fix: remove need for GetUiModulePtr

This commit is contained in:
goat 2021-04-06 15:58:17 +02:00
parent e50474e408
commit e5353b943a
2 changed files with 9 additions and 5 deletions

View file

@ -8,7 +8,10 @@ using Serilog;
using SharpDX;
namespace Dalamud.Game.Internal.Gui {
public sealed class GameGui : IDisposable {
public sealed class GameGui : IDisposable
{
private readonly Dalamud dalamud;
private GameGuiAddressResolver Address { get; }
public ChatGui Chat { get; private set; }
@ -100,7 +103,10 @@ namespace Dalamud.Game.Internal.Gui {
/// </summary>
public EventHandler<HoveredAction> HoveredActionChanged { get; set; }
public GameGui(IntPtr baseAddress, SigScanner scanner, Dalamud dalamud) {
public GameGui(IntPtr baseAddress, SigScanner scanner, Dalamud dalamud)
{
this.dalamud = dalamud;
Address = new GameGuiAddressResolver(baseAddress);
Address.Setup(scanner);
@ -424,7 +430,7 @@ namespace Dalamud.Game.Internal.Gui {
/// <returns>IntPtr pointing to UI module</returns>
public IntPtr GetUIModule()
{
return this.getUiModule(Marshal.ReadIntPtr(Address.GetUIModulePtr));
return this.getUiModule(this.dalamud.Framework.Address.BaseAddress);
}
/// <summary>

View file

@ -20,7 +20,6 @@ namespace Dalamud.Game.Internal.Gui {
public IntPtr GetBaseUIObject { get; private set; }
public IntPtr GetUIObjectByName { get; private set; }
public IntPtr GetUIModule { get; private set; }
public IntPtr GetUIModulePtr { get; private set; }
public GameGuiAddressResolver(IntPtr baseAddress) {
BaseAddress = baseAddress;
@ -48,7 +47,6 @@ namespace Dalamud.Game.Internal.Gui {
GetBaseUIObject = sig.ScanText("E8 ?? ?? ?? ?? 41 B8 01 00 00 00 48 8D 15 ?? ?? ?? ?? 48 8B 48 20 E8 ?? ?? ?? ?? 48 8B CF");
GetUIObjectByName = sig.ScanText("E8 ?? ?? ?? ?? 48 8B CF 48 89 87 ?? ?? 00 00 E8 ?? ?? ?? ?? 41 B8 01 00 00 00");
GetUIModule = sig.ScanText("E8 ?? ?? ?? ?? 83 3B 01");
GetUIModulePtr = sig.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 48 8D 54 24 ?? 48 83 C1 10 E8 ?? ?? ?? ??");
}
}
}