Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
10 changes: 0 additions & 10 deletions Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions Generals/Code/GameEngine/Include/Common/GameEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
4 changes: 0 additions & 4 deletions Generals/Code/GameEngine/Include/Common/OSDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}

// ------------------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; };

Expand Down
4 changes: 0 additions & 4 deletions GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}

// ------------------------------------------------------------------------------------------------
Expand Down
Loading