mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-06-02 10:10:48 -04:00
Switch system_clock to high_resolution_clock, work around win32 sleep_for/sleep_until bug when clocks go backwards
This commit is contained in:
+3
-3
@@ -3,10 +3,10 @@
|
||||
|
||||
static ultramodern::input_callbacks_t input_callbacks;
|
||||
|
||||
std::chrono::system_clock::time_point input_poll_time;
|
||||
std::chrono::high_resolution_clock::time_point input_poll_time;
|
||||
|
||||
void update_poll_time() {
|
||||
input_poll_time = std::chrono::system_clock::now();
|
||||
input_poll_time = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
extern "C" void recomp_set_current_frame_poll_id(uint8_t* rdram, recomp_context* ctx) {
|
||||
@@ -18,7 +18,7 @@ extern "C" void recomp_measure_latency(uint8_t* rdram, recomp_context* ctx) {
|
||||
}
|
||||
|
||||
void ultramodern::measure_input_latency() {
|
||||
// printf("Delta: %ld micros\n", std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now() - input_poll_time));
|
||||
// printf("Delta: %ld micros\n", std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - input_poll_time));
|
||||
}
|
||||
|
||||
void set_input_callbacks(const ultramodern::input_callbacks_t& callbacks) {
|
||||
|
||||
@@ -429,8 +429,7 @@ void recomp::start(ultramodern::WindowHandle window_handle, const ultramodern::a
|
||||
}, window_handle, rdram_buffer.get()};
|
||||
|
||||
while (!exited) {
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(1ms);
|
||||
ultramodern::sleep_milliseconds(1);
|
||||
if (gfx_callbacks.update_gfx != nullptr) {
|
||||
gfx_callbacks.update_gfx(gfx_data);
|
||||
}
|
||||
|
||||
@@ -322,10 +322,7 @@ public:
|
||||
throw std::runtime_error("Failed to make RmlUi data model for the graphics config menu");
|
||||
}
|
||||
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
std::this_thread::sleep_for(50ms);
|
||||
}
|
||||
ultramodern::sleep_milliseconds(50);
|
||||
new_options = ultramodern::get_graphics_config();
|
||||
bind_config_list_events(constructor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user