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 

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

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



Joined: 30 Aug 2005
Posts: 29

PostPosted: Fri Nov 02, 2007 1:30 am    Post subject: Any quickies .. porting to Slim for app that only uses sce? Reply with quote

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?
Back to top
View user's profile Send private message Visit poster's website AIM Address
skeezixcodejedi



Joined: 30 Aug 2005
Posts: 29

PostPosted: Fri Nov 02, 2007 1:55 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message Visit poster's website AIM Address
Viper8896



Joined: 26 Jan 2006
Posts: 110

PostPosted: Fri Nov 02, 2007 7:57 pm    Post subject: Reply with quote

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



Joined: 30 Aug 2005
Posts: 29

PostPosted: Fri Nov 02, 2007 11:44 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message Visit poster's website AIM Address
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