L L4D2node

CServerRemoteAccess::WriteDataRequest

0x0020f940 · 1893 bytes · __thiscall

_ZN19CServerRemoteAccess16WriteDataRequestEP11CRConServerjPKvi

Decompiled

undefined (5 params)

/* CServerRemoteAccess::WriteDataRequest(CRConServer*, unsigned int, void const*, int) */

void __thiscall
CServerRemoteAccess::WriteDataRequest
          (CServerRemoteAccess *this,CRConServer *param_1,uint param_2,void *param_3,int param_4)

{
  char cVar1;
  int iVar2;
  long lVar3;
  undefined4 uVar4;
  int *piVar5;
  undefined4 *puVar6;
  int iVar7;
  int in_GS_OFFSET;
  char *pcVar8;
  int local_368;
  undefined4 local_364;
  undefined4 local_360;
  undefined4 local_35c;
  int local_358;
  int local_354;
  int local_34c;
  undefined4 local_348;
  undefined1 local_344;
  byte local_343;
  undefined4 local_33c;
  int local_338;
  byte local_324;
  char local_320 [256];
  char local_220 [512];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  *(int *)(this + 0x5c) = *(int *)(this + 0x5c) + param_4;
  if (7 < (uint)param_4) {
    CUtlBuffer::CUtlBuffer((CUtlBuffer *)&local_358,param_3,param_4,8);
    iVar2 = param_2 * 0x1c;
LAB_0020f9d0:
    do {
      if (local_354 + -8 <= local_34c) break;
      if ((local_343 & 1) == 0) {
        cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)&local_358,4);
        if (cVar1 == '\0') {
          iVar7 = 0;
        }
        else {
          if ((local_324 & 1) == 0) {
            iVar7 = *(int *)(local_358 + (local_34c - local_338));
          }
          else {
            piVar5 = (int *)((local_34c - local_338) + local_358);
            if (piVar5 == (int *)0x0) {
              piVar5 = &local_368;
            }
            local_360 = local_368;
            local_360 = CONCAT31((int3)((uint)local_368 >> 8),*(undefined1 *)((int)piVar5 + 3));
            local_360._2_2_ = (undefined2)((uint)local_368 >> 0x10);
            local_360._0_2_ =
                 CONCAT11(*(undefined1 *)((int)piVar5 + 2),*(undefined1 *)((int)piVar5 + 3));
            local_360._3_1_ = (undefined1)((uint)local_368 >> 0x18);
            local_360._0_3_ = CONCAT12(*(undefined1 *)((int)piVar5 + 1),(undefined2)local_360);
            local_360 = CONCAT13((char)*piVar5,(undefined3)local_360);
            _V_memcpy(&local_368,&local_360,4);
            iVar7 = local_368;
          }
          local_34c = local_34c + 4;
        }
      }
      else {
        local_368 = 0;
                    /* try { // try from 0020fa11 to 002100c8 has its CatchHandler @ 002100ec */
        CUtlBuffer::Scanf((CUtlBuffer *)&local_358,"%d",&local_368);
        iVar7 = local_368;
      }
      CRConServer::SetRequestID(param_1,param_2,iVar7);
      if ((local_343 & 1) == 0) {
        cVar1 = CUtlBuffer::CheckGet((CUtlBuffer *)&local_358,4);
        if (cVar1 != '\0') {
          if ((local_324 & 1) == 0) {
            uVar4 = *(undefined4 *)(local_358 + (local_34c - local_338));
          }
          else {
            puVar6 = (undefined4 *)((local_34c - local_338) + local_358);
            if (puVar6 == (undefined4 *)0x0) {
              puVar6 = &local_364;
            }
            local_35c = local_364;
            local_35c = CONCAT31((int3)((uint)local_364 >> 8),*(undefined1 *)((int)puVar6 + 3));
            local_35c._2_2_ = (undefined2)((uint)local_364 >> 0x10);
            local_35c._0_2_ =
                 CONCAT11(*(undefined1 *)((int)puVar6 + 2),*(undefined1 *)((int)puVar6 + 3));
            local_35c._3_1_ = (undefined1)((uint)local_364 >> 0x18);
            local_35c._0_3_ = CONCAT12(*(undefined1 *)((int)puVar6 + 1),(undefined2)local_35c);
            local_35c = CONCAT13(*(undefined1 *)puVar6,(undefined3)local_35c);
            _V_memcpy(&local_364,&local_35c,4);
            uVar4 = local_364;
          }
          local_34c = local_34c + 4;
          goto code_r0x0020fe70;
        }
switchD_0020fa75_caseD_0:
        if (*(char *)(*(int *)(this + 0x2c) + 4 + iVar2) == '\0') {
          cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x100);
          if (cVar1 == '\0') break;
        }
        else {
          cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x100);
          if (cVar1 == '\0') break;
          RequestValue(this,param_2,iVar7,local_220);
        }
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x100);
        goto LAB_0020fd53;
      }
      local_364 = 0;
      CUtlBuffer::Scanf((CUtlBuffer *)&local_358,"%d",&local_364);
      uVar4 = local_364;
