mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-19 13:51:05 +00:00
Move the SetThreadExecutionState calls to their own separate functions
This commit is contained in:
parent
bcf33b0ac6
commit
50cee98bca
@ -712,6 +712,18 @@ void GMainWindow::OnOpenUpdater() {
|
|||||||
updater->LaunchUI();
|
updater->LaunchUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::PreventOSSleep() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GMainWindow::AllowOSSleep() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool GMainWindow::LoadROM(const QString& filename) {
|
bool GMainWindow::LoadROM(const QString& filename) {
|
||||||
// Shutdown previous session if the emu thread is still active...
|
// Shutdown previous session if the emu thread is still active...
|
||||||
if (emu_thread != nullptr)
|
if (emu_thread != nullptr)
|
||||||
@ -902,9 +914,7 @@ void GMainWindow::ShutdownGame() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
AllowOSSleep();
|
||||||
SetThreadExecutionState(ES_CONTINUOUS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
discord_rpc->Pause();
|
discord_rpc->Pause();
|
||||||
OnStopRecordingPlayback();
|
OnStopRecordingPlayback();
|
||||||
@ -1223,9 +1233,7 @@ void GMainWindow::OnStartGame() {
|
|||||||
movie_record_path.clear();
|
movie_record_path.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
PreventOSSleep();
|
||||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
emu_thread->SetRunning(true);
|
emu_thread->SetRunning(true);
|
||||||
qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
|
qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
|
||||||
@ -1255,9 +1263,7 @@ void GMainWindow::OnPauseGame() {
|
|||||||
ui.action_Stop->setEnabled(true);
|
ui.action_Stop->setEnabled(true);
|
||||||
ui.action_Capture_Screenshot->setEnabled(false);
|
ui.action_Capture_Screenshot->setEnabled(false);
|
||||||
|
|
||||||
#ifdef _WIN32
|
AllowOSSleep();
|
||||||
SetThreadExecutionState(ES_CONTINUOUS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnStopGame() {
|
void GMainWindow::OnStopGame() {
|
||||||
|
@ -104,6 +104,9 @@ private:
|
|||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
void ConnectMenuEvents();
|
void ConnectMenuEvents();
|
||||||
|
|
||||||
|
void PreventOSSleep();
|
||||||
|
void AllowOSSleep();
|
||||||
|
|
||||||
bool LoadROM(const QString& filename);
|
bool LoadROM(const QString& filename);
|
||||||
void BootGame(const QString& filename);
|
void BootGame(const QString& filename);
|
||||||
void ShutdownGame();
|
void ShutdownGame();
|
||||||
|
Loading…
Reference in New Issue
Block a user