L L4D2node

CMaster::HandleUnknown

0x00204460 · 3326 bytes · __thiscall

_ZN7CMaster13HandleUnknownEP11netpacket_sP11CBaseServerP11CGameServer

Decompiled

undefined (4 params)

/* CMaster::HandleUnknown(netpacket_s*, CBaseServer*, CGameServer*) */

void __thiscall
CMaster::HandleUnknown(CMaster *this,netpacket_s *param_1,CBaseServer *param_2,CGameServer *param_3)

{
  uint *puVar1;
  undefined4 uVar2;
  char cVar3;
  int iVar4;
  int *piVar5;
  uint uVar6;
  uint uVar7;
  byte bVar8;
  byte bVar9;
  code *pcVar10;
  int iVar11;
  int in_GS_OFFSET;
  bool bVar12;
  uint local_858;
  undefined4 local_844;
  undefined4 local_840;
  int local_83c;
  uint local_838;
  uint local_834;
  int local_830;
  uint *local_82c;
  uint *local_828;
  int local_824;
  char local_820 [63];
  undefined1 local_7e1;
  int local_20;
  
  local_830 = *(int *)(param_1 + 0x30);
  puVar1 = *(uint **)(param_1 + 0x34);
  local_828 = *(uint **)(param_1 + 0x38);
  local_824 = *(int *)(param_1 + 0x3c);
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_844 = *(undefined4 *)(param_1 + 0x1c);
  local_840 = *(undefined4 *)(param_1 + 0x20);
  local_83c = *(int *)(param_1 + 0x24);
  local_838 = *(uint *)(param_1 + 0x28);
  uVar7 = *(uint *)(param_1 + 0x2c);
  bVar9 = (byte)uVar7;
  uVar2 = local_840;
  local_82c = puVar1;
  if (local_830 < 8) {
    if ((puVar1 == local_828) || (local_828 <= puVar1)) goto LAB_002045d8;
    local_82c = puVar1 + 1;
    uVar7 = *puVar1;
    if ((char)local_840 != '\0') goto LAB_002045d8;
    iVar11 = 8 - local_830;
    bVar8 = (byte)local_830;
    local_830 = local_830 + 0x18;
    bVar9 = (byte)(((&CBitBuffer::s_nMaskTable)[iVar11] & uVar7) << (bVar8 & 0x1f)) | bVar9;
    uVar7 = uVar7 >> ((byte)iVar11 & 0x1f);
  }
  else {
    local_830 = local_830 + -8;
    if (local_830 == 0) {
      local_830 = 0x20;
      if (puVar1 == local_828) {
        local_830 = 1;
        local_834 = 0;
        uVar7 = local_834;
        local_82c = puVar1 + 1;
      }
      else if (local_828 < puVar1) {
        local_840._1_3_ = (undefined3)((uint)local_840 >> 8);
        local_840 = CONCAT31(local_840._1_3_,1);
        local_834 = 0;
        uVar2 = local_840;
        uVar7 = local_834;
      }
      else {
        uVar7 = *puVar1;
        local_82c = puVar1 + 1;
      }
    }
    else {
      uVar7 = uVar7 >> 8;
    }
  }
  local_840 = uVar2;
  local_834 = uVar7;
  if (bVar9 == 0x54) {
    local_820[0] = '\0';
    if (local_824 == 0) {
      iVar11 = 0;
    }
    else {
      iVar11 = (((uint)((int)local_82c - local_824) >> 2) * 0x20 - local_830) + (local_838 & 3) * 8;
      if (local_83c < iVar11) {
        iVar11 = local_83c;
      }
    }
    iVar11 = local_83c - iVar11;
    iVar4 = _V_strlen("Source Engine Query");
    if (iVar4 <= iVar11 >> 3) {
      CBitRead::ReadString((CBitRead *)&local_844,local_820,0x3e,false,(int *)0x0);
      local_7e1 = 0;
    }
    cVar3 = CBaseServer::ValidInfoChallenge(param_2,(netadr_s *)param_1,local_820);
    uVar7 = local_834;
    if (cVar3 != '\0') {
      ReplyInfo(this,(netadr_s *)param_1,param_2);
      uVar7 = local_834;
    }
    goto LAB_002045d8;
  }
  if ((char)bVar9 < 'U') {
    if (bVar9 != 0x2d) {
      if ((bVar9 != 0x4f) ||
         (cVar3 = (**(code **)(*(int *)this + 0x2c))(this,param_1), uVar6 = local_834,
         uVar7 = local_834, cVar3 == '\0')) goto LAB_002045d8;
      if (local_830 < 0x20) {
        if ((local_82c == local_828) || (local_828 <= local_82c)) goto LAB_002045d8;
        puVar1 = local_82c + 1;
        uVar7 = *local_82c;
        local_82c = puVar1;
        if ((char)local_840 != '\0') goto LAB_002045d8;
        uVar6 = ((&CBitBuffer::s_nMaskTable)[0x20 - local_830] & uVar7) << ((byte)local_830 & 0x1f)
                | local_834;
        local_834 = uVar7 >> ((byte)(0x20 - local_830) & 0x1f);
      }
      else {
        local_830 = local_830 + -0x20;
        if (local_830 == 0) {
          local_830 = 0x20;
          if (local_82c == local_828) {
            local_830 = 1;
            local_82c = local_82c + 1;
            local_834 = 0;
          }
          else {
            if (local_828 <= local_82c) goto LAB_002045d8;
            local_834 = *local_82c;
            local_82c = local_82c + 1;
          }
        }
        else {
          local_834 = 0;
        }
        uVar7 = local_834;
        if ((char)local_840 != '\0') goto LAB_002045d8;
      }
      cVar3 = (**(code **)(*(int *)this + 0x30))(this,param_1,uVar6,param_2);
      uVar7 = local_834;
      if (cVar3 != '\0') {
        Msg("%cMasterRequestRestart\n",3);
        piVar5 = (int *)CommandLine_Tier0();
        iVar11 = (**(code **)(*piVar5 + 0x28))(piVar5,"-autoupdate");
        if (iVar11 == 0) {
          Msg("Your server needs to be restarted in order to receive the latest update.\n");
          cVar3 = LoggingSystem_IsChannelEnabled(LOG_ServerLog,0);
          uVar7 = local_834;
          if (cVar3 != '\0') {
            LoggingSystem_Log(LOG_ServerLog,0,
                              "Your server needs to be restarted in order to receive the latest update.\n"
                             );
            uVar7 = local_834;
          }
        }
        else {
          Msg("Your server will be restarted on map change.\n");
          cVar3 = LoggingSystem_IsChannelEnabled(LOG_ServerLog,0);
          if (cVar3 != '\0') {
            LoggingSystem_Log(LOG_ServerLog,0,"Your server will be restarted on map change.\n");
          }
          (**(code **)(*(int *)this + 0x3c))(this,1);
          uVar7 = local_834;
        }
      }
      goto LAB_002045d8;
    }
    cVar3 = (**(code **)(*(int *)this + 0x2c))(this,param_1);
    uVar7 = local_834;
    if (cVar3 == '\0') goto LAB_002045d8;
    if (local_830 < 8) {
      if (local_82c == local_828) {
        local_830 = 1;
        local_834 = 0;
        local_840 = CONCAT31(local_840._1_3_,1);
        local_82c = local_82c + 1;
      }
      else if (local_82c < local_828) {
        puVar1 = local_82c + 1;
        local_834 = *local_82c;
        local_82c = puVar1;
        if ((char)local_840 == '\0') {
          local_834 = local_834 >> (8U - (char)local_830 & 0x1f);
          local_830 = local_830 + 0x18;
        }
      }
      else {
LAB_00204d38:
        local_840 = CONCAT31(local_840._1_3_,1);
        local_834 = 0;
      }
    }
    else {
      local_830 = local_830 + -8;
      if (local_830 == 0) {
        local_830 = 0x20;
        if (local_82c == local_828) {
          local_830 = 1;
          local_82c = local_82c + 1;
          local_834 = 0;
        }
        else {
          if (local_828 <= local_82c) goto LAB_00204d38;
          local_834 = *local_82c;
          local_82c = local_82c + 1;
        }
      }
      else {
        local_834 = local_834 >> 8;
      }
    }
    CBitRead::ReadString((CBitRead *)&local_844,local_820,0x7fe,false,(int *)0x0);
    GameDataAcknowledgement(this,(netadr_s *)param_1,local_820);
    uVar7 = local_834;
    goto LAB_002045d8;
  }
  local_840._0_1_ = (char)uVar2;
  local_840._1_3_ = (undefined3)((uint)uVar2 >> 8);
  if (bVar9 == 0x56) {
    if (local_824 == 0) {
      iVar11 = 0;
    }
    else {
      iVar11 = (((uint)((int)local_82c - local_824) >> 2) * 0x20 - local_830) + (local_838 & 3) * 8;
      if (local_83c < iVar11) {
        iVar11 = local_83c;
      }
    }
    uVar6 = 0xffffffff;
    if (0x1f < local_83c - iVar11) {
      if (local_830 < 0x20) {
        if (local_82c == local_828) {
          local_82c = local_82c + 1;
          local_830 = 1;
          uVar6 = 0;
          local_834 = 0;
          local_840 = CONCAT31(local_840._1_3_,1);
          uVar2 = local_840;
        }
        else {
          if (local_828 < local_82c) {
            local_840 = CONCAT31(local_840._1_3_,1);
            local_834 = 0;
          }
          else {
            puVar1 = local_82c + 1;
            bVar12 = (char)local_840 == '\0';
            local_834 = *local_82c;
            local_82c = puVar1;
            if (bVar12) {
              uVar6 = (&CBitBuffer::s_nMaskTable)[0x20 - local_830] & local_834;
              local_834 = local_834 >> ((byte)(0x20 - local_830) & 0x1f);
              uVar6 = uVar6 << ((byte)local_830 & 0x1f) | uVar7;
              goto LAB_00204b00;
            }
          }
          uVar6 = 0;
          uVar2 = local_840;
        }
      }
      else {
        local_830 = local_830 + -0x20;
        uVar6 = uVar7;
        if (local_830 == 0) {
          local_830 = 0x20;
          if (local_82c == local_828) {
            local_830 = 1;
            local_834 = 0;
            local_82c = local_82c + 1;
          }
          else {
            if (local_828 < local_82c) {
              local_840 = CONCAT31(local_840._1_3_,1);
              uVar2 = local_840;
              goto LAB_00204af5;
            }
            local_834 = *local_82c;
            local_82c = local_82c + 1;
          }
        }
        else {
LAB_00204af5:
          local_840 = uVar2;
          local_834 = 0;
          uVar2 = local_840;
        }
      }
    }
LAB_00204b00:
    local_840 = uVar2;
    cVar3 = CBaseServer::ValidChallenge(param_2,(netadr_s *)param_1,uVar6);
    uVar7 = local_834;
    if (cVar3 != '\0') {
      ReplyRules(this,(netadr_s *)param_1,param_2);
      uVar7 = local_834;
    }
    goto LAB_002045d8;
  }
  if ((char)bVar9 < 'V') {
    if (local_824 == 0) {
      iVar11 = 0;
    }
    else {
      iVar11 = (((uint)((int)local_82c - local_824) >> 2) * 0x20 - local_830) + (local_838 & 3) * 8;
      if (local_83c < iVar11) {
        iVar11 = local_83c;
      }
    }
    uVar6 = 0xffffffff;
    if (0x1f < local_83c - iVar11) {
      if (local_830 < 0x20) {
        if (local_82c == local_828) {
          local_82c = local_82c + 1;
          local_830 = 1;
          uVar6 = 0;
          local_834 = 0;
          local_840 = CONCAT31(local_840._1_3_,1);
          uVar2 = local_840;
        }
        else {
          if (local_828 < local_82c) {
            local_840 = CONCAT31(local_840._1_3_,1);
            local_834 = 0;
          }
          else {
            puVar1 = local_82c + 1;
            bVar12 = (char)local_840 == '\0';
            local_834 = *local_82c;
            local_82c = puVar1;
            if (bVar12) {
              uVar6 = (&CBitBuffer::s_nMaskTable)[0x20 - local_830] & local_834;
              local_834 = local_834 >> ((byte)(0x20 - local_830) & 0x1f);
              uVar6 = uVar6 << ((byte)local_830 & 0x1f) | uVar7;
              goto LAB_00204708;
            }
          }
          uVar6 = 0;
          uVar2 = local_840;
        }
      }
      else {
        local_830 = local_830 + -0x20;
        uVar6 = uVar7;
        if (local_830 == 0) {
          local_830 = 0x20;
          if (local_82c == local_828) {
            local_830 = 1;
            local_834 = 0;
            local_82c = local_82c + 1;
          }
          else {
            if (local_828 < local_82c) {
              local_840 = CONCAT31(local_840._1_3_,1);
              uVar2 = local_840;
              goto LAB_002046fb;
            }
            local_834 = *local_82c;
            local_82c = local_82c + 1;
          }
        }
        else {
LAB_002046fb:
          local_840 = uVar2;
          local_834 = 0;
          uVar2 = local_840;
        }
      }
    }
LAB_00204708:
    local_840 = uVar2;
    cVar3 = CBaseServer::ValidChallenge(param_2,(netadr_s *)param_1,uVar6);
    uVar7 = local_834;
    if ((cVar3 != '\0') && (param_3 != (CGameServer *)0x0)) {
      ReplyPlayers(this,(netadr_s *)param_1,param_3);
      uVar7 = local_834;
    }
    goto LAB_002045d8;
  }
  if ((bVar9 != 0x73) ||
     (cVar3 = (**(code **)(*(int *)this + 0x2c))(this,param_1), uVar7 = local_834, cVar3 == '\0'))
  goto LAB_002045d8;
  if (local_830 < 8) {
    if (local_82c == local_828) {
      local_82c = local_82c + 1;
      local_830 = 1;
    }
    else if (local_82c <= local_828) {
      puVar1 = local_82c + 1;
      local_858 = *local_82c;
      local_82c = puVar1;
      if ((char)local_840 == '\0') {
        local_858 = local_858 >> (8U - (char)local_830 & 0x1f);
        local_830 = local_830 + 0x18;
        goto LAB_00204c9c;
      }
      goto LAB_002049d8;
    }
    local_840 = CONCAT31(local_840._1_3_,1);
    local_858 = 0;
LAB_002049d8:
    pcVar10 = *(code **)(*(int *)this + 0x20);
    if (local_830 < 0x20) {
LAB_00204ca7:
      if (local_82c == local_828) {
        local_82c = local_828 + 1;
        local_840 = CONCAT31(local_840._1_3_,1);
        local_858 = 0;
        local_830 = 1;
        local_834 = 0;
      }
      else {
        if (local_828 < local_82c) {
          local_840 = CONCAT31(local_840._1_3_,1);
          local_834 = 0;
        }
        else {
          puVar1 = local_82c + 1;
          local_834 = *local_82c;
          local_82c = puVar1;
          if ((char)local_840 == '\0') {
            uVar7 = local_834 & (&CBitBuffer::s_nMaskTable)[0x20 - local_830];
            local_834 = local_834 >> ((byte)(0x20 - local_830) & 0x1f);
            local_858 = uVar7 << ((byte)local_830 & 0x1f) | local_858;
            goto LAB_00204a19;
          }
        }
        local_858 = 0;
      }
    }
    else {
      local_830 = local_830 + -0x20;
      if (local_830 == 0) goto LAB_00204e18;
LAB_00204a0f:
      local_834 = 0;
    }
  }
  else {
    local_830 = local_830 + -8;
    if (local_830 != 0) {
      local_858 = local_834 >> 8;
      goto LAB_002049d8;
    }
    if (local_82c == local_828) {
      local_830 = 1;
      local_858 = 0;
      local_82c = local_828 + 1;
LAB_00204c9c:
      pcVar10 = *(code **)(*(int *)this + 0x20);
      goto LAB_00204ca7;
    }
    if (local_828 < local_82c) {
      local_840 = CONCAT31(local_840._1_3_,1);
      local_858 = 0;
    }
    else {
      local_858 = *local_82c;
      local_82c = local_82c + 1;
    }
    pcVar10 = *(code **)(*(int *)this + 0x20);
LAB_00204e18:
    local_830 = 0x20;
    if (local_82c == local_828) {
      local_830 = 1;
      local_834 = 0;
      local_82c = local_82c + 1;
    }
    else {
      if (local_828 < local_82c) {
        local_840 = CONCAT31(local_840._1_3_,1);
        goto LAB_00204a0f;
      }
      local_834 = *local_82c;
      local_82c = local_82c + 1;
    }
  }
LAB_00204a19:
  (*pcVar10)(this,param_1,local_858,param_2);
  uVar7 = local_834;
LAB_002045d8:
  local_834 = uVar7;
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)