diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2018-05-11 22:38:44 +0200 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2018-05-12 18:10:26 +0200 |
| commit | 6763a3fce1df5a949900dd976393c7fe89fa4aec (patch) | |
| tree | cdf3ad1c04d6746d62d7f53ff0a2c46e547727b9 /Source/Core/VideoCommon/VideoConfig.cpp | |
| parent | 7dca7c237eb9ae40765e581317df6df4b4fc1ad4 (diff) | |
Config: Add support for enums
This makes it possible to use enums as the config type.
Default values are now clearer and there's no need for casts
when calling Config::Get/Set anymore.
In order to add support for enums, the common code was updated to
handle enums by using the underlying type when loading/saving settings.
A copy constructor is also provided for conversions from
`ConfigInfo<Enum>` to `ConfigInfo<underlying_type<Enum>>`
so that enum settings can still easily work with code that doesn't care
about the actual enum values (like Graphics{Choice,Radio} in DolphinQt2
which only treat the setting as an integer).
Diffstat (limited to 'Source/Core/VideoCommon/VideoConfig.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoConfig.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index abdf27dcd1..2d7f958d8f 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -60,9 +60,9 @@ void VideoConfig::Refresh() iAdapter = Config::Get(Config::GFX_ADAPTER); bWidescreenHack = Config::Get(Config::GFX_WIDESCREEN_HACK); - const auto config_aspect_mode = static_cast<AspectMode>(Config::Get(Config::GFX_ASPECT_RATIO)); + const AspectMode config_aspect_mode = Config::Get(Config::GFX_ASPECT_RATIO); if (config_aspect_mode == AspectMode::Auto) - aspect_mode = static_cast<AspectMode>(Config::Get(Config::GFX_SUGGESTED_ASPECT_RATIO)); + aspect_mode = Config::Get(Config::GFX_SUGGESTED_ASPECT_RATIO); else aspect_mode = config_aspect_mode; bCrop = Config::Get(Config::GFX_CROP); @@ -103,8 +103,7 @@ void VideoConfig::Refresh() iCommandBufferExecuteInterval = Config::Get(Config::GFX_COMMAND_BUFFER_EXECUTE_INTERVAL); bShaderCache = Config::Get(Config::GFX_SHADER_CACHE); bWaitForShadersBeforeStarting = Config::Get(Config::GFX_WAIT_FOR_SHADERS_BEFORE_STARTING); - iShaderCompilationMode = - static_cast<ShaderCompilationMode>(Config::Get(Config::GFX_SHADER_COMPILATION_MODE)); + iShaderCompilationMode = Config::Get(Config::GFX_SHADER_COMPILATION_MODE); iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS); iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS); @@ -122,7 +121,7 @@ void VideoConfig::Refresh() bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR); bDisableCopyFilter = Config::Get(Config::GFX_ENHANCE_DISABLE_COPY_FILTER); - stereo_mode = static_cast<StereoMode>(Config::Get(Config::GFX_STEREO_MODE)); + stereo_mode = Config::Get(Config::GFX_STEREO_MODE); iStereoDepth = Config::Get(Config::GFX_STEREO_DEPTH); iStereoConvergencePercentage = Config::Get(Config::GFX_STEREO_CONVERGENCE_PERCENTAGE); bStereoSwapEyes = Config::Get(Config::GFX_STEREO_SWAP_EYES); |
