From a1cb85cd0509b796cc47fd726740cffeae391bf5 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 2 May 2013 07:48:28 -0700 Subject: [PATCH 1/6] Stick to a single config entry per option. We don't need a bool in the ini AND an int setting. This should also fix the anistropy setting, which appears to have been pretty much broken. Also makes frameskip enable even if you don't tap auto, which is what I'd assumed it did before. --- Core/Config.cpp | 12 ++++----- Core/Config.h | 5 +--- Core/HLE/sceDisplay.cpp | 4 +-- UI/MenuScreens.cpp | 54 ++++++++++++++++++++++++++++++--------- Windows/WndMainWindow.cpp | 4 +-- 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index ec7d1142cc..e211fe5873 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -99,14 +99,13 @@ void Config::Load(const char *iniFileName) graphics->Get("LinearFiltering", &bLinearFiltering, false); graphics->Get("SSAA", &SSAntiAliasing, 0); graphics->Get("VBO", &bUseVBO, false); - graphics->Get("FrameSkip", &bFrameSkip, false); - graphics->Get("XBRZTexScaling", &bXBRZTexScaling, false); + graphics->Get("FrameSkip", &iFrameSkip, 0); graphics->Get("XBRZTexScalingLevel", &iXBRZTexScalingLevel, 1); graphics->Get("UseMediaEngine", &bUseMediaEngine, true); #ifdef USING_GLES2 - graphics->Get("AnisotropicFiltering", &bAnisotropicFiltering, true); + graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0); #else - graphics->Get("AnisotropicFiltering", &bAnisotropicFiltering, false); + graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8); #endif graphics->Get("VertexCache", &bVertexCache, true); graphics->Get("FullScreen", &bFullScreen, false); @@ -190,11 +189,10 @@ void Config::Save() graphics->Set("LinearFiltering", bLinearFiltering); graphics->Set("SSAA", SSAntiAliasing); graphics->Set("VBO", bUseVBO); - graphics->Set("FrameSkip", bFrameSkip); - graphics->Set("XBRZTexScaling", bXBRZTexScaling); + graphics->Set("FrameSkip", iFrameSkip); graphics->Set("XBRZTexScalingLevel", iXBRZTexScalingLevel); graphics->Set("UseMediaEngine", bUseMediaEngine); - graphics->Set("AnisotropicFiltering", bAnisotropicFiltering); + graphics->Set("AnisotropyLevel", iAnisotropyLevel); graphics->Set("VertexCache", bVertexCache); graphics->Set("FullScreen", bFullScreen); graphics->Set("StretchToDisplay", bStretchToDisplay); diff --git a/Core/Config.h b/Core/Config.h index eac31aef9d..943b40b7ac 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -60,8 +60,7 @@ public: bool bLinearFiltering; bool bUseVBO; bool bStretchToDisplay; - bool bFrameSkip; - int iNumSkip; + bool iFrameSkip; bool bUseMediaEngine; int iWindowX; @@ -73,8 +72,6 @@ public: int iAnisotropyLevel; bool bTrueColor; bool bMipMap; - bool bAnisotropicFiltering; - bool bXBRZTexScaling; int iXBRZTexScalingLevel; // Sound diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index f9d7587a5c..99e0c51a2d 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -286,7 +286,7 @@ void DoFrameTiming(bool &throttle, bool &skipFrame) { // Check if the frameskipping code should be enabled. If neither throttling or frameskipping is on, // we have nothing to do here. - bool doFrameSkip = g_Config.bFrameSkip; + bool doFrameSkip = g_Config.iFrameSkip != 0; // On non windows, which is always vsync locked, we need to force frameskip when // unthrottled. @@ -343,7 +343,7 @@ void DoFrameTiming(bool &throttle, bool &skipFrame) { // Max 4 skipped frames in a row - 15 fps is really the bare minimum for playability. // We check for 3 here so it's 3 skipped frames, 1 non skipped, 3 skipped, etc. - if (numSkippedFrames >= g_Config.iNumSkip) { + if (numSkippedFrames >= g_Config.iFrameSkip) { skipFrame = false; } } diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 61a4330b71..107bde5249 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -424,16 +424,24 @@ void PauseScreen::render() { if (gpu) gpu->Resized(); } - UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &g_Config.bFrameSkip); - if (g_Config.bFrameSkip) { + + bool enableFrameSkip = g_Config.iFrameSkip != 0; + UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &enableFrameSkip); + if (enableFrameSkip) { + if (g_Config.iFrameSkip == 0) + g_Config.iFrameSkip = 3; + ui_draw2d.DrawText(UBUNTU24, gs->T("Skip Frames :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 250 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 80, 0, "Auto", ALIGN_LEFT)) - g_Config.iNumSkip = 3; + g_Config.iFrameSkip = 3; if (UIButton(GEN_ID, hlinear1, 30, 0, "1", ALIGN_LEFT)) - g_Config.iNumSkip = 1; + g_Config.iFrameSkip = 1; if (UIButton(GEN_ID, hlinear1, 30, 0, "2", ALIGN_LEFT)) - g_Config.iNumSkip = 2; + g_Config.iFrameSkip = 2; + } + else { + g_Config.iFrameSkip = 0; } UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); @@ -680,7 +688,18 @@ void GraphicsScreenP1::render() { #endif UICheckBox(GEN_ID, x, y += stride, gs->T("Media Engine"), ALIGN_TOPLEFT, &g_Config.bUseMediaEngine); UICheckBox(GEN_ID, x, y += stride, gs->T("Linear Filtering"), ALIGN_TOPLEFT, &g_Config.bLinearFiltering); - UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &g_Config.bFrameSkip); + bool enableFrameSkip = g_Config.iFrameSkip != 0; + UICheckBox(GEN_ID, x, y += stride, gs->T("Frame Skipping"), ALIGN_TOPLEFT, &enableFrameSkip); + if (enableFrameSkip) { + // This one doesn't have the # of frame options, so only change the setting if they flipped it. + // 3 means auto. + if (g_Config.iFrameSkip == 0) + g_Config.iFrameSkip = 3; + } + else { + g_Config.iFrameSkip = 0; + } + UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap); if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) { if (gpu) @@ -719,8 +738,13 @@ void GraphicsScreenP2::render() { UICheckBox(GEN_ID, x, y += stride, gs->T("Draw Wireframe"), ALIGN_TOPLEFT, &g_Config.bDrawWireframe); UICheckBox(GEN_ID, x, y += stride, gs->T("Display Raw Framebuffer"), ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer); UICheckBox(GEN_ID, x, y += stride, gs->T("True Color"), ALIGN_TOPLEFT, &g_Config.bTrueColor); - UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &g_Config.bAnisotropicFiltering); - if (g_Config.bAnisotropicFiltering) { + + bool AnisotropicFiltering = g_Config.iAnisotropyLevel != 0; + UICheckBox(GEN_ID, x, y += stride, gs->T("Anisotropic Filtering"), ALIGN_TOPLEFT, &AnisotropicFiltering); + if (AnisotropicFiltering) { + if (g_Config.iAnisotropyLevel == 0) + g_Config.iAnisotropyLevel = 2; + ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 160 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT)) @@ -731,19 +755,25 @@ void GraphicsScreenP2::render() { g_Config.iAnisotropyLevel = 8; if (UIButton(GEN_ID, hlinear1, 60, 0, "16x", ALIGN_LEFT)) g_Config.iAnisotropyLevel = 16; - } else + } else { g_Config.iAnisotropyLevel = 0; + } + + bool XBRZTexScaling = g_Config.iXBRZTexScalingLevel <= 1; + UICheckBox(GEN_ID, x, y += stride, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &XBRZTexScaling); + if (XBRZTexScaling) { + if (g_Config.iXBRZTexScalingLevel <= 1) + g_Config.iXBRZTexScalingLevel = 2; - UICheckBox(GEN_ID, x, y += stride, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &g_Config.bXBRZTexScaling); - if (g_Config.bXBRZTexScaling) { ui_draw2d.DrawText(UBUNTU24, gs->T("Level :"), x + 60, y += stride + 10, 0xFFFFFFFF, ALIGN_LEFT); HLinear hlinear1(x + 160 , y + 5, 20); if (UIButton(GEN_ID, hlinear1, 45, 0, "2x", ALIGN_LEFT)) g_Config.iXBRZTexScalingLevel = 2; if (UIButton(GEN_ID, hlinear1, 45, 0, "3x", ALIGN_LEFT)) g_Config.iXBRZTexScalingLevel = 3; - } else + } else { g_Config.iXBRZTexScalingLevel = 1; + } UIEnd(); } diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 883ccf722d..000809bc3f 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -537,7 +537,7 @@ namespace MainWindow break; case ID_OPTIONS_FRAMESKIP: - g_Config.bFrameSkip = !g_Config.bFrameSkip; + g_Config.iFrameSkip = g_Config.iFrameSkip == 0 ? 1 : 0; break; case ID_OPTIONS_USEMEDIAENGINE: @@ -776,7 +776,7 @@ namespace MainWindow CHECKITEM(ID_OPTIONS_USEVBO, g_Config.bUseVBO); CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache); CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.bShowFPSCounter); - CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.bFrameSkip); + CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0); CHECKITEM(ID_OPTIONS_USEMEDIAENGINE, g_Config.bUseMediaEngine); CHECKITEM(ID_OPTIONS_MIPMAP, g_Config.bMipMap); CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound); From e1587744e4c63e2ed1c4597718194ea6e59b34a2 Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 2 May 2013 23:24:59 +0800 Subject: [PATCH 2/6] Fix message dialog oversize --- Core/Dialog/PSPDialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index 6c7f5e387f..39ac4d2824 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -53,9 +53,9 @@ void PSPDialog::EndDraw() void PSPDialog::DisplayMessage(std::string text) { - PPGeDrawRect(30, 50, 450, 51, CalcFadedColor(0xFFFFFFFF)); - PPGeDrawRect(30, 180, 450, 181, CalcFadedColor(0xFFFFFFFF)); - PPGeDrawText(text.c_str(), 40, 60, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); + PPGeDrawRect(30, 30, 450, 31, CalcFadedColor(0xFFFFFFFF)); + PPGeDrawRect(30, 200, 450, 201, CalcFadedColor(0xFFFFFFFF)); + PPGeDrawText(text.c_str(), 40, 50, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0xFFFFFFFF)); } int PSPDialog::Shutdown() From 6d66577f17b66a0f97cb0d8136fa04f26aa844fe Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Thu, 2 May 2013 20:18:46 +0200 Subject: [PATCH 3/6] Don't write to transformedvertex.color1[4], it doesn't exist. --- GPU/GLES/TextureCache.cpp | 1 + GPU/GLES/TransformPipeline.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 6d6d2a8be1..9ec6da3261 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -680,6 +680,7 @@ static const u8 bitsPerPixel[11] = { 8, //GE_TFMT_DXT5=8, }; +// This is the same as (fmt & 4) != 0, heh. static const bool formatUsesClut[11] = { false, false, diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 9e264e1ca8..aa2a054219 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -680,7 +680,7 @@ void TransformDrawEngine::SoftwareTransformAndDraw( for (int i = 0; i < 4; i++) { transformed[index].color0[i] = c0[i] * 255.0f; } - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 3; i++) { transformed[index].color1[i] = c1[i] * 255.0f; } } From 0ccebacbd685465cc3bdba77eb6c4f5fff074a26 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Thu, 2 May 2013 20:58:10 +0200 Subject: [PATCH 4/6] Turn off screensavers. Note that this won't work on Vista+ when there's a password. --- Windows/WndMainWindow.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 000809bc3f..360ba30bc5 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -746,6 +746,21 @@ namespace MainWindow UpdateMenus(); break; + // Turn off the screensaver. + // Note that if there's a screensaver password, this simple method + // doesn't work on Vista or higher. + case WM_SYSCOMMAND: + { + switch (wParam) + { + case SC_SCREENSAVE: + return 0; + case SC_MONITORPOWER: + return 0; + } + return DefWindowProc(hWnd, message, wParam, lParam); + } + default: return DefWindowProc(hWnd, message, wParam, lParam); } From cd550680264413bdb73cd876aa314a6737404415 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Thu, 2 May 2013 21:36:36 +0200 Subject: [PATCH 5/6] iFrameSkip should be an int. --- Core/Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Config.h b/Core/Config.h index 943b40b7ac..6ff1fc31d4 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -60,7 +60,7 @@ public: bool bLinearFiltering; bool bUseVBO; bool bStretchToDisplay; - bool iFrameSkip; + int iFrameSkip; bool bUseMediaEngine; int iWindowX; From 4665226064b7c5ae6c47636dc5b88ab98d162841 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 2 May 2013 14:32:45 -0700 Subject: [PATCH 6/6] Fix typo breaking XBRZ option. --- UI/MenuScreens.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 107bde5249..af288883bf 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -759,7 +759,7 @@ void GraphicsScreenP2::render() { g_Config.iAnisotropyLevel = 0; } - bool XBRZTexScaling = g_Config.iXBRZTexScalingLevel <= 1; + bool XBRZTexScaling = g_Config.iXBRZTexScalingLevel > 1; UICheckBox(GEN_ID, x, y += stride, gs->T("xBRZ Texture Scaling"), ALIGN_TOPLEFT, &XBRZTexScaling); if (XBRZTexScaling) { if (g_Config.iXBRZTexScalingLevel <= 1)