Core: Change CoreTiming event key from int to EventType*

Replace 'int' keys with something that carries type information.
Performance is neutral.
This commit is contained in:
EmptyChaos
2016-09-01 10:54:18 +00:00
parent f15e4fb35e
commit aa16282516
18 changed files with 73 additions and 85 deletions

View File

@ -43,9 +43,11 @@ u64 GetIdleTicks();
void DoState(PointerWrap& p);
struct EventType;
// Returns the event_type identifier. if name is not unique, an existing event_type will be
// discarded.
int RegisterEvent(const std::string& name, TimedCallback callback);
EventType* RegisterEvent(const std::string& name, TimedCallback callback);
void UnregisterAllEvents();
enum class FromThread
@ -58,12 +60,12 @@ enum class FromThread
};
// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from savestates.
void ScheduleEvent(s64 cycles_into_future, int event_type, u64 userdata = 0,
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(int event_type);
void RemoveAllEvents(int event_type);
void RemoveEvent(EventType* event_type);
void RemoveAllEvents(EventType* event_type);
void Advance();
void MoveEvents();