Prevent windows from idling while playing a game with a gamecube controller.

This commit is contained in:
Garrett Brown
2016-07-06 19:00:33 -05:00
parent 3f03e2d5fe
commit 0856e162a3
2 changed files with 26 additions and 0 deletions

View File

@ -198,8 +198,14 @@ bool MainWindow::Stop()
}
if (stop)
{
ForceStop();
#ifdef Q_OS_WIN
// Allow windows to idle or turn off display again
SetThreadExecutionState(ES_CONTINUOUS);
#endif
}
return stop;
}
@ -258,6 +264,13 @@ void MainWindow::StartGame(const QString& path)
Settings().SetLastGame(path);
ShowRenderWidget();
emit EmulationStarted();
#ifdef Q_OS_WIN
// Prevents Windows from sleeping, turning off the display, or idling
EXECUTION_STATE shouldScreenSave =
SConfig::GetInstance().bDisableScreenSaver ? ES_DISPLAY_REQUIRED : 0;
SetThreadExecutionState(ES_CONTINUOUS | shouldScreenSave | ES_SYSTEM_REQUIRED);
#endif
}
void MainWindow::ShowRenderWidget()