From f26a65a625b9862a7bee7f6da4765ee997fb6ff2 Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Tue, 21 May 2024 21:15:11 +0000 Subject: [PATCH] Matchmaking classes (#175) --- classes.cpp | 2 + network/MatchmakingAttributes.hpp | 14 ++++++ network/MatchmakingId.hpp | 14 ++++++ network/Network.hpp | 82 +++++++++++++++---------------- network/snSession.hpp | 54 ++++++++++++-------- 5 files changed, 103 insertions(+), 63 deletions(-) create mode 100644 network/MatchmakingAttributes.hpp create mode 100644 network/MatchmakingId.hpp diff --git a/classes.cpp b/classes.cpp index 7c3a655..de17d5a 100644 --- a/classes.cpp +++ b/classes.cpp @@ -119,6 +119,8 @@ #include "network/CNetGamePlayer.hpp" #include "network/CNetGamePlayerDataMsg.hpp" #include "network/CNetworkPlayerMgr.hpp" +#include "network/MatchmakingAttributes.hpp" +#include "network/MatchmakingId.hpp" #include "network/netObject.hpp" #include "network/netPeerAddress.hpp" #include "network/netPlayer.hpp" diff --git a/network/MatchmakingAttributes.hpp b/network/MatchmakingAttributes.hpp new file mode 100644 index 0000000..07612fb --- /dev/null +++ b/network/MatchmakingAttributes.hpp @@ -0,0 +1,14 @@ +#pragma once +#include + +class MatchmakingAttributes +{ +public: + uint32_t m_game_mode; //0x0000 + uint32_t m_num_params; //0x0004 + uint32_t m_param_unk[8]; //0x0008 + char m_param_names[8][24]; //0x0028 + uint32_t m_param_values[8]; //0x00E8 + uint32_t m_params_bitset; //0x0108 +}; //Size: 0x010C +static_assert(sizeof(MatchmakingAttributes) == 0x10C); \ No newline at end of file diff --git a/network/MatchmakingId.hpp b/network/MatchmakingId.hpp new file mode 100644 index 0000000..6dba8cd --- /dev/null +++ b/network/MatchmakingId.hpp @@ -0,0 +1,14 @@ +#pragma once +#include +#include + +#pragma pack(push, 1) +class MatchmakingId +{ +public: + char m_data1[0x26]; + std::uint64_t m_data2; + std::uint64_t m_data3; +}; +static_assert(offsetof(MatchmakingId, MatchmakingId::m_data3) == 0x2E); +#pragma pack(pop) diff --git a/network/Network.hpp b/network/Network.hpp index 46c77aa..e4fc98a 100644 --- a/network/Network.hpp +++ b/network/Network.hpp @@ -3,6 +3,7 @@ #include "../security/ObfVar.hpp" #include "CNetComplaintMgr.hpp" #include "snSession.hpp" +#include "MatchmakingAttributes.hpp" #include #pragma pack(push, 1) @@ -15,16 +16,36 @@ public: }; //Size: 0x0348 static_assert(sizeof(MetricSessionMigrated) == 0x348); -class NetworkGameConfig +class NetworkBaseConfig +{ +public: + virtual ~NetworkBaseConfig() = default; + virtual void Reset() {}; + + uint32_t m_build_type; //0x0008 + uint32_t m_discriminator; //0x000C + uint32_t m_discriminator_mapping; //0x0010 + uint32_t m_region_mapping; //0x0014 + uint32_t m_language_mapping; //0x0018 + uint32_t m_mm_group_1_mapping; //0x001C + uint32_t m_mm_group_2_mapping; //0x0020 + uint32_t m_activity_type_mapping; //0x0024 + uint32_t m_activity_id_mapping; //0x0028 + uint32_t m_activity_players_mapping; //0x002C +}; +static_assert(sizeof(NetworkBaseConfig) == 0x30); + +class NetworkGameConfig : public NetworkBaseConfig { public: - char pad_0000[48]; //0x0000 uint32_t m_public_slots; //0x0030 uint32_t m_private_slots; //0x0034 - char pad_0038[272]; //0x0038 + MatchmakingAttributes m_matchmaking_attributes; //0x0038 + char m_pad[0x4]; }; //Size: 0x0148 static_assert(sizeof(NetworkGameConfig) == 0x148); +// this is not MatchmakingAttributes class NetworkGameFilterMatchmakingComponent { public: @@ -40,51 +61,26 @@ public: m_num_parameters++; } - uint32_t m_filter_type; //0x0000 - char m_filter_name[24]; //0x0004 - uint32_t m_num_parameters; //0x001C - uint16_t m_game_mode; //0x0020 - uint16_t m_session_type; //0x0022 - uint32_t m_param_unk[8]; //0x0024 - char m_param_names[8][24]; //0x0044 - char pad_0104[4]; //0x0104 - uint32_t m_param_mappings[8]; //0x0108 - char pad_0128[352]; //0x0128 - uint32_t m_param_values[8]; //0x0288 - char pad_02A8[96]; //0x02A8 - uint32_t m_enabled_params_bitset; //0x0308 - char pad_030C[8]; //0x030C + uint32_t m_filter_type; //0x0000 + char m_filter_name[24]; //0x0004 + uint32_t m_num_parameters; //0x001C + uint16_t m_game_mode; //0x0020 + uint16_t m_session_type; //0x0022 + uint32_t m_param_unk[8]; //0x0024 + char m_param_names[8][24]; //0x0044 + char pad_0104[4]; //0x0104 + uint32_t m_param_mappings[8]; //0x0108 + char pad_0128[352]; //0x0128 + uint32_t m_param_values[8]; //0x0288 + char pad_02A8[96]; //0x02A8 + uint32_t m_enabled_params_bitset; //0x0308 + char pad_030C[8]; //0x030C }; //Size: 0x0314 static_assert(sizeof(NetworkGameFilterMatchmakingComponent) == 0x314); -class MatchmakingAttributes +class NetworkGameFilter : public NetworkBaseConfig { public: - uint32_t m_game_mode; //0x0000 - uint32_t m_num_params; //0x0004 - uint32_t m_param_unk[8]; //0x0008 - char m_param_names[8][24]; //0x0028 - uint32_t m_param_values[8]; //0x00E8 - uint32_t m_params_bitset; //0x0108 -}; //Size: 0x010C -static_assert(sizeof(MatchmakingAttributes) == 0x10C); - -class NetworkGameFilter -{ -public: - virtual ~NetworkGameFilter() = default; - virtual void Reset() {}; - - uint32_t m_build_type; //0x0008 - uint32_t m_discriminator; //0x000C - uint32_t m_discriminator_mapping; //0x0010 - uint32_t m_region_mapping; //0x0014 - uint32_t m_language_mapping; //0x0018 - uint32_t m_mm_group_1_mapping; //0x001C - uint32_t m_mm_group_2_mapping; //0x0020 - uint32_t m_activity_type_mapping; //0x0024 - uint32_t m_activity_id_mapping; //0x0028 - uint32_t m_activity_players_mapping; //0x002C class NetworkGameFilterMatchmakingComponent m_matchmaking_component; //0x0030 }; //Size: 0x0344 static_assert(sizeof(NetworkGameFilter) == 0x344); diff --git a/network/snSession.hpp b/network/snSession.hpp index 2762151..aa580f1 100644 --- a/network/snSession.hpp +++ b/network/snSession.hpp @@ -2,6 +2,7 @@ #include "../rage/rlGamerInfo.hpp" #include "../rage/rlSessionInfo.hpp" +#include "MatchmakingAttributes.hpp" #pragma pack(push, 1) namespace rage @@ -50,33 +51,46 @@ namespace rage virtual ~rlSession() = default; }; //Size: 0x0770 static_assert(sizeof(rage::rlSession) == 0x770); + + class rlSessionConfig + { + public: + char m_pad[0x4]; // 0x00 + int m_public_slots; // 0x04 + int m_private_slots; // 0x08 + MatchmakingAttributes m_matchmaking_attributes; // 0x0C + char m_pad2[0x18]; // 0x10C + }; + static_assert(sizeof(rage::rlSessionConfig) == 0x130); class rlSessionDetail { public: - class rage::rlGamerInfoBase m_base_gamer_info; - char pad_0060[8]; //0x0060 - class rage::rlSessionInfo m_session_info; //0x0068 - char pad_00D8[14]; //0x00D8 - uint16_t m_session_type; //0x00E6 - char pad_00E8[324]; //0x00E8 - uint32_t m_player_count; //0x022C - uint32_t m_unk_player_count; //0x0230 - char pad_0234[2]; //0x0234 - int16_t m_unk_pos_x; //0x0236 - int16_t m_unk_pos_y; //0x0238 - int16_t m_unk_pos_z; //0x023A - uint8_t m_matchmaking_property_ids[32]; //0x023C - char pad_025C[2]; //0x025C - uint16_t m_rank; //0x025E - char pad_0260[1]; //0x0260 - uint8_t m_mental_state; //0x0261 - char pad_0262[21]; //0x0262 - uint8_t m_population_density; //0x0277 - char pad_0278[320]; //0x0278 + class rage::rlGamerInfoBase m_base_gamer_info; // 0x00 + std::uint64_t m_host_token; // 0xC0 + class rage::rlSessionInfo m_session_info; // 0xC8 + class rage::rlSessionConfig m_session_config; // 0x198 + rage::rlGamerHandle m_handle; // 0x2C8 + char m_name[0x14]; // 0x2D8 + uint32_t m_player_count; // 0x2EC + uint32_t m_spectator_count; // 0x2F0 + uint16_t m_session_data_struct_size; // 0x2F4 + char m_session_data_struct[0x100]; // 0x2F6 likely a union of two structs, sizes 0x44 and 0x28 + uint16_t m_matchmaking_data_struct_size; // 0x3F6 + char m_matchmaking_data_struct[0x80]; // 0x3F8 stores matchmaking tunable data? }; //Size: 0x03CA static_assert(sizeof(rlSessionDetail) == 0x478); + class rlSessionDetailMsg + { + public: + int m_status; + int m_required_version; + int m_request_token; + int m_unk; + rlSessionDetail m_detail; + }; + static_assert(sizeof(rlSessionDetailMsg) == 0x488); class rlMatchmakingFindResult {