KeyValues::UnpackIntoStructure
0x00250ae0 · 814 bytes · __thiscall
_ZN9KeyValues19UnpackIntoStructureEPK24KeyValuesUnpackStructurePv
Decompiled
undefined (3 params)
/* KeyValues::UnpackIntoStructure(KeyValuesUnpackStructure const*, void*) */
void __thiscall
KeyValues::UnpackIntoStructure(KeyValues *this,KeyValuesUnpackStructure *param_1,void *param_2)
{
size_t __n;
int iVar1;
float fVar2;
char *pcVar3;
float *__dest;
int in_GS_OFFSET;
longdouble lVar4;
float fVar5;
float fVar6;
double dVar7;
uint local_30 [3];
undefined1 local_24;
undefined1 local_23;
undefined1 local_22;
undefined1 local_21;
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pcVar3 = *(char **)param_1;
while (pcVar3 != (char *)0x0) {
__dest = (float *)((int)param_2 + *(int *)(param_1 + 0xc));
iVar1 = FindKey(this,pcVar3,false);
switch(*(undefined4 *)(param_1 + 8)) {
case 0:
fVar2 = 0.0;
if (*(char **)(param_1 + 4) != (char *)0x0) {
dVar7 = strtod(*(char **)(param_1 + 4),(char **)0x0);
fVar2 = (float)dVar7;
}
lVar4 = (longdouble)GetFloat(this,*(char **)param_1,fVar2);
*__dest = (float)lVar4;
break;
case 1:
pcVar3 = (char *)GetString(this,*(char **)param_1,*(char **)(param_1 + 4));
if ((pcVar3 == (char *)0x0) ||
(iVar1 = sscanf(pcVar3,"%f %f %f",__dest,__dest + 1,__dest + 2), iVar1 != 3)) {
*__dest = 0.0;
__dest[1] = 0.0;
__dest[2] = 0.0;
}
break;
case 2:
if (iVar1 == 0) {
if (*(char **)(param_1 + 4) == (char *)0x0) {
fVar6 = 0.0;
fVar5 = 0.0;
fVar2 = fVar6;
}
else {
sscanf(*(char **)(param_1 + 4),"%f %f %f",__dest,__dest + 1,__dest + 2);
fVar6 = __dest[1] * 0.003921569;
fVar5 = __dest[2] * 0.003921569;
fVar2 = *__dest * 0.003921569;
}
}
else {
local_24 = 0;
local_23 = 0;
local_22 = 0;
local_21 = 0;
GetColor((char *)local_30,(Color *)this);
fVar6 = (float)(local_30[0] >> 8 & 0xff) * 0.003921569;
fVar5 = (float)(local_30[0] >> 0x10 & 0xff) * 0.003921569;
fVar2 = (float)(local_30[0] & 0xff) * 0.003921569;
}
*__dest = fVar2;
__dest[1] = fVar6;
__dest[2] = fVar5;
break;
case 3:
pcVar3 = *(char **)(param_1 + 4);
if (pcVar3 == (char *)0x0) {
pcVar3 = "";
}
__n = *(size_t *)(param_1 + 0x10);
pcVar3 = (char *)GetString(this,*(char **)param_1,pcVar3);
strncpy((char *)__dest,pcVar3,__n);
break;
case 4:
iVar1 = 0;
if (*(char **)(param_1 + 4) != (char *)0x0) {
iVar1 = strtol(*(char **)(param_1 + 4),(char **)0x0,10);
}
fVar2 = (float)GetInt(this,*(char **)param_1,iVar1);
*__dest = fVar2;
break;
case 5:
pcVar3 = (char *)GetString(this,*(char **)param_1,*(char **)(param_1 + 4));
if ((pcVar3 == (char *)0x0) ||
(iVar1 = sscanf(pcVar3,"%f %f %f %f",__dest,__dest + 1,__dest + 2,__dest + 3), iVar1 != 4))
{
*__dest = 0.0;
__dest[1] = 0.0;
__dest[2] = 0.0;
__dest[3] = 0.0;
}
break;
case 6:
pcVar3 = (char *)GetString(this,*(char **)param_1,*(char **)(param_1 + 4));
if ((pcVar3 == (char *)0x0) || (iVar1 = sscanf(pcVar3,"%f %f",__dest,__dest + 1), iVar1 != 2))
{
*__dest = 0.0;
__dest[1] = 0.0;
}
}
param_1 = param_1 + 0x14;
pcVar3 = *(char **)param_1;
}
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.