From f47c4d13d14a56ff6ffc69de8ac269646dcd5766 Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 17 Jan 2021 00:47:00 +0100 Subject: [PATCH] feat(Protections): Added cage protection --- .../looped/protections/replay_interface.cpp | 28 +++++++++++++++++++ BigBaseV2/src/gui/tab_bar/main/settings.cpp | 15 ++++++++++ BigBaseV2/src/pointers.cpp | 7 ++++- BigBaseV2/src/pointers.hpp | 5 +++- BigBaseV2/src/settings.h | 5 +++- 5 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 BigBaseV2/src/features/looped/protections/replay_interface.cpp diff --git a/BigBaseV2/src/features/looped/protections/replay_interface.cpp b/BigBaseV2/src/features/looped/protections/replay_interface.cpp new file mode 100644 index 00000000..149197d3 --- /dev/null +++ b/BigBaseV2/src/features/looped/protections/replay_interface.cpp @@ -0,0 +1,28 @@ +#include "features.hpp" +#include "gta/replay.hpp" +#include "pointers.hpp" + +namespace big +{ + void features::replay_interface() + { + rage::CReplayInterface* replay_interf = *g_pointers->m_replay_interface; + rage::CObjectInterface* object_interf = replay_interf->m_object_interface; + + auto& protections = g_settings.options["settings"]["protections"]; + + const int max_obj = object_interf->m_max_objects; + for (int i = 0; i < max_obj; i++) + { + rage::CObject* obj = object_interf->get_object(i); + if (obj == nullptr) continue; + + Object ent = g_pointers->m_ptr_to_handle(obj); + + if (protections["cage"] && ENTITY::GET_ENTITY_MODEL(ent) == RAGE_JOAAT("prop_gold_cont_01")) + { + functions::delete_entity(ent); + } + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/tab_bar/main/settings.cpp b/BigBaseV2/src/gui/tab_bar/main/settings.cpp index ef7169c3..cc9b7533 100644 --- a/BigBaseV2/src/gui/tab_bar/main/settings.cpp +++ b/BigBaseV2/src/gui/tab_bar/main/settings.cpp @@ -83,6 +83,21 @@ namespace big { auto& protections = g_settings.options["settings"]["protections"]; + if ( + ImGui::Checkbox("Cage Protection", protections["cage"].get())// || + //ImGui::Checkbox("Version Mismatch Protection", protections["version_mismatch"].get()) + ) + g_settings.save(); + + ImGui::TreePop(); + } + + ImGui::Separator(); + + if (ImGui::TreeNode("Script Protection")) + { + auto& protections = g_settings.options["settings"]["script_protections"]; + if ( ImGui::Checkbox("Bounty", protections["bounty"].get()) || ImGui::Checkbox("Ceo Ban", protections["ceo_ban"].get()) || diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index 4ed52a8b..5cc1ae1c 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -125,7 +125,12 @@ namespace big main_batch.add("Replay Interface", "48 8D 0D ? ? ? ? 48 8B D7 E8 ? ? ? ? 48 8D 0D ? ? ? ? 8A D8 E8 ? ? ? ? 84 DB 75 13 48 8D 0D", [this](memory::handle ptr) { - m_replay_interface = ptr.add(3).rip().as(); + m_replay_interface = ptr.add(3).rip().as(); + }); + + main_batch.add("Pointer to Handle", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 8B 15 ? ? ? ? 48 8B F9 48 83 C1 10 33 DB", [this](memory::handle ptr) + { + m_ptr_to_handle = ptr.as(); }); main_batch.run(memory::module(nullptr)); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index 2a41b5f6..03489f9b 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -2,6 +2,7 @@ #include "common.hpp" #include "gta/fwddec.hpp" #include "gta/enums.hpp" +#include "gta/replay.hpp" #include "function_types.hpp" namespace big @@ -19,7 +20,7 @@ namespace big CPedFactory **m_ped_factory{}; CNetworkPlayerMgr **m_network_player_mgr{}; - CReplayInterface **m_replay_interface{}; + rage::CReplayInterface **m_replay_interface{}; rage::scrNativeRegistrationTable *m_native_registration_table{}; functions::get_native_handler_t m_get_native_handler{}; @@ -46,6 +47,8 @@ namespace big functions::spectate_player* m_spectate_player{}; functions::sync_local_time* m_sync_local_time{}; functions::trigger_script_event* m_trigger_script_event{}; + + functions::ptr_to_handle* m_ptr_to_handle{}; }; inline pointers *g_pointers{}; diff --git a/BigBaseV2/src/settings.h b/BigBaseV2/src/settings.h index 3cc0befa..66d7e572 100644 --- a/BigBaseV2/src/settings.h +++ b/BigBaseV2/src/settings.h @@ -36,7 +36,6 @@ namespace big "population_modifiers": false, "ragdoll": false, "rank": 6969, - "reveal_players": false, "speedo_type": 0, "spoof_rank": false, "sticky_tyres": false, @@ -44,6 +43,10 @@ namespace big "vehicle_density": 1.0, "settings": { "protections": { + "cage": false, + "version_mismatch": false + }, + "script_protections": { "bounty": false, "ceo_ban": false, "ceo_kick": false,