hooks/settings updated

This commit is contained in:
Jadis0x
2024-05-16 21:50:42 +03:00
parent f69767f794
commit 1526e262f8
3 changed files with 384 additions and 45 deletions

View File

@@ -1,18 +1,24 @@
#include "pch-il2cpp.h"
#include "Hooks.hpp"
#include "../features/menu.hpp"
#include "../settings/settings.hpp"
#include "../main.h"
#include "../utils/utils.hpp"
#include "features/menu.hpp"
#include "settings/settings.hpp"
#include "main.h"
#include "utils/utils.hpp"
#include <iostream>
#include "helpers.h"
#include "players/players.h"
#include "UnityCore.h"
#include "ClientHelper.h"
#pragma warning(push, 0) //important cuz dx11 throws so much warnings
#include <d3d11.h>
#pragma warning(pop)
#pragma comment (lib, "d3d11.lib" )
bool open_menu = false;
/*
//Code about hooking stuff
//Exemple of hooked function :
@@ -38,10 +44,8 @@
typedef void(__stdcall* TDebug_2_Log)(app::Object*, MethodInfo*);
TDebug_2_Log oDebug_2_Log = NULL;
TDebug_2_Log oDebug_2_Warning = NULL;
TDebug_2_Log oDebug_2_Error = NULL;
void __stdcall hDebug_Log(app::Object* message, MethodInfo* method) {
std::cout << "[UNITY] " << ToString(message) << std::endl;
std::cout << "[DevourClient] " << ToString(message) << std::endl;
il2cppi_log_write(ToString(message));
}
@@ -54,6 +58,87 @@ void __stdcall hNolanBehaviour_OnAttributeUpdateValue(app::NolanBehaviour* __thi
oNolanBehaviour_OnAttributeUpdateValue(__this, attribute, method);
}
// DO_APP_FUNC(0x004A7D70, void, NolanBehaviour_FixedUpdate, (NolanBehaviour* __this, MethodInfo* method));
typedef void(__stdcall* TNolanBehaviour_FixedUpdate)(app::NolanBehaviour*, MethodInfo*);
TNolanBehaviour_FixedUpdate oNolanBehaviour_FixedUpdate = NULL;
void __stdcall hNolanBehaviour_FixedUpdate(app::NolanBehaviour* __this, MethodInfo* method) {
if (settings::freeze_azazel && IsHost()) {
app::GameObject* goAzazel = __this->fields.m_Survival->fields.m_Azazel;
if (goAzazel) {
app::String* azazelComponent = reinterpret_cast<app::String*>(il2cpp_string_new("UltimateCharacterLocomotion"));
auto component = app::GameObject_GetComponentByName(goAzazel, azazelComponent, nullptr);
if (component) {
app::UltimateCharacterLocomotion* locomotion = reinterpret_cast<app::UltimateCharacterLocomotion*>(component);
if (locomotion) {
// confused Azazel!! fix it
app::UltimateCharacterLocomotion_set_TimeScale(locomotion, settings::new_azazel_speed, NULL);
}
}
}
}
if (settings::change_player_speed && IsLocalPlayer(__this)) {
// Apply Sprint Speed
if (__this->fields.speedChangeAbility)
{
__this->fields.speedChangeAbility->fields.m_SpeedChangeMultiplier = (float)settings::new_speed;
__this->fields.speedChangeAbility->fields.m_MaxSpeedChangeValue = (float)settings::new_speed;
}
}
oNolanBehaviour_FixedUpdate(__this, method);
}
// DO_APP_FUNC(0x01D48040, bool, Cursor_1_get_visible, (MethodInfo * method));
typedef bool(__stdcall* TCursor_1_get_visible)(MethodInfo*);
TCursor_1_get_visible oCursor_1_get_visible = NULL;
bool __stdcall hCursor_1_get_visible(MethodInfo* method) {
if (open_menu)
return true;
return oCursor_1_get_visible(method);
}
// DO_APP_FUNC(0x02D25380, void, Cursor_1_set_visible, (bool value, MethodInfo * method));
typedef bool(__stdcall* TCursor_1_set_visible)(bool, MethodInfo*);
TCursor_1_set_visible oCursor_1_set_visible = NULL;
bool __stdcall hCursor_1_set_visible(bool value, MethodInfo* method) {
if (open_menu)
value = true;
return oCursor_1_set_visible(value, method);
}
// DO_APP_FUNC(0x02D253D0, CursorLockMode__Enum, Cursor_1_get_lockState, (MethodInfo * method));
typedef app::CursorLockMode__Enum(__stdcall* TCursor_1_get_lockState)(MethodInfo*);
TCursor_1_get_lockState oCursor_1_get_lockState = NULL;
app::CursorLockMode__Enum __stdcall hCursor_1_get_lockState(MethodInfo* method) {
if (open_menu)
return app::CursorLockMode__Enum::None;
return oCursor_1_get_lockState(method);
}
// DO_APP_FUNC(0x02D25420, void, Cursor_1_set_lockState, (CursorLockMode__Enum value, MethodInfo * method));
typedef void(__stdcall* TCursor_1_set_lockState)(app::CursorLockMode__Enum, MethodInfo*);
TCursor_1_set_lockState oCursor_1_set_lockState = NULL;
void __stdcall hCursor_1_set_lockState(app::CursorLockMode__Enum value, MethodInfo* method) {
if (open_menu)
value = app::CursorLockMode__Enum::None;
return oCursor_1_set_lockState(value, method);
}
// DO_APP_FUNC(0x005E5E10, bool, OptionsHelpers_IsRobeUnlocked, (OptionsHelpers * __this, String * robe, String * character, MethodInfo * method));
typedef bool(__stdcall* TOptionsHelpers_IsRobeUnlocked)(app::OptionsHelpers*, app::String*, app::String*, MethodInfo*);
TOptionsHelpers_IsRobeUnlocked oOptionsHelpers_IsRobeUnlocked = NULL;
@@ -65,6 +150,33 @@ bool __stdcall hOptionsHelpers_IsRobeUnlocked(app::OptionsHelpers* __this, app::
return oOptionsHelpers_IsRobeUnlocked(__this, robe, character, method);
}
// app::DevourInput_GetLongPress
// DO_APP_FUNC(0x005A1890, bool, DevourInput_GetLongPress, (DevourInput * __this, String * name, float duration, bool waitForRelease, MethodInfo * method));
typedef bool(__stdcall* TDevourInput_GetLongPress)(app::DevourInput*, app::String*, float, bool, MethodInfo*);
TDevourInput_GetLongPress oDevourInput_GetLongPress = NULL;
bool __stdcall hDevourInput_GetLongPress(app::DevourInput* __this, app::String* name, float duration, bool waitForRelease, MethodInfo* method) {
if (settings::disable_longInteract) {
duration = 0.0f;
}
return oDevourInput_GetLongPress(__this, name, duration, waitForRelease, method);
}
//DO_APP_FUNC(0x005AD0F0, bool, LockedInteractable_CanInteract, (LockedInteractable * __this, GameObject * character, MethodInfo * method));
typedef bool(__stdcall* TLockedInteractable_CanInteract)(app::LockedInteractable*, app::GameObject*, MethodInfo*);
TLockedInteractable_CanInteract oLockedInteractable_CanInteract = NULL;
bool __stdcall hLockedInteractable_CanInteract(app::LockedInteractable* __this, app::GameObject* character, MethodInfo* method) {
if (settings::unlock_all)
{
__this->fields.isLocked = false;
return true;
}
return oLockedInteractable_CanInteract(__this, character, method);
}
// DO_APP_FUNC(0x005E44C0, bool, OptionsHelpers_IsCharacterUnlocked, (OptionsHelpers * __this, String * prefab, MethodInfo * method));
typedef bool(__stdcall* TOptionsHelpers_IsCharacterUnlocked)(app::OptionsHelpers*, app::String*, MethodInfo*);
TOptionsHelpers_IsCharacterUnlocked oOptionsHelpers_IsCharacterUnlocked = NULL;
@@ -82,11 +194,14 @@ app::RankHelpers_ExpGainInfo* __stdcall hRankHelpers_CalculateExpGain(app::RankH
app::RankHelpers_ExpGainInfo* gain = oRankHelpers_CalculateExpGain(__this, mapProgress, numAwards, gameConfigToken, method);
if (settings::exp_modifier) {
gain->fields.awardsBonus = settings::new_exp;
gain->fields.winBonus = settings::new_exp;
gain->fields.totalExp = settings::new_exp;
}
return gain;
}
typedef app::UIPerkSelectionType* (__stdcall* TMenu_SetupPerk)(app::Menu*, app::CharacterPerk*, MethodInfo*);
TMenu_SetupPerk oMenu_SetupPerk = NULL;
app::UIPerkSelectionType* __stdcall hMenu_SetupPerk(app::Menu* __this, app::CharacterPerk* perk, MethodInfo* method) {
@@ -121,6 +236,7 @@ app::UIFlashlightSelectionType* __stdcall hMenu_SetupFlashlight(app::Menu* __thi
return oMenu_SetupFlashlight(__this, flashlight, method);
}
// DO_APP_FUNC(0x00646F00, UIEmoteSelectionType *, Menu_SetupEmote, (Menu * __this, CharacterEmote * emote, MethodInfo * method));
typedef app::UIEmoteSelectionType* (__stdcall* TMenu_SetupEmote)(app::Menu*, app::CharacterEmote*, MethodInfo*);
TMenu_SetupEmote oMenu_SetupEmote = NULL;
app::UIEmoteSelectionType* __stdcall hMenu_SetupEmote(app::Menu* __this, app::CharacterEmote* emote, MethodInfo* method) {
@@ -135,6 +251,107 @@ app::UIEmoteSelectionType* __stdcall hMenu_SetupEmote(app::Menu* __this, app::Ch
return oMenu_SetupEmote(__this, emote, method);
}
// DO_APP_FUNC(0x00550DD0, bool, SurvivalLobbyController_CanReady, (SurvivalLobbyController* __this, MethodInfo* method));
typedef bool(__stdcall* TSurvivalLobbyController_CanReady)(app::SurvivalLobbyController*, MethodInfo*);
TSurvivalLobbyController_CanReady oSurvivalLobbyController_CanReady = NULL;
bool __stdcall hSurvivalLobbyController_CanReady(app::SurvivalLobbyController* __this, MethodInfo* method) {
if (settings::unlock_all) {
__this->fields.m_ready = true;
return true;
}
return oSurvivalLobbyController_CanReady(__this, method);
}
// DO_APP_FUNC(0x005510E0, bool, SurvivalLobbyController_PlayableCharacterSelected, (SurvivalLobbyController* __this, MethodInfo* method));
typedef bool(__stdcall* TSurvivalLobbyController_PlayableCharacterSelected)(app::SurvivalLobbyController*, MethodInfo*);
TSurvivalLobbyController_PlayableCharacterSelected oSurvivalLobbyController_PlayableCharacterSelected = NULL;
bool __stdcall hSurvivalLobbyController_PlayableCharacterSelected(app::SurvivalLobbyController* __this, MethodInfo* method) {
if (settings::unlock_all)
return true;
return oSurvivalLobbyController_PlayableCharacterSelected(__this, method);
}
// DO_APP_FUNC(0x00551670, bool, SurvivalLobbyController_UnlockedCharacterSelected, (SurvivalLobbyController* __this, MethodInfo* method));
typedef bool(__stdcall* TSurvivalLobbyController_UnlockedCharacterSelected)(app::SurvivalLobbyController*, MethodInfo*);
TSurvivalLobbyController_UnlockedCharacterSelected oSurvivalLobbyController_UnlockedCharacterSelected = NULL;
bool __stdcall hSurvivalLobbyController_UnlockedCharacterSelected(app::SurvivalLobbyController* __this, MethodInfo* method) {
if (settings::unlock_all)
return true;
return oSurvivalLobbyController_UnlockedCharacterSelected(__this, method);
}
// DO_APP_FUNC(0x00552DC0, bool, SurvivalLobbyController_AllPlayersReady, (SurvivalLobbyController * __this, MethodInfo * method));
typedef bool(__stdcall* TSurvivalLobbyController_AllPlayersReady)(app::SurvivalLobbyController*, MethodInfo*);
TSurvivalLobbyController_AllPlayersReady oSurvivalLobbyController_AllPlayersReady = NULL;
bool __stdcall hSurvivalLobbyController_AllPlayersReady(app::SurvivalLobbyController* __this, MethodInfo* method) {
if (settings::unlock_all && IsHost()) {
app::GameObject_set_active(__this->fields.m_Menu->fields.lobbyChangeCharacterBlocked, true, NULL);
return true;
}
return oSurvivalLobbyController_AllPlayersReady(__this, method);
}
// DO_APP_FUNC(0x00554840, void, SurvivalLobbyController_OnSelectOutfit, (SurvivalLobbyController * __this, CharacterOutfit * outfit, MethodInfo * method));
typedef void(__stdcall* TSurvivalLobbyController_OnSelectOutfit)(app::SurvivalLobbyController*, app::CharacterOutfit*, MethodInfo*);
TSurvivalLobbyController_OnSelectOutfit oSurvivalLobbyController_OnSelectOutfit = NULL;
void __stdcall hSurvivalLobbyController_OnSelectOutfit(app::SurvivalLobbyController* __this, app::CharacterOutfit* outfit, MethodInfo* method) {
if (settings::unlock_all) {
outfit->fields.isHidden = false;
outfit->fields.isOwned = true;
outfit->fields.isSupporter = true;
}
return oSurvivalLobbyController_OnSelectOutfit(__this, outfit, method);
}
// DO_APP_FUNC(0x0059A070, void, UIOutfitSelectionType_SetLocked, (UIOutfitSelectionType * __this, bool locked, MethodInfo * method));
typedef void(__stdcall* TUIOutfitSelectionType_SetLocked)(app::UIOutfitSelectionType*, bool, MethodInfo*);
TUIOutfitSelectionType_SetLocked oUIOutfitSelectionType_SetLocked = NULL;
void __stdcall hUIOutfitSelectionType_SetLocked(app::UIOutfitSelectionType* __this, bool locked, MethodInfo* method) {
if (settings::unlock_all) {
locked = false;
//__this->fields.owned
__this->fields.outfitType->fields.isHidden = false;
__this->fields.outfitType->fields.isSupporter = true;
__this->fields.outfitType->fields.isOwned = true;
}
return oUIOutfitSelectionType_SetLocked(__this, locked, method);
}
// DO_APP_FUNC(0x005203A0, bool, SteamInventoryManager_UserHasItem, (SteamInventoryManager * __this, int32_t steamItemDefID, MethodInfo * method));
typedef bool(__stdcall* TSteamInventoryManager_UserHasItem)(app::SteamInventoryManager*, int32_t, MethodInfo*);
TSteamInventoryManager_UserHasItem oSteamInventoryManager_UserHasItem = NULL;
bool __stdcall hSteamInventoryManager_UserHasItem(app::SteamInventoryManager* __this, int32_t steamItemDefID, MethodInfo* method) {
if (settings::unlock_all) {
return true;
}
return oSteamInventoryManager_UserHasItem(__this, steamItemDefID, method);
}
// DO_APP_FUNC(0x0051E650, bool, SteamInventoryManager_HasRetrievedUserInventoryItems, (SteamInventoryManager * __this, MethodInfo * method));
typedef bool(__stdcall* TSteamInventoryManager_HasRetrievedUserInventoryItems)(app::SteamInventoryManager*, MethodInfo*);
TSteamInventoryManager_HasRetrievedUserInventoryItems oSteamInventoryManager_HasRetrievedUserInventoryItems = NULL;
bool __stdcall hSteamInventoryManager_HasRetrievedUserInventoryItems(app::SteamInventoryManager* __this, MethodInfo* method) {
if (settings::unlock_all) {
return true;
}
return oSteamInventoryManager_HasRetrievedUserInventoryItems(__this, method);
}
void CreateHooks() {
/*
//Exemple :
@@ -144,61 +361,183 @@ void CreateHooks() {
//original_sum can be NULL if we don't want to trampoline hook
*/
// DEBUG LOOK
MH_STATUS status_Debug_Log = MH_CreateHook((LPVOID*)app::Debug_2_Log, &hDebug_Log, reinterpret_cast<LPVOID*>(&oDebug_2_Log));
if (status_Debug_Log != MH_OK) {
std::cout << "Failed to create Debug_Log hook: " << MH_StatusToString(status_Debug_Log) << std::endl;
return;
}
status_Debug_Log = MH_CreateHook((LPVOID*)app::Debug_2_LogError, &hDebug_Log, reinterpret_cast<LPVOID*>(&oDebug_2_Error));
if (status_Debug_Log != MH_OK) {
std::cout << "Failed to create Debug_LogError hook: " << MH_StatusToString(status_Debug_Log) << std::endl;
return;
}
status_Debug_Log = MH_CreateHook((LPVOID*)app::Debug_2_LogWarning, &hDebug_Log, reinterpret_cast<LPVOID*>(&oDebug_2_Warning));
if (status_Debug_Log != MH_OK) {
std::cout << "Failed to create Debug_LogWarning hook: " << MH_StatusToString(status_Debug_Log) << std::endl;
return;
}
// UV HOOK
MH_STATUS status_uv = MH_CreateHook((LPVOID*)app::NolanBehaviour_OnAttributeUpdateValue, &hNolanBehaviour_OnAttributeUpdateValue, reinterpret_cast<LPVOID*>(&oNolanBehaviour_OnAttributeUpdateValue));
if (status_uv != MH_OK) {
std::cout << "Failed to create uv hook: " << MH_StatusToString(status_uv) << std::endl;
return;
}
// NOLAN HOOK
MH_STATUS status_nolan = MH_CreateHook((LPVOID*)app::NolanBehaviour_FixedUpdate, &hNolanBehaviour_FixedUpdate, reinterpret_cast<LPVOID*>(&oNolanBehaviour_FixedUpdate));
if (status_nolan != MH_OK) {
std::cout << "Failed to create nolan hook: " << MH_StatusToString(status_nolan) << std::endl;
return;
}
// XP HOOK
MH_STATUS status_xp = MH_CreateHook((LPVOID*)app::RankHelpers_CalculateExpGain, &hRankHelpers_CalculateExpGain, reinterpret_cast<LPVOID*>(&oRankHelpers_CalculateExpGain));
if (status_uv != MH_OK) {
if (status_xp != MH_OK) {
std::cout << "Failed to create xp hook: " << MH_StatusToString(status_xp) << std::endl;
return;
}
// ROBE HOOK
MH_STATUS status_robe = MH_CreateHook((LPVOID*)app::OptionsHelpers_IsRobeUnlocked, &hOptionsHelpers_IsRobeUnlocked, reinterpret_cast<LPVOID*>(&oOptionsHelpers_IsRobeUnlocked));
if (status_robe != MH_OK) {
std::cout << "Failed to create robe hook: " << MH_StatusToString(status_robe) << std::endl;
return;
}
// Cursor_1_get_visible HOOK
MH_STATUS status_getVisible = MH_CreateHook((LPVOID*)app::Cursor_1_get_visible, &hCursor_1_get_visible, reinterpret_cast<LPVOID*>(&oCursor_1_get_visible));
if (status_getVisible != MH_OK) {
std::cout << "Failed to create Cursor_1_get_visible hook: " << MH_StatusToString(status_getVisible) << std::endl;
return;
}
// Cursor_1_set_visible HOOK
MH_STATUS status_setVisible = MH_CreateHook((LPVOID*)app::Cursor_1_set_visible, &hCursor_1_set_visible, reinterpret_cast<LPVOID*>(&oCursor_1_set_visible));
if (status_setVisible != MH_OK) {
std::cout << "Failed to create Cursor_1_set_visible hook: " << MH_StatusToString(status_setVisible) << std::endl;
return;
}
// Cursor_1_get_lockState HOOK
MH_STATUS status_getLockState = MH_CreateHook((LPVOID*)app::Cursor_1_get_lockState, &hCursor_1_get_lockState, reinterpret_cast<LPVOID*>(&oCursor_1_get_lockState));
if (status_getLockState != MH_OK) {
std::cout << "Failed to create Cursor_1_get_lockState hook: " << MH_StatusToString(status_getLockState) << std::endl;
return;
}
// Cursor_1_set_lockState HOOK
MH_STATUS status_setLockState = MH_CreateHook((LPVOID*)app::Cursor_1_set_lockState, &hCursor_1_set_lockState, reinterpret_cast<LPVOID*>(&oCursor_1_set_lockState));
if (status_setLockState != MH_OK) {
std::cout << "Failed to create Cursor_1_set_lockState hook: " << MH_StatusToString(status_setLockState) << std::endl;
return;
}
// LOCKED HOOK
MH_STATUS status_CanInteract = MH_CreateHook((LPVOID*)app::LockedInteractable_CanInteract, &hLockedInteractable_CanInteract, reinterpret_cast<LPVOID*>(&oLockedInteractable_CanInteract));
if (status_CanInteract != MH_OK) {
std::cout << "Failed to create LockedInteractable hook: " << MH_StatusToString(status_CanInteract) << std::endl;
return;
}
// CHARACTER UNLOCK HOOK
MH_STATUS status_characterUnlock = MH_CreateHook((LPVOID*)app::OptionsHelpers_IsCharacterUnlocked, &hOptionsHelpers_IsCharacterUnlocked, reinterpret_cast<LPVOID*>(&oOptionsHelpers_IsCharacterUnlocked));
if (status_characterUnlock != MH_OK) {
std::cout << "Failed to create character unlock hook: " << MH_StatusToString(status_characterUnlock) << std::endl;
return;
}
// INPUT HOOK (LONGI INTERACT)
MH_STATUS status_devourInput = MH_CreateHook((LPVOID*)app::DevourInput_GetLongPress, &hDevourInput_GetLongPress, reinterpret_cast<LPVOID*>(&oDevourInput_GetLongPress));
if (status_devourInput != MH_OK) {
std::cout << "Failed to create DevourInput " << MH_StatusToString(status_devourInput) << std::endl;
return;
}
// PERKS HOOK
MH_STATUS status_perks = MH_CreateHook((LPVOID*)app::Menu_SetupPerk, &hMenu_SetupPerk, reinterpret_cast<LPVOID*>(&oMenu_SetupPerk));
if (status_perks != MH_OK) {
std::cout << "Failed to create character perks hook: " << MH_StatusToString(status_perks) << std::endl;
return;
}
// OUTFIT HOOK
MH_STATUS status_outfit = MH_CreateHook((LPVOID*)app::Menu_SetupOutfit, &hMenu_SetupOutfit, reinterpret_cast<LPVOID*>(&oMenu_SetupOutfit));
if (status_outfit != MH_OK) {
std::cout << "Failed to create character outfit hook: " << MH_StatusToString(status_outfit) << std::endl;
return;
}
// FLASHLIGHT HOOK
MH_STATUS status_flashlight = MH_CreateHook((LPVOID*)app::Menu_SetupFlashlight, &hMenu_SetupFlashlight, reinterpret_cast<LPVOID*>(&oMenu_SetupFlashlight));
if (status_flashlight != MH_OK) {
std::cout << "Failed to create flashlight hook: " << MH_StatusToString(status_flashlight) << std::endl;
return;
}
// EMOTE HOOK
MH_STATUS status_emote = MH_CreateHook((LPVOID*)app::Menu_SetupEmote, &hMenu_SetupEmote, reinterpret_cast<LPVOID*>(&oMenu_SetupEmote));
if (status_emote != MH_OK) {
std::cout << "Failed to create emote hook: " << MH_StatusToString(status_emote) << std::endl;
return;
}
// LOBBY HOOKS
// SurvivalLobbyController_CanReady
MH_STATUS status_canReady = MH_CreateHook((LPVOID*)app::SurvivalLobbyController_CanReady, &hSurvivalLobbyController_CanReady, reinterpret_cast<LPVOID*>(&oSurvivalLobbyController_CanReady));
if (status_canReady != MH_OK) {
std::cout << "Failed to create ready hook: " << MH_StatusToString(status_canReady) << std::endl;
return;
}
// SurvivalLobbyController_PlayableCharacterSelected
MH_STATUS status_playableCharacterSelected = MH_CreateHook((LPVOID*)app::SurvivalLobbyController_PlayableCharacterSelected, &hSurvivalLobbyController_PlayableCharacterSelected, reinterpret_cast<LPVOID*>(&oSurvivalLobbyController_PlayableCharacterSelected));
if (status_playableCharacterSelected != MH_OK) {
std::cout << "Failed to create status_playableCharacterSelected hook: " << MH_StatusToString(status_playableCharacterSelected) << std::endl;
return;
}
// SurvivalLobbyController_UnlockedCharacterSelected
MH_STATUS status_unlockedCharacterSelected = MH_CreateHook((LPVOID*)app::SurvivalLobbyController_UnlockedCharacterSelected, &hSurvivalLobbyController_UnlockedCharacterSelected, reinterpret_cast<LPVOID*>(&oSurvivalLobbyController_UnlockedCharacterSelected));
if (status_unlockedCharacterSelected != MH_OK) {
std::cout << "Failed to create unlockedCharacterSelected hook: " << MH_StatusToString(status_unlockedCharacterSelected) << std::endl;
return;
}
// SurvivalLobbyController_AllPlayersReady
MH_STATUS status_allPlayersReady = MH_CreateHook((LPVOID*)app::SurvivalLobbyController_AllPlayersReady, &hSurvivalLobbyController_AllPlayersReady, reinterpret_cast<LPVOID*>(&oSurvivalLobbyController_AllPlayersReady));
if (status_allPlayersReady != MH_OK) {
std::cout << "Failed to create allPlayersReady hook: " << MH_StatusToString(status_allPlayersReady) << std::endl;
return;
}
// SurvivalLobbyController_OnSelectOutfit
MH_STATUS status_OnSelectOutfit = MH_CreateHook((LPVOID*)app::SurvivalLobbyController_OnSelectOutfit, &hSurvivalLobbyController_OnSelectOutfit, reinterpret_cast<LPVOID*>(&oSurvivalLobbyController_OnSelectOutfit));
if (status_OnSelectOutfit != MH_OK) {
std::cout << "Failed to create status_OnSelectOutfit hook: " << MH_StatusToString(status_OnSelectOutfit) << std::endl;
return;
}
// UIOutfitSelectionType_SetLocked
MH_STATUS status_outfitSetLocked = MH_CreateHook((LPVOID*)app::UIOutfitSelectionType_SetLocked, &hUIOutfitSelectionType_SetLocked, reinterpret_cast<LPVOID*>(&oUIOutfitSelectionType_SetLocked));
if (status_outfitSetLocked != MH_OK) {
std::cout << "Failed to create status_outfitSetLocked hook: " << MH_StatusToString(status_outfitSetLocked) << std::endl;
return;
}
// SteamInventoryManager_UserHasItem
MH_STATUS status_userHasItem = MH_CreateHook((LPVOID*)app::SteamInventoryManager_UserHasItem, &hSteamInventoryManager_UserHasItem, reinterpret_cast<LPVOID*>(&oSteamInventoryManager_UserHasItem));
if (status_userHasItem != MH_OK) {
std::cout << "Failed to create status_userHasItem hook: " << MH_StatusToString(status_userHasItem) << std::endl;
return;
}
// SteamInventoryManager_HasRetrievedUserInventoryItems
MH_STATUS status_HasRetrieved = MH_CreateHook((LPVOID*)app::SteamInventoryManager_HasRetrievedUserInventoryItems, &hSteamInventoryManager_HasRetrievedUserInventoryItems, reinterpret_cast<LPVOID*>(&oSteamInventoryManager_HasRetrievedUserInventoryItems));
if (status_HasRetrieved != MH_OK) {
std::cout << "Failed to create status_HasRetrieved hook: " << MH_StatusToString(status_HasRetrieved) << std::endl;
return;
}
// SteamInventoryValidator_PlayerHasItem
//MH_STATUS status_playerHasItem = MH_CreateHook((LPVOID*)app::SteamInventoryValidator_PlayerHasItem, &hSteamInventoryValidator_PlayerHasItem, reinterpret_cast<LPVOID*>(&oSteamInventoryValidator_PlayerHasItem));
//if (status_playerHasItem != MH_OK) {
// std::cout << "Failed to create status_playerHasItem hook: " << MH_StatusToString(status_playerHasItem) << std::endl;
// 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;
@@ -215,7 +554,6 @@ ID3D11DeviceContext* pContext = NULL;
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND window = NULL;
WNDPROC oWndProc;
bool open_menu = false;
LRESULT __stdcall WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (open_menu && ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam)) {
return true;
@@ -259,14 +597,23 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
return phookD3D11Present(pSwapChain, SyncInterval, Flags);
}
if (GetKeyState(VK_INSERT) & 0x8000) {
if (GetKeyState('Q') & 0x8000) {
pressed = true;
}
else if (!(GetKeyState(VK_INSERT) & 0x8000) && pressed) {
else if (!(GetKeyState('Q') & 0x8000) && pressed) {
open_menu = !open_menu;
pressed = false;
if (IsInGame()) {
if (open_menu) {
app::UIHelpers_ShowMouseCursor(NULL);
}
else {
app::UIHelpers_HideMouseCursor(NULL);
}
}
}
ImGui_ImplDX11_NewFrame();
@@ -280,27 +627,9 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
*/
if (open_menu) {
/*Unity::CGameObject* UIHelpers = Unity::GameObject::Find("UIHelpers");
if (UIHelpers) {
Unity::CComponent* UI = UIHelpers->GetComponent("UIHelpers");
if (UI) {
UI->CallMethodSafe<void*>("ShowMouseCursor");
cursor_switch = true;
}
}*/
DrawMenu(open_menu);
}
/*if (!open_menu && cursor_switch) {
Unity::CGameObject* UIHelpers = Unity::GameObject::Find("UIHelpers");
if (UIHelpers) {
Unity::CComponent* UI = UIHelpers->GetComponent("UIHelpers");
if (UI) {
UI->CallMethodSafe<void*>("HideMouseCursor");
cursor_switch = false;
}
}
}*/
ImGui::GetIO().MouseDrawCursor = open_menu;

View File

@@ -42,4 +42,9 @@ namespace settings {
bool auto_respawn = false;
bool change_player_speed = false;
int new_speed = 1;
bool freeze_azazel = false;
float new_azazel_speed = 0.f;
bool disable_longInteract = false;
}

View File

@@ -46,6 +46,11 @@ namespace settings {
extern bool auto_respawn;
extern bool change_player_speed;
extern int new_speed;
extern bool freeze_azazel;
extern float new_azazel_speed;
extern bool disable_longInteract;
}
#endif