feat(Globals): Simplified code, sorry to anyone who has to update their code

This commit is contained in:
Yimura 2022-02-22 01:18:49 +01:00
parent 86522fa238
commit a2d9f04f1e
52 changed files with 609 additions and 598 deletions

View File

@ -10,7 +10,7 @@ namespace big
{ {
void backend::loop() void backend::loop()
{ {
g.attempt_save(); g->attempt_save();
QUEUE_JOB_BEGIN_CLAUSE() QUEUE_JOB_BEGIN_CLAUSE()
{ {
looped::system_screen_size(); looped::system_screen_size();

View File

@ -9,9 +9,9 @@ namespace big
void looped::player_specate() 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) if (!bReset)
{ {

View File

@ -17,16 +17,16 @@ namespace big
uint32_t& flags = g_local_player->m_player_info->m_frame_flags; 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; flags |= eFrameFlagExplosiveAmmo;
if (g.self.frame_flags.explosive_melee) if (g->self.frame_flags.explosive_melee)
flags |= eFrameFlagExplosiveMelee; flags |= eFrameFlagExplosiveMelee;
if (g.self.frame_flags.fire_ammo) if (g->self.frame_flags.fire_ammo)
flags |= eFrameFlagFireAmmo; flags |= eFrameFlagFireAmmo;
if (g.self.frame_flags.super_jump) if (g->self.frame_flags.super_jump)
flags |= eFrameFlagSuperJump; flags |= eFrameFlagSuperJump;
} }
} }

View File

@ -18,9 +18,9 @@ namespace big
if (g_local_player == nullptr) return; if (g_local_player == nullptr) return;
Entity ent = PLAYER::PLAYER_PED_ID(); 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); cCam = CAM::CREATE_CAM("DEFAULT_SCRIPTED_CAMERA", 0);
@ -34,7 +34,7 @@ namespace big
bLastFreeCam = true; bLastFreeCam = true;
} }
else if (!g.self.free_cam && bLastFreeCam) else if (!g->self.free_cam && bLastFreeCam)
{ {
CAM::SET_CAM_ACTIVE(cCam, false); CAM::SET_CAM_ACTIVE(cCam, false);
CAM::RENDER_SCRIPT_CAMS(false, true, 500, true, true, 0); CAM::RENDER_SCRIPT_CAMS(false, true, 500, true, true, 0);

View File

@ -7,13 +7,13 @@ namespace big
void looped::self_godmode() void looped::self_godmode()
{ {
bool bGodMode = g.self.godmode; bool bGodMode = g->self.godmode;
if (bGodMode || (!bGodMode && bGodMode != bLastGodMode)) 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;
} }
} }
} }

View File

@ -7,10 +7,10 @@ namespace big
{ {
Ped player = PLAYER::PLAYER_PED_ID(); Ped player = PLAYER::PLAYER_PED_ID();
if (g.self.no_ragdoll) { if (g->self.no_ragdoll) {
PED::SET_PED_CAN_RAGDOLL(player, !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_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !g->self.no_ragdoll);
PED::SET_PED_RAGDOLL_ON_COLLISION(player, !g.self.no_ragdoll); PED::SET_PED_RAGDOLL_ON_COLLISION(player, !g->self.no_ragdoll);
} }
} }

View File

@ -16,7 +16,7 @@ namespace big
static Vector3 rot{}; static Vector3 rot{};
void looped::self_noclip() { void looped::self_noclip() {
bool bNoclip = g.self.noclip; bool bNoclip = g->self.noclip;
Entity ent = PLAYER::PLAYER_PED_ID(); Entity ent = PLAYER::PLAYER_PED_ID();
bool bInVehicle = PED::IS_PED_IN_ANY_VEHICLE(ent, true); bool bInVehicle = PED::IS_PED_IN_ANY_VEHICLE(ent, true);

View File

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

View File

@ -8,9 +8,9 @@ namespace big
auto playerInfo = g_local_player->m_player_info; auto playerInfo = g_local_player->m_player_info;
if (g.self.never_wanted) if (g->self.never_wanted)
playerInfo->m_wanted_level = 0; playerInfo->m_wanted_level = 0;
else if (g.self.force_wanted_level) else if (g->self.force_wanted_level)
playerInfo->m_wanted_level = g.self.wanted_level; playerInfo->m_wanted_level = g->self.wanted_level;
} }
} }

View File

@ -11,7 +11,7 @@ namespace big
void looped::self_super_run() 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; if (run_speed < run_cap) run_speed += .5f;
@ -39,7 +39,7 @@ namespace big
g_local_player->m_player_info->m_run_speed = .7f; 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; 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; 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

@ -7,6 +7,6 @@ namespace big
{ {
void looped::system_screen_size() 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);
} }
} }

View File

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

View File

