diff --git a/Core/Config.h b/Core/Config.h
index 6a5600bf3f..428d614765 100644
--- a/Core/Config.h
+++ b/Core/Config.h
@@ -415,7 +415,10 @@ public:
void ResetControlLayout();
void GetReportingInfo(UrlEncoder &data);
-
+
+ bool IsPortrait() const {
+ return (iInternalScreenRotation == ROTATION_LOCKED_VERTICAL || iInternalScreenRotation == ROTATION_LOCKED_VERTICAL180) && iRenderingMode != 0;
+ }
private:
std::string gameId_;
diff --git a/Core/Core.cpp b/Core/Core.cpp
index cfa25cf1df..e8d0251c16 100644
--- a/Core/Core.cpp
+++ b/Core/Core.cpp
@@ -121,13 +121,13 @@ void Core_WaitInactive(int milliseconds) {
}
}
-bool UpdateScreenScale(int width, int height) {
+bool UpdateScreenScale(int width, int height, bool smallWindow) {
g_dpi = 72;
g_dpi_scale = 1.0f;
#if defined(__SYMBIAN32__)
g_dpi_scale = 1.4f;
#elif defined(_WIN32)
- if (width < 480 + 80) {
+ if (smallWindow) {
g_dpi_scale = 2.0f;
}
#endif
diff --git a/Core/Core.h b/Core/Core.h
index 301cd3e8c7..839a63dacf 100644
--- a/Core/Core.h
+++ b/Core/Core.h
@@ -42,7 +42,7 @@ bool Core_IsInactive();
void Core_WaitInactive();
void Core_WaitInactive(int milliseconds);
-bool UpdateScreenScale(int width, int height);
+bool UpdateScreenScale(int width, int height, bool smallWindow);
// Don't run the core when minimized etc.
void Core_NotifyWindowHidden(bool hidden);
diff --git a/Windows/ControlMapping.cpp b/Windows/ControlMapping.cpp
deleted file mode 100644
index a106388041..0000000000
--- a/Windows/ControlMapping.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2012- PPSSPP Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official git repository and contact information can be found at
-// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
-
-#include "Common/KeyMap.h"
-#include "ControlMapping.h"
-#include "DinputDevice.h"
-#include "XinputDevice.h"
diff --git a/Windows/ControlMapping.h b/Windows/ControlMapping.h
deleted file mode 100644
index 933a254a07..0000000000
--- a/Windows/ControlMapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2012- PPSSPP Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official git repository and contact information can be found at
-// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
-
-#pragma once
-
-#include "InputDevice.h"
-
diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp
index 77476c0bb9..d2923b20ff 100644
--- a/Windows/DinputDevice.cpp
+++ b/Windows/DinputDevice.cpp
@@ -20,7 +20,6 @@
#include "Core/HLE/sceCtrl.h"
#include "DinputDevice.h"
-#include "ControlMapping.h"
#include "Core/Config.h"
#include "input/input_state.h"
#include "base/NativeApp.h"
diff --git a/Windows/KeyboardDevice.cpp b/Windows/KeyboardDevice.cpp
index 64ab36d775..de6a680582 100644
--- a/Windows/KeyboardDevice.cpp
+++ b/Windows/KeyboardDevice.cpp
@@ -3,7 +3,6 @@
#include "input/keycodes.h"
#include "util/const_map.h"
#include "KeyMap.h"
-#include "ControlMapping.h"
#include "KeyboardDevice.h"
#include "../Common/CommonTypes.h"
#include "WinUser.h"
diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj
index 515fce2aa6..65386549b1 100644
--- a/Windows/PPSSPP.vcxproj
+++ b/Windows/PPSSPP.vcxproj
@@ -304,7 +304,6 @@
-
@@ -359,7 +358,6 @@
-
diff --git a/Windows/PPSSPP.vcxproj.filters b/Windows/PPSSPP.vcxproj.filters
index 88f7908a55..d7ef0c09a7 100644
--- a/Windows/PPSSPP.vcxproj.filters
+++ b/Windows/PPSSPP.vcxproj.filters
@@ -107,9 +107,6 @@
Windows\Input
-
- Windows\Input
-
Windows\Debugger
@@ -233,9 +230,6 @@
Windows\Input
-
- Windows\Input
-
Windows\Debugger
diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp
index 1680f1f6e6..2722d206f7 100644
--- a/Windows/WndMainWindow.cpp
+++ b/Windows/WndMainWindow.cpp
@@ -71,7 +71,6 @@
#include "GPU/GLES/TextureScaler.h"
#include "GPU/GLES/TextureCache.h"
#include "GPU/GLES/Framebuffer.h"
-#include "ControlMapping.h"
#include "UI/OnScreenDisplay.h"
#include "GPU/Common/PostShader.h"
@@ -231,16 +230,32 @@ namespace MainWindow
static void UpdateRenderResolution() {
RECT rc;
GetClientRect(hwndMain, &rc);
+
+ // Actually, auto mode should be more granular...
// Round up to a zoom factor for the render size.
int zoom = g_Config.iInternalResolution;
- if (zoom == 0) // auto mode
- zoom = (rc.right - rc.left + 479) / 480;
+ if (zoom == 0) { // auto mode
+ // Use the longest dimension
+ if (g_Config.IsPortrait()) {
+ zoom = (rc.bottom - rc.top + 479) / 480;
+ } else {
+ zoom = (rc.right - rc.left + 479) / 480;
+ }
+ }
if (zoom <= 1)
zoom = 1;
- // Actually, auto mode should be more granular...
- PSP_CoreParameter().renderWidth = 480 * zoom;
- PSP_CoreParameter().renderHeight = 272 * zoom;
+ if (g_Config.IsPortrait()) {
+ PSP_CoreParameter().renderWidth = 480 * zoom;
+ PSP_CoreParameter().renderHeight = 272 * zoom;
+ } else {
+ PSP_CoreParameter().renderWidth = 272 * zoom;
+ PSP_CoreParameter().renderHeight = 480 * zoom;
+ }
+ }
+
+ static bool IsWindowSmall() {
+ return g_Config.IsPortrait() ? (g_Config.iWindowHeight < 480 + 80) : (g_Config.iWindowWidth < 480 + 80);
}
static void ResizeDisplay(bool noWindowMovement = false) {
@@ -251,7 +266,7 @@ namespace MainWindow
if (!noWindowMovement) {
width = rc.right - rc.left;
height = rc.bottom - rc.top;
- // Moves the internal window, not the frame. TODO: Get rid of the internal window.
+ // Moves the internal window, not the frame. TODO: Get rid of the internal window. Tried before but Intel drivers screw up when minimizing, or something?
MoveWindow(hwndDisplay, 0, 0, width, height, TRUE);
// This is taken care of anyway later, but makes sure that ShowScreenResolution gets the right numbers.
// Need to clean all of this up...
@@ -262,7 +277,7 @@ namespace MainWindow
UpdateRenderResolution();
if (!noWindowMovement) {
- if (UpdateScreenScale(width, height)) {
+ if (UpdateScreenScale(width, height, IsWindowSmall())) {
NativeMessageReceived("gpu resized", "");
}
}
@@ -271,7 +286,13 @@ namespace MainWindow
void SetWindowSize(int zoom) {
AssertCurrentThreadName("Main");
RECT rc, rcOuter;
- GetWindowRectAtResolution(480 * (int)zoom, 272 * (int)zoom, rc, rcOuter);
+
+ // Actually, auto mode should be more granular...
+ if (g_Config.IsPortrait()) {
+ GetWindowRectAtResolution(272 * (int)zoom, 480 * (int)zoom, rc, rcOuter);
+ } else {
+ GetWindowRectAtResolution(480 * (int)zoom, 272 * (int)zoom, rc, rcOuter);
+ }
MoveWindow(hwndMain, rcOuter.left, rcOuter.top, rcOuter.right - rcOuter.left, rcOuter.bottom - rcOuter.top, TRUE);
ResizeDisplay(false);
ShowScreenResolution();
@@ -403,7 +424,8 @@ namespace MainWindow
// First, get the w/h right.
if (g_Config.iWindowWidth <= 0 || g_Config.iWindowHeight <= 0) {
RECT rcInner = rc, rcOuter;
- GetWindowRectAtResolution(2 * 480, 2 * 272, rcInner, rcOuter);
+ bool portrait = g_Config.IsPortrait();
+ GetWindowRectAtResolution(2 * (portrait ? 272 : 480), 2 * (portrait ? 480 : 272), rcInner, rcOuter);
rc.right = rc.left + (rcOuter.right - rcOuter.left);
rc.bottom = rc.top + (rcOuter.bottom - rcOuter.top);
g_Config.iWindowWidth = rc.right - rc.left;
@@ -941,10 +963,9 @@ namespace MainWindow
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
// Only apply a factor > 1 in windowed mode.
- int factor = !IsZoomed(GetHWND()) && !g_Config.bFullScreen && g_Config.iWindowWidth < (480 + 80) ? 2 : 1;
+ int factor = !IsZoomed(GetHWND()) && !g_Config.bFullScreen && IsWindowSmall() ? 2 : 1;
static bool firstErase = true;
-
switch (message) {
case WM_ACTIVATE:
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) {
@@ -1071,8 +1092,9 @@ namespace MainWindow
{
MINMAXINFO *minmax = reinterpret_cast(lParam);
RECT rc = { 0 };
- rc.right = 480;
- rc.bottom = 272;
+ bool portrait = g_Config.IsPortrait();
+ rc.right = portrait ? 272 : 480;
+ rc.bottom = portrait ? 480 : 272;
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, TRUE);
minmax->ptMinTrackSize.x = rc.right - rc.left;
minmax->ptMinTrackSize.y = rc.bottom - rc.top;
@@ -1819,8 +1841,11 @@ namespace MainWindow
RECT rc;
GetClientRect(GetHWND(), &rc);
+ int checkW = g_Config.IsPortrait() ? 272 : 480;
+ int checkH = g_Config.IsPortrait() ? 480 : 272;
+
for (int i = 0; i < ARRAY_SIZE(windowSizeItems); i++) {
- bool check = (i + 1) * 480 == rc.right - rc.left || (i + 1) * 272 == rc.bottom - rc.top;
+ bool check = (i + 1) * checkW == rc.right - rc.left || (i + 1) * checkH == rc.bottom - rc.top;
CheckMenuItem(menu, windowSizeItems[i], MF_BYCOMMAND | (check ? MF_CHECKED : MF_UNCHECKED));
}
diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp
index deae4fc882..e4f51b6f61 100644
--- a/Windows/XinputDevice.cpp
+++ b/Windows/XinputDevice.cpp
@@ -7,7 +7,6 @@
#include "input/input_state.h"
#include "input/keycodes.h"
#include "XinputDevice.h"
-#include "ControlMapping.h"
// Utilities to dynamically load XInput. Adapted from SDL.