L L4D2node

Cbuf_AddText

0x00116d30 · 161 bytes · __cdecl

_Z12Cbuf_AddText16ECommandTarget_tPKci

Decompiled

undefined (3 params)

/* Cbuf_AddText(ECommandTarget_t, char const*, int) */

uint Cbuf_AddText(int param_1,char *param_2,int param_3)

{
  uint uVar1;
  char cVar2;
  uint uVar3;
  bool bVar4;
  
  uVar3 = ThreadGetCurrentId();
  if (uVar3 != s_CommandBufferMutex) {
    LOCK();
    bVar4 = s_CommandBufferMutex != 0;
    uVar1 = uVar3;
    if (bVar4) {
      uVar1 = s_CommandBufferMutex;
    }
    s_CommandBufferMutex = uVar1;
    UNLOCK();
    if (bVar4) {
      CThreadFastMutex::Lock(0x3887e8,uVar3);
      goto LAB_00116d5f;
    }
  }
  DAT_003887ec = DAT_003887ec + 1;
LAB_00116d5f:
                    /* try { // try from 00116d7e to 00116d82 has its CatchHandler @ 00116dde */
  cVar2 = CCommandBuffer::AddText
                    ((CCommandBuffer *)(s_CommandBuffer + param_1 * 0x2554),param_2,param_3);
  if (cVar2 == '\0') {
                    /* try { // try from 00116dd7 to 00116ddb has its CatchHandler @ 00116dde */
    ConMsg("Cbuf_AddText: buffer overflow\n");
  }
  uVar3 = s_CommandBufferMutex;
  DAT_003887ec = DAT_003887ec - 1;
  if (DAT_003887ec == 0) {
    LOCK();
    s_CommandBufferMutex = DAT_003887ec;
    UNLOCK();
    return uVar3;
  }
  return DAT_003887ec;
}

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)