@ -5,7 +5,7 @@ namespace big
{ {
void looped::tunables_no_idle_kick() void looped::tunables_no_idle_kick()
{ {
if (g.tunables.no_idle_kick) if (g->tunables.no_idle_kick)
{ {
*script_global(1644209).at(1149).as<int*>() = 0; *script_global(1644209).at(1149).as<int*>() = 0;
*script_global(1644209).at(1165).as<int*>() = 0; *script_global(1644209).at(1165).as<int*>() = 0;

View File

@ -7,7 +7,7 @@ namespace big
{ {
void looped::vehicle_horn_boost() 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)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
{ {

View File

@ -16,7 +16,7 @@ namespace big
busy = true; busy = true;
constexpr int hash = RAGE_JOAAT("carmod_shop"); 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 ( if (
auto carmod_shop_thread = gta_util::find_script_thread(hash); 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<int*>() != 4 *script_local(carmod_shop_thread, 726).at(11).as<int*>() != 4
) )
{ {
g.vehicle.ls_customs = false; g->vehicle.ls_customs = false;
*script_local(carmod_shop_thread, 726).as<int*>() = 1; // cleanup *script_local(carmod_shop_thread, 726).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 = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()); Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID());
if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false)) if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false))
{ {
busy = false; busy = false;
g.vehicle.ls_customs = false; g->vehicle.ls_customs = false;
notify::above_map("You aren't in a vehicle."); notify::above_map("You aren't in a vehicle.");
@ -65,6 +65,6 @@ namespace big
} }
busy = false; busy = false;
state = g.vehicle.ls_customs; state = g->vehicle.ls_customs;
} }
} }

View File

@ -6,7 +6,7 @@ namespace big
{ {
void looped::vehicle_speedo_meter() 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; 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; 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_FONT(2);
HUD::SET_TEXT_SCALE(.9f, .9f); HUD::SET_TEXT_SCALE(.9f, .9f);
HUD::SET_TEXT_OUTLINE(); HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING"); HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed); 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_FONT(2);
HUD::SET_TEXT_SCALE(.91f, .91f); HUD::SET_TEXT_SCALE(.91f, .91f);
HUD::SET_TEXT_OUTLINE(); HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING"); HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(speed_type); 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);
} }
} }

View File

@ -6,10 +6,10 @@ namespace big
static bool last_veh_god = false; static bool last_veh_god = false;
void looped::vehicle_god_mode() 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; 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; g_local_player->m_vehicle->m_deform_god = 0x8C;
misc::set_bit((int*)&g_local_player->m_vehicle->m_damage_bits, 8); 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); 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;
} }
} }

View File

