Closed dbeef closed 4 years ago
@ooPo, sorry to bother you but I see you're the only maintainer responding to this MR for a whole month, and activity on pspdev projects is just flatline. Any way of merging to master, having only your approval?
I introduce changes of no risk to break anyone's build, in the same time allowing me to build my own project, which is why I care.
@dbeef Sure thing, I can merge it. I only held back because I've not been active lately and didn't want to step on any toes.
Thanks!
Synopsis:
I've been developing my PSP project utilizing SDL 1.2.15 that you provide within psplibraries repository (well, thing you provide is scripts and patches for building, but you get it).
I successfuly built PSP toolchain, installed SDL and began development.
As I wanted to provide some abstraction layer, namely by using glad, to not rely on system headers when building I stumbled on a problem - creating OpenGL context on a PSP using SDL was successful, glad didn't fail on loading OpenGL functions, but emulator still crashed in runtime, when it came to execute OpenGL functions.
I checked glad's pointers to OpenGL functions and they were all null.
Some experimenting of mine has shown, that some functions fail, but some not. After some recursive grepping through SDL's sources I found
SDL_glfuncs.h
(as I included patch to this specific file in this MR, you can open diff to have some knowledge what lies there)Weirdly, all functions that were preceded with
SDL_PROC_UNUSED
crashed emulator, and those withSDL_PROC
didn't.After I annotated all of them with
SDL_PROC
I had linking errors:(it was 200 lines, shortened it for clarity)
I understood, that PSP-GL that lies under this particular SDL implementation, does not provide all of those OpenGL function-definitions. So I prefixed again all functions that raised undefined reference with
SDL_PROC_UNUSED
- those that I needed were still there, so I was happy.I recompiled SDL and that was it - linking succeeded. Now I can build an artifact of my code on PC / PSP from the same codebase ;)
You can clone it from here: https://github.com/dbeef/spelunky-psp Build scripts are under
/scripts
Obviously, only thing it does now is blinking, but it blinks in a proud, cross-platform way ;)