mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
CoreTiming: Fix scheduling into the past
ForceExceptionCheck messes up the downcount and slice length if the callback is scheduled into the past (g_slice_length becomes negative)
This commit is contained in:
@ -282,11 +282,12 @@ void RemoveAllEvents(EventType* event_type)
|
||||
|
||||
void ForceExceptionCheck(s64 cycles)
|
||||
{
|
||||
cycles = std::max<s64>(0, cycles);
|
||||
if (DowncountToCycles(PowerPC::ppcState.downcount) > cycles)
|
||||
{
|
||||
// downcount is always (much) smaller than MAX_INT so we can safely cast cycles to an int here.
|
||||
// Account for cycles already executed by adjusting the g_slice_length
|
||||
g_slice_length -= (DowncountToCycles(PowerPC::ppcState.downcount) - static_cast<int>(cycles));
|
||||
g_slice_length -= DowncountToCycles(PowerPC::ppcState.downcount) - static_cast<int>(cycles);
|
||||
PowerPC::ppcState.downcount = CyclesToDowncount(static_cast<int>(cycles));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user