diff --git a/change-refresh.lua b/change-refresh.lua index 08c79d4..d970b7b 100644 --- a/change-refresh.lua +++ b/change-refresh.lua @@ -241,7 +241,7 @@ function changeRefresh(width, height, rate, display) options.pause > 0 and not mp.get_property_bool("pause") and not ( tostring(var.current_height) == height and tostring(var.current_width) == width and - tostring(math.floor(mp.get_property_number('display-fps'))) == rate + tostring(math.floor(mp.get_property_number('display-fps') + 0.5)) == rate ) then mp.set_property_bool("pause", true) @@ -482,6 +482,20 @@ function toggleFpsType() return end +--toggles between auto being on or off +function toggleAuto() + if options.auto then + options.auto = false + osdMessage("[Change-Refresh] auto fps change is disabled") + msg.info("now disabled auto fps change") + else + options.auto = true + osdMessage("[Change-Refresh] auto fps change is enabled") + msg.info("now enabled auto fps change") + end + return +end + --runs the script automatically on startup if option is enabled function autoChange() if options.auto then @@ -520,6 +534,9 @@ mp.add_key_binding("", 'toggle-fps-type', toggleFpsType) --set the current resolution and refresh rate as the default mp.add_key_binding("", "set-default-refresh", setDefault) +--switches between auto changing fps or not +mp.add_key_binding("", 'toggle-auto', toggleAuto) + --sends a command to switch to the specified display rate --syntax is: script-message change-refresh [width] [height] [rate] [display] mp.register_script_message("change-refresh", scriptMessage)