Use an enum for efb scale values.

This commit is contained in:
Rachel Bryk 2013-04-06 01:48:00 -04:00
parent 518e7a7635
commit 4d81e0739d
4 changed files with 32 additions and 20 deletions

View File

@ -247,7 +247,7 @@ void OSDMenu(WPARAM wParam)
OSDChoice = 1; OSDChoice = 1;
// Toggle native resolution // Toggle native resolution
g_Config.iEFBScale = g_Config.iEFBScale + 1; 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; break;
case '4': case '4':
OSDChoice = 2; OSDChoice = 2;

View File

@ -144,7 +144,7 @@ int Renderer::EFBToScaledX(int x)
{ {
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {
case 0: // fractional case SCALE_AUTO: // fractional
return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbWidth(x, s_backbuffer_width); return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbWidth(x, s_backbuffer_width);
default: default:
@ -156,7 +156,7 @@ int Renderer::EFBToScaledY(int y)
{ {
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {
case 0: // fractional case SCALE_AUTO: // fractional
return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbHeight(y, s_backbuffer_height); return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbHeight(y, s_backbuffer_height);
default: default:
@ -166,7 +166,7 @@ int Renderer::EFBToScaledY(int y)
void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) 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; scaledX = x;
scaledY = y; scaledY = y;
@ -283,28 +283,28 @@ void Renderer::DrawDebugText()
const char* res_text = ""; const char* res_text = "";
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {
case 0: case SCALE_AUTO:
res_text = "Auto (fractional)"; res_text = "Auto (fractional)";
break; break;
case 1: case SCALE_AUTO_INTEGRAL:
res_text = "Auto (integral)"; res_text = "Auto (integral)";
break; break;
case 2: case SCALE_1X:
res_text = "Native"; res_text = "Native";
break; break;
case 3: case SCALE_1_5X:
res_text = "1.5x"; res_text = "1.5x";
break; break;
case 4: case SCALE_2X:
res_text = "2x"; res_text = "2x";
break; break;
case 5: case SCALE_2_5X:
res_text = "2.5x"; res_text = "2.5x";
break; break;
case 6: case SCALE_3X:
res_text = "3x"; res_text = "3x";
break; break;
case 7: case SCALE_4X:
res_text = "4x"; res_text = "4x";
break; break;
} }

View File

@ -79,7 +79,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "HackedBufferUpload", &bHackedBufferUpload, 0); iniFile.Get("Settings", "HackedBufferUpload", &bHackedBufferUpload, 0);
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 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); iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
@ -139,21 +139,21 @@ void VideoConfig::GameIniLoad(const char *ini_file)
iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode); iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode);
int tmp = 0; int tmp = 0;
iniFile.GetIfExists("Video_Settings", "EFBScale", &tmp); // integral iniFile.GetIfExists("Video_Settings", "EFBScale", &tmp); // integral
if (tmp != -1) if (tmp != SCALE_FORCE_INTEGRAL)
iEFBScale = tmp; iEFBScale = tmp;
// Round down to multiple of native IR // Round down to multiple of native IR
else else
{ {
switch (iEFBScale) switch (iEFBScale)
{ {
case 0: case SCALE_AUTO:
iEFBScale = 1; iEFBScale = SCALE_AUTO_INTEGRAL;
break; break;
case 3: // 1.5x case SCALE_1_5X:
iEFBScale = 2; iEFBScale = SCALE_1X;
break; break;
case 5: // 2.5x case SCALE_2_5X:
iEFBScale = 4; iEFBScale = SCALE_2X;
break; break;
default: default:
break; break;

View File

@ -44,6 +44,18 @@ enum AspectMode {
ASPECT_STRETCH = 3, 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; class IniFile;
// NEVER inherit from this class. // NEVER inherit from this class.