CDmxElement::UnpackIntoStructure
0x00be7910 · 1103 bytes · __thiscall
_ZNK11CDmxElement19UnpackIntoStructureEPvPK27DmxElementUnpackStructure_t
Decompiled
undefined (3 params)
/* CDmxElement::UnpackIntoStructure(void*, DmxElementUnpackStructure_t const*) const */
void __thiscall
CDmxElement::UnpackIntoStructure
(CDmxElement *this,void *param_1,DmxElementUnpackStructure_t *param_2)
{
ushort uVar1;
CDmxAttribute *pCVar2;
int iVar3;
char *pcVar4;
uint uVar5;
uint uVar6;
byte bVar7;
ushort uVar8;
uint uVar9;
DmxElementUnpackStructure_t *pDVar10;
CUtlString *this_00;
uint local_74;
uint local_70;
CDmxAttribute local_60 [12];
CUtlBuffer local_54 [68];
iVar3 = *(int *)(param_2 + 8);
do {
pDVar10 = param_2;
if (iVar3 == 0) {
return;
}
while( true ) {
this_00 = (CUtlString *)(*(int *)(pDVar10 + 0xc) + (int)param_1);
if (*(DmxElementUnpackStructure_t **)(pDVar10 + 0x24) != (DmxElementUnpackStructure_t *)0x0)
break;
if ((iVar3 - 0xfU < 0xe) || (iVar3 == 6)) goto LAB_00be7943;
CDmxAttribute::CDmxAttribute(local_60,(char *)0x0);
/* try { // try from 00be7985 to 00be7a46 has its CatchHandler @ 00be7d76 */
pCVar2 = (CDmxAttribute *)GetAttribute(this,*(char **)pDVar10);
if (pCVar2 == (CDmxAttribute *)0x0) {
if (*(char **)(pDVar10 + 4) != (char *)0x0) {
iVar3 = _V_strlen(*(char **)(pDVar10 + 4));
if (iVar3 == 0) {
iVar3 = 1;
}
CUtlBuffer::CUtlBuffer(local_54,*(void **)(pDVar10 + 4),iVar3,9);
/* try { // try from 00be7a5b to 00be7a5f has its CatchHandler @ 00be7d8b */
CDmxAttribute::Unserialize(local_60,*(undefined4 *)(pDVar10 + 8),local_54);
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_54);
pCVar2 = local_60;
goto LAB_00be7992;
}
goto switchD_00be7a80_caseD_0;
}
LAB_00be7992:
iVar3 = *(int *)(pDVar10 + 8);
if (iVar3 != *(int *)pCVar2) {
Warning("CDmxElement::UnpackIntoStructure: Mismatched attribute type in attribute \"%s\"!\n"
,*(undefined4 *)pDVar10);
goto switchD_00be7a80_caseD_0;
}
if (iVar3 == 5) {
iVar3 = *(int *)(pDVar10 + 0x10);
if (iVar3 == -1) {
pcVar4 = CUtlString::operator_cast_to_char_(*(CUtlString **)(pCVar2 + 8));
CUtlString::operator=(this_00,pcVar4);
}
else {
/* try { // try from 00be7aa5 to 00be7d0c has its CatchHandler @ 00be7d76 */
pcVar4 = CUtlString::operator_cast_to_char_(*(CUtlString **)(pCVar2 + 8));
V_strncpy((char *)this_00,pcVar4,iVar3);
}
goto switchD_00be7a80_caseD_0;
}
if (iVar3 == 3) {
if (*(int *)(pDVar10 + 0x10) != 0x10) {
if (*(int *)(pDVar10 + 0x14) != -1) goto switchD_00be7a80_caseD_2;
goto LAB_00be7ad2;
}
*(undefined4 *)this_00 = **(undefined4 **)(pCVar2 + 8);
*(undefined4 *)(this_00 + 4) = **(undefined4 **)(pCVar2 + 8);
*(undefined4 *)(this_00 + 8) = **(undefined4 **)(pCVar2 + 8);
*(undefined4 *)(this_00 + 0xc) = **(undefined4 **)(pCVar2 + 8);
goto switchD_00be7a80_caseD_0;
}
if (*(int *)(pDVar10 + 0x14) == -1) {
LAB_00be7ad2:
memcpy(this_00,*(void **)(pCVar2 + 8),*(size_t *)(pDVar10 + 0x10));
goto switchD_00be7a80_caseD_0;
}
if (iVar3 != 2) {
switchD_00be7a80_caseD_2:
UnpackBitfield<char>(this,(char *)this_00,pDVar10,pCVar2);
goto switchD_00be7a80_caseD_0;
}
local_70._0_1_ = (byte)*(int *)(pDVar10 + 0x14);
switch(*(undefined4 *)(pDVar10 + 0x18)) {
case 1:
case 3:
UnpackBitfield<unsigned_char>((uchar *)this_00,pDVar10,*(CDmxAttribute **)(pCVar2 + 8));
break;
case 2:
goto switchD_00be7a80_caseD_2;
case 4:
bVar7 = (byte)*(int *)(pDVar10 + 0x10);
if (*(int *)(pDVar10 + 0x10) == 0x10) {
local_70._0_2_ = 0;
local_74._0_2_ = 0xffff;
}
else {
local_74._0_2_ = (short)(1 << (bVar7 & 0x1f)) - 1;
local_70._0_2_ = ~(ushort)((int)(short)(ushort)local_74 << ((byte)local_70 & 0x1f));
}
uVar1 = **(ushort **)(pCVar2 + 8);
uVar8 = ~((short)(1 << (bVar7 - 1 & 0x1f)) - 1U);
if ((short)uVar1 < 0) {
if (uVar8 == (uVar1 & uVar8)) goto LAB_00be7be1;
LAB_00be7ce2:
Warning("Value %s exeeds size of datatype. \n",*(undefined4 *)pDVar10);
iVar3 = 0;
}
else {
if ((uVar8 & uVar1) != 0) goto LAB_00be7ce2;
LAB_00be7be1:
iVar3 = (int)(short)(uVar1 & (ushort)local_74);
}
uVar1 = *(ushort *)this_00;
*(ushort *)this_00 = (ushort)local_70 & uVar1;
*(ushort *)this_00 =
(ushort)local_70 & uVar1 |
(ushort)(iVar3 << ((byte)*(undefined4 *)(pDVar10 + 0x14) & 0x1f));
break;
case 5:
if (*(int *)(pDVar10 + 0x10) == 0x10) {
uVar6 = 0;
local_70._0_2_ = 0;
local_74._0_2_ = 0xffff;
}
else {
uVar9 = (1 << ((byte)*(int *)(pDVar10 + 0x10) & 0x1f)) - 1;
local_74._0_2_ = (ushort)uVar9;
uVar9 = uVar9 & 0xffff;
uVar6 = ~uVar9;
local_70._0_2_ = ~(ushort)(uVar9 << ((byte)local_70 & 0x1f));
}
if ((**(ushort **)(pCVar2 + 8) & uVar6) == 0) {
uVar6 = (uint)((ushort)local_74 & **(ushort **)(pCVar2 + 8));
}
else {
Warning("Value %s exeeds size of datatype. \n",*(undefined4 *)pDVar10);
uVar6 = 0;
}
uVar1 = *(ushort *)this_00;
*(ushort *)this_00 = (ushort)local_70 & uVar1;
*(ushort *)this_00 =
(ushort)local_70 & uVar1 |
(ushort)(uVar6 << ((byte)*(undefined4 *)(pDVar10 + 0x14) & 0x1f));
break;
case 6:
bVar7 = (byte)*(int *)(pDVar10 + 0x10);
if (*(int *)(pDVar10 + 0x10) == 0x20) {
local_70 = 0;
local_74 = 0xffffffff;
}
else {
local_74 = (1 << (bVar7 & 0x1f)) - 1;
local_70 = ~(local_74 << ((byte)local_70 & 0x1f));
}
uVar6 = **(uint **)(pCVar2 + 8);
uVar9 = ~((1 << (bVar7 - 1 & 0x1f)) - 1U);
if ((int)uVar6 < 0) {
if (uVar9 != (uVar9 & uVar6)) goto LAB_00be7b5b;
}
else if ((uVar9 & uVar6) != 0) {
LAB_00be7b5b:
Warning("Value %s exeeds size of datatype. \n",*(undefined4 *)pDVar10);
uVar6 = 0;
goto LAB_00be7b6f;
}
uVar6 = uVar6 & local_74;
goto LAB_00be7b6f;
case 7:
if (*(int *)(pDVar10 + 0x10) == 0x20) {
local_70 = 0;
uVar6 = **(uint **)(pCVar2 + 8);
}
else {
uVar5 = (1 << ((byte)*(int *)(pDVar10 + 0x10) & 0x1f)) - 1;
local_70 = ~(uVar5 << ((byte)local_70 & 0x1f));
uVar9 = **(uint **)(pCVar2 + 8);
uVar6 = uVar5 & uVar9;
if ((uVar9 & ~uVar5) != 0) goto LAB_00be7b5b;
}
LAB_00be7b6f:
uVar9 = *(uint *)this_00;
*(uint *)this_00 = local_70 & uVar9;
*(uint *)this_00 =
uVar6 << ((byte)*(undefined4 *)(pDVar10 + 0x14) & 0x1f) | local_70 & uVar9;
}
switchD_00be7a80_caseD_0:
CDmxAttribute::~CDmxAttribute(local_60);
iVar3 = *(int *)(pDVar10 + 0x30);
pDVar10 = pDVar10 + 0x28;
if (iVar3 == 0) {
return;
}
}
UnpackIntoStructure(this,this_00,*(DmxElementUnpackStructure_t **)(pDVar10 + 0x24));
LAB_00be7943:
param_2 = pDVar10 + 0x28;
iVar3 = *(int *)(pDVar10 + 0x30);
} 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.