Atlas - SDL_sysmain_runapp.c

Home / ext / SDL / src / main / psp Lines: 1 | Size: 2589 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21 22#include "SDL_internal.h" 23 24#ifdef SDL_PLATFORM_PSP 25 26// SDL_RunApp() for PSP based on SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14 27 28#include <pspkernel.h> 29#include <pspthreadman.h> 30#include "../../events/SDL_events_c.h" 31#include "../SDL_main_callbacks.h" 32 33/* If application's main() is redefined as SDL_main, and libSDL_main is 34 linked, then this file will create the standard exit callback, 35 define the PSP_MODULE_INFO macro, and exit back to the browser when 36 the program is finished. 37 38 You can still override other parameters in your own code if you 39 desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR, 40 PSP_MAIN_THREAD_STACK_SIZE, etc. 41*/ 42 43PSP_MODULE_INFO("SDL App", 0, 1, 0); 44PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU | THREAD_ATTR_USER); 45 46int sdl_psp_exit_callback(int arg1, int arg2, void *common) 47{ 48 SDL_SendQuit(); 49 return 0; 50} 51 52int sdl_psp_callback_thread(SceSize args, void *argp) 53{ 54 int cbid; 55 cbid = sceKernelCreateCallback("Exit Callback", 56 sdl_psp_exit_callback, NULL); 57 sceKernelRegisterExitCallback(cbid); 58 sceKernelSleepThreadCB(); 59 return 0; 60} 61 62int sdl_psp_setup_callbacks(void) 63{ 64 int thid; 65 thid = sceKernelCreateThread("update_thread", 66 sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0); 67 if (thid >= 0) { 68 sceKernelStartThread(thid, 0, 0); 69 } 70 return thid; 71} 72 73int SDL_RunApp(int argc, char *argv[], SDL_main_func mainFunction, void * reserved) 74{ 75 (void)reserved; 76 77 sdl_psp_setup_callbacks(); 78 79 return SDL_CallMainFunction(argc, argv, mainFunction); 80} 81 82#endif // SDL_PLATFORM_PSP 83
[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.