L L4D2node

CUtlFilenameSymbolTable::FindOrAddFileName

0x00264120 · 467 bytes · __thiscall

_ZN23CUtlFilenameSymbolTable17FindOrAddFileNameEPKc

Decompiled

undefined (2 params)

/* CUtlFilenameSymbolTable::FindOrAddFileName(char const*) */

uint __thiscall
CUtlFilenameSymbolTable::FindOrAddFileName(CUtlFilenameSymbolTable *this,char *param_1)

{
  char cVar1;
  short sVar2;
  short sVar3;
  ushort uVar4;
  uint uVar5;
  int iVar6;
  int in_GS_OFFSET;
  char local_32c [260];
  char local_228 [260];
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (param_1 == (char *)0x0) {
    uVar5 = 0;
  }
  else {
    uVar5 = FindFileName(this,param_1);
    if (uVar5 == 0) {
      V_strncpy(local_32c,param_1,0x104);
      V_RemoveDotSlashes(local_32c,'/');
      V_ExtractFilePath(local_32c,local_228,0x104);
      iVar6 = _V_strlen(local_228);
      V_strncpy(local_124,local_32c + iVar6,0x104);
      iVar6 = ThreadGetCurrentId();
      LOCK();
      *(int *)(this + 0x40) = *(int *)(this + 0x40) + 1;
      UNLOCK();
      if ((0 < *(int *)(this + 0x3c)) ||
         (((*(int *)(this + 0x38) != 0 && (iVar6 != *(int *)(this + 0x38))) ||
          (cVar1 = ThreadInterlockedAssignIf64(this + 0x38,iVar6,0,0,0), cVar1 == '\0')))) {
        CThreadSpinRWLock::SpinLockForWrite((uint)(this + 0x38));
      }
      sVar2 = CCountedStringPool::FindStringHandle((CCountedStringPool *)this,local_228);
      sVar3 = CCountedStringPool::FindStringHandle((CCountedStringPool *)this,local_124);
      uVar5 = CONCAT22(sVar3,sVar2);
      if ((sVar2 == 0) || (sVar3 == 0)) {
        uVar4 = CCountedStringPool::ReferenceStringHandle((CCountedStringPool *)this,local_228);
        iVar6 = CCountedStringPool::ReferenceStringHandle((CCountedStringPool *)this,local_124);
        uVar5 = (uint)uVar4 | iVar6 << 0x10;
      }
      CThreadSpinRWLock::UnlockWrite();
    }
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uVar5;
}

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)