fix(headless): Skip early load abort in headless replay simulations#2730
fix(headless): Skip early load abort in headless replay simulations#2730githubawn wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/Main/WinMain.cpp | WM_CLOSE handler skips setQuitting(TRUE) in headless mode when TheMessageStream is not ready, preventing early quit-flag poisoning during engine init. |
| Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | updateLoadProgress now skips QuitGameException in headless mode, acting as a second-line defence against spurious quit flags during map loading. |
| GeneralsMD/Code/Main/WinMain.cpp | Identical fix to Generals/Code/Main/WinMain.cpp applied to the Zero Hour tree; no functional differences. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | Identical fix to Generals GameLogic.cpp applied to the Zero Hour tree; no functional differences. |
Sequence Diagram
sequenceDiagram
participant OS as Windows OS
participant WP as WndProc (WinMain)
participant GE as GameEngine
participant GL as GameLogic::updateLoadProgress
participant CI as CI Replay Checker
Note over OS,CI: Headless replay startup — engine still initialising
OS->>WP: WM_CLOSE (early, TheMessageStream not ready)
alt Non-headless (old behaviour)
WP->>GE: setQuitting(TRUE)
GE-->>GL: "getQuitting() == true"
GL->>CI: throw QuitGameException() — simulation aborted
else Headless mode (new behaviour)
WP-->>WP: skip setQuitting (headless guard)
Note over GL: updateLoadProgress also guards: skip QuitGameException if headless
GL->>CI: loading continues normally
end
Note over CI: Map loading completes, replay runs to end
CI->>CI: Simulation finishes, process exits cleanly
Reviews (5): Last reviewed commit: "another try" | Re-trigger Greptile
|
did some triaging and it happens much earlier than found, run 5930 instead of 7153 https://github.com/TheSuperHackers/GeneralsGameCode/actions/runs/22267506812/job/64416452283 basically either the first or second commit of the PR |
In headless replay simulation mode, the hidden game window can receive WM_CLOSE from the OS before ThePlayerList is initialized (isReadyForMessages() returns false). The new else branch introduced in PR TheSuperHackers#2336 was calling setQuitting(TRUE) in this case, which caused updateLoadProgress() to throw QuitGameException on every replay load. The game would then simulate on an empty world with no map or objects, completing a 99-minute replay in ~4 seconds instead of the expected ~4 minutes. Fix: add !TheGlobalData->m_headless guard to the WM_CLOSE fallback branch so that OS-generated window close messages during headless init are silently ignored.
|
As long as the test passes green, it is not working correctly. |
|
Suggest to first revert #2336 entirely, observe tests (of GitHub CI), then divide and conquer |
Fixes the CI replay checker instantly completing introduced by #2336.
Bypasses the
QuitGameExceptioninGameLogic::updateLoadProgresswhen running in headless mode. This ensures that any early initialization warnings that set the quitting flag do not prematurely abort the replay simulation during map loading.Claude helped. Worked locally. Let's see what it does on our CI.