ScriptTableToKeyValues
0x008a1360 · 1316 bytes · __cdecl
_Z22ScriptTableToKeyValuesP9IScriptVMPKcP9HSCRIPT__
Decompiled
undefined (3 params)
/* ScriptTableToKeyValues(IScriptVM*, char const*, HSCRIPT__*) */
KeyValues * ScriptTableToKeyValues(IScriptVM *param_1,char *param_2,HSCRIPT__ *param_3)
{
KeyValues *this;
uint uVar1;
undefined1 *puVar2;
void *pvVar3;
HSCRIPT__ *pHVar4;
KeyValues *this_00;
int iVar5;
int iVar6;
char *pcVar7;
int in_GS_OFFSET;
byte bVar8;
uint in_stack_fffffe18;
void *local_1c4 [2];
short local_1bc;
ushort local_1ba;
HSCRIPT__ *local_1b8;
undefined4 local_1b4;
short local_1b0;
ushort local_1ae;
char local_1ac [128];
CFmtStrN<256> local_12c [5];
char local_127 [263];
int local_20;
bVar8 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_2 == (char *)0x0) {
param_2 = "";
}
this = KeyValues::operator_new((KeyValues *)0x2c,in_stack_fffffe18);
/* try { // try from 008a13bb to 008a13bf has its CatchHandler @ 008a1947 */
KeyValues::KeyValues(this,param_2,(IKeyValuesSystem *)0x0,false);
if ((param_3 != (HSCRIPT__ *)0x0) && (param_1 != (IScriptVM *)0x0)) {
local_1c4[0] = (void *)0x0;
local_1bc = 0;
local_1ba = 0;
local_1b0 = 0;
local_1ae = 0;
local_1b8 = (HSCRIPT__ *)0x0;
iVar6 = 0;
/* try { // try from 008a1437 to 008a16b3 has its CatchHandler @ 008a1943 */
while (iVar6 = (**(code **)(*(int *)param_1 + 0x8c))(param_1,param_3,iVar6,local_1c4),
iVar6 != -1) {
pcVar7 = local_1ac;
for (iVar5 = 0x20; iVar5 != 0; iVar5 = iVar5 + -1) {
pcVar7[0] = '\0';
pcVar7[1] = '\0';
pcVar7[2] = '\0';
pcVar7[3] = '\0';
pcVar7 = pcVar7 + ((uint)bVar8 * -2 + 1) * 4;
}
uVar1 = (uint)local_1bc;
switch(local_1bc) {
default:
Warning("ScriptVmStringFromVariant failed to unpack parameter variant type %d\n");
break;
case 1:
uVar1 = 0x80;
V_snprintf(local_1ac,0x80,"%f",(double)(float)local_1c4[0]);
break;
case 5:
pvVar3 = local_1c4[0];
goto LAB_008a153f;
case 6:
pvVar3 = (void *)((uint)local_1c4[0] & 0xff);
LAB_008a153f:
uVar1 = 0x80;
V_snprintf(local_1ac,0x80,"%d",pvVar3);
break;
case 8:
uVar1 = 0x80;
V_snprintf(local_1ac,0x80,"%c",(int)(char)local_1c4[0]);
break;
case 0x1f:
uVar1 = 0x80;
V_snprintf(local_1ac,0x80,"%s",local_1c4[0]);
}
if (local_1ac[0] != '\0') {
puVar2 = (undefined1 *)(int)local_1b0;
switch(local_1b0) {
default:
Warning("ScriptVmKeyValueFromVariant failed to unpack parameter variant type %d\n");
goto LAB_008a1898;
case 1:
this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar1);
/* try { // try from 008a1851 to 008a1855 has its CatchHandler @ 008a18ff */
KeyValues::KeyValues(this_00,"",(IKeyValuesSystem *)0x0,false);
pHVar4 = local_1b8;
if (local_1b0 != 1) {
pHVar4 = (HSCRIPT__ *)(float)(int)local_1b8;
}
puVar2 = (undefined1 *)0x0;
/* try { // try from 008a187b to 008a18a3 has its CatchHandler @ 008a1943 */
KeyValues::SetFloat(this_00,(char *)0x0,(float)pHVar4);
break;
case 5:
this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar1);
/* try { // try from 008a17e9 to 008a17ed has its CatchHandler @ 008a190b */
KeyValues::KeyValues(this_00,"",(IKeyValuesSystem *)0x0,false);
puVar2 = (undefined1 *)0x0;
pHVar4 = (HSCRIPT__ *)(int)(float)local_1b8;
if (local_1b0 == 5) {
pHVar4 = local_1b8;
}
/* try { // try from 008a1818 to 008a1833 has its CatchHandler @ 008a1943 */
KeyValues::SetInt(this_00,(char *)0x0,(int)pHVar4);
break;
case 6:
this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar1);
/* try { // try from 008a1799 to 008a179d has its CatchHandler @ 008a1917 */
KeyValues::KeyValues(this_00,"",(IKeyValuesSystem *)0x0,false);
puVar2 = (undefined1 *)0x0;
/* try { // try from 008a17b4 to 008a17cb has its CatchHandler @ 008a1943 */
KeyValues::SetInt(this_00,(char *)0x0,(uint)local_1b8 & 0xff);
break;
case 8:
this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar1);
/* try { // try from 008a1721 to 008a1725 has its CatchHandler @ 008a1923 */
KeyValues::KeyValues(this_00,"",(IKeyValuesSystem *)0x0,false);
/* try { // try from 008a1742 to 008a177b has its CatchHandler @ 008a1943 */
CFmtStrN<256>::CFmtStrN(local_12c,"%c",(int)(char)local_1b8);
puVar2 = (undefined1 *)0x0;
KeyValues::SetString(this_00,(char *)0x0,local_127);
break;
case 0x1f:
this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar1);
/* try { // try from 008a16d1 to 008a16d5 has its CatchHandler @ 008a1932 */
KeyValues::KeyValues(this_00,"",(IKeyValuesSystem *)0x0,false);
puVar2 = (undefined1 *)0x0;
/* try { // try from 008a16eb to 008a1703 has its CatchHandler @ 008a1943 */
KeyValues::SetString(this_00,(char *)0x0,(char *)local_1b8);
break;
case 0x20:
puVar2 = &DAT_00d539c2;
this_00 = (KeyValues *)ScriptTableToKeyValues(param_1,"",local_1b8);
}
if (this_00 == (KeyValues *)0x0) {
LAB_008a1898:
this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)puVar2);
/* try { // try from 008a18c1 to 008a18c5 has its CatchHandler @ 008a18d1 */
KeyValues::KeyValues(this_00,"",(IKeyValuesSystem *)0x0,false);
}
KeyValues::SetName(this_00,local_1ac);
KeyValues::AddSubKey(this,this_00);
}
(**(code **)(*(int *)param_1 + 0x9c))(param_1,local_1c4);
(**(code **)(*(int *)param_1 + 0x9c))(param_1,&local_1b8);
}
if ((local_1ae & 1) != 0) {
free(local_1b8);
local_1ae = local_1ae & 0xfffe;
}
local_1b8 = (HSCRIPT__ *)0x0;
local_1b4 = 0;
local_1b0 = 0;
if ((local_1ba & 1) != 0) {
free(local_1c4[0]);
}
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return this;
}
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.