From 95259faf593150dc5d5b929a457b4b0ae91f778e Mon Sep 17 00:00:00 2001 From: Alice <105157805+Alice2333g@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:20:22 +0800 Subject: [PATCH 01/19] add lua api: script.execute_as_script (#2824) Co-authored-by: xiaoxiao921 --- docs/lua/tables/script.md | 13 ++++++++++++- src/lua/bindings/script.cpp | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/lua/tables/script.md b/docs/lua/tables/script.md index e43b2697..a922cc0c 100644 --- a/docs/lua/tables/script.md +++ b/docs/lua/tables/script.md @@ -2,7 +2,7 @@ Table containing helper functions related to gta scripts. -## Functions (2) +## Functions (3) ### `register_looped(name, func)` @@ -75,4 +75,15 @@ end) script.run_in_fiber(func) ``` +### `execute_as_script(script_name, func)` + +- **Parameters:** + - `script_name` (string): target script thread. + - `func` (function): function that will be executed once in the script thread. + +**Example Usage:** +```lua +script.execute_as_script(script_name, func) +``` + diff --git a/src/lua/bindings/script.cpp b/src/lua/bindings/script.cpp index ecc01e78..a47108d7 100644 --- a/src/lua/bindings/script.cpp +++ b/src/lua/bindings/script.cpp @@ -3,6 +3,7 @@ #include "lua/lua_manager.hpp" #include "script_mgr.hpp" +#include "gta_util.hpp" namespace lua::script { @@ -151,15 +152,26 @@ namespace lua::script module->m_registered_scripts.push_back(std::move(lua_script)); } + // Lua API: function + // Table: script + // Name: execute_as_script + // Param: script_name: string: target script thread. + // Param: func: function: function that will be executed once in the script thread. + static void execute_as_script(const std::string& script_name, sol::protected_function func) + { + big::gta_util::execute_as_script(rage::joaat(script_name), func); + } + void bind(sol::state& state) { auto ns = state["script"].get_or_create(); ns["register_looped"] = register_looped; ns["run_in_fiber"] = run_in_fiber; + ns["execute_as_script"] = execute_as_script; auto usertype = state.new_usertype("script_util"); usertype["yield"] = sol::yielding(&script_util::yield); usertype["sleep"] = sol::yielding(&script_util::sleep); } -} \ No newline at end of file +} From 5f553b343000f75c53594a0213da3f85e1cad19b Mon Sep 17 00:00:00 2001 From: Andreas Maerten <24669514+Yimura@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:22:33 +0100 Subject: [PATCH 02/19] fix(Logger): not logging anymore after setup is done (#2858) Regression introduced in #2492 Closes #2773 --- src/logger/logger.cpp | 37 +++++++++++++++++++++++++------------ src/logger/logger.hpp | 3 ++- src/main.cpp | 3 +-- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/logger/logger.cpp b/src/logger/logger.cpp index b30652e9..e478d5be 100644 --- a/src/logger/logger.cpp +++ b/src/logger/logger.cpp @@ -22,7 +22,6 @@ namespace big m_console_logger = &logger::format_console_simple; } - toggle_external_console(attach_console); create_backup(); m_file_out.open(m_file.get_path(), std::ios_base::out | std::ios_base::trunc); @@ -33,6 +32,8 @@ namespace big Logger::AddSink([this](LogMessagePtr msg) { format_file(std::move(msg)); }); + + toggle_external_console(attach_console); } void logger::destroy() @@ -44,6 +45,19 @@ namespace big void logger::toggle_external_console(bool toggle) { + if (m_is_console_open == toggle) + { + return; + } + m_is_console_open = toggle; + + m_console_out.close(); + if (m_did_console_exist) + SetConsoleMode(m_console_handle, m_original_console_mode); + + if (!m_did_console_exist) + FreeConsole(); + if (toggle) { if (m_did_console_exist = ::AttachConsole(GetCurrentProcessId()); !m_did_console_exist) @@ -60,23 +74,12 @@ namespace big // terminal like behaviour enable full color support console_mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN; - // prevent clicking in terminal from suspending our main thread - console_mode &= ~(ENABLE_QUICK_EDIT_MODE); SetConsoleMode(m_console_handle, console_mode); } m_console_out.open("CONOUT$", std::ios_base::out | std::ios_base::app); - - return; } - - m_console_out.close(); - if (m_did_console_exist) - SetConsoleMode(m_console_handle, m_original_console_mode); - - if (!m_did_console_exist) - FreeConsole(); } void logger::create_backup() @@ -119,6 +122,11 @@ namespace big void logger::format_console(const LogMessagePtr msg) { + if (!m_is_console_open) + { + return; + } + const auto color = get_color(msg->Level()); const auto timestamp = std::format("{0:%H:%M:%S}", msg->Timestamp()); @@ -133,6 +141,11 @@ namespace big void logger::format_console_simple(const LogMessagePtr msg) { + if (!m_is_console_open) + { + return; + } + const auto color = get_color(msg->Level()); const auto timestamp = std::format("{0:%H:%M:%S}", msg->Timestamp()); diff --git a/src/logger/logger.hpp b/src/logger/logger.hpp index 647ae01b..b1e46a76 100644 --- a/src/logger/logger.hpp +++ b/src/logger/logger.hpp @@ -28,6 +28,7 @@ namespace big private: bool m_attach_console = true; bool m_did_console_exist = false; + bool m_is_console_open = false; void (logger::*m_console_logger)(const LogMessagePtr msg) = &logger::format_console; @@ -59,4 +60,4 @@ namespace big }; inline logger g_log{}; -} \ No newline at end of file +} diff --git a/src/main.cpp b/src/main.cpp index 6873f2ef..3e0203fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -152,9 +152,8 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) g_file_manager.init(base_dir); g.init(g_file_manager.get_project_file("./settings.json")); - LOG(INFO) << "Settings Loaded."; - g_log.initialize("YimMenu", g_file_manager.get_project_file("./cout.log"), g.debug.external_console); + LOG(INFO) << "Settings Loaded and logger initialized."; LOG(INFO) << "Yim's Menu Initializing"; LOGF(INFO, "Git Info\n\tBranch:\t{}\n\tHash:\t{}\n\tDate:\t{}", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE); From dd679010b759b8e43d076e236ab2a9ce00f4ddae Mon Sep 17 00:00:00 2001 From: xynny <86185324+xynnylol@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:04:40 +0000 Subject: [PATCH 03/19] Add more crash models to protection (#2857) --- src/util/protection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/protection.cpp b/src/util/protection.cpp index 985a570c..24b099cd 100644 --- a/src/util/protection.cpp +++ b/src/util/protection.cpp @@ -4,7 +4,7 @@ namespace big::protection { - constexpr auto crash_objects = {"prop_dummy_01"_J, "prop_dummy_car"_J, "prop_dummy_light"_J, "prop_dummy_plane"_J, "prop_distantcar_night"_J, "prop_distantcar_day"_J, "hei_bh1_08_details4_em_night"_J, "dt1_18_sq_night_slod"_J, "ss1_12_night_slod"_J, "hash_b334b5e2_qyquzxq_collision"_J, "h4_prop_bush_bgnvla_med_01"_J, "h4_prop_bush_bgnvla_lrg_01"_J, "h4_prop_bush_buddleia_low_01"_J, "h4_prop_bush_ear_aa"_J, "h4_prop_bush_ear_ab"_J, "h4_prop_bush_fern_low_01"_J, "h4_prop_bush_fern_tall_cc"_J, "h4_prop_bush_mang_ad"_J, "h4_prop_bush_mang_low_aa"_J, "h4_prop_bush_mang_low_ab"_J, "h4_prop_bush_seagrape_low_01"_J, "prop_h4_ground_cover"_J, "h4_prop_weed_groundcover_01"_J, "h4_prop_grass_med_01"_J, "h4_prop_grass_tropical_lush_01"_J, "h4_prop_grass_wiregrass_01"_J, "h4_prop_weed_01_plant"_J, "h4_prop_weed_01_row"_J, "urbanweeds02_l1"_J, "proc_forest_grass01"_J, "prop_small_bushyba"_J, "v_res_d_dildo_a"_J, "v_res_d_dildo_b"_J, "v_res_d_dildo_c"_J, "v_res_d_dildo_d"_J, "v_res_d_dildo_e"_J, "v_res_d_dildo_f"_J, "v_res_skateboard"_J, "prop_battery_01"_J, "prop_barbell_01"_J, "prop_barbell_02"_J, "prop_bandsaw_01"_J, "prop_bbq_3"_J, "v_med_curtainsnewcloth2"_J, "bh1_07_flagpoles"_J, "hash_058a7eb5_deihiws_collision"_J, "proc_dry_plants_01"_J, "proc_leafyplant_01"_J, "proc_grassplantmix_02"_J, "proc_dryplantsgrass_01"_J, "proc_dryplantsgrass_02"_J, "proc_dryplantsgrass_02"_J, "proc_grasses01"_J, "prop_dryweed_002_a"_J, "prop_fernba"_J, "prop_weed_001_aa"_J, "urbangrnfrnds_01"_J, "urbanweeds01"_J, "prop_dandy_b"_J, "v_proc2_temp"_J, "prop_fernbb"_J, "proc_drygrassfronds01"_J, "prop_log_ae"_J, "prop_grass_da"_J, "prop_fragtest_cnst_04"_J}; + constexpr unsigned int crash_objects[126] = {"prop_facgate_05_r_dam_l1"_J, "v_61_lng_mesh_unita_swap"_J, "prop_crt_mon_02"_J, "xs_prop_arena_pit_fire_01a_wl"_J, "prop_billboard_07"_J, "prop_recyclebin_02_d"_J, "prop_billboard_14"_J, "v_res_fa_book02"_J, "sf_int1_dropdownlight041"_J, "w_sg_pumpshotgunmk2_camo6"_J, "ch_prop_cash_low_trolly_01b"_J, "prop_ld_headset_01"_J, "sf_int1_office_wpaper_6"_J, "v_74_it3_ceiling_smoke_01_skin"_J, "prop_sh_tt_fridgedoor"_J, "ch_prop_arcade_race_02a"_J, "v_61_kit_over_dec_cruma"_J, "gr_prop_gr_rsply_crate01a"_J, "prop_snow_streetlight_01_frag_"_J, "v_34_sm_proc"_J, "tr_int1_lightcap_proxy001"_J, "v_ilev_tort_door"_J, "ch_prop_arcade_street_01b"_J, "prop_ic_repair_p"_J, "sf_int2_elevator_details_02"_J, "prop_cs4_05_tdoor"_J, "vfx_it1_02"_J, "cloudhat_wispy_b"_J, "hei_p_pre_heist_trash"_J, "v_ilev_trev_patiodoor"_J, "prop_bin_10a"_J, "sm_prop_offchair_smug_01"_J, "stt_prop_stunt_tube_fn_02"_J, "m23_2_prop_m32_hat_captain_01a"_J, "vw_prop_vw_arcade_04d_screen"_J, "prop_food_juice02"_J, "m23_2_prop_m32_mazebankcard_01a"_J, "v_28_alrm_case011"_J, "apa_mp_h_acc_pot_pouri_01"_J, "xm3_prop_xm3_crate_ammo_01a"_J, "prop_blackjack_01"_J, "prop_cs_mini_tv"_J, "v_res_fa_basket"_J, "prop_plant_int_02b"_J, "prop_umpire_01"_J, "gr_prop_gr_fnclink_03g"_J, "prop_rub_tyre_dam3"_J, "ba_prop_battle_lights_support"_J, "prop_fnclink_09a"_J, "ba_prop_battle_dj_mixer_01e"_J, "ar_prop_ar_neon_gate8x_04a"_J, "xs_propintarena_structure_f_03b"_J, "des_plog_door_end"_J, "v_ret_fh_chair01"_J, "gr_prop_gr_offchair_01a"_J, "hei_p_pre_heist_coke"_J, "cloudhat_puff_b"_J, "v_ind_cfbucket"_J, "p_hw1_22_doors_s"_J, "arbitergt"_J, "slod_human"_J, "prop_dummy_01"_J, "prop_dummy_car"_J, "prop_dummy_light"_J, "prop_dummy_plane"_J, "prop_distantcar_night"_J, "prop_distantcar_day"_J, "hei_bh1_08_details4_em_night"_J, "dt1_18_sq_night_slod"_J, "ss1_12_night_slod"_J, "hash_b334b5e2_qyquzxq_collision"_J, "h4_prop_bush_bgnvla_med_01"_J, "h4_prop_bush_bgnvla_lrg_01"_J, "h4_prop_bush_buddleia_low_01"_J, "h4_prop_bush_ear_aa"_J, "h4_prop_bush_ear_ab"_J, "h4_prop_bush_fern_low_01"_J, "h4_prop_bush_fern_tall_cc"_J, "h4_prop_bush_mang_ad"_J, "h4_prop_bush_mang_low_aa"_J, "h4_prop_bush_mang_low_ab"_J, "h4_prop_bush_seagrape_low_01"_J, "prop_h4_ground_cover"_J, "h4_prop_weed_groundcover_01"_J, "h4_prop_grass_med_01"_J, "h4_prop_grass_tropical_lush_01"_J, "h4_prop_grass_wiregrass_01"_J, "h4_prop_weed_01_plant"_J, "h4_prop_weed_01_row"_J, "urbanweeds02_l1"_J, "proc_forest_grass01"_J, "prop_small_bushyba"_J, "v_res_d_dildo_a"_J, "v_res_d_dildo_b"_J, "v_res_d_dildo_c"_J, "v_res_d_dildo_d"_J, "v_res_d_dildo_e"_J, "v_res_d_dildo_f"_J, "v_res_skateboard"_J, "prop_battery_01"_J, "prop_barbell_01"_J, "prop_barbell_02"_J, "prop_bandsaw_01"_J, "prop_bbq_3"_J, "v_med_curtainsnewcloth2"_J, "bh1_07_flagpoles"_J, "hash_058a7eb5_deihiws_collision"_J, "proc_dry_plants_01"_J, "proc_leafyplant_01"_J, "proc_grassplantmix_02"_J, "proc_dryplantsgrass_01"_J, "proc_dryplantsgrass_02"_J, "proc_dryplantsgrass_02"_J, "proc_grasses01"_J, "prop_dryweed_002_a"_J, "prop_fernba"_J, "prop_weed_001_aa"_J, "urbangrnfrnds_01"_J, "urbanweeds01"_J, "prop_dandy_b"_J, "v_proc2_temp"_J, "prop_fernbb"_J, "proc_drygrassfronds01"_J, "prop_log_ae"_J, "prop_grass_da"_J, "prop_fragtest_cnst_04"_J}; bool is_crash_object(rage::joaat_t model) { if (!model_info::get_model(model)) From 3f1921e83583b2a46c56c3502f6fb06ba84c8ba0 Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Fri, 22 Mar 2024 04:24:39 -0400 Subject: [PATCH 04/19] Fixed incorrect typing of crash_objects array to allow the compiler to determine which is best. (#2859) --- src/util/protection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/protection.cpp b/src/util/protection.cpp index 24b099cd..e2d9a678 100644 --- a/src/util/protection.cpp +++ b/src/util/protection.cpp @@ -4,7 +4,7 @@ namespace big::protection { - constexpr unsigned int crash_objects[126] = {"prop_facgate_05_r_dam_l1"_J, "v_61_lng_mesh_unita_swap"_J, "prop_crt_mon_02"_J, "xs_prop_arena_pit_fire_01a_wl"_J, "prop_billboard_07"_J, "prop_recyclebin_02_d"_J, "prop_billboard_14"_J, "v_res_fa_book02"_J, "sf_int1_dropdownlight041"_J, "w_sg_pumpshotgunmk2_camo6"_J, "ch_prop_cash_low_trolly_01b"_J, "prop_ld_headset_01"_J, "sf_int1_office_wpaper_6"_J, "v_74_it3_ceiling_smoke_01_skin"_J, "prop_sh_tt_fridgedoor"_J, "ch_prop_arcade_race_02a"_J, "v_61_kit_over_dec_cruma"_J, "gr_prop_gr_rsply_crate01a"_J, "prop_snow_streetlight_01_frag_"_J, "v_34_sm_proc"_J, "tr_int1_lightcap_proxy001"_J, "v_ilev_tort_door"_J, "ch_prop_arcade_street_01b"_J, "prop_ic_repair_p"_J, "sf_int2_elevator_details_02"_J, "prop_cs4_05_tdoor"_J, "vfx_it1_02"_J, "cloudhat_wispy_b"_J, "hei_p_pre_heist_trash"_J, "v_ilev_trev_patiodoor"_J, "prop_bin_10a"_J, "sm_prop_offchair_smug_01"_J, "stt_prop_stunt_tube_fn_02"_J, "m23_2_prop_m32_hat_captain_01a"_J, "vw_prop_vw_arcade_04d_screen"_J, "prop_food_juice02"_J, "m23_2_prop_m32_mazebankcard_01a"_J, "v_28_alrm_case011"_J, "apa_mp_h_acc_pot_pouri_01"_J, "xm3_prop_xm3_crate_ammo_01a"_J, "prop_blackjack_01"_J, "prop_cs_mini_tv"_J, "v_res_fa_basket"_J, "prop_plant_int_02b"_J, "prop_umpire_01"_J, "gr_prop_gr_fnclink_03g"_J, "prop_rub_tyre_dam3"_J, "ba_prop_battle_lights_support"_J, "prop_fnclink_09a"_J, "ba_prop_battle_dj_mixer_01e"_J, "ar_prop_ar_neon_gate8x_04a"_J, "xs_propintarena_structure_f_03b"_J, "des_plog_door_end"_J, "v_ret_fh_chair01"_J, "gr_prop_gr_offchair_01a"_J, "hei_p_pre_heist_coke"_J, "cloudhat_puff_b"_J, "v_ind_cfbucket"_J, "p_hw1_22_doors_s"_J, "arbitergt"_J, "slod_human"_J, "prop_dummy_01"_J, "prop_dummy_car"_J, "prop_dummy_light"_J, "prop_dummy_plane"_J, "prop_distantcar_night"_J, "prop_distantcar_day"_J, "hei_bh1_08_details4_em_night"_J, "dt1_18_sq_night_slod"_J, "ss1_12_night_slod"_J, "hash_b334b5e2_qyquzxq_collision"_J, "h4_prop_bush_bgnvla_med_01"_J, "h4_prop_bush_bgnvla_lrg_01"_J, "h4_prop_bush_buddleia_low_01"_J, "h4_prop_bush_ear_aa"_J, "h4_prop_bush_ear_ab"_J, "h4_prop_bush_fern_low_01"_J, "h4_prop_bush_fern_tall_cc"_J, "h4_prop_bush_mang_ad"_J, "h4_prop_bush_mang_low_aa"_J, "h4_prop_bush_mang_low_ab"_J, "h4_prop_bush_seagrape_low_01"_J, "prop_h4_ground_cover"_J, "h4_prop_weed_groundcover_01"_J, "h4_prop_grass_med_01"_J, "h4_prop_grass_tropical_lush_01"_J, "h4_prop_grass_wiregrass_01"_J, "h4_prop_weed_01_plant"_J, "h4_prop_weed_01_row"_J, "urbanweeds02_l1"_J, "proc_forest_grass01"_J, "prop_small_bushyba"_J, "v_res_d_dildo_a"_J, "v_res_d_dildo_b"_J, "v_res_d_dildo_c"_J, "v_res_d_dildo_d"_J, "v_res_d_dildo_e"_J, "v_res_d_dildo_f"_J, "v_res_skateboard"_J, "prop_battery_01"_J, "prop_barbell_01"_J, "prop_barbell_02"_J, "prop_bandsaw_01"_J, "prop_bbq_3"_J, "v_med_curtainsnewcloth2"_J, "bh1_07_flagpoles"_J, "hash_058a7eb5_deihiws_collision"_J, "proc_dry_plants_01"_J, "proc_leafyplant_01"_J, "proc_grassplantmix_02"_J, "proc_dryplantsgrass_01"_J, "proc_dryplantsgrass_02"_J, "proc_dryplantsgrass_02"_J, "proc_grasses01"_J, "prop_dryweed_002_a"_J, "prop_fernba"_J, "prop_weed_001_aa"_J, "urbangrnfrnds_01"_J, "urbanweeds01"_J, "prop_dandy_b"_J, "v_proc2_temp"_J, "prop_fernbb"_J, "proc_drygrassfronds01"_J, "prop_log_ae"_J, "prop_grass_da"_J, "prop_fragtest_cnst_04"_J}; + constexpr auto crash_objects = {"prop_facgate_05_r_dam_l1"_J, "v_61_lng_mesh_unita_swap"_J, "prop_crt_mon_02"_J, "xs_prop_arena_pit_fire_01a_wl"_J, "prop_billboard_07"_J, "prop_recyclebin_02_d"_J, "prop_billboard_14"_J, "v_res_fa_book02"_J, "sf_int1_dropdownlight041"_J, "w_sg_pumpshotgunmk2_camo6"_J, "ch_prop_cash_low_trolly_01b"_J, "prop_ld_headset_01"_J, "sf_int1_office_wpaper_6"_J, "v_74_it3_ceiling_smoke_01_skin"_J, "prop_sh_tt_fridgedoor"_J, "ch_prop_arcade_race_02a"_J, "v_61_kit_over_dec_cruma"_J, "gr_prop_gr_rsply_crate01a"_J, "prop_snow_streetlight_01_frag_"_J, "v_34_sm_proc"_J, "tr_int1_lightcap_proxy001"_J, "v_ilev_tort_door"_J, "ch_prop_arcade_street_01b"_J, "prop_ic_repair_p"_J, "sf_int2_elevator_details_02"_J, "prop_cs4_05_tdoor"_J, "vfx_it1_02"_J, "cloudhat_wispy_b"_J, "hei_p_pre_heist_trash"_J, "v_ilev_trev_patiodoor"_J, "prop_bin_10a"_J, "sm_prop_offchair_smug_01"_J, "stt_prop_stunt_tube_fn_02"_J, "m23_2_prop_m32_hat_captain_01a"_J, "vw_prop_vw_arcade_04d_screen"_J, "prop_food_juice02"_J, "m23_2_prop_m32_mazebankcard_01a"_J, "v_28_alrm_case011"_J, "apa_mp_h_acc_pot_pouri_01"_J, "xm3_prop_xm3_crate_ammo_01a"_J, "prop_blackjack_01"_J, "prop_cs_mini_tv"_J, "v_res_fa_basket"_J, "prop_plant_int_02b"_J, "prop_umpire_01"_J, "gr_prop_gr_fnclink_03g"_J, "prop_rub_tyre_dam3"_J, "ba_prop_battle_lights_support"_J, "prop_fnclink_09a"_J, "ba_prop_battle_dj_mixer_01e"_J, "ar_prop_ar_neon_gate8x_04a"_J, "xs_propintarena_structure_f_03b"_J, "des_plog_door_end"_J, "v_ret_fh_chair01"_J, "gr_prop_gr_offchair_01a"_J, "hei_p_pre_heist_coke"_J, "cloudhat_puff_b"_J, "v_ind_cfbucket"_J, "p_hw1_22_doors_s"_J, "arbitergt"_J, "slod_human"_J, "prop_dummy_01"_J, "prop_dummy_car"_J, "prop_dummy_light"_J, "prop_dummy_plane"_J, "prop_distantcar_night"_J, "prop_distantcar_day"_J, "hei_bh1_08_details4_em_night"_J, "dt1_18_sq_night_slod"_J, "ss1_12_night_slod"_J, "hash_b334b5e2_qyquzxq_collision"_J, "h4_prop_bush_bgnvla_med_01"_J, "h4_prop_bush_bgnvla_lrg_01"_J, "h4_prop_bush_buddleia_low_01"_J, "h4_prop_bush_ear_aa"_J, "h4_prop_bush_ear_ab"_J, "h4_prop_bush_fern_low_01"_J, "h4_prop_bush_fern_tall_cc"_J, "h4_prop_bush_mang_ad"_J, "h4_prop_bush_mang_low_aa"_J, "h4_prop_bush_mang_low_ab"_J, "h4_prop_bush_seagrape_low_01"_J, "prop_h4_ground_cover"_J, "h4_prop_weed_groundcover_01"_J, "h4_prop_grass_med_01"_J, "h4_prop_grass_tropical_lush_01"_J, "h4_prop_grass_wiregrass_01"_J, "h4_prop_weed_01_plant"_J, "h4_prop_weed_01_row"_J, "urbanweeds02_l1"_J, "proc_forest_grass01"_J, "prop_small_bushyba"_J, "v_res_d_dildo_a"_J, "v_res_d_dildo_b"_J, "v_res_d_dildo_c"_J, "v_res_d_dildo_d"_J, "v_res_d_dildo_e"_J, "v_res_d_dildo_f"_J, "v_res_skateboard"_J, "prop_battery_01"_J, "prop_barbell_01"_J, "prop_barbell_02"_J, "prop_bandsaw_01"_J, "prop_bbq_3"_J, "v_med_curtainsnewcloth2"_J, "bh1_07_flagpoles"_J, "hash_058a7eb5_deihiws_collision"_J, "proc_dry_plants_01"_J, "proc_leafyplant_01"_J, "proc_grassplantmix_02"_J, "proc_dryplantsgrass_01"_J, "proc_dryplantsgrass_02"_J, "proc_dryplantsgrass_02"_J, "proc_grasses01"_J, "prop_dryweed_002_a"_J, "prop_fernba"_J, "prop_weed_001_aa"_J, "urbangrnfrnds_01"_J, "urbanweeds01"_J, "prop_dandy_b"_J, "v_proc2_temp"_J, "prop_fernbb"_J, "proc_drygrassfronds01"_J, "prop_log_ae"_J, "prop_grass_da"_J, "prop_fragtest_cnst_04"_J}; bool is_crash_object(rage::joaat_t model) { if (!model_info::get_model(model)) From 313bfa24b3cf019d6583181eea3f9af6b2207a93 Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:19:57 -0400 Subject: [PATCH 05/19] Remove DROWN flag and replace it with WATER flag. (#2863) --- src/core/enums.hpp | 3 +-- src/core/settings.hpp | 3 +-- src/views/self/view_self.cpp | 7 ------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/core/enums.hpp b/src/core/enums.hpp index 384b91aa..2f87ff3b 100644 --- a/src/core/enums.hpp +++ b/src/core/enums.hpp @@ -293,8 +293,7 @@ namespace big GOD = 1 << 8, EXPLOSION = 1 << 11, STEAM = 1 << 15, - DROWN = 1 << 16, - WATER = 1 << 24, + WATER = 1 << 16, }; enum ePedType : uint32_t { diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 44f7f9f6..74723fd1 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -336,7 +336,6 @@ namespace big bool proof_melee = false; bool proof_explosion = false; bool proof_steam = false; - bool proof_drown = false; bool proof_water = false; uint32_t proof_mask = 0; bool mobile_radio = false; @@ -388,7 +387,7 @@ namespace big NLOHMANN_DEFINE_TYPE_INTRUSIVE(super_hero_fly, gradual, explosions, auto_land, charge, ptfx, fly_speed, initial_launch) } super_hero_fly{}; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ipls, ptfx_effects, clean_player, force_wanted_level, passive, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, noclip_aim_speed_multiplier, noclip_speed_multiplier, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop, prompt_ambient_animations, persist_outfit, persist_outfits_mis, interaction_menu_freedom, super_hero_fly) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ipls, ptfx_effects, clean_player, force_wanted_level, passive, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, noclip_aim_speed_multiplier, noclip_speed_multiplier, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop, prompt_ambient_animations, persist_outfit, persist_outfits_mis, interaction_menu_freedom, super_hero_fly) } self{}; struct session diff --git a/src/views/self/view_self.cpp b/src/views/self/view_self.cpp index a8ba77bb..ed68eb14 100644 --- a/src/views/self/view_self.cpp +++ b/src/views/self/view_self.cpp @@ -233,7 +233,6 @@ namespace big g.self.proof_melee = true; g.self.proof_explosion = true; g.self.proof_steam = true; - g.self.proof_drown = true; g.self.proof_water = true; } @@ -247,7 +246,6 @@ namespace big g.self.proof_melee = false; g.self.proof_explosion = false; g.self.proof_steam = false; - g.self.proof_drown = false; g.self.proof_water = false; } @@ -274,7 +272,6 @@ namespace big ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("DROWN"_T.data(), &g.self.proof_drown); ImGui::Checkbox("WATER"_T.data(), &g.self.proof_water); ImGui::EndGroup(); @@ -408,10 +405,6 @@ namespace big { g.self.proof_mask |= static_cast(eEntityProofs::STEAM); } - if (g.self.proof_drown) - { - g.self.proof_mask |= static_cast(eEntityProofs::DROWN); - } if (g.self.proof_water) { g.self.proof_mask |= static_cast(eEntityProofs::WATER); From cba19d0c331ab584c12f198a30509c656af53564 Mon Sep 17 00:00:00 2001 From: Andreas Maerten <24669514+Yimura@users.noreply.github.com> Date: Sat, 23 Mar 2024 00:04:49 +0100 Subject: [PATCH 06/19] refactor!: Rewrite of the old notification service (#2866) The main goal was improving the readability of the original code however some ugliness remains. - Swapped from pointer singleton to instance singleton - Actually make use of the alpha logic that used to be present - Added a counter to notifications to indicate if something is being spammed - Notification timeouts reset if they're sent to the queue again --- .../commands/player/kick/end_session_kick.cpp | 2 +- .../commands/player/kick/host_kick.cpp | 4 +- .../commands/player/kick/script_host_kick.cpp | 2 +- .../commands/player/toxic/turn_into_beast.cpp | 12 +-- .../commands/player/vehicle/boost_vehicle.cpp | 6 +- .../commands/player/vehicle/burst_tyres.cpp | 2 +- .../commands/player/vehicle/close_doors.cpp | 6 +- .../player/vehicle/downgrade_vehicle.cpp | 4 +- .../commands/player/vehicle/flip_180.cpp | 4 +- .../player/vehicle/flying_vehicle.cpp | 4 +- .../commands/player/vehicle/kill_engine.cpp | 6 +- .../commands/player/vehicle/lock_doors.cpp | 4 +- .../commands/player/vehicle/open_doors.cpp | 6 +- .../player/vehicle/remote_control_vehicle.cpp | 6 +- .../player/vehicle/special_ability.cpp | 4 +- .../commands/player/vehicle/stop_vehicle.cpp | 6 +- .../commands/player/vehicle/unlock_doors.cpp | 4 +- .../player/vehicle/upgrade_vehicle.cpp | 4 +- src/backend/commands/session/wipe_session.cpp | 4 +- src/backend/commands/spawn/spawn_vehicle.cpp | 2 +- .../context/default_command_context.cpp | 6 +- src/backend/looped/self/super_hero_fly.cpp | 2 +- src/backend/looped/self/toggle_passive.cpp | 2 +- src/backend/looped/vehicle/auto_drive.cpp | 6 +- src/backend/looped/vehicle/turn_signals.cpp | 2 +- src/backend/looped/weapons/cage_gun.cpp | 2 +- src/backend/looped/weapons/delete_gun.cpp | 8 +- src/backend/looped/weapons/gravity_gun.cpp | 8 +- src/backend/looped/weapons/repair_gun.cpp | 6 +- .../looped/weapons/steal_vehicle_gun.cpp | 4 +- .../looped/world/nearby/auto_disarm.cpp | 2 +- src/backend/reactions/interloper_reaction.cpp | 4 +- src/backend/reactions/reaction.cpp | 2 +- src/hooks/info/get_network_event_data.cpp | 4 +- .../assign_physical_index.cpp | 12 +-- .../player_management/network_player_mgr.cpp | 4 +- .../protections/allocate_memory_reliable.cpp | 4 +- src/hooks/protections/handle_join_request.cpp | 4 +- src/hooks/protections/receive_net_message.cpp | 8 +- src/hooks/protections/receive_pickup.cpp | 4 +- src/hooks/protections/received_event.cpp | 6 +- .../protections/script_event_handler.cpp | 2 +- .../send_non_physical_player_data.cpp | 4 +- src/hooks/script/gta_thread_kill.cpp | 2 +- src/hooks/script/gta_thread_start.cpp | 2 +- src/lua/bindings/gui.cpp | 8 +- src/main.cpp | 4 +- src/native_hooks/shop_controller.hpp | 4 +- .../context_menu/context_menu_service.hpp | 14 +-- .../creator_storage_service.cpp | 2 +- .../custom_teleport_service.cpp | 2 +- src/services/notifications/notification.cpp | 46 ++++++++++ src/services/notifications/notification.hpp | 89 +++++++++++++++++++ .../notifications/notification_service.cpp | 65 +++++++------- .../notifications/notification_service.hpp | 51 ++++------- .../ped_animations/ped_animations_service.cpp | 4 +- .../persist_weapons/persist_weapons.cpp | 4 +- .../player_database_service.cpp | 34 +++---- src/services/squad_spawner/squad_spawner.cpp | 6 +- .../squad_spawner_save_files.cpp | 4 +- src/services/vehicle/persist_car_service.cpp | 4 +- .../vehicle/vehicle_control_service.cpp | 8 +- src/util/animations.hpp | 4 +- src/util/mobile.hpp | 6 +- src/util/notify.hpp | 6 +- src/util/scripts.hpp | 8 +- src/util/session.hpp | 14 +-- src/util/teleport.hpp | 16 ++-- src/util/toxic.hpp | 10 +-- src/util/train.hpp | 6 +- src/util/vehicle.cpp | 8 +- src/views/core/view_notifications.cpp | 57 +++++------- src/views/core/view_onboarding.cpp | 2 +- src/views/debug/view_debug_globals.cpp | 4 +- src/views/debug/view_debug_locals.cpp | 4 +- src/views/debug/view_debug_misc.cpp | 2 +- src/views/debug/view_debug_scripts.cpp | 4 +- src/views/debug/view_debug_threads.cpp | 6 +- src/views/network/view_network.cpp | 2 +- src/views/network/view_player_database.cpp | 6 +- src/views/network/view_session_browser.cpp | 4 +- src/views/self/view_animations.cpp | 10 +-- src/views/self/view_custom_teleport.cpp | 12 +-- src/views/self/view_mobile.cpp | 4 +- src/views/self/view_outfit_editor.cpp | 4 +- src/views/self/view_outfit_slots.cpp | 4 +- src/views/settings/view_proxy_settings.cpp | 8 +- src/views/settings/view_settings.cpp | 4 +- src/views/vehicle/spawn/view_persist_car.cpp | 8 +- src/views/vehicle/spawn/view_pv.cpp | 2 +- src/views/vehicle/view_fun_vehicle.cpp | 2 +- src/views/vehicle/view_lsc.cpp | 2 +- src/views/vehicle/view_spawn_vehicle.cpp | 4 +- src/views/vehicle/view_vehicle.cpp | 2 +- src/views/world/view_creator.cpp | 6 +- src/views/world/view_model_swapper.cpp | 6 +- src/views/world/view_spawn_ped.cpp | 8 +- src/views/world/view_squad_spawner.cpp | 6 +- src/views/world/view_world.cpp | 6 +- 99 files changed, 459 insertions(+), 359 deletions(-) create mode 100644 src/services/notifications/notification.cpp create mode 100644 src/services/notifications/notification.hpp diff --git a/src/backend/commands/player/kick/end_session_kick.cpp b/src/backend/commands/player/kick/end_session_kick.cpp index bd401c25..de269eff 100644 --- a/src/backend/commands/player/kick/end_session_kick.cpp +++ b/src/backend/commands/player/kick/end_session_kick.cpp @@ -21,7 +21,7 @@ namespace big return; if (!scripts::force_host("freemode"_J)) { - g_notification_service->push_error("END_KICK"_T.data(), "BACKEND_END_SESSION_KICK_FORCE_SCRIPT_HOST_FAILED"_T.data()); + g_notification_service.push_error("END_KICK"_T.data(), "BACKEND_END_SESSION_KICK_FORCE_SCRIPT_HOST_FAILED"_T.data()); return; } diff --git a/src/backend/commands/player/kick/host_kick.cpp b/src/backend/commands/player/kick/host_kick.cpp index 9330ef4d..281aecdd 100644 --- a/src/backend/commands/player/kick/host_kick.cpp +++ b/src/backend/commands/player/kick/host_kick.cpp @@ -18,7 +18,7 @@ namespace big return; if (!g_player_service->get_self()->is_host()) { - g_notification_service->push_error("HOST_KICK"_T.data(), "BACKEND_HOST_KICK_FAILED"_T.data()); + g_notification_service.push_error("HOST_KICK"_T.data(), "BACKEND_HOST_KICK_FAILED"_T.data()); return; } @@ -27,4 +27,4 @@ namespace big }; host_kick g_host_kick("hostkick", "HOST_KICK", "HOST_KICK_DESC", 0, false); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/kick/script_host_kick.cpp b/src/backend/commands/player/kick/script_host_kick.cpp index d66330e5..b6dbc96f 100644 --- a/src/backend/commands/player/kick/script_host_kick.cpp +++ b/src/backend/commands/player/kick/script_host_kick.cpp @@ -21,7 +21,7 @@ namespace big return; if (!scripts::force_host("freemode"_J)) { - g_notification_service->push_error("Kick", "Force script host failed!"); + g_notification_service.push_error("Kick", "Force script host failed!"); return; } diff --git a/src/backend/commands/player/toxic/turn_into_beast.cpp b/src/backend/commands/player/toxic/turn_into_beast.cpp index 1aa70b27..31bfcb7d 100644 --- a/src/backend/commands/player/toxic/turn_into_beast.cpp +++ b/src/backend/commands/player/toxic/turn_into_beast.cpp @@ -23,11 +23,11 @@ namespace big { if (!NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT_ON_SCRIPT(id, "am_launcher", -1)) { - g_notification_service->push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_CANNOT_START_AM_LAUNCHER"_T.data()); + g_notification_service.push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_CANNOT_START_AM_LAUNCHER"_T.data()); return; } - g_notification_service->push("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_STARTING"_T.data()); + g_notification_service.push("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_STARTING"_T.data()); scripts::start_launcher_script(47); @@ -35,7 +35,7 @@ namespace big { if (i >= 1000) { - g_notification_service->push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED"_T.data()); + g_notification_service.push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED"_T.data()); return; } @@ -48,7 +48,7 @@ namespace big if (!scripts::force_host("am_hunt_the_beast"_J)) { - g_notification_service->push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED_CONTROL"_T.data()); + g_notification_service.push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED_CONTROL"_T.data()); return; } @@ -89,7 +89,7 @@ namespace big { if (i >= 7000) { - g_notification_service->push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED"_T.data()); + g_notification_service.push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED"_T.data()); return; } @@ -100,7 +100,7 @@ namespace big if (!scripts::force_host("am_hunt_the_beast"_J)) { - g_notification_service->push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED_CONTROL"_T.data()); + g_notification_service.push_error("TURN_INTO_BEAST"_T.data(), "BACKEND_TURN_INTO_BEAST_FAILED_CONTROL"_T.data()); return; } diff --git a/src/backend/commands/player/vehicle/boost_vehicle.cpp b/src/backend/commands/player/vehicle/boost_vehicle.cpp index 9a6b0f43..685a669e 100644 --- a/src/backend/commands/player/vehicle/boost_vehicle.cpp +++ b/src/backend/commands/player/vehicle/boost_vehicle.cpp @@ -14,7 +14,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -26,11 +26,11 @@ namespace big } else { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); } } } }; boost_vehicle g_boost_vehicle("boostveh", "BACKEND_BOOST_VEHICLE", "BACKEND_BOOST_VEHICLE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/burst_tyres.cpp b/src/backend/commands/player/vehicle/burst_tyres.cpp index 338f6866..828af186 100644 --- a/src/backend/commands/player/vehicle/burst_tyres.cpp +++ b/src/backend/commands/player/vehicle/burst_tyres.cpp @@ -15,7 +15,7 @@ namespace big if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { diff --git a/src/backend/commands/player/vehicle/close_doors.cpp b/src/backend/commands/player/vehicle/close_doors.cpp index 0cdb2330..a793dfa9 100644 --- a/src/backend/commands/player/vehicle/close_doors.cpp +++ b/src/backend/commands/player/vehicle/close_doors.cpp @@ -14,7 +14,7 @@ namespace big if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -26,11 +26,11 @@ namespace big } else { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); } } } }; close_doors g_close_doors("closedoors", "BACKEND_CLOSE_VEHICLE_DOORS", "BACKEND_CLOSE_VEHICLE_DOORS_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/downgrade_vehicle.cpp b/src/backend/commands/player/vehicle/downgrade_vehicle.cpp index d3428636..34711f84 100644 --- a/src/backend/commands/player/vehicle/downgrade_vehicle.cpp +++ b/src/backend/commands/player/vehicle/downgrade_vehicle.cpp @@ -16,7 +16,7 @@ namespace big if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -34,4 +34,4 @@ namespace big }; downgrade_vehicle g_downgrade_vehicle("downgradeveh", "BACKEND_DOWNGRADE_VEHICLE", "BACKEND_DOWNGRADE_VEHICLE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/flip_180.cpp b/src/backend/commands/player/vehicle/flip_180.cpp index e7cb7153..73002ed2 100644 --- a/src/backend/commands/player/vehicle/flip_180.cpp +++ b/src/backend/commands/player/vehicle/flip_180.cpp @@ -18,7 +18,7 @@ namespace big if (!PED::IS_PED_IN_ANY_VEHICLE(player_ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -41,4 +41,4 @@ namespace big }; flip_180 g_flip_180("flip180", "BACKEND_FLIP", "BACKEND_FLIP_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/flying_vehicle.cpp b/src/backend/commands/player/vehicle/flying_vehicle.cpp index ccb27b49..3e4d0c97 100644 --- a/src/backend/commands/player/vehicle/flying_vehicle.cpp +++ b/src/backend/commands/player/vehicle/flying_vehicle.cpp @@ -15,7 +15,7 @@ namespace big if (!PED::IS_PED_IN_ANY_VEHICLE(ent, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -30,4 +30,4 @@ namespace big }; flying_vehicle g_flying_vehicle("flyingveh", "BACKEND_FLYING_VEHICLE", "BACKEND_FLYING_VEHICLE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/kill_engine.cpp b/src/backend/commands/player/vehicle/kill_engine.cpp index 83ef224c..97d6b18b 100644 --- a/src/backend/commands/player/vehicle/kill_engine.cpp +++ b/src/backend/commands/player/vehicle/kill_engine.cpp @@ -13,7 +13,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -25,11 +25,11 @@ namespace big } else { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); } } } }; kill_engine g_kill_engine("killengine", "BACKEND_KILL_VEHICLE_ENGINE", "BACKEND_KILL_VEHICLE_ENGINE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/lock_doors.cpp b/src/backend/commands/player/vehicle/lock_doors.cpp index 6d20ae6f..2962281e 100644 --- a/src/backend/commands/player/vehicle/lock_doors.cpp +++ b/src/backend/commands/player/vehicle/lock_doors.cpp @@ -14,7 +14,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -27,4 +27,4 @@ namespace big }; lock_vehicle g_lock_vehicle("lockveh", "BACKEND_LOCK_VEHICLE", "BACKEND_LOCK_VEHICLE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/open_doors.cpp b/src/backend/commands/player/vehicle/open_doors.cpp index 35525605..82cc3b29 100644 --- a/src/backend/commands/player/vehicle/open_doors.cpp +++ b/src/backend/commands/player/vehicle/open_doors.cpp @@ -14,7 +14,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -29,11 +29,11 @@ namespace big } else { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); } } } }; open_doors g_open_doors("opendoors", "BACKEND_OPEN_VEHICLE_DOORS", "BACKEND_OPEN_VEHICLE_DOORS_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/remote_control_vehicle.cpp b/src/backend/commands/player/vehicle/remote_control_vehicle.cpp index 9e1f95a9..aeb027b6 100644 --- a/src/backend/commands/player/vehicle/remote_control_vehicle.cpp +++ b/src/backend/commands/player/vehicle/remote_control_vehicle.cpp @@ -15,9 +15,9 @@ namespace big if (veh == 0) { if (g.player.spectating) - g_notification_service->push_warning("REMOTE_CONTROL"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("REMOTE_CONTROL"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); else - g_notification_service->push_warning("REMOTE_CONTROL"_T.data(), std::format("{} {}", "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T, "BACKEND_REMOTE_CONTROL_VEHICLE_SPECTATE"_T).c_str()); + g_notification_service.push_warning("REMOTE_CONTROL"_T.data(), std::format("{} {}", "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T, "BACKEND_REMOTE_CONTROL_VEHICLE_SPECTATE"_T).c_str()); return; } @@ -27,4 +27,4 @@ namespace big }; remote_control_vehicle g_remote_control_vehicle("rcplayer", "BACKEND_REMOTE_CONTROL_VEHICLE", "BACKEND_REMOTE_CONTROL_VEHICLE_DESC", 0, false); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/special_ability.cpp b/src/backend/commands/player/vehicle/special_ability.cpp index cd824feb..0f980903 100644 --- a/src/backend/commands/player/vehicle/special_ability.cpp +++ b/src/backend/commands/player/vehicle/special_ability.cpp @@ -15,7 +15,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -28,4 +28,4 @@ namespace big vehicle_special_ability<1> g_special_boost_vehicle("svehboost", "BACKEND_SPECIAL_ABILITY_BOOST", "BACKEND_SPECIAL_ABILITY_BOOST_DESC", 0); vehicle_special_ability<3> g_special_shunt_left("sshuntleft", "BACKEND_SPECIAL_ABILITY_LEFT", "BACKEND_SPECIAL_ABILITY_LEFT_DESC", 0); vehicle_special_ability<2> g_special_shunt_right("sshuntright", "BACKEND_SPECIAL_ABILITY_RIGHT", "BACKEND_SPECIAL_ABILITY_RIGHT_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/stop_vehicle.cpp b/src/backend/commands/player/vehicle/stop_vehicle.cpp index dd6bccc0..c74ba66b 100644 --- a/src/backend/commands/player/vehicle/stop_vehicle.cpp +++ b/src/backend/commands/player/vehicle/stop_vehicle.cpp @@ -13,7 +13,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -25,11 +25,11 @@ namespace big } else { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_FAILED_TO_TAKE_CONTROL"_T.data()); } } } }; stop_vehicle g_stop_vehicle("stopveh", "BACKEND_STOP_VEHICLE", "BACKEND_STOP_VEHICLE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/unlock_doors.cpp b/src/backend/commands/player/vehicle/unlock_doors.cpp index 9dfdacb7..87e12036 100644 --- a/src/backend/commands/player/vehicle/unlock_doors.cpp +++ b/src/backend/commands/player/vehicle/unlock_doors.cpp @@ -14,7 +14,7 @@ namespace big Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()); if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("VEHICLE"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("VEHICLE"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -27,4 +27,4 @@ namespace big }; unlock_vehicle g_unlock_vehicle("unlockveh", "BACKEND_UNLOCK_DOORS", "BACKEND_UNLOCK_DOORS_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/player/vehicle/upgrade_vehicle.cpp b/src/backend/commands/player/vehicle/upgrade_vehicle.cpp index 1cb7accb..96fc1f23 100644 --- a/src/backend/commands/player/vehicle/upgrade_vehicle.cpp +++ b/src/backend/commands/player/vehicle/upgrade_vehicle.cpp @@ -17,7 +17,7 @@ namespace big if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true)) { - g_notification_service->push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); + g_notification_service.push_warning("TOXIC"_T.data(), "ERROR_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); } else { @@ -27,4 +27,4 @@ namespace big }; upgrade_vehicle g_upgrade_vehicle("upgradeveh", "MAX_VEHICLE", "BACKEND_UPGRADE_VEHICLE_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/session/wipe_session.cpp b/src/backend/commands/session/wipe_session.cpp index be66f76f..50a6dbd8 100644 --- a/src/backend/commands/session/wipe_session.cpp +++ b/src/backend/commands/session/wipe_session.cpp @@ -15,8 +15,8 @@ namespace big { player_mgr->RemovePlayer(plyr->get_net_game_player()); } - g_notification_service->push("EMPTY_SESSION"_T.data(), "BACKEND_WIPE_SESSION_COMPLETE"_T.data()); + g_notification_service.push("EMPTY_SESSION"_T.data(), "BACKEND_WIPE_SESSION_COMPLETE"_T.data()); } }; empty_session g_empty_session("emptysession", "EMPTY_SESSION", "BACKEND_WIPE_SESSION_DESC", 0); -} \ No newline at end of file +} diff --git a/src/backend/commands/spawn/spawn_vehicle.cpp b/src/backend/commands/spawn/spawn_vehicle.cpp index f7ec4755..3dba2f35 100644 --- a/src/backend/commands/spawn/spawn_vehicle.cpp +++ b/src/backend/commands/spawn/spawn_vehicle.cpp @@ -42,7 +42,7 @@ namespace big if (veh == 0) { - g_notification_service->push_error("GUI_TAB_SPAWN_VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data()); + g_notification_service.push_error("GUI_TAB_SPAWN_VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data()); } else { diff --git a/src/backend/context/default_command_context.cpp b/src/backend/context/default_command_context.cpp index 146973b8..c3535ec8 100644 --- a/src/backend/context/default_command_context.cpp +++ b/src/backend/context/default_command_context.cpp @@ -14,11 +14,11 @@ namespace big void default_command_context::report_output(const std::string& output) const { - g_notification_service->push("BACKEND_COMMAND"_T.data(), output); + g_notification_service.push("BACKEND_COMMAND"_T.data(), output); } void default_command_context::report_error(const std::string& error) const { - g_notification_service->push_error("BACKEND_COMMAND"_T.data(), error); + g_notification_service.push_error("BACKEND_COMMAND"_T.data(), error); } -} \ No newline at end of file +} diff --git a/src/backend/looped/self/super_hero_fly.cpp b/src/backend/looped/self/super_hero_fly.cpp index e832c28d..5ae2ed57 100644 --- a/src/backend/looped/self/super_hero_fly.cpp +++ b/src/backend/looped/self/super_hero_fly.cpp @@ -391,7 +391,7 @@ namespace big virtual void on_enable() override { - g_notification_service->push("SUPER_HERO_FLY"_T.data(), "SUPER_HERO_FLY_ENABLE_NOTIFICATION"_T.data()); + g_notification_service.push("SUPER_HERO_FLY"_T.data(), "SUPER_HERO_FLY_ENABLE_NOTIFICATION"_T.data()); } virtual void on_disable() override diff --git a/src/backend/looped/self/toggle_passive.cpp b/src/backend/looped/self/toggle_passive.cpp index a3a5c83d..84bbccc0 100644 --- a/src/backend/looped/self/toggle_passive.cpp +++ b/src/backend/looped/self/toggle_passive.cpp @@ -19,7 +19,7 @@ namespace big { on_disable(); g.self.passive = false; - g_notification_service->push_warning("PASSIVE"_T.data(), "BACKEND_LOOPED_SELF_TOGGLE_PASSIVE_DISABLED_PASSIVE_MODE_MESSAGE"_T.data()); + g_notification_service.push_warning("PASSIVE"_T.data(), "BACKEND_LOOPED_SELF_TOGGLE_PASSIVE_DISABLED_PASSIVE_MODE_MESSAGE"_T.data()); return; } *g_tunables_service->get_tunable(-29732167) = 0; // End Passive Time = 0s diff --git a/src/backend/looped/vehicle/auto_drive.cpp b/src/backend/looped/vehicle/auto_drive.cpp index 31c81feb..ad58eca8 100644 --- a/src/backend/looped/vehicle/auto_drive.cpp +++ b/src/backend/looped/vehicle/auto_drive.cpp @@ -29,7 +29,7 @@ namespace big { current_destination = AutoDriveDestination::STOPPED; changing_driving_styles = false; - g_notification_service->push_warning("AUTO_DRIVE"_T.data(), "PLAYER_INFO_NO_VEHICLE"_T.data()); + g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "PLAYER_INFO_NO_VEHICLE"_T.data()); } else if (current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] || current_speed != g.vehicle.auto_drive_speed) { @@ -77,11 +77,11 @@ namespace big if (to_waypoint && !does_waypoint_exist) { - g_notification_service->push_warning("AUTO_DRIVE"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data()); + g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data()); } else { - g_notification_service->push_warning("AUTO_DRIVE"_T.data(), "BACKEND_LOOPED_VEHICLE_AUTO_DRIVE_STOPPED"_T.data()); + g_notification_service.push_warning("AUTO_DRIVE"_T.data(), "BACKEND_LOOPED_VEHICLE_AUTO_DRIVE_STOPPED"_T.data()); } started = false; diff --git a/src/backend/looped/vehicle/turn_signals.cpp b/src/backend/looped/vehicle/turn_signals.cpp index edd2f668..ec2914b3 100644 --- a/src/backend/looped/vehicle/turn_signals.cpp +++ b/src/backend/looped/vehicle/turn_signals.cpp @@ -125,7 +125,7 @@ namespace big virtual void on_enable() override { - g_notification_service->push("TURN_SIGNALS"_T.data(), "BACKEND_LOOPED_VEHICLE_TURN_SIGNALS_HELP"_T.data()); + g_notification_service.push("TURN_SIGNALS"_T.data(), "BACKEND_LOOPED_VEHICLE_TURN_SIGNALS_HELP"_T.data()); } virtual void on_tick() override diff --git a/src/backend/looped/weapons/cage_gun.cpp b/src/backend/looped/weapons/cage_gun.cpp index 9c9223c0..111d4efa 100644 --- a/src/backend/looped/weapons/cage_gun.cpp +++ b/src/backend/looped/weapons/cage_gun.cpp @@ -24,7 +24,7 @@ namespace big } else { - g_notification_service->push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); + g_notification_service.push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); } } } diff --git a/src/backend/looped/weapons/delete_gun.cpp b/src/backend/looped/weapons/delete_gun.cpp index 5b0ddade..8548595f 100644 --- a/src/backend/looped/weapons/delete_gun.cpp +++ b/src/backend/looped/weapons/delete_gun.cpp @@ -20,7 +20,7 @@ namespace big { if (ENTITY::IS_ENTITY_A_PED(entity) && PED::IS_PED_A_PLAYER(entity)) { - g_notification_service->push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_DELETE_GUN_PLAYER"_T.data()); + g_notification_service.push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_DELETE_GUN_PLAYER"_T.data()); } else { @@ -29,7 +29,7 @@ namespace big if (dist > 500) { - g_notification_service->push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_DELETE_GUN_TOO_FAR"_T.data()); + g_notification_service.push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_DELETE_GUN_TOO_FAR"_T.data()); } else { @@ -38,13 +38,13 @@ namespace big entity::delete_entity(entity); } else - g_notification_service->push_error("CUSTOM_WEAPONS"_T.data(), "TELEPORT_FAILED_TO_TAKE_CONTROL"_T.data()); + g_notification_service.push_error("CUSTOM_WEAPONS"_T.data(), "TELEPORT_FAILED_TO_TAKE_CONTROL"_T.data()); } } } else { - g_notification_service->push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); + g_notification_service.push_error("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); } } } diff --git a/src/backend/looped/weapons/gravity_gun.cpp b/src/backend/looped/weapons/gravity_gun.cpp index 4d228c2a..3d1b926b 100644 --- a/src/backend/looped/weapons/gravity_gun.cpp +++ b/src/backend/looped/weapons/gravity_gun.cpp @@ -65,7 +65,7 @@ namespace big { if (ENTITY::IS_ENTITY_A_PED(ent_to_add) && PED::IS_PED_A_PLAYER(ent_to_add)) { - g_notification_service->push_warning("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_GRAVITY_GUN_PLAYER"_T.data()); + g_notification_service.push_warning("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_GRAVITY_GUN_PLAYER"_T.data()); } else { @@ -79,7 +79,7 @@ namespace big if (temp_dist > 500) { - g_notification_service->push_warning("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_DELETE_GUN_TOO_FAR"_T.data()); + g_notification_service.push_warning("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_DELETE_GUN_TOO_FAR"_T.data()); } else { @@ -87,7 +87,7 @@ namespace big { TASK::SET_HIGH_FALL_TASK(ent_to_add, 0, 0, 0); - g_notification_service->push_warning("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_GRAVITY_GUN_SET"_T.data()); + g_notification_service.push_warning("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_GRAVITY_GUN_SET"_T.data()); } ents.push_back(ent_to_add); @@ -121,7 +121,7 @@ namespace big ents.clear(); - g_notification_service->push_success("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_GRAVITY_GUN_UNSET"_T.data()); + g_notification_service.push_success("CUSTOM_WEAPONS"_T.data(), "BACKEND_LOOPED_WEAPONS_GRAVITY_GUN_UNSET"_T.data()); } } } diff --git a/src/backend/looped/weapons/repair_gun.cpp b/src/backend/looped/weapons/repair_gun.cpp index d81068c0..0c10da64 100644 --- a/src/backend/looped/weapons/repair_gun.cpp +++ b/src/backend/looped/weapons/repair_gun.cpp @@ -24,15 +24,15 @@ namespace big } else { - g_notification_service->push_warning("BACKEND_LOOPED_WEAPONS_REPAIR_GUN"_T.data(), "VEHICLE_INVALID"_T.data()); + g_notification_service.push_warning("BACKEND_LOOPED_WEAPONS_REPAIR_GUN"_T.data(), "VEHICLE_INVALID"_T.data()); } } else { - g_notification_service->push_warning("BACKEND_LOOPED_WEAPONS_REPAIR_GUN"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); + g_notification_service.push_warning("BACKEND_LOOPED_WEAPONS_REPAIR_GUN"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); } } } } } -} \ No newline at end of file +} diff --git a/src/backend/looped/weapons/steal_vehicle_gun.cpp b/src/backend/looped/weapons/steal_vehicle_gun.cpp index 1493fe2b..6ba79c36 100644 --- a/src/backend/looped/weapons/steal_vehicle_gun.cpp +++ b/src/backend/looped/weapons/steal_vehicle_gun.cpp @@ -31,12 +31,12 @@ namespace big } else { - g_notification_service->push_warning("BACKEND_LOOPED_WEAPONS_STEAL_VEHICLE_GUN"_T.data(), "VEHICLE_INVALID"_T.data()); + g_notification_service.push_warning("BACKEND_LOOPED_WEAPONS_STEAL_VEHICLE_GUN"_T.data(), "VEHICLE_INVALID"_T.data()); } } else { - g_notification_service->push_warning("BACKEND_LOOPED_WEAPONS_STEAL_VEHICLE_GUN"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); + g_notification_service.push_warning("BACKEND_LOOPED_WEAPONS_STEAL_VEHICLE_GUN"_T.data(), "BACKEND_LOOPED_WEAPONS_CAGE_GUN_NO_ENTITY_FOUND"_T.data()); } } } diff --git a/src/backend/looped/world/nearby/auto_disarm.cpp b/src/backend/looped/world/nearby/auto_disarm.cpp index 249e929f..24040598 100644 --- a/src/backend/looped/world/nearby/auto_disarm.cpp +++ b/src/backend/looped/world/nearby/auto_disarm.cpp @@ -11,7 +11,7 @@ namespace big virtual void on_enable() override { - g_notification_service->push("Auto disarm", "Nearby hostile peds will be disarmed"); + g_notification_service.push("Auto disarm", "Nearby hostile peds will be disarmed"); } virtual void on_tick() override diff --git a/src/backend/reactions/interloper_reaction.cpp b/src/backend/reactions/interloper_reaction.cpp index 4546aee9..21d057e6 100644 --- a/src/backend/reactions/interloper_reaction.cpp +++ b/src/backend/reactions/interloper_reaction.cpp @@ -49,10 +49,10 @@ namespace big if (notify) { - g_notification_service->push_warning("PROTECTIONS"_T.data(), + g_notification_service.push_warning("PROTECTIONS"_T.data(), std::vformat(g_translation_service.get_translation(m_notify_message), std::make_format_args(attacker->get_name(), victim->get_name()))); } process_common(attacker); } -} \ No newline at end of file +} diff --git a/src/backend/reactions/reaction.cpp b/src/backend/reactions/reaction.cpp index bfd51844..607d2bf3 100644 --- a/src/backend/reactions/reaction.cpp +++ b/src/backend/reactions/reaction.cpp @@ -75,7 +75,7 @@ namespace big if (notify) { - g_notification_service->push_warning("PROTECTIONS"_T.data(), + g_notification_service.push_warning("PROTECTIONS"_T.data(), std::vformat(g_translation_service.get_translation(m_notify_message), std::make_format_args(player->get_name()))); } diff --git a/src/hooks/info/get_network_event_data.cpp b/src/hooks/info/get_network_event_data.cpp index e5a06c05..f4bd962e 100644 --- a/src/hooks/info/get_network_event_data.cpp +++ b/src/hooks/info/get_network_event_data.cpp @@ -64,11 +64,11 @@ namespace big g_fiber_pool->queue_job([] { session::join_session(gta_util::get_network()->m_last_joined_session.m_session_info); }); - g_notification_service->push_warning("KICKED"_T.data(), "You have been desync kicked. Rejoining previous session..."); + g_notification_service.push_warning("KICKED"_T.data(), "You have been desync kicked. Rejoining previous session..."); } else { - g_notification_service->push_warning("KICKED"_T.data(), "USER_DESYNC_KICKED"_T.data()); + g_notification_service.push_warning("KICKED"_T.data(), "USER_DESYNC_KICKED"_T.data()); } break; } diff --git a/src/hooks/player_management/assign_physical_index.cpp b/src/hooks/player_management/assign_physical_index.cpp index 056a5eeb..68b59fde 100644 --- a/src/hooks/player_management/assign_physical_index.cpp +++ b/src/hooks/player_management/assign_physical_index.cpp @@ -41,7 +41,7 @@ namespace big if (g.notifications.player_leave.notify) { - g_notification_service->push("PLAYER_LEFT"_T.data(), + g_notification_service.push("PLAYER_LEFT"_T.data(), std::vformat("PLAYER_LEFT_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, @@ -60,7 +60,7 @@ namespace big { if (admin_rids.contains(net_player_data->m_gamer_handle.m_rockstar_id)) { - g_notification_service->push_warning("POTENTIAL_ADMIN_FOUND"_T.data(), + g_notification_service.push_warning("POTENTIAL_ADMIN_FOUND"_T.data(), std::format("{} {}", net_player_data->m_name, "PLAYER_DETECTED_AS_ADMIN"_T)); LOG(WARNING) << net_player_data->m_name << " (" << net_player_data->m_gamer_handle.m_rockstar_id << ") has been detected as an admin"; @@ -82,7 +82,7 @@ namespace big if (g.notifications.player_join.notify) { - g_notification_service->push("PLAYER_JOINED"_T.data(), + g_notification_service.push("PLAYER_JOINED"_T.data(), std::vformat("PLAYER_JOINED_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, @@ -109,7 +109,7 @@ namespace big if (strcmp(plyr->get_name(), entry->name.data())) { - g_notification_service->push("PLAYERS"_T.data(), + g_notification_service.push("PLAYERS"_T.data(), std::format("{} {}: {}", entry->name, "PLAYER_CHANGED_NAME"_T, plyr->get_name())); entry->name = plyr->get_name(); g_player_database_service->save(); @@ -133,14 +133,14 @@ namespace big { if ((plyr->is_friend() && g.session.allow_friends_into_locked_session) || plyr->is_trusted) { - g_notification_service->push_success("LOBBY_LOCK"_T.data(), + g_notification_service.push_success("LOBBY_LOCK"_T.data(), std::vformat("LOBBY_LOCK_ALLOWED"_T.data(), std::make_format_args(plyr->get_net_data()->m_name))); } else { dynamic_cast(command::get("multikick"_J))->call(plyr, {}); - g_notification_service->push_warning("LOBBY_LOCK"_T.data(), + g_notification_service.push_warning("LOBBY_LOCK"_T.data(), std::vformat("LOBBY_LOCK_DENIED"_T.data(), std::make_format_args(plyr->get_net_data()->m_name))); } } diff --git a/src/hooks/player_management/network_player_mgr.cpp b/src/hooks/player_management/network_player_mgr.cpp index f116efda..7551fda6 100644 --- a/src/hooks/player_management/network_player_mgr.cpp +++ b/src/hooks/player_management/network_player_mgr.cpp @@ -13,7 +13,7 @@ namespace big if (g.notifications.network_player_mgr_init.log) LOG(INFO) << "CNetworkPlayerMgr#init got called, we're probably entering a session."; if (g.notifications.network_player_mgr_init.notify) - g_notification_service->push("NETWORK_PLAYER_MGR"_T.data(), "NETWORK_PLAYER_MGR_INIT"_T.data()); + g_notification_service.push("NETWORK_PLAYER_MGR"_T.data(), "NETWORK_PLAYER_MGR_INIT"_T.data()); bool result = g_hooking->get_original()(_this, a2, a3, a4); @@ -32,7 +32,7 @@ namespace big if (g.notifications.network_player_mgr_shutdown.log) LOG(INFO) << "CNetworkPlayerMgr#shutdown got called, we're probably leaving our session."; if (g.notifications.network_player_mgr_shutdown.notify) - g_notification_service->push("NETWORK_PLAYER_MGR"_T.data(), "NETWORK_PLAYER_MGR_DESTROY"_T.data()); + g_notification_service.push("NETWORK_PLAYER_MGR"_T.data(), "NETWORK_PLAYER_MGR_DESTROY"_T.data()); g.session.trust_session = false; g_hooking->get_original()(_this); diff --git a/src/hooks/protections/allocate_memory_reliable.cpp b/src/hooks/protections/allocate_memory_reliable.cpp index 063f4ea9..1bd0b9a7 100644 --- a/src/hooks/protections/allocate_memory_reliable.cpp +++ b/src/hooks/protections/allocate_memory_reliable.cpp @@ -73,8 +73,8 @@ namespace big if (memory) return memory; - g_notification_service->push_error("Protections", "The network message allocator is out of memory"); // this never reaches here but why not + g_notification_service.push_error("Protections", "The network message allocator is out of memory"); // this never reaches here but why not return nullptr; } -} \ No newline at end of file +} diff --git a/src/hooks/protections/handle_join_request.cpp b/src/hooks/protections/handle_join_request.cpp index ef51ec41..bbb8ab58 100644 --- a/src/hooks/protections/handle_join_request.cpp +++ b/src/hooks/protections/handle_join_request.cpp @@ -16,7 +16,7 @@ namespace big CMsgJoinResponse response{}; response.m_status_code = player->block_join_reason; g_pointers->m_gta.m_write_join_response_data(&response, ctx->m_join_response_data, 512, &ctx->m_join_response_size); - g_notification_service->push("BLOCK_JOIN"_T.data(), + g_notification_service.push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_INFO"_T, std::make_format_args(player->name))); return false; } @@ -25,4 +25,4 @@ namespace big return g_hooking->get_original()(network, session, player_info, ctx, is_transition_session); } } -} \ No newline at end of file +} diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 54b48911..2b1f4b25 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -118,7 +118,7 @@ namespace big { if (g.session.log_chat_messages) spam::log_chat(message, player, spam_reason, is_team); - g_notification_service->push("PROTECTIONS"_T.data(), + g_notification_service.push("PROTECTIONS"_T.data(), std::format("{} {}", player->get_name(), "IS_A_SPAMMER"_T.data())); player->is_spammer = true; if (g.session.kick_chat_spammers @@ -166,7 +166,7 @@ namespace big if (player->m_host_migration_rate_limit.exceeded_last_process()) { session::add_infraction(player, Infraction::TRIED_KICK_PLAYER); - g_notification_service->push_error("PROTECTIONS"_T.data(), + g_notification_service.push_error("PROTECTIONS"_T.data(), std::vformat("OOM_KICK"_T, std::make_format_args(player->get_name()))); } return true; @@ -209,7 +209,7 @@ namespace big if (reason == KickReason::VOTED_OUT) { - g_notification_service->push_warning("PROTECTIONS"_T.data(), "YOU_HAVE_BEEN_KICKED"_T.data()); + g_notification_service.push_warning("PROTECTIONS"_T.data(), "YOU_HAVE_BEEN_KICKED"_T.data()); return true; } @@ -225,7 +225,7 @@ namespace big if (player->m_radio_request_rate_limit.exceeded_last_process()) { session::add_infraction(player, Infraction::TRIED_KICK_PLAYER); - g_notification_service->push_error("PROTECTIONS"_T.data(), + g_notification_service.push_error("PROTECTIONS"_T.data(), std::vformat("OOM_KICK"_T, std::make_format_args(player->get_name()))); player->block_radio_requests = true; } diff --git a/src/hooks/protections/receive_pickup.cpp b/src/hooks/protections/receive_pickup.cpp index 9bf80f16..000c4737 100644 --- a/src/hooks/protections/receive_pickup.cpp +++ b/src/hooks/protections/receive_pickup.cpp @@ -6,10 +6,10 @@ namespace big { if (g.protections.receive_pickup) { - g_notification_service->push_error("PROTECTIONS"_T.data(), "Blocked pickup"); + g_notification_service.push_error("PROTECTIONS"_T.data(), "Blocked pickup"); return false; } return g_hooking->get_original()(object, unk, ped); } -} \ No newline at end of file +} diff --git a/src/hooks/protections/received_event.cpp b/src/hooks/protections/received_event.cpp index 9f3c2d6f..2e63ac01 100644 --- a/src/hooks/protections/received_event.cpp +++ b/src/hooks/protections/received_event.cpp @@ -355,7 +355,7 @@ namespace big && player->m_player_info->m_ped && player->m_player_info->m_ped->m_net_object && ownerNetId != player->m_player_info->m_ped->m_net_object->m_object_id && !offset_object) { - g_notification_service->push_error("WARNING"_T.data(), + g_notification_service.push_error("WARNING"_T.data(), std::vformat("BLAMED_FOR_EXPLOSION"_T, std::make_format_args(player->get_name(), reinterpret_cast(entity)->m_player_info->m_net_player_data.m_name))); @@ -615,7 +615,7 @@ namespace big if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id) { weapon_item weapon = g_gta_data_service->weapon_by_hash(hash); - g_notification_service->push_warning("PROTECTIONS"_T.data(), + g_notification_service.push_warning("PROTECTIONS"_T.data(), std::format("{} {} {}.", source_player->get_name(), "REMOVE_WEAPON_ATTEMPT_MESSAGE"_T, weapon.m_display_name)); g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); return; @@ -632,7 +632,7 @@ namespace big if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id) { weapon_item weapon = g_gta_data_service->weapon_by_hash(hash); - g_notification_service->push_warning("PROTECTIONS"_T.data(), + g_notification_service.push_warning("PROTECTIONS"_T.data(), std::format("{} {} {}.", source_player->get_name(), "GIVE_WEAPON_ATTEMPT_MESSAGE"_T, weapon.m_display_name)); g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); return; diff --git a/src/hooks/protections/script_event_handler.cpp b/src/hooks/protections/script_event_handler.cpp index b9d252f2..91b0e609 100644 --- a/src/hooks/protections/script_event_handler.cpp +++ b/src/hooks/protections/script_event_handler.cpp @@ -20,7 +20,7 @@ namespace big LOG(WARNING) << "BLOCKED_SCRIPT_EVENT From: " << player_name << " Event Type: " << protection_type; if (should_notify) - g_notification_service->push_warning("Script Event Protection", + g_notification_service.push_warning("Script Event Protection", std::format("From: {}\nEvent Type: {}", player_name.data(), protection_type.data())); } diff --git a/src/hooks/protections/send_non_physical_player_data.cpp b/src/hooks/protections/send_non_physical_player_data.cpp index c54a9912..aabf422e 100644 --- a/src/hooks/protections/send_non_physical_player_data.cpp +++ b/src/hooks/protections/send_non_physical_player_data.cpp @@ -16,7 +16,7 @@ namespace big if (plyr && plyr->block_join && *g_pointers->m_gta.m_is_session_started) { data->m_bubble_id = 10; - g_notification_service->push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_PREVENT_PLAYER_JOIN"_T, std::make_format_args(plyr->get_name()))); + g_notification_service.push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_PREVENT_PLAYER_JOIN"_T, std::make_format_args(plyr->get_name()))); } bool result = g_hooking->get_original()(player, message, flags, a4, a5); @@ -25,4 +25,4 @@ namespace big return result; } -} \ No newline at end of file +} diff --git a/src/hooks/script/gta_thread_kill.cpp b/src/hooks/script/gta_thread_kill.cpp index c5deaaa3..f5cd8f20 100644 --- a/src/hooks/script/gta_thread_kill.cpp +++ b/src/hooks/script/gta_thread_kill.cpp @@ -11,7 +11,7 @@ namespace big LOG(INFO) << "Script Thread '" << thread->m_name << "' terminated (" << thread->m_exit_message << ")."; if (g.notifications.gta_thread_kill.notify) - g_notification_service->push("Script Thread Termination", + g_notification_service.push("Script Thread Termination", std::format("Script Thread '{}' terminated.", thread->m_name)); if (thread == g.m_hunt_the_beast_thread) diff --git a/src/hooks/script/gta_thread_start.cpp b/src/hooks/script/gta_thread_start.cpp index db7da41a..60a294b6 100644 --- a/src/hooks/script/gta_thread_start.cpp +++ b/src/hooks/script/gta_thread_start.cpp @@ -12,7 +12,7 @@ namespace big if (g.notifications.gta_thread_kill.log) LOG(INFO) << "Script Thread '" << name << "' started."; if (g.notifications.gta_thread_kill.notify) - g_notification_service->push("Script Thread Startup", std::format("Script Thread '{}' started.", name)); + g_notification_service.push("Script Thread Startup", std::format("Script Thread '{}' started.", name)); } return new_thread; diff --git a/src/lua/bindings/gui.cpp b/src/lua/bindings/gui.cpp index a55b2a4e..4aa3f270 100644 --- a/src/lua/bindings/gui.cpp +++ b/src/lua/bindings/gui.cpp @@ -251,7 +251,7 @@ namespace lua::gui // Shows a message to the user with the given title and message. static void show_message(const std::string& title, const std::string& message) { - big::g_notification_service->push(title, message); + big::g_notification_service.push(title, message); } // Lua API: Function @@ -262,7 +262,7 @@ namespace lua::gui // Shows a warning to the user with the given title and message. static void show_warning(const std::string& title, const std::string& message) { - big::g_notification_service->push_warning(title, message); + big::g_notification_service.push_warning(title, message); } // Lua API: Function @@ -273,7 +273,7 @@ namespace lua::gui // Shows an error to the user with the given title and message. static void show_error(const std::string& title, const std::string& message) { - big::g_notification_service->push_error(title, message); + big::g_notification_service.push_error(title, message); } // Lua API: Function @@ -373,4 +373,4 @@ namespace lua::gui tab_ut["add_input_string"] = &tab::add_input_string; tab_ut["add_imgui"] = &tab::add_imgui; } -} \ No newline at end of file +} diff --git a/src/main.cpp b/src/main.cpp index 3e0203fc..84fb819a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -210,7 +210,6 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) auto context_menu_service_instance = std::make_unique(); auto custom_text_service_instance = std::make_unique(); auto mobile_service_instance = std::make_unique(); - auto notification_service_instance = std::make_unique(); auto pickup_service_instance = std::make_unique(); auto player_service_instance = std::make_unique(); auto gta_data_service_instance = std::make_unique(); @@ -228,6 +227,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) auto xml_maps_service_instance = std::make_unique(); LOG(INFO) << "Registered service instances..."; + g_notification_service.initialise(); + LOG(INFO) << "Finished initialising services."; + g_script_mgr.add_script(std::make_unique