+char *psp_get_status_line(void)
+{
+ static char buff[64];
+ int ret, bat_percent, bat_time;
+ pspTime time;
+
+ ret = sceRtcGetCurrentClockLocalTime(&time);
+ bat_percent = scePowerGetBatteryLifePercent();
+ bat_time = scePowerGetBatteryLifeTime();
+ if (ret < 0 || bat_percent < 0 || bat_time < 0) return NULL;
+
+ snprintf(buff, sizeof(buff), "%02i:%02i bat: %3i%%", time.hour, time.minutes, bat_percent);
+ if (!scePowerIsPowerOnline())
+ snprintf(buff+strlen(buff), sizeof(buff)-strlen(buff), " (%i:%02i)", bat_time/60, bat_time%60);
+ return buff;
+}
+
+void psp_wait_suspend(void)
+{
+ // probably should do something smarter here?
+ sceDisplayWaitVblankStart();
+}
+
+void psp_resume_suspend(void)
+{
+ // for some reason file IO doesn't seem to work
+ // after resume for some period of time, at least on 1.5
+ SceUID fd;
+ int i;
+ for (i = 0; i < 30; i++) {
+ fd = sceIoOpen("EBOOT.PBP", PSP_O_RDONLY, 0777);
+ if (fd >= 0) break;
+ sceKernelDelayThread(100 * 1024);
+ }
+ if (fd >= 0) sceIoClose(fd);
+ sceDisplayWaitVblankStart();
+ if (i < 30)
+ lprintf("io resumed after %i tries\n", i);
+ else {
+ lprintf("io resume failed with %08x\n", fd);
+ sceKernelDelayThread(500 * 1024);
+ }
+}
+