ValidateMpGameMode
0x00504000 · 962 bytes · __cdecl
_ZL18ValidateMpGameModeP7IConVarPKcf
Decompiled
undefined (3 params)
/* ValidateMpGameMode(IConVar*, char const*, float) */
void ValidateMpGameMode(IConVar *param_1,char *param_2,float param_3)
{
char *pcVar1;
int iVar2;
KeyValues *pKVar3;
char *pcVar4;
KeyValues *pKVar5;
char *pcVar6;
char *pcVar7;
int in_GS_OFFSET;
undefined4 *local_48;
int local_44;
char local_40 [32];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
ConVarRef::ConVarRef((ConVarRef *)&local_48,param_1);
pcVar1 = *(char **)(local_44 + 0x24);
if (ValidateMpGameMode(IConVar*,char_const*,float)::bSelfChanging == '\0') {
ValidateMpGameMode(IConVar*,char_const*,float)::bSelfChanging = 1;
iVar2 = (**(code **)(*g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar1);
if (iVar2 == 0) {
Msg("Invalid mp_gamemode value \'%s\', keeping old value \'%s\'.\n",pcVar1,param_2);
(**(code **)*local_48)(local_48,param_2);
}
else {
iVar2 = _V_strlen(pcVar1);
if (0x1f < iVar2) {
Error("Game mode name too long for buffer size\n");
}
V_strncpy(local_40,pcVar1,0x20);
_V_strlower(local_40);
(**(code **)*local_48)(local_48,local_40);
iVar2 = _V_stricmp(local_40,param_2);
if ((iVar2 != 0) &&
(pKVar3 = (KeyValues *)(**(code **)(*g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,param_2),
pKVar3 != (KeyValues *)0x0)) {
pKVar5 = (KeyValues *)KeyValues::FindKey(pKVar3,"convar",false);
if (pKVar5 != (KeyValues *)0x0) {
for (pKVar5 = (KeyValues *)KeyValues::GetFirstValue(pKVar5); pKVar5 != (KeyValues *)0x0;
pKVar5 = (KeyValues *)KeyValues::GetNextValue(pKVar5)) {
pcVar4 = (char *)KeyValues::GetName(pKVar5);
RevertGameModeConvar(param_2,pcVar4);
}
}
pcVar4 = (char *)KeyValues::GetString(pKVar3,"base",(char *)0x0);
if ((((pcVar4 != (char *)0x0) && (param_2 != pcVar4)) &&
(iVar2 = _V_stricmp(pcVar4,param_2), iVar2 != 0)) &&
((pKVar3 = (KeyValues *)(**(code **)(*g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar4),
pKVar3 != (KeyValues *)0x0 &&
(pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar3,"convar",false),
pKVar3 != (KeyValues *)0x0)))) {
for (pKVar3 = (KeyValues *)KeyValues::GetFirstValue(pKVar3); pKVar3 != (KeyValues *)0x0;
pKVar3 = (KeyValues *)KeyValues::GetNextValue(pKVar3)) {
pcVar6 = (char *)KeyValues::GetName(pKVar3);
RevertGameModeConvar(pcVar4,pcVar6);
}
}
}
pKVar3 = (KeyValues *)(**(code **)(*g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar1);
if (pKVar3 != (KeyValues *)0x0) {
pcVar4 = (char *)KeyValues::GetString(pKVar3,"base",(char *)0x0);
if (((pcVar4 != (char *)0x0) && (pcVar4 != pcVar1)) &&
((iVar2 = _V_stricmp(pcVar4,pcVar1), iVar2 != 0 &&
((pKVar5 = (KeyValues *)(**(code **)(*g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar4),
pKVar5 != (KeyValues *)0x0 &&
(pKVar5 = (KeyValues *)KeyValues::FindKey(pKVar5,"convar",false),
pKVar5 != (KeyValues *)0x0)))))) {
for (pKVar5 = (KeyValues *)KeyValues::GetFirstValue(pKVar5); pKVar5 != (KeyValues *)0x0;
pKVar5 = (KeyValues *)KeyValues::GetNextValue(pKVar5)) {
pcVar6 = (char *)KeyValues::GetString(pKVar5,(char *)0x0,"");
pcVar7 = (char *)KeyValues::GetName(pKVar5);
iVar2 = StringAfterPrefix(pcVar7,"360_");
if (iVar2 == 0) {
SetGameModeConvar(pcVar4,pcVar7,pcVar6);
}
}
}
pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar3,"convar",false);
if (pKVar3 != (KeyValues *)0x0) {
for (pKVar3 = (KeyValues *)KeyValues::GetFirstValue(pKVar3); pKVar3 != (KeyValues *)0x0;
pKVar3 = (KeyValues *)KeyValues::GetNextValue(pKVar3)) {
pcVar4 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
pcVar6 = (char *)KeyValues::GetName(pKVar3);
iVar2 = StringAfterPrefix(pcVar6,"360_");
if (iVar2 == 0) {
SetGameModeConvar(pcVar1,pcVar6,pcVar4);
}
}
}
}
}
ValidateMpGameMode(IConVar*,char_const*,float)::bSelfChanging = '\0';
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.