refactor!: globals (#717)

* refactor(globals): use macro's for to_json/from_json
* refactor(globals): switch from global pointer to global instance
This commit is contained in:
Yimura 2022-12-18 23:15:52 +01:00 committed by GitHub
parent 4041370763
commit f6c00f113d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
147 changed files with 1280 additions and 1902 deletions

View File

@ -13,7 +13,6 @@ namespace big
while (g_running)
{
g->attempt_save();
looped::system_self_globals();
looped::system_update_pointers();
looped::system_desync_kick_protection();

View File

@ -24,17 +24,17 @@ namespace big
g_player_service->iterate([](const player_entry& entry)
{
if ((g->session.off_radar_all || entry.second->off_radar) && offRadarPlayer == entry.second->id())
if ((g.session.off_radar_all || entry.second->off_radar) && offRadarPlayer == entry.second->id())
globals::give_remote_otr(entry.second->id());
});
g_player_service->iterate([](const player_entry& entry)
{
if ((g->session.never_wanted_all || entry.second->never_wanted) && PLAYER::GET_PLAYER_WANTED_LEVEL(entry.second->id()) > 0 && neverWantedPlayer == entry.second->id())
if ((g.session.never_wanted_all || entry.second->never_wanted) && PLAYER::GET_PLAYER_WANTED_LEVEL(entry.second->id()) > 0 && neverWantedPlayer == entry.second->id())
globals::clear_wanted_player(entry.second->id());
});
if (g->session.semi_godmode_all)
if (g.session.semi_godmode_all)
{
g_pointers->m_give_pickup_rewards(-1, REWARD_HEALTH);
g_pointers->m_give_pickup_rewards(-1, REWARD_ARMOUR);

View File

@ -8,32 +8,32 @@ namespace big
{
void looped::player_remote_control_vehicle()
{
if (g->m_remote_controller_vehicle == -1)
if (g.m_remote_controller_vehicle == -1)
return;
if (!ENTITY::DOES_ENTITY_EXIST(g->m_remote_controlled_vehicle))
if (!ENTITY::DOES_ENTITY_EXIST(g.m_remote_controlled_vehicle))
{
g->m_remote_controlled_vehicle = -1;
g->m_remote_controlled_vehicle = -1;
g.m_remote_controlled_vehicle = -1;
g.m_remote_controlled_vehicle = -1;
return;
}
if (!ENTITY::DOES_ENTITY_EXIST(g->m_remote_controller_vehicle))
if (!ENTITY::DOES_ENTITY_EXIST(g.m_remote_controller_vehicle))
{
g->m_remote_controlled_vehicle = -1;
g->m_remote_controlled_vehicle = -1;
g.m_remote_controlled_vehicle = -1;
g.m_remote_controlled_vehicle = -1;
return;
}
if (VEHICLE::IS_VEHICLE_SEAT_FREE(g->m_remote_controller_vehicle, -1, TRUE))
if (VEHICLE::IS_VEHICLE_SEAT_FREE(g.m_remote_controller_vehicle, -1, TRUE))
{
auto controlled = g->m_remote_controlled_vehicle;
auto controller = g->m_remote_controller_vehicle;
auto controlled = g.m_remote_controlled_vehicle;
auto controller = g.m_remote_controller_vehicle;
g_fiber_pool->queue_job([controlled, controller]
{
if (entity::take_control_of(controlled))
{
ENTITY::SET_ENTITY_COLLISION(g->m_remote_controlled_vehicle, TRUE, TRUE);
ENTITY::SET_ENTITY_COLLISION(g.m_remote_controlled_vehicle, TRUE, TRUE);
ENTITY::DETACH_ENTITY(controlled, TRUE, TRUE);
VEHICLE::SET_VEHICLE_DOORS_LOCKED(controlled, 0);
VEHICLE::SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(controlled, FALSE);
@ -43,8 +43,8 @@ namespace big
});
g->m_remote_controller_vehicle = -1;
g->m_remote_controlled_vehicle = -1;
g.m_remote_controller_vehicle = -1;
g.m_remote_controlled_vehicle = -1;
}
}
};

View File

@ -12,9 +12,9 @@ namespace big
const auto vehicle = self::veh;
const auto ped = self::ped;
if (!g_player_service->get_selected()->is_valid() || !g->player.spectating)
if (!g_player_service->get_selected()->is_valid() || !g.player.spectating)
{
if (g->player.spectating) g->player.spectating = false;
if (g.player.spectating) g.player.spectating = false;
if (!bReset)
{

View File

@ -6,7 +6,7 @@ namespace big
{
void looped::self_clean_player()
{
if (g->self.clean_player) {
if (g.self.clean_player) {
entity::clean_ped(self::ped);
}
}

View File

@ -9,10 +9,10 @@ namespace big
bool bLastDanceMode = false;
void looped::self_dance_mode()
{
if (g->self.dance_mode && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) > 0)
g->self.dance_mode = false;
if (g.self.dance_mode && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) > 0)
g.self.dance_mode = false;
if (g->self.dance_mode && g->self.dance_mode != bLastDanceMode)
if (g.self.dance_mode && g.self.dance_mode != bLastDanceMode)
{
scripts::request_script(RAGE_JOAAT("am_mp_nightclub"));
if (!scripts::wait_till_loaded(RAGE_JOAAT("am_mp_nightclub")))
@ -24,12 +24,12 @@ namespace big
if (!thread)
return;
g->m_dance_thread = gta_util::find_script_thread(RAGE_JOAAT("am_mp_nightclub"));
g->m_dance_program = gta_util::find_script_program(RAGE_JOAAT("am_mp_nightclub"));
g.m_dance_thread = gta_util::find_script_thread(RAGE_JOAAT("am_mp_nightclub"));
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_script_handler_mgr)->attach_thread(g.m_dance_thread);
g->m_dance_thread->m_context.m_state = rage::eThreadState::unk_3;
g.m_dance_thread->m_context.m_state = rage::eThreadState::unk_3;
// perform initial setup
gta_util::execute_as_script(RAGE_JOAAT("am_mp_nightclub"), []
@ -43,25 +43,25 @@ namespace big
return;
}
if (!g->self.dance_mode && g->self.dance_mode != bLastDanceMode)
if (!g.self.dance_mode && g.self.dance_mode != bLastDanceMode)
{
if (g->m_dance_thread)
g->m_dance_thread->kill();
if (g.m_dance_thread)
g.m_dance_thread->kill();
g->m_dance_thread = nullptr;
g->m_dance_program = nullptr;
g.m_dance_thread = nullptr;
g.m_dance_program = nullptr;
bLastDanceMode = false;
return;
}
if (g->self.dance_mode && g->m_dance_thread->m_handler)
if (g.self.dance_mode && g.m_dance_thread->m_handler)
{
*script_global(1950102).as<bool*>() = true;
misc::set_bit(scr_globals::gpbd_fm_1.at(self::id, scr_globals::size::gpbd_fm_1).at(267).at(310).at(7).as<int*>(), 0);
misc::set_bit(scr_globals::gpbd_fm_1.at(self::id, scr_globals::size::gpbd_fm_1).at(267).at(310).at(7).as<int*>(), 1);
misc::set_bit(scr_globals::gpbd_fm_1.at(self::id, scr_globals::size::gpbd_fm_1).at(267).at(310).at(7).as<int*>(), 2);
scr_functions::dance_loop.call(g->m_dance_thread, g->m_dance_program, {});
scr_functions::dance_loop.call(g.m_dance_thread, g.m_dance_program, {});
}
}
}

View File

@ -5,7 +5,7 @@ namespace big
{
void looped::self_fast_respawn()
{
if (g->self.fast_respawn)
if (g.self.fast_respawn)
{
if(PED::IS_PED_DEAD_OR_DYING(self::ped, true))
{

View File

@ -33,7 +33,7 @@ namespace big
{
if (g_local_player == nullptr) return;
if (g->self.free_cam)
if (g.self.free_cam)
{
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
@ -48,9 +48,9 @@ namespace big
const auto vehicle = self::veh;
const auto ped = self::ped;
if (!g->self.free_cam && !bLastFreeCam) return;
if (!g.self.free_cam && !bLastFreeCam) return;
if (g->self.free_cam && !bLastFreeCam)
if (g.self.free_cam && !bLastFreeCam)
{
cCam = CAM::CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", 0);
@ -66,7 +66,7 @@ namespace big
bLastFreeCam = true;
}
else if (!g->self.free_cam && bLastFreeCam)
else if (!g.self.free_cam && bLastFreeCam)
{
CAM::SET_CAM_ACTIVE(cCam, false);
CAM::RENDER_SCRIPT_CAMS(false, true, 500, true, true, 0);

View File

@ -12,7 +12,7 @@ namespace big
return;
}
uint32_t bits = g->self.proof_mask;
uint32_t bits = g.self.proof_mask;
uint32_t changed_bits = bits ^ last_bits;
uint32_t changed_or_enabled_bits = bits | changed_bits;

View File

@ -9,11 +9,11 @@ namespace big
void looped::self_hud()
{
const bool bHideRadar = g->self.hide_radar;
const bool bHideAmmo = g->self.hide_ammo;
const bool bForceShowElement = g->self.force_show_hud_element;
const bool bForceShowHUD = g->self.force_show_hud;
auto& bHudComponents = g->self.hud_components_states;
const bool bHideRadar = g.self.hide_radar;
const bool bHideAmmo = g.self.hide_ammo;
const bool bForceShowElement = g.self.force_show_hud_element;
const bool bForceShowHUD = g.self.force_show_hud;
auto& bHudComponents = g.self.hud_components_states;
if (bHideRadar)
{

View File

@ -9,25 +9,25 @@ namespace big
{
Ped ped = self::ped;
bool bInvisibility = g->self.invisibility;
bool bInvisibility = g.self.invisibility;
if (bInvisibility || (!bInvisibility && bInvisibility != bLastInvisibility))
{
ENTITY::SET_ENTITY_VISIBLE(ped, !g->self.invisibility, 0);
ENTITY::SET_ENTITY_VISIBLE(ped, !g.self.invisibility, 0);
bLastInvisibility = g->self.invisibility;
bLastInvisibility = g.self.invisibility;
}
if (NETWORK::NETWORK_IS_SESSION_STARTED())
{
if (g->self.invisibility && g->self.local_visibility)
if (g.self.invisibility && g.self.local_visibility)
{
NETWORK::SET_ENTITY_LOCALLY_VISIBLE(ped);
}
}
else
{
if (g->self.local_visibility)
if (g.self.local_visibility)
{
ENTITY::SET_ENTITY_VISIBLE(ped, true, 0);
}

View File

@ -7,7 +7,7 @@ namespace big
void looped::self_mobile_radio()
{
const bool bMobileRadio = g->self.mobile_radio;
const bool bMobileRadio = g.self.mobile_radio;
if (bMobileRadio)
{

View File

@ -10,7 +10,7 @@ namespace big
{
if (g_local_player == nullptr) return;
bool bNoCollsion = g->self.no_collision;
bool bNoCollsion = g.self.no_collision;
if (bNoCollsion)
{

View File

@ -7,13 +7,13 @@ namespace big
void looped::self_no_ragdoll()
{
bool bNoRagdoll = g->self.no_ragdoll;
bool bNoRagdoll = g.self.no_ragdoll;
if (bNoRagdoll || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll))
{
PED::SET_PED_CAN_RAGDOLL(self::ped, !g->self.no_ragdoll);
PED::SET_PED_CAN_RAGDOLL(self::ped, !g.self.no_ragdoll);
bLastNoRagdoll = g->self.no_ragdoll;
bLastNoRagdoll = g.self.no_ragdoll;
}
}
}

View File

@ -8,7 +8,7 @@ namespace big
{
if (g_local_player == nullptr) return;
bool bNoWaterCollsion = g->self.no_water_collision;
bool bNoWaterCollsion = g.self.no_water_collision;
if (bNoWaterCollsion)
{

View File

@ -26,7 +26,7 @@ namespace big
void looped::self_noclip_disable_control_action()
{
if (g->self.noclip)
if (g.self.noclip)
{
for (const auto& control : controls)
PAD::DISABLE_CONTROL_ACTION(0, static_cast<int>(control), true);
@ -35,7 +35,7 @@ namespace big
void looped::self_noclip()
{
const auto bNoclip = g->self.noclip;
const auto bNoclip = g.self.noclip;
const auto location = self::pos;
const Entity ent = (self::veh != 0 && g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING) ? self::veh : self::ped;

View File

@ -5,7 +5,7 @@ namespace big
{
void looped::self_off_radar()
{
if (g->self.off_radar)
mobile::lester::off_radar(g->self.off_radar);
if (g.self.off_radar)
mobile::lester::off_radar(g.self.off_radar);
}
}

View File

@ -9,7 +9,7 @@ namespace big
static bool bLast = false;
bool b = g->self.never_wanted;
bool b = g.self.never_wanted;
if (b)
{
@ -25,7 +25,7 @@ namespace big
bLast = b;
}
if(g->self.force_wanted_level && !b)
g_local_player->m_player_info->m_wanted_level = g->self.wanted_level;
if(g.self.force_wanted_level && !b)
g_local_player->m_player_info->m_wanted_level = g.self.wanted_level;
}
}

View File

@ -11,7 +11,7 @@ namespace big
void looped::self_super_run()
{
if (g->self.super_run && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
if (g.self.super_run && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
{
if (run_speed < run_cap) run_speed += .5f;
@ -38,7 +38,7 @@ namespace big
g_local_player->m_player_info->m_run_speed = .7f;
}
else if (!g->self.super_run && g->self.super_run != super_run_state)
else if (!g.self.super_run && g.self.super_run != super_run_state)
{
g_local_player->m_player_info->m_run_speed = 1.f;
}
@ -48,6 +48,6 @@ namespace big
g_local_player->m_player_info->m_run_speed = 1.f;
}
super_run_state = g->self.super_run;
super_run_state = g.self.super_run;
}
}

View File

@ -6,7 +6,7 @@ namespace big
{
if (g_local_player == nullptr) return;
if (g->self.unlimited_oxygen)
if (g.self.unlimited_oxygen)
g_local_player->m_oxygen_info->m_oxygen_time = 0;
}
}

View File

@ -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_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)

View File

@ -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_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)

View File

@ -7,15 +7,15 @@ namespace big
void looped::session_local_time()
{
if (g->session.override_time)
if (g.session.override_time)
{
if (toggled)
{
NETWORK::NETWORK_GET_GLOBAL_MULTIPLAYER_CLOCK(&g->session.custom_time.hour, &g->session.custom_time.minute, &g->session.custom_time.second);
NETWORK::NETWORK_GET_GLOBAL_MULTIPLAYER_CLOCK(&g.session.custom_time.hour, &g.session.custom_time.minute, &g.session.custom_time.second);
toggled = false;
}
NETWORK::NETWORK_OVERRIDE_CLOCK_TIME(g->session.custom_time.hour, g->session.custom_time.minute, g->session.custom_time.second);
NETWORK::NETWORK_OVERRIDE_CLOCK_TIME(g.session.custom_time.hour, g.session.custom_time.minute, g.session.custom_time.second);
}
else
{

View File

@ -12,27 +12,27 @@ 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_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)
{
gta_util::execute_as_script(RAGE_JOAAT("freemode"), []
{
pop_multiplier_id = MISC::ADD_POP_MULTIPLIER_SPHERE(1.1f, 1.1f, 1.1f, 15000.0f, g->session.disable_peds ? 0.0f : 1.0f, g->session.disable_traffic ? 0.0f : 1.0f, false, true);
pop_multiplier_id = MISC::ADD_POP_MULTIPLIER_SPHERE(1.1f, 1.1f, 1.1f, 15000.0f, g.session.disable_peds ? 0.0f : 1.0f, g.session.disable_traffic ? 0.0f : 1.0f, false, true);
bLastBlockPeds = g->session.disable_peds;
bLastBlockVehs = g->session.disable_traffic;
bLastBlockPeds = g.session.disable_peds;
bLastBlockVehs = g.session.disable_traffic;
bLastPopMultiplierAreasEnabled = true;
MISC::CLEAR_AREA(1.1f, 1.1f, 1.1f, 19999.9f, true, false, false, true);
});
}
}
else if (bLastPopMultiplierAreasEnabled && (g->session.disable_traffic != bLastBlockVehs || g->session.disable_peds != bLastBlockPeds))
else if (bLastPopMultiplierAreasEnabled && (g.session.disable_traffic != bLastBlockVehs || g.session.disable_peds != bLastBlockPeds))
{
bLastBlockPeds = g->session.disable_peds;
bLastBlockVehs = g->session.disable_traffic;
bLastBlockPeds = g.session.disable_peds;
bLastBlockVehs = g.session.disable_traffic;
used = false;
}

View File

@ -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_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())
{

View File

@ -11,18 +11,18 @@ namespace big
{
bool temp_disable_tp = (!*g_pointers->m_is_session_started) && CUTSCENE::IS_CUTSCENE_ACTIVE();
if ((!g->self.auto_tp || temp_disable_tp) && bLastAutoTP)
if ((!g.self.auto_tp || temp_disable_tp) && bLastAutoTP)
{
MISC::USING_MISSION_CREATOR(false);
MISC::ALLOW_MISSION_CREATOR_WARP(false);
}
if (g->self.auto_tp && !temp_disable_tp)
if (g.self.auto_tp && !temp_disable_tp)
{
MISC::USING_MISSION_CREATOR(true);
MISC::ALLOW_MISSION_CREATOR_WARP(true);
}
bLastAutoTP = g->self.auto_tp;
bLastAutoTP = g.self.auto_tp;
}
}

View File

@ -10,15 +10,15 @@ namespace big
bool bLastMissionCreator = false;
void looped::system_mission_creator()
{
if (g->m_mission_creator_thread)
if (g.m_mission_creator_thread)
{
*scr_globals::terminate_creator.as<bool*>() = false;
if (SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) > 0)
{
if (g->m_mission_creator_thread)
g->m_mission_creator_thread->kill();
g->m_mission_creator_thread = nullptr;
if (g.m_mission_creator_thread)
g.m_mission_creator_thread->kill();
g.m_mission_creator_thread = nullptr;
return;
}

View File

@ -8,12 +8,12 @@ namespace big
static bool bLastForceHost = false;
void looped::system_spoofing()
{
if (bLastForceHost != g->session.force_session_host && gta_util::get_network()->m_game_session_state == 0)
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);
host_token = g->session.force_session_host ? (rand() % 10000) : host_token;
host_token = g.session.force_session_host ? (rand() % 10000) : host_token;
*g_pointers->m_host_token = host_token;
@ -27,17 +27,17 @@ namespace big
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;
bLastForceHost = g->session.force_session_host;
bLastForceHost = g.session.force_session_host;
}
if (g->spoofing.rockstar_id != g->spoofing.applied_spoof_rockstar_id && gta_util::get_network()->m_game_session_state == 0)
if (g.spoofing.rockstar_id != g.spoofing.applied_spoof_rockstar_id && gta_util::get_network()->m_game_session_state == 0)
{
g->spoofing.applied_spoof_rockstar_id = g->spoofing.spoof_rockstar_id;
g.spoofing.applied_spoof_rockstar_id = g.spoofing.spoof_rockstar_id;
}
if (g->spoofing.spoof_rockstar_id != g->spoofing.should_spoof_rockstar_id && gta_util::get_network()->m_game_session_state == 0)
if (g.spoofing.spoof_rockstar_id != g.spoofing.should_spoof_rockstar_id && gta_util::get_network()->m_game_session_state == 0)
{
g->spoofing.should_spoof_rockstar_id = g->spoofing.spoof_rockstar_id;
g.spoofing.should_spoof_rockstar_id = g.spoofing.spoof_rockstar_id;
}
}
}

View File

@ -5,6 +5,6 @@ namespace big
{
void looped::tunables_disable_phone()
{
*script_global(20366).as<bool*>() = g->tunables.disable_phone; // Who even uses that...
*script_global(20366).as<bool*>() = g.tunables.disable_phone; // Who even uses that...
}
}

View File

@ -21,10 +21,10 @@ namespace big
static bool started = false;
static Vector3 waypoint;
if (g->vehicle.auto_drive_destination != AutoDriveDestination::STOPPED)
if (g.vehicle.auto_drive_destination != AutoDriveDestination::STOPPED)
{
current_destination = g->vehicle.auto_drive_destination;
g->vehicle.auto_drive_destination = AutoDriveDestination::STOPPED;
current_destination = g.vehicle.auto_drive_destination;
g.vehicle.auto_drive_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = true;
}
@ -35,11 +35,11 @@ namespace big
g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
}
else if (
current_driving_flag != driving_style_flags[g->vehicle.auto_drive_style] ||
current_speed != g->vehicle.auto_drive_speed
current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] ||
current_speed != g.vehicle.auto_drive_speed
) {
current_driving_flag = driving_style_flags[g->vehicle.auto_drive_style];
current_speed = g->vehicle.auto_drive_speed;
current_driving_flag = driving_style_flags[g.vehicle.auto_drive_style];
current_speed = g.vehicle.auto_drive_speed;
changing_driving_styles = true;
}

View File

@ -10,12 +10,12 @@ namespace big
if (vehicle && VEHICLE::GET_HAS_ROCKET_BOOST(self::veh))
{
if (g->vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL && (vehicle->m_boost == 0.f || !vehicle->m_boost_state)) // Instant Refill
if (g.vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL && (vehicle->m_boost == 0.f || !vehicle->m_boost_state)) // Instant Refill
{
vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 3.f;
}
else if (g->vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST) // Infinite Boost
else if (g.vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST) // Infinite Boost
{
vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 3.f;

View File

@ -29,7 +29,7 @@ namespace big
void looped::vehicle_drive_on_water()
{
if (!g->vehicle.drive_on_water || self::veh == 0) {
if (!g.vehicle.drive_on_water || self::veh == 0) {
drive_on_water_hide_surface();
return;
}

View File

@ -14,9 +14,9 @@ namespace big
Vector3 cam_pos = CAM::GET_GAMEPLAY_CAM_ROT(0);
ENTITY::SET_ENTITY_ROTATION(vehicle, cam_pos.x, cam_pos.y, cam_pos.z, 1, true);
ENTITY::SET_ENTITY_COLLISION(vehicle, !g->vehicle.fly.no_collision, true);
ENTITY::SET_ENTITY_COLLISION(vehicle, !g.vehicle.fly.no_collision, true);
float locspeed = g->vehicle.fly.speed;
float locspeed = g.vehicle.fly.speed;
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{
@ -26,9 +26,9 @@ namespace big
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE))
{
if (g->vehicle.fly.dont_stop)
if (g.vehicle.fly.dont_stop)
{
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, g->vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, g.vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
}
else
{
@ -38,12 +38,12 @@ namespace big
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
{
float lsp = g->vehicle.fly.speed;
float lsp = g.vehicle.fly.speed;
if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{
lsp = (g->vehicle.fly.speed * 2);
lsp = (g.vehicle.fly.speed * 2);
}
if (g->vehicle.fly.dont_stop)
if (g.vehicle.fly.dont_stop)
{
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, 0 - (lsp), 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
}
@ -55,12 +55,12 @@ namespace big
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY))
{
float lsp = ((0 - g->vehicle.fly.speed) * 2);
float lsp = ((0 - g.vehicle.fly.speed) * 2);
if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{
lsp = (0 - g->vehicle.fly.speed);
lsp = (0 - g.vehicle.fly.speed);
}
if (g->vehicle.fly.dont_stop)
if (g.vehicle.fly.dont_stop)
{
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (lsp), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
}
@ -72,12 +72,12 @@ namespace big
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY))
{
float lsp = g->vehicle.fly.speed;
float lsp = g.vehicle.fly.speed;
if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{
lsp = (g->vehicle.fly.speed * 2);
lsp = (g.vehicle.fly.speed * 2);
}
if (g->vehicle.fly.dont_stop)
if (g.vehicle.fly.dont_stop)
{
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, lsp, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
}
@ -87,17 +87,17 @@ namespace big
}
}
if (!g->vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE) && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
if (!g.vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE) && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0);
}
if (TASK::GET_IS_TASK_ACTIVE(self::ped, 2))
{
g->vehicle.fly.enabled = false;
g.vehicle.fly.enabled = false;
VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true);
ENTITY::SET_ENTITY_COLLISION(vehicle, true, true);
if (g->vehicle.fly.stop_on_exit)
if (g.vehicle.fly.stop_on_exit)
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0);
}
@ -107,7 +107,7 @@ namespace big
void looped::vehicle_fly()
{
Vehicle vehicle = self::veh;
if (g->vehicle.fly.enabled)
if (g.vehicle.fly.enabled)
{
last_fly_tick = true;
@ -115,7 +115,7 @@ namespace big
if (!vehicle)
{
g_notification_service->push_warning("Warning", "Please be in a vehicle before enabling vehicle fly.");
g->vehicle.fly.enabled = false;
g.vehicle.fly.enabled = false;
return;
}
else

View File

@ -10,7 +10,7 @@ namespace big
void looped::vehicle_horn_boost()
{
if (!g->vehicle.horn_boost) return;
if (!g.vehicle.horn_boost) return;
Vehicle vehicle = self::veh;

View File

@ -7,7 +7,7 @@ namespace big
void looped::vehicle_instant_brake()
{
if (!g->vehicle.instant_brake) return;
if (!g.vehicle.instant_brake) return;
Vehicle vehicle = self::veh;

View File

@ -5,6 +5,6 @@ namespace big
void looped::vehicle_is_targetable()
{
if (g_local_player && g_local_player->m_vehicle)
g_local_player->m_vehicle->m_is_targetable = g->vehicle.is_targetable;
g_local_player->m_vehicle->m_is_targetable = g.vehicle.is_targetable;
}
}

View File

@ -5,7 +5,7 @@ namespace big
{
void looped::vehicle_keep_vehicle_repaired()
{
if (g->vehicle.keep_vehicle_repaired && VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(self::veh)) {
if (g.vehicle.keep_vehicle_repaired && VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(self::veh)) {
vehicle::repair(self::veh);
}
}

View File

@ -18,7 +18,7 @@ namespace big
busy = true;
constexpr int hash = RAGE_JOAAT("carmod_shop");
if (g->vehicle.ls_customs && g->vehicle.ls_customs == state)
if (g.vehicle.ls_customs && g.vehicle.ls_customs == state)
{
if (
auto carmod_shop_thread = gta_util::find_script_thread(hash);
@ -26,19 +26,19 @@ namespace big
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).at(11).as<int*>() != 4
)
{
g->vehicle.ls_customs = false;
g.vehicle.ls_customs = false;
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).as<int*>() = 1; // cleanup
}
}
if (g->vehicle.ls_customs && g->vehicle.ls_customs != state)
if (g.vehicle.ls_customs && g.vehicle.ls_customs != state)
{
Vehicle veh = self::veh;
if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false))
{
busy = false;
g->vehicle.ls_customs = false;
g.vehicle.ls_customs = false;
g_notification_service->push_warning("LS Customs", "You aren't in a vehicle.");
@ -67,6 +67,6 @@ namespace big
}
busy = false;
state = g->vehicle.ls_customs;
state = g.vehicle.ls_customs;
}
}

View File

@ -8,7 +8,7 @@ namespace big
{
if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr) return;
bool bNoWaterCollsion = g->vehicle.no_water_collision;
bool bNoWaterCollsion = g.vehicle.no_water_collision;
if (bNoWaterCollsion)
{

View File

@ -25,17 +25,17 @@ namespace big
static int green = 0;
static int blue = 0;
if (self::veh && g->vehicle.rainbow_paint.type != RainbowPaintType::Off && last_rgb_run_time + delay < std::chrono::system_clock::now())
if (self::veh && g.vehicle.rainbow_paint.type != RainbowPaintType::Off && last_rgb_run_time + delay < std::chrono::system_clock::now())
{
int delay_step = 100;
if (g->vehicle.rainbow_paint.type == RainbowPaintType::Spasm)
if (g.vehicle.rainbow_paint.type == RainbowPaintType::Spasm)
{
red = rand() % 256;
green = rand() % 256;
blue = rand() % 256;
}
else if (g->vehicle.rainbow_paint.type == RainbowPaintType::Fade)
else if (g.vehicle.rainbow_paint.type == RainbowPaintType::Fade)
{
delay_step = 10;
@ -103,24 +103,24 @@ namespace big
Vehicle vehicle = self::veh;
if (g->vehicle.rainbow_paint.primary) {
if (g.vehicle.rainbow_paint.primary) {
VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, red, green, blue);
}
if (g->vehicle.rainbow_paint.secondary) {
if (g.vehicle.rainbow_paint.secondary) {
VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(vehicle, red, green, blue);
}
if (g->vehicle.rainbow_paint.neon) {
if (g.vehicle.rainbow_paint.neon) {
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 0, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 1, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 2, 1);
VEHICLE::SET_VEHICLE_NEON_ENABLED(vehicle, 3, 1);
VEHICLE::SET_VEHICLE_NEON_COLOUR(vehicle, red, green, blue);
}
if (g->vehicle.rainbow_paint.smoke) {
if (g.vehicle.rainbow_paint.smoke) {
VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(vehicle, red, green, blue);
}
delay = std::chrono::milliseconds(((delay_step * 10) + 10) - (g->vehicle.rainbow_paint.speed * delay_step));
delay = std::chrono::milliseconds(((delay_step * 10) + 10) - (g.vehicle.rainbow_paint.speed * delay_step));
last_rgb_run_time = std::chrono::system_clock::now();
}
}

View File

@ -7,15 +7,15 @@ namespace big
void looped::vehicle_seatbelt()
{
bool b_seatbelt = g->vehicle.seatbelt;
bool b_seatbelt = g.vehicle.seatbelt;
if (b_seatbelt || (!b_seatbelt && b_seatbelt != b_last_seatbelt))
{
PED::SET_PED_CONFIG_FLAG(self::ped, 32, g->vehicle.seatbelt);
PED::SET_PED_CONFIG_FLAG(self::ped, 32, g.vehicle.seatbelt);
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(self::ped, g->vehicle.seatbelt);
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(self::ped, g.vehicle.seatbelt);
b_last_seatbelt = g->vehicle.seatbelt;
b_last_seatbelt = g.vehicle.seatbelt;
}
}
}

View File

@ -7,7 +7,7 @@ namespace big
void looped::vehicle_speedo_meter()
{
if (
!g->vehicle.speedo_meter.enabled ||
!g.vehicle.speedo_meter.enabled ||
self::veh == 0 ||
HUD::IS_PAUSE_MENU_ACTIVE() ||
HUD::IS_WARNING_MESSAGE_ACTIVE() ||
@ -24,10 +24,10 @@ namespace big
float veh_speed = vehicle::mps_to_speed(
ENTITY::GET_ENTITY_SPEED(self::veh),
g->vehicle.speed_unit
g.vehicle.speed_unit
);
switch (g->vehicle.speed_unit)
switch (g.vehicle.speed_unit)
{
case SpeedUnit::KMPH:
strcpy(speed_type, "kmph");
@ -41,21 +41,21 @@ namespace big
break;
}
sprintf(speed, "%*d", g->vehicle.speedo_meter.left_side ? 0 : char_width, (int)veh_speed);
sprintf(speed, "%*d", g.vehicle.speedo_meter.left_side ? 0 : char_width, (int)veh_speed);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed_type);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y, 1);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g.vehicle.speedo_meter.x, g.vehicle.speedo_meter.y, 1);
HUD::SET_TEXT_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x + (g->vehicle.speedo_meter.left_side ? 0 : .003f), g->vehicle.speedo_meter.y + .04f, 1);
HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g.vehicle.speedo_meter.x + (g.vehicle.speedo_meter.left_side ? 0 : .003f), g.vehicle.speedo_meter.y + .04f, 1);
}
}

View File

@ -81,7 +81,7 @@ inline void set_turn_signals(int signal_state, bool on)
{
static constexpr int off = 0;
if (self::veh && big::g->vehicle.turn_signals)
if (self::veh && big::g.vehicle.turn_signals)
{
switch (signal_state)
{
@ -110,7 +110,7 @@ namespace big
void looped::vehicle_turn_signals()
{
static bool hazzards = false;
bool b_turn_signals = g->vehicle.turn_signals;
bool b_turn_signals = g.vehicle.turn_signals;
if (!b_turn_signals && b_turn_signals != b_last_turn_signals)
{
@ -118,7 +118,7 @@ namespace big
VEHICLE::SET_VEHICLE_INDICATOR_LIGHTS(PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false), 1, 0);
}
if (g->vehicle.turn_signals)
if (g.vehicle.turn_signals)
{
static bool ran_once = []
{
@ -130,12 +130,12 @@ namespace big
update_key_states();
if (left_signal_key.state == key_state::just_pressed || g->vehicle.auto_turn_signals && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY))
if (left_signal_key.state == key_state::just_pressed || g.vehicle.auto_turn_signals && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY))
{
set_turn_signals(signal_state::left, true);
}
if (right_signal_key.state == key_state::just_pressed || g->vehicle.auto_turn_signals && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY))
if (right_signal_key.state == key_state::just_pressed || g.vehicle.auto_turn_signals && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY))
{
set_turn_signals(signal_state::right, true);
}
@ -145,7 +145,7 @@ namespace big
set_turn_signals(signal_state::hazzards, true);
hazzards = true;
}
else if (hazzards_key.state == key_state::just_pressed && hazzards || !g->vehicle.turn_signals)
else if (hazzards_key.state == key_state::just_pressed && hazzards || !g.vehicle.turn_signals)
{
set_turn_signals(signal_state::hazzards, false);
hazzards = false;
@ -154,7 +154,7 @@ namespace big
if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY))
{
if (g->vehicle.turn_signals)
if (g.vehicle.turn_signals)
{
script::get_current()->yield(1500ms);
}
@ -163,14 +163,14 @@ namespace big
if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY))
{
if (g->vehicle.turn_signals)
if (g.vehicle.turn_signals)
{
script::get_current()->yield(1500ms);
}
set_turn_signals(signal_state::right, false);
}
b_last_turn_signals = g->vehicle.turn_signals;
b_last_turn_signals = g.vehicle.turn_signals;
}
}

View File

@ -14,7 +14,7 @@ namespace big
}
if (
(g->vehicle.god_mode || g->vehicle.proof_collision) &&
(g.vehicle.god_mode || g.vehicle.proof_collision) &&
g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING
) {
g_local_player->m_vehicle->m_deform_god = 0x8C;
@ -24,7 +24,7 @@ namespace big
g_local_player->m_vehicle->m_deform_god = 0x9C;
}
uint32_t bits = g->vehicle.proof_mask;
uint32_t bits = g.vehicle.proof_mask;
uint32_t changed_bits = bits ^ last_bits;
uint32_t changed_or_enabled_bits = bits | changed_bits;

View File

@ -6,7 +6,7 @@ namespace big
{
void looped::vehicle_jump()
{
if (!g->vehicle.vehicle_jump) return;
if (!g.vehicle.vehicle_jump) return;
const auto vehicle = self::veh;

View File

@ -18,7 +18,7 @@ namespace big
return;
}
if (g->weapons.ammo_special.toggle) {
if (g.weapons.ammo_special.toggle) {
CWeaponInfo* weapon_info = g_local_player->m_weapon_manager->m_weapon_info;
// check if the player changed their weapon
@ -39,12 +39,12 @@ namespace big
// apply ammo type changes to the current weapon
eDamageType damage_type = eDamageType::None;
eExplosionTag explosion_tag = g->weapons.ammo_special.explosion_tag;
eExplosionTag explosion_tag = g.weapons.ammo_special.explosion_tag;
eAmmoSpecialType ammo_type = eAmmoSpecialType::None;
if (explosion_tag == eExplosionTag::DONTCARE) {
damage_type = modified_weapon_damage_type;
ammo_type = g->weapons.ammo_special.type;
ammo_type = g.weapons.ammo_special.type;
}
else {
damage_type = eDamageType::Explosive;

View File

@ -7,7 +7,7 @@ namespace big
{
void looped::weapons_cage_gun()
{
bool bCageGun = g->weapons.custom_weapon == CustomWeapon::CAGE_GUN;
bool bCageGun = g.weapons.custom_weapon == CustomWeapon::CAGE_GUN;
if (bCageGun)
{

View File

@ -19,7 +19,7 @@ namespace big
void looped::custom_gun_disable_control_action()
{
bool is_custom_gun_selected = g->weapons.custom_weapon != CustomWeapon::NONE;
bool is_custom_gun_selected = g.weapons.custom_weapon != CustomWeapon::NONE;
if (is_custom_gun_selected)
{
for (const auto& control : attack_controls)

View File

@ -8,7 +8,7 @@ namespace big
{
void looped::weapons_delete_gun()
{
bool bCageGun = g->weapons.custom_weapon == CustomWeapon::DELETE_GUN;
bool bCageGun = g.weapons.custom_weapon == CustomWeapon::DELETE_GUN;
if (bCageGun)
{

View File

@ -6,7 +6,7 @@ namespace big
{
void looped::weapons_force_crosshairs()
{
if (g->weapons.force_crosshairs) {
if (g.weapons.force_crosshairs) {
HUD::SHOW_HUD_COMPONENT_THIS_FRAME(static_cast<int>(HudComponents::RETICLE));
}
}

View File

@ -15,7 +15,7 @@ namespace big
void looped::weapons_gravity_gun()
{
bool is_gravity_gun_selected = g->weapons.custom_weapon == CustomWeapon::GRAVITY_GUN;
bool is_gravity_gun_selected = g.weapons.custom_weapon == CustomWeapon::GRAVITY_GUN;
constexpr double multiplier = 3.0;
auto is_zoomed_in = is_gravity_gun_selected && PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM);

View File

@ -5,10 +5,10 @@ namespace big
{
void looped::weapons_increased_damage()
{
if (g->weapons.increased_damage != 1) {
if (g.weapons.increased_damage != 1) {
Hash weapon{};
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon, 0);
WEAPON::SET_WEAPON_DAMAGE_MODIFIER(weapon, g->weapons.increased_damage);
WEAPON::SET_WEAPON_DAMAGE_MODIFIER(weapon, g.weapons.increased_damage);
}
}
}

View File

@ -7,13 +7,13 @@ namespace big
void looped::weapons_infinite_ammo()
{
bool bInfiniteAmmo = g->weapons.infinite_ammo;
bool bInfiniteAmmo = g.weapons.infinite_ammo;
if (bInfiniteAmmo || (!bInfiniteAmmo && bInfiniteAmmo != bLastInfiniteAmmo))
{
WEAPON::SET_PED_INFINITE_AMMO(self::ped, g->weapons.infinite_ammo, NULL);
WEAPON::SET_PED_INFINITE_AMMO(self::ped, g.weapons.infinite_ammo, NULL);
bLastInfiniteAmmo = g->weapons.infinite_ammo;
bLastInfiniteAmmo = g.weapons.infinite_ammo;
}
}
}

View File

@ -7,13 +7,13 @@ namespace big
void looped::weapons_infinite_mag()
{
bool bInfiniteMag = g->weapons.infinite_mag;
bool bInfiniteMag = g.weapons.infinite_mag;
if (bInfiniteMag || (!bInfiniteMag && bInfiniteMag != bLastInfiniteMag))
{
WEAPON::SET_PED_INFINITE_AMMO_CLIP(self::ped, g->weapons.infinite_mag);
WEAPON::SET_PED_INFINITE_AMMO_CLIP(self::ped, g.weapons.infinite_mag);
bLastInfiniteMag = g->weapons.infinite_mag;
bLastInfiniteMag = g.weapons.infinite_mag;
}
}
}

View File

@ -24,7 +24,7 @@ namespace big
float get_recoil_value(uint32_t hash)
{
return g->weapons.no_recoil
return g.weapons.no_recoil
? 0.f
: get_og_recoil_value(hash);
}

View File

@ -24,7 +24,7 @@ namespace big
float get_spread_value(uint32_t hash)
{
return g->weapons.no_spread
return g.weapons.no_spread
? 0.f
: get_og_spread_value(hash);
}

View File

@ -8,7 +8,7 @@ namespace big
{
void looped::weapons_rapid_fire()
{
if (g->weapons.rapid_fire)
if (g.weapons.rapid_fire)
{
if(!HUD::IS_PAUSE_MENU_ACTIVE() && !g_gui->is_open() && !PED::IS_PED_DEAD_OR_DYING(self::ped, true))
{

View File

@ -7,7 +7,7 @@ namespace big
{
void looped::weapons_repair_gun()
{
bool bRepairGun = g->weapons.custom_weapon == CustomWeapon::REPAIR_GUN;
bool bRepairGun = g.weapons.custom_weapon == CustomWeapon::REPAIR_GUN;
if (bRepairGun)
{

View File

@ -9,7 +9,7 @@ namespace big
void looped::weapons_steal_vehicle_gun()
{
if (const bool bStealVehicleGun = g->weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; bStealVehicleGun)
if (const bool bStealVehicleGun = g.weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; bStealVehicleGun)
{
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{

View File

@ -10,7 +10,7 @@ namespace big
void looped::weapons_vehicle_gun()
{
const bool is_vehicle_gun_selected = g->weapons.custom_weapon == CustomWeapon::VEHICLE_GUN;
const bool is_vehicle_gun_selected = g.weapons.custom_weapon == CustomWeapon::VEHICLE_GUN;
const auto time_now = std::chrono::steady_clock::now();
@ -35,7 +35,7 @@ namespace big
location.y += dist * sin(yaw) * cos(pitch);
location.z += dist * sin(pitch);
Vehicle veh = vehicle::spawn(
rage::joaat((const char*)g->weapons.vehicle_gun_model),
rage::joaat(g.weapons.vehicle_gun_model.data()),
location,
ENTITY::GET_ENTITY_HEADING(self::ped)
);

View File

@ -6,9 +6,9 @@ namespace big
{
void register_script_patches()
{
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 01 08 00 ? 38 00 5D ? ? ? 2A 06", 5, {0x71, 0x2E, 0x01, 0x01}, &g->session.decloak_players });
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 01 04 00 ? 2C ? ? ? 5D ? ? ? 71 57 ? ? 2C", 5, { 0x2E, 0x01, 0x00 }, &g->protections.script_host_kick });
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 00 07 00 00 5D ? ? ? 56 ? ? 71", 5, { 0x2E, 0x00, 0x00 }, &g->tunables.no_idle_kick });
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 01 08 00 ? 38 00 5D ? ? ? 2A 06", 5, {0x71, 0x2E, 0x01, 0x01}, &g.session.decloak_players });
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 01 04 00 ? 2C ? ? ? 5D ? ? ? 71 57 ? ? 2C", 5, { 0x2E, 0x01, 0x00 }, &g.protections.script_host_kick });
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 00 07 00 00 5D ? ? ? 56 ? ? 71", 5, { 0x2E, 0x00, 0x00 }, &g.tunables.no_idle_kick });
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "5D ? ? ? 76 57 ? ? 5D ? ? ? 76", 0, { 0x2E, 0x00, 0x00 }, nullptr }); // end session kick protection
g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 01 09 00 00 5D ? ? ? 56 ? ? 2E", 5, { 0x2E, 0x01, 0x00 }, nullptr }); // disable death when undermap/spectating
g_script_patcher_service->add_patch({ RAGE_JOAAT("shop_controller"), "2D 01 04 00 00 2C ? ? ? 56 ? ? 71", 5, { 0x71, 0x2E, 0x01, 0x01 }, nullptr }); // despawn bypass

View File

@ -8,6 +8,11 @@ namespace big
INSTANT_REFIL,
INFINITE_BOOST
};
NLOHMANN_JSON_SERIALIZE_ENUM(eBoostBehaviors, {
{ eBoostBehaviors::DEFAULT, "default" },
{ eBoostBehaviors::INSTANT_REFIL, "instant" },
{ eBoostBehaviors::INFINITE_BOOST, "infinite" }
})
enum class CustomWeapon
{
@ -19,6 +24,15 @@ namespace big
REPAIR_GUN,
VEHICLE_GUN
};
NLOHMANN_JSON_SERIALIZE_ENUM(CustomWeapon, {
{ CustomWeapon::NONE, "none" },
{ CustomWeapon::CAGE_GUN, "cage" },
{ CustomWeapon::DELETE_GUN, "delete" },
{ CustomWeapon::GRAVITY_GUN, "gravity" },
{ CustomWeapon::STEAL_VEHICLE_GUN, "steal" },
{ CustomWeapon::REPAIR_GUN, "repair" },
{ CustomWeapon::VEHICLE_GUN, "vehicle" },
})
enum class ContextEntityType : uint8_t
{
@ -271,6 +285,11 @@ namespace big
MIPH,
MPS
};
NLOHMANN_JSON_SERIALIZE_ENUM(SpeedUnit, {
{ SpeedUnit::KMPH, "kmph" },
{ SpeedUnit::MIPH, "miph" },
{ SpeedUnit::MPS, "mps" },
})
enum class RainbowPaintType
{
@ -278,6 +297,11 @@ namespace big
Fade,
Spasm
};
NLOHMANN_JSON_SERIALIZE_ENUM(RainbowPaintType, {
{ RainbowPaintType::Off, "off" },
{ RainbowPaintType::Fade, "fade" },
{ RainbowPaintType::Spasm, "spasm" },
})
enum class AutoDriveDestination
{
@ -287,12 +311,23 @@ namespace big
WANDER,
EMERGENCY_STOP
};
NLOHMANN_JSON_SERIALIZE_ENUM(AutoDriveDestination, {
{ AutoDriveDestination::STOPPED, "stopped" },
{ AutoDriveDestination::OBJECTITVE, "objective" },
{ AutoDriveDestination::WAYPOINT, "waypoint" },
{ AutoDriveDestination::WANDER, "wander" },
{ AutoDriveDestination::EMERGENCY_STOP, "emergency_stop" },
})
enum class AutoDriveStyle
{
LAW_ABIDING,
THE_ROAD_IS_YOURS
};
NLOHMANN_JSON_SERIALIZE_ENUM(AutoDriveStyle, {
{ AutoDriveStyle::LAW_ABIDING, "law_abiding" },
{ AutoDriveStyle::THE_ROAD_IS_YOURS, "the_road_is_yours" },
})
enum class eEntityProofs : uint32_t
{

128
src/core/globals.cpp Normal file
View File

@ -0,0 +1,128 @@
#include "globals.hpp"
#include "thread_pool.hpp"
namespace big
{
void menu_settings::init(const file& save_file)
{
m_save_file = std::make_unique<file>(save_file.get_path());
load();
g_thread_pool->push([this]
{
while (g_running)
{
std::this_thread::sleep_for(100ms);
attempt_save();
}
});
}
void menu_settings::attempt_save()
{
const nlohmann::json j = *this;
if (deep_compare(m_options, j, true))
save();
}
bool menu_settings::load()
{
m_default_options = *this;
std::ifstream file(m_save_file->get_path());
if (!m_save_file->exists())
{
write_default_config();
file.open(m_save_file->get_path());
}
try
{
file >> m_options;
file.close();
}
catch (const std::exception&)
{
file.close();
LOG(WARNING) << "Detected corrupt settings, writing default config...";
write_default_config();
return load();
}
const bool should_save = deep_compare(m_options, m_default_options);
try
{
from_json(m_options, *this);
}
catch(const nlohmann::detail::type_error& e)
{
LOG(WARNING) << e.what();
return false;
}
if (should_save)
{
LOG(INFO) << "Updating settings.";
save();
}
return true;
}
bool menu_settings::deep_compare(nlohmann::json& current_settings, const nlohmann::json& default_settings, bool compare_value)
{
bool should_save = false;
for (auto& e : default_settings.items())
{
const std::string& key = e.key();
if (current_settings.count(key) == 0 || (compare_value && current_settings[key] != e.value()))
{
current_settings[key] = e.value();
should_save = true;
}
else if (current_settings[key].is_object() && e.value().is_object())
{
if (deep_compare(current_settings[key], e.value(), compare_value))
should_save = true;
}
else if (!current_settings[key].is_object() && e.value().is_object()) {
current_settings[key] = e.value();
should_save = true;
}
}
return should_save;
}
bool menu_settings::save()
{
std::ofstream file(m_save_file->get_path(), std::ios::out | std::ios::trunc);
nlohmann::json j = *this;
file << j.dump(4);
file.close();
return true;
}
bool menu_settings::write_default_config()
{
std::ofstream file(m_save_file->get_path(), std::ios::out | std::ios::trunc);
nlohmann::json j = *this;
file << j.dump(4);
file.close();
return true;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -76,8 +76,8 @@ namespace big
auto& colors = style.Colors;
colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
colors[ImGuiCol_WindowBg] = ImGui::ColorConvertU32ToFloat4(g->window.color);
colors[ImGuiCol_ChildBg] = ImGui::ColorConvertU32ToFloat4(g->window.color);
colors[ImGuiCol_WindowBg] = ImGui::ColorConvertU32ToFloat4(g.window.color);
colors[ImGuiCol_ChildBg] = ImGui::ColorConvertU32ToFloat4(g.window.color);
colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
@ -115,7 +115,7 @@ namespace big
{
if (m_is_open)
{
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::ColorConvertU32ToFloat4(g->window.color));
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::ColorConvertU32ToFloat4(g.window.color));
view::root();
ImGui::PopStyleColor();
}
@ -166,7 +166,7 @@ namespace big
void gui::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
if (msg == WM_KEYUP && wparam == g->settings.hotkeys.menu_toggle)
if (msg == WM_KEYUP && wparam == g.settings.hotkeys.menu_toggle)
{
//Persist and restore the cursor position between menu instances.
static POINT cursor_coords{};
@ -179,9 +179,9 @@ namespace big
SetCursorPos(cursor_coords.x, cursor_coords.y);
}
toggle(g->settings.hotkeys.editing_menu_toggle || !m_is_open);
if (g->settings.hotkeys.editing_menu_toggle)
g->settings.hotkeys.editing_menu_toggle = false;
toggle(g.settings.hotkeys.editing_menu_toggle || !m_is_open);
if (g.settings.hotkeys.editing_menu_toggle)
g.settings.hotkeys.editing_menu_toggle = false;
}
}

View File

@ -4,6 +4,6 @@
namespace big
{
void components::icon(const std::string_view text) {
components::custom_text(text.data(), g->window.font_icon);
components::custom_text(text.data(), g.window.font_icon);
}
}

View File

@ -4,6 +4,6 @@
namespace big
{
void components::small_text(const std::string_view text) {
components::custom_text(text.data(), g->window.font_small);
components::custom_text(text.data(), g.window.font_small);
}
}

View File

@ -4,6 +4,6 @@
namespace big
{
void components::sub_title(const std::string_view text) {
components::custom_text(text.data(), g->window.font_sub_title);
components::custom_text(text.data(), g.window.font_sub_title);
}
}

View File

@ -4,6 +4,6 @@
namespace big
{
void components::title(const std::string_view text) {
components::custom_text(text.data(), g->window.font_title);
components::custom_text(text.data(), g.window.font_title);
}
}

View File

@ -4,7 +4,7 @@ namespace big
{
int hooks::multiplayer_chat_filter(__int64 chat_type, const char* input, const char** output)
{
if (g->session.disable_chat_filter)
if (g.session.disable_chat_filter)
{
return -1;
}

View File

@ -18,8 +18,8 @@ namespace big
}
}
if (g->m_spoofed_peer_ids.contains(host_token))
msg->m_peer_id = g->m_spoofed_peer_ids[host_token];
if (g.m_spoofed_peer_ids.contains(host_token))
msg->m_peer_id = g.m_spoofed_peer_ids[host_token];
return g_hooking->get_original<hooks::send_chat_net_message>()(mgr, receiver_msg_id, msg, flags, unk);
}

View File

@ -9,7 +9,7 @@ namespace big
{
int old_group = msg->m_matchmaking_group;
if (g->session.join_in_sctv_slots)
if (g.session.join_in_sctv_slots)
msg->m_matchmaking_group = 4;
bool ret = g_hooking->get_original<hooks::serialize_player_data_msg>()(msg, buffer);

View File

@ -7,9 +7,9 @@ namespace big
// false => e1 < e2
bool hooks::sort_session_details(SessionSortEntry* e1, SessionSortEntry* e2)
{
if (g->session.player_magnet_enabled)
if (g.session.player_magnet_enabled)
{
return std::abs((int)e1->m_session_detail->m_player_count - g->session.player_magnet_count) < std::abs((int)e2->m_session_detail->m_player_count - g->session.player_magnet_count);
return std::abs((int)e1->m_session_detail->m_player_count - g.session.player_magnet_count) < std::abs((int)e2->m_session_detail->m_player_count - g.session.player_magnet_count);
}
else
{

View File

@ -9,14 +9,14 @@ namespace big
{
int discriminator = filter->m_param_values[0]; // this is guaranteed to work
if (g->session_browser.replace_game_matchmaking && filter->m_filter_type == 1)
if (g.session_browser.replace_game_matchmaking && filter->m_filter_type == 1)
{
*status = 1;
g_fiber_pool->queue_job([max_sessions, results, num_sessions_found, status, discriminator]
{
bool result = false;
if (g->session.join_in_sctv_slots)
if (g.session.join_in_sctv_slots)
result = g_matchmaking_service->matchmake();
else
result = g_matchmaking_service->matchmake(discriminator);

View File

@ -15,17 +15,17 @@ namespace big
if (new_index == static_cast<uint8_t>(-1))
{
g->m_spoofed_peer_ids.erase(player->get_net_data()->m_host_token);
g.m_spoofed_peer_ids.erase(player->get_net_data()->m_host_token);
g_player_service->player_leave(player);
if (net_player_data)
{
if (g->notifications.player_leave.log)
if (g.notifications.player_leave.log)
LOG(INFO) << "Player left '" << net_player_data->m_name
<< "' freeing slot #" << (int)player->m_player_id
<< " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id;
if (g->notifications.player_leave.notify)
if (g.notifications.player_leave.notify)
g_notification_service->push("Player Left", std::format("{} freeing slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id));
}
@ -36,15 +36,15 @@ namespace big
g_player_service->player_join(player);
if (net_player_data)
{
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_is_session_started) // prevent loading screen spam
notify::player_joined(player);
if (g->notifications.player_join.log)
if (g.notifications.player_join.log)
LOG(INFO) << "Player joined '" << net_player_data->m_name
<< "' allocating slot #" << (int)player->m_player_id
<< " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id;
if (g->notifications.player_join.notify)
if (g.notifications.player_join.notify)
g_notification_service->push("Player Joined", std::format("{} taking slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id));
auto id = player->m_player_id;

View File

@ -6,9 +6,9 @@ namespace big
{
void hooks::network_player_mgr_init(CNetworkPlayerMgr* _this, std::uint64_t a2, std::uint32_t a3, std::uint32_t a4[4])
{
if (g->notifications.network_player_mgr_init.log)
if (g.notifications.network_player_mgr_init.log)
LOG(INFO) << "CNetworkPlayerMgr#init got called, we're probably entering a session.";
if (g->notifications.network_player_mgr_init.notify)
if (g.notifications.network_player_mgr_init.notify)
g_notification_service->push("Network Player Manager", "Entering session and initializing player data.");
g_hooking->get_original<hooks::network_player_mgr_init>()(_this, a2, a3, a4);
@ -18,12 +18,12 @@ namespace big
void hooks::network_player_mgr_shutdown(CNetworkPlayerMgr* _this)
{
g->m_spoofed_peer_ids.clear();
g.m_spoofed_peer_ids.clear();
g_player_service->do_cleanup();
if (g->notifications.network_player_mgr_shutdown.log)
if (g.notifications.network_player_mgr_shutdown.log)
LOG(INFO) << "CNetworkPlayerMgr#shutdown got called, we're probably leaving our session.";
if (g->notifications.network_player_mgr_shutdown.notify)
if (g.notifications.network_player_mgr_shutdown.notify)
g_notification_service->push("Network Player Manager", "Leaving session and cleaning up player data.");
g_hooking->get_original<hooks::network_player_mgr_shutdown>()(_this);

View File

@ -31,7 +31,7 @@ namespace big
{
bool hooks::add_player_to_session(rage::netConnectionManager* mgr, int receiver_msg_id, int* out_command_hndl, RemoteGamerInfoMsg* msg, int flags, void* unk)
{
if (msg->m_gamer_info.m_gamer_handle_2.m_rockstar_id == g_local_player->m_player_info->m_net_player_data.m_gamer_handle_2.m_rockstar_id && gta_util::get_network()->m_game_session_ptr->is_host() && g->protections.lessen_breakups)
if (msg->m_gamer_info.m_gamer_handle_2.m_rockstar_id == g_local_player->m_player_info->m_net_player_data.m_gamer_handle_2.m_rockstar_id && gta_util::get_network()->m_game_session_ptr->is_host() && g.protections.lessen_breakups)
{
std::uint64_t host_token = -1;
@ -46,7 +46,7 @@ namespace big
}
std::uint64_t peer_id = rand64bits();
g->m_spoofed_peer_ids.emplace(host_token, peer_id);
g.m_spoofed_peer_ids.emplace(host_token, peer_id);
msg->m_gamer_info.m_peer_id_2 = peer_id;
}

View File

@ -202,7 +202,7 @@ namespace big
bool hooks::can_apply_data(rage::netSyncTree* tree, rage::netObject* object)
{
if (tree->m_child_node_count && check_node(tree->m_sync_node, g->m_syncing_player, object))
if (tree->m_child_node_count && check_node(tree->m_sync_node, g.m_syncing_player, object))
{
return false;
}

View File

@ -20,10 +20,10 @@ namespace big
case RAGE_JOAAT("MPPLY_VC_HATE"):
const auto report = std::format("From: {}", sender->get_name());
if (g->notifications.reports.log)
if (g.notifications.reports.log)
LOG(INFO) << "Blocked report; " << report;
if (g->notifications.reports.notify)
if (g.notifications.reports.notify)
g_notification_service->push_warning("BLOCKED REPORT", report);
return true;

View File

@ -80,16 +80,16 @@ namespace big
if (spam::is_text_spam(message))
{
if (g->session.log_chat_messages)
if (g.session.log_chat_messages)
spam::log_chat(message, player, true);
player->is_spammer = true;
if (g->session.kick_chat_spammers)
if (g.session.kick_chat_spammers)
kick::breakup_kick(player);
return true;
}
else
{
if (g->session.log_chat_messages)
if (g.session.log_chat_messages)
spam::log_chat(message, player, false);
}
break;
@ -213,7 +213,7 @@ namespace big
CGameScriptId script;
script_id_deserialize(script, buffer);
if (script.m_hash == RAGE_JOAAT("freemode") && g->session.force_script_host)
if (script.m_hash == RAGE_JOAAT("freemode") && g.session.force_script_host)
return true;
break;

View File

@ -11,7 +11,7 @@ namespace big
return true;
}
g->m_syncing_player = src;
g.m_syncing_player = src;
return g_hooking->get_original<hooks::received_clone_create>()(mgr, src, dst, object_type, object_id, object_flag, buffer, timestamp);
}
}

View File

@ -17,7 +17,7 @@ namespace big
return eAckCode::ACKCODE_FAIL;
}
g->m_syncing_player = src;
g.m_syncing_player = src;
return g_hooking->get_original<received_clone_sync>()(mgr, src, dst, object_type, object_id, buffer, unk, timestamp);
}
}

View File

@ -181,7 +181,7 @@ namespace big
if (damageType == 3 && (damageFlags & (1 << 1)) == 0)
hitGlobalId = g_local_player ? g_local_player->m_net_object->m_object_id : 0;
if (g->session.damage_karma && g_local_player && g_local_player->m_net_object && (g_local_player->m_net_object->m_object_id == hitGlobalId || math::distance_between_vectors(localPos, *g_local_player->m_navigation->get_position()) < 1.5f))
if (g.session.damage_karma && g_local_player && g_local_player->m_net_object && (g_local_player->m_net_object->m_object_id == hitGlobalId || math::distance_between_vectors(localPos, *g_local_player->m_navigation->get_position()) < 1.5f))
{
int id = player->m_player_id;
g_fiber_pool->queue_job([id, hitComponent, overrideDefaultDamage, weaponType, weaponDamage, tyreIndex, suspensionIndex, damageFlags, actionResultName, actionResultId, f104, hitEntityWeapon, hitWeaponAmmoAttachment, silenced, hasImpactDir, impactDir, localPos]
@ -314,7 +314,7 @@ namespace big
return;
}
if (g->session.explosion_karma && g_local_player && math::distance_between_vectors({ posX, posY, posZ }, *g_local_player->m_navigation->get_position()) < 3.0f)
if (g.session.explosion_karma && g_local_player && math::distance_between_vectors({ posX, posY, posZ }, *g_local_player->m_navigation->get_position()) < 3.0f)
{
int id = player->m_player_id;
g_fiber_pool->queue_job([id, explosionType, damageScale, cameraShake, isAudible, isInvisible]
@ -355,9 +355,9 @@ namespace big
std::uint32_t player_bitfield = buffer->Read<uint32_t>(32);
if (player_bitfield & (1 << target_player->m_player_id))
{
if (g->notifications.received_event.kick_vote.log)
if (g.notifications.received_event.kick_vote.log)
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " is voting to kick us.";
if (g->notifications.received_event.kick_vote.notify)
if (g.notifications.received_event.kick_vote.notify)
g_notification_service->push_warning("Kick Vote", std::format("{} is voting to kick us.", source_player->get_name()));
}
buffer->Seek(0);
@ -421,9 +421,9 @@ namespace big
{
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
if (g->notifications.received_event.clear_ped_task.log)
if (g.notifications.received_event.clear_ped_task.log)
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " sent CLEAR_PED_TASKS event.";
if (g->notifications.received_event.clear_ped_task.notify)
if (g.notifications.received_event.clear_ped_task.notify)
g_notification_service->push_warning("Protections", std::format("{} tried to freeze player.", source_player->get_name()));
return;
@ -440,9 +440,9 @@ namespace big
{
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
if (g->notifications.received_event.clear_ped_task.log)
if (g.notifications.received_event.clear_ped_task.log)
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " sent RAGDOLL_REQUEST event.";
if (g->notifications.received_event.clear_ped_task.notify)
if (g.notifications.received_event.clear_ped_task.notify)
g_notification_service->push_warning("Protections", std::format("{} tried to ragdoll player.", source_player->get_name()));
return;
@ -463,9 +463,9 @@ namespace big
if (money >= 2000)
{
if (g->notifications.received_event.report_cash_spawn.log)
if (g.notifications.received_event.report_cash_spawn.log)
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " sent REPORT_CASH_SPAWN event.";
if (g->notifications.received_event.report_cash_spawn.notify)
if (g.notifications.received_event.report_cash_spawn.notify)
g_notification_service->push_warning("Protections", std::format("{} is spawning cash.", source_player->get_name()));
}
@ -474,9 +474,9 @@ namespace big
// player sending this event is a modder
case eNetworkEvents::REPORT_MYSELF_EVENT:
{
if (g->notifications.received_event.modder_detect.log)
if (g.notifications.received_event.modder_detect.log)
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " sent modder event.";
if (g->notifications.received_event.modder_detect.notify)
if (g.notifications.received_event.modder_detect.notify)
g_notification_service->push_warning("Protections", std::format("{} sent out a modder event.", source_player->get_name()));
if (auto plyr = g_player_service->get_by_id(source_player->m_player_id))
@ -491,9 +491,9 @@ namespace big
{
g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
if (g->notifications.received_event.request_control_event.log)
if (g.notifications.received_event.request_control_event.log)
LOG(INFO) << "RECEIVED_EVENT_HANDLER : " << source_player->get_name() << " requested control of player vehicle.";
if (g->notifications.received_event.request_control_event.notify)
if (g.notifications.received_event.request_control_event.notify)
g_notification_service->push_warning("Protections", std::format("Denied player control request from {}", source_player->get_name()));
return;
@ -610,7 +610,7 @@ namespace big
}
buffer->Seek(0);
g->m_syncing_player = source_player;
g.m_syncing_player = source_player;
break;
}
case eNetworkEvents::NETWORK_PLAY_SOUND_EVENT:

View File

@ -24,7 +24,7 @@ namespace big
const auto hash = static_cast<eRemoteEvent>(args[0]);
const auto player_name = player->get_name();
const auto& notify = g->notifications.script_event_handler;
const auto& notify = g.notifications.script_event_handler;
// detect pasted menus setting args[1] to something other than PLAYER_ID()
if (*(int*)&args[1] != player->m_player_id && player->m_player_id != -1)
@ -37,7 +37,7 @@ namespace big
switch (hash)
{
case eRemoteEvent::Bounty:
if (g->protections.script_events.bounty)
if (g.protections.script_events.bounty)
{
format_string(player_name, "Bounty", notify.bounty.log, notify.bounty.notify);
@ -45,7 +45,7 @@ namespace big
}
break;
case eRemoteEvent::CeoBan:
if (g->protections.script_events.ceo_ban)
if (g.protections.script_events.ceo_ban)
{
format_string(player_name, "Ceo Ban", notify.ceo_ban.log, notify.ceo_ban.notify);
@ -53,7 +53,7 @@ namespace big
}
break;
case eRemoteEvent::CeoKick:
if (g->protections.script_events.ceo_kick)
if (g.protections.script_events.ceo_kick)
{
format_string(player_name, "Ceo Kick", notify.ceo_kick.log, notify.ceo_kick.notify);
@ -61,7 +61,7 @@ namespace big
}
break;
case eRemoteEvent::CeoMoney:
if (g->protections.script_events.ceo_money)
if (g.protections.script_events.ceo_money)
{
format_string(player_name, "Ceo Money", notify.ceo_money.log, notify.ceo_money.notify);
@ -69,7 +69,7 @@ namespace big
}
break;
case eRemoteEvent::ClearWantedLevel:
if (g->protections.script_events.clear_wanted_level)
if (g.protections.script_events.clear_wanted_level)
{
format_string(player_name, "Clear Wanted Level", notify.clear_wanted_level.log, notify.clear_wanted_level.notify);
@ -78,7 +78,7 @@ namespace big
break;
case eRemoteEvent::Crash:
case eRemoteEvent::Crash2:
if (g->protections.script_events.crash)
if (g.protections.script_events.crash)
{
format_string(player_name, "TSE Crash", notify.crash.log, notify.crash.notify);
@ -91,7 +91,7 @@ namespace big
case eRemoteEvent::NotificationMoneyBanked:
case eRemoteEvent::NotificationMoneyRemoved:
case eRemoteEvent::NotificationMoneyStolen:
if (g->protections.script_events.fake_deposit)
if (g.protections.script_events.fake_deposit)
{
format_string(player_name, "Fake Deposit", notify.fake_deposit.log, notify.fake_deposit.notify);
@ -101,7 +101,7 @@ namespace big
}
break;
case eRemoteEvent::ForceMission:
if (g->protections.script_events.force_mission)
if (g.protections.script_events.force_mission)
{
format_string(player_name, "Force Mission", notify.force_mission.log, notify.force_mission.notify);
@ -109,7 +109,7 @@ namespace big
}
break;
case eRemoteEvent::GiveCollectible:
if (g->protections.script_events.switch_player_model)
if (g.protections.script_events.switch_player_model)
{
if (args[2] == 8)
{
@ -120,7 +120,7 @@ namespace big
}
break;
case eRemoteEvent::GtaBanner:
if (g->protections.script_events.gta_banner)
if (g.protections.script_events.gta_banner)
{
format_string(player_name, "GTA Banner", notify.gta_banner.log, notify.gta_banner.notify);
@ -128,13 +128,13 @@ namespace big
}
break;
case eRemoteEvent::MCTeleport:
if (g->protections.script_events.mc_teleport && args[3] <= 32)
if (g.protections.script_events.mc_teleport && args[3] <= 32)
{
format_string(player_name, "Remote Teleport", notify.mc_teleport.log, notify.mc_teleport.notify);
return true;
}
else if (g->protections.script_events.crash && args[3] > 32)
else if (g.protections.script_events.crash && args[3] > 32)
{
format_string(player_name, "TSE Crash", notify.crash.log, notify.crash.notify);
@ -142,7 +142,7 @@ namespace big
}
break;
case eRemoteEvent::PersonalVehicleDestroyed:
if (g->protections.script_events.personal_vehicle_destroyed)
if (g.protections.script_events.personal_vehicle_destroyed)
{
format_string(player_name, "Personal Vehicle Destroyed", notify.personal_vehicle_destroyed.log, notify.personal_vehicle_destroyed.notify);
@ -150,7 +150,7 @@ namespace big
}
break;
case eRemoteEvent::RemoteOffradar:
if (g->protections.script_events.remote_off_radar)
if (g.protections.script_events.remote_off_radar)
{
format_string(player_name, "Off Radar", notify.remote_off_radar.log, notify.remote_off_radar.notify);
@ -158,7 +158,7 @@ namespace big
}
break;
case eRemoteEvent::TSECommand:
if (g->protections.script_events.rotate_cam && static_cast<eRemoteEvent>(args[2]) == eRemoteEvent::TSECommandRotateCam)
if (g.protections.script_events.rotate_cam && static_cast<eRemoteEvent>(args[2]) == eRemoteEvent::TSECommandRotateCam)
{
format_string(player_name, "Rotate Cam", notify.rotate_cam.log, notify.rotate_cam.notify);
@ -166,7 +166,7 @@ namespace big
}
break;
case eRemoteEvent::SendToCayoPerico:
if (g->protections.script_events.send_to_location)
if (g.protections.script_events.send_to_location)
{
format_string(player_name, "Send to Cayo Perico", notify.send_to_location.log, notify.send_to_location.notify);
@ -174,7 +174,7 @@ namespace big
}
break;
case eRemoteEvent::SendToCutscene:
if (g->protections.script_events.send_to_cutscene)
if (g.protections.script_events.send_to_cutscene)
{
format_string(player_name, "Send to Cutscene", notify.send_to_cutscene.log, notify.send_to_cutscene.notify);
@ -191,7 +191,7 @@ namespace big
{
known_location = true;
if (g->protections.script_events.send_to_location)
if (g.protections.script_events.send_to_location)
{
format_string(player_name, "Send to Beach", notify.send_to_location.log, notify.send_to_location.notify);
@ -202,7 +202,7 @@ namespace big
{
known_location = true;
if (g->protections.script_events.send_to_location)
if (g.protections.script_events.send_to_location)
{
format_string(player_name, "Send to Cayo Perico", notify.send_to_location.log, notify.send_to_location.notify);
@ -220,7 +220,7 @@ namespace big
break;
}
case eRemoteEvent::SoundSpam:
if (g->protections.script_events.sound_spam)
if (g.protections.script_events.sound_spam)
{
format_string(player_name, "Sound Spamn", notify.sound_spam.log, notify.sound_spam.notify);
@ -228,7 +228,7 @@ namespace big
}
break;
case eRemoteEvent::Spectate:
if (g->protections.script_events.spectate)
if (g.protections.script_events.spectate)
{
format_string(player_name, "Spectate", notify.spectate.log, notify.spectate.notify);
@ -236,7 +236,7 @@ namespace big
}
break;
case eRemoteEvent::Teleport:
if (g->protections.script_events.force_teleport)
if (g.protections.script_events.force_teleport)
{
format_string(player_name, "Apartment Invite", notify.force_teleport.log, notify.force_teleport.notify);
@ -244,7 +244,7 @@ namespace big
}
break;
case eRemoteEvent::TransactionError:
if (g->protections.script_events.transaction_error)
if (g.protections.script_events.transaction_error)
{
format_string(player_name, "Transaction Error", notify.transaction_error.log, notify.transaction_error.notify);
@ -252,7 +252,7 @@ namespace big
}
break;
case eRemoteEvent::VehicleKick:
if (g->protections.script_events.vehicle_kick)
if (g.protections.script_events.vehicle_kick)
{
format_string(player_name, "Vehicle Kick", notify.vehicle_kick.log, notify.vehicle_kick.notify);
@ -260,7 +260,7 @@ namespace big
}
break;
case eRemoteEvent::ForceMission2:
if (g->protections.script_events.force_mission)
if (g.protections.script_events.force_mission)
{
format_string(player_name, "Force Mission", notify.force_mission.log, notify.force_mission.notify);
@ -268,7 +268,7 @@ namespace big
}
break;
case eRemoteEvent::NetworkBail:
if (g->protections.script_events.network_bail)
if (g.protections.script_events.network_bail)
{
if (auto plyr = g_player_service->get_by_id(player->m_player_id))
session::add_infraction(plyr, Infraction::TRIED_KICK_PLAYER);
@ -277,7 +277,7 @@ namespace big
}
break;
case eRemoteEvent::TeleportToWarehouse:
if (g->protections.script_events.teleport_to_warehouse)
if (g.protections.script_events.teleport_to_warehouse)
{
format_string(player_name, "Teleport To Warehouse", notify.teleport_to_warehouse.log, notify.teleport_to_warehouse.notify);
@ -287,7 +287,7 @@ namespace big
case eRemoteEvent::StartActivity:
{
eActivityType activity = static_cast<eActivityType>(args[2]);
if (g->protections.script_events.start_activity)
if (g.protections.script_events.start_activity)
{
if (activity == eActivityType::Survival || activity == eActivityType::Mission || activity == eActivityType::Deathmatch || activity == eActivityType::BaseJump || activity == eActivityType::Race)
{
@ -321,7 +321,7 @@ namespace big
}
// there are MANY more
}
else if (g->protections.script_events.crash && activity == eActivityType::Tennis)
else if (g.protections.script_events.crash && activity == eActivityType::Tennis)
{
format_string(player_name, "TSE Crash (Start Tennis)", notify.crash.log, notify.crash.notify);
@ -343,7 +343,7 @@ namespace big
break;
}
if (g->debug.logs.script_event.logs && (!g->debug.logs.script_event.filter_player || g->debug.logs.script_event.player_id == player->m_player_id))
if (g.debug.logs.script_event.logs && (!g.debug.logs.script_event.filter_player || g.debug.logs.script_event.player_id == player->m_player_id))
{
std::string script_args = "{ ";
for (std::size_t i = 0; i < scripted_game_event->m_args_size; i++)

View File

@ -43,7 +43,7 @@ namespace big
if (node->m_decor_count > 11)
{
notify::crash_blocked(g->m_syncing_player, "out of bounds decorator count");
notify::crash_blocked(g.m_syncing_player, "out of bounds decorator count");
return;
}

View File

@ -16,7 +16,7 @@ namespace big
data->SerializeDwordAlt(&node->m_num_items, 7);
if (node->m_num_items > 105)
{
notify::crash_blocked(g->m_syncing_player, "out of bounds inventory item count");
notify::crash_blocked(g.m_syncing_player, "out of bounds inventory item count");
return;
}
@ -31,7 +31,7 @@ namespace big
data->SerializeBool(&node->m_ammo_all_infinite);
if (node->m_num_ammos > 65)
{
notify::crash_blocked(g->m_syncing_player, "out of bounds inventory ammo count");
notify::crash_blocked(g.m_syncing_player, "out of bounds inventory ammo count");
return;
}

View File

@ -12,7 +12,7 @@ namespace big
info->m_prop_hash != RAGE_JOAAT("p_parachute_s")
)
{
notify::crash_blocked(g->m_syncing_player, "invalid parachute");
notify::crash_blocked(g.m_syncing_player, "invalid parachute");
info->m_prop_hash = 0;
}
}

View File

@ -29,7 +29,7 @@ namespace big
if (node->m_gadget_count > 2)
{
notify::crash_blocked(g->m_syncing_player, "out of bounds vehicle gadget count");
notify::crash_blocked(g.m_syncing_player, "out of bounds vehicle gadget count");
return;
}

View File

@ -5,7 +5,7 @@ namespace big
bool hooks::update_presence_attribute_int(void* presence_data, int profile_index, char* attr, std::uint64_t value)
{
auto hash = rage::joaat(attr);
if (g->protections.rid_join &&
if (g.protections.rid_join &&
(hash == RAGE_JOAAT("gstok") || hash == RAGE_JOAAT("gsid") || hash == RAGE_JOAAT("gstype") || hash == RAGE_JOAAT("gshost") || hash == RAGE_JOAAT("gsjoin")))
{
return true;
@ -17,7 +17,7 @@ namespace big
bool hooks::update_presence_attribute_string(void* presence_data, int profile_index, char* attr, char* value)
{
auto hash = rage::joaat(attr);
if (g->protections.rid_join && hash == RAGE_JOAAT("gsinfo"))
if (g.protections.rid_join && hash == RAGE_JOAAT("gsinfo"))
{
return true;
}

View File

@ -7,19 +7,19 @@ namespace big
{
const auto result = g_hooking->get_original<gta_thread_kill>()(thread);
if (g->notifications.gta_thread_kill.log)
if (g.notifications.gta_thread_kill.log)
LOG(INFO) << "Script Thread '" << thread->m_name << "' terminated.";
if (g->notifications.gta_thread_kill.notify)
if (g.notifications.gta_thread_kill.notify)
g_notification_service->push("Script Thread Termination", std::format("Script Thread '{}' terminated.", thread->m_name));
if (thread == g->m_hunt_the_beast_thread)
g->m_hunt_the_beast_thread = nullptr;
if (thread == g.m_hunt_the_beast_thread)
g.m_hunt_the_beast_thread = nullptr;
if (thread == g->m_dance_thread)
g->m_dance_thread = nullptr;
if (thread == g.m_dance_thread)
g.m_dance_thread = nullptr;
if (thread == g->m_mission_creator_thread)
g->m_mission_creator_thread = nullptr;
if (thread == g.m_mission_creator_thread)
g.m_mission_creator_thread = nullptr;
return result;
}

View File

@ -9,9 +9,9 @@ namespace big
if (const char* name = new_thread->m_name; strlen(name) > 0)
{
if (g->notifications.gta_thread_kill.log)
if (g.notifications.gta_thread_kill.log)
LOG(INFO) << "Script Thread '" << name << "' started.";
if (g->notifications.gta_thread_kill.notify)
if (g.notifications.gta_thread_kill.notify)
g_notification_service->push("Script Thread Startup", std::format("Script Thread '{}' started.", name));
}

View File

@ -7,7 +7,7 @@ namespace big
bool hooks::read_bitbuffer_gamer_handle(rage::datBitBuffer* buffer, rage::rlGamerHandle* handle)
{
bool result = g_hooking->get_original<hooks::read_bitbuffer_gamer_handle>()(buffer, handle);
if (g->spoofing.should_spoof_rockstar_id && handle->m_rockstar_id == g->spoofing.applied_spoof_rockstar_id)
if (g.spoofing.should_spoof_rockstar_id && handle->m_rockstar_id == g.spoofing.applied_spoof_rockstar_id)
handle->m_rockstar_id = g_pointers->m_profile_gamer_info->m_gamer_handle_2.m_rockstar_id;
return result;
}

View File

@ -19,39 +19,39 @@ namespace big
// check so we're 100% sure we modify data only for ourselves
if (is_local_player)
{
if (g->spoofing.spoof_username)
memcpy(player->m_name, g->spoofing.username.c_str(), sizeof(player->m_name));
if (g.spoofing.spoof_username)
memcpy(player->m_name, g.spoofing.username.c_str(), sizeof(player->m_name));
if (g->spoofing.spoof_ip)
if (g.spoofing.spoof_ip)
{
player->m_external_ip.m_field1 = g->spoofing.ip_address[0];
player->m_external_ip.m_field2 = g->spoofing.ip_address[1];
player->m_external_ip.m_field3 = g->spoofing.ip_address[2];
player->m_external_ip.m_field4 = g->spoofing.ip_address[3];
player->m_external_ip.m_field1 = g.spoofing.ip_address[0];
player->m_external_ip.m_field2 = g.spoofing.ip_address[1];
player->m_external_ip.m_field3 = g.spoofing.ip_address[2];
player->m_external_ip.m_field4 = g.spoofing.ip_address[3];
}
if (g->spoofing.should_spoof_rockstar_id)
if (g.spoofing.should_spoof_rockstar_id)
{
player->m_gamer_handle.m_rockstar_id = g->spoofing.applied_spoof_rockstar_id;
player->m_gamer_handle_2.m_rockstar_id = g->spoofing.applied_spoof_rockstar_id;
player->m_gamer_handle.m_rockstar_id = g.spoofing.applied_spoof_rockstar_id;
player->m_gamer_handle_2.m_rockstar_id = g.spoofing.applied_spoof_rockstar_id;
}
if (g->notifications.send_net_info_to_lobby.log)
if (g.notifications.send_net_info_to_lobby.log)
LOG(INFO) << "Sending spoofed values to session host";
if (g->notifications.send_net_info_to_lobby.notify)
if (g.notifications.send_net_info_to_lobby.notify)
g_notification_service->push("Player Info Spoofing", "Sent spoofed values to lobby host.");
}
else
{
if (g->session.name_spoof_enabled)
if (g.session.name_spoof_enabled)
{
if (g->session.advertise_menu)
if (g.session.advertise_menu)
{
memcpy(player->m_name, advertisments[rand() % advertisments.size()], sizeof(player->m_name));
}
else
{
memcpy(player->m_name, g->session.spoofed_name.c_str(), sizeof(player->m_name));
memcpy(player->m_name, g.session.spoofed_name.c_str(), sizeof(player->m_name));
}
}
}

View File

@ -5,14 +5,14 @@ namespace big
{
bool hooks::send_session_matchmaking_attributes(void* a1, rage::rlSessionInfo* info, std::uint64_t session_id, bool use_session_id, MatchmakingAttributes* attributes)
{
if (g->spoofing.spoof_session_region_type)
attributes->m_param_values[4] = g->spoofing.session_region_type;
if (g.spoofing.spoof_session_region_type)
attributes->m_param_values[4] = g.spoofing.session_region_type;
if (g->spoofing.spoof_session_language)
attributes->m_param_values[3] = g->spoofing.session_language;
if (g.spoofing.spoof_session_language)
attributes->m_param_values[3] = g.spoofing.session_language;
if (g->spoofing.spoof_session_player_count)
attributes->m_param_values[7] = g->spoofing.session_player_count;
if (g.spoofing.spoof_session_player_count)
attributes->m_param_values[7] = g.spoofing.session_player_count;
return g_hooking->get_original<hooks::send_session_matchmaking_attributes>()(a1, info, session_id, use_session_id, attributes);
}

View File

@ -8,9 +8,9 @@ namespace big
{
bool restore = false;
if (g->spoofing.should_spoof_rockstar_id && handle->m_rockstar_id == g_pointers->m_profile_gamer_info->m_gamer_handle_2.m_rockstar_id)
if (g.spoofing.should_spoof_rockstar_id && handle->m_rockstar_id == g_pointers->m_profile_gamer_info->m_gamer_handle_2.m_rockstar_id)
{
handle->m_rockstar_id = g->spoofing.applied_spoof_rockstar_id;
handle->m_rockstar_id = g.spoofing.applied_spoof_rockstar_id;
restore = true;
}

View File

@ -7,7 +7,7 @@ namespace big
{
auto ret = g_hooking->get_original<write_player_game_state_data_node>()(player, node);
if (g->spoofing.spoof_hide_god)
if (g.spoofing.spoof_hide_god)
{
node->m_is_invincible = false;
node->m_bullet_proof = false;
@ -19,7 +19,7 @@ namespace big
node->m_water_proof = false;
}
if (g->spoofing.spoof_hide_spectate)
if (g.spoofing.spoof_hide_spectate)
{
node->m_is_spectating = false;
node->m_spectating_net_id = 0;

View File

@ -7,7 +7,7 @@ namespace big
{
g_hooking->get_original<write_player_gamer_data_node>()(player, node);
if (g->spoofing.spoof_crew_data)
if (g.spoofing.spoof_crew_data)
{
node->m_clan_data.m_clan_member_id = 1;
node->m_clan_data.m_clan_id = 41564112;
@ -16,23 +16,23 @@ namespace big
node->m_clan_data.m_clan_member_count = 15;
node->m_clan_data.m_clan_created_time = 420;
strcpy(node->m_clan_data.m_clan_tag, g->spoofing.crew_tag.c_str());
node->m_clan_data.m_is_system_clan = g->spoofing.rockstar_crew;
node->m_clan_data.m_is_clan_open = g->spoofing.square_crew_tag;
strcpy(node->m_clan_data.m_clan_tag, g.spoofing.crew_tag.c_str());
node->m_clan_data.m_is_system_clan = g.spoofing.rockstar_crew;
node->m_clan_data.m_is_clan_open = g.spoofing.square_crew_tag;
if (g->spoofing.rockstar_crew)
if (g.spoofing.rockstar_crew)
{
strcpy(node->m_clan_data.m_clan_name, "Rockstar");
}
}
node->m_is_cheater = g->spoofing.spoof_cheater;
node->m_is_cheater = g.spoofing.spoof_cheater;
// spoof r* dev and qa only when spoofing rid because every player in the session will send metrics if you join with that enabled
if (g->spoofing.spoof_rockstar_id)
if (g.spoofing.spoof_rockstar_id)
{
node->m_is_rockstar_dev = g->spoofing.spoof_rockstar_dev;
node->m_is_rockstar_qa = g->spoofing.spoof_rockstar_qa;
node->m_is_rockstar_dev = g.spoofing.spoof_rockstar_dev;
node->m_is_rockstar_qa = g.spoofing.spoof_rockstar_qa;
}
}
}

View File

@ -18,13 +18,13 @@ namespace big
bool need_to_use_end_session_kick = g_player_service->m_player_to_use_end_session_kick &&
target->m_player_id == g_player_service->m_player_to_use_end_session_kick->get()->id() && _this->m_array == scr_globals::gsbd.as<void*>();
bool need_to_modify_wanted_level = g->session.wanted_level_all && (_this->m_array >= scr_globals::globalplayer_bd.as<uint8_t*>() &&
bool need_to_modify_wanted_level = g.session.wanted_level_all && (_this->m_array >= scr_globals::globalplayer_bd.as<uint8_t*>() &&
_this->m_array <= scr_globals::globalplayer_bd.at(31, scr_globals::size::globalplayer_bd).as<uint8_t*>());
bool need_to_turn_player_into_beast = g->m_hunt_the_beast_thread && g->m_hunt_the_beast_thread->m_stack && g->m_hunt_the_beast_thread->m_net_component &&
_this->m_array == script_local(g->m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).as<void*>();
bool need_to_turn_player_into_beast = g.m_hunt_the_beast_thread && g.m_hunt_the_beast_thread->m_stack && g.m_hunt_the_beast_thread->m_net_component &&
_this->m_array == script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).as<void*>();
bool need_to_randomize_replay_protection = g->session.block_ceo_money && _this->m_array == scr_globals::gsbd_fm_events.as<void*>();
bool need_to_randomize_replay_protection = g.session.block_ceo_money && _this->m_array == scr_globals::gsbd_fm_events.as<void*>();
if (need_to_use_end_session_kick)
{
@ -41,13 +41,13 @@ namespace big
if (need_to_turn_player_into_beast)
{
orig_player = *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_participant = *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_player = *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_participant = *script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(6).as<int*>();
*script_local(g->m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(6).as<int*>() = g->m_hunt_the_beast_thread->m_net_component->get_participant_index(target); // participant idx
*script_local(g->m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(7).as<Player*>() = target->m_player_id; // beast player idx
*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
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(6).as<int*>() = g.m_hunt_the_beast_thread->m_net_component->get_participant_index(target); // participant idx
*script_local(g.m_hunt_the_beast_thread->m_stack, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(7).as<Player*>() = target->m_player_id; // beast player idx
*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();
}
@ -74,8 +74,8 @@ namespace big
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;
*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();
}

View File

@ -46,10 +46,6 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
base_dir /= "BigBaseV2";
auto file_manager_instance = std::make_unique<file_manager>(base_dir);
auto globals_instance = std::make_unique<menu_settings>(
file_manager_instance->get_project_file("./settings.json")
);
auto logger_instance = std::make_unique<logger>(
"YimMenu",
file_manager_instance->get_project_file("./cout.log")
@ -62,7 +58,11 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
LOG(INFO) << "Yim's Menu Initializing";
LOGF(INFO, "Git Info\n\tBranch:\t%s\n\tHash:\t%s\n\tDate:\t%s", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE);
g->load();
auto thread_pool_instance = std::make_unique<thread_pool>();
LOG(INFO) << "Thread pool initialized.";
g.init(
file_manager_instance->get_project_file("./settings.json"));
LOG(INFO) << "Settings Loaded.";
auto pointers_instance = std::make_unique<pointers>();
@ -78,9 +78,6 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
auto hooking_instance = std::make_unique<hooking>();
LOG(INFO) << "Hooking initialized.";
auto thread_pool_instance = std::make_unique<thread_pool>();
LOG(INFO) << "Thread pool initialized.";
auto context_menu_service_instance = std::make_unique<context_menu_service>();
auto custom_text_service_instance = std::make_unique<custom_text_service>();
auto globals_service_instace = std::make_unique<globals_service>();
@ -141,8 +138,6 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
thread_pool_instance->destroy();
LOG(INFO) << "Destroyed thread pool.";
thread_pool_instance.reset();
LOG(INFO) << "Thread pool uninitialized.";
hotkey_service_instance.reset();
LOG(INFO) << "Hotkey Service reset.";
@ -187,6 +182,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
pointers_instance.reset();
LOG(INFO) << "Pointers uninitialized.";
thread_pool_instance.reset();
LOG(INFO) << "Thread pool uninitialized.";
}
catch (std::exception const& ex)
{
@ -197,8 +195,6 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
logger_instance->destroy();
logger_instance.reset();
globals_instance.reset();
file_manager_instance.reset();
CloseHandle(g_main_thread);

View File

@ -16,7 +16,7 @@ namespace big
bool return_value = DLC::IS_DLC_PRESENT(hash);
if (hash == 0x96F02EE6)
return_value = return_value || g->settings.dev_dlc;
return_value = return_value || g.settings.dev_dlc;
src->set_return_value(return_value);
}

Some files were not shown because too many files have changed in this diff Show More