From e2cb54d233fe15f0fca591fe3256ef18d90d820d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 18 Oct 2024 19:07:09 +1000 Subject: [PATCH] Settings: Use uint getter/setter for more fields --- src/core/settings.cpp | 20 ++++++++++---------- src/core/settings.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index a154a0dcc3..3191006b39 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -172,15 +172,15 @@ void Settings::Load(SettingsInterface& si, SettingsInterface& controller_si) enable_discord_presence = si.GetBoolValue("Main", "EnableDiscordPresence", false); rewind_enable = si.GetBoolValue("Main", "RewindEnable", false); rewind_save_frequency = si.GetFloatValue("Main", "RewindFrequency", 10.0f); - rewind_save_slots = static_cast(si.GetIntValue("Main", "RewindSaveSlots", 10)); - runahead_frames = static_cast(si.GetIntValue("Main", "RunaheadFrameCount", 0)); + rewind_save_slots = static_cast(si.GetUIntValue("Main", "RewindSaveSlots", 10u)); + runahead_frames = static_cast(si.GetUIntValue("Main", "RunaheadFrameCount", 0u)); cpu_execution_mode = ParseCPUExecutionMode( si.GetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(DEFAULT_CPU_EXECUTION_MODE)).c_str()) .value_or(DEFAULT_CPU_EXECUTION_MODE); - cpu_overclock_numerator = std::max(si.GetIntValue("CPU", "OverclockNumerator", 1), 1); - cpu_overclock_denominator = std::max(si.GetIntValue("CPU", "OverclockDenominator", 1), 1); + cpu_overclock_numerator = std::max(si.GetUIntValue("CPU", "OverclockNumerator", 1u), 1u); + cpu_overclock_denominator = std::max(si.GetUIntValue("CPU", "OverclockDenominator", 1u), 1u); cpu_overclock_enable = si.GetBoolValue("CPU", "OverclockEnable", false); UpdateOverclockActive(); cpu_recompiler_memory_exceptions = si.GetBoolValue("CPU", "RecompilerMemoryExceptions", false); @@ -193,8 +193,8 @@ void Settings::Load(SettingsInterface& si, SettingsInterface& controller_si) gpu_renderer = ParseRendererName(si.GetStringValue("GPU", "Renderer", GetRendererName(DEFAULT_GPU_RENDERER)).c_str()) .value_or(DEFAULT_GPU_RENDERER); gpu_adapter = si.GetStringValue("GPU", "Adapter", ""); - gpu_resolution_scale = static_cast(si.GetIntValue("GPU", "ResolutionScale", 1)); - gpu_multisamples = static_cast(si.GetIntValue("GPU", "Multisamples", 1)); + gpu_resolution_scale = static_cast(si.GetUIntValue("GPU", "ResolutionScale", 1u)); + gpu_multisamples = static_cast(si.GetUIntValue("GPU", "Multisamples", 1u)); gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false); gpu_disable_shader_cache = si.GetBoolValue("GPU", "DisableShaderCache", false); gpu_disable_dual_source_blend = si.GetBoolValue("GPU", "DisableDualSourceBlend", false); @@ -520,8 +520,8 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements); si.SetBoolValue("Main", "RewindEnable", rewind_enable); si.SetFloatValue("Main", "RewindFrequency", rewind_save_frequency); - si.SetIntValue("Main", "RewindSaveSlots", rewind_save_slots); - si.SetIntValue("Main", "RunaheadFrameCount", runahead_frames); + si.SetUIntValue("Main", "RewindSaveSlots", rewind_save_slots); + si.SetUIntValue("Main", "RunaheadFrameCount", runahead_frames); si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode)); si.SetBoolValue("CPU", "OverclockEnable", cpu_overclock_enable); @@ -534,8 +534,8 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const si.SetStringValue("GPU", "Renderer", GetRendererName(gpu_renderer)); si.SetStringValue("GPU", "Adapter", gpu_adapter.c_str()); - si.SetIntValue("GPU", "ResolutionScale", static_cast(gpu_resolution_scale)); - si.SetIntValue("GPU", "Multisamples", static_cast(gpu_multisamples)); + si.SetUIntValue("GPU", "ResolutionScale", gpu_resolution_scale); + si.SetUIntValue("GPU", "Multisamples", gpu_multisamples); if (!ignore_base) { diff --git a/src/core/settings.h b/src/core/settings.h index b3b664e718..cacd09f155 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -93,8 +93,8 @@ struct Settings bool rewind_enable : 1 = false; float rewind_save_frequency = 10.0f; - u32 rewind_save_slots = 10; - u32 runahead_frames = 0; + u8 rewind_save_slots = 10; + u8 runahead_frames = 0; GPURenderer gpu_renderer = DEFAULT_GPU_RENDERER; std::string gpu_adapter;