From bcf33b0ac61a7ae489b105f3cac3198398d7c569 Mon Sep 17 00:00:00 2001 From: vitor-k Date: Tue, 3 Sep 2019 11:06:57 -0300 Subject: [PATCH] Fix to windows sleep issues, now with clang format! --- src/citra_qt/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index fe8f60e251..d0060f6901 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -18,6 +18,9 @@ #ifdef __APPLE__ #include // for chdir #endif +#ifdef _WIN32 +#include +#endif #include "citra_qt/aboutdialog.h" #include "citra_qt/applets/mii_selector.h" #include "citra_qt/applets/swkbd.h" @@ -899,6 +902,10 @@ void GMainWindow::ShutdownGame() { return; } +#ifdef _WIN32 + SetThreadExecutionState(ES_CONTINUOUS); +#endif + discord_rpc->Pause(); OnStopRecordingPlayback(); emu_thread->RequestStop(); @@ -1216,6 +1223,10 @@ void GMainWindow::OnStartGame() { movie_record_path.clear(); } +#ifdef _WIN32 + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); +#endif + emu_thread->SetRunning(true); qRegisterMetaType("Core::System::ResultStatus"); qRegisterMetaType("std::string"); @@ -1243,6 +1254,10 @@ void GMainWindow::OnPauseGame() { ui.action_Pause->setEnabled(false); ui.action_Stop->setEnabled(true); ui.action_Capture_Screenshot->setEnabled(false); + +#ifdef _WIN32 + SetThreadExecutionState(ES_CONTINUOUS); +#endif } void GMainWindow::OnStopGame() {