diff --git a/Dalamud/Game/Internal/AntiDebug.cs b/Dalamud/Game/Internal/AntiDebug.cs index c6a423ba2..acc65094d 100644 --- a/Dalamud/Game/Internal/AntiDebug.cs +++ b/Dalamud/Game/Internal/AntiDebug.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Dalamud.Hooking; @@ -14,12 +15,16 @@ namespace Dalamud.Game.Internal public bool IsEnabled { get; private set; } public AntiDebug(SigScanner scanner) { - DebugCheckAddress = scanner.ScanText("FF 15 ?? ?? ?? ?? 85 C0 74 11"); - - Log.Verbose("IsDebuggerPresent address {IsDebuggerPresent}", DebugCheckAddress); + try { + DebugCheckAddress = scanner.ScanText("FF 15 ?? ?? ?? ?? 85 C0 74 11 41"); + } catch (KeyNotFoundException) { + DebugCheckAddress = IntPtr.Zero; + } + + Log.Verbose("DebugCheck address {DebugCheckAddress}", DebugCheckAddress); } - private readonly byte[] nop = new byte[] { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90 }; + private readonly byte[] nop = new byte[] { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90, 0x90 }; private byte[] original; public void Enable() { @@ -28,6 +33,8 @@ namespace Dalamud.Game.Internal Log.Information($"Overwriting Debug Check @ 0x{DebugCheckAddress.ToInt64():X}"); Marshal.Copy(DebugCheckAddress, this.original, 0, this.nop.Length); Marshal.Copy(this.nop, 0, DebugCheckAddress, this.nop.Length); + } else { + Log.Information("DebugCheck already overwritten?"); } IsEnabled = true;