fix: MH_EnableHook was not in the right place

This commit is contained in:
2024-04-13 19:39:01 +02:00
parent b9552f3920
commit 44837830cd

View File

@@ -68,7 +68,6 @@ bool __stdcall hOptionsHelpers_IsRobeUnlocked(app::OptionsHelpers* __this, app::
// DO_APP_FUNC(0x005E44C0, bool, OptionsHelpers_IsCharacterUnlocked, (OptionsHelpers * __this, String * prefab, MethodInfo * method)); // DO_APP_FUNC(0x005E44C0, bool, OptionsHelpers_IsCharacterUnlocked, (OptionsHelpers * __this, String * prefab, MethodInfo * method));
typedef bool(__stdcall* TOptionsHelpers_IsCharacterUnlocked)(app::OptionsHelpers*, app::String* , MethodInfo*); typedef bool(__stdcall* TOptionsHelpers_IsCharacterUnlocked)(app::OptionsHelpers*, app::String* , MethodInfo*);
TOptionsHelpers_IsCharacterUnlocked oOptionsHelpers_IsCharacterUnlocked = NULL; TOptionsHelpers_IsCharacterUnlocked oOptionsHelpers_IsCharacterUnlocked = NULL;
bool __stdcall hOptionsHelpers_IsCharacterUnlocked(app::OptionsHelpers* __this, app::String* prefab, MethodInfo* method) { bool __stdcall hOptionsHelpers_IsCharacterUnlocked(app::OptionsHelpers* __this, app::String* prefab, MethodInfo* method) {
if (settings::unlock_all) if (settings::unlock_all)
@@ -122,11 +121,6 @@ void CreateHooks() {
std::cout << "Failed to create xp hook: " << MH_StatusToString(status_xp) << std::endl; std::cout << "Failed to create xp hook: " << MH_StatusToString(status_xp) << std::endl;
return; return;
} }
MH_STATUS enable_status_Debug_Log = MH_EnableHook(MH_ALL_HOOKS);
if (enable_status_Debug_Log != MH_OK) {
std::cout << "Failed to enable hooks: " << MH_StatusToString(enable_status_Debug_Log) << std::endl;
return;
}
MH_STATUS status_robe = MH_CreateHook((LPVOID*)app::OptionsHelpers_IsRobeUnlocked, &hOptionsHelpers_IsRobeUnlocked, reinterpret_cast<LPVOID*>(&oOptionsHelpers_IsRobeUnlocked)); MH_STATUS status_robe = MH_CreateHook((LPVOID*)app::OptionsHelpers_IsRobeUnlocked, &hOptionsHelpers_IsRobeUnlocked, reinterpret_cast<LPVOID*>(&oOptionsHelpers_IsRobeUnlocked));
if (status_robe != MH_OK) { if (status_robe != MH_OK) {
std::cout << "Failed to create robe hook: " << MH_StatusToString(status_robe) << std::endl; std::cout << "Failed to create robe hook: " << MH_StatusToString(status_robe) << std::endl;
@@ -137,6 +131,11 @@ void CreateHooks() {
std::cout << "Failed to create character unlock hook: " << MH_StatusToString(status_characterUnlock) << std::endl; std::cout << "Failed to create character unlock hook: " << MH_StatusToString(status_characterUnlock) << std::endl;
return; return;
} }
MH_STATUS enable_status_Debug_Log = MH_EnableHook(MH_ALL_HOOKS);
if (enable_status_Debug_Log != MH_OK) {
std::cout << "Failed to enable hooks: " << MH_StatusToString(enable_status_Debug_Log) << std::endl;
return;
}
} }
typedef HRESULT(__stdcall* D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); typedef HRESULT(__stdcall* D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);