L L4D2node

CTerrorGameRules::IsWeaponPrecacheAllowed

0x005098b0 · 571 bytes · __cdecl

_ZN16CTerrorGameRules23IsWeaponPrecacheAllowedEPKc

Decompiled

undefined (1 param)

/* CTerrorGameRules::IsWeaponPrecacheAllowed(char const*) */

undefined4 CTerrorGameRules::IsWeaponPrecacheAllowed(char *param_1)

{
  undefined4 *puVar1;
  int iVar2;
  KeyValues *this;
  char *pcVar3;
  int iVar4;
  undefined4 uVar5;
  undefined4 *local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  undefined4 *local_20;
  
  if ((mp_gamemode[0x15] & 0x10) == 0) {
    pcVar3 = *(char **)(mp_gamemode._28_4_ + 0x24);
    if (pcVar3 == (char *)0x0) {
      pcVar3 = "";
      goto LAB_00509a6d;
    }
    if (pcVar3 != "mutation14") goto LAB_00509a6d;
joined_r0x00509a8b:
    if ((param_1 == "weapon_grenade_launcher") ||
       (iVar2 = _V_stricmp(param_1,"weapon_grenade_launcher"), iVar2 == 0)) {
      return 0;
    }
    if ((param_1 == "weapon_rifle_m60") ||
       (iVar2 = _V_stricmp(param_1,"weapon_rifle_m60"), iVar2 == 0)) {
      return 1;
    }
  }
  else {
    pcVar3 = "FCVAR_NEVER_AS_STRING";
LAB_00509a6d:
    iVar2 = _V_stricmp(pcVar3,"mutation14");
    if (iVar2 == 0) goto joined_r0x00509a8b;
  }
  local_30 = (undefined4 *)0x0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = (undefined4 *)0x0;
                    /* try { // try from 00509952 to 005099bb has its CatchHandler @ 00509b0a */
  this = (KeyValues *)GetMissionInfo();
  if (this == (KeyValues *)0x0) {
    uVar5 = 1;
  }
  else {
    pcVar3 = (char *)KeyValues::GetString(this,"excludeweapons",(char *)0x0);
    if (pcVar3 == (char *)0x0) {
      uVar5 = 1;
    }
    else {
      V_SplitString(pcVar3,";",(CUtlVector *)&local_30);
      uVar5 = 1;
      if (local_24 < 1) goto LAB_005099ea;
      iVar2 = 0;
      pcVar3 = (char *)*local_30;
      while ((param_1 != pcVar3 && (iVar4 = _V_stricmp(pcVar3,param_1), iVar4 != 0))) {
        iVar2 = iVar2 + 1;
        if (local_24 <= iVar2) {
          uVar5 = 1;
          goto LAB_005099c9;
        }
        pcVar3 = (char *)local_30[iVar2];
      }
      uVar5 = 0;
    }
  }
LAB_005099c9:
  if (0 < local_24) {
    iVar2 = 0;
    do {
      if ((void *)local_30[iVar2] != (void *)0x0) {
        operator_delete__((void *)local_30[iVar2]);
      }
      iVar2 = iVar2 + 1;
    } while (iVar2 < local_24);
  }
LAB_005099ea:
  iVar2 = 0;
  local_24 = 0;
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_30);
  local_20 = local_30;
  if (0 < local_24) {
    do {
      puVar1 = local_30 + iVar2;
      iVar2 = iVar2 + 1;
      operator_delete((void *)*puVar1);
    } while (iVar2 < local_24);
  }
  local_24 = 0;
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_30);
  local_24 = 0;
  local_20 = local_30;
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_30);
  local_20 = local_30;
  CUtlMemory<char*,int>::Purge((CUtlMemory<char*,int> *)&local_30);
  return uVar5;
}

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)