X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fpsp%2Fpsp.c;h=c8d73acad2c60e1bb33047c0c92b6be25b0ea1a8;hb=b542be4686241c9e0722ff8e452980f9ac2b4d7c;hp=05af63d6126039bf6d17e63b53d270f2cfb8d7fb;hpb=8022f53da61b8e70420a3bac97250119bbe26457;p=picodrive.git diff --git a/platform/psp/psp.c b/platform/psp/psp.c index 05af63d..c8d73ac 100644 --- a/platform/psp/psp.c +++ b/platform/psp/psp.c @@ -10,6 +10,7 @@ #include #include "psp.h" +#include "emu.h" #include "../common/lprintf.h" PSP_MODULE_INFO("PicoDrive", 0, 1, 34); @@ -28,6 +29,19 @@ static int exit_callback(int arg1, int arg2, void *common) return 0; } +/* Power Callback */ +static int power_callback(int unknown, int pwrflags, void *common) +{ + /* check for power switch and suspending as one is manual and the other automatic */ + if (pwrflags & PSP_POWER_CB_POWER_SWITCH || pwrflags & PSP_POWER_CB_SUSPENDING) + { + lprintf("power_callback: flags: 0x%08X: suspending\n", pwrflags); + engineState = PGS_Menu; + } + sceDisplayWaitVblankStart(); + return 0; +} + /* Callback thread */ static int callback_thread(SceSize args, void *argp) { @@ -38,6 +52,8 @@ static int callback_thread(SceSize args, void *argp) cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); + cbid = sceKernelCreateCallback("Power Callback", power_callback, NULL); + scePowerRegisterCallback(0, cbid); sceKernelSleepThreadCB();