mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Move the SetThreadExecutionState calls to their own separate functions
This commit is contained in:
		
							parent
							
								
									bcf33b0ac6
								
							
						
					
					
						commit
						50cee98bca
					
				
					 2 changed files with 18 additions and 9 deletions
				
			
		|  | @ -712,6 +712,18 @@ void GMainWindow::OnOpenUpdater() { | |||
|     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) { | ||||
|     // Shutdown previous session if the emu thread is still active...
 | ||||
|     if (emu_thread != nullptr) | ||||
|  | @ -902,9 +914,7 @@ void GMainWindow::ShutdownGame() { | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
| #ifdef _WIN32 | ||||
|     SetThreadExecutionState(ES_CONTINUOUS); | ||||
| #endif | ||||
|     AllowOSSleep(); | ||||
| 
 | ||||
|     discord_rpc->Pause(); | ||||
|     OnStopRecordingPlayback(); | ||||
|  | @ -1223,9 +1233,7 @@ void GMainWindow::OnStartGame() { | |||
|         movie_record_path.clear(); | ||||
|     } | ||||
| 
 | ||||
| #ifdef _WIN32 | ||||
|     SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); | ||||
| #endif | ||||
|     PreventOSSleep(); | ||||
| 
 | ||||
|     emu_thread->SetRunning(true); | ||||
|     qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus"); | ||||
|  | @ -1255,9 +1263,7 @@ void GMainWindow::OnPauseGame() { | |||
|     ui.action_Stop->setEnabled(true); | ||||
|     ui.action_Capture_Screenshot->setEnabled(false); | ||||
| 
 | ||||
| #ifdef _WIN32 | ||||
|     SetThreadExecutionState(ES_CONTINUOUS); | ||||
| #endif | ||||
|     AllowOSSleep(); | ||||
| } | ||||
| 
 | ||||
| void GMainWindow::OnStopGame() { | ||||
|  |  | |||
|  | @ -104,6 +104,9 @@ private: | |||
|     void ConnectWidgetEvents(); | ||||
|     void ConnectMenuEvents(); | ||||
| 
 | ||||
|     void PreventOSSleep(); | ||||
|     void AllowOSSleep(); | ||||
| 
 | ||||
|     bool LoadROM(const QString& filename); | ||||
|     void BootGame(const QString& filename); | ||||
|     void ShutdownGame(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue