From 0c21b74825df17fd0e99002ed663a66460bc63e4 Mon Sep 17 00:00:00 2001 From: Yimura Date: Tue, 22 Feb 2022 01:18:49 +0100 Subject: [PATCH] feat(Globals): Simplified code, sorry to anyone who has to update their code --- BigBaseV2/src/backend/backend.cpp | 2 +- .../src/backend/looped/player/spectate.cpp | 4 +- .../src/backend/looped/self/frame_flags.cpp | 8 +- .../src/backend/looped/self/free_cam.cpp | 6 +- BigBaseV2/src/backend/looped/self/godmode.cpp | 6 +- .../src/backend/looped/self/no_ragdoll.cpp | 8 +- BigBaseV2/src/backend/looped/self/noclip.cpp | 2 +- .../src/backend/looped/self/off_radar.cpp | 4 +- BigBaseV2/src/backend/looped/self/police.cpp | 6 +- .../src/backend/looped/self/super_run.cpp | 6 +- .../src/backend/looped/system/screen_size.cpp | 2 +- .../backend/looped/tunables/disable_phone.cpp | 2 +- .../backend/looped/tunables/no_idle_kick.cpp | 2 +- .../src/backend/looped/vehicle/horn_boost.cpp | 2 +- .../src/backend/looped/vehicle/ls_customs.cpp | 10 +- .../backend/looped/vehicle/speedo_meter.cpp | 8 +- .../backend/looped/vehicle/vehicle_god.cpp | 6 +- .../src/backend/looped/weapons/cage_gun.cpp | 2 +- .../src/backend/looped/weapons/delete_gun.cpp | 2 +- .../backend/looped/weapons/gravity_gun.cpp | 2 +- .../backend/looped/weapons/infinite_ammo.cpp | 2 +- .../backend/looped/weapons/infinite_mag.cpp | 4 +- .../src/backend/looped/weapons/repair_gun.cpp | 2 +- .../looped/weapons/steal_vehicle_gun.cpp | 2 +- .../backend/looped/weapons/vehicle_gun.cpp | 4 +- BigBaseV2/src/core/data/session_types.hpp | 35 +- BigBaseV2/src/core/globals.hpp | 805 +++++++++--------- BigBaseV2/src/gui/window/dbg/debug_debug.cpp | 2 +- BigBaseV2/src/gui/window/main/tab_mobile.cpp | 4 +- .../src/gui/window/main/tab_recovery.cpp | 4 +- BigBaseV2/src/gui/window/main/tab_self.cpp | 30 +- .../src/gui/window/main/tab_settings.cpp | 44 +- .../src/gui/window/main/tab_spoofing.cpp | 16 +- .../src/gui/window/main/tab_tunables.cpp | 4 +- BigBaseV2/src/gui/window/main/tab_vehicle.cpp | 22 +- BigBaseV2/src/gui/window/main/tab_weapons.cpp | 10 +- .../src/gui/window/player/player_info.cpp | 2 +- BigBaseV2/src/gui/window/window_debug.cpp | 2 +- BigBaseV2/src/gui/window/window_handling.cpp | 2 +- BigBaseV2/src/gui/window/window_main.cpp | 2 +- BigBaseV2/src/gui/window/window_player.cpp | 2 +- BigBaseV2/src/gui/window/window_top_bar.cpp | 8 +- BigBaseV2/src/gui/window/window_users.cpp | 10 +- BigBaseV2/src/hooks/gta_thread_kill.cpp | 2 +- BigBaseV2/src/hooks/gta_thread_tick.cpp | 6 +- BigBaseV2/src/hooks/script_event_handler.cpp | 40 +- .../src/hooks/send_net_info_to_lobby.cpp | 20 +- BigBaseV2/src/main.cpp | 11 +- BigBaseV2/src/native_hooks/carmod_shop.hpp | 6 +- BigBaseV2/src/renderer.cpp | 8 +- BigBaseV2/src/util/mobile.hpp | 2 +- BigBaseV2/src/util/player.hpp | 4 +- 52 files changed, 609 insertions(+), 598 deletions(-) diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index faa03522..df51fd4e 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -10,7 +10,7 @@ namespace big { void backend::loop() { - g.attempt_save(); + g->attempt_save(); QUEUE_JOB_BEGIN_CLAUSE() { looped::system_screen_size(); diff --git a/BigBaseV2/src/backend/looped/player/spectate.cpp b/BigBaseV2/src/backend/looped/player/spectate.cpp index 0a45fad9..e65d4995 100644 --- a/BigBaseV2/src/backend/looped/player/spectate.cpp +++ b/BigBaseV2/src/backend/looped/player/spectate.cpp @@ -9,9 +9,9 @@ namespace big void looped::player_specate() { - 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) { diff --git a/BigBaseV2/src/backend/looped/self/frame_flags.cpp b/BigBaseV2/src/backend/looped/self/frame_flags.cpp index b581ce21..6943c31b 100644 --- a/BigBaseV2/src/backend/looped/self/frame_flags.cpp +++ b/BigBaseV2/src/backend/looped/self/frame_flags.cpp @@ -17,16 +17,16 @@ namespace big uint32_t& flags = g_local_player->m_player_info->m_frame_flags; - if (g.self.frame_flags.explosive_ammo) + if (g->self.frame_flags.explosive_ammo) flags |= eFrameFlagExplosiveAmmo; - if (g.self.frame_flags.explosive_melee) + if (g->self.frame_flags.explosive_melee) flags |= eFrameFlagExplosiveMelee; - if (g.self.frame_flags.fire_ammo) + if (g->self.frame_flags.fire_ammo) flags |= eFrameFlagFireAmmo; - if (g.self.frame_flags.super_jump) + if (g->self.frame_flags.super_jump) flags |= eFrameFlagSuperJump; } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/self/free_cam.cpp b/BigBaseV2/src/backend/looped/self/free_cam.cpp index 780f80f8..68106449 100644 --- a/BigBaseV2/src/backend/looped/self/free_cam.cpp +++ b/BigBaseV2/src/backend/looped/self/free_cam.cpp @@ -18,9 +18,9 @@ namespace big if (g_local_player == nullptr) return; Entity ent = PLAYER::PLAYER_PED_ID(); - 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); @@ -34,7 +34,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); diff --git a/BigBaseV2/src/backend/looped/self/godmode.cpp b/BigBaseV2/src/backend/looped/self/godmode.cpp index 3ec1356b..aecdabaf 100644 --- a/BigBaseV2/src/backend/looped/self/godmode.cpp +++ b/BigBaseV2/src/backend/looped/self/godmode.cpp @@ -7,13 +7,13 @@ namespace big void looped::self_godmode() { - bool bGodMode = g.self.godmode; + bool bGodMode = g->self.godmode; if (bGodMode || (!bGodMode && bGodMode != bLastGodMode)) { - ENTITY::SET_ENTITY_INVINCIBLE(PLAYER::PLAYER_PED_ID(), g.self.godmode); + ENTITY::SET_ENTITY_INVINCIBLE(PLAYER::PLAYER_PED_ID(), g->self.godmode); - bLastGodMode = g.self.godmode; + bLastGodMode = g->self.godmode; } } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp b/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp index 289aae81..24b1fd2a 100644 --- a/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp +++ b/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp @@ -7,10 +7,10 @@ namespace big { Ped player = PLAYER::PLAYER_PED_ID(); - if (g.self.no_ragdoll) { - PED::SET_PED_CAN_RAGDOLL(player, !g.self.no_ragdoll); - PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !g.self.no_ragdoll); - PED::SET_PED_RAGDOLL_ON_COLLISION(player, !g.self.no_ragdoll); + if (g->self.no_ragdoll) { + PED::SET_PED_CAN_RAGDOLL(player, !g->self.no_ragdoll); + PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !g->self.no_ragdoll); + PED::SET_PED_RAGDOLL_ON_COLLISION(player, !g->self.no_ragdoll); } } diff --git a/BigBaseV2/src/backend/looped/self/noclip.cpp b/BigBaseV2/src/backend/looped/self/noclip.cpp index d49fb36a..4e0c0671 100644 --- a/BigBaseV2/src/backend/looped/self/noclip.cpp +++ b/BigBaseV2/src/backend/looped/self/noclip.cpp @@ -16,7 +16,7 @@ namespace big static Vector3 rot{}; void looped::self_noclip() { - bool bNoclip = g.self.noclip; + bool bNoclip = g->self.noclip; Entity ent = PLAYER::PLAYER_PED_ID(); bool bInVehicle = PED::IS_PED_IN_ANY_VEHICLE(ent, true); diff --git a/BigBaseV2/src/backend/looped/self/off_radar.cpp b/BigBaseV2/src/backend/looped/self/off_radar.cpp index dee8ece4..33249321 100644 --- a/BigBaseV2/src/backend/looped/self/off_radar.cpp +++ b/BigBaseV2/src/backend/looped/self/off_radar.cpp @@ -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); } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/self/police.cpp b/BigBaseV2/src/backend/looped/self/police.cpp index a3061b76..00166cb5 100644 --- a/BigBaseV2/src/backend/looped/self/police.cpp +++ b/BigBaseV2/src/backend/looped/self/police.cpp @@ -8,9 +8,9 @@ namespace big auto playerInfo = g_local_player->m_player_info; - if (g.self.never_wanted) + if (g->self.never_wanted) playerInfo->m_wanted_level = 0; - else if (g.self.force_wanted_level) - playerInfo->m_wanted_level = g.self.wanted_level; + else if (g->self.force_wanted_level) + playerInfo->m_wanted_level = g->self.wanted_level; } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/self/super_run.cpp b/BigBaseV2/src/backend/looped/self/super_run.cpp index e8e3d567..27204809 100644 --- a/BigBaseV2/src/backend/looped/self/super_run.cpp +++ b/BigBaseV2/src/backend/looped/self/super_run.cpp @@ -11,7 +11,7 @@ namespace big void looped::self_super_run() { - if (g.self.super_run && PAD::IS_CONTROL_PRESSED(0, 21)) + if (g->self.super_run && PAD::IS_CONTROL_PRESSED(0, 21)) { if (run_speed < run_cap) run_speed += .5f; @@ -39,7 +39,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; } @@ -49,6 +49,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; } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/system/screen_size.cpp b/BigBaseV2/src/backend/looped/system/screen_size.cpp index 41faedbd..21d49796 100644 --- a/BigBaseV2/src/backend/looped/system/screen_size.cpp +++ b/BigBaseV2/src/backend/looped/system/screen_size.cpp @@ -7,6 +7,6 @@ namespace big { void looped::system_screen_size() { - GRAPHICS::GET_ACTIVE_SCREEN_RESOLUTION_(&g.window.x, &g.window.y); + GRAPHICS::GET_ACTIVE_SCREEN_RESOLUTION_(&g->window.x, &g->window.y); } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/tunables/disable_phone.cpp b/BigBaseV2/src/backend/looped/tunables/disable_phone.cpp index 2a92944c..f32aa9a4 100644 --- a/BigBaseV2/src/backend/looped/tunables/disable_phone.cpp +++ b/BigBaseV2/src/backend/looped/tunables/disable_phone.cpp @@ -5,6 +5,6 @@ namespace big { void looped::tunables_disable_phone() { - *script_global(19937).as() = g.tunables.disable_phone; + *script_global(19937).as() = g->tunables.disable_phone; } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/tunables/no_idle_kick.cpp b/BigBaseV2/src/backend/looped/tunables/no_idle_kick.cpp index 0ce30ed5..87429925 100644 --- a/BigBaseV2/src/backend/looped/tunables/no_idle_kick.cpp +++ b/BigBaseV2/src/backend/looped/tunables/no_idle_kick.cpp @@ -5,7 +5,7 @@ namespace big { void looped::tunables_no_idle_kick() { - if (g.tunables.no_idle_kick) + if (g->tunables.no_idle_kick) { *script_global(1644209).at(1149).as() = 0; *script_global(1644209).at(1165).as() = 0; diff --git a/BigBaseV2/src/backend/looped/vehicle/horn_boost.cpp b/BigBaseV2/src/backend/looped/vehicle/horn_boost.cpp index c6a6f561..414d0a28 100644 --- a/BigBaseV2/src/backend/looped/vehicle/horn_boost.cpp +++ b/BigBaseV2/src/backend/looped/vehicle/horn_boost.cpp @@ -7,7 +7,7 @@ namespace big { void looped::vehicle_horn_boost() { - if (!g.vehicle.horn_boost) return; + if (!g->vehicle.horn_boost) return; if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN)) { diff --git a/BigBaseV2/src/backend/looped/vehicle/ls_customs.cpp b/BigBaseV2/src/backend/looped/vehicle/ls_customs.cpp index 61cc5b0d..db14dd58 100644 --- a/BigBaseV2/src/backend/looped/vehicle/ls_customs.cpp +++ b/BigBaseV2/src/backend/looped/vehicle/ls_customs.cpp @@ -16,7 +16,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); @@ -24,19 +24,19 @@ namespace big *script_local(carmod_shop_thread, 726).at(11).as() != 4 ) { - g.vehicle.ls_customs = false; + g->vehicle.ls_customs = false; *script_local(carmod_shop_thread, 726).as() = 1; // cleanup } } - if (g.vehicle.ls_customs && g.vehicle.ls_customs != state) + if (g->vehicle.ls_customs && g->vehicle.ls_customs != state) { Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()); if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false)) { busy = false; - g.vehicle.ls_customs = false; + g->vehicle.ls_customs = false; notify::above_map("You aren't in a vehicle."); @@ -65,6 +65,6 @@ namespace big } busy = false; - state = g.vehicle.ls_customs; + state = g->vehicle.ls_customs; } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/vehicle/speedo_meter.cpp b/BigBaseV2/src/backend/looped/vehicle/speedo_meter.cpp index 53f72058..c1abe1a8 100644 --- a/BigBaseV2/src/backend/looped/vehicle/speedo_meter.cpp +++ b/BigBaseV2/src/backend/looped/vehicle/speedo_meter.cpp @@ -6,7 +6,7 @@ namespace big { void looped::vehicle_speedo_meter() { - SpeedoMeter speedo_type = g.vehicle.speedo_meter.type; + SpeedoMeter speedo_type = g->vehicle.speedo_meter.type; if (speedo_type == SpeedoMeter::DISABLED || HUD::IS_PAUSE_MENU_ACTIVE() || HUD::IS_WARNING_MESSAGE_ACTIVE() || CAM::IS_SCREEN_FADED_OUT() || CAM::IS_SCREEN_FADING_OUT() || CAM::IS_SCREEN_FADING_IN()) return; @@ -28,20 +28,20 @@ namespace big break; } - sprintf(speed, "%*d", g.vehicle.speedo_meter.left_side ? 0 : 3, (int)veh_speed); + sprintf(speed, "%*d", g->vehicle.speedo_meter.left_side ? 0 : 3, (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); - HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g.vehicle.speedo_meter.x, g.vehicle.speedo_meter.y + .04f, 1); + HUD::END_TEXT_COMMAND_DISPLAY_TEXT(g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y + .04f, 1); HUD::SET_TEXT_FONT(2); HUD::SET_TEXT_SCALE(.91f, .91f); 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); } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp b/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp index f3e8b07f..1fa91e95 100644 --- a/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp +++ b/BigBaseV2/src/backend/looped/vehicle/vehicle_god.cpp @@ -6,10 +6,10 @@ namespace big static bool last_veh_god = false; void looped::vehicle_god_mode() { - if ((!g.vehicle.god_mode && last_veh_god == g.vehicle.god_mode) || g_local_player == nullptr || g_local_player->m_vehicle == nullptr) + if ((!g->vehicle.god_mode && last_veh_god == g->vehicle.god_mode) || g_local_player == nullptr || g_local_player->m_vehicle == nullptr) return; - if (g.vehicle.god_mode && g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING) + if (g->vehicle.god_mode && g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING) { g_local_player->m_vehicle->m_deform_god = 0x8C; misc::set_bit((int*)&g_local_player->m_vehicle->m_damage_bits, 8); @@ -20,6 +20,6 @@ namespace big misc::clear_bit((int*)&g_local_player->m_vehicle->m_damage_bits, 8); } - last_veh_god = g.vehicle.god_mode; + last_veh_god = g->vehicle.god_mode; } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/weapons/cage_gun.cpp b/BigBaseV2/src/backend/looped/weapons/cage_gun.cpp index ee16a67d..e934b78d 100644 --- a/BigBaseV2/src/backend/looped/weapons/cage_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/cage_gun.cpp @@ -9,7 +9,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) { diff --git a/BigBaseV2/src/backend/looped/weapons/delete_gun.cpp b/BigBaseV2/src/backend/looped/weapons/delete_gun.cpp index 85854ddb..6d517cff 100644 --- a/BigBaseV2/src/backend/looped/weapons/delete_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/delete_gun.cpp @@ -10,7 +10,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) { diff --git a/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp b/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp index 98a04bd6..4a4de403 100644 --- a/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp @@ -16,7 +16,7 @@ namespace big void looped::weapons_gravity_gun() { - bool bGravityGun = g.weapons.custom_weapon == CustomWeapon::GRAVITY_GUN; + bool bGravityGun = g->weapons.custom_weapon == CustomWeapon::GRAVITY_GUN; double multiplier = 3.0; // ZOOMED IN diff --git a/BigBaseV2/src/backend/looped/weapons/infinite_ammo.cpp b/BigBaseV2/src/backend/looped/weapons/infinite_ammo.cpp index ce885025..4c2e9c52 100644 --- a/BigBaseV2/src/backend/looped/weapons/infinite_ammo.cpp +++ b/BigBaseV2/src/backend/looped/weapons/infinite_ammo.cpp @@ -6,7 +6,7 @@ namespace big { void looped::weapons_infinite_ammo() { - if (g.weapons.infinite_ammo) { + if (g->weapons.infinite_ammo) { Hash weaponHash; auto const ped = PLAYER::PLAYER_PED_ID(); diff --git a/BigBaseV2/src/backend/looped/weapons/infinite_mag.cpp b/BigBaseV2/src/backend/looped/weapons/infinite_mag.cpp index efd6ca54..5c2675b2 100644 --- a/BigBaseV2/src/backend/looped/weapons/infinite_mag.cpp +++ b/BigBaseV2/src/backend/looped/weapons/infinite_mag.cpp @@ -5,8 +5,8 @@ namespace big { void looped::weapons_infinite_mag() { - if (g.weapons.infinite_mag) { - WEAPON::SET_PED_INFINITE_AMMO_CLIP(PLAYER::PLAYER_PED_ID(), g.weapons.infinite_mag); + if (g->weapons.infinite_mag) { + WEAPON::SET_PED_INFINITE_AMMO_CLIP(PLAYER::PLAYER_PED_ID(), g->weapons.infinite_mag); } } } \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/weapons/repair_gun.cpp b/BigBaseV2/src/backend/looped/weapons/repair_gun.cpp index 57495b38..3d12f36d 100644 --- a/BigBaseV2/src/backend/looped/weapons/repair_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/repair_gun.cpp @@ -10,7 +10,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) { diff --git a/BigBaseV2/src/backend/looped/weapons/steal_vehicle_gun.cpp b/BigBaseV2/src/backend/looped/weapons/steal_vehicle_gun.cpp index 93f58f27..dc9b8ee7 100644 --- a/BigBaseV2/src/backend/looped/weapons/steal_vehicle_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/steal_vehicle_gun.cpp @@ -10,7 +10,7 @@ namespace big void looped::weapons_steal_vehicle_gun() { - bool bStealVehicleGun = g.weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; + bool bStealVehicleGun = g->weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; if (bStealVehicleGun) { diff --git a/BigBaseV2/src/backend/looped/weapons/vehicle_gun.cpp b/BigBaseV2/src/backend/looped/weapons/vehicle_gun.cpp index 981967ba..42ed5337 100644 --- a/BigBaseV2/src/backend/looped/weapons/vehicle_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/vehicle_gun.cpp @@ -9,7 +9,7 @@ namespace big void looped::weapons_vehicle_gun() { - bool bVehicleGun = g.weapons.custom_weapon == CustomWeapon::VEHICLE_GUN; + bool bVehicleGun = g->weapons.custom_weapon == CustomWeapon::VEHICLE_GUN; if (bVehicleGun) { @@ -35,7 +35,7 @@ namespace big location.y += dist * sin(yaw) * cos(pitch); location.z += dist * sin(pitch); Vehicle veh = vehicle::spawn( - (const char*)g.weapons.vehicle_gun_model, + (const char*)g->weapons.vehicle_gun_model, location, ENTITY::GET_ENTITY_HEADING(player) ); diff --git a/BigBaseV2/src/core/data/session_types.hpp b/BigBaseV2/src/core/data/session_types.hpp index 141aca34..f62882b9 100644 --- a/BigBaseV2/src/core/data/session_types.hpp +++ b/BigBaseV2/src/core/data/session_types.hpp @@ -1,20 +1,23 @@ #pragma once #include "core/enums.hpp" -struct SessionType { - eSessionType id; - const char name[22]; -}; +namespace big +{ + struct SessionType { + eSessionType id; + const char name[22]; + }; -const SessionType sessions[] = { - { eSessionType::JOIN_PUBLIC, "Join Public Session" }, - { eSessionType::NEW_PUBLIC, "New Public Session" }, - { eSessionType::CLOSED_CREW, "Closed Crew Session" }, - { eSessionType::CREW, "Crew Session" }, - { eSessionType::CLOSED_FRIENDS, "Closed Friend Session" }, - { eSessionType::FIND_FRIEND, "Find Friend Session" }, - { eSessionType::SOLO, "Solo Session" }, - { eSessionType::INVITE_ONLY, "Invite Only Session" }, - { eSessionType::JOIN_CREW, "Join Crew Session" }, - { eSessionType::LEAVE_ONLINE, "Leave GTA Online" } -}; \ No newline at end of file + const SessionType sessions[] = { + { eSessionType::JOIN_PUBLIC, "Join Public Session" }, + { eSessionType::NEW_PUBLIC, "New Public Session" }, + { eSessionType::CLOSED_CREW, "Closed Crew Session" }, + { eSessionType::CREW, "Crew Session" }, + { eSessionType::CLOSED_FRIENDS, "Closed Friend Session" }, + { eSessionType::FIND_FRIEND, "Find Friend Session" }, + { eSessionType::SOLO, "Solo Session" }, + { eSessionType::INVITE_ONLY, "Invite Only Session" }, + { eSessionType::JOIN_CREW, "Join Crew Session" }, + { eSessionType::LEAVE_ONLINE, "Leave GTA Online" } + }; +} \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 247cf691..787ffe08 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -1,448 +1,451 @@ #pragma once #include "enums.hpp" +#include "file_manager.hpp" -#ifndef GLOBALS_H -#define GLOBALS_H +namespace big +{ + class menu_settings; + inline menu_settings* g{}; -using namespace big; -struct globals { - nlohmann::json default_options; - nlohmann::json options; + class menu_settings { + nlohmann::json default_options; + nlohmann::json options; - struct debug { - bool script_event_logging = false; - }; - - struct tunables { - bool disable_phone = false; - bool no_idle_kick = false; - }; - - struct player { - int character_slot = 1; - int set_level = 130; - bool spectating = false; - }; - - struct protections { - struct script_events { - bool bounty = true; - bool ceo_ban = true; - bool ceo_kick = true; - bool ceo_money = true; - bool clear_wanted_level = true; - bool fake_deposit = true; - bool force_mission = true; - bool force_teleport = true; - bool gta_banner = true; - bool network_bail = true; - bool personal_vehicle_destroyed = true; - bool remote_off_radar = true; - bool rotate_cam = true; - bool send_to_cutscene = true; - bool send_to_island = true; - bool sound_spam = true; - bool spectate = true; - bool transaction_error = true; - bool vehicle_kick = true; + struct debug { + bool script_event_logging = false; }; - bool freemode_terminated = false; - - script_events script_events{}; - }; - - struct self { - struct frame_flags { - bool explosive_ammo = false; - bool explosive_melee = false; - bool fire_ammo = false; - bool super_jump = false; + struct tunables { + bool disable_phone = false; + bool no_idle_kick = false; }; - bool godmode = false; - bool free_cam = false; - bool off_radar = false; - bool never_wanted = false; - bool noclip = false; - bool no_ragdoll = false; - bool super_run = false; - bool force_wanted_level = false; - int wanted_level = 0; - - frame_flags frame_flags{}; - }; - - struct settings { - struct hotkeys - { - bool editing_menu_toggle = false; - int menu_toggle = VK_INSERT; - int teleport_waypoint = 0; + struct player { + int character_slot = 1; + int set_level = 130; + bool spectating = false; }; - hotkeys hotkeys{}; - }; + struct protections { + struct script_events { + bool bounty = true; + bool ceo_ban = true; + bool ceo_kick = true; + bool ceo_money = true; + bool clear_wanted_level = true; + bool fake_deposit = true; + bool force_mission = true; + bool force_teleport = true; + bool gta_banner = true; + bool network_bail = true; + bool personal_vehicle_destroyed = true; + bool remote_off_radar = true; + bool rotate_cam = true; + bool send_to_cutscene = true; + bool send_to_island = true; + bool sound_spam = true; + bool spectate = true; + bool transaction_error = true; + bool vehicle_kick = true; + }; - struct spoofing - { - bool spoof_username = false; - std::string username = ""; + bool freemode_terminated = false; - bool spoof_ip = true; - int ip_address[4] = { 42, 42, 42, 42}; - - bool spoof_rockstar_id = false; - uint64_t rockstar_id = 0; - }; - - struct vehicle { - struct speedo_meter { - SpeedoMeter type = SpeedoMeter::DISABLED; - - float x = .9f; - float y = .72f; - - bool left_side = false; + script_events script_events{}; }; - bool god_mode = false; - bool horn_boost = false; - bool ls_customs = false; // don't save this to disk - bool pv_teleport_into = false; - speedo_meter speedo_meter{}; - }; + struct self { + struct frame_flags { + bool explosive_ammo = false; + bool explosive_melee = false; + bool fire_ammo = false; + bool super_jump = false; + }; - struct weapons { - CustomWeapon custom_weapon = CustomWeapon::NONE; - char vehicle_gun_model[12] = "bus"; - bool infinite_ammo = false; - bool infinite_mag = false; - }; + bool godmode = false; + bool free_cam = false; + bool off_radar = false; + bool never_wanted = false; + bool noclip = false; + bool no_ragdoll = false; + bool super_run = false; + bool force_wanted_level = false; + int wanted_level = 0; - struct window { - bool debug = false; - bool handling = false; - bool log = false; - bool main = true; - bool users = true; - bool player = false; + frame_flags frame_flags{}; + }; - int x; - int y; - }; - - int friend_count = 0; - int player_count = 0; - - debug debug{}; - tunables tunables{}; - player player{}; - protections protections{}; - self self{}; - settings settings{}; - spoofing spoofing{}; - vehicle vehicle{}; - weapons weapons{}; - window window{}; - - void from_json(const nlohmann::json& j) - { - this->debug.script_event_logging = j["debug"]["script_event_logging"]; - - this->protections.script_events.bounty = j["protections"]["script_events"]["bounty"]; - this->protections.script_events.ceo_ban = j["protections"]["script_events"]["ceo_ban"]; - this->protections.script_events.ceo_kick = j["protections"]["script_events"]["ceo_kick"]; - this->protections.script_events.ceo_money = j["protections"]["script_events"]["ceo_money"]; - this->protections.script_events.clear_wanted_level = j["protections"]["script_events"]["clear_wanted_level"]; - this->protections.script_events.fake_deposit = j["protections"]["script_events"]["fake_deposit"]; - this->protections.script_events.force_mission = j["protections"]["script_events"]["force_mission"]; - this->protections.script_events.force_teleport = j["protections"]["script_events"]["force_teleport"]; - this->protections.script_events.gta_banner = j["protections"]["script_events"]["gta_banner"]; - this->protections.script_events.network_bail = j["protections"]["script_events"]["network_bail"]; - this->protections.script_events.personal_vehicle_destroyed = j["protections"]["script_events"]["personal_vehicle_destroyed"]; - this->protections.script_events.remote_off_radar = j["protections"]["script_events"]["remote_off_radar"]; - this->protections.script_events.rotate_cam = j["protections"]["script_events"]["rotate_cam"]; - this->protections.script_events.send_to_cutscene = j["protections"]["script_events"]["send_to_cutscene"]; - this->protections.script_events.send_to_island = j["protections"]["script_events"]["send_to_island"]; - this->protections.script_events.sound_spam = j["protections"]["script_events"]["sound_spam"]; - this->protections.script_events.spectate = j["protections"]["script_events"]["spectate"]; - this->protections.script_events.transaction_error = j["protections"]["script_events"]["transaction_error"]; - this->protections.script_events.vehicle_kick = j["protections"]["script_events"]["vehicle_kick"]; - - this->tunables.disable_phone = j["tunables"]["disable_phone"]; - this->tunables.no_idle_kick = j["tunables"]["no_idle_kick"]; - - this->self.godmode = j["self"]["godmode"]; - this->self.off_radar = j["self"]["off_radar"]; - this->self.never_wanted = j["self"]["never_wanted"]; - this->self.no_ragdoll = j["self"]["no_ragdoll"]; - this->self.super_run = j["self"]["super_run"]; - - this->self.frame_flags.explosive_ammo = j["self"]["frame_flags"]["explosive_ammo"]; - this->self.frame_flags.explosive_melee = j["self"]["frame_flags"]["explosive_melee"]; - this->self.frame_flags.fire_ammo = j["self"]["frame_flags"]["fire_ammo"]; - this->self.frame_flags.super_jump = j["self"]["frame_flags"]["super_jump"]; - - this->settings.hotkeys.menu_toggle = j["settings"]["hotkeys"]["menu_toggle"]; - - this->spoofing.spoof_ip = j["spoofing"]["spoof_ip"]; - this->spoofing.spoof_rockstar_id = j["spoofing"]["spoof_rockstar_id"]; - this->spoofing.spoof_username = j["spoofing"]["spoof_username"]; - - for (int i = 0; i < 4; i++) - this->spoofing.ip_address[i] = j["spoofing"]["ip_address"].at(i); - this->spoofing.rockstar_id = j["spoofing"]["rockstar_id"]; - this->spoofing.username = j["spoofing"]["username"]; - - this->vehicle.god_mode = j["vehicle"]["god_mode"]; - this->vehicle.horn_boost = j["vehicle"]["horn_boost"]; - this->vehicle.pv_teleport_into = j["vehicle"]["pv_teleport_into"]; - - this->vehicle.speedo_meter.type = (SpeedoMeter)j["vehicle"]["speedo_meter"]["type"]; - this->vehicle.speedo_meter.left_side = j["vehicle"]["speedo_meter"]["left_side"]; - this->vehicle.speedo_meter.x = j["vehicle"]["speedo_meter"]["position_x"]; - this->vehicle.speedo_meter.y = j["vehicle"]["speedo_meter"]["position_y"]; - - this->weapons.custom_weapon = (CustomWeapon)j["weapons"]["custom_weapon"]; - this->weapons.infinite_ammo = j["weapons"]["infinite_ammo"]; - this->weapons.infinite_mag = j["weapons"]["infinite_mag"]; - - this->window.debug = j["window"]["debug"]; - this->window.handling = j["window"]["handling"]; - this->window.log = j["window"]["log"]; - this->window.main = j["window"]["main"]; - this->window.users = j["window"]["users"]; - } - - nlohmann::json to_json() - { - return nlohmann::json{ + struct settings { + struct hotkeys { - "debug", + bool editing_menu_toggle = false; + int menu_toggle = VK_INSERT; + int teleport_waypoint = 0; + }; + + hotkeys hotkeys{}; + }; + + struct spoofing + { + bool spoof_username = false; + std::string username = ""; + + bool spoof_ip = true; + int ip_address[4] = { 42, 42, 42, 42 }; + + bool spoof_rockstar_id = false; + uint64_t rockstar_id = 0; + }; + + struct vehicle { + struct speedo_meter { + SpeedoMeter type = SpeedoMeter::DISABLED; + + float x = .9f; + float y = .72f; + + bool left_side = false; + }; + + bool god_mode = false; + bool horn_boost = false; + bool ls_customs = false; // don't save this to disk + bool pv_teleport_into = false; + speedo_meter speedo_meter{}; + }; + + struct weapons { + CustomWeapon custom_weapon = CustomWeapon::NONE; + char vehicle_gun_model[12] = "bus"; + bool infinite_ammo = false; + bool infinite_mag = false; + }; + + struct window { + bool debug = false; + bool handling = false; + bool log = false; + bool main = true; + bool users = true; + bool player = false; + + int x; + int y; + }; + + public: + int friend_count = 0; + int player_count = 0; + + debug debug{}; + tunables tunables{}; + player player{}; + protections protections{}; + self self{}; + settings settings{}; + spoofing spoofing{}; + vehicle vehicle{}; + weapons weapons{}; + window window{}; + + menu_settings(file save_file) + : m_save_file(std::move(save_file)) + { + g = this; + } + + ~menu_settings() + { + g = nullptr; + } + + void from_json(const nlohmann::json& j) + { + this->debug.script_event_logging = j["debug"]["script_event_logging"]; + + this->protections.script_events.bounty = j["protections"]["script_events"]["bounty"]; + this->protections.script_events.ceo_ban = j["protections"]["script_events"]["ceo_ban"]; + this->protections.script_events.ceo_kick = j["protections"]["script_events"]["ceo_kick"]; + this->protections.script_events.ceo_money = j["protections"]["script_events"]["ceo_money"]; + this->protections.script_events.clear_wanted_level = j["protections"]["script_events"]["clear_wanted_level"]; + this->protections.script_events.fake_deposit = j["protections"]["script_events"]["fake_deposit"]; + this->protections.script_events.force_mission = j["protections"]["script_events"]["force_mission"]; + this->protections.script_events.force_teleport = j["protections"]["script_events"]["force_teleport"]; + this->protections.script_events.gta_banner = j["protections"]["script_events"]["gta_banner"]; + this->protections.script_events.network_bail = j["protections"]["script_events"]["network_bail"]; + this->protections.script_events.personal_vehicle_destroyed = j["protections"]["script_events"]["personal_vehicle_destroyed"]; + this->protections.script_events.remote_off_radar = j["protections"]["script_events"]["remote_off_radar"]; + this->protections.script_events.rotate_cam = j["protections"]["script_events"]["rotate_cam"]; + this->protections.script_events.send_to_cutscene = j["protections"]["script_events"]["send_to_cutscene"]; + this->protections.script_events.send_to_island = j["protections"]["script_events"]["send_to_island"]; + this->protections.script_events.sound_spam = j["protections"]["script_events"]["sound_spam"]; + this->protections.script_events.spectate = j["protections"]["script_events"]["spectate"]; + this->protections.script_events.transaction_error = j["protections"]["script_events"]["transaction_error"]; + this->protections.script_events.vehicle_kick = j["protections"]["script_events"]["vehicle_kick"]; + + this->tunables.disable_phone = j["tunables"]["disable_phone"]; + this->tunables.no_idle_kick = j["tunables"]["no_idle_kick"]; + + this->self.godmode = j["self"]["godmode"]; + this->self.off_radar = j["self"]["off_radar"]; + this->self.never_wanted = j["self"]["never_wanted"]; + this->self.no_ragdoll = j["self"]["no_ragdoll"]; + this->self.super_run = j["self"]["super_run"]; + + this->self.frame_flags.explosive_ammo = j["self"]["frame_flags"]["explosive_ammo"]; + this->self.frame_flags.explosive_melee = j["self"]["frame_flags"]["explosive_melee"]; + this->self.frame_flags.fire_ammo = j["self"]["frame_flags"]["fire_ammo"]; + this->self.frame_flags.super_jump = j["self"]["frame_flags"]["super_jump"]; + + this->settings.hotkeys.menu_toggle = j["settings"]["hotkeys"]["menu_toggle"]; + + this->spoofing.spoof_ip = j["spoofing"]["spoof_ip"]; + this->spoofing.spoof_rockstar_id = j["spoofing"]["spoof_rockstar_id"]; + this->spoofing.spoof_username = j["spoofing"]["spoof_username"]; + + for (int i = 0; i < 4; i++) + this->spoofing.ip_address[i] = j["spoofing"]["ip_address"].at(i); + this->spoofing.rockstar_id = j["spoofing"]["rockstar_id"]; + this->spoofing.username = j["spoofing"]["username"]; + + this->vehicle.god_mode = j["vehicle"]["god_mode"]; + this->vehicle.horn_boost = j["vehicle"]["horn_boost"]; + this->vehicle.pv_teleport_into = j["vehicle"]["pv_teleport_into"]; + + this->vehicle.speedo_meter.type = (SpeedoMeter)j["vehicle"]["speedo_meter"]["type"]; + this->vehicle.speedo_meter.left_side = j["vehicle"]["speedo_meter"]["left_side"]; + this->vehicle.speedo_meter.x = j["vehicle"]["speedo_meter"]["position_x"]; + this->vehicle.speedo_meter.y = j["vehicle"]["speedo_meter"]["position_y"]; + + this->weapons.custom_weapon = (CustomWeapon)j["weapons"]["custom_weapon"]; + this->weapons.infinite_ammo = j["weapons"]["infinite_ammo"]; + this->weapons.infinite_mag = j["weapons"]["infinite_mag"]; + + this->window.debug = j["window"]["debug"]; + this->window.handling = j["window"]["handling"]; + this->window.log = j["window"]["log"]; + this->window.main = j["window"]["main"]; + this->window.users = j["window"]["users"]; + } + + nlohmann::json to_json() + { + return nlohmann::json{ { - { "script_event_logging", this->debug.script_event_logging } - } - }, - { - "protections", + "debug", + { + { "script_event_logging", this->debug.script_event_logging } + } + }, { + "protections", { - "script_events", { - { "bounty", this->protections.script_events.bounty }, - { "ceo_ban", this->protections.script_events.ceo_ban }, - { "ceo_kick", this->protections.script_events.ceo_kick }, - { "ceo_money", this->protections.script_events.ceo_money }, - { "clear_wanted_level", this->protections.script_events.clear_wanted_level }, - { "fake_deposit", this->protections.script_events.fake_deposit }, - { "force_mission", this->protections.script_events.force_mission }, - { "force_teleport", this->protections.script_events.force_teleport }, - { "gta_banner", this->protections.script_events.gta_banner }, - { "network_bail", this->protections.script_events.network_bail }, - { "personal_vehicle_destroyed", this->protections.script_events.personal_vehicle_destroyed }, - { "remote_off_radar", this->protections.script_events.remote_off_radar }, - { "rotate_cam", this->protections.script_events.rotate_cam }, - { "send_to_cutscene", this->protections.script_events.send_to_cutscene }, - { "send_to_island", this->protections.script_events.send_to_island }, - { "sound_spam", this->protections.script_events.sound_spam }, - { "spectate", this->protections.script_events.spectate }, - { "transaction_error", this->protections.script_events.transaction_error }, - { "vehicle_kick", this->protections.script_events.vehicle_kick } + { + "script_events", { + { "bounty", this->protections.script_events.bounty }, + { "ceo_ban", this->protections.script_events.ceo_ban }, + { "ceo_kick", this->protections.script_events.ceo_kick }, + { "ceo_money", this->protections.script_events.ceo_money }, + { "clear_wanted_level", this->protections.script_events.clear_wanted_level }, + { "fake_deposit", this->protections.script_events.fake_deposit }, + { "force_mission", this->protections.script_events.force_mission }, + { "force_teleport", this->protections.script_events.force_teleport }, + { "gta_banner", this->protections.script_events.gta_banner }, + { "network_bail", this->protections.script_events.network_bail }, + { "personal_vehicle_destroyed", this->protections.script_events.personal_vehicle_destroyed }, + { "remote_off_radar", this->protections.script_events.remote_off_radar }, + { "rotate_cam", this->protections.script_events.rotate_cam }, + { "send_to_cutscene", this->protections.script_events.send_to_cutscene }, + { "send_to_island", this->protections.script_events.send_to_island }, + { "sound_spam", this->protections.script_events.sound_spam }, + { "spectate", this->protections.script_events.spectate }, + { "transaction_error", this->protections.script_events.transaction_error }, + { "vehicle_kick", this->protections.script_events.vehicle_kick } + } } } - } - }, - { - "tunables", { - { "disable_phone", this->tunables.disable_phone }, - { "no_idle_kick", this->tunables.no_idle_kick } - } - }, - { - "self", { - { "godmode", this->self.godmode }, - { "off_radar", this->self.off_radar }, - { "never_wanted", this->self.never_wanted }, - { "no_ragdoll", this->self.no_ragdoll }, - { "super_run", this->self.super_run }, + }, + { + "tunables", { + { "disable_phone", this->tunables.disable_phone }, + { "no_idle_kick", this->tunables.no_idle_kick } + } + }, + { + "self", { + { "godmode", this->self.godmode }, + { "off_radar", this->self.off_radar }, + { "never_wanted", this->self.never_wanted }, + { "no_ragdoll", this->self.no_ragdoll }, + { "super_run", this->self.super_run }, - { - "frame_flags", { - { "explosive_ammo", this->self.frame_flags.explosive_ammo }, - { "explosive_melee", this->self.frame_flags.explosive_melee }, - { "fire_ammo", this->self.frame_flags.fire_ammo }, - { "super_jump", this->self.frame_flags.super_jump } + { + "frame_flags", { + { "explosive_ammo", this->self.frame_flags.explosive_ammo }, + { "explosive_melee", this->self.frame_flags.explosive_melee }, + { "fire_ammo", this->self.frame_flags.fire_ammo }, + { "super_jump", this->self.frame_flags.super_jump } + } } } - } - }, - { - "settings", { - { "hotkeys", { - { "menu_toggle", this->settings.hotkeys.menu_toggle } + }, + { + "settings", { + { "hotkeys", { + { "menu_toggle", this->settings.hotkeys.menu_toggle } + } } } - } - }, - { - "spoofing", { - { "spoof_ip", this->spoofing.spoof_ip }, - { "spoof_rockstar_id", this->spoofing.spoof_rockstar_id }, - { "spoof_username", this->spoofing.spoof_username }, - { "ip_address", nlohmann::json::array({ - this->spoofing.ip_address[0], - this->spoofing.ip_address[1], - this->spoofing.ip_address[2], - this->spoofing.ip_address[3] }) - }, - { "rockstar_id", this->spoofing.rockstar_id }, - { "username", this->spoofing.username } - } - }, - { - "vehicle", { - { "god_mode", this->vehicle.god_mode }, - { "horn_boost", this->vehicle.horn_boost }, - { "pv_teleport_into", this->vehicle.pv_teleport_into }, - { - "speedo_meter", { - { "type", (int)this->vehicle.speedo_meter.type }, - { "left_side", this->vehicle.speedo_meter.left_side }, - { "position_x", this->vehicle.speedo_meter.x }, - { "position_y", this->vehicle.speedo_meter.y } + }, + { + "spoofing", { + { "spoof_ip", this->spoofing.spoof_ip }, + { "spoof_rockstar_id", this->spoofing.spoof_rockstar_id }, + { "spoof_username", this->spoofing.spoof_username }, + { "ip_address", nlohmann::json::array({ + this->spoofing.ip_address[0], + this->spoofing.ip_address[1], + this->spoofing.ip_address[2], + this->spoofing.ip_address[3] }) + }, + { "rockstar_id", this->spoofing.rockstar_id }, + { "username", this->spoofing.username } + } + }, + { + "vehicle", { + { "god_mode", this->vehicle.god_mode }, + { "horn_boost", this->vehicle.horn_boost }, + { "pv_teleport_into", this->vehicle.pv_teleport_into }, + { + "speedo_meter", { + { "type", (int)this->vehicle.speedo_meter.type }, + { "left_side", this->vehicle.speedo_meter.left_side }, + { "position_x", this->vehicle.speedo_meter.x }, + { "position_y", this->vehicle.speedo_meter.y } + } } } + }, + { + "weapons", { + { "custom_weapon", (int)this->weapons.custom_weapon }, + { "infinite_ammo", this->weapons.infinite_ammo }, + { "infinite_mag", this->weapons.infinite_mag } + } + }, + { + "window", { + { "debug", this->window.debug }, + { "handling", this->window.handling }, + { "log", this->window.log }, + { "main", this->window.main }, + { "users", this->window.users } + } } - }, + }; + } + + void attempt_save() + { + const nlohmann::json& j = this->to_json(); + + if (deep_compare(this->options, j, true)) + this->save(); + } + + bool load() + { + this->default_options = this->to_json(); + + std::ifstream file(m_save_file.get_path()); + + if (!file.is_open()) { - "weapons", { - { "custom_weapon", (int)this->weapons.custom_weapon }, - { "infinite_ammo", this->weapons.infinite_ammo }, - { "infinite_mag", this->weapons.infinite_mag } - } - }, - { - "window", { - { "debug", this->window.debug }, - { "handling", this->window.handling }, - { "log", this->window.log }, - { "main", this->window.main }, - { "users", this->window.users } - } + this->write_default_config(); + + file.open(m_save_file.get_path()); } - }; - } - void attempt_save() - { - nlohmann::json& j = this->to_json(); - - if (deep_compare(this->options, j, true)) - this->save(); - } - - bool load() - { - this->default_options = this->to_json(); - - std::string settings_file = std::getenv("appdata"); - settings_file += this->settings_location; - - std::ifstream file(settings_file); - - if (!file.is_open()) - { - this->write_default_config(); - - file.open(settings_file); - } - - try - { - file >> this->options; - - file.close(); - } - catch (const std::exception&) - { - file.close(); - - LOG(WARNING) << "Detected corrupt settings, writing default config..."; - - this->write_default_config(); - - return this->load(); - } - - bool should_save = this->deep_compare(this->options, this->default_options); - - this->from_json(this->options); - - if (should_save) - { - LOG(INFO) << "Updating settings."; - save(); - } - - return true; - } - -private: - const char* settings_location = "\\BigBaseV2\\settings.json"; - - bool deep_compare(nlohmann::json& current_settings, const nlohmann::json& default_settings, bool compare_value = false) - { - 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())) + try { - current_settings[key] = e.value(); + file >> this->options; - should_save = true; + file.close(); } - else if (current_settings[key].is_object() && e.value().is_object()) + catch (const std::exception&) { - if (deep_compare(current_settings[key], e.value(), compare_value)) + file.close(); + + LOG(WARNING) << "Detected corrupt settings, writing default config..."; + + this->write_default_config(); + + return this->load(); + } + + const bool should_save = this->deep_compare(this->options, this->default_options); + + this->from_json(this->options); + + if (should_save) + { + LOG(INFO) << "Updating settings."; + save(); + } + + return true; + } + + private: + file m_save_file; + + bool deep_compare(nlohmann::json& current_settings, const nlohmann::json& default_settings, bool compare_value = false) + { + 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()) { - current_settings[key] = e.value(); + } + 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; + should_save = true; + } } + + return should_save; } - return should_save; - } + bool save() + { + std::ofstream file(m_save_file.get_path(), std::ios::out | std::ios::trunc); + file << this->to_json().dump(4); + file.close(); - bool save() - { - std::string settings_file = std::getenv("appdata"); - settings_file += this->settings_location; + return true; + } - std::ofstream file(settings_file, std::ios::out | std::ios::trunc); - file << this->to_json().dump(4); - file.close(); + bool write_default_config() + { + std::ofstream file(m_save_file.get_path(), std::ios::out | std::ios::trunc); + file << this->to_json().dump(4); + file.close(); - return true; - } - - bool write_default_config() - { - std::string settings_file = std::getenv("appdata"); - settings_file += this->settings_location; - - std::ofstream file(settings_file, std::ios::out); - file << this->to_json().dump(4); - file.close(); - - return true; - } -}; - -inline struct globals g; -#endif // !GLOBALS_H + return true; + } + }; +} diff --git a/BigBaseV2/src/gui/window/dbg/debug_debug.cpp b/BigBaseV2/src/gui/window/dbg/debug_debug.cpp index 61f462ff..e563d034 100644 --- a/BigBaseV2/src/gui/window/dbg/debug_debug.cpp +++ b/BigBaseV2/src/gui/window/dbg/debug_debug.cpp @@ -7,7 +7,7 @@ namespace big { if (ImGui::BeginTabItem("Debug")) { - ImGui::Checkbox("Script Event Logging", &g.debug.script_event_logging); + ImGui::Checkbox("Script Event Logging", &g->debug.script_event_logging); if (ImGui::Button("Dump entrypoints")) { diff --git a/BigBaseV2/src/gui/window/main/tab_mobile.cpp b/BigBaseV2/src/gui/window/main/tab_mobile.cpp index f9ffdf4b..8bb2141c 100644 --- a/BigBaseV2/src/gui/window/main/tab_mobile.cpp +++ b/BigBaseV2/src/gui/window/main/tab_mobile.cpp @@ -27,7 +27,7 @@ namespace big if (ImGui::TreeNode("Lester")) { - ImGui::Checkbox("Off Radar", &g.self.off_radar); + ImGui::Checkbox("Off Radar", &g->self.off_radar); ImGui::TreePop(); } @@ -92,7 +92,7 @@ namespace big g_mobile_service->register_vehicles(); }QUEUE_JOB_END_CLAUSE } - ImGui::Checkbox("Spawn in Vehicle", &g.vehicle.pv_teleport_into); + ImGui::Checkbox("Spawn in Vehicle", &g->vehicle.pv_teleport_into); ImGui::TreePop(); } diff --git a/BigBaseV2/src/gui/window/main/tab_recovery.cpp b/BigBaseV2/src/gui/window/main/tab_recovery.cpp index ef070b83..fc5bd336 100644 --- a/BigBaseV2/src/gui/window/main/tab_recovery.cpp +++ b/BigBaseV2/src/gui/window/main/tab_recovery.cpp @@ -10,12 +10,12 @@ namespace big if (ImGui::BeginTabItem("Recovery")) { ImGui::Text("Set Current Character Level:"); - ImGui::SliderInt("##input_levels_self", &g.player.set_level, 0, 8000); + ImGui::SliderInt("##input_levels_self", &g->player.set_level, 0, 8000); if (ImGui::Button("Set Level")) { QUEUE_JOB_BEGIN_CLAUSE() { - player::set_player_level(g.player.set_level); + player::set_player_level(g->player.set_level); }QUEUE_JOB_END_CLAUSE } diff --git a/BigBaseV2/src/gui/window/main/tab_self.cpp b/BigBaseV2/src/gui/window/main/tab_self.cpp index 3a182fc8..d7319019 100644 --- a/BigBaseV2/src/gui/window/main/tab_self.cpp +++ b/BigBaseV2/src/gui/window/main/tab_self.cpp @@ -24,17 +24,17 @@ namespace big { ImGui::BeginGroup(); - ImGui::Checkbox("God Mode", &g.self.godmode); - ImGui::Checkbox("Off Radar", &g.self.off_radar); - ImGui::Checkbox("Free Cam", &g.self.free_cam); + ImGui::Checkbox("God Mode", &g->self.godmode); + ImGui::Checkbox("Off Radar", &g->self.off_radar); + ImGui::Checkbox("Free Cam", &g->self.free_cam); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("No Clip", &g.self.noclip); - ImGui::Checkbox("No Ragdoll", &g.self.no_ragdoll); - ImGui::Checkbox("Super Run", &g.self.super_run); + ImGui::Checkbox("No Clip", &g->self.noclip); + ImGui::Checkbox("No Ragdoll", &g->self.no_ragdoll); + ImGui::Checkbox("Super Run", &g->self.super_run); ImGui::EndGroup(); @@ -45,15 +45,15 @@ namespace big { ImGui::BeginGroup(); - ImGui::Checkbox("Explosive Ammo", &g.self.frame_flags.explosive_ammo); - ImGui::Checkbox("Fire Ammo", &g.self.frame_flags.fire_ammo); + ImGui::Checkbox("Explosive Ammo", &g->self.frame_flags.explosive_ammo); + ImGui::Checkbox("Fire Ammo", &g->self.frame_flags.fire_ammo); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Explosive Melee", &g.self.frame_flags.explosive_melee); - ImGui::Checkbox("Super Jump", &g.self.frame_flags.super_jump); + ImGui::Checkbox("Explosive Melee", &g->self.frame_flags.explosive_melee); + ImGui::Checkbox("Super Jump", &g->self.frame_flags.super_jump); ImGui::EndGroup(); @@ -103,14 +103,14 @@ namespace big if (ImGui::TreeNode("Police")) { - ImGui::Checkbox("Never Wanted", &g.self.never_wanted); + ImGui::Checkbox("Never Wanted", &g->self.never_wanted); - if (!g.self.never_wanted) + if (!g->self.never_wanted) { - ImGui::Checkbox("Force Wanted Level", &g.self.force_wanted_level); + ImGui::Checkbox("Force Wanted Level", &g->self.force_wanted_level); ImGui::Text("Wanted Level"); - if (ImGui::SliderInt("###wanted_level", &g.self.wanted_level, 0, 5) && !g.self.force_wanted_level) - g_local_player->m_player_info->m_wanted_level = g.self.wanted_level; + if (ImGui::SliderInt("###wanted_level", &g->self.wanted_level, 0, 5) && !g->self.force_wanted_level) + g_local_player->m_player_info->m_wanted_level = g->self.wanted_level; } ImGui::TreePop(); diff --git a/BigBaseV2/src/gui/window/main/tab_settings.cpp b/BigBaseV2/src/gui/window/main/tab_settings.cpp index f9b220c8..494b7607 100644 --- a/BigBaseV2/src/gui/window/main/tab_settings.cpp +++ b/BigBaseV2/src/gui/window/main/tab_settings.cpp @@ -12,15 +12,15 @@ namespace big ImGui::PushItemWidth(350.f); ImGui::BeginGroup(); - if (ImGui::Hotkey("Menu Toggle", &g.settings.hotkeys.menu_toggle)) - g.settings.hotkeys.editing_menu_toggle = true; // make our menu reappear + if (ImGui::Hotkey("Menu Toggle", &g->settings.hotkeys.menu_toggle)) + g->settings.hotkeys.editing_menu_toggle = true; // make our menu reappear ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); ImGui::Text("(Below hotkey is not implemented)"); - ImGui::Hotkey("Teleport to waypoint", &g.settings.hotkeys.teleport_waypoint); + ImGui::Hotkey("Teleport to waypoint", &g->settings.hotkeys.teleport_waypoint); ImGui::EndGroup(); ImGui::PopItemWidth(); @@ -30,25 +30,25 @@ namespace big if (ImGui::TreeNode("Protections")) { - ImGui::Checkbox("Bounty", &g.protections.script_events.bounty); - ImGui::Checkbox("CEO Ban", &g.protections.script_events.ceo_ban); - ImGui::Checkbox("CEO Kick", &g.protections.script_events.ceo_kick); - ImGui::Checkbox("CEO Money", &g.protections.script_events.ceo_money); - ImGui::Checkbox("Wanted Level", &g.protections.script_events.clear_wanted_level); - ImGui::Checkbox("Fake Deposit", &g.protections.script_events.fake_deposit); - ImGui::Checkbox("Force Mission", &g.protections.script_events.force_mission); - ImGui::Checkbox("Force Teleport", &g.protections.script_events.force_teleport); - ImGui::Checkbox("GTA Banner", &g.protections.script_events.gta_banner); - ImGui::Checkbox("Network Bail", &g.protections.script_events.network_bail); - ImGui::Checkbox("Destroy Personal Vehicle", &g.protections.script_events.personal_vehicle_destroyed); - ImGui::Checkbox("Remote Off Radar", &g.protections.script_events.remote_off_radar); - ImGui::Checkbox("Rotate Cam", &g.protections.script_events.rotate_cam); - ImGui::Checkbox("Send to Cutscene", &g.protections.script_events.send_to_cutscene); - ImGui::Checkbox("Send to Island", &g.protections.script_events.send_to_island); - ImGui::Checkbox("Sound Spam", &g.protections.script_events.sound_spam); - ImGui::Checkbox("Spectate", &g.protections.script_events.spectate); - ImGui::Checkbox("Transaction Error", &g.protections.script_events.transaction_error); - ImGui::Checkbox("Vehicle Kick", &g.protections.script_events.vehicle_kick); + ImGui::Checkbox("Bounty", &g->protections.script_events.bounty); + ImGui::Checkbox("CEO Ban", &g->protections.script_events.ceo_ban); + ImGui::Checkbox("CEO Kick", &g->protections.script_events.ceo_kick); + ImGui::Checkbox("CEO Money", &g->protections.script_events.ceo_money); + ImGui::Checkbox("Wanted Level", &g->protections.script_events.clear_wanted_level); + ImGui::Checkbox("Fake Deposit", &g->protections.script_events.fake_deposit); + ImGui::Checkbox("Force Mission", &g->protections.script_events.force_mission); + ImGui::Checkbox("Force Teleport", &g->protections.script_events.force_teleport); + ImGui::Checkbox("GTA Banner", &g->protections.script_events.gta_banner); + ImGui::Checkbox("Network Bail", &g->protections.script_events.network_bail); + ImGui::Checkbox("Destroy Personal Vehicle", &g->protections.script_events.personal_vehicle_destroyed); + ImGui::Checkbox("Remote Off Radar", &g->protections.script_events.remote_off_radar); + ImGui::Checkbox("Rotate Cam", &g->protections.script_events.rotate_cam); + ImGui::Checkbox("Send to Cutscene", &g->protections.script_events.send_to_cutscene); + ImGui::Checkbox("Send to Island", &g->protections.script_events.send_to_island); + ImGui::Checkbox("Sound Spam", &g->protections.script_events.sound_spam); + ImGui::Checkbox("Spectate", &g->protections.script_events.spectate); + ImGui::Checkbox("Transaction Error", &g->protections.script_events.transaction_error); + ImGui::Checkbox("Vehicle Kick", &g->protections.script_events.vehicle_kick); ImGui::TreePop(); } diff --git a/BigBaseV2/src/gui/window/main/tab_spoofing.cpp b/BigBaseV2/src/gui/window/main/tab_spoofing.cpp index a741ae3a..54119d31 100644 --- a/BigBaseV2/src/gui/window/main/tab_spoofing.cpp +++ b/BigBaseV2/src/gui/window/main/tab_spoofing.cpp @@ -17,16 +17,16 @@ namespace big PAD::DISABLE_ALL_CONTROL_ACTIONS(0); }QUEUE_JOB_END_CLAUSE - ImGui::Checkbox("Spoof Username", &g.spoofing.spoof_username); + ImGui::Checkbox("Spoof Username", &g->spoofing.spoof_username); static char name[20]; - strcpy_s(name, sizeof(name), g.spoofing.username.c_str()); + strcpy_s(name, sizeof(name), g->spoofing.username.c_str()); ImGui::Text("Username:"); ImGui::InputText("##username_input", name, sizeof(name)); - if (name != g.spoofing.username) - g.spoofing.username = std::string(name); + if (name != g->spoofing.username) + g->spoofing.username = std::string(name); ImGui::TreePop(); } @@ -38,10 +38,10 @@ namespace big PAD::DISABLE_ALL_CONTROL_ACTIONS(0); }QUEUE_JOB_END_CLAUSE - ImGui::Checkbox("Spoof IP", &g.spoofing.spoof_ip); + ImGui::Checkbox("Spoof IP", &g->spoofing.spoof_ip); ImGui::Text("IP Address:"); - ImGui::DragInt4("##ip_fields", g.spoofing.ip_address, 0, 255); + ImGui::DragInt4("##ip_fields", g->spoofing.ip_address, 0, 255); ImGui::TreePop(); } @@ -53,10 +53,10 @@ namespace big PAD::DISABLE_ALL_CONTROL_ACTIONS(0); }QUEUE_JOB_END_CLAUSE - ImGui::Checkbox("Spoof Rockstar ID", &g.spoofing.spoof_rockstar_id); + ImGui::Checkbox("Spoof Rockstar ID", &g->spoofing.spoof_rockstar_id); ImGui::Text("Rockstar ID:"); - ImGui::InputScalar("##rockstar_id_input", ImGuiDataType_U64, &g.spoofing.rockstar_id); + ImGui::InputScalar("##rockstar_id_input", ImGuiDataType_U64, &g->spoofing.rockstar_id); ImGui::TreePop(); } diff --git a/BigBaseV2/src/gui/window/main/tab_tunables.cpp b/BigBaseV2/src/gui/window/main/tab_tunables.cpp index 82a8eb98..bea3b05a 100644 --- a/BigBaseV2/src/gui/window/main/tab_tunables.cpp +++ b/BigBaseV2/src/gui/window/main/tab_tunables.cpp @@ -6,8 +6,8 @@ namespace big { if (ImGui::BeginTabItem("Tunables")) { - ImGui::Checkbox("Disable Phone", &g.tunables.disable_phone); - ImGui::Checkbox("No Idle Kick", &g.tunables.no_idle_kick); + ImGui::Checkbox("Disable Phone", &g->tunables.disable_phone); + ImGui::Checkbox("No Idle Kick", &g->tunables.no_idle_kick); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/window/main/tab_vehicle.cpp b/BigBaseV2/src/gui/window/main/tab_vehicle.cpp index 65b4ba31..ddb2d7e6 100644 --- a/BigBaseV2/src/gui/window/main/tab_vehicle.cpp +++ b/BigBaseV2/src/gui/window/main/tab_vehicle.cpp @@ -18,8 +18,8 @@ namespace big if (ImGui::TreeNode("General")) { ImGui::BeginGroup(); - ImGui::Checkbox("God Mode", &g.vehicle.god_mode); - ImGui::Checkbox("Horn Boost", &g.vehicle.horn_boost); + ImGui::Checkbox("God Mode", &g->vehicle.god_mode); + ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost); ImGui::EndGroup(); ImGui::SameLine(); @@ -35,7 +35,7 @@ namespace big }QUEUE_JOB_END_CLAUSE } if (ImGui::Button("Handling")) - g.window.handling = true; + g->window.handling = true; ImGui::EndGroup(); ImGui::TreePop(); @@ -45,7 +45,7 @@ namespace big { if (ImGui::Button("Start LS Customs")) { - g.vehicle.ls_customs = true; + g->vehicle.ls_customs = true; } ImGui::TreePop(); @@ -53,7 +53,7 @@ namespace big if (ImGui::TreeNode("Speedo Meter")) { - SpeedoMeter selected = g.vehicle.speedo_meter.type; + SpeedoMeter selected = g->vehicle.speedo_meter.type; ImGui::Text("Type:"); if (ImGui::BeginCombo("###speedo_type", speedo_meters[(int)selected].name)) @@ -62,7 +62,7 @@ namespace big { if (ImGui::Selectable(speedo.name, speedo.id == selected)) { - g.vehicle.speedo_meter.type = speedo.id; + g->vehicle.speedo_meter.type = speedo.id; } if (speedo.id == selected) @@ -75,15 +75,15 @@ namespace big ImGui::Text("Position"); float pos[2]; - pos[0] = g.vehicle.speedo_meter.x; - pos[1] = g.vehicle.speedo_meter.y; + pos[0] = g->vehicle.speedo_meter.x; + pos[1] = g->vehicle.speedo_meter.y; if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f")) { - g.vehicle.speedo_meter.x = pos[0]; - g.vehicle.speedo_meter.y = pos[1]; + g->vehicle.speedo_meter.x = pos[0]; + g->vehicle.speedo_meter.y = pos[1]; } - ImGui::Checkbox("Left Sided", &g.vehicle.speedo_meter.left_side); + ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side); ImGui::TreePop(); } diff --git a/BigBaseV2/src/gui/window/main/tab_weapons.cpp b/BigBaseV2/src/gui/window/main/tab_weapons.cpp index 4556ae48..1397eb24 100644 --- a/BigBaseV2/src/gui/window/main/tab_weapons.cpp +++ b/BigBaseV2/src/gui/window/main/tab_weapons.cpp @@ -9,18 +9,18 @@ namespace big { if (ImGui::TreeNode("Ammo Options")) { - ImGui::Checkbox("Infinite Ammo", &g.weapons.infinite_ammo); + ImGui::Checkbox("Infinite Ammo", &g->weapons.infinite_ammo); ImGui::SameLine(); - ImGui::Checkbox("Infinite Clip", &g.weapons.infinite_mag); + ImGui::Checkbox("Infinite Clip", &g->weapons.infinite_mag); ImGui::TreePop(); } if (ImGui::TreeNode("Custom Weapons")) { - CustomWeapon selected = g.weapons.custom_weapon; + CustomWeapon selected = g->weapons.custom_weapon; if (ImGui::BeginCombo("Weapon", custom_weapons[(int)selected].name)) { @@ -28,7 +28,7 @@ namespace big { if (ImGui::Selectable(weapon.name, weapon.id == selected)) { - g.weapons.custom_weapon = weapon.id; + g->weapons.custom_weapon = weapon.id; } if (weapon.id == selected) @@ -52,7 +52,7 @@ namespace big break; case CustomWeapon::VEHICLE_GUN: ImGui::Text("Shooting Model:"); - ImGui::InputText("##vehicle_gun_model", g.weapons.vehicle_gun_model, 12); + ImGui::InputText("##vehicle_gun_model", g->weapons.vehicle_gun_model, 12); break; } diff --git a/BigBaseV2/src/gui/window/player/player_info.cpp b/BigBaseV2/src/gui/window/player/player_info.cpp index 4de38ccf..31212479 100644 --- a/BigBaseV2/src/gui/window/player/player_info.cpp +++ b/BigBaseV2/src/gui/window/player/player_info.cpp @@ -7,7 +7,7 @@ namespace big { if (ImGui::BeginTabItem("Info")) { - ImGui::Checkbox("Spectate", &g.player.spectating); + ImGui::Checkbox("Spectate", &g->player.spectating); ImGui::Separator(); diff --git a/BigBaseV2/src/gui/window/window_debug.cpp b/BigBaseV2/src/gui/window/window_debug.cpp index cd3c028c..c3080972 100644 --- a/BigBaseV2/src/gui/window/window_debug.cpp +++ b/BigBaseV2/src/gui/window/window_debug.cpp @@ -5,7 +5,7 @@ namespace big { void window::debug() { - if (g.window.debug && ImGui::Begin("Dev")) + if (g->window.debug && ImGui::Begin("Dev")) { ImGui::BeginTabBar("dev_tabbar"); tab_debug::_tab_debug(); diff --git a/BigBaseV2/src/gui/window/window_handling.cpp b/BigBaseV2/src/gui/window/window_handling.cpp index 27c3dee7..609b33de 100644 --- a/BigBaseV2/src/gui/window/window_handling.cpp +++ b/BigBaseV2/src/gui/window/window_handling.cpp @@ -10,7 +10,7 @@ namespace big { ImGui::SetNextWindowSize({ 500, 250 }, ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos({ 50, 50 }, ImGuiCond_FirstUseEver); - if (g.window.handling && ImGui::Begin("Handling", &g.window.handling)) + if (g->window.handling && ImGui::Begin("Handling", &g->window.handling)) { if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { diff --git a/BigBaseV2/src/gui/window/window_main.cpp b/BigBaseV2/src/gui/window/window_main.cpp index ed11967e..8b43741f 100644 --- a/BigBaseV2/src/gui/window/window_main.cpp +++ b/BigBaseV2/src/gui/window/window_main.cpp @@ -7,7 +7,7 @@ namespace big void window::main() { ImGui::SetNextWindowSize({ 800, 840 }, ImGuiCond_FirstUseEver); - if (g.window.main && ImGui::Begin("Yimura's Mod Menu")) + if (g->window.main && ImGui::Begin("Yimura's Mod Menu")) { ImGui::BeginTabBar("tabbar"); tab_main::tab_self(); diff --git a/BigBaseV2/src/gui/window/window_player.cpp b/BigBaseV2/src/gui/window/window_player.cpp index 2784f242..14109e42 100644 --- a/BigBaseV2/src/gui/window/window_player.cpp +++ b/BigBaseV2/src/gui/window/window_player.cpp @@ -9,7 +9,7 @@ namespace big std::string title = fmt::format("Player Options: {}###player_options", g_player_service->get_selected()->get_name()); ImGui::SetNextWindowSize({ 350.f, 300.f }, ImGuiCond_FirstUseEver); - if (g.window.player && g_player_service->get_selected()->is_valid() && ImGui::Begin(title.c_str(), &g.window.player)) + if (g->window.player && g_player_service->get_selected()->is_valid() && ImGui::Begin(title.c_str(), &g->window.player)) { ImGui::BeginTabBar("tabbar_player"); tab_player::tab_info(); diff --git a/BigBaseV2/src/gui/window/window_top_bar.cpp b/BigBaseV2/src/gui/window/window_top_bar.cpp index 7365aeb4..975a038e 100644 --- a/BigBaseV2/src/gui/window/window_top_bar.cpp +++ b/BigBaseV2/src/gui/window/window_top_bar.cpp @@ -51,10 +51,10 @@ namespace big if (ImGui::BeginMenu("Windows")) { - ImGui::MenuItem("Main", nullptr, &g.window.main); - ImGui::MenuItem("Players", nullptr, &g.window.users); - ImGui::MenuItem("Logs", nullptr, &g.window.log); - ImGui::MenuItem("Debug", nullptr, &g.window.debug); + ImGui::MenuItem("Main", nullptr, &g->window.main); + ImGui::MenuItem("Players", nullptr, &g->window.users); + ImGui::MenuItem("Logs", nullptr, &g->window.log); + ImGui::MenuItem("Debug", nullptr, &g->window.debug); ImGui::EndMenu(); } diff --git a/BigBaseV2/src/gui/window/window_users.cpp b/BigBaseV2/src/gui/window/window_users.cpp index 67bc6745..de1a9d02 100644 --- a/BigBaseV2/src/gui/window/window_users.cpp +++ b/BigBaseV2/src/gui/window/window_users.cpp @@ -9,10 +9,10 @@ namespace big static const float height_correction = 28.f; static const float width = 170.f; - ImGui::SetNextWindowSize({ width, (float)g.window.y - height_correction }, ImGuiCond_Always); - ImGui::SetNextWindowPos({ g.window.x - width, height_correction }, ImGuiCond_Always); + ImGui::SetNextWindowSize({ width, (float)g->window.y - height_correction }, ImGuiCond_Always); + ImGui::SetNextWindowPos({ g->window.x - width, height_correction }, ImGuiCond_Always); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.f); - if (g.window.users && ImGui::Begin("###player_menu", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav)) + if (g->window.users && ImGui::Begin("###player_menu", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav)) { ImGui::Text("Friends:"); for (auto& item : g_player_service->m_players) @@ -22,7 +22,7 @@ namespace big { g_player_service->set_selected(plyr.get()); - g.window.player = true; + g->window.player = true; } } @@ -34,7 +34,7 @@ namespace big { g_player_service->set_selected(plyr.get()); - g.window.player = true; + g->window.player = true; } } diff --git a/BigBaseV2/src/hooks/gta_thread_kill.cpp b/BigBaseV2/src/hooks/gta_thread_kill.cpp index fab4b708..9a3c3d7b 100644 --- a/BigBaseV2/src/hooks/gta_thread_kill.cpp +++ b/BigBaseV2/src/hooks/gta_thread_kill.cpp @@ -10,7 +10,7 @@ namespace big g_native_hooks->do_cleanup_for_thread(thread); if (thread->m_script_hash == RAGE_JOAAT("freemode")) - g.protections.freemode_terminated = !(result == rage::eThreadState::running); + g->protections.freemode_terminated = !(result == rage::eThreadState::running); return result; } diff --git a/BigBaseV2/src/hooks/gta_thread_tick.cpp b/BigBaseV2/src/hooks/gta_thread_tick.cpp index c2ec9c64..df04a963 100644 --- a/BigBaseV2/src/hooks/gta_thread_tick.cpp +++ b/BigBaseV2/src/hooks/gta_thread_tick.cpp @@ -10,7 +10,7 @@ namespace big { rage::eThreadState state = thread->m_context.m_state; - if (thread->m_script_hash == RAGE_JOAAT("freemode") && state == rage::eThreadState::running && !g.protections.freemode_terminated) + if (thread->m_script_hash == RAGE_JOAAT("freemode") && state == rage::eThreadState::running && !g->protections.freemode_terminated) { memcpy(struct_backup, (void*)thread, sizeof(GtaThread)); if (thread->m_stack) @@ -21,7 +21,7 @@ namespace big if (thread->m_script_hash == RAGE_JOAAT("freemode")) { - if (result == rage::eThreadState::killed && state == rage::eThreadState::running && !g.protections.freemode_terminated) + if (result == rage::eThreadState::killed && state == rage::eThreadState::running && !g->protections.freemode_terminated) { LOG(INFO) << "Freemode script crashed, attempting recovery..."; @@ -32,7 +32,7 @@ namespace big memcpy(thread->m_stack, stack_buffer, thread->m_context.m_stack_size); } - if (g.protections.freemode_terminated) g.protections.freemode_terminated = !(result == rage::eThreadState::running); + if (g->protections.freemode_terminated) g->protections.freemode_terminated = !(result == rage::eThreadState::running); } return result; diff --git a/BigBaseV2/src/hooks/script_event_handler.cpp b/BigBaseV2/src/hooks/script_event_handler.cpp index 30142683..77bde15e 100644 --- a/BigBaseV2/src/hooks/script_event_handler.cpp +++ b/BigBaseV2/src/hooks/script_event_handler.cpp @@ -16,97 +16,97 @@ namespace big switch (hash) { case eRemoteEvent::Bounty: - if (g.protections.script_events.bounty) + if (g->protections.script_events.bounty) strcpy(type, "Bounty"); break; case eRemoteEvent::CeoBan: - if (g.protections.script_events.ceo_ban) + if (g->protections.script_events.ceo_ban) strcpy(type, "Ceo Ban"); break; case eRemoteEvent::CeoKick: - if (g.protections.script_events.ceo_kick) + if (g->protections.script_events.ceo_kick) strcpy(type, "Ceo Kick"); break; case eRemoteEvent::CeoMoney: - if (g.protections.script_events.ceo_money) + if (g->protections.script_events.ceo_money) strcpy(type, "Ceo Money"); break; case eRemoteEvent::ClearWantedLevel: - if (g.protections.script_events.clear_wanted_level) + if (g->protections.script_events.clear_wanted_level) strcpy(type, "Clear Wanted Level"); break; case eRemoteEvent::FakeDeposit: - if (g.protections.script_events.fake_deposit) + if (g->protections.script_events.fake_deposit) strcpy(type, "Deposit"); break; case eRemoteEvent::ForceMission: - if (g.protections.script_events.force_mission) + if (g->protections.script_events.force_mission) strcpy(type, "Force Mission"); break; case eRemoteEvent::GtaBanner: - if (g.protections.script_events.gta_banner) + if (g->protections.script_events.gta_banner) strcpy(type, "GTA Banner"); break; case eRemoteEvent::NetworkBail: - if (g.protections.script_events.network_bail) + if (g->protections.script_events.network_bail) strcpy(type, "Network Bail"); break; case eRemoteEvent::PersonalVehicleDestroyed: - if (g.protections.script_events.personal_vehicle_destroyed) + if (g->protections.script_events.personal_vehicle_destroyed) strcpy(type, "Personal Vehicle Destroyed"); break; case eRemoteEvent::RemoteOffradar: - if (g.protections.script_events.remote_off_radar) + if (g->protections.script_events.remote_off_radar) strcpy(type, "Remote Off Radar"); break; case eRemoteEvent::RotateCam: - if (g.protections.script_events.rotate_cam) + if (g->protections.script_events.rotate_cam) strcpy(type, "Rotate Cam"); break; case eRemoteEvent::SendToCutscene: - if (g.protections.script_events.send_to_cutscene) + if (g->protections.script_events.send_to_cutscene) strcpy(type, "Send To Cutscene"); break; case eRemoteEvent::SendToIsland: - if (g.protections.script_events.send_to_island) + if (g->protections.script_events.send_to_island) strcpy(type, "Send To Island"); break; case eRemoteEvent::SoundSpam: - if (g.protections.script_events.sound_spam) + if (g->protections.script_events.sound_spam) strcpy(type, "Sound Spam"); break; case eRemoteEvent::Spectate: - if (g.protections.script_events.spectate) + if (g->protections.script_events.spectate) strcpy(type, "Specate"); break; case eRemoteEvent::Teleport: - if (g.protections.script_events.force_teleport) + if (g->protections.script_events.force_teleport) strcpy(type, "Force Teleport"); break; case eRemoteEvent::TransactionError: - if (g.protections.script_events.transaction_error) + if (g->protections.script_events.transaction_error) strcpy(type, "Transaction Error"); break; case eRemoteEvent::VehicleKick: - if (g.protections.script_events.vehicle_kick) + if (g->protections.script_events.vehicle_kick) strcpy(type, "Vehicle Kick"); break; @@ -121,7 +121,7 @@ namespace big return true; } - if (g.debug.script_event_logging) + if (g->debug.script_event_logging) { LOG(INFO) << "== Begin of Script Event =="; LOG(INFO) << "Player: " << player->get_name(); diff --git a/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp b/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp index 17deb3fa..a9a49584 100644 --- a/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp +++ b/BigBaseV2/src/hooks/send_net_info_to_lobby.cpp @@ -9,21 +9,21 @@ namespace big { LOG(INFO) << "HOOKS | Sending spoofed values to lobby."; - 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.spoof_rockstar_id) + if (g->spoofing.spoof_rockstar_id) { - player->m_rockstar_id = g.spoofing.rockstar_id; - player->m_rockstar_id2 = g.spoofing.rockstar_id; + player->m_rockstar_id = g->spoofing.rockstar_id; + player->m_rockstar_id2 = g->spoofing.rockstar_id; } } diff --git a/BigBaseV2/src/main.cpp b/BigBaseV2/src/main.cpp index d70c87e9..255ff49e 100644 --- a/BigBaseV2/src/main.cpp +++ b/BigBaseV2/src/main.cpp @@ -1,4 +1,5 @@ #include "common.hpp" +#include "core/globals.hpp" #include "features.hpp" #include "fiber_pool.hpp" #include "gui.hpp" @@ -32,6 +33,10 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) base_dir /= "BigBaseV2"; auto file_manager_instance = std::make_unique(base_dir); + auto globals_instance = std::make_unique( + file_manager_instance->get_project_file("./settings.json") + ); + auto logger_instance = std::make_unique( "YimMenu", file_manager_instance->get_project_file("./cout.log") @@ -51,7 +56,7 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) auto hooking_instance = std::make_unique(); LOG(INFO) << "Hooking initialized."; - g.load(); + g->load(); LOG(INFO) << "Settings Loaded."; auto thread_pool_instance = std::make_unique(); @@ -124,9 +129,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) logger_instance->destroy(); logger_instance.reset(); - file_manager_instance.reset(); + globals_instance.reset(); - std::this_thread::sleep_for(10s); + file_manager_instance.reset(); CloseHandle(g_main_thread); FreeLibraryAndExitThread(g_hmodule, 0); diff --git a/BigBaseV2/src/native_hooks/carmod_shop.hpp b/BigBaseV2/src/native_hooks/carmod_shop.hpp index 6df63ffc..39c93f0b 100644 --- a/BigBaseV2/src/native_hooks/carmod_shop.hpp +++ b/BigBaseV2/src/native_hooks/carmod_shop.hpp @@ -8,7 +8,7 @@ namespace big { inline void SET_ENTITY_COORDS(rage::scrNativeCallContext* src) { - if (!g.vehicle.ls_customs) + if (!g->vehicle.ls_customs) { ENTITY::SET_ENTITY_COORDS( src->get_arg(0), @@ -25,7 +25,7 @@ namespace big inline void SET_ENTITY_HEADING(rage::scrNativeCallContext* src) { - if (!g.vehicle.ls_customs) + if (!g->vehicle.ls_customs) { ENTITY::SET_ENTITY_HEADING( src->get_arg(0), @@ -36,7 +36,7 @@ namespace big inline void SET_VEHICLE_LIGHTS(rage::scrNativeCallContext* src) { - if (!g.vehicle.ls_customs) + if (!g->vehicle.ls_customs) { VEHICLE::SET_VEHICLE_LIGHTS( src->get_arg(0), diff --git a/BigBaseV2/src/renderer.cpp b/BigBaseV2/src/renderer.cpp index 33e817c2..c876577e 100644 --- a/BigBaseV2/src/renderer.cpp +++ b/BigBaseV2/src/renderer.cpp @@ -96,7 +96,7 @@ namespace big void renderer::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{}; @@ -109,9 +109,9 @@ namespace big SetCursorPos(cursor_coords.x, cursor_coords.y); } - g_gui.m_opened = g.settings.hotkeys.editing_menu_toggle || !g_gui.m_opened; - if (g.settings.hotkeys.editing_menu_toggle) - g.settings.hotkeys.editing_menu_toggle = false; + g_gui.m_opened = g->settings.hotkeys.editing_menu_toggle || !g_gui.m_opened; + if (g->settings.hotkeys.editing_menu_toggle) + g->settings.hotkeys.editing_menu_toggle = false; } if (g_gui.m_opened) diff --git a/BigBaseV2/src/util/mobile.hpp b/BigBaseV2/src/util/mobile.hpp index 8a70d746..93fef344 100644 --- a/BigBaseV2/src/util/mobile.hpp +++ b/BigBaseV2/src/util/mobile.hpp @@ -111,7 +111,7 @@ namespace big::mobile // blocking call till vehicle is delivered notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as(), -1); - if (g.vehicle.pv_teleport_into) + if (g->vehicle.pv_teleport_into) vehicle::bring(globals::get_personal_vehicle(), ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true)); } } diff --git a/BigBaseV2/src/util/player.hpp b/BigBaseV2/src/util/player.hpp index dbf4b783..11eebff9 100644 --- a/BigBaseV2/src/util/player.hpp +++ b/BigBaseV2/src/util/player.hpp @@ -19,10 +19,10 @@ namespace big::player inline void set_player_level(int level) { - get_active_character_slot(&g.player.character_slot); + get_active_character_slot(&g->player.character_slot); char level_string[64]; - sprintf(level_string, "MP%d_CHAR_SET_RP_GIFT_ADMIN", g.player.character_slot); + sprintf(level_string, "MP%d_CHAR_SET_RP_GIFT_ADMIN", g->player.character_slot); STATS::STAT_SET_INT(rage::joaat(level_string), levels[level - 1], 0); }