CRestore::ReadString
0x004a9980 · 194 bytes · __thiscall
_ZN8CRestore10ReadStringEP8string_tii
Decompiled
undefined (4 params)
/* CRestore::ReadString(string_t*, int, int) */
int __thiscall CRestore::ReadString(CRestore *this,string_t *param_1,int param_2,int param_3)
{
char *pcVar1;
char *pcVar2;
int iVar3;
undefined4 local_20 [4];
if (*(int *)(this + 0x18) == 0) {
pcVar2 = (char *)0x0;
pcVar1 = (char *)param_3;
if (param_3 != 0) goto LAB_004a99aa;
}
else {
pcVar2 = *(char **)(*(int *)(this + 0x18) + 4);
pcVar1 = pcVar2 + param_3;
if (pcVar2 < pcVar2 + param_3) {
LAB_004a99aa:
if (0 < param_2) {
iVar3 = 0;
do {
if (*pcVar2 == '\0') {
*(undefined4 *)param_1 = 0;
}
else {
AllocPooledString((char *)local_20);
*(undefined4 *)param_1 = local_20[0];
}
for (; *pcVar2 != '\0'; pcVar2 = pcVar2 + 1) {
}
pcVar2 = pcVar2 + 1;
iVar3 = iVar3 + 1;
param_1 = param_1 + 4;
} while ((pcVar2 < pcVar1) && (iVar3 < param_2));
goto LAB_004a99e9;
}
}
}
iVar3 = 0;
LAB_004a99e9:
BufferReadBytes(this,(char *)0x0,param_3);
return iVar3;
}
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.