From 4d81e0739d2cc7112d5167682fd0750836f691a9 Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Sat, 6 Apr 2013 01:48:00 -0400 Subject: [PATCH] Use an enum for efb scale values. --- Source/Core/VideoCommon/Src/EmuWindow.cpp | 2 +- Source/Core/VideoCommon/Src/RenderBase.cpp | 22 ++++++++++----------- Source/Core/VideoCommon/Src/VideoConfig.cpp | 16 +++++++-------- Source/Core/VideoCommon/Src/VideoConfig.h | 12 +++++++++++ 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Source/Core/VideoCommon/Src/EmuWindow.cpp b/Source/Core/VideoCommon/Src/EmuWindow.cpp index bf9da4190b..8952432789 100644 --- a/Source/Core/VideoCommon/Src/EmuWindow.cpp +++ b/Source/Core/VideoCommon/Src/EmuWindow.cpp @@ -247,7 +247,7 @@ void OSDMenu(WPARAM wParam) OSDChoice = 1; // Toggle native resolution g_Config.iEFBScale = g_Config.iEFBScale + 1; - if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0; + if (g_Config.iEFBScale > SCALE_4X) g_Config.iEFBScale = SCALE_AUTO; break; case '4': OSDChoice = 2; diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 90a09aec43..652a613b2a 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -144,7 +144,7 @@ int Renderer::EFBToScaledX(int x) { switch (g_ActiveConfig.iEFBScale) { - case 0: // fractional + case SCALE_AUTO: // fractional return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbWidth(x, s_backbuffer_width); default: @@ -156,7 +156,7 @@ int Renderer::EFBToScaledY(int y) { switch (g_ActiveConfig.iEFBScale) { - case 0: // fractional + case SCALE_AUTO: // fractional return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbHeight(y, s_backbuffer_height); default: @@ -166,7 +166,7 @@ int Renderer::EFBToScaledY(int y) void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) { - if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1) + if (g_ActiveConfig.iEFBScale == SCALE_AUTO || g_ActiveConfig.iEFBScale == SCALE_AUTO_INTEGRAL) { scaledX = x; scaledY = y; @@ -283,28 +283,28 @@ void Renderer::DrawDebugText() const char* res_text = ""; switch (g_ActiveConfig.iEFBScale) { - case 0: + case SCALE_AUTO: res_text = "Auto (fractional)"; break; - case 1: + case SCALE_AUTO_INTEGRAL: res_text = "Auto (integral)"; break; - case 2: + case SCALE_1X: res_text = "Native"; break; - case 3: + case SCALE_1_5X: res_text = "1.5x"; break; - case 4: + case SCALE_2X: res_text = "2x"; break; - case 5: + case SCALE_2_5X: res_text = "2.5x"; break; - case 6: + case SCALE_3X: res_text = "3x"; break; - case 7: + case SCALE_4X: res_text = "4x"; break; } diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 5f10650747..a6139363e6 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -79,7 +79,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "HackedBufferUpload", &bHackedBufferUpload, 0); iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); - iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native + iniFile.Get("Settings", "EFBScale", &iEFBScale, (int) SCALE_1X); // native iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false); @@ -139,21 +139,21 @@ void VideoConfig::GameIniLoad(const char *ini_file) iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode); int tmp = 0; iniFile.GetIfExists("Video_Settings", "EFBScale", &tmp); // integral - if (tmp != -1) + if (tmp != SCALE_FORCE_INTEGRAL) iEFBScale = tmp; // Round down to multiple of native IR else { switch (iEFBScale) { - case 0: - iEFBScale = 1; + case SCALE_AUTO: + iEFBScale = SCALE_AUTO_INTEGRAL; break; - case 3: // 1.5x - iEFBScale = 2; + case SCALE_1_5X: + iEFBScale = SCALE_1X; break; - case 5: // 2.5x - iEFBScale = 4; + case SCALE_2_5X: + iEFBScale = SCALE_2X; break; default: break; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 1a76baa733..1670e47222 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -44,6 +44,18 @@ enum AspectMode { ASPECT_STRETCH = 3, }; +enum EFBScale { + SCALE_FORCE_INTEGRAL = -1, + SCALE_AUTO, + SCALE_AUTO_INTEGRAL, + SCALE_1X, + SCALE_1_5X, + SCALE_2X, + SCALE_2_5X, + SCALE_3X, + SCALE_4X, +}; + class IniFile; // NEVER inherit from this class.