mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Correct sceKernelSetVTimerTime*().
This commit is contained in:
parent
29d7d00b08
commit
67cd13702e
4 changed files with 16 additions and 13 deletions
|
@ -34,6 +34,14 @@ template<u64 func(u32)> void WrapU64_U() {
|
|||
currentMIPS->r[3] = (retval >> 32) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
template<u64 func(u32, u64)> void WrapU64_UU64() {
|
||||
u64 param_one = currentMIPS->r[6];
|
||||
param_one |= (u64)(currentMIPS->r[7]) << 32;
|
||||
u64 retval = func(PARAM(0), param_one);
|
||||
currentMIPS->r[2] = retval & 0xFFFFFFFF;
|
||||
currentMIPS->r[3] = (retval >> 32) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
template<int func(int, u64)> void WrapI_IU64() {
|
||||
u64 param_one = currentMIPS->r[6];
|
||||
param_one |= (u64)(currentMIPS->r[7]) << 32;
|
||||
|
|
|
@ -844,7 +844,7 @@ const HLEFunction ThreadManForUser[] =
|
|||
{0xC0B3FFD2,WrapU64_U<sceKernelGetVTimerTimeWide>,"sceKernelGetVTimerTimeWide"},
|
||||
{0x5F32BEAA,WrapU_UU<sceKernelReferVTimerStatus>,"sceKernelReferVTimerStatus"},
|
||||
{0x542AD630,WrapU_UU<sceKernelSetVTimerTime>,"sceKernelSetVTimerTime"},
|
||||
{0xFB6425C3,WrapU_UU64<sceKernelSetVTimerTimeWide>,"sceKernelSetVTimerTimeWide"},
|
||||
{0xFB6425C3,WrapU64_UU64<sceKernelSetVTimerTimeWide>,"sceKernelSetVTimerTimeWide"},
|
||||
{0xd8b299ae,WrapU_UUUU<sceKernelSetVTimerHandler>,"sceKernelSetVTimerHandler"},
|
||||
{0x53B00E9A,WrapU_UU64UU<sceKernelSetVTimerHandlerWide>,"sceKernelSetVTimerHandlerWide"},
|
||||
|
||||
|
|
|
@ -294,10 +294,9 @@ u64 sceKernelGetVTimerTimeWide(u32 uid) {
|
|||
return time;
|
||||
}
|
||||
|
||||
u64 __setVTimer(VTimer *vt, u64 time) {
|
||||
u64 __KernelSetVTimer(VTimer *vt, u64 time) {
|
||||
u64 current = __getVTimerCurrentTime(vt);
|
||||
vt->nvt.base = vt->nvt.base + __getVTimerCurrentTime(vt) - time;
|
||||
vt->nvt.current = 0;
|
||||
vt->nvt.current = time;
|
||||
|
||||
return current;
|
||||
}
|
||||
|
@ -315,27 +314,23 @@ u32 sceKernelSetVTimerTime(u32 uid, u32 timeClockAddr) {
|
|||
|
||||
u64 time = Memory::Read_U64(timeClockAddr);
|
||||
if (Memory::IsValidAddress(timeClockAddr))
|
||||
Memory::Write_U64(__setVTimer(vt, time), timeClockAddr);
|
||||
Memory::Write_U64(__KernelSetVTimer(vt, time), timeClockAddr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sceKernelSetVTimerTimeWide(u32 uid, u64 timeClock) {
|
||||
u64 sceKernelSetVTimerTimeWide(u32 uid, u64 timeClock) {
|
||||
DEBUG_LOG(SCEKERNEL, "sceKernelSetVTimerTimeWide(%08x, %llu", uid, timeClock);
|
||||
|
||||
u32 error;
|
||||
VTimer *vt = kernelObjects.Get<VTimer>(uid, error);
|
||||
|
||||
if (error) {
|
||||
if (error || vt == NULL) {
|
||||
WARN_LOG(SCEKERNEL, "%08x=sceKernelSetVTimerTimeWide(%08x, %llu)", error, uid, timeClock);
|
||||
return error;
|
||||
}
|
||||
|
||||
if (vt == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return __setVTimer(vt, timeClock);
|
||||
return __KernelSetVTimer(vt, timeClock);
|
||||
}
|
||||
|
||||
void __startVTimer(VTimer *vt) {
|
||||
|
|
|
@ -30,7 +30,7 @@ u64 sceKernelGetVTimerBaseWide(u32 uid);
|
|||
u32 sceKernelGetVTimerTime(u32 uid, u32 timeClockAddr);
|
||||
u64 sceKernelGetVTimerTimeWide(u32 uid);
|
||||
u32 sceKernelSetVTimerTime(u32 uid, u32 timeClockAddr);
|
||||
u32 sceKernelSetVTimerTimeWide(u32 uid, u64 timeClock);
|
||||
u64 sceKernelSetVTimerTimeWide(u32 uid, u64 timeClock);
|
||||
|
||||
// TODO
|
||||
void _sceKernelReturnFromTimerHandler();
|
||||
|
|
Loading…
Add table
Reference in a new issue