L L4D2node

CSoundEmitterSystem::AddCaptionFile

0x004b6d30 · 557 bytes · __thiscall

_ZN19CSoundEmitterSystem14AddCaptionFileEPKc

Decompiled

undefined (2 params)

/* CSoundEmitterSystem::AddCaptionFile(char const*) */

void __thiscall CSoundEmitterSystem::AddCaptionFile(CSoundEmitterSystem *this,char *param_1)

{
  code *pcVar1;
  int iVar2;
  char *pcVar3;
  char cVar4;
  int iVar5;
  char *pcVar6;
  int iVar7;
  int iVar8;
  int in_GS_OFFSET;
  int *apiStack_160 [2];
  char *local_158;
  int local_154 [5];
  int local_140;
  char *local_13c;
  CSoundEmitterSystem *local_138;
  int local_134;
  int local_130;
  undefined1 local_124 [260];
  int local_20;
  
  local_13c = param_1;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_154[2] = 0;
  local_154[1] = 0;
  local_154[0] = 1;
  local_158 = "GAME";
  apiStack_160[1] = filesystem;
  apiStack_160[0] = (int *)0x4b6d86;
  iVar5 = (**(code **)(*filesystem + 0x34))();
  iVar2 = -((iVar5 + 0x10U & 0xfffffff0) + 0x10);
  iVar7 = *filesystem;
  *(int **)((int)apiStack_160 + iVar2 + 4) = filesystem;
  *(int *)((int)local_154 + iVar2 + 8) = iVar5;
  *(int *)((int)local_154 + iVar2 + 4) = (int)&local_140 + iVar2;
  *(undefined4 *)((int)local_154 + iVar2) = 1;
  *(char **)((int)&local_158 + iVar2) = "GAME";
  pcVar1 = *(code **)(iVar7 + 0x34);
  *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6dbe;
  (*pcVar1)();
  *(char **)((int)&local_158 + iVar2) = ";";
  *(int *)((int)apiStack_160 + iVar2 + 4) = (int)&local_140 + iVar2;
  *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6dce;
  pcVar6 = strtok(*(char **)((int)apiStack_160 + iVar2 + 4),*(char **)((int)&local_158 + iVar2));
  local_138 = this + 0x44;
  pcVar3 = local_13c;
  while (local_13c = pcVar3, pcVar6 != (char *)0x0) {
    *(char **)((int)local_154 + iVar2 + 4) = pcVar6;
    *(char **)((int)local_154 + iVar2) = "%s%s";
    *(undefined4 *)((int)&local_158 + iVar2) = 0x104;
    *(undefined1 **)((int)apiStack_160 + iVar2 + 4) = local_124;
    *(char **)((int)local_154 + iVar2 + 8) = pcVar3;
    *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6edb;
    V_snprintf(*(char **)((int)apiStack_160 + iVar2 + 4),*(int *)((int)&local_158 + iVar2),
               *(char **)((int)local_154 + iVar2));
    *(undefined4 *)((int)&local_158 + iVar2) = 0x2f;
    *(undefined1 **)((int)apiStack_160 + iVar2 + 4) = local_124;
    *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6eeb;
    V_FixSlashes(*(char **)((int)apiStack_160 + iVar2 + 4),*(char *)((int)&local_158 + iVar2));
    *(undefined1 **)((int)apiStack_160 + iVar2 + 4) = local_124;
    *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6ef3;
    _V_strlower(*(char **)((int)apiStack_160 + iVar2 + 4));
    *(undefined4 *)((int)&local_158 + iVar2) = *(undefined4 *)(this + 0x50);
    *(CSoundEmitterSystem **)((int)apiStack_160 + iVar2 + 4) = local_138;
    *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6f08;
    iVar7 = CUtlVector<AsyncCaption_t,CUtlMemory<AsyncCaption_t,int>>::InsertBefore
                      (*(CUtlVector<AsyncCaption_t,CUtlMemory<AsyncCaption_t,int>> **)
                        ((int)apiStack_160 + iVar2 + 4),*(int *)((int)&local_158 + iVar2));
    *(undefined1 **)((int)&local_158 + iVar2) = local_124;
    local_134 = iVar7;
    local_130 = iVar7 * 0x54;
    *(int *)((int)apiStack_160 + iVar2 + 4) = iVar7 * 0x54 + *(int *)(this + 0x44);
    *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6f2b;
    cVar4 = AsyncCaption_t::LoadFromFile
                      (*(AsyncCaption_t **)((int)apiStack_160 + iVar2 + 4),
                       *(char **)((int)&local_158 + iVar2));
    if (cVar4 == '\0') {
      iVar7 = local_130 + *(int *)(this + 0x44);
      *(undefined4 *)(iVar7 + 0x28) = 0;
      *(int *)((int)apiStack_160 + iVar2 + 4) = iVar7 + 0x1c;
      local_140 = iVar7 + 0x1c;
      *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6e09;
      CUtlMemory<CaptionLookup_t,int>::Purge
                (*(CUtlMemory<CaptionLookup_t,int> **)((int)apiStack_160 + iVar2 + 4));
      *(undefined4 *)(iVar7 + 0x2c) = *(undefined4 *)(iVar7 + 0x1c);
      *(int *)((int)apiStack_160 + iVar2 + 4) = local_140;
      *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6e1d;
      CUtlMemory<CaptionLookup_t,int>::Purge
                (*(CUtlMemory<CaptionLookup_t,int> **)((int)apiStack_160 + iVar2 + 4));
      *(int *)((int)apiStack_160 + iVar2 + 4) = iVar7;
      *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6e25;
      CUtlRBTree<AsyncCaption_t::BlockInfo_t,unsigned_short,bool(*)(AsyncCaption_t::BlockInfo_t_const&,AsyncCaption_t::BlockInfo_t_const&),CUtlMemory<UtlRBTreeNode_t<AsyncCaption_t::BlockInfo_t,unsigned_short>,unsigned_short>>
      ::RemoveAll(*(CUtlRBTree<AsyncCaption_t::BlockInfo_t,unsigned_short,bool(*)(AsyncCaption_t::BlockInfo_t_const&,AsyncCaption_t::BlockInfo_t_const&),CUtlMemory<UtlRBTreeNode_t<AsyncCaption_t::BlockInfo_t,unsigned_short>,unsigned_short>>
                    **)((int)apiStack_160 + iVar2 + 4));
      *(undefined2 *)(iVar7 + 0x14) = 0xffff;
      *(int *)((int)apiStack_160 + iVar2 + 4) = iVar7 + 4;
      local_140 = iVar7 + 4;
      *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6e3f;
      CUtlMemory<UtlRBTreeNode_t<AsyncCaption_t::BlockInfo_t,unsigned_short>,unsigned_short>::Purge
                (*(CUtlMemory<UtlRBTreeNode_t<AsyncCaption_t::BlockInfo_t,unsigned_short>,unsigned_short>
                   **)((int)apiStack_160 + iVar2 + 4));
      *(undefined2 *)(iVar7 + 0x16) = 0xffff;
      *(int *)((int)apiStack_160 + iVar2 + 4) = local_140;
      *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6e56;
      CUtlMemory<UtlRBTreeNode_t<AsyncCaption_t::BlockInfo_t,unsigned_short>,unsigned_short>::Purge
                (*(CUtlMemory<UtlRBTreeNode_t<AsyncCaption_t::BlockInfo_t,unsigned_short>,unsigned_short>
                   **)((int)apiStack_160 + iVar2 + 4));
      iVar5 = local_130;
      iVar7 = *(int *)(this + 0x50);
      iVar8 = (iVar7 - local_134) + -1;
      if (0 < iVar8) {
        iVar7 = *(int *)(this + 0x44);
        *(int *)((int)local_154 + iVar2) = iVar8 * 0x54;
        *(int *)((int)apiStack_160 + iVar2 + 4) = iVar7 + iVar5;
        *(int *)((int)&local_158 + iVar2) = iVar7 + 0x54 + iVar5;
        *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6e90;
        _V_memmove(*(void **)((int)apiStack_160 + iVar2 + 4),*(void **)((int)&local_158 + iVar2),
                   *(int *)((int)local_154 + iVar2));
        iVar7 = *(int *)(this + 0x50);
      }
      *(int *)(this + 0x50) = iVar7 + -1;
    }
    else {
      *(undefined1 **)((int)&local_158 + iVar2) = local_124;
      *(char **)((int)apiStack_160 + iVar2 + 4) = "Server: added caption file: %s\n";
      *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6f43;
      DevMsg(*(char **)((int)apiStack_160 + iVar2 + 4));
    }
    *(char **)((int)&local_158 + iVar2) = ";";
    *(undefined4 *)((int)apiStack_160 + iVar2 + 4) = 0;
    *(undefined4 *)((int)apiStack_160 + iVar2) = 0x4b6ead;
    pcVar6 = strtok(*(char **)((int)apiStack_160 + iVar2 + 4),*(char **)((int)&local_158 + iVar2));
    pcVar3 = local_13c;
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  *(undefined **)((int)apiStack_160 + iVar2) = &UNK_004b6f69;
  __stack_chk_fail();
}

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)