L L4D2node

CollectMusicBanks

0x008b2110 · 350 bytes · __regparm3

_ZL17CollectMusicBanksPKcP9KeyValuesP10CUtlVectorIPc10CUtlMemoryIS4_iEE

Decompiled

undefined (3 params)

/* CollectMusicBanks(char const*, KeyValues*, CUtlVector<char*, CUtlMemory<char*, int> >*) */

void __regparm3 CollectMusicBanks(char *param_1,KeyValues *param_2,CUtlVector *param_3)

{
  undefined4 *puVar1;
  void *pvVar2;
  undefined4 uVar3;
  char *__s;
  int iVar4;
  size_t sVar5;
  char *__dest;
  int iVar6;
  int iVar7;
  char local_30 [16];
  char *local_20 [4];
  
  iVar7 = 0;
  if (0 < *(int *)(param_3 + 0xc)) {
    do {
      pvVar2 = *(void **)(*(int *)param_3 + iVar7 * 4);
      if (pvVar2 != (void *)0x0) {
        operator_delete__(pvVar2);
      }
      iVar7 = iVar7 + 1;
    } while (iVar7 < *(int *)(param_3 + 0xc));
  }
  *(undefined4 *)(param_3 + 0xc) = 0;
  for (; param_2 != (KeyValues *)0x0; param_2 = (KeyValues *)KeyValues::GetNextKey(param_2)) {
    do {
      iVar7 = KeyValues::GetFirstSubKey(param_2);
    } while (iVar7 == 0);
    __s = (char *)KeyValues::GetName(param_2);
    iVar7 = _V_strlen(param_1);
    iVar7 = V_strnicmp(__s,param_1,iVar7);
    if (iVar7 == 0) {
      AllocPooledString(local_30);
      sVar5 = strlen(__s);
      __dest = operator_new__(sVar5 + 1);
      strcpy(__dest,__s);
      local_20[0] = __dest;
      CUtlVector<char*,CUtlMemory<char*,int>>::InsertBefore
                ((CUtlVector<char*,CUtlMemory<char*,int>> *)param_3,*(int *)(param_3 + 0xc),local_20
                );
    }
  }
  iVar6 = *(int *)(param_3 + 0xc);
  iVar7 = iVar6 + -1;
  if (0 < iVar7) {
    iVar6 = 0;
    do {
      iVar4 = RandomInt(iVar6,iVar7);
      puVar1 = (undefined4 *)(*(int *)param_3 + iVar6 * 4);
      iVar6 = iVar6 + 1;
      uVar3 = *puVar1;
      *puVar1 = *(undefined4 *)(*(int *)param_3 + iVar4 * 4);
      *(undefined4 *)(*(int *)param_3 + iVar4 * 4) = uVar3;
    } while (iVar6 != iVar7);
    iVar6 = *(int *)(param_3 + 0xc);
  }
joined_r0x008b21de:
  if (iVar6 < 5) {
    return;
  }
  if ((void *)**(undefined4 **)param_3 != (void *)0x0) goto code_r0x008b21e8;
  goto LAB_008b21f7;
code_r0x008b21e8:
  operator_delete__((void *)**(undefined4 **)param_3);
  iVar6 = *(int *)(param_3 + 0xc);
  if (0 < iVar6) {
LAB_008b21f7:
    iVar7 = iVar6 + -1;
    iVar6 = 0;
    if (iVar7 != 0) {
      **(undefined4 **)param_3 = (*(undefined4 **)param_3)[iVar7];
      iVar6 = *(int *)(param_3 + 0xc) + -1;
    }
    *(int *)(param_3 + 0xc) = iVar6;
  }
  goto joined_r0x008b21de;
}

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)