How to change vsh/module attibut
How to change vsh/module attibut
Hi !
Does anyone know how to remove a *.prx file into flash0:/vsh/module directory.
until 3.71m33 this directory is Hidden and in ReadOnly mode
I just want to be able to delete/replace some files in this folder but... that's doesn't work.
ex:
I juste make a dummy.txt file inside vsh/module via Windows
With sceIoRemove I can't remove this file...
sceIoRemove return no error ...
Any idea ? flash0 is already assigned with 0777 attribut
it's possible to replace vshmain.prx and paf.prx via an eboot in kernel mode ?
			
			
									
									
						Does anyone know how to remove a *.prx file into flash0:/vsh/module directory.
until 3.71m33 this directory is Hidden and in ReadOnly mode
I just want to be able to delete/replace some files in this folder but... that's doesn't work.
ex:
I juste make a dummy.txt file inside vsh/module via Windows
With sceIoRemove I can't remove this file...
sceIoRemove return no error ...
Any idea ? flash0 is already assigned with 0777 attribut
it's possible to replace vshmain.prx and paf.prx via an eboot in kernel mode ?
thanks but that's doesn't work...
so I can't remove or replace file in flash0:/vsh/module directory
sceIoRemove("flash0:/vsh/module/paf.prx")
sceIoOpen('flash0:/vsh/module/paf.prx", PSP_O_RDONLY, 0777);
return error...
So if I can't remove or open it's impossible to me to write a new one.
I just want to finish a Theme Flasher who can flash paf.prx and vshmain.prx
So if I want to copy a dummy file in flash0:/vsh/module/ dummy file go in vsh/podule ! WTF ?
i'm in PSP1004 FAT 3.80M33-5 with Kernel 1.50
			
			
									
									
						so I can't remove or replace file in flash0:/vsh/module directory
sceIoRemove("flash0:/vsh/module/paf.prx")
sceIoOpen('flash0:/vsh/module/paf.prx", PSP_O_RDONLY, 0777);
return error...
So if I can't remove or open it's impossible to me to write a new one.
I just want to finish a Theme Flasher who can flash paf.prx and vshmain.prx
So if I want to copy a dummy file in flash0:/vsh/module/ dummy file go in vsh/podule ! WTF ?
i'm in PSP1004 FAT 3.80M33-5 with Kernel 1.50
... *cry*
ok I just try to make a fonction
but 
return "File not found or Already Deleted"
I've try without the file_exist test but same way... the PRX was not deleted...
any idea ?
			
			
									
									
						ok I just try to make a fonction
Code: Select all
void Remove_file(char * Delfile)
{
int file_exist,test_del;;
file_exist = sceIoOpen(Delfile, PSP_O_RDONLY, 0777);
	if (file_exist>=0){
		SceIoStat stat;
		memset(&stat, 0, sizeof(SceIoStat));
		sceIoGetstat(Delfile, &stat);
		stat.st_attr &= ~0x0F;
		sceIoChstat(Delfile, &stat, 3);
		test_del = sceIoRemove(Delfile);
			if (test_del<0){
				pspDebugScreenSetTextColor(0x000000FF);
				printf("%s - Cannot delete file\n", Delfile);
			}
			else {
				pspDebugScreenSetTextColor(0x0000FF00);
				printf("%s - File Deleted OK\n", Delfile);
			}
	}
	else {
	pspDebugScreenSetTextColor(0x00303030);
	printf("%s - File not found or already Deleted\n", Delfile);
	}
}Code: Select all
Remove_file("flash0:/vsh/module/vshmain.prx");
Remove_file("flash0:/vsh/module/paf.prx");I've try without the file_exist test but same way... the PRX was not deleted...
any idea ?
This works for me...
			
			
									
									
						Code: Select all
SceIoStat stats;
sceIoChstat( file_path, &stats,  0x0003);
sceIoRemove(file_path);
just try with
but ... 
flash0:/vsh/module/vshmain.prx - Cannot delete file...
			
			
									
									
						Code: Select all
void Remove_file(char * Delfile)
{
int test_del;;
		SceIoStat stat;
		sceIoChstat(Delfile, &stat,  0x0003); 
		test_del = sceIoRemove(Delfile);
			if (test_del<0){
				pspDebugScreenSetTextColor(0x000000FF);
				printf("%s - Cannot delete file\n", Delfile);
			}
			else {
				pspDebugScreenSetTextColor(0x0000FF00);
				printf("%s - File Deleted OK\n", Delfile);
			}
}flash0:/vsh/module/vshmain.prx - Cannot delete file...
Flash0 is unassign and re-assigned without error
and i'm in
tested in 0x0800 too
			
			
									
									
						Code: Select all
if (sceIoUnassign("flash0:") < 0)
	printf("F0unassign: Error | ");
if (sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0) < 0)
	{
		printf("F0assign: Error\n");
	}Code: Select all
PSP_MODULE_INFO("flash", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);This is what I have,
Also using the code I posted before seems to work fine and has been tested on 3.80m33-x and 3.90m33-x
			
			
									
									
						Code: Select all
PSP_MODULE_INFO("Write2Flash380", 0x800, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
PSP_HEAP_SIZE_MAX();
i hav by-pass this fonction.
Eboot not check if file exist, just check if file sceIoRemove return no error.
i'll try to install 3.90M33 ... sniff i love my 3.80...
[edit]
Same way in 3.90M33-2 k1.50v2
			
			
									
									
						Eboot not check if file exist, just check if file sceIoRemove return no error.
Code: Select all
void Remove_file(char * Delfile)
{
int test_del;;
		SceIoStat stat;
		sceIoChstat(Delfile, &stat, 0x0003);
		test_del = sceIoRemove(Delfile);
			if (test_del<0){
				pspDebugScreenSetTextColor(0x000000FF);
				printf("%s - Cannot delete file\n", Delfile);
			}
			else {
				pspDebugScreenSetTextColor(0x0000FF00);
				printf("%s - File Deleted OK\n", Delfile);
			}
}[edit]
Same way in 3.90M33-2 k1.50v2
I just did a few tests with the code and it seems I'm also now getting strange results,
I created 4 read only txt files and tried to delete one and it would not delete until I tried to delete the 2nd time,
But I can then delete any of the other read only files in one go,
Seems strange to me so I will try to work it out,
			
			
									
									
						I created 4 read only txt files and tried to delete one and it would not delete until I tried to delete the 2nd time,
But I can then delete any of the other read only files in one go,
Seems strange to me so I will try to work it out,
- 
				Gh0st-UPMS
- Posts: 23
- Joined: Sun Feb 17, 2008 12:32 am
Try this code, works for me.Alree wrote:Tested, and that's work on your app... but I don't understand why only in your app
Code: Select all
PSP_MODULE_INFO("Your App Name", 0x800, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
PSP_HEAP_SIZE_KB(21000);
void ReassignFlash0() 
{
	int flash0_unassign, flash0_assign;
	
  flash0_unassign = sceIoUnassign("flash0:");
  flash0_assign = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
	
	if(flash0_unassign < 0){
			pspDebugScreenClear();
			printf("  Error: Unassigning Flash0\n");
			sceKernelDelayThread(500000);
			sceKernelExitGame();
		}
	else if(flash0_assign < 0){
			pspDebugScreenClear();
			printf("  Error: Assigning Flash0\n");
			sceKernelDelayThread(500000);
			sceKernelExitGame();
		}
		else{
				printf("  Flash assigned\n");
			}
}
void removeStatus(const char *file)
{
	int fileDelete;
	
	SceIoStat stat;
	memset(&stat, 0, sizeof(SceIoStat));
	sceIoGetstat(file, &stat);
	stat.st_attr &= ~0xFF;
	sceIoChstat(file, &stat, 3);//Hidden Stat
	sceIoChstat(file, &stat, 4);//Archive Stat
	sceIoChstat(file, &stat, 6);//Read Only Stat
	
	fileDelete = sceIoRemove(file);
	if(fileDelete < 0){
		sceKernelDelayThread(300000);
		printf("%s: Deleted unsuccessful", file);
	}
	else {
		sceKernelDelayThread(300000);
		printf("%s: was deleted successfully", file);
	}
}Just tested, same way...
I have flashed a dummy.txt file in flash0:/vsh/module but Cannot delete
			
			
									
									
						I have flashed a dummy.txt file in flash0:/vsh/module but Cannot delete
Code: Select all
PSP_MODULE_INFO("fnof", 0x800, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
PSP_HEAP_SIZE_KB(21000); 
int main(void) 
{ 
   pspDebugScreenInit(); 
pspDebugScreenClear();
pspDebugScreenSetTextColor(0x00FFFFFF);
   int flash0_unassign, flash0_assign;
   
  flash0_unassign = sceIoUnassign("flash0:");
  flash0_assign = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
   
   if(flash0_unassign < 0){
         pspDebugScreenClear();
         printf("  Error: Unassigning Flash0\n");
         sceKernelDelayThread(500000);
         sceKernelExitGame();
      }
   else if(flash0_assign < 0){
         pspDebugScreenClear();
         printf("  Error: Assigning Flash0\n");
         sceKernelDelayThread(500000);
         sceKernelExitGame();
      }
      else{
            printf("  Flash assigned\n");
         } 
printf("\n\nFlashage en Cours...\n"); 
sceKernelDelayThread(100*1000); 
Remove_file("flash0:/vsh/module/dummy.txt");
sceKernelDelayThread(1000*10000); 
pspDebugScreenSetTextColor(0x00FFFFFF);
printf("Operation terminee");
return 0;
}
void Remove_file(char * Delfile)
{
//int file_exist;
int test_del;;
//file_exist = sceIoOpen(Delfile, PSP_O_RDONLY, 0777);
//	if (file_exist>=0){
   SceIoStat stat;
   memset(&stat, 0, sizeof(SceIoStat));
   sceIoGetstat(Delfile, &stat);
   stat.st_attr &= ~0xFF;
   sceIoChstat(Delfile, &stat, 3);//Hidden Stat
   sceIoChstat(Delfile, &stat, 4);//Archive Stat
   sceIoChstat(Delfile, &stat, 6);//Read Only Stat 
		test_del = sceIoRemove(Delfile);
			if (test_del<0){
				pspDebugScreenSetTextColor(0x000000FF);
				printf("%s - Cannot delete file\n", Delfile);
			}
			else {
				pspDebugScreenSetTextColor(0x0000FF00);
				printf("%s - File Deleted OK\n", Delfile);
			}
//	}
//	else {
//	pspDebugScreenSetTextColor(0x00303030);
//	printf("%s - File not found or already Deleted\n", Delfile);
//	}
}@Alree - This worked fine for me,
			
			
									
									
						Code: Select all
SceIoStat stats;
memset( &stats, 0, sizeof(SceIoStat));
sceIoGetstat( file_path, &stats);
stats.st_attr &= ~0x0F;    // This line is differant from the example given by Gh0st-UPMS
sceIoChstat( file_path, &stats,  3);
sceIoChstat( file_path, &stats,  4);
sceIoChstat( file_path, &stats,  6);
sceIoRemove( file_path);
well ...
any suggestion that's doesn't work ?
			
			
									
									
						Code: Select all
  
#include <pspkernel.h> 
#include <pspctrl.h>
#include <pspsdk.h>
#include <pspiofilemgr.h> 
#include <stdlib.h> 
#include <string.h> 
#include <stdio.h> 
#include <pspgu.h> 
#include <psputils.h>
//#include <stdarg.h>
#include <pspmoduleinfo.h>
#define printf pspDebugScreenPrintf 
PSP_MODULE_INFO("fnof", 0x800, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
PSP_HEAP_SIZE_KB(21000); 
void Remove_file(char * Delfile)
{
int test_del;;
SceIoStat stats;
sceIoGetstat( Delfile, &stats);
stats.st_attr &= ~0x0F;    // This line is differant from the example given by Gh0st-UPMS
sceIoChstat( Delfile, &stats,  3);
sceIoChstat( Delfile, &stats,  4);
sceIoChstat( Delfile, &stats,  6);
		test_del = sceIoRemove(Delfile);
			if (test_del<0){
				pspDebugScreenSetTextColor(0x000000FF);
				printf("%s - Cannot delete file\n", Delfile);
			}
			else {
				pspDebugScreenSetTextColor(0x0000FF00);
				printf("%s - File Deleted OK\n", Delfile);
			}
}
int main(void) 
{ 
pspDebugScreenInit(); 
pspDebugScreenClear();
pspDebugScreenSetTextColor(0x00FFFFFF);
   int flash0_unassign, flash0_assign;
   
  flash0_unassign = sceIoUnassign("flash0:");
  flash0_assign = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
   
   if(flash0_unassign < 0){
         pspDebugScreenClear();
         pspDebugScreenSetTextColor(0x0000FF00);
         printf("Error: Unassigning Flash0\n");
         sceKernelDelayThread(500000);
         sceKernelExitGame();
      }
   else if(flash0_assign < 0){
         pspDebugScreenClear();
           pspDebugScreenSetTextColor(0x000000FF);
         printf("Error: Assigning Flash0\n");
         sceKernelDelayThread(500000);
         sceKernelExitGame();
      }
      else{
           pspDebugScreenSetTextColor(0x0000FF00);
		   printf("Flash assigned\n");
         }
pspDebugScreenSetTextColor(0x00FFFFFF);		 
printf("\n\nFlashage en Cours...\n"); 
sceKernelDelayThread(100*1000); 
Remove_file("flash0:/vsh/module/dummy.txt");
sceKernelDelayThread(1000*10000); 
pspDebugScreenSetTextColor(0x00FFFFFF);
printf("Operation terminee");
return 0;
}