feat(Hooks): Added is_dlc_present hook

This commit is contained in:
Yimura 2021-12-06 16:39:46 +01:00
parent af58184844
commit 105fe7f6d5
6 changed files with 29 additions and 1 deletions

View File

@ -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),

View File

@ -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;

View File

@ -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<decltype(&is_dlc_present)>()(dlc_hash);
}
}

View File

@ -209,6 +209,12 @@ namespace big
{
m_blame_explode = ptr.as<decltype(m_blame_explode)>();
});
// 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<decltype(m_is_dlc_present)>();
});
main_batch.run(memory::module(nullptr));

View File

@ -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{};

View File

@ -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
```