L L4D2node

CUtlVector<GCSDK::FKData_t,CUtlMemory<GCSDK::FKData_t,int>>::InsertBefore

0x000972e0 · 419 bytes · __thiscall

_ZN10CUtlVectorIN5GCSDK8FKData_tE10CUtlMemoryIS1_iEE12InsertBeforeEiRKS1_

Decompiled

undefined (3 params)

/* CUtlVector<GCSDK::FKData_t, CUtlMemory<GCSDK::FKData_t, int> >::InsertBefore(int, GCSDK::FKData_t
   const&) */

int __thiscall
CUtlVector<GCSDK::FKData_t,CUtlMemory<GCSDK::FKData_t,int>>::InsertBefore
          (CUtlVector<GCSDK::FKData_t,CUtlMemory<GCSDK::FKData_t,int>> *this,int param_1,
          FKData_t *param_2)

{
  void *pvVar1;
  int iVar2;
  int iVar3;
  FKData_t *pFVar4;
  FKData_t *pFVar5;
  int iVar6;
  FKData_t *pFVar7;
  byte bVar8;
  
  bVar8 = 0;
  iVar6 = *(int *)(this + 4);
  iVar3 = *(int *)(this + 0xc) + 1;
  if (iVar6 < iVar3) {
    iVar2 = *(int *)(this + 8);
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (iVar6 == 0) {
          if (iVar3 < 2) {
            iVar2 = 1;
            goto LAB_0009742f;
          }
          iVar6 = 1;
        }
        do {
          iVar2 = iVar6 * 2;
          if (iVar3 <= iVar2) break;
          iVar2 = iVar6 * 4;
          iVar6 = iVar2;
        } while (iVar2 < iVar3);
      }
      else {
        for (iVar2 = iVar2 * (*(int *)(this + 0xc) / iVar2 + 1); iVar2 < iVar3;
            iVar2 = (iVar2 + iVar3) / 2) {
        }
      }
LAB_0009742f:
      *(int *)(this + 4) = iVar2;
      if (*(void **)this == (void *)0x0) {
        pvVar1 = malloc(iVar2 * 0x124);
        *(void **)this = pvVar1;
      }
      else {
        pvVar1 = realloc(*(void **)this,iVar2 * 0x124);
        *(void **)this = pvVar1;
        iVar3 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_000972ff;
    }
  }
  pvVar1 = *(void **)this;
LAB_000972ff:
  *(int *)(this + 0xc) = iVar3;
  *(void **)(this + 0x10) = pvVar1;
  iVar6 = (iVar3 - param_1) + -1;
  iVar3 = param_1 * 0x124;
  if (0 < iVar6) {
    _V_memmove((void *)((int)pvVar1 + iVar3 + 0x124),(void *)((int)pvVar1 + iVar3),iVar6 * 0x124);
    pvVar1 = *(void **)this;
  }
  pFVar4 = (FKData_t *)(iVar3 + (int)pvVar1);
  if (pFVar4 != (FKData_t *)0x0) {
    pFVar5 = param_2;
    pFVar7 = pFVar4;
    for (iVar3 = 0x20; iVar3 != 0; iVar3 = iVar3 + -1) {
      *(undefined4 *)pFVar7 = *(undefined4 *)pFVar5;
      pFVar5 = pFVar5 + (uint)bVar8 * -8 + 4;
      pFVar7 = pFVar7 + (uint)bVar8 * -8 + 4;
    }
    *pFVar7 = *pFVar5;
    pFVar5 = param_2 + 0x81;
    pFVar7 = pFVar4 + 0x81;
    for (iVar3 = 0x20; iVar3 != 0; iVar3 = iVar3 + -1) {
      *(undefined4 *)pFVar7 = *(undefined4 *)pFVar5;
      pFVar5 = pFVar5 + (uint)bVar8 * -8 + 4;
      pFVar7 = pFVar7 + (uint)bVar8 * -8 + 4;
    }
    *pFVar7 = *pFVar5;
    *(undefined4 *)(pFVar4 + 0x108) = 0;
    *(undefined4 *)(pFVar4 + 0x10c) = 0;
    *(undefined4 *)(pFVar4 + 0x110) = 0;
    *(undefined4 *)(pFVar4 + 0x114) = 0;
    *(undefined4 *)(pFVar4 + 0x118) = 0;
    *(undefined ***)(pFVar4 + 0x104) = &PTR__CCopyableUtlVector_000b6100;
                    /* try { // try from 000973ca to 000973ce has its CatchHandler @ 00097496 */
    CUtlVector<GCSDK::FKColumnRelation_t,CUtlMemory<GCSDK::FKColumnRelation_t,int>>::CopyArray
              ((CUtlVector<GCSDK::FKColumnRelation_t,CUtlMemory<GCSDK::FKColumnRelation_t,int>> *)
               (pFVar4 + 0x108),*(FKColumnRelation_t **)(param_2 + 0x108),*(int *)(param_2 + 0x114))
    ;
    *(undefined4 *)(pFVar4 + 0x11c) = *(undefined4 *)(param_2 + 0x11c);
    *(undefined4 *)(pFVar4 + 0x120) = *(undefined4 *)(param_2 + 0x120);
  }
  return param_1;
}

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)