CoreTiming: Document initial startup behavior

Events don't update the downcount until after the first Advance(),
thus Advance() must be called once before scheduling works normally.
This commit is contained in:
EmptyChaos
2016-09-01 11:39:05 +00:00
parent 59465911d7
commit fb5537213a
2 changed files with 17 additions and 0 deletions

View File

@ -31,6 +31,8 @@ extern u64 g_fake_TB_start_ticks;
extern int g_slice_length;
extern float g_last_OC_factor_inverted;
// CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is
// required to end slice -1 and start slice 0 before the first cycle of code is executed.
void Init();
void Shutdown();
@ -60,12 +62,22 @@ enum class FromThread
};
// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from savestates.
// After the first Advance, the slice lengths and the downcount will be reduced whenever an event
// is scheduled earlier than the current values (when scheduled from the CPU Thread only).
// Scheduling from a callback will not update the downcount until the Advance() completes.
void ScheduleEvent(s64 cycles_into_future, EventType* event_type, u64 userdata = 0,
FromThread from = FromThread::CPU);
// We only permit one event of each type in the queue at a time.
void RemoveEvent(EventType* event_type);
void RemoveAllEvents(EventType* event_type);
// Advance must be called at the beginning of dispatcher loops, not the end. Advance() ends
// the previous timing slice and begins the next one, you must Advance from the previous
// slice to the current one before executing any cycles. CoreTiming starts in slice -1 so an
// Advance() is required to initialize the slice length before the first cycle of emulated
// instructions is executed.
// NOTE: Advance updates the PowerPC downcount and performs a PPC external exception check.
void Advance();
void MoveEvents();