| View previous topic :: View next topic |
| Author |
Message |
homemister
Joined: 24 Mar 2008 Posts: 25
|
Posted: Tue Jul 22, 2008 9:43 pm Post subject: Load PRX from Eboot |
|
|
Hi all,
I am trying to include prx files into my eboot using bin/o and then load them into kernel memory when they are needed.
i use this function to store the prx file in the eboot.
syslib.o : syslib.prx
bin2o -i syslib.prx syslib.o syslib
But how do i load if from the memory?
Regards
Homemister |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Tue Jul 22, 2008 9:53 pm Post subject: |
|
|
Hi! :)
I never used bin2o, but if it works like bin2c it should declare a variable named as the label parameter:
| Code: | | static unsigned char label[] __attribute__((aligned(16))) |
Ciaooo
Sakya |
|
| Back to top |
|
 |
homemister
Joined: 24 Mar 2008 Posts: 25
|
Posted: Tue Jul 22, 2008 9:59 pm Post subject: |
|
|
| how do you do bin2c? |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Tue Jul 22, 2008 10:04 pm Post subject: |
|
|
Hi! :)
| homemister wrote: | | how do you do bin2c? |
Almost the same way you used bin2o: :)
| Code: | | bin2c syslib.prx syslib.h syslib |
And you get a header file with the declaration of
| Code: | static unsigned char syslib[] __attribute__((aligned(16))) = {
....
}; |
Ciaooo
Sakya |
|
| Back to top |
|
 |
homemister
Joined: 24 Mar 2008 Posts: 25
|
Posted: Wed Jul 23, 2008 7:35 pm Post subject: |
|
|
how do i then load it into the kernal memory?
Sorry for all of the trouble, but i have never done this before. |
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Wed Jul 23, 2008 9:11 pm Post subject: |
|
|
Hi! :)
| homemister wrote: | how do i then load it into the kernal memory?
Sorry for all of the trouble, but i have never done this before. |
Sorry, I don't know if it is possible to load a prx from memory and not from ms/flash.
If there's no way to do this I think you can at last save the data to a file and then load it. ;)
EDIT: Try to have a look to this function:
| Code: | /**
* Load a module from a buffer using the USB/WLAN API.
*
* Can only be called from kernel mode, or from a thread that has attributes of 0xa0000000.
*
* @param bufsize - Size (in bytes) of the buffer pointed to by buf.
* @param buf - Pointer to a buffer containing the module to load. The buffer must reside at an
* address that is a multiple to 64 bytes.
* @param flags - Unused, always 0.
* @param option - Pointer to an optional ::SceKernelLMOption structure.
*
* @returns The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
*/
SceUID sceKernelLoadModuleBufferUsbWlan(SceSize bufsize, void *buf, int flags, SceKernelLMOption *option); |
But if this function works only in kernel mode you'll need a kernel prx to use it...so the problem isn't solved. :)
Ciaooo
Sakya |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Thu Jul 31, 2008 12:06 pm Post subject: |
|
|
You can write the bin2o variable to a temporary file in ms0:/ and load it normally, then delete it.
Thats what IRShell does to continue running in the background after launching a game. |
|
| Back to top |
|
 |
homemister
Joined: 24 Mar 2008 Posts: 25
|
Posted: Thu Jul 31, 2008 6:38 pm Post subject: |
|
|
sorry for this question. But i am still learing about bin2c and bin2o.
How would i write the bin2o file to the memory stick? |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Fri Aug 01, 2008 12:22 am Post subject: |
|
|
In your program, in the global area, declare the following
extern unsigned char syslib_start[];
extern u32 syslib_size[];
Then you can write it to a file using sceIoWrite(fp, syslib_start, syslib_size); |
|
| Back to top |
|
 |
homemister
Joined: 24 Mar 2008 Posts: 25
|
Posted: Sat Aug 02, 2008 11:02 am Post subject: |
|
|
| Thx verry much Torch. |
|
| Back to top |
|
 |
Mashphealh
Joined: 28 Nov 2007 Posts: 18
|
Posted: Thu Aug 07, 2008 2:44 am Post subject: |
|
|
You also can use this :
| Code: |
int LoadStartModuleBuffer(void *buffer, int size, int a2)
{
SceUID v0 = vshKernelLoadModuleBufferVSH(size, buffer, 0, 0) < 0) return -1;
if(v0 < 0)
return -1;
if(a2 == 0)
return sceKernelStartModule(v0, 0, 0, 0, 0);
return 0;
}
|
In my SDK, the function vshKernelLoad... hasn't been defined, so you can use a paralel function found at pspmodulemgr_kernel.h , his name is sceKernelLoadModuleBuffer.
Personally, I didn't test it function, and I don't know if that function will work in vsh mode.
The usage of LoadStartModuleBuffer is easy, just write LoadStartModuleBuffer(buffer, sizeof(buffer), 0); |
|
| Back to top |
|
 |
|