Support IDA sigs that are based off of the first CALL instruction for a function.

This commit is contained in:
attickdoor 2020-03-04 21:29:02 -05:00
parent 042320718b
commit 95e2bc14f2

View file

@ -155,10 +155,25 @@ namespace Dalamud.Game {
if (IsCopy)
scanRet = new IntPtr(scanRet.ToInt64() - this.moduleCopyOffset);
if (Marshal.ReadByte(scanRet) == 0xE8)
return ReadCallSig(scanRet);
return scanRet;
}
/// <summary>
/// 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>
/// <returns>The real offset of the signature.</returns>
private IntPtr ReadCallSig(IntPtr SigLocation)
{
int jumpOffset = Marshal.ReadInt32(IntPtr.Add(SigLocation, 1));
return IntPtr.Add(SigLocation, 5 + jumpOffset);
}
/// <summary>
/// Scan for a byte signature in the .data section.
/// </summary>