+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("dummy.txt", PSP_O_WRONLY|PSP_O_APPEND, 0777);
+ if (fd != 0x80010013) break; // device not available
+ sceKernelDelayThread(32 * 1024);
+ }
+ if (fd >= 0) sceIoClose(fd);
+ sceDisplayWaitVblankStart();
+ psp_unhandled_suspend = 0;
+ if (i < 30)
+ lprintf("io resumed after %i tries\n", i);
+ else lprintf("io resume failed\n");
+}
+