From afd63c0fcdc3c1e2956bf5134d14ef976ee1f051 Mon Sep 17 00:00:00 2001 From: ermaccer <40604575+ermaccer@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:59:04 +0200 Subject: [PATCH] no DOF toggle, fix p2 infinite supermoves cheat --- MK11Hook/MK11Hook.rc | Bin 4524 -> 4524 bytes MK11Hook/dllmain.cpp | 7 ++++--- MK11Hook/mk/Engine.cpp | 1 - MK11Hook/mk/GameInfo.h | 2 +- MK11Hook/plugin/Hooks.cpp | 11 +++++++++++ MK11Hook/plugin/Hooks.h | 3 +++ MK11Hook/plugin/Menu.cpp | 7 ++++--- MK11Hook/plugin/Menu.h | 3 ++- MK11Hook/plugin/PatternSolver.cpp | 5 ++++- MK11Hook/plugin/PatternSolver.h | 1 + 10 files changed, 30 insertions(+), 10 deletions(-) diff --git a/MK11Hook/MK11Hook.rc b/MK11Hook/MK11Hook.rc index 162a9dcf0a338c35a491bda9b0df01ee6111c6f5..0d32fcd8b94dcfa8d61331a71bc2d4f090852fdf 100644 GIT binary patch delta 46 zcmZ3ZyheFL6$himMvKjBIesz$IsLrSlMirnOxEM!+kAt28zWGrpI4Rz0BS-G ArvLx| delta 46 zcmZ3ZyheFL6$hjFM)S>UIesz$IsLrSlMirnOxEM!+kAt28zWGrpI4Rz0BPM0 AqW}N^ diff --git a/MK11Hook/dllmain.cpp b/MK11Hook/dllmain.cpp index cb23cc0..70f1956 100644 --- a/MK11Hook/dllmain.cpp +++ b/MK11Hook/dllmain.cpp @@ -24,7 +24,6 @@ #include "helper/eGamepadManager.h" #include "helper/eAbilityNames.h" -#include #include #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") @@ -88,6 +87,10 @@ void OnInitializeHook() InjectHook(_pattern(PATID_SetKryptCharacterL_Hook), tramp->Jump(SetKryptCharacterL)); InjectHook(_pattern(PATID_SetKryptCharacterClass_Hook), tramp->Jump(SetKryptCharacterClass)); + + ReadCall(_pattern(PATID_ProcessDOFSettings), pProcessDOFSettings); + InjectHook(_pattern(PATID_ProcessDOFSettings), tramp->Jump(ProcessDOFSettings), PATCH_CALL); + //gamepad if (SettingsMgr->bEnableGamepadSupport) { @@ -157,11 +160,9 @@ bool ValidateGameVersion() break; } } - } return true; - } extern "C" diff --git a/MK11Hook/mk/Engine.cpp b/MK11Hook/mk/Engine.cpp index 436de6d..132ff75 100644 --- a/MK11Hook/mk/Engine.cpp +++ b/MK11Hook/mk/Engine.cpp @@ -40,7 +40,6 @@ void HideHUD() static uintptr_t pat = _pattern(PATID_HideHUD); if (pat) ((void(__fastcall*)(int, int))pat)(8, 8); - } void ShowHUD() diff --git a/MK11Hook/mk/GameInfo.h b/MK11Hook/mk/GameInfo.h index 0f720ed..3131291 100644 --- a/MK11Hook/mk/GameInfo.h +++ b/MK11Hook/mk/GameInfo.h @@ -1,6 +1,6 @@ #pragma once #include "PlayerInfo.h" -#include "../utils.h" +#include "..\utils.h" #define TOTAL_ABILITIES 20 diff --git a/MK11Hook/plugin/Hooks.cpp b/MK11Hook/plugin/Hooks.cpp index 703b340..ffd297c 100644 --- a/MK11Hook/plugin/Hooks.cpp +++ b/MK11Hook/plugin/Hooks.cpp @@ -2,6 +2,17 @@ int64 hud_property = 0; +void(__fastcall* pProcessDOFSettings)(int64, int64, int64, int64) = 0; + + +void ProcessDOFSettings(int64 settings, int64 a2, int64 newSettings, int64 a4) +{ + if (pProcessDOFSettings) + pProcessDOFSettings(settings, a2, newSettings, a4); + + if (TheMenu->m_bDisableDOF) + *(int*)(settings + 36) = 0; +} void MKProcDispatch_Hook() { diff --git a/MK11Hook/plugin/Hooks.h b/MK11Hook/plugin/Hooks.h index e5cee75..f5ea257 100644 --- a/MK11Hook/plugin/Hooks.h +++ b/MK11Hook/plugin/Hooks.h @@ -8,6 +8,9 @@ #include "..\helper\eMouse.h" #include "PluginInterface.h" +extern void(__fastcall* pProcessDOFSettings)(int64, int64, int64, int64); +void ProcessDOFSettings(int64 settings, int64 a2, int64 newSettings, int64 a4); + void MKProcDispatch_Hook(); void Dispatch_Hook(int64 ptr, int a2); void RecordEvent_Hook(int64 eventID, int64 a2, int64 a3, int64 a4); diff --git a/MK11Hook/plugin/Menu.cpp b/MK11Hook/plugin/Menu.cpp index 493107f..f9aae5b 100644 --- a/MK11Hook/plugin/Menu.cpp +++ b/MK11Hook/plugin/Menu.cpp @@ -614,8 +614,8 @@ const char* szStageNames[]{ "BGND_TournamentLVECT", "BGND_TournamentLVFKT", "BGND_WuShiDragonGrotto", - }; + const char* szCameraModes[TOTAL_CUSTOM_CAMERAS] = { "Third Person", "Third Person #2", @@ -1517,6 +1517,7 @@ void MK11Menu::DrawCameraTab() ImGui::Separator(); + ImGui::Checkbox("Disable DOF", &m_bDisableDOF); ImGui::Checkbox("Force Camera To Move", &m_bForceCameraUpdate); ImGui::SameLine(); ShowHelpMarker("Check this option if camera doesn't move in cinematics."); @@ -1685,9 +1686,9 @@ void MK11Menu::DrawCheatsTab() if (ImGui::Checkbox("P2##ixr", &m_bInfiniteXraysP2)) { if (m_bInfiniteXraysP2) - GetObj(PLAYER2)->SetFastUppercutRecovery(true); + GetObj(PLAYER2)->SetXRayInfinite(true); else - GetObj(PLAYER2)->SetFastUppercutRecovery(false); + GetObj(PLAYER2)->SetXRayInfinite(false); } ImGui::NextColumn(); diff --git a/MK11Hook/plugin/Menu.h b/MK11Hook/plugin/Menu.h index 08cd99b..c797061 100644 --- a/MK11Hook/plugin/Menu.h +++ b/MK11Hook/plugin/Menu.h @@ -10,7 +10,7 @@ #include "../utils.h" -#define MK11HOOK_VERSION "0.5.7" +#define MK11HOOK_VERSION "0.5.8" enum eCustomCameras { CAMERA_3RDPERSON, @@ -74,6 +74,7 @@ class MK11Menu { bool m_bHideHUD = false; bool m_bAutoHideHUD = false; bool m_bMouseControl = false; + bool m_bDisableDOF = false; // cheats bool m_bInfiniteHealthP1 = false; diff --git a/MK11Hook/plugin/PatternSolver.cpp b/MK11Hook/plugin/PatternSolver.cpp index bd1e8e6..e749205 100644 --- a/MK11Hook/plugin/PatternSolver.cpp +++ b/MK11Hook/plugin/PatternSolver.cpp @@ -121,6 +121,8 @@ void PatternSolver::Initialize() ms_patterns[PATID_GetScaleform] = GetPattern("83 3D ? ? ? ? ? 74 72 45 8B C4 8B 15", 2); + ms_patterns[PATID_ProcessDOFSettings] = GetPattern("48 8D 4B 44 E8 ? ? ? ? 48 8D 44 24", 4); + auto end = std::chrono::high_resolution_clock::now(); auto time = std::chrono::duration_cast(end - begin); @@ -234,7 +236,8 @@ const char* PatternSolver::GetPatternName(int id) "GetNames", "USkeletalMeshComponent_GetBoneName", "XInputGetState_Hook", - "GetScaleform" + "GetScaleform", + "ProcessDOFSettings" }; return szPatternNames[id]; diff --git a/MK11Hook/plugin/PatternSolver.h b/MK11Hook/plugin/PatternSolver.h index d152e1e..ce084dc 100644 --- a/MK11Hook/plugin/PatternSolver.h +++ b/MK11Hook/plugin/PatternSolver.h @@ -95,6 +95,7 @@ enum EPatternID { PATID_XInputGetState_Hook, PATID_GetScaleform, + PATID_ProcessDOFSettings, PATID_Total_Patterns };