Start UMD (with boot.bin) using Load and Start Module

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

Moderators: cheriff, TyRaNiD

Post Reply
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Start UMD (with boot.bin) using Load and Start Module

Post by Ghozt »

Hi there!

I was trying to load my UMD with Load and start module but it seems that I can't get it to work. Her is my code:

Code: Select all

 SceUID moduid;
int start;
unsigned int y;

pspSdkInstallNoDeviceCheckPatch();
pspSdkInstallNoPlainModuleCheckPatch();

 y = sceUmdCheckMedium(0);
if (!(y)) sceUmdWaitDriveStat(UMD_WAITFORDISC);
sceUmdActivate(1,"disc0:");
 sceUmdWaitDriveStat(UMD_WAITFORINIT);

if ((moduid = sceKernelLoadModule("disc0:/PSP_GAME/SYSDIR/BOOT.BIN", 0, 1)) & 0x80000000)
{
    printf("Error %08X loading module.\n", moduid);     
}

if ((start = sceKernelStartModule(moduid, 0, NULL, NULL, NULL)) & 0x80000000)
{
    printf("Error %08X starting module.\n", start); 
I get the 800200d9 error which I think means that the psp couldn't allocate enough memory or something like that. My app runs in kernel mode if that makes any difference. Does anyone know what to do?

Thanks in Advance!

btw. I can't use sceKernelLoadExec() since that one unloads my app totaly. I want my app to still run in the background like mphgl does.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

your app needs also to be in the kernel memory and not in the user memory
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Re: Start UMD (with boot.bin) using Load and Start Module

Post by moonlight »

Ghozt wrote: I get the 800200d9 error which I think means that the psp couldn't allocate enough memory or something like that. My app runs in kernel mode if that makes any difference. Does anyone know what to do?
.
PSP_HEAP_SIZE_KB(0); may help it.
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Re: Start UMD (with boot.bin) using Load and Start Module

Post by Ghozt »

moonlight wrote: PSP_HEAP_SIZE_KB(0); may help it.
By adding PSP_HEAP_SIZE_KB(0); causes my app to freeze when I try to start it ( the first thing in my main function is loading and displaying a .png picture from the ms if that makes any difference)

btw. Weltall: I told you my app runs in kernel mode.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Re: Start UMD (with boot.bin) using Load and Start Module

Post by moonlight »

Ghozt wrote:
moonlight wrote: PSP_HEAP_SIZE_KB(0); may help it.
By adding PSP_HEAP_SIZE_KB(0); causes my app to freeze when I try to start it ( the first thing in my main function is loading and displaying a .png picture from the ms if that makes any difference)
yes, that makes a lot of difference, as libpng use allocation functions that need heap memory.
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Re: Start UMD (with boot.bin) using Load and Start Module

Post by Ghozt »

moonlight wrote:yes, that makes a lot of difference, as libpng use allocation functions that need heap memory.
Is there any other way I can do it?? ( I have thought of doing it from a prx but I don't think I can load prx since the load/start module doesn't work because of libpng. )
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Post by Ghozt »

So there is no way to use load/startModule and using libpng?? Is there any other similar function that you can use too boot a UMD without unloading your own program??
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

PSP_HEAP_SIZE_KB(0);
will not work you need some heap :P

/* Define the main thread's heap size (optional) */
/**
* ELF:
* Elf default is (Max) available memory block
*
* PRX:
* when making a prx, user mode prx default
* heap size is (64K) if youd like to use more
* change below
*/
PSP_HEAP_SIZE_KB(size_kb);

recommended size for kernel module:
PSP_HEAP_SIZE_KB(32);
10011011 00101010 11010111 10001001 10111010
CyberBill
Posts: 86
Joined: Tue Jul 26, 2005 3:53 pm
Location: Redmond, WA

Post by CyberBill »

The issue here is that if you're planning on making a loader that runs games from UMD, those games will never return. So both programs will be loaded and running at the same time after you start it.

If you're displaying an image, you cant afford to 'steal' that memory from the game you're trying to run, so you need to use sceKernelCreateFPL / DeleteFPL, etc. Create a memory pool big enough for your bitmaps so that you NEVER call new/malloc, and then when you run your UMD game, you have to delete the memory pool.

Since other libraries (libpng) may use new/malloc (and probably do) you pretty much cant use them unless you override new/delete & malloc/free. not fun!

I also think its a little strange that you're trying to run a game from UMD... as theres no point to this.... you can run the game directly from the PSP OS!!!
Ghozt
Posts: 34
Joined: Mon Mar 13, 2006 8:37 pm

Post by Ghozt »

CyberBill wrote:The issue here is that if you're planning on making a loader that runs games from UMD, those games will never return. So both programs will be loaded and running at the same time after you start it.

If you're displaying an image, you cant afford to 'steal' that memory from the game you're trying to run, so you need to use sceKernelCreateFPL / DeleteFPL, etc. Create a memory pool big enough for your bitmaps so that you NEVER call new/malloc, and then when you run your UMD game, you have to delete the memory pool.

Since other libraries (libpng) may use new/malloc (and probably do) you pretty much cant use them unless you override new/delete & malloc/free. not fun!

I also think its a little strange that you're trying to run a game from UMD... as theres no point to this.... you can run the game directly from the PSP OS!!!
If I just wanted to run the game I could have used sceKenelLoadExec() but since that unloads my program I can't do anything special ( like haveing the usb activated while playing etc.)
Post Reply