This commit is contained in:
goat 2021-04-07 11:51:52 +02:00
commit d9e6f25f42
2 changed files with 6 additions and 13 deletions

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using Dalamud.Game.Internal.Gui.Toast; using Dalamud.Game.Internal.Gui.Toast;
@ -54,9 +53,7 @@ namespace Dalamud.Game.Internal.Gui
private delegate byte ShowQuestToastDelegate(IntPtr manager, int position, IntPtr text, uint iconOrCheck1, byte playSound, uint iconOrCheck2, byte alsoPlaySound); private delegate byte ShowQuestToastDelegate(IntPtr manager, int position, IntPtr text, uint iconOrCheck1, byte playSound, uint iconOrCheck2, byte alsoPlaySound);
private delegate byte ShowErrorToastDelegate(IntPtr manager, IntPtr text, int layer, byte respectsHidingMaybe); private delegate byte ShowErrorToastDelegate(IntPtr manager, IntPtr text, byte respectsHidingMaybe);
private delegate IntPtr GetAtkModuleDelegate(IntPtr uiModule);
#endregion #endregion
@ -265,11 +262,7 @@ namespace Dalamud.Game.Internal.Gui
private void ShowError(byte[] bytes) private void ShowError(byte[] bytes)
{ {
var uiModule = this.Dalamud.Framework.Gui.GetUIModule(); var manager = this.Dalamud.Framework.Gui.GetUIModule();
var vtbl = Marshal.ReadIntPtr(uiModule);
var atkModulePtr = Marshal.ReadIntPtr(vtbl + (7 * 8));
var getAtkModule = Marshal.GetDelegateForFunctionPointer<GetAtkModuleDelegate>(atkModulePtr);
var manager = getAtkModule(uiModule);
// terminate the string // terminate the string
var terminated = Terminate(bytes); var terminated = Terminate(bytes);
@ -278,7 +271,7 @@ namespace Dalamud.Game.Internal.Gui
{ {
fixed (byte* ptr = terminated) fixed (byte* ptr = terminated)
{ {
this.HandleErrorToastDetour(manager, (IntPtr) ptr, 10, 0); this.HandleErrorToastDetour(manager, (IntPtr) ptr, 0);
} }
} }
} }
@ -366,7 +359,7 @@ namespace Dalamud.Game.Internal.Gui
} }
} }
private byte HandleErrorToastDetour(IntPtr manager, IntPtr text, int layer, byte respectsHidingMaybe) private byte HandleErrorToastDetour(IntPtr manager, IntPtr text, byte respectsHidingMaybe)
{ {
if (text == IntPtr.Zero) if (text == IntPtr.Zero)
{ {
@ -391,7 +384,7 @@ namespace Dalamud.Game.Internal.Gui
{ {
fixed (byte* message = terminated) fixed (byte* message = terminated)
{ {
return this.showErrorToastHook.Original(manager, (IntPtr) message, layer, respectsHidingMaybe); return this.showErrorToastHook.Original(manager, (IntPtr) message, respectsHidingMaybe);
} }
} }
} }

View file

@ -14,7 +14,7 @@ namespace Dalamud.Game.Internal.Gui
{ {
this.ShowNormalToast = sig.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 30 83 3D ?? ?? ?? ?? ??"); this.ShowNormalToast = sig.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 30 83 3D ?? ?? ?? ?? ??");
this.ShowQuestToast = sig.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 83 EC 40 83 3D ?? ?? ?? ?? ??"); this.ShowQuestToast = sig.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 83 EC 40 83 3D ?? ?? ?? ?? ??");
this.ShowErrorToast = sig.ScanText("40 56 57 41 56 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 41 8B F0"); this.ShowErrorToast = sig.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 83 3D ?? ?? ?? ?? ?? 41 0F B6 F0");
} }
} }
} }