mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Improvements to timer hack.
This commit is contained in:
parent
5cdfe40c03
commit
effca1e4c7
3 changed files with 14 additions and 4 deletions
|
@ -102,18 +102,27 @@ int GetClockFrequencyMHz()
|
|||
return CPU_HZ / 1000000;
|
||||
}
|
||||
|
||||
u64 GetGlobalTimeUs()
|
||||
u64 GetGlobalTimeUsScaled()
|
||||
{
|
||||
s64 ticksSinceLast = GetTicks() - lastGlobalTimeTicks;
|
||||
int freq = GetClockFrequencyMHz();
|
||||
if (g_Config.bTimerHack) {
|
||||
float vps;
|
||||
__DisplayGetVPS(&vps);
|
||||
if (vps > 5.0f)
|
||||
freq = (int)(((float)CPU_HZ * vps) / (1000000.0f * 60.0f));
|
||||
if (vps > 4.0f)
|
||||
freq *= (vps / 60.0f);
|
||||
}
|
||||
s64 usSinceLast = ticksSinceLast / freq;
|
||||
return lastGlobalTimeUs + usSinceLast;
|
||||
|
||||
}
|
||||
|
||||
u64 GetGlobalTimeUs()
|
||||
{
|
||||
s64 ticksSinceLast = GetTicks() - lastGlobalTimeTicks;
|
||||
int freq = GetClockFrequencyMHz();
|
||||
s64 usSinceLast = ticksSinceLast / freq;
|
||||
return lastGlobalTimeUs + usSinceLast;
|
||||
}
|
||||
|
||||
Event* GetNewEvent()
|
||||
|
|
|
@ -80,6 +80,7 @@ namespace CoreTiming
|
|||
u64 GetTicks();
|
||||
u64 GetIdleTicks();
|
||||
u64 GetGlobalTimeUs();
|
||||
u64 GetGlobalTimeUsScaled();
|
||||
|
||||
// Returns the event_type identifier.
|
||||
int RegisterEvent(const char *name, TimedCallback callback);
|
||||
|
|
|
@ -71,7 +71,7 @@ u32 sceKernelGetSystemTimeLow()
|
|||
|
||||
u64 sceKernelGetSystemTimeWide()
|
||||
{
|
||||
u64 t = CoreTiming::GetGlobalTimeUs();
|
||||
u64 t = CoreTiming::GetGlobalTimeUsScaled();
|
||||
DEBUG_LOG(SCEKERNEL,"%i=sceKernelGetSystemTimeWide()",(u32)t);
|
||||
hleEatCycles(250);
|
||||
hleReSchedule("system time");
|
||||
|
|
Loading…
Add table
Reference in a new issue