From 08569eafa139b68694351845a6e624c7ac640f1a Mon Sep 17 00:00:00 2001 From: raven02 Date: Tue, 30 Jul 2013 22:28:34 +0800 Subject: [PATCH 1/3] Add GameSettingsScreen::DrawBackground() --- UI/GameSettingsScreen.cpp | 33 ++++++++++++++++++++++++++++++++ UI/GameSettingsScreen.h | 1 + UI/MenuScreens.cpp | 40 ++++++++++++++++++++------------------- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 4ec5fba879..dcf810a7f7 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -29,6 +29,10 @@ #include "Core/Config.h" #include "android/jni/TestRunner.h" #include "GPU/GPUInterface.h" +#include "base/colorutil.h" +#include "base/timeutil.h" +#include "math/curves.h" + namespace UI { @@ -275,6 +279,35 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new PopupMultiChoice(&g_Config.iButtonPreference, gs->T("Button Perference"), buttonPref, 1, 2, s, screenManager())); } +void DrawBackground(float alpha); + +void GameSettingsScreen::DrawBackground(UIContext &dc) { + GameInfo *ginfo = g_gameInfoCache.GetInfo(gamePath_, true); + dc.Flush(); + + dc.RebindTexture(); + ::DrawBackground(1.0f); + dc.Flush(); + + if (ginfo && ginfo->pic1Texture) { + ginfo->pic1Texture->Bind(0); + uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0; + dc.Draw()->DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color); + dc.Flush(); + dc.RebindTexture(); + } + /* + if (ginfo && ginfo->pic0Texture) { + ginfo->pic0Texture->Bind(0); + // Pic0 is drawn in the bottom right corner, overlaying pic1. + float sizeX = dp_xres / 480 * ginfo->pic0Texture->Width(); + float sizeY = dp_yres / 272 * ginfo->pic0Texture->Height(); + uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 2)) & 0xFFc0c0c0; + ui_draw2d.DrawTexRect(dp_xres - sizeX, dp_yres - sizeY, dp_xres, dp_yres, 0,0,1,1,color); + ui_draw2d.Flush(); + dc.RebindTexture(); + }*/ +} void GameSettingsScreen::update(InputState &input) { UIScreen::update(input); g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0; diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index a3ebef1121..62a9151c8b 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -30,6 +30,7 @@ public: protected: virtual void CreateViews(); + virtual void DrawBackground(UIContext &dc); private: std::string gamePath_, gameID_; diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 8535446e7e..2b63fc1360 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -1697,12 +1697,12 @@ void KeyMappingScreen::render() { #define KeyBtn(x, y, symbol) \ - if (UIButton(GEN_ID, Pos(x, y), 60, 0, KeyMap::NameKeyFromPspButton(currentMap_, symbol).c_str(), \ + if (UIButton(GEN_ID, Pos(x, y), 90, 0, KeyMap::NameKeyFromPspButton(currentMap_, symbol).c_str(), \ ALIGN_TOPLEFT)) {\ screenManager()->push(new KeyMappingNewKeyDialog(symbol, currentMap_), 0); \ UIReset(); \ } \ - UIText(0, Pos(x+30, y+50), KeyMap::NameDeviceFromPspButton(currentMap_, symbol).c_str(), 0xFFFFFFFF, 0.78f, ALIGN_HCENTER); \ + UIText(0, Pos(x+30, y+50), KeyMap::NameDeviceFromPspButton(currentMap_, symbol).c_str(), 0xFFFFFFFF, 0.7f, ALIGN_HCENTER); \ UIText(0, Pos(x+30, y+80), KeyMap::GetPspButtonName(symbol).c_str(), 0xFFFFFFFF, 0.5f, ALIGN_HCENTER); \ @@ -1715,34 +1715,36 @@ void KeyMappingScreen::render() { int left = 30; KeyBtn(left, 30, CTRL_LTRIGGER); - int top = 100; - KeyBtn(left+hlfpad, top, CTRL_UP); // ^ - KeyBtn(left, top+hlfpad, CTRL_LEFT);// < - KeyBtn(left+pad, top+hlfpad, CTRL_RIGHT); // > - KeyBtn(left+hlfpad, top+pad, CTRL_DOWN); // v + int top = 120; + KeyBtn(left+hlfpad, top, CTRL_UP); // Up + KeyBtn(left, top+hlfpad, CTRL_LEFT);// Left + KeyBtn(left+pad, top+hlfpad, CTRL_RIGHT); // Right + KeyBtn(left+hlfpad, top+pad, CTRL_DOWN); // Down top = 10; - left = 250; - KeyBtn(left+hlfpad, top, VIRTKEY_AXIS_Y_MAX); // ^ - KeyBtn(left, top+hlfpad, VIRTKEY_AXIS_X_MIN);// < - KeyBtn(left+pad, top+hlfpad, VIRTKEY_AXIS_X_MAX); // > - KeyBtn(left+hlfpad, top+pad, VIRTKEY_AXIS_Y_MIN); // v - top = 100; + left = 300; + KeyBtn(left+hlfpad, top, VIRTKEY_AXIS_Y_MAX); // Analog Up + KeyBtn(left, top+hlfpad, VIRTKEY_AXIS_X_MIN);// Analog Left + KeyBtn(left+pad, top+hlfpad, VIRTKEY_AXIS_X_MAX); // Analog Right + KeyBtn(left+hlfpad, top+pad, VIRTKEY_AXIS_Y_MIN); // Analog Down - left = 500; + top = 120; + left = 550; KeyBtn(left+hlfpad, top, CTRL_TRIANGLE); // Triangle KeyBtn(left, top+hlfpad, CTRL_SQUARE); // Square KeyBtn(left+pad, top+hlfpad, CTRL_CIRCLE); // Circle KeyBtn(left+hlfpad, top+pad, CTRL_CROSS); // Cross + + left = 680; KeyBtn(left, 30, CTRL_RTRIGGER); - top += pad; - left = 250; - KeyBtn(left, top, CTRL_SELECT); - KeyBtn(left + pad, top, CTRL_START); + top += pad + 50; + left = 300; + KeyBtn(left, top, CTRL_SELECT); // Select + KeyBtn(left + pad, top, CTRL_START); //Start top = 10; - left = 720; + left = 830; KeyBtn(left, top, VIRTKEY_UNTHROTTLE); top += 100; KeyBtn(left, top, VIRTKEY_SPEED_TOGGLE); From 766770a7550e30446ebfbe58c4622c73944c30c0 Mon Sep 17 00:00:00 2001 From: raven02 Date: Tue, 30 Jul 2013 21:18:49 +0800 Subject: [PATCH 2/3] Anrdoid : Add option 'Anti-Aliasing' --- Core/Config.cpp | 4 ++-- Core/Config.h | 2 +- UI/EmuScreen.cpp | 2 +- UI/GameSettingsScreen.cpp | 1 + UI/MenuScreens.cpp | 2 +- Windows/WndMainWindow.cpp | 6 +++--- Windows/ppsspp.rc | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index fbf4917493..050b9d0bed 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -101,7 +101,7 @@ void Config::Load(const char *iniFileName) graphics->Get("RenderingMode", &iRenderingMode, 1); // default is buffered rendering mode graphics->Get("HardwareTransform", &bHardwareTransform, true); graphics->Get("TextureFiltering", &iTexFiltering, 1); - graphics->Get("SSAA", &SSAntiAliasing, 0); + graphics->Get("SSAA", &bAntiAliasing, 0); graphics->Get("VBO", &bUseVBO, false); graphics->Get("FrameSkip", &iFrameSkip, 0); graphics->Get("FrameRate", &iFpsLimit, 0); @@ -230,7 +230,7 @@ void Config::Save() graphics->Set("RenderingMode", iRenderingMode); graphics->Set("HardwareTransform", bHardwareTransform); graphics->Set("TextureFiltering", iTexFiltering); - graphics->Set("SSAA", SSAntiAliasing); + graphics->Set("SSAA", bAntiAliasing); graphics->Set("VBO", bUseVBO); graphics->Set("FrameSkip", iFrameSkip); graphics->Set("FrameRate", iFpsLimit); diff --git a/Core/Config.h b/Core/Config.h index b226ed5014..1b13f746fb 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -77,7 +77,7 @@ public: int iWindowX; int iWindowY; int iWindowZoom; // for Windows - bool SSAntiAliasing; // for Windows, too + bool bAntiAliasing; // for Windows, too bool bVertexCache; bool bFullScreen; #ifdef _WIN32 diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index f96ca4861b..3dc4138b4d 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -83,7 +83,7 @@ void EmuScreen::bootGame(const std::string &filename) { coreParam.outputHeight = dp_yres; coreParam.pixelWidth = pixel_xres; coreParam.pixelHeight = pixel_yres; - if (g_Config.SSAntiAliasing) { + if (g_Config.bAntiAliasing) { coreParam.renderWidth *= 2; coreParam.renderHeight *= 2; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index dcf810a7f7..a2bbba9071 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -204,6 +204,7 @@ void GameSettingsScreen::CreateViews() { static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory(GPU)"}; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, 3, gs, screenManager())); #endif + graphicsSettings->Add(new CheckBox(&g_Config.bAntiAliasing, gs->T("Anti-Aliasing"))); graphicsSettings->Add(new ItemHeader(gs->T("Features"))); graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform"))); graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache"))); diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 2b63fc1360..9f7f765f32 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -948,7 +948,7 @@ void GraphicsScreenP1::render() { #endif UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap); - UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti-Aliasing"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing); + UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti-Aliasing"), ALIGN_TOPLEFT, &g_Config.bAntiAliasing); #ifdef _WIN32 //bool Vsync = g_Config.iVSyncInterval != 0; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 9c2deae595..1b374d07c1 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -186,7 +186,7 @@ namespace MainWindow // Round up to a zoom factor for the render size. int zoom = (rc.right - rc.left + 479) / 480; - if (g_Config.SSAntiAliasing) zoom *= 2; + if (g_Config.bAntiAliasing) zoom *= 2; PSP_CoreParameter().renderWidth = 480 * zoom; PSP_CoreParameter().renderHeight = 272 * zoom; PSP_CoreParameter().outputWidth = 480 * zoom; @@ -1007,7 +1007,7 @@ namespace MainWindow break; case ID_OPTIONS_SIMPLE2XSSAA: - g_Config.SSAntiAliasing = !g_Config.SSAntiAliasing; + g_Config.bAntiAliasing = !g_Config.bAntiAliasing; ResizeDisplay(true); break; @@ -1187,7 +1187,7 @@ namespace MainWindow CHECKITEM(ID_OPTIONS_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats); CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform); CHECKITEM(ID_OPTIONS_FASTMEMORY, g_Config.bFastMemory); - CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.SSAntiAliasing); + CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.bAntiAliasing); CHECKITEM(ID_OPTIONS_STRETCHDISPLAY, g_Config.bStretchToDisplay); CHECKITEM(ID_EMULATION_RUNONLOAD, g_Config.bAutoRun); CHECKITEM(ID_OPTIONS_USEVBO, g_Config.bUseVBO); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 01d460746b..3ecdb55b26 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -407,7 +407,7 @@ BEGIN MENUITEM "&Vertex Cache", ID_OPTIONS_VERTEXCACHE MENUITEM "&Stream VBO", ID_OPTIONS_USEVBO MENUITEM "&MipMapping", ID_OPTIONS_MIPMAP - MENUITEM "2x SSAA", ID_OPTIONS_SIMPLE2XSSAA + MENUITEM "Anti-Aliasing", ID_OPTIONS_SIMPLE2XSSAA MENUITEM "VS&ync", ID_OPTIONS_VSYNC MENUITEM SEPARATOR MENUITEM "Show &FPS", ID_OPTIONS_SHOWFPS From b938313501911e3c6a7ad5d6e0c4f20be77d3b07 Mon Sep 17 00:00:00 2001 From: raven02 Date: Wed, 31 Jul 2013 23:47:52 +0800 Subject: [PATCH 3/3] Revert size to fit Nexus S --- UI/MenuScreens.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 9f7f765f32..5b6aff137d 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -1722,29 +1722,29 @@ void KeyMappingScreen::render() { KeyBtn(left+hlfpad, top+pad, CTRL_DOWN); // Down top = 10; - left = 300; + left = 250; KeyBtn(left+hlfpad, top, VIRTKEY_AXIS_Y_MAX); // Analog Up KeyBtn(left, top+hlfpad, VIRTKEY_AXIS_X_MIN);// Analog Left KeyBtn(left+pad, top+hlfpad, VIRTKEY_AXIS_X_MAX); // Analog Right KeyBtn(left+hlfpad, top+pad, VIRTKEY_AXIS_Y_MIN); // Analog Down top = 120; - left = 550; + left = 480; KeyBtn(left+hlfpad, top, CTRL_TRIANGLE); // Triangle KeyBtn(left, top+hlfpad, CTRL_SQUARE); // Square KeyBtn(left+pad, top+hlfpad, CTRL_CIRCLE); // Circle KeyBtn(left+hlfpad, top+pad, CTRL_CROSS); // Cross - left = 680; + left = 610; KeyBtn(left, 30, CTRL_RTRIGGER); top += pad + 50; - left = 300; + left = 250; KeyBtn(left, top, CTRL_SELECT); // Select KeyBtn(left + pad, top, CTRL_START); //Start top = 10; - left = 830; + left = 720; KeyBtn(left, top, VIRTKEY_UNTHROTTLE); top += 100; KeyBtn(left, top, VIRTKEY_SPEED_TOGGLE);