From f4617f1f66f8d183d2e4b9710c3ce143017768af Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 28 Sep 2025 11:49:08 +0200 Subject: [PATCH 1/2] bugfix(network): Fix Network stalling state --- .../Code/GameEngine/Source/GameNetwork/Network.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp index 138c7aa2285..47af9940eea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -207,6 +207,7 @@ class Network : public NetworkInterface __int64 m_nextFrameTime; ///< When did we execute the last frame? For slugging the GameLogic... Bool m_frameDataReady; ///< Is the frame data for the next frame ready to be executed by TheGameLogic? + Bool m_isStalling; // CRC info Bool m_checkCRCsThisFrame; @@ -269,6 +270,7 @@ Network::Network() m_checkCRCsThisFrame = FALSE; m_didSelfSlug = FALSE; m_frameDataReady = FALSE; + m_isStalling = FALSE; m_sawCRCMismatch = FALSE; // @@ -334,6 +336,7 @@ void Network::init() m_lastExecutionFrame = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_lastFrameCompleted = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_frameDataReady = FALSE; + m_isStalling = FALSE; m_didSelfSlug = FALSE; m_localStatus = NETLOCALSTATUS_PREGAME; @@ -692,6 +695,7 @@ void Network::update( void ) // 4. If all commands are there, put that frame's commands on TheCommandList. // m_frameDataReady = FALSE; + m_isStalling = FALSE; #if defined(RTS_DEBUG) if (m_networkOn == FALSE) { @@ -723,6 +727,11 @@ void Network::update( void ) m_frameDataReady = TRUE; // Tell the GameEngine to run the commands for the new frame. } } + else { + __int64 curTime; + QueryPerformanceCounter((LARGE_INTEGER *)&curTime); + m_isStalling = curTime >= m_nextFrameTime; + } } void Network::liteupdate() { @@ -812,9 +821,7 @@ Bool Network::isFrameDataReady() { Bool Network::isStalling() { - __int64 curTime; - QueryPerformanceCounter((LARGE_INTEGER *)&curTime); - return curTime >= m_nextFrameTime; + return m_isStalling; } /** From 12fd38af5e848037237e849e438f10082b6ef169 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:09:23 +0200 Subject: [PATCH 2/2] Replicate in Generals --- .../Code/GameEngine/Source/GameNetwork/Network.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp index a2f47681963..ced611d7a80 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/Network.cpp @@ -207,6 +207,7 @@ class Network : public NetworkInterface __int64 m_nextFrameTime; ///< When did we execute the last frame? For slugging the GameLogic... Bool m_frameDataReady; ///< Is the frame data for the next frame ready to be executed by TheGameLogic? + Bool m_isStalling; // CRC info Bool m_checkCRCsThisFrame; @@ -269,6 +270,7 @@ Network::Network() m_checkCRCsThisFrame = FALSE; m_didSelfSlug = FALSE; m_frameDataReady = FALSE; + m_isStalling = FALSE; m_sawCRCMismatch = FALSE; // @@ -334,6 +336,7 @@ void Network::init() m_lastExecutionFrame = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_lastFrameCompleted = m_runAhead - 1; // subtract 1 since we're starting on frame 0 m_frameDataReady = FALSE; + m_isStalling = FALSE; m_didSelfSlug = FALSE; m_localStatus = NETLOCALSTATUS_PREGAME; @@ -692,6 +695,7 @@ void Network::update( void ) // 4. If all commands are there, put that frame's commands on TheCommandList. // m_frameDataReady = FALSE; + m_isStalling = FALSE; #if defined(RTS_DEBUG) if (m_networkOn == FALSE) { @@ -723,6 +727,11 @@ void Network::update( void ) m_frameDataReady = TRUE; // Tell the GameEngine to run the commands for the new frame. } } + else { + __int64 curTime; + QueryPerformanceCounter((LARGE_INTEGER *)&curTime); + m_isStalling = curTime >= m_nextFrameTime; + } } void Network::liteupdate() { @@ -812,9 +821,7 @@ Bool Network::isFrameDataReady() { Bool Network::isStalling() { - __int64 curTime; - QueryPerformanceCounter((LARGE_INTEGER *)&curTime); - return curTime >= m_nextFrameTime; + return m_isStalling; } /**