L L4D2node

CSoundEnt::FindOrAllocateSound

0x0082c660 · 230 bytes · __thiscall

_ZN9CSoundEnt19FindOrAllocateSoundEP11CBaseEntityi

Decompiled

undefined (3 params)

/* CSoundEnt::FindOrAllocateSound(CBaseEntity*, int) */

void __thiscall CSoundEnt::FindOrAllocateSound(CSoundEnt *this,CBaseEntity *param_1,int param_2)

{
  uint uVar1;
  int iVar2;
  undefined *puVar3;
  undefined2 local_30;
  CBaseEntity *local_24;
  
  iVar2 = *(int *)(this + 0x444);
  do {
    if (iVar2 == -1) {
      iVar2 = *(int *)(this + 0x440);
      if (iVar2 != -1) {
        local_30 = (undefined2)*(int *)(this + 0x444);
        *(int *)(this + 0x440) = (int)*(short *)(this + iVar2 * 0x34 + 0x468);
        *(undefined2 *)(this + iVar2 * 0x34 + 0x468) = local_30;
        *(int *)(this + 0x444) = iVar2;
        return;
      }
      IAllocSound();
      return;
    }
    iVar2 = iVar2 * 0x34;
    if (*(int *)(this + iVar2 + 0x46c) == param_2) {
      uVar1 = *(uint *)(this + iVar2 + 0x44c);
      local_24 = (CBaseEntity *)0x0;
      if (((uVar1 != 0xffffffff) &&
          (puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) {
        local_24 = *(CBaseEntity **)(puVar3 + 4);
      }
      if (param_1 == local_24) {
        return;
      }
    }
    iVar2 = (int)*(short *)(this + iVar2 + 0x468);
  } while( true );
}

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)