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 Loader on XMB...

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



Joined: 12 Mar 2007
Posts: 26

PostPosted: Sat Feb 02, 2008 11:38 am    Post subject: PRX Loader on XMB... Reply with quote

Hi!

Well, my final goal is to be able to load an EBOOT.PBP at the start of the PSP. I tried several methods (i’ve tried to use « autorun » in the « recovery »,to load a prx before the loading of the XMB…) but no one of this methods works, and I think it’s normal because the modules prx of the psp are not yet load in each one of this case.

So I’ve used another method, which is to create an active prx on the XMB but which load the EBOOT.PBP only when I push SELECT.
But the prx is unable to load the EBOOT and I dunno where I can made a mistake.

Here is my source code :

main.c
Code:


   #include <pspkernel.h>
   #include <pspiofilemgr.h>
   #include <pspmodulemgr.h>
   #include <pspdisplay.h>
   #include <pspdebug.h>
   #include <pspusb.h>
   #include <pspusbstor.h>
   #include <pspthreadman.h>
   #include <pspctrl.h>
   #include <pspsdk.h>
   #include <pspsyscon.h>
   #include <psploadexec_kernel.h>

   #include <pspuser.h>
   #include <systemctrl.h>
   #include <systemctrl_se.h>

   #include <errno.h>
   #include <stdlib.h>
   #include <string.h>
   #include <time.h>
   #include <unistd.h>
   #include <stdio.h>


   #define printf pspDebugScreenPrintf
   #define SCE_LED_POWER 1
   #define LED_ON 1
   #define LED_OFF 0

   #define OUI 1
   #define NON 0

   
int req;
int mode;

int Loader(void);
int execEboot(char *target,int mode);
void pause_prx(int atemp);
void Boucle(void);

PSP_MODULE_INFO("PRX_Loader_test", 0, 1, 1);



int main(int argc, char **argv){

   SceCtrlData pad;
   
   while(1)
   {
      sceCtrlPeekBufferPositive(&pad, 1);
      if(pad.Buttons & PSP_CTRL_SELECT)
      {
         Loader();
         pause_prx(2);
         Boucle();
         pause_prx(2);
      }
      sceKernelDelayThread(1000);
   }
   
   return 0;
}


int Loader(void){

   pspDebugScreenInit();
   pspDebugScreenClear();
   pspDebugScreenSetBackColor(0x00000000);
   
   printf("\n\n\nChargement en cours");
   pause_prx(2);
   printf(".");
   pause_prx(2);
   printf(".");
   pause_prx(2);
   printf(".");
   
   mode=1;
   while(1)
   {
      req=execEboot("ms0:/PSP/GAME/TEST/EBOOT.PBP", mode);
      if(req < 0)
      {
         printf("\nMODE%d:%d : Erreur! please wait...",mode,req);
         pause_prx(5);
         mode++;
      }
      
      if(mode==0){break;}
   }
   
   return 0;
}

int execEboot(char *target, int mode){

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

   
   // I try all possibility...
   if(mode==1)
      {req =sceKernelLoadExecVSHMs1(target, &param);}
   else if(mode==2)
      {req =sceKernelLoadExecVSHMs2(target, &param);}
   else if(mode==3)
      {req =sceKernelLoadExecVSHMs3(target, &param);}
   else if(mode==4)
      {req =sceKernelLoadExecVSHMs4(target, &param);}
   else if(mode==5)
      {req =sctrlKernelLoadExecVSHMs3(target, &param);}
   else if(mode==6)
      {req =sctrlKernelLoadExecVSHMs2(target, &param);}
   else if(mode==7)
      {req =sctrlKernelLoadExecVSHMs1(target, &param);}
   else
      {mode=0;}
   
   return req;
}

void pause_prx(int atemp){
   int iii=0;
   int compteur1=0;
   int compteur2=0;
   
   atemp = (atemp*1000*2);
   
   for(compteur1=0; compteur1 <= atemp; compteur1++)
   {
      for(compteur2=0; compteur2 <= atemp; compteur2++)
      {iii++;}
   }
   
   return;
}

void Boucle(void){
   int var1;
   var1 = 0;
   
   while (var1 == 0)
   {
      SceCtrlData pad;
      sceCtrlPeekBufferPositive(&pad, 1);
      if(pad.Buttons & PSP_CTRL_SELECT)
      {
         var1 = 1;
      }
   }
}

void* getModuleInfo(void){/* Exported function returns the address of module_info */
   return (void *) &module_info;
}


Makefile
Code:

TARGET = prx_loader
OBJS = main.o

PSP_FW_VERSION = 390
BUILD_PRX=1

#USE_KERNEL_LIBC=1
#USE_KERNEL_LIBS=1
#USE_PSPSDK_LIBC = 1

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS = -mno-crt0
LIBS   = -lpsploadexec_kernel -lpspsystemctrl_user

#EXTRA_TARGETS = EBOOT.PBP
#PSP_EBOOT_TITLE = PRX Loader

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak



thanks for your help
_________________
Sorry for my English, I'm french.
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