From 284600b1a7f7992422351f71d2b09b3e7349582e Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sat, 7 Nov 2015 01:10:43 +0100 Subject: [PATCH 1/9] Move "Display Rotation" to display layout editor. Fix portrait rotation representation in the editor with auto setting. Minor cleanup. --- GPU/Common/FramebufferCommon.cpp | 70 ++++++++++++++------------------ UI/DisplayLayoutScreen.cpp | 16 ++++++-- UI/DisplayLayoutScreen.h | 2 + UI/GameSettingsScreen.cpp | 6 --- UI/GameSettingsScreen.h | 1 - 5 files changed, 45 insertions(+), 50 deletions(-) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 37018a0f62..1a5d731750 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -40,49 +40,41 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW outW = frameW; outH = frameH; } else { - bool fullScreenZoom = true; -#ifndef MOBILE_DEVICE - // This would turn off small display in window mode. I think it's better to allow it. - // fullScreenZoom = g_Config.bFullScreen; -#endif - if (fullScreenZoom) { - if (g_Config.iSmallDisplayZoom != 0) { - float offsetX = (g_Config.fSmallDisplayOffsetX - 0.5f) * 2.0f * frameW; - float offsetY = (g_Config.fSmallDisplayOffsetY - 0.5f) * 2.0f * frameH; - // Have to invert Y for GL - if (GetGPUBackend() == GPUBackend::OPENGL) { - offsetY = offsetY * -1.0f; - } - float customZoom = g_Config.fSmallDisplayCustomZoom / 8.0f; - float smallDisplayW = origW * customZoom; - float smallDisplayH = origH * customZoom; - if (!rotated) { - *x = floorf(((frameW - smallDisplayW) / 2.0f) + offsetX); - *y = floorf(((frameH - smallDisplayH) / 2.0f) + offsetY); - *w = floorf(smallDisplayW); - *h = floorf(smallDisplayH); - return; - } else { - *x = floorf(((frameW - smallDisplayH) / 2.0f) + offsetX); - *y = floorf(((frameH - smallDisplayW) / 2.0f) + offsetY); - *w = floorf(smallDisplayH); - *h = floorf(smallDisplayW); - return; - } + if (g_Config.iSmallDisplayZoom != 0) { + float offsetX = (g_Config.fSmallDisplayOffsetX - 0.5f) * 2.0f * frameW; + float offsetY = (g_Config.fSmallDisplayOffsetY - 0.5f) * 2.0f * frameH; + // Have to invert Y for GL + if (GetGPUBackend() == GPUBackend::OPENGL) { + offsetY = offsetY * -1.0f; + } + float customZoom = g_Config.fSmallDisplayCustomZoom / 8.0f; + float smallDisplayW = origW * customZoom; + float smallDisplayH = origH * customZoom; + if (!rotated) { + *x = floorf(((frameW - smallDisplayW) / 2.0f) + offsetX); + *y = floorf(((frameH - smallDisplayH) / 2.0f) + offsetY); + *w = floorf(smallDisplayW); + *h = floorf(smallDisplayH); + return; } else { - float pixelCrop = frameH / 270.0f; - float resCommonWidescreen = pixelCrop - floor(pixelCrop); - if (!rotated && resCommonWidescreen == 0.0f) { - *x = 0; - *y = floorf(-pixelCrop); - *w = floorf(frameW); - *h = floorf(pixelCrop * 272.0f); - return; - } + *x = floorf(((frameW - smallDisplayH) / 2.0f) + offsetX); + *y = floorf(((frameH - smallDisplayW) / 2.0f) + offsetY); + *w = floorf(smallDisplayH); + *h = floorf(smallDisplayW); + return; + } + } else { + float pixelCrop = frameH / 270.0f; + float resCommonWidescreen = pixelCrop - floor(pixelCrop); + if (!rotated && resCommonWidescreen == 0.0f) { + *x = 0; + *y = floorf(-pixelCrop); + *w = floorf(frameW); + *h = floorf(pixelCrop * 272.0f); + return; } } - float origRatio = !rotated ? origW / origH : origH / origW; float frameRatio = frameW / frameH; diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index 18bf3f9731..f6f6baf894 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -27,6 +27,7 @@ #include "Core/Config.h" #include "Core/System.h" #include "DisplayLayoutEditor.h" +#include "GPU/GLES/Framebuffer.h" static const int leftColumnWidth = 200; @@ -151,7 +152,6 @@ UI::EventReturn DisplayLayoutScreen::OnZoomChange(UI::EventParams &e) { return UI::EVENT_DONE; }; - void DisplayLayoutScreen::dialogFinished(const Screen *dialog, DialogResult result) { RecreateViews(); } @@ -193,10 +193,13 @@ void DisplayLayoutScreen::CreateViews() { Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10)); static const char *zoomLevels[] = { "Auto", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x" }; - zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoom, gr->T("Zoom settings"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(300, WRAP_CONTENT, verticalBoundaryPositionL * 2 - 150, NONE, NONE, 10)); + zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoom, gr->T("Zoom settings"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(300, WRAP_CONTENT, local_dp_xres / 2 - 150, NONE, NONE, 10)); zoom_->OnChoice.Handle(this, &DisplayLayoutScreen::OnZoomChange); - + static const char *displayRotation[] = { "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed" }; + rotation_ = new PopupMultiChoice(&g_Config.iInternalScreenRotation, gr->T("Rotation"), displayRotation, 1, ARRAY_SIZE(displayRotation), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, local_dp_yres - 64)); + rotation_->SetEnabledPtr(&displayRotEnable_); + displayRotEnable_ = (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158 + 64 + 10)); if (g_Config.iSmallDisplayZoom == 0) { @@ -205,6 +208,10 @@ void DisplayLayoutScreen::CreateViews() { g_Config.fSmallDisplayCustomZoom = autoBound; g_Config.fSmallDisplayOffsetX = 0.5f; g_Config.fSmallDisplayOffsetY = 0.5f; + if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { + float autoBound = bounds.h / 480.0f * 8.0f; + g_Config.fSmallDisplayCustomZoom = autoBound; + } } else { Choice *center = new Choice(di->T("Center"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 84)); center->OnClick.Handle(this, &DisplayLayoutScreen::OnCenter); @@ -218,10 +225,11 @@ void DisplayLayoutScreen::CreateViews() { back->OnClick.Handle(this, &UIScreen::OnBack); root_->Add(mode_); root_->Add(zoom_); + root_->Add(rotation_); root_->Add(back); displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, g_Config.fSmallDisplayCustomZoom); - if (g_Config.iInternalScreenRotation == 2 || g_Config.iInternalScreenRotation == 4) { + if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { displayRepresentation_->SetAngle(90.0f); } root_->Add(displayRepresentation_); diff --git a/UI/DisplayLayoutScreen.h b/UI/DisplayLayoutScreen.h index 6aa8761f69..98dffaa4ee 100644 --- a/UI/DisplayLayoutScreen.h +++ b/UI/DisplayLayoutScreen.h @@ -42,6 +42,8 @@ private: DragDropDisplay *displayRepresentation_; UI::ChoiceStrip *mode_; UI::PopupMultiChoice *zoom_; + UI::PopupMultiChoice *rotation_; + bool displayRotEnable_; // Touch down state for drag to resize etc float startX_; float startY_; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 7de23b92b3..fb70302419 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -194,11 +194,6 @@ void GameSettingsScreen::CreateViews() { resolutionEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); resolutionChoice_->SetEnabledPtr(&resolutionEnable_); - static const char *displayRotation[] = {"Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed"}; - PopupMultiChoice *dispRotChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iInternalScreenRotation, gr->T("Display Rotation"), displayRotation, 1, ARRAY_SIZE(displayRotation), co->GetName(), screenManager())); - dispRotChoice->SetEnabledPtr(&displayRotEnable_); - displayRotEnable_ = (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); - #ifdef ANDROID static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2; @@ -682,7 +677,6 @@ UI::EventReturn GameSettingsScreen::OnRenderingMode(UI::EventParams &e) { postProcEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); resolutionEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); - displayRotEnable_ = (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) { g_Config.bAutoFrameSkip = false; diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 49d1c624f5..89224865af 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -115,7 +115,6 @@ private: bool postProcEnable_; bool resolutionEnable_; bool bloomHackEnable_; - bool displayRotEnable_; }; class DeveloperToolsScreen : public UIDialogScreenWithBackground { From 57c193d74244c6815f68907e356e372f7a8af365 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sat, 7 Nov 2015 04:40:04 +0100 Subject: [PATCH 2/9] Add Display Rotation to windows menu bar. --- Windows/MainWindowMenu.cpp | 33 +++++++++++++++++++++++++++++++++ Windows/ppsspp.rc | 7 +++++++ Windows/resource.h | 4 ++++ 3 files changed, 44 insertions(+) diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index d628ad048b..cf9ebcb849 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -80,6 +80,9 @@ namespace MainWindow { // File submenus SUBMENU_FILE_SAVESTATE_SLOT = 6, + // Emulation submenus + SUBMENU_DISPLAY_ROTATION = 8, + // Game Settings submenus SUBMENU_CUSTOM_SHADERS = 10, SUBMENU_RENDERING_RESOLUTION = 11, @@ -235,6 +238,11 @@ namespace MainWindow { TranslateMenuItem(menu, ID_EMULATION_STOP, L"\tCtrl+W"); TranslateMenuItem(menu, ID_EMULATION_RESET, L"\tCtrl+B"); TranslateMenuItem(menu, ID_EMULATION_SWITCH_UMD, L"\tCtrl+U", "Switch UMD"); + TranslateSubMenu(menu, "Display Rotation", MENU_EMULATION, SUBMENU_DISPLAY_ROTATION); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_H); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_V); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_H_R); + TranslateMenuItem(menu, ID_EMULATION_ROTATION_V_R); // Debug menu TranslateMenuItem(menu, ID_DEBUG_LOADMAPFILE); @@ -385,6 +393,10 @@ namespace MainWindow { } } + static void setScreenRotation(int rotation) { + g_Config.iInternalScreenRotation = rotation; + } + static void SaveStateActionFinished(bool result, void *userdata) { PostMessage(MainWindow::GetHWND(), WM_USER_SAVESTATE_FINISH, 0, 0); } @@ -534,6 +546,11 @@ namespace MainWindow { UmdSwitchAction(); break; + case ID_EMULATION_ROTATION_H: setScreenRotation(ROTATION_LOCKED_HORIZONTAL); break; + case ID_EMULATION_ROTATION_V: setScreenRotation(ROTATION_LOCKED_VERTICAL); break; + case ID_EMULATION_ROTATION_H_R: setScreenRotation(ROTATION_LOCKED_HORIZONTAL180); break; + case ID_EMULATION_ROTATION_V_R: setScreenRotation(ROTATION_LOCKED_VERTICAL180); break; + case ID_EMULATION_CHEATS: g_Config.bEnableCheats = !g_Config.bEnableCheats; osm.ShowOnOff(gr->T("Cheats"), g_Config.bEnableCheats); @@ -933,6 +950,22 @@ namespace MainWindow { CHECKITEM(ID_EMULATION_CHEATS, g_Config.bEnableCheats); CHECKITEM(ID_OPTIONS_IGNOREWINKEY, g_Config.bIgnoreWindowsKey); + static const int displayrotationitems[] = { + ID_EMULATION_ROTATION_H, + ID_EMULATION_ROTATION_V, + ID_EMULATION_ROTATION_H_R, + ID_EMULATION_ROTATION_V_R + }; + if (g_Config.iInternalScreenRotation < ROTATION_LOCKED_HORIZONTAL) + g_Config.iInternalScreenRotation = ROTATION_LOCKED_HORIZONTAL; + + else if (g_Config.iInternalScreenRotation > ROTATION_LOCKED_VERTICAL180) + g_Config.iInternalScreenRotation = ROTATION_LOCKED_VERTICAL180; + + for (int i = 0; i < ARRAY_SIZE(displayrotationitems); i++) { + CheckMenuItem(menu, displayrotationitems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iInternalScreenRotation ? MF_CHECKED : MF_UNCHECKED)); + } + // Disable Vertex Cache when HW T&L is disabled. if (!g_Config.bHardwareTransform) { EnableMenuItem(menu, ID_OPTIONS_VERTEXCACHE, MF_GRAYED); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index be654e816f..96bba8e4f2 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -411,6 +411,13 @@ BEGIN MENUITEM "Stop", ID_EMULATION_STOP MENUITEM "Reset", ID_EMULATION_RESET MENUITEM "Switch UMD", ID_EMULATION_SWITCH_UMD + POPUP "Display Rotation" + BEGIN + MENUITEM "Landscape", ID_EMULATION_ROTATION_H + MENUITEM "Portrait", ID_EMULATION_ROTATION_V + MENUITEM "Landscape reversed", ID_EMULATION_ROTATION_H_R + MENUITEM "Portrait reversed", ID_EMULATION_ROTATION_V_R + END END POPUP "Debug" diff --git a/Windows/resource.h b/Windows/resource.h index 5ef058e63a..2bc7be481f 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -319,6 +319,10 @@ #define ID_OPTIONS_BUFNEARESTFILTER 40153 #define ID_OPTIONS_DIRECT3D9 40154 #define ID_OPTIONS_OPENGL 40155 +#define ID_EMULATION_ROTATION_H 40156 +#define ID_EMULATION_ROTATION_V 40157 +#define ID_EMULATION_ROTATION_H_R 40158 +#define ID_EMULATION_ROTATION_V_R 40159 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500 From 0c2efa6d44cd2a93c51a376cfb7df7685191fab8 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Fri, 13 Nov 2015 08:50:10 +0100 Subject: [PATCH 3/9] Make sure display representation matches all cases and recreate views on window resize(this also fixes touch control layout screen). --- UI/DisplayLayoutScreen.cpp | 27 +++++++++++++++++++-------- Windows/MainWindow.cpp | 6 ++++++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index f6f6baf894..ae43d2ee5c 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -30,6 +30,7 @@ #include "GPU/GLES/Framebuffer.h" static const int leftColumnWidth = 200; +static const float orgRatio = 1.764706; // Ugly hackery, need to rework some stuff to get around this static float local_dp_xres; @@ -179,9 +180,9 @@ void DisplayLayoutScreen::CreateViews() { float horizontalBoundaryPositionL = local_dp_yres / 4.0f; float horizontalBoundaryPositionR = local_dp_yres - horizontalBoundaryPositionL; TabHolder *verticalBoundaryL = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionL, new AnchorLayoutParams(0, 0, 0, 0, false)); - TabHolder *verticalBoundaryR = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionR, new AnchorLayoutParams(0, 0, 0, 0, false)); - TabHolder *horizontalBoundaryL = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionL * 2.0f, new AnchorLayoutParams(verticalBoundaryPositionL * 2.0f, horizontalBoundaryPositionL - 31.0f, 0, 0, true)); - TabHolder *horizontalBoundaryR = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionL * 2.0f, new AnchorLayoutParams(verticalBoundaryPositionL * 2.0f, horizontalBoundaryPositionR + 31.0f, 0, 0, true)); + TabHolder *verticalBoundaryR = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionR + 4.0f, new AnchorLayoutParams(0, 0, 0, 0, false)); + TabHolder *horizontalBoundaryL = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionL * 2.0f, new AnchorLayoutParams(verticalBoundaryPositionL * 2.0f, horizontalBoundaryPositionL - 32.0f, 0, 0, true)); + TabHolder *horizontalBoundaryR = new TabHolder(ORIENT_VERTICAL, verticalBoundaryPositionL * 2.0f, new AnchorLayoutParams(verticalBoundaryPositionL * 2.0f, horizontalBoundaryPositionR + 32.0f, 0, 0, true)); AnchorLayout *topBoundary = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); AnchorLayout *bottomBoundary = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); root_->Add(verticalBoundaryL); @@ -204,14 +205,24 @@ void DisplayLayoutScreen::CreateViews() { mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158 + 64 + 10)); if (g_Config.iSmallDisplayZoom == 0) { mode_->AddChoice(gr->T("Active (Auto)")); - float autoBound = bounds.w / 480.0f * 8.0f; + float autoBound = local_dp_yres / 270.0f * 8.0f; + // Case of screen rotated ~ only works with buffered rendering + if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { + autoBound = local_dp_yres / 480.0f * 8.0f; + } else { // Without rotation in common cases like 1080p we cut off 2 pixels of height, this reflects other cases + float resCommonWidescreen = autoBound - floor(autoBound); + if (resCommonWidescreen != 0.0f) { + float ratio = local_dp_xres / local_dp_yres; + if (ratio < orgRatio) { + autoBound = local_dp_xres / 480.0f * 8.0f; + } else { + autoBound = local_dp_yres / 272.0f * 8.0f; + } + } + } g_Config.fSmallDisplayCustomZoom = autoBound; g_Config.fSmallDisplayOffsetX = 0.5f; g_Config.fSmallDisplayOffsetY = 0.5f; - if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { - float autoBound = bounds.h / 480.0f * 8.0f; - g_Config.fSmallDisplayCustomZoom = autoBound; - } } else { Choice *center = new Choice(di->T("Center"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 84)); center->OnClick.Handle(this, &DisplayLayoutScreen::OnCenter); diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index d6b54d78b2..d0f6ee8581 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -69,6 +69,7 @@ #include "GPU/GPUInterface.h" #include "UI/OnScreenDisplay.h" #include "Windows/MainWindowMenu.h" +#include "UI/GameSettingsScreen.h" #define MOUSEEVENTF_FROMTOUCH_NOPEN 0xFF515780 //http://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx #define MOUSEEVENTF_MASK_PLUS_PENTOUCH 0xFFFFFF80 @@ -93,6 +94,7 @@ struct VerySleepy_AddrInfo { static RECT g_normalRC = {0}; static std::wstring windowTitle; extern InputState input_state; +extern ScreenManager *screenManager; #define TIMER_CURSORUPDATE 1 #define TIMER_CURSORMOVEUPDATE 2 @@ -281,6 +283,10 @@ namespace MainWindow NativeMessageReceived("gpu resized", ""); } + if (screenManager) { + screenManager->RecreateAllViews(); + } + // Don't save the window state if fullscreen. if (!g_Config.bFullScreen) { g_WindowState = newSizingType; From e4271fe1bc8b83f49a3380cd6ef5357da8626f4b Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Fri, 13 Nov 2015 22:30:32 +0100 Subject: [PATCH 4/9] Integrate stretching options into display layout editor. --- Core/Config.cpp | 12 +--- Core/Config.h | 4 +- GPU/Common/FramebufferCommon.cpp | 8 ++- Qt/mainwindow.cpp | 27 +++++--- Qt/mainwindow.h | 4 +- UI/DisplayLayoutScreen.cpp | 106 +++++++++++++++++++------------ UI/DisplayLayoutScreen.h | 3 +- UI/GameSettingsScreen.cpp | 6 -- Windows/MainWindowMenu.cpp | 60 +++++++++++++++-- Windows/ppsspp.rc | 17 ++++- Windows/resource.h | 14 +++- 11 files changed, 176 insertions(+), 85 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 5d5c6355b2..de7d0c3040 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -384,14 +384,6 @@ static int DefaultInternalResolution() { #endif } -static bool DefaultPartialStretch() { -#ifdef BLACKBERRY - return pixel_xres < 1.3 * pixel_yres; -#else - return false; -#endif -} - static bool DefaultTimerHack() { // Has been in use on Symbian since v0.7. Preferred option. #ifdef __SYMBIAN32__ @@ -465,9 +457,7 @@ static ConfigSetting graphicsSettings[] = { #endif // TODO: Replace these settings with a list of options - ConfigSetting("PartialStretch", &g_Config.bPartialStretch, &DefaultPartialStretch, true, true), - ConfigSetting("StretchToDisplay", &g_Config.bStretchToDisplay, false, true, true), - ConfigSetting("SmallDisplayZoom", &g_Config.iSmallDisplayZoom, 0, true, true), + ConfigSetting("SmallDisplayZoom", &g_Config.iSmallDisplayZoom, 2, true, true), ConfigSetting("SmallDisplayOffsetX", &g_Config.fSmallDisplayOffsetX, 0.5f, true, true), ConfigSetting("SmallDisplayOffsetY", &g_Config.fSmallDisplayOffsetY, 0.5f, true, true), ConfigSetting("SmallDisplayCustomZoom", &g_Config.fSmallDisplayCustomZoom, 8.0f, true, true), diff --git a/Core/Config.h b/Core/Config.h index 55c1d8473d..65444c5838 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -144,9 +144,7 @@ public: int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (CPU) 3 = Read Framebuffer to memory (GPU) int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG) int iBufFilter; // 1 = linear, 2 = nearest - bool bPartialStretch; - bool bStretchToDisplay; - int iSmallDisplayZoom; // Used to fit display into screen 0 = auto, anything higher is used to set's integer zoom of psp resolution and allows manual editing + int iSmallDisplayZoom; // Used to fit display into screen 0 = stretch, 1 = partial stretch, 2 = auto, anything higher is used to set's integer zoom of psp resolution and allows manual editing float fSmallDisplayOffsetX; // Along with Y it goes from 0.0 to 1.0, XY (0.5, 0.5) = center of the screen float fSmallDisplayOffsetY; float fSmallDisplayCustomZoom; //This is actually used for zoom, both in and out. diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 1a5d731750..a917de49af 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -36,11 +36,11 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW bool rotated = rotation == ROTATION_LOCKED_VERTICAL || rotation == ROTATION_LOCKED_VERTICAL180; - if (g_Config.bStretchToDisplay) { + if (g_Config.iSmallDisplayZoom == 0) { outW = frameW; outH = frameH; } else { - if (g_Config.iSmallDisplayZoom != 0) { + if (g_Config.iSmallDisplayZoom > 2) { float offsetX = (g_Config.fSmallDisplayOffsetX - 0.5f) * 2.0f * frameW; float offsetY = (g_Config.fSmallDisplayOffsetY - 0.5f) * 2.0f * frameH; // Have to invert Y for GL @@ -83,12 +83,14 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW outW = frameW; outH = frameW / origRatio; // Stretch a little bit - if (!rotated && g_Config.bPartialStretch) + if (!rotated && g_Config.iSmallDisplayZoom == 1) outH = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564 } else { // Image is taller than frame. Center horizontally. outW = frameH * origRatio; outH = frameH; + if (rotated && g_Config.iSmallDisplayZoom == 1) + outW = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564 } } diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 8a007f701d..6d7004007c 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -89,6 +89,20 @@ void MainWindow::updateMenus() } } + foreach(QAction * action, displayLayoutGroup->actions()) { + if (g_Config.iSmallDisplayZoom == action->data().toInt()) { + if (g_Config.iSmallDisplayZoom > 2) { + g_Config.fSmallDisplayCustomZoom = (float)((g_Config.iSmallDisplayZoom - 2) * 8); + } + + if (gpu) + gpu->Resized(); + + action->setChecked(true); + break; + } + } + int defaultLevel = LogManager::GetInstance()->GetLogLevel(LogTypes::COMMON); foreach(QAction * action, defaultLogGroup->actions()) { if (defaultLevel == action->data().toInt()) { @@ -334,13 +348,6 @@ void MainWindow::memviewTexAct() memoryTexWindow->show(); } -void MainWindow::stretchAct() -{ - g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay; - if (gpu) - gpu->Resized(); -} - void MainWindow::raiseTopMost() { @@ -539,8 +546,10 @@ void MainWindow::createMenus() QList() << 1 << 2 << 3 << 4, QList() << Qt::CTRL + Qt::Key_1 << Qt::CTRL + Qt::Key_2 << Qt::CTRL + Qt::Key_3 << Qt::CTRL + Qt::Key_4); - videoMenu->add(new MenuAction(this, SLOT(stretchAct()), QT_TR_NOOP("&Stretch to Display"))) - ->addEventChecked(&g_Config.bStretchToDisplay); + MenuTree* displayLayoutMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Display Layout Options")); + displayLayoutGroup = new MenuActionGroup(this, displayLayoutMenu, SLOT(displayLayoutGroup_triggered(QAction *)), + QStringList() << "Stretched" << "Partialy stretched" << "Auto Scaling" << "1x" << "2x" << "3x" << "4x" << "5x" << "6x" << "7x" << "8x" << "9x" << "10x", + QList() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12); videoMenu->addSeparator(); videoMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware Transform"), Qt::Key_F6)) ->addEventChecked(&g_Config.bHardwareTransform); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 8e500e5d4f..8e53d7cc1f 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -100,7 +100,7 @@ private slots: void screenGroup_triggered(QAction *action) { SetZoom(action->data().toInt()); } - void stretchAct(); + void displayLayoutGroup_triggered(QAction *action) { g_Config.iSmallDisplayZoom = action->data().toInt(); } void transformAct() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; } void vertexCacheAct() { g_Config.bVertexCache = !g_Config.bVertexCache; } void frameskipAct() { g_Config.iFrameSkip = !g_Config.iFrameSkip; } @@ -154,7 +154,7 @@ private: Debugger_MemoryTex *memoryTexWindow; Debugger_DisplayList *displaylistWindow; - QActionGroup *anisotropicGroup, *screenGroup, + QActionGroup *anisotropicGroup, *screenGroup, *displayLayoutGroup, *defaultLogGroup, *g3dLogGroup, *hleLogGroup; }; diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index ae43d2ee5c..cf89fc71c0 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -21,6 +21,7 @@ #include "gfx_es2/draw_buffer.h" #include "i18n/i18n.h" #include "ui/ui_context.h" +#include "ui/view.h" #include "ui_atlas.h" #include "DisplayLayoutScreen.h" @@ -70,7 +71,7 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { using namespace UI; int mode = mode_->GetSelection(); - if (g_Config.iSmallDisplayZoom == 0) { mode = -1; } + if (g_Config.iSmallDisplayZoom == 2) { mode = -1; } const Bounds &screen_bounds = screenManager()->getUIContext()->GetBounds(); @@ -140,8 +141,8 @@ UI::EventReturn DisplayLayoutScreen::OnCenter(UI::EventParams &e) { }; UI::EventReturn DisplayLayoutScreen::OnZoomChange(UI::EventParams &e) { - if (g_Config.iSmallDisplayZoom > 0) { - g_Config.fSmallDisplayCustomZoom = (float)(g_Config.iSmallDisplayZoom * 8); + if (g_Config.iSmallDisplayZoom > 2) { + g_Config.fSmallDisplayCustomZoom = (float)((g_Config.iSmallDisplayZoom - 2) * 8); } else { const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); float autoBound = bounds.w / 480.0f * 8.0f; @@ -158,10 +159,6 @@ void DisplayLayoutScreen::dialogFinished(const Screen *dialog, DialogResult resu } void DisplayLayoutScreen::CreateViews() { - if (g_Config.bStretchToDisplay) { - // Shouldn't even be able to get here as the way into this dialog should be closed. - return; - } const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); local_dp_xres = bounds.w; @@ -171,6 +168,7 @@ void DisplayLayoutScreen::CreateViews() { I18NCategory *di = GetI18NCategory("Dialog"); I18NCategory *gr = GetI18NCategory("Graphics"); + I18NCategory *cw = GetI18NCategory("CwCheats"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); @@ -193,55 +191,83 @@ void DisplayLayoutScreen::CreateViews() { horizontalBoundaryR->AddTab("", bottomBoundary); Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10)); - static const char *zoomLevels[] = { "Auto", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x" }; - zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoom, gr->T("Zoom settings"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(300, WRAP_CONTENT, local_dp_xres / 2 - 150, NONE, NONE, 10)); + static const char *zoomLevels[] = { "Full Stretch", "Partial Stretch", "Auto Scaling", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x" }; + zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoom, cw->T("Options"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, 10)); zoom_->OnChoice.Handle(this, &DisplayLayoutScreen::OnZoomChange); static const char *displayRotation[] = { "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed" }; rotation_ = new PopupMultiChoice(&g_Config.iInternalScreenRotation, gr->T("Rotation"), displayRotation, 1, ARRAY_SIZE(displayRotation), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, local_dp_yres - 64)); rotation_->SetEnabledPtr(&displayRotEnable_); displayRotEnable_ = (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); - + bool bRotated = false; + if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { bRotated = true; } mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158 + 64 + 10)); - if (g_Config.iSmallDisplayZoom == 0) { - mode_->AddChoice(gr->T("Active (Auto)")); - float autoBound = local_dp_yres / 270.0f * 8.0f; - // Case of screen rotated ~ only works with buffered rendering - if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { - autoBound = local_dp_yres / 480.0f * 8.0f; - } else { // Without rotation in common cases like 1080p we cut off 2 pixels of height, this reflects other cases - float resCommonWidescreen = autoBound - floor(autoBound); - if (resCommonWidescreen != 0.0f) { - float ratio = local_dp_xres / local_dp_yres; - if (ratio < orgRatio) { - autoBound = local_dp_xres / 480.0f * 8.0f; - } else { - autoBound = local_dp_yres / 272.0f * 8.0f; + if (g_Config.iSmallDisplayZoom > 1) { + if (g_Config.iSmallDisplayZoom == 2) { + mode_->AddChoice(gr->T("Auto Scaling")); + mode_->ReplaceLayoutParams(new AnchorLayoutParams(0, 0, local_dp_xres / 2.0f - 70.0f, NONE, NONE, local_dp_yres / 2.0f + 32.0f)); + float autoBound = local_dp_yres / 270.0f * 8.0f; + // Case of screen rotated ~ only works with buffered rendering + if (bRotated) { + autoBound = local_dp_yres / 480.0f * 8.0f; + } + else { // Without rotation in common cases like 1080p we cut off 2 pixels of height, this reflects other cases + float resCommonWidescreen = autoBound - floor(autoBound); + if (resCommonWidescreen != 0.0f) { + float ratio = local_dp_xres / local_dp_yres; + if (ratio < orgRatio) { + autoBound = local_dp_xres / 480.0f * 8.0f; + } + else { + autoBound = local_dp_yres / 272.0f * 8.0f; + } } } + g_Config.fSmallDisplayCustomZoom = autoBound; + g_Config.fSmallDisplayOffsetX = 0.5f; + g_Config.fSmallDisplayOffsetY = 0.5f; + } else { + Choice *center = new Choice(di->T("Center"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 74)); + center->OnClick.Handle(this, &DisplayLayoutScreen::OnCenter); + root_->Add(center); + mode_->AddChoice(di->T("Move")); + mode_->AddChoice(di->T("Resize")); + mode_->SetSelection(0); } - g_Config.fSmallDisplayCustomZoom = autoBound; - g_Config.fSmallDisplayOffsetX = 0.5f; - g_Config.fSmallDisplayOffsetY = 0.5f; + displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, g_Config.fSmallDisplayCustomZoom); + displayRepresentation_->SetVisibility(V_VISIBLE); } else { - Choice *center = new Choice(di->T("Center"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 84)); - center->OnClick.Handle(this, &DisplayLayoutScreen::OnCenter); - root_->Add(center); - mode_->AddChoice(di->T("Move")); - mode_->AddChoice(di->T("Resize")); - mode_->SetSelection(0); + mode_->AddChoice(gr->T("Stretching")); + mode_->ReplaceLayoutParams(new AnchorLayoutParams(0, 0, local_dp_xres / 2.0f - 70.0f, NONE, NONE, local_dp_yres / 2.0f + 32.0f)); + displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, g_Config.fSmallDisplayCustomZoom); + displayRepresentation_->SetVisibility(V_INVISIBLE); + float width = local_dp_xres / 2.0f; + float height = local_dp_yres / 2.0f; + if (g_Config.iSmallDisplayZoom == 0) { // Stretched + Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, width - width / 2.0f, NONE, NONE, height - height / 2.0f)); + root_->Add(stretched); + } else { // Partially stretched + float origRatio = !bRotated ? 480.0f / 272.0f : 272.0f / 480.0f; + float frameRatio = width / height; + if (origRatio > frameRatio) { + height = width / origRatio; + if (!bRotated && g_Config.iSmallDisplayZoom == 1) { height = (272.0f + height) / 2.0f; } + } else { + width = height * origRatio; + if (bRotated && g_Config.iSmallDisplayZoom == 1) { width = (272.0f + height) / 2.0f; } + } + Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, local_dp_xres / 2.0f - width / 2.0f, NONE, NONE, local_dp_yres / 2.0f - height / 2.0f)); + root_->Add(stretched); + } + } + if (bRotated) { + displayRepresentation_->SetAngle(90.0f); } - back->OnClick.Handle(this, &UIScreen::OnBack); + root_->Add(displayRepresentation_); root_->Add(mode_); root_->Add(zoom_); root_->Add(rotation_); root_->Add(back); - - displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, g_Config.fSmallDisplayCustomZoom); - if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { - displayRepresentation_->SetAngle(90.0f); - } - root_->Add(displayRepresentation_); } diff --git a/UI/DisplayLayoutScreen.h b/UI/DisplayLayoutScreen.h index 98dffaa4ee..d6e5cd2839 100644 --- a/UI/DisplayLayoutScreen.h +++ b/UI/DisplayLayoutScreen.h @@ -27,7 +27,6 @@ class DragDropDisplay; class DisplayLayoutScreen : public UIDialogScreenWithBackground { public: DisplayLayoutScreen(); - virtual void CreateViews() override; virtual bool touch(const TouchInput &touch) override; virtual void dialogFinished(const Screen *dialog, DialogResult result) override; @@ -36,7 +35,7 @@ public: protected: virtual UI::EventReturn OnCenter(UI::EventParams &e); virtual UI::EventReturn OnZoomChange(UI::EventParams &e); - + private: DragDropDisplay *picked_; DragDropDisplay *displayRepresentation_; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index fb70302419..53da6e8f6a 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -166,15 +166,9 @@ void GameSettingsScreen::CreateViews() { #if !defined(MOBILE_DEVICE) graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gr->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); #endif - graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gr->T("Stretch to Display"))); - // Display Layout Editor: To avoid overlapping touch controls on large tablets, meet geeky demands for integer zoom/unstretched image etc. displayEditor_ = graphicsSettings->Add(new Choice(gr->T("Display layout editor"))); displayEditor_->OnClick.Handle(this, &GameSettingsScreen::OnDisplayLayoutEditor); - displayEditor_->SetDisabledPtr(&g_Config.bStretchToDisplay); - - if (pixel_xres < pixel_yres * 1.3) // Smaller than 4:3 - graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gr->T("Partial Vertical Stretch"))); #ifdef ANDROID // Hide Immersive Mode on pre-kitkat Android diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index cf9ebcb849..dff75a30e8 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -81,9 +81,10 @@ namespace MainWindow { SUBMENU_FILE_SAVESTATE_SLOT = 6, // Emulation submenus - SUBMENU_DISPLAY_ROTATION = 8, + SUBMENU_DISPLAY_ROTATION = 5, // Game Settings submenus + SUBMENU_DISPLAY_LAYOUT = 7, SUBMENU_CUSTOM_SHADERS = 10, SUBMENU_RENDERING_RESOLUTION = 11, SUBMENU_WINDOW_SIZE = 12, @@ -268,7 +269,11 @@ namespace MainWindow { TranslateMenuItem(menu, ID_OPTIONS_IGNOREWINKEY); TranslateMenuItem(menu, ID_OPTIONS_MORE_SETTINGS); TranslateMenuItem(menu, ID_OPTIONS_CONTROLS); - TranslateMenuItem(menu, ID_OPTIONS_STRETCHDISPLAY); + TranslateSubMenu(menu, "Display Layout Options", MENU_OPTIONS, SUBMENU_DISPLAY_LAYOUT); + TranslateMenuItem(menu, ID_OPTIONS_STRETCH); + TranslateMenuItem(menu, ID_OPTIONS_PARTIAL_STRETCH); + TranslateMenuItem(menu, ID_OPTIONS_DISPLAY_AUTO); + // Skip display multipliers x1-x10 TranslateMenuItem(menu, ID_OPTIONS_FULLSCREEN, L"\tAlt+Return, F11"); TranslateMenuItem(menu, ID_OPTIONS_VSYNC); TranslateSubMenu(menu, "Postprocessing Shader", MENU_OPTIONS, SUBMENU_CUSTOM_SHADERS); @@ -481,6 +486,13 @@ namespace MainWindow { g_Config.bEnableCheats = cheats; } + static void setDisplayOptions(int options) { + g_Config.iSmallDisplayZoom = options; + if (g_Config.iSmallDisplayZoom > 2) { + g_Config.fSmallDisplayCustomZoom = (float)((g_Config.iSmallDisplayZoom - 2) * 8); + } + NativeMessageReceived("gpu resized", ""); + } void MainWindowMenu_Process(HWND hWnd, WPARAM wParam) { std::string fn; @@ -711,10 +723,20 @@ namespace MainWindow { osm.ShowOnOff(gr->T("Hardware Transform"), g_Config.bHardwareTransform); break; - case ID_OPTIONS_STRETCHDISPLAY: - g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay; - NativeMessageReceived("gpu resized", ""); - break; + case ID_OPTIONS_STRETCH: setDisplayOptions(0); break; + case ID_OPTIONS_PARTIAL_STRETCH: setDisplayOptions(1); break; + case ID_OPTIONS_DISPLAY_AUTO: setDisplayOptions(2); break; + case ID_OPTIONS_DISPLAY_1: setDisplayOptions(3); break; + case ID_OPTIONS_DISPLAY_2: setDisplayOptions(4); break; + case ID_OPTIONS_DISPLAY_3: setDisplayOptions(5); break; + case ID_OPTIONS_DISPLAY_4: setDisplayOptions(6); break; + case ID_OPTIONS_DISPLAY_5: setDisplayOptions(7); break; + case ID_OPTIONS_DISPLAY_6: setDisplayOptions(8); break; + case ID_OPTIONS_DISPLAY_7: setDisplayOptions(9); break; + case ID_OPTIONS_DISPLAY_8: setDisplayOptions(10); break; + case ID_OPTIONS_DISPLAY_9: setDisplayOptions(11); break; + case ID_OPTIONS_DISPLAY_10: setDisplayOptions(12); break; + case ID_OPTIONS_FRAMESKIP_0: setFrameSkipping(FRAMESKIP_OFF); break; case ID_OPTIONS_FRAMESKIP_1: setFrameSkipping(FRAMESKIP_1); break; @@ -936,7 +958,6 @@ namespace MainWindow { CHECKITEM(ID_DEBUG_IGNOREILLEGALREADS, g_Config.bIgnoreBadMemAccess); CHECKITEM(ID_DEBUG_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats); CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform); - CHECKITEM(ID_OPTIONS_STRETCHDISPLAY, g_Config.bStretchToDisplay); CHECKITEM(ID_DEBUG_RUNONLOAD, g_Config.bAutoRun); CHECKITEM(ID_OPTIONS_VERTEXCACHE, g_Config.bVertexCache); CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.iShowFPSCounter); @@ -966,6 +987,31 @@ namespace MainWindow { CheckMenuItem(menu, displayrotationitems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iInternalScreenRotation ? MF_CHECKED : MF_UNCHECKED)); } + static const int displaylayoutitems[] = { + ID_OPTIONS_STRETCH, + ID_OPTIONS_PARTIAL_STRETCH, + ID_OPTIONS_DISPLAY_AUTO, + ID_OPTIONS_DISPLAY_1, + ID_OPTIONS_DISPLAY_2, + ID_OPTIONS_DISPLAY_3, + ID_OPTIONS_DISPLAY_4, + ID_OPTIONS_DISPLAY_5, + ID_OPTIONS_DISPLAY_6, + ID_OPTIONS_DISPLAY_7, + ID_OPTIONS_DISPLAY_8, + ID_OPTIONS_DISPLAY_9, + ID_OPTIONS_DISPLAY_10 + }; + if (g_Config.iSmallDisplayZoom < 0) + g_Config.iSmallDisplayZoom = 0; + + else if (g_Config.iSmallDisplayZoom > 12) + g_Config.iSmallDisplayZoom = 12; + + for (int i = 0; i < ARRAY_SIZE(displaylayoutitems); i++) { + CheckMenuItem(menu, displaylayoutitems[i], MF_BYCOMMAND | (i == g_Config.iSmallDisplayZoom ? MF_CHECKED : MF_UNCHECKED)); + } + // Disable Vertex Cache when HW T&L is disabled. if (!g_Config.bHardwareTransform) { EnableMenuItem(menu, ID_OPTIONS_VERTEXCACHE, MF_GRAYED); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 96bba8e4f2..44fb493a53 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -451,7 +451,22 @@ BEGIN MENUITEM "Control Mapping...", ID_OPTIONS_CONTROLS MENUITEM "Language...", ID_OPTIONS_LANGUAGE MENUITEM SEPARATOR - MENUITEM "Stretch to Display", ID_OPTIONS_STRETCHDISPLAY + POPUP "Display Layout Options" + BEGIN + MENUITEM "Full stretch", ID_OPTIONS_STRETCH + MENUITEM "Partial stretch", ID_OPTIONS_PARTIAL_STRETCH + MENUITEM "Auto scaling", ID_OPTIONS_DISPLAY_AUTO + MENUITEM "1x", ID_OPTIONS_DISPLAY_1 + MENUITEM "2x", ID_OPTIONS_DISPLAY_2 + MENUITEM "3x", ID_OPTIONS_DISPLAY_3 + MENUITEM "4x", ID_OPTIONS_DISPLAY_4 + MENUITEM "5x", ID_OPTIONS_DISPLAY_5 + MENUITEM "6x", ID_OPTIONS_DISPLAY_6 + MENUITEM "7x", ID_OPTIONS_DISPLAY_7 + MENUITEM "8x", ID_OPTIONS_DISPLAY_8 + MENUITEM "9x", ID_OPTIONS_DISPLAY_9 + MENUITEM "10x", ID_OPTIONS_DISPLAY_10 + END MENUITEM "Fullscreen", ID_OPTIONS_FULLSCREEN MENUITEM "VSync", ID_OPTIONS_VSYNC MENUITEM "Postprocessing Shader", ID_OPTIONS_FXAA diff --git a/Windows/resource.h b/Windows/resource.h index 2bc7be481f..2e455d3625 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -208,7 +208,6 @@ #define ID_DEBUG_DUMPNEXTFRAME 40040 #define ID_OPTIONS_VERTEXCACHE 40041 #define ID_OPTIONS_SHOWFPS 40042 -#define ID_OPTIONS_STRETCHDISPLAY 40043 #define ID_OPTIONS_FRAMESKIP 40044 #define IDC_MEMCHECK 40045 #define ID_FILE_MEMSTICK 40046 @@ -323,6 +322,19 @@ #define ID_EMULATION_ROTATION_V 40157 #define ID_EMULATION_ROTATION_H_R 40158 #define ID_EMULATION_ROTATION_V_R 40159 +#define ID_OPTIONS_STRETCH 40160 +#define ID_OPTIONS_PARTIAL_STRETCH 40161 +#define ID_OPTIONS_DISPLAY_AUTO 40162 +#define ID_OPTIONS_DISPLAY_1 40163 +#define ID_OPTIONS_DISPLAY_2 40164 +#define ID_OPTIONS_DISPLAY_3 40165 +#define ID_OPTIONS_DISPLAY_4 40166 +#define ID_OPTIONS_DISPLAY_5 40167 +#define ID_OPTIONS_DISPLAY_6 40168 +#define ID_OPTIONS_DISPLAY_7 40169 +#define ID_OPTIONS_DISPLAY_8 40170 +#define ID_OPTIONS_DISPLAY_9 40171 +#define ID_OPTIONS_DISPLAY_10 40172 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500 From 6061ad75793f8ebefcf9402de22a506b9286dac9 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 21 Dec 2015 06:32:05 +0100 Subject: [PATCH 5/9] Some improvements, comments and polishing. --- Core/Config.cpp | 12 ++++++-- Core/Config.h | 4 +-- GPU/Common/FramebufferCommon.cpp | 14 ++++----- Qt/mainwindow.cpp | 9 ++---- Qt/mainwindow.h | 2 +- UI/DisplayLayoutScreen.cpp | 52 +++++++++++++++++--------------- UI/DisplayLayoutScreen.h | 4 ++- UI/EmuScreen.cpp | 5 +++ UI/GameSettingsScreen.cpp | 4 +++ UI/MainScreen.cpp | 5 +++ Windows/MainWindowMenu.cpp | 52 ++++---------------------------- Windows/ppsspp.rc | 17 +---------- Windows/resource.h | 14 +-------- 13 files changed, 76 insertions(+), 118 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index de7d0c3040..8d731c1e6f 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -384,6 +384,14 @@ static int DefaultInternalResolution() { #endif } +static int DefaultZoomType() { + if (pixel_xres < 1.3 * pixel_yres) { + return 1; + } else { + return 2; + } +} + static bool DefaultTimerHack() { // Has been in use on Symbian since v0.7. Preferred option. #ifdef __SYMBIAN32__ @@ -457,10 +465,10 @@ static ConfigSetting graphicsSettings[] = { #endif // TODO: Replace these settings with a list of options - ConfigSetting("SmallDisplayZoom", &g_Config.iSmallDisplayZoom, 2, true, true), + ConfigSetting("SmallDisplayZoomType", &g_Config.iSmallDisplayZoomType, &DefaultZoomType, true, true), ConfigSetting("SmallDisplayOffsetX", &g_Config.fSmallDisplayOffsetX, 0.5f, true, true), ConfigSetting("SmallDisplayOffsetY", &g_Config.fSmallDisplayOffsetY, 0.5f, true, true), - ConfigSetting("SmallDisplayCustomZoom", &g_Config.fSmallDisplayCustomZoom, 8.0f, true, true), + ConfigSetting("SmallDisplayZoomLevel", &g_Config.fSmallDisplayZoomLevel, 1.0f, true, true), ConfigSetting("ImmersiveMode", &g_Config.bImmersiveMode, false, true, true), ReportedConfigSetting("TrueColor", &g_Config.bTrueColor, true, true, true), diff --git a/Core/Config.h b/Core/Config.h index 65444c5838..aabe387e81 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -144,10 +144,10 @@ public: int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (CPU) 3 = Read Framebuffer to memory (GPU) int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG) int iBufFilter; // 1 = linear, 2 = nearest - int iSmallDisplayZoom; // Used to fit display into screen 0 = stretch, 1 = partial stretch, 2 = auto, anything higher is used to set's integer zoom of psp resolution and allows manual editing + int iSmallDisplayZoomType; // Used to fit display into screen 0 = stretch, 1 = partial stretch, 2 = auto scaling, 3 = manual scaling. float fSmallDisplayOffsetX; // Along with Y it goes from 0.0 to 1.0, XY (0.5, 0.5) = center of the screen float fSmallDisplayOffsetY; - float fSmallDisplayCustomZoom; //This is actually used for zoom, both in and out. + float fSmallDisplayZoomLevel; //This is used for zoom values, both in and out. bool bImmersiveMode; // Mode on Android Kitkat 4.4 that hides the back button etc. bool bVSync; int iFrameSkip; diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index a917de49af..7867434ca6 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -36,18 +36,18 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW bool rotated = rotation == ROTATION_LOCKED_VERTICAL || rotation == ROTATION_LOCKED_VERTICAL180; - if (g_Config.iSmallDisplayZoom == 0) { + if (g_Config.iSmallDisplayZoomType == 0) { // Stretching outW = frameW; outH = frameH; } else { - if (g_Config.iSmallDisplayZoom > 2) { + if (g_Config.iSmallDisplayZoomType == 3) { // Manual Scaling float offsetX = (g_Config.fSmallDisplayOffsetX - 0.5f) * 2.0f * frameW; float offsetY = (g_Config.fSmallDisplayOffsetY - 0.5f) * 2.0f * frameH; // Have to invert Y for GL if (GetGPUBackend() == GPUBackend::OPENGL) { offsetY = offsetY * -1.0f; } - float customZoom = g_Config.fSmallDisplayCustomZoom / 8.0f; + float customZoom = g_Config.fSmallDisplayZoomLevel; float smallDisplayW = origW * customZoom; float smallDisplayH = origH * customZoom; if (!rotated) { @@ -63,7 +63,7 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW *h = floorf(smallDisplayW); return; } - } else { + } else if (g_Config.iSmallDisplayZoomType == 2) { // Auto Scaling float pixelCrop = frameH / 270.0f; float resCommonWidescreen = pixelCrop - floor(pixelCrop); if (!rotated && resCommonWidescreen == 0.0f) { @@ -77,19 +77,19 @@ void CenterDisplayOutputRect(float *x, float *y, float *w, float *h, float origW float origRatio = !rotated ? origW / origH : origH / origW; float frameRatio = frameW / frameH; - + if (origRatio > frameRatio) { // Image is wider than frame. Center vertically. outW = frameW; outH = frameW / origRatio; // Stretch a little bit - if (!rotated && g_Config.iSmallDisplayZoom == 1) + if (!rotated && g_Config.iSmallDisplayZoomType == 1) // Partial Stretch outH = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564 } else { // Image is taller than frame. Center horizontally. outW = frameH * origRatio; outH = frameH; - if (rotated && g_Config.iSmallDisplayZoom == 1) + if (rotated && g_Config.iSmallDisplayZoomType == 1) // Partial Stretch outW = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564 } } diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 6d7004007c..12862659c0 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -90,10 +90,7 @@ void MainWindow::updateMenus() } foreach(QAction * action, displayLayoutGroup->actions()) { - if (g_Config.iSmallDisplayZoom == action->data().toInt()) { - if (g_Config.iSmallDisplayZoom > 2) { - g_Config.fSmallDisplayCustomZoom = (float)((g_Config.iSmallDisplayZoom - 2) * 8); - } + if (g_Config.iSmallDisplayZoomType == action->data().toInt()) { if (gpu) gpu->Resized(); @@ -548,8 +545,8 @@ void MainWindow::createMenus() MenuTree* displayLayoutMenu = new MenuTree(this, videoMenu, QT_TR_NOOP("&Display Layout Options")); displayLayoutGroup = new MenuActionGroup(this, displayLayoutMenu, SLOT(displayLayoutGroup_triggered(QAction *)), - QStringList() << "Stretched" << "Partialy stretched" << "Auto Scaling" << "1x" << "2x" << "3x" << "4x" << "5x" << "6x" << "7x" << "8x" << "9x" << "10x", - QList() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12); + QStringList() << "Stretched" << "Partialy stretched" << "Auto Scaling" << "Manual Scaling", + QList() << 0 << 1 << 2 << 3); videoMenu->addSeparator(); videoMenu->add(new MenuAction(this, SLOT(transformAct()), QT_TR_NOOP("&Hardware Transform"), Qt::Key_F6)) ->addEventChecked(&g_Config.bHardwareTransform); diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 8e53d7cc1f..bf8bdf2a30 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -100,7 +100,7 @@ private slots: void screenGroup_triggered(QAction *action) { SetZoom(action->data().toInt()); } - void displayLayoutGroup_triggered(QAction *action) { g_Config.iSmallDisplayZoom = action->data().toInt(); } + void displayLayoutGroup_triggered(QAction *action) { g_Config.iSmallDisplayZoomType = action->data().toInt(); } void transformAct() { g_Config.bHardwareTransform = !g_Config.bHardwareTransform; } void vertexCacheAct() { g_Config.bVertexCache = !g_Config.bVertexCache; } void frameskipAct() { g_Config.iFrameSkip = !g_Config.iFrameSkip; } diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index cf89fc71c0..b443829194 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -71,7 +71,7 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { using namespace UI; int mode = mode_->GetSelection(); - if (g_Config.iSmallDisplayZoom == 2) { mode = -1; } + if (g_Config.iSmallDisplayZoomType == 2) { mode = -1; } const Bounds &screen_bounds = screenManager()->getUIContext()->GetBounds(); @@ -126,6 +126,7 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { picked_->SaveDisplayPosition(); picked_ = 0; } + g_Config.fSmallDisplayZoomLevel = startScale_ / 8.0f; return true; }; @@ -140,13 +141,12 @@ UI::EventReturn DisplayLayoutScreen::OnCenter(UI::EventParams &e) { return UI::EVENT_DONE; }; -UI::EventReturn DisplayLayoutScreen::OnZoomChange(UI::EventParams &e) { - if (g_Config.iSmallDisplayZoom > 2) { - g_Config.fSmallDisplayCustomZoom = (float)((g_Config.iSmallDisplayZoom - 2) * 8); - } else { +UI::EventReturn DisplayLayoutScreen::OnZoomTypeChange(UI::EventParams &e) { + if (g_Config.iSmallDisplayZoomType < 3) { const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); - float autoBound = bounds.w / 480.0f * 8.0f; - g_Config.fSmallDisplayCustomZoom = autoBound; + float autoBound = bounds.w / 480.0f; + g_Config.fSmallDisplayZoomLevel = autoBound; + displayRepresentationScale_ = g_Config.fSmallDisplayZoomLevel * 8.0f; g_Config.fSmallDisplayOffsetX = 0.5f; g_Config.fSmallDisplayOffsetY = 0.5f; } @@ -191,9 +191,9 @@ void DisplayLayoutScreen::CreateViews() { horizontalBoundaryR->AddTab("", bottomBoundary); Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10)); - static const char *zoomLevels[] = { "Full Stretch", "Partial Stretch", "Auto Scaling", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x" }; - zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoom, cw->T("Options"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, 10)); - zoom_->OnChoice.Handle(this, &DisplayLayoutScreen::OnZoomChange); + static const char *zoomLevels[] = { "Stretching", "Partial Stretch", "Auto Scaling", "Manual Scaling" }; + zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoomType, cw->T("Options"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, 10)); + zoom_->OnChoice.Handle(this, &DisplayLayoutScreen::OnZoomTypeChange); static const char *displayRotation[] = { "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed" }; rotation_ = new PopupMultiChoice(&g_Config.iInternalScreenRotation, gr->T("Rotation"), displayRotation, 1, ARRAY_SIZE(displayRotation), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, local_dp_yres - 64)); @@ -202,48 +202,52 @@ void DisplayLayoutScreen::CreateViews() { bool bRotated = false; if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { bRotated = true; } mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158 + 64 + 10)); - if (g_Config.iSmallDisplayZoom > 1) { - if (g_Config.iSmallDisplayZoom == 2) { + displayRepresentationScale_ = g_Config.fSmallDisplayZoomLevel * 8.0f; // Visual representation image is just icon size and have to be scaled 8 times to match PSP native resolution which is used as 1.0 for zoom + if (g_Config.iSmallDisplayZoomType > 1) { // Scaling + if (g_Config.iSmallDisplayZoomType == 2) { // Auto Scaling mode_->AddChoice(gr->T("Auto Scaling")); mode_->ReplaceLayoutParams(new AnchorLayoutParams(0, 0, local_dp_xres / 2.0f - 70.0f, NONE, NONE, local_dp_yres / 2.0f + 32.0f)); - float autoBound = local_dp_yres / 270.0f * 8.0f; + float autoBound = local_dp_yres / 270.0f; // Case of screen rotated ~ only works with buffered rendering if (bRotated) { - autoBound = local_dp_yres / 480.0f * 8.0f; + autoBound = local_dp_yres / 480.0f; } else { // Without rotation in common cases like 1080p we cut off 2 pixels of height, this reflects other cases float resCommonWidescreen = autoBound - floor(autoBound); if (resCommonWidescreen != 0.0f) { float ratio = local_dp_xres / local_dp_yres; if (ratio < orgRatio) { - autoBound = local_dp_xres / 480.0f * 8.0f; + autoBound = local_dp_xres / 480.0f; } else { - autoBound = local_dp_yres / 272.0f * 8.0f; + autoBound = local_dp_yres / 272.0f; } } } - g_Config.fSmallDisplayCustomZoom = autoBound; + g_Config.fSmallDisplayZoomLevel = autoBound; + displayRepresentationScale_ = g_Config.fSmallDisplayZoomLevel * 8.0f; g_Config.fSmallDisplayOffsetX = 0.5f; g_Config.fSmallDisplayOffsetY = 0.5f; - } else { + } else { // Manual Scaling Choice *center = new Choice(di->T("Center"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 74)); center->OnClick.Handle(this, &DisplayLayoutScreen::OnCenter); root_->Add(center); + PopupSliderChoiceFloat *zoomlvl_ = new PopupSliderChoiceFloat(&g_Config.fSmallDisplayZoomLevel, 1.0f, 10.0f, di->T("Zoom"), 1.0f, screenManager(), "* PSP res", new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 134)); + root_->Add(zoomlvl_); mode_->AddChoice(di->T("Move")); mode_->AddChoice(di->T("Resize")); mode_->SetSelection(0); } - displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, g_Config.fSmallDisplayCustomZoom); + displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, displayRepresentationScale_); displayRepresentation_->SetVisibility(V_VISIBLE); - } else { + } else { // Stretching mode_->AddChoice(gr->T("Stretching")); mode_->ReplaceLayoutParams(new AnchorLayoutParams(0, 0, local_dp_xres / 2.0f - 70.0f, NONE, NONE, local_dp_yres / 2.0f + 32.0f)); - displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, g_Config.fSmallDisplayCustomZoom); + displayRepresentation_ = new DragDropDisplay(g_Config.fSmallDisplayOffsetX, g_Config.fSmallDisplayOffsetY, I_PSP_DISPLAY, displayRepresentationScale_); displayRepresentation_->SetVisibility(V_INVISIBLE); float width = local_dp_xres / 2.0f; float height = local_dp_yres / 2.0f; - if (g_Config.iSmallDisplayZoom == 0) { // Stretched + if (g_Config.iSmallDisplayZoomType == 0) { // Stretched Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, width - width / 2.0f, NONE, NONE, height - height / 2.0f)); root_->Add(stretched); } else { // Partially stretched @@ -251,10 +255,10 @@ void DisplayLayoutScreen::CreateViews() { float frameRatio = width / height; if (origRatio > frameRatio) { height = width / origRatio; - if (!bRotated && g_Config.iSmallDisplayZoom == 1) { height = (272.0f + height) / 2.0f; } + if (!bRotated && g_Config.iSmallDisplayZoomType == 1) { height = (272.0f + height) / 2.0f; } } else { width = height * origRatio; - if (bRotated && g_Config.iSmallDisplayZoom == 1) { width = (272.0f + height) / 2.0f; } + if (bRotated && g_Config.iSmallDisplayZoomType == 1) { width = (272.0f + height) / 2.0f; } } Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, local_dp_xres / 2.0f - width / 2.0f, NONE, NONE, local_dp_yres / 2.0f - height / 2.0f)); root_->Add(stretched); diff --git a/UI/DisplayLayoutScreen.h b/UI/DisplayLayoutScreen.h index d6e5cd2839..ac49b3c005 100644 --- a/UI/DisplayLayoutScreen.h +++ b/UI/DisplayLayoutScreen.h @@ -34,7 +34,7 @@ public: protected: virtual UI::EventReturn OnCenter(UI::EventParams &e); - virtual UI::EventReturn OnZoomChange(UI::EventParams &e); + virtual UI::EventReturn OnZoomTypeChange(UI::EventParams &e); private: DragDropDisplay *picked_; @@ -42,10 +42,12 @@ private: UI::ChoiceStrip *mode_; UI::PopupMultiChoice *zoom_; UI::PopupMultiChoice *rotation_; + UI::PopupSliderChoiceFloat *zoomlvl_; bool displayRotEnable_; // Touch down state for drag to resize etc float startX_; float startY_; float startScale_; + float displayRepresentationScale_; }; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index c7d57dcd74..d8fc228688 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -61,6 +61,7 @@ #include "UI/GameInfoCache.h" #include "UI/MiscScreens.h" #include "UI/ControlMappingScreen.h" +#include "UI/DisplayLayoutScreen.h" #include "UI/GameSettingsScreen.h" #include "UI/InstallZipScreen.h" #include "UI/ProfilerDraw.h" @@ -231,6 +232,10 @@ void EmuScreen::sendMessage(const char *message, const char *value) { UpdateUIState(UISTATE_MENU); releaseButtons(); screenManager()->push(new ControlMappingScreen()); + } else if (!strcmp(message, "display layout editor")) { + UpdateUIState(UISTATE_MENU); + releaseButtons(); + screenManager()->push(new DisplayLayoutScreen()); } else if (!strcmp(message, "settings")) { UpdateUIState(UISTATE_MENU); releaseButtons(); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 53da6e8f6a..ed2cdce5dd 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -828,6 +828,10 @@ void GameSettingsScreen::sendMessage(const char *message, const char *value) { UpdateUIState(UISTATE_MENU); screenManager()->push(new ControlMappingScreen()); } + if (!strcmp(message, "display layout editor")) { + UpdateUIState(UISTATE_MENU); + screenManager()->push(new DisplayLayoutScreen()); + } } void GameSettingsScreen::onFinish(DialogResult result) { diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index bd84ab123f..f22e7b30c1 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -42,6 +42,7 @@ #include "UI/GameSettingsScreen.h" #include "UI/MiscScreens.h" #include "UI/ControlMappingScreen.h" +#include "UI/DisplayLayoutScreen.h" #include "UI/SavedataScreen.h" #include "UI/Store.h" #include "UI/ui_atlas.h" @@ -887,6 +888,10 @@ void MainScreen::sendMessage(const char *message, const char *value) { UpdateUIState(UISTATE_MENU); screenManager()->push(new ControlMappingScreen()); } + if (!strcmp(message, "display layout editor")) { + UpdateUIState(UISTATE_MENU); + screenManager()->push(new DisplayLayoutScreen()); + } if (!strcmp(message, "settings")) { UpdateUIState(UISTATE_MENU); screenManager()->push(new GameSettingsScreen("")); diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index dff75a30e8..fbb9a200e3 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -269,10 +269,8 @@ namespace MainWindow { TranslateMenuItem(menu, ID_OPTIONS_IGNOREWINKEY); TranslateMenuItem(menu, ID_OPTIONS_MORE_SETTINGS); TranslateMenuItem(menu, ID_OPTIONS_CONTROLS); - TranslateSubMenu(menu, "Display Layout Options", MENU_OPTIONS, SUBMENU_DISPLAY_LAYOUT); - TranslateMenuItem(menu, ID_OPTIONS_STRETCH); - TranslateMenuItem(menu, ID_OPTIONS_PARTIAL_STRETCH); - TranslateMenuItem(menu, ID_OPTIONS_DISPLAY_AUTO); + TranslateMenuItem(menu, ID_OPTIONS_DISPLAY_LAYOUT); + // Skip display multipliers x1-x10 TranslateMenuItem(menu, ID_OPTIONS_FULLSCREEN, L"\tAlt+Return, F11"); TranslateMenuItem(menu, ID_OPTIONS_VSYNC); @@ -487,10 +485,7 @@ namespace MainWindow { } static void setDisplayOptions(int options) { - g_Config.iSmallDisplayZoom = options; - if (g_Config.iSmallDisplayZoom > 2) { - g_Config.fSmallDisplayCustomZoom = (float)((g_Config.iSmallDisplayZoom - 2) * 8); - } + g_Config.iSmallDisplayZoomType = options; NativeMessageReceived("gpu resized", ""); } @@ -723,19 +718,9 @@ namespace MainWindow { osm.ShowOnOff(gr->T("Hardware Transform"), g_Config.bHardwareTransform); break; - case ID_OPTIONS_STRETCH: setDisplayOptions(0); break; - case ID_OPTIONS_PARTIAL_STRETCH: setDisplayOptions(1); break; - case ID_OPTIONS_DISPLAY_AUTO: setDisplayOptions(2); break; - case ID_OPTIONS_DISPLAY_1: setDisplayOptions(3); break; - case ID_OPTIONS_DISPLAY_2: setDisplayOptions(4); break; - case ID_OPTIONS_DISPLAY_3: setDisplayOptions(5); break; - case ID_OPTIONS_DISPLAY_4: setDisplayOptions(6); break; - case ID_OPTIONS_DISPLAY_5: setDisplayOptions(7); break; - case ID_OPTIONS_DISPLAY_6: setDisplayOptions(8); break; - case ID_OPTIONS_DISPLAY_7: setDisplayOptions(9); break; - case ID_OPTIONS_DISPLAY_8: setDisplayOptions(10); break; - case ID_OPTIONS_DISPLAY_9: setDisplayOptions(11); break; - case ID_OPTIONS_DISPLAY_10: setDisplayOptions(12); break; + case ID_OPTIONS_DISPLAY_LAYOUT: + NativeMessageReceived("display layout editor", ""); + break; case ID_OPTIONS_FRAMESKIP_0: setFrameSkipping(FRAMESKIP_OFF); break; @@ -987,31 +972,6 @@ namespace MainWindow { CheckMenuItem(menu, displayrotationitems[i], MF_BYCOMMAND | ((i + 1) == g_Config.iInternalScreenRotation ? MF_CHECKED : MF_UNCHECKED)); } - static const int displaylayoutitems[] = { - ID_OPTIONS_STRETCH, - ID_OPTIONS_PARTIAL_STRETCH, - ID_OPTIONS_DISPLAY_AUTO, - ID_OPTIONS_DISPLAY_1, - ID_OPTIONS_DISPLAY_2, - ID_OPTIONS_DISPLAY_3, - ID_OPTIONS_DISPLAY_4, - ID_OPTIONS_DISPLAY_5, - ID_OPTIONS_DISPLAY_6, - ID_OPTIONS_DISPLAY_7, - ID_OPTIONS_DISPLAY_8, - ID_OPTIONS_DISPLAY_9, - ID_OPTIONS_DISPLAY_10 - }; - if (g_Config.iSmallDisplayZoom < 0) - g_Config.iSmallDisplayZoom = 0; - - else if (g_Config.iSmallDisplayZoom > 12) - g_Config.iSmallDisplayZoom = 12; - - for (int i = 0; i < ARRAY_SIZE(displaylayoutitems); i++) { - CheckMenuItem(menu, displaylayoutitems[i], MF_BYCOMMAND | (i == g_Config.iSmallDisplayZoom ? MF_CHECKED : MF_UNCHECKED)); - } - // Disable Vertex Cache when HW T&L is disabled. if (!g_Config.bHardwareTransform) { EnableMenuItem(menu, ID_OPTIONS_VERTEXCACHE, MF_GRAYED); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 44fb493a53..4b9f915af4 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -451,22 +451,7 @@ BEGIN MENUITEM "Control Mapping...", ID_OPTIONS_CONTROLS MENUITEM "Language...", ID_OPTIONS_LANGUAGE MENUITEM SEPARATOR - POPUP "Display Layout Options" - BEGIN - MENUITEM "Full stretch", ID_OPTIONS_STRETCH - MENUITEM "Partial stretch", ID_OPTIONS_PARTIAL_STRETCH - MENUITEM "Auto scaling", ID_OPTIONS_DISPLAY_AUTO - MENUITEM "1x", ID_OPTIONS_DISPLAY_1 - MENUITEM "2x", ID_OPTIONS_DISPLAY_2 - MENUITEM "3x", ID_OPTIONS_DISPLAY_3 - MENUITEM "4x", ID_OPTIONS_DISPLAY_4 - MENUITEM "5x", ID_OPTIONS_DISPLAY_5 - MENUITEM "6x", ID_OPTIONS_DISPLAY_6 - MENUITEM "7x", ID_OPTIONS_DISPLAY_7 - MENUITEM "8x", ID_OPTIONS_DISPLAY_8 - MENUITEM "9x", ID_OPTIONS_DISPLAY_9 - MENUITEM "10x", ID_OPTIONS_DISPLAY_10 - END + MENUITEM "Display Layout Editor" ID_OPTIONS_DISPLAY_LAYOUT MENUITEM "Fullscreen", ID_OPTIONS_FULLSCREEN MENUITEM "VSync", ID_OPTIONS_VSYNC MENUITEM "Postprocessing Shader", ID_OPTIONS_FXAA diff --git a/Windows/resource.h b/Windows/resource.h index 2e455d3625..3ffc2aeefe 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -322,19 +322,7 @@ #define ID_EMULATION_ROTATION_V 40157 #define ID_EMULATION_ROTATION_H_R 40158 #define ID_EMULATION_ROTATION_V_R 40159 -#define ID_OPTIONS_STRETCH 40160 -#define ID_OPTIONS_PARTIAL_STRETCH 40161 -#define ID_OPTIONS_DISPLAY_AUTO 40162 -#define ID_OPTIONS_DISPLAY_1 40163 -#define ID_OPTIONS_DISPLAY_2 40164 -#define ID_OPTIONS_DISPLAY_3 40165 -#define ID_OPTIONS_DISPLAY_4 40166 -#define ID_OPTIONS_DISPLAY_5 40167 -#define ID_OPTIONS_DISPLAY_6 40168 -#define ID_OPTIONS_DISPLAY_7 40169 -#define ID_OPTIONS_DISPLAY_8 40170 -#define ID_OPTIONS_DISPLAY_9 40171 -#define ID_OPTIONS_DISPLAY_10 40172 +#define ID_OPTIONS_DISPLAY_LAYOUT 40160 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500 From 55903cee77efc882db9145b954427d14447efe15 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 21 Dec 2015 07:26:27 +0100 Subject: [PATCH 6/9] Set default partial stretch only for blackberry devices without ws. --- Core/Config.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/Config.cpp b/Core/Config.cpp index 8d731c1e6f..c91fea1bb4 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -385,11 +385,15 @@ static int DefaultInternalResolution() { } static int DefaultZoomType() { +#ifdef BLACKBERRY if (pixel_xres < 1.3 * pixel_yres) { return 1; } else { return 2; } +#else + return 2; +#endif } static bool DefaultTimerHack() { From 80fa2695bf5ca624f9187220b8311dba77c2dc28 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sun, 17 Jan 2016 11:47:01 +0100 Subject: [PATCH 7/9] Tabs can't live in space and some other corrections. --- UI/DisplayLayoutScreen.cpp | 9 +- Windows/ppsspp.rc | 166 ++++++++++++++++++------------------- Windows/resource.h | 2 +- 3 files changed, 89 insertions(+), 88 deletions(-) diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index b443829194..a25a8f2bab 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -168,7 +168,6 @@ void DisplayLayoutScreen::CreateViews() { I18NCategory *di = GetI18NCategory("Dialog"); I18NCategory *gr = GetI18NCategory("Graphics"); - I18NCategory *cw = GetI18NCategory("CwCheats"); root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); @@ -192,7 +191,7 @@ void DisplayLayoutScreen::CreateViews() { Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 10)); static const char *zoomLevels[] = { "Stretching", "Partial Stretch", "Auto Scaling", "Manual Scaling" }; - zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoomType, cw->T("Options"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, 10)); + zoom_ = new PopupMultiChoice(&g_Config.iSmallDisplayZoomType, di->T("Options"), zoomLevels, 0, ARRAY_SIZE(zoomLevels), gr->GetName(), screenManager(), new AnchorLayoutParams(400, WRAP_CONTENT, local_dp_xres / 2 - 200, NONE, NONE, 10)); zoom_->OnChoice.Handle(this, &DisplayLayoutScreen::OnZoomTypeChange); static const char *displayRotation[] = { "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed" }; @@ -200,7 +199,9 @@ void DisplayLayoutScreen::CreateViews() { rotation_->SetEnabledPtr(&displayRotEnable_); displayRotEnable_ = (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); bool bRotated = false; - if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { bRotated = true; } + if (displayRotEnable_ && (g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || g_Config.iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180)) { + bRotated = true; + } mode_ = new ChoiceStrip(ORIENT_VERTICAL, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 158 + 64 + 10)); displayRepresentationScale_ = g_Config.fSmallDisplayZoomLevel * 8.0f; // Visual representation image is just icon size and have to be scaled 8 times to match PSP native resolution which is used as 1.0 for zoom if (g_Config.iSmallDisplayZoomType > 1) { // Scaling @@ -232,7 +233,7 @@ void DisplayLayoutScreen::CreateViews() { Choice *center = new Choice(di->T("Center"), "", false, new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 74)); center->OnClick.Handle(this, &DisplayLayoutScreen::OnCenter); root_->Add(center); - PopupSliderChoiceFloat *zoomlvl_ = new PopupSliderChoiceFloat(&g_Config.fSmallDisplayZoomLevel, 1.0f, 10.0f, di->T("Zoom"), 1.0f, screenManager(), "* PSP res", new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 134)); + PopupSliderChoiceFloat *zoomlvl_ = new PopupSliderChoiceFloat(&g_Config.fSmallDisplayZoomLevel, 1.0f, 10.0f, di->T("Zoom"), 1.0f, screenManager(), di->T("* PSP res"), new AnchorLayoutParams(leftColumnWidth, WRAP_CONTENT, 10, NONE, NONE, 134)); root_->Add(zoomlvl_); mode_->AddChoice(di->T("Move")); mode_->AddChoice(di->T("Resize")); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 4b9f915af4..9f2f7040b3 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -159,8 +159,8 @@ BEGIN CONTROL "",IDC_BREAKPOINTLIST,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93 CONTROL "Custom2",IDC_DEBUGMEMVIEW,"CtrlMemView",WS_BORDER,1,338,513,93 CONTROL "",IDC_THREADLIST,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93 - CONTROL "",IDC_STACKFRAMES,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93 - CONTROL "",IDC_MODULELIST,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93 + CONTROL "",IDC_STACKFRAMES,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93 + CONTROL "",IDC_MODULELIST,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93 CONTROL "",IDC_DEBUG_BOTTOMTABS,"SysTabControl32",TCS_TABS | TCS_FOCUSNEVER,1,338,513,93 END @@ -390,17 +390,17 @@ BEGIN MENUITEM SEPARATOR POPUP "Savestate Slot" - BEGIN - MENUITEM "&1", ID_FILE_SAVESTATE_SLOT_1 - MENUITEM "&2", ID_FILE_SAVESTATE_SLOT_2 - MENUITEM "&3", ID_FILE_SAVESTATE_SLOT_3 - MENUITEM "&4", ID_FILE_SAVESTATE_SLOT_4 - MENUITEM "&5", ID_FILE_SAVESTATE_SLOT_5 - END - MENUITEM "Load State", ID_FILE_QUICKLOADSTATE - MENUITEM "Save State", ID_FILE_QUICKSAVESTATE - MENUITEM "Load State File...", ID_FILE_LOADSTATEFILE - MENUITEM "Save State File...", ID_FILE_SAVESTATEFILE + BEGIN + MENUITEM "&1", ID_FILE_SAVESTATE_SLOT_1 + MENUITEM "&2", ID_FILE_SAVESTATE_SLOT_2 + MENUITEM "&3", ID_FILE_SAVESTATE_SLOT_3 + MENUITEM "&4", ID_FILE_SAVESTATE_SLOT_4 + MENUITEM "&5", ID_FILE_SAVESTATE_SLOT_5 + END + MENUITEM "Load State", ID_FILE_QUICKLOADSTATE + MENUITEM "Save State", ID_FILE_QUICKSAVESTATE + MENUITEM "Load State File...", ID_FILE_LOADSTATEFILE + MENUITEM "Save State File...", ID_FILE_SAVESTATEFILE MENUITEM SEPARATOR MENUITEM "Exit", ID_FILE_EXIT END @@ -411,13 +411,13 @@ BEGIN MENUITEM "Stop", ID_EMULATION_STOP MENUITEM "Reset", ID_EMULATION_RESET MENUITEM "Switch UMD", ID_EMULATION_SWITCH_UMD - POPUP "Display Rotation" - BEGIN - MENUITEM "Landscape", ID_EMULATION_ROTATION_H - MENUITEM "Portrait", ID_EMULATION_ROTATION_V - MENUITEM "Landscape reversed", ID_EMULATION_ROTATION_H_R - MENUITEM "Portrait reversed", ID_EMULATION_ROTATION_V_R - END + POPUP "Display Rotation" + BEGIN + MENUITEM "Landscape", ID_EMULATION_ROTATION_H + MENUITEM "Portrait", ID_EMULATION_ROTATION_V + MENUITEM "Landscape reversed", ID_EMULATION_ROTATION_H_R + MENUITEM "Portrait reversed", ID_EMULATION_ROTATION_V_R + END END POPUP "Debug" @@ -446,12 +446,12 @@ BEGIN BEGIN MENUITEM "Keep PPSSPP On Top", ID_OPTIONS_TOPMOST MENUITEM "Pause When Not Focused", ID_OPTIONS_PAUSE_FOCUS - MENUITEM "Ignore Windows Key", ID_OPTIONS_IGNOREWINKEY + MENUITEM "Ignore Windows Key", ID_OPTIONS_IGNOREWINKEY MENUITEM "More Settings...", ID_OPTIONS_MORE_SETTINGS MENUITEM "Control Mapping...", ID_OPTIONS_CONTROLS MENUITEM "Language...", ID_OPTIONS_LANGUAGE MENUITEM SEPARATOR - MENUITEM "Display Layout Editor" ID_OPTIONS_DISPLAY_LAYOUT + MENUITEM "Display Layout Editor" ID_OPTIONS_DISPLAY_LAYOUT MENUITEM "Fullscreen", ID_OPTIONS_FULLSCREEN MENUITEM "VSync", ID_OPTIONS_VSYNC MENUITEM "Postprocessing Shader", ID_OPTIONS_FXAA @@ -477,45 +477,45 @@ BEGIN MENUITEM "&4x", ID_OPTIONS_WINDOW4X END - POPUP "Backend" - BEGIN - MENUITEM "Direct3D9" ID_OPTIONS_DIRECT3D9 - MENUITEM "OpenGL" ID_OPTIONS_OPENGL - END + POPUP "Backend" + BEGIN + MENUITEM "Direct3D9" ID_OPTIONS_DIRECT3D9 + MENUITEM "OpenGL" ID_OPTIONS_OPENGL + END - POPUP "Rendering Mode" - BEGIN - MENUITEM "Non-Buffered Rendering", ID_OPTIONS_NONBUFFEREDRENDERING - MENUITEM "Buffered Rendering", ID_OPTIONS_BUFFEREDRENDERING - MENUITEM "Read Framebuffers To Memory (CPU)", ID_OPTIONS_READFBOTOMEMORYCPU - MENUITEM "Read Framebuffers To Memory (GPU)", ID_OPTIONS_READFBOTOMEMORYGPU - END - POPUP "Frame Skipping" - BEGIN - MENUITEM "Auto", ID_OPTIONS_FRAMESKIP_AUTO - MENUITEM SEPARATOR - MENUITEM "Off", ID_OPTIONS_FRAMESKIP_0 - MENUITEM "&1", ID_OPTIONS_FRAMESKIP_1 - MENUITEM "&2", ID_OPTIONS_FRAMESKIP_2 - MENUITEM "&3", ID_OPTIONS_FRAMESKIP_3 - MENUITEM "&4", ID_OPTIONS_FRAMESKIP_4 - MENUITEM "&5", ID_OPTIONS_FRAMESKIP_5 - MENUITEM "&6", ID_OPTIONS_FRAMESKIP_6 - MENUITEM "&7", ID_OPTIONS_FRAMESKIP_7 - MENUITEM "&8", ID_OPTIONS_FRAMESKIP_8 - END - POPUP "Texture Filtering" - BEGIN - MENUITEM "Auto", ID_OPTIONS_TEXTUREFILTERING_AUTO - MENUITEM "Nearest", ID_OPTIONS_NEARESTFILTERING - MENUITEM "Linear", ID_OPTIONS_LINEARFILTERING - MENUITEM "Linear on FMV", ID_OPTIONS_LINEARFILTERING_CG - END - POPUP "Screen Scaling Filter" - BEGIN - MENUITEM "Linear", ID_OPTIONS_BUFLINEARFILTER - MENUITEM "Nearest", ID_OPTIONS_BUFNEARESTFILTER - END + POPUP "Rendering Mode" + BEGIN + MENUITEM "Non-Buffered Rendering", ID_OPTIONS_NONBUFFEREDRENDERING + MENUITEM "Buffered Rendering", ID_OPTIONS_BUFFEREDRENDERING + MENUITEM "Read Framebuffers To Memory (CPU)", ID_OPTIONS_READFBOTOMEMORYCPU + MENUITEM "Read Framebuffers To Memory (GPU)", ID_OPTIONS_READFBOTOMEMORYGPU + END + POPUP "Frame Skipping" + BEGIN + MENUITEM "Auto", ID_OPTIONS_FRAMESKIP_AUTO + MENUITEM SEPARATOR + MENUITEM "Off", ID_OPTIONS_FRAMESKIP_0 + MENUITEM "&1", ID_OPTIONS_FRAMESKIP_1 + MENUITEM "&2", ID_OPTIONS_FRAMESKIP_2 + MENUITEM "&3", ID_OPTIONS_FRAMESKIP_3 + MENUITEM "&4", ID_OPTIONS_FRAMESKIP_4 + MENUITEM "&5", ID_OPTIONS_FRAMESKIP_5 + MENUITEM "&6", ID_OPTIONS_FRAMESKIP_6 + MENUITEM "&7", ID_OPTIONS_FRAMESKIP_7 + MENUITEM "&8", ID_OPTIONS_FRAMESKIP_8 + END + POPUP "Texture Filtering" + BEGIN + MENUITEM "Auto", ID_OPTIONS_TEXTUREFILTERING_AUTO + MENUITEM "Nearest", ID_OPTIONS_NEARESTFILTERING + MENUITEM "Linear", ID_OPTIONS_LINEARFILTERING + MENUITEM "Linear on FMV", ID_OPTIONS_LINEARFILTERING_CG + END + POPUP "Screen Scaling Filter" + BEGIN + MENUITEM "Linear", ID_OPTIONS_BUFLINEARFILTER + MENUITEM "Nearest", ID_OPTIONS_BUFNEARESTFILTER + END POPUP "Texture Scaling" BEGIN @@ -524,7 +524,7 @@ BEGIN MENUITEM "&2x", ID_TEXTURESCALING_2X MENUITEM "&3x", ID_TEXTURESCALING_3X MENUITEM "&4x", ID_TEXTURESCALING_4X - MENUITEM "&5x", ID_TEXTURESCALING_5X + MENUITEM "&5x", ID_TEXTURESCALING_5X MENUITEM SEPARATOR MENUITEM "xBRZ", ID_TEXTURESCALING_XBRZ MENUITEM "Hybrid", ID_TEXTURESCALING_HYBRID @@ -533,7 +533,7 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Deposterize", ID_TEXTURESCALING_DEPOSTERIZE END - MENUITEM "Hardware Transform", ID_OPTIONS_HARDWARETRANSFORM + MENUITEM "Hardware Transform", ID_OPTIONS_HARDWARETRANSFORM MENUITEM "Vertex Cache", ID_OPTIONS_VERTEXCACHE MENUITEM "Show FPS Counter", ID_OPTIONS_SHOWFPS MENUITEM SEPARATOR @@ -574,9 +574,9 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Kill Function", ID_DISASM_ADDHLE MENUITEM "Rename Function...", ID_DISASM_RENAMEFUNCTION - MENUITEM "Remove Function", ID_DISASM_REMOVEFUNCTION - MENUITEM "Add Function Here", ID_DISASM_ADDFUNCTION - END + MENUITEM "Remove Function", ID_DISASM_REMOVEFUNCTION + MENUITEM "Add Function Here", ID_DISASM_ADDFUNCTION + END POPUP "funclist" BEGIN MENUITEM "Kill Function", ID_FUNCLIST_KILLFUNCTION @@ -593,24 +593,24 @@ BEGIN BEGIN MENUITEM "Disable", ID_CONTROLS_KEY_DISABLE END - POPUP "breakpointlist" - BEGIN - MENUITEM "Enable", ID_DISASM_DISABLEBREAKPOINT - MENUITEM "Edit", ID_DISASM_EDITBREAKPOINT + POPUP "breakpointlist" + BEGIN + MENUITEM "Enable", ID_DISASM_DISABLEBREAKPOINT + MENUITEM "Edit", ID_DISASM_EDITBREAKPOINT MENUITEM SEPARATOR - MENUITEM "Add New", ID_DISASM_ADDNEWBREAKPOINT - END - POPUP "threadlist" - BEGIN - MENUITEM "Force Resume", ID_DISASM_THREAD_FORCERUN - MENUITEM "Terminate", ID_DISASM_THREAD_KILL - END - POPUP "newbreakpoint" - BEGIN - MENUITEM "Add New", ID_DISASM_ADDNEWBREAKPOINT - END - POPUP "displaylistview" - BEGIN + MENUITEM "Add New", ID_DISASM_ADDNEWBREAKPOINT + END + POPUP "threadlist" + BEGIN + MENUITEM "Force Resume", ID_DISASM_THREAD_FORCERUN + MENUITEM "Terminate", ID_DISASM_THREAD_KILL + END + POPUP "newbreakpoint" + BEGIN + MENUITEM "Add New", ID_DISASM_ADDNEWBREAKPOINT + END + POPUP "displaylistview" + BEGIN MENUITEM "Copy Address", ID_DISASM_COPYADDRESS MENUITEM "Copy Instruction (Hex)", ID_DISASM_COPYINSTRUCTIONHEX MENUITEM "Copy Instruction (Disasm)", ID_DISASM_COPYINSTRUCTIONDISASM @@ -623,7 +623,7 @@ BEGIN MENUITEM "Go to Displaylist PC", ID_GEDBG_GOTOPC MENUITEM "Go to Address...", ID_GEDBG_GOTOADDR MENUITEM "Go to in Memory View", ID_DISASM_GOTOINMEMORYVIEW - END + END END #endif // English (United States) resources diff --git a/Windows/resource.h b/Windows/resource.h index 3ffc2aeefe..675dcd39bd 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -335,7 +335,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 256 -#define _APS_NEXT_COMMAND_VALUE 40152 +#define _APS_NEXT_COMMAND_VALUE 40161 #define _APS_NEXT_CONTROL_VALUE 1199 #define _APS_NEXT_SYMED_VALUE 101 #endif From 6751617c8f7fddd70798737b362a9d2f88949281 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sun, 17 Jan 2016 22:05:32 +0100 Subject: [PATCH 8/9] Smooth out touch moving and resize and other small changes. --- UI/DisplayLayoutScreen.cpp | 34 ++++++++++++++++++++-------------- UI/DisplayLayoutScreen.h | 3 ++- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index a25a8f2bab..46d16b01ad 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -74,47 +74,52 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { if (g_Config.iSmallDisplayZoomType == 2) { mode = -1; } const Bounds &screen_bounds = screenManager()->getUIContext()->GetBounds(); - if ((touch.flags & TOUCH_MOVE) && picked_ != 0) { + int touchX = touch.x - offsetTouchX; + int touchY = touch.y - offsetTouchY; if (mode == 0) { const Bounds &bounds = picked_->GetBounds(); int mintouchX = screen_bounds.w / 4; - int maxTouchX = screen_bounds.w - screen_bounds.w / 4; + int maxTouchX = screen_bounds.w - mintouchX; int minTouchY = screen_bounds.h / 4; - int maxTouchY = screen_bounds.h - screen_bounds.h / 4; + int maxTouchY = screen_bounds.h - minTouchY; int newX = bounds.centerX(), newY = bounds.centerY(); // we have to handle x and y separately since even if x is blocked, y may not be. - if (touch.x > mintouchX && touch.x < maxTouchX) { + if (touchX > mintouchX && touchX < maxTouchX) { // if the leftmost point of the control is ahead of the margin, // move it. Otherwise, don't. - newX = touch.x; + newX = touchX; } - if (touch.y > minTouchY && touch.y < maxTouchY) { - newY = touch.y; + if (touchY > minTouchY && touchY < maxTouchY) { + newY = touchY; } picked_->ReplaceLayoutParams(new UI::AnchorLayoutParams(newX, newY, NONE, NONE, true)); - } - else if (mode == 1) { + } else if (mode == 1) { // Resize. Vertical = scaling, horizontal = spacing; // Up should be bigger so let's negate in that direction - float diffX = (touch.x - startX_); - float diffY = -(touch.y - startY_); + float diffX = (touchX - startX_); + float diffY = -(touchY - startY_); float movementScale = 0.5f; float newScale = startScale_ + diffY * movementScale; if (newScale > 100.0f) newScale = 100.0f; if (newScale < 1.0f) newScale = 1.0f; picked_->SetScale(newScale); + scaleUpdate_ = picked_->GetScale(); + g_Config.fSmallDisplayZoomLevel = scaleUpdate_ / 8.0f; } } if ((touch.flags & TOUCH_DOWN) && picked_ == 0) { picked_ = displayRepresentation_; if (picked_) { - startX_ = touch.x; - startY_ = touch.y; + const Bounds &bounds = picked_->GetBounds(); + startX_ = bounds.centerX(); + startY_ = bounds.centerY(); + offsetTouchX = touch.x - startX_; + offsetTouchY = touch.y - startY_; startScale_ = picked_->GetScale(); } } @@ -126,7 +131,6 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { picked_->SaveDisplayPosition(); picked_ = 0; } - g_Config.fSmallDisplayZoomLevel = startScale_ / 8.0f; return true; }; @@ -250,6 +254,7 @@ void DisplayLayoutScreen::CreateViews() { float height = local_dp_yres / 2.0f; if (g_Config.iSmallDisplayZoomType == 0) { // Stretched Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, width - width / 2.0f, NONE, NONE, height - height / 2.0f)); + stretched->SetEnabled(false); root_->Add(stretched); } else { // Partially stretched float origRatio = !bRotated ? 480.0f / 272.0f : 272.0f / 480.0f; @@ -262,6 +267,7 @@ void DisplayLayoutScreen::CreateViews() { if (bRotated && g_Config.iSmallDisplayZoomType == 1) { width = (272.0f + height) / 2.0f; } } Choice *stretched = new Choice("", "", false, new AnchorLayoutParams(width, height, local_dp_xres / 2.0f - width / 2.0f, NONE, NONE, local_dp_yres / 2.0f - height / 2.0f)); + stretched->SetEnabled(false); root_->Add(stretched); } } diff --git a/UI/DisplayLayoutScreen.h b/UI/DisplayLayoutScreen.h index ac49b3c005..a6d9c80082 100644 --- a/UI/DisplayLayoutScreen.h +++ b/UI/DisplayLayoutScreen.h @@ -47,7 +47,8 @@ private: // Touch down state for drag to resize etc float startX_; float startY_; - float startScale_; + float startScale_, scaleUpdate_; float displayRepresentationScale_; + int offsetTouchX, offsetTouchY; }; From f54e9d8ac4ce698fb592e470cde0a30f61421972 Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Sun, 17 Jan 2016 22:56:42 +0100 Subject: [PATCH 9/9] Rename variable to match others. --- UI/DisplayLayoutScreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UI/DisplayLayoutScreen.cpp b/UI/DisplayLayoutScreen.cpp index 46d16b01ad..f9e00ca937 100644 --- a/UI/DisplayLayoutScreen.cpp +++ b/UI/DisplayLayoutScreen.cpp @@ -80,15 +80,15 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) { if (mode == 0) { const Bounds &bounds = picked_->GetBounds(); - int mintouchX = screen_bounds.w / 4; - int maxTouchX = screen_bounds.w - mintouchX; + int minTouchX = screen_bounds.w / 4; + int maxTouchX = screen_bounds.w - minTouchX; int minTouchY = screen_bounds.h / 4; int maxTouchY = screen_bounds.h - minTouchY; int newX = bounds.centerX(), newY = bounds.centerY(); // we have to handle x and y separately since even if x is blocked, y may not be. - if (touchX > mintouchX && touchX < maxTouchX) { + if (touchX > minTouchX && touchX < maxTouchX) { // if the leftmost point of the control is ahead of the margin, // move it. Otherwise, don't. newX = touchX;