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 

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

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



Joined: 13 Mar 2006
Posts: 34

PostPosted: Thu Apr 27, 2006 4:10 am    Post subject: Start UMD (with boot.bin) using Load and Start Module Reply with quote

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:
 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.
Back to top
View user's profile Send private message
weltall



Joined: 20 Feb 2004
Posts: 310

PostPosted: Thu Apr 27, 2006 4:30 am    Post subject: Reply with quote

your app needs also to be in the kernel memory and not in the user memory
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Apr 27, 2006 4:58 am    Post subject: Re: Start UMD (with boot.bin) using Load and Start Module Reply with quote

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.
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Thu Apr 27, 2006 5:12 am    Post subject: Re: Start UMD (with boot.bin) using Load and Start Module Reply with quote

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



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Apr 27, 2006 5:30 am    Post subject: Re: Start UMD (with boot.bin) using Load and Start Module Reply with quote

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.
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Thu Apr 27, 2006 5:36 am    Post subject: Re: Start UMD (with boot.bin) using Load and Start Module Reply with quote

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. )
Back to top
View user's profile Send private message
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Sat Apr 29, 2006 7:31 am    Post subject: Reply with quote

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??
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Sat Apr 29, 2006 9:33 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
CyberBill



Joined: 26 Jul 2005
Posts: 86
Location: Redmond, WA

PostPosted: Sat Apr 29, 2006 4:57 pm    Post subject: Reply with quote

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!!!
Back to top
View user's profile Send private message AIM Address MSN Messenger
Ghozt



Joined: 13 Mar 2006
Posts: 34

PostPosted: Sun Apr 30, 2006 1:04 am    Post subject: Reply with quote

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