forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

About sceKernelLoadExec()...

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Fri Apr 14, 2006 2:04 am    Post subject: About sceKernelLoadExec()... Reply with quote

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!
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Fri Apr 14, 2006 5:18 am    Post subject: Reply with quote

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:

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 (sceKernelLoadExecVSHDisc(eboot, &param) < 0)
   {
      pspDebugScreenInit();
      printf("error");      
   }

   return 0;
}


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)
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Fri Apr 14, 2006 5:54 am    Post subject: Reply with quote

Thanks a lot! That really helped!
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Fri Apr 14, 2006 6:18 am    Post subject: Reply with quote

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:

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

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

            if (sceKernelLoadExecVSHDisc(eboot, &param) < 0)
            {
            pspDebugScreenInit();
            screenblit(0, 0, 480, 272, insert_umd);
         flipScreen();     
            }


According to this page: http://forums.qj.net/showthread.php?t=40375&highlight=80020148
that error means unsupported prx type. What is the problem??

btw. Thanks again!
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Fri Apr 14, 2006 6:30 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Fri Apr 14, 2006 7:26 am    Post subject: Reply with quote

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:

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

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

            if (sceKernelLoadExecVSHDisc(eboot, &param) < 0)
            {
            pspDebugScreenInit();
            printf("error");
         flipScreen();     
            }


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.)
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Fri Apr 14, 2006 8:03 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Fri Apr 14, 2006 8:10 am    Post subject: Reply with quote

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??
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group