Advertisement
Guest User

PSP User Input callback.c

a guest
Feb 12th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1.  
  2. #include <pspkernel.h>
  3.  
  4. static int exitRequest  = 1;
  5.  
  6. int isRunning()
  7. {
  8.     return exitRequest;
  9. }
  10.  
  11. int exitCallback(int arg1, int arg2, void *common)
  12. {
  13.     exitRequest = 0;
  14.     return 0;
  15. }
  16.  
  17. int callbackThread(SceSize args, void *argp)
  18. {
  19.     int callbackID;
  20.  
  21.     callbackID = sceKernelCreateCallback("Exit Callback", exitCallback, NULL);
  22.     sceKernelRegisterExitCallback(callbackID);
  23.  
  24.     sceKernelSleepThreadCB();
  25.  
  26.     return 0;
  27. }
  28.  
  29. int setupExitCallback()
  30. {
  31.     int threadID = 0;
  32.  
  33.     threadID = sceKernelCreateThread("Callback Update Thread", callbackThread, 0x11, 0xFA0, THREAD_ATTR_USER, 0);
  34.      
  35.     if(threadID >= 0)
  36.     {
  37.         sceKernelStartThread(threadID, 0, 0);
  38.     }
  39.  
  40.     return threadID;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement