L L4D2node

CUtlLinkedList<CChangeTrack*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CChangeTrack*,int>,int>>::InsertBefore

0x001ef280 · 565 bytes · __thiscall

_ZN14CUtlLinkedListIP12CChangeTrackiLb0Ei10CUtlMemoryI19UtlLinkedListElem_tIS1_iEiEE12InsertBeforeEiRKS1_

Decompiled

undefined (3 params)

/* CUtlLinkedList<CChangeTrack*, int, false, int, CUtlMemory<UtlLinkedListElem_t<CChangeTrack*,
   int>, int> >::InsertBefore(int, CChangeTrack* const&) */

int __thiscall
CUtlLinkedList<CChangeTrack*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CChangeTrack*,int>,int>>::
InsertBefore(CUtlLinkedList<CChangeTrack*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CChangeTrack*,int>,int>>
             *this,int param_1,CChangeTrack **param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  
  iVar5 = *(int *)(this + 0x14);
  if (iVar5 != -1) {
    iVar6 = iVar5 * 0xc;
    iVar3 = *(int *)this + iVar6;
    *(undefined4 *)(this + 0x14) = *(undefined4 *)(iVar3 + 8);
    goto LAB_001ef2ab;
  }
  iVar3 = *(int *)(this + 0x20);
  iVar6 = *(int *)(this + 4);
  if ((iVar3 < 0) || (iVar6 <= iVar3)) {
    iVar5 = 0;
    if (iVar6 < 1) goto LAB_001ef346;
  }
  else {
    iVar5 = iVar3 + 1;
    if ((iVar5 < 0) || (iVar6 <= iVar5)) {
LAB_001ef346:
      iVar5 = *(int *)(this + 8);
      if (iVar5 < 0) {
        pvVar4 = *(void **)this;
      }
      else {
        iVar2 = iVar6 + 1;
        if (iVar5 == 0) {
          iVar5 = 3;
          if (iVar6 != 0) {
            iVar5 = iVar6;
          }
          while (iVar6 = iVar5, iVar6 < iVar2) {
            iVar5 = iVar6 * 2;
          }
        }
        else {
          for (iVar6 = iVar5 * (iVar6 / iVar5 + 1); iVar6 < iVar2; iVar6 = (iVar6 + iVar2) / 2) {
          }
        }
        *(int *)(this + 4) = iVar6;
        if (*(void **)this == (void *)0x0) {
          pvVar4 = malloc(iVar6 * 0xc);
          *(void **)this = pvVar4;
        }
        else {
          pvVar4 = realloc(*(void **)this,iVar6 * 0xc);
          iVar3 = *(int *)(this + 0x20);
          iVar6 = *(int *)(this + 4);
          *(void **)this = pvVar4;
        }
      }
      *(void **)(this + 0x24) = pvVar4;
      if ((iVar3 < 0) || (iVar6 <= iVar3)) {
        iVar5 = 0;
        if (iVar6 < 1) goto LAB_001ef3ce;
        goto LAB_001ef41a;
      }
      iVar5 = iVar3 + 1;
      if ((iVar5 < 0) || (iVar6 <= iVar5)) {
LAB_001ef3ce:
        if (AllocInternal(bool)::__executeCount < 10) {
          AllocInternal(bool)::__executeCount = AllocInternal(bool)::__executeCount + 1;
          Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
        }
        return -1;
      }
    }
    if (iVar5 == -1) {
      if (9 < AllocInternal(bool)::__executeCount) {
        return -1;
      }
      AllocInternal(bool)::__executeCount = AllocInternal(bool)::__executeCount + 1;
      Warning("CUtlLinkedList overflow! (exhausted index range)\n");
      return -1;
    }
  }
LAB_001ef41a:
  *(int *)(this + 0x20) = iVar5;
  *(int *)(this + 0x1c) = *(int *)(this + 0x1c) + 1;
  iVar6 = iVar5 * 0xc;
  iVar3 = *(int *)this + iVar6;
LAB_001ef2ab:
  *(int *)(iVar3 + 8) = iVar5;
  *(int *)(*(int *)this + 4 + iVar6) = iVar5;
  Unlink(this,iVar5);
  iVar3 = *(int *)this + iVar6;
  *(int *)(iVar3 + 8) = param_1;
  if (param_1 == -1) {
    iVar2 = *(int *)(this + 0x10);
    *(int *)(iVar3 + 4) = iVar2;
    *(int *)(this + 0x10) = iVar5;
  }
  else {
    iVar1 = *(int *)this + param_1 * 0xc;
    iVar2 = *(int *)(iVar1 + 4);
    *(int *)(iVar3 + 4) = iVar2;
    *(int *)(iVar1 + 4) = iVar5;
  }
  if (iVar2 == -1) {
    *(int *)(this + 0xc) = iVar5;
  }
  else {
    *(int *)(*(int *)this + iVar2 * 0xc + 8) = iVar5;
  }
  *(int *)(this + 0x18) = *(int *)(this + 0x18) + 1;
  if ((undefined4 *)(iVar6 + *(int *)this) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar6 + *(int *)this) = *param_2;
  }
  return iVar5;
}

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)