Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use an enum for efb scale values.
  • Loading branch information
RachelBryk committed Apr 6, 2013
1 parent 518e7a7 commit 4d81e07
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/Src/EmuWindow.cpp
Expand Up @@ -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;
Expand Down
22 changes: 11 additions & 11 deletions Source/Core/VideoCommon/Src/RenderBase.cpp
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
16 changes: 8 additions & 8 deletions Source/Core/VideoCommon/Src/VideoConfig.cpp
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions Source/Core/VideoCommon/Src/VideoConfig.h
Expand Up @@ -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.
Expand Down

0 comments on commit 4d81e07

Please sign in to comment.