diff --git a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs index 07c554f38..357fa77a2 100644 --- a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs +++ b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs @@ -13,9 +13,9 @@ namespace Dalamud.Game.ClientState public IntPtr JobGaugeData { get; set; } protected override void Setup64Bit(SigScanner sig) { - ActorTable = sig.Module.BaseAddress + 0x1C62198; // updated 5.21 + ActorTable = sig.GetStaticAddressFromSig("F3 0F 11 05 ?? ?? ?? ?? EB 27", 0) + 0xC; LocalContentId = sig.Module.BaseAddress + 0x1C2E000; - JobGaugeData = sig.Module.BaseAddress + 0x1C5E420; + JobGaugeData = sig.GetStaticAddressFromSig("E8 ?? ?? ?? ?? 80 BB ?? ?? ?? ?? ?? 77 93", 0x220) + 0x10; } } } diff --git a/Dalamud/Game/SigScanner.cs b/Dalamud/Game/SigScanner.cs index f27222a35..d1b8f122c 100644 --- a/Dalamud/Game/SigScanner.cs +++ b/Dalamud/Game/SigScanner.cs @@ -166,7 +166,7 @@ namespace Dalamud.Game { /// Helper for ScanText to get the correct address for /// IDA sigs that mark the first CALL location. /// - /// The address the CALL sig resolved to. + /// The address the CALL sig resolved to. /// The real offset of the signature. private IntPtr ReadCallSig(IntPtr SigLocation) { @@ -174,6 +174,28 @@ namespace Dalamud.Game { return IntPtr.Add(SigLocation, 5 + jumpOffset); } + /// + /// Scan for a .data address using a .text function. + /// This is intended to be used with IDA sigs. + /// Place your cursor on the line calling a static address, and create and IDA sig. + /// + /// The signature of the function using the data. + /// The offset from function start of the instruction using the data. + /// An IntPtr to the static memory location. + public IntPtr GetStaticAddressFromSig(string signature, int offset) + { + IntPtr instrAddr = ScanText(signature); + instrAddr = IntPtr.Add(instrAddr, offset + 1); + long bAddr = (long)Module.BaseAddress; + var num = (long)Marshal.ReadInt32(instrAddr) + (long)instrAddr + 4 - bAddr; + while(! (num >= DataSectionOffset && num <= DataSectionOffset + DataSectionSize)) + { + instrAddr= IntPtr.Add(instrAddr, 1); + num = Marshal.ReadInt32(instrAddr) + (long)instrAddr + 4 - bAddr; + } + return IntPtr.Add(instrAddr, Marshal.ReadInt32(instrAddr) + 4); + } + /// /// Scan for a byte signature in the .data section. ///