Tunables service fix and theme changes (#1507)

This commit is contained in:
maybegreat48 2023-06-23 06:43:44 +00:00 committed by GitHub
parent 74d3e2ac57
commit 1d75981731
43 changed files with 1616 additions and 800 deletions

View File

@ -6,6 +6,7 @@
#include "script_patches.hpp" #include "script_patches.hpp"
#include "services/context_menu/context_menu_service.hpp" #include "services/context_menu/context_menu_service.hpp"
#include "services/orbital_drone/orbital_drone.hpp" #include "services/orbital_drone/orbital_drone.hpp"
#include "services/script_connection/script_connection_service.hpp"
#include "services/squad_spawner/squad_spawner.hpp" #include "services/squad_spawner/squad_spawner.hpp"
#include "services/tunables/tunables_service.hpp" #include "services/tunables/tunables_service.hpp"
#include "services/vehicle/vehicle_control_service.hpp" #include "services/vehicle/vehicle_control_service.hpp"
@ -98,6 +99,9 @@ namespace big
looped::session_auto_kick_host(); looped::session_auto_kick_host();
looped::session_block_jobs(); looped::session_block_jobs();
if (g_script_connection_service)
g_script_connection_service->on_tick();
script::get_current()->yield(); script::get_current()->yield();
} }
} }

View File

@ -6,6 +6,7 @@
#include "hooking.hpp" #include "hooking.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "services/script_connection/script_connection_service.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
#include <script/globals/GPBD_FM.hpp> #include <script/globals/GPBD_FM.hpp>
@ -26,107 +27,19 @@ namespace big
{ {
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[player->id()].PropertyData.Index != -1) if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[player->id()].PropertyData.Index != -1)
{ {
int id = player->id(); auto cxn = g_script_connection_service->create_connection("am_mp_property_int", player);
g_fiber_pool->queue_job([id] { cxn->set_host_broadcast_size(1359);
int instance = -1; cxn->set_player_broadcast_size(1185);
cxn->set_no_remote_start(true);
cxn->set_wait_for_host_broadcast_data(true);
cxn->set_quick_cleanup(true);
cxn->set_debug_logging(true);
cxn->set_broadcast_modify_callback([](rage::scrThread* thread, uint64_t* server_vars, uint64_t* client_vars) {
server_vars[718] = 1;
});
for (int i = 0; i < 32; i++) g_fiber_pool->queue_job([cxn] {
{ cxn->start();
if (NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT_ON_SCRIPT(id, "am_mp_property_int", i))
{
instance = i;
break;
}
}
if (instance == -1)
{
return;
}
while (!SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(RAGE_JOAAT("am_mp_property_int")))
{
SCRIPT::REQUEST_SCRIPT_WITH_NAME_HASH(RAGE_JOAAT("am_mp_property_int"));
script::get_current()->yield();
}
auto program = gta_util::find_script_program(RAGE_JOAAT("am_mp_property_int"));
int count = program->m_local_count;
program->m_local_count = 2;
int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH(RAGE_JOAAT("am_mp_property_int"), 1424);
program->m_local_count = count;
auto script = gta_util::find_script_thread_by_id(id);
if (!script)
return;
script->m_context.m_state = rage::eThreadState::unk_3;
gta_util::execute_as_script(script, [instance] {
if (auto hook =
g_hooking->m_handler_hooks[(CGameScriptHandler*)rage::scrThread::get()->m_handler].get())
{
hook->disable();
g_hooking->m_handler_hooks.erase((CGameScriptHandler*)rage::scrThread::get()->m_handler);
}
NETWORK::NETWORK_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT(32, true, instance);
});
for (int i = 0; i < 100; i++)
{
int status = 0;
gta_util::execute_as_script(script, [&status] {
status = NETWORK::NETWORK_GET_SCRIPT_STATUS();
});
if (status == 2)
break;
if (status > 2)
{
script->kill();
return;
}
script::get_current()->yield(50ms);
}
static uint64_t server_vars[1358]{};
static uint64_t client_vars[1185]{};
gta_util::execute_as_script(script, [] {
NETWORK::NETWORK_REGISTER_HOST_BROADCAST_VARIABLES((int*)server_vars, 1358, 0);
NETWORK::NETWORK_REGISTER_PLAYER_BROADCAST_VARIABLES((int*)client_vars, 1185, 0);
});
for (int i = 0; i < 3600; i++)
{
bool received = false;
gta_util::execute_as_script(script, [&received] {
received = NETWORK::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA();
});
if (received)
break;
script::get_current()->yield();
}
if (!scripts::force_host(RAGE_JOAAT("am_mp_property_int")))
{
script->kill();
return;
}
server_vars[717] = 1;
script::get_current()->yield(3s);
script->kill();
}); });
} }
else else

View File

@ -10,7 +10,8 @@ namespace big
virtual void on_enable() override virtual void on_enable() override
{ {
*g_pointers->m_gta.m_refresh_audio_input = true; *g_pointers->m_gta.m_refresh_audio_input = true;
*g_pointers->m_gta.m_refresh_audio_input_2 = true;
} }
virtual void on_tick() override virtual void on_tick() override
@ -20,7 +21,8 @@ namespace big
virtual void on_disable() override virtual void on_disable() override
{ {
*g_pointers->m_gta.m_refresh_audio_input = true; *g_pointers->m_gta.m_refresh_audio_input = true;
*g_pointers->m_gta.m_refresh_audio_input_2 = true;
NETWORK::NETWORK_OVERRIDE_SEND_RESTRICTIONS_ALL(false); NETWORK::NETWORK_OVERRIDE_SEND_RESTRICTIONS_ALL(false);
} }
}; };

View File

@ -2,6 +2,236 @@
namespace big namespace big
{ {
constexpr const static inline auto launcher_scripts = std::to_array({
0u,
RAGE_JOAAT("AM_HOLD_UP"),
0u,
RAGE_JOAAT("AM_CR_SELL_DRUGS"),
RAGE_JOAAT("AM_STRIPPER"),
RAGE_JOAAT("stripclub_mp"),
RAGE_JOAAT("AM_ArmWrestling"),
RAGE_JOAAT("AM_ImportExport"),
RAGE_JOAAT("AM_Tennis"),
RAGE_JOAAT("AM_Darts"),
RAGE_JOAAT("AM_FistFight"),
RAGE_JOAAT("AM_DropOffHooker"),
RAGE_JOAAT("AM_Safehouse"),
RAGE_JOAAT("AM_Hitchhiker"),
0u,
RAGE_JOAAT("AM_DOORS"),
RAGE_JOAAT("MG_RACE_TO_POINT"),
RAGE_JOAAT("AM_PI_MENU"),
RAGE_JOAAT("AM_CRATE_DROP"),
RAGE_JOAAT("AM_IMP_EXP"),
RAGE_JOAAT("FM_INTRO"),
RAGE_JOAAT("AM_PROSTITUTE"),
RAGE_JOAAT("AM_TAXI"),
RAGE_JOAAT("AM_TAXI_LAUNCHER"),
RAGE_JOAAT("AM_GANG_CALL"),
RAGE_JOAAT("heli_gun"),
RAGE_JOAAT("AM_backup_heli"),
RAGE_JOAAT("AM_airstrike"),
RAGE_JOAAT("AM_AMMO_DROP"),
RAGE_JOAAT("AM_VEHICLE_DROP"),
RAGE_JOAAT("AM_BRU_BOX"),
RAGE_JOAAT("AM_GA_PICKUPS"),
RAGE_JOAAT("AM_JOYRIDER"),
RAGE_JOAAT("AM_PLANE_TAKEDOWN"),
RAGE_JOAAT("AM_DISTRACT_COPS"),
RAGE_JOAAT("AM_DESTROY_VEH"),
RAGE_JOAAT("AM_HOT_TARGET"),
RAGE_JOAAT("AM_KILL_LIST"),
RAGE_JOAAT("AM_TIME_TRIAL"),
RAGE_JOAAT("AM_CP_COLLECTION"),
RAGE_JOAAT("AM_CHALLENGES"),
RAGE_JOAAT("AM_PENNED_IN"),
RAGE_JOAAT("AM_PASS_THE_PARCEL"),
RAGE_JOAAT("AM_HOT_PROPERTY"),
RAGE_JOAAT("AM_DEAD_DROP"),
RAGE_JOAAT("AM_KING_OF_THE_CASTLE"),
RAGE_JOAAT("AM_CRIMINAL_DAMAGE"),
RAGE_JOAAT("AM_HUNT_THE_BEAST"),
RAGE_JOAAT("GB_LIMO_ATTACK"),
RAGE_JOAAT("GB_DEATHMATCH"),
RAGE_JOAAT("GB_STEAL_VEH"),
RAGE_JOAAT("GB_POINT_TO_POINT"),
RAGE_JOAAT("GB_TERMINATE"),
RAGE_JOAAT("GB_YACHT_ROB"),
RAGE_JOAAT("GB_BELLYBEAST"),
RAGE_JOAAT("GB_FIVESTAR"),
RAGE_JOAAT("GB_ROB_SHOP"),
RAGE_JOAAT("GB_COLLECT_MONEY"),
RAGE_JOAAT("GB_ASSAULT"),
RAGE_JOAAT("GB_VEH_SURV"),
RAGE_JOAAT("GB_SIGHTSEER"),
RAGE_JOAAT("GB_FLYING_IN_STYLE"),
RAGE_JOAAT("GB_FINDERSKEEPERS"),
RAGE_JOAAT("GB_HUNT_THE_BOSS"),
RAGE_JOAAT("GB_CARJACKING"),
RAGE_JOAAT("GB_HEADHUNTER"),
RAGE_JOAAT("GB_CONTRABAND_BUY"),
RAGE_JOAAT("GB_CONTRABAND_SELL"),
RAGE_JOAAT("GB_CONTRABAND_DEFEND"),
RAGE_JOAAT("GB_AIRFREIGHT"),
RAGE_JOAAT("GB_CASHING_OUT"),
RAGE_JOAAT("GB_SALVAGE"),
RAGE_JOAAT("GB_FRAGILE_GOODS"),
RAGE_JOAAT("GB_VEHICLE_EXPORT"),
RAGE_JOAAT("GB_VEHICLE_EXPORT"),
RAGE_JOAAT("GB_PLOUGHED"),
RAGE_JOAAT("GB_FULLY_LOADED"),
RAGE_JOAAT("GB_AMPHIBIOUS_ASSAULT"),
RAGE_JOAAT("GB_TRANSPORTER"),
RAGE_JOAAT("GB_FORTIFIED"),
RAGE_JOAAT("GB_VELOCITY"),
RAGE_JOAAT("GB_RAMPED_UP"),
RAGE_JOAAT("GB_STOCKPILING"),
RAGE_JOAAT("GB_BIKER_RACE_P2P"),
RAGE_JOAAT("GB_BIKER_JOUST"),
RAGE_JOAAT("GB_BIKER_UNLOAD_WEAPONS"),
0u,
RAGE_JOAAT("GB_BIKER_BAD_DEAL"),
RAGE_JOAAT("GB_BIKER_RESCUE_CONTACT"),
RAGE_JOAAT("GB_BIKER_LAST_RESPECTS"),
RAGE_JOAAT("GB_BIKER_CONTRACT_KILLING"),
RAGE_JOAAT("GB_BIKER_CONTRABAND_SELL"),
RAGE_JOAAT("GB_BIKER_CONTRABAND_DEFEND"),
RAGE_JOAAT("GB_ILLICIT_GOODS_RESUPPLY"),
RAGE_JOAAT("GB_BIKER_DRIVEBY_ASSASSIN"),
RAGE_JOAAT("GB_BIKER_RIPPIN_IT_UP"),
RAGE_JOAAT("GB_BIKER_FREE_PRISONER"),
RAGE_JOAAT("GB_BIKER_SAFECRACKER"),
RAGE_JOAAT("GB_BIKER_STEAL_BIKES"),
RAGE_JOAAT("GB_BIKER_SEARCH_AND_DESTROY"),
RAGE_JOAAT("AM_PENNED_IN"),
RAGE_JOAAT("GB_BIKER_STAND_YOUR_GROUND"),
RAGE_JOAAT("GB_BIKER_CRIMINAL_MISCHIEF"),
RAGE_JOAAT("GB_BIKER_DESTROY_VANS"),
RAGE_JOAAT("GB_BIKER_BURN_ASSETS"),
RAGE_JOAAT("GB_BIKER_SHUTTLE"),
RAGE_JOAAT("GB_BIKER_WHEELIE_RIDER"),
RAGE_JOAAT("GB_GUNRUNNING"),
RAGE_JOAAT("GB_GUNRUNNING"),
RAGE_JOAAT("GB_GUNRUNNING_DEFEND"),
RAGE_JOAAT("GB_SMUGGLER"),
RAGE_JOAAT("GB_SMUGGLER"),
RAGE_JOAAT("GB_SMUGGLER"),
RAGE_JOAAT("GB_GANGOPS"),
RAGE_JOAAT("BUSINESS_BATTLES"),
RAGE_JOAAT("BUSINESS_BATTLES_SELL"),
RAGE_JOAAT("BUSINESS_BATTLES_DEFEND"),
RAGE_JOAAT("GB_SECURITY_VAN"),
RAGE_JOAAT("GB_TARGET_PURSUIT"),
RAGE_JOAAT("GB_JEWEL_STORE_GRAB"),
RAGE_JOAAT("GB_BANK_JOB"),
RAGE_JOAAT("GB_DATA_HACK"),
RAGE_JOAAT("GB_INFILTRATION"),
RAGE_JOAAT("BUSINESS_BATTLES_DEFEND"),
RAGE_JOAAT("BUSINESS_BATTLES_SELL"),
RAGE_JOAAT("GB_CASINO"),
RAGE_JOAAT("GB_CASINO_HEIST"),
RAGE_JOAAT("fm_content_business_battles"),
RAGE_JOAAT("fm_content_drug_vehicle"),
RAGE_JOAAT("fm_content_movie_props"),
RAGE_JOAAT("fm_content_island_heist"),
RAGE_JOAAT("fm_content_island_dj"),
RAGE_JOAAT("AM_ISLAND_BACKUP_HELI"),
RAGE_JOAAT("fm_content_golden_gun"),
RAGE_JOAAT("fm_content_tuner_robbery"),
RAGE_JOAAT("fm_content_vehicle_list"),
RAGE_JOAAT("tuner_sandbox_activity"),
RAGE_JOAAT("fm_content_auto_shop_delivery"),
RAGE_JOAAT("fm_content_payphone_hit"),
RAGE_JOAAT("fm_content_security_contract"),
RAGE_JOAAT("fm_content_vip_contract_1"),
RAGE_JOAAT("fm_content_metal_detector"),
RAGE_JOAAT("am_agency_suv"),
RAGE_JOAAT("fm_content_phantom_car"),
RAGE_JOAAT("fm_content_slasher"),
RAGE_JOAAT("fm_content_sightseeing"),
RAGE_JOAAT("fm_content_smuggler_trail"),
RAGE_JOAAT("fm_content_smuggler_plane"),
RAGE_JOAAT("fm_content_skydive"),
RAGE_JOAAT("fm_content_cerberus"),
RAGE_JOAAT("fm_content_parachuter"),
RAGE_JOAAT("fm_content_crime_scene"),
RAGE_JOAAT("fm_content_bar_resupply"),
RAGE_JOAAT("fm_content_bike_shop_delivery"),
RAGE_JOAAT("fm_content_clubhouse_contracts"),
RAGE_JOAAT("fm_content_cargo"),
RAGE_JOAAT("fm_content_export_cargo"),
RAGE_JOAAT("fm_content_ammunation"),
RAGE_JOAAT("fm_content_gunrunning"),
RAGE_JOAAT("fm_content_source_research"),
RAGE_JOAAT("fm_content_club_management"),
RAGE_JOAAT("fm_content_club_odd_jobs"),
RAGE_JOAAT("fm_content_club_source"),
RAGE_JOAAT("fm_content_convoy"),
RAGE_JOAAT("fm_content_robbery"),
RAGE_JOAAT("fm_content_acid_lab_setup"),
RAGE_JOAAT("fm_content_acid_lab_source"),
RAGE_JOAAT("fm_content_acid_lab_sell"),
RAGE_JOAAT("fm_content_drug_lab_work"),
RAGE_JOAAT("fm_content_stash_house"),
RAGE_JOAAT("fm_content_taxi_driver"),
RAGE_JOAAT("fm_content_xmas_mugger"),
RAGE_JOAAT("fm_content_bank_shootout"),
RAGE_JOAAT("fm_content_armoured_truck"),
RAGE_JOAAT("fm_content_ghosthunt"),
RAGE_JOAAT("fm_content_smuggler_sell"),
RAGE_JOAAT("fm_content_smuggler_resupply"),
RAGE_JOAAT("fm_content_smuggler_ops"),
RAGE_JOAAT("fm_content_bicycle_time_trial"),
RAGE_JOAAT("fm_content_possessed_animals"),
RAGE_JOAAT("AM_BOAT_TAXI"),
RAGE_JOAAT("AM_HELI_TAXI"),
RAGE_JOAAT("fm_hold_up_tut"),
RAGE_JOAAT("AM_CAR_MOD_TUT"),
RAGE_JOAAT("AM_CONTACT_REQUESTS"),
RAGE_JOAAT("am_mission_launch"),
RAGE_JOAAT("am_npc_invites"),
RAGE_JOAAT("am_lester_cut"),
RAGE_JOAAT("am_heist_int"),
RAGE_JOAAT("am_lowrider_int"),
RAGE_JOAAT("AM_VEHICLE_SPAWN"),
RAGE_JOAAT("am_ronTrevor_Cut"),
RAGE_JOAAT("AM_ARMYBASE"),
RAGE_JOAAT("AM_PRISON"),
RAGE_JOAAT("am_rollercoaster"),
RAGE_JOAAT("am_ferriswheel"),
RAGE_JOAAT("AM_LAUNCHER"),
RAGE_JOAAT("AM_DAILY_OBJECTIVES"),
RAGE_JOAAT("AM_ArmWrestling"),
RAGE_JOAAT("AM_Darts"),
RAGE_JOAAT("golf_mp"),
RAGE_JOAAT("Range_Modern_MP"),
RAGE_JOAAT("tennis_network_mp"),
RAGE_JOAAT("Pilot_School_MP"),
RAGE_JOAAT("FM_Impromptu_DM_Controler"),
RAGE_JOAAT("fm_Bj_race_controler"),
RAGE_JOAAT("fm_deathmatch_controler"),
RAGE_JOAAT("fm_hideout_controler"),
RAGE_JOAAT("fm_mission_controller"),
RAGE_JOAAT("FM_Race_Controler"),
RAGE_JOAAT("FM_Horde_Controler"),
RAGE_JOAAT("dont_cross_the_line"),
RAGE_JOAAT("am_darts_apartment"),
RAGE_JOAAT("AM_Armwrestling_Apartment"),
RAGE_JOAAT("grid_arcade_cabinet"),
RAGE_JOAAT("scroll_arcade_cabinet"),
RAGE_JOAAT("example_arcade"),
RAGE_JOAAT("road_arcade"),
RAGE_JOAAT("gunslinger_arcade"),
RAGE_JOAAT("wizard_arcade"),
RAGE_JOAAT("AM_CASINO_LIMO"),
RAGE_JOAAT("AM_CASINO_LUXURY_CAR"),
RAGE_JOAAT("Degenatron Games"),
RAGE_JOAAT("ggsm_arcade"),
RAGE_JOAAT("puzzle"),
RAGE_JOAAT("camhedz_arcade"),
RAGE_JOAAT("SCTV"),
});
constexpr const static inline auto all_script_names = std::to_array({ constexpr const static inline auto all_script_names = std::to_array({
"abigail1", "abigail1",
"abigail2", "abigail2",

File diff suppressed because one or more lines are too long

View File

@ -570,16 +570,18 @@ namespace big
bool rockstar_crew = false; bool rockstar_crew = false;
bool square_crew_tag = false; bool square_crew_tag = false;
bool spoof_session_region_type = false; bool spoof_session_region_type = false;
int session_region_type = 0; int session_region_type = 0;
bool spoof_session_language = false; bool spoof_session_language = false;
int session_language = 0; int session_language = 0;
bool spoof_session_player_count = false; bool spoof_session_player_count = false;
int session_player_count = 25; int session_player_count = 25;
bool spoof_session_bad_sport_status = false;
bool session_bad_sport = false;
bool voice_chat_audio = false; bool voice_chat_audio = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(spoofing, hide_from_player_list, spoof_cheater, spoof_hide_god, spoof_hide_spectate, spoof_crew_data, crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, spoof_session_language, session_language, spoof_session_player_count, session_player_count, voice_chat_audio) NLOHMANN_DEFINE_TYPE_INTRUSIVE(spoofing, hide_from_player_list, spoof_cheater, spoof_hide_god, spoof_hide_spectate, spoof_crew_data, crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, spoof_session_language, session_language, spoof_session_player_count, session_player_count, voice_chat_audio, spoof_session_bad_sport_status, session_bad_sport)
} spoofing{}; } spoofing{};
struct vehicle struct vehicle
@ -722,8 +724,11 @@ namespace big
struct window struct window
{ {
ImU32 color = 3357612055; ImU32 background_color = 3189656871;
float gui_scale = 1.f; ImU32 text_color = 4294967295;
ImU32 button_color = 4216956014;
ImU32 frame_color = 2939772740;
float gui_scale = 1.f;
ImFont* font_title = nullptr; ImFont* font_title = nullptr;
ImFont* font_sub_title = nullptr; ImFont* font_sub_title = nullptr;
@ -741,9 +746,10 @@ namespace big
bool show_players = true; bool show_players = true;
bool show_time = true; bool show_time = true;
bool show_replay_interface = true; bool show_replay_interface = true;
bool show_position = false;
bool show_game_versions = true; bool show_game_versions = true;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(ingame_overlay, opened, show_with_menu_opened, show_fps, show_players, show_time, show_replay_interface, show_game_versions) NLOHMANN_DEFINE_TYPE_INTRUSIVE(ingame_overlay, opened, show_with_menu_opened, show_fps, show_players, show_time, show_replay_interface, show_position, show_game_versions)
} ingame_overlay{}; } ingame_overlay{};
struct vehicle_control struct vehicle_control
@ -756,7 +762,7 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle_control, operation_animation, max_summon_range, render_distance_on_veh) NLOHMANN_DEFINE_TYPE_INTRUSIVE(vehicle_control, operation_animation, max_summon_range, render_distance_on_veh)
} vehicle_control{}; } vehicle_control{};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, color, gui_scale, switched_view, ingame_overlay, vehicle_control) NLOHMANN_DEFINE_TYPE_INTRUSIVE(window, background_color, text_color, button_color, frame_color, gui_scale, switched_view, ingame_overlay, vehicle_control)
} window{}; } window{};
struct context_menu struct context_menu

