Atlas - SDL_psp_main.c
Home / ext / SDL2 / src / main / psp Lines: 1 | Size: 1640 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14 3*/ 4#include "SDL_config.h" 5 6#ifdef __PSP__ 7 8#include "SDL_main.h" 9#include <pspkernel.h> 10#include <pspdebug.h> 11#include <pspsdk.h> 12#include <pspthreadman.h> 13#include <stdlib.h> 14#include <stdio.h> 15 16/* If application's main() is redefined as SDL_main, and libSDLmain is 17 linked, then this file will create the standard exit callback, 18 define the PSP_MODULE_INFO macro, and exit back to the browser when 19 the program is finished. 20 21 You can still override other parameters in your own code if you 22 desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR, 23 PSP_MAIN_THREAD_STACK_SIZE, etc. 24*/ 25 26PSP_MODULE_INFO("SDL App", 0, 1, 1); 27 28int sdl_psp_exit_callback(int arg1, int arg2, void *common) 29{ 30 exit(0); 31 return 0; 32} 33 34int sdl_psp_callback_thread(SceSize args, void *argp) 35{ 36 int cbid; 37 cbid = sceKernelCreateCallback("Exit Callback", 38 sdl_psp_exit_callback, NULL); 39 sceKernelRegisterExitCallback(cbid); 40 sceKernelSleepThreadCB(); 41 return 0; 42} 43 44int sdl_psp_setup_callbacks(void) 45{ 46 int thid = 0; 47 thid = sceKernelCreateThread("update_thread", 48 sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0); 49 if(thid >= 0) 50 sceKernelStartThread(thid, 0, 0); 51 return thid; 52} 53 54int main(int argc, char *argv[]) 55{ 56 pspDebugScreenInit(); 57 sdl_psp_setup_callbacks(); 58 59 /* Register sceKernelExitGame() to be called when we exit */ 60 atexit(sceKernelExitGame); 61 62 SDL_SetMainReady(); 63 64 (void)SDL_main(argc, argv); 65 return 0; 66} 67 68#endif /* __PSP__ */ 69 70/* vi: set ts=4 sw=4 expandtab: */ 71[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.