Skip to content

Commit 2e1235a

Browse files
authored
A2S_Rules fix: Move MTU patch value to gamedata (alliedmodders#1829)
* A2S_Rules fix: Move MTU patch value to gamedata and increase it * Revert MTU value back to 5k
1 parent 426c1a0 commit 2e1235a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

extensions/cstrike/rulesfix.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
// Grab the convar ref
3737
ConVar *host_rules_show = nullptr;
3838
bool bPatched = false;
39+
int iPatchSize = -1;
3940

4041
RulesFix rulesfix;
4142

@@ -53,7 +54,7 @@ bool SetMTUMax(int iValue)
5354

5455
//If we never changed skip resetting
5556
if (iOriginalValue == -1 && iValue == -1)
56-
return true;
57+
return false;
5758

5859
if (m_pMaxMTU == nullptr)
5960
{
@@ -77,10 +78,16 @@ bool SetMTUMax(int iValue)
7778

7879
void RulesFix::OnLoad()
7980
{
81+
const char *patchSize = g_pGameConf->GetKeyValue("MTUPatchSize");
82+
if (patchSize != NULL)
83+
{
84+
iPatchSize = atoi(patchSize);
85+
}
86+
8087
host_rules_show = g_pCVar->FindVar("host_rules_show");
8188
if (host_rules_show)
8289
{
83-
if (SetMTUMax(5000))
90+
if (SetMTUMax(iPatchSize))
8491
{
8592
// Default to enabled. Explicit disable via cfg will still be obeyed.
8693
host_rules_show->SetValue(true);
@@ -124,7 +131,7 @@ static void OnConVarChanged(IConVar *var, const char *pOldValue, float flOldValu
124131
{
125132
if (!bPatched)
126133
{
127-
if (SetMTUMax(5000))
134+
if (SetMTUMax(iPatchSize))
128135
{
129136
bPatched = true;
130137
NotifyAllCVars();

gamedata/sm-cstrike.games/game.csgo.txt

+4
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@
267267

268268
"#default"
269269
{
270+
"Keys"
271+
{
272+
"MTUPatchSize" "5000"
273+
}
270274
"Addresses"
271275
{
272276
// Offset from NET_SendPacket sig to MTU

0 commit comments

Comments
 (0)