View File

@ -244,6 +244,7 @@ namespace big
PVOID m_enumerate_audio_devices{}; PVOID m_enumerate_audio_devices{};
PVOID m_direct_sound_capture_create{}; PVOID m_direct_sound_capture_create{};
bool* m_refresh_audio_input{}; bool* m_refresh_audio_input{};
bool* m_refresh_audio_input_2{};
PVOID m_allow_weapons_in_vehicle{}; PVOID m_allow_weapons_in_vehicle{};

View File

@ -11,8 +11,8 @@
namespace big namespace big
{ {
gui::gui() : gui::gui() :
m_is_open(false), m_is_open(false),
m_override_mouse(false) m_override_mouse(false)
{ {
g_renderer->add_dx_callback(view::gta_data, -1); g_renderer->add_dx_callback(view::gta_data, -1);
g_renderer->add_dx_callback(view::notifications, -2); g_renderer->add_dx_callback(view::notifications, -2);
@ -92,10 +92,10 @@ namespace big
style.ChildRounding = 4.0f; style.ChildRounding = 4.0f;
auto& colors = style.Colors; auto& colors = style.Colors;
colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f); colors[ImGuiCol_Text] = ImGui::ColorConvertU32ToFloat4(g.window.text_color);
colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
colors[ImGuiCol_WindowBg] = ImGui::ColorConvertU32ToFloat4(g.window.color); colors[ImGuiCol_WindowBg] = ImGui::ColorConvertU32ToFloat4(g.window.background_color);
colors[ImGuiCol_ChildBg] = ImGui::ColorConvertU32ToFloat4(g.window.color); colors[ImGuiCol_ChildBg] = ImGui::ColorConvertU32ToFloat4(g.window.background_color);
colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f); colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f); colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
@ -110,7 +110,7 @@ namespace big
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f); colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f); colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); colors[ImGuiCol_CheckMark] = ImVec4(1.00f, 0.98f, 0.95f, 0.61f);
colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f); colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
colors[ImGuiCol_Button] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f); colors[ImGuiCol_Button] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
@ -128,24 +128,55 @@ namespace big
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f); colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f); colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f);
memcpy(&m_default_config, &ImGui::GetStyle(), sizeof(ImGuiStyle)); save_default_style();
} }
void gui::dx_on_tick() void gui::dx_on_tick()
{ {
if (m_is_open) if (m_is_open)
{ {
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::ColorConvertU32ToFloat4(g.window.color)); push_theme_colors();
view::root(); view::root(); // frame bg
ImGui::PopStyleColor(); pop_theme_colors();
} }
} }
void gui::save_default_style()
{
memcpy(&m_default_config, &ImGui::GetStyle(), sizeof(ImGuiStyle));
}
void gui::restore_default_style() void gui::restore_default_style()
{ {
memcpy(&ImGui::GetStyle(), &m_default_config, sizeof(ImGuiStyle)); memcpy(&ImGui::GetStyle(), &m_default_config, sizeof(ImGuiStyle));
} }
void gui::push_theme_colors()
{
auto button_color = ImGui::ColorConvertU32ToFloat4(g.window.button_color);
auto button_active_color =
ImVec4(button_color.x + 0.33f, button_color.y + 0.33f, button_color.z + 0.33f, button_color.w);
auto frame_color = ImGui::ColorConvertU32ToFloat4(g.window.frame_color);
auto frame_hovered_color =
ImVec4(frame_color.x + 0.14f, frame_color.y + 0.14f, frame_color.z + 0.14f, button_color.w);
auto frame_active_color =
ImVec4(frame_color.x + 0.30f, frame_color.y + 0.30f, frame_color.z + 0.30f, button_color.w);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::ColorConvertU32ToFloat4(g.window.background_color));
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::ColorConvertU32ToFloat4(g.window.text_color));
ImGui::PushStyleColor(ImGuiCol_Button, button_color);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, button_color);
ImGui::PushStyleColor(ImGuiCol_ButtonActive, button_active_color);
ImGui::PushStyleColor(ImGuiCol_FrameBg, frame_color);
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, frame_hovered_color);
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, frame_active_color);
}
void gui::pop_theme_colors()
{
ImGui::PopStyleColor(8);
}
void gui::script_on_tick() void gui::script_on_tick()
{ {
if (g_gui->m_is_open || g_gui->m_override_mouse) if (g_gui->m_is_open || g_gui->m_override_mouse)

View File

@ -17,7 +17,9 @@ namespace big
void toggle(bool toggle); void toggle(bool toggle);
bool mouse_override() const bool mouse_override() const
{ return m_override_mouse; } {
return m_override_mouse;
}
/** /**
* @brief Forces the mouse to draw and disable camera controls of the game * @brief Forces the mouse to draw and disable camera controls of the game
* This function works for now but might start causing issues when more features start relying on it. * This function works for now but might start causing issues when more features start relying on it.
@ -27,8 +29,12 @@ namespace big
void dx_init(); void dx_init();
void dx_on_tick(); void dx_on_tick();
void save_default_style();
void restore_default_style(); void restore_default_style();
void push_theme_colors();
void pop_theme_colors();
void script_on_tick(); void script_on_tick();
static void script_func(); static void script_func();

View File

@ -101,9 +101,14 @@ namespace big
static bool button(const std::string_view text) static bool button(const std::string_view text)
{ {
bool status = false; bool status = false;
ImGui::PushStyleColor(ImGuiCol_Button, color);
if constexpr (color.x != 0.24f || color.y != 0.23f || color.z != 0.29f || color.w != 1.0f)
ImGui::PushStyleColor(ImGuiCol_Button, color);
status = ImGui::Button(text.data(), size); status = ImGui::Button(text.data(), size);
ImGui::PopStyleColor(1);
if constexpr (color.x != 0.24f || color.y != 0.23f || color.z != 0.29f || color.w != 1.0f)
ImGui::PopStyleColor(1);
return status; return status;
} }

View File

@ -14,6 +14,14 @@ namespace big
if (g.spoofing.spoof_session_player_count) if (g.spoofing.spoof_session_player_count)
attributes->m_param_values[7] = g.spoofing.session_player_count; attributes->m_param_values[7] = g.spoofing.session_player_count;
if (g.spoofing.spoof_session_bad_sport_status)
{
if (g.spoofing.session_bad_sport)
attributes->m_param_values[0] |= (1 << 14);
else
attributes->m_param_values[0] &= ~(1 << 14);
}
return g_hooking->get_original<hooks::send_session_matchmaking_attributes>()(a1, info, session_id, use_session_id, attributes); return g_hooking->get_original<hooks::send_session_matchmaking_attributes>()(a1, info, session_id, use_session_id, attributes);
} }
} }

View File

@ -43,14 +43,14 @@ namespace big
[this, hash, handler] { [this, hash, handler] {
__try __try
{ {
_call_asm(&m_call_context, handler, g_pointers->m_gta.m_native_return); // return address checks are no longer a thing
// handler(&m_call_context); handler(&m_call_context);
g_pointers->m_gta.m_fix_vectors(&m_call_context); g_pointers->m_gta.m_fix_vectors(&m_call_context);
} }
__except (EXCEPTION_EXECUTE_HANDLER) __except (EXCEPTION_EXECUTE_HANDLER)
{ {
[hash]() { [hash]() {
LOG(WARNING) << "Exception caught while trying to call " << hash << " native."; LOG(WARNING) << "Exception caught while trying to call " << HEX_TO_UPPER(hash) << " native.";
}(); }();
} }
}(); }();

View File

@ -1,21 +0,0 @@
.DATA
return_address dq 0
real_rbx dq 0
.CODE
_call_asm PROC
mov real_rbx, rbx
mov r9, [rsp]
mov return_address, r9
lea rbx, _ret_asm
mov [rsp], r8
jmp rdx
_call_asm ENDP
_ret_asm PROC
mov rbx, real_rbx
mov rcx, return_address
jmp rcx
_ret_asm ENDP
END

View File

@ -26,6 +26,7 @@
#include "services/pickups/pickup_service.hpp" #include "services/pickups/pickup_service.hpp"
#include "services/player_database/player_database_service.hpp" #include "services/player_database/player_database_service.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "services/script_connection/script_connection_service.hpp"
#include "services/script_patcher/script_patcher_service.hpp" #include "services/script_patcher/script_patcher_service.hpp"
#include "services/squad_spawner/squad_spawner.hpp" #include "services/squad_spawner/squad_spawner.hpp"
#include "services/tunables/tunables_service.hpp" #include "services/tunables/tunables_service.hpp"
@ -90,23 +91,24 @@ 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.";
auto context_menu_service_instance = std::make_unique<context_menu_service>(); auto context_menu_service_instance = std::make_unique<context_menu_service>();
auto custom_text_service_instance = std::make_unique<custom_text_service>(); auto custom_text_service_instance = std::make_unique<custom_text_service>();
auto globals_service_instace = std::make_unique<globals_service>(); auto globals_service_instace = std::make_unique<globals_service>();
auto mobile_service_instance = std::make_unique<mobile_service>(); auto mobile_service_instance = std::make_unique<mobile_service>();
auto notification_service_instance = std::make_unique<notification_service>(); auto notification_service_instance = std::make_unique<notification_service>();
auto pickup_service_instance = std::make_unique<pickup_service>(); auto pickup_service_instance = std::make_unique<pickup_service>();
auto player_service_instance = std::make_unique<player_service>(); auto player_service_instance = std::make_unique<player_service>();
auto gta_data_service_instance = std::make_unique<gta_data_service>(); auto gta_data_service_instance = std::make_unique<gta_data_service>();
auto model_preview_service_instance = std::make_unique<model_preview_service>(); auto model_preview_service_instance = std::make_unique<model_preview_service>();
auto handling_service_instance = std::make_unique<handling_service>(); auto handling_service_instance = std::make_unique<handling_service>();
auto gui_service_instance = std::make_unique<gui_service>(); auto gui_service_instance = std::make_unique<gui_service>();
auto script_patcher_service_instance = std::make_unique<script_patcher_service>(); auto script_patcher_service_instance = std::make_unique<script_patcher_service>();
auto player_database_service_instance = std::make_unique<player_database_service>(); auto player_database_service_instance = std::make_unique<player_database_service>();
auto hotkey_service_instance = std::make_unique<hotkey_service>(); auto hotkey_service_instance = std::make_unique<hotkey_service>();
auto matchmaking_service_instance = std::make_unique<matchmaking_service>(); auto matchmaking_service_instance = std::make_unique<matchmaking_service>();
auto api_service_instance = std::make_unique<api_service>(); auto api_service_instance = std::make_unique<api_service>();
auto tunables_service_instance = std::make_unique<tunables_service>(); auto tunables_service_instance = std::make_unique<tunables_service>();
auto script_connection_service_instance = std::make_unique<script_connection_service>();
LOG(INFO) << "Registered service instances..."; LOG(INFO) << "Registered service instances...";
g_script_mgr.add_script(std::make_unique<script>(&gui::script_func, "GUI", false)); g_script_mgr.add_script(std::make_unique<script>(&gui::script_func, "GUI", false));
@ -166,6 +168,8 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
thread_pool_instance->destroy(); thread_pool_instance->destroy();
LOG(INFO) << "Destroyed thread pool."; LOG(INFO) << "Destroyed thread pool.";
script_connection_service_instance.reset();
LOG(INFO) << "Script Connection Service reset.";
tunables_service_instance.reset(); tunables_service_instance.reset();
LOG(INFO) << "Tunables Service reset."; LOG(INFO) << "Tunables Service reset.";
hotkey_service_instance.reset(); hotkey_service_instance.reset();

View File

@ -157,5 +157,9 @@ namespace big
{ {
src->set_return_value<BOOL>(FALSE); src->set_return_value<BOOL>(FALSE);
} }
void DO_NOTHING(rage::scrNativeCallContext* src)
{
}
} }
} }

View File

@ -6,10 +6,22 @@ namespace big
{ {
namespace freemode namespace freemode
{ {
void GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(rage::scrNativeCallContext* src)
{
const auto hash = src->get_arg<rage::joaat_t>(0);
if (hash == RAGE_JOAAT("director_mode") || hash == RAGE_JOAAT("main"))
{
src->set_return_value(0);
return;
}
src->set_return_value(SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(hash));
}
void STAT_GET_INT(rage::scrNativeCallContext* src) void STAT_GET_INT(rage::scrNativeCallContext* src)
{ {
if (g_vehicle_control_service.m_driver_performing_task && (src->get_arg<Hash>(0) == RAGE_JOAAT("MP0_PERSONAL_VEHICLE_ACCESS") || if (g_vehicle_control_service.m_driver_performing_task && (src->get_arg<Hash>(0) == RAGE_JOAAT("MP0_PERSONAL_VEHICLE_ACCESS") || src->get_arg<Hash>(0) == RAGE_JOAAT("MP1_PERSONAL_VEHICLE_ACCESS")))
src->get_arg<Hash>(0) == RAGE_JOAAT("MP1_PERSONAL_VEHICLE_ACCESS")))
{ {
src->set_return_value<int>(0); src->set_return_value<int>(0);
return; return;
@ -53,7 +65,7 @@ namespace big
void NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA(rage::scrNativeCallContext* src) void NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA(rage::scrNativeCallContext* src)
{ {
if (NETWORK::NETWORK_IS_ACTIVITY_SESSION() || NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT()) if (NETWORK::NETWORK_IS_ACTIVITY_SESSION() || NETWORK::NETWORK_IS_IN_TRANSITION() || NETWORK::NETWORK_IS_TRANSITION_TO_GAME() || NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT())
{ {
src->set_return_value<BOOL>(NETWORK::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA()); src->set_return_value<BOOL>(NETWORK::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA());
} }

View File

@ -114,23 +114,30 @@ namespace big
add_native_detour(0xEB354E5376BC81A7, all_scripts::HUD_FORCE_WEAPON_WHEEL); add_native_detour(0xEB354E5376BC81A7, all_scripts::HUD_FORCE_WEAPON_WHEEL);
add_native_detour(0x158C16F5E4CF41F8, all_scripts::RETURN_TRUE); // bypass casino country restrictions add_native_detour(0x158C16F5E4CF41F8, all_scripts::RETURN_TRUE); // bypass casino country restrictions
add_native_detour(0xE679E3E06E363892, all_scripts::NETWORK_OVERRIDE_CLOCK_TIME); add_native_detour(0xE679E3E06E363892, all_scripts::NETWORK_OVERRIDE_CLOCK_TIME);
add_native_detour(0x40EB1EFD921822BC, all_scripts::DO_NOTHING); // SECURITY::REGISTER_SCRIPT_VARIABLE
add_native_detour(0x340A36A700E99699, all_scripts::DO_NOTHING); // SECURITY::UNREGISTER_SCRIPT_VARIABLE
add_native_detour(0x8E580AB902917360, all_scripts::DO_NOTHING); // SECURITY::FORCE_CHECK_SCRIPT_VARIABLES
add_native_detour(RAGE_JOAAT("shop_controller"), 0x34616828CD07F1A1, all_scripts::RETURN_FALSE); // prevent exploit reports add_native_detour(RAGE_JOAAT("shop_controller"), 0x34616828CD07F1A1, all_scripts::RETURN_FALSE); // prevent exploit reports
add_native_detour(RAGE_JOAAT("shop_controller"), 0xDC38CC1E35B6A5D7, shop_controller::SET_WARNING_MESSAGE_WITH_HEADER);
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x06843DA7060A026B, carmod_shop::SET_ENTITY_COORDS); add_native_detour(RAGE_JOAAT("carmod_shop"), 0x06843DA7060A026B, carmod_shop::SET_ENTITY_COORDS);
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x8E2530AA8ADA980E, carmod_shop::SET_ENTITY_HEADING); add_native_detour(RAGE_JOAAT("carmod_shop"), 0x8E2530AA8ADA980E, carmod_shop::SET_ENTITY_HEADING);
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x34E710FF01247C5A, carmod_shop::SET_VEHICLE_LIGHTS); add_native_detour(RAGE_JOAAT("carmod_shop"), 0x34E710FF01247C5A, carmod_shop::SET_VEHICLE_LIGHTS);
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x767FBC2AC802EF3D, carmod_shop::STAT_GET_INT); add_native_detour(RAGE_JOAAT("carmod_shop"), 0x767FBC2AC802EF3D, carmod_shop::STAT_GET_INT);
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x5F4B6931816E599B, carmod_shop::DISABLE_ALL_CONTROL_ACTIONS); add_native_detour(RAGE_JOAAT("carmod_shop"), 0x5F4B6931816E599B, carmod_shop::DISABLE_ALL_CONTROL_ACTIONS);
add_native_detour(RAGE_JOAAT("freemode"), 0x2C83A9DA6BFFC4F9, freemode::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH);
add_native_detour(RAGE_JOAAT("freemode"), 0x767FBC2AC802EF3D, freemode::STAT_GET_INT); add_native_detour(RAGE_JOAAT("freemode"), 0x767FBC2AC802EF3D, freemode::STAT_GET_INT);
add_native_detour(RAGE_JOAAT("freemode"), 0x5E9564D8246B909A, freemode::IS_PLAYER_PLAYING); add_native_detour(RAGE_JOAAT("freemode"), 0x5E9564D8246B909A, freemode::IS_PLAYER_PLAYING);
add_native_detour(RAGE_JOAAT("freemode"), 0xEA1C610A04DB6BBB, freemode::SET_ENTITY_VISIBLE); add_native_detour(RAGE_JOAAT("freemode"), 0xEA1C610A04DB6BBB, freemode::SET_ENTITY_VISIBLE);
add_native_detour(RAGE_JOAAT("freemode"), 0x231C8F89D0539D8F, freemode::SET_BIGMAP_ACTIVE); add_native_detour(RAGE_JOAAT("freemode"), 0x231C8F89D0539D8F, freemode::SET_BIGMAP_ACTIVE);
add_native_detour(RAGE_JOAAT("freemode"), 0x9029B2F3DA924928, freemode::SET_BLIP_DISPLAY); add_native_detour(RAGE_JOAAT("freemode"), 0x9029B2F3DA924928, freemode::SET_BLIP_DISPLAY);
add_native_detour(RAGE_JOAAT("freemode"), 0x5D10B3795F3FC886, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA); add_native_detour(RAGE_JOAAT("freemode"), 0x5D10B3795F3FC886, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);
add_native_detour(RAGE_JOAAT("fmmc_launcher"), 0x5D10B3795F3FC886, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA); add_native_detour(RAGE_JOAAT("fmmc_launcher"), 0x5D10B3795F3FC886, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);
add_native_detour(RAGE_JOAAT("shop_controller"), 0xDC38CC1E35B6A5D7, shop_controller::SET_WARNING_MESSAGE_WITH_HEADER);
add_native_detour(RAGE_JOAAT("maintransition"), 0x6F3D4ED9BEE4E61D, network::NETWORK_SESSION_HOST); add_native_detour(RAGE_JOAAT("maintransition"), 0x6F3D4ED9BEE4E61D, network::NETWORK_SESSION_HOST);
add_native_detour(RAGE_JOAAT("am_launcher"), 0xB8BA7F44DF1575E1, am_launcher::START_NEW_SCRIPT_WITH_ARGS); add_native_detour(RAGE_JOAAT("am_launcher"), 0xB8BA7F44DF1575E1, am_launcher::START_NEW_SCRIPT_WITH_ARGS);
add_native_detour(RAGE_JOAAT("am_launcher"), 0x5D10B3795F3FC886, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA); add_native_detour(RAGE_JOAAT("am_launcher"), 0x5D10B3795F3FC886, freemode::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA);

View File

@ -21,9 +21,6 @@ namespace big
inline void NETWORK_ACCESS_TUNABLE_BOOL_MODIFICATION_DETECTION_REGISTRATION_HASH(rage::scrNativeCallContext* src) inline void NETWORK_ACCESS_TUNABLE_BOOL_MODIFICATION_DETECTION_REGISTRATION_HASH(rage::scrNativeCallContext* src)
{ {
if (src->get_arg<Hash>(1) == RAGE_JOAAT("TURN_SNOW_ON_OFF"))
LOG(INFO) << "Snow loaded";
g_tunables_service->register_tunable(src->get_arg<Hash>(1), src->get_arg<BOOL*>(2)); g_tunables_service->register_tunable(src->get_arg<Hash>(1), src->get_arg<BOOL*>(2));
src->set_return_value<BOOL>(NETWORK::NETWORK_ACCESS_TUNABLE_BOOL_MODIFICATION_DETECTION_REGISTRATION_HASH(src->get_arg<Hash>(0), src->get_arg<Hash>(1), src->get_arg<BOOL*>(2))); src->set_return_value<BOOL>(NETWORK::NETWORK_ACCESS_TUNABLE_BOOL_MODIFICATION_DETECTION_REGISTRATION_HASH(src->get_arg<Hash>(0), src->get_arg<Hash>(1), src->get_arg<BOOL*>(2)));
}; };

View File

@ -1137,6 +1137,7 @@ namespace big
[](memory::handle ptr) [](memory::handle ptr)
{ {
g_pointers->m_gta.m_refresh_audio_input = ptr.add(3).rip().as<bool*>(); g_pointers->m_gta.m_refresh_audio_input = ptr.add(3).rip().as<bool*>();
g_pointers->m_gta.m_refresh_audio_input_2 = ptr.add(3).rip().as<bool*>() + 2;
} }
}, },
// Allow Weapons In Vehicle // Allow Weapons In Vehicle

View File

@ -130,7 +130,7 @@ namespace big
tabs::NETWORK, tabs::NETWORK,
{ {
"GUI_TAB_NETWORK", "GUI_TAB_NETWORK",
view::session, view::network,
{ {
{tabs::SPOOFING, {"GUI_TAB_SPOOFING", view::spoofing}}, {tabs::SPOOFING, {"GUI_TAB_SPOOFING", view::spoofing}},
{tabs::MISSIONS, {"GUI_TAB_MISSIONS", view::missions}}, {tabs::MISSIONS, {"GUI_TAB_MISSIONS", view::missions}},

View File

@ -51,12 +51,13 @@ namespace big
bool block_join = false; bool block_join = false;
int block_join_reason = 1; int block_join_reason = 1;
bool is_modder = false; bool is_modder = false;
bool notify_online = false; bool notify_online = false;
std::unordered_set<int> infractions; std::unordered_set<int> infractions;
std::string notes = "";
std::optional<CommandAccessLevel> command_access_level = std::nullopt; std::optional<CommandAccessLevel> command_access_level = std::nullopt;
PlayerOnlineStatus online_state = PlayerOnlineStatus::UNKNOWN; PlayerOnlineStatus online_state = PlayerOnlineStatus::UNKNOWN;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(persistent_player, name, rockstar_id, block_join, block_join_reason, is_modder, notify_online, infractions, command_access_level) NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(persistent_player, name, rockstar_id, block_join, block_join_reason, is_modder, notify_online, infractions, notes, command_access_level)
}; };
}; };

View File

@ -0,0 +1,404 @@
#include "script_connection.hpp"
#include "gta_util.hpp"
#include "hooking.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "util/scripts.hpp"
#include <script/globals/GPBD_FM_3.hpp>
namespace big
{
bool script_connection::does_remote_script_exist()
{
return NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT_ON_SCRIPT(m_target->get()->id(), m_script_name.data(), -1);
}
bool script_connection::start_script_on_local()
{
while (!SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(m_script_hash))
{
SCRIPT::REQUEST_SCRIPT_WITH_NAME_HASH(m_script_hash);
script::get_current()->yield();
}
auto program = gta_util::find_script_program(m_script_hash);
int count = program->m_local_count;
program->m_local_count = 2;
int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH(m_script_hash, DEFAULT_STACK_SIZE);
program->m_local_count = count;
SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(m_script_hash);
m_thread = gta_util::find_script_thread_by_id(id);
if (!m_thread)
return false;
m_thread->m_context.m_state = rage::eThreadState::unk_3;
return true;
}
void script_connection::start_script_on_remote()
{
if (!m_target)
{
if (m_debug_logging)
LOG(VERBOSE) << "Starting " << m_script_name << " using am_launcher";
scripts::start_launcher_script(scripts::launcher_index_from_hash(m_script_hash));
}
else
{
if (m_debug_logging)
LOG(VERBOSE) << "Starting " << m_script_name << " using TSEs";
const size_t arg_count = 25;
int64_t args[arg_count] = {(int64_t)eRemoteEvent::StartScriptBegin, (int64_t)self::id};
args[2] = scripts::launcher_index_from_hash(m_script_hash);
strcpy((char*)&args[2 + 3], "0");
args[2 + 16] = -1;
args[2 + 17] = 1337;
args[24] = scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[m_target->get()->id()].ScriptEventReplayProtectionCounter;
g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << m_target->get()->id());
for (int i = 0; i < 2; i++)
{
const size_t arg_count_2 = 25;
int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id};
args_2[2 + 17] = 1337;
g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << m_target->get()->id());
script::get_current()->yield(20ms);
}
}
}
bool script_connection::populate_instance_id()
{
for (int i = 0; i < 0x100; i++)
{
if (NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT_ON_SCRIPT(m_target->get()->id(), m_script_name.data(), i))
{
m_instance_id = i;
break;
}
}
return m_instance_id != -1;
}
bool script_connection::set_script_as_networked()
{
gta_util::execute_as_script(m_thread, [this] {
if (auto hook = g_hooking->m_handler_hooks[(CGameScriptHandler*)m_thread->m_handler].get())
{
hook->disable();
g_hooking->m_handler_hooks.erase((CGameScriptHandler*)m_thread->m_handler);
}
NETWORK::NETWORK_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT(32, true, m_instance_id);
});
for (int i = 0; i < 100; i++)
{
int status = 0;
gta_util::execute_as_script(m_thread, [&status] {
status = NETWORK::NETWORK_GET_SCRIPT_STATUS();
});
if (status == 2)
return true;
if (status > 2)
{
break;
}
script::get_current()->yield(50ms);
}
return false;
}
void script_connection::setup_broadcast_data()
{
auto locals = gta_util::find_script_program(m_script_hash)->m_local_data;
if (m_host_broadcast_size)
{
m_host_broadcast_data = new uint64_t[m_host_broadcast_size];
if (m_host_broadcast_default_data_address.has_value())
memcpy(m_host_broadcast_data, &locals[m_host_broadcast_default_data_address.value()], m_host_broadcast_size * sizeof(uint64_t));
else
memset(m_host_broadcast_data, 0, m_host_broadcast_size * sizeof(uint64_t));
}
if (m_player_broadcast_data)
{
m_player_broadcast_data = new uint64_t[m_player_broadcast_size];
if (m_player_broadcast_default_data_address.has_value())
{
memcpy(m_player_broadcast_data, &locals[m_player_broadcast_default_data_address.value()], m_player_broadcast_size * sizeof(uint64_t));
}
else
{
memset(m_player_broadcast_data, 0, m_player_broadcast_size * sizeof(uint64_t));
m_player_broadcast_data[0] = 32;
}
}
if (m_broadcast_setup_callback)
m_broadcast_setup_callback(m_thread, m_host_broadcast_data, m_player_broadcast_data);
}
void script_connection::register_broadcast_data()
{
gta_util::execute_as_script(m_thread, [this] {
if (m_host_broadcast_size)
NETWORK::NETWORK_REGISTER_HOST_BROADCAST_VARIABLES((int*)m_host_broadcast_data, m_host_broadcast_size, 0);
if (m_player_broadcast_size)
NETWORK::NETWORK_REGISTER_PLAYER_BROADCAST_VARIABLES((int*)m_player_broadcast_data, m_player_broadcast_size, 0);
});
}
bool script_connection::force_host_of_script()
{
if (m_thread && m_thread->m_net_component)
{
for (int i = 0; !m_thread->m_net_component->is_local_player_host(); i++)
{
if (i > 200)
return false;
((CGameScriptHandlerNetComponent*)m_thread->m_net_component)
->send_host_migration_event(g_player_service->get_self()->get_net_game_player());
script::get_current()->yield(10ms);
if (!m_thread->m_stack || !m_thread->m_net_component)
return false;
}
m_thread->m_net_component->block_host_migration(true);
}
return true;
}
bool script_connection::wait_for_host_broadcast_data()
{
for (int i = 0; i < 3600; i++)
{
bool received = false;
gta_util::execute_as_script(m_thread, [&received] {
received = NETWORK::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA();
});
if (received)
return true;
script::get_current()->yield();
}
return false;
}
bool script_connection::wait_for_connection_to_remote()
{
for (int i = 0; i < 100; i++)
{
bool is_a_participant = false;
gta_util::execute_as_script(m_thread, [&is_a_participant, this] {
is_a_participant = NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT(m_target->get()->id());
});
if (is_a_participant)
return true;
script::get_current()->yield(25ms);
}
return false;
}
bool script_connection::start_impl()
{
auto need_to_create = !m_target || !populate_instance_id();
if (need_to_create && m_no_remote_start)
{
if (m_debug_logging)
LOG(FATAL) << "Script must be started on remote, but script starting is disabled";
return false;
}
if (!start_script_on_local())
{
if (m_debug_logging)
LOG(FATAL) << "Failed to start script locally";
return false;
}
if (!set_script_as_networked())
{
if (m_debug_logging)
LOG(FATAL) << "Failed to set script as networked";
return false;
}
setup_broadcast_data();
register_broadcast_data();
if (!need_to_create && (!m_target || !m_target->get()->is_valid() || !wait_for_connection_to_remote()))
{
if (m_debug_logging)
LOG(FATAL) << "Remote no longer a participant";
return false;
}
if (m_wait_for_host_broadcast_data && !wait_for_host_broadcast_data())
{
if (m_debug_logging)
LOG(FATAL) << "Failed to receive host broadcast data";
return false;
}
if (!force_host_of_script())
{
if (m_debug_logging)
LOG(FATAL) << "Failed to get script host";
return false;
}
if (need_to_create)
start_script_on_remote();
if (need_to_create && m_target && !wait_for_connection_to_remote())
{
if (m_debug_logging)
LOG(FATAL) << "Failed to connect to remote";
return false;
}
if (m_broadcast_modify_callback)
m_broadcast_modify_callback(m_thread, m_host_broadcast_data, m_player_broadcast_data);
m_startup_done = true;
m_startup_complete_time = std::chrono::system_clock::now();
return true;
}
script_connection::script_connection(const std::string& script_name, std::optional<player_ptr> target) :
m_script_name(script_name),
m_script_hash(rage::joaat(script_name)),
m_target(target)
{
}
void script_connection::start()
{
if (m_startup_done && m_thread && m_broadcast_modify_callback)
m_broadcast_modify_callback(m_thread, m_host_broadcast_data, m_player_broadcast_data);
if (m_startup_done || m_startup_failed)
return;
if (!start_impl())
m_startup_failed = true;
}
void script_connection::cleanup()
{
if (m_thread)
{
m_thread->kill();
m_thread = nullptr;
}
if (m_host_broadcast_data)
{
delete[] m_host_broadcast_data;
m_host_broadcast_data = nullptr;
}
if (m_player_broadcast_data)
{
delete[] m_player_broadcast_data;
m_player_broadcast_data = nullptr;
}
}
bool script_connection::should_cleanup()
{
if (m_startup_failed)
{
if (m_debug_logging)
LOG(VERBOSE) << "Startup has failed, cleaning up";
return true;
}
if (m_startup_done && (!m_thread || m_thread->m_stack == nullptr || m_thread->m_context.m_state == rage::eThreadState::killed))
{
if (m_debug_logging)
LOG(VERBOSE) << "Local thread has been terminated, cleaning up";
return true;
}
if (m_startup_done && m_target && !m_target->get()->is_valid())
{
if (m_debug_logging)
LOG(VERBOSE) << "Target has left, cleaning up";
return true;
}
#if 0
if (m_target && m_target->get()->is_valid())
{
bool is_a_participant = false;
gta_util::execute_as_script(m_thread, [&is_a_participant, this] {
is_a_participant = NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT(m_target->get()->id());
});
if (!is_a_participant)
{
if (m_debug_logging)
LOG(VERBOSE) << "Target no longer a participant, cleaning up";
return true;
}
}
#endif
bool might_cleanup = m_quick_cleanup || MISC::GET_NUMBER_OF_FREE_STACKS_OF_THIS_SIZE(DEFAULT_STACK_SIZE) < 5;
if (might_cleanup && m_startup_complete_time.has_value()
&& std::chrono::system_clock::now() - m_startup_complete_time.value() > 5s)
{
if (m_debug_logging)
LOG(VERBOSE) << "Cleaning up";
return true;
}
return false;
}
}

View File

@ -0,0 +1,75 @@
#pragma once
#include "services/players/player_service.hpp"
namespace big
{
constexpr int DEFAULT_STACK_SIZE = 1424;
class script_connection
{
std::string m_script_name;
rage::joaat_t m_script_hash;
std::optional<player_ptr> m_target;
int m_instance_id = -1;
rage::scrThread* m_thread = nullptr;
bool m_startup_done = false;
bool m_startup_failed = false;
int m_host_broadcast_size = 0;
int m_player_broadcast_size = 0;
bool m_debug_logging = false;
bool m_wait_for_host_broadcast_data = false;
bool m_no_remote_start = false;
bool m_quick_cleanup = false;
std::optional<int> m_host_broadcast_default_data_address = std::nullopt;
std::optional<int> m_player_broadcast_default_data_address = std::nullopt;
std::function<void(rage::scrThread*, uint64_t*, uint64_t*)> m_broadcast_setup_callback{};
std::function<void(rage::scrThread*, uint64_t*, uint64_t*)> m_broadcast_modify_callback{};
std::uint64_t* m_host_broadcast_data = nullptr;
std::uint64_t* m_player_broadcast_data = nullptr;
std::optional<std::chrono::system_clock::time_point> m_startup_complete_time = std::nullopt;
bool does_remote_script_exist();
bool start_script_on_local();
void start_script_on_remote();
bool populate_instance_id();
bool set_script_as_networked();
void setup_broadcast_data();
void register_broadcast_data();
bool force_host_of_script();
bool wait_for_host_broadcast_data();
bool wait_for_connection_to_remote();
bool start_impl();
public:
script_connection(const std::string& script_name, std::optional<player_ptr> target = std::nullopt);
void start();
void cleanup();
bool should_cleanup();
// clang-format off
inline rage::joaat_t get_script_hash() { return m_script_hash; }
inline std::optional<player_ptr> get_target() { return m_target; }
inline rage::scrThread* get_script_thread() { return m_thread; }
inline void set_host_broadcast_size(int size) { m_host_broadcast_size = size; }
inline void set_player_broadcast_size(int size) { m_player_broadcast_size = size; }
inline void set_debug_logging(bool enabled) { m_debug_logging = enabled; }
inline void set_wait_for_host_broadcast_data(bool enabled) { m_wait_for_host_broadcast_data = enabled; }
inline void set_no_remote_start(bool enabled) { m_no_remote_start = enabled; }
inline void set_quick_cleanup(bool enabled) { m_quick_cleanup = enabled; }
inline void set_host_broadcast_default_data_address(int data_address) { m_host_broadcast_default_data_address = data_address; }
inline void set_player_broadcast_default_data_address(int data_address) { m_player_broadcast_default_data_address = data_address; }
// thread, host_broadcast_data, player_broadcast_data
inline void set_broadcast_setup_callback(std::function<void(rage::scrThread*, uint64_t*, uint64_t*)> cb) { m_broadcast_setup_callback = std::move(cb); }
inline void set_broadcast_modify_callback(std::function<void(rage::scrThread*, uint64_t*, uint64_t*)> cb) { m_broadcast_modify_callback = std::move(cb); }
inline void invalidate_script_thread() { m_thread = nullptr; }
// clang-format on
};
}

View File

@ -0,0 +1,52 @@
#include "script_connection_service.hpp"
namespace big
{
script_connection* script_connection_service::get_connection(const std::string& script_name, std::optional<player_ptr> target)
{
auto hash = rage::joaat(script_name);
for (auto& cxn : m_script_connections)
if (cxn->get_script_hash() == hash
&& ((!target && !cxn->get_target())
|| (target && cxn->get_target() && target->get()->id() == cxn->get_target()->get()->id())))
return cxn.get();
return nullptr;
}
script_connection_service::script_connection_service()
{
g_script_connection_service = this;
}
script_connection_service::~script_connection_service()
{
g_script_connection_service = nullptr;
}
script_connection* script_connection_service::create_connection(const std::string& script_name, std::optional<player_ptr> target)
{
if (auto cxn = get_connection(script_name, target))
return cxn;
auto cxn = std::make_unique<script_connection>(script_name, target);
auto ret = cxn.get();
m_script_connections.push_back(std::move(cxn));
return ret;
}
void script_connection_service::on_tick()
{
std::erase_if(m_script_connections, [](auto& cxn) {
if (cxn.get()->should_cleanup())
{
cxn.get()->cleanup();
return true;
}
return false;
});
}
}

View File

@ -0,0 +1,20 @@
#pragma once
#include "script_connection.hpp"
namespace big
{
class script_connection_service
{
std::vector<std::unique_ptr<script_connection>> m_script_connections;
script_connection* get_connection(const std::string& script_name, std::optional<player_ptr> target);
public:
script_connection_service();
~script_connection_service();
script_connection* create_connection(const std::string& script_name, std::optional<player_ptr> target);
void on_tick();
};
inline script_connection_service* g_script_connection_service;
}

View File

@ -4,6 +4,7 @@
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "script.hpp" #include "script.hpp"
#include "services/script_connection/script_connection_service.hpp" // for the stack size
#include "services/script_patcher/script_patcher_service.hpp" #include "services/script_patcher/script_patcher_service.hpp"
#include "thread_pool.hpp" #include "thread_pool.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
@ -60,9 +61,9 @@ namespace big
if (SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(RAGE_JOAAT("tuneables_processing"))) if (SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(RAGE_JOAAT("tuneables_processing")))
{ {
std::uint64_t args[] = {6, 27, 1}; // TODO: check args std::uint64_t args[] = {6, 27}; // TODO: check args
int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH_AND_ARGS(RAGE_JOAAT("tuneables_processing"), (Any*)args, sizeof(args) / 8, 5050); int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH_AND_ARGS(RAGE_JOAAT("tuneables_processing"), (Any*)args, sizeof(args) / 8, DEFAULT_STACK_SIZE);
if (!id) if (!id)
{ {
@ -85,6 +86,7 @@ namespace big
if (m_tunables.size() == 0) if (m_tunables.size() == 0)
{ {
LOG(FATAL) << "Failed to cache tunables"; LOG(FATAL) << "Failed to cache tunables";
g_script_patcher_service->update();
return; return;
} }

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "core/data/all_script_names.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/script_handler.hpp" #include "gta/script_handler.hpp"
@ -78,6 +79,15 @@ namespace big::scripts
return true; return true;
} }
inline int launcher_index_from_hash(rage::joaat_t script_hash)
{
for (int i = 0; i < launcher_scripts.size(); i++)
if (launcher_scripts[i] == script_hash)
return i;
return -1;
}
// force launcher script over the lobby, take two // force launcher script over the lobby, take two
// try to get am_launcher in a consistent state before trying to start the script taking account of all participants // try to get am_launcher in a consistent state before trying to start the script taking account of all participants
inline void start_launcher_script(int script_id) inline void start_launcher_script(int script_id)

View File

@ -5,7 +5,7 @@
namespace namespace
{ {
static const char* spam_texts[] = { static const char* spam_texts[] = {
"qq",//a chinese chat app "qq", //a chinese chat app
"QQ", "QQ",
"WWW.", "WWW.",
"www.", "www.",
@ -14,7 +14,7 @@ namespace
".TOP", ".TOP",
".COM", ".COM",
".top", ".top",
"\xE3\x80\x90",//left bracket in Chinese input method "\xE3\x80\x90", //left bracket in Chinese input method
"/Menu", "/Menu",
"Money/", "Money/",
"Money\\\\", "Money\\\\",
@ -29,28 +29,31 @@ namespace
// "\xD0\xBC\xD0\xB5", // Cyrillic "me" // "\xD0\xBC\xD0\xB5", // Cyrillic "me"
"P888", "P888",
"gtacash", "gtacash",
"\xE6\x89\xA3\xE6\x89\xA3",// no clue what this is "\xE6\x89\xA3\xE6\x89\xA3", // no clue what this is
"\xE5\xBE\xAE\xE4\xBF\xA1",// "wechat" in Chinese "\xE5\xBE\xAE\xE4\xBF\xA1", // "wechat" in Chinese
".cc", ".cc",
"<font s", "<font s",
"sellix.io", "sellix.io",
"ezcars", "ezcars",
"PLANO INICIAL",// "initial plan" "PLANO INICIAL", // "initial plan"
"REP +", "REP +",
"20R$",// Brazil currency? "20R$", // Brazil currency?
"l55.me", "l55.me",
"\xE5\xBA\x97",//"shop" in Chinese "\xE5\xBA\x97", //"shop" in Chinese
"\xE9\x92\xB1",//"money" in Chinese "\xE9\x92\xB1", //"money" in Chinese
"\xE5\x88\xB7",//"make(money)" in Chinese "\xE5\x88\xB7", //"make(money)" in Chinese
// disabled as it's too verbose // disabled as it's too verbose
// "av", //uknowwhat video // "av", //uknowwhat video
"\xE8\x90\x9D\xE8\x8E\x89",//"cute girl" in Chinese "\xE8\x90\x9D\xE8\x8E\x89", //"cute girl" in Chinese
"\xE5\xA6\x88", //"mother" in Chinese "\xE5\xA6\x88", //"mother" in Chinese
"\xE7\xBE\x8E\xE5\xA5\xB3",//"sexy girl" in Chinese "\xE7\xBE\x8E\xE5\xA5\xB3", //"sexy girl" in Chinese
"\xE5\xBC\xBA\xE5\xA5\xB8",//"rape" in Chinese "\xE5\xBC\xBA\xE5\xA5\xB8", //"rape" in Chinese
"\xE8\x90\x9D", //"loli" in Chinese "\xE8\x90\x9D", //"loli" in Chinese
"\xE6\x8C\x82", //"hack" in Chinese "\xE6\x8C\x82", //"hack" in Chinese
"\xE5\x85\x83" //chinese dollar "\xE5\x85\x83", //chinese dollar
"TRUSTPILOT",
"cashlounge",
"Fast Delivery",
}; };
} }
@ -64,7 +67,7 @@ namespace big::spam
return false; return false;
} }
inline void log_chat(char* msg, player_ptr player, bool is_spam) inline void log_chat(char* msg, player_ptr player, bool is_spam)
{ {
std::ofstream spam_log(g_file_manager->get_project_file(is_spam ? "./spam.log" : "./chat.log").get_path(), std::ios::app); std::ofstream spam_log(g_file_manager->get_project_file(is_spam ? "./spam.log" : "./chat.log").get_path(), std::ios::app);

View File

@ -10,9 +10,14 @@ namespace big::teleport
{ {
inline bool teleport_player_to_coords(player_ptr player, Vector3 coords) inline bool teleport_player_to_coords(player_ptr player, Vector3 coords)
{ {
Entity ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); Entity ent;
if(ent == self::ped || ent == self::veh) if (*g_pointers->m_gta.m_is_session_started)
ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
else
ent = PLAYER::PLAYER_PED_ID();
if (ent == self::ped || ent == self::veh)
PED::SET_PED_COORDS_KEEP_VEHICLE(ent, coords.x, coords.y, coords.z); PED::SET_PED_COORDS_KEEP_VEHICLE(ent, coords.x, coords.y, coords.z);
if (ENTITY::IS_ENTITY_DEAD(ent, true)) if (ENTITY::IS_ENTITY_DEAD(ent, true))

View File

@ -42,8 +42,13 @@ namespace big
dl->AddRectFilled({(float)*g_pointers->m_gta.m_resolution_x - 360.f, 10.f + start_pos}, dl->AddRectFilled({(float)*g_pointers->m_gta.m_resolution_x - 360.f, 10.f + start_pos},
{(float)*g_pointers->m_gta.m_resolution_x - 10.f, start_pos + 45.f + total_size}, {(float)*g_pointers->m_gta.m_resolution_x - 10.f, start_pos + 45.f + total_size},
g.window.color); g.window.background_color);
dl->AddRectFilledMultiColor({(float)*g_pointers->m_gta.m_resolution_x - 360.f, 10.f + start_pos}, {(float)*g_pointers->m_gta.m_resolution_x - 255.f, start_pos + 45.f + total_size}, fadeBegin, fadeEnd, fadeEnd, fadeBegin); dl->AddRectFilledMultiColor({(float)*g_pointers->m_gta.m_resolution_x - 360.f, 10.f + start_pos},
{(float)*g_pointers->m_gta.m_resolution_x - 255.f, start_pos + 45.f + total_size},
fadeBegin,
fadeEnd,
fadeEnd,
fadeBegin);
dl->AddText(g.window.font_sub_title, dl->AddText(g.window.font_sub_title,
22.f, 22.f,

View File

@ -10,6 +10,8 @@ namespace big
if (!g.window.ingame_overlay.opened || (g_gui->is_open() && !g.window.ingame_overlay.show_with_menu_opened)) if (!g.window.ingame_overlay.opened || (g_gui->is_open() && !g.window.ingame_overlay.show_with_menu_opened))
return; return;
g_gui->push_theme_colors();
ImGui::SetNextWindowPos(ImVec2(10.0f, 10.0f), ImGuiCond_FirstUseEver, ImVec2(0.0f, 0.0f)); ImGui::SetNextWindowPos(ImVec2(10.0f, 10.0f), ImGuiCond_FirstUseEver, ImVec2(0.0f, 0.0f));
ImGui::SetNextWindowBgAlpha(0.5f); ImGui::SetNextWindowBgAlpha(0.5f);
@ -26,6 +28,15 @@ namespace big
ImGui::Text(std::format("Players: {}/{}", network_player_mgr->m_player_count, network_player_mgr->m_player_limit) ImGui::Text(std::format("Players: {}/{}", network_player_mgr->m_player_count, network_player_mgr->m_player_limit)
.c_str()); .c_str());
if (g.window.ingame_overlay.show_position && g_local_player)
{
ImGui::Separator();
auto& pos = *g_local_player->get_position();
ImGui::Text("Pos: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
}
// can't easily get used item count using pools, so keeping replay interface for now // can't easily get used item count using pools, so keeping replay interface for now
if (auto replay_interface = *g_pointers->m_gta.m_replay_interface; g.window.ingame_overlay.show_replay_interface) if (auto replay_interface = *g_pointers->m_gta.m_replay_interface; g.window.ingame_overlay.show_replay_interface)
{ {
@ -58,5 +69,7 @@ namespace big
} }
} }
ImGui::End(); ImGui::End();
g_gui->pop_theme_colors();
} }
} }

View File

@ -6,10 +6,10 @@
#include "script.hpp" #include "script.hpp"
#include "script_global.hpp" #include "script_global.hpp"
#include "util/misc.hpp" #include "util/misc.hpp"
#include "util/pathfind.hpp"
#include "util/ped.hpp"
#include "util/system.hpp" #include "util/system.hpp"
#include "view_debug.hpp" #include "view_debug.hpp"
#include "util/ped.hpp"
#include "util/pathfind.hpp"
namespace big namespace big
{ {
@ -61,7 +61,7 @@ namespace big
INTERIOR::REFRESH_INTERIOR(interior); INTERIOR::REFRESH_INTERIOR(interior);
}); });
components::button("NET_SHUTDOWN_AND_LOAD_SP", [] { components::button("NET_SHUTDOWN_AND_LOAD_SP"_T.data(), [] {
NETWORK::SHUTDOWN_AND_LAUNCH_SINGLE_PLAYER_GAME(); NETWORK::SHUTDOWN_AND_LAUNCH_SINGLE_PLAYER_GAME();
}); });
@ -80,7 +80,6 @@ namespace big
ENTITY::SET_ENTITY_COORDS(self::ped, safepos.x, safepos.y, safepos.z, 0, 0, 0, false); ENTITY::SET_ENTITY_COORDS(self::ped, safepos.x, safepos.y, safepos.z, 0, 0, 0, false);
else else
g_notification_service->push_error("Find safe pos", "Failed to find a safe position"); g_notification_service->push_error("Find safe pos", "Failed to find a safe position");
}); });
components::command_button<"fastquit">(); components::command_button<"fastquit">();

View File

@ -9,6 +9,7 @@
#include "script.hpp" #include "script.hpp"
#include "script_global.hpp" #include "script_global.hpp"
#include "util/misc.hpp" #include "util/misc.hpp"
#include "util/scripts.hpp"
#include "util/system.hpp" #include "util/system.hpp"
#include "view_debug.hpp" #include "view_debug.hpp"
@ -161,6 +162,21 @@ namespace big
update_free_stacks_count(); update_free_stacks_count();
}); });
ImGui::SameLine();
components::button("Start With Launcher", [] {
auto hash = rage::joaat(selected_script);
auto idx = scripts::launcher_index_from_hash(hash);
if (idx == -1)
{
g_notification_service->push_warning("Script Launcher", "This script cannot be started using am_launcher");
return;
}
scripts::start_launcher_script(idx);
});
if (*g_pointers->m_gta.m_game_state != eGameState::Invalid && std::chrono::high_resolution_clock::now() - last_stack_update_time > 100ms) if (*g_pointers->m_gta.m_game_state != eGameState::Invalid && std::chrono::high_resolution_clock::now() - last_stack_update_time > 100ms)
{ {
last_stack_update_time = std::chrono::high_resolution_clock::now(); last_stack_update_time = std::chrono::high_resolution_clock::now();

View File

@ -1,486 +1,485 @@
#include "core/data/apartment_names.hpp" #include "core/data/apartment_names.hpp"
#include "core/data/command_access_levels.hpp" #include "core/data/command_access_levels.hpp"
#include "core/data/region_codes.hpp" #include "core/data/region_codes.hpp"
#include "core/data/warehouse_names.hpp" #include "core/data/warehouse_names.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta_util.hpp" #include "gta_util.hpp"
#include "hooking.hpp" #include "hooking.hpp"
#include "util/notify.hpp" #include "util/notify.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
#include "util/session.hpp" #include "util/session.hpp"
#include "util/toxic.hpp" #include "util/toxic.hpp"
#include "views/view.hpp" #include "views/view.hpp"
#include <network/Network.hpp> #include <network/Network.hpp>
#include <script/globals/GPBD_FM_3.hpp> #include <script/globals/GPBD_FM_3.hpp>
#include <script/globals/GlobalPlayerBD.hpp> #include <script/globals/GlobalPlayerBD.hpp>
namespace big namespace big
{ {
void render_rid_joiner()
void render_rid_joiner() {
{ ImGui::BeginGroup();
ImGui::BeginGroup(); components::sub_title("Rid joiner");
components::sub_title("Rid joiner"); if (ImGui::ListBoxHeader("##ridjoiner", get_listbox_dimensions()))
if (ImGui::ListBoxHeader("##ridjoiner", get_listbox_dimensions())) {
{ static uint64_t rid = 0;
static uint64_t rid = 0; static char username[20];
static char username[20]; static char base64[500]{};
static char base64[500]{};
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5);
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5);
ImGui::InputScalar("##inputrid", ImGuiDataType_U64, &rid);
ImGui::InputScalar("##inputrid", ImGuiDataType_U64, &rid); ImGui::SameLine();
ImGui::SameLine(); components::button("JOIN_BY_RID"_T, [] {
components::button("JOIN_BY_RID"_T, [] { session::join_by_rockstar_id(rid);
session::join_by_rockstar_id(rid); });
});
components::input_text_with_hint("##usernameinput", "INPUT_USERNAME"_T, username, sizeof(username));
components::input_text_with_hint("##usernameinput", "INPUT_USERNAME"_T, username, sizeof(username)); ImGui::SameLine();
ImGui::SameLine(); if (components::button("JOIN_BY_USERNAME"_T))
if (components::button("JOIN_BY_USERNAME"_T)) {
{ session::join_by_username(username);
session::join_by_username(username); };
};
components::input_text_with_hint("##sessioninfoinput", "SESSION_INFO"_T, base64, sizeof(base64));
components::input_text_with_hint("##sessioninfoinput", "SESSION_INFO"_T, base64, sizeof(base64)); ImGui::SameLine();
ImGui::SameLine(); components::button("JOIN_SESSION_INFO"_T, [] {
components::button("JOIN_SESSION_INFO"_T, [] { rage::rlSessionInfo info;
rage::rlSessionInfo info; g_pointers->m_gta.m_decode_session_info(&info, base64, nullptr);
g_pointers->m_gta.m_decode_session_info(&info, base64, nullptr); session::join_session(info);
session::join_session(info); });
});
components::button("COPY_SESSION_INFO"_T, [] {
components::button("COPY_SESSION_INFO"_T, [] { char buf[0x100]{};
char buf[0x100]{}; g_pointers->m_gta.m_encode_session_info(&gta_util::get_network()->m_game_session.m_rline_session.m_session_info, buf, 0xA9, nullptr);
g_pointers->m_gta.m_encode_session_info(&gta_util::get_network()->m_game_session.m_rline_session.m_session_info, buf, 0xA9, nullptr); ImGui::SetClipboardText(buf);
ImGui::SetClipboardText(buf); });
});
ImGui::PopItemWidth();
ImGui::PopItemWidth(); ImGui::ListBoxFooter();
ImGui::ListBoxFooter(); }
} ImGui::EndGroup();
ImGui::EndGroup(); }
}
void render_session_switcher()
void render_session_switcher() {
{ ImGui::BeginGroup();
ImGui::BeginGroup(); components::sub_title("SESSION_SWITCHER"_T);
components::sub_title("SESSION_SWITCHER"_T); if (ImGui::ListBoxHeader("###session_switch", get_listbox_dimensions()))
if (ImGui::ListBoxHeader("###session_switch", get_listbox_dimensions())) {
{ if (ImGui::BeginCombo("##regionswitcher", "Regions"))
if (ImGui::BeginCombo("##regionswitcher", "Regions")) {
{ for (const auto& region_type : regions)
for (const auto& region_type : regions) {
{ components::selectable(region_type.name, *g_pointers->m_gta.m_region_code == region_type.id, [&region_type] {
components::selectable(region_type.name, *g_pointers->m_gta.m_region_code == region_type.id, [&region_type] { *g_pointers->m_gta.m_region_code = region_type.id;
*g_pointers->m_gta.m_region_code = region_type.id; });
}); }
} ImGui::EndCombo();
ImGui::EndCombo(); }
}
ImGui::Spacing();
ImGui::Spacing();
for (const auto& session_type : sessions)
for (const auto& session_type : sessions) {
{ components::selectable(session_type.name, false, [&session_type] {
components::selectable(session_type.name, false, [&session_type] { session::join_type(session_type.id);
session::join_type(session_type.id); });
}); }
} ImGui::EndListBox();
ImGui::EndListBox(); }
}
ImGui::EndGroup();
ImGui::EndGroup(); }
}
void render_misc()
void render_misc() {
{ ImGui::BeginGroup();
ImGui::BeginGroup();
components::sub_title("Misc");
components::sub_title("Misc"); if (ImGui::ListBoxHeader("##miscsession", get_listbox_dimensions()))
if (ImGui::ListBoxHeader("##miscsession", get_listbox_dimensions())) {
{ ImGui::Checkbox("Join Sctv", &g.session.join_in_sctv_slots); //CHANGE TRANSLATION JOIN_IN_SCTV
ImGui::Checkbox("Join Sctv", &g.session.join_in_sctv_slots); //CHANGE TRANSLATION JOIN_IN_SCTV if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("JOIN_IN_SCTV_DESC"_T.data());
ImGui::SetTooltip("JOIN_IN_SCTV_DESC"_T.data());
ImGui::Checkbox("PLAYER_MAGNET"_T.data(), &g.session.player_magnet_enabled);
ImGui::Checkbox("PLAYER_MAGNET"_T.data(), &g.session.player_magnet_enabled); if (g.session.player_magnet_enabled)
if (g.session.player_magnet_enabled) {
{ ImGui::Text("PLAYER_COUNT"_T.data());
ImGui::Text("PLAYER_COUNT"_T.data()); ImGui::InputInt("##playercount", &g.session.player_magnet_count);
ImGui::InputInt("##playercount", &g.session.player_magnet_count); }
}
ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
ImGui::Checkbox("Lobby Lock", &g.session.lock_session);
ImGui::Checkbox("Lobby Lock", &g.session.lock_session); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Blocks all players from joining. May not work on some modders.");
ImGui::SetTooltip("Blocks all players from joining. May not work on some modders.");
ImGui::EndDisabled();
ImGui::EndDisabled();
components::script_patch_checkbox("REVEAL_OTR_PLAYERS"_T, &g.session.decloak_players);
components::script_patch_checkbox("REVEAL_OTR_PLAYERS"_T, &g.session.decloak_players);
ImGui::ListBoxFooter();
ImGui::ListBoxFooter(); }
}
ImGui::EndGroup();
ImGui::EndGroup(); }
}
void render_chat()
void render_chat() {
{ ImGui::BeginGroup();
ImGui::BeginGroup();
components::sub_title("Chat");
components::sub_title("Chat"); if (ImGui::ListBoxHeader("##chat", get_listbox_dimensions()))
if (ImGui::ListBoxHeader("##chat", get_listbox_dimensions())) {
{ static char msg[256];
static char msg[256]; ImGui::Checkbox("AUTO_KICK_CHAT_SPAMMERS"_T.data(), &g.session.kick_chat_spammers);
ImGui::Checkbox("AUTO_KICK_CHAT_SPAMMERS"_T.data(), &g.session.kick_chat_spammers); ImGui::Checkbox("DISABLE_FILTER"_T.data(), &g.session.chat_force_clean);
ImGui::Checkbox("DISABLE_FILTER"_T.data(), &g.session.chat_force_clean); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Your sent chat messages will not be censored to the receivers"); // TODO: add translation
ImGui::SetTooltip("Your sent chat messages will not be censored to the receivers"); // TODO: add translation ImGui::Checkbox("LOG_CHAT_MSG"_T.data(), &g.session.log_chat_messages);
ImGui::Checkbox("LOG_CHAT_MSG"_T.data(), &g.session.log_chat_messages); ImGui::Checkbox("LOG_TXT_MSG"_T.data(), &g.session.log_text_messages);
ImGui::Checkbox("LOG_TXT_MSG"_T.data(), &g.session.log_text_messages); components::input_text_with_hint("##message", "Chat message", msg, sizeof(msg));
components::input_text_with_hint("##message", "Chat message", msg, sizeof(msg));
ImGui::Checkbox("IS_TEAM"_T.data(), &g.session.is_team);
ImGui::Checkbox("IS_TEAM"_T.data(), &g.session.is_team); ImGui::SameLine();
ImGui::SameLine(); components::button("SEND"_T, [] {
components::button("SEND"_T, [] { if (const auto net_game_player = gta_util::get_network_player_mgr()->m_local_net_player; net_game_player)
if (const auto net_game_player = gta_util::get_network_player_mgr()->m_local_net_player; net_game_player) {
{ if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_gta.m_send_chat_ptr,
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_gta.m_send_chat_ptr, net_game_player->get_net_data(),
net_game_player->get_net_data(), msg,
msg, g.session.is_team))
g.session.is_team)) notify::draw_chat(msg, net_game_player->get_name(), g.session.is_team);
notify::draw_chat(msg, net_game_player->get_name(), g.session.is_team); }
} });
});
ImGui::Separator();
ImGui::Separator();
ImGui::Checkbox("CHAT_COMMANDS"_T.data(), &g.session.chat_commands);
ImGui::Checkbox("CHAT_COMMANDS"_T.data(), &g.session.chat_commands); if (g.session.chat_commands)
if (g.session.chat_commands) {
{ components::small_text("DEFAULT_CMD_PERMISSIONS"_T.data());
components::small_text("DEFAULT_CMD_PERMISSIONS"_T.data()); if (ImGui::BeginCombo("##defualtchatcommands", COMMAND_ACCESS_LEVELS[g.session.chat_command_default_access_level]))
if (ImGui::BeginCombo("##defualtchatcommands", COMMAND_ACCESS_LEVELS[g.session.chat_command_default_access_level])) {
{ for (const auto& [type, name] : COMMAND_ACCESS_LEVELS)
for (const auto& [type, name] : COMMAND_ACCESS_LEVELS) {
{ if (ImGui::Selectable(name, type == g.session.chat_command_default_access_level))
if (ImGui::Selectable(name, type == g.session.chat_command_default_access_level)) {
{ g.session.chat_command_default_access_level = type;
g.session.chat_command_default_access_level = type; }
}
if (type == g.session.chat_command_default_access_level)
if (type == g.session.chat_command_default_access_level) {
{ ImGui::SetItemDefaultFocus();
ImGui::SetItemDefaultFocus(); }
} }
}
ImGui::EndCombo();
ImGui::EndCombo(); }
} }
}
ImGui::ListBoxFooter();
ImGui::ListBoxFooter(); }
}
ImGui::EndGroup();
ImGui::EndGroup(); }
}
void render_session_globals()
void render_session_globals() {
{ ImGui::BeginGroup();
ImGui::BeginGroup();
components::sub_title("Globals");
components::sub_title("Globals"); if (ImGui::ListBoxHeader("##globals", get_listbox_dimensions()))
if (ImGui::ListBoxHeader("##globals", get_listbox_dimensions())) {
{ static int global_wanted_level = 0;
static int global_wanted_level = 0;
ImGui::Checkbox("OFF_THE_RADAR"_T.data(), &g.session.off_radar_all);
ImGui::Checkbox("OFF_THE_RADAR"_T.data(), &g.session.off_radar_all); ImGui::Checkbox("NEVER_WANTED"_T.data(), &g.session.never_wanted_all);
ImGui::Checkbox("NEVER_WANTED"_T.data(), &g.session.never_wanted_all); ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g.session.semi_godmode_all);
ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g.session.semi_godmode_all); ImGui::Checkbox("EXPLOSION_KARMA"_T.data(), &g.session.explosion_karma);
ImGui::Checkbox("EXPLOSION_KARMA"_T.data(), &g.session.explosion_karma); ImGui::Checkbox("DAMAGE_KARMA"_T.data(), &g.session.damage_karma);
ImGui::Checkbox("DAMAGE_KARMA"_T.data(), &g.session.damage_karma); ImGui::Checkbox("DISABLE_PEDS"_T.data(), &g.session.disable_peds);
ImGui::Checkbox("DISABLE_PEDS"_T.data(), &g.session.disable_peds); ImGui::Checkbox("DISABLE_TRAFFIC"_T.data(), &g.session.disable_traffic);
ImGui::Checkbox("DISABLE_TRAFFIC"_T.data(), &g.session.disable_traffic); ImGui::Checkbox("FORCE_THUNDER"_T.data(), &g.session.force_thunder);
ImGui::Checkbox("FORCE_THUNDER"_T.data(), &g.session.force_thunder);
components::small_text("WANTED_LVL"_T.data());
components::small_text("WANTED_LVL"_T.data()); ImGui::SetNextItemWidth(150);
ImGui::SetNextItemWidth(150); if (ImGui::SliderInt("##wantedlevel", &global_wanted_level, 0, 5))
if (ImGui::SliderInt("##wantedlevel", &global_wanted_level, 0, 5)) {
{ scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelAmount = global_wanted_level;
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelAmount = global_wanted_level; }
}
ImGui::SameLine();
ImGui::SameLine(); if (ImGui::Checkbox("FORCE"_T.data(), &g.session.wanted_level_all))
if (ImGui::Checkbox("FORCE"_T.data(), &g.session.wanted_level_all)) {
{ scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelPlayer = __rdtsc() + 32;
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelPlayer = __rdtsc() + 32; scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelAmount = global_wanted_level;
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].RemoteWantedLevelAmount = global_wanted_level; }
}
ImGui::ListBoxFooter();
ImGui::ListBoxFooter(); }
}
ImGui::EndGroup();
ImGui::EndGroup(); }
}
void view::network()
void view::session() {
{ render_rid_joiner();
render_rid_joiner(); ImGui::SameLine();
ImGui::SameLine(); render_session_switcher();
render_session_switcher();
render_misc();
render_misc(); ImGui::SameLine();
ImGui::SameLine(); render_chat();
render_chat();
render_session_globals();
render_session_globals();
ImGui::SameLine();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::BeginGroup(); components::sub_title("FORCE_HOST"_T);
components::sub_title("FORCE_HOST"_T); ImGui::Checkbox("FORCE_SESSION_HOST"_T.data(), &g.session.force_session_host);
ImGui::Checkbox("FORCE_SESSION_HOST"_T.data(), &g.session.force_session_host); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("FORCE_SESSION_HOST_DESC"_T.data());
ImGui::SetTooltip("FORCE_SESSION_HOST_DESC"_T.data());
if (g.session.force_session_host)
if (g.session.force_session_host) {
{ ImGui::SameLine();
ImGui::SameLine(); ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host);
ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host); }
}
if (ImGui::Checkbox("FORCE_SCRIPT_HOST"_T.data(), &g.session.force_script_host))
if (ImGui::Checkbox("FORCE_SCRIPT_HOST"_T.data(), &g.session.force_script_host)) {
{ if (g.session.force_script_host)
if (g.session.force_script_host) g_fiber_pool->queue_job([] {
g_fiber_pool->queue_job([] { scripts::force_host(RAGE_JOAAT("freemode"));
scripts::force_host(RAGE_JOAAT("freemode")); if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode")); script && script->m_net_component)
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode")); script && script->m_net_component) script->m_net_component->block_host_migration(true);
script->m_net_component->block_host_migration(true);
scripts::force_host(RAGE_JOAAT("fmmc_launcher"));
scripts::force_host(RAGE_JOAAT("fmmc_launcher")); if (auto script = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")); script && script->m_net_component)
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")); script && script->m_net_component) script->m_net_component->block_host_migration(true);
script->m_net_component->block_host_migration(true); });
}); }
}
ImGui::Spacing();
ImGui::Spacing();
components::sub_title("Players");
components::sub_title("Players"); components::options_modal(
components::options_modal( "Griefing",
"Griefing", [] {
[] { components::command_button<"killall">({}, "KILL_ALL"_T);
components::command_button<"killall">({}, "KILL_ALL"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"explodeall">({}, "EXPLODE_ALL"_T);
components::command_button<"explodeall">({}, "EXPLODE_ALL"_T);
ImGui::SameLine();
ImGui::SameLine();
components::command_button<"beastall">({});
components::command_button<"beastall">({}); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("INCLUDING_YOU"_T.data());
ImGui::SetTooltip("INCLUDING_YOU"_T.data());
components::command_button<"bringall">({});
components::command_button<"bringall">({}); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"giveweapsall">({});
components::command_button<"giveweapsall">({}); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"remweapsall">({});
components::command_button<"remweapsall">({});
components::command_button<"ceokickall">({});
components::command_button<"ceokickall">({}); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"vehkickall">({});
components::command_button<"vehkickall">({});
components::command_button<"ragdollall">({}, "RAGDOLL_PLAYERS"_T);
components::command_button<"ragdollall">({}, "RAGDOLL_PLAYERS"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"intkickall">({}, "KICK_ALL_FROM_INTERIORS"_T);
components::command_button<"intkickall">({}, "KICK_ALL_FROM_INTERIORS"_T);
components::command_button<"missionall">({});
components::command_button<"missionall">({}); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"errorall">({});
components::command_button<"errorall">({});
components::command_button<"ceoraidall">({});
components::command_button<"ceoraidall">({}); ImGui::SameLine();
ImGui::SameLine(); components::button("Trigger MC Raid", [] {
components::button("Trigger MC Raid", [] { g_player_service->iterate([](auto& plyr) {
g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::BikerDefend);
toxic::start_activity(plyr.second, eActivityType::BikerDefend); });
}); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("Trigger Bunker Raid", [] {
components::button("Trigger Bunker Raid", [] { g_player_service->iterate([](auto& plyr) {
g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::GunrunningDefend);
toxic::start_activity(plyr.second, eActivityType::GunrunningDefend); });
}); });
}); },
}, false,
false, "Griefing");
"Griefing");
components::options_modal(
components::options_modal( "Teleport",
"Teleport", [] {
[] { if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx]))
if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx])) {
{ for (int i = 1; i < apartment_names.size(); i++)
for (int i = 1; i < apartment_names.size(); i++) {
{ if (ImGui::Selectable(apartment_names[i], i == g.session.send_to_apartment_idx))
if (ImGui::Selectable(apartment_names[i], i == g.session.send_to_apartment_idx)) {
{ g.session.send_to_apartment_idx = i;
g.session.send_to_apartment_idx = i; }
}
if (i == g.session.send_to_apartment_idx)
if (i == g.session.send_to_apartment_idx) {
{ ImGui::SetItemDefaultFocus();
ImGui::SetItemDefaultFocus(); }
} }
}
ImGui::EndCombo();
ImGui::EndCombo(); }
}
ImGui::SameLine();
ImGui::SameLine();
components::command_button<"apartmenttpall">({(uint64_t)g.session.send_to_apartment_idx}, "TP_ALL_TO_APARTMENT"_T);
components::command_button<"apartmenttpall">({(uint64_t)g.session.send_to_apartment_idx}, "TP_ALL_TO_APARTMENT"_T);
if (ImGui::BeginCombo("##warehouse", warehouse_names[g.session.send_to_warehouse_idx]))
if (ImGui::BeginCombo("##warehouse", warehouse_names[g.session.send_to_warehouse_idx])) {
{ for (int i = 1; i < warehouse_names.size(); i++)
for (int i = 1; i < warehouse_names.size(); i++) {
{ if (ImGui::Selectable(warehouse_names[i], i == g.session.send_to_warehouse_idx))
if (ImGui::Selectable(warehouse_names[i], i == g.session.send_to_warehouse_idx)) {
{ g.session.send_to_warehouse_idx = i;
g.session.send_to_warehouse_idx = i; }
}
if (i == g.session.send_to_warehouse_idx)
if (i == g.session.send_to_warehouse_idx) {
{ ImGui::SetItemDefaultFocus();
ImGui::SetItemDefaultFocus(); }
} }
}
ImGui::EndCombo();
ImGui::EndCombo(); }
}
ImGui::SameLine();
ImGui::SameLine();
components::command_button<"warehousetpall">({(uint64_t)g.session.send_to_warehouse_idx}, "TP_ALL_TO_WAREHOUSE"_T);
components::command_button<"warehousetpall">({(uint64_t)g.session.send_to_warehouse_idx}, "TP_ALL_TO_WAREHOUSE"_T);
components::button("TP_ALL_TO_DARTS"_T, [] {
components::button("TP_ALL_TO_DARTS"_T, [] { g_player_service->iterate([](auto& plyr) {
g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::Darts);
toxic::start_activity(plyr.second, eActivityType::Darts); });
}); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("TP_ALL_TO_FLIGHT_SCHOOL"_T, [] {
components::button("TP_ALL_TO_FLIGHT_SCHOOL"_T, [] { g_player_service->iterate([](auto& plyr) {
g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::PilotSchool);
toxic::start_activity(plyr.second, eActivityType::PilotSchool); });
}); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("TP_ALL_TO_MAP_CENTER"_T, [] {
components::button("TP_ALL_TO_MAP_CENTER"_T, [] { g_player_service->iterate([](auto& plyr) {
g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::ArmWresling);
toxic::start_activity(plyr.second, eActivityType::ArmWresling); });
}); });
});
components::button("TP_ALL_TO_SKYDIVE"_T, [] {
components::button("TP_ALL_TO_SKYDIVE"_T, [] { g_player_service->iterate([](auto& plyr) {
g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::Skydive);
toxic::start_activity(plyr.second, eActivityType::Skydive); });
}); });
}); ImGui::SameLine();
ImGui::SameLine();
components::command_button<"interiortpall">({81}, "TP_ALL_TO_MOC"_T);
components::command_button<"interiortpall">({81}, "TP_ALL_TO_MOC"_T);
ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({123}, "TP_ALL_TO_CASINO"_T);
components::command_button<"interiortpall">({123}, "TP_ALL_TO_CASINO"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({124}, "TP_ALL_TO_PENTHOUSE"_T);
components::command_button<"interiortpall">({124}, "TP_ALL_TO_PENTHOUSE"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({128}, "TP_ALL_TO_ARCADE"_T);
components::command_button<"interiortpall">({128}, "TP_ALL_TO_ARCADE"_T);
components::command_button<"interiortpall">({146}, "TP_ALL_TO_MUSIC_LOCKER"_T);
components::command_button<"interiortpall">({146}, "TP_ALL_TO_MUSIC_LOCKER"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({148}, "TP_ALL_TO_RECORD_A_STUDIOS"_T);
components::command_button<"interiortpall">({148}, "TP_ALL_TO_RECORD_A_STUDIOS"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({149}, "TP_ALL_TO_CUSTOM_AUTO_SHOP"_T);
components::command_button<"interiortpall">({149}, "TP_ALL_TO_CUSTOM_AUTO_SHOP"_T);
components::command_button<"interiortpall">({155}, "TP_ALL_TO_AGENCY"_T);
components::command_button<"interiortpall">({155}, "TP_ALL_TO_AGENCY"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({160}, "TP_ALL_TO_FREAKSHOP"_T);
components::command_button<"interiortpall">({160}, "TP_ALL_TO_FREAKSHOP"_T); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"interiortpall">({161}, "TP_ALL_TO_MULTI_FLOOR_GARAGE"_T);
components::command_button<"interiortpall">({161}, "TP_ALL_TO_MULTI_FLOOR_GARAGE"_T);
components::command_button<"tutorialall">();
components::command_button<"tutorialall">(); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"golfall">();
components::command_button<"golfall">(); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"flightschoolall">();
components::command_button<"flightschoolall">(); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"dartsall">();
components::command_button<"dartsall">();
components::command_button<"badlandsall">();
components::command_button<"badlandsall">(); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"spacemonkeyall">();
components::command_button<"spacemonkeyall">(); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"wizardall">();
components::command_button<"wizardall">();
components::command_button<"qub3dall">();
components::command_button<"qub3dall">(); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"camhedzall">();
components::command_button<"camhedzall">(); },
}, true,
true, "Teleport");
"Teleport");
ImGui::EndGroup();
ImGui::EndGroup();
components::command_button<"sextall">({}, "Send Sexts");
components::command_button<"sextall">({}, "Send Sexts"); ImGui::SameLine();
ImGui::SameLine(); components::command_button<"fakebanall">({}, "Send Fake Ban Messages");
components::command_button<"fakebanall">({}, "Send Fake Ban Messages");
components::small_text("WARP_TIME"_T.data());
components::small_text("WARP_TIME"_T.data());
components::button("PLUS_1_MINUTE"_T, [] {
components::button("PLUS_1_MINUTE"_T, [] { toxic::warp_time_forward_all(60 * 1000);
toxic::warp_time_forward_all(60 * 1000); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("PLUS_5_MINUTES"_T, [] {
components::button("PLUS_5_MINUTES"_T, [] { toxic::warp_time_forward_all(5 * 60 * 1000);
toxic::warp_time_forward_all(5 * 60 * 1000); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("PLUS_48_MINUTES"_T, [] {
components::button("PLUS_48_MINUTES"_T, [] { toxic::warp_time_forward_all(48 * 60 * 1000);
toxic::warp_time_forward_all(48 * 60 * 1000); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("PLUS_96_MINUTES"_T, [] {
components::button("PLUS_96_MINUTES"_T, [] { toxic::warp_time_forward_all(96 * 60 * 1000);
toxic::warp_time_forward_all(96 * 60 * 1000); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("PLUS_200_MINUTES"_T, [] {
components::button("PLUS_200_MINUTES"_T, [] { toxic::warp_time_forward_all(200 * 60 * 1000);
toxic::warp_time_forward_all(200 * 60 * 1000); });
}); ImGui::SameLine();
ImGui::SameLine(); components::button("STOP_TIME"_T, [] {
components::button("STOP_TIME"_T, [] { toxic::set_time_all(INT_MAX - 3000);
toxic::set_time_all(INT_MAX - 3000); });
}); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("STOP_TIME_DESC"_T.data());
ImGui::SetTooltip("STOP_TIME_DESC"_T.data());
components::sub_title("SCRIPT_HOST_FEATURES"_T);
components::sub_title("SCRIPT_HOST_FEATURES"_T); ImGui::Checkbox("DISABLE_CEO_MONEY"_T.data(), &g.session.block_ceo_money);
ImGui::Checkbox("DISABLE_CEO_MONEY"_T.data(), &g.session.block_ceo_money); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("DISABLE_CEO_MONEY_DESC"_T.data());
ImGui::SetTooltip("DISABLE_CEO_MONEY_DESC"_T.data()); ImGui::SameLine();
ImGui::SameLine(); ImGui::Checkbox("RANDOMIZE_CEO_COLORS"_T.data(), &g.session.randomize_ceo_colors);
ImGui::Checkbox("RANDOMIZE_CEO_COLORS"_T.data(), &g.session.randomize_ceo_colors); ImGui::Checkbox("Block Jobs", &g.session.block_jobs);
ImGui::Checkbox("Block Jobs", &g.session.block_jobs); if (ImGui::IsItemHovered())
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Prevents remote players from starting jobs while in your session");
ImGui::SetTooltip("Prevents remote players from starting jobs while in your session"); ImGui::SameLine();
ImGui::SameLine(); components::script_patch_checkbox("Block Muggers", &g.session.block_muggers, "For the entire session");
components::script_patch_checkbox("Block Muggers", &g.session.block_muggers, "For the entire session"); ImGui::SameLine();
ImGui::SameLine(); components::script_patch_checkbox("Block CEO Raids", &g.session.block_ceo_raids, "For the entire session");
components::script_patch_checkbox("Block CEO Raids", &g.session.block_ceo_raids, "For the entire session"); }
} }
}

View File

@ -13,6 +13,8 @@ namespace big
{ {
char name_buf[32]; char name_buf[32];
char search[64]; char search[64];
char note_buffer[1024];
bool notes_dirty = false;
std::shared_ptr<persistent_player> current_player; std::shared_ptr<persistent_player> current_player;
void draw_player_db_entry(std::shared_ptr<persistent_player> player, const std::string& lower_search) void draw_player_db_entry(std::shared_ptr<persistent_player> player, const std::string& lower_search)
@ -42,9 +44,17 @@ namespace big
if (components::selectable(player->name, player == g_player_database_service->get_selected())) if (components::selectable(player->name, player == g_player_database_service->get_selected()))
{ {
if (notes_dirty)
{
// Ensure notes are saved
g_player_database_service->save();
notes_dirty = false;
}
g_player_database_service->set_selected(player); g_player_database_service->set_selected(player);
current_player = player; current_player = player;
strncpy(name_buf, current_player->name.data(), sizeof(name_buf)); strncpy(name_buf, current_player->name.data(), sizeof(name_buf));
strncpy(note_buffer, current_player->notes.data(), sizeof(note_buffer));
} }
ImGui::PopID(); ImGui::PopID();
@ -97,7 +107,7 @@ namespace big
if (ImGui::InputScalar("RID"_T.data(), ImGuiDataType_S64, &current_player->rockstar_id) if (ImGui::InputScalar("RID"_T.data(), ImGuiDataType_S64, &current_player->rockstar_id)
|| ImGui::Checkbox("IS_MODDER"_T.data(), &current_player->is_modder) || ImGui::Checkbox("IS_MODDER"_T.data(), &current_player->is_modder)
|| ImGui::Checkbox("BLOCK_JOIN"_T.data(), &current_player->block_join) || ImGui::Checkbox("BLOCK_JOIN"_T.data(), &current_player->block_join)
|| ImGui::Checkbox("Notify When Online", &current_player->notify_online)) || ImGui::Checkbox("Notify When Online", &current_player->notify_online))
{ {
if (current_player->rockstar_id != selected->rockstar_id) if (current_player->rockstar_id != selected->rockstar_id)
g_player_database_service->update_rockstar_id(selected->rockstar_id, current_player->rockstar_id); g_player_database_service->update_rockstar_id(selected->rockstar_id, current_player->rockstar_id);
@ -157,6 +167,12 @@ namespace big
} }
} }
if (ImGui::InputTextMultiline("Notes", note_buffer, sizeof(note_buffer)))
{
current_player->notes = note_buffer;
notes_dirty = true;
}
components::button("JOIN_SESSION"_T, [] { components::button("JOIN_SESSION"_T, [] {
session::join_by_rockstar_id(current_player->rockstar_id); session::join_by_rockstar_id(current_player->rockstar_id);
}); });

View File

@ -147,5 +147,12 @@ namespace big
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputInt("###player_count", &g.spoofing.session_player_count); ImGui::InputInt("###player_count", &g.spoofing.session_player_count);
} }
ImGui::Checkbox("Spoof Session Bad Sport Status", &g.spoofing.spoof_session_bad_sport_status);
if (g.spoofing.spoof_session_bad_sport_status)
{
ImGui::SameLine();
ImGui::Checkbox("Badsport", &g.spoofing.session_bad_sport);
}
} }
} }

View File

@ -14,7 +14,9 @@ namespace big
return gta_util::get_network()->m_game_session_ptr->is_host(); return gta_util::get_network()->m_game_session_ptr->is_host();
}; };
ImGui::Text("Host/breakup kick require Host"); if (!g_player_service->get_self()->is_host())
ImGui::Text("Host and breakup kick require session host");
ImGui::BeginDisabled(!g_player_service->get_self()->is_host()); ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
components::player_command_button<"hostkick">(g_player_service->get_selected()); components::player_command_button<"hostkick">(g_player_service->get_selected());

View File

@ -1,4 +1,5 @@
#include "script/globals/GPBD_FM_3.hpp" #include "script/globals/GPBD_FM_3.hpp"
#include "services/script_connection/script_connection_service.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
#include "util/vehicle.hpp" #include "util/vehicle.hpp"
#include "views/view.hpp" #include "views/view.hpp"

View File

@ -110,7 +110,7 @@ namespace big
ImGui::EndCombo(); ImGui::EndCombo();
} }
auto selected_ipl = ipls[g.self.ipls.select]; const auto& selected_ipl = ipls[g.self.ipls.select];
if (components::button("LOAD_IPL"_T.data())) if (components::button("LOAD_IPL"_T.data()))
{ {
//unload all previous ipls //unload all previous ipls

View File

@ -25,8 +25,8 @@ namespace big
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("Increased C4 Limit (Max = 50)", &g.weapons.increased_c4_limit); ImGui::Checkbox("Increase C4 Limit (Max = 50)", &g.weapons.increased_c4_limit);
ImGui::Checkbox("Increased Flare Limit (Max = 50)", &g.weapons.increased_flare_limit); ImGui::Checkbox("Increase Flare Limit (Max = 50)", &g.weapons.increased_flare_limit);
components::command_checkbox<"rapidfire">(); components::command_checkbox<"rapidfire">();

View File

@ -1,3 +1,4 @@
#include "gui.hpp"
#include "renderer.hpp" #include "renderer.hpp"
#include "views/view.hpp" #include "views/view.hpp"
@ -6,20 +7,38 @@ namespace big
void view::gui_settings() void view::gui_settings()
{ {
components::sub_title("SETTINGS_UI_SCALE"_T); components::sub_title("SETTINGS_UI_SCALE"_T);
if (ImGui::SliderFloat("##gui-scale", &g.window.gui_scale, 1.f, 1.5f, "%.2f")) if (ImGui::SliderFloat("##gui-scale", &g.window.gui_scale, 0.75f, 1.5f, "%.2f"))
g_renderer->rescale(g.window.gui_scale); g_renderer->rescale(g.window.gui_scale);
components::sub_title("SETTINGS_UI_COLOR"_T); components::sub_title("SETTINGS_UI_COLOR"_T);
static ImVec4 col_gui = ImGui::ColorConvertU32ToFloat4(g.window.color); static ImVec4 col_gui = ImGui::ColorConvertU32ToFloat4(g.window.background_color);
if (ImGui::ColorEdit4("SETTINGS_UI_COLOR_PICKER"_T.data(), (float*)&col_gui, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) if (ImGui::ColorEdit4("SETTINGS_UI_COLOR_PICKER"_T.data(), (float*)&col_gui, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
{ {
g.window.color = ImGui::ColorConvertFloat4ToU32(col_gui); g.window.background_color = ImGui::ColorConvertFloat4ToU32(col_gui);
} }
components::sub_title("Ingame Overlay"); static ImVec4 col_text = ImGui::ColorConvertU32ToFloat4(g.window.text_color);
if (ImGui::ColorEdit4("Text Color", (float*)&col_text, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
{
g.window.text_color = ImGui::ColorConvertFloat4ToU32(col_text);
}
static ImVec4 col_button = ImGui::ColorConvertU32ToFloat4(g.window.button_color);
if (ImGui::ColorEdit4("Button Color", (float*)&col_button, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
{
g.window.button_color = ImGui::ColorConvertFloat4ToU32(col_button);
}
static ImVec4 col_frame = ImGui::ColorConvertU32ToFloat4(g.window.frame_color);
if (ImGui::ColorEdit4("Frame Color", (float*)&col_frame, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
{
g.window.frame_color = ImGui::ColorConvertFloat4ToU32(col_frame);
}
components::sub_title("In-Game Overlay");
ImGui::Checkbox("Show Overlay", &g.window.ingame_overlay.opened); ImGui::Checkbox("Show Overlay", &g.window.ingame_overlay.opened);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox("Show when Menu opened", &g.window.ingame_overlay.show_with_menu_opened); ImGui::Checkbox("Show When Menu Opened", &g.window.ingame_overlay.show_with_menu_opened);
ImGui::BeginGroup(); ImGui::BeginGroup();
@ -34,6 +53,7 @@ namespace big
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("Show Replay Interface", &g.window.ingame_overlay.show_replay_interface); ImGui::Checkbox("Show Replay Interface", &g.window.ingame_overlay.show_replay_interface);
ImGui::Checkbox("Show Position", &g.window.ingame_overlay.show_position);
ImGui::Checkbox("Show Game Version", &g.window.ingame_overlay.show_game_versions); ImGui::Checkbox("Show Game Version", &g.window.ingame_overlay.show_game_versions);
ImGui::EndGroup(); ImGui::EndGroup();

View File

@ -42,7 +42,7 @@ namespace big
static void overlay(); static void overlay();
static void root(); static void root();
static void self(); static void self();
static void session(); static void network();
static void missions(); static void missions();
static void player_database(); static void player_database();
static void session_browser(); static void session_browser();

View File

@ -10,7 +10,7 @@ namespace big
void view::squad_spawner() void view::squad_spawner()
{ {
const char* const spawn_distance_modes[5]{"Custom", "On target", "Closeby", "Moderately distanced", "Far away"}; const char* const spawn_distance_modes[5]{"Custom", "On target", "Nearby", "Moderately distanced", "Far away"};
const char* const combat_ability_levels[3]{"Poor", "Average", "Professional"}; const char* const combat_ability_levels[3]{"Poor", "Average", "Professional"};
static squad new_template{}; static squad new_template{};
@ -229,13 +229,13 @@ namespace big
new_template.m_vehicle_model.clear(); new_template.m_vehicle_model.clear();
new_template.m_weapon_model.clear(); new_template.m_weapon_model.clear();
new_template.m_persistent_vehicle = "None"; new_template.m_persistent_vehicle = "None";
new_template.m_squad_size = 1; new_template.m_squad_size = 1;
new_template.m_ped_invincibility = 0; new_template.m_ped_invincibility = 0;
new_template.m_veh_invincibility = 0; new_template.m_veh_invincibility = 0;
new_template.m_ped_health = 0; new_template.m_ped_health = 0;
new_template.m_ped_armor = 0; new_template.m_ped_armor = 0;
new_template.m_ped_accuracy = 50; new_template.m_ped_accuracy = 50;
new_template.m_spawn_distance = 0; new_template.m_spawn_distance = 0;
for (int i = 0; i < sizeof(new_template.m_ped_proofs) / sizeof(new_template.m_ped_proofs[0]); i++) for (int i = 0; i < sizeof(new_template.m_ped_proofs) / sizeof(new_template.m_ped_proofs[0]); i++)
new_template.m_ped_proofs[i] = false; new_template.m_ped_proofs[i] = false;
new_template.m_stay_in_veh = 0; new_template.m_stay_in_veh = 0;
@ -252,20 +252,20 @@ namespace big
{ {
ImGui::BeginGroup(); //Toggleables ImGui::BeginGroup(); //Toggleables
ImGui::Checkbox("Spawn ahead", &new_template.m_spawn_ahead); ImGui::Checkbox("Spawn Ahead", &new_template.m_spawn_ahead);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("Will use the distance specified and apply it in a forward direction to find a position ahead of the target"); ImGui::SetTooltip("Will use the distance specified and apply it in a forward direction to find a position ahead of the target");
ImGui::Checkbox("Favour roads", &new_template.m_favour_roads); ImGui::Checkbox("Favour Roads", &new_template.m_favour_roads);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("Will try and find a road first"); ImGui::SetTooltip("Will try and find a road first");
ImGui::Checkbox("Disperse", &new_template.m_disperse); ImGui::Checkbox("Disperse", &new_template.m_disperse);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("If the squad is on foot, will scatter units within the spawn distance"); ImGui::SetTooltip("If the squad is on foot, will scatter units within the spawn distance");
ImGui::Checkbox("Vehicle catch up", &new_template.m_spawn_behind_same_velocity); ImGui::Checkbox("Vehicle Catch Up", &new_template.m_spawn_behind_same_velocity);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("Will spawn the mobile squad behind the target with identical velocity if applicable.\nOnly for squads with a vehicle."); ImGui::SetTooltip("Will spawn the mobile squad behind the target with identical velocity if applicable.\nOnly for squads with a vehicle.");
ImGui::Checkbox("Stay In Vehicle", &new_template.m_stay_in_veh); ImGui::Checkbox("Stay In Vehicle", &new_template.m_stay_in_veh);
ImGui::Checkbox("Vehicle mods maxed", &new_template.m_max_vehicle); ImGui::Checkbox("Vehicle Mods Maxed", &new_template.m_max_vehicle);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
@ -285,13 +285,13 @@ namespace big
ImGui::PushItemWidth(200); ImGui::PushItemWidth(200);
ImGui::Text("Ped Health"); ImGui::Text("Ped Health");
ImGui::SliderFloat("##pedhealth", &new_template.m_ped_health, 100, 2000); ImGui::SliderFloat("##pedhealth", &new_template.m_ped_health, 0, 2000);
ImGui::Text("Ped Armor"); ImGui::Text("Ped Armor");
ImGui::SliderFloat("##pedarmor", &new_template.m_ped_armor, 0, 2000); ImGui::SliderFloat("##pedarmor", &new_template.m_ped_armor, 0, 2000);
ImGui::Text("Ped Accuracy"); ImGui::Text("Ped Accuracy");
ImGui::SliderFloat("##pedaccuracy", &new_template.m_ped_accuracy, 0, 100); ImGui::SliderFloat("##pedaccuracy", &new_template.m_ped_accuracy, 0, 100);
ImGui::Text("Custom Spawn Distance"); ImGui::Text("Custom Spawn Distance");
ImGui::SliderFloat("##customspawndistance", &new_template.m_spawn_distance, 10, 500); ImGui::SliderFloat("##customspawndistance", &new_template.m_spawn_distance, 0, 500);
ImGui::EndGroup(); ImGui::EndGroup();
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip("Leave these values at 0 to default, except for accuracy."); ImGui::SetTooltip("Leave these values at 0 to default, except for accuracy.");
@ -309,7 +309,7 @@ namespace big
ImGui::EndCombo(); ImGui::EndCombo();
} }
ImGui::Text("Persistent vehicle"); ImGui::Text("Persistent Vehicle");
if (ImGui::BeginCombo("##persistent_vehicle", new_template.m_persistent_vehicle.data())) if (ImGui::BeginCombo("##persistent_vehicle", new_template.m_persistent_vehicle.data()))
{ {
if (ImGui::Selectable("None", new_template.m_persistent_vehicle == "None")) if (ImGui::Selectable("None", new_template.m_persistent_vehicle == "None"))
@ -324,9 +324,7 @@ namespace big
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::EndGroup(); ImGui::EndGroup();
components::input_text_with_hint("##new_template.m_description", components::input_text_with_hint("##new_template.m_description", "Description", &new_template.m_description);
"Squad new_template.m_description",
&new_template.m_description);
ImGui::TreePop(); ImGui::TreePop();
} }
@ -362,43 +360,41 @@ namespace big
}; };
components::button("Spawn Squad", [] { components::button("Spawn Squad", [] {
try{ try
{
if (check_validity(false)) if (check_validity(false))
g_squad_spawner_service.spawn_squad({ g_squad_spawner_service.spawn_squad({new_template.m_name,
new_template.m_name, new_template.m_ped_model,
new_template.m_ped_model, new_template.m_weapon_model,
new_template.m_weapon_model, new_template.m_vehicle_model,
new_template.m_vehicle_model, new_template.m_squad_size,
new_template.m_squad_size, new_template.m_ped_invincibility,
new_template.m_ped_invincibility, new_template.m_veh_invincibility,
new_template.m_veh_invincibility, new_template.m_ped_proofs,
new_template.m_ped_proofs, new_template.m_ped_health,
new_template.m_ped_health, new_template.m_ped_armor,
new_template.m_ped_armor, new_template.m_spawn_distance,
new_template.m_spawn_distance, new_template.m_ped_accuracy,
new_template.m_ped_accuracy, new_template.m_spawn_distance_mode,
new_template.m_spawn_distance_mode, new_template.m_combat_ability_level,
new_template.m_combat_ability_level, new_template.m_stay_in_veh,
new_template.m_stay_in_veh, new_template.m_spawn_behind_same_velocity,
new_template.m_spawn_behind_same_velocity, new_template.m_description,
new_template.m_description, new_template.m_disperse,
new_template.m_disperse, new_template.m_spawn_ahead,
new_template.m_spawn_ahead, new_template.m_favour_roads,
new_template.m_favour_roads, new_template.m_max_vehicle,
new_template.m_max_vehicle, new_template.m_persistent_vehicle},
new_template.m_persistent_vehicle}, victim,
victim, new_template.m_spawn_distance_mode == eSquadSpawnDistance::CUSTOM,
new_template.m_spawn_distance_mode == eSquadSpawnDistance::CUSTOM, g_orbital_drone_service.m_ground_pos);
g_orbital_drone_service.m_ground_pos);
} }
catch (std::exception e) catch (std::exception e)
{ {
LOG(WARNING) << "Exception while spawning squad " << e.what(); LOG(WARNING) << "Exception while spawning squad " << e.what();
} }
}); });
ImGui::SameLine(); ImGui::SameLine();
components::button("Save", [] { components::button("Save", [] {
if (check_validity(true) && !check_if_exists(new_template.m_name)) if (check_validity(true) && !check_if_exists(new_template.m_name))