int initRpc() { meRpc.mutex = sceKernelCreateMutex("SceMediaEngineRpc", 0x101, 0, 0); if (meRpc.mutex < 0) return meRpc.mutex; meRpc.sema = sceKernelCreateSema("SceMediaEngineAvcPower" , 0x101, 1, 1, 0); if (meRpc.sema < 0) return meRpc.sema; meRpc.event = sceKernelCreateEventFlag("SceMediaEngineRpcWait", 0x201, 0, 0); if (meRpc.event < 0) return meRpc.event; sceSysregIntrEnd(); int ret = sceKernelRegisterIntrHandler(SCE_MECODEC_INT, 2, (void*)&interruptHandler, (void*)meRpc.event, 0); if (ret < 0) return ret; return sceKernelEnableIntr(SCE_MECODEC_INT); }
s32 STimerInit() { s32 oldIntr = sceKernelCpuSuspendIntr(); s32 i; for (i = 0; i < 4; i++) { timers[i].hw->unk0 = 0x80000000; timers[i].hw->unk8 = -1; timers[i].hw->unk12 = -1; (void)timers[i].hw->unk0; timers[i].cb = NULL; timers[i].unk12 = 0; timers[i].unk16 = 0; timers[i].unk24 = 0; timers[i].unk28 = 0; timers[i].curTimer = -1; sceKernelRegisterIntrHandler(timers[i].s32Num, 2, systimerhandler, &timers[i], 0); } sceKernelRegisterSuspendHandler(10, suspendSTimer, 0); sceKernelRegisterResumeHandler(10, resumeSTimer, 0); sceKernelCpuResumeIntr(oldIntr); return 0; }