zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_psp_main.c
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
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_main.h"
23 #include <pspkernel.h>
24 #include <pspdebug.h>
25 #include <pspsdk.h>
26 #include <pspthreadman.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 
30 /* If application's main() is redefined as SDL_main, and libSDLmain is
31  linked, then this file will create the standard exit callback,
32  define the PSP_MODULE_INFO macro, and exit back to the browser when
33  the program is finished.
34 
35  You can still override other parameters in your own code if you
36  desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR,
37  PSP_MAIN_THREAD_STACK_SIZE, etc.
38 */
39 
40 PSP_MODULE_INFO("SDL App", 0, 1, 1);
41 
42 int sdl_psp_exit_callback(int arg1, int arg2, void *common)
43 {
44  exit(0);
45  return 0;
46 }
47 
48 int sdl_psp_callback_thread(SceSize args, void *argp)
49 {
50  int cbid;
51  cbid = sceKernelCreateCallback("Exit Callback",
53  sceKernelRegisterExitCallback(cbid);
54  sceKernelSleepThreadCB();
55  return 0;
56 }
57 
59 {
60  int thid = 0;
61  thid = sceKernelCreateThread("update_thread",
62  sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
63  if(thid >= 0)
64  sceKernelStartThread(thid, 0, 0);
65  return thid;
66 }
67 
68 int main(int argc, char *argv[])
69 {
70  pspDebugScreenInit();
72 
73  /* Register sceKernelExitGame() to be called when we exit */
74  atexit(sceKernelExitGame);
75 
77 
78  (void)SDL_main(argc, argv);
79  return 0;
80 }
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
int main(int argc, char **argv)
Definition: bootstrap.cpp:102
DECLSPEC void SDL_SetMainReady(void)
Definition: SDL.c:97
#define NULL
Definition: ftobjs.h:61
PSP_MODULE_INFO("SDL App", 0, 1, 1)
GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glew.h:7549
GLuint GLuint GLuint arg1
Definition: glew.h:7548
int sdl_psp_setup_callbacks(void)
Definition: SDL_psp_main.c:58
int sdl_psp_exit_callback(int arg1, int arg2, void *common)
Definition: SDL_psp_main.c:42
int sdl_psp_callback_thread(SceSize args, void *argp)
Definition: SDL_psp_main.c:48
C_LINKAGE int SDL_main(int argc, char *argv[])