L L4D2node

CUtlStreamBuffer::ReadBytesFromFile

0x0028d300 · 232 bytes · __thiscall

_ZN16CUtlStreamBuffer17ReadBytesFromFileEii

Decompiled

undefined (3 params)

/* CUtlStreamBuffer::ReadBytesFromFile(int, int) */

int __thiscall CUtlStreamBuffer::ReadBytesFromFile(CUtlStreamBuffer *this,int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  iVar2 = *(int *)(this + 0x38);
  if (iVar2 == 0) {
    if (*(char **)(this + 0x3c) == (char *)0x0) {
      Warning("File has not been opened!\n");
      return 0;
    }
    iVar2 = OpenFile(this,*(char **)(this + 0x3c),*(char **)(this + 0x40),*(int *)(this + 0x44));
    *(int *)(this + 0x38) = iVar2;
    if (iVar2 == 0) {
      Error("Unable to read file %s!\n",*(undefined4 *)(this + 0x3c));
      return 0;
    }
    if (*(int *)(this + 0x20) != 0) {
      (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x10))
                (g_pFullFileSystem + 4,iVar2,*(int *)(this + 0x20),0);
      iVar2 = *(int *)(this + 0x38);
    }
  }
  iVar1 = *(int *)this;
  iVar2 = (*(code *)**(undefined4 **)(g_pFullFileSystem + 4))
                    (g_pFullFileSystem + 4,iVar1 + param_2,param_1,iVar2);
  if ((param_1 != iVar2) &&
     (iVar3 = *(int *)(this + 0xc) + param_2 + iVar2, iVar3 < *(int *)(this + 0x1c))) {
    *(int *)(this + 0x1c) = iVar3;
  }
  if (param_2 + iVar2 < *(int *)(this + 4)) {
    *(undefined1 *)(iVar1 + param_2 + iVar2) = 0;
  }
  return iVar2;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)