mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-31 03:45:38 +00:00
TimingEvents: Reset downcount when head is resorted
This commit is contained in:
parent
78959f6339
commit
f82d08e223
|
@ -52,7 +52,8 @@ std::unique_ptr<TimingEvent> CreateTimingEvent(std::string name, TickCount perio
|
||||||
|
|
||||||
void UpdateCPUDowncount()
|
void UpdateCPUDowncount()
|
||||||
{
|
{
|
||||||
CPU::g_state.downcount = CPU::HasPendingInterrupt() ? 0 : s_active_events_head->GetDowncount();
|
const u32 event_downcount = s_active_events_head->GetDowncount();
|
||||||
|
CPU::g_state.downcount = CPU::HasPendingInterrupt() ? 0 : event_downcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimingEvent** GetHeadEventPtr()
|
TimingEvent** GetHeadEventPtr()
|
||||||
|
@ -113,9 +114,14 @@ static void SortEvent(TimingEvent* event)
|
||||||
|
|
||||||
// unlink
|
// unlink
|
||||||
if (event->prev)
|
if (event->prev)
|
||||||
|
{
|
||||||
event->prev->next = event->next;
|
event->prev->next = event->next;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
s_active_events_head = event->next;
|
s_active_events_head = event->next;
|
||||||
|
UpdateCPUDowncount();
|
||||||
|
}
|
||||||
if (event->next)
|
if (event->next)
|
||||||
event->next->prev = event->prev;
|
event->next->prev = event->prev;
|
||||||
else
|
else
|
||||||
|
@ -128,9 +134,14 @@ static void SortEvent(TimingEvent* event)
|
||||||
event->prev = current->prev;
|
event->prev = current->prev;
|
||||||
|
|
||||||
if (current->prev)
|
if (current->prev)
|
||||||
|
{
|
||||||
current->prev->next = event;
|
current->prev->next = event;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
s_active_events_head = event;
|
s_active_events_head = event;
|
||||||
|
UpdateCPUDowncount();
|
||||||
|
}
|
||||||
|
|
||||||
current->prev = event;
|
current->prev = event;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue