L L4D2node

UpgradeAddAutocomplete

0x00995830 · 262 bytes · __cdecl

_Z22UpgradeAddAutocompletePKcPA64_c

Decompiled

undefined (2 params)

/* UpgradeAddAutocomplete(char const*, char (*) [64]) */

int UpgradeAddAutocomplete(char *param_1,char *param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  char *pcVar4;
  int iVar5;
  int in_GS_OFFSET;
  int local_70;
  char local_60 [64];
  int local_20;
  
  local_70 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar1 = _V_strstr(param_1," ");
  if (iVar1 != 0) {
    iVar5 = 0;
    V_StrSlice(param_1,0,iVar1 - (int)param_1,local_60,0x40);
    iVar2 = _V_strlen(param_1 + (iVar1 - (int)param_1) + 1);
    local_70 = 0;
    do {
      iVar3 = GetUpgradeInfo(iVar5);
      if (iVar3 != 0) {
        pcVar4 = (char *)UpgradeToString(iVar5);
        iVar3 = V_strnicmp(pcVar4,param_1 + (iVar1 - (int)param_1) + 1,iVar2);
        if (iVar3 == 0) {
          iVar3 = local_70 + 1;
          V_snprintf(param_2 + local_70 * 0x40,0x40,"%s %s",local_60,pcVar4);
          local_70 = iVar3;
          if (iVar3 == 0x40) {
            local_70 = 0x40;
            break;
          }
        }
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 != 3);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return local_70;
}

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)