problem flashing camera_plugin.rco from flash0

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

problem flashing camera_plugin.rco from flash0

Post by PsPfReAK »

well camera_plugin.rco wont flash from flash0, it copies with 0bytes why is this?

any help?
Last edited by PsPfReAK on Thu Apr 23, 2009 2:06 am, edited 1 time in total.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Do you sceIOClose the file somewhere?

Jim
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

Jim wrote:Do you sceIOClose the file somewhere?

Jim
i do this

Code: Select all

printf("\n Assigning Flash");
	if &#40;sceIoUnassign&#40;"flash0&#58;"&#41; < 0&#41;
                        printf&#40;"Cannot Un-Assign flash0&#58;"&#41;;
                        if &#40;sceIoAssign&#40;"flash0&#58;", "lflash0&#58;0,0", "flashfat0&#58;", IOASSIGN_RDWR, NULL, 0&#41; < 0&#41; &#123;
                                             printf&#40;"Error Assigning flash0 in write mode"&#41;; &#125;
       printf&#40;"Flash Assigned...\n\n"&#41;;
    printf&#40;"\n Flashing camera plugins "&#41;;
	copyFile&#40;"flash0&#58;/vsh/module/camera_plugin.prx", "ms0&#58;/camera_plugin.prx"&#41;;
	copyFile&#40;"flash0&#58;/vsh/resource/camera_plugin.rco", "ms0&#58;/camera_plugin.rco"&#41;;
	sceIoClose;
	printf&#40;"done"&#41;;
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

There is no access to flash0:/ from even a kernel module or user module. You unassign and reassign must be failing, but the code you've given just prints an error and continues without stopping. You can use one of these methods.

1) If you are just making an EBOOT application, then instead of making it user mode, make it VSH mode by giving 0x800 in PSP_MODULE_INFO("flash0w", 0x800, 1, 0);

Now you can unassign and reassign then freely read and write flash0:/.

2) If you are making a user mode prx or an EBOOT, then load DAX's iop.prx first. It comes with his LEDA application.

3) If you are making a kernel mode prx then #include <systemctrl.h> and add -lpspsystemctrl_kernel to your makefile libs. Then call this before assign, or open file, or read, or write.

int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);

sceIoOpen(...);

sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

Torch wrote:There is no access to flash0:/ from even a kernel module or user module. You unassign and reassign must be failing, but the code you've given just prints an error and continues without stopping. You can use one of these methods.

1) If you are just making an EBOOT application, then instead of making it user mode, make it VSH mode by giving 0x800 in PSP_MODULE_INFO("flash0w", 0x800, 1, 0);

Now you can unassign and reassign then freely read and write flash0:/.

2) If you are making a user mode prx or an EBOOT, then load DAX's iop.prx first. It comes with his LEDA application.

3) If you are making a kernel mode prx then #include <systemctrl.h> and add -lpspsystemctrl_kernel to your makefile libs. Then call this before assign, or open file, or read, or write.

int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);

sceIoOpen(...);

sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);
its an eboot.
but i am in vsh mode because it copys over camera_plugin.prx but not camera_plugin.rco....
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

this:
sceIoClose;
does nothing.

Jim
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

Jim wrote:this:
sceIoClose;
does nothing.

Jim
i figured that out, but how do i flash the camera_plugin.rco?
do i need to change the copy code?

how do i call iop.prx that torch mentioned?
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

okay this is gettng annoying, i called the iop.prx, it loaded it but still only flashed the camera_plugin.prx but it left the camera_plugin.rco empty

whats going on here?
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

okay i found out my flash isnt un assigning, this is my code

Code: Select all

 p2c&#40;" - Assigning flash0....\n "&#41;;
						sceKernelDelayThread&#40;1000000&#41;;
                        if &#40;sceIoUnassign&#40; "flash0&#58;" &#41; < 0&#41;
                        errorExit&#40;"Cannot Unassign Flash0\n"&#41;;
                        if &#40;sceIoAssign&#40; "flash0&#58;", "lflash0&#58;0,0", "flashfat0&#58;", IOASSIGN_RDWR, NULL, 0 &#41; < 0&#41; &#123;
                                             errorExit&#40;"Cannot Assign Flash0 In Write Mode\n"&#41;; &#125;
whats wrong with it?
my eboot has the 0x800 flag at the begining...
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

What error code are you getting from it?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Try making it usermode with iop.prx. Though I know that you CAN assign/unassign from a VSH mode eboot.
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

dont worry about the assigning problem, turned out that i was giving my psp to many kernal commands, i think....
im still trying to get that camera_plugin.rco though, still no hope
also
int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);

sceIoOpen(...);

sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);
where eactly does this go, before i assign thew flash?
and sceIoOpen(...); <--is that the part where i flash the files or do i open iop.prx?
EDIT- solved, thank you very much for your help
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

okay, another error, when i use the code above when i try to assign flasho afterwards it wont let me, its say cannot un-assign flash....
any suggestions?
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

okay when i use this before assigning

int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);

sceIoOpen("flash0:/vsh/camera_plugin.rco", PSP_O_RDONLY, 0777);

sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);

it wont let me un assign flash

so can someone tell me how to do it, like ive tried everything i can think off
this is it currently


int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);

sceIoOpen("flash0:/vsh/camera_plugin.rco", PSP_O_RDONLY, 0777);

sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);

pspSdkLoadStartModule("iop.prx", PSP_MEMORY_PARTITION_KERNEL);
p2c(" Assigning flash0....\n ");
if (sceIoUnassign("flash0:") < 0)
errorExit("Cannot Un-Assign flash0:");
if (sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0) < 0) {
errorExit("Error Assigning flash0 in write mode"); }
p2c(" Flash Assigned\n");
copyFile("flash0:/vsh/module/camera_plugin.prx", "ms0:/camera_plugin.prx");
copyFile("flash0:/vsh/resource/camera_plugin.rco", "ms0:/camera_plugin.rco");

but yet it only copies the prx

its a eboot it vsh mode (0x800)

can anyone help?
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

:@

Post by PsPfReAK »

so your saying no one knows how to this?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Theres no need for VSH mode 0x800 if you are using iop.prx, make it user mode 0x0
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

still in user mode it wont let me unnassign flash0
it only does this when this is in

int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);

sceIoOpen("flash0:/vsh/camera_plugin.rco", PSP_O_RDONLY, 0777);

sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);

so how should i go about it?



any help!!!!
Last edited by PsPfReAK on Wed Apr 22, 2009 6:47 am, edited 1 time in total.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

First of all how can you call sctrlKernelSetUserLevel from a user mode prx?? I'm not at my dev PC but I'm pretty sure its a kernel only export.

If you're in kernel mode then iop.prx won't work.
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

O.o

Post by PsPfReAK »

well, it works when i go to test m33 but when i test it in the actual psp it still only copies the prx not the rco
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

You still are not closing the files!
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Thats probably because of the permissions of the files. Test M33 or DC installed firmware sets all permissions on the files to 0777 which is full access.
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

Post by PsPfReAK »

@jim

where do i close them

in the flashing code or where i actually flash it?

SOLVED

i just rewrite the copy code
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

For every file you handle=sceIoOpen, you should have a matching call to sceIoClose(handle). I'm not saying it'll fix your problem, but there are a limited number of file handles available (32?) and once they are all gone you won't be able to open any more files ever.

Jim
Post Reply