mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #292 from ascclemens/toast-fixups
Use UiModule error toast function
This commit is contained in:
commit
f145f56263
2 changed files with 6 additions and 13 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
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 ShowErrorToastDelegate(IntPtr manager, IntPtr text, int layer, byte respectsHidingMaybe);
|
||||
|
||||
private delegate IntPtr GetAtkModuleDelegate(IntPtr uiModule);
|
||||
private delegate byte ShowErrorToastDelegate(IntPtr manager, IntPtr text, byte respectsHidingMaybe);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -265,11 +262,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
|
||||
private void ShowError(byte[] bytes)
|
||||
{
|
||||
var uiModule = 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);
|
||||
var manager = this.Dalamud.Framework.Gui.GetUIModule();
|
||||
|
||||
// terminate the string
|
||||
var terminated = Terminate(bytes);
|
||||
|
|
@ -278,7 +271,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
@ -391,7 +384,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
{
|
||||
fixed (byte* message = terminated)
|
||||
{
|
||||
return this.showErrorToastHook.Original(manager, (IntPtr) message, layer, respectsHidingMaybe);
|
||||
return this.showErrorToastHook.Original(manager, (IntPtr) message, respectsHidingMaybe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue