CCvarUtilities::CvarToggle
0x00128e90 · 295 bytes · __thiscall
_ZN14CCvarUtilities10CvarToggleERK8CCommand
Decompiled
undefined (2 params)
/* CCvarUtilities::CvarToggle(CCommand const&) */
void __thiscall CCvarUtilities::CvarToggle(CCvarUtilities *this,CCommand *param_1)
{
int iVar1;
char cVar2;
ConCommandBase *pCVar3;
char *pcVar4;
char *pcVar5;
int iVar6;
undefined1 *puVar7;
int iVar8;
iVar1 = *(int *)param_1;
if (iVar1 < 2) {
ConMsg("Usage: toggle <cvarname> [value1] [value2] [value3]...\n");
return;
}
pCVar3 = (ConCommandBase *)
(**(code **)(*g_pCVar + 0x30))(g_pCVar,*(undefined4 *)(param_1 + 0x40c));
pcVar4 = "";
if (1 < *(int *)param_1) {
pcVar4 = *(char **)(param_1 + 0x40c);
}
cVar2 = IsValidToggleCommand(this,pcVar4);
if (cVar2 == '\0') {
return;
}
iVar8 = 2;
if (iVar1 == 2) {
(**(code **)(*(int *)pCVar3 + 0x44))(pCVar3,*(int *)(*(int *)(pCVar3 + 0x1c) + 0x30) == 0);
}
else {
do {
pcVar4 = "";
if (iVar8 < *(int *)param_1) {
pcVar4 = *(char **)(param_1 + iVar8 * 4 + 0x408);
}
pcVar5 = "FCVAR_NEVER_AS_STRING";
if (((byte)pCVar3[0x15] & 0x10) == 0) {
pcVar5 = "";
if (*(char **)(*(int *)(pCVar3 + 0x1c) + 0x24) != (char *)0x0) {
pcVar5 = *(char **)(*(int *)(pCVar3 + 0x1c) + 0x24);
}
}
iVar6 = _V_strcmp(pcVar5,pcVar4);
} while ((iVar6 != 0) && (iVar8 = iVar8 + 1, iVar8 < iVar1));
iVar8 = iVar8 + 1;
if (iVar1 <= iVar8) {
iVar8 = 2;
}
puVar7 = &DAT_002c79d4;
if (iVar8 < *(int *)param_1) {
puVar7 = *(undefined1 **)(param_1 + iVar8 * 4 + 0x408);
}
(**(code **)(*(int *)pCVar3 + 0x3c))(pCVar3,puVar7);
}
ConVar_PrintDescription(pCVar3);
return;
}
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.