mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
Replace some hleEatCycles() with actual PSP timing.
Measured several runs at 8 per run with test overhead check.
This commit is contained in:
parent
e797ed7f95
commit
f1f2cf0603
@ -83,7 +83,7 @@ const HLEFunction UtilsForUser[] =
|
||||
{
|
||||
{0x91E4F6A7, WrapU_V<sceKernelLibcClock>, "sceKernelLibcClock"},
|
||||
{0x27CC57F0, WrapU_U<sceKernelLibcTime>, "sceKernelLibcTime"},
|
||||
{0x71EC4271, WrapU_U<sceKernelLibcGettimeofday>, "sceKernelLibcGettimeofday"},
|
||||
{0x71EC4271, WrapU_UU<sceKernelLibcGettimeofday>, "sceKernelLibcGettimeofday"},
|
||||
{0xBFA98062, WrapI_UI<sceKernelDcacheInvalidateRange>, "sceKernelDcacheInvalidateRange"},
|
||||
{0xC8186A58, 0, "sceKernelUtilsMd5Digest"},
|
||||
{0x9E5C5086, 0, "sceKernelUtilsMd5BlockInit"},
|
||||
|
@ -2038,6 +2038,7 @@ int sceKernelRotateThreadReadyQueue(int priority)
|
||||
hleReSchedule("rotatethreadreadyqueue");
|
||||
}
|
||||
|
||||
hleEatCycles(250);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ int sceKernelGetSystemTime(u32 sysclockPtr)
|
||||
if (Memory::IsValidAddress(sysclockPtr))
|
||||
Memory::Write_U64(t, sysclockPtr);
|
||||
DEBUG_LOG(HLE, "sceKernelGetSystemTime(out:%16llx)", t);
|
||||
hleEatCycles(2 * 222);
|
||||
hleEatCycles(265);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -76,6 +76,7 @@ u32 sceKernelGetSystemTimeLow()
|
||||
// This clock should tick at 1 Mhz.
|
||||
u64 t = CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz();
|
||||
VERBOSE_LOG(HLE,"%08x=sceKernelGetSystemTimeLow()",(u32)t);
|
||||
hleEatCycles(165);
|
||||
return (u32)t;
|
||||
}
|
||||
|
||||
@ -83,7 +84,7 @@ u64 sceKernelGetSystemTimeWide()
|
||||
{
|
||||
u64 t = CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz();
|
||||
DEBUG_LOG(HLE,"%i=sceKernelGetSystemTimeWide()",(u32)t);
|
||||
hleEatCycles(1 * 222);
|
||||
hleEatCycles(250);
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -92,13 +93,14 @@ int sceKernelUSec2SysClock(u32 usec, u32 clockPtr)
|
||||
DEBUG_LOG(HLE,"sceKernelUSec2SysClock(%i, %08x )", usec, clockPtr);
|
||||
if (Memory::IsValidAddress(clockPtr))
|
||||
Memory::Write_U32((usec & 0xFFFFFFFFL), clockPtr);
|
||||
hleEatCycles(2 * 222);
|
||||
hleEatCycles(165);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 sceKernelUSec2SysClockWide(u32 usec)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceKernelUSec2SysClockWide(%i)", usec);
|
||||
hleEatCycles(150);
|
||||
return usec;
|
||||
}
|
||||
|
||||
@ -112,7 +114,7 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
|
||||
Memory::Write_U32(highResult, highPtr);
|
||||
if (Memory::IsValidAddress(lowPtr))
|
||||
Memory::Write_U32(lowResult, lowPtr);
|
||||
hleEatCycles(2 * 222);
|
||||
hleEatCycles(415);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -127,6 +129,7 @@ int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 high
|
||||
} else
|
||||
if (Memory::IsValidAddress(highPtr))
|
||||
Memory::Write_U32((int) sysClock, highPtr);
|
||||
hleEatCycles(385);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -134,6 +137,7 @@ u32 sceKernelLibcClock()
|
||||
{
|
||||
u32 retVal = (u32) (CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz());
|
||||
DEBUG_LOG(HLE, "%i = sceKernelLibcClock", retVal);
|
||||
hleEatCycles(330);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@ -142,6 +146,8 @@ u32 sceKernelLibcTime(u32 outPtr)
|
||||
u32 t = (u32) start_time + (u32) (CoreTiming::GetTicks() / CPU_HZ);
|
||||
|
||||
DEBUG_LOG(HLE, "%i = sceKernelLibcTime(%08X)", t, outPtr);
|
||||
// The PSP sure takes its sweet time on this function.
|
||||
hleEatCycles(3385);
|
||||
|
||||
if (Memory::IsValidAddress(outPtr))
|
||||
Memory::Write_U32(t, outPtr);
|
||||
@ -151,8 +157,9 @@ u32 sceKernelLibcTime(u32 outPtr)
|
||||
return t;
|
||||
}
|
||||
|
||||
u32 sceKernelLibcGettimeofday(u32 timeAddr)
|
||||
u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
|
||||
{
|
||||
// TODO: tzAddr?
|
||||
#ifdef _WIN32
|
||||
union {
|
||||
s64 ns100; /*time since 1 Jan 1601 in 100ns units */
|
||||
@ -174,6 +181,7 @@ u32 sceKernelLibcGettimeofday(u32 timeAddr)
|
||||
timeval *tv = (timeval*)Memory::GetPointer(timeAddr);
|
||||
gettimeofday(tv, NULL);
|
||||
#endif
|
||||
DEBUG_LOG(HLE,"sceKernelLibcGettimeofday()");
|
||||
DEBUG_LOG(HLE,"sceKernelLibcGettimeofday(%08x, %08x)", timeAddr, tzAddr);
|
||||
hleEatCycles(1885);
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
u32 sceKernelLibcGettimeofday(u32 timeAddr);
|
||||
u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr);
|
||||
u32 sceKernelLibcTime(u32 outPtr);
|
||||
int sceKernelUSec2SysClock(u32 microsec, u32 clockPtr);
|
||||
int sceKernelGetSystemTime(u32 sysclockPtr);
|
||||
|
Loading…
Reference in New Issue
Block a user