About sceKernelLoadExec()...

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

Moderators: cheriff, TyRaNiD

Post Reply
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

About sceKernelLoadExec()...

Post by Ghozt »

How come you can only use sceKernelLoadExec() to boot a UMD in usermode and not in kernelmode? And why can you only boot eboots from the ms with sceKernelLoadExec() in kernelmode?

While we're already talking about it what can you boot with LoadStartModule() ?? Can you boot umds in kernelmode with LoadStartModule() ?? Does LoadStartModule() the same thing as sceKernelLoadModule() and sceKernelStartModule() combined??
Does anyone got any good examples of using LoadStartModule() on a eboot on the ms and/or boot the UMD??

If non of the things above works booting umds in kernelmode what code should you use too boot the boot.bin on a UMD (in kernelmode) ??

And how does multi-threading work?

Sorry for alle the (noob) questions.
Thanks in Advance!
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

If you want a function similar to sceKernelLoadExec that let you boot both boot.bin and eboot.bin in kernel mode, it exists: it's the undocumented sceKernelLoadExecVSHDisc:

Its definition and usage (the same than loadexec, it has more fields in the struct, but who knows what they are for...):

Code: Select all

struct SceKernelLoadExecVSHParam {
/* Size of structure in bytes */
    SceSize     size; 
/* Size of the arguments string */
    SceSize     args;
/* Pointer to the arguments strings */
    void * argp;
/* "game", "updater" or "vsh" */
    const char * key;
/* unknown, it seems to be some kind of flag. the firmware set it to 
   0x00000400. it looks like is related with the next fields of the 
   structure, it's better to set it to 0 if we don't know how to use 
   those fields */
    u32 unk1;
/* unknown, the firmware always set it to 0x09CF344C, which seems to 
   be a pointer */
    void *unk2;
/* unknown. the firmware sets it to 0 */
    u32 unk3;
/* unknown. the firmware sets it to 0 */
    u32 unk4;
/* unknown. the firmware sets it to 0 */
    u32 unk5;
};

int sceKernelLoadExecVSHDisc(const char *file, struct SceKernelLoadExecVSHParam *param);


int main()
{
	struct SceKernelLoadExecVSHParam  param;
	char *eboot = "disc0:/PSP_GAME/SYSDIR/EBOOT.BIN";

	memset(&param, 0, sizeof(param));
	param.size = sizeof(param);
	param.argp = eboot;
	param.args = strlen(eboot)+1;
	param.key = "game";

	if &#40;sceKernelLoadExecVSHDisc&#40;eboot, &param&#41; < 0&#41;
	&#123;
		pspDebugScreenInit&#40;&#41;;
		printf&#40;"error"&#41;;		
	&#125;

	return 0;
&#125;
This function cannot be called in usermode (well, actually the firmware calls it in vsh mode, but not directly, it calls to a function of the sceVshBridge_driver that simply calls this function)
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Post by Ghozt »

Thanks a lot! That really helped!
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Post by Ghozt »

hmm, I have a problem. Booting via eboot.bin works fine but using boot.bin gives me the error: "The game could not be started (80020148)"

This is the code I used (it is exactly the same as yours except that I changed eboot.bin to boot.bin):

Code: Select all

			struct SceKernelLoadExecVSHParam  param;
   			char *eboot = "disc0&#58;/PSP_GAME/SYSDIR/BOOT.BIN";

   			memset&#40;&param, 0, sizeof&#40;param&#41;&#41;;
   			param.size = sizeof&#40;param&#41;;
   			param.argp = eboot;
   			param.args = strlen&#40;eboot&#41;+1;
   			param.key = "game";

   			if &#40;sceKernelLoadExecVSHDisc&#40;eboot, &param&#41; < 0&#41;
   			&#123;
      		pspDebugScreenInit&#40;&#41;;
      		screenblit&#40;0, 0, 480, 272, insert_umd&#41;;
			flipScreen&#40;&#41;;     
   			&#125; 
According to this page: http://forums.qj.net/showthread.php?t=4 ... t=80020148
that error means unsupported prx type. What is the problem??

btw. Thanks again!
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Maybe i was wrong, and it only works with eboots, i'll check it

The unsupported prx type is because the firmware doesn't recognize the file as an executable because it's not encrypted...
Last edited by moonlight on Fri Apr 14, 2006 8:04 pm, edited 1 time in total.
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Post by Ghozt »

moonlight wrote:Maybe i was wrong, and it only works with eboots, i'll check it

The unsupported prx type is because the firmware doesn't recognize the file as an executable because it's not encrypted...

But the strange thing is that it can execute elf's not encrypted from the memorystick, lol, sony is weird
It seems the function can only execute encrypted files. I just tryed this:

Code: Select all

			struct SceKernelLoadExecVSHParam  param;
   			char *eboot = "ms0&#58;/PSP/GAME/MPHGAMELOADER/EBOOT.PBP";

   			memset&#40;&param, 0, sizeof&#40;param&#41;&#41;;
   			param.size = sizeof&#40;param&#41;;
   			param.argp = eboot;
   			param.args = strlen&#40;eboot&#41;+1;
   			param.key = "game";

   			if &#40;sceKernelLoadExecVSHDisc&#40;eboot, &param&#41; < 0&#41;
   			&#123;
      		pspDebugScreenInit&#40;&#41;;
      		printf&#40;"error"&#41;;
			flipScreen&#40;&#41;;     
   			&#125; 
That didn't work either. Still the 80020146 error.

btw. is there a way to start mphgl at all since when you use sceKernelLoadExec() MPHGL freezes when it showing the text (You know, MPH Game Loader 1.1 etc.)
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Ghozt wrote: btw. is there a way to start mphgl at all since when you use sceKernelLoadExec() MPHGL freezes when it showing the text (You know, MPH Game Loader 1.1 etc.)
switch wlan = on
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Post by Ghozt »

moonlight wrote:switch wlan = on
I knew it was something simple =P Thanks!

There isn't possibly any other way to load a umd using boot.bin??
Post Reply