From f2011a6ce5e4bac1c026486b3a9342d5e59b6a2e Mon Sep 17 00:00:00 2001 From: Yimura Date: Sat, 18 Dec 2021 01:42:44 +0100 Subject: [PATCH] chore(Classes): Modified code to reflect changes made in GTAV-Classes vendor --- BigBaseV2/src/api/api.hpp | 6 +- BigBaseV2/src/gta/player.hpp | 56 +++++++++---------- .../src/gui/window/player/player_info.cpp | 13 +++-- BigBaseV2/src/gui/window/window_top_bar.cpp | 2 +- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/BigBaseV2/src/api/api.hpp b/BigBaseV2/src/api/api.hpp index dca8c301..78c15624 100644 --- a/BigBaseV2/src/api/api.hpp +++ b/BigBaseV2/src/api/api.hpp @@ -51,9 +51,11 @@ namespace big::api http::Request request(domain + path); CPlayerInfo* player_info = g_local_player->m_player_info; + netPlayerData& netData = player_info->m_net_player_data; + nlohmann::json body = { - { "username", std::string(player_info->m_name) }, - { "rockstar_id", player_info->m_rockstar_id2 } + { "username", std::string(netData.m_name) }, + { "rockstar_id", netData.m_rockstar_id } }; try diff --git a/BigBaseV2/src/gta/player.hpp b/BigBaseV2/src/gta/player.hpp index cf2a419a..390c8e38 100644 --- a/BigBaseV2/src/gta/player.hpp +++ b/BigBaseV2/src/gta/player.hpp @@ -8,40 +8,38 @@ #pragma pack(push, 1) namespace rage { -# pragma warning(push) -# pragma warning(disable : 4201) // nonstandard extension used: nameless struct/union - union netAddress + class netAddress { - std::uint32_t m_raw; - struct - { - std::uint8_t m_field4; - std::uint8_t m_field3; - std::uint8_t m_field2; - std::uint8_t m_field1; - }; - }; -# pragma warning(pop) + public: + uint8_t m_field4; //0x0000 + uint8_t m_field3; //0x0001 + uint8_t m_field2; //0x0002 + uint8_t m_field1; //0x0003 + }; //Size: 0x0004 + static_assert(sizeof(netAddress) == 0x4); class netPlayerData { public: - char pad_0000[48]; //0x0000 - uint32_t m_sec_key_time; //0x0010 - netAddress m_lan_ip; //0x0014 - uint16_t m_lan_port; //0x0018 - char pad_001A[2]; //0x001A - netAddress m_relay_ip; //0x001C - uint32_t m_relay_port; //0x0020 - netAddress m_online_ip; //0x0024 - uint16_t m_online_port; //0x0028 - char pad_002A[22]; //0x002A - int32_t m_host_token; //0x0040 - char pad_0044[12]; //0x0044 - uint64_t m_rockstar_id; //0x0050 - char pad_0058[12]; //0x0058 - char m_name[20]; //0x0064 - }; //Size: 0x0078 + char pad_0000[8]; //0x0000 + uint64_t m_rockstar_id; //0x0008 + char pad_0010[52]; //0x0010 + class netAddress m_relay_ip; //0x0044 + uint16_t m_relay_port; //0x0048 + char pad_004A[2]; //0x004A + class netAddress m_external_ip; //0x004C + uint16_t m_external_port; //0x0050 + char pad_0052[2]; //0x0052 + class netAddress m_internal_ip; //0x0054 + uint16_t m_internal_port; //0x0058 + char pad_005A[6]; //0x005A + uint64_t m_host_token; //0x0060 + char pad_0068[8]; //0x0068 + uint64_t m_rockstar_id2; //0x0070 + char pad_0078[12]; //0x0078 + char m_name[20]; //0x0084 + }; //Size: 0x0098 + static_assert(sizeof(netPlayerData) == 0x98); class nonPhysicalPlayerDataBase { diff --git a/BigBaseV2/src/gui/window/player/player_info.cpp b/BigBaseV2/src/gui/window/player/player_info.cpp index 733faa0c..4031de49 100644 --- a/BigBaseV2/src/gui/window/player/player_info.cpp +++ b/BigBaseV2/src/gui/window/player/player_info.cpp @@ -12,16 +12,17 @@ namespace big ImGui::Text("Player ID: %d", g.selected_player.id); - CNetGamePlayer* net_player = g.selected_player.net_player; - if (net_player != nullptr) + + if (CNetGamePlayer* net_player = g.selected_player.net_player; net_player != nullptr) { - CPlayerInfo* player_info = net_player->player_info; - if (player_info != nullptr) + if (CPlayerInfo* player_info = net_player->player_info; player_info != nullptr) { + netPlayerData& netData = player_info->m_net_player_data; + ImGui::Text("Session Host: %s", net_player->is_host() ? "Yes" : "No"); - ImGui::Text("Rockstar ID: %d", player_info->m_rockstar_id); - ImGui::Text("IP Address: %d.%d.%d.%d:%d", player_info->m_external_ip.m_field1, player_info->m_external_ip.m_field2, player_info->m_external_ip.m_field3, player_info->m_external_ip.m_field4, player_info->m_external_port); + ImGui::Text("Rockstar ID: %d", netData.m_rockstar_id); + ImGui::Text("IP Address: %d.%d.%d.%d:%d", netData.m_external_ip.m_field1, netData.m_external_ip.m_field2, netData.m_external_ip.m_field3, netData.m_external_ip.m_field4, netData.m_external_port); } } diff --git a/BigBaseV2/src/gui/window/window_top_bar.cpp b/BigBaseV2/src/gui/window/window_top_bar.cpp index 7591f079..e035611b 100644 --- a/BigBaseV2/src/gui/window/window_top_bar.cpp +++ b/BigBaseV2/src/gui/window/window_top_bar.cpp @@ -14,7 +14,7 @@ namespace big if (ImGui::BeginMenu("Info")) { ImGui::MenuItem("Logged in as:", NULL, false, false); - ImGui::MenuItem(g_local_player == nullptr || g_local_player->m_player_info == nullptr ? "unknown" : g_local_player->m_player_info->m_name, NULL, false, false); + ImGui::MenuItem(g_local_player == nullptr || g_local_player->m_player_info == nullptr ? "unknown" : g_local_player->m_player_info->m_net_player_data.m_name, NULL, false, false); ImGui::EndMenu(); }