L L4D2node

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

0x00662030 · 522 bytes · __thiscall

_ZN14CUtlLinkedListIP13CDamageRecordiLb0Ei10CUtlMemoryI19UtlLinkedListElem_tIS1_iEiEE12InsertBeforeEi

Decompiled

undefined (2 params)

/* CUtlLinkedList<CDamageRecord*, int, false, int, CUtlMemory<UtlLinkedListElem_t<CDamageRecord*,
   int>, int> >::InsertBefore(int) */

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

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  int iVar4;
  int iVar5;
  
  iVar4 = *(int *)(this + 0x14);
  if (iVar4 != -1) {
    iVar5 = iVar4 * 0xc;
    iVar2 = *(int *)this + iVar5;
    *(undefined4 *)(this + 0x14) = *(undefined4 *)(iVar2 + 8);
    goto LAB_00662054;
  }
  iVar2 = *(int *)(this + 0x20);
  iVar5 = *(int *)(this + 4);
  if ((iVar2 < 0) || (iVar5 <= iVar2)) {
    iVar4 = 0;
    if (iVar5 < 1) goto LAB_006620d6;
  }
  else {
    iVar4 = iVar2 + 1;
    if ((iVar4 < 0) || (iVar5 <= iVar4)) {
LAB_006620d6:
      iVar4 = *(int *)(this + 8);
      if (iVar4 < 0) {
        pvVar3 = *(void **)this;
      }
      else {
        iVar1 = iVar5 + 1;
        if (iVar4 == 0) {
          iVar4 = 3;
          if (iVar5 != 0) {
            iVar4 = iVar5;
          }
          while (iVar5 = iVar4, iVar5 < iVar1) {
            iVar4 = iVar5 * 2;
          }
        }
        else {
          for (iVar5 = iVar4 * (iVar5 / iVar4 + 1); iVar5 < iVar1; iVar5 = (iVar5 + iVar1) / 2) {
          }
        }
        *(int *)(this + 4) = iVar5;
        if (*(void **)this == (void *)0x0) {
          pvVar3 = malloc(iVar5 * 0xc);
          *(void **)this = pvVar3;
        }
        else {
          pvVar3 = realloc(*(void **)this,iVar5 * 0xc);
          iVar2 = *(int *)(this + 0x20);
          iVar5 = *(int *)(this + 4);
          *(void **)this = pvVar3;
        }
      }
      *(void **)(this + 0x24) = pvVar3;
      if ((iVar2 < 0) || (iVar5 <= iVar2)) {
        iVar4 = 0;
        if (iVar5 < 1) goto LAB_00662156;
        goto LAB_0066219a;
      }
      iVar4 = iVar2 + 1;
      if ((iVar4 < 0) || (iVar5 <= iVar4)) {
LAB_00662156:
        if (AllocInternal(bool)::__executeCount < 10) {
          AllocInternal(bool)::__executeCount = AllocInternal(bool)::__executeCount + 1;
          Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
        }
        return -1;
      }
    }
    if (iVar4 == -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_0066219a:
  *(int *)(this + 0x20) = iVar4;
  *(int *)(this + 0x1c) = *(int *)(this + 0x1c) + 1;
  iVar5 = iVar4 * 0xc;
  iVar2 = *(int *)this + iVar5;
LAB_00662054:
  *(int *)(iVar2 + 8) = iVar4;
  *(int *)(*(int *)this + 4 + iVar5) = iVar4;
  Unlink(this,iVar4);
  iVar5 = iVar5 + *(int *)this;
  *(int *)(iVar5 + 8) = param_1;
  if (param_1 == -1) {
    iVar2 = *(int *)(this + 0x10);
    *(int *)(iVar5 + 4) = iVar2;
    *(int *)(this + 0x10) = iVar4;
  }
  else {
    iVar1 = *(int *)this + param_1 * 0xc;
    iVar2 = *(int *)(iVar1 + 4);
    *(int *)(iVar5 + 4) = iVar2;
    *(int *)(iVar1 + 4) = iVar4;
  }
  if (iVar2 == -1) {
    *(int *)(this + 0xc) = iVar4;
  }
  else {
    *(int *)(*(int *)this + iVar2 * 0xc + 8) = iVar4;
  }
  *(int *)(this + 0x18) = *(int *)(this + 0x18) + 1;
  return iVar4;
}

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)