L L4D2node

Cbuf_Execute

0x00118150 · 933 bytes · unknown

_Z12Cbuf_Executev

Decompiled

undefined (0 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* Cbuf_Execute() */

int * Cbuf_Execute(void)

{
  char cVar1;
  int *piVar2;
  int *piVar3;
  undefined1 *this;
  int iVar4;
  bool bVar5;
  CCommandBuffer CVar6;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  int local_2c;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_44 = 0;
  local_40 = 0;
  if (_exit == 0) {
    local_2c = 0;
  }
  else {
    (**(code **)(_exit + 0x50))
              (_exit,&local_44,0,0,0,0,"/data/src/engine/./cmd.cpp",0x18a,&Cbuf_Execute()::tm_fmt,
               "(%s)%s","Unaccounted","Cbuf_Execute");
    local_2c = _exit;
  }
  piVar2 = _DAT_0040b9d4;
  local_34 = local_44;
  local_30 = local_40;
                    /* try { // try from 001183f6 to 00118444 has its CatchHandler @ 001184f5 */
  if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
     (piVar3 = (int *)ThreadGetCurrentId(), piVar2 == piVar3)) {
    if ((char *)*_DAT_0040b030 != "Cbuf_Execute") {
      _DAT_0040b030 =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2aa6a5,&DAT_00000001,0x2a054b);
    }
    CVProfNode::EnterScope();
    DAT_0040b02c = '\0';
  }
  local_3c = 0;
  local_38 = 0;
  if (_g_Telemetry == 0) {
    local_20 = 0;
  }
  else {
                    /* try { // try from 0011826e to 00118270 has its CatchHandler @ 00118590 */
    (**(code **)(_g_Telemetry + 0x50))
              (_g_Telemetry,&local_3c,0,0x32,0,0,"/data/src/engine/./cmd.cpp",0x18b,
               &Cbuf_Execute()::tm_fmt,&DAT_002c48a3,"Cbuf_Execute");
    local_20 = _g_Telemetry;
  }
  local_28 = local_3c;
  local_24 = local_38;
                    /* try { // try from 00118286 to 001182ac has its CatchHandler @ 0011850a */
  cVar1 = ThreadInMainThread();
  if ((cVar1 == '\0') &&
     (Warning("Executing command outside main loop thread\n"), Cbuf_Execute()::__executeCount < 1))
  {
    Cbuf_Execute()::__executeCount = Cbuf_Execute()::__executeCount + 1;
    cVar1 = Plat_IsInDebugSession(0);
    if (cVar1 != '\0') {
      raise(5);
    }
  }
  piVar2 = (int *)ThreadGetCurrentId();
  if (piVar2 != s_CommandBufferMutex) {
    LOCK();
    bVar5 = s_CommandBufferMutex != (int *)0x0;
    piVar3 = piVar2;
    if (bVar5) {
      piVar3 = s_CommandBufferMutex;
    }
    s_CommandBufferMutex = piVar3;
    UNLOCK();
    if (bVar5) {
                    /* try { // try from 001184a8 to 001184d0 has its CatchHandler @ 0011850a */
      CThreadFastMutex::Lock(0x3887e8,(uint)piVar2);
      goto LAB_001182d5;
    }
  }
  DAT_003887ec = (int *)((int)DAT_003887ec + 1);
LAB_001182d5:
  this = s_CommandBuffer;
  CVar6 = (CCommandBuffer)(*(int *)(sv_allow_wait_command._28_4_ + 0x30) != 0);
  iVar4 = 0;
  do {
                    /* try { // try from 001182ed to 0011833c has its CatchHandler @ 0011856c */
    cVar1 = CCommandBuffer::IsProcessingCommands((CCommandBuffer *)this);
    if (cVar1 == '\0') {
      if (*(CCommandBuffer *)(this + 0x2049) != CVar6) {
        *(CCommandBuffer *)(this + 0x2049) = CVar6;
      }
      CCommandBuffer::BeginProcessingCommands((CCommandBuffer *)this,1);
      while (cVar1 = CCommandBuffer::DequeueNextCommand((CCommandBuffer *)this), cVar1 != '\0') {
        Cbuf_ExecuteCommand(iVar4,(CCommandBuffer *)(this + 0x204c));
      }
      CCommandBuffer::EndProcessingCommands((CCommandBuffer *)this);
    }
    iVar4 = iVar4 + 1;
    this = this + 0x2554;
  } while (iVar4 != 5);
  DAT_003887ec = (int *)((int)DAT_003887ec + -1);
  piVar2 = DAT_003887ec;
  if (DAT_003887ec == (int *)0x0) {
    LOCK();
    UNLOCK();
    piVar2 = s_CommandBufferMutex;
    s_CommandBufferMutex = (int *)0x0;
  }
  if (local_20 != 0) {
    piVar2 = (int *)(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
  }
  piVar3 = _DAT_0040b9d4;
  if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
     (piVar2 = (int *)ThreadGetCurrentId(), piVar3 == piVar2)) {
    cVar1 = CVProfNode::ExitScope();
    if (cVar1 != '\0') {
      _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
    }
    DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
    piVar2 = _DAT_0040b030;
  }
  if (local_2c != 0) {
    piVar2 = (int *)(**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
  }
  return piVar2;
}

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)