L L4D2node

CCommandBuffer::InsertCommand

0x00246480 · 288 bytes · __thiscall

_ZN14CCommandBuffer13InsertCommandEPKcii

Decompiled

undefined (4 params)

/* CCommandBuffer::InsertCommand(char const*, int, int) */

CCommandBuffer __thiscall
CCommandBuffer::InsertCommand(CCommandBuffer *this,char *param_1,int param_2,int param_3)

{
  CCommandBuffer CVar1;
  int iVar2;
  int *piVar3;
  
  if (0x1fe < param_2) {
    Warning("WARNING: Command too long... ignoring!\n%s\n",param_1);
    return (CCommandBuffer)0x0;
  }
  iVar2 = *(int *)(this + 0x2004);
  if (*(int *)(this + 0x2044) <= iVar2 + param_2) {
    Compact(this);
    iVar2 = *(int *)(this + 0x2004);
    if (*(int *)(this + 0x2044) <= iVar2 + param_2) {
      return (CCommandBuffer)0x0;
    }
  }
  memcpy(this + iVar2,param_1,param_2);
  this[param_2 + *(int *)(this + 0x2004)] = (CCommandBuffer)0x0;
  piVar3 = (int *)CUtlLinkedList<CCommandBuffer::Command_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<CCommandBuffer::Command_t,int>>>
                  ::AllocInternal((CUtlLinkedList<CCommandBuffer::Command_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<CCommandBuffer::Command_t,int>>>
                                   *)(this + 0x2008),false);
  *piVar3 = param_3;
  iVar2 = *(int *)(this + 0x2004);
  piVar3[2] = param_2 + 1;
  piVar3[1] = iVar2;
  CVar1 = this[0x2048];
  *(int *)(this + 0x2004) = *(int *)(this + 0x2004) + param_2 + 1;
  if ((CVar1 != (CCommandBuffer)0x0) && (param_3 <= *(int *)(this + 0x2034))) {
    CUtlLinkedList<CCommandBuffer::Command_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<CCommandBuffer::Command_t,int>>>
    ::LinkBefore((CUtlLinkedList<CCommandBuffer::Command_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<CCommandBuffer::Command_t,int>>>
                  *)(this + 0x2008),*(int *)(this + 0x2040),(int)piVar3);
    return CVar1;
  }
  InsertCommandAtAppropriateTime(this,(int)piVar3);
  return (CCommandBuffer)0x1;
}

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)