CCvarUtilities::IsCommand
0x00128680 · 757 bytes · __thiscall
_ZN14CCvarUtilities9IsCommandERK8CCommandi
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CCvarUtilities::IsCommand(CCommand const&, int) */
undefined4 __thiscall CCvarUtilities::IsCommand(CCvarUtilities *this,CCommand *param_1,int param_2)
{
CCommand CVar1;
char cVar2;
ConCommandBase *pCVar3;
int iVar4;
char *pcVar5;
undefined4 uVar6;
CCommand *pCVar7;
undefined1 *puVar8;
undefined4 uVar9;
int in_GS_OFFSET;
char acStack_421 [1025];
int local_20;
iVar4 = *(int *)param_1;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (iVar4 != 0) {
puVar8 = &DAT_002c79d4;
if (0 < iVar4) {
puVar8 = *(undefined1 **)(param_1 + 0x408);
}
pCVar3 = (ConCommandBase *)(**(code **)(*g_pCVar + 0x30))(g_pCVar,puVar8);
if (pCVar3 != (ConCommandBase *)0x0) {
if ((0 < param_2) &&
(cVar2 = (**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,0x8000), cVar2 != '\0')) {
puVar8 = &DAT_002c79d4;
if (0 < *(int *)param_1) {
puVar8 = *(undefined1 **)(param_1 + 0x408);
}
V_snprintf(acStack_421 + 1,0x200,"%s%d",puVar8,param_2 + 1);
pCVar3 = (ConCommandBase *)(**(code **)(*g_pCVar + 0x30))(g_pCVar,acStack_421 + 1);
if (pCVar3 == (ConCommandBase *)0x0) goto LAB_00128747;
}
cVar2 = (**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,2);
if (cVar2 == '\0') {
if (iVar4 == 1) {
ConVar_PrintDescription(pCVar3);
uVar9 = 1;
goto LAB_00128749;
}
(**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,0x40);
(**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,0x400000);
uVar9 = (**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,0x4000);
if (((char)uVar9 != '\0') && (cVar2 = Host_IsSinglePlayerGame(), cVar2 == '\0')) {
cVar2 = ConVar::IsFlagSet((ConVar *)sv_hosting_lobby,2);
if (cVar2 == '\0') {
puVar8 = sv_cheats;
LAB_001288f7:
if (*(int *)(*(int *)(puVar8 + 0x1c) + 0x30) != 0) goto LAB_001287c7;
}
else {
if ((g_pMatchFramework == (int *)0x0) ||
(iVar4 = (**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework), iVar4 == 0)) {
puVar8 = sv_cheats;
}
else {
puVar8 = (undefined1 *)0x0;
}
if (((DAT_003b80d0 == 0 && _DAT_003b80cc == 0) &&
(*(int *)(sv_hosting_lobby._28_4_ + 0x30) == 0)) && (puVar8 != (undefined1 *)0x0))
goto LAB_001288f7;
}
cVar2 = Cmd_IsRptActive();
if (cVar2 == '\0') {
uVar6 = (**(code **)(*(int *)pCVar3 + 0x1c))(pCVar3);
ConMsg("Can\'t use cheat cvar %s in multiplayer, unless the server has sv_cheats set to 1.\n"
,uVar6);
goto LAB_00128749;
}
}
LAB_001287c7:
(**(code **)(*(int *)pCVar3 + 0xc))(pCVar3,0x2000);
pCVar7 = (CCommand *)&DAT_002c79d4;
if (*(int *)(param_1 + 4) != 0) {
pCVar7 = param_1 + *(int *)(param_1 + 4) + 8;
}
iVar4 = _V_strlen((char *)pCVar7);
CVar1 = *pCVar7;
if (CVar1 == (CCommand)0x22) {
iVar4 = iVar4 + -1;
V_strncpy(acStack_421 + 1,(char *)(pCVar7 + 1),0x400);
}
else {
pCVar7 = (CCommand *)&DAT_002c79d4;
if (*(int *)(param_1 + 4) != 0) {
pCVar7 = param_1 + *(int *)(param_1 + 4) + 8;
}
V_strncpy(acStack_421 + 1,(char *)pCVar7,0x400);
}
for (pcVar5 = acStack_421 + iVar4; acStack_421 + 1 <= pcVar5; pcVar5 = pcVar5 + -1) {
if (' ' < *pcVar5) {
if ((CVar1 == (CCommand)0x22) && (*pcVar5 == '\"')) {
*pcVar5 = '\0';
}
break;
}
*pcVar5 = '\0';
}
uVar9 = 1;
SetDirect(this,(ConVar *)pCVar3,acStack_421 + 1);
goto LAB_00128749;
}
}
}
LAB_00128747:
uVar9 = 0;
LAB_00128749:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar9;
}
/* 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.