mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Implement sceKernelDelaySysClockThreadCB
This commit is contained in:
parent
b283b915cb
commit
9fe592e83a
@ -523,8 +523,8 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0x71bc9871,sceKernelChangeThreadPriority,"sceKernelChangeThreadPriority"},
|
||||
{0x446D8DE6,WrapI_CUUIUU<sceKernelCreateThread>,"sceKernelCreateThread"},
|
||||
{0x9fa03cd3,WrapI_I<sceKernelDeleteThread>,"sceKernelDeleteThread"},
|
||||
{0xBD123D9E,0,"sceKernelDelaySysClockThread"},
|
||||
{0x1181E963,0,"sceKernelDelaySysClockThreadCB"},
|
||||
{0xBD123D9E,sceKernelDelaySysClockThread,"sceKernelDelaySysClockThread"},
|
||||
{0x1181E963,sceKernelDelaySysClockThreadCB,"sceKernelDelaySysClockThreadCB"},
|
||||
{0xceadeb47,sceKernelDelayThread,"sceKernelDelayThread"},
|
||||
{0x68da9e36,sceKernelDelayThreadCB,"sceKernelDelayThreadCB"},
|
||||
{0xaa73c935,sceKernelExitThread,"sceKernelExitThread"},
|
||||
|
@ -1051,7 +1051,7 @@ void hleScheduledWakeup(u64 userdata, int cyclesLate)
|
||||
__KernelTriggerWait(WAITTYPE_DELAY, threadID, true);
|
||||
}
|
||||
|
||||
void __KernelScheduleWakeup(SceUID threadID, int usFromNow)
|
||||
void __KernelScheduleWakeup(SceUID threadID, s64 usFromNow)
|
||||
{
|
||||
s64 cycles = usToCycles(usFromNow);
|
||||
CoreTiming::ScheduleEvent(cycles, eventScheduledWakeup, threadID);
|
||||
@ -1667,6 +1667,47 @@ void sceKernelDelayThread()
|
||||
u32 usec = PARAM(0);
|
||||
if (usec < 200) usec = 200;
|
||||
DEBUG_LOG(HLE,"sceKernelDelayThread(%i usec)",usec);
|
||||
|
||||
SceUID curThread = __KernelGetCurThread();
|
||||
__KernelScheduleWakeup(curThread, usec);
|
||||
__KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, false);
|
||||
}
|
||||
|
||||
void sceKernelDelaySysClockThreadCB()
|
||||
{
|
||||
u32 sysclockAddr = PARAM(0);
|
||||
if (!Memory::IsValidAddress(sysclockAddr)) {
|
||||
ERROR_LOG(HLE, "sceKernelDelaySysClockThread(%08x) - bad pointer", sysclockAddr);
|
||||
RETURN(-1);
|
||||
return;
|
||||
}
|
||||
SceKernelSysClock sysclock;
|
||||
Memory::ReadStruct(sysclockAddr, &sysclock);
|
||||
|
||||
// TODO: Which unit?
|
||||
u64 usec = sysclock.lo | ((u64)sysclock.hi << 32);
|
||||
INFO_LOG(HLE, "sceKernelDelaySysClockThread(%08x (%llu))", sysclockAddr, usec);
|
||||
|
||||
SceUID curThread = __KernelGetCurThread();
|
||||
__KernelScheduleWakeup(curThread, usec);
|
||||
__KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, true);
|
||||
}
|
||||
|
||||
void sceKernelDelaySysClockThread()
|
||||
{
|
||||
u32 sysclockAddr = PARAM(0);
|
||||
if (!Memory::IsValidAddress(sysclockAddr)) {
|
||||
ERROR_LOG(HLE, "sceKernelDelaySysClockThread(%08x) - bad pointer", sysclockAddr);
|
||||
RETURN(-1);
|
||||
return;
|
||||
}
|
||||
SceKernelSysClock sysclock;
|
||||
Memory::ReadStruct(sysclockAddr, &sysclock);
|
||||
|
||||
// TODO: Which unit?
|
||||
u64 usec = sysclock.lo | ((u64)sysclock.hi << 32);
|
||||
INFO_LOG(HLE, "sceKernelDelaySysClockThread(%08x (%llu))", sysclockAddr, usec);
|
||||
|
||||
SceUID curThread = __KernelGetCurThread();
|
||||
__KernelScheduleWakeup(curThread, usec);
|
||||
__KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, false);
|
||||
|
@ -29,6 +29,8 @@ void sceKernelChangeThreadPriority();
|
||||
int sceKernelCreateThread(const char *threadName, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr);
|
||||
void sceKernelDelayThread();
|
||||
void sceKernelDelayThreadCB();
|
||||
void sceKernelDelaySysClockThread();
|
||||
void sceKernelDelaySysClockThreadCB();
|
||||
int sceKernelDeleteThread(int threadHandle);
|
||||
void sceKernelExitDeleteThread();
|
||||
void sceKernelExitThread();
|
||||
@ -109,7 +111,7 @@ void __KernelThreadingShutdown();
|
||||
KernelObject *__KernelThreadObject();
|
||||
KernelObject *__KernelCallbackObject();
|
||||
|
||||
void __KernelScheduleWakeup(int usFromNow, int threadnumber);
|
||||
void __KernelScheduleWakeup(int threadnumber, s64 usFromNow);
|
||||
SceUID __KernelGetCurThread();
|
||||
|
||||
void __KernelSaveContext(ThreadContext *ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user