mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Win32: Fix a bunch of little window resizing issues
This commit is contained in:
1 parent
95b6b50fd5
commit
28d8ed5881
11 files changed
+47
-72
No files matched your search
+4
-1
@@ -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_;
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControlMapping.cpp" />
|
||||
<ClCompile Include="D3D9Base.cpp" />
|
||||
<ClCompile Include="Debugger\BreakpointWindow.cpp" />
|
||||
<ClCompile Include="Debugger\CtrlDisAsmView.cpp" />
|
||||
@@ -359,7 +358,6 @@
|
||||
<ClInclude Include="..\android\jni\Arm64EmitterTest.h" />
|
||||
<ClInclude Include="..\android\jni\TestRunner.h" />
|
||||
<ClInclude Include="..\ios\ViewController.h" />
|
||||
<ClInclude Include="ControlMapping.h" />
|
||||
<ClInclude Include="D3D9Base.h" />
|
||||
<ClInclude Include="Debugger\BreakpointWindow.h" />
|
||||
<ClInclude Include="Debugger\CtrlDisAsmView.h" />
|
||||
|
||||
@@ -107,9 +107,6 @@
|
||||
<ClCompile Include="DinputDevice.cpp">
|
||||
<Filter>Windows\Input</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControlMapping.cpp">
|
||||
<Filter>Windows\Input</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Debugger\DebuggerShared.cpp">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClCompile>
|
||||
@@ -233,9 +230,6 @@
|
||||
<ClInclude Include="DinputDevice.h">
|
||||
<Filter>Windows\Input</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ControlMapping.h">
|
||||
<Filter>Windows\Input</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Debugger\DebuggerShared.h">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClInclude>
|
||||
|
||||
+40
-15
@@ -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<MINMAXINFO *>(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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in new issue
Block a user