L L4D2node

CDatacenter::CreateCmdBatch

0x0005ba70 · 301 bytes · __thiscall

_ZN11CDatacenter14CreateCmdBatchEv

Decompiled

undefined (1 param)

/* CDatacenter::CreateCmdBatch() */

undefined4 * __thiscall CDatacenter::CreateCmdBatch(CDatacenter *this)

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  
  puVar2 = operator_new(0x1c);
  *puVar2 = &PTR_AddCommand_000b4b68;
  puVar2[2] = 0;
  puVar2[1] = this;
  puVar2[3] = 0;
  puVar2[4] = 0;
  puVar2[5] = 0;
  puVar2[6] = 0;
  iVar1 = *(int *)(this + 0x2c);
  iVar5 = *(int *)(this + 0x24);
  iVar6 = iVar1 + 1;
  if (iVar5 < iVar6) {
    iVar3 = *(int *)(this + 0x28);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar5 == 0) {
          if (iVar6 < 9) {
            iVar3 = 8;
            goto LAB_0005bb3f;
          }
          iVar5 = 8;
        }
        do {
          iVar3 = iVar5 * 2;
          if (iVar6 <= iVar3) break;
          iVar3 = iVar5 * 4;
          iVar5 = iVar3;
        } while (iVar3 < iVar6);
      }
      else {
        for (iVar3 = (iVar1 / iVar3 + 1) * iVar3; iVar3 < iVar6; iVar3 = (iVar3 + iVar6) / 2) {
        }
      }
LAB_0005bb3f:
      *(int *)(this + 0x24) = iVar3;
      if (*(void **)(this + 0x20) == (void *)0x0) {
        pvVar4 = malloc(iVar3 << 2);
        *(void **)(this + 0x20) = pvVar4;
      }
      else {
        pvVar4 = realloc(*(void **)(this + 0x20),iVar3 << 2);
        *(void **)(this + 0x20) = pvVar4;
        iVar6 = *(int *)(this + 0x2c) + 1;
      }
      goto LAB_0005bac6;
    }
  }
  pvVar4 = *(void **)(this + 0x20);
LAB_0005bac6:
  *(int *)(this + 0x2c) = iVar6;
  iVar6 = (iVar6 - iVar1) + -1;
  *(void **)(this + 0x30) = pvVar4;
  iVar1 = iVar1 * 4;
  if (0 < iVar6) {
    _V_memmove((void *)((int)pvVar4 + iVar1 + 4),(void *)((int)pvVar4 + iVar1),iVar6 * 4);
    pvVar4 = *(void **)(this + 0x20);
  }
  if ((undefined4 *)((int)pvVar4 + iVar1) != (undefined4 *)0x0) {
    *(undefined4 *)((int)pvVar4 + iVar1) = puVar2;
  }
  return puVar2;
}

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)