Advertisement
GeeckoDev

HW4PSP

Apr 14th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.47 KB | None | 0 0
  1. /***************************************************************************
  2.  *   Copyright (C) 2008 by Geecko   *
  3.  *      *
  4.  *                                                                         *
  5.  *   This program is free software; you can redistribute it and/or modify  *
  6.  *   it under the terms of the GNU General Public License as published by  *
  7.  *   the Free Software Foundation; either version 2 of the License, or     *
  8.  *   (at your option) any later version.                                   *
  9.  *                                                                         *
  10.  *   This program is distributed in the hope that it will be useful,       *
  11.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  12.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  13.  *   GNU General Public License for more details.                          *
  14.  *                                                                         *
  15.  *   You should have received a copy of the GNU General Public License     *
  16.  *   along with this program; if not, write to the                         *
  17.  *   Free Software Foundation, Inc.,                                       *
  18.  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  19.  ***************************************************************************/
  20.  
  21.  
  22. #include <pspkernel.h>
  23. #include <pspdebug.h>
  24. #include <oslib/oslib.h>
  25.  
  26. PSP_MODULE_INFO("Hello World", 0, 1, 1);
  27. PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
  28.  
  29.  
  30. #define printf pspDebugScreenPrintf
  31.  
  32. /* Exit callback */
  33. int exit_callback(int arg1, int arg2, void *common) {
  34.           sceKernelExitGame();
  35.           return 0;
  36. }
  37.  
  38. /* Callback thread */
  39. int CallbackThread(SceSize args, void *argp) {
  40.           int cbid;
  41.  
  42.           cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
  43.           sceKernelRegisterExitCallback(cbid);
  44.  
  45.           sceKernelSleepThreadCB();
  46.  
  47.           return 0;
  48. }
  49.  
  50. /* Sets up the callback thread and returns its thread id */
  51. int SetupCallbacks(void) {
  52.           int thid = 0;
  53.  
  54.           thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
  55.           if(thid >= 0) {
  56.                     sceKernelStartThread(thid, 0, 0);
  57.           }
  58.  
  59.           return thid;
  60. }
  61.  
  62.  
  63. int main() {
  64.        pspDebugScreenInit();
  65.        SetupCallbacks();
  66.        printf("Hello World !\n\nBy Geecko");
  67.        sceKernelSleepThread();
  68.        return 0;
  69.            }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement