CC_Ent_Dump
0x006091e0 · 1095 bytes · __cdecl
_Z11CC_Ent_DumpRK8CCommand
Decompiled
undefined (1 param)
/* CC_Ent_Dump(CCommand const&) */
void CC_Ent_Dump(CCommand *param_1)
{
bool bVar1;
char cVar2;
CBasePlayer *pCVar3;
char *pcVar4;
int *piVar5;
undefined *puVar6;
int iVar7;
undefined1 *puVar8;
int iVar9;
int iVar10;
int in_GS_OFFSET;
CBaseEntity *local_140;
char *local_134 [3];
uint local_128;
int local_124;
char local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pCVar3 = (CBasePlayer *)UTIL_GetCommandClient();
if ((pCVar3 != (CBasePlayer *)0x0) &&
(cVar2 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3), cVar2 != '\0')) {
bVar1 = false;
local_140 = (CBaseEntity *)0x0;
iVar10 = *(int *)param_1;
if (iVar10 < 2) {
ClientPrint(pCVar3,2,"Usage:\n ent_dump <entity name>\n",(char *)0x0,(char *)0x0,(char *)0x0
,(char *)0x0);
}
else {
while( true ) {
pcVar4 = "";
if (1 < iVar10) {
pcVar4 = *(char **)(param_1 + 0x40c);
}
local_140 = (CBaseEntity *)
CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,local_140,pcVar4,(CBaseEntity *)0x0,
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
if (local_140 == (CBaseEntity *)0x0) break;
for (piVar5 = (int *)(**(code **)(*(int *)local_140 + 0x30))(local_140);
piVar5 != (int *)0x0; piVar5 = (int *)piVar5[3]) {
if (0 < piVar5[1]) {
iVar10 = 0;
do {
while( true ) {
local_124 = 0;
iVar9 = iVar10 * 0x40;
local_134[0] = (char *)0x0;
local_128 = 0xffffffff;
cVar2 = CBaseEntity::ReadKeyField
(local_140,*(char **)(*piVar5 + 0x10 + iVar9),
(variant_t *)local_134);
if (cVar2 != '\0') break;
LAB_0060933e:
iVar10 = iVar10 + 1;
if (piVar5[1] <= iVar10) goto LAB_006094f8;
}
local_120[0] = '\0';
if (local_124 == 2) {
pcVar4 = "";
if (local_134[0] != (char *)0x0) {
pcVar4 = local_134[0];
}
V_strncpy(local_120,pcVar4,0x100);
}
else if (local_124 < 3) {
if ((local_124 == 1) && ((float)local_134[0] != 0.0)) {
V_snprintf(local_120,0x100,"%.2f",(double)(float)local_134[0]);
}
}
else if (local_124 == 5) {
if (local_134[0] != (char *)0x0) {
V_snprintf(local_120,0x100,"%d",local_134[0]);
}
}
else if ((((local_124 == 0xd) && (local_128 != 0xffffffff)) &&
(puVar6 = g_pEntityList + (local_128 & 0xfff) * 0x10,
puVar6 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar6 + 8) == local_128 >> 0xc && (*(int *)(puVar6 + 4) != 0))))
{
puVar6 = g_pEntityList + (local_128 & 0xfff) * 0x10;
if ((puVar6 == (undefined *)0xfffffffc) ||
(*(uint *)(puVar6 + 8) != local_128 >> 0xc)) {
iVar7 = 0;
}
else {
iVar7 = *(int *)(puVar6 + 4);
}
puVar8 = &DAT_00d539c2;
if (*(undefined1 **)(iVar7 + 0x154) != (undefined1 *)0x0) {
puVar8 = *(undefined1 **)(iVar7 + 0x154);
}
V_snprintf(local_120,0x100,"%s",puVar8);
}
iVar7 = _V_stricmp("parentname",*(char **)(*piVar5 + 0x10 + iVar9));
if (((iVar7 == 0) ||
(iVar7 = _V_stricmp("targetname",*(char **)(*piVar5 + 0x10 + iVar9)), iVar7 == 0))
|| (local_120[0] == '\0')) goto LAB_0060933e;
iVar10 = iVar10 + 1;
pcVar4 = (char *)UTIL_VarArgs(" %s: %s\n",*(undefined4 *)(*piVar5 + 0x10 + iVar9),
local_120);
ClientPrint(pCVar3,2,pcVar4,(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
} while (iVar10 < piVar5[1]);
}
LAB_006094f8:
}
bVar1 = true;
iVar10 = *(int *)param_1;
}
if (!bVar1) {
ClientPrint(pCVar3,2,"ent_dump: no such entity",(char *)0x0,(char *)0x0,(char *)0x0,
(char *)0x0);
}
}
}
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.