diff --git a/Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h b/Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h index e27eb8504c9..fe8d0be7c3a 100644 --- a/Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h +++ b/Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h @@ -65,6 +65,7 @@ class Win32GameEngine : public GameEngine virtual void reset() override; ///< reset engine virtual void update() override; ///< update the game engine virtual void serviceWindowsOS() override; ///< allow windows maintenance in background + virtual void setBusyState(Bool busyDisplay, Bool busySystem) override; protected: diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 485d5f83bd2..d8c922f418f 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -168,3 +168,12 @@ void Win32GameEngine::serviceWindowsOS() } +//------------------------------------------------------------------------------------------------- +void Win32GameEngine::setBusyState(Bool busyDisplay, Bool busySystem) +{ + EXECUTION_STATE state = ES_CONTINUOUS; + state |= busyDisplay ? ES_DISPLAY_REQUIRED : 0; + state |= busySystem ? ES_SYSTEM_REQUIRED : 0; + + ::SetThreadExecutionState(state); +} diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp index 8cca1518494..c2dee80fb64 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp @@ -105,13 +105,3 @@ OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedIn return OSDBT_CANCEL; } - -//------------------------------------------------------------------------------------------------- -void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem) -{ - EXECUTION_STATE state = ES_CONTINUOUS; - state |= busyDisplay ? ES_DISPLAY_REQUIRED : 0; - state |= busySystem ? ES_SYSTEM_REQUIRED : 0; - - ::SetThreadExecutionState(state); -} diff --git a/Generals/Code/GameEngine/Include/Common/GameEngine.h b/Generals/Code/GameEngine/Include/Common/GameEngine.h index 8dfb25151ac..1b53296b45d 100644 --- a/Generals/Code/GameEngine/Include/Common/GameEngine.h +++ b/Generals/Code/GameEngine/Include/Common/GameEngine.h @@ -72,6 +72,9 @@ class GameEngine : public SubsystemInterface virtual Bool isMultiplayerSession(); virtual void serviceWindowsOS() {}; ///< service the native OS + // TheSuperHackers @feature Tell the Operating System that the game is considered busy + // and we would not like the display screen and/or system to shut off. + virtual void setBusyState(Bool busyDisplay, Bool busySystem) {} virtual Bool isActive() {return m_isActive;} ///< returns whether app has OS focus. virtual void setIsActive(Bool isActive) { m_isActive = isActive; }; virtual void checkAbnormalQuitting(); ///< check if user is quitting at an unusual time - as in cheating! diff --git a/Generals/Code/GameEngine/Include/Common/OSDisplay.h b/Generals/Code/GameEngine/Include/Common/OSDisplay.h index 293ec4858ea..7f1d617fd97 100644 --- a/Generals/Code/GameEngine/Include/Common/OSDisplay.h +++ b/Generals/Code/GameEngine/Include/Common/OSDisplay.h @@ -57,7 +57,3 @@ enum OSDisplayOtherFlags CPP_11(: UnsignedInt) // buttons. (Feel free to add buttons as appropriate to the enum above). // This function will return the button pressed to close the dialog. OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedInt buttonFlags, UnsignedInt otherFlags); - -// TheSuperHackers @feature Tell the Operating System that the game is considered busy -// and we would not like the display screen and/or system to shut off. -void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem); diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 5be383ee07b..cb2b135449f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -42,7 +42,6 @@ #include "Common/LatchRestore.h" #include "Common/MapObject.h" #include "Common/MultiplayerSettings.h" -#include "Common/OSDisplay.h" #include "Common/PerfTimer.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -968,7 +967,7 @@ void GameLogic::updateDisplayBusyState() const Bool busySystem = isInInteractiveGame() && !isGamePaused(); const Bool busyDisplay = busySystem && !TheGlobalData->m_headless; - OSDisplaySetBusyState(busyDisplay, busySystem); + TheGameEngine->setBusyState(busyDisplay, busySystem); } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h index bcf91c3643f..77ab9783d87 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h @@ -72,6 +72,9 @@ class GameEngine : public SubsystemInterface virtual Bool isMultiplayerSession(); virtual void serviceWindowsOS() {}; ///< service the native OS + // TheSuperHackers @feature Tell the Operating System that the game is considered busy + // and we would not like the display screen and/or system to shut off. + virtual void setBusyState(Bool busyDisplay, Bool busySystem) {} virtual Bool isActive() {return m_isActive;} ///< returns whether app has OS focus. virtual void setIsActive(Bool isActive) { m_isActive = isActive; }; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h b/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h index 900b3505dfa..d42c82edd79 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h @@ -57,7 +57,3 @@ enum OSDisplayOtherFlags CPP_11(: UnsignedInt) // buttons. (Feel free to add buttons as appropriate to the enum above). // This function will return the button pressed to close the dialog. OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedInt buttonFlags, UnsignedInt otherFlags); - -// TheSuperHackers @feature Tell the Operating System that the game is considered busy -// and we would not like the display screen and/or system to shut off. -void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index b993d8f9116..275119c54cf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -43,7 +43,6 @@ #include "Common/LatchRestore.h" #include "Common/MapObject.h" #include "Common/MultiplayerSettings.h" -#include "Common/OSDisplay.h" #include "Common/PerfTimer.h" #include "Common/Player.h" #include "Common/PlayerList.h" @@ -1109,7 +1108,7 @@ void GameLogic::updateDisplayBusyState() const Bool busySystem = isInInteractiveGame() && !isGamePaused(); const Bool busyDisplay = busySystem && !TheGlobalData->m_headless; - OSDisplaySetBusyState(busyDisplay, busySystem); + TheGameEngine->setBusyState(busyDisplay, busySystem); } // ------------------------------------------------------------------------------------------------