L L4D2node

CMeleeWeaponInfoStore::LoadScriptsFromManifest

0x00544f80 · 692 bytes · __thiscall

_ZN21CMeleeWeaponInfoStore23LoadScriptsFromManifestEP14CUtlStringList

Decompiled

undefined (2 params)

/* CMeleeWeaponInfoStore::LoadScriptsFromManifest(CUtlStringList*) */

void __thiscall
CMeleeWeaponInfoStore::LoadScriptsFromManifest(CMeleeWeaponInfoStore *this,CUtlStringList *param_1)

{
  char cVar1;
  KeyValues *this_00;
  IBaseFileSystem *pIVar2;
  char *pcVar3;
  int iVar4;
  int iVar5;
  undefined4 uVar6;
  KeyValues *pKVar7;
  int iVar8;
  int in_GS_OFFSET;
  uint in_stack_fffffda8;
  uint uVar9;
  KeyValues *local_234;
  char local_220 [512];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this_00 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_fffffda8);
  pKVar7 = this_00;
                    /* try { // try from 00544fd2 to 00544fd6 has its CatchHandler @ 00545244 */
  KeyValues::KeyValues(this_00,"meleeweaponinfo",(IKeyValuesSystem *)0x0,false);
  if (this_00 != (KeyValues *)0x0) {
    KeyValues::UsesEscapeSequences(this_00,true);
    pIVar2 = (IBaseFileSystem *)0x0;
    if (filesystem != 0) {
      pIVar2 = (IBaseFileSystem *)(filesystem + 4);
    }
    cVar1 = KeyValues::LoadFromFile(this_00,pIVar2,"scripts/melee/melee_manifest.txt","GAME");
    if (cVar1 != '\0') {
      local_234 = (KeyValues *)KeyValues::GetFirstSubKey(this_00);
      if (local_234 != (KeyValues *)0x0) {
        do {
          pcVar3 = (char *)KeyValues::GetName(local_234);
          iVar4 = _V_stricmp(pcVar3,"file");
          if (iVar4 == 0) {
            pcVar3 = (char *)KeyValues::GetString(local_234,(char *)0x0,"");
            V_FileBase(pcVar3,local_220,0x200);
            iVar4 = *(int *)(param_1 + 0xc);
            if (iVar4 < 1) {
LAB_00545140:
              cVar1 = CDirectorItemManager::IsMeleeWeaponAllowedToExist
                                (*(CDirectorItemManager **)(TheDirector + 0x62c),local_220);
              if (cVar1 != '\0') {
                uVar9 = 1;
                (**(code **)(*g_pStringTableMeleeWeapons + 0x24))
                          (g_pStringTableMeleeWeapons,1,local_220,0xffffffff,0);
                pKVar7 = KeyValues::operator_new((KeyValues *)0x2c,uVar9);
                    /* try { // try from 005451b1 to 005451b5 has its CatchHandler @ 00545232 */
                KeyValues::KeyValues(pKVar7,"meleeweapon",(IKeyValuesSystem *)0x0,false);
                if (pKVar7 != (KeyValues *)0x0) {
                  pcVar3 = (char *)KeyValues::GetString(local_234,(char *)0x0,"");
                  pIVar2 = (IBaseFileSystem *)0x0;
                  if (filesystem != 0) {
                    pIVar2 = (IBaseFileSystem *)(filesystem + 4);
                  }
                  cVar1 = KeyValues::LoadFromFile(pKVar7,pIVar2,pcVar3,"GAME");
                  if (cVar1 != '\0') {
                    RegisterMeleeWeaponType(this,local_220,pKVar7);
                  }
                  KeyValues::deleteThis();
                }
              }
            }
            else {
              iVar8 = 0;
              do {
                iVar5 = _V_strcmp(local_220,*(char **)(*(int *)param_1 + iVar8 * 4));
                if (iVar5 == 0) goto LAB_00545140;
                iVar8 = iVar8 + 1;
              } while (iVar8 != iVar4);
            }
          }
          else {
            uVar6 = KeyValues::GetName(local_234);
            Error("Expecting \'file\', got %s\n",uVar6);
          }
          local_234 = (KeyValues *)KeyValues::GetNextKey(local_234);
        } while (local_234 != (KeyValues *)0x0);
      }
    }
    KeyValues::deleteThis();
    pKVar7 = this_00;
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(pKVar7);
}

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)