diff --git a/Dalamud/Game/SigScanner.cs b/Dalamud/Game/SigScanner.cs index 3fea68536..700831d51 100644 --- a/Dalamud/Game/SigScanner.cs +++ b/Dalamud/Game/SigScanner.cs @@ -25,7 +25,7 @@ namespace Dalamud.Game private IntPtr moduleCopyPtr; private long moduleCopyOffset; - private Dictionary? textCache; + private Dictionary? textCache; /// /// Initializes a new instance of the class using the main module of the current process. @@ -308,11 +308,10 @@ namespace Dalamud.Game { if (this.textCache != null && this.textCache.TryGetValue(signature, out var address)) { - return address; + return new IntPtr(address + this.Module.BaseAddress.ToInt64()); } var mBase = this.IsCopy ? this.moduleCopyPtr : this.TextSectionBase; - var scanRet = Scan(mBase, this.TextSectionSize, signature); if (this.IsCopy) @@ -323,7 +322,7 @@ namespace Dalamud.Game if (insnByte == 0xE8 || insnByte == 0xE9) return ReadJmpCallSig(scanRet); - this.textCache?.Add(signature, scanRet); + this.textCache?.Add(signature, scanRet.ToInt64() - this.Module.BaseAddress.ToInt64()); return scanRet; } @@ -518,7 +517,7 @@ namespace Dalamud.Game return; } - this.textCache = JsonConvert.DeserializeObject>(File.ReadAllText(this.cacheFile.FullName)) ?? new Dictionary(); + this.textCache = JsonConvert.DeserializeObject>(File.ReadAllText(this.cacheFile.FullName)) ?? new Dictionary(); } } }