Skip to content
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
3 changes: 2 additions & 1 deletion Generals/Code/GameEngine/Include/GameLogic/GameLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ class GameLogic : public SubsystemInterface, public Snapshot

// CRC cache system -----------------------------------------------------------------------------
UnsignedInt m_CRC; ///< Cache of previous CRC value
std::map<Int, UnsignedInt> m_cachedCRCs; ///< CRCs we've seen this frame
typedef std::map<Int, UnsignedInt> CachedCRCMap;
CachedCRCMap m_cachedCRCs; ///< CRCs we've seen this frame
Bool m_shouldValidateCRCs; ///< Should we validate CRCs this frame?
//-----------------------------------------------------------------------------------------------
//Bool m_loadingScene;
Expand Down
29 changes: 20 additions & 9 deletions Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2338,15 +2338,26 @@ void GameLogic::processCommandList( CommandList *list )
}
else
{
//DEBUG_LOG(("Comparing %d CRCs on frame %d", m_cachedCRCs.size(), m_frame));
std::map<Int, UnsignedInt>::const_iterator crcIt = m_cachedCRCs.begin();
Int validatorCRC = crcIt->second;
//DEBUG_LOG(("Validator CRC from player %d is %8.8X", crcIt->first, validatorCRC));
while (++crcIt != m_cachedCRCs.end())
Bool hasReferenceCRC = FALSE;
UnsignedInt referenceCRC = 0;

for (CachedCRCMap::const_iterator it = m_cachedCRCs.begin(); it != m_cachedCRCs.end(); ++it)
{
Int validatedCRC = crcIt->second;
//DEBUG_LOG(("CRC to validate is from player %d: %8.8X", crcIt->first, validatedCRC));
if (validatorCRC != validatedCRC)
// TheSuperHackers @bugfix Caball009 14/06/2026 Check if player is still connected,
// to avoid spurious mismatches at low CRC intervals, e.g. every frame.
if (!TheNetwork->isPlayerConnected(it->first))
continue;

const UnsignedInt crc = it->second;

if (!hasReferenceCRC)
{
hasReferenceCRC = TRUE;
referenceCRC = crc;
continue;
}

if (referenceCRC != crc)
{
DEBUG_CRASH(("CRC mismatch!"));
sawCRCMismatch = TRUE;
Expand All @@ -2359,7 +2370,7 @@ void GameLogic::processCommandList( CommandList *list )
{
#ifdef DEBUG_LOGGING
DEBUG_LOG(("CRC Mismatch - saw %d CRCs from %d players", m_cachedCRCs.size(), numPlayers));
for (std::map<Int, UnsignedInt>::const_iterator crcIt = m_cachedCRCs.begin(); crcIt != m_cachedCRCs.end(); ++crcIt)
for (CachedCRCMap::const_iterator crcIt = m_cachedCRCs.begin(); crcIt != m_cachedCRCs.end(); ++crcIt)
{
Player *player = ThePlayerList->getNthPlayer(crcIt->first);
DEBUG_LOG(("CRC from player %d (%ls) = %X", crcIt->first,
Expand Down
3 changes: 2 additions & 1 deletion GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ class GameLogic : public SubsystemInterface, public Snapshot

// CRC cache system -----------------------------------------------------------------------------
UnsignedInt m_CRC; ///< Cache of previous CRC value
std::map<Int, UnsignedInt> m_cachedCRCs; ///< CRCs we've seen this frame
typedef std::map<Int, UnsignedInt> CachedCRCMap;
CachedCRCMap m_cachedCRCs; ///< CRCs we've seen this frame
Bool m_shouldValidateCRCs; ///< Should we validate CRCs this frame?
//-----------------------------------------------------------------------------------------------
//Bool m_loadingScene;
Expand Down
29 changes: 20 additions & 9 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2664,15 +2664,26 @@ void GameLogic::processCommandList( CommandList *list )
}
else
{
//DEBUG_LOG(("Comparing %d CRCs on frame %d", m_cachedCRCs.size(), m_frame));
std::map<Int, UnsignedInt>::const_iterator crcIt = m_cachedCRCs.begin();
Int validatorCRC = crcIt->second;
//DEBUG_LOG(("Validator CRC from player %d is %8.8X", crcIt->first, validatorCRC));
while (++crcIt != m_cachedCRCs.end())
Bool hasReferenceCRC = FALSE;
UnsignedInt referenceCRC = 0;

for (CachedCRCMap::const_iterator it = m_cachedCRCs.begin(); it != m_cachedCRCs.end(); ++it)
{
Int validatedCRC = crcIt->second;
//DEBUG_LOG(("CRC to validate is from player %d: %8.8X", crcIt->first, validatedCRC));
if (validatorCRC != validatedCRC)
// TheSuperHackers @bugfix Caball009 14/06/2026 Check if player is still connected,
Comment thread
xezon marked this conversation as resolved.
// to avoid spurious mismatches at low CRC intervals, e.g. every frame.
if (!TheNetwork->isPlayerConnected(it->first))
Comment thread
xezon marked this conversation as resolved.
continue;
Comment thread
Caball009 marked this conversation as resolved.

const UnsignedInt crc = it->second;

if (!hasReferenceCRC)
{
hasReferenceCRC = TRUE;
referenceCRC = crc;
continue;
}

if (referenceCRC != crc)
{
DEBUG_CRASH(("CRC mismatch!"));
sawCRCMismatch = TRUE;
Expand All @@ -2685,7 +2696,7 @@ void GameLogic::processCommandList( CommandList *list )
{
#ifdef DEBUG_LOGGING
DEBUG_LOG(("CRC Mismatch - saw %d CRCs from %d players", m_cachedCRCs.size(), numPlayers));
for (std::map<Int, UnsignedInt>::const_iterator crcIt = m_cachedCRCs.begin(); crcIt != m_cachedCRCs.end(); ++crcIt)
for (CachedCRCMap::const_iterator crcIt = m_cachedCRCs.begin(); crcIt != m_cachedCRCs.end(); ++crcIt)
{
Player *player = ThePlayerList->getNthPlayer(crcIt->first);
DEBUG_LOG(("CRC from player %d (%ls) = %X", crcIt->first,
Expand Down
Loading