From 105fe7f6d5f9f027e77b6c74cff9cf3e9a456b2b Mon Sep 17 00:00:00 2001 From: Yimura Date: Mon, 6 Dec 2021 16:39:46 +0100 Subject: [PATCH] feat(Hooks): Added is_dlc_present hook --- BigBaseV2/src/hooking.cpp | 2 ++ BigBaseV2/src/hooking.hpp | 2 ++ BigBaseV2/src/hooks/is_dlc_present.cpp | 17 +++++++++++++++++ BigBaseV2/src/pointers.cpp | 6 ++++++ BigBaseV2/src/pointers.hpp | 1 + README.md | 2 +- 6 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 BigBaseV2/src/hooks/is_dlc_present.cpp diff --git a/BigBaseV2/src/hooking.cpp b/BigBaseV2/src/hooking.cpp index a9b6c14a..61a63ea9 100644 --- a/BigBaseV2/src/hooking.cpp +++ b/BigBaseV2/src/hooking.cpp @@ -50,6 +50,8 @@ namespace big // Increment Stat Event m_increment_stat_hook("ISE", g_pointers->m_increment_stat_event, &hooks::increment_stat_event), + // Is DLC Present + m_is_dlc_present_hook("IDP", g_pointers->m_is_dlc_present, &hooks::is_dlc_present), // Error Screen m_error_screen_hook("ES", g_pointers->m_error_screen, &hooks::disable_error_screen), diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index dbde84e5..552cace2 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -29,6 +29,7 @@ namespace big static rage::eThreadState gta_thread_kill(GtaThread* thread); static bool increment_stat_event(CNetworkIncrementStatEvent* net_event_struct, CNetGamePlayer* sender, int64_t a3); + static bool is_dlc_present(Hash dlc_hash); static bool received_event( rage::netEventMgr* event_manager, @@ -82,6 +83,7 @@ namespace big detour_hook m_gta_thread_kill_hook; detour_hook m_increment_stat_hook; + detour_hook m_is_dlc_present_hook; detour_hook m_received_event_hook; diff --git a/BigBaseV2/src/hooks/is_dlc_present.cpp b/BigBaseV2/src/hooks/is_dlc_present.cpp new file mode 100644 index 00000000..3c7e88dc --- /dev/null +++ b/BigBaseV2/src/hooks/is_dlc_present.cpp @@ -0,0 +1,17 @@ +#include "gta/joaat.hpp" +#include "hooking.hpp" +#include "natives.hpp" + +namespace big +{ + bool hooks::is_dlc_present(Hash dlc_hash) + { + switch (dlc_hash) + { + case 0x96F02EE6: + return true; + } + + return g_hooking->m_is_dlc_present_hook.get_original()(dlc_hash); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index dc86a7fe..892eaa48 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -209,6 +209,12 @@ namespace big { m_blame_explode = ptr.as(); }); + + // Is DLC Present + main_batch.add("IDP", "48 89 5C 24 ? 57 48 83 EC ? 81 F9", [this](memory::handle ptr) + { + m_is_dlc_present = ptr.as(); + }); main_batch.run(memory::module(nullptr)); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index f7ba4459..ad08e4ad 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -41,6 +41,7 @@ namespace big PVOID m_blame_explode; PVOID m_model_spawn_bypass; PVOID m_native_return; + PVOID m_is_dlc_present; functions::error_screen* m_error_screen{}; diff --git a/README.md b/README.md index 617d7be3..346fc519 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ I can't confirm if all hooks are correct as the report myself event hook probabl To set up the build environment, run the following commands in a terminal: ```dos -git clone git@github.com:Yimura/YimMenu.git --recursive +git clone git@github.com:Yimura/YimMenu.git --recursive || echo You don't have git installed, install it from https://git-scm.com/download/win cd YimMenu GenerateProjects.bat ```