Skip to content

[GEN][ZH] Do not pause Replay playback on CRC mismatch if a Game Window has input focus #1294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2025
Merged
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
17 changes: 11 additions & 6 deletions Generals/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,6 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
// playbackCRC, newCRC, TheGameLogic->getFrame()-m_crcInfo->GetQueueSize()-1, playerIndex));
if (TheGameLogic->getFrame() > 0 && newCRC != playbackCRC && !m_crcInfo->sawCRCMismatch())
{
m_crcInfo->setSawCRCMismatch();

// Since we don't seem to have any *visible* desyncs when replaying games, but get this warning
// virtually every replay, the assumption is our CRC checking is faulty. Since we're at the
// tail end of patch season, let's just disable the message, and hope the users believe the
Expand All @@ -1072,10 +1070,17 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
printf("CRC Mismatch in Frame %d\n", mismatchFrame);

// TheSuperHackers @tweak Pause the game on mismatch.
Bool pause = TRUE;
Bool pauseMusic = FALSE;
Bool pauseInput = FALSE;
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
// But not when a window with focus is opened, because that can make resuming difficult.
if (TheWindowManager->winGetFocus() == NULL)
Copy link

@Caball009 Caball009 Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would mean that the replay never pauses (if there's a window in focus), even though people probably rely on that with a mismatch.

Maybe put the m_crcInfo->setSawCRCMismatch(); at least in this branch? That way the game will pause as soon as the window closes (may be done with scripts).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Tested and worked. Will spam mismatch message every 100 frames until pausing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine I think as long as it's very unlikely to happen, which seems to be case.

{
Bool pause = TRUE;
Bool pauseMusic = FALSE;
Bool pauseInput = FALSE;
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);

// Mark this mismatch as seen when we had the chance to pause once.
m_crcInfo->setSawCRCMismatch();
}
}
return;
}
Expand Down
17 changes: 11 additions & 6 deletions GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,8 +1047,6 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
// playbackCRC, newCRC, TheGameLogic->getFrame()-m_crcInfo->GetQueueSize()-1, playerIndex));
if (TheGameLogic->getFrame() > 0 && newCRC != playbackCRC && !m_crcInfo->sawCRCMismatch())
{
m_crcInfo->setSawCRCMismatch();

//Kris: Patch 1.01 November 10, 2003 (integrated changes from Matt Campbell)
// Since we don't seem to have any *visible* desyncs when replaying games, but get this warning
// virtually every replay, the assumption is our CRC checking is faulty. Since we're at the
Expand All @@ -1075,10 +1073,17 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
printf("CRC Mismatch in Frame %d\n", mismatchFrame);

// TheSuperHackers @tweak Pause the game on mismatch.
Bool pause = TRUE;
Bool pauseMusic = FALSE;
Bool pauseInput = FALSE;
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
// But not when a window with focus is opened, because that can make resuming difficult.
if (TheWindowManager->winGetFocus() == NULL)
{
Bool pause = TRUE;
Bool pauseMusic = FALSE;
Bool pauseInput = FALSE;
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);

// Mark this mismatch as seen when we had the chance to pause once.
m_crcInfo->setSawCRCMismatch();
}
}
return;
}
Expand Down
Loading