From e6ce3639637a6641ff1dc989cd937b3f7bd6c7af Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Sat, 12 Nov 2022 18:35:28 +0000 Subject: [PATCH] Add script patcher and update protections (#588) --- CMakeSettings.json | 15 ++ src/backend/backend.cpp | 6 +- src/backend/script_patches.hpp | 18 ++ src/core/globals.hpp | 31 ++- src/gta/net_game_event.hpp | 238 +++++++++--------- src/gui/components/components.hpp | 2 + src/gui/components/script_patch_checkbox.cpp | 26 ++ src/hooking.cpp | 2 + src/hooking.hpp | 2 + src/hooks/protections/receive_net_message.cpp | 45 +++- .../gta_thread_kill.cpp | 2 - .../gta_thread_start.cpp | 3 - src/hooks/script/init_native_tables.cpp | 15 ++ src/hooks/script/script_vm.cpp | 20 ++ .../write_player_game_state_data_node.cpp | 15 ++ src/memory/pattern.hpp | 2 +- src/native_hooks/freemode.hpp | 9 + src/native_hooks/native_hooks.cpp | 37 +-- src/native_hooks/native_hooks.hpp | 21 +- src/pointers.cpp | 12 + src/pointers.hpp | 3 + src/script_hook.cpp | 10 + src/script_hook.hpp | 1 + src/services/script_patcher/script_data.hpp | 30 +++ src/services/script_patcher/script_patch.cpp | 68 +++++ src/services/script_patcher/script_patch.hpp | 29 +++ .../script_patcher/script_patcher_service.cpp | 87 +++++++ .../script_patcher/script_patcher_service.hpp | 26 ++ src/views/network/view_session.cpp | 3 + src/views/network/view_spoofing.cpp | 3 +- .../settings/view_protection_settings.cpp | 1 + 31 files changed, 610 insertions(+), 172 deletions(-) create mode 100644 CMakeSettings.json create mode 100644 src/backend/script_patches.hpp create mode 100644 src/gui/components/script_patch_checkbox.cpp rename src/hooks/{native_hooks => script}/gta_thread_kill.cpp (91%) rename src/hooks/{native_hooks => script}/gta_thread_start.cpp (88%) create mode 100644 src/hooks/script/init_native_tables.cpp create mode 100644 src/hooks/script/script_vm.cpp create mode 100644 src/services/script_patcher/script_data.hpp create mode 100644 src/services/script_patcher/script_patch.cpp create mode 100644 src/services/script_patcher/script_patch.hpp create mode 100644 src/services/script_patcher/script_patcher_service.cpp create mode 100644 src/services/script_patcher/script_patcher_service.hpp diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 00000000..330798fd --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,15 @@ +{ + "configurations": [ + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + } + ] +} \ No newline at end of file diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index d701ab81..039e4448 100644 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -3,12 +3,16 @@ #include "thread_pool.hpp" #include "looped/looped.hpp" #include "services/context_menu/context_menu_service.hpp" +#include "script_patches.hpp" namespace big { void backend::loop() { - while (true) { + register_script_patches(); + + while (true) + { g->attempt_save(); looped::system_self_globals(); looped::system_update_pointers(); diff --git a/src/backend/script_patches.hpp b/src/backend/script_patches.hpp new file mode 100644 index 00000000..b635e190 --- /dev/null +++ b/src/backend/script_patches.hpp @@ -0,0 +1,18 @@ +#include "services/script_patcher/script_patcher_service.hpp" +#include