1 #include "stdafx.h" 2 #include "PlatformUtilities.h" 3 4 #if !defined(LIBRETRO) && defined(_WIN32) 5 #include <Windows.h> 6 #endif 7 8 bool PlatformUtilities::_highResTimerEnabled = false; 9 DisableScreensaver()10void PlatformUtilities::DisableScreensaver() 11 { 12 //Prevent screensaver/etc from starting while using the emulator 13 //DirectInput devices apparently do not always count as user input 14 #if !defined(LIBRETRO) && defined(_WIN32) 15 SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_CONTINUOUS); 16 #endif 17 } 18 EnableScreensaver()19void PlatformUtilities::EnableScreensaver() 20 { 21 #if !defined(LIBRETRO) && defined(_WIN32) 22 SetThreadExecutionState(ES_CONTINUOUS); 23 #endif 24 } 25 EnableHighResolutionTimer()26void PlatformUtilities::EnableHighResolutionTimer() 27 { 28 #if !defined(LIBRETRO) && defined(_WIN32) 29 //Request a 1ms timer resolution on Windows while a game is running 30 if(!_highResTimerEnabled) { 31 timeBeginPeriod(1); 32 _highResTimerEnabled = true; 33 } 34 #endif 35 } 36 RestoreTimerResolution()37void PlatformUtilities::RestoreTimerResolution() 38 { 39 #if !defined(LIBRETRO) && defined(_WIN32) 40 if(_highResTimerEnabled) { 41 timeEndPeriod(1); 42 _highResTimerEnabled = false; 43 } 44 #endif 45 }