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 

[Solved] Running a homebrew from a homebrew

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



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Mon Apr 13, 2009 7:17 am    Post subject: [Solved] Running a homebrew from a homebrew Reply with quote

Hi,

I'd like to run my FreeDink(.org) homebrew with some additional parameters, so it can run a given addon instead of the main game. In another words I need to write a simple frontend to do the job.

What's the best way to run the game engine from the frontend - that is, run an homebrew from another one? In the psplink code I found that "ldstart" is implemented using "sceKernelLoadModule", but I'm not sure that's what I need.


Last edited by Beuc on Fri Apr 17, 2009 6:21 am; edited 1 time in total
Back to top
View user's profile Send private message
arnie



Joined: 11 Apr 2009
Posts: 16

PostPosted: Mon Apr 13, 2009 9:31 am    Post subject: Reply with quote

Code:

int k1 = pspSdkSetK1(0);
   
   SceUID mod = sceKernelLoadModule(path, 0, NULL);
   if (mod >= 0)
   {
      mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL);
      if (mod < 0)
         //Error
   }
   pspSdkSetK1(k1);


Replace path with the module you want to load.

-Arnie
Back to top
View user's profile Send private message
Beuc



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Tue Apr 14, 2009 2:39 am    Post subject: Reply with quote

arnie wrote:
Code:

int k1 = pspSdkSetK1(0);
   
   SceUID mod = sceKernelLoadModule(path, 0, NULL);
   if (mod >= 0)
   {
      mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL);
      if (mod < 0)
         //Error
   }
   pspSdkSetK1(k1);


Replace path with the module you want to load.

-Arnie


It looks it doesn't want to start the application if the front-end is already running (mod == 0x800200d9). Do I need to unload it first somehow?

I tried with running an eboot (0x80020148/unsupported_prx_type) and a .prx (0x800200D9/same as when trying to run a program twice from psplink).

I'm not very familiar with the PSP constraints (like, you can run two programs at once?).

Thanks!
Back to top
View user's profile Send private message
Beuc



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Tue Apr 14, 2009 6:58 am    Post subject: Reply with quote

OK, apparently something going wrong (800200d9) if I run an SDL app from another SDL app - even if I unloaded everything:

Works:
- run text-mode app 1
- user chooses app to launch
- call pspSdkLoadStartModule(SDL App 2)
- SDL App 2 is run

Doesn't work:
- run SDL app 1
- user chooses app to launch (graphically)
- quit SDL
- call pspSdkLoadStartModule(SDL App 2)
- SDL App 2 is not run (800200d9)

Do you have an idea about what blocks starting SDL App 2 from SDL App 1?
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Apr 14, 2009 7:42 am    Post subject: Reply with quote

800200d9 in loadmodule means non enough memory to load.

You probably haven't freed the heap.
Back to top
View user's profile Send private message
Beuc



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Tue Apr 14, 2009 7:52 am    Post subject: Reply with quote

Thanks - what function should I use to free the heap?
I didn't manipulate it directly.
Back to top
View user's profile Send private message
Beuc



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Tue Apr 14, 2009 8:40 am    Post subject: Reply with quote

I confirm that the heap is not freed - sadly __psp_free_heap() doesn't seem to be public, and it's the only function with access to the memory blockid used by newlib AFAICS.
Is there another way?
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Apr 14, 2009 1:57 pm    Post subject: Reply with quote

Simply add the prototype for it in your source and it will work.
Back to top
View user's profile Send private message
Beuc



Joined: 26 Mar 2009
Posts: 33
Location: holland

PostPosted: Wed Apr 15, 2009 3:24 am    Post subject: Reply with quote

Torch wrote:
Simply add the prototype for it in your source and it will work.


Cool. I did but actually I had forgotten an "extern C" somewhere (I'm using Guichan so the program is C++), hence I thought I didn't work. It works fine now - only using '__' functions is probably a bit ugly.
Thanks :)
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