L L4D2node

AsyncCaption_t::LoadFromFile

0x00587cd0 · 525 bytes · __thiscall

_ZN14AsyncCaption_t12LoadFromFileEPKc

Decompiled

undefined (2 params)

/* AsyncCaption_t::LoadFromFile(char const*) */

undefined4 __thiscall AsyncCaption_t::LoadFromFile(AsyncCaption_t *this,char *param_1)

{
  int iVar1;
  uint uVar2;
  void *pvVar3;
  size_t __size;
  undefined1 local_5f;
  undefined2 local_5e;
  undefined4 local_5c;
  undefined1 *local_58;
  int local_54 [3];
  int local_48;
  int local_34;
  
  iVar1 = (**(code **)(*(int *)(g_pFullFileSystem + 4) + 8))(g_pFullFileSystem + 4,param_1,"rb",0);
  if (iVar1 != 0) {
    CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_54,0,0,0);
                    /* try { // try from 00587d52 to 00587e9a has its CatchHandler @ 00587ef0 */
    (*(code *)**(undefined4 **)(g_pFullFileSystem + 4))
              (g_pFullFileSystem + 4,this + 0x38,0x18,iVar1);
    if (*(int *)(this + 0x38) != 0x44434356) {
      Error("Invalid file id for %s\n",param_1);
    }
    if (*(int *)(this + 0x3c) != 1) {
      Error("Invalid file version for %s\n",param_1);
    }
    uVar2 = *(uint *)(this + 0x48);
    if (0x10000 < uVar2) {
      Error("Invalid directory size %d for %s\n",uVar2,param_1);
      uVar2 = *(uint *)(this + 0x48);
    }
    __size = uVar2 * 0xc;
    if ((*(int *)(this + 0x20) < (int)uVar2) && (-1 < *(int *)(this + 0x24))) {
      *(uint *)(this + 0x20) = uVar2;
      if (*(void **)(this + 0x1c) == (void *)0x0) {
        pvVar3 = malloc(__size);
        *(void **)(this + 0x1c) = pvVar3;
      }
      else {
        pvVar3 = realloc(*(void **)(this + 0x1c),__size);
        *(void **)(this + 0x1c) = pvVar3;
      }
    }
    else {
      pvVar3 = *(void **)(this + 0x1c);
    }
    *(void **)(this + 0x2c) = pvVar3;
    CUtlBuffer::EnsureCapacity((CUtlBuffer *)local_54,__size);
    (*(code *)**(undefined4 **)(g_pFullFileSystem + 4))
              (g_pFullFileSystem + 4,local_54[0],__size,iVar1);
    (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0xc))(g_pFullFileSystem + 4,iVar1);
    CUtlVector<CaptionLookup_t,CUtlMemory<CaptionLookup_t,int>>::CopyArray
              ((CUtlVector<CaptionLookup_t,CUtlMemory<CaptionLookup_t,int>> *)(this + 0x1c),
               (CaptionLookup_t *)((local_48 - local_34) + local_54[0]),*(int *)(this + 0x48));
    this[0x34] = (AsyncCaption_t)0x0;
    if (1 < (int)*(size_t *)(this + 0x28)) {
      local_5c = *(undefined4 *)(this + 0x30);
      local_58 = &local_5f;
      g_pUtlSortVectorQSortContext = &local_5c;
      qsort(*(void **)(this + 0x1c),*(size_t *)(this + 0x28),0xc,
            CUtlSortVector<CaptionLookup_t,CCaptionLookupLess>::CompareHelper);
    }
    CUtlSymbol::CUtlSymbol((CUtlSymbol *)&local_5e,param_1);
    *(undefined2 *)(this + 0x50) = local_5e;
    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_54);
    return 1;
  }
  return 0;
}

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)