Skip to content

Commit 3180a44

Browse files
Vaufftilgep
andcommitted
Attempt to fix lag/client crashes with a ParticleManager msg blocker
Co-authored-by: tilgep <tilgep95@gmail.com>
1 parent 612aa57 commit 3180a44

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ cs2f_prevent_using_players 0 // Whether to prevent +use from hitting players (
2424
cs2f_map_steamids_enable 0 // Whether to make Steam ID's available to maps
2525
cs2f_fix_game_bans 0 // Whether to fix CS2 game bans spreading to all new joining players
2626
cs2f_free_armor 0 // Whether kevlar (1+) and/or helmet (2) are given automatically
27+
cs2f_block_particle_msgs 0 // Whether to block CUserMsg_ParticleManager messages to fix lag/crashes, experimental
2728
2829
cs2f_beacon_particle "particles/cs2fixes/admin_beacon.vpcf" // .vpcf file to be precached and used for player beacon
2930
cs2f_motd_url "" // Server MOTD URL, shows up as a "Server Website" button in scoreboard

src/cs2fixes.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ void CS2Fixes::Hook_GameServerSteamAPIActivated()
661661
RETURN_META(MRES_IGNORED);
662662
}
663663

664+
CConVar<bool> g_cvarBlockParticleMsgs("cs2f_block_particle_msgs", FCVAR_NONE, "Whether to block CUserMsg_ParticleManager messages to fix lag/crashes, experimental", false);
665+
664666
void CS2Fixes::Hook_PostEvent(CSplitScreenSlot nSlot, bool bLocalOnly, int nClientCount, const uint64* clients,
665667
INetworkMessageInternal* pEvent, const CNetMessage* pData, unsigned long nSize, NetChannelBufType_t bufType)
666668
{
@@ -789,6 +791,13 @@ void CS2Fixes::Hook_PostEvent(CSplitScreenSlot nSlot, bool bLocalOnly, int nClie
789791
*(uint64*)clients &= ~silenceSoundMask;
790792
}
791793
}
794+
else if (info->m_MessageId == UM_ParticleManager)
795+
{
796+
// These messages were previously unused, but recently started being used for weapon particles in the AG2 update
797+
// Unfortunately, this new system seems extremely unoptimized for 64 players, and was causing severe performance issues & vector overflow client crashes
798+
if (g_cvarBlockParticleMsgs.Get())
799+
*(uint64*)clients = 0;
800+
}
792801
}
793802

794803
void CS2Fixes::AllPluginsLoaded()

0 commit comments

Comments
 (0)