SDL for PSP

What I thought was going to be a snap has turned into massive frustration.

I’ve been trying to port my SDL program to PSP. To do this, I downloaded the native PSP SDK found at http://www.jetdrone.com/minpspw.

The SDL port documentation for the necessary makefile modifications didn’t work, causing lots of unresolved SDL references and unrecognised C++ constructs. A working makefile was found at http://www.consolespot.net/forums/psp-help-tutorials/21979-psp-programming-tutorial-windows-sdl-without-cygwin.html, which resolved the issues.

However, the SDL library itself has issues:

C:/pspdev/psp/lib\libSDL.a(SDL_pspevents.o): In function PSP_EventQuit': C:\msys\home\jetdrone\minpspw\devpaks\017_SDL\build\SDL\src\video\psp/SDL_pspevents.c:274: undefined reference topspIrKeybFinish’
C:/pspdev/psp/lib\libSDL.a(SDL_pspevents.o): In function PSP_EventInit': C:\msys\home\jetdrone\minpspw\devpaks\017_SDL\build\SDL\src\video\psp/SDL_pspevents.c:247: undefined reference topspIrKeybInit’
C:\msys\home\jetdrone\minpspw\devpaks\017_SDL\build\SDL\src\video\psp/SDL_pspevents.c:249: undefined reference to pspIrKeybOutputMode' C:/pspdev/psp/lib\libSDL.a(SDL_pspevents.o): In functionPSP_PumpEvents’:
C:\msys\home\jetdrone\minpspw\devpaks\017_SDL\build\SDL\src\video\psp/SDL_pspevents.c:112: undefined reference to `pspIrKeybReadinput’
collect2: ld returned 1 exit status

Turns out it’s because this version of the library is based on some old version of a PSP devkit. Great, so the SDK comes with a library that doesn’t actually work.

Next was trying to compile it myself, so I grabbed the source at https://github.com/pspdev/psp-ports/tree/master/SDL. However, this seems to require a Cygwin environment, and I didn’t see a makefile that would run with just make on the command line anyway.

HELP

After some milk and cookies, I looked up the references that were missing, and it turns out that it’s because some libraries weren’t linked. Aside from linking stdc++ to be able to use C++ code, you have to add pspirkeyb and psppower.

I ended up with a working application, but it froze my PSP before shutting it down. printf doesn’t work; you have to use pspDebugScreenPrintf instead (which works just like printf), which will output to the screen. This way I was able to diagnose my problem. My SDL_SetVideoMode function call was failing. Turns out you can’t use 24-bit colour depth; you have to use 32-bit colours.

With software surfaces, performance is bad, even with optimised surfaces. Switching to hardware surfaces solves this, but I’m having a problem related to colour keying, as every other frame the transparent colour of my surfaces are being drawn. I have yet to look into this.

Have you tried using SDL_Log(), SDL_LogError(), etc.? I would suppose that
they wrap the PSP’s proper logging commands.

Jonny DOn Sat, Feb 15, 2014 at 12:16 PM, BenoitRen wrote:

After some milk and cookies, I looked up the references that were
missing, and it turns out that it’s because some libraries weren’t linked.
Aside from linking stdc++ to be able to use C++ code, you have to add
pspirkeyb and psppower.

I ended up with a working application, but it froze my PSP before shutting
it down. printf doesn’t work; you have to use pspDebugScreenPrintf instead
(which works just like printf), which will output to the screen. This way I
was able to diagnose my problem. My SDL_SetVideoMode function call was
failing. Turns out you can’t use 24-bit colour depth; you have to use
32-bit colours.

With software surfaces, performance is bad, even with optimised surfaces.
Switching to hardware surfaces solves this, but I’m having a problem
related to colour keying, as every other frame the transparent colour of my
surfaces are being drawn. I have yet to look into this.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

There’s definitely something wrong with the colour key functionality when using hardware surfaces.

With single buffering, there’s the flickering I mentioned.

With double buffering, if I set the colour key on a 24-bit surface before converting it to a 32-bit surface, it doesn’t work. If I set the colour key after converting it, nothing gets drawn.

So it’s back to software surfaces. At least I found out that I forgot to convert one surface, so performance is good now. The only thing that bothers me is that the image is stretched across the screen.

@Jonny D : Thanks for the suggestion, but it doesn’t look like SDL_Log exists in SDL1.2.