L L4D2node

CBasePlayer::ProcessUsercmds

0x007bc980 · 556 bytes · __thiscall

_ZN11CBasePlayer15ProcessUsercmdsEP8CUserCmdiiib

Decompiled

undefined (6 params)

/* CBasePlayer::ProcessUsercmds(CUserCmd*, int, int, int, bool) */

void __thiscall
CBasePlayer::ProcessUsercmds
          (CBasePlayer *this,CUserCmd *param_1,int param_2,int param_3,int param_4,bool param_5)

{
  CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>> *this_00;
  ushort uVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  bool bVar5;
  undefined4 local_28;
  int local_24;
  int local_20;
  
  iVar2 = CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>>::InsertBefore
                    ((CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>> *)(this + 0x1dc0),
                     *(int *)(this + 0x1dcc));
  iVar4 = param_3 + -1;
  this_00 = (CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>> *)
            (*(int *)(this + 0x1dc0) + iVar2 * 0x24);
  if (-1 < iVar4) {
    do {
      iVar4 = iVar4 + -1;
      CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>>::InsertBefore
                (this_00,*(int *)(this_00 + 0xc),param_1);
      param_1 = param_1 + 0x58;
    } while (iVar4 != -1);
  }
  *(int *)(this_00 + 0x14) = param_2;
  this_00[0x20] = (CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>>)param_5;
  *(int *)(this_00 + 0x18) = param_3;
  *(int *)(this_00 + 0x1c) = param_4;
  if (param_5) {
    bVar5 = true;
    if ((this[0x186] == (CBasePlayer)0x8) && (*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) != 0)) {
      bVar5 = *(int *)(sv_noclipduringpause._28_4_ + 0x30) == 0;
    }
    iVar2 = 0;
    iVar4 = 0;
    if (0 < param_2) {
      do {
        *(undefined4 *)(*(int *)this_00 + 0x24 + iVar2) = 0;
        if (bVar5) {
          *(undefined4 *)(*(int *)this_00 + 0x18 + iVar2) = 0;
          *(undefined4 *)(*(int *)this_00 + 0x1c + iVar2) = 0;
          *(undefined4 *)(*(int *)this_00 + 0x20 + iVar2) = 0;
          iVar3 = *(int *)this_00 + iVar2;
          *(undefined4 *)(iVar3 + 0xc) = *(undefined4 *)(this + 0x1c84);
          *(undefined4 *)(iVar3 + 0x10) = *(undefined4 *)(this + 0x1c88);
          *(undefined4 *)(iVar3 + 0x14) = *(undefined4 *)(this + 0x1c8c);
        }
        iVar4 = iVar4 + 1;
        iVar2 = iVar2 + 0x58;
      } while (iVar4 < *(int *)(this_00 + 0x14));
    }
    *(undefined4 *)(this_00 + 0x1c) = 0;
    this[0x205c] = (CBasePlayer)0x1;
    *(undefined4 *)(this + 300) = 0xffffffff;
    (**(code **)(*(int *)this + 0x1c8))(this);
  }
  else {
    this[0x205c] = (CBasePlayer)0x0;
  }
  if (0 < *(int *)(sv_playerperfhistorycount._28_4_ + 0x30)) {
    local_28 = *gpGlobals;
    local_20 = param_4;
    local_24 = param_2;
    if (*(int *)(sv_playerperfhistorycount._28_4_ + 0x30) <= (int)(uint)*(ushort *)(this + 0x2316))
    {
      do {
        uVar1 = *(ushort *)(this + 0x2310);
        CUtlLinkedList<CPlayerCmdInfo,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CPlayerCmdInfo,unsigned_short>,unsigned_short>>
        ::Unlink((CUtlLinkedList<CPlayerCmdInfo,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CPlayerCmdInfo,unsigned_short>,unsigned_short>>
                  *)(this + 0x2304),uVar1);
        *(undefined2 *)((uint)uVar1 * 0x10 + *(int *)(this + 0x2304) + 0xe) =
             *(undefined2 *)(this + 0x2314);
        *(ushort *)(this + 0x2314) = uVar1;
      } while (*(int *)(sv_playerperfhistorycount._28_4_ + 0x30) <=
               (int)(uint)*(ushort *)(this + 0x2316));
    }
    CUtlLinkedList<CPlayerCmdInfo,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CPlayerCmdInfo,unsigned_short>,unsigned_short>>
    ::InsertBefore((CUtlLinkedList<CPlayerCmdInfo,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CPlayerCmdInfo,unsigned_short>,unsigned_short>>
                    *)(this + 0x2304),0xffff,(CPlayerCmdInfo *)&local_28);
  }
  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)