@ -9,7 +9,7 @@ namespace big
void looped::weapons_cage_gun() 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) if (bCageGun)
{ {

View File

@ -10,7 +10,7 @@ namespace big
void looped::weapons_delete_gun() 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) if (bCageGun)
{ {

View File

@ -16,7 +16,7 @@ namespace big
void looped::weapons_gravity_gun() 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; double multiplier = 3.0;
// ZOOMED IN // ZOOMED IN

View File

@ -6,7 +6,7 @@ namespace big
{ {
void looped::weapons_infinite_ammo() void looped::weapons_infinite_ammo()
{ {
if (g.weapons.infinite_ammo) { if (g->weapons.infinite_ammo) {
Hash weaponHash; Hash weaponHash;
auto const ped = PLAYER::PLAYER_PED_ID(); auto const ped = PLAYER::PLAYER_PED_ID();

View File

@ -5,8 +5,8 @@ namespace big
{ {
void looped::weapons_infinite_mag() void looped::weapons_infinite_mag()
{ {
if (g.weapons.infinite_mag) { if (g->weapons.infinite_mag) {
WEAPON::SET_PED_INFINITE_AMMO_CLIP(PLAYER::PLAYER_PED_ID(), g.weapons.infinite_mag); WEAPON::SET_PED_INFINITE_AMMO_CLIP(PLAYER::PLAYER_PED_ID(), g->weapons.infinite_mag);
} }
} }
} }

View File

@ -10,7 +10,7 @@ namespace big
void looped::weapons_repair_gun() 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) if (bRepairGun)
{ {

View File

@ -10,7 +10,7 @@ namespace big
void looped::weapons_steal_vehicle_gun() 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) if (bStealVehicleGun)
{ {

View File

@ -9,7 +9,7 @@ namespace big
void looped::weapons_vehicle_gun() 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) if (bVehicleGun)
{ {
@ -35,7 +35,7 @@ namespace big
location.y += dist * sin(yaw) * cos(pitch); location.y += dist * sin(yaw) * cos(pitch);
location.z += dist * sin(pitch); location.z += dist * sin(pitch);
Vehicle veh = vehicle::spawn( Vehicle veh = vehicle::spawn(
(const char*)g.weapons.vehicle_gun_model, (const char*)g->weapons.vehicle_gun_model,
location, location,
ENTITY::GET_ENTITY_HEADING(player) ENTITY::GET_ENTITY_HEADING(player)
); );

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "core/enums.hpp" #include "core/enums.hpp"
namespace big
{
struct SessionType { struct SessionType {
eSessionType id; eSessionType id;
const char name[22]; const char name[22];
@ -18,3 +20,4 @@ const SessionType sessions[] = {
{ eSessionType::JOIN_CREW, "Join Crew Session" }, { eSessionType::JOIN_CREW, "Join Crew Session" },
{ eSessionType::LEAVE_ONLINE, "Leave GTA Online" } { eSessionType::LEAVE_ONLINE, "Leave GTA Online" }
}; };
}

View File

@ -1,11 +1,13 @@
#pragma once #pragma once
#include "enums.hpp" #include "enums.hpp"
#include "file_manager.hpp"
#ifndef GLOBALS_H namespace big
#define GLOBALS_H {
class menu_settings;
inline menu_settings* g{};
using namespace big; class menu_settings {
struct globals {
nlohmann::json default_options; nlohmann::json default_options;
nlohmann::json options; nlohmann::json options;
@ -132,6 +134,7 @@ struct globals {
int y; int y;
}; };
public:
int friend_count = 0; int friend_count = 0;
int player_count = 0; int player_count = 0;
@ -146,6 +149,17 @@ struct globals {
weapons weapons{}; weapons weapons{};
window window{}; 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) void from_json(const nlohmann::json& j)
{ {
this->debug.script_event_logging = j["debug"]["script_event_logging"]; this->debug.script_event_logging = j["debug"]["script_event_logging"];
@ -335,7 +349,7 @@ struct globals {
void attempt_save() void attempt_save()
{ {
nlohmann::json& j = this->to_json(); const nlohmann::json& j = this->to_json();
if (deep_compare(this->options, j, true)) if (deep_compare(this->options, j, true))
this->save(); this->save();
@ -345,16 +359,13 @@ struct globals {
{ {
this->default_options = this->to_json(); this->default_options = this->to_json();
std::string settings_file = std::getenv("appdata"); std::ifstream file(m_save_file.get_path());
settings_file += this->settings_location;
std::ifstream file(settings_file);
if (!file.is_open()) if (!file.is_open())
{ {
this->write_default_config(); this->write_default_config();
file.open(settings_file); file.open(m_save_file.get_path());
} }
try try
@ -374,7 +385,7 @@ struct globals {
return this->load(); return this->load();
} }
bool should_save = this->deep_compare(this->options, this->default_options); const bool should_save = this->deep_compare(this->options, this->default_options);
this->from_json(this->options); this->from_json(this->options);
@ -388,7 +399,7 @@ struct globals {
} }
private: private:
const char* settings_location = "\\BigBaseV2\\settings.json"; file m_save_file;
bool deep_compare(nlohmann::json& current_settings, const nlohmann::json& default_settings, bool compare_value = false) bool deep_compare(nlohmann::json& current_settings, const nlohmann::json& default_settings, bool compare_value = false)
{ {
@ -421,10 +432,7 @@ private:
bool save() bool save()
{ {
std::string settings_file = std::getenv("appdata"); std::ofstream file(m_save_file.get_path(), std::ios::out | std::ios::trunc);
settings_file += this->settings_location;
std::ofstream file(settings_file, std::ios::out | std::ios::trunc);
file << this->to_json().dump(4); file << this->to_json().dump(4);
file.close(); file.close();
@ -433,16 +441,11 @@ private:
bool write_default_config() bool write_default_config()
{ {
std::string settings_file = std::getenv("appdata"); std::ofstream file(m_save_file.get_path(), std::ios::out | std::ios::trunc);
settings_file += this->settings_location;
std::ofstream file(settings_file, std::ios::out);
file << this->to_json().dump(4); file << this->to_json().dump(4);
file.close(); file.close();
return true; return true;
} }
}; };
}
inline struct globals g;
#endif // !GLOBALS_H

View File

@ -7,7 +7,7 @@ namespace big
{ {
if (ImGui::BeginTabItem("Debug")) 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")) if (ImGui::Button("Dump entrypoints"))
{ {

View File

@ -27,7 +27,7 @@ namespace big
if (ImGui::TreeNode("Lester")) if (ImGui::TreeNode("Lester"))
{ {
ImGui::Checkbox("Off Radar", &g.self.off_radar); ImGui::Checkbox("Off Radar", &g->self.off_radar);
ImGui::TreePop(); ImGui::TreePop();
} }
@ -92,7 +92,7 @@ namespace big
g_mobile_service->register_vehicles(); g_mobile_service->register_vehicles();
}QUEUE_JOB_END_CLAUSE }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(); ImGui::TreePop();
} }

View File

@ -10,12 +10,12 @@ namespace big
if (ImGui::BeginTabItem("Recovery")) if (ImGui::BeginTabItem("Recovery"))
{ {
ImGui::Text("Set Current Character Level:"); 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")) if (ImGui::Button("Set Level"))
{ {
QUEUE_JOB_BEGIN_CLAUSE() QUEUE_JOB_BEGIN_CLAUSE()
{ {
player::set_player_level(g.player.set_level); player::set_player_level(g->player.set_level);
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
} }

View File

@ -24,17 +24,17 @@ namespace big
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("God Mode", &g.self.godmode); ImGui::Checkbox("God Mode", &g->self.godmode);
ImGui::Checkbox("Off Radar", &g.self.off_radar); ImGui::Checkbox("Off Radar", &g->self.off_radar);
ImGui::Checkbox("Free Cam", &g.self.free_cam); ImGui::Checkbox("Free Cam", &g->self.free_cam);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("No Clip", &g.self.noclip); ImGui::Checkbox("No Clip", &g->self.noclip);
ImGui::Checkbox("No Ragdoll", &g.self.no_ragdoll); ImGui::Checkbox("No Ragdoll", &g->self.no_ragdoll);
ImGui::Checkbox("Super Run", &g.self.super_run); ImGui::Checkbox("Super Run", &g->self.super_run);
ImGui::EndGroup(); ImGui::EndGroup();
@ -45,15 +45,15 @@ namespace big
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("Explosive Ammo", &g.self.frame_flags.explosive_ammo); ImGui::Checkbox("Explosive Ammo", &g->self.frame_flags.explosive_ammo);
ImGui::Checkbox("Fire Ammo", &g.self.frame_flags.fire_ammo); ImGui::Checkbox("Fire Ammo", &g->self.frame_flags.fire_ammo);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("Explosive Melee", &g.self.frame_flags.explosive_melee); ImGui::Checkbox("Explosive Melee", &g->self.frame_flags.explosive_melee);
ImGui::Checkbox("Super Jump", &g.self.frame_flags.super_jump); ImGui::Checkbox("Super Jump", &g->self.frame_flags.super_jump);
ImGui::EndGroup(); ImGui::EndGroup();
@ -103,14 +103,14 @@ namespace big
if (ImGui::TreeNode("Police")) 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"); ImGui::Text("Wanted Level");
if (ImGui::SliderInt("###wanted_level", &g.self.wanted_level, 0, 5) && !g.self.force_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; g_local_player->m_player_info->m_wanted_level = g->self.wanted_level;
} }
ImGui::TreePop(); ImGui::TreePop();

View File

@ -12,15 +12,15 @@ namespace big
ImGui::PushItemWidth(350.f); ImGui::PushItemWidth(350.f);
ImGui::BeginGroup(); ImGui::BeginGroup();
if (ImGui::Hotkey("Menu Toggle", &g.settings.hotkeys.menu_toggle)) if (ImGui::Hotkey("Menu Toggle", &g->settings.hotkeys.menu_toggle))
g.settings.hotkeys.editing_menu_toggle = true; // make our menu reappear g->settings.hotkeys.editing_menu_toggle = true; // make our menu reappear
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Text("(Below hotkey is not implemented)"); 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::EndGroup();
ImGui::PopItemWidth(); ImGui::PopItemWidth();
@ -30,25 +30,25 @@ namespace big
if (ImGui::TreeNode("Protections")) if (ImGui::TreeNode("Protections"))
{ {
ImGui::Checkbox("Bounty", &g.protections.script_events.bounty); ImGui::Checkbox("Bounty", &g->protections.script_events.bounty);
ImGui::Checkbox("CEO Ban", &g.protections.script_events.ceo_ban); ImGui::Checkbox("CEO Ban", &g->protections.script_events.ceo_ban);
ImGui::Checkbox("CEO Kick", &g.protections.script_events.ceo_kick); ImGui::Checkbox("CEO Kick", &g->protections.script_events.ceo_kick);
ImGui::Checkbox("CEO Money", &g.protections.script_events.ceo_money); ImGui::Checkbox("CEO Money", &g->protections.script_events.ceo_money);
ImGui::Checkbox("Wanted Level", &g.protections.script_events.clear_wanted_level); ImGui::Checkbox("Wanted Level", &g->protections.script_events.clear_wanted_level);
ImGui::Checkbox("Fake Deposit", &g.protections.script_events.fake_deposit); ImGui::Checkbox("Fake Deposit", &g->protections.script_events.fake_deposit);
ImGui::Checkbox("Force Mission", &g.protections.script_events.force_mission); ImGui::Checkbox("Force Mission", &g->protections.script_events.force_mission);
ImGui::Checkbox("Force Teleport", &g.protections.script_events.force_teleport); ImGui::Checkbox("Force Teleport", &g->protections.script_events.force_teleport);
ImGui::Checkbox("GTA Banner", &g.protections.script_events.gta_banner); ImGui::Checkbox("GTA Banner", &g->protections.script_events.gta_banner);
ImGui::Checkbox("Network Bail", &g.protections.script_events.network_bail); ImGui::Checkbox("Network Bail", &g->protections.script_events.network_bail);
ImGui::Checkbox("Destroy Personal Vehicle", &g.protections.script_events.personal_vehicle_destroyed); 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("Remote Off Radar", &g->protections.script_events.remote_off_radar);
ImGui::Checkbox("Rotate Cam", &g.protections.script_events.rotate_cam); 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 Cutscene", &g->protections.script_events.send_to_cutscene);
ImGui::Checkbox("Send to Island", &g.protections.script_events.send_to_island); ImGui::Checkbox("Send to Island", &g->protections.script_events.send_to_island);
ImGui::Checkbox("Sound Spam", &g.protections.script_events.sound_spam); ImGui::Checkbox("Sound Spam", &g->protections.script_events.sound_spam);
ImGui::Checkbox("Spectate", &g.protections.script_events.spectate); ImGui::Checkbox("Spectate", &g->protections.script_events.spectate);
ImGui::Checkbox("Transaction Error", &g.protections.script_events.transaction_error); ImGui::Checkbox("Transaction Error", &g->protections.script_events.transaction_error);
ImGui::Checkbox("Vehicle Kick", &g.protections.script_events.vehicle_kick); ImGui::Checkbox("Vehicle Kick", &g->protections.script_events.vehicle_kick);
ImGui::TreePop(); ImGui::TreePop();
} }

View File

@ -17,16 +17,16 @@ namespace big
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
ImGui::Checkbox("Spoof Username", &g.spoofing.spoof_username); ImGui::Checkbox("Spoof Username", &g->spoofing.spoof_username);
static char name[20]; 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::Text("Username:");
ImGui::InputText("##username_input", name, sizeof(name)); ImGui::InputText("##username_input", name, sizeof(name));
if (name != g.spoofing.username) if (name != g->spoofing.username)
g.spoofing.username = std::string(name); g->spoofing.username = std::string(name);
ImGui::TreePop(); ImGui::TreePop();
} }
@ -38,10 +38,10 @@ namespace big
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
}QUEUE_JOB_END_CLAUSE }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::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(); ImGui::TreePop();
} }
@ -53,10 +53,10 @@ namespace big
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
}QUEUE_JOB_END_CLAUSE }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::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(); ImGui::TreePop();
} }

View File

@ -6,8 +6,8 @@ namespace big
{ {
if (ImGui::BeginTabItem("Tunables")) if (ImGui::BeginTabItem("Tunables"))
{ {
ImGui::Checkbox("Disable Phone", &g.tunables.disable_phone); ImGui::Checkbox("Disable Phone", &g->tunables.disable_phone);
ImGui::Checkbox("No Idle Kick", &g.tunables.no_idle_kick); ImGui::Checkbox("No Idle Kick", &g->tunables.no_idle_kick);
ImGui::EndTabItem(); ImGui::EndTabItem();
} }

View File

@ -18,8 +18,8 @@ namespace big
if (ImGui::TreeNode("General")) if (ImGui::TreeNode("General"))
{ {
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("God Mode", &g.vehicle.god_mode); ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
ImGui::Checkbox("Horn Boost", &g.vehicle.horn_boost); ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
@ -35,7 +35,7 @@ namespace big
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
} }
if (ImGui::Button("Handling")) if (ImGui::Button("Handling"))
g.window.handling = true; g->window.handling = true;
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::TreePop(); ImGui::TreePop();
@ -45,7 +45,7 @@ namespace big
{ {
if (ImGui::Button("Start LS Customs")) if (ImGui::Button("Start LS Customs"))
{ {
g.vehicle.ls_customs = true; g->vehicle.ls_customs = true;
} }
ImGui::TreePop(); ImGui::TreePop();
@ -53,7 +53,7 @@ namespace big
if (ImGui::TreeNode("Speedo Meter")) if (ImGui::TreeNode("Speedo Meter"))
{ {
SpeedoMeter selected = g.vehicle.speedo_meter.type; SpeedoMeter selected = g->vehicle.speedo_meter.type;
ImGui::Text("Type:"); ImGui::Text("Type:");
if (ImGui::BeginCombo("###speedo_type", speedo_meters[(int)selected].name)) if (ImGui::BeginCombo("###speedo_type", speedo_meters[(int)selected].name))
@ -62,7 +62,7 @@ namespace big
{ {
if (ImGui::Selectable(speedo.name, speedo.id == selected)) 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) if (speedo.id == selected)
@ -75,15 +75,15 @@ namespace big
ImGui::Text("Position"); ImGui::Text("Position");
float pos[2]; float pos[2];
pos[0] = g.vehicle.speedo_meter.x; pos[0] = g->vehicle.speedo_meter.x;
pos[1] = g.vehicle.speedo_meter.y; pos[1] = g->vehicle.speedo_meter.y;
if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f")) if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f"))
{ {
g.vehicle.speedo_meter.x = pos[0]; g->vehicle.speedo_meter.x = pos[0];
g.vehicle.speedo_meter.y = pos[1]; 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(); ImGui::TreePop();
} }

View File

@ -9,18 +9,18 @@ namespace big
{ {
if (ImGui::TreeNode("Ammo Options")) if (ImGui::TreeNode("Ammo Options"))
{ {
ImGui::Checkbox("Infinite Ammo", &g.weapons.infinite_ammo); ImGui::Checkbox("Infinite Ammo", &g->weapons.infinite_ammo);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Infinite Clip", &g.weapons.infinite_mag); ImGui::Checkbox("Infinite Clip", &g->weapons.infinite_mag);
ImGui::TreePop(); ImGui::TreePop();
} }
if (ImGui::TreeNode("Custom Weapons")) 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)) if (ImGui::BeginCombo("Weapon", custom_weapons[(int)selected].name))
{ {
@ -28,7 +28,7 @@ namespace big
{ {
if (ImGui::Selectable(weapon.name, weapon.id == selected)) if (ImGui::Selectable(weapon.name, weapon.id == selected))
{ {
g.weapons.custom_weapon = weapon.id; g->weapons.custom_weapon = weapon.id;
} }
if (weapon.id == selected) if (weapon.id == selected)
@ -52,7 +52,7 @@ namespace big
break; break;
case CustomWeapon::VEHICLE_GUN: case CustomWeapon::VEHICLE_GUN:
ImGui::Text("Shooting Model:"); 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; break;
} }

View File

@ -7,7 +7,7 @@ namespace big
{ {
if (ImGui::BeginTabItem("Info")) if (ImGui::BeginTabItem("Info"))
{ {
ImGui::Checkbox("Spectate", &g.player.spectating); ImGui::Checkbox("Spectate", &g->player.spectating);
ImGui::Separator(); ImGui::Separator();

View File

@ -5,7 +5,7 @@ namespace big
{ {
void window::debug() void window::debug()
{ {
if (g.window.debug && ImGui::Begin("Dev")) if (g->window.debug && ImGui::Begin("Dev"))
{ {
ImGui::BeginTabBar("dev_tabbar"); ImGui::BeginTabBar("dev_tabbar");
tab_debug::_tab_debug(); tab_debug::_tab_debug();

View File

@ -10,7 +10,7 @@ namespace big
{ {
ImGui::SetNextWindowSize({ 500, 250 }, ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize({ 500, 250 }, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowPos({ 50, 50 }, 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) if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT)
{ {

View File

@ -7,7 +7,7 @@ namespace big
void window::main() void window::main()
{ {
ImGui::SetNextWindowSize({ 800, 840 }, ImGuiCond_FirstUseEver); 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"); ImGui::BeginTabBar("tabbar");
tab_main::tab_self(); tab_main::tab_self();

View File

@ -9,7 +9,7 @@ namespace big
std::string title = fmt::format("Player Options: {}###player_options", g_player_service->get_selected()->get_name()); std::string title = fmt::format("Player Options: {}###player_options", g_player_service->get_selected()->get_name());
ImGui::SetNextWindowSize({ 350.f, 300.f }, ImGuiCond_FirstUseEver); 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"); ImGui::BeginTabBar("tabbar_player");
tab_player::tab_info(); tab_player::tab_info();

View File

@ -51,10 +51,10 @@ namespace big
if (ImGui::BeginMenu("Windows")) if (ImGui::BeginMenu("Windows"))
{ {
ImGui::MenuItem("Main", nullptr, &g.window.main); ImGui::MenuItem("Main", nullptr, &g->window.main);
ImGui::MenuItem("Players", nullptr, &g.window.users); ImGui::MenuItem("Players", nullptr, &g->window.users);
ImGui::MenuItem("Logs", nullptr, &g.window.log); ImGui::MenuItem("Logs", nullptr, &g->window.log);
ImGui::MenuItem("Debug", nullptr, &g.window.debug); ImGui::MenuItem("Debug", nullptr, &g->window.debug);
ImGui::EndMenu(); ImGui::EndMenu();
} }

View File

@ -9,10 +9,10 @@ namespace big
static const float height_correction = 28.f; static const float height_correction = 28.f;
static const float width = 170.f; static const float width = 170.f;
ImGui::SetNextWindowSize({ width, (float)g.window.y - 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::SetNextWindowPos({ g->window.x - width, height_correction }, ImGuiCond_Always);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.f); 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:"); ImGui::Text("Friends:");
for (auto& item : g_player_service->m_players) for (auto& item : g_player_service->m_players)
@ -22,7 +22,7 @@ namespace big
{ {
g_player_service->set_selected(plyr.get()); 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_player_service->set_selected(plyr.get());
g.window.player = true; g->window.player = true;
} }
} }

View File

@ -10,7 +10,7 @@ namespace big
g_native_hooks->do_cleanup_for_thread(thread); g_native_hooks->do_cleanup_for_thread(thread);
if (thread->m_script_hash == RAGE_JOAAT("freemode")) 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; return result;
} }

View File

@ -10,7 +10,7 @@ namespace big
{ {
rage::eThreadState state = thread->m_context.m_state; 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)); memcpy(struct_backup, (void*)thread, sizeof(GtaThread));
if (thread->m_stack) if (thread->m_stack)
@ -21,7 +21,7 @@ namespace big
if (thread->m_script_hash == RAGE_JOAAT("freemode")) 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..."; 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); 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; return result;

View File

@ -16,97 +16,97 @@ namespace big
switch (hash) switch (hash)
{ {
case eRemoteEvent::Bounty: case eRemoteEvent::Bounty:
if (g.protections.script_events.bounty) if (g->protections.script_events.bounty)
strcpy(type, "Bounty"); strcpy(type, "Bounty");
break; break;
case eRemoteEvent::CeoBan: case eRemoteEvent::CeoBan:
if (g.protections.script_events.ceo_ban) if (g->protections.script_events.ceo_ban)
strcpy(type, "Ceo Ban"); strcpy(type, "Ceo Ban");
break; break;
case eRemoteEvent::CeoKick: case eRemoteEvent::CeoKick:
if (g.protections.script_events.ceo_kick) if (g->protections.script_events.ceo_kick)
strcpy(type, "Ceo Kick"); strcpy(type, "Ceo Kick");
break; break;
case eRemoteEvent::CeoMoney: case eRemoteEvent::CeoMoney:
if (g.protections.script_events.ceo_money) if (g->protections.script_events.ceo_money)
strcpy(type, "Ceo Money"); strcpy(type, "Ceo Money");
break; break;
case eRemoteEvent::ClearWantedLevel: case eRemoteEvent::ClearWantedLevel:
if (g.protections.script_events.clear_wanted_level) if (g->protections.script_events.clear_wanted_level)
strcpy(type, "Clear Wanted Level"); strcpy(type, "Clear Wanted Level");
break; break;
case eRemoteEvent::FakeDeposit: case eRemoteEvent::FakeDeposit:
if (g.protections.script_events.fake_deposit) if (g->protections.script_events.fake_deposit)
strcpy(type, "Deposit"); strcpy(type, "Deposit");
break; break;
case eRemoteEvent::ForceMission: case eRemoteEvent::ForceMission:
if (g.protections.script_events.force_mission) if (g->protections.script_events.force_mission)
strcpy(type, "Force Mission"); strcpy(type, "Force Mission");
break; break;
case eRemoteEvent::GtaBanner: case eRemoteEvent::GtaBanner:
if (g.protections.script_events.gta_banner) if (g->protections.script_events.gta_banner)
strcpy(type, "GTA Banner"); strcpy(type, "GTA Banner");
break; break;
case eRemoteEvent::NetworkBail: case eRemoteEvent::NetworkBail:
if (g.protections.script_events.network_bail) if (g->protections.script_events.network_bail)
strcpy(type, "Network Bail"); strcpy(type, "Network Bail");
break; break;
case eRemoteEvent::PersonalVehicleDestroyed: case eRemoteEvent::PersonalVehicleDestroyed:
if (g.protections.script_events.personal_vehicle_destroyed) if (g->protections.script_events.personal_vehicle_destroyed)
strcpy(type, "Personal Vehicle Destroyed"); strcpy(type, "Personal Vehicle Destroyed");
break; break;
case eRemoteEvent::RemoteOffradar: case eRemoteEvent::RemoteOffradar:
if (g.protections.script_events.remote_off_radar) if (g->protections.script_events.remote_off_radar)
strcpy(type, "Remote Off Radar"); strcpy(type, "Remote Off Radar");
break; break;
case eRemoteEvent::RotateCam: case eRemoteEvent::RotateCam:
if (g.protections.script_events.rotate_cam) if (g->protections.script_events.rotate_cam)
strcpy(type, "Rotate Cam"); strcpy(type, "Rotate Cam");
break; break;
case eRemoteEvent::SendToCutscene: case eRemoteEvent::SendToCutscene:
if (g.protections.script_events.send_to_cutscene) if (g->protections.script_events.send_to_cutscene)
strcpy(type, "Send To Cutscene"); strcpy(type, "Send To Cutscene");
break; break;
case eRemoteEvent::SendToIsland: case eRemoteEvent::SendToIsland:
if (g.protections.script_events.send_to_island) if (g->protections.script_events.send_to_island)
strcpy(type, "Send To Island"); strcpy(type, "Send To Island");
break; break;
case eRemoteEvent::SoundSpam: case eRemoteEvent::SoundSpam:
if (g.protections.script_events.sound_spam) if (g->protections.script_events.sound_spam)
strcpy(type, "Sound Spam"); strcpy(type, "Sound Spam");
break; break;
case eRemoteEvent::Spectate: case eRemoteEvent::Spectate:
if (g.protections.script_events.spectate) if (g->protections.script_events.spectate)
strcpy(type, "Specate"); strcpy(type, "Specate");
break; break;
case eRemoteEvent::Teleport: case eRemoteEvent::Teleport:
if (g.protections.script_events.force_teleport) if (g->protections.script_events.force_teleport)
strcpy(type, "Force Teleport"); strcpy(type, "Force Teleport");
break; break;
case eRemoteEvent::TransactionError: case eRemoteEvent::TransactionError:
if (g.protections.script_events.transaction_error) if (g->protections.script_events.transaction_error)
strcpy(type, "Transaction Error"); strcpy(type, "Transaction Error");
break; break;
case eRemoteEvent::VehicleKick: case eRemoteEvent::VehicleKick:
if (g.protections.script_events.vehicle_kick) if (g->protections.script_events.vehicle_kick)
strcpy(type, "Vehicle Kick"); strcpy(type, "Vehicle Kick");
break; break;
@ -121,7 +121,7 @@ namespace big
return true; return true;
} }
if (g.debug.script_event_logging) if (g->debug.script_event_logging)
{ {
LOG(INFO) << "== Begin of Script Event =="; LOG(INFO) << "== Begin of Script Event ==";
LOG(INFO) << "Player: " << player->get_name(); LOG(INFO) << "Player: " << player->get_name();

View File

@ -9,21 +9,21 @@ namespace big
{ {
LOG(INFO) << "HOOKS | Sending spoofed values to lobby."; LOG(INFO) << "HOOKS | Sending spoofed values to lobby.";
if (g.spoofing.spoof_username) if (g->spoofing.spoof_username)
memcpy(player->m_name, g.spoofing.username.c_str(), sizeof(player->m_name)); 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_field1 = g->spoofing.ip_address[0];
player->m_external_ip.m_field2 = g.spoofing.ip_address[1]; 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_field3 = g->spoofing.ip_address[2];
player->m_external_ip.m_field4 = g.spoofing.ip_address[3]; 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_id = g->spoofing.rockstar_id;
player->m_rockstar_id2 = g.spoofing.rockstar_id; player->m_rockstar_id2 = g->spoofing.rockstar_id;
} }
} }

View File

@ -1,4 +1,5 @@
#include "common.hpp" #include "common.hpp"
#include "core/globals.hpp"
#include "features.hpp" #include "features.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gui.hpp" #include "gui.hpp"
@ -32,6 +33,10 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
base_dir /= "BigBaseV2"; base_dir /= "BigBaseV2";
auto file_manager_instance = std::make_unique<file_manager>(base_dir); 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>( auto logger_instance = std::make_unique<logger>(
"YimMenu", "YimMenu",
file_manager_instance->get_project_file("./cout.log") 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<hooking>(); auto hooking_instance = std::make_unique<hooking>();
LOG(INFO) << "Hooking initialized."; LOG(INFO) << "Hooking initialized.";
g.load(); g->load();
LOG(INFO) << "Settings Loaded."; LOG(INFO) << "Settings Loaded.";
auto thread_pool_instance = std::make_unique<thread_pool>(); auto thread_pool_instance = std::make_unique<thread_pool>();
@ -124,9 +129,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
logger_instance->destroy(); logger_instance->destroy();
logger_instance.reset(); logger_instance.reset();
file_manager_instance.reset(); globals_instance.reset();
std::this_thread::sleep_for(10s); file_manager_instance.reset();
CloseHandle(g_main_thread); CloseHandle(g_main_thread);
FreeLibraryAndExitThread(g_hmodule, 0); FreeLibraryAndExitThread(g_hmodule, 0);

View File

@ -8,7 +8,7 @@ namespace big
{ {
inline void SET_ENTITY_COORDS(rage::scrNativeCallContext* src) inline void SET_ENTITY_COORDS(rage::scrNativeCallContext* src)
{ {
if (!g.vehicle.ls_customs) if (!g->vehicle.ls_customs)
{ {
ENTITY::SET_ENTITY_COORDS( ENTITY::SET_ENTITY_COORDS(
src->get_arg<Entity>(0), src->get_arg<Entity>(0),
@ -25,7 +25,7 @@ namespace big
inline void SET_ENTITY_HEADING(rage::scrNativeCallContext* src) inline void SET_ENTITY_HEADING(rage::scrNativeCallContext* src)
{ {
if (!g.vehicle.ls_customs) if (!g->vehicle.ls_customs)
{ {
ENTITY::SET_ENTITY_HEADING( ENTITY::SET_ENTITY_HEADING(
src->get_arg<Entity>(0), src->get_arg<Entity>(0),
@ -36,7 +36,7 @@ namespace big
inline void SET_VEHICLE_LIGHTS(rage::scrNativeCallContext* src) inline void SET_VEHICLE_LIGHTS(rage::scrNativeCallContext* src)
{ {
if (!g.vehicle.ls_customs) if (!g->vehicle.ls_customs)
{ {
VEHICLE::SET_VEHICLE_LIGHTS( VEHICLE::SET_VEHICLE_LIGHTS(
src->get_arg<Vehicle>(0), src->get_arg<Vehicle>(0),

View File

@ -96,7 +96,7 @@ namespace big
void renderer::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) 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. //Persist and restore the cursor position between menu instances.
static POINT cursor_coords{}; static POINT cursor_coords{};
@ -109,9 +109,9 @@ namespace big
SetCursorPos(cursor_coords.x, cursor_coords.y); SetCursorPos(cursor_coords.x, cursor_coords.y);
} }
g_gui.m_opened = g.settings.hotkeys.editing_menu_toggle || !g_gui.m_opened; g_gui.m_opened = g->settings.hotkeys.editing_menu_toggle || !g_gui.m_opened;
if (g.settings.hotkeys.editing_menu_toggle) if (g->settings.hotkeys.editing_menu_toggle)
g.settings.hotkeys.editing_menu_toggle = false; g->settings.hotkeys.editing_menu_toggle = false;
} }
if (g_gui.m_opened) if (g_gui.m_opened)

View File

@ -111,7 +111,7 @@ namespace big::mobile
// blocking call till vehicle is delivered // blocking call till vehicle is delivered
notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as<int*>(), -1); notify::busy_spinner("Delivering vehicle...", mechanic_global.at(958).as<int*>(), -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)); vehicle::bring(globals::get_personal_vehicle(), ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true));
} }
} }

View File

@ -19,10 +19,10 @@ namespace big::player
inline void set_player_level(int level) 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]; 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); STATS::STAT_SET_INT(rage::joaat(level_string), levels[level - 1], 0);
} }