 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Devun_06
Joined: 17 Jun 2006 Posts: 15
|
Posted: Sat Jun 17, 2006 7:14 pm Post subject: PRX & Moduling Help |
|
|
I'm trying to get my homebrew to load other eboots and call itself back up upon the exiting of the eboot my homebrew has loaded, but so far... I can't even tackle my first attempt at this moduling thing... can some one help me with this... my code doesn't look wrong to me.
Execution:
| Code: | //////////////////////Loading a PRX
int LoadAndStartModule_PRX(char *ModuleFILE, int UserMode)//UserMode mode: 1==true; 0 == false;
{//start moduling
SceKernelLMOption moduleprx;
moduleprx.mpidtext = (UserMode+1);// 2 is equivalent to usermode ;)
moduleprx.mpiddata = (UserMode+1);// 2 is equivalent to usermode ;)
moduleprx.position = 0;
moduleprx.access = 1;
moduleprx.size = sizeof(moduleprx);
SceUID PrxID=0;
PrxID = sceKernelLoadModuleMs(ModuleFILE,0,UserMode > 0 ? &moduleprx : NULL);// If in usermode, don't call as NULL >:// this carrys MS for Memory Stick ;)
int prxstatus=-1;
if( ( sceKernelStartModule (PrxID, 0,NULL,&prxstatus,NULL) ) !=0)// it was :if( ( sceKernelStartModule (PrxID, 0,NULL,&prxstatus,moduleprx) ) !=0)
{//I think this is an okay error check<-
//do nothing until necessary... :), but this is on an errors existance
}//last argument is 0 for usermode! #3 is NULL becaus it's okay, and I don't know wtf it's it's honestly asking for... :'(
//Finish MODULING: Stop & Unload Relative MODULE
sceKernelStopModule(PrxID, 0, NULL,&prxstatus,NULL);// it was:sceKernelStopModule(PrxID, 0, NULL,&prxstatus,moduleprx);
sceKernelUnloadModule(PrxID);
return prxstatus;
}//end moduling
//////////////////////Loading a PRX |
Preperation:
| Code: | | if(Controller.Buttons & PSP_CTRL_LTRIGGER){LoadAndStartModule_PRX("ms0:/XT1_Module.prx", 0);} |
* I'm using the Sample PRX Renamed.
* It's in the right directory.
* After changing the name read in the sample loader, the PRX tested as *Working*
Thank You!! |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Sat Jun 17, 2006 7:34 pm Post subject: |
|
|
I suppose that you have previously called pspSdkInstallNoPlainModuleCheckPatch (which requires kernel mode), right?
Also, if you call pspSdkInstallNoDeviceCheckPatch, you wouldn't need the sceKernelLoadModuleMs, the normal sceKernelLoadModule would work better.
It seems that the sceKernelLoadModuleMs has problems in loading user mode prx's (no problems with kernel ones), that's why you should use sceKernelLoadModule instead. |
|
| Back to top |
|
 |
Devun_06
Joined: 17 Jun 2006 Posts: 15
|
Posted: Sun Jun 18, 2006 6:48 am Post subject: |
|
|
| moonlight wrote: | I suppose that you have previously called pspSdkInstallNoPlainModuleCheckPatch (which requires kernel mode), right?
Also, if you call pspSdkInstallNoDeviceCheckPatch, you wouldn't need the sceKernelLoadModuleMs, the normal sceKernelLoadModule would work better.
It seems that the sceKernelLoadModuleMs has problems in loading user mode prx's (no problems with kernel ones), that's why you should use sceKernelLoadModule instead. |
Thanks
Last edited by Devun_06 on Sat Jul 29, 2006 5:59 am; edited 1 time in total |
|
| Back to top |
|
 |
subbie
Joined: 05 May 2005 Posts: 122
|
Posted: Tue Jun 20, 2006 1:19 am Post subject: |
|
|
| I have a minor prx question. How do you figure out the STUB info to use in the program that loads the prx? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Tue Jun 20, 2006 2:29 am Post subject: |
|
|
| subbie, make your export.exp with the functions you want to export then do psp-build-exports -s export.exp and that will spit out a file with LibName.S where libname is the name of your library you specified in the export.exp file. Then just copy that across to your loader application and add it to your makefile. |
|
| Back to top |
|
 |
subbie
Joined: 05 May 2005 Posts: 122
|
Posted: Tue Jun 20, 2006 2:50 am Post subject: |
|
|
| TyRaNiD wrote: | | subbie, make your export.exp with the functions you want to export then do psp-build-exports -s export.exp and that will spit out a file with LibName.S where libname is the name of your library you specified in the export.exp file. Then just copy that across to your loader application and add it to your makefile. |
Sweet, Thanks !! :D |
|
| Back to top |
|
 |
Devun_06
Joined: 17 Jun 2006 Posts: 15
|
Posted: Thu Jul 27, 2006 5:22 am Post subject: |
|
|
Okay, I've made the necessary changes now, but I'm still not getting anything to boot from it except now the PSP doesn't crash unless I release the error codes as comments. What exactly is messing up my code now?
| Code: | int LoadAndStartModule_PRX(char *ModuleFILE, int UserMode)//UserMode mode: 1==true; 0 == false;
{//start moduling
//**ERROR INSTALL HANDLERS**\//
//pspDebugInstallKprintfHandler(NULL);
//pspDebugInstallErrorHandler(NULL);
//pspDebugInstallStdoutHandler(pspDebugScreenPrintData);
//pspSdkInstallNoPlainModuleCheckPatch();//uses : #include <pspsdk.h>
SceKernelLMOption moduleprx;
moduleprx.mpidtext = (UserMode+1);// 2 is equivalent to usermode ;)
moduleprx.mpiddata = (UserMode+1);// 2 is equivalent to usermode ;)
moduleprx.position = 0;
moduleprx.access = 1;
moduleprx.size = sizeof(moduleprx);
SceUID PrxID=0;
PrxID = sceKernelLoadModule(ModuleFILE,0,UserMode > 0 ? &moduleprx : NULL);// If in usermode, don't call as NULL >:
int prxstatus=-1;
if( ( sceKernelStartModule (PrxID, 0,NULL,&prxstatus,NULL) ) !=0)// it was :if( ( sceKernelStartModule (PrxID, 0,NULL,&prxstatus,moduleprx) ) !=0)
{//I think this is an okay error check<-
//do nothing until necessary... :), but this is on an errors existance
}//last argument is 0 for usermode! #3 is NULL because it's okay, and I don't know what it's honestly asking for... :'(
//Finish MODULING: Stop & Unload Relative MODULE
sceKernelStopModule(PrxID, 0, NULL,&prxstatus,NULL);// it was:sceKernelStopModule(PrxID, 0, NULL,&prxstatus,moduleprx);
sceKernelUnloadModule(PrxID);
return prxstatus;
}//end moduling |
|
|
| Back to top |
|
 |
|
|
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
|