File: pspmain.cpp

package info (click to toggle)
powder 117-2
  • links: PTS
  • area: non-free
  • in suites: stretch
  • size: 10,576 kB
  • ctags: 3,545
  • sloc: cpp: 55,002; makefile: 541; sh: 258; objc: 245; ansic: 107; csh: 54
file content (75 lines) | stat: -rw-r--r-- 1,309 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

#include <SDL.h>
//#include "hamfake.h"
#define APP_TITLE "Powder"

// PSP

#define SDL_main main
#include <pspsdk.h>
#include <psppower.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>

PSP_MODULE_INFO(APP_TITLE, 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
//PSP_HEAP_SIZE_KB(20480);

#define printf pspDebugScreenPrintf

int ExitCallback(int arg1, int arg2, void *common)
{
  sceKernelExitGame();
  return 0;
}

int CallbackThread(SceSize args, void *argp)
{
  int cbid;
  cbid = sceKernelCreateCallback("exit_callback", ExitCallback, NULL);
  sceKernelRegisterExitCallback(cbid);
  sceKernelSleepThreadCB();
  return 0;
}

int SystemSetup(void)
{
  scePowerSetClockFrequency(333, 333, 166);
  sceDisplaySetMode(0, 480, 272);
  pspDebugScreenInit();

  int thid = 0;
  thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
  if (thid >= 0)
    sceKernelStartThread(thid, 0, 0);

  return thid;
}

void SystemShutdown()
{
  sceKernelSleepThread();
}


#ifdef main
#undef main
#endif
#define main gba_main

#include "../../main.cpp"

#undef main

int main(int argc, char *argv[])
{
  SystemSetup();

  // run
  gba_main();

  SDL_Quit();
  SystemShutdown();
  return 0;
}