CCommandBuffer::AddText
0x002465c0 · 402 bytes · __thiscall
_ZN14CCommandBuffer7AddTextEPKci
Decompiled
undefined (3 params)
/* CCommandBuffer::AddText(char const*, int) */
undefined4 __thiscall CCommandBuffer::AddText(CCommandBuffer *this,char *param_1,int param_2)
{
int iVar1;
undefined4 *puVar2;
int iVar3;
int iVar4;
int iVar5;
undefined4 uVar6;
undefined4 *puVar7;
undefined4 *puVar8;
char *pcVar9;
int in_GS_OFFSET;
uint local_64;
int local_60;
int local_5c;
undefined1 local_58 [56];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar3 = _V_strlen(param_1);
param_2 = param_2 + *(int *)(this + 0x2034);
puVar2 = (undefined4 *)&stack0xffffff74;
do {
if (iVar3 < 1) {
uVar6 = 1;
puVar8 = puVar2;
LAB_00246745:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar6;
}
/* WARNING: Subroutine does not return */
puVar8[-1] = &LAB_0024675e;
__stack_chk_fail();
}
puVar2[2] = iVar3;
puVar2[4] = &local_64;
puVar2[3] = &local_60;
puVar2[1] = param_1;
*puVar2 = this;
puVar2[-1] = 0x246677;
GetNextCommandLength
((CCommandBuffer *)*puVar2,(char *)puVar2[1],puVar2[2],(int *)puVar2[3],
(int *)puVar2[4]);
puVar7 = puVar2;
if (0 < local_60) {
iVar1 = -((local_60 + 0x10U & 0xfffffff0) + 0x10);
puVar8 = (undefined4 *)((int)puVar2 + iVar1);
puVar7 = (undefined4 *)((int)puVar2 + iVar1);
*(int *)((int)puVar2 + iVar1 + 8) = local_60;
*(undefined1 **)((int)puVar2 + iVar1) = local_58;
pcVar9 = (char *)((int)puVar2 + iVar1 + 0x23 & 0xfffffff0);
*(undefined4 *)((int)puVar2 + iVar1 + 0xc) = 9;
*(char **)((int)puVar2 + iVar1 + 4) = param_1;
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x2466ab;
CUtlBuffer::CUtlBuffer
(*(CUtlBuffer **)((int)puVar2 + iVar1),*(void **)((int)puVar2 + iVar1 + 4),
*(int *)((int)puVar2 + iVar1 + 8),*(int *)((int)puVar2 + iVar1 + 0xc));
*(char **)((int)puVar2 + iVar1 + 8) = pcVar9;
*(int **)((int)puVar2 + iVar1 + 0x10) = &local_5c;
*(int *)((int)puVar2 + iVar1 + 0xc) = local_60 + 1;
*(undefined1 **)((int)puVar2 + iVar1 + 4) = local_58;
*(CCommandBuffer **)((int)puVar2 + iVar1) = this;
/* try { // try from 002466cd to 0024670f has its CatchHandler @ 0024675e */
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x2466d2;
ParseArgV0(*(CCommandBuffer **)((int)puVar2 + iVar1),*(CUtlBuffer **)((int)puVar2 + iVar1 + 4)
,*(char **)((int)puVar2 + iVar1 + 8),*(int *)((int)puVar2 + iVar1 + 0xc),
*(char ***)((int)puVar2 + iVar1 + 0x10));
if (*pcVar9 != '\0') {
*(undefined **)((int)puVar2 + iVar1 + 4) = &DAT_002cb6fe;
*(char **)((int)puVar2 + iVar1) = pcVar9;
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x2466eb;
iVar5 = _V_stricmp(*(char **)((int)puVar2 + iVar1),*(char **)((int)puVar2 + iVar1 + 4));
iVar4 = local_5c;
if ((iVar5 == 0) && (this[0x2049] != (CCommandBuffer)0x0)) {
if (local_5c == 0) {
iVar4 = *(int *)(this + 0x203c);
}
else {
*(undefined4 *)((int)puVar2 + iVar1 + 8) = 10;
*(undefined4 *)((int)puVar2 + iVar1 + 4) = 0;
*(int *)((int)puVar2 + iVar1) = iVar4;
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x246633;
iVar4 = strtol(*(char **)((int)puVar2 + iVar1),*(char ***)((int)puVar2 + iVar1 + 4),
*(int *)((int)puVar2 + iVar1 + 8));
}
param_2 = param_2 + iVar4;
}
else {
*(char **)((int)puVar2 + iVar1 + 4) = param_1;
*(int *)((int)puVar2 + iVar1 + 0xc) = param_2;
*(int *)((int)puVar2 + iVar1 + 8) = local_60;
*(CCommandBuffer **)((int)puVar2 + iVar1) = this;
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x246710;
uVar6 = InsertCommand(*(CCommandBuffer **)((int)puVar2 + iVar1),
*(char **)((int)puVar2 + iVar1 + 4),
*(int *)((int)puVar2 + iVar1 + 8),
*(int *)((int)puVar2 + iVar1 + 0xc));
if ((char)uVar6 == '\0') {
*(undefined1 **)((int)puVar2 + iVar1) = local_58;
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x246726;
CUtlMemory<unsigned_char,int>::Purge
(*(CUtlMemory<unsigned_char,int> **)((int)puVar2 + iVar1));
goto LAB_00246745;
}
}
}
*(undefined1 **)((int)puVar2 + iVar1) = local_58;
*(undefined4 *)((int)puVar2 + iVar1 + -4) = 0x246641;
CUtlMemory<unsigned_char,int>::Purge(*(CUtlMemory<unsigned_char,int> **)((int)puVar2 + iVar1))
;
}
param_1 = param_1 + local_64 + 1;
iVar3 = iVar3 + ~local_64;
puVar2 = puVar7;
} while( true );
}
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.