Any quickies .. porting to Slim for app that only uses sce?

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

Moderators: cheriff, TyRaNiD

Post Reply
skeezixcodejedi
Posts: 29
Joined: Tue Aug 30, 2005 10:37 am
Contact:

Any quickies .. porting to Slim for app that only uses sce?

Post by skeezixcodejedi »

Have a newborn in the house, so the last few months have been a total writeoff and just now getting back into the swing of things; so I've missed the Slim discussions :( I'm hoping someone can point me to a quick summary:

If you're only using "sce" functions (kernel prx's I presume), then what changes to the code to make it Slim happy?

I just today picked up a Slim (and looking to sell my Fat, though I am tempted to keep it around just for future 1.50 kernel stuff like making pandoras .. but it sounds like 1.50 kernel might get fixed up to run on Slims soon, so no real reason to keep a Fatty around?), and of course tried my various homebrews and got the now famous 80020148 error.

Sounds like you need to add in:
PSP_HEAP_SIZE_KB(50000); // or somesuch, for lots of heap again

And:
-DPSP_FW_VERSION=360 // what does this do in the SDK? I've got a year old version of PSPSDK I'm fond if.. it is required to get a newer version, or am I good with old SDK?

BUILD_PRX=1 needs to get appended to build-prx? Interesting. Sounds like new PSPSDK needed then, for sure.

Anything else?

What exactly causes the 80020148 error? Does that mean I really am using some 'psp' userland calls somewhere?

Thanks for any tips, wikis, posts, etc. Trying to catch up, but time with a baby around is tight :)

jeff
--
Have you played Atari today?
skeezixcodejedi
Posts: 29
Joined: Tue Aug 30, 2005 10:37 am
Contact:

Post by skeezixcodejedi »

Oh wait, maybe I have that backwards; the sce's are the problem, not the psp user functions I bet.

Hmm. Are there user mode equivilents for most functions people use these days, to avoid wrapping up all their sce's in something?

I think I'll have a few minutes today (breath breath), so will start searching posts from a month ago :P

jeff
--
Have you played Atari today?
Viper8896
Posts: 110
Joined: Thu Jan 26, 2006 6:20 pm

Post by Viper8896 »

slim need the latest firmware to run so to run homebrew on that everything must be coded for 3.71 custom firmware rather that using game150 folder like on phat psps. and to do that program must be a user mode prx rather than a elf and if you need kernel mode the user prx has to load the kernel prx. dark alex's custom firmware has samples libraries and headers u may need http://dark-alex.org
skeezixcodejedi
Posts: 29
Joined: Tue Aug 30, 2005 10:37 am
Contact:

Post by skeezixcodejedi »

Interesting.

Any 'hello world' type short samples? (Time is tight for me now, so any pointers are appreciated :)

Just looking randomly around, I nabbed the source for Doom/PSP recently released:

psp_main.c:main() .. first few lines pretty much:

pspDebugScreenInit();
pspDebugScreenSetBackColor(0x000000);
pspDebugScreenSetTextColor(0xffffff);
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

So he cuts right to the 'sce' routines with no special setup. I guess the sceCtrlSetSamplingCycle() is userland despite being an sce... function?

Ahright, getting to the meat of it..

- it looks like his user-land code loads up a module DveManager or somesuch:

if (sceKernelDevkitVersion() >= 0x03070110)
if (kuKernelGetModel() == PSP_MODEL_SLIM_AND_LITE)
{
char str[256];
sprintf(str,"%s%s",psp_home,"dvemgr.prx");
if (pspSdkLoadStartModule(str, PSP_MEMORY_PARTITION_KERNEL) >= 0)
psp_tv_cable = pspDveMgrCheckVideoOut();
}

So pspDveMgrCheckVideoOut() has been exported by the dvemgr.prx. Interesting to note you don't have to refer to it by a handle or mmap or somesuch. Good to know.

- looks like he defines the dvemgr.prx externally (using prxtool or something?) in dvemgr/main.c, which does the module start/stop nil pair, and has the two functions he needs and exports them. Example function is:

int pspDveMgrCheckVideoOut()
{
int k1 = pspSdkSetK1(0);
int intr = sceKernelCpuSuspendIntr();

// Warning: nid changed between 3.60 and 3.71
int cable = sceHprm_driver_1528D408();

sceKernelCpuResumeIntr(intr);
pspSdkSetK1(k1);

return cable;
}

- So conclusion ..

1) Some specific few sce..() routines are callable in user mode (any idea which?)

2) The main application must live on psp...() routines, and any exported prx functions

3) For most sce...() functions, I need to load up an appropriate prx, or write up my own prx wrapper to export them. Is there a list somewhere of which prx's export which functions?

4) It strikes me if this logic is correct (I might be entirely wrong, since just guessing here) then someone would've made one giant fat .prx file that just stubs out to every kernel function and exports them, so you could then just load up one module .. 'giantfunctionexporter.prx' and be good to go :P

I'll have to grab a more current PSPSDK and take a look. Must be a Hello World with prxs for 3.71 somewhere.

If its non-obvious and I figure it out, I'll post a Hello World :P

Thanks for any tips!

jeff
--
Have you played Atari today?
Post Reply