L L4D2node

PrecacheInstancedScene

0x00819740 · 612 bytes · __cdecl

_Z22PrecacheInstancedScenePKc

Decompiled

undefined (1 param)

/* PrecacheInstancedScene(char const*) */

void PrecacheInstancedScene(char *param_1)

{
  ushort uVar1;
  char cVar2;
  short sVar3;
  undefined4 uVar4;
  char *pcVar5;
  int *piVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  undefined4 local_20;
  
  uVar4 = HashStringCaselessConventional(param_1);
  uVar7 = (uint)(ushort)g_ScenePrecacheSystem._28_2_;
  if (g_ScenePrecacheSystem._28_2_ != -1) {
    local_2c = uVar4;
    do {
      while( true ) {
        iVar9 = uVar7 * 0x10;
        cVar2 = (*(code *)g_ScenePrecacheSystem._12_4_)
                          (&local_2c,g_ScenePrecacheSystem._16_4_ + 8 + iVar9);
        if (cVar2 != '\0') break;
        cVar2 = (*(code *)g_ScenePrecacheSystem._12_4_)
                          (g_ScenePrecacheSystem._16_4_ + iVar9 + 8,&local_2c);
        if (cVar2 == '\0') {
          piVar6 = (int *)(g_ScenePrecacheSystem._16_4_ + iVar9 + 0xc);
          *piVar6 = *piVar6 + 1;
          return;
        }
        if (CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Links(unsigned_short)::s_Sentinel == '\0') {
          iVar8 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                       ::Links(unsigned_short)::s_Sentinel);
          if (iVar8 != 0) {
            CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f26b96 = 0xffff;
            DAT_00f26b98 = 0xffff;
            __cxa_guard_release(&CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                 ::Links(unsigned_short)::s_Sentinel);
          }
        }
        uVar1 = *(ushort *)(g_ScenePrecacheSystem._16_4_ + 2 + iVar9);
        uVar7 = (uint)uVar1;
        if (uVar1 == 0xffff) goto LAB_008197f3;
      }
      if (CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
          ::Links(unsigned_short)::s_Sentinel == '\0') {
        iVar8 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                     ::Links(unsigned_short)::s_Sentinel);
        if (iVar8 != 0) {
          CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
          ::Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f26b96 = 0xffff;
          DAT_00f26b98 = 0xffff;
          __cxa_guard_release(&CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                               ::Links(unsigned_short)::s_Sentinel);
        }
      }
      uVar7 = (uint)*(ushort *)(g_ScenePrecacheSystem._16_4_ + iVar9);
    } while (*(ushort *)(g_ScenePrecacheSystem._16_4_ + iVar9) != 0xffff);
  }
LAB_008197f3:
  local_28 = 0;
  local_2c = uVar4;
  CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
  ::Insert((CUtlRBTree<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<int,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<int,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            *)(g_ScenePrecacheSystem + 0xc),(Node_t *)&local_2c);
  if (PrecacheInstancedScene(char_const*)::nMakingReslists == 0xffffffff) {
    piVar6 = (int *)CommandLine_Tier0();
    iVar9 = (**(code **)(*piVar6 + 0x28))(piVar6,"-makereslists");
    PrecacheInstancedScene(char_const*)::nMakingReslists = (uint)(0 < iVar9);
  }
  if (PrecacheInstancedScene(char_const*)::nMakingReslists == 1) {
    (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x1c))(g_pFullFileSystem + 4,param_1,0);
  }
  cVar2 = (**(code **)(*scenefilecache + 0x1c))(scenefilecache,param_1,(Node_t *)&local_2c);
  if ((cVar2 != '\0') && (0 < local_24)) {
    iVar9 = 0;
    do {
      iVar8 = iVar9 + 1;
      sVar3 = (**(code **)(*scenefilecache + 0x20))(scenefilecache,local_20,iVar9);
      pcVar5 = (char *)(**(code **)(*scenefilecache + 0x24))(scenefilecache,(int)sVar3);
      CBaseEntity::PrecacheScriptSound(pcVar5);
      iVar9 = iVar8;
    } while (iVar8 < local_24);
  }
  (**(code **)(*g_pStringTableClientSideChoreoScenes + 0x24))
            (g_pStringTableClientSideChoreoScenes,1,param_1,0xffffffff,0);
  return;
}

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)