Skip to content

Commit 16c50f7

Browse files
authored
[GEN][ZH] Do not pause Replay playback on CRC mismatch if a Game Window has input focus (#1294)
1 parent 8821d8c commit 16c50f7

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,6 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
10451045
// playbackCRC, newCRC, TheGameLogic->getFrame()-m_crcInfo->GetQueueSize()-1, playerIndex));
10461046
if (TheGameLogic->getFrame() > 0 && newCRC != playbackCRC && !m_crcInfo->sawCRCMismatch())
10471047
{
1048-
m_crcInfo->setSawCRCMismatch();
1049-
10501048
// Since we don't seem to have any *visible* desyncs when replaying games, but get this warning
10511049
// virtually every replay, the assumption is our CRC checking is faulty. Since we're at the
10521050
// tail end of patch season, let's just disable the message, and hope the users believe the
@@ -1072,10 +1070,17 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
10721070
printf("CRC Mismatch in Frame %d\n", mismatchFrame);
10731071

10741072
// TheSuperHackers @tweak Pause the game on mismatch.
1075-
Bool pause = TRUE;
1076-
Bool pauseMusic = FALSE;
1077-
Bool pauseInput = FALSE;
1078-
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
1073+
// But not when a window with focus is opened, because that can make resuming difficult.
1074+
if (TheWindowManager->winGetFocus() == NULL)
1075+
{
1076+
Bool pause = TRUE;
1077+
Bool pauseMusic = FALSE;
1078+
Bool pauseInput = FALSE;
1079+
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
1080+
1081+
// Mark this mismatch as seen when we had the chance to pause once.
1082+
m_crcInfo->setSawCRCMismatch();
1083+
}
10791084
}
10801085
return;
10811086
}

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,6 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
10471047
// playbackCRC, newCRC, TheGameLogic->getFrame()-m_crcInfo->GetQueueSize()-1, playerIndex));
10481048
if (TheGameLogic->getFrame() > 0 && newCRC != playbackCRC && !m_crcInfo->sawCRCMismatch())
10491049
{
1050-
m_crcInfo->setSawCRCMismatch();
1051-
10521050
//Kris: Patch 1.01 November 10, 2003 (integrated changes from Matt Campbell)
10531051
// Since we don't seem to have any *visible* desyncs when replaying games, but get this warning
10541052
// virtually every replay, the assumption is our CRC checking is faulty. Since we're at the
@@ -1075,10 +1073,17 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f
10751073
printf("CRC Mismatch in Frame %d\n", mismatchFrame);
10761074

10771075
// TheSuperHackers @tweak Pause the game on mismatch.
1078-
Bool pause = TRUE;
1079-
Bool pauseMusic = FALSE;
1080-
Bool pauseInput = FALSE;
1081-
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
1076+
// But not when a window with focus is opened, because that can make resuming difficult.
1077+
if (TheWindowManager->winGetFocus() == NULL)
1078+
{
1079+
Bool pause = TRUE;
1080+
Bool pauseMusic = FALSE;
1081+
Bool pauseInput = FALSE;
1082+
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
1083+
1084+
// Mark this mismatch as seen when we had the chance to pause once.
1085+
m_crcInfo->setSawCRCMismatch();
1086+
}
10821087
}
10831088
return;
10841089
}

0 commit comments

Comments
 (0)