From abc15f9a228bd88aa5252f89d4ed003ae930629f Mon Sep 17 00:00:00 2001 From: Raymond Date: Tue, 26 Oct 2021 11:37:25 -0400 Subject: [PATCH] Catch CoreHook initialization/hook errors, let reloaded try instead --- Dalamud/Hooking/Hook.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Dalamud/Hooking/Hook.cs b/Dalamud/Hooking/Hook.cs index 25471a23f..7171e2ec7 100644 --- a/Dalamud/Hooking/Hook.cs +++ b/Dalamud/Hooking/Hook.cs @@ -5,6 +5,7 @@ using Dalamud.Configuration.Internal; using Dalamud.Hooking.Internal; using Dalamud.Memory; using Reloaded.Hooks; +using Serilog; namespace Dalamud.Hooking { @@ -54,7 +55,16 @@ namespace Dalamud.Hooking this.address = address; if (this.isCoreHook) { - this.coreHookImpl = CoreHook.HookFactory.CreateHook(address, detour); + try + { + this.coreHookImpl = CoreHook.HookFactory.CreateHook(address, detour); + } + catch (Exception ex) + { + this.isCoreHook = false; + Log.Error(ex, "CoreHook is having a bad day, defaulting to Reloaded"); + this.hookImpl = ReloadedHooks.Instance.CreateHook(detour, address.ToInt64()); + } } else {