PRX Loader on XMB...

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

Moderators: cheriff, TyRaNiD

Post Reply
peb
Posts: 26
Joined: Mon Mar 12, 2007 10:01 pm

PRX Loader on XMB...

Post by peb »

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: Select all


	#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&#40;void&#41;;
int execEboot&#40;char *target,int mode&#41;;
void pause_prx&#40;int atemp&#41;;
void Boucle&#40;void&#41;;

PSP_MODULE_INFO&#40;"PRX_Loader_test", 0, 1, 1&#41;;



int main&#40;int argc, char **argv&#41;&#123;

	SceCtrlData pad;
	
	while&#40;1&#41;
	&#123;
		sceCtrlPeekBufferPositive&#40;&pad, 1&#41;;
		if&#40;pad.Buttons & PSP_CTRL_SELECT&#41;
		&#123;
			Loader&#40;&#41;;
			pause_prx&#40;2&#41;;
			Boucle&#40;&#41;;
			pause_prx&#40;2&#41;;
		&#125;
		sceKernelDelayThread&#40;1000&#41;;
	&#125;
	
	return 0;
&#125;


int Loader&#40;void&#41;&#123;

	pspDebugScreenInit&#40;&#41;;
	pspDebugScreenClear&#40;&#41;;
	pspDebugScreenSetBackColor&#40;0x00000000&#41;;
	
	printf&#40;"\n\n\nChargement en cours"&#41;;
	pause_prx&#40;2&#41;;
	printf&#40;"."&#41;;
	pause_prx&#40;2&#41;;
	printf&#40;"."&#41;;
	pause_prx&#40;2&#41;;
	printf&#40;"."&#41;;
	
	mode=1;
	while&#40;1&#41;
	&#123;
		req=execEboot&#40;"ms0&#58;/PSP/GAME/TEST/EBOOT.PBP", mode&#41;;
		if&#40;req < 0&#41;
		&#123;
			printf&#40;"\nMODE%d&#58;%d &#58; Erreur! please wait...",mode,req&#41;;
			pause_prx&#40;5&#41;;
			mode++;
		&#125;
		
		if&#40;mode==0&#41;&#123;break;&#125;
	&#125;
	
	return 0;
&#125;

int execEboot&#40;char *target, int mode&#41;&#123;

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

	
	// I try all possibility...
	if&#40;mode==1&#41;
		&#123;req =sceKernelLoadExecVSHMs1&#40;target, &param&#41;;&#125;
	else if&#40;mode==2&#41;
		&#123;req =sceKernelLoadExecVSHMs2&#40;target, &param&#41;;&#125;
	else if&#40;mode==3&#41;
		&#123;req =sceKernelLoadExecVSHMs3&#40;target, &param&#41;;&#125;
	else if&#40;mode==4&#41;
		&#123;req =sceKernelLoadExecVSHMs4&#40;target, &param&#41;;&#125;
	else if&#40;mode==5&#41;
		&#123;req =sctrlKernelLoadExecVSHMs3&#40;target, &param&#41;;&#125;
	else if&#40;mode==6&#41;
		&#123;req =sctrlKernelLoadExecVSHMs2&#40;target, &param&#41;;&#125;
	else if&#40;mode==7&#41;
		&#123;req =sctrlKernelLoadExecVSHMs1&#40;target, &param&#41;;&#125;
	else
		&#123;mode=0;&#125;
	
	return req;
&#125;

void pause_prx&#40;int atemp&#41;&#123;
	int iii=0;
	int compteur1=0;
	int compteur2=0;
	
	atemp = &#40;atemp*1000*2&#41;;
	
	for&#40;compteur1=0; compteur1 <= atemp; compteur1++&#41;
	&#123;
		for&#40;compteur2=0; compteur2 <= atemp; compteur2++&#41;
		&#123;iii++;&#125;
	&#125;
	
	return;
&#125;

void Boucle&#40;void&#41;&#123; 
	int var1;
	var1 = 0; 
	
	while &#40;var1 == 0&#41;
	&#123; 
		SceCtrlData pad;
		sceCtrlPeekBufferPositive&#40;&pad, 1&#41;;
		if&#40;pad.Buttons & PSP_CTRL_SELECT&#41;
		&#123;
			var1 = 1;
		&#125;
	&#125;
&#125;

void* getModuleInfo&#40;void&#41;&#123;/* Exported function returns the address of module_info */
   return &#40;void *&#41; &module_info;
&#125; 
Makefile

Code: Select all

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 = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

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

#EXTRA_TARGETS = EBOOT.PBP
#PSP_EBOOT_TITLE = PRX Loader

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak

thanks for your help
Sorry for my English, I'm french.
Post Reply