mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
do-while is actually more elegant for once
This commit is contained in:
parent
39e196ddbb
commit
9186a1cf54
1 changed files with 5 additions and 4 deletions
|
|
@ -185,14 +185,15 @@ namespace Dalamud.Game {
|
||||||
public IntPtr GetStaticAddressFromSig(string signature, int offset)
|
public IntPtr GetStaticAddressFromSig(string signature, int offset)
|
||||||
{
|
{
|
||||||
IntPtr instrAddr = ScanText(signature);
|
IntPtr instrAddr = ScanText(signature);
|
||||||
instrAddr = IntPtr.Add(instrAddr, offset + 1);
|
instrAddr = IntPtr.Add(instrAddr, offset);
|
||||||
long bAddr = (long)Module.BaseAddress;
|
long bAddr = (long)Module.BaseAddress;
|
||||||
var num = (long)Marshal.ReadInt32(instrAddr) + (long)instrAddr + 4 - bAddr;
|
long num;
|
||||||
while(! (num >= DataSectionOffset && num <= DataSectionOffset + DataSectionSize))
|
do
|
||||||
{
|
{
|
||||||
instrAddr= IntPtr.Add(instrAddr, 1);
|
instrAddr = IntPtr.Add(instrAddr, 1);
|
||||||
num = Marshal.ReadInt32(instrAddr) + (long)instrAddr + 4 - bAddr;
|
num = Marshal.ReadInt32(instrAddr) + (long)instrAddr + 4 - bAddr;
|
||||||
}
|
}
|
||||||
|
while (!(num >= DataSectionOffset && num <= DataSectionOffset + DataSectionSize));
|
||||||
return IntPtr.Add(instrAddr, Marshal.ReadInt32(instrAddr) + 4);
|
return IntPtr.Add(instrAddr, Marshal.ReadInt32(instrAddr) + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue