mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Add GetStaticAddressFromSig
This commit is contained in:
parent
da8c66c394
commit
39e196ddbb
2 changed files with 25 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ namespace Dalamud.Game {
|
|||
/// Helper for ScanText to get the correct address for
|
||||
/// IDA sigs that mark the first CALL location.
|
||||
/// </summary>
|
||||
/// <param name="sigLocation">The address the CALL sig resolved to.</param>
|
||||
/// <param name="SigLocation">The address the CALL sig resolved to.</param>
|
||||
/// <returns>The real offset of the signature.</returns>
|
||||
private IntPtr ReadCallSig(IntPtr SigLocation)
|
||||
{
|
||||
|
|
@ -174,6 +174,28 @@ namespace Dalamud.Game {
|
|||
return IntPtr.Add(SigLocation, 5 + jumpOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="signature">The signature of the function using the data.</param>
|
||||
/// <param name="offset">The offset from function start of the instruction using the data.</param>
|
||||
/// <returns>An IntPtr to the static memory location.</returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scan for a byte signature in the .data section.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue