Skip to content

refactor(gameengine): Replace OSDisplaySetBusyState with GameEngine::setBusyState - #3674

Open
OmarAglan wants to merge 1 commit into
TheSuperHackers:mainfrom
OmarAglan:refactor/busy-state-via-gameengine
Open

OmarAglan wants to merge 1 commit into
TheSuperHackers:mainfrom
OmarAglan:refactor/busy-state-via-gameengine

Conversation

@OmarAglan

Copy link
Copy Markdown

GameLogic::updateDisplayBusyState() is in GameEngine and called the free function OSDisplaySetBusyState(), which is implemented in GameEngineDevice (Win32OSDisplay.cpp).

This change adds a virtual function GameEngine::setBusyState() with an empty default. Win32GameEngine overrides it with the same SetThreadExecutionState code. This is the same pattern as serviceWindowsOS(). GameLogic now calls TheGameEngine->setBusyState().

There is no behavior change. GameLogic is created by GameEngine::init, so TheGameEngine is always set when this is called.

OSDisplayWarningBox is not changed. It has no callers, so it does not need the device library at link time. It can be removed in a separate change.

This removes one of the calls from GameEngine into GameEngineDevice, as discussed in #3552.

AI USE

Used AI to make the change and to check the callers.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T09:30:43.896083Z 1784483 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

GameLogic now sends display and system busy-state values through a virtual GameEngine method in both game variants. Win32GameEngine implements the method by setting Windows thread execution-state flags. The previous OSDisplaySetBusyState API and implementation are removed.

Changes

Busy-state dispatch

Layer / File(s) Summary
Engine busy-state support
Generals/Code/GameEngine/Include/Common/GameEngine.h, GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h, Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h, Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp, Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
Both GameEngine variants declare setBusyState. Win32GameEngine sets ES_CONTINUOUS and adds the display and system flags according to the arguments. The previous Win32OSDisplay implementation is removed.
GameLogic dispatch and API removal
Generals/Code/GameEngine/Include/Common/OSDisplay.h, GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h, Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp, GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Both GameLogic variants call TheGameEngine->setBusyState with the existing values. The OSDisplay includes and public OSDisplaySetBusyState declarations are removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Suggested labels: Refactor, Minor, Gen, ZH

Suggested reviewers: xezon

Merge Risk: Minimal · up to 17844

The refactor preserves busy-state behavior on the inspected game paths. No actionable merge-blocking risk was established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: replacing OSDisplaySetBusyState with GameEngine::setBusyState.
Description check Passed The description explains the API change, the Win32GameEngine override, and the updated GameLogic call. It is directly related to the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e806939c-09ee-4466-b5dd-c09c012865c7
Commits

Reviewing files that changed from the base of the PR and between 998f337 and 1784483.

Files selected for processing: 9

  • Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h
  • Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp
  • Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp
  • Generals/Code/GameEngine/Include/Common/GameEngine.h
  • Generals/Code/GameEngine/Include/Common/OSDisplay.h
  • Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
  • GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
  • GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h
  • GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Files with no reviewable changes: 3

  • GeneralsMD/Code/GameEngine/Include/Common/OSDisplay.h
  • Generals/Code/GameEngine/Include/Common/OSDisplay.h
  • Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This refactor appears safe to merge.

Summary

Moves the request to keep Windows awake from OSDisplaySetBusyState into GameEngine::setBusyState.

  • The game engine now handles busy-state requests.

Diagram

sequenceDiagram
    participant Logic as GameLogic
    participant Engine as Win32GameEngine
    participant Windows
    Logic->>Engine: setBusyState(busyDisplay, busySystem)
    Engine->>Windows: SetThreadExecutionState(state)
Loading

Reviews (1) · Last reviewed commit: "refactor(gameengine): Replace OSDisplayS..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant