L L4D2node

CMeleeWeaponInfoStore::LoadScripts

0x00545420 · 486 bytes · __cdecl

_ZN21CMeleeWeaponInfoStore11LoadScriptsEb

Decompiled

undefined (1 param)

/* CMeleeWeaponInfoStore::LoadScripts(bool) */

void CMeleeWeaponInfoStore::LoadScripts(bool param_1)

{
  int iVar1;
  void *pvVar2;
  KeyValues *this;
  char *pcVar3;
  int iVar4;
  undefined3 in_stack_00000005;
  char *local_24;
  int local_20 [5];
  
  DeleteAllInfo(_param_1);
  local_20[0] = 0;
  local_20[1] = 0;
  local_20[2] = 0;
  local_20[3] = 0;
  local_20[4] = 0;
                    /* try { // try from 00545459 to 00545616 has its CatchHandler @ 0054561c */
  this = (KeyValues *)CTerrorGameRules::GetMissionInfo();
  if ((this != (KeyValues *)0x0) &&
     (pcVar3 = (char *)KeyValues::GetString(this,"meleeweapons",(char *)0x0), pcVar3 != (char *)0x0)
     ) {
    V_SplitString(pcVar3,";",(CUtlVector *)local_20);
  }
  iVar4 = (**(code **)(*engine + 0x164))(engine);
  if (iVar4 != 0) {
    local_24 = operator_new__(8);
    builtin_strncpy(local_24,"fireaxe",8);
    CUtlVector<char*,CUtlMemory<char*,int>>::InsertBefore
              ((CUtlVector<char*,CUtlMemory<char*,int>> *)local_20,local_20[3],&local_24);
  }
  pcVar3 = (char *)CDirector::GetGameMode();
  iVar4 = _V_stricmp(pcVar3,"mutation5");
  if (iVar4 == 0) {
    local_20[3] = 0;
    local_24 = operator_new__(7);
    builtin_strncpy(local_24,"katana",7);
    CUtlVector<char*,CUtlMemory<char*,int>>::InsertBefore
              ((CUtlVector<char*,CUtlMemory<char*,int>> *)local_20,local_20[3],&local_24);
  }
  if (local_20[3] == 0) {
    LoadScriptsFromManifest(_param_1,(CUtlStringList *)local_20);
  }
  else {
    LoadScriptsFromDir(_param_1,(CUtlStringList *)local_20);
  }
  iVar4 = 0;
  if (0 < local_20[3]) {
    do {
      pvVar2 = *(void **)(local_20[0] + iVar4 * 4);
      if (pvVar2 != (void *)0x0) {
        operator_delete__(pvVar2);
      }
      iVar4 = iVar4 + 1;
    } while (iVar4 < local_20[3]);
  }
  iVar4 = 0;
  local_20[3] = 0;
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)local_20);
  local_20[4] = local_20[0];
  if (0 < local_20[3]) {
    do {
      iVar1 = iVar4 * 4;
      iVar4 = iVar4 + 1;
      operator_delete(*(void **)(local_20[0] + iVar1));
    } while (iVar4 < local_20[3]);
  }
  local_20[3] = 0;
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)local_20);
  local_20[3] = 0;
  local_20[4] = local_20[0];
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)local_20);
  local_20[4] = local_20[0];
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)local_20);
  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)