123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #include <pspkernel.h>
- #include <pspdebug.h>
- #include <pspsdk.h>
- #include <psppower.h>
- #include <pspthreadman.h>
- #include <stdlib.h>
- #include <stdio.h>
- #define PSP_HEAP_MEMSIZE 12288
- PSP_MODULE_INFO("SDLPAL", 0, 1, 1);
- PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
- PSP_HEAP_SIZE_KB(PSP_HEAP_MEMSIZE);
- int PSPExitCallback(int arg1, int arg2, void *common)
- {
- exit(0);
- return 0;
- }
- int PSPSuspendCallback(int arg1, int pwrflags, void *common)
- {
- if (pwrflags & PSP_POWER_CB_RESUME_COMPLETE)
- {
- UTIL_CloseFile(gpGlobals->f.fpFBP);
- UTIL_CloseFile(gpGlobals->f.fpMGO);
- UTIL_CloseFile(gpGlobals->f.fpBALL);
- UTIL_CloseFile(gpGlobals->f.fpDATA);
- UTIL_CloseFile(gpGlobals->f.fpF);
- UTIL_CloseFile(gpGlobals->f.fpFIRE);
- UTIL_CloseFile(gpGlobals->f.fpRGM);
- UTIL_CloseFile(gpGlobals->f.fpSSS);
- gpGlobals->f.fpFBP = UTIL_OpenRequiredFile("fbp.mkf");
- gpGlobals->f.fpDATA = UTIL_OpenRequiredFile("data.mkf");
- gpGlobals->f.fpFIRE = UTIL_OpenRequiredFile("fire.mkf");
- gpGlobals->f.fpSSS = UTIL_OpenRequiredFile("sss.mkf");
- gpGlobals->lpObjectDesc = PAL_LoadObjectDesc(va("%s%s", PAL_PREFIX, "desc.dat"));
- SOUND_ReloadVOC();
- }
- int cbid;
- cbid = sceKernelCreateCallback("suspend Callback", PSPSuspendCallback, NULL);
- scePowerRegisterCallback(0, cbid);
- return 0;
- }
- int PSPRegisterCallbackThread(SceSize args, void *argp)
- {
- int cbid;
- cbid = sceKernelCreateCallback("Exit Callback", PSPExitCallback, NULL);
- sceKernelRegisterExitCallback(cbid);
- cbid = sceKernelCreateCallback("suspend Callback", PSPSuspendCallback, NULL);
- scePowerRegisterCallback(0, cbid);
- sceKernelSleepThreadCB();
- return 0;
- }
- int PSPSetupCallbacks(void)
- {
- int thid = 0;
- thid = sceKernelCreateThread("update_thread", PSPRegisterCallbackThread, 0x11, 0xFA0, 0, 0);
- if(thid >= 0)
- sceKernelStartThread(thid, 0, 0);
- return thid;
- }
- void sdlpal_psp_init(void)
- {
-
- pspDebugScreenInit();
-
- PSPSetupCallbacks();
-
- atexit(sceKernelExitGame);
-
- scePowerSetClockFrequency(333 , 333 , 166);
- }
|