L L4D2node

CModelLoader::FindNext

0x0019c8e0 · 500 bytes · __thiscall

_ZN12CModelLoader8FindNextEiPP7model_t

Decompiled

undefined (3 params)

/* CModelLoader::FindNext(int, model_t**) */

uint __thiscall CModelLoader::FindNext(CModelLoader *this,int param_1,model_t **param_2)

{
  ushort uVar1;
  ushort *puVar2;
  uint uVar3;
  short *psVar4;
  int iVar5;
  uint uVar6;
  
  if (param_1 == -1) {
    if (*(short *)(this + 0x16) != 0) {
      uVar1 = *(ushort *)(this + 0x14);
      do {
        uVar6 = (uint)uVar1;
        if ((CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
             ::Links(unsigned_short)::s_Sentinel == '\0') &&
           (iVar5 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                         ::Links(unsigned_short)::s_Sentinel), iVar5 != 0)) {
          CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
          ::Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_003415da = 0xffff;
          DAT_003415dc = 0xffff;
          __cxa_guard_release(&CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                               ::Links(unsigned_short)::s_Sentinel);
          if (uVar1 == 0xffff) goto LAB_0019ca20;
LAB_0019c9a6:
          psVar4 = (short *)(uVar6 * 0x10 + *(int *)(this + 8));
        }
        else {
          if (uVar1 != 0xffff) goto LAB_0019c9a6;
LAB_0019ca20:
          psVar4 = &CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    ::Links(unsigned_short)::s_Sentinel;
        }
        if (*psVar4 == -1) goto LAB_0019c950;
        if (CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Links(unsigned_short)::s_Sentinel == '\0') {
          iVar5 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                       ::Links(unsigned_short)::s_Sentinel);
          if (iVar5 != 0) {
            CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_003415da = 0xffff;
            DAT_003415dc = 0xffff;
            __cxa_guard_release(&CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                 ::Links(unsigned_short)::s_Sentinel);
          }
          if (uVar1 != 0xffff) goto LAB_0019c9ca;
LAB_0019ca51:
          puVar2 = &CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    ::Links(unsigned_short)::s_Sentinel;
        }
        else {
          if (uVar1 == 0xffff) goto LAB_0019ca51;
LAB_0019c9ca:
          puVar2 = (ushort *)(uVar6 * 0x10 + *(int *)(this + 8));
        }
        uVar1 = *puVar2;
      } while( true );
    }
  }
  else if (*(short *)(this + 0x16) != 0) {
    uVar6 = param_1 & 0xffff;
    if (((int)uVar6 < *(int *)(this + 0xc)) && ((ushort)param_1 <= *(ushort *)(this + 0x1a))) {
      if ((CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
           ::Links(unsigned_short)::s_Sentinel == '\0') &&
         (iVar5 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                                       ::Links(unsigned_short)::s_Sentinel), iVar5 != 0)) {
        DAT_003415da = 0xffff;
        CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
        ::Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_003415dc = 0xffff;
        __cxa_guard_release(&CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                             ::Links(unsigned_short)::s_Sentinel);
      }
      if ((ushort)param_1 == 0xffff) {
        puVar2 = &CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                  ::Links(unsigned_short)::s_Sentinel;
      }
      else {
        puVar2 = (ushort *)(uVar6 * 0x10 + *(int *)(this + 8));
      }
      if ((ushort)param_1 != *puVar2) {
LAB_0019c950:
        *param_2 = *(model_t **)(uVar6 * 0x10 + *(int *)(this + 8) + 0xc);
        uVar3 = CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                ::NextInorder((CUtlRBTree<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CModelLoader::ModelEntry_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                               *)(this + 4),(ushort)uVar6);
        uVar6 = 0xffffffff;
        if ((uVar3 & 0xffff) != 0xffff) {
          uVar6 = uVar3 & 0xffff;
        }
        return uVar6;
      }
    }
  }
  *param_2 = (model_t *)0x0;
  return 0xffffffff;
}

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)