refactor: rename InfoModule-related stuff

This commit is contained in:
Anna
2022-01-30 22:11:03 -05:00
parent aa10bf3ceb
commit 9372ad35bc
4 changed files with 29 additions and 13 deletions
+13
View File
@@ -45,6 +45,9 @@ internal sealed unsafe class Chat : IDisposable {
[Signature("E8 ?? ?? ?? ?? F6 43 0A 40")] [Signature("E8 ?? ?? ?? ?? F6 43 0A 40")]
private readonly delegate* unmanaged<Framework*, IntPtr> _getNetworkModule = null!; private readonly delegate* unmanaged<Framework*, IntPtr> _getNetworkModule = null!;
[Signature("E8 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? 45 8D 46 FB")]
private readonly delegate* unmanaged<IntPtr, uint, Utf8String*> _getLinkshellName = null!;
// Hooks // Hooks
private delegate byte ChatLogRefreshDelegate(IntPtr log, ushort eventId, AtkValue* value); private delegate byte ChatLogRefreshDelegate(IntPtr log, ushort eventId, AtkValue* value);
@@ -126,6 +129,16 @@ internal sealed unsafe class Chat : IDisposable {
this.Activated = null; this.Activated = null;
} }
internal string? GetLinkshellName(uint idx) {
var infoProxy = this.Plugin.Functions.GetInfoProxyByIndex(26);
if (infoProxy == IntPtr.Zero) {
return null;
}
var utf = this._getLinkshellName(infoProxy, idx);
return utf == null ? null : utf->ToString();
}
private readonly Dictionary<string, Keybind> _keybinds = new(); private readonly Dictionary<string, Keybind> _keybinds = new();
internal IReadOnlyDictionary<string, Keybind> Keybinds => this._keybinds; internal IReadOnlyDictionary<string, Keybind> Keybinds => this._keybinds;
+2 -6
View File
@@ -34,16 +34,12 @@ internal sealed unsafe class Context {
} }
internal void InviteToNoviceNetwork(string name, ushort world) { internal void InviteToNoviceNetwork(string name, ushort world) {
if (this._inviteToNoviceNetwork == null || this.Plugin.Functions.Indexer == null) { if (this._inviteToNoviceNetwork == null) {
return; return;
} }
var uiModule = Framework.Instance()->GetUiModule();
// 6.05: 20D722
var func = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[33];
var toIndex = func(uiModule);
// 6.05: 20E4CB // 6.05: 20E4CB
var a1 = this.Plugin.Functions.Indexer(toIndex, 0x11); var a1 = this.Plugin.Functions.GetInfoProxyByIndex(0x11);
fixed (byte* namePtr = name.ToTerminatedBytes()) { fixed (byte* namePtr = name.ToTerminatedBytes()) {
// can specify content id if we have it, but there's no need // can specify content id if we have it, but there's no need
+12 -1
View File
@@ -21,7 +21,7 @@ internal unsafe class GameFunctions : IDisposable {
#region Functions #region Functions
[Signature("E8 ?? ?? ?? ?? 8B FD 8B CD", Fallibility = Fallibility.Fallible)] [Signature("E8 ?? ?? ?? ?? 8B FD 8B CD", Fallibility = Fallibility.Fallible)]
internal readonly delegate* unmanaged<IntPtr, uint, IntPtr> Indexer = null!; private readonly delegate* unmanaged<IntPtr, uint, IntPtr> _getInfoProxyByIndex = null!;
[Signature("E8 ?? ?? ?? ?? 84 C0 74 0D B0 02", Fallibility = Fallibility.Fallible)] [Signature("E8 ?? ?? ?? ?? 84 C0 74 0D B0 02", Fallibility = Fallibility.Fallible)]
private readonly delegate* unmanaged<IntPtr, byte> _isMentor = null!; private readonly delegate* unmanaged<IntPtr, byte> _isMentor = null!;
@@ -76,6 +76,17 @@ internal unsafe class GameFunctions : IDisposable {
Marshal.FreeHGlobal(this._placeholderNamePtr); Marshal.FreeHGlobal(this._placeholderNamePtr);
} }
private static IntPtr GetInfoModule() {
var uiModule = Framework.Instance()->GetUiModule();
var getInfoModule = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[33];
return getInfoModule(uiModule);
}
internal IntPtr GetInfoProxyByIndex(uint idx) {
var infoModule = GetInfoModule();
return infoModule == IntPtr.Zero ? IntPtr.Zero : this._getInfoProxyByIndex(infoModule, idx);
}
internal uint? GetCurrentChatLogEntryIndex() { internal uint? GetCurrentChatLogEntryIndex() {
if (this._currentChatEntryOffset == null) { if (this._currentChatEntryOffset == null) {
return null; return null;
+2 -6
View File
@@ -1,6 +1,5 @@
using ChatTwo.Util; using ChatTwo.Util;
using FFXIVClientStructs.FFXIV.Client.System.Framework; using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Siggingway; using Siggingway;
@@ -28,15 +27,12 @@ internal sealed unsafe class Party {
} }
internal void Invite(string name, ushort world, ulong contentId) { internal void Invite(string name, ushort world, ulong contentId) {
if (this._inviteToParty == null || this.Plugin.Functions.Indexer == null) { if (this._inviteToParty == null) {
return; return;
} }
var uiModule = Framework.Instance()->GetUiModule();
// 6.05: 20D722 // 6.05: 20D722
var func = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[33]; var a1 = this.Plugin.Functions.GetInfoProxyByIndex(1);
var toIndex = func(uiModule);
var a1 = this.Plugin.Functions.Indexer(toIndex, 1);
if (contentId != 0) { if (contentId != 0) {
// third param is world, but it requires a specific world // third param is world, but it requires a specific world