CRestore::ReadFields
0x004aa8e0 · 701 bytes · __thiscall
_ZN8CRestore10ReadFieldsEPKcPvP9datamap_tP17typedescription_ti
Decompiled
undefined (6 params)
/* CRestore::ReadFields(char const*, void*, datamap_t*, typedescription_t*, int) */
undefined4 __thiscall
CRestore::ReadFields
(CRestore *this,char *param_1,void *param_2,datamap_t *param_3,typedescription_t *param_4,
int param_5)
{
undefined4 *puVar1;
char cVar2;
short sVar3;
uint uVar4;
uint uVar5;
undefined4 uVar6;
typedescription_t *ptVar7;
int iVar8;
char *pcVar9;
int iVar10;
int iVar11;
uint uVar12;
uint uVar13;
char *pcVar14;
int local_30;
int local_24;
ushort local_20;
ushort local_1e;
(**(code **)(*(int *)this + 0x30))(this);
cVar2 = *param_1;
if (cVar2 == '\0') {
uVar4 = 0;
}
else {
uVar4 = 0;
pcVar14 = param_1;
do {
iVar10 = 4;
do {
uVar5 = uVar4 >> 1;
uVar12 = uVar4 & 1;
uVar4 = uVar5;
if (uVar12 != 0) {
uVar4 = uVar5 | 0x80000000;
}
iVar10 = iVar10 + -1;
} while (iVar10 != 0);
pcVar14 = pcVar14 + 1;
uVar4 = uVar4 ^ (int)cVar2;
cVar2 = *pcVar14;
} while (cVar2 != '\0');
}
uVar5 = *(uint *)(*(int *)(this + 0x18) + 0x10);
if (0 < (int)uVar5) {
iVar10 = *(int *)(*(int *)(this + 0x18) + 0x14);
uVar12 = uVar4 % uVar5 & 0xffff;
uVar4 = uVar5 + uVar12;
do {
uVar13 = uVar12 - uVar5;
if ((int)uVar12 < (int)uVar5) {
uVar13 = uVar12;
}
puVar1 = (undefined4 *)(iVar10 + uVar13 * 4);
pcVar14 = (char *)*puVar1;
if ((pcVar14 == (char *)0x0) || (iVar11 = strcmp(param_1,pcVar14), iVar11 == 0)) {
uVar13 = uVar13 & 0xffff;
*puVar1 = param_1;
goto LAB_004aa9b7;
}
uVar12 = uVar12 + 1;
} while (uVar12 != uVar4);
}
uVar13 = 0;
Warning("CSaveRestoreBuffer::TokenHash() is COMPLETELY FULL!");
LAB_004aa9b7:
sVar3 = (**(code **)(*(int *)this + 0x30))(this);
uVar4 = (uint)sVar3;
if (uVar4 == uVar13) {
ReadFields(char_const*,void*,datamap_t*,typedescription_t*,int)::lastName = uVar13;
(**(code **)(*(int *)this + 0x10))(this,param_2,param_4,param_5);
iVar10 = (**(code **)(*(int *)this + 0x3c))(this);
local_24 = 0;
if (0 < iVar10) {
local_30 = 0;
do {
while( true ) {
(**(code **)(*(int *)this + 0x24))(this,(SaveRestoreRecordHeader_t *)&local_20);
pcVar14 = "<<illegal>>";
if ((int)(uint)local_1e < *(int *)(*(int *)(this + 0x18) + 0x10)) {
pcVar14 = *(char **)(*(int *)(*(int *)(this + 0x18) + 0x14) + (uint)local_1e * 4);
}
ptVar7 = (typedescription_t *)FindField(this,pcVar14,param_4,param_5,&local_24);
if (((ptVar7 != (typedescription_t *)0x0) && ((*(ushort *)(ptVar7 + 0xe) & 2) != 0)) &&
((*(int *)(this + 0x20) == 0 || ((*(ushort *)(ptVar7 + 0xe) & 1) == 0)))) break;
BufferReadBytes(this,(char *)0x0,(uint)local_20);
local_30 = local_30 + 1;
if (local_30 == iVar10) {
return 1;
}
}
ReadField(this,(SaveRestoreRecordHeader_t *)&local_20,
(void *)((int)param_2 + *(int *)(ptVar7 + 8)),param_3,ptVar7);
local_30 = local_30 + 1;
} while (local_30 != iVar10);
}
return 1;
}
pcVar14 = "<<illegal>>";
iVar10 = *(int *)(this + 0x18);
if (((int)ReadFields(char_const*,void*,datamap_t*,typedescription_t*,int)::lastName < 0) ||
(*(int *)(iVar10 + 0x10) <=
(int)ReadFields(char_const*,void*,datamap_t*,typedescription_t*,int)::lastName)) {
if (-1 < (int)uVar4) goto LAB_004aa9f1;
LAB_004aaa5d:
pcVar9 = "<<illegal>>";
uVar6 = 0;
if (iVar10 == 0) goto LAB_004aa9f9;
}
else {
pcVar14 = *(char **)(*(int *)(iVar10 + 0x14) +
ReadFields(char_const*,void*,datamap_t*,typedescription_t*,int)::lastName *
4);
if ((int)uVar4 < 0) goto LAB_004aaa5d;
LAB_004aa9f1:
pcVar9 = "<<illegal>>";
if ((int)uVar4 < *(int *)(iVar10 + 0x10)) {
pcVar9 = *(char **)(*(int *)(iVar10 + 0x14) + uVar4 * 4);
}
}
uVar6 = *(undefined4 *)(iVar10 + 4);
LAB_004aa9f9:
Msg("Expected %s found %s ( raw \'%s\' )! (prev: %s)\n",param_1,pcVar9,uVar6,pcVar14);
Msg("Field type name may have changed or inheritance graph changed, save file is suspect\n");
iVar10 = *(int *)(this + 0x18);
iVar11 = *(int *)(iVar10 + 8);
if (iVar11 < 4) {
iVar11 = -iVar11;
iVar8 = 0;
}
else {
iVar8 = iVar11 + -4;
iVar11 = -4;
}
*(int *)(iVar10 + 4) = *(int *)(iVar10 + 4) + iVar11;
*(int *)(iVar10 + 8) = iVar8;
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.