CScriptHud::HUDParseElementData
0x00905ef0 · 3170 bytes · __cdecl
_ZN10CScriptHud19HUDParseElementDataEP9HSCRIPT__b
Decompiled
undefined (2 params)
/* CScriptHud::HUDParseElementData(HSCRIPT__*, bool) */
char * CScriptHud::HUDParseElementData(HSCRIPT__ *param_1,bool param_2)
{
char cVar1;
int iVar2;
uint uVar3;
int iVar4;
char *pcVar5;
char *pcVar6;
char *pcVar7;
undefined4 *puVar8;
int in_GS_OFFSET;
byte bVar9;
undefined3 in_stack_00000009;
int local_17c;
char *local_16c;
char *local_168;
char *local_164;
char *local_160;
char *local_15c [2];
ushort local_154;
ushort local_152;
char *local_150;
undefined4 local_14c;
undefined2 local_148;
ushort local_146;
char *local_144;
undefined4 local_140;
ushort local_13c;
ushort local_13a;
char *local_138;
undefined4 local_134;
ushort local_130;
ushort local_12e;
char *local_12c;
undefined4 local_128;
ushort local_124;
ushort local_122;
char local_120 [128];
char local_a0 [128];
int local_20;
bVar9 = 0;
local_15c[0] = (char *)0x0;
local_150 = (char *)0x0;
local_144 = (char *)0x0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
local_154 = 0;
local_152 = 0;
local_148 = 0;
local_146 = 0;
local_13c = 0;
local_13a = 0;
/* try { // try from 00905f9e to 00905fd1 has its CatchHandler @ 00906c32 */
cVar1 = (**(code **)(*g_pScriptVM + 0x90))(g_pScriptVM,_param_2,"slot",&local_144);
pcVar7 = local_144;
if (cVar1 == '\0') goto LAB_00905fae;
local_130 = local_13c;
local_138 = (char *)0x0;
local_12e = 0;
local_134 = 0;
switch(local_13c) {
case 3:
local_130 = 3;
local_138 = malloc(0xc);
*(undefined4 *)local_138 = *(undefined4 *)pcVar7;
*(undefined4 *)(local_138 + 4) = *(undefined4 *)(pcVar7 + 4);
*(undefined4 *)(local_138 + 8) = *(undefined4 *)(pcVar7 + 8);
local_12e = 1;
uVar3 = 3;
break;
case 4:
local_130 = 4;
local_138 = malloc(0x10);
*(undefined4 *)local_138 = *(undefined4 *)pcVar7;
*(undefined4 *)(local_138 + 4) = *(undefined4 *)(pcVar7 + 4);
*(undefined4 *)(local_138 + 8) = *(undefined4 *)(pcVar7 + 8);
*(undefined4 *)(local_138 + 0xc) = *(undefined4 *)(pcVar7 + 0xc);
local_12e = 1;
uVar3 = 4;
break;
default:
local_138 = local_144;
local_134 = local_140;
goto LAB_00906712;
case 0x1c:
local_130 = 0x1c;
local_138 = malloc(8);
*(undefined4 *)local_138 = *(undefined4 *)pcVar7;
local_12e = 1;
*(undefined4 *)(local_138 + 4) = *(undefined4 *)(pcVar7 + 4);
uVar3 = 0x1c;
break;
case 0x1f:
local_130 = 0x1f;
iVar4 = _V_strlen(local_144);
local_138 = malloc(iVar4 + 1U);
memcpy(local_138,pcVar7,iVar4 + 1U);
local_12e = local_12e | 1;
LAB_00906712:
uVar3 = (uint)local_130;
if (local_130 != 5) {
pcVar7 = "unknown_variant_type";
if (local_130 < 0x29) break;
goto LAB_00906127;
}
goto LAB_00906141;
case 0x28:
local_130 = 0x28;
local_138 = malloc(0xc);
*(undefined4 *)local_138 = *(undefined4 *)pcVar7;
*(undefined4 *)(local_138 + 4) = *(undefined4 *)(pcVar7 + 4);
*(undefined4 *)(local_138 + 8) = *(undefined4 *)(pcVar7 + 8);
local_12e = 1;
uVar3 = 0x28;
}
pcVar7 = *(char **)(CSWTCH_689 + uVar3 * 4);
LAB_00906127:
/* try { // try from 0090613a to 0090613e has its CatchHandler @ 00906c28 */
Warning("Wrong field type (%s) for <%s> in HUD Table",pcVar7,"slot");
cVar1 = '\0';
LAB_00906141:
if ((local_12e & 1) != 0) {
free(local_138);
}
if (cVar1 == '\0') {
LAB_00905fae:
DevWarning("Cant parse a HUD Element without a Slot\n");
goto LAB_00905fd2;
}
pcVar7 = (char *)(int)(float)local_144;
if (local_13c == 5) {
pcVar7 = local_144;
}
if (pcVar7 == (char *)0xf) goto LAB_00905fae;
/* try { // try from 009061c8 to 009061cd has its CatchHandler @ 00906c32 */
cVar1 = (**(code **)(*g_pScriptVM + 0x90))(g_pScriptVM,_param_2,"flags",&local_144);
pcVar6 = local_144;
if (cVar1 == '\0') {
local_17c = 0;
pcVar6 = (char *)0x0;
goto LAB_009062b8;
}
local_124 = local_13c;
local_12c = (char *)0x0;
local_122 = 0;
local_128 = 0;
switch(local_13c) {
case 3:
local_124 = 3;
local_12c = malloc(0xc);
*(undefined4 *)local_12c = *(undefined4 *)pcVar6;
*(undefined4 *)(local_12c + 4) = *(undefined4 *)(pcVar6 + 4);
*(undefined4 *)(local_12c + 8) = *(undefined4 *)(pcVar6 + 8);
local_122 = 1;
uVar3 = 3;
break;
case 4:
local_124 = 4;
local_12c = malloc(0x10);
*(undefined4 *)local_12c = *(undefined4 *)pcVar6;
*(undefined4 *)(local_12c + 4) = *(undefined4 *)(pcVar6 + 4);
*(undefined4 *)(local_12c + 8) = *(undefined4 *)(pcVar6 + 8);
*(undefined4 *)(local_12c + 0xc) = *(undefined4 *)(pcVar6 + 0xc);
local_122 = 1;
uVar3 = 4;
break;
default:
local_12c = local_144;
local_128 = local_140;
goto LAB_00906472;
case 0x1c:
local_124 = 0x1c;
local_12c = malloc(8);
*(undefined4 *)local_12c = *(undefined4 *)pcVar6;
local_122 = 1;
*(undefined4 *)(local_12c + 4) = *(undefined4 *)(pcVar6 + 4);
uVar3 = 0x1c;
break;
case 0x1f:
local_124 = 0x1f;
iVar4 = _V_strlen(local_144);
local_12c = malloc(iVar4 + 1U);
memcpy(local_12c,pcVar6,iVar4 + 1U);
local_122 = local_122 | 1;
LAB_00906472:
uVar3 = (uint)local_124;
if (local_124 != 5) {
pcVar6 = "unknown_variant_type";
if (local_124 < 0x29) break;
goto LAB_00906277;
}
if (local_13c == 5) {
local_17c = 0;
pcVar6 = local_144;
}
else {
local_17c = 0;
pcVar6 = (char *)(int)(float)local_144;
}
goto LAB_0090629b;
case 0x28:
local_124 = 0x28;
local_12c = malloc(0xc);
*(undefined4 *)local_12c = *(undefined4 *)pcVar6;
*(undefined4 *)(local_12c + 4) = *(undefined4 *)(pcVar6 + 4);
*(undefined4 *)(local_12c + 8) = *(undefined4 *)(pcVar6 + 8);
local_122 = 1;
uVar3 = 0x28;
}
pcVar6 = *(char **)(CSWTCH_689 + uVar3 * 4);
LAB_00906277:
/* try { // try from 0090628a to 0090628e has its CatchHandler @ 00906bce */
Warning("Wrong field type (%s) for <%s> in HUD Table",pcVar6,"flags");
local_17c = 1;
pcVar6 = (char *)0x0;
LAB_0090629b:
if ((local_122 & 1) != 0) {
free(local_12c);
}
LAB_009062b8:
/* try { // try from 009062f0 to 00906b99 has its CatchHandler @ 00906c32 */
cVar1 = (**(code **)(*g_pScriptVM + 0x90))(g_pScriptVM,_param_2,"dataval",local_15c);
iVar4 = g_pGameRules;
if (cVar1 == '\0') {
cVar1 = (**(code **)(*g_pScriptVM + 0x90))(g_pScriptVM,_param_2,"special",local_15c);
iVar4 = g_pGameRules;
if (cVar1 != '\0') {
local_164 = (char *)(int)(float)local_15c[0];
if (local_154 == 5) {
local_164 = local_15c[0];
}
iVar2 = memcmp((void *)(g_pGameRules + 0x4a0 + (int)pcVar7 * 4),&local_164,4);
if (iVar2 != 0) {
CGameRulesProxy::NotifyNetworkStateChanged();
*(char **)(iVar4 + 0x4a0 + (int)pcVar7 * 4) = local_164;
}
pcVar6 = (char *)((uint)pcVar6 | 0x3000);
}
}
else if (local_154 == 5) {
if ((((uint)pcVar6 & 0x3000) != 0) ||
(*(char **)(g_pGameRules + 0x4a0 + (int)pcVar7 * 4) != local_15c[0])) {
pcVar6 = (char *)((uint)pcVar6 & 0xffffcfff);
local_16c = local_15c[0];
iVar2 = memcmp((void *)(g_pGameRules + 0x4a0 + (int)pcVar7 * 4),&local_16c,4);
if (iVar2 != 0) {
CGameRulesProxy::NotifyNetworkStateChanged();
*(char **)(iVar4 + 0x4a0 + (int)pcVar7 * 4) = local_16c;
}
}
}
else if (local_154 == 0x1f) {
if (((uint)pcVar6 & 0x3000) == 0x2000) {
iVar4 = _V_strlen(local_15c[0]);
iVar4 = V_strncmp((char *)(g_pGameRules + 0x674 + (int)pcVar7 * 0x80),local_15c[0],iVar4);
if (iVar4 == 0) goto LAB_00906360;
}
iVar4 = g_pGameRules;
pcVar6 = (char *)((uint)pcVar6 & 0xffffcfff | 0x2000);
V_strncpy(local_120,local_15c[0],0x80);
iVar2 = memcmp((void *)(iVar4 + 0x674 + (int)pcVar7 * 0x80),local_120,0x80);
if (iVar2 != 0) {
CGameRulesProxy::NotifyNetworkStateChanged();
pcVar5 = local_120;
puVar8 = (undefined4 *)(iVar4 + 0x674 + (int)pcVar7 * 0x80);
for (iVar2 = 0x20; iVar2 != 0; iVar2 = iVar2 + -1) {
*puVar8 = *(undefined4 *)pcVar5;
pcVar5 = pcVar5 + (uint)bVar9 * -8 + 4;
puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
}
}
}
else if (local_154 == 1) {
if ((((uint)pcVar6 & 0x3000) != 0x1000) ||
((float)local_15c[0] != *(float *)(g_pGameRules + 0x4dc + (int)pcVar7 * 4))) {
pcVar6 = (char *)((uint)pcVar6 & 0xffffcfff | 0x1000);
local_168 = local_15c[0];
iVar2 = memcmp((void *)(g_pGameRules + 0x4dc + (int)pcVar7 * 4),&local_168,4);
if (iVar2 != 0) {
CGameRulesProxy::NotifyNetworkStateChanged();
*(char **)(iVar4 + 0x4dc + (int)pcVar7 * 4) = local_168;
}
}
}
else {
pcVar5 = "unknown_variant_type";
if (local_154 < 0x29) {
pcVar5 = *(char **)(CSWTCH_689 + (uint)local_154 * 4);
}
DevWarning("Illegal type <%s> in dataval field\n",pcVar5);
local_17c = local_17c + 1;
}
LAB_00906360:
cVar1 = (**(code **)(*g_pScriptVM + 0x90))(g_pScriptVM,_param_2,"staticstring",&local_150);
if (cVar1 != '\0') {
iVar4 = _V_strlen(local_150);
iVar2 = V_strncmp((char *)(g_pGameRules + 0x674 + (int)pcVar7 * 0x80),local_150,iVar4);
iVar4 = g_pGameRules;
if (iVar2 != 0) {
V_strncpy(local_a0,local_150,0x80);
iVar2 = memcmp((void *)(iVar4 + 0x674 + (int)pcVar7 * 0x80),local_a0,0x80);
if (iVar2 != 0) {
CGameRulesProxy::NotifyNetworkStateChanged();
pcVar5 = local_a0;
puVar8 = (undefined4 *)(iVar4 + 0x674 + (int)pcVar7 * 0x80);
for (iVar2 = 0x20; iVar2 != 0; iVar2 = iVar2 + -1) {
*puVar8 = *(undefined4 *)pcVar5;
pcVar5 = pcVar5 + (uint)bVar9 * -8 + 4;
puVar8 = puVar8 + (uint)bVar9 * -2 + 1;
}
}
}
if (((uint)pcVar6 & 3) == 0) {
pcVar6 = (char *)((uint)pcVar6 | 1);
}
}
if (local_17c != 0) {
pcVar6 = (char *)((uint)pcVar6 | 0x4000);
}
iVar4 = g_pGameRules + (int)pcVar7 * 4;
if ((pcVar6 != *(char **)(iVar4 + 0x518)) &&
(local_160 = pcVar6,
iVar2 = memcmp((void *)(g_pGameRules + 0x518 + (int)pcVar7 * 4),&local_160,4), iVar2 != 0)) {
CGameRulesProxy::NotifyNetworkStateChanged();
*(char **)(iVar4 + 0x518) = local_160;
}
if (local_17c != 0) {
LAB_00905fd2:
pcVar7 = &DAT_ffffffff;
}
if ((local_13a & 1) != 0) {
free(local_144);
local_13a = local_13a & 0xfffe;
}
local_144 = (char *)0x0;
local_140 = 0;
local_13c = 0;
if ((local_146 & 1) != 0) {
free(local_150);
local_146 = local_146 & 0xfffe;
}
local_150 = (char *)0x0;
local_14c = 0;
local_148 = 0;
if ((local_152 & 1) != 0) {
free(local_15c[0]);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return pcVar7;
}
/* 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.