porting a 1.50 PSP app to 3.xx

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

Moderators: cheriff, TyRaNiD

Post Reply
plankton
Posts: 9
Joined: Tue Jan 10, 2006 11:03 pm
Location: USA
Contact:

porting a 1.50 PSP app to 3.xx

Post by plankton »

hi everyone, i'm the author of PSPSeq (http://dspmusic.org/psp). at the moment i do all my development on a 1.50 fat and have users use various apps like eloader or timemachine to run on new firmware. that's ok, but what i would really like is to get this program running natively on 3.xx/slim hardware.

as i understand it, the common issue is whether or not your program requires kernel mode function calls. if it does, they are put into a separate library and loaded into the main user mode app, right? is there a complete list of functions that are kernel mode only? if not, is there an easy way to tell from the function name if it is kernel or user?

once i have this list, i assume the next step is to follow the general procedure outlined in this post:

http://forums.ps2dev.org/viewtopic.php?t=9022

take all kernel functions, add a small wrapper, include the necessary module_start() and module_stop() functions, build as a prx, include in the main user mode app, and then be done with it.

does that sound generally correct? is there anything else that i need to watch out for? thanks!

ethan
dspmusic.org/psp
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

over and over again....Functions messing up with hardware are generally kernel side. I can't point you to a list, but you can figure it out trying to compile a small program with the functions you need and then launch prxtool on the compiled binary and see what are the modules exporting your functions. If i'm not wrong, when you see "_Driver" you are in kernel mode. To be honest, i'm currently doing it by error-and-retry..... :)
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

is there anything else that i need to watch out for?
Image

Spaghetti code you started writing two years ago.
Sorry, couldn't help it.
If not actually, then potentially.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Re: porting a 1.50 PSP app to 3.xx

Post by J.F. »

plankton wrote:hi everyone, i'm the author of PSPSeq (http://dspmusic.org/psp). at the moment i do all my development on a 1.50 fat and have users use various apps like eloader or timemachine to run on new firmware. that's ok, but what i would really like is to get this program running natively on 3.xx/slim hardware.

as i understand it, the common issue is whether or not your program requires kernel mode function calls. if it does, they are put into a separate library and loaded into the main user mode app, right? is there a complete list of functions that are kernel mode only? if not, is there an easy way to tell from the function name if it is kernel or user?
The easiest way to tell if it's a kernel-mode function is to look at the name of the library it's in - if the library ends with "_driver", it's kernel-mode. If not, it's user-mode. In general, there are VERY few kernel-mode functions that you would ever use. One is to change the audio playback sample rate from 44100 to 48000. Another is to activate and run functions on the MediaEngine. Another would be to add a debug exception handler. In general, if you don't do one of those three, you won't have any kernel-mode functions to worry about.
once i have this list, i assume the next step is to follow the general procedure outlined in this post:

http://forums.ps2dev.org/viewtopic.php?t=9022

take all kernel functions, add a small wrapper, include the necessary module_start() and module_stop() functions, build as a prx, include in the main user mode app, and then be done with it.

does that sound generally correct?
Yes. Read the explanation of the 3.xx HEN example I posted a little ways down in that thread for more info.

http://forums.ps2dev.org/viewtopic.php?p=58653#58653

is there anything else that i need to watch out for? thanks!

ethan
dspmusic.org/psp
If you use a kernel-mode prx, you have to compile the main program as a prx as well (you'll see "BUILD_PRX = 1" in the makefile of the example). If you want to use the extra RAM in the Slim, put "PSP_LARGE_MEMORY = 1" in the makefile as well. If you DO build the main program as a prx, the default heap size is tiny - you should add either "PSP_HEAP_SIZE_MAX();" to main.c, or "PSP_HEAP_SIZE_KB(48000);" if you use threads in the main program. The number in the macro is the number of kB to make the heap; obviously you wouldn't use 48000 on a Phat PSP.
Post Reply