Hello community,
I have written a small SDL2 “hello world” application for the PSP which loads and draws a sprite on blue background (after pressing the x button). Here is the source of my project.
Everything works fine using the emulator “PPSSPP” but once I try the project on my PSP and PS Vita it always crashes the moment I press the x button which triggers the drawing of the texture. I’ve tried the SDL2 version that comes with the pspdev-toolchain and also compiled SDL2 for the PSP from source myself. I’ve tried png and bitmap as source format.
I’m putting the thread to sleep so you can see the message that the image was indeed successfully loaded on the screen. I’m also checking for null pointers and errors but once the code reaches SDL_RenderCopy(…); both console crash. I’m not able to check SDL_GetError() because the console becomes immediately unresponsive until the console shuts itself down.
I’ve exhausted my ideas for now and hope that someone here might have an idea
Thanks to the helpful PSP homebrew community on Discord I found out how to debug and I found the place in the SDL2 source where it is supposedly crashing.
Good news a friendly person on Discord has given me the solution.
You have to add the following line to your main c/cpp file: PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
And to add all the information, the actual error seems to have been in SDL/src/render/psp/SDL_render_psp.c:136. After messing with the Makefile the debugger has given me this line which makes more sense.