TimingEvent: Add Delay method

This commit is contained in:
Connor McLaughlin 2021-06-14 14:55:20 +10:00
parent 38288e6b36
commit db5be6c70c
2 changed files with 14 additions and 0 deletions

View File

@ -392,6 +392,17 @@ TickCount TimingEvent::GetTicksUntilNextExecution() const
return std::max(m_downcount - CPU::GetPendingTicks(), static_cast<TickCount>(0));
}
void TimingEvent::Delay(TickCount ticks)
{
if (!m_active)
{
Panic("Trying to delay an inactive event");
return;
}
m_downcount += ticks;
}
void TimingEvent::Schedule(TickCount ticks)
{
const TickCount pending_ticks = CPU::GetPendingTicks();

View File

@ -30,6 +30,9 @@ public:
TickCount GetTicksSinceLastExecution() const;
TickCount GetTicksUntilNextExecution() const;
// Adds ticks to current execution.
void Delay(TickCount ticks);
void Schedule(TickCount ticks);
void SetIntervalAndSchedule(TickCount ticks);
void SetPeriodAndSchedule(TickCount ticks);