Debian Codegraph @

port/psp/pspmain.cpp

raw
1
2 #include <SDL.h>
3 //#include "hamfake.h"
4 #define APP_TITLE "Powder"
5
6 // PSP
7
8 #define SDL_main main
9 #include <pspsdk.h>
10 #include <psppower.h>
11 #include <pspkernel.h>
12 #include <pspdebug.h>
13 #include <pspdisplay.h>
14
15 PSP_MODULE_INFO(APP_TITLE, 0, 1, 1);
16 PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
17 //PSP_HEAP_SIZE_KB(20480);
18
19 #define printf pspDebugScreenPrintf
20
21 int ExitCallback(int arg1, int arg2, void *common)
22 {
23 sceKernelExitGame();
24 return 0;
25 }
26
27 int CallbackThread(SceSize args, void *argp)
28 {
29 int cbid;
30 cbid = sceKernelCreateCallback("exit_callback", ExitCallback, NULL);
31 sceKernelRegisterExitCallback(cbid);
32 sceKernelSleepThreadCB();
33 return 0;
34 }
35
36 int SystemSetup(void)
37 {
38 scePowerSetClockFrequency(333, 333, 166);
39 sceDisplaySetMode(0, 480, 272);
40 pspDebugScreenInit();
41
42 int thid = 0;
43 thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
44 if (thid >= 0)
45 sceKernelStartThread(thid, 0, 0);
46
47 return thid;
48 }
49
50 void SystemShutdown()
51 {
52 sceKernelSleepThread();
53 }
54
55
56 #ifdef main
57 #undef main
58 #endif
59 #define main gba_main
60
61 #include "../../main.cpp"
62
63 #undef main
64
65 int main(int argc, char *argv[])
66 {
67 SystemSetup();
68
69 // run
70 gba_main();
71
72 SDL_Quit();
73 SystemShutdown();
74 return 0;
75 }