Initial SDL_ps2_main implementation

This commit is contained in:
Francisco Javier Trujillo Mata 2022-03-20 19:42:06 +01:00 committed by Sam Lantinga
parent 1f3ae75228
commit 84d69da4e1
4 changed files with 57 additions and 1 deletions

View File

@ -2539,7 +2539,10 @@ elseif(PSP)
endif(NOT SDL2_DISABLE_SDL2MAIN) endif(NOT SDL2_DISABLE_SDL2MAIN)
elseif(PS2) elseif(PS2)
list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__") list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I${PS2SDK}/ports/include")
file(GLOB PS2_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/ps2/*.c)
set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES})
if(SDL_FILESYSTEM) if(SDL_FILESYSTEM)
set(SDL_FILESYSTEM_PS2 1) set(SDL_FILESYSTEM_PS2 1)
@ -2559,6 +2562,12 @@ elseif(PS2)
list(APPEND SOURCE_FILES ${PS2_TIMER_SOURCES}) list(APPEND SOURCE_FILES ${PS2_TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE) set(HAVE_SDL_TIMERS TRUE)
endif() endif()
list(APPEND EXTRA_LIBS
patches
ps2_drivers
)
elseif(OS2) elseif(OS2)
list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR")

View File

@ -92,6 +92,9 @@
*/ */
#define SDL_MAIN_AVAILABLE #define SDL_MAIN_AVAILABLE
#elif defined(__PS2__)
#define SDL_MAIN_AVAILABLE
#endif #endif
#endif /* SDL_MAIN_HANDLED */ #endif /* SDL_MAIN_HANDLED */

View File

@ -0,0 +1,36 @@
/*
SDL_ps2_main.c, fjtrujy@gmail.com
*/
#include "SDL_config.h"
#ifdef __PS2__
#include "SDL_main.h"
#include "SDL_error.h"
#include <sifrpc.h>
#include <iopcontrol.h>
#include <sbv_patches.h>
#ifdef main
#undef main
#endif
static void prepare_IOP()
{
SifInitRpc(0);
sbv_patch_enable_lmb();
sbv_patch_disable_prefix_check();
}
int main(int argc, char *argv[])
{
prepare_IOP();
return SDL_main(argc, argv);
}
#endif /* _EE */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -27,6 +27,14 @@ if(PSP)
psphprm psphprm
psppower psppower
) )
elseif(PS2)
link_libraries(
SDL2main
SDL2_test
SDL2-static
patches
ps2_drivers
)
else() else()
link_libraries(SDL2::SDL2test SDL2::SDL2-static) link_libraries(SDL2::SDL2test SDL2::SDL2-static)
endif() endif()