code_r0x0020fe70:
                    /* WARNING: Could not find normalized switch variable to match jumptable */
      switch(uVar4) {
      case 0:
      case 0xbad1abe1bad1abe1:
        goto switchD_0020fa75_caseD_0;
      case 1:
        if (*(char *)(*(int *)(this + 0x2c) + 4 + iVar2) != '\0') {
          cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_320,0x100);
          if (cVar1 == '\0') goto LAB_0020faa8;
          cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x100);
          if (cVar1 == '\0') goto LAB_0020faa8;
          SetValue(this,local_320,local_220);
          goto LAB_0020f9d0;
        }
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200);
        if (cVar1 == '\0') goto LAB_0020faa8;
        break;
      case 2:
        if (*(char *)(*(int *)(this + 0x2c) + 4 + iVar2) == '\0') {
          cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200);
          if ((cVar1 == '\0') ||
             (cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200), cVar1 == '\0'))
          goto LAB_0020faa8;
          LogCommand(this,param_2,"Bad Password");
          goto LAB_0020f9d0;
        }
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200);
        if (cVar1 == '\0') goto LAB_0020faa8;
        ExecCommand(this,local_220);
        if (*(uint *)(this + 0x60) != param_2) {
          pcVar8 = (char *)va("command \"%s\"",local_220);
          LogCommand(this,param_2,pcVar8);
        }
        break;
      case 3:
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200);
        if (cVar1 == '\0') goto LAB_0020faa8;
        CheckPassword(this,param_1,param_2,iVar7,local_220);
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200);
        if (cVar1 == '\0') goto LAB_0020faa8;
        if (*(char *)(*(int *)(this + 0x2c) + 4 + iVar2) != '\0') {
          lVar3 = strtol(local_220,(char **)0x0,10);
          iVar7 = (**(code **)(*g_pCVar + 0x38))(g_pCVar,"mp_disable_autokick");
          if (iVar7 != 0) {
            uVar4 = va("mp_disable_autokick %d\n",lVar3);
            Cbuf_AddText(4,uVar4,0);
            cVar1 = NET_IsDedicated();
            if (cVar1 != '\0') {
              Cbuf_Execute();
            }
          }
        }
        goto LAB_0020f9d0;
      case 4:
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x19);
        if ((cVar1 == '\0') ||
           (cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x19), cVar1 == '\0'))
        goto LAB_0020faa8;
        if (*(char *)(*(int *)(this + 0x2c) + 4 + iVar2) != '\0') {
          RegisterVProfDataListener(param_2);
          LogCommand(this,param_2,"Remote VProf started!\n");
          pcVar8 = "Remote VProf started!\n";
          goto LAB_002100b6;
        }
        goto LAB_0020f9d0;
      case 5:
        cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x19);
        if ((cVar1 == '\0') ||
           (cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x19), cVar1 == '\0'))
        goto LAB_0020faa8;
        if (*(char *)(*(int *)(this + 0x2c) + 4 + iVar2) != '\0') {
          RemoveVProfDataListener(param_2);
          LogCommand(this,param_2,"Remote VProf finished!\n");
          pcVar8 = "Remote VProf finished!\n";
LAB_002100b6:
          RespondString(this,param_2,iVar7,pcVar8);
        }
        goto LAB_0020f9d0;
      default:
        local_34c = 0;
        local_348 = 0;
        local_338 = 0;
        local_33c = 0;
        local_344 = 0;
        CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_358);
        goto LAB_0020faa8;
      }
      cVar1 = GetStringHelper((CUtlBuffer *)&local_358,local_220,0x200);
LAB_0020fd53:
    } while (cVar1 != '\0');
LAB_0020faa8:
    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_358);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)