ParseKeyvalue
0x0080e420 · 674 bytes · __cdecl
_Z13ParseKeyvaluePvP17typedescription_tiPKcS3_
Decompiled
undefined (5 params)
/* ParseKeyvalue(void*, typedescription_t*, int, char const*, char const*) */
undefined4
ParseKeyvalue(void *param_1,typedescription_t *param_2,int param_3,char *param_4,char *param_5)
{
int iVar1;
undefined4 uVar2;
int iVar3;
long lVar4;
int iVar5;
undefined4 *puVar6;
double dVar7;
undefined4 local_30 [2];
int local_28;
void *local_24;
typedescription_t *local_20;
if (0 < param_3) {
iVar5 = 0;
do {
iVar1 = *(int *)(param_2 + 8);
if (((*(int *)param_2 == 10) && (*(short *)(param_2 + 0xc) == 1)) &&
(puVar6 = *(undefined4 **)(param_2 + 0x20), puVar6 != (undefined4 *)0x0)) {
do {
uVar2 = ParseKeyvalue((void *)(iVar1 + (int)param_1),(typedescription_t *)*puVar6,
puVar6[1],param_4,param_5);
if ((char)uVar2 != '\0') {
return uVar2;
}
puVar6 = (undefined4 *)puVar6[3];
} while (puVar6 != (undefined4 *)0x0);
}
if ((((byte)param_2[0xe] & 4) != 0) &&
(iVar3 = _V_stricmp(*(char **)(param_2 + 0x10),param_4), iVar3 == 0)) {
switch(*(int *)param_2) {
default:
Warning("Bad field in entity!!\n");
goto LAB_0080e446;
case 1:
case 0x10:
dVar7 = strtod(param_5,(char **)0x0);
*(float *)(iVar1 + (int)param_1) = (float)dVar7;
return 1;
case 2:
case 0x12:
case 0x13:
AllocPooledString((char *)local_30);
*(undefined4 *)((int)param_1 + iVar1) = local_30[0];
return 1;
case 3:
case 0xf:
UTIL_StringToVector((float *)(iVar1 + (int)param_1),param_5);
return 1;
case 5:
case 0x11:
lVar4 = strtol(param_5,(char **)0x0,10);
*(long *)(iVar1 + (int)param_1) = lVar4;
return 1;
case 6:
lVar4 = strtol(param_5,(char **)0x0,10);
*(bool *)(iVar1 + (int)param_1) = lVar4 != 0;
return 1;
case 7:
lVar4 = strtol(param_5,(char **)0x0,10);
*(short *)(iVar1 + (int)param_1) = (short)lVar4;
return 1;
case 8:
lVar4 = strtol(param_5,(char **)0x0,10);
*(char *)(iVar1 + (int)param_1) = (char)lVar4;
return 1;
case 9:
V_StringToColor32((color32_s *)(iVar1 + (int)param_1),param_5);
return 1;
case 0xb:
local_28 = iVar1 + (int)param_1;
local_24 = param_1;
local_20 = param_2;
(**(code **)(**(int **)(param_2 + 0x14) + 0x10))
(*(int **)(param_2 + 0x14),&local_28,param_5);
return 1;
case 0x16:
case 0x17:
iVar5 = 0x10;
break;
case 0x18:
iVar5 = 0xc;
}
UTIL_StringToFloatArray((float *)(iVar1 + (int)param_1),iVar5,param_5);
return 1;
}
LAB_0080e446:
iVar5 = iVar5 + 1;
param_2 = param_2 + 0x40;
} while (iVar5 != param_3);
}
return 0;
}
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.