fix(logic): Improve handling of MSG_NEW_GAME in GameLogicDispatch#2440
fix(logic): Improve handling of MSG_NEW_GAME in GameLogicDispatch#2440stephanmeesters wants to merge 3 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | Adds guard against MSG_NEW_GAME when game is in invalid state, but calls isClearingGameData() and isLoadingMap() which don't exist in the Generals GameLogic class — will cause a compile error when RETAIL_COMPATIBLE_CRC=0. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | Same guard added to Zero Hour (GeneralsMD); all three methods (isInGame, isClearingGameData, isLoadingMap) are properly declared in the GeneralsMD GameLogic header — no issues. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MSG_NEW_GAME received] --> B{RETAIL_COMPATIBLE_CRC == 0?}
B -- No --> E[Process MSG_NEW_GAME normally]
B -- Yes --> C{"isInGame() ||\nisClearingGameData() ||\nisLoadingMap()"}
C -- true --> D[DEBUG_CRASH + break\nMessage silently dropped]
C -- false --> E
E --> F[prepareNewGame]
F --> G[startNewGame]
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Line: 417-422
Comment:
**Missing methods in Generals GameLogic**
`isClearingGameData()` and `isLoadingMap()` are not declared in `Generals/Code/GameEngine/Include/GameLogic/GameLogic.h`. The Generals version only has `isLoadingGame()`. This means that when `RETAIL_COMPATIBLE_CRC` is set to `0`, the Generals build will fail to compile.
The GeneralsMD (Zero Hour) version correctly declares both methods (`isLoadingMap()` on line 189 and `isClearingGameData()` on line 191 of its `GameLogic.h`), but the vanilla Generals version does not have these equivalents.
This appears to be tracked by the open PR Todo item ("Replicate in Generals"), but as-is the `Generals` build is broken when `RETAIL_COMPATIBLE_CRC=0`.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: b5d35b3
Is this necessary? I was under the impression that it's not possible to recover from the DC bug. |
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Show resolved
Hide resolved
The DC bug is game ending, but once someone leaves the other guy wins, and that game may then carry on for some more frames and be recorded in the replay. Since this PR changes something there it may then mismatch right at the end, I didn't test specifically though. |
xezon
left a comment
There was a problem hiding this comment.
Makes logical sense.
I suggest test all game modes and verify they all properly launch.
Comment can be written better.
Needs to be replicated in Generals.
| #if !RETAIL_COMPATIBLE_CRC | ||
| // TheSuperHackers @fix stephanmeesters 11/03/2026 | ||
| // Make sure we're ready to start a new game. This prevents an issue where an infinite disconnect screen | ||
| // ("DC bug") can be triggered in an online match. |
There was a problem hiding this comment.
("DC bug") can be omitted. I suggest clarify that this can only be done by hacking, not in regular ways.
Think I got all of them except for Generals challenge and WOL (see ticket description). I could try spinning up x64's server code |
|
Can ignore the WOL for now. |
| if ( isInGame() || isClearingGameData() || isLoadingMap() ) | ||
| { | ||
| DEBUG_CRASH( ("Called MSG_NEW_GAME while game is not ready (inGame=%d, clearingData=%d, loadingMap=%d)", | ||
| isInGame(), isClearingGameData(), isLoadingMap()) ); | ||
| break; | ||
| } |
There was a problem hiding this comment.
Missing methods in Generals GameLogic
isClearingGameData() and isLoadingMap() are not declared in Generals/Code/GameEngine/Include/GameLogic/GameLogic.h. The Generals version only has isLoadingGame(). This means that when RETAIL_COMPATIBLE_CRC is set to 0, the Generals build will fail to compile.
The GeneralsMD (Zero Hour) version correctly declares both methods (isLoadingMap() on line 189 and isClearingGameData() on line 191 of its GameLogic.h), but the vanilla Generals version does not have these equivalents.
This appears to be tracked by the open PR Todo item ("Replicate in Generals"), but as-is the Generals build is broken when RETAIL_COMPATIBLE_CRC=0.
Prompt To Fix With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Line: 417-422
Comment:
**Missing methods in Generals GameLogic**
`isClearingGameData()` and `isLoadingMap()` are not declared in `Generals/Code/GameEngine/Include/GameLogic/GameLogic.h`. The Generals version only has `isLoadingGame()`. This means that when `RETAIL_COMPATIBLE_CRC` is set to `0`, the Generals build will fail to compile.
The GeneralsMD (Zero Hour) version correctly declares both methods (`isLoadingMap()` on line 189 and `isClearingGameData()` on line 191 of its `GameLogic.h`), but the vanilla Generals version does not have these equivalents.
This appears to be tracked by the open PR Todo item ("Replicate in Generals"), but as-is the `Generals` build is broken when `RETAIL_COMPATIBLE_CRC=0`.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
May need a unify PR for this
There was a problem hiding this comment.
Is this right? It will fail to compile with that configuration?
There was a problem hiding this comment.
Yes, that's correct. The Generals build will fail to compile when RETAIL_COMPATIBLE_CRC=0.
Verified:
- Generals GameLogic.h only has
isLoadingGame() - GeneralsMD GameLogic.h has
isLoadingMap()(line 189) andisClearingGameData()(line 191)
When RETAIL_COMPATIBLE_CRC=0, the compiler will encounter undefined method calls to isClearingGameData() and isLoadingMap() in the Generals build, causing compilation errors.
The methods need to be added to Generals/Code/GameEngine/Include/GameLogic/GameLogic.h (likely following the same pattern as GeneralsMD) to make this work.
This should be an acceptable mismatch imho. The game has basically ended. |
The concern was that we would be wasting time on investigating replay mismatches due to anti-cheat fixes, see #2408. If you don't think that concern applies here then there will be no need for the RETAIL_COMPATIBLE_CRC |
|
Can you fix the Generals compile error? Edit: Nevermind, I see you did a unify first. |
This prevents a possible issue where the game gets stuck in the disconnect screen ("dc bug") when making a call to MSG_NEW_GAME when the game is not ready for it.
Tested with local multiplayer match, skirmish, savegame, replay, campaign, generals challeng. 1k replays passed.
Moved behind RETAIL_COMPATIBLE_CRC in the case of any replays that have a forced dc bug.
Todo