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 

PRX & Moduling Help

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



Joined: 17 Jun 2006
Posts: 15

PostPosted: Sat Jun 17, 2006 7:14 pm    Post subject: PRX & Moduling Help Reply with quote

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



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat Jun 17, 2006 7:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
Devun_06



Joined: 17 Jun 2006
Posts: 15

PostPosted: Sun Jun 18, 2006 6:48 am    Post subject: Reply with quote

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
View user's profile Send private message
subbie



Joined: 05 May 2005
Posts: 122

PostPosted: Tue Jun 20, 2006 1:19 am    Post subject: Reply with quote

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
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Jun 20, 2006 2:29 am    Post subject: Reply with quote

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
View user's profile Send private message
subbie



Joined: 05 May 2005
Posts: 122

PostPosted: Tue Jun 20, 2006 2:50 am    Post subject: Reply with quote

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
View user's profile Send private message
Devun_06



Joined: 17 Jun 2006
Posts: 15

PostPosted: Thu Jul 27, 2006 5:22 am    Post subject: Reply with quote

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
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