diff options
| -rw-r--r-- | src/core/core_timing.cpp | 10 | ||||
| -rw-r--r-- | src/core/core_timing.h | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index a1b6f96f1..b2e3a495a 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -141,7 +141,7 @@ void ScheduleEvent(s64 cycles_into_future, const EventType* event_type, u64 user | |||
| 141 | ForceExceptionCheck(cycles_into_future); | 141 | ForceExceptionCheck(cycles_into_future); |
| 142 | 142 | ||
| 143 | event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); | 143 | event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); |
| 144 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); | 144 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | void ScheduleEventThreadsafe(s64 cycles_into_future, const EventType* event_type, u64 userdata) { | 147 | void ScheduleEventThreadsafe(s64 cycles_into_future, const EventType* event_type, u64 userdata) { |
| @@ -156,7 +156,7 @@ void UnscheduleEvent(const EventType* event_type, u64 userdata) { | |||
| 156 | // Removing random items breaks the invariant so we have to re-establish it. | 156 | // Removing random items breaks the invariant so we have to re-establish it. |
| 157 | if (itr != event_queue.end()) { | 157 | if (itr != event_queue.end()) { |
| 158 | event_queue.erase(itr, event_queue.end()); | 158 | event_queue.erase(itr, event_queue.end()); |
| 159 | std::make_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); | 159 | std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| 162 | 162 | ||
| @@ -167,7 +167,7 @@ void RemoveEvent(const EventType* event_type) { | |||
| 167 | // Removing random items breaks the invariant so we have to re-establish it. | 167 | // Removing random items breaks the invariant so we have to re-establish it. |
| 168 | if (itr != event_queue.end()) { | 168 | if (itr != event_queue.end()) { |
| 169 | event_queue.erase(itr, event_queue.end()); | 169 | event_queue.erase(itr, event_queue.end()); |
| 170 | std::make_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); | 170 | std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | 173 | ||
| @@ -190,7 +190,7 @@ void MoveEvents() { | |||
| 190 | for (Event ev; ts_queue.Pop(ev);) { | 190 | for (Event ev; ts_queue.Pop(ev);) { |
| 191 | ev.fifo_order = event_fifo_id++; | 191 | ev.fifo_order = event_fifo_id++; |
| 192 | event_queue.emplace_back(std::move(ev)); | 192 | event_queue.emplace_back(std::move(ev)); |
| 193 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); | 193 | std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | 196 | ||
| @@ -205,7 +205,7 @@ void Advance() { | |||
| 205 | 205 | ||
| 206 | while (!event_queue.empty() && event_queue.front().time <= global_timer) { | 206 | while (!event_queue.empty() && event_queue.front().time <= global_timer) { |
| 207 | Event evt = std::move(event_queue.front()); | 207 | Event evt = std::move(event_queue.front()); |
| 208 | std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); | 208 | std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 209 | event_queue.pop_back(); | 209 | event_queue.pop_back(); |
| 210 | evt.type->callback(evt.userdata, static_cast<int>(global_timer - evt.time)); | 210 | evt.type->callback(evt.userdata, static_cast<int>(global_timer - evt.time)); |
| 211 | } | 211 | } |
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 7fe6380ad..5bbde47f4 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h | |||
| @@ -23,6 +23,10 @@ | |||
| 23 | 23 | ||
| 24 | namespace CoreTiming { | 24 | namespace CoreTiming { |
| 25 | 25 | ||
| 26 | struct EventType; | ||
| 27 | |||
| 28 | using TimedCallback = std::function<void(u64 userdata, int cycles_late)>; | ||
| 29 | |||
| 26 | /** | 30 | /** |
| 27 | * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is | 31 | * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is |
| 28 | * required to end slice -1 and start slice 0 before the first cycle of code is executed. | 32 | * required to end slice -1 and start slice 0 before the first cycle of code is executed. |
| @@ -30,8 +34,6 @@ namespace CoreTiming { | |||
| 30 | void Init(); | 34 | void Init(); |
| 31 | void Shutdown(); | 35 | void Shutdown(); |
| 32 | 36 | ||
| 33 | typedef std::function<void(u64 userdata, int cycles_late)> TimedCallback; | ||
| 34 | |||
| 35 | /** | 37 | /** |
| 36 | * This should only be called from the emu thread, if you are calling it any other thread, you are | 38 | * This should only be called from the emu thread, if you are calling it any other thread, you are |
| 37 | * doing something evil | 39 | * doing something evil |
| @@ -40,8 +42,6 @@ u64 GetTicks(); | |||
| 40 | u64 GetIdleTicks(); | 42 | u64 GetIdleTicks(); |
| 41 | void AddTicks(u64 ticks); | 43 | void AddTicks(u64 ticks); |
| 42 | 44 | ||
| 43 | struct EventType; | ||
| 44 | |||
| 45 | /** | 45 | /** |
| 46 | * Returns the event_type identifier. if name is not unique, it will assert. | 46 | * Returns the event_type identifier. if name is not unique, it will assert. |
| 47 | */ | 47 | */ |