CUtlStreamBuffer::Open
0x00bf0c10 · 257 bytes · __thiscall
_ZN16CUtlStreamBuffer4OpenEPKcS1_ii
Decompiled
undefined (5 params)
/* CUtlStreamBuffer::Open(char const*, char const*, int, int) */
void __thiscall
CUtlStreamBuffer::Open(CUtlStreamBuffer *this,char *param_1,char *param_2,int param_3,int param_4)
{
int iVar1;
int iVar2;
if ((*(int *)(this + 0x38) != 0) || (*(int *)(this + 0x3c) != 0)) {
Close(this);
}
*(undefined4 *)(this + 0xc) = 0;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 *)(this + 0x18) = 0;
*(undefined4 *)(this + 0x20) = 0;
this[0x15] = SUB41(param_3,0);
iVar1 = OpenFile(this,param_1,param_2,param_4);
*(int *)(this + 0x38) = iVar1;
if (iVar1 != 0) {
if (((byte)this[0x15] & 8) == 0) {
if (*(int *)(this + 4) != 0) {
*(undefined4 *)(this + 0x1c) = 0xffffffff;
CUtlBuffer::AddNullTermination((CUtlBuffer *)this);
return;
}
*(undefined4 *)(this + 0x1c) = 0;
}
else {
iVar2 = (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x18))(g_pFullFileSystem + 4,iVar1);
iVar1 = *(int *)(this + 4);
*(int *)(this + 0x1c) = iVar2;
if (0 < iVar1) {
if (iVar2 <= iVar1) {
iVar1 = iVar2;
}
ReadBytesFromFile(this,iVar1,0);
return;
}
}
return;
}
this[0x14] = (CUtlStreamBuffer)((byte)this[0x14] | 4);
return;
}
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.