Closes #272
This commit is contained in:
Quentin E. / iDeath 2022-10-06 13:30:04 +02:00 committed by GitHub
parent b3f13f284e
commit 987579575a
7 changed files with 226 additions and 120 deletions

View File

@ -200,6 +200,16 @@ namespace big
bool spoof_rockstar_id = false;
uint64_t rockstar_id = 0;
bool spoof_cheater = false;
bool spoof_rockstar_dev = false;
bool spoof_rockstar_qa = false;
bool spoof_crew_data = false;
std::string crew_tag = "";
bool rockstar_crew = false;
bool square_crew_tag = false;
};
struct tunables {
@ -551,6 +561,13 @@ namespace big
this->spoofing.spoof_ip = j["spoofing"]["spoof_ip"];
this->spoofing.spoof_rockstar_id = j["spoofing"]["spoof_rockstar_id"];
this->spoofing.spoof_username = j["spoofing"]["spoof_username"];
this->spoofing.spoof_cheater = j["spoofing"]["spoof_cheater"];
this->spoofing.spoof_rockstar_dev = j["spoofing"]["spoof_rockstar_dev"];
this->spoofing.spoof_rockstar_qa = j["spoofing"]["spoof_rockstar_qa"];
this->spoofing.spoof_crew_data = j["spoofing"]["spoof_crew_data"];
this->spoofing.crew_tag = j["spoofing"]["crew_tag"];
this->spoofing.rockstar_crew = j["spoofing"]["rockstar_crew"];
this->spoofing.square_crew_tag = j["spoofing"]["square_crew_tag"];
for (int i = 0; i < 4; i++)
this->spoofing.ip_address[i] = j["spoofing"]["ip_address"].at(i);
@ -831,7 +848,14 @@ namespace big
this->spoofing.ip_address[3] })
},
{ "rockstar_id", this->spoofing.rockstar_id },
{ "username", this->spoofing.username }
{ "username", this->spoofing.username },
{ "spoof_cheater", this->spoofing.spoof_cheater },
{ "spoof_rockstar_dev", this->spoofing.spoof_rockstar_dev },
{ "spoof_rockstar_qa", this->spoofing.spoof_rockstar_qa },
{ "spoof_crew_data", this->spoofing.spoof_crew_data },
{ "crew_tag", this->spoofing.crew_tag },
{ "rockstar_crew", this->spoofing.rockstar_crew },
{ "square_crew_tag", this->spoofing.square_crew_tag }
}
},
{

View File

@ -52,7 +52,8 @@ namespace big
// Received clone sync
m_received_clone_sync_hook("RCS", g_pointers->m_received_clone_sync, &hooks::received_clone_sync),
//Get Network Event Data
m_get_network_event_data_hook("GNED", g_pointers->m_get_network_event_data, &hooks::get_network_event_data)
m_get_network_event_data_hook("GNED", g_pointers->m_get_network_event_data, &hooks::get_network_event_data),
m_write_player_gamer_data_node_hook("WPGDN", g_pointers->m_write_player_gamer_data_node, &hooks::write_player_gamer_data_node)
{
m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);
@ -86,6 +87,7 @@ namespace big
m_receive_net_message_hook.enable();
m_get_network_event_data_hook.enable();
m_received_clone_sync_hook.enable();
m_write_player_gamer_data_node_hook.enable();
MH_ApplyQueued();
@ -96,6 +98,7 @@ namespace big
{
m_enabled = false;
m_write_player_gamer_data_node_hook.disable();
m_received_clone_sync_hook.disable();
m_get_network_event_data_hook.disable();
m_receive_net_message_hook.disable();

View File

@ -1,116 +1,121 @@
#pragma once
#include "common.hpp"
#include "detour_hook.hpp"
#include "gta/fwddec.hpp"
#include "gta/net_game_event.hpp"
#include "gta/script_thread.hpp"
#include "script_hook.hpp"
#include "vmt_hook.hpp"
#include "MinHook.h"
#include "gta/enums.hpp"
namespace big
{
struct hooks
{
static bool run_script_threads(std::uint32_t ops_to_execute);
static constexpr auto swapchain_num_funcs = 19;
static constexpr auto swapchain_present_index = 8;
static constexpr auto swapchain_resizebuffers_index = 13;
static HRESULT swapchain_present(IDXGISwapChain *this_, UINT sync_interval, UINT flags);
static HRESULT swapchain_resizebuffers(IDXGISwapChain *this_, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swapchain_flags);
static LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
static const char* get_label_text(void* unk, const char* label);
static GtaThread* gta_thread_start(unsigned int** a1, unsigned int a2);
static rage::eThreadState gta_thread_kill(GtaThread* thread);
static void network_player_mgr_init(CNetworkPlayerMgr* _this, std::uint64_t a2, std::uint32_t a3, std::uint32_t a4[4]);
static void network_player_mgr_shutdown(CNetworkPlayerMgr* _this);
static void network_group_override(std::int64_t a1, std::int64_t a2, std::int64_t a3);
static void received_event(
rage::netEventMgr* event_manager,
CNetGamePlayer* source_player,
CNetGamePlayer* target_player,
uint16_t event_id,
int event_index,
int event_handled_bitset,
int unk,
rage::datBitBuffer* bit_buffer
);
// these two aren't actually hooks, just helper functions for hooks
static bool increment_stat_event(CNetworkIncrementStatEvent* net_event_struct, CNetGamePlayer* sender);
static bool scripted_game_event(CScriptedGameEvent* scripted_game_event, CNetGamePlayer* player);
static bool send_net_info_to_lobby(rage::rlGamerInfo *player, int64_t a2, int64_t a3, DWORD* a4);
static bool receive_net_message(void* netConnectionManager, void* a2, rage::netConnection::InFrame* frame);
static void get_network_event_data(int64_t unk, rage::CEventNetwork* net_event);
static void* assign_physical_index(CNetworkPlayerMgr* netPlayerMgr, CNetGamePlayer* player, uint8_t new_index);
//SYNC
static int64_t received_clone_sync(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, eObjType sync_type, uint16_t obj_id, rage::datBitBuffer* bufer, uint16_t unk, uint32_t timestamp);
};
class minhook_keepalive
{
public:
minhook_keepalive()
{
MH_Initialize();
}
~minhook_keepalive()
{
MH_Uninitialize();
}
};
class hooking
{
friend hooks;
public:
explicit hooking();
~hooking();
void enable();
void disable();
private:
bool m_enabled{};
minhook_keepalive m_minhook_keepalive;
vmt_hook m_swapchain_hook;
WNDPROC m_og_wndproc = nullptr;
detour_hook m_run_script_threads_hook;
detour_hook m_get_label_text;
detour_hook m_gta_thread_start_hook;
detour_hook m_gta_thread_kill_hook;
detour_hook m_network_player_mgr_init_hook;
detour_hook m_network_player_mgr_shutdown_hook;
detour_hook m_network_group_override;
detour_hook m_assign_physical_index_hook;
detour_hook m_received_event_hook;
detour_hook m_received_clone_sync_hook;
detour_hook m_send_net_info_to_lobby;
detour_hook m_receive_net_message_hook;
detour_hook m_get_network_event_data_hook;
};
inline hooking *g_hooking{};
}
#pragma once
#include "common.hpp"
#include "detour_hook.hpp"
#include "gta/fwddec.hpp"
#include "gta/net_game_event.hpp"
#include "gta/script_thread.hpp"
#include "script_hook.hpp"
#include "vmt_hook.hpp"
#include "MinHook.h"
#include "gta/enums.hpp"
#include "datanodes/player/CPlayerGamerDataNode.hpp"
namespace big
{
struct hooks
{
static bool run_script_threads(std::uint32_t ops_to_execute);
static constexpr auto swapchain_num_funcs = 19;
static constexpr auto swapchain_present_index = 8;
static constexpr auto swapchain_resizebuffers_index = 13;
static HRESULT swapchain_present(IDXGISwapChain *this_, UINT sync_interval, UINT flags);
static HRESULT swapchain_resizebuffers(IDXGISwapChain *this_, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swapchain_flags);
static LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
static const char* get_label_text(void* unk, const char* label);
static GtaThread* gta_thread_start(unsigned int** a1, unsigned int a2);
static rage::eThreadState gta_thread_kill(GtaThread* thread);
static void network_player_mgr_init(CNetworkPlayerMgr* _this, std::uint64_t a2, std::uint32_t a3, std::uint32_t a4[4]);
static void network_player_mgr_shutdown(CNetworkPlayerMgr* _this);
static void network_group_override(std::int64_t a1, std::int64_t a2, std::int64_t a3);
static void received_event(
rage::netEventMgr* event_manager,
CNetGamePlayer* source_player,
CNetGamePlayer* target_player,
uint16_t event_id,
int event_index,
int event_handled_bitset,
int unk,
rage::datBitBuffer* bit_buffer
);
// these two aren't actually hooks, just helper functions for hooks
static bool increment_stat_event(CNetworkIncrementStatEvent* net_event_struct, CNetGamePlayer* sender);
static bool scripted_game_event(CScriptedGameEvent* scripted_game_event, CNetGamePlayer* player);
static bool send_net_info_to_lobby(rage::rlGamerInfo *player, int64_t a2, int64_t a3, DWORD* a4);
static bool receive_net_message(void* netConnectionManager, void* a2, rage::netConnection::InFrame* frame);
static void get_network_event_data(int64_t unk, rage::CEventNetwork* net_event);
static void* assign_physical_index(CNetworkPlayerMgr* netPlayerMgr, CNetGamePlayer* player, uint8_t new_index);
//SYNC
static int64_t received_clone_sync(CNetworkObjectMgr* mgr, CNetGamePlayer* src, CNetGamePlayer* dst, eObjType sync_type, uint16_t obj_id, rage::datBitBuffer* bufer, uint16_t unk, uint32_t timestamp);
static void write_player_gamer_data_node(rage::netObject* player, CPlayerGamerDataNode* node);
};
class minhook_keepalive
{
public:
minhook_keepalive()
{
MH_Initialize();
}
~minhook_keepalive()
{
MH_Uninitialize();
}
};
class hooking
{
friend hooks;
public:
explicit hooking();
~hooking();
void enable();
void disable();
private:
bool m_enabled{};
minhook_keepalive m_minhook_keepalive;
vmt_hook m_swapchain_hook;
WNDPROC m_og_wndproc = nullptr;
detour_hook m_run_script_threads_hook;
detour_hook m_get_label_text;
detour_hook m_gta_thread_start_hook;
detour_hook m_gta_thread_kill_hook;
detour_hook m_network_player_mgr_init_hook;
detour_hook m_network_player_mgr_shutdown_hook;
detour_hook m_network_group_override;
detour_hook m_assign_physical_index_hook;
detour_hook m_received_event_hook;
detour_hook m_received_clone_sync_hook;
detour_hook m_send_net_info_to_lobby;
detour_hook m_receive_net_message_hook;
detour_hook m_get_network_event_data_hook;
detour_hook m_write_player_gamer_data_node_hook;
};
inline hooking *g_hooking{};
}

View File

@ -0,0 +1,37 @@
#include "hooking.hpp"
namespace big
{
void hooks::write_player_gamer_data_node(rage::netObject* player, CPlayerGamerDataNode* node)
{
g_hooking->m_write_player_gamer_data_node_hook.get_original<decltype(&write_player_gamer_data_node)>()(player, node);
if (g->spoofing.spoof_crew_data)
{
node->m_clan_data.m_clan_member_id = 1;
node->m_clan_data.m_clan_id = 41564112;
node->m_clan_data.m_clan_id_2 = 41564112;
node->m_clan_data.m_clan_color = 420;
node->m_clan_data.m_clan_member_count = 15;
node->m_clan_data.m_clan_created_time = 420;
strcpy(node->m_clan_data.m_clan_tag, g->spoofing.crew_tag.c_str());
node->m_clan_data.m_is_system_clan = g->spoofing.rockstar_crew;
node->m_clan_data.m_is_clan_open = g->spoofing.square_crew_tag;
if (g->spoofing.rockstar_crew)
{
strcpy(node->m_clan_data.m_clan_name, "Rockstar");
}
}
node->m_is_cheater = g->spoofing.spoof_cheater;
// spoof r* dev and qa only when spoofing rid because every player in the session will send metrics if you join with that enabled
if (g->spoofing.spoof_rockstar_id)
{
node->m_is_rockstar_dev = g->spoofing.spoof_rockstar_dev;
node->m_is_rockstar_qa = g->spoofing.spoof_rockstar_qa;
}
}
}

View File

@ -283,6 +283,12 @@ namespace big
m_give_pickup_rewards = ptr.sub(0x28).as<decltype(m_give_pickup_rewards)>();
});
// Write Player Gamer Data Node
main_batch.add("WPGDN", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 81 C1 ? ? ? ? 48 8B DA E8", [this](memory::handle ptr)
{
m_write_player_gamer_data_node = ptr.as<PVOID>();
});
// Network Group Override
main_batch.add("NGO", "44 89 81 ? ? ? ? 89 91 ? ? ? ? C6 05", [this](memory::handle ptr)
{

View File

@ -67,6 +67,8 @@ namespace big
functions::give_pickup_rewards m_give_pickup_rewards{};
PVOID m_write_player_gamer_data_node{};
functions::trigger_script_event m_trigger_script_event{};
// Bitbuffer Read/Write START

View File

@ -5,7 +5,7 @@
namespace big
{
void view::spoofing()
{
{
components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.");
components::sub_title("Username");
@ -16,7 +16,8 @@ namespace big
ImGui::Checkbox("Spoof Username", &g->spoofing.spoof_username);
static char name[20];
constexpr size_t name_size = RTL_FIELD_SIZE(rage::rlGamerInfo, m_name);
static char name[name_size];
strcpy_s(name, sizeof(name), g->spoofing.username.c_str());
ImGui::Text("Username:");
@ -50,5 +51,33 @@ namespace big
ImGui::Text("Rockstar ID:");
ImGui::InputScalar("##rockstar_id_input", ImGuiDataType_U64, &g->spoofing.rockstar_id);
components::sub_title("Crew");
g_fiber_pool->queue_job([] {
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
});
ImGui::Checkbox("Spoof Crew", &g->spoofing.spoof_crew_data);
constexpr size_t crew_tag_size = RTL_FIELD_SIZE(ClanData, m_clan_tag);
static char crew_tag[crew_tag_size];
strcpy_s(crew_tag, sizeof(crew_tag), g->spoofing.crew_tag.c_str());
ImGui::Text("Crew Tag:");
ImGui::InputText("##crew_tag_input", crew_tag, sizeof(crew_tag));
if (crew_tag != g->spoofing.crew_tag)
g->spoofing.crew_tag = std::string(crew_tag);
ImGui::Checkbox("Is Rockstar Crew", &g->spoofing.rockstar_crew);
ImGui::Checkbox("Square Crew Tag", &g->spoofing.square_crew_tag);
components::sub_title("Extra - Only work when Spoofed RID");
ImGui::Checkbox("Is Cheater", &g->spoofing.spoof_cheater);
ImGui::Checkbox("Is Rockstar Dev", &g->spoofing.spoof_rockstar_dev);
ImGui::Checkbox("Is Rockstar QA", &g->spoofing.spoof_rockstar_qa);
}
}