From b5f5c35cd71634e90a885de8e9dfc8f598dd1c38 Mon Sep 17 00:00:00 2001 From: Martin Donlon Date: Fri, 27 May 2022 07:40:25 -0700 Subject: [PATCH] video: Change refresh min/max to a floating point value (#625) --- cfg.cpp | 4 ++-- cfg.h | 4 ++-- video.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cfg.cpp b/cfg.cpp index 5464c7e..f364194 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -65,8 +65,8 @@ static const ini_var_t ini_vars[] = { "GAMEPAD_DEFAULTS", (void*)(&(cfg.gamepad_defaults)), UINT8, 0, 1 }, { "RECENTS", (void*)(&(cfg.recents)), UINT8, 0, 1 }, { "CONTROLLER_INFO", (void*)(&(cfg.controller_info)), UINT8, 0, 10 }, - { "REFRESH_MIN", (void*)(&(cfg.refresh_min)), UINT8, 0, 150 }, - { "REFRESH_MAX", (void*)(&(cfg.refresh_max)), UINT8, 0, 150 }, + { "REFRESH_MIN", (void*)(&(cfg.refresh_min)), FLOAT, 0, 150 }, + { "REFRESH_MAX", (void*)(&(cfg.refresh_max)), FLOAT, 0, 150 }, { "JAMMA_VID", (void*)(&(cfg.jamma_vid)), UINT16, 0, 0xFFFF }, { "JAMMA_PID", (void*)(&(cfg.jamma_pid)), UINT16, 0, 0xFFFF }, { "SNIPER_MODE", (void*)(&(cfg.sniper_mode)), UINT8, 0, 1 }, diff --git a/cfg.h b/cfg.h index e41eb6c..a3efaf2 100644 --- a/cfg.h +++ b/cfg.h @@ -22,8 +22,8 @@ typedef struct { uint8_t hdmi_limited; uint8_t direct_video; uint8_t video_info; - uint8_t refresh_min; - uint8_t refresh_max; + float refresh_min; + float refresh_max; uint8_t controller_info; uint8_t vsync_adjust; uint8_t kbd_nomouse; diff --git a/video.cpp b/video.cpp index bda2e96..b16ce3a 100644 --- a/video.cpp +++ b/video.cpp @@ -1836,16 +1836,16 @@ void video_mode_adjust() Fpix = 0; } - uint32_t hz = 100000000 / vtime; + float hz = 100000000.0f / vtime; if (cfg.refresh_min && hz < cfg.refresh_min) { - printf("Estimated frame rate (%d Hz) is less than MONITOR_HZ_MIN(%d Hz). Canceling auto-adjust.\n", hz, cfg.refresh_min); + printf("Estimated frame rate (%f Hz) is less than REFRESH_MIN(%f Hz). Canceling auto-adjust.\n", hz, cfg.refresh_min); Fpix = 0; } if (cfg.refresh_max && hz > cfg.refresh_max) { - printf("Estimated frame rate (%d Hz) is more than MONITOR_HZ_MAX(%d Hz). Canceling auto-adjust.\n", hz, cfg.refresh_max); + printf("Estimated frame rate (%f Hz) is more than REFRESH_MAX(%f Hz). Canceling auto-adjust.\n", hz, cfg.refresh_max); Fpix = 0; } }