| View previous topic :: View next topic |
| Author |
Message |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Tue Feb 26, 2008 11:14 pm Post subject: 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 ? |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Thu Feb 28, 2008 9:14 am Post subject: |
|
|
| Use sceIoChstat to change the file attributes, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 4:51 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 6:25 am Post subject: |
|
|
| sceIoChstat does work because I'm using it for exactly the same reason in my own theme flasher, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 6:32 am Post subject: |
|
|
so when and how you use it..
just before deleting file doesn't work.
juste before replacing file or write in... doesn't work |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 6:45 am Post subject: |
|
|
| You need to use SceIoStat and sceIoChstat before sceIoRemove |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 7:58 am Post subject: |
|
|
... *cry*
ok I just try to make a fonction
| Code: | 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);
}
} |
but
| Code: | Remove_file("flash0:/vsh/module/vshmain.prx");
Remove_file("flash0:/vsh/module/paf.prx"); |
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 ? |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 8:11 am Post subject: |
|
|
This works for me...
| Code: |
SceIoStat stats;
sceIoChstat( file_path, &stats, 0x0003);
sceIoRemove(file_path);
|
|
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 8:27 am Post subject: |
|
|
just try with
| Code: | 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);
}
} |
but ...
flash0:/vsh/module/vshmain.prx - Cannot delete file... |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 8:39 am Post subject: |
|
|
Have you unassigned and assigned flash0 ?
Also what mode is your app in ? |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 8:43 am Post subject: |
|
|
Flash0 is unassign and re-assigned without error
| Code: | if (sceIoUnassign("flash0:") < 0)
printf("F0unassign: Error | ");
if (sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0) < 0)
{
printf("F0assign: Error\n");
} |
and i'm in
| Code: | PSP_MODULE_INFO("flash", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0); |
tested in 0x0800 too |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 8:49 am Post subject: |
|
|
This is what I have,
| Code: |
PSP_MODULE_INFO("Write2Flash380", 0x800, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
PSP_HEAP_SIZE_MAX();
|
Also using the code I posted before seems to work fine and has been tested on 3.80m33-x and 3.90m33-x |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 9:05 am Post subject: |
|
|
no way for me.
I don't understand... |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 9:17 am Post subject: |
|
|
Try closing the file after you have checked that it exists,
Then do the attribute change and delete, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 9:21 am Post subject: |
|
|
i hav by-pass this fonction.
Eboot not check if file exist, just check if file sceIoRemove return no error.
| Code: | 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);
}
} |
i'll try to install 3.90M33 ... sniff i love my 3.80...
[edit]
Same way in 3.90M33-2 k1.50v2 |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 9:55 am Post subject: |
|
|
tested on my second PSP FAT just passed on 3.90M33-2 too...
cannot delete file... |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 11:15 am Post subject: |
|
|
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, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 11:26 am Post subject: |
|
|
and could you copy file into vsh/module or files go in vsh/podule like on my psp ?
that's really strange. M33 be hard-protected... |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 11:42 am Post subject: |
|
|
It's wierd because the theme flashing works fine well it seems to be but when in the file browser (another feature of the app) I sometimes get wierd results using my file copy, file paste and delete features,
It's strange, lol
I'm going to have to take a look at it again when I'm not so sleepy, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 11:51 am Post subject: |
|
|
all other flashing procedure works fine.
but not in this F*** directory... |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 11:55 am Post subject: |
|
|
I will PM you a link to my app if you want so you can see what I mean,
Its strange how it deletes it on the 2nd attempt when in the file browser, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 12:00 pm Post subject: |
|
|
| thanks and i'll try with IRShell too when go!messenger installation finished -_- |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 12:10 pm Post subject: |
|
|
| PM has been sent, |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Fri Feb 29, 2008 12:22 pm Post subject: |
|
|
| Tested, and that's work on your app... but I don't understand why only in your app |
|
| Back to top |
|
 |
Gh0st-UPMS
Joined: 17 Feb 2008 Posts: 23
|
Posted: Fri Feb 29, 2008 4:48 pm Post subject: |
|
|
| Alree wrote: | | Tested, and that's work on your app... but I don't understand why only in your app |
Try this code, works for me.
| Code: |
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);
}
} |
|
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri Feb 29, 2008 8:45 pm Post subject: |
|
|
Just tested the code and it works perfectly,
Thanks Gh0st-UPMS |
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Sat Mar 01, 2008 12:15 am Post subject: |
|
|
Just tested, same way...
I have flashed a dummy.txt file in flash0:/vsh/module but Cannot delete
| Code: |
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);
// }
} |
|
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Sat Mar 01, 2008 3:02 am Post subject: |
|
|
@Alree - This worked fine for me,
| Code: |
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);
|
|
|
| Back to top |
|
 |
Alree
Joined: 26 Feb 2008 Posts: 33
|
Posted: Sat Mar 01, 2008 3:34 am Post subject: |
|
|
well ...
| Code: |
#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;
}
|
any suggestion that's doesn't work ? |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Sat Mar 01, 2008 3:58 am Post subject: |
|
|
| Alree wrote: | | Tested, and that's work on your app... but I don't understand why only in your app |
So it's maybe a SDK or compiler problem, try to update PSPSDK. |
|
| Back to top |
|
 |
|