diff options
author | oy <tom_adams@web.de> | 2023-06-13 22:19:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-13 22:19:37 +0200 |
commit | 134f0d56f68ae90d876b958dfcfa7a18bb6febd0 (patch) | |
tree | dc08122a669056ddde72f5c03d5b3f2b91582c7b | |
parent | a843326deba1a5f1c91db2fd586d52661e390f15 (diff) | |
parent | f04e6fac4f8bbe33601bb6e5e50b3035da3328be (diff) |
Merge pull request #3129 from Robyt3/dbg_stress-DEBUG-only
Disable dbg_stress in release builds
-rw-r--r-- | src/engine/client/client.cpp | 12 | ||||
-rw-r--r-- | src/engine/client/graphics_threaded.cpp | 2 | ||||
-rw-r--r-- | src/engine/client/sound.cpp | 2 | ||||
-rw-r--r-- | src/engine/shared/config_variables.h | 8 | ||||
-rw-r--r-- | src/game/client/components/controls.cpp | 2 | ||||
-rw-r--r-- | src/game/client/gameclient.cpp | 2 | ||||
-rw-r--r-- | src/game/server/gamecontroller.cpp | 4 |
7 files changed, 27 insertions, 5 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index c4dc21ef2..498008a7b 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1740,6 +1740,7 @@ void CClient::Update() } // STRESS TEST: join the server again +#ifdef CONF_DEBUG if(Config()->m_DbgStress) { static int64 ActionTaken = 0; @@ -1763,6 +1764,7 @@ void CClient::Update() } } } +#endif // pump the network PumpNetwork(); @@ -2130,7 +2132,9 @@ void CClient::Run() m_LastRenderTime = Now; // when we are stress testing only render every 10th frame - if(!Config()->m_DbgStress || (m_RenderFrames%10) == 0 ) +#ifdef CONF_DEBUG + if(!Config()->m_DbgStress || (m_RenderFrames%10) == 0) +#endif { Render(); m_pGraphics->Swap(); @@ -2147,8 +2151,12 @@ void CClient::Run() // beNice if(Config()->m_ClCpuThrottle) thread_sleep(Config()->m_ClCpuThrottle); - else if(Config()->m_DbgStress || !m_pGraphics->WindowActive()) + else if(!m_pGraphics->WindowActive()) thread_sleep(5); +#ifdef CONF_DEBUG + else if(Config()->m_DbgStress) + thread_sleep(5); +#endif if(Config()->m_DbgHitch) { diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index 266e67534..00be6121c 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -322,8 +322,10 @@ int CGraphics_Threaded::LoadTextureRawSub(CTextureHandle TextureID, int x, int y IGraphics::CTextureHandle CGraphics_Threaded::LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags) { // don't waste memory on texture if we are stress testing +#ifdef CONF_DEBUG if(m_pConfig->m_DbgStress) return m_InvalidTexture; +#endif // grab texture int Tex = m_FirstFreeTexture; diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index 6b1dbcbd8..9f59a6c2f 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -373,8 +373,10 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename) WavpackContext *pContext; // don't waste memory on sound when we are stress testing +#ifdef CONF_DEBUG if(m_pConfig->m_DbgStress) return CSampleHandle(); +#endif // no need to load sound when we are running with no sound if(!m_SoundEnabled) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 55204ff36..125a83983 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -109,12 +109,14 @@ MACRO_CONFIG_INT(EcOutputLevel, ec_output_level, 1, 0, 2, CFGFLAG_SAVE|CFGFLAG_E MACRO_CONFIG_INT(NetTcpAbortOnClose, net_tcp_abort_on_close, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_SERVER|CFGFLAG_ECON, "Aborts tcp connection on close") MACRO_CONFIG_INT(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode") -MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems") -MACRO_CONFIG_INT(DbgStressNetwork, dbg_stress_network, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress network") MACRO_CONFIG_INT(DbgPref, dbg_pref, 0, 0, 1, CFGFLAG_SERVER, "Performance outputs") MACRO_CONFIG_INT(DbgGraphs, dbg_graphs, 0, 0, 1, CFGFLAG_CLIENT, "Performance graphs") MACRO_CONFIG_INT(DbgHitch, dbg_hitch, 0, 0, 0, CFGFLAG_SERVER, "Hitch warnings") -MACRO_CONFIG_STR(DbgStressServer, dbg_stress_server, 32, "localhost", CFGFLAG_CLIENT, "Server to stress") MACRO_CONFIG_INT(DbgResizable, dbg_resizable, 0, 0, 0, CFGFLAG_CLIENT, "Enables window resizing") +#ifdef CONF_DEBUG +MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems") +MACRO_CONFIG_INT(DbgStressNetwork, dbg_stress_network, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress network") +MACRO_CONFIG_STR(DbgStressServer, dbg_stress_server, 32, "localhost", CFGFLAG_CLIENT, "Server to stress") +#endif #endif diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index c04e20283..9669aed16 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -155,6 +155,7 @@ int CControls::SnapInput(int *pData) m_InputData.m_Direction = 1; // stress testing +#ifdef CONF_DEBUG if(Config()->m_DbgStress) { float t = Client()->LocalTime(); @@ -168,6 +169,7 @@ int CControls::SnapInput(int *pData) m_InputData.m_TargetX = (int)(sinf(t*3)*100.0f); m_InputData.m_TargetY = (int)(cosf(t*3)*100.0f); } +#endif // check if we need to send input if(m_InputData.m_Direction != m_LastData.m_Direction) Send = true; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 4ad3ba263..897740b89 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1161,6 +1161,7 @@ void CGameClient::OnNewSnapshot() ProcessEvents(); +#ifdef CONF_DEBUG if(Config()->m_DbgStress) { if((Client()->GameTick()%100) == 0) @@ -1178,6 +1179,7 @@ void CGameClient::OnNewSnapshot() Client()->SendPackMsg(&Msg, MSGFLAG_VITAL); } } +#endif CTuningParams StandardTuning; if(Client()->State() == IClient::STATE_DEMOPLAYBACK) diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index 8b104ca00..6ac1bcda3 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -1188,8 +1188,12 @@ int IGameController::GetStartTeam() int Team = TEAM_RED; if(IsTeamplay()) { +#ifdef CONF_DEBUG if(!Config()->m_DbgStress) // this will force the auto balancer to work overtime aswell +#endif + { Team = m_aTeamSize[TEAM_RED] > m_aTeamSize[TEAM_BLUE] ? TEAM_BLUE : TEAM_RED; + } } // check if there're enough player slots left |