Advertisement
max_ishere

psp-dev main.cpp

Apr 19th, 2021
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <pspkernel.h>
  2. #include <pspdebug.h>
  3.  
  4. PSP_MODULE_INFO("Tutorial", 0, 1, 0);
  5.  
  6. int exit_callback(int arg1, int arg2, void* common){
  7.     sceKernelExitGame();
  8.     return 0;
  9. }
  10.  
  11. int CallbackThread(SceSize args, void* argp) {
  12.     int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
  13.     sceKernelRegisterExitCallback(cbid);
  14.     sceKernelSleepThreadCB();
  15.  
  16.     return 0;
  17. }
  18.  
  19. int SetupCallbacks(void) {
  20.     int thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
  21.     if (thid >= 0) {
  22.         sceKernelStartThread(thid, 0, 0);
  23.     }
  24.     return thid;
  25. }
  26.  
  27. int main() { //In C++ `auto main() -> int` is also valid.
  28.     SetupCallbacks();
  29.     pspDebugScreenInit();
  30.     pspDebugScreenPrintf("Hello World!");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement