From 884a9080b5bb86f6fb1dbb0b3d2f51c5e7bd09b0 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Tue, 1 Mar 2022 20:40:56 +0000 Subject: [PATCH 1/2] hle: detect when patches fail to apply --- src/core/hle/Patches.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/hle/Patches.cpp b/src/core/hle/Patches.cpp index 3236914b2..9af7930fe 100644 --- a/src/core/hle/Patches.cpp +++ b/src/core/hle/Patches.cpp @@ -438,8 +438,14 @@ inline void EmuInstallPatch(const std::string FunctionName, const xbox::addr_xt return; } - g_FunctionHooks[FunctionName].Install((void*)(FunctionAddr), (void*)patch.patchFunc); - printf("HLE: %s Patched\n", FunctionName.c_str()); + auto result = g_FunctionHooks[FunctionName].Install((void*)(FunctionAddr), (void*)patch.patchFunc); + if (!result) { + printf("HLE: %s Patch Failed\n", FunctionName.c_str()); + } + else { + printf("HLE: %s Patched\n", FunctionName.c_str()); + } + } void EmuInstallPatches() From 3a59c62753a3df4fd372ae8105d1a6d9a38a36f4 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Tue, 1 Mar 2022 22:41:18 +0000 Subject: [PATCH 2/2] Update src/core/hle/Patches.cpp Co-authored-by: RadWolfie --- src/core/hle/Patches.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/hle/Patches.cpp b/src/core/hle/Patches.cpp index 9af7930fe..74e0b3d2d 100644 --- a/src/core/hle/Patches.cpp +++ b/src/core/hle/Patches.cpp @@ -438,12 +438,12 @@ inline void EmuInstallPatch(const std::string FunctionName, const xbox::addr_xt return; } - auto result = g_FunctionHooks[FunctionName].Install((void*)(FunctionAddr), (void*)patch.patchFunc); - if (!result) { - printf("HLE: %s Patch Failed\n", FunctionName.c_str()); + auto success = g_FunctionHooks[FunctionName].Install((void*)(FunctionAddr), (void*)patch.patchFunc); + if (success) { + printf("HLE: %s Patched\n", FunctionName.c_str()); } else { - printf("HLE: %s Patched\n", FunctionName.c_str()); + printf("HLE: %s Patch Failed\n", FunctionName.c_str()); } }