Adjust event times after a PPC clock change
This likely doesn't change much, but it makes events trigger at the correct time after a clock change.
This commit is contained in:
parent
fdfe57a49b
commit
a085cd431d
|
@ -364,6 +364,16 @@ void LogPendingEvents()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should only be called from the CPU thread after the PPC clock has changed
|
||||||
|
void AdjustEventQueueTimes(u32 new_ppc_clock, u32 old_ppc_clock)
|
||||||
|
{
|
||||||
|
for (Event& ev : s_event_queue)
|
||||||
|
{
|
||||||
|
const s64 ticks = (ev.time - g_global_timer) * new_ppc_clock / old_ppc_clock;
|
||||||
|
ev.time = g_global_timer + ticks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Idle()
|
void Idle()
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().bSyncGPUOnSkipIdleHack)
|
if (SConfig::GetInstance().bSyncGPUOnSkipIdleHack)
|
||||||
|
|
|
@ -91,6 +91,8 @@ void LogPendingEvents();
|
||||||
|
|
||||||
std::string GetScheduledEventsSummary();
|
std::string GetScheduledEventsSummary();
|
||||||
|
|
||||||
|
void AdjustEventQueueTimes(u32 new_ppc_clock, u32 old_ppc_clock);
|
||||||
|
|
||||||
u32 GetFakeDecStartValue();
|
u32 GetFakeDecStartValue();
|
||||||
void SetFakeDecStartValue(u32 val);
|
void SetFakeDecStartValue(u32 val);
|
||||||
u64 GetFakeDecStartTicks();
|
u64 GetFakeDecStartTicks();
|
||||||
|
|
|
@ -228,10 +228,12 @@ void PreInit()
|
||||||
|
|
||||||
void ChangePPCClock(Mode mode)
|
void ChangePPCClock(Mode mode)
|
||||||
{
|
{
|
||||||
|
const u32 previous_clock = s_cpu_core_clock;
|
||||||
if (mode == Mode::Wii)
|
if (mode == Mode::Wii)
|
||||||
s_cpu_core_clock = 729000000u;
|
s_cpu_core_clock = 729000000u;
|
||||||
else
|
else
|
||||||
s_cpu_core_clock = 486000000u;
|
s_cpu_core_clock = 486000000u;
|
||||||
|
CoreTiming::AdjustEventQueueTimes(s_cpu_core_clock, previous_clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
|
Loading…
Reference in New Issue