int myIoCloseAsync(SceUID fd) { int ret; if (is_nodrm_fd(fd)) { ret = sceIoCloseAsync(fd); if (ret == 0) { ret = remove_nodrm_fd(fd); if (ret < 0) { printk("%s: remove_nodrm_fd -> %d\n", __func__, ret); } ret = 0; } else { printk("%s: sceIoCloseAsync 0x%08X -> 0x%08X\n", __func__, fd, ret); } // printk("%s: 0x%08X -> 0x%08X\n", __func__, fd, ret); } else { ret = sceIoCloseAsync(fd); } return ret; }
void checkIo(int doDispatch) { char temp[128]; SceUID fd = sceIoOpen("dispatch.prx", PSP_O_RDONLY, 0777); dispatchCheckpoint("sceIoOpen: %08x", fd >= 0 ? 1 : fd); dispatchCheckpoint("sceIoRead: %08x", sceIoRead(fd, temp, sizeof(temp))); dispatchCheckpoint("sceIoClose: %08x", sceIoClose(fd)); int state; if (doDispatch) { ++ignoreResched; state = sceKernelSuspendDispatchThread(); dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state); } fd = sceIoOpen("dispatch.prx", PSP_O_RDONLY, 0777); dispatchCheckpoint("sceIoOpen: %08x", fd >= 0 ? 1 : fd); dispatchCheckpoint("sceIoRead: %08x", sceIoRead(fd, temp, sizeof(temp))); dispatchCheckpoint("sceIoClose: %08x", sceIoClose(fd)); if (doDispatch) { dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state)); --ignoreResched; } SceInt64 res = -1; int result = -1; fd = sceIoOpenAsync("dispatch.prx", PSP_O_RDONLY, 0777); dispatchCheckpoint("sceIoOpenAsync: %08x", fd >= 0 ? 1 : fd); if (doDispatch) { ++ignoreResched; state = sceKernelSuspendDispatchThread(); dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state); } result = sceIoPollAsync(fd, &res); dispatchCheckpoint("sceIoPollAsync: %08x / %016llx", result, res >= 0 ? 1LL : res); result = sceIoGetAsyncStat(fd, 1, &res); dispatchCheckpoint("sceIoGetAsyncStat: %08x / %016llx", result, res >= 0 ? 1LL : res); result = sceIoGetAsyncStat(fd, 0, &res); dispatchCheckpoint("sceIoGetAsyncStat: %08x / %016llx", result, res >= 0 ? 1LL : res); result = sceIoWaitAsync(fd, &res); dispatchCheckpoint("sceIoWaitAsync: %08x / %016llx", result, res >= 0 ? 1LL : res); if (doDispatch) { dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state)); --ignoreResched; } result = sceIoWaitAsync(fd, &res); dispatchCheckpoint("sceIoWaitAsync: %08x / %016llx", result, res >= 0 ? 1LL : res); if (doDispatch) { ++ignoreResched; state = sceKernelSuspendDispatchThread(); dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state); } dispatchCheckpoint("sceIoRead: %08x", sceIoRead(fd, temp, sizeof(temp))); dispatchCheckpoint("sceIoWrite: %08x", sceIoWrite(1, "Hello.", sizeof("Hello."))); if (doDispatch) { dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state)); --ignoreResched; } dispatchCheckpoint("sceIoCloseAsync: %08x", sceIoCloseAsync(fd)); result = sceIoWaitAsync(fd, &res); dispatchCheckpoint("sceIoWaitAsync: %08x / %016llx", result, res); }