ReadDMXHeader
0x00be9270 · 956 bytes · __cdecl
_Z13ReadDMXHeaderR10CUtlBufferPciRiS1_iS2_
Decompiled
undefined (7 params)
/* ReadDMXHeader(CUtlBuffer&, char*, int, int&, char*, int, int&) */
undefined4
ReadDMXHeader(CUtlBuffer *param_1,char *param_2,int param_3,int *param_4,char *param_5,int param_6,
int *param_7)
{
CUtlBuffer CVar1;
char cVar2;
undefined4 uVar3;
int iVar4;
char *pcVar5;
bool bVar6;
int iVar7;
int in_GS_OFFSET;
bool bVar8;
byte bVar9;
bool local_21f;
char local_218 [168];
char local_170 [168];
char local_c8 [168];
int local_20;
bVar9 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
bVar6 = (bool)((byte)param_1[0x15] & 1);
bVar8 = ((byte)param_1[0x15] & 5) == 5;
CUtlBuffer::SetBufferType(param_1,true,(bool)(bVar6 ^ 1U | bVar8));
pcVar5 = local_218;
for (iVar7 = 0x2a; iVar7 != 0; iVar7 = iVar7 + -1) {
pcVar5[0] = '\0';
pcVar5[1] = '\0';
pcVar5[2] = '\0';
pcVar5[3] = '\0';
pcVar5 = pcVar5 + ((uint)bVar9 * -2 + 1) * 4;
}
cVar2 = CUtlBuffer::ParseToken(param_1,"<!-- dmx","-->",local_218,0xa8);
if (cVar2 == '\0') {
LAB_00be9340:
CUtlBuffer::SeekGet(param_1,0,0);
cVar2 = CUtlBuffer::ParseToken(param_1,"<!-- DMXVersion","-->",param_5,param_6);
if (cVar2 == '\0') {
LAB_00be9389:
CUtlBuffer::SetBufferType(param_1,bVar6,bVar8);
}
else {
*param_4 = 0;
*param_7 = 0;
iVar7 = _V_stricmp(param_5,"binary_v1");
if ((iVar7 == 0) || (iVar7 = _V_stricmp(param_5,"binary_v2"), iVar7 == 0)) {
V_strncpy(param_2,"binary",param_3);
local_21f = (bool)(bVar6 ^ 1U);
}
else {
iVar7 = _V_stricmp(param_5,"keyvalues2_v1");
if ((iVar7 != 0) && (iVar7 = _V_stricmp(param_5,"keyvalues2_flat_v1"), iVar7 != 0))
goto LAB_00be9389;
V_strncpy(param_2,"keyvalues2",param_3);
local_21f = bVar6;
}
CUtlBuffer::SetBufferType(param_1,bVar6,bVar8);
if (local_21f != false) {
CVar1 = param_1[0x14];
goto joined_r0x00be95a7;
}
}
}
else {
pcVar5 = local_170;
for (iVar7 = 0x2a; iVar7 != 0; iVar7 = iVar7 + -1) {
pcVar5[0] = '\0';
pcVar5[1] = '\0';
pcVar5[2] = '\0';
pcVar5[3] = '\0';
pcVar5 = pcVar5 + ((uint)bVar9 * -2 + 1) * 4;
}
pcVar5 = local_c8;
for (iVar7 = 0x2a; iVar7 != 0; iVar7 = iVar7 + -1) {
pcVar5[0] = '\0';
pcVar5[1] = '\0';
pcVar5[2] = '\0';
pcVar5[3] = '\0';
pcVar5 = pcVar5 + ((uint)bVar9 * -2 + 1) * 4;
}
iVar7 = sscanf(local_218,"encoding %s %d format %s %d\n",local_170,param_4,local_c8,param_7);
iVar4 = _V_strlen(local_170);
if ((param_3 <= iVar4) || (iVar4 = _V_strlen(local_c8), param_6 <= iVar4)) {
V_strncpy(param_2,local_170,param_3);
V_strncpy(param_5,local_c8,param_6);
goto LAB_00be9340;
}
V_strncpy(param_2,local_170,param_3);
V_strncpy(param_5,local_c8,param_6);
if (iVar7 != 4) goto LAB_00be9340;
pcVar5 = "keyvalues2";
if (bVar6 == false) {
pcVar5 = "binary";
}
iVar7 = _V_stricmp(param_2,pcVar5);
if (iVar7 != 0) goto LAB_00be9340;
CUtlBuffer::SetBufferType(param_1,bVar6,bVar8);
CVar1 = param_1[0x14];
joined_r0x00be95a7:
uVar3 = 1;
if (CVar1 == (CUtlBuffer)0x0) goto LAB_00be93a9;
}
uVar3 = 0;
LAB_00be93a9:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar3;
}
/* 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.