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;
// 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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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.