L L4D2node

CDatacenterCmdBatchImpl::AddCommand

0x0005bbb0 · 251 bytes · __thiscall

_ZN23CDatacenterCmdBatchImpl10AddCommandEP9KeyValues

Decompiled

undefined (2 params)

/* CDatacenterCmdBatchImpl::AddCommand(KeyValues*) */

void __thiscall
CDatacenterCmdBatchImpl::AddCommand(CDatacenterCmdBatchImpl *this,KeyValues *param_1)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  
  if (param_1 == (KeyValues *)0x0) {
    return;
  }
  uVar2 = KeyValues::MakeCopy(param_1);
  iVar1 = *(int *)(this + 0x14);
  iVar6 = *(int *)(this + 0xc);
  iVar5 = iVar1 + 1;
  if (iVar6 < iVar5) {
    iVar3 = *(int *)(this + 0x10);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar6 == 0) {
          if (iVar5 < 9) {
            iVar3 = 8;
            goto LAB_0005bc5f;
          }
          iVar6 = 8;
        }
        do {
          iVar3 = iVar6 * 2;
          if (iVar5 <= iVar3) break;
          iVar3 = iVar6 * 4;
          iVar6 = iVar3;
        } while (iVar3 < iVar5);
      }
      else {
        for (iVar3 = (iVar1 / iVar3 + 1) * iVar3; iVar3 < iVar5; iVar3 = (iVar3 + iVar5) / 2) {
        }
      }
LAB_0005bc5f:
      *(int *)(this + 0xc) = iVar3;
      if (*(void **)(this + 8) == (void *)0x0) {
        pvVar4 = malloc(iVar3 << 2);
        *(void **)(this + 8) = pvVar4;
      }
      else {
        pvVar4 = realloc(*(void **)(this + 8),iVar3 << 2);
        *(void **)(this + 8) = pvVar4;
        iVar5 = *(int *)(this + 0x14) + 1;
      }
      goto LAB_0005bbde;
    }
  }
  pvVar4 = *(void **)(this + 8);
LAB_0005bbde:
  *(int *)(this + 0x14) = iVar5;
  iVar6 = iVar1 * 4;
  iVar5 = (iVar5 - iVar1) + -1;
  *(void **)(this + 0x18) = pvVar4;
  if (0 < iVar5) {
    _V_memmove((void *)((int)pvVar4 + iVar6 + 4),(void *)((int)pvVar4 + iVar6),iVar5 * 4);
    pvVar4 = *(void **)(this + 8);
  }
  if ((undefined4 *)(iVar6 + (int)pvVar4) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar6 + (int)pvVar4) = uVar2;
  }
  return;
}

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)