|
|
|
@ -6,10 +6,6 @@ |
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
#include <immintrin.h> |
|
|
|
#endif |
|
|
|
|
|
|
|
#include <condition_variable> |
|
|
|
#include <cstddef> |
|
|
|
#include <functional> |
|
|
|
@ -127,8 +123,8 @@ public: |
|
|
|
if (Settings::values.use_speed_limit.GetValue() && target_fps > 0.0) { |
|
|
|
auto now = std::chrono::steady_clock::now(); |
|
|
|
if (last_target_fps != target_fps) { |
|
|
|
max_frame_count = static_cast<int>(0.1 * target_fps); |
|
|
|
frame_interval = std::chrono::duration_cast<std::chrono::steady_clock::duration>(std::chrono::duration<double>(1.0 / target_fps)); |
|
|
|
max_frame_count = static_cast<int>(0.1 * target_fps); |
|
|
|
last_target_fps = target_fps; |
|
|
|
frame_counter = 0; |
|
|
|
start_time = now; |
|
|
|
@ -141,11 +137,7 @@ public: |
|
|
|
std::this_thread::sleep_for(sleep_time - std::chrono::milliseconds(1)); |
|
|
|
} |
|
|
|
while (std::chrono::steady_clock::now() < target_time) { |
|
|
|
#ifdef _WIN32 |
|
|
|
_mm_pause(); |
|
|
|
#else |
|
|
|
std::this_thread::yield(); |
|
|
|
#endif |
|
|
|
} |
|
|
|
} else if (frame_counter > max_frame_count) { |
|
|
|
frame_counter = 0; |
|
|
|
|