mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-23 04:27:25 +08:00
Feat ptr cache continued (#1227)
This commit is contained in:
parent
a3b8e780ec
commit
5a4dc03121
@ -23,7 +23,7 @@ namespace big
|
||||
(int64_t)self::id,
|
||||
scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].ScriptEventReplayProtectionCounter};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,22 +30,22 @@ namespace big
|
||||
|
||||
if (gta_util::get_network()->m_game_session.is_host())
|
||||
{
|
||||
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
|
||||
g_pointers->m_gta.m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
|
||||
}
|
||||
else if (player->is_host())
|
||||
{
|
||||
for (auto& [_, plyr] : g_player_service->players())
|
||||
{
|
||||
if (plyr->id() != player->id())
|
||||
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_gta.m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
(int)plyr->get_session_player()->m_player_data.m_peer_id_2),
|
||||
gta_util::get_network()->m_game_session_ptr->m_connection_identifier,
|
||||
&cmd,
|
||||
0x1000000);
|
||||
}
|
||||
|
||||
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
|
||||
g_pointers->m_gta.m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -53,8 +53,8 @@ namespace big
|
||||
{
|
||||
if (plyr->is_host())
|
||||
{
|
||||
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_gta.m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
(int)plyr->get_session_player()->m_player_data.m_peer_id_2),
|
||||
gta_util::get_network()->m_game_session_ptr->m_connection_identifier,
|
||||
&cmd,
|
||||
|
@ -19,7 +19,7 @@ namespace big
|
||||
const size_t arg_count = 15;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, (int64_t)(int)-1};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace big
|
||||
0,
|
||||
1};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << self::id);
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << self::id);
|
||||
}
|
||||
else if (scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace big
|
||||
const size_t arg_count = 2;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::CeoKick, (int64_t)self::id};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -35,7 +35,7 @@ namespace big
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::MarkPlayerAsBeast, (int64_t)self::id, leader};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ namespace big
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::ForceMission, (int64_t)self::id, 0};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace big
|
||||
*scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(8).as<int64_t*>(),
|
||||
};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -24,12 +24,12 @@ namespace big
|
||||
const size_t arg_count = 9;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::VehicleKick, self::id, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
else
|
||||
{
|
||||
// use a private method to kick player from vehicle
|
||||
(*g_pointers->m_network_object_mgr)->ChangeOwner(vehicle->m_net_object, g_player_service->get_self()->get_net_game_player(), 0);
|
||||
(*g_pointers->m_gta.m_network_object_mgr)->ChangeOwner(vehicle->m_net_object, g_player_service->get_self()->get_net_game_player(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ namespace big
|
||||
if (!player->get_ped())
|
||||
return;
|
||||
|
||||
g_pointers->m_send_network_damage(g_player_service->get_self()->get_ped(),
|
||||
g_pointers->m_gta.m_send_network_damage(g_player_service->get_self()->get_ped(),
|
||||
player->get_ped(),
|
||||
player->get_ped()->m_navigation->get_position(),
|
||||
0,
|
||||
|
@ -17,7 +17,7 @@ namespace big
|
||||
{
|
||||
if (auto ped = player->get_ped())
|
||||
if (auto net_object = ped->m_net_object)
|
||||
g_pointers->m_request_ragdoll(net_object->m_object_id);
|
||||
g_pointers->m_gta.m_request_ragdoll(net_object->m_object_id);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace big
|
||||
|
||||
strcpy((char*)&args[2], "HUD_ROSBANPERM");
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace big
|
||||
strcpy((char*)&args[2],
|
||||
(std::string("SXT_") + strippers[rand() % strippers.size()] + "_" + sext_types[rand() % sext_types.size()])
|
||||
.data());
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace big
|
||||
const size_t arg_count = 9;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport, self::id, (int64_t)player->id(), (int64_t)(int)-1, 1, (int64_t)_args[0], 1, 1, 1};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace big
|
||||
(int64_t) true,
|
||||
-1};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace big
|
||||
(int64_t)self::id,
|
||||
};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace big
|
||||
const size_t arg_count = 6;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TeleportToWarehouse, self::id, (int64_t)player->id(), 1, (int64_t)_args[0]};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace big
|
||||
*scr_globals::gsbd_fm_events.at(9).as<int*>(),
|
||||
*scr_globals::gsbd_fm_events.at(10).as<int*>()};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,14 +30,14 @@ namespace big
|
||||
args[2 + 19] = arg19;
|
||||
args[24] = scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].ScriptEventReplayProtectionCounter;
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
const size_t arg_count_2 = 25;
|
||||
int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id};
|
||||
args_2[2 + 17] = 1337;
|
||||
g_pointers->m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id());
|
||||
|
||||
script::get_current()->yield(20ms);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace big
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TriggerCEORaid, (int64_t)self::id, 0};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace big
|
||||
{
|
||||
if (g_local_player && g_local_player->m_vehicle)
|
||||
{
|
||||
const Vehicle veh = g_pointers->m_ptr_to_handle(g_local_player->m_vehicle);
|
||||
const Vehicle veh = g_pointers->m_gta.m_ptr_to_handle(g_local_player->m_vehicle);
|
||||
teleport::into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace big
|
||||
msg[1] = ' ';
|
||||
strncpy(msg + 2, output.c_str(), sizeof(msg) - 2);
|
||||
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr,
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_gta.m_send_chat_ptr,
|
||||
g_player_service->get_self()->get_net_data(),
|
||||
msg,
|
||||
false))
|
||||
|
@ -11,7 +11,7 @@ namespace big
|
||||
static int neverWantedPlayer = 0;
|
||||
void looped::player_good_options()
|
||||
{
|
||||
if (!*g_pointers->m_is_session_started)
|
||||
if (!*g_pointers->m_gta.m_is_session_started)
|
||||
return;
|
||||
|
||||
offRadarPlayer++;
|
||||
@ -35,8 +35,8 @@ namespace big
|
||||
|
||||
if (g.session.semi_godmode_all)
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(-1, REWARD_HEALTH);
|
||||
g_pointers->m_give_pickup_rewards(-1, REWARD_ARMOUR);
|
||||
g_pointers->m_gta.m_give_pickup_rewards(-1, REWARD_HEALTH);
|
||||
g_pointers->m_gta.m_give_pickup_rewards(-1, REWARD_ARMOUR);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -50,12 +50,12 @@ namespace big
|
||||
|
||||
if (ped->m_health < ped->m_maxhealth)
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(1 << entry.second->id(), REWARD_HEALTH);
|
||||
g_pointers->m_gta.m_give_pickup_rewards(1 << entry.second->id(), REWARD_HEALTH);
|
||||
}
|
||||
|
||||
if (ped->m_armor < 50.0f)
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(1 << entry.second->id(), REWARD_ARMOUR);
|
||||
g_pointers->m_gta.m_give_pickup_rewards(1 << entry.second->id(), REWARD_ARMOUR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
void looped::player_toxic_options()
|
||||
{
|
||||
if (!*g_pointers->m_is_session_started)
|
||||
if (!*g_pointers->m_gta.m_is_session_started)
|
||||
return;
|
||||
|
||||
int rotate_cam_bits = 0;
|
||||
@ -18,7 +18,7 @@ namespace big
|
||||
if (g_player_service->get_self()->get_ped() && entry.second->get_ped() && entry.second->get_ped()->m_health > 0)
|
||||
{
|
||||
if (entry.second->kill_loop && !(entry.second->get_ped()->m_damage_bits & (1 << 8)))
|
||||
g_pointers->m_send_network_damage(g_player_service->get_self()->get_ped(),
|
||||
g_pointers->m_gta.m_send_network_damage(g_player_service->get_self()->get_ped(),
|
||||
entry.second->get_ped(),
|
||||
entry.second->get_ped()->m_navigation->get_position(),
|
||||
0,
|
||||
@ -41,10 +41,10 @@ namespace big
|
||||
toxic::blame_explode_player(entry.second, entry.second, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f);
|
||||
|
||||
if (entry.second->freeze_loop && entry.second->get_ped()->m_net_object)
|
||||
g_pointers->m_clear_ped_tasks_network(entry.second->get_ped(), true);
|
||||
g_pointers->m_gta.m_clear_ped_tasks_network(entry.second->get_ped(), true);
|
||||
|
||||
if (entry.second->ragdoll_loop && entry.second->get_ped()->m_net_object)
|
||||
g_pointers->m_request_ragdoll(entry.second->get_ped()->m_net_object->m_object_id);
|
||||
g_pointers->m_gta.m_request_ragdoll(entry.second->get_ped()->m_net_object->m_object_id);
|
||||
|
||||
if (entry.second->rotate_cam_loop)
|
||||
rotate_cam_bits |= (1 << entry.second->id());
|
||||
@ -55,7 +55,7 @@ namespace big
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::TSECommand, (int64_t)self::id, (int64_t)eRemoteEvent::TSECommandRotateCam};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, rotate_cam_bits);
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, rotate_cam_bits);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace big
|
||||
g.m_dance_thread = gta_util::find_script_thread_by_id(thread);
|
||||
g.m_dance_program = gta_util::find_script_program(RAGE_JOAAT("am_mp_nightclub"));
|
||||
|
||||
(*g_pointers->m_script_handler_mgr)->attach_thread(g.m_dance_thread);
|
||||
(*g_pointers->m_gta.m_script_handler_mgr)->attach_thread(g.m_dance_thread);
|
||||
|
||||
g.m_dance_thread->m_context.m_state = rage::eThreadState::unk_3;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/police.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -15,14 +16,14 @@ namespace big
|
||||
if (b)
|
||||
{
|
||||
g_local_player->m_player_info->m_wanted_level = 0;
|
||||
g_pointers->m_max_wanted_level->apply();
|
||||
g_pointers->m_max_wanted_level_2->apply();
|
||||
police::m_max_wanted_level->apply();
|
||||
police::m_max_wanted_level_2->apply();
|
||||
bLast = b;
|
||||
}
|
||||
else if (b != bLast)
|
||||
{
|
||||
g_pointers->m_max_wanted_level->restore();
|
||||
g_pointers->m_max_wanted_level_2->restore();
|
||||
police::m_max_wanted_level->restore();
|
||||
police::m_max_wanted_level_2->restore();
|
||||
bLast = b;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
static bool bLastKickHost = false;
|
||||
void looped::session_auto_kick_host()
|
||||
{
|
||||
bool kick_host = *g_pointers->m_is_session_started && g.session.force_session_host && g.session.kick_host_when_forcing_host;
|
||||
bool kick_host = *g_pointers->m_gta.m_is_session_started && g.session.force_session_host && g.session.kick_host_when_forcing_host;
|
||||
if (kick_host && !bLastKickHost)
|
||||
{
|
||||
g_player_service->iterate([](auto& plyr) {
|
||||
|
@ -11,7 +11,7 @@ namespace big
|
||||
|
||||
void looped::session_block_jobs()
|
||||
{
|
||||
bool used = g.session.block_jobs && *g_pointers->m_is_session_started;
|
||||
bool used = g.session.block_jobs && *g_pointers->m_gta.m_is_session_started;
|
||||
if (!bLastBlockJobsEnabled && used)
|
||||
{
|
||||
if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0 && NETWORK::NETWORK_GET_HOST_OF_SCRIPT("fmmc_launcher", -1, 0) == self::id)
|
||||
@ -23,7 +23,7 @@ namespace big
|
||||
}
|
||||
else if (bLastBlockJobsEnabled && !used)
|
||||
{
|
||||
if (*g_pointers->m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")))
|
||||
if (*g_pointers->m_gta.m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")))
|
||||
{
|
||||
auto fmmc = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher"));
|
||||
*script_local(fmmc->m_stack, scr_locals::fmmc_launcher::broadcast_idx).at(47).at(7).as<int*>() = 0;
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
|
||||
void looped::session_force_thunder()
|
||||
{
|
||||
bool used = g.session.force_thunder && *g_pointers->m_is_session_started;
|
||||
bool used = g.session.force_thunder && *g_pointers->m_gta.m_is_session_started;
|
||||
if (!bLastForceThunderEnabled && used)
|
||||
{
|
||||
if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("freemode")) && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
|
||||
@ -23,7 +23,7 @@ namespace big
|
||||
}
|
||||
else if (bLastForceThunderEnabled && !used)
|
||||
{
|
||||
if (*g_pointers->m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("freemode")))
|
||||
if (*g_pointers->m_gta.m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
session::clear_fm_event_index(9);
|
||||
session::clear_fm_event_index(10);
|
||||
|
@ -12,7 +12,7 @@ namespace big
|
||||
|
||||
void looped::session_pop_multiplier_areas()
|
||||
{
|
||||
bool used = (g.session.disable_traffic || g.session.disable_peds) && *g_pointers->m_is_session_started;
|
||||
bool used = (g.session.disable_traffic || g.session.disable_peds) && *g_pointers->m_gta.m_is_session_started;
|
||||
if (!bLastPopMultiplierAreasEnabled && used)
|
||||
{
|
||||
if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("freemode")) && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
{
|
||||
void looped::session_randomize_ceo_colors()
|
||||
{
|
||||
if (g.session.randomize_ceo_colors && *g_pointers->m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
|
||||
if (g.session.randomize_ceo_colors && *g_pointers->m_gta.m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
|
||||
{
|
||||
if (auto freemode = gta_util::find_script_thread(RAGE_JOAAT("freemode"));
|
||||
freemode && freemode->m_net_component && freemode->m_net_component->is_local_player_host())
|
||||
|
@ -37,7 +37,7 @@ namespace big
|
||||
if (plyr->get_net_data())
|
||||
{
|
||||
gta_util::get_network()->m_game_complaint_mgr.m_host_token = plyr->get_net_data()->m_host_token;
|
||||
g_pointers->m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr);
|
||||
g_pointers->m_gta.m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ namespace big
|
||||
{
|
||||
gta_util::get_network()->m_game_complaint_mgr.m_host_token =
|
||||
g_player_service->get_self()->get_net_data()->m_host_token;
|
||||
g_pointers->m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr);
|
||||
g_pointers->m_gta.m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,11 @@ namespace big
|
||||
{
|
||||
void looped::system_self_globals()
|
||||
{
|
||||
if (!*g_pointers->m_network_player_mgr || !(*g_pointers->m_network_player_mgr)->m_local_net_player
|
||||
|| (*g_pointers->m_network_player_mgr)->m_local_net_player->m_player_id == -1)
|
||||
if (!*g_pointers->m_gta.m_network_player_mgr || !(*g_pointers->m_gta.m_network_player_mgr)->m_local_net_player
|
||||
|| (*g_pointers->m_gta.m_network_player_mgr)->m_local_net_player->m_player_id == -1)
|
||||
self::id = 0;
|
||||
else
|
||||
self::id = (*g_pointers->m_network_player_mgr)->m_local_net_player->m_player_id;
|
||||
self::id = (*g_pointers->m_gta.m_network_player_mgr)->m_local_net_player->m_player_id;
|
||||
|
||||
self::ped = PLAYER::PLAYER_PED_ID();
|
||||
|
||||
|
@ -16,18 +16,18 @@ namespace big
|
||||
if (bLastForceHost != g.session.force_session_host && gta_util::get_network()->m_game_session_state == 0)
|
||||
{
|
||||
std::uint64_t host_token;
|
||||
g_pointers->m_generate_uuid(&host_token);
|
||||
g_pointers->m_gta.m_generate_uuid(&host_token);
|
||||
|
||||
host_token = g.session.force_session_host ? (rand() % 10000) : host_token;
|
||||
|
||||
*g_pointers->m_host_token = host_token;
|
||||
*g_pointers->m_gta.m_host_token = host_token;
|
||||
|
||||
if (gta_util::get_network()->m_game_session_ptr)
|
||||
gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_host_token = host_token;
|
||||
|
||||
g_pointers->m_profile_gamer_info->m_host_token = host_token;
|
||||
g_pointers->m_player_info_gamer_info->m_host_token = host_token;
|
||||
(*g_pointers->m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = host_token;
|
||||
g_pointers->m_gta.m_profile_gamer_info->m_host_token = host_token;
|
||||
g_pointers->m_gta.m_player_info_gamer_info->m_host_token = host_token;
|
||||
(*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = host_token;
|
||||
|
||||
if (g_local_player && g_local_player->m_player_info)
|
||||
g_local_player->m_player_info->m_net_player_data.m_host_token = host_token;
|
||||
@ -35,7 +35,7 @@ namespace big
|
||||
bLastForceHost = g.session.force_session_host;
|
||||
}
|
||||
|
||||
if (*g_pointers->m_is_session_started)
|
||||
if (*g_pointers->m_gta.m_is_session_started)
|
||||
{
|
||||
gta_util::execute_as_script(RAGE_JOAAT("freemode"), [] {
|
||||
if (NETWORK::NETWORK_GET_THIS_SCRIPT_IS_NETWORK_SCRIPT() && NETWORK::NETWORK_GET_SCRIPT_STATUS() == 2)
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
|
||||
virtual void on_enable() override
|
||||
{
|
||||
*g_pointers->m_refresh_audio_input = true;
|
||||
*g_pointers->m_gta.m_refresh_audio_input = true;
|
||||
}
|
||||
|
||||
virtual void on_tick() override
|
||||
@ -20,7 +20,7 @@ namespace big
|
||||
|
||||
virtual void on_disable() override
|
||||
{
|
||||
*g_pointers->m_refresh_audio_input = true;
|
||||
*g_pointers->m_gta.m_refresh_audio_input = true;
|
||||
NETWORK::NETWORK_OVERRIDE_SEND_RESTRICTIONS_ALL(false);
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "backend/looped_command.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -9,7 +10,7 @@ namespace big
|
||||
|
||||
virtual void on_enable() override
|
||||
{
|
||||
g_pointers->m_disable_collision->apply();
|
||||
vehicle::disable_collisions::m_patch->apply();
|
||||
}
|
||||
|
||||
virtual void on_tick() override
|
||||
@ -19,7 +20,7 @@ namespace big
|
||||
|
||||
virtual void on_disable() override
|
||||
{
|
||||
g_pointers->m_disable_collision->restore();
|
||||
vehicle::disable_collisions::m_patch->restore();
|
||||
}
|
||||
};
|
||||
veh_no_collision g_veh_no_collision("vehnocollision", "No Collision", "Same as Ped No Collision, except this is global and also affects Ped", g.vehicle.no_collision);
|
||||
|
@ -15,9 +15,9 @@ namespace big
|
||||
static bool bLastLoadPathNodes = false;
|
||||
void looped::world_spawn_ped()
|
||||
{
|
||||
if (*g_pointers->m_is_session_started != last_online)
|
||||
if (*g_pointers->m_gta.m_is_session_started != last_online)
|
||||
{
|
||||
last_online = *g_pointers->m_is_session_started;
|
||||
last_online = *g_pointers->m_gta.m_is_session_started;
|
||||
|
||||
for (auto& ped : spawned_peds)
|
||||
cleanup_spawned_ped(ped);
|
||||
@ -38,7 +38,7 @@ namespace big
|
||||
|
||||
for (auto it = spawned_peds.begin(); it != spawned_peds.end();)
|
||||
{
|
||||
if ((*g_pointers->m_is_session_started && !NETWORK::NETWORK_IS_PLAYER_CONNECTED(it->spawned_for_player)) || !ENTITY::DOES_ENTITY_EXIST(it->ped_handle))
|
||||
if ((*g_pointers->m_gta.m_is_session_started && !NETWORK::NETWORK_IS_PLAYER_CONNECTED(it->spawned_for_player)) || !ENTITY::DOES_ENTITY_EXIST(it->ped_handle))
|
||||
{
|
||||
cleanup_spawned_ped(*it);
|
||||
it = spawned_peds.erase(it);
|
||||
|
@ -31,7 +31,7 @@ namespace big
|
||||
attacker->get_name(),
|
||||
victim->get_name());
|
||||
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr,
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_gta.m_send_chat_ptr,
|
||||
g_player_service->get_self()->get_net_data(),
|
||||
chat,
|
||||
false))
|
||||
|
@ -61,7 +61,7 @@ namespace big
|
||||
std::format("{} {}", g.session.chat_output_prefix, m_announce_message).data(),
|
||||
player->get_name());
|
||||
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr,
|
||||
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_gta.m_send_chat_ptr,
|
||||
g_player_service->get_self()->get_net_data(),
|
||||
chat,
|
||||
false))
|
||||
|
@ -57,7 +57,7 @@ namespace big
|
||||
g_script_patcher_service->add_patch(
|
||||
{RAGE_JOAAT("carmod_shop"), "2D 03 07 00 00 71 38 02", 5, {0x72, 0x2E, 0x03, 0x01}, &g.vehicle.ls_customs});// allow all vehicles 2
|
||||
|
||||
for (auto& entry : *g_pointers->m_script_program_table)
|
||||
for (auto& entry : *g_pointers->m_gta.m_script_program_table)
|
||||
{
|
||||
if (entry.m_program)
|
||||
g_script_patcher_service->on_script_load(entry.m_program);
|
||||
|
83
src/byte_patch_manager.cpp
Normal file
83
src/byte_patch_manager.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include "byte_patch_manager.hpp"
|
||||
|
||||
#include "gta/net_array.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "memory/byte_patch.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/police.hpp"
|
||||
#include "util/toxic.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
extern "C" void sound_overload_detour();
|
||||
std::uint64_t g_sound_overload_ret_addr;
|
||||
|
||||
namespace big
|
||||
{
|
||||
static void init()
|
||||
{
|
||||
// Max Wanted Level
|
||||
police::m_max_wanted_level =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_max_wanted_level.add(5).rip().as<uint32_t*>(), 0).get();
|
||||
police::m_max_wanted_level_2 =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_max_wanted_level.add(14).rip().as<uint32_t*>(), 0).get();
|
||||
|
||||
//Patch blocked explosions
|
||||
toxic::explosion_anti_cheat_bypass::m_can_blame_others =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_explosion_patch.as<std::uint16_t*>(), 0xE990).get();
|
||||
toxic::explosion_anti_cheat_bypass::m_can_use_blocked_explosions =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_explosion_patch.sub(12).as<uint16_t*>(), 0x9090).get();
|
||||
|
||||
// Is Matchmaking Session Valid
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_is_matchmaking_session_valid.as<void*>(), std::to_array({0xB0, 0x01, 0xC3}))
|
||||
->apply(); // has no observable side effects
|
||||
|
||||
// Broadcast Net Array Patch
|
||||
broadcast_net_array::m_patch =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_broadcast_patch.as<uint8_t*>(), 0xEB).get();
|
||||
|
||||
// Creator Warp Cheat Triggered Patch
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_creator_warp_cheat_triggered_patch.as<uint8_t*>(), 0xEB)->apply();
|
||||
|
||||
// NTQVM Caller
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_ntqvm_caller.add(4).rip().sub(32).as<uint64_t*>(), (uint64_t)&hooks::nt_query_virtual_memory)
|
||||
->apply();
|
||||
|
||||
// Sound Overload Detour
|
||||
g_sound_overload_ret_addr = g_pointers->m_gta.m_sound_overload_detour.add(13 + 15).as<decltype(g_sound_overload_ret_addr)>();
|
||||
std::vector<byte> bytes = {0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90}; // far jump opcode + a nop opcode
|
||||
*(void**)(bytes.data() + 6) = sound_overload_detour;
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_sound_overload_detour.add(13).as<void*>(), bytes)->apply();
|
||||
|
||||
// Disable Collision
|
||||
vehicle::disable_collisions::m_patch =
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_disable_collision.sub(2).as<uint8_t*>(), 0xEB).get();
|
||||
|
||||
// Crash Trigger
|
||||
memory::byte_patch::make(g_pointers->m_gta.m_crash_trigger.add(4).as<uint8_t*>(), 0x00)->apply();
|
||||
|
||||
// freemode_thread_restorer_through_vm_patch
|
||||
memory::byte_patch::make(g_pointers->m_gta.freemode_thread_restorer_through_vm_patch_1.add(2).as<uint32_t*>(), 0xc9310272)
|
||||
->apply();
|
||||
memory::byte_patch::make(g_pointers->m_gta.freemode_thread_restorer_through_vm_patch_1.add(6).as<uint16_t*>(), 0x9090)
|
||||
->apply();
|
||||
|
||||
memory::byte_patch::make(g_pointers->m_gta.freemode_thread_restorer_through_vm_patch_2.add(2).as<uint32_t*>(), 0xc9310272)
|
||||
->apply();
|
||||
memory::byte_patch::make(g_pointers->m_gta.freemode_thread_restorer_through_vm_patch_2.add(6).as<uint16_t*>(), 0x9090)
|
||||
->apply();
|
||||
}
|
||||
|
||||
byte_patch_manager::byte_patch_manager()
|
||||
{
|
||||
init();
|
||||
|
||||
g_byte_patch_manager = this;
|
||||
}
|
||||
|
||||
byte_patch_manager::~byte_patch_manager()
|
||||
{
|
||||
memory::byte_patch::restore_all();
|
||||
|
||||
g_byte_patch_manager = nullptr;
|
||||
}
|
||||
}
|
15
src/byte_patch_manager.hpp
Normal file
15
src/byte_patch_manager.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
extern "C" std::uint64_t g_sound_overload_ret_addr;
|
||||
|
||||
namespace big
|
||||
{
|
||||
class byte_patch_manager
|
||||
{
|
||||
public:
|
||||
byte_patch_manager();
|
||||
~byte_patch_manager();
|
||||
};
|
||||
|
||||
inline byte_patch_manager* g_byte_patch_manager;
|
||||
}
|
@ -252,12 +252,12 @@ namespace rage
|
||||
|
||||
fiPackfile::fiPackfile()
|
||||
{
|
||||
big::g_pointers->m_fipackfile_ctor(this);
|
||||
big::g_pointers->m_gta.m_fipackfile_ctor(this);
|
||||
}
|
||||
|
||||
bool fiPackfile::OpenPackfile(const char* archive, bool b_true, int type, intptr_t very_false)
|
||||
{
|
||||
return big::g_pointers->m_fipackfile_open_archive(this, archive, b_true, type, very_false);
|
||||
return big::g_pointers->m_gta.m_fipackfile_open_archive(this, archive, b_true, type, very_false);
|
||||
}
|
||||
|
||||
bool fiPackfile::Mount(const char* mount_point)
|
||||
|
@ -29,7 +29,7 @@ namespace rage
|
||||
public:
|
||||
static inline fiDevice* GetDevice(const char* path, bool allowRoot)
|
||||
{
|
||||
return big::g_pointers->m_fidevice_get_device(path, allowRoot);
|
||||
return big::g_pointers->m_gta.m_fidevice_get_device(path, allowRoot);
|
||||
}
|
||||
|
||||
static bool MountGlobal(const char* mountPoint, fiDevice* device, bool allowRoot);
|
||||
|
@ -1,4 +1,13 @@
|
||||
#pragma once
|
||||
#include "memory/fwddec.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
struct broadcast_net_array
|
||||
{
|
||||
inline static memory::byte_patch* m_patch;
|
||||
};
|
||||
}
|
||||
|
||||
class CNetGamePlayer;
|
||||
|
||||
@ -202,7 +211,7 @@ namespace rage
|
||||
#if 0
|
||||
static inline netArrayHandlerBase* get_by_data(void* data)
|
||||
{
|
||||
if (auto array_mgr = *big::g_pointers->m_game_array_mgr)
|
||||
if (auto array_mgr = *big::g_pointers->m_gta.m_game_array_mgr)
|
||||
{
|
||||
if (auto handler = array_mgr->m_start)
|
||||
{
|
||||
|
@ -74,11 +74,11 @@ namespace rage
|
||||
}
|
||||
bool WriteBool(bool integer)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_bool(this, integer, 1);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_bool(this, integer, 1);
|
||||
}
|
||||
bool ReadBool(bool* integer)
|
||||
{
|
||||
return big::g_pointers->m_read_bitbuf_bool(this, integer, 1);
|
||||
return big::g_pointers->m_gta.m_read_bitbuf_bool(this, integer, 1);
|
||||
}
|
||||
bool ReadPeerId(uint64_t* integer)
|
||||
{
|
||||
@ -113,16 +113,16 @@ namespace rage
|
||||
}
|
||||
bool ReadString(char* string, int bits)
|
||||
{
|
||||
return big::g_pointers->m_read_bitbuf_string(this, string, bits);
|
||||
return big::g_pointers->m_gta.m_read_bitbuf_string(this, string, bits);
|
||||
}
|
||||
bool WriteByte(uint8_t integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_dword(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool ReadByte(uint8_t* integer, int bits)
|
||||
{
|
||||
uint32_t read;
|
||||
if (big::g_pointers->m_read_bitbuf_dword(this, &read, bits))
|
||||
if (big::g_pointers->m_gta.m_read_bitbuf_dword(this, &read, bits))
|
||||
{
|
||||
*integer = read;
|
||||
return true;
|
||||
@ -131,12 +131,12 @@ namespace rage
|
||||
}
|
||||
bool WriteWord(uint16_t integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_dword(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool ReadWord(uint16_t* integer, int bits)
|
||||
{
|
||||
uint32_t read;
|
||||
if (big::g_pointers->m_read_bitbuf_dword(this, &read, bits))
|
||||
if (big::g_pointers->m_gta.m_read_bitbuf_dword(this, &read, bits))
|
||||
{
|
||||
*integer = read;
|
||||
return true;
|
||||
@ -145,15 +145,15 @@ namespace rage
|
||||
}
|
||||
bool WriteDword(uint32_t integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_dword(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool ReadDword(uint32_t* integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_read_bitbuf_dword(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_read_bitbuf_dword(this, integer, bits);
|
||||
}
|
||||
bool WriteInt32(int32_t integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_int32(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_int32(this, integer, bits);
|
||||
}
|
||||
bool ReadInt32(int32_t* integer, int bits)
|
||||
{
|
||||
@ -168,7 +168,7 @@ namespace rage
|
||||
}
|
||||
bool WriteQWord(uint64_t integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_qword(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_qword(this, integer, bits);
|
||||
}
|
||||
bool ReadQWord(uint64_t* integer, int bits)
|
||||
{
|
||||
@ -194,7 +194,7 @@ namespace rage
|
||||
}
|
||||
bool WriteInt64(int64_t integer, int bits)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_int64(this, integer, bits);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_int64(this, integer, bits);
|
||||
}
|
||||
bool ReadInt64(int64_t* integer, int bits)
|
||||
{
|
||||
@ -209,11 +209,11 @@ namespace rage
|
||||
}
|
||||
bool WriteArray(void* array, int size)
|
||||
{
|
||||
return big::g_pointers->m_write_bitbuf_array(this, array, size, 0);
|
||||
return big::g_pointers->m_gta.m_write_bitbuf_array(this, array, size, 0);
|
||||
}
|
||||
bool ReadArray(PVOID array, int size)
|
||||
{
|
||||
return big::g_pointers->m_read_bitbuf_array(this, array, size, 0);
|
||||
return big::g_pointers->m_gta.m_read_bitbuf_array(this, array, size, 0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -136,6 +136,6 @@ class CNetworkObjectMgr : public rage::netObjectMgrBase
|
||||
public:
|
||||
rage::netObject* find_object_by_id(std::uint16_t object_id, bool can_delete_be_pending)
|
||||
{
|
||||
return big::g_pointers->m_get_net_object(this, object_id, can_delete_be_pending);
|
||||
return big::g_pointers->m_gta.m_get_net_object(this, object_id, can_delete_be_pending);
|
||||
}
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
int CGameScriptHandlerNetComponent::get_participant_index(CNetGamePlayer* player)
|
||||
{
|
||||
if (player == (*big::g_pointers->m_network_player_mgr)->m_local_net_player)
|
||||
if (player == (*big::g_pointers->m_gta.m_network_player_mgr)->m_local_net_player)
|
||||
return m_local_participant_index;
|
||||
|
||||
if (m_num_participants <= 1)
|
||||
|
260
src/gta_pointers.hpp
Normal file
260
src/gta_pointers.hpp
Normal file
@ -0,0 +1,260 @@
|
||||
#pragma once
|
||||
|
||||
class CCommunications;
|
||||
class FriendRegistry;
|
||||
class CNetworkPlayerMgr;
|
||||
class Network;
|
||||
class ChatData;
|
||||
|
||||
namespace rage
|
||||
{
|
||||
template<typename T>
|
||||
class atSingleton;
|
||||
class RageSecurity;
|
||||
class netTime;
|
||||
class rlGamerInfo;
|
||||
}
|
||||
|
||||
namespace big
|
||||
{
|
||||
// needed for serialization of the pointers cache
|
||||
#pragma pack(push, 1)
|
||||
struct gta_pointers
|
||||
{
|
||||
memory::handle m_max_wanted_level;
|
||||
|
||||
memory::handle m_blame_explode;
|
||||
|
||||
memory::handle m_explosion_patch;
|
||||
|
||||
memory::handle m_is_matchmaking_session_valid;
|
||||
|
||||
memory::handle m_broadcast_patch;
|
||||
|
||||
memory::handle m_creator_warp_cheat_triggered_patch;
|
||||
|
||||
memory::handle m_ntqvm_caller;
|
||||
|
||||
memory::handle m_sound_overload_detour;
|
||||
|
||||
memory::handle m_disable_collision;
|
||||
|
||||
memory::handle m_crash_trigger;
|
||||
|
||||
memory::handle freemode_thread_restorer_through_vm_patch_1;
|
||||
memory::handle freemode_thread_restorer_through_vm_patch_2;
|
||||
|
||||
eGameState* m_game_state{};
|
||||
bool* m_is_session_started{};
|
||||
|
||||
CPedFactory** m_ped_factory{};
|
||||
CNetworkPlayerMgr** m_network_player_mgr{};
|
||||
CNetworkObjectMgr** m_network_object_mgr{};
|
||||
rage::CReplayInterface** m_replay_interface{};
|
||||
|
||||
functions::ptr_to_handle m_ptr_to_handle{};
|
||||
functions::handle_to_ptr m_handle_to_ptr{};
|
||||
rage::scrNativeRegistrationTable* m_native_registration_table{};
|
||||
functions::get_native_handler m_get_native_handler{};
|
||||
functions::fix_vectors m_fix_vectors{};
|
||||
|
||||
rage::atArray<GtaThread*>* m_script_threads{};
|
||||
rage::scrProgramTable* m_script_program_table{};
|
||||
functions::run_script_threads m_run_script_threads{};
|
||||
std::int64_t** m_script_globals{};
|
||||
|
||||
CGameScriptHandlerMgr** m_script_handler_mgr{};
|
||||
|
||||
IDXGISwapChain** m_swapchain{};
|
||||
|
||||
int* m_resolution_x;
|
||||
int* m_resolution_y;
|
||||
|
||||
uint32_t* m_region_code;
|
||||
|
||||
PVOID m_world_model_spawn_bypass;
|
||||
PVOID m_native_return;
|
||||
PVOID m_get_label_text;
|
||||
functions::check_chat_profanity* m_check_chat_profanity{};
|
||||
functions::write_player_game_state_data_node m_write_player_game_state_data_node{};
|
||||
|
||||
ChatData** m_chat_data;
|
||||
ScInfo* m_sc_info;
|
||||
FriendRegistry* m_friend_registry{};
|
||||
|
||||
functions::get_screen_coords_for_world_coords m_get_screen_coords_for_world_coords{};
|
||||
|
||||
HashTable<CBaseModelInfo*>* m_model_table;
|
||||
PVOID m_get_model_info;
|
||||
|
||||
PVOID m_gta_thread_start{};
|
||||
PVOID m_gta_thread_kill{};
|
||||
|
||||
PVOID m_network_player_mgr_init;
|
||||
PVOID m_network_player_mgr_shutdown;
|
||||
|
||||
functions::get_gameplay_cam_coords m_get_gameplay_cam_coords;
|
||||
|
||||
PVOID m_write_player_gamer_data_node{};
|
||||
|
||||
functions::trigger_script_event m_trigger_script_event{};
|
||||
|
||||
// Bitbuffer Read/Write START
|
||||
functions::read_bitbuf_dword m_read_bitbuf_dword{};
|
||||
functions::read_bitbuf_string m_read_bitbuf_string{};
|
||||
functions::read_bitbuf_bool m_read_bitbuf_bool{};
|
||||
functions::read_bitbuf_array m_read_bitbuf_array{};
|
||||
functions::write_bitbuf_qword m_write_bitbuf_qword{};
|
||||
functions::write_bitbuf_dword m_write_bitbuf_dword{};
|
||||
functions::write_bitbuf_int64 m_write_bitbuf_int64{};
|
||||
functions::write_bitbuf_int32 m_write_bitbuf_int32{};
|
||||
functions::write_bitbuf_bool m_write_bitbuf_bool{};
|
||||
functions::write_bitbuf_array m_write_bitbuf_array{};
|
||||
// Bitbuffer Read/Write END
|
||||
|
||||
// Received Event Signatures START
|
||||
PVOID m_received_event{};
|
||||
functions::send_event_ack m_send_event_ack{};
|
||||
// Received Event Signatures END
|
||||
|
||||
//Sync Signatures START
|
||||
PVOID m_received_clone_create;
|
||||
PVOID m_received_clone_sync;
|
||||
PVOID m_can_apply_data;
|
||||
functions::get_sync_tree_for_type m_get_sync_tree_for_type{};
|
||||
functions::get_sync_type_info m_get_sync_type_info{};
|
||||
functions::get_net_object m_get_net_object{};
|
||||
functions::read_bitbuffer_into_sync_tree m_read_bitbuffer_into_sync_tree{};
|
||||
//Sync Signatures END
|
||||
|
||||
PVOID m_receive_net_message{};
|
||||
PVOID m_get_network_event_data{};
|
||||
PVOID m_assign_physical_index{};
|
||||
|
||||
Network** m_network;
|
||||
|
||||
functions::start_get_session_by_gamer_handle m_start_get_session_by_gamer_handle;
|
||||
functions::start_matchmaking_find_sessions m_start_matchmaking_find_sessions;
|
||||
functions::join_session_by_info m_join_session_by_info;
|
||||
|
||||
functions::reset_network_complaints m_reset_network_complaints{};
|
||||
|
||||
functions::fidevice_get_device m_fidevice_get_device{};
|
||||
uintptr_t m_fidevices{};
|
||||
uint16_t* m_fidevices_len{};
|
||||
functions::fipackfile_ctor m_fipackfile_ctor{};
|
||||
rage::fiPackfile** m_fipackfile_instances{};
|
||||
functions::fipackfile_open_archive m_fipackfile_open_archive{};
|
||||
functions::fipackfile_mount m_fipackfile_mount{};
|
||||
functions::fipackfile_unmount m_fipackfile_unmount{};
|
||||
|
||||
PVOID m_invalid_mods_crash_detour{};
|
||||
PVOID m_constraint_attachment_crash{};
|
||||
PVOID m_invalid_decal_crash{};
|
||||
PVOID m_task_parachute_object_0x270{};
|
||||
|
||||
int64_t** m_send_chat_ptr{};
|
||||
functions::send_chat_message m_send_chat_message{};
|
||||
|
||||
PVOID m_init_native_tables{};
|
||||
functions::script_vm m_script_vm{};
|
||||
|
||||
functions::generate_uuid m_generate_uuid{};
|
||||
std::uint64_t* m_host_token{};
|
||||
rage::rlGamerInfo* m_profile_gamer_info{}; // per profile gamer info
|
||||
rage::rlGamerInfo* m_player_info_gamer_info{}; // the gamer info that is applied to CPlayerInfo
|
||||
CCommunications** m_communications{};
|
||||
|
||||
PVOID m_serialize_ped_inventory_data_node;
|
||||
PVOID m_serialize_vehicle_gadget_data_node;
|
||||
functions::get_vehicle_gadget_array_size m_get_vehicle_gadget_array_size;
|
||||
|
||||
PVOID m_handle_join_request;
|
||||
functions::write_join_response_data m_write_join_response_data;
|
||||
|
||||
functions::queue_packet m_queue_packet;
|
||||
|
||||
PVOID m_sort_session_details;
|
||||
|
||||
PVOID m_add_player_to_session;
|
||||
PVOID m_send_chat_net_message;
|
||||
|
||||
PVOID m_process_matchmaking_find_response;
|
||||
PVOID m_serialize_player_data_msg;
|
||||
|
||||
PVOID m_serialize_join_request_message;
|
||||
|
||||
functions::give_pickup_rewards m_give_pickup_rewards{};
|
||||
functions::send_network_damage m_send_network_damage;
|
||||
functions::request_ragdoll m_request_ragdoll;
|
||||
functions::request_control m_request_control;
|
||||
functions::clear_ped_tasks_network m_clear_ped_tasks_network;
|
||||
|
||||
functions::get_connection_peer m_get_connection_peer{};
|
||||
functions::send_remove_gamer_cmd m_send_remove_gamer_cmd{};
|
||||
functions::handle_remove_gamer_cmd m_handle_remove_gamer_cmd{};
|
||||
|
||||
PVOID m_broadcast_net_array{};
|
||||
|
||||
rage::atSingleton<rage::RageSecurity>* m_security;
|
||||
PVOID m_prepare_metric_for_sending;
|
||||
|
||||
PVOID m_queue_dependency;
|
||||
PVOID m_interval_check_func;
|
||||
|
||||
PVOID m_send_session_matchmaking_attributes;
|
||||
|
||||
PVOID m_serialize_take_off_ped_variation_task;
|
||||
|
||||
PVOID m_create_script_handler;
|
||||
|
||||
functions::encode_session_info m_encode_session_info;
|
||||
functions::decode_session_info m_decode_session_info;
|
||||
functions::decode_peer_info m_decode_peer_info;
|
||||
|
||||
datafile_commands::SveFileObject* m_main_file_object;
|
||||
functions::load_cloud_file m_load_cloud_file;
|
||||
functions::set_as_active_cloud_file m_set_as_active_cloud_file;
|
||||
functions::save_json_data m_save_json_data;
|
||||
|
||||
rage::netTime** m_network_time;
|
||||
functions::sync_network_time m_sync_network_time;
|
||||
|
||||
functions::send_packet m_send_packet;
|
||||
functions::connect_to_peer m_connect_to_peer;
|
||||
|
||||
PVOID m_fragment_physics_crash;
|
||||
PVOID m_fragment_physics_crash_2;
|
||||
|
||||
PVOID m_infinite_train_crash;
|
||||
functions::get_next_carriage m_get_next_carriage;
|
||||
|
||||
functions::get_entity_attached_to m_get_entity_attached_to;
|
||||
|
||||
PVOID m_received_array_update;
|
||||
|
||||
PVOID m_receive_pickup{};
|
||||
|
||||
PVOID m_write_player_camera_data_node{};
|
||||
|
||||
PVOID m_send_player_card_stats{};
|
||||
bool* m_force_player_card_refresh{};
|
||||
|
||||
PVOID m_serialize_stats{};
|
||||
|
||||
PVOID m_write_player_creation_data_node{};
|
||||
PVOID m_write_player_appearance_data_node{};
|
||||
|
||||
PVOID m_enumerate_audio_devices{};
|
||||
PVOID m_direct_sound_capture_create{};
|
||||
bool* m_refresh_audio_input{};
|
||||
|
||||
PVOID m_allow_weapons_in_vehicle{};
|
||||
|
||||
PVOID m_taskjump_constructor{};
|
||||
|
||||
PVOID m_write_vehicle_proximity_migration_data_node{};
|
||||
functions::migrate_object m_migrate_object{};
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
13
src/gta_pointers_layout_info.hpp
Normal file
13
src/gta_pointers_layout_info.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
struct gta_pointers_layout_info
|
||||
{
|
||||
// get the beginning and the end of what we need to save / load
|
||||
inline static constexpr size_t offset_of_cache_begin_field = offsetof(big::pointers, m_gta);
|
||||
inline static constexpr size_t offset_of_cache_end_field = offsetof(big::pointers, m_gta) + sizeof(gta_pointers);
|
||||
inline static constexpr size_t field_count = (offset_of_cache_end_field - offset_of_cache_begin_field) / sizeof(void*);
|
||||
};
|
||||
}
|
@ -11,7 +11,7 @@ namespace big::gta_util
|
||||
{
|
||||
inline CPed* get_local_ped()
|
||||
{
|
||||
if (auto ped_factory = *g_pointers->m_ped_factory)
|
||||
if (auto ped_factory = *g_pointers->m_gta.m_ped_factory)
|
||||
{
|
||||
return ped_factory->m_local_ped;
|
||||
}
|
||||
@ -33,7 +33,7 @@ namespace big::gta_util
|
||||
|
||||
inline CPlayerInfo* get_local_playerinfo()
|
||||
{
|
||||
if (auto ped_factory = *g_pointers->m_ped_factory)
|
||||
if (auto ped_factory = *g_pointers->m_gta.m_ped_factory)
|
||||
{
|
||||
if (auto ped = ped_factory->m_local_ped)
|
||||
{
|
||||
@ -46,12 +46,12 @@ namespace big::gta_util
|
||||
|
||||
inline CNetworkPlayerMgr* get_network_player_mgr()
|
||||
{
|
||||
return *g_pointers->m_network_player_mgr;
|
||||
return *g_pointers->m_gta.m_network_player_mgr;
|
||||
}
|
||||
|
||||
inline Network* get_network()
|
||||
{
|
||||
return *g_pointers->m_network;
|
||||
return *g_pointers->m_gta.m_network;
|
||||
}
|
||||
|
||||
template<typename F, typename... Args>
|
||||
@ -72,7 +72,7 @@ namespace big::gta_util
|
||||
template<typename F, typename... Args>
|
||||
void execute_as_script(rage::joaat_t script_hash, F&& callback, Args&&... args)
|
||||
{
|
||||
for (auto thread : *g_pointers->m_script_threads)
|
||||
for (auto thread : *g_pointers->m_gta.m_script_threads)
|
||||
{
|
||||
if (!thread || !thread->m_context.m_thread_id || thread->m_context.m_script_hash != script_hash)
|
||||
continue;
|
||||
@ -85,7 +85,7 @@ namespace big::gta_util
|
||||
|
||||
inline GtaThread* find_script_thread(rage::joaat_t hash)
|
||||
{
|
||||
for (auto thread : *g_pointers->m_script_threads)
|
||||
for (auto thread : *g_pointers->m_gta.m_script_threads)
|
||||
{
|
||||
if (thread && thread->m_context.m_thread_id && thread->m_handler && thread->m_script_hash == hash)
|
||||
{
|
||||
@ -98,7 +98,7 @@ namespace big::gta_util
|
||||
|
||||
inline GtaThread* find_script_thread_by_id(std::uint32_t id)
|
||||
{
|
||||
for (auto thread : *g_pointers->m_script_threads)
|
||||
for (auto thread : *g_pointers->m_gta.m_script_threads)
|
||||
{
|
||||
if (thread && thread->m_handler && thread->m_context.m_thread_id == id)
|
||||
{
|
||||
@ -111,7 +111,7 @@ namespace big::gta_util
|
||||
|
||||
inline rage::scrProgram* find_script_program(rage::joaat_t hash)
|
||||
{
|
||||
for (auto& script : *g_pointers->m_script_program_table)
|
||||
for (auto& script : *g_pointers->m_gta.m_script_program_table)
|
||||
{
|
||||
if (script.m_program && script.m_program->m_name_hash == hash)
|
||||
return script.m_program;
|
||||
|
@ -12,7 +12,7 @@ namespace big
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {0, 5});
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {0, 2});
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, {0, 0});
|
||||
bool result = ImGui::Button(text.data(), {((float)*g_pointers->m_resolution_x * 0.15f) - 30, 0});
|
||||
bool result = ImGui::Button(text.data(), {((float)*g_pointers->m_gta.m_resolution_x * 0.15f) - 30, 0});
|
||||
ImGui::PopStyleVar(4);
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
|
120
src/hooking.cpp
120
src/hooking.cpp
@ -17,7 +17,7 @@ namespace big
|
||||
{
|
||||
hooking::hooking() :
|
||||
// Swapchain
|
||||
m_swapchain_hook(*g_pointers->m_swapchain, hooks::swapchain_num_funcs)
|
||||
m_swapchain_hook(*g_pointers->m_gta.m_swapchain, hooks::swapchain_num_funcs)
|
||||
{
|
||||
m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
|
||||
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);
|
||||
@ -29,101 +29,101 @@ namespace big
|
||||
detour_hook_helper->m_detour_hook->set_target_and_create_hook(detour_hook_helper->m_on_hooking_available());
|
||||
}
|
||||
|
||||
detour_hook_helper::add<hooks::run_script_threads>("SH", g_pointers->m_run_script_threads);
|
||||
detour_hook_helper::add<hooks::run_script_threads>("SH", g_pointers->m_gta.m_run_script_threads);
|
||||
|
||||
detour_hook_helper::add<hooks::get_label_text>("GLT", g_pointers->m_get_label_text);
|
||||
detour_hook_helper::add<hooks::get_label_text>("GLT", g_pointers->m_gta.m_get_label_text);
|
||||
|
||||
detour_hook_helper::add<hooks::check_chat_profanity>("CCP", g_pointers->m_check_chat_profanity);
|
||||
detour_hook_helper::add<hooks::check_chat_profanity>("CCP", g_pointers->m_gta.m_check_chat_profanity);
|
||||
|
||||
detour_hook_helper::add<hooks::write_player_game_state_data_node>("WPGSDN", g_pointers->m_write_player_game_state_data_node);
|
||||
detour_hook_helper::add<hooks::write_player_game_state_data_node>("WPGSDN", g_pointers->m_gta.m_write_player_game_state_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::gta_thread_start>("GTS", g_pointers->m_gta_thread_start);
|
||||
detour_hook_helper::add<hooks::gta_thread_kill>("GTK", g_pointers->m_gta_thread_kill);
|
||||
detour_hook_helper::add<hooks::init_native_tables>("INT", g_pointers->m_init_native_tables);
|
||||
detour_hook_helper::add<hooks::script_vm>("SVM", g_pointers->m_script_vm);
|
||||
detour_hook_helper::add<hooks::gta_thread_start>("GTS", g_pointers->m_gta.m_gta_thread_start);
|
||||
detour_hook_helper::add<hooks::gta_thread_kill>("GTK", g_pointers->m_gta.m_gta_thread_kill);
|
||||
detour_hook_helper::add<hooks::init_native_tables>("INT", g_pointers->m_gta.m_init_native_tables);
|
||||
detour_hook_helper::add<hooks::script_vm>("SVM", g_pointers->m_gta.m_script_vm);
|
||||
|
||||
detour_hook_helper::add<hooks::network_player_mgr_init>("NPMI", g_pointers->m_network_player_mgr_init);
|
||||
detour_hook_helper::add<hooks::network_player_mgr_shutdown>("NPMS", g_pointers->m_network_player_mgr_shutdown);
|
||||
detour_hook_helper::add<hooks::network_player_mgr_init>("NPMI", g_pointers->m_gta.m_network_player_mgr_init);
|
||||
detour_hook_helper::add<hooks::network_player_mgr_shutdown>("NPMS", g_pointers->m_gta.m_network_player_mgr_shutdown);
|
||||
|
||||
detour_hook_helper::add<hooks::received_event>("RE", g_pointers->m_received_event);
|
||||
detour_hook_helper::add<hooks::received_event>("RE", g_pointers->m_gta.m_received_event);
|
||||
|
||||
detour_hook_helper::add<hooks::assign_physical_index>("API", g_pointers->m_assign_physical_index);
|
||||
detour_hook_helper::add<hooks::assign_physical_index>("API", g_pointers->m_gta.m_assign_physical_index);
|
||||
|
||||
detour_hook_helper::add<hooks::receive_net_message>("RNM", g_pointers->m_receive_net_message);
|
||||
detour_hook_helper::add<hooks::receive_net_message>("RNM", g_pointers->m_gta.m_receive_net_message);
|
||||
|
||||
detour_hook_helper::add<hooks::received_clone_create>("RCC", g_pointers->m_received_clone_create);
|
||||
detour_hook_helper::add<hooks::received_clone_sync>("RCS", g_pointers->m_received_clone_sync);
|
||||
detour_hook_helper::add<hooks::can_apply_data>("CAD", g_pointers->m_can_apply_data);
|
||||
detour_hook_helper::add<hooks::received_clone_create>("RCC", g_pointers->m_gta.m_received_clone_create);
|
||||
detour_hook_helper::add<hooks::received_clone_sync>("RCS", g_pointers->m_gta.m_received_clone_sync);
|
||||
detour_hook_helper::add<hooks::can_apply_data>("CAD", g_pointers->m_gta.m_can_apply_data);
|
||||
|
||||
detour_hook_helper::add<hooks::get_network_event_data>("GNED", g_pointers->m_get_network_event_data);
|
||||
detour_hook_helper::add<hooks::write_player_gamer_data_node>("WPGDN", g_pointers->m_write_player_gamer_data_node);
|
||||
detour_hook_helper::add<hooks::get_network_event_data>("GNED", g_pointers->m_gta.m_get_network_event_data);
|
||||
detour_hook_helper::add<hooks::write_player_gamer_data_node>("WPGDN", g_pointers->m_gta.m_write_player_gamer_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::invalid_mods_crash_detour>("IMCD", g_pointers->m_invalid_mods_crash_detour);
|
||||
detour_hook_helper::add<hooks::constraint_attachment_crash>("CAC", g_pointers->m_constraint_attachment_crash);
|
||||
detour_hook_helper::add<hooks::invalid_decal>("IDC", g_pointers->m_invalid_decal_crash);
|
||||
detour_hook_helper::add<hooks::task_parachute_object_0x270>("TPO270", g_pointers->m_task_parachute_object_0x270);
|
||||
detour_hook_helper::add<hooks::invalid_mods_crash_detour>("IMCD", g_pointers->m_gta.m_invalid_mods_crash_detour);
|
||||
detour_hook_helper::add<hooks::constraint_attachment_crash>("CAC", g_pointers->m_gta.m_constraint_attachment_crash);
|
||||
detour_hook_helper::add<hooks::invalid_decal>("IDC", g_pointers->m_gta.m_invalid_decal_crash);
|
||||
detour_hook_helper::add<hooks::task_parachute_object_0x270>("TPO270", g_pointers->m_gta.m_task_parachute_object_0x270);
|
||||
|
||||
detour_hook_helper::add<hooks::update_presence_attribute_int>("UPAI", g_pointers->m_update_presence_attribute_int);
|
||||
detour_hook_helper::add<hooks::update_presence_attribute_string>("UPAS", g_pointers->m_update_presence_attribute_string);
|
||||
detour_hook_helper::add<hooks::update_presence_attribute_int>("UPAI", g_pointers->m_sc.m_update_presence_attribute_int);
|
||||
detour_hook_helper::add<hooks::update_presence_attribute_string>("UPAS", g_pointers->m_sc.m_update_presence_attribute_string);
|
||||
|
||||
detour_hook_helper::add<hooks::serialize_ped_inventory_data_node>("SPIDN", g_pointers->m_serialize_ped_inventory_data_node);
|
||||
detour_hook_helper::add<hooks::serialize_vehicle_gadget_data_node>("SVGDN", g_pointers->m_serialize_vehicle_gadget_data_node);
|
||||
detour_hook_helper::add<hooks::serialize_ped_inventory_data_node>("SPIDN", g_pointers->m_gta.m_serialize_ped_inventory_data_node);
|
||||
detour_hook_helper::add<hooks::serialize_vehicle_gadget_data_node>("SVGDN", g_pointers->m_gta.m_serialize_vehicle_gadget_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::handle_join_request>("HJR", g_pointers->m_handle_join_request);
|
||||
detour_hook_helper::add<hooks::handle_join_request>("HJR", g_pointers->m_gta.m_handle_join_request);
|
||||
|
||||
detour_hook_helper::add<hooks::sort_session_details>("SSD", g_pointers->m_sort_session_details);
|
||||
detour_hook_helper::add<hooks::sort_session_details>("SSD", g_pointers->m_gta.m_sort_session_details);
|
||||
|
||||
detour_hook_helper::add<hooks::add_player_to_session>("APTS", g_pointers->m_add_player_to_session);
|
||||
detour_hook_helper::add<hooks::send_chat_message>("SCM", g_pointers->m_send_chat_message);
|
||||
detour_hook_helper::add<hooks::send_chat_net_message>("SCNM", g_pointers->m_send_chat_net_message);
|
||||
detour_hook_helper::add<hooks::add_player_to_session>("APTS", g_pointers->m_gta.m_add_player_to_session);
|
||||
detour_hook_helper::add<hooks::send_chat_message>("SCM", g_pointers->m_gta.m_send_chat_message);
|
||||
detour_hook_helper::add<hooks::send_chat_net_message>("SCNM", g_pointers->m_gta.m_send_chat_net_message);
|
||||
|
||||
detour_hook_helper::add<hooks::process_matchmaking_find_response>("PMFR", g_pointers->m_process_matchmaking_find_response);
|
||||
detour_hook_helper::add<hooks::serialize_player_data_msg>("SJPD", g_pointers->m_serialize_player_data_msg);
|
||||
detour_hook_helper::add<hooks::process_matchmaking_find_response>("PMFR", g_pointers->m_gta.m_process_matchmaking_find_response);
|
||||
detour_hook_helper::add<hooks::serialize_player_data_msg>("SJPD", g_pointers->m_gta.m_serialize_player_data_msg);
|
||||
|
||||
detour_hook_helper::add<hooks::serialize_join_request_message>("SJRM", g_pointers->m_serialize_join_request_message);
|
||||
detour_hook_helper::add<hooks::serialize_join_request_message>("SJRM", g_pointers->m_gta.m_serialize_join_request_message);
|
||||
|
||||
detour_hook_helper::add<hooks::start_matchmaking_find_sessions>("SMFS", g_pointers->m_start_matchmaking_find_sessions);
|
||||
detour_hook_helper::add<hooks::start_matchmaking_find_sessions>("SMFS", g_pointers->m_gta.m_start_matchmaking_find_sessions);
|
||||
|
||||
detour_hook_helper::add<hooks::broadcast_net_array>("BNA", g_pointers->m_broadcast_net_array);
|
||||
detour_hook_helper::add<hooks::broadcast_net_array>("BNA", g_pointers->m_gta.m_broadcast_net_array);
|
||||
|
||||
detour_hook_helper::add<hooks::send_session_matchmaking_attributes>("SSMA", g_pointers->m_send_session_matchmaking_attributes);
|
||||
detour_hook_helper::add<hooks::send_session_matchmaking_attributes>("SSMA", g_pointers->m_gta.m_send_session_matchmaking_attributes);
|
||||
|
||||
detour_hook_helper::add<hooks::serialize_take_off_ped_variation_task>("STOPVT", g_pointers->m_serialize_take_off_ped_variation_task);
|
||||
detour_hook_helper::add<hooks::serialize_take_off_ped_variation_task>("STOPVT", g_pointers->m_gta.m_serialize_take_off_ped_variation_task);
|
||||
|
||||
detour_hook_helper::add<hooks::create_script_handler>("CSH", g_pointers->m_create_script_handler);
|
||||
detour_hook_helper::add<hooks::create_script_handler>("CSH", g_pointers->m_gta.m_create_script_handler);
|
||||
|
||||
detour_hook_helper::add<hooks::queue_dependency>("QD", g_pointers->m_queue_dependency);
|
||||
detour_hook_helper::add<hooks::prepare_metric_for_sending>("PMFS", g_pointers->m_prepare_metric_for_sending);
|
||||
detour_hook_helper::add<hooks::queue_dependency>("QD", g_pointers->m_gta.m_queue_dependency);
|
||||
detour_hook_helper::add<hooks::prepare_metric_for_sending>("PMFS", g_pointers->m_gta.m_prepare_metric_for_sending);
|
||||
|
||||
detour_hook_helper::add<hooks::fragment_physics_crash>("FPC", g_pointers->m_fragment_physics_crash);
|
||||
detour_hook_helper::add<hooks::fragment_physics_crash_2>("FPC2", g_pointers->m_fragment_physics_crash_2);
|
||||
detour_hook_helper::add<hooks::fragment_physics_crash>("FPC", g_pointers->m_gta.m_fragment_physics_crash);
|
||||
detour_hook_helper::add<hooks::fragment_physics_crash_2>("FPC2", g_pointers->m_gta.m_fragment_physics_crash_2);
|
||||
|
||||
detour_hook_helper::add<hooks::infinite_train_crash>("ITC", g_pointers->m_infinite_train_crash);
|
||||
detour_hook_helper::add<hooks::infinite_train_crash>("ITC", g_pointers->m_gta.m_infinite_train_crash);
|
||||
|
||||
detour_hook_helper::add<hooks::received_array_update>("RAU", g_pointers->m_received_array_update);
|
||||
detour_hook_helper::add<hooks::received_array_update>("RAU", g_pointers->m_gta.m_received_array_update);
|
||||
|
||||
detour_hook_helper::add<hooks::receive_pickup>("RPI", g_pointers->m_receive_pickup);
|
||||
detour_hook_helper::add<hooks::receive_pickup>("RPI", g_pointers->m_gta.m_receive_pickup);
|
||||
|
||||
detour_hook_helper::add<hooks::write_player_camera_data_node>("WPCDN", g_pointers->m_write_player_camera_data_node);
|
||||
detour_hook_helper::add<hooks::write_player_camera_data_node>("WPCDN", g_pointers->m_gta.m_write_player_camera_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::send_player_card_stats>("SPCS", g_pointers->m_send_player_card_stats);
|
||||
detour_hook_helper::add<hooks::serialize_stats>("SS", g_pointers->m_serialize_stats);
|
||||
detour_hook_helper::add<hooks::send_player_card_stats>("SPCS", g_pointers->m_gta.m_send_player_card_stats);
|
||||
detour_hook_helper::add<hooks::serialize_stats>("SS", g_pointers->m_gta.m_serialize_stats);
|
||||
|
||||
detour_hook_helper::add<hooks::write_player_creation_data_node>("WPCDN", g_pointers->m_write_player_creation_data_node);
|
||||
detour_hook_helper::add<hooks::write_player_appearance_data_node>("WPADN", g_pointers->m_write_player_appearance_data_node);
|
||||
detour_hook_helper::add<hooks::write_player_creation_data_node>("WPCDN", g_pointers->m_gta.m_write_player_creation_data_node);
|
||||
detour_hook_helper::add<hooks::write_player_appearance_data_node>("WPADN", g_pointers->m_gta.m_write_player_appearance_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::get_model_info>("GMI", g_pointers->m_get_model_info);
|
||||
detour_hook_helper::add<hooks::get_model_info>("GMI", g_pointers->m_gta.m_get_model_info);
|
||||
|
||||
detour_hook_helper::add<hooks::task_jump_constructor>("TJC", g_pointers->m_taskjump_constructor);
|
||||
detour_hook_helper::add<hooks::task_jump_constructor>("TJC", g_pointers->m_gta.m_taskjump_constructor);
|
||||
|
||||
detour_hook_helper::add<hooks::enumerate_audio_devices>("EAD", g_pointers->m_enumerate_audio_devices);
|
||||
detour_hook_helper::add<hooks::direct_sound_capture_create>("DSCC", g_pointers->m_direct_sound_capture_create);
|
||||
detour_hook_helper::add<hooks::enumerate_audio_devices>("EAD", g_pointers->m_gta.m_enumerate_audio_devices);
|
||||
detour_hook_helper::add<hooks::direct_sound_capture_create>("DSCC", g_pointers->m_gta.m_direct_sound_capture_create);
|
||||
|
||||
detour_hook_helper::add<hooks::write_vehicle_proximity_migration_data_node>("WVPMDN", g_pointers->m_write_vehicle_proximity_migration_data_node);
|
||||
detour_hook_helper::add<hooks::write_vehicle_proximity_migration_data_node>("WVPMDN", g_pointers->m_gta.m_write_vehicle_proximity_migration_data_node);
|
||||
|
||||
detour_hook_helper::add<hooks::fipackfile_mount>("FPFM", g_pointers->m_fipackfile_mount);
|
||||
detour_hook_helper::add<hooks::fipackfile_mount>("FPFM", g_pointers->m_gta.m_fipackfile_mount);
|
||||
|
||||
detour_hook_helper::add<hooks::allow_weapons_in_vehicle>("AWIV", g_pointers->m_allow_weapons_in_vehicle);
|
||||
detour_hook_helper::add<hooks::allow_weapons_in_vehicle>("AWIV", g_pointers->m_gta.m_allow_weapons_in_vehicle);
|
||||
|
||||
g_hooking = this;
|
||||
}
|
||||
@ -148,7 +148,7 @@ namespace big
|
||||
detour_hook_helper->m_detour_hook->enable();
|
||||
}
|
||||
|
||||
for (auto& thread : *g_pointers->m_script_threads)
|
||||
for (auto& thread : *g_pointers->m_gta.m_script_threads)
|
||||
{
|
||||
if (thread->m_handler)
|
||||
hook_script_handler((CGameScriptHandler*)thread->m_handler);
|
||||
|
@ -24,13 +24,13 @@ namespace big
|
||||
if (damage_data.m_weapon_used == RAGE_JOAAT("weapon_explosion"))
|
||||
break;
|
||||
|
||||
if (auto damager = g_pointers->m_handle_to_ptr(damage_data.m_damager_index);
|
||||
if (auto damager = g_pointers->m_gta.m_handle_to_ptr(damage_data.m_damager_index);
|
||||
damager && damager->m_entity_type == 4 && reinterpret_cast<CPed*>(damager)->m_player_info)
|
||||
{
|
||||
if (auto player = g_player_service->get_by_host_token(
|
||||
reinterpret_cast<CPed*>(damager)->m_player_info->m_net_player_data.m_host_token))
|
||||
{
|
||||
if (auto victim = g_pointers->m_handle_to_ptr(damage_data.m_victim_index);
|
||||
if (auto victim = g_pointers->m_gta.m_handle_to_ptr(damage_data.m_victim_index);
|
||||
victim && victim->m_entity_type == 4 && reinterpret_cast<CPed*>(victim)->m_player_info)
|
||||
{
|
||||
if (reinterpret_cast<CPed*>(damager)->m_damage_bits & (1 << 8))
|
||||
|
@ -5,7 +5,7 @@ namespace big
|
||||
{
|
||||
void hooks::queue_dependency(void* dependency)
|
||||
{
|
||||
if (dependency == g_pointers->m_interval_check_func)
|
||||
if (dependency == g_pointers->m_gta.m_interval_check_func)
|
||||
{
|
||||
//LOG(INFO) << "Prevent attempt to queue a report to R*.";
|
||||
return;
|
||||
|
@ -59,7 +59,7 @@ namespace big
|
||||
plyr->is_admin = true;
|
||||
}
|
||||
}
|
||||
if (g.notifications.player_join.above_map && *g_pointers->m_is_session_started) // prevent loading screen spam
|
||||
if (g.notifications.player_join.above_map && *g_pointers->m_gta.m_is_session_started) // prevent loading screen spam
|
||||
notify::player_joined(player);
|
||||
|
||||
if (g.notifications.player_join.log)
|
||||
|
@ -15,7 +15,7 @@ namespace big
|
||||
{
|
||||
CMsgJoinResponse response{};
|
||||
response.m_status_code = player->block_join_reason;
|
||||
g_pointers->m_write_join_response_data(&response, ctx->m_join_response_data, 512, &ctx->m_join_response_size);
|
||||
g_pointers->m_gta.m_write_join_response_data(&response, ctx->m_join_response_data, 512, &ctx->m_join_response_size);
|
||||
g_notification_service->push("BLOCK_JOIN"_T.data(),
|
||||
std::vformat("BLOCK_JOIN_INFO"_T, std::make_format_args(player->name)));
|
||||
return false;
|
||||
|
@ -8,12 +8,12 @@ namespace big
|
||||
void* current_carriage = carriage;
|
||||
int count = 0;
|
||||
|
||||
while (g_pointers->m_get_next_carriage(current_carriage))
|
||||
while (g_pointers->m_gta.m_get_next_carriage(current_carriage))
|
||||
{
|
||||
if (++count > 20)
|
||||
return nullptr;
|
||||
|
||||
current_carriage = g_pointers->m_get_next_carriage(current_carriage);
|
||||
current_carriage = g_pointers->m_gta.m_get_next_carriage(current_carriage);
|
||||
}
|
||||
|
||||
return current_carriage;
|
||||
|
@ -270,7 +270,7 @@ namespace big
|
||||
uint32_t counter = buffer.Read<uint32_t>(32);
|
||||
uint32_t token = buffer.Read<uint32_t>(32);
|
||||
uint32_t timestamp = buffer.Read<uint32_t>(32);
|
||||
uint32_t time_diff = (*g_pointers->m_network_time)->m_time_offset + frame->m_timestamp;
|
||||
uint32_t time_diff = (*g_pointers->m_gta.m_network_time)->m_time_offset + frame->m_timestamp;
|
||||
|
||||
if (action == 0)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace big
|
||||
return eAckCode::ACKCODE_FAIL;
|
||||
}
|
||||
|
||||
if (auto net_obj = g_pointers->m_get_net_object(mgr, object_id, true); net_obj && net_obj->m_object_type != (int16_t)object_type)
|
||||
if (auto net_obj = g_pointers->m_gta.m_get_net_object(mgr, object_id, true); net_obj && net_obj->m_object_type != (int16_t)object_type)
|
||||
{
|
||||
notify::crash_blocked(src, "incorrect object type");
|
||||
return eAckCode::ACKCODE_FAIL;
|
||||
|
@ -193,7 +193,7 @@ namespace big
|
||||
if (!player->is_valid() || !player->get_ped())
|
||||
return;
|
||||
|
||||
g_pointers->m_send_network_damage(g_player_service->get_self()->get_ped(),
|
||||
g_pointers->m_gta.m_send_network_damage(g_player_service->get_self()->get_ped(),
|
||||
player->get_ped(),
|
||||
(rage::fvector3*)&localPos,
|
||||
hitComponent,
|
||||
@ -321,10 +321,10 @@ namespace big
|
||||
|
||||
buffer->Seek(0);
|
||||
|
||||
auto object = g_pointers->m_get_net_object(*g_pointers->m_network_object_mgr, ownerNetId, true);
|
||||
auto object = g_pointers->m_gta.m_get_net_object(*g_pointers->m_gta.m_network_object_mgr, ownerNetId, true);
|
||||
auto entity = object ? object->GetGameObject() : nullptr;
|
||||
|
||||
auto offset_object = g_pointers->m_get_net_object(*g_pointers->m_network_object_mgr, f210, true);
|
||||
auto offset_object = g_pointers->m_gta.m_get_net_object(*g_pointers->m_gta.m_network_object_mgr, f210, true);
|
||||
|
||||
if (f208 == 0 && entity && entity->m_entity_type == 4 && reinterpret_cast<CPed*>(entity)->m_player_info
|
||||
&& player->m_player_info->m_ped && player->m_player_info->m_ped->m_net_object
|
||||
@ -354,14 +354,14 @@ namespace big
|
||||
{
|
||||
if (event_id > 91u)
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto event_name = *(char**)((DWORD64)event_manager + 8i64 * event_id + 243376);
|
||||
if (event_name == nullptr || source_player == nullptr || source_player->m_player_id < 0 || source_player->m_player_id >= 32)
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ namespace big
|
||||
buffer->ReadDword(&increment_stat_event->m_amount, 0x20);
|
||||
if (hooks::increment_stat_event(increment_stat_event.get(), source_player))
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
buffer->Seek(0);
|
||||
@ -404,7 +404,7 @@ namespace big
|
||||
|
||||
if ((action >= 15 && action <= 18) || action == 33)
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
notify::crash_blocked(source_player, "vehicle temp action");
|
||||
return;
|
||||
}
|
||||
@ -412,7 +412,7 @@ namespace big
|
||||
else if (type > ScriptEntityChangeType::SetVehicleExclusiveDriver || type < ScriptEntityChangeType::BlockingOfNonTemporaryEvents)
|
||||
{
|
||||
notify::crash_blocked(source_player, "invalid script entity change type");
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
buffer->Seek(0);
|
||||
@ -427,7 +427,7 @@ namespace big
|
||||
|
||||
if (hooks::scripted_game_event(scripted_game_event.get(), source_player))
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -441,7 +441,7 @@ namespace big
|
||||
|
||||
if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g.reactions.clear_ped_tasks.process(plyr);
|
||||
return;
|
||||
}
|
||||
@ -455,7 +455,7 @@ namespace big
|
||||
|
||||
if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g.reactions.remote_ragdoll.process(plyr);
|
||||
return;
|
||||
}
|
||||
@ -495,7 +495,7 @@ namespace big
|
||||
if (g_local_player && g_local_player->m_vehicle && g_local_player->m_vehicle->m_net_object
|
||||
&& g_local_player->m_vehicle->m_net_object->m_object_id == net_id && g_local_player->m_vehicle->m_driver == g_local_player)
|
||||
{
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g.reactions.request_control_event.process(plyr);
|
||||
return;
|
||||
}
|
||||
@ -528,7 +528,7 @@ namespace big
|
||||
// most definitely a crash
|
||||
LOG(INFO) << std::hex << std::uppercase << "0x" << id.m_hash;
|
||||
notify::crash_blocked(source_player, "rope");
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -541,14 +541,14 @@ namespace big
|
||||
if (pop_group == 0 && (percentage == 0 || percentage == 103))
|
||||
{
|
||||
notify::crash_blocked(source_player, "pop group override");
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (type > WorldStateDataType::VehiclePlayerLocking || type < WorldStateDataType::CarGen)
|
||||
{
|
||||
notify::crash_blocked(source_player, "invalid world state type");
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ namespace big
|
||||
if (hash == RAGE_JOAAT("WEAPON_UNARMED"))
|
||||
{
|
||||
notify::crash_blocked(source_player, "remove unarmed");
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -571,7 +571,7 @@ namespace big
|
||||
{
|
||||
g_notification_service->push_warning("PROTECTIONS"_T.data(),
|
||||
std::vformat("REMOVE_WEAPON_ATTEMPT"_T, std::make_format_args(source_player->get_name())));
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -586,7 +586,7 @@ namespace big
|
||||
{
|
||||
g_notification_service->push_warning("PROTECTIONS"_T.data(),
|
||||
std::vformat("REMOVE_ALL_WEAPONS_ATTEMPT"_T, std::make_format_args(source_player->get_name())));
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ namespace big
|
||||
if (object_type < eNetObjType::NET_OBJ_TYPE_AUTOMOBILE || object_type > eNetObjType::NET_OBJ_TYPE_TRAIN)
|
||||
{
|
||||
notify::crash_blocked(source_player, "out of bounds give control type");
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -630,7 +630,7 @@ namespace big
|
||||
{
|
||||
notify::crash_blocked(source_player, "sound spam");
|
||||
}
|
||||
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace big
|
||||
if (data->IsSizeCalculator())
|
||||
size = 94;
|
||||
else
|
||||
size = g_pointers->m_get_vehicle_gadget_array_size(node->m_gadget_data[i].m_gadget_type);
|
||||
size = g_pointers->m_gta.m_get_vehicle_gadget_array_size(node->m_gadget_data[i].m_gadget_type);
|
||||
|
||||
data->SerializeArray(&node->m_gadget_data[i].m_data, size);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace big
|
||||
if (auto bytecode = g_script_patcher_service->get_script_bytecode(program->m_name_hash))
|
||||
program->m_code_blocks = bytecode;
|
||||
|
||||
if (g_pointers->m_script_globals[0xA])
|
||||
if (g_pointers->m_gta.m_script_globals[0xA])
|
||||
{
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].CurrentShopIndex = old_shop_index;
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].CayoPericoFlags = old_cayo_flags;
|
||||
@ -38,7 +38,7 @@ namespace big
|
||||
{
|
||||
m_program->m_code_blocks = m_orig_bytecode;
|
||||
|
||||
if (g_pointers->m_script_globals[0xA])
|
||||
if (g_pointers->m_gta.m_script_globals[0xA])
|
||||
{
|
||||
old_shop_index = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].CurrentShopIndex;
|
||||
old_cayo_flags = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].CayoPericoFlags;
|
||||
|
@ -37,13 +37,13 @@ namespace big
|
||||
{
|
||||
orig_gsbd = *scr_globals::gsbd.as<int*>();
|
||||
*scr_globals::gsbd.as<uint32_t*>() = 5;
|
||||
g_pointers->m_broadcast_patch->apply();
|
||||
broadcast_net_array::m_patch->apply();
|
||||
}
|
||||
|
||||
if (need_to_modify_wanted_level)
|
||||
{
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelPlayer = target->m_player_id;
|
||||
g_pointers->m_broadcast_patch->apply();
|
||||
broadcast_net_array::m_patch->apply();
|
||||
}
|
||||
|
||||
if (need_to_turn_player_into_beast)
|
||||
@ -64,39 +64,39 @@ namespace big
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(2).as<int*>() = INT_MAX;// stopwatch time
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(83).as<int*>() = 0;// transformed bitset
|
||||
|
||||
g_pointers->m_broadcast_patch->apply();
|
||||
broadcast_net_array::m_patch->apply();
|
||||
}
|
||||
|
||||
if (need_to_randomize_replay_protection)
|
||||
{
|
||||
*scr_globals::gsbd_fm_events.at(9).as<uint32_t*>() = __rdtsc();
|
||||
*scr_globals::gsbd_fm_events.at(10).as<uint32_t*>() = __rdtsc();
|
||||
g_pointers->m_broadcast_patch->apply();
|
||||
broadcast_net_array::m_patch->apply();
|
||||
}
|
||||
|
||||
int ret = g_hooking->get_original<hooks::broadcast_net_array>()(_this, target, bit_buffer, counter, elem_start, silent);
|
||||
|
||||
if (need_to_use_end_session_kick)
|
||||
{
|
||||
g_pointers->m_broadcast_patch->restore();
|
||||
broadcast_net_array::m_patch->restore();
|
||||
*scr_globals::gsbd.as<int*>() = orig_gsbd;
|
||||
}
|
||||
|
||||
if (need_to_modify_wanted_level)
|
||||
{
|
||||
g_pointers->m_broadcast_patch->restore();
|
||||
broadcast_net_array::m_patch->restore();
|
||||
}
|
||||
|
||||
if (need_to_turn_player_into_beast)
|
||||
{
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(7).as<Player*>() = orig_player;
|
||||
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(6).as<int*>() = orig_participant;
|
||||
g_pointers->m_broadcast_patch->restore();
|
||||
broadcast_net_array::m_patch->restore();
|
||||
}
|
||||
|
||||
if (need_to_randomize_replay_protection)
|
||||
{
|
||||
g_pointers->m_broadcast_patch->restore();
|
||||
broadcast_net_array::m_patch->restore();
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -22,7 +22,7 @@ namespace big
|
||||
for (const rage::scrNativeMapping& mapping : g_crossmap)
|
||||
{
|
||||
rage::scrNativeHandler handler =
|
||||
g_pointers->m_get_native_handler(g_pointers->m_native_registration_table, mapping.second);
|
||||
g_pointers->m_gta.m_get_native_handler(g_pointers->m_gta.m_native_registration_table, mapping.second);
|
||||
m_handler_cache.emplace(mapping.first, handler);
|
||||
}
|
||||
|
||||
@ -43,9 +43,9 @@ namespace big
|
||||
[this, hash, handler] {
|
||||
__try
|
||||
{
|
||||
_call_asm(&m_call_context, handler, g_pointers->m_native_return);
|
||||
_call_asm(&m_call_context, handler, g_pointers->m_gta.m_native_return);
|
||||
// handler(&m_call_context);
|
||||
g_pointers->m_fix_vectors(&m_call_context);
|
||||
g_pointers->m_gta.m_fix_vectors(&m_call_context);
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -1,4 +1,5 @@
|
||||
#include "backend/backend.hpp"
|
||||
#include "byte_patch_manager.hpp"
|
||||
#include "common.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
@ -11,8 +12,6 @@
|
||||
#include "script_mgr.hpp"
|
||||
#include "services/api/api_service.hpp"
|
||||
#include "services/context_menu/context_menu_service.hpp"
|
||||
#include "services/orbital_drone/orbital_drone.hpp"
|
||||
#include "services/vehicle/vehicle_control_service.hpp"
|
||||
#include "services/custom_text/custom_text_service.hpp"
|
||||
#include "services/globals/globals_service.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
@ -28,6 +27,7 @@
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "services/script_patcher/script_patcher_service.hpp"
|
||||
#include "services/vehicle/handling_service.hpp"
|
||||
#include "services/vehicle/vehicle_control_service.hpp"
|
||||
#include "thread_pool.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
@ -74,6 +74,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
auto pointers_instance = std::make_unique<pointers>();
|
||||
LOG(INFO) << "Pointers initialized.";
|
||||
|
||||
auto byte_patch_manager_instance = std::make_unique<byte_patch_manager>();
|
||||
LOG(INFO) << "Byte Patch Manager initialized.";
|
||||
|
||||
auto renderer_instance = std::make_unique<renderer>();
|
||||
LOG(INFO) << "Renderer initialized.";
|
||||
auto gui_instance = std::make_unique<gui>();
|
||||
@ -192,6 +195,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
renderer_instance.reset();
|
||||
LOG(INFO) << "Renderer uninitialized.";
|
||||
|
||||
byte_patch_manager_instance.reset();
|
||||
LOG(INFO) << "Byte Patch Manager uninitialized.";
|
||||
|
||||
pointers_instance.reset();
|
||||
LOG(INFO) << "Pointers uninitialized.";
|
||||
|
||||
|
@ -6,3 +6,4 @@
|
||||
#include "module.hpp"
|
||||
#include "pattern.hpp"
|
||||
#include "range.hpp"
|
||||
#include "signature.hpp"
|
||||
|
@ -1,60 +0,0 @@
|
||||
#include "batch.hpp"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "range.hpp"
|
||||
|
||||
#include <future>//std::async
|
||||
|
||||
static std::mutex s_entry_mutex;
|
||||
static std::vector<std::future<bool>> g_futures;
|
||||
|
||||
namespace memory
|
||||
{
|
||||
void batch::add(std::string name, pattern pattern, std::function<void(handle)> callback)
|
||||
{
|
||||
m_entries.emplace_back(std::move(name), std::move(pattern), std::move(callback));
|
||||
}
|
||||
|
||||
bool scan_pattern_and_execute_callback(range region, memory::batch::entry entry)
|
||||
{
|
||||
if (auto result = region.scan(entry.m_pattern))
|
||||
{
|
||||
if (entry.m_callback)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_entry_mutex);// Acquire a lock on the mutex to synchronize access.
|
||||
|
||||
std::invoke(std::move(entry.m_callback), result);
|
||||
LOG(INFO) << "Found '" << entry.m_name << "' GTA5.exe+"
|
||||
<< HEX_TO_UPPER(result.as<DWORD64>() - region.begin().as<DWORD64>());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(WARNING) << "Failed to find '" << entry.m_name << "'.";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool batch::run(range region)
|
||||
{
|
||||
for (auto& entry : m_entries)
|
||||
{
|
||||
g_futures.emplace_back(std::async(&scan_pattern_and_execute_callback, region, entry));
|
||||
}
|
||||
|
||||
bool found_all_patterns = true;
|
||||
for (auto& future : g_futures)
|
||||
{
|
||||
future.wait();
|
||||
|
||||
if (!future.get())
|
||||
found_all_patterns = false;
|
||||
}
|
||||
|
||||
m_entries.clear();
|
||||
g_futures.clear();
|
||||
|
||||
return found_all_patterns;
|
||||
}
|
||||
}
|
@ -1,35 +1,118 @@
|
||||
#pragma once
|
||||
#include "pattern.hpp"
|
||||
#include "signature.hpp"
|
||||
#include "range.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <future>
|
||||
|
||||
namespace memory
|
||||
{
|
||||
class batch
|
||||
template<size_t N>
|
||||
struct batch
|
||||
{
|
||||
public:
|
||||
explicit batch() = default;
|
||||
~batch() noexcept = default;
|
||||
std::array<signature, N> m_entries;
|
||||
|
||||
void add(std::string name, pattern pattern, std::function<void(memory::handle)> callback);
|
||||
bool run(range region);
|
||||
|
||||
struct entry
|
||||
{
|
||||
std::string m_name;
|
||||
pattern m_pattern;
|
||||
std::function<void(memory::handle)> m_callback;
|
||||
|
||||
explicit entry(std::string name, pattern pattern, std::function<void(memory::handle)> callback) :
|
||||
m_name(std::move(name)),
|
||||
m_pattern(std::move(pattern)),
|
||||
m_callback(std::move(callback))
|
||||
constexpr batch(std::array<signature, N> entries)
|
||||
{
|
||||
m_entries = entries;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<entry> m_entries;
|
||||
template<size_t N>
|
||||
struct batch_and_hash
|
||||
{
|
||||
batch<N> m_batch;
|
||||
uint32_t m_hash;
|
||||
};
|
||||
|
||||
struct signature_hasher
|
||||
{
|
||||
static inline constexpr uint32_t FNV_PRIME_32 = 16777619u;
|
||||
static inline constexpr uint32_t FNV_OFFSET_32 = 2166136261u;
|
||||
|
||||
static inline constexpr uint32_t fnv1a_32(const char* str, uint32_t hash = FNV_OFFSET_32) noexcept
|
||||
{
|
||||
return (str[0] == '\0') ? hash : fnv1a_32(&str[1], (hash ^ static_cast<uint32_t>(str[0])) * FNV_PRIME_32);
|
||||
}
|
||||
|
||||
template<signature sig>
|
||||
static inline constexpr uint32_t compute_hash(uint32_t hash)
|
||||
{
|
||||
hash = fnv1a_32(sig.m_ida, hash);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
template<signature sig, signature... rest_sigs>
|
||||
static inline constexpr uint32_t add(uint32_t hash = FNV_OFFSET_32)
|
||||
{
|
||||
hash = compute_hash<sig>(hash);
|
||||
|
||||
if constexpr (sizeof...(rest_sigs) > 0)
|
||||
{
|
||||
hash = add<rest_sigs...>(hash);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
|
||||
template<signature... args>
|
||||
static inline constexpr auto make_batch(uint32_t hash = signature_hasher::FNV_OFFSET_32)
|
||||
{
|
||||
constexpr std::array<signature, sizeof...(args)> a1 = {args...};
|
||||
|
||||
constexpr memory::batch<a1.size()> h(a1);
|
||||
|
||||
return batch_and_hash<a1.size()>{h, signature_hasher::add<args...>()};
|
||||
}
|
||||
|
||||
struct batch_runner
|
||||
{
|
||||
inline static std::mutex s_entry_mutex;
|
||||
inline static std::vector<std::future<bool>> g_futures;
|
||||
|
||||
template<size_t N>
|
||||
inline static bool run(const memory::batch<N> batch, range region)
|
||||
{
|
||||
for (auto& entry : batch.m_entries)
|
||||
{
|
||||
g_futures.emplace_back(std::async(&scan_pattern_and_execute_callback, region, entry));
|
||||
}
|
||||
|
||||
bool found_all_patterns = true;
|
||||
for (auto& future : g_futures)
|
||||
{
|
||||
future.wait();
|
||||
|
||||
if (!future.get())
|
||||
found_all_patterns = false;
|
||||
}
|
||||
|
||||
g_futures.clear();
|
||||
|
||||
return found_all_patterns;
|
||||
}
|
||||
|
||||
inline static bool scan_pattern_and_execute_callback(range region, signature entry)
|
||||
{
|
||||
if (auto result = region.scan(entry.m_ida))
|
||||
{
|
||||
if (entry.m_on_signature_found)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_entry_mutex); // Acquire a lock on the mutex to synchronize access.
|
||||
|
||||
std::invoke(std::move(entry.m_on_signature_found), result);
|
||||
LOG(INFO) << "Found '" << entry.m_name << "' GTA5.exe+"
|
||||
<< HEX_TO_UPPER(result.as<DWORD64>() - region.begin().as<DWORD64>());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(WARNING) << "Failed to find '" << entry.m_name << "'.";
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -7,4 +7,5 @@ namespace memory
|
||||
class module;
|
||||
class pattern;
|
||||
class pattern_batch;
|
||||
class byte_patch;
|
||||
}
|
||||
|
11
src/memory/signature.hpp
Normal file
11
src/memory/signature.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace memory
|
||||
{
|
||||
struct signature
|
||||
{
|
||||
const char* m_name;
|
||||
const char* m_ida;
|
||||
void (*m_on_signature_found)(memory::handle ptr);
|
||||
};
|
||||
}
|
@ -66,7 +66,7 @@ namespace big
|
||||
auto native = replacement_hash;
|
||||
map_native(&native);
|
||||
|
||||
auto og_handler = g_pointers->m_get_native_handler(g_pointers->m_native_registration_table, native);
|
||||
auto og_handler = g_pointers->m_gta.m_get_native_handler(g_pointers->m_gta.m_native_registration_table, native);
|
||||
if (!og_handler)
|
||||
continue;
|
||||
|
||||
@ -149,7 +149,7 @@ namespace big
|
||||
add_native_detour(RAGE_JOAAT("fm_lts_creator"), 0x3D3D8B3BE5A83D35, creator::GET_USED_CREATOR_BUDGET);
|
||||
add_native_detour(RAGE_JOAAT("fm_survival_creator"), 0x3D3D8B3BE5A83D35, creator::GET_USED_CREATOR_BUDGET);
|
||||
|
||||
for (auto& entry : *g_pointers->m_script_program_table)
|
||||
for (auto& entry : *g_pointers->m_gta.m_script_program_table)
|
||||
if (entry.m_program)
|
||||
hook_program(entry.m_program);
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace big
|
||||
{
|
||||
if (g.session.join_queued)
|
||||
{
|
||||
g_pointers->m_join_session_by_info(*g_pointers->m_network, &g.session.info, 1, 1 | 2, nullptr, 0);
|
||||
g_pointers->m_gta.m_join_session_by_info(*g_pointers->m_gta.m_network, &g.session.info, 1, 1 | 2, nullptr, 0);
|
||||
g.session.join_queued = false;
|
||||
src->set_return_value<BOOL>(TRUE);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace big
|
||||
|
||||
void packet::send(uint32_t msg_id)
|
||||
{
|
||||
g_pointers->m_queue_packet(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
g_pointers->m_gta.m_queue_packet(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
msg_id,
|
||||
m_data,
|
||||
(m_buffer.m_curBit + 7) >> 3,
|
||||
@ -31,7 +31,7 @@ namespace big
|
||||
void packet::send(int peer_id, int connection_id)
|
||||
{
|
||||
auto mgr = gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr;
|
||||
auto peer = g_pointers->m_get_connection_peer(mgr, peer_id);
|
||||
g_pointers->m_send_packet(mgr, peer, connection_id, m_data, (m_buffer.m_curBit + 7) >> 3, 0x1000000);
|
||||
auto peer = g_pointers->m_gta.m_get_connection_peer(mgr, peer_id);
|
||||
g_pointers->m_gta.m_send_packet(mgr, peer, connection_id, m_data, (m_buffer.m_curBit + 7) >> 3, 0x1000000);
|
||||
}
|
||||
}
|
2044
src/pointers.cpp
2044
src/pointers.cpp
File diff suppressed because it is too large
Load Diff
364
src/pointers.hpp
364
src/pointers.hpp
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "base/HashTable.hpp"
|
||||
#include "common.hpp"
|
||||
#include "function_types.hpp"
|
||||
#include "gta/fwddec.hpp"
|
||||
#include "gta/replay.hpp"
|
||||
@ -9,39 +8,108 @@
|
||||
#include "memory/module.hpp"
|
||||
#include "services/gta_data/cache_file.hpp"
|
||||
#include "socialclub/ScInfo.hpp"
|
||||
|
||||
class CCommunications;
|
||||
class FriendRegistry;
|
||||
class CNetworkPlayerMgr;
|
||||
class Network;
|
||||
class ChatData;
|
||||
|
||||
namespace rage
|
||||
{
|
||||
template<typename T>
|
||||
class atSingleton;
|
||||
class RageSecurity;
|
||||
class netTime;
|
||||
class rlGamerInfo;
|
||||
}
|
||||
|
||||
extern "C" std::uint64_t g_sound_overload_ret_addr;
|
||||
#include "util/compile_time_helpers.hpp"
|
||||
#include "gta_pointers.hpp"
|
||||
#include "sc_pointers.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
// needed for serialization of the pointers cache
|
||||
#pragma pack(push, 1)
|
||||
class pointers
|
||||
{
|
||||
private:
|
||||
bool is_pointers_cache_up_to_date(memory::batch& version_batch, const memory::module& mem_region);
|
||||
template<cstxpr_str batch_name, auto batch_hash, size_t offset_of_cache_begin_field, size_t offset_of_cache_end_field, memory::batch batch>
|
||||
void write_to_cache_or_read_from_cache(cache_file& cache_file, const memory::module& mem_region, const bool found_version_cache)
|
||||
{
|
||||
static_assert(batch_hash > 0);
|
||||
|
||||
// we can't cache things like pointers we allocate on the heap
|
||||
void always_run_main_batch(const memory::module& mem_region);
|
||||
cache_file.set_cache_version(batch_hash);
|
||||
|
||||
void run_cacheable_main_batch(const memory::module& mem_region);
|
||||
const uintptr_t pointer_to_cacheable_data_start = reinterpret_cast<uintptr_t>(this) + offset_of_cache_begin_field;
|
||||
|
||||
void run_socialclub_batch();
|
||||
if (!found_version_cache || !is_pointers_cache_up_to_date<batch_name>(cache_file, mem_region))
|
||||
{
|
||||
run_batch<batch_name>(batch, mem_region);
|
||||
|
||||
const uintptr_t pointer_to_cacheable_data_end = reinterpret_cast<uintptr_t>(this) + offset_of_cache_end_field;
|
||||
write_pointers_to_cache<batch_name, offset_of_cache_begin_field, offset_of_cache_end_field>(cache_file, pointer_to_cacheable_data_start, pointer_to_cacheable_data_end, mem_region);
|
||||
}
|
||||
else
|
||||
{
|
||||
load_pointers_from_cache(cache_file, pointer_to_cacheable_data_start, mem_region);
|
||||
}
|
||||
|
||||
cache_file.free();
|
||||
}
|
||||
|
||||
void load_pointers_from_cache(const cache_file& cache_file, const uintptr_t pointer_to_cacheable_data_start, const memory::module& mem_region);
|
||||
|
||||
template<cstxpr_str batch_name, size_t offset_of_cache_begin_field, size_t offset_of_cache_end_field>
|
||||
void write_pointers_to_cache(cache_file& cache_file, const uintptr_t pointer_to_cacheable_data_start, const uintptr_t pointer_to_cacheable_data_end, const memory::module& mem_region)
|
||||
{
|
||||
constexpr size_t data_size = offset_of_cache_end_field - offset_of_cache_begin_field;
|
||||
|
||||
cache_data cache_data_ptr = std::make_unique<std::uint8_t[]>(data_size);
|
||||
|
||||
// multiple things here:
|
||||
// - iterate each cacheable field of the pointers instance
|
||||
// - substract the base module address so that we only keep the offsets
|
||||
// - save that to the cache
|
||||
uintptr_t* cache_data = reinterpret_cast<uintptr_t*>(cache_data_ptr.get());
|
||||
|
||||
size_t i = 0;
|
||||
for (uintptr_t field_ptr = pointer_to_cacheable_data_start; field_ptr != pointer_to_cacheable_data_end; field_ptr += sizeof(uintptr_t))
|
||||
{
|
||||
const uintptr_t field_value = *reinterpret_cast<uintptr_t*>(field_ptr);
|
||||
|
||||
if (mem_region.contains(memory::handle(field_value)))
|
||||
{
|
||||
const uintptr_t offset = field_value - mem_region.begin().as<uintptr_t>();
|
||||
cache_data[i] = offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(FATAL) << "Just tried to save to cache a pointer supposedly within the " << batch_name.str << " module range but wasnt !!!Offset from start of pointers instance : " << (field_ptr - reinterpret_cast<uintptr_t>(this));
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Pointers cache: saved " << (data_size / sizeof(uintptr_t)) << " fields to the cache";
|
||||
|
||||
cache_file.set_data(std::move(cache_data_ptr), data_size);
|
||||
|
||||
cache_file.set_header_version(m_game_version_uint32_t, m_online_version_float);
|
||||
cache_file.write();
|
||||
}
|
||||
|
||||
template<cstxpr_str batch_name>
|
||||
bool is_pointers_cache_up_to_date(cache_file& cache_file, const memory::module& mem_region)
|
||||
{
|
||||
cache_file.load();
|
||||
|
||||
if (cache_file.up_to_date(m_game_version_uint32_t, m_online_version_float))
|
||||
{
|
||||
LOG(INFO) << batch_name.str << " pointers cache is up to date, using it.";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static constexpr auto get_gta_batch();
|
||||
static constexpr auto get_sc_batch();
|
||||
|
||||
template<cstxpr_str batch_name, size_t N>
|
||||
void run_batch(const memory::batch<N>& batch, const memory::module& mem_region)
|
||||
{
|
||||
if (!memory::batch_runner::run(batch, mem_region))
|
||||
{
|
||||
const std::string error_message =
|
||||
std::string("Failed to find some patterns for ") + std::string(batch_name.str);
|
||||
throw std::runtime_error(error_message);
|
||||
}
|
||||
}
|
||||
|
||||
void freemode_thread_restorer_through_vm_patch(const memory::module& mem_region);
|
||||
|
||||
@ -50,254 +118,24 @@ namespace big
|
||||
~pointers();
|
||||
|
||||
private:
|
||||
cache_file m_pointers_cache;
|
||||
cache_file m_gta_pointers_cache;
|
||||
cache_file m_sc_pointers_cache;
|
||||
|
||||
public:
|
||||
HWND m_hwnd{};
|
||||
|
||||
memory::byte_patch* m_max_wanted_level;
|
||||
memory::byte_patch* m_max_wanted_level_2;
|
||||
|
||||
memory::byte_patch* m_blame_explode;
|
||||
memory::byte_patch* m_explosion_patch;
|
||||
|
||||
memory::byte_patch* m_disable_collision{};
|
||||
|
||||
memory::byte_patch* m_broadcast_patch;
|
||||
// Those version pointers are not in the gta pointers struct due to always having to look for them in the binary
|
||||
// (We use them as a way of checking if the cache needs to be updated or not on game updates)
|
||||
const char* m_game_version;
|
||||
const char* m_online_version;
|
||||
|
||||
uint32_t m_game_version_uint32_t;
|
||||
float m_online_version_float;
|
||||
|
||||
// Pointers inside social club module START
|
||||
PVOID m_update_presence_attribute_int;
|
||||
PVOID m_update_presence_attribute_string;
|
||||
gta_pointers m_gta;
|
||||
|
||||
functions::start_get_presence_attributes m_start_get_presence_attributes;
|
||||
// Pointers inside social club module END
|
||||
|
||||
// don't remove, used for signaling the start of the pointers gta module offset cache
|
||||
// Note: between the start and the end, only pointers coming from the gta 5 module should be in there
|
||||
void* m_offset_gta_module_cache_start;
|
||||
|
||||
eGameState* m_game_state{};
|
||||
bool* m_is_session_started{};
|
||||
|
||||
CPedFactory** m_ped_factory{};
|
||||
CNetworkPlayerMgr** m_network_player_mgr{};
|
||||
CNetworkObjectMgr** m_network_object_mgr{};
|
||||
rage::CReplayInterface** m_replay_interface{};
|
||||
|
||||
functions::ptr_to_handle m_ptr_to_handle{};
|
||||
functions::handle_to_ptr m_handle_to_ptr{};
|
||||
rage::scrNativeRegistrationTable* m_native_registration_table{};
|
||||
functions::get_native_handler m_get_native_handler{};
|
||||
functions::fix_vectors m_fix_vectors{};
|
||||
|
||||
rage::atArray<GtaThread*>* m_script_threads{};
|
||||
rage::scrProgramTable* m_script_program_table{};
|
||||
functions::run_script_threads m_run_script_threads{};
|
||||
std::int64_t** m_script_globals{};
|
||||
|
||||
CGameScriptHandlerMgr** m_script_handler_mgr{};
|
||||
|
||||
IDXGISwapChain** m_swapchain{};
|
||||
|
||||
int* m_resolution_x;
|
||||
int* m_resolution_y;
|
||||
|
||||
uint32_t* m_region_code;
|
||||
|
||||
PVOID m_world_model_spawn_bypass;
|
||||
PVOID m_native_return;
|
||||
PVOID m_get_label_text;
|
||||
functions::check_chat_profanity* m_check_chat_profanity{};
|
||||
functions::write_player_game_state_data_node m_write_player_game_state_data_node{};
|
||||
|
||||
ChatData** m_chat_data;
|
||||
ScInfo* m_sc_info;
|
||||
FriendRegistry* m_friend_registry{};
|
||||
|
||||
functions::get_screen_coords_for_world_coords m_get_screen_coords_for_world_coords{};
|
||||
|
||||
HashTable<CBaseModelInfo*>* m_model_table;
|
||||
PVOID m_get_model_info;
|
||||
|
||||
PVOID m_gta_thread_start{};
|
||||
PVOID m_gta_thread_kill{};
|
||||
|
||||
PVOID m_network_player_mgr_init;
|
||||
PVOID m_network_player_mgr_shutdown;
|
||||
|
||||
functions::get_gameplay_cam_coords m_get_gameplay_cam_coords;
|
||||
|
||||
PVOID m_write_player_gamer_data_node{};
|
||||
|
||||
functions::trigger_script_event m_trigger_script_event{};
|
||||
|
||||
// Bitbuffer Read/Write START
|
||||
functions::read_bitbuf_dword m_read_bitbuf_dword{};
|
||||
functions::read_bitbuf_string m_read_bitbuf_string{};
|
||||
functions::read_bitbuf_bool m_read_bitbuf_bool{};
|
||||
functions::read_bitbuf_array m_read_bitbuf_array{};
|
||||
functions::write_bitbuf_qword m_write_bitbuf_qword{};
|
||||
functions::write_bitbuf_dword m_write_bitbuf_dword{};
|
||||
functions::write_bitbuf_int64 m_write_bitbuf_int64{};
|
||||
functions::write_bitbuf_int32 m_write_bitbuf_int32{};
|
||||
functions::write_bitbuf_bool m_write_bitbuf_bool{};
|
||||
functions::write_bitbuf_array m_write_bitbuf_array{};
|
||||
// Bitbuffer Read/Write END
|
||||
|
||||
// Received Event Signatures START
|
||||
PVOID m_received_event{};
|
||||
functions::send_event_ack m_send_event_ack{};
|
||||
// Received Event Signatures END
|
||||
|
||||
//Sync Signatures START
|
||||
PVOID m_received_clone_create;
|
||||
PVOID m_received_clone_sync;
|
||||
PVOID m_can_apply_data;
|
||||
functions::get_sync_tree_for_type m_get_sync_tree_for_type{};
|
||||
functions::get_sync_type_info m_get_sync_type_info{};
|
||||
functions::get_net_object m_get_net_object{};
|
||||
functions::read_bitbuffer_into_sync_tree m_read_bitbuffer_into_sync_tree{};
|
||||
//Sync Signatures END
|
||||
|
||||
PVOID m_receive_net_message{};
|
||||
PVOID m_get_network_event_data{};
|
||||
PVOID m_assign_physical_index{};
|
||||
|
||||
Network** m_network;
|
||||
|
||||
functions::start_get_session_by_gamer_handle m_start_get_session_by_gamer_handle;
|
||||
functions::start_matchmaking_find_sessions m_start_matchmaking_find_sessions;
|
||||
functions::join_session_by_info m_join_session_by_info;
|
||||
|
||||
functions::reset_network_complaints m_reset_network_complaints{};
|
||||
|
||||
functions::fidevice_get_device m_fidevice_get_device{};
|
||||
uintptr_t m_fidevices{};
|
||||
uint16_t* m_fidevices_len{};
|
||||
functions::fipackfile_ctor m_fipackfile_ctor{};
|
||||
rage::fiPackfile** m_fipackfile_instances{};
|
||||
functions::fipackfile_open_archive m_fipackfile_open_archive{};
|
||||
functions::fipackfile_mount m_fipackfile_mount{};
|
||||
functions::fipackfile_unmount m_fipackfile_unmount{};
|
||||
|
||||
const char* m_game_version;
|
||||
const char* m_online_version;
|
||||
|
||||
PVOID m_invalid_mods_crash_detour{};
|
||||
PVOID m_constraint_attachment_crash{};
|
||||
PVOID m_invalid_decal_crash{};
|
||||
PVOID m_task_parachute_object_0x270{};
|
||||
|
||||
int64_t** m_send_chat_ptr{};
|
||||
functions::send_chat_message m_send_chat_message{};
|
||||
|
||||
PVOID m_init_native_tables{};
|
||||
functions::script_vm m_script_vm{};
|
||||
|
||||
functions::generate_uuid m_generate_uuid{};
|
||||
std::uint64_t* m_host_token{};
|
||||
rage::rlGamerInfo* m_profile_gamer_info{}; // per profile gamer info
|
||||
rage::rlGamerInfo* m_player_info_gamer_info{}; // the gamer info that is applied to CPlayerInfo
|
||||
CCommunications** m_communications{};
|
||||
|
||||
PVOID m_serialize_ped_inventory_data_node;
|
||||
PVOID m_serialize_vehicle_gadget_data_node;
|
||||
functions::get_vehicle_gadget_array_size m_get_vehicle_gadget_array_size;
|
||||
|
||||
PVOID m_handle_join_request;
|
||||
functions::write_join_response_data m_write_join_response_data;
|
||||
|
||||
functions::queue_packet m_queue_packet;
|
||||
|
||||
PVOID m_sort_session_details;
|
||||
|
||||
PVOID m_add_player_to_session;
|
||||
PVOID m_send_chat_net_message;
|
||||
|
||||
PVOID m_process_matchmaking_find_response;
|
||||
PVOID m_serialize_player_data_msg;
|
||||
|
||||
PVOID m_serialize_join_request_message;
|
||||
|
||||
functions::give_pickup_rewards m_give_pickup_rewards{};
|
||||
functions::send_network_damage m_send_network_damage;
|
||||
functions::request_ragdoll m_request_ragdoll;
|
||||
functions::request_control m_request_control;
|
||||
functions::clear_ped_tasks_network m_clear_ped_tasks_network;
|
||||
|
||||
functions::get_connection_peer m_get_connection_peer{};
|
||||
functions::send_remove_gamer_cmd m_send_remove_gamer_cmd{};
|
||||
functions::handle_remove_gamer_cmd m_handle_remove_gamer_cmd{};
|
||||
|
||||
PVOID m_broadcast_net_array{};
|
||||
|
||||
rage::atSingleton<rage::RageSecurity>* m_security;
|
||||
PVOID m_prepare_metric_for_sending;
|
||||
|
||||
PVOID m_queue_dependency;
|
||||
PVOID m_interval_check_func;
|
||||
|
||||
PVOID m_send_session_matchmaking_attributes;
|
||||
|
||||
PVOID m_serialize_take_off_ped_variation_task;
|
||||
|
||||
PVOID m_create_script_handler;
|
||||
|
||||
functions::encode_session_info m_encode_session_info;
|
||||
functions::decode_session_info m_decode_session_info;
|
||||
functions::decode_peer_info m_decode_peer_info;
|
||||
|
||||
datafile_commands::SveFileObject* m_main_file_object;
|
||||
functions::load_cloud_file m_load_cloud_file;
|
||||
functions::set_as_active_cloud_file m_set_as_active_cloud_file;
|
||||
functions::save_json_data m_save_json_data;
|
||||
|
||||
rage::netTime** m_network_time;
|
||||
functions::sync_network_time m_sync_network_time;
|
||||
|
||||
functions::send_packet m_send_packet;
|
||||
functions::connect_to_peer m_connect_to_peer;
|
||||
|
||||
PVOID m_fragment_physics_crash;
|
||||
PVOID m_fragment_physics_crash_2;
|
||||
|
||||
PVOID m_infinite_train_crash;
|
||||
functions::get_next_carriage m_get_next_carriage;
|
||||
|
||||
functions::get_entity_attached_to m_get_entity_attached_to;
|
||||
|
||||
PVOID m_received_array_update;
|
||||
|
||||
PVOID m_receive_pickup{};
|
||||
|
||||
PVOID m_write_player_camera_data_node{};
|
||||
|
||||
PVOID m_send_player_card_stats{};
|
||||
bool* m_force_player_card_refresh{};
|
||||
|
||||
PVOID m_serialize_stats{};
|
||||
|
||||
PVOID m_write_player_creation_data_node{};
|
||||
PVOID m_write_player_appearance_data_node{};
|
||||
|
||||
PVOID m_enumerate_audio_devices{};
|
||||
PVOID m_direct_sound_capture_create{};
|
||||
bool* m_refresh_audio_input{};
|
||||
|
||||
PVOID m_allow_weapons_in_vehicle{};
|
||||
|
||||
PVOID m_taskjump_constructor{};
|
||||
|
||||
PVOID m_write_vehicle_proximity_migration_data_node{};
|
||||
functions::migrate_object m_migrate_object{};
|
||||
|
||||
// don't remove, used for signaling the end of the pointers gta module offset cache
|
||||
void* m_offset_gta_module_cache_end;
|
||||
socialclub_pointers m_sc;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
inline pointers* g_pointers{};
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARA
|
||||
namespace big
|
||||
{
|
||||
renderer::renderer() :
|
||||
m_dxgi_swapchain(*g_pointers->m_swapchain)
|
||||
m_dxgi_swapchain(*g_pointers->m_gta.m_swapchain)
|
||||
{
|
||||
if (m_dxgi_swapchain->GetDevice(__uuidof(ID3D11Device), reinterpret_cast<void**>(&m_d3d_device)) < 0)
|
||||
{
|
||||
|
15
src/sc_pointers.hpp
Normal file
15
src/sc_pointers.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
// needed for serialization of the pointers cache
|
||||
#pragma pack(push, 1)
|
||||
struct socialclub_pointers
|
||||
{
|
||||
PVOID m_update_presence_attribute_int;
|
||||
PVOID m_update_presence_attribute_string;
|
||||
|
||||
functions::start_get_presence_attributes m_start_get_presence_attributes;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
13
src/sc_pointers_layout_info.hpp
Normal file
13
src/sc_pointers_layout_info.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
struct sc_pointers_layout_info
|
||||
{
|
||||
// get the beginning and the end of what we need to save / load
|
||||
inline static constexpr size_t offset_of_cache_begin_field = offsetof(big::pointers, m_sc);
|
||||
inline static constexpr size_t offset_of_cache_end_field = offsetof(big::pointers, m_sc) + sizeof(socialclub_pointers);
|
||||
inline static constexpr size_t field_count = (offset_of_cache_end_field - offset_of_cache_begin_field) / sizeof(void*);
|
||||
};
|
||||
}
|
@ -56,7 +56,7 @@ namespace big
|
||||
ctx.m_instruction_pointer = m_ip;
|
||||
ctx.m_state = rage::eThreadState::idle;
|
||||
|
||||
g_pointers->m_script_vm(stack, g_pointers->m_script_globals, program, &ctx);
|
||||
g_pointers->m_gta.m_script_vm(stack, g_pointers->m_gta.m_script_globals, program, &ctx);
|
||||
|
||||
tls_ctx->m_script_thread = og_thread;
|
||||
tls_ctx->m_is_script_thread_active = og_thread != nullptr;
|
||||
@ -88,7 +88,7 @@ namespace big
|
||||
|
||||
auto old_ctx = thread->m_context;
|
||||
thread->m_context = ctx;
|
||||
result = g_pointers->m_script_vm(stack, g_pointers->m_script_globals, program, &thread->m_context);
|
||||
result = g_pointers->m_gta.m_script_vm(stack, g_pointers->m_gta.m_script_globals, program, &thread->m_context);
|
||||
thread->m_context = old_ctx;
|
||||
|
||||
tls_ctx->m_script_thread = og_thread;
|
||||
|
@ -22,6 +22,6 @@ namespace big
|
||||
|
||||
void* script_global::get()
|
||||
{
|
||||
return g_pointers->m_script_globals[m_index >> 0x12 & 0x3F] + (m_index & 0x3FFFF);
|
||||
return g_pointers->m_gta.m_script_globals[m_index >> 0x12 & 0x3F] + (m_index & 0x3FFFF);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace big
|
||||
|
||||
inline std::string get_ticket()
|
||||
{
|
||||
return g_pointers->m_sc_info->m_ticket;
|
||||
return g_pointers->m_gta.m_sc_info->m_ticket;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -85,8 +85,8 @@ namespace big
|
||||
&screen_result.y);
|
||||
if (success)
|
||||
{
|
||||
screen_result.x = static_cast<float>(*g_pointers->m_resolution_x) * screen_result.x;
|
||||
screen_result.y = static_cast<float>(*g_pointers->m_resolution_y) * screen_result.y;
|
||||
screen_result.x = static_cast<float>(*g_pointers->m_gta.m_resolution_x) * screen_result.x;
|
||||
screen_result.y = static_cast<float>(*g_pointers->m_gta.m_resolution_y) * screen_result.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -193,7 +193,7 @@ namespace big
|
||||
void context_menu_service::get_entity_closest_to_screen_center()
|
||||
{
|
||||
m_pointer = nullptr;
|
||||
if (const auto replay = *g_pointers->m_replay_interface; replay)
|
||||
if (const auto replay = *g_pointers->m_gta.m_replay_interface; replay)
|
||||
{
|
||||
const auto veh_interface = replay->m_vehicle_interface;
|
||||
const auto ped_interface = replay->m_ped_interface;
|
||||
@ -212,7 +212,7 @@ namespace big
|
||||
const auto temp_pointer = entity.m_entity_ptr;
|
||||
if (!temp_pointer || !temp_pointer->m_navigation)
|
||||
continue;
|
||||
const auto temp_handle = g_pointers->m_ptr_to_handle(temp_pointer);
|
||||
const auto temp_handle = g_pointers->m_gta.m_ptr_to_handle(temp_pointer);
|
||||
|
||||
const auto pos = temp_pointer->m_navigation->get_position();
|
||||
HUD::GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(pos->x,
|
||||
@ -245,7 +245,7 @@ namespace big
|
||||
&& reinterpret_cast<CPed*>(m_pointer)->m_vehicle)
|
||||
{
|
||||
m_pointer = reinterpret_cast<CPed*>(m_pointer)->m_vehicle;
|
||||
m_handle = g_pointers->m_ptr_to_handle(m_pointer);
|
||||
m_handle = g_pointers->m_gta.m_ptr_to_handle(m_pointer);
|
||||
}
|
||||
fill_model_bounding_box_screen_space();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace big
|
||||
|
||||
SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(RAGE_JOAAT("fm_race_creator"));
|
||||
|
||||
auto buffer = g_pointers->m_save_json_data(g_pointers->m_main_file_object, nullptr, "to save it to a file I guess?");
|
||||
auto buffer = g_pointers->m_gta.m_save_json_data(g_pointers->m_gta.m_main_file_object, nullptr, "to save it to a file I guess?");
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
@ -69,8 +69,8 @@ namespace big
|
||||
DATAFILE::DATAFILE_DELETE(0);
|
||||
|
||||
sCloudFile* cloud_file = nullptr;
|
||||
g_pointers->m_load_cloud_file(&cloud_file, buffer.data(), buffer.length(), "to load it from a file I guess?");
|
||||
g_pointers->m_set_as_active_cloud_file(g_pointers->m_main_file_object, &cloud_file);
|
||||
g_pointers->m_gta.m_load_cloud_file(&cloud_file, buffer.data(), buffer.length(), "to load it from a file I guess?");
|
||||
g_pointers->m_gta.m_set_as_active_cloud_file(g_pointers->m_gta.m_main_file_object, &cloud_file);
|
||||
|
||||
while (!SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(RAGE_JOAAT("fm_race_creator")))
|
||||
{
|
||||
|
@ -23,8 +23,8 @@ namespace big
|
||||
return false;
|
||||
|
||||
const auto rockstar_id = net_player->get_net_data()->m_gamer_handle.m_rockstar_id;
|
||||
for (std::uint32_t i = 0; i < g_pointers->m_friend_registry->m_friend_count; i++)
|
||||
if (rockstar_id == g_pointers->m_friend_registry->get(i)->m_rockstar_id)
|
||||
for (std::uint32_t i = 0; i < g_pointers->m_gta.m_friend_registry->m_friend_count; i++)
|
||||
if (rockstar_id == g_pointers->m_gta.m_friend_registry->get(i)->m_rockstar_id)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -2,6 +2,14 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
cache_file::cache_file(file cache_file) :
|
||||
m_cache_file(cache_file),
|
||||
m_data(nullptr),
|
||||
m_cache_version(0),
|
||||
m_cache_header()
|
||||
{
|
||||
}
|
||||
|
||||
cache_file::cache_file(file cache_file, std::uint32_t cache_version) :
|
||||
m_cache_file(cache_file),
|
||||
m_data(nullptr),
|
||||
@ -78,4 +86,9 @@ namespace big
|
||||
m_cache_header.m_game_version = game_version;
|
||||
m_cache_header.m_online_version = online_version;
|
||||
}
|
||||
|
||||
void cache_file::set_cache_version(std::uint32_t cache_version)
|
||||
{
|
||||
m_cache_version = cache_version;
|
||||
}
|
||||
}
|
@ -16,6 +16,12 @@ namespace big
|
||||
class cache_file final
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cache_file">FileMgr file object</param>
|
||||
cache_file(file cache_file);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -60,6 +66,8 @@ namespace big
|
||||
/// <param name="online_version">Online Version</param>
|
||||
void set_header_version(std::uint32_t game_version, float online_version);
|
||||
|
||||
void set_cache_version(std::uint32_t cache_version);
|
||||
|
||||
private:
|
||||
file m_cache_file;
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace big
|
||||
{
|
||||
m_update_state = eGtaDataUpdateState::WAITING_FOR_SINGLE_PLAYER;
|
||||
g_fiber_pool->queue_job([this] {
|
||||
while (*g_pointers->m_game_state != eGameState::Playing)
|
||||
while (*g_pointers->m_gta.m_game_state != eGameState::Playing)
|
||||
{
|
||||
script::get_current()->yield(100ms);
|
||||
}
|
||||
@ -70,7 +70,7 @@ namespace big
|
||||
|
||||
session::join_type(eSessionType::SOLO);
|
||||
|
||||
while (!*g_pointers->m_is_session_started)
|
||||
while (!*g_pointers->m_gta.m_is_session_started)
|
||||
{
|
||||
script::get_current()->yield(100ms);
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ namespace big
|
||||
{
|
||||
std::vector<std::string> non_dlc_mounted_devices_names;
|
||||
|
||||
uint16_t mounted_devices_len = *g_pointers->m_fidevices_len;
|
||||
uint16_t mounted_devices_len = *g_pointers->m_gta.m_fidevices_len;
|
||||
if (mounted_devices_len)
|
||||
{
|
||||
auto devices_arr = *(uint64_t*)g_pointers->m_fidevices;
|
||||
uint8_t** current_device_mount_name_ptr = *(unsigned __int8***)g_pointers->m_fidevices;
|
||||
auto devices_arr = *(uint64_t*)g_pointers->m_gta.m_fidevices;
|
||||
uint8_t** current_device_mount_name_ptr = *(unsigned __int8***)g_pointers->m_gta.m_fidevices;
|
||||
auto device_i = 0;
|
||||
|
||||
while (true)
|
||||
@ -56,9 +56,9 @@ namespace big
|
||||
constexpr auto yield_increment = 80;
|
||||
|
||||
auto i = 1;
|
||||
while (g_pointers->m_fipackfile_instances[i])
|
||||
while (g_pointers->m_gta.m_fipackfile_instances[i])
|
||||
{
|
||||
auto* rpf = g_pointers->m_fipackfile_instances[i];
|
||||
auto* rpf = g_pointers->m_gta.m_fipackfile_instances[i];
|
||||
|
||||
// its hard coded in the binary?
|
||||
if (++i >= 3672)
|
||||
@ -108,7 +108,7 @@ namespace big
|
||||
cb(rpf_wrapper);
|
||||
});
|
||||
|
||||
g_pointers->m_fipackfile_unmount(default_mount_name);
|
||||
g_pointers->m_gta.m_fipackfile_unmount(default_mount_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -71,7 +71,7 @@ namespace big
|
||||
|
||||
void hotkey_service::wndproc(eKeyState state, key_t key)
|
||||
{
|
||||
if (const auto chat_data = *g_pointers->m_chat_data; chat_data && (chat_data->m_chat_open || chat_data->m_timer_two))
|
||||
if (const auto chat_data = *g_pointers->m_gta.m_chat_data; chat_data && (chat_data->m_chat_open || chat_data->m_timer_two))
|
||||
return;
|
||||
|
||||
//command executer is opened
|
||||
|
@ -28,7 +28,7 @@ namespace big
|
||||
return;
|
||||
}
|
||||
|
||||
if (*g_pointers->m_is_session_started && gta_util::get_network_player_mgr()->m_local_net_player
|
||||
if (*g_pointers->m_gta.m_is_session_started && gta_util::get_network_player_mgr()->m_local_net_player
|
||||
&& gta_util::get_network_player_mgr()->m_local_net_player->m_player_info->m_ped)
|
||||
{
|
||||
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].OrbitalBitset.Set(eOrbitalBitset::kOrbitalCannonActive);
|
||||
@ -332,7 +332,7 @@ namespace big
|
||||
|
||||
if (ENTITY::IS_ENTITY_A_VEHICLE(ent))
|
||||
{
|
||||
const auto vehicle = reinterpret_cast<CVehicle*>(g_pointers->m_handle_to_ptr(ent));
|
||||
const auto vehicle = reinterpret_cast<CVehicle*>(g_pointers->m_gta.m_handle_to_ptr(ent));
|
||||
if (vehicle)
|
||||
{
|
||||
for (const auto& player : g_player_service->players() | std::ranges::views::values)
|
||||
@ -362,7 +362,7 @@ namespace big
|
||||
{
|
||||
for (auto ped : g_player_service->players() | std::ranges::views::values)
|
||||
{
|
||||
if (ped && g_pointers->m_ptr_to_handle(ped->get_ped()) == ent)
|
||||
if (ped && g_pointers->m_gta.m_ptr_to_handle(ped->get_ped()) == ent)
|
||||
{
|
||||
g_player_service->set_selected(ped);
|
||||
}
|
||||
@ -379,7 +379,7 @@ namespace big
|
||||
Vector3 entpos = ENTITY::GET_ENTITY_COORDS(entity::get_entity_closest_to_middle_of_screen(), 0);
|
||||
|
||||
if (g_player_service->get_selected()->is_valid()
|
||||
&&ENTITY::DOES_ENTITY_EXIST(g_pointers->m_ptr_to_handle(g_player_service->get_selected()->get_ped())))
|
||||
&&ENTITY::DOES_ENTITY_EXIST(g_pointers->m_gta.m_ptr_to_handle(g_player_service->get_selected()->get_ped())))
|
||||
{
|
||||
toxic::blame_explode_coord(g_player_service->get_selected(), m_ground_pos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace big
|
||||
{
|
||||
if (weapon.m_reward_ammo_hash != 0 || weapon.m_throwable)
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(targets, weapon.m_reward_ammo_hash);
|
||||
g_pointers->m_gta.m_give_pickup_rewards(targets, weapon.m_reward_ammo_hash);
|
||||
script::get_current()->yield(20ms);
|
||||
}
|
||||
}
|
||||
@ -51,15 +51,15 @@ namespace big
|
||||
|
||||
void pickup_service::give_armour(const int targets) const
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_ARMOUR"));
|
||||
g_pointers->m_gta.m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_ARMOUR"));
|
||||
script::get_current()->yield(20ms);
|
||||
}
|
||||
|
||||
void pickup_service::give_health(const int targets) const
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_HEALTH"));
|
||||
g_pointers->m_gta.m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_HEALTH"));
|
||||
script::get_current()->yield(20ms);
|
||||
g_pointers->m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_HEALTH"));
|
||||
g_pointers->m_gta.m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_HEALTH"));
|
||||
script::get_current()->yield(20ms);
|
||||
}
|
||||
|
||||
@ -69,12 +69,12 @@ namespace big
|
||||
{
|
||||
if (weapon.m_reward_hash != 0)
|
||||
{
|
||||
g_pointers->m_give_pickup_rewards(targets, weapon.m_reward_hash);
|
||||
g_pointers->m_gta.m_give_pickup_rewards(targets, weapon.m_reward_hash);
|
||||
script::get_current()->yield(20ms);
|
||||
}
|
||||
}
|
||||
|
||||
g_pointers->m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_PARACHUTE"));
|
||||
g_pointers->m_gta.m_give_pickup_rewards(targets, RAGE_JOAAT("REWARD_PARACHUTE"));
|
||||
script::get_current()->yield(20ms);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace big
|
||||
bool success = false;
|
||||
rage::rlTaskStatus state{};
|
||||
|
||||
if (g_pointers->m_start_get_session_by_gamer_handle(0, &player_handle, 1, &result, 1, &success, &state))
|
||||
if (g_pointers->m_gta.m_start_get_session_by_gamer_handle(0, &player_handle, 1, &result, 1, &success, &state))
|
||||
{
|
||||
while (state.status == 1)
|
||||
script::get_current()->yield();
|
||||
|
@ -89,7 +89,7 @@ namespace big
|
||||
return get_net_data()->m_external_ip;
|
||||
|
||||
if (auto session_player = get_session_player())
|
||||
if (auto peer = g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
if (auto peer = g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
(int)get_session_player()->m_player_data.m_peer_id_2))
|
||||
return netAddress{((netConnectionPeer*)peer)->m_external_ip};
|
||||
|
||||
@ -102,7 +102,7 @@ namespace big
|
||||
return get_net_data()->m_external_port;
|
||||
|
||||
if (auto session_player = get_session_player())
|
||||
if (auto peer = g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
if (auto peer = g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
|
||||
(int)get_session_player()->m_player_data.m_peer_id_2))
|
||||
return ((netConnectionPeer*)peer)->m_external_port;
|
||||
|
||||
|
@ -320,7 +320,7 @@ namespace big
|
||||
const auto vehicle_rotation = ENTITY::GET_ENTITY_ROTATION(vehicle, 0);
|
||||
bool has_collision = ENTITY::GET_ENTITY_COLLISION_DISABLED(object);
|
||||
bool is_visible = ENTITY::IS_ENTITY_VISIBLE(object);
|
||||
CObject* cobject = (CObject*)g_pointers->m_handle_to_ptr(vehicle);
|
||||
CObject* cobject = (CObject*)g_pointers->m_gta.m_handle_to_ptr(vehicle);
|
||||
bool is_invincible = misc::has_bit_set(&(int&)cobject->m_damage_bits, 8);
|
||||
|
||||
Vector3 rotation;
|
||||
@ -335,7 +335,7 @@ namespace big
|
||||
|
||||
nlohmann::json persist_car_service::get_model_attachments(Vehicle vehicle, bool is_towed_vehicle)
|
||||
{
|
||||
const auto replay_interface = *g_pointers->m_replay_interface;
|
||||
const auto replay_interface = *g_pointers->m_gta.m_replay_interface;
|
||||
|
||||
std::vector<nlohmann::json> attached_objects;
|
||||
|
||||
@ -346,7 +346,7 @@ namespace big
|
||||
if (!object_ptr)
|
||||
continue;
|
||||
|
||||
const auto object = g_pointers->m_ptr_to_handle(object_ptr);
|
||||
const auto object = g_pointers->m_gta.m_ptr_to_handle(object_ptr);
|
||||
if (!object)
|
||||
break;
|
||||
|
||||
@ -365,7 +365,7 @@ namespace big
|
||||
|
||||
nlohmann::json persist_car_service::get_vehicle_attachents(Vehicle vehicle)
|
||||
{
|
||||
const auto replay_interface = *g_pointers->m_replay_interface;
|
||||
const auto replay_interface = *g_pointers->m_gta.m_replay_interface;
|
||||
|
||||
const auto vehicle_interface = replay_interface->m_vehicle_interface;
|
||||
|
||||
@ -380,7 +380,7 @@ namespace big
|
||||
if (!vehicle_ptr)
|
||||
continue;
|
||||
|
||||
const auto object = g_pointers->m_ptr_to_handle(vehicle_ptr);
|
||||
const auto object = g_pointers->m_gta.m_ptr_to_handle(vehicle_ptr);
|
||||
if (!object)
|
||||
break;
|
||||
|
||||
@ -445,7 +445,7 @@ namespace big
|
||||
vehicle_json[pearlescent_color_key] = pearlescent_color;
|
||||
bool has_collision = ENTITY::GET_ENTITY_COLLISION_DISABLED(vehicle);
|
||||
bool is_visible = ENTITY::IS_ENTITY_VISIBLE(vehicle);
|
||||
CVehicle* cvehicle = (CVehicle*)g_pointers->m_handle_to_ptr(vehicle);
|
||||
CVehicle* cvehicle = (CVehicle*)g_pointers->m_gta.m_handle_to_ptr(vehicle);
|
||||
bool is_invincible = misc::has_bit_set(&(int&)cvehicle->m_damage_bits, 8);
|
||||
vehicle_json[has_collision_key] = !has_collision;
|
||||
vehicle_json[is_visible_key] = is_visible;
|
||||
|
@ -73,7 +73,7 @@ namespace big
|
||||
controlled_vehicle new_veh{};
|
||||
|
||||
new_veh.handle = veh;
|
||||
new_veh.ptr = (CVehicle*)g_pointers->m_handle_to_ptr(veh);
|
||||
new_veh.ptr = (CVehicle*)g_pointers->m_gta.m_handle_to_ptr(veh);
|
||||
strcpy(new_veh.model_name, HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(VEHICLE::GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(ENTITY::GET_ENTITY_MODEL(veh))));
|
||||
new_veh.doorCount = VEHICLE::GET_NUMBER_OF_VEHICLE_DOORS(veh);
|
||||
new_veh.lockstate = (eVehicleLockState)VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(veh);
|
||||
@ -377,7 +377,7 @@ namespace big
|
||||
{
|
||||
if (g_local_player->m_vehicle)
|
||||
{
|
||||
if (m_controlled_vehicle.handle != g_pointers->m_ptr_to_handle(g_local_player->m_vehicle))
|
||||
if (m_controlled_vehicle.handle != g_pointers->m_gta.m_ptr_to_handle(g_local_player->m_vehicle))
|
||||
m_controlled_vehicle = vehicle_control::update_vehicle(self::veh);
|
||||
}
|
||||
}
|
||||
|
16
src/util/compile_time_helpers.hpp
Normal file
16
src/util/compile_time_helpers.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
template<uint32_t hash>
|
||||
struct compile_time_helper
|
||||
{
|
||||
static_assert(hash == -1);
|
||||
static constexpr bool print_hash = (hash == -1);
|
||||
};
|
||||
|
||||
struct cstxpr_str
|
||||
{
|
||||
const char* str;
|
||||
};
|
||||
}
|
@ -72,9 +72,9 @@ namespace big::entity
|
||||
|
||||
inline bool take_control_of(Entity ent, int timeout = 300)
|
||||
{
|
||||
auto hnd = g_pointers->m_handle_to_ptr(ent);
|
||||
auto hnd = g_pointers->m_gta.m_handle_to_ptr(ent);
|
||||
|
||||
if (!hnd || !hnd->m_net_object || !*g_pointers->m_is_session_started)
|
||||
if (!hnd || !hnd->m_net_object || !*g_pointers->m_gta.m_is_session_started)
|
||||
return false;
|
||||
|
||||
if (network_has_control_of_entity(hnd->m_net_object))
|
||||
@ -82,7 +82,7 @@ namespace big::entity
|
||||
|
||||
for (int i = 0; i < timeout; i++)
|
||||
{
|
||||
g_pointers->m_request_control(hnd->m_net_object);
|
||||
g_pointers->m_gta.m_request_control(hnd->m_net_object);
|
||||
|
||||
if (network_has_control_of_entity(hnd->m_net_object))
|
||||
return true;
|
||||
@ -98,7 +98,7 @@ namespace big::entity
|
||||
{
|
||||
std::vector<Entity> target_entities;
|
||||
target_entities.clear();
|
||||
const auto replay_interface = *g_pointers->m_replay_interface;
|
||||
const auto replay_interface = *g_pointers->m_gta.m_replay_interface;
|
||||
if (!replay_interface)
|
||||
return target_entities;
|
||||
|
||||
@ -114,7 +114,7 @@ namespace big::entity
|
||||
if (vehicle_ptr == gta_util::get_local_vehicle())
|
||||
continue;
|
||||
|
||||
const auto veh = g_pointers->m_ptr_to_handle(vehicle_ptr);
|
||||
const auto veh = g_pointers->m_gta.m_ptr_to_handle(vehicle_ptr);
|
||||
if (!veh)
|
||||
break;
|
||||
|
||||
@ -135,7 +135,7 @@ namespace big::entity
|
||||
if (ped_ptr == gta_util::get_local_ped())
|
||||
continue;
|
||||
|
||||
const auto ped = g_pointers->m_ptr_to_handle(ped_ptr);
|
||||
const auto ped = g_pointers->m_gta.m_ptr_to_handle(ped_ptr);
|
||||
if (!ped)
|
||||
break;
|
||||
|
||||
@ -197,7 +197,7 @@ namespace big::entity
|
||||
Entity closest_entity{};
|
||||
float distance = 1;
|
||||
|
||||
auto replayInterface = *g_pointers->m_replay_interface;
|
||||
auto replayInterface = *g_pointers->m_gta.m_replay_interface;
|
||||
auto vehicleInterface = replayInterface->m_vehicle_interface;
|
||||
auto pedInterface = replayInterface->m_ped_interface;
|
||||
|
||||
@ -205,7 +205,7 @@ namespace big::entity
|
||||
{
|
||||
if (veh.m_entity_ptr)
|
||||
{
|
||||
Vehicle handle = g_pointers->m_ptr_to_handle(veh.m_entity_ptr);
|
||||
Vehicle handle = g_pointers->m_gta.m_ptr_to_handle(veh.m_entity_ptr);
|
||||
Vector3 pos = ENTITY::GET_ENTITY_COORDS(handle, 1);
|
||||
rage::fvector2 screenpos;
|
||||
HUD::GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(pos.x, pos.y, pos.z, &screenpos.x, &screenpos.y);
|
||||
@ -222,7 +222,7 @@ namespace big::entity
|
||||
{
|
||||
if (ped.m_entity_ptr)
|
||||
{
|
||||
Vehicle handle = g_pointers->m_ptr_to_handle(ped.m_entity_ptr);
|
||||
Vehicle handle = g_pointers->m_gta.m_ptr_to_handle(ped.m_entity_ptr);
|
||||
Vector3 pos = ENTITY::GET_ENTITY_COORDS(handle, 1);
|
||||
rage::fvector2 screenpos;
|
||||
HUD::GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(pos.x, pos.y, pos.z, &screenpos.x, &screenpos.y);
|
||||
|
@ -13,7 +13,7 @@ namespace big::globals
|
||||
self::id,
|
||||
*scr_globals::gpbd_fm_3.at(target, scr_globals::size::gpbd_fm_3).at(510).as<int*>()};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target);
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target);
|
||||
}
|
||||
|
||||
inline void give_remote_otr(Player target)
|
||||
@ -27,7 +27,7 @@ namespace big::globals
|
||||
false,
|
||||
*scr_globals::gpbd_fm_3.at(target, scr_globals::size::gpbd_fm_3).at(510).as<int64_t*>()};
|
||||
|
||||
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target);
|
||||
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target);
|
||||
}
|
||||
|
||||
inline Interior get_interior_from_player(Player player)
|
||||
|
@ -27,7 +27,7 @@ namespace big::math
|
||||
inline float calculate_distance_from_game_cam(rage::fvector3 player_position)
|
||||
{
|
||||
const Vector3 plyr_coords = {player_position.x, player_position.y, player_position.z};
|
||||
const Vector3 cam_coords = g_pointers->m_get_gameplay_cam_coords();
|
||||
const Vector3 cam_coords = g_pointers->m_gta.m_get_gameplay_cam_coords();
|
||||
|
||||
return (float)distance_between_vectors(plyr_coords, cam_coords);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace big
|
||||
template<typename T = CBaseModelInfo*>
|
||||
static T get_model(const rage::joaat_t hash)
|
||||
{
|
||||
const auto model_table = g_pointers->m_model_table;
|
||||
const auto model_table = g_pointers->m_gta.m_model_table;
|
||||
for (auto i = model_table->m_lookup_table[hash % model_table->m_lookup_key]; i; i = i->m_next)
|
||||
{
|
||||
if (i->m_hash == hash)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user