From 8a78f5e814ab9f23396cd7d7f592c62fe369ef19 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 29 Jun 2014 18:06:47 -0400 Subject: [PATCH] Pause rendering when minimized, when appropriate (hopefully? This is sort of hard to test.). --- GPU/GPUState.h | 1 + UI/EmuScreen.cpp | 6 ++++++ UI/MiscScreens.cpp | 7 +++++++ Windows/WndMainWindow.cpp | 6 ++++++ 4 files changed, 20 insertions(+) diff --git a/GPU/GPUState.h b/GPU/GPUState.h index b1f4bad10f..30db2b0775 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -419,6 +419,7 @@ enum SkipDrawReasonFlags { SKIPDRAW_SKIPFRAME = 1, SKIPDRAW_NON_DISPLAYED_FB = 2, // Skip drawing to FBO:s that have not been displayed. SKIPDRAW_BAD_FB_TEXTURE = 4, + SKIPDRAW_WINDOW_MINIMIZED = 8, // Don't draw when the host window is minimized. }; bool vertTypeIsSkinningEnabled(u32 vertType); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 1749aac268..22780f858c 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -224,6 +224,12 @@ void EmuScreen::sendMessage(const char *message, const char *value) { if (PSP_IsInited()) { currentMIPS->UpdateCore(g_Config.bJit ? CPU_JIT : CPU_INTERPRETER); } + } else if (!strcmp(message, "window minimized")) { + if (!strcmp(value, "true")) { + gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED; + } else { + gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED; + } } } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index e0bccc56ae..560536210a 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -37,6 +37,7 @@ #include "Core/HLE/sceUtility.h" #include "Common/CPUDetect.h" #include "Common/FileUtil.h" +#include "GPU/GPUState.h" #include "ui_atlas.h" @@ -197,6 +198,12 @@ void UIDialogScreenWithBackground::sendMessage(const char *message, const char * auto langScreen = new NewLanguageScreen(de->T("Language")); langScreen->OnChoice.Handle(this, &UIDialogScreenWithBackground::OnLanguageChange); screenManager()->push(langScreen); + } else if (!strcmp(message, "window minimized")) { + if (!strcmp(value, "true")) { + gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED; + } else { + gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED; + } } } diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 67a6661699..b45383a15b 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -1093,11 +1093,17 @@ namespace MainWindow case SIZE_MAXIMIZED: case SIZE_RESTORED: Core_NotifyWindowHidden(false); + if (!g_Config.bPauseWhenMinimized) { + NativeMessageReceived("window minimized", "false"); + } SavePosition(); ResizeDisplay(); break; case SIZE_MINIMIZED: Core_NotifyWindowHidden(g_Config.bPauseWhenMinimized); + if (!g_Config.bPauseWhenMinimized) { + NativeMessageReceived("window minimized", "true"); + } break; default: break;