Fix in-game rendering resolution changes on Windows. Fixes #5401

This commit is contained in:
Henrik Rydgard 2014-02-12 10:36:40 +01:00
parent 7e9c0e766a
commit fb3febb22b

View File

@ -194,7 +194,7 @@ namespace MainWindow
}
}
void GetWindowRectAtResolution(int xres, int yres, RECT &rcInner, RECT &rcOuter) {
static void GetWindowRectAtResolution(int xres, int yres, RECT &rcInner, RECT &rcOuter) {
rcInner.left = 0;
rcInner.top = 0;
@ -209,7 +209,17 @@ namespace MainWindow
rcOuter.top = g_Config.iWindowY;
}
void ResizeDisplay(bool displayOSM = true, bool noWindowMovement = false) {
static void ShowScreenResolution() {
I18NCategory *g = GetI18NCategory("Graphics");
char message[256];
sprintf(message, "%s: %ix%i %s: %ix%i",
g->T("Internal Resolution"), PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight,
g->T("Window Size"), PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
osm.Show(g->T(message), 2.0f);
}
static void ResizeDisplay(bool noWindowMovement = false) {
int width = PSP_CoreParameter().pixelWidth, height = PSP_CoreParameter().pixelHeight;
RECT rc;
GetClientRect(hwndMain, &rc);
@ -233,15 +243,6 @@ namespace MainWindow
PSP_CoreParameter().renderWidth = 480 * zoom;
PSP_CoreParameter().renderHeight = 272 * zoom;
if (displayOSM) {
I18NCategory *g = GetI18NCategory("Graphics");
char message[256];
sprintf(message, "%s: %ix%i %s: %ix%i",
g->T("Internal Resolution"), PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight,
g->T("Window Size"), PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
osm.Show(g->T(message), 2.0f);
}
if (!noWindowMovement) {
UpdateScreenScale(width, height);
NativeMessageReceived("gpu resized", "");
@ -252,7 +253,8 @@ namespace MainWindow
RECT rc, rcOuter;
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(true, true);
ResizeDisplay(true);
ShowScreenResolution();
}
void SetInternalResolution(int res = -1) {
@ -267,7 +269,8 @@ namespace MainWindow
if (g_Config.iTexScalingLevel == TEXSCALING_AUTO)
setTexScalingMultiplier(0);
ResizeDisplay(true, true);
gpu->Resized();
ShowScreenResolution();
}
void CorrectCursor() {
@ -307,7 +310,10 @@ namespace MainWindow
CorrectCursor();
bool showOSM = (g_Config.iInternalResolution == RESOLUTION_AUTO);
ResizeDisplay(showOSM, true);
ResizeDisplay(true);
if (showOSM) {
ShowScreenResolution();
}
ShowOwnedPopups(hwndMain, TRUE);
W32Util::MakeTopMost(hwndMain, g_Config.bTopMost);
}
@ -337,7 +343,10 @@ namespace MainWindow
CorrectCursor();
bool showOSM = (g_Config.iInternalResolution == RESOLUTION_AUTO);
ResizeDisplay(showOSM, true);
ResizeDisplay(true);
if (showOSM) {
ShowScreenResolution();
}
ShowOwnedPopups(hwndMain, FALSE);
}
@ -1031,12 +1040,12 @@ namespace MainWindow
case WM_MOVE:
SavePosition();
ResizeDisplay(false);
ResizeDisplay();
break;
case WM_SIZE:
SavePosition();
ResizeDisplay(false);
ResizeDisplay();
break;
case WM_TIMER:
@ -1550,7 +1559,8 @@ namespace MainWindow
break;
case WM_USER_UPDATE_SCREEN:
ResizeDisplay(true, true);
ResizeDisplay(true);
ShowScreenResolution();
break;
case WM_USER_WINDOW_TITLE_CHANGED: