mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
Optimize sysclock / sysclock 2 usec.
Legend of Heroes 1/2/3 call these a ton, making them quite slow. Not sure if it's a bug, but they can be more optimal which'll make it easier to debug anyway.
This commit is contained in:
parent
015529cb49
commit
ac8b35b2ef
@ -603,7 +603,7 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0x57CF62DD,WrapU_U<sceKernelGetThreadmanIdType>,"sceKernelGetThreadmanIdType"},
|
||||
|
||||
{0x82BC5777,sceKernelGetSystemTimeWide,"sceKernelGetSystemTimeWide"},
|
||||
{0xdb738f35,sceKernelGetSystemTime,"sceKernelGetSystemTime"},
|
||||
{0xdb738f35,WrapI_U<sceKernelGetSystemTime>,"sceKernelGetSystemTime"},
|
||||
{0x369ed59d,sceKernelGetSystemTimeLow,"sceKernelGetSystemTimeLow"},
|
||||
|
||||
{0x8218B4DD,&WrapU_U<sceKernelReferGlobalProfiler>,"sceKernelReferGlobalProfiler"},
|
||||
@ -616,7 +616,7 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0x7e65b999,WrapI_I<sceKernelCancelAlarm>,"sceKernelCancelAlarm"},
|
||||
{0xDAA3F564,WrapI_IU<sceKernelReferAlarmStatus>,"sceKernelReferAlarmStatus"},
|
||||
|
||||
{0xba6b92e2,sceKernelSysClock2USec,"sceKernelSysClock2USec"},
|
||||
{0xba6b92e2,WrapI_UUU<sceKernelSysClock2USec>,"sceKernelSysClock2USec"},
|
||||
{0x110DEC9A,0,"sceKernelUSec2SysClock"},
|
||||
{0xC8CD158C,WrapU_U<sceKernelUSec2SysClockWide>,"sceKernelUSec2SysClockWide"},
|
||||
{0xE1619D7C,sceKernelSysClock2USecWide,"sceKernelSysClock2USecWide"},
|
||||
|
@ -58,14 +58,12 @@ struct SceKernelSysClock
|
||||
u32 hi;
|
||||
};
|
||||
|
||||
void sceKernelGetSystemTime()
|
||||
int sceKernelGetSystemTime(u32 sysclockPtr)
|
||||
{
|
||||
SceKernelSysClock *clock = (SceKernelSysClock*)Memory::GetPointer(PARAM(0));
|
||||
u64 t = CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz();
|
||||
clock->lo = (u32)t;
|
||||
clock->hi = t >> 32;
|
||||
DEBUG_LOG(HLE,"sceKernelGetSystemTime(out:%08x%08x)",clock->hi, clock->lo);
|
||||
RETURN(0);
|
||||
Memory::Write_U64(t, sysclockPtr);
|
||||
DEBUG_LOG(HLE, "sceKernelGetSystemTime(out:%16llx)", t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sceKernelGetSystemTimeLow()
|
||||
@ -93,17 +91,17 @@ void sceKernelUSec2SysClock()
|
||||
RETURN(0);
|
||||
}
|
||||
|
||||
void sceKernelSysClock2USec()
|
||||
int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
|
||||
{
|
||||
SceKernelSysClock clock;
|
||||
Memory::ReadStruct(PARAM(0), &clock);
|
||||
DEBUG_LOG(HLE, "sceKernelSysClock2USec(clock = , lo = %08x, hi = %08x)", PARAM(1), PARAM(2));
|
||||
u64 time = clock.lo | ((u64)clock.hi << 32);
|
||||
if (Memory::IsValidAddress(PARAM(1)))
|
||||
Memory::Write_U32((u32)(time / 1000000), PARAM(1));
|
||||
if (Memory::IsValidAddress(PARAM(2)))
|
||||
Memory::Write_U32((u32)(time % 1000000), PARAM(2));
|
||||
RETURN(0);
|
||||
DEBUG_LOG(HLE, "sceKernelSysClock2USec(clock = %08x, lo = %08x, hi = %08x)", sysclockPtr, highPtr, lowPtr);
|
||||
u64 time = Memory::Read_U64(sysclockPtr);
|
||||
u32 highResult = (u32)(time / 1000000);
|
||||
u32 lowResult = (u32)(time % 1000000);
|
||||
if (Memory::IsValidAddress(highPtr))
|
||||
Memory::Write_U32(highResult, highPtr);
|
||||
if (Memory::IsValidAddress(lowPtr))
|
||||
Memory::Write_U32(lowResult, lowPtr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sceKernelSysClock2USecWide()
|
||||
|
@ -20,10 +20,10 @@
|
||||
u32 sceKernelLibcGettimeofday(u32 timeAddr);
|
||||
u32 sceKernelLibcTime(u32 outPtr);
|
||||
void sceKernelUSec2SysClock();
|
||||
void sceKernelGetSystemTime();
|
||||
int sceKernelGetSystemTime(u32 sysclockPtr);
|
||||
void sceKernelGetSystemTimeLow();
|
||||
void sceKernelGetSystemTimeWide();
|
||||
void sceKernelSysClock2USec();
|
||||
int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr);
|
||||
void sceKernelSysClock2USecWide();
|
||||
u32 sceKernelUSec2SysClockWide(u32 usec);
|
||||
u32 sceKernelLibcClock();
|
||||
|
Loading…
Reference in New Issue
Block a user