L L4D2node

CServerDemo::LookupOrAddModel

0x005983f0 · 171 bytes · __thiscall

_ZN11CServerDemo16LookupOrAddModelEPKc

Decompiled

undefined (2 params)

/* CServerDemo::LookupOrAddModel(char const*) */

int __thiscall CServerDemo::LookupOrAddModel(CServerDemo *this,char *param_1)

{
  char *__s2;
  int iVar1;
  int iVar2;
  CUtlString local_2c [28];
  
  if ((param_1 != (char *)0x0) && (*param_1 != '\0')) {
    iVar2 = 0;
    if (0 < *(int *)(this + 0x110)) {
      do {
        __s2 = CUtlString::operator_cast_to_char_
                         ((CUtlString *)(iVar2 * 0x10 + *(int *)(this + 0x104)));
        iVar1 = strcmp(param_1,__s2);
        if (iVar1 == 0) {
          return iVar2;
        }
        iVar2 = iVar2 + 1;
      } while (iVar2 < *(int *)(this + 0x110));
    }
    CUtlString::CUtlString(local_2c,param_1);
                    /* try { // try from 00598483 to 00598487 has its CatchHandler @ 005984a5 */
    iVar2 = CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                      ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)(this + 0x104),
                       *(int *)(this + 0x110),local_2c);
    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_2c);
    return iVar2;
  }
  return -1;
}

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)