X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fpsp%2Fpsp.c;h=6b65c2a641e97a684588b5cb51b243841f5b2312;hb=ff6b7429bb03e37e2d44eabcd0d86bd5713d2fc1;hp=c507e5dade43eb710b08b0911ae7f79f357b8290;hpb=2445b7cb6d5a0f0aa8697fdaa8af8ca52780f5b7;p=picodrive.git diff --git a/platform/psp/psp.c b/platform/psp/psp.c index c507e5d..6b65c2a 100644 --- a/platform/psp/psp.c +++ b/platform/psp/psp.c @@ -44,7 +44,12 @@ int main() thid = sceKernelCreateThread("pico_main", (SceKernelThreadEntry) pico_main, 32, 0x2000, PSP_THREAD_ATTR_USER, NULL); if (thid >= 0) sceKernelStartThread(thid, 0, 0); +#ifndef GCOV sceKernelExitDeleteThread(0); +#else + while (engineState != PGS_Quit) + sceKernelDelayThread(1024 * 1024); +#endif return 0; } @@ -70,12 +75,21 @@ static int exit_callback(int arg1, int arg2, void *common) /* Power Callback */ static int power_callback(int unknown, int pwrflags, void *common) { + static int old_state = PGS_Menu; + + lprintf("power_callback: flags: 0x%08X\n", pwrflags); + /* 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) + if (pwrflags & PSP_POWER_CB_POWER_SWITCH || pwrflags & PSP_POWER_CB_SUSPENDING || pwrflags & PSP_POWER_CB_STANDBY) { - lprintf("power_callback: flags: 0x%08X: suspending\n", pwrflags); - engineState = PGS_Menu; + if (engineState != PGS_Suspending) { + old_state = engineState; + engineState = PGS_Suspending; + } } + else if (pwrflags & PSP_POWER_CB_RESUME_COMPLETE) + engineState = old_state; + //sceDisplayWaitVblankStart(); return 0; } @@ -238,6 +252,12 @@ char *psp_get_status_line(void) return buff; } +void psp_wait_suspend(void) +{ + // probably should do something smarter here? + sceDisplayWaitVblankStart(); +} + /* alt logging */ #define LOG_FILE "log.txt" @@ -251,7 +271,7 @@ typedef struct _log_entry static log_entry *le_root = NULL; #endif -void lprintf_f(const char *fmt, ...) +void lprintf(const char *fmt, ...) { va_list vl;