Skip to content

Commit e085a6f

Browse files
authored
[GEN][ZH] Add message with additional information on CRC mismatch in Replay playback (#1052)
1 parent ecd6507 commit e085a6f

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Generals/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,14 +1042,20 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
10421042
// problem is fixed. -MDC 3/20/2003
10431043
//
10441044
// TheSuperHackers @tweak helmutbuhler 03/04/2025
1045-
// More than 20 years later, but finally fixed and reenabled!
1045+
// More than 20 years later, but finally fixed and re-enabled!
10461046
TheInGameUI->message("GUI:CRCMismatch");
10471047

10481048
// TheSuperHackers @info helmutbuhler 03/04/2025
1049-
// Note: We subtract the queue size from the frame no. This way we calculate the correct frame
1049+
// Note: We subtract the queue size from the frame number. This way we calculate the correct frame
10501050
// the mismatch first happened in case the NetCRCInterval is set to 1 during the game.
1051-
DEBUG_CRASH(("Replay has gone out of sync! All bets are off!\nInGame:%8.8X Replay:%8.8X\nFrame:%d",
1052-
playbackCRC, newCRC, TheGameLogic->getFrame()-m_crcInfo->GetQueueSize()-1));
1051+
const UnsignedInt mismatchFrame = TheGameLogic->getFrame() - m_crcInfo->GetQueueSize() - 1;
1052+
1053+
// Now also prints a UI message for it.
1054+
const UnicodeString mismatchDetailsStr = TheGameText->FETCH_OR_SUBSTITUTE("GUI:CRCMismatchDetails", L"InGame:%8.8X Replay:%8.8X Frame:%d");
1055+
TheInGameUI->message(mismatchDetailsStr, playbackCRC, newCRC, mismatchFrame);
1056+
1057+
DEBUG_LOG(("Replay has gone out of sync!\nInGame:%8.8X Replay:%8.8X\nFrame:%d\n",
1058+
playbackCRC, newCRC, mismatchFrame));
10531059

10541060
// TheSuperHackers @tweak Pause the game on mismatch.
10551061
Bool pause = TRUE;

GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,14 +1045,20 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
10451045
// problem is fixed. -MDC 3/20/2003
10461046
//
10471047
// TheSuperHackers @tweak helmutbuhler 03/04/2025
1048-
// More than 20 years later, but finally fixed and reenabled!
1048+
// More than 20 years later, but finally fixed and re-enabled!
10491049
TheInGameUI->message("GUI:CRCMismatch");
10501050

10511051
// TheSuperHackers @info helmutbuhler 03/04/2025
1052-
// Note: We subtract the queue size from the frame no. This way we calculate the correct frame
1052+
// Note: We subtract the queue size from the frame number. This way we calculate the correct frame
10531053
// the mismatch first happened in case the NetCRCInterval is set to 1 during the game.
1054-
DEBUG_CRASH(("Replay has gone out of sync! All bets are off!\nInGame:%8.8X Replay:%8.8X\nFrame:%d",
1055-
playbackCRC, newCRC, TheGameLogic->getFrame()-m_crcInfo->GetQueueSize()-1));
1054+
const UnsignedInt mismatchFrame = TheGameLogic->getFrame() - m_crcInfo->GetQueueSize() - 1;
1055+
1056+
// Now also prints a UI message for it.
1057+
const UnicodeString mismatchDetailsStr = TheGameText->FETCH_OR_SUBSTITUTE("GUI:CRCMismatchDetails", L"InGame:%8.8X Replay:%8.8X Frame:%d");
1058+
TheInGameUI->message(mismatchDetailsStr, playbackCRC, newCRC, mismatchFrame);
1059+
1060+
DEBUG_LOG(("Replay has gone out of sync!\nInGame:%8.8X Replay:%8.8X\nFrame:%d\n",
1061+
playbackCRC, newCRC, mismatchFrame));
10561062

10571063
// TheSuperHackers @tweak Pause the game on mismatch.
10581064
Bool pause = TRUE;

0 commit comments

Comments
 (0)