From 545757d40657746c2a825b4e0bbbc6fc58623e02 Mon Sep 17 00:00:00 2001 From: goat Date: Fri, 1 Nov 2019 16:30:53 +0900 Subject: [PATCH 01/10] Update for 5.1 --- Dalamud/Dalamud.cs | 11 ++-- Dalamud/Dalamud.csproj | 2 +- .../ClientState/ClientStateAddressResolver.cs | 4 +- Dalamud/Game/ClientState/Structs/Actor.cs | 16 +++--- .../Internal/Gui/ChatGuiAddressResolver.cs | 11 +++- Dalamud/Game/Internal/Gui/IconReplacer.cs | 11 ++-- Dalamud/Game/Internal/Gui/TargetManager.cs | 55 +++++++++++++++++++ .../Gui/TargetManagerAddressResolver.cs | 15 +++++ .../Network/GameNetworkAddressResolver.cs | 3 +- 9 files changed, 100 insertions(+), 28 deletions(-) create mode 100644 Dalamud/Game/Internal/Gui/TargetManager.cs create mode 100644 Dalamud/Game/Internal/Gui/TargetManagerAddressResolver.cs diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 589b5093e..52ec31e1c 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -158,8 +158,8 @@ namespace Dalamud { HelpMessage = "Unmute a word or sentence. Usage: /fatewatchremove " }); - CommandManager.AddHandler("/xldactortable", new CommandInfo(OnDebugActorTable) { - HelpMessage = "Actor table operations", + CommandManager.AddHandler("/xldstate", new CommandInfo(OnDebugPrintGameState) { + HelpMessage = "Print parsed game state", ShowInHelp = false }); @@ -318,11 +318,13 @@ namespace Dalamud { Process.Start(ChatHandlers.LastLink); } - private void OnDebugActorTable(string command, string arguments) { + private void OnDebugPrintGameState(string command, string arguments) { Framework.Gui.Chat.Print(this.ClientState.Actors.Length + " entries"); Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.Name); Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.CurrentWorld.Name); + Framework.Gui.Chat.Print(this.ClientState.LocalPlayer.HomeWorld.Name); Framework.Gui.Chat.Print(this.ClientState.LocalContentId.ToString("X")); + Framework.Gui.Chat.Print(Framework.Gui.Chat.LastLinkedItemId.ToString()); for (var i = 0; i < this.ClientState.Actors.Length; i++) { var actor = this.ClientState.Actors[i]; @@ -369,7 +371,6 @@ namespace Dalamud { continue; this.Configuration.ComboPresets |= value; - Framework.Gui.Chat.Print(argumentsParts[1] + " SET"); } } break; @@ -379,7 +380,6 @@ namespace Dalamud { continue; this.Configuration.ComboPresets ^= value; - Framework.Gui.Chat.Print(argumentsParts[1] + " TOGGLE"); } } break; @@ -390,7 +390,6 @@ namespace Dalamud { continue; this.Configuration.ComboPresets &= ~value; - Framework.Gui.Chat.Print(argumentsParts[1] + " UNSET"); } } break; diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index b14a0da76..d96583d65 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -21,7 +21,7 @@ - E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml + E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml diff --git a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs index afe8ef25d..885f0b31e 100644 --- a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs +++ b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs @@ -13,8 +13,8 @@ namespace Dalamud.Game.ClientState public IntPtr JobGaugeData { get; set; } protected override void Setup64Bit(SigScanner sig) { - ActorTable = sig.Module.BaseAddress + 0x1B29B40; - LocalContentId = sig.Module.BaseAddress + 0x1B58B60; + ActorTable = sig.Module.BaseAddress + 0x1C01D90; + LocalContentId = sig.Module.BaseAddress + 0x1C2E000; JobGaugeData = sig.Module.BaseAddress + 0x1BFD110; } } diff --git a/Dalamud/Game/ClientState/Structs/Actor.cs b/Dalamud/Game/ClientState/Structs/Actor.cs index 3e1d9ac7c..4dff763c7 100644 --- a/Dalamud/Game/ClientState/Structs/Actor.cs +++ b/Dalamud/Game/ClientState/Structs/Actor.cs @@ -20,13 +20,13 @@ namespace Dalamud.Game.ClientState.Structs [FieldOffset(140)] public ObjectKind ObjectKind; [FieldOffset(141)] public byte SubKind; [FieldOffset(160)] public Position3 Position; - [FieldOffset(6296)] public byte CurrentWorld; - [FieldOffset(6298)] public byte HomeWorld; - [FieldOffset(6308)] public int CurrentHp; - [FieldOffset(6312)] public int MaxHp; - [FieldOffset(6316)] public int CurrentMp; - [FieldOffset(6320)] public int MaxMp; - [FieldOffset(6364)] public byte ClassJob; - [FieldOffset(6366)] public byte Level; + [FieldOffset(6308)] public byte CurrentWorld; + [FieldOffset(6310)] public byte HomeWorld; + [FieldOffset(6328)] public int CurrentHp; + [FieldOffset(6332)] public int MaxHp; + [FieldOffset(6336)] public int CurrentMp; + [FieldOffset(6340)] public int MaxMp; + [FieldOffset(6388)] public byte ClassJob; + [FieldOffset(6390)] public byte Level; } } diff --git a/Dalamud/Game/Internal/Gui/ChatGuiAddressResolver.cs b/Dalamud/Game/Internal/Gui/ChatGuiAddressResolver.cs index 67478e423..0516fce54 100644 --- a/Dalamud/Game/Internal/Gui/ChatGuiAddressResolver.cs +++ b/Dalamud/Game/Internal/Gui/ChatGuiAddressResolver.cs @@ -76,13 +76,18 @@ namespace Dalamud.Game.Internal.Gui { */ protected override void Setup64Bit(SigScanner sig) { - PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24D8FEFFFF 4881EC28020000 488B05???????? 4833C4 488985F0000000 4532D2 48894C2448"); + //PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24D8FEFFFF 4881EC28020000 488B05???????? 4833C4 488985F0000000 4532D2 48894C2448"); LAST PART FOR 5.1??? + PrintMessage = + sig.ScanText( + "4055 57 41 ?? 41 ?? 4157488DAC24E0FE FFFF4881EC2002 0000488B05???? ????48 33C4488985F000 000045 32D248894C2448"); //PrintMessage = sig.ScanText("4055 57 41 ?? 41 ?? 488DAC24E8FEFFFF 4881EC18020000 488B05???????? 4833C4 488985E0000000 4532D2 48894C2438"); old - + //PrintMessage = sig.ScanText("40 55 57 41 56 41 57 48 8D AC 24 D8 FE FF FF 48 81 EC 28 02 00 00 48 8B 05 63 47 4A 01 48 33 C4 48 89 85 F0 00 00 00 45 32 D2 48 89 4C 24 48 33"); //PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 FA F2 B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); - PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); + + //PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); 5.0 + PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 7A 12 AF FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); } } } diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 7f89b401c..069af81a8 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -87,7 +87,6 @@ namespace Dalamud.Game.Internal.Gui { // TODO: this is currently broken // As it stands, don't rely on localCharacter.level for anything. - /* if (localCharacter == null) { try { localCharacter = dalamud.ClientState.LocalPlayer; @@ -97,14 +96,12 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } } - */ // Don't clutter the spaghetti any worse than it already is. - int lastMove = Marshal.ReadInt32(lastComboMove); - float comboTime = (float)Marshal.ReadInt32(comboTimer); - //localCharacter = dalamud.ClientState.LocalPlayer; - //byte level = localCharacter.Level; - byte level = 80; + var lastMove = Marshal.ReadInt32(this.lastComboMove); + var comboTime = Marshal.ReadInt32(this.comboTimer); + this.localCharacter = this.dalamud.ClientState.LocalPlayer; + var level = this.localCharacter.Level; // DRAGOON // TODO: Jump/High Jump into Mirage Dive diff --git a/Dalamud/Game/Internal/Gui/TargetManager.cs b/Dalamud/Game/Internal/Gui/TargetManager.cs new file mode 100644 index 000000000..a6a1c45ee --- /dev/null +++ b/Dalamud/Game/Internal/Gui/TargetManager.cs @@ -0,0 +1,55 @@ +using Dalamud.Game.ClientState; +using Dalamud.Game.ClientState.Actors.Types; +using Dalamud.Game.ClientState.Structs.JobGauge; +using Dalamud.Hooking; +using Serilog; +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using XIVLauncher.Dalamud; + +namespace Dalamud.Game.Internal.Gui { + public class TargetManager { + public delegate IntPtr GetTargetDelegate(IntPtr manager); + + private Hook getTargetHook; + + private TargetManagerAddressResolver Address; + + public unsafe TargetManager(Dalamud dalamud, SigScanner scanner) { + this.Address = new TargetManagerAddressResolver(); + this.Address.Setup(scanner); + + Log.Verbose("===== T A R G E T M A N A G E R ====="); + Log.Verbose("GetTarget address {GetTarget}", Address.GetTarget); + + this.getTargetHook = new Hook(this.Address.GetTarget, new GetTargetDelegate(GetTargetDetour), this); + } + + public void Enable() { + this.getTargetHook.Enable(); + } + + public void Dispose() { + this.getTargetHook.Dispose(); + } + + private IntPtr GetTargetDetour(IntPtr manager) + { + try { + var res = this.getTargetHook.Original(manager); + + var test = Marshal.ReadInt32(res); + + Log.Debug($"GetTargetDetour {manager.ToInt64():X} -> RET: {res:X}"); + + return res; + } + catch (Exception ex) + { + Log.Error(ex, "Exception GetTargetDetour hook."); + return this.getTargetHook.Original(manager); + } + } + } +} diff --git a/Dalamud/Game/Internal/Gui/TargetManagerAddressResolver.cs b/Dalamud/Game/Internal/Gui/TargetManagerAddressResolver.cs new file mode 100644 index 000000000..137742bc0 --- /dev/null +++ b/Dalamud/Game/Internal/Gui/TargetManagerAddressResolver.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Dalamud.Game.Internal.Gui { + class TargetManagerAddressResolver : BaseAddressResolver { + public IntPtr GetTarget { get; private set; } + + protected override void Setup64Bit(SigScanner sig) { + this.GetTarget = sig.ScanText("40 57 48 83 EC 40 48 8B F9 48 8B 49 08 48 8B 01 FF 50 40 66 83 B8 CA 81 00 00 00 74 33 48 8B 4F 08 48 8B 01 FF 50 40 66 83 B8 CA 81 00 00 04 74"); + } + } +} diff --git a/Dalamud/Game/Internal/Network/GameNetworkAddressResolver.cs b/Dalamud/Game/Internal/Network/GameNetworkAddressResolver.cs index 08868c3a4..02f76e865 100644 --- a/Dalamud/Game/Internal/Network/GameNetworkAddressResolver.cs +++ b/Dalamud/Game/Internal/Network/GameNetworkAddressResolver.cs @@ -5,7 +5,8 @@ namespace Dalamud.Game.Internal.Network { public IntPtr ProcessZonePacket { get; private set; } protected override void Setup64Bit(SigScanner sig) { - ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 7A FF 0F B7 57 02 8D 42 89 3D 5F 02 00 00 0F 87 60 01 00 00 4C 8D 05"); + //ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 7A FF 0F B7 57 02 8D 42 89 3D 5F 02 00 00 0F 87 60 01 00 00 4C 8D 05"); + ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 73 FF 0F B7 57 02 8D 42 ?? 3D ?? ?? 00 00 0F 87 60 01 00 00 4C 8D 05"); } } } From 6b5f8e6bed3f6c112f3297f11c06283a15b2daf9 Mon Sep 17 00:00:00 2001 From: goat Date: Sat, 2 Nov 2019 14:35:48 +0900 Subject: [PATCH 02/10] Don't try to do italics on messages with SE opcodes --- Dalamud.Injector/Program.cs | 2 +- Dalamud/Game/ChatHandlers.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dalamud.Injector/Program.cs b/Dalamud.Injector/Program.cs index dfa91a07f..75c0a8a75 100644 --- a/Dalamud.Injector/Program.cs +++ b/Dalamud.Injector/Program.cs @@ -19,7 +19,7 @@ namespace Dalamud.Injector { Process.GetCurrentProcess().Kill(); }; - int pid = int.Parse(args[0]); + var pid = int.Parse(args[0]); Process process = null; diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs index 158527216..4005107a4 100644 --- a/Dalamud/Game/ChatHandlers.cs +++ b/Dalamud/Game/ChatHandlers.cs @@ -92,8 +92,8 @@ namespace Dalamud.Game { .GetResult()); - if (this.HandledChatTypeColors.ContainsKey(type) || type == XivChatType.Say || type == XivChatType.Shout || - type == XivChatType.Alliance || type == XivChatType.TellOutgoing || type == XivChatType.Yell) { + if ((this.HandledChatTypeColors.ContainsKey(type) || type == XivChatType.Say || type == XivChatType.Shout || + type == XivChatType.Alliance || type == XivChatType.TellOutgoing || type == XivChatType.Yell) && !message.Contains((char)0x02)) { var italicsStart = message.IndexOf("*"); var italicsEnd = message.IndexOf("*", italicsStart + 1); From 75ed54117ccaf52ca0effb2644dd584620cdf716 Mon Sep 17 00:00:00 2001 From: goat Date: Sun, 3 Nov 2019 21:17:47 +0900 Subject: [PATCH 03/10] Some changes to Actor Table handling --- Dalamud/Dalamud.cs | 2 ++ Dalamud/Dalamud.csproj | 9 ++++---- Dalamud/Game/Chat/XivChatType.cs | 5 +++++ Dalamud/Game/ClientState/Actors/ActorTable.cs | 13 +++++++++--- Dalamud/Game/ClientState/ClientState.cs | 9 +++++++- Dalamud/Game/Internal/Gui/IconReplacer.cs | 21 +++++++------------ Dalamud/Game/Network/NetworkHandlers.cs | 14 ++++++------- Dalamud/XivApi.cs | 3 +++ 8 files changed, 46 insertions(+), 30 deletions(-) diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 52ec31e1c..3f756922a 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -346,6 +346,7 @@ namespace Dalamud { var argumentsParts = arguments.Split(); switch (argumentsParts[0]) { + /* Sorry! case "setall": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast()) { if (value == CustomComboPreset.None) @@ -393,6 +394,7 @@ namespace Dalamud { } } break; + */ case "list": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast()) { if (this.Configuration.ComboPresets.HasFlag(value)) diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index d96583d65..9a99ab4ff 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -7,15 +7,16 @@ Library - $(SolutionDir)/bin + D:\Sapphire\recorder\FFXIV.Recorder\/bin false true Portable true - 2.1.0.0 - 2.1.0 + 2.2.0.0 + 2.2.0 + 2.2.0.0 @@ -27,7 +28,7 @@ E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml - E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml + D:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml E:\Sapphire\recorder\FFXIV.Recorder\/bin\Dalamud.xml diff --git a/Dalamud/Game/Chat/XivChatType.cs b/Dalamud/Game/Chat/XivChatType.cs index d909947cb..a52584153 100644 --- a/Dalamud/Game/Chat/XivChatType.cs +++ b/Dalamud/Game/Chat/XivChatType.cs @@ -61,6 +61,11 @@ namespace Dalamud.Game.Chat { [XivChatTypeInfo("Novice Network", "nn", 0xFF8B4513)] NoviceNetwork = 27, + [XivChatTypeInfo("Custom Emotes", "nn", 0xFF8B4513)] + CustomEmote = 28, + [XivChatTypeInfo("Standard Emotes", null, 0xFF8B4513)] + StandardEmote = 29, + [XivChatTypeInfo("Yell", "y", 0xFFFFFF00)] Yell = 30, diff --git a/Dalamud/Game/ClientState/Actors/ActorTable.cs b/Dalamud/Game/ClientState/Actors/ActorTable.cs index d1dd88a92..2dd497bc4 100644 --- a/Dalamud/Game/ClientState/Actors/ActorTable.cs +++ b/Dalamud/Game/ClientState/Actors/ActorTable.cs @@ -9,7 +9,7 @@ namespace Dalamud.Game.ClientState.Actors { /// /// This collection represents the currently spawned FFXIV actors. /// - public unsafe class ActorTable : ICollection { + public class ActorTable : ICollection { private ClientStateAddressResolver Address { get; } /// @@ -29,8 +29,15 @@ namespace Dalamud.Game.ClientState.Actors { /// at the specified spawn index. public Actor this[int index] { get { + if (index > Length) + return null; + + Log.Information("Trying to get actor at {0}", index); var tblIndex = Address.ActorTable + 8 + index * 8; - var offset = *(IntPtr*) tblIndex; + + var offset = Marshal.ReadIntPtr(tblIndex); + + Log.Information("Actor at {0}", offset.ToString()); if (offset == IntPtr.Zero) throw new Exception($"Actor slot at index {index} is invalid"); @@ -76,7 +83,7 @@ namespace Dalamud.Game.ClientState.Actors { /// /// The amount of currently spawned actors. /// - public int Length => *(int*) Address.ActorTable; + public int Length => Marshal.ReadInt32(Address.ActorTable); int ICollection.Count => Length; diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index 98e1c2e29..e0e038382 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -32,7 +32,7 @@ namespace Dalamud.Game.ClientState /// /// The local player character, if one is present. /// - public PlayerCharacter LocalPlayer => (PlayerCharacter) this.Actors[0]; + public PlayerCharacter LocalPlayer { get; private set; } /// /// The content ID of the local character. @@ -62,6 +62,13 @@ namespace Dalamud.Game.ClientState this.Actors = new ActorTable(Address); this.JobGauges = new JobGauges(Address); + + dalamud.Framework.OnUpdateEvent += FrameworkOnOnUpdateEvent; + } + + private void FrameworkOnOnUpdateEvent(Framework framework) { + LocalPlayer = (PlayerCharacter) this.Actors[0]; + Log.Verbose("FRAMEWORK UPDATE"); } } } diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 069af81a8..40630cab0 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -24,7 +24,6 @@ namespace Dalamud.Game.Internal.Gui { private IntPtr jobInfo; private IntPtr byteBase; private Dalamud dalamud; - private PlayerCharacter localCharacter = null; public unsafe IconReplacer(Dalamud dalamud, SigScanner scanner) { this.dalamud = dalamud; @@ -68,12 +67,13 @@ namespace Dalamud.Game.Internal.Gui { /// For example, Souleater combo on DRK happens by dragging Souleater /// onto your bar and mashing it. /// - private unsafe ulong GetIconDetour(byte self, uint actionID) { + private ulong GetIconDetour(byte self, uint actionID) { // TODO: More jobs, level checking for everything. // Check if player is loaded in by trying to get their buffs. // If not, skip everything until we are (game will crash cause I'm lazy). + /* if (activeBuffArray == IntPtr.Zero) { try { activeBuffArray = FindBuffAddress(); @@ -84,24 +84,16 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } } + */ // TODO: this is currently broken // As it stands, don't rely on localCharacter.level for anything. - if (localCharacter == null) { - try { - localCharacter = dalamud.ClientState.LocalPlayer; - } - catch(Exception e) { - localCharacter = null; - return this.iconHook.Original(self, actionID); - } - } + var localPlayer = this.dalamud.ClientState.LocalPlayer; // Don't clutter the spaghetti any worse than it already is. var lastMove = Marshal.ReadInt32(this.lastComboMove); var comboTime = Marshal.ReadInt32(this.comboTimer); - this.localCharacter = this.dalamud.ClientState.LocalPlayer; - var level = this.localCharacter.Level; + var level = 80; // DRAGOON // TODO: Jump/High Jump into Mirage Dive @@ -838,10 +830,11 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } - private bool SearchBuffArray(short needle) { + private bool SearchBuffArray(short needle) {/* for (int i = 0; i < 60; i++) { if (Marshal.ReadInt16(activeBuffArray + 4 * i) == needle) return true; } + */ return false; } diff --git a/Dalamud/Game/Network/NetworkHandlers.cs b/Dalamud/Game/Network/NetworkHandlers.cs index eea77eb4c..ba3a636ac 100644 --- a/Dalamud/Game/Network/NetworkHandlers.cs +++ b/Dalamud/Game/Network/NetworkHandlers.cs @@ -64,18 +64,16 @@ namespace Dalamud.Game.Network { Marshal.Copy(dataPtr, data, 0, 64); var notifyType = data[16]; - var contentFinderConditionId = BitConverter.ToInt16(data, 38); + var contentFinderConditionId = BitConverter.ToInt16(data, 28); Task.Run(async () => { - if (notifyType != 4) + if (notifyType != 2 || contentFinderConditionId == 0) return; var contentFinderCondition = await XivApi.GetContentFinderCondition(contentFinderConditionId); - this.dalamud.Framework.Gui.Chat.Print("Duty Finder pop: " + contentFinderCondition["Name"]); - if (this.dalamud.BotManager.IsConnected) await this.dalamud.BotManager.ProcessCfPop(contentFinderCondition); }); @@ -179,13 +177,13 @@ namespace Dalamud.Game.Network { } private enum ZoneOpCode { - CfNotify = 0x78, + CfNotify = 0x8F, RetainerSaleItemId = 0x13F, // TODO these are probably not accurate RetainerSaleFinish = 0x138, FateSpawn = 0x226, - MarketBoardItemRequestStart = 0x13B, - MarketBoardOfferings = 0x13C, - MarketBoardHistory = 0x140 + MarketBoardItemRequestStart = 0x39D, + MarketBoardOfferings = 0x36A, + MarketBoardHistory = 0x194 } } } diff --git a/Dalamud/XivApi.cs b/Dalamud/XivApi.cs index 6515541a5..dc5e5fa8b 100644 --- a/Dalamud/XivApi.cs +++ b/Dalamud/XivApi.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.CSharp.RuntimeBinder; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Serilog; namespace Dalamud { @@ -68,6 +69,8 @@ namespace Dalamud public static async Task Get(string endpoint, bool noCache = false) { + Log.Verbose("XIVAPI FETCH: {0}", endpoint); + if (cachedResponses.ContainsKey(endpoint) && !noCache) return cachedResponses[endpoint]; From c7291743b262c22385fdc1c05a5155897a9bac87 Mon Sep 17 00:00:00 2001 From: attick Date: Wed, 6 Nov 2019 18:38:18 -0500 Subject: [PATCH 04/10] Cursed Dictionary to speed icon replacement function. --- Dalamud/Dalamud.csproj | 2 +- Dalamud/Game/Internal/Gui/IconReplacer.cs | 247 ++++++++++++++++++++++ 2 files changed, 248 insertions(+), 1 deletion(-) diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 9a99ab4ff..9ef9364a2 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -7,7 +7,7 @@ Library - D:\Sapphire\recorder\FFXIV.Recorder\/bin + false true Portable diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 40630cab0..7918c199a 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -4,6 +4,7 @@ using Dalamud.Game.ClientState.Structs.JobGauge; using Dalamud.Hooking; using Serilog; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; using XIVLauncher.Dalamud; @@ -25,6 +26,8 @@ namespace Dalamud.Game.Internal.Gui { private IntPtr byteBase; private Dalamud dalamud; + private Dictionary UsedIDs; + public unsafe IconReplacer(Dalamud dalamud, SigScanner scanner) { this.dalamud = dalamud; this.Address = new IconReplacerAddressResolver(); @@ -34,6 +37,10 @@ namespace Dalamud.Game.Internal.Gui { this.comboTimer = byteBase + 0x1BB5B50; this.lastComboMove = byteBase + 0x1BB5B54; + UsedIDs = new Dictionary(); + + PopulateDict(); + Log.Verbose("===== H O T B A R S ====="); Log.Verbose("IsIconReplaceable address {IsIconReplaceable}", Address.IsIconReplaceable); Log.Verbose("GetIcon address {GetIcon}", Address.GetIcon); @@ -86,6 +93,8 @@ namespace Dalamud.Game.Internal.Gui { } */ + if (!this.UsedIDs.ContainsKey(actionID)) return actionID; + // TODO: this is currently broken // As it stands, don't rely on localCharacter.level for anything. var localPlayer = this.dalamud.ClientState.LocalPlayer; @@ -848,5 +857,243 @@ namespace Dalamud.Game.Internal.Gui { var callback = Marshal.GetDelegateForFunctionPointer(step3); return (IntPtr)callback((long*)num); } + + private void PopulateDict() { + + UsedIDs.Add(16477, true); + UsedIDs.Add(88, true); + UsedIDs.Add(84, true); + UsedIDs.Add(3632, true); + UsedIDs.Add(16468, true); + UsedIDs.Add(3538, true); + UsedIDs.Add(3539, true); + UsedIDs.Add(16457, true); + UsedIDs.Add(42, true); + UsedIDs.Add(45, true); + UsedIDs.Add(16462, true); + UsedIDs.Add(7480, true); + UsedIDs.Add(7481, true); + UsedIDs.Add(7482, true); + UsedIDs.Add(7484, true); + UsedIDs.Add(7485, true); + UsedIDs.Add(3563, true); + UsedIDs.Add(2255, true); + UsedIDs.Add(16488, true); + UsedIDs.Add(16145, true); + UsedIDs.Add(16146, true); + UsedIDs.Add(16149, true); + UsedIDs.Add(7413, true); + UsedIDs.Add(2870, true); + UsedIDs.Add(3575, true); + UsedIDs.Add(149, true); + UsedIDs.Add(17055, true); + UsedIDs.Add(3582, true); + UsedIDs.Add(3581, true); + UsedIDs.Add(163, true); + UsedIDs.Add(16508, true); + UsedIDs.Add(16510, true); + UsedIDs.Add(16543, true); + UsedIDs.Add(167, true); + UsedIDs.Add(15994, true); + UsedIDs.Add(15993, true); + UsedIDs.Add(16007, true); + UsedIDs.Add(16008, true); + UsedIDs.Add(16531, true); + UsedIDs.Add(16534, true); + UsedIDs.Add(3559, true); + UsedIDs.Add(97, true); + UsedIDs.Add(16525, true); + UsedIDs.Add(16524, true); + UsedIDs.Add(7516, true); + UsedIDs.Add(0x3e75, true); + UsedIDs.Add(0x3e76, true); + UsedIDs.Add(0x3e77, true); + UsedIDs.Add(0x3e78, true); + UsedIDs.Add(0x3e7d, true); + UsedIDs.Add(0x3e7e, true); + UsedIDs.Add(0x3e86, true); + UsedIDs.Add(0x3f10, true); + UsedIDs.Add(0x3f25, true); + UsedIDs.Add(0x3f1b, true); + UsedIDs.Add(0x3f1c, true); + UsedIDs.Add(0x3f1d, true); + UsedIDs.Add(0x3f1e, true); + UsedIDs.Add(0x451f, true); + UsedIDs.Add(0x42ff, true); + UsedIDs.Add(0x4300, true); + UsedIDs.Add(0x49d4, true); + UsedIDs.Add(0x49d5, true); + UsedIDs.Add(0x49e9, true); + UsedIDs.Add(0x49ea, true); + UsedIDs.Add(0x49f4, true); + UsedIDs.Add(0x49f7, true); + UsedIDs.Add(0x49f9, true); + UsedIDs.Add(0x4a06, true); + UsedIDs.Add(0x4a31, true); + UsedIDs.Add(0x4a32, true); + UsedIDs.Add(0x4a35, true); + UsedIDs.Add(0x4792, true); + UsedIDs.Add(0x452f, true); + UsedIDs.Add(0x453f, true); + UsedIDs.Add(0x454c, true); + UsedIDs.Add(0x455c, true); + UsedIDs.Add(0x455d, true); + UsedIDs.Add(0x4561, true); + UsedIDs.Add(0x4565, true); + UsedIDs.Add(0x4566, true); + UsedIDs.Add(0x45a0, true); + UsedIDs.Add(0x45c8, true); + UsedIDs.Add(0x45c9, true); + UsedIDs.Add(0x45cd, true); + UsedIDs.Add(0x4197, true); + UsedIDs.Add(0x4199, true); + UsedIDs.Add(0x419b, true); + UsedIDs.Add(0x419d, true); + UsedIDs.Add(0x419f, true); + UsedIDs.Add(0x4198, true); + UsedIDs.Add(0x419a, true); + UsedIDs.Add(0x419c, true); + UsedIDs.Add(0x419e, true); + UsedIDs.Add(0x41a0, true); + UsedIDs.Add(0x41a1, true); + UsedIDs.Add(0x41a2, true); + UsedIDs.Add(0x41a3, true); + UsedIDs.Add(0x417e, true); + UsedIDs.Add(0x404f, true); + UsedIDs.Add(0x4051, true); + UsedIDs.Add(0x4052, true); + UsedIDs.Add(0x4055, true); + UsedIDs.Add(0x4053, true); + UsedIDs.Add(0x4056, true); + UsedIDs.Add(0x405e, true); + UsedIDs.Add(0x405f, true); + UsedIDs.Add(0x4063, true); + UsedIDs.Add(0x406f, true); + UsedIDs.Add(0x4074, true); + UsedIDs.Add(0x4075, true); + UsedIDs.Add(0x4076, true); + UsedIDs.Add(0x407d, true); + UsedIDs.Add(0x407f, true); + UsedIDs.Add(0x4083, true); + UsedIDs.Add(0x4080, true); + UsedIDs.Add(0x4081, true); + UsedIDs.Add(0x4082, true); + UsedIDs.Add(0x4084, true); + UsedIDs.Add(0x408e, true); + UsedIDs.Add(0x4091, true); + UsedIDs.Add(0x4092, true); + UsedIDs.Add(0x4094, true); + UsedIDs.Add(0x4095, true); + UsedIDs.Add(0x409c, true); + UsedIDs.Add(0x409d, true); + UsedIDs.Add(0x40aa, true); + UsedIDs.Add(0x40ab, true); + UsedIDs.Add(0x40ad, true); + UsedIDs.Add(0x40ae, true); + UsedIDs.Add(0x272b, true); + UsedIDs.Add(0x222a, true); + UsedIDs.Add(0x222d, true); + UsedIDs.Add(0x222e, true); + UsedIDs.Add(0x223b, true); + UsedIDs.Add(0x2265, true); + UsedIDs.Add(0x2267, true); + UsedIDs.Add(0x2268, true); + UsedIDs.Add(0x2269, true); + UsedIDs.Add(0x2274, true); + UsedIDs.Add(0x2290, true); + UsedIDs.Add(0x2291, true); + UsedIDs.Add(0x2292, true); + UsedIDs.Add(0x229c, true); + UsedIDs.Add(0x229e, true); + UsedIDs.Add(0x22a8, true); + UsedIDs.Add(0x22b3, true); + UsedIDs.Add(0x22b5, true); + UsedIDs.Add(0x22b7, true); + UsedIDs.Add(0x22d1, true); + UsedIDs.Add(0x4575, true); + UsedIDs.Add(0x2335, true); + UsedIDs.Add(0x1ebb, true); + UsedIDs.Add(0x1cdd, true); + UsedIDs.Add(0x1cee, true); + UsedIDs.Add(0x1cef, true); + UsedIDs.Add(0x1cf1, true); + UsedIDs.Add(0x1cf3, true); + UsedIDs.Add(0x1cf4, true); + UsedIDs.Add(0x1cf7, true); + UsedIDs.Add(0x1cfc, true); + UsedIDs.Add(0x1d17, true); + UsedIDs.Add(0x1d00, true); + UsedIDs.Add(0x1d01, true); + UsedIDs.Add(0x1d05, true); + UsedIDs.Add(0x1d07, true); + UsedIDs.Add(0x1d0b, true); + UsedIDs.Add(0x1d0d, true); + UsedIDs.Add(0x1d0f, true); + UsedIDs.Add(0x1d12, true); + UsedIDs.Add(0x1d13, true); + UsedIDs.Add(0x1d4f, true); + UsedIDs.Add(0x1d64, true); + UsedIDs.Add(0x1d50, true); + UsedIDs.Add(0x1d58, true); + UsedIDs.Add(0x1d59, true); + UsedIDs.Add(0x1d51, true); + UsedIDs.Add(0x1d53, true); + UsedIDs.Add(0x1d66, true); + UsedIDs.Add(0x1d55, true); + UsedIDs.Add(0xdda, true); + UsedIDs.Add(0xddd, true); + UsedIDs.Add(0xdde, true); + UsedIDs.Add(0xde3, true); + UsedIDs.Add(0xdf0, true); + UsedIDs.Add(0xdfb, true); + UsedIDs.Add(0xe00, true); + UsedIDs.Add(0xe0b, true); + UsedIDs.Add(0xe0c, true); + UsedIDs.Add(0xe0e, true); + UsedIDs.Add(0xe0f, true); + UsedIDs.Add(0xe11, true); + UsedIDs.Add(0xfed, true); + UsedIDs.Add(0xff7, true); + UsedIDs.Add(0xffb, true); + UsedIDs.Add(0xfe9, true); + UsedIDs.Add(0xb30, true); + UsedIDs.Add(0x12e, true); + UsedIDs.Add(0x8d3, true); + UsedIDs.Add(0x8d4, true); + UsedIDs.Add(0x8d5, true); + UsedIDs.Add(0x8d7, true); + UsedIDs.Add(0xb32, true); + UsedIDs.Add(0xb34, true); + UsedIDs.Add(0xb38, true); + UsedIDs.Add(0xb39, true); + UsedIDs.Add(0xb3e, true); + UsedIDs.Add(0x12d, true); + UsedIDs.Add(0x15, true); + UsedIDs.Add(0x26, true); + UsedIDs.Add(0x31, true); + UsedIDs.Add(0x33, true); + UsedIDs.Add(0x4b, true); + UsedIDs.Add(0x5c, true); + UsedIDs.Add(0x62, true); + UsedIDs.Add(0x64, true); + UsedIDs.Add(0x71, true); + UsedIDs.Add(0x77, true); + UsedIDs.Add(0x7f, true); + UsedIDs.Add(0x79, true); + UsedIDs.Add(0x84, true); + UsedIDs.Add(0x90, true); + UsedIDs.Add(0x99, true); + UsedIDs.Add(0xa4, true); + UsedIDs.Add(0xb2, true); + UsedIDs.Add(0xa8, true); + UsedIDs.Add(0xac, true); + UsedIDs.Add(0xb8, true); + UsedIDs.Add(0xe2, true); + UsedIDs.Add(0x10f, true); + UsedIDs.Add(0xf3, true); + UsedIDs.Add(0x10e, true); + UsedIDs.Add(0x110, true); + UsedIDs.Add(0x111, true); + } } } From 36670456d5ae83bbf050b32283449a04424a4ad7 Mon Sep 17 00:00:00 2001 From: attick Date: Wed, 6 Nov 2019 19:44:18 -0500 Subject: [PATCH 05/10] Swap from Dictionary to Hashset. --- Dalamud/Game/Internal/Gui/IconReplacer.cs | 474 +++++++++++----------- 1 file changed, 237 insertions(+), 237 deletions(-) diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 7918c199a..4ccb5d1ed 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -26,7 +26,7 @@ namespace Dalamud.Game.Internal.Gui { private IntPtr byteBase; private Dalamud dalamud; - private Dictionary UsedIDs; + private HashSet UsedIDs; public unsafe IconReplacer(Dalamud dalamud, SigScanner scanner) { this.dalamud = dalamud; @@ -37,7 +37,7 @@ namespace Dalamud.Game.Internal.Gui { this.comboTimer = byteBase + 0x1BB5B50; this.lastComboMove = byteBase + 0x1BB5B54; - UsedIDs = new Dictionary(); + UsedIDs = new HashSet(); PopulateDict(); @@ -93,7 +93,7 @@ namespace Dalamud.Game.Internal.Gui { } */ - if (!this.UsedIDs.ContainsKey(actionID)) return actionID; + if (!this.UsedIDs.Contains(actionID)) return actionID; // TODO: this is currently broken // As it stands, don't rely on localCharacter.level for anything. @@ -860,240 +860,240 @@ namespace Dalamud.Game.Internal.Gui { private void PopulateDict() { - UsedIDs.Add(16477, true); - UsedIDs.Add(88, true); - UsedIDs.Add(84, true); - UsedIDs.Add(3632, true); - UsedIDs.Add(16468, true); - UsedIDs.Add(3538, true); - UsedIDs.Add(3539, true); - UsedIDs.Add(16457, true); - UsedIDs.Add(42, true); - UsedIDs.Add(45, true); - UsedIDs.Add(16462, true); - UsedIDs.Add(7480, true); - UsedIDs.Add(7481, true); - UsedIDs.Add(7482, true); - UsedIDs.Add(7484, true); - UsedIDs.Add(7485, true); - UsedIDs.Add(3563, true); - UsedIDs.Add(2255, true); - UsedIDs.Add(16488, true); - UsedIDs.Add(16145, true); - UsedIDs.Add(16146, true); - UsedIDs.Add(16149, true); - UsedIDs.Add(7413, true); - UsedIDs.Add(2870, true); - UsedIDs.Add(3575, true); - UsedIDs.Add(149, true); - UsedIDs.Add(17055, true); - UsedIDs.Add(3582, true); - UsedIDs.Add(3581, true); - UsedIDs.Add(163, true); - UsedIDs.Add(16508, true); - UsedIDs.Add(16510, true); - UsedIDs.Add(16543, true); - UsedIDs.Add(167, true); - UsedIDs.Add(15994, true); - UsedIDs.Add(15993, true); - UsedIDs.Add(16007, true); - UsedIDs.Add(16008, true); - UsedIDs.Add(16531, true); - UsedIDs.Add(16534, true); - UsedIDs.Add(3559, true); - UsedIDs.Add(97, true); - UsedIDs.Add(16525, true); - UsedIDs.Add(16524, true); - UsedIDs.Add(7516, true); - UsedIDs.Add(0x3e75, true); - UsedIDs.Add(0x3e76, true); - UsedIDs.Add(0x3e77, true); - UsedIDs.Add(0x3e78, true); - UsedIDs.Add(0x3e7d, true); - UsedIDs.Add(0x3e7e, true); - UsedIDs.Add(0x3e86, true); - UsedIDs.Add(0x3f10, true); - UsedIDs.Add(0x3f25, true); - UsedIDs.Add(0x3f1b, true); - UsedIDs.Add(0x3f1c, true); - UsedIDs.Add(0x3f1d, true); - UsedIDs.Add(0x3f1e, true); - UsedIDs.Add(0x451f, true); - UsedIDs.Add(0x42ff, true); - UsedIDs.Add(0x4300, true); - UsedIDs.Add(0x49d4, true); - UsedIDs.Add(0x49d5, true); - UsedIDs.Add(0x49e9, true); - UsedIDs.Add(0x49ea, true); - UsedIDs.Add(0x49f4, true); - UsedIDs.Add(0x49f7, true); - UsedIDs.Add(0x49f9, true); - UsedIDs.Add(0x4a06, true); - UsedIDs.Add(0x4a31, true); - UsedIDs.Add(0x4a32, true); - UsedIDs.Add(0x4a35, true); - UsedIDs.Add(0x4792, true); - UsedIDs.Add(0x452f, true); - UsedIDs.Add(0x453f, true); - UsedIDs.Add(0x454c, true); - UsedIDs.Add(0x455c, true); - UsedIDs.Add(0x455d, true); - UsedIDs.Add(0x4561, true); - UsedIDs.Add(0x4565, true); - UsedIDs.Add(0x4566, true); - UsedIDs.Add(0x45a0, true); - UsedIDs.Add(0x45c8, true); - UsedIDs.Add(0x45c9, true); - UsedIDs.Add(0x45cd, true); - UsedIDs.Add(0x4197, true); - UsedIDs.Add(0x4199, true); - UsedIDs.Add(0x419b, true); - UsedIDs.Add(0x419d, true); - UsedIDs.Add(0x419f, true); - UsedIDs.Add(0x4198, true); - UsedIDs.Add(0x419a, true); - UsedIDs.Add(0x419c, true); - UsedIDs.Add(0x419e, true); - UsedIDs.Add(0x41a0, true); - UsedIDs.Add(0x41a1, true); - UsedIDs.Add(0x41a2, true); - UsedIDs.Add(0x41a3, true); - UsedIDs.Add(0x417e, true); - UsedIDs.Add(0x404f, true); - UsedIDs.Add(0x4051, true); - UsedIDs.Add(0x4052, true); - UsedIDs.Add(0x4055, true); - UsedIDs.Add(0x4053, true); - UsedIDs.Add(0x4056, true); - UsedIDs.Add(0x405e, true); - UsedIDs.Add(0x405f, true); - UsedIDs.Add(0x4063, true); - UsedIDs.Add(0x406f, true); - UsedIDs.Add(0x4074, true); - UsedIDs.Add(0x4075, true); - UsedIDs.Add(0x4076, true); - UsedIDs.Add(0x407d, true); - UsedIDs.Add(0x407f, true); - UsedIDs.Add(0x4083, true); - UsedIDs.Add(0x4080, true); - UsedIDs.Add(0x4081, true); - UsedIDs.Add(0x4082, true); - UsedIDs.Add(0x4084, true); - UsedIDs.Add(0x408e, true); - UsedIDs.Add(0x4091, true); - UsedIDs.Add(0x4092, true); - UsedIDs.Add(0x4094, true); - UsedIDs.Add(0x4095, true); - UsedIDs.Add(0x409c, true); - UsedIDs.Add(0x409d, true); - UsedIDs.Add(0x40aa, true); - UsedIDs.Add(0x40ab, true); - UsedIDs.Add(0x40ad, true); - UsedIDs.Add(0x40ae, true); - UsedIDs.Add(0x272b, true); - UsedIDs.Add(0x222a, true); - UsedIDs.Add(0x222d, true); - UsedIDs.Add(0x222e, true); - UsedIDs.Add(0x223b, true); - UsedIDs.Add(0x2265, true); - UsedIDs.Add(0x2267, true); - UsedIDs.Add(0x2268, true); - UsedIDs.Add(0x2269, true); - UsedIDs.Add(0x2274, true); - UsedIDs.Add(0x2290, true); - UsedIDs.Add(0x2291, true); - UsedIDs.Add(0x2292, true); - UsedIDs.Add(0x229c, true); - UsedIDs.Add(0x229e, true); - UsedIDs.Add(0x22a8, true); - UsedIDs.Add(0x22b3, true); - UsedIDs.Add(0x22b5, true); - UsedIDs.Add(0x22b7, true); - UsedIDs.Add(0x22d1, true); - UsedIDs.Add(0x4575, true); - UsedIDs.Add(0x2335, true); - UsedIDs.Add(0x1ebb, true); - UsedIDs.Add(0x1cdd, true); - UsedIDs.Add(0x1cee, true); - UsedIDs.Add(0x1cef, true); - UsedIDs.Add(0x1cf1, true); - UsedIDs.Add(0x1cf3, true); - UsedIDs.Add(0x1cf4, true); - UsedIDs.Add(0x1cf7, true); - UsedIDs.Add(0x1cfc, true); - UsedIDs.Add(0x1d17, true); - UsedIDs.Add(0x1d00, true); - UsedIDs.Add(0x1d01, true); - UsedIDs.Add(0x1d05, true); - UsedIDs.Add(0x1d07, true); - UsedIDs.Add(0x1d0b, true); - UsedIDs.Add(0x1d0d, true); - UsedIDs.Add(0x1d0f, true); - UsedIDs.Add(0x1d12, true); - UsedIDs.Add(0x1d13, true); - UsedIDs.Add(0x1d4f, true); - UsedIDs.Add(0x1d64, true); - UsedIDs.Add(0x1d50, true); - UsedIDs.Add(0x1d58, true); - UsedIDs.Add(0x1d59, true); - UsedIDs.Add(0x1d51, true); - UsedIDs.Add(0x1d53, true); - UsedIDs.Add(0x1d66, true); - UsedIDs.Add(0x1d55, true); - UsedIDs.Add(0xdda, true); - UsedIDs.Add(0xddd, true); - UsedIDs.Add(0xdde, true); - UsedIDs.Add(0xde3, true); - UsedIDs.Add(0xdf0, true); - UsedIDs.Add(0xdfb, true); - UsedIDs.Add(0xe00, true); - UsedIDs.Add(0xe0b, true); - UsedIDs.Add(0xe0c, true); - UsedIDs.Add(0xe0e, true); - UsedIDs.Add(0xe0f, true); - UsedIDs.Add(0xe11, true); - UsedIDs.Add(0xfed, true); - UsedIDs.Add(0xff7, true); - UsedIDs.Add(0xffb, true); - UsedIDs.Add(0xfe9, true); - UsedIDs.Add(0xb30, true); - UsedIDs.Add(0x12e, true); - UsedIDs.Add(0x8d3, true); - UsedIDs.Add(0x8d4, true); - UsedIDs.Add(0x8d5, true); - UsedIDs.Add(0x8d7, true); - UsedIDs.Add(0xb32, true); - UsedIDs.Add(0xb34, true); - UsedIDs.Add(0xb38, true); - UsedIDs.Add(0xb39, true); - UsedIDs.Add(0xb3e, true); - UsedIDs.Add(0x12d, true); - UsedIDs.Add(0x15, true); - UsedIDs.Add(0x26, true); - UsedIDs.Add(0x31, true); - UsedIDs.Add(0x33, true); - UsedIDs.Add(0x4b, true); - UsedIDs.Add(0x5c, true); - UsedIDs.Add(0x62, true); - UsedIDs.Add(0x64, true); - UsedIDs.Add(0x71, true); - UsedIDs.Add(0x77, true); - UsedIDs.Add(0x7f, true); - UsedIDs.Add(0x79, true); - UsedIDs.Add(0x84, true); - UsedIDs.Add(0x90, true); - UsedIDs.Add(0x99, true); - UsedIDs.Add(0xa4, true); - UsedIDs.Add(0xb2, true); - UsedIDs.Add(0xa8, true); - UsedIDs.Add(0xac, true); - UsedIDs.Add(0xb8, true); - UsedIDs.Add(0xe2, true); - UsedIDs.Add(0x10f, true); - UsedIDs.Add(0xf3, true); - UsedIDs.Add(0x10e, true); - UsedIDs.Add(0x110, true); - UsedIDs.Add(0x111, true); + UsedIDs.Add(16477); + UsedIDs.Add(88); + UsedIDs.Add(84); + UsedIDs.Add(3632); + UsedIDs.Add(16468); + UsedIDs.Add(3538); + UsedIDs.Add(3539); + UsedIDs.Add(16457); + UsedIDs.Add(42); + UsedIDs.Add(45); + UsedIDs.Add(16462); + UsedIDs.Add(7480); + UsedIDs.Add(7481); + UsedIDs.Add(7482); + UsedIDs.Add(7484); + UsedIDs.Add(7485); + UsedIDs.Add(3563); + UsedIDs.Add(2255); + UsedIDs.Add(16488); + UsedIDs.Add(16145); + UsedIDs.Add(16146); + UsedIDs.Add(16149); + UsedIDs.Add(7413); + UsedIDs.Add(2870); + UsedIDs.Add(3575); + UsedIDs.Add(149); + UsedIDs.Add(17055); + UsedIDs.Add(3582); + UsedIDs.Add(3581); + UsedIDs.Add(163); + UsedIDs.Add(16508); + UsedIDs.Add(16510); + UsedIDs.Add(16543); + UsedIDs.Add(167); + UsedIDs.Add(15994); + UsedIDs.Add(15993); + UsedIDs.Add(16007); + UsedIDs.Add(16008); + UsedIDs.Add(16531); + UsedIDs.Add(16534); + UsedIDs.Add(3559); + UsedIDs.Add(97); + UsedIDs.Add(16525); + UsedIDs.Add(16524); + UsedIDs.Add(7516); + UsedIDs.Add(0x3e75); + UsedIDs.Add(0x3e76); + UsedIDs.Add(0x3e77); + UsedIDs.Add(0x3e78); + UsedIDs.Add(0x3e7d); + UsedIDs.Add(0x3e7e); + UsedIDs.Add(0x3e86); + UsedIDs.Add(0x3f10); + UsedIDs.Add(0x3f25); + UsedIDs.Add(0x3f1b); + UsedIDs.Add(0x3f1c); + UsedIDs.Add(0x3f1d); + UsedIDs.Add(0x3f1e); + UsedIDs.Add(0x451f); + UsedIDs.Add(0x42ff); + UsedIDs.Add(0x4300); + UsedIDs.Add(0x49d4); + UsedIDs.Add(0x49d5); + UsedIDs.Add(0x49e9); + UsedIDs.Add(0x49ea); + UsedIDs.Add(0x49f4); + UsedIDs.Add(0x49f7); + UsedIDs.Add(0x49f9); + UsedIDs.Add(0x4a06); + UsedIDs.Add(0x4a31); + UsedIDs.Add(0x4a32); + UsedIDs.Add(0x4a35); + UsedIDs.Add(0x4792); + UsedIDs.Add(0x452f); + UsedIDs.Add(0x453f); + UsedIDs.Add(0x454c); + UsedIDs.Add(0x455c); + UsedIDs.Add(0x455d); + UsedIDs.Add(0x4561); + UsedIDs.Add(0x4565); + UsedIDs.Add(0x4566); + UsedIDs.Add(0x45a0); + UsedIDs.Add(0x45c8); + UsedIDs.Add(0x45c9); + UsedIDs.Add(0x45cd); + UsedIDs.Add(0x4197); + UsedIDs.Add(0x4199); + UsedIDs.Add(0x419b); + UsedIDs.Add(0x419d); + UsedIDs.Add(0x419f); + UsedIDs.Add(0x4198); + UsedIDs.Add(0x419a); + UsedIDs.Add(0x419c); + UsedIDs.Add(0x419e); + UsedIDs.Add(0x41a0); + UsedIDs.Add(0x41a1); + UsedIDs.Add(0x41a2); + UsedIDs.Add(0x41a3); + UsedIDs.Add(0x417e); + UsedIDs.Add(0x404f); + UsedIDs.Add(0x4051); + UsedIDs.Add(0x4052); + UsedIDs.Add(0x4055); + UsedIDs.Add(0x4053); + UsedIDs.Add(0x4056); + UsedIDs.Add(0x405e); + UsedIDs.Add(0x405f); + UsedIDs.Add(0x4063); + UsedIDs.Add(0x406f); + UsedIDs.Add(0x4074); + UsedIDs.Add(0x4075); + UsedIDs.Add(0x4076); + UsedIDs.Add(0x407d); + UsedIDs.Add(0x407f); + UsedIDs.Add(0x4083); + UsedIDs.Add(0x4080); + UsedIDs.Add(0x4081); + UsedIDs.Add(0x4082); + UsedIDs.Add(0x4084); + UsedIDs.Add(0x408e); + UsedIDs.Add(0x4091); + UsedIDs.Add(0x4092); + UsedIDs.Add(0x4094); + UsedIDs.Add(0x4095); + UsedIDs.Add(0x409c); + UsedIDs.Add(0x409d); + UsedIDs.Add(0x40aa); + UsedIDs.Add(0x40ab); + UsedIDs.Add(0x40ad); + UsedIDs.Add(0x40ae); + UsedIDs.Add(0x272b); + UsedIDs.Add(0x222a); + UsedIDs.Add(0x222d); + UsedIDs.Add(0x222e); + UsedIDs.Add(0x223b); + UsedIDs.Add(0x2265); + UsedIDs.Add(0x2267); + UsedIDs.Add(0x2268); + UsedIDs.Add(0x2269); + UsedIDs.Add(0x2274); + UsedIDs.Add(0x2290); + UsedIDs.Add(0x2291); + UsedIDs.Add(0x2292); + UsedIDs.Add(0x229c); + UsedIDs.Add(0x229e); + UsedIDs.Add(0x22a8); + UsedIDs.Add(0x22b3); + UsedIDs.Add(0x22b5); + UsedIDs.Add(0x22b7); + UsedIDs.Add(0x22d1); + UsedIDs.Add(0x4575); + UsedIDs.Add(0x2335); + UsedIDs.Add(0x1ebb); + UsedIDs.Add(0x1cdd); + UsedIDs.Add(0x1cee); + UsedIDs.Add(0x1cef); + UsedIDs.Add(0x1cf1); + UsedIDs.Add(0x1cf3); + UsedIDs.Add(0x1cf4); + UsedIDs.Add(0x1cf7); + UsedIDs.Add(0x1cfc); + UsedIDs.Add(0x1d17); + UsedIDs.Add(0x1d00); + UsedIDs.Add(0x1d01); + UsedIDs.Add(0x1d05); + UsedIDs.Add(0x1d07); + UsedIDs.Add(0x1d0b); + UsedIDs.Add(0x1d0d); + UsedIDs.Add(0x1d0f); + UsedIDs.Add(0x1d12); + UsedIDs.Add(0x1d13); + UsedIDs.Add(0x1d4f); + UsedIDs.Add(0x1d64); + UsedIDs.Add(0x1d50); + UsedIDs.Add(0x1d58); + UsedIDs.Add(0x1d59); + UsedIDs.Add(0x1d51); + UsedIDs.Add(0x1d53); + UsedIDs.Add(0x1d66); + UsedIDs.Add(0x1d55); + UsedIDs.Add(0xdda); + UsedIDs.Add(0xddd); + UsedIDs.Add(0xdde); + UsedIDs.Add(0xde3); + UsedIDs.Add(0xdf0); + UsedIDs.Add(0xdfb); + UsedIDs.Add(0xe00); + UsedIDs.Add(0xe0b); + UsedIDs.Add(0xe0c); + UsedIDs.Add(0xe0e); + UsedIDs.Add(0xe0f); + UsedIDs.Add(0xe11); + UsedIDs.Add(0xfed); + UsedIDs.Add(0xff7); + UsedIDs.Add(0xffb); + UsedIDs.Add(0xfe9); + UsedIDs.Add(0xb30); + UsedIDs.Add(0x12e); + UsedIDs.Add(0x8d3); + UsedIDs.Add(0x8d4); + UsedIDs.Add(0x8d5); + UsedIDs.Add(0x8d7); + UsedIDs.Add(0xb32); + UsedIDs.Add(0xb34); + UsedIDs.Add(0xb38); + UsedIDs.Add(0xb39); + UsedIDs.Add(0xb3e); + UsedIDs.Add(0x12d); + UsedIDs.Add(0x15); + UsedIDs.Add(0x26); + UsedIDs.Add(0x31); + UsedIDs.Add(0x33); + UsedIDs.Add(0x4b); + UsedIDs.Add(0x5c); + UsedIDs.Add(0x62); + UsedIDs.Add(0x64); + UsedIDs.Add(0x71); + UsedIDs.Add(0x77); + UsedIDs.Add(0x7f); + UsedIDs.Add(0x79); + UsedIDs.Add(0x84); + UsedIDs.Add(0x90); + UsedIDs.Add(0x99); + UsedIDs.Add(0xa4); + UsedIDs.Add(0xb2); + UsedIDs.Add(0xa8); + UsedIDs.Add(0xac); + UsedIDs.Add(0xb8); + UsedIDs.Add(0xe2); + UsedIDs.Add(0x10f); + UsedIDs.Add(0xf3); + UsedIDs.Add(0x10e); + UsedIDs.Add(0x110); + UsedIDs.Add(0x111); } } } From f93842d5c600d3d4f9629f7d78dad489882b7613 Mon Sep 17 00:00:00 2001 From: attick Date: Thu, 7 Nov 2019 11:50:44 -0500 Subject: [PATCH 06/10] Separate vanilla icons from custom ones. --- Dalamud/Game/Internal/Gui/IconReplacer.cs | 484 +++++++++++----------- 1 file changed, 243 insertions(+), 241 deletions(-) diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 4ccb5d1ed..c831f8274 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -26,7 +26,8 @@ namespace Dalamud.Game.Internal.Gui { private IntPtr byteBase; private Dalamud dalamud; - private HashSet UsedIDs; + private HashSet CustomIDs; + private HashSet VanillaIDs; public unsafe IconReplacer(Dalamud dalamud, SigScanner scanner) { this.dalamud = dalamud; @@ -37,7 +38,8 @@ namespace Dalamud.Game.Internal.Gui { this.comboTimer = byteBase + 0x1BB5B50; this.lastComboMove = byteBase + 0x1BB5B54; - UsedIDs = new HashSet(); + CustomIDs = new HashSet(); + VanillaIDs = new HashSet(); PopulateDict(); @@ -80,7 +82,7 @@ namespace Dalamud.Game.Internal.Gui { // Check if player is loaded in by trying to get their buffs. // If not, skip everything until we are (game will crash cause I'm lazy). - /* + if (activeBuffArray == IntPtr.Zero) { try { activeBuffArray = FindBuffAddress(); @@ -91,9 +93,9 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } } - */ - if (!this.UsedIDs.Contains(actionID)) return actionID; + if (this.VanillaIDs.Contains(actionID)) return this.iconHook.Original(self, actionID); + if (!this.CustomIDs.Contains(actionID)) return actionID; // TODO: this is currently broken // As it stands, don't rely on localCharacter.level for anything. @@ -839,11 +841,11 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } - private bool SearchBuffArray(short needle) {/* + private bool SearchBuffArray(short needle) { for (int i = 0; i < 60; i++) { if (Marshal.ReadInt16(activeBuffArray + 4 * i) == needle) return true; } - */ + return false; } @@ -860,240 +862,240 @@ namespace Dalamud.Game.Internal.Gui { private void PopulateDict() { - UsedIDs.Add(16477); - UsedIDs.Add(88); - UsedIDs.Add(84); - UsedIDs.Add(3632); - UsedIDs.Add(16468); - UsedIDs.Add(3538); - UsedIDs.Add(3539); - UsedIDs.Add(16457); - UsedIDs.Add(42); - UsedIDs.Add(45); - UsedIDs.Add(16462); - UsedIDs.Add(7480); - UsedIDs.Add(7481); - UsedIDs.Add(7482); - UsedIDs.Add(7484); - UsedIDs.Add(7485); - UsedIDs.Add(3563); - UsedIDs.Add(2255); - UsedIDs.Add(16488); - UsedIDs.Add(16145); - UsedIDs.Add(16146); - UsedIDs.Add(16149); - UsedIDs.Add(7413); - UsedIDs.Add(2870); - UsedIDs.Add(3575); - UsedIDs.Add(149); - UsedIDs.Add(17055); - UsedIDs.Add(3582); - UsedIDs.Add(3581); - UsedIDs.Add(163); - UsedIDs.Add(16508); - UsedIDs.Add(16510); - UsedIDs.Add(16543); - UsedIDs.Add(167); - UsedIDs.Add(15994); - UsedIDs.Add(15993); - UsedIDs.Add(16007); - UsedIDs.Add(16008); - UsedIDs.Add(16531); - UsedIDs.Add(16534); - UsedIDs.Add(3559); - UsedIDs.Add(97); - UsedIDs.Add(16525); - UsedIDs.Add(16524); - UsedIDs.Add(7516); - UsedIDs.Add(0x3e75); - UsedIDs.Add(0x3e76); - UsedIDs.Add(0x3e77); - UsedIDs.Add(0x3e78); - UsedIDs.Add(0x3e7d); - UsedIDs.Add(0x3e7e); - UsedIDs.Add(0x3e86); - UsedIDs.Add(0x3f10); - UsedIDs.Add(0x3f25); - UsedIDs.Add(0x3f1b); - UsedIDs.Add(0x3f1c); - UsedIDs.Add(0x3f1d); - UsedIDs.Add(0x3f1e); - UsedIDs.Add(0x451f); - UsedIDs.Add(0x42ff); - UsedIDs.Add(0x4300); - UsedIDs.Add(0x49d4); - UsedIDs.Add(0x49d5); - UsedIDs.Add(0x49e9); - UsedIDs.Add(0x49ea); - UsedIDs.Add(0x49f4); - UsedIDs.Add(0x49f7); - UsedIDs.Add(0x49f9); - UsedIDs.Add(0x4a06); - UsedIDs.Add(0x4a31); - UsedIDs.Add(0x4a32); - UsedIDs.Add(0x4a35); - UsedIDs.Add(0x4792); - UsedIDs.Add(0x452f); - UsedIDs.Add(0x453f); - UsedIDs.Add(0x454c); - UsedIDs.Add(0x455c); - UsedIDs.Add(0x455d); - UsedIDs.Add(0x4561); - UsedIDs.Add(0x4565); - UsedIDs.Add(0x4566); - UsedIDs.Add(0x45a0); - UsedIDs.Add(0x45c8); - UsedIDs.Add(0x45c9); - UsedIDs.Add(0x45cd); - UsedIDs.Add(0x4197); - UsedIDs.Add(0x4199); - UsedIDs.Add(0x419b); - UsedIDs.Add(0x419d); - UsedIDs.Add(0x419f); - UsedIDs.Add(0x4198); - UsedIDs.Add(0x419a); - UsedIDs.Add(0x419c); - UsedIDs.Add(0x419e); - UsedIDs.Add(0x41a0); - UsedIDs.Add(0x41a1); - UsedIDs.Add(0x41a2); - UsedIDs.Add(0x41a3); - UsedIDs.Add(0x417e); - UsedIDs.Add(0x404f); - UsedIDs.Add(0x4051); - UsedIDs.Add(0x4052); - UsedIDs.Add(0x4055); - UsedIDs.Add(0x4053); - UsedIDs.Add(0x4056); - UsedIDs.Add(0x405e); - UsedIDs.Add(0x405f); - UsedIDs.Add(0x4063); - UsedIDs.Add(0x406f); - UsedIDs.Add(0x4074); - UsedIDs.Add(0x4075); - UsedIDs.Add(0x4076); - UsedIDs.Add(0x407d); - UsedIDs.Add(0x407f); - UsedIDs.Add(0x4083); - UsedIDs.Add(0x4080); - UsedIDs.Add(0x4081); - UsedIDs.Add(0x4082); - UsedIDs.Add(0x4084); - UsedIDs.Add(0x408e); - UsedIDs.Add(0x4091); - UsedIDs.Add(0x4092); - UsedIDs.Add(0x4094); - UsedIDs.Add(0x4095); - UsedIDs.Add(0x409c); - UsedIDs.Add(0x409d); - UsedIDs.Add(0x40aa); - UsedIDs.Add(0x40ab); - UsedIDs.Add(0x40ad); - UsedIDs.Add(0x40ae); - UsedIDs.Add(0x272b); - UsedIDs.Add(0x222a); - UsedIDs.Add(0x222d); - UsedIDs.Add(0x222e); - UsedIDs.Add(0x223b); - UsedIDs.Add(0x2265); - UsedIDs.Add(0x2267); - UsedIDs.Add(0x2268); - UsedIDs.Add(0x2269); - UsedIDs.Add(0x2274); - UsedIDs.Add(0x2290); - UsedIDs.Add(0x2291); - UsedIDs.Add(0x2292); - UsedIDs.Add(0x229c); - UsedIDs.Add(0x229e); - UsedIDs.Add(0x22a8); - UsedIDs.Add(0x22b3); - UsedIDs.Add(0x22b5); - UsedIDs.Add(0x22b7); - UsedIDs.Add(0x22d1); - UsedIDs.Add(0x4575); - UsedIDs.Add(0x2335); - UsedIDs.Add(0x1ebb); - UsedIDs.Add(0x1cdd); - UsedIDs.Add(0x1cee); - UsedIDs.Add(0x1cef); - UsedIDs.Add(0x1cf1); - UsedIDs.Add(0x1cf3); - UsedIDs.Add(0x1cf4); - UsedIDs.Add(0x1cf7); - UsedIDs.Add(0x1cfc); - UsedIDs.Add(0x1d17); - UsedIDs.Add(0x1d00); - UsedIDs.Add(0x1d01); - UsedIDs.Add(0x1d05); - UsedIDs.Add(0x1d07); - UsedIDs.Add(0x1d0b); - UsedIDs.Add(0x1d0d); - UsedIDs.Add(0x1d0f); - UsedIDs.Add(0x1d12); - UsedIDs.Add(0x1d13); - UsedIDs.Add(0x1d4f); - UsedIDs.Add(0x1d64); - UsedIDs.Add(0x1d50); - UsedIDs.Add(0x1d58); - UsedIDs.Add(0x1d59); - UsedIDs.Add(0x1d51); - UsedIDs.Add(0x1d53); - UsedIDs.Add(0x1d66); - UsedIDs.Add(0x1d55); - UsedIDs.Add(0xdda); - UsedIDs.Add(0xddd); - UsedIDs.Add(0xdde); - UsedIDs.Add(0xde3); - UsedIDs.Add(0xdf0); - UsedIDs.Add(0xdfb); - UsedIDs.Add(0xe00); - UsedIDs.Add(0xe0b); - UsedIDs.Add(0xe0c); - UsedIDs.Add(0xe0e); - UsedIDs.Add(0xe0f); - UsedIDs.Add(0xe11); - UsedIDs.Add(0xfed); - UsedIDs.Add(0xff7); - UsedIDs.Add(0xffb); - UsedIDs.Add(0xfe9); - UsedIDs.Add(0xb30); - UsedIDs.Add(0x12e); - UsedIDs.Add(0x8d3); - UsedIDs.Add(0x8d4); - UsedIDs.Add(0x8d5); - UsedIDs.Add(0x8d7); - UsedIDs.Add(0xb32); - UsedIDs.Add(0xb34); - UsedIDs.Add(0xb38); - UsedIDs.Add(0xb39); - UsedIDs.Add(0xb3e); - UsedIDs.Add(0x12d); - UsedIDs.Add(0x15); - UsedIDs.Add(0x26); - UsedIDs.Add(0x31); - UsedIDs.Add(0x33); - UsedIDs.Add(0x4b); - UsedIDs.Add(0x5c); - UsedIDs.Add(0x62); - UsedIDs.Add(0x64); - UsedIDs.Add(0x71); - UsedIDs.Add(0x77); - UsedIDs.Add(0x7f); - UsedIDs.Add(0x79); - UsedIDs.Add(0x84); - UsedIDs.Add(0x90); - UsedIDs.Add(0x99); - UsedIDs.Add(0xa4); - UsedIDs.Add(0xb2); - UsedIDs.Add(0xa8); - UsedIDs.Add(0xac); - UsedIDs.Add(0xb8); - UsedIDs.Add(0xe2); - UsedIDs.Add(0x10f); - UsedIDs.Add(0xf3); - UsedIDs.Add(0x10e); - UsedIDs.Add(0x110); - UsedIDs.Add(0x111); + CustomIDs.Add(16477); + CustomIDs.Add(88); + CustomIDs.Add(84); + CustomIDs.Add(3632); + CustomIDs.Add(16468); + CustomIDs.Add(3538); + CustomIDs.Add(3539); + CustomIDs.Add(16457); + CustomIDs.Add(42); + CustomIDs.Add(45); + CustomIDs.Add(16462); + CustomIDs.Add(7480); + CustomIDs.Add(7481); + CustomIDs.Add(7482); + CustomIDs.Add(7484); + CustomIDs.Add(7485); + CustomIDs.Add(3563); + CustomIDs.Add(2255); + CustomIDs.Add(16488); + CustomIDs.Add(16145); + CustomIDs.Add(16146); + CustomIDs.Add(16149); + CustomIDs.Add(7413); + CustomIDs.Add(2870); + CustomIDs.Add(3575); + CustomIDs.Add(149); + CustomIDs.Add(17055); + CustomIDs.Add(3582); + CustomIDs.Add(3581); + CustomIDs.Add(163); + CustomIDs.Add(16508); + CustomIDs.Add(16510); + CustomIDs.Add(16543); + CustomIDs.Add(167); + CustomIDs.Add(15994); + CustomIDs.Add(15993); + CustomIDs.Add(16007); + CustomIDs.Add(16008); + CustomIDs.Add(16531); + CustomIDs.Add(16534); + CustomIDs.Add(3559); + CustomIDs.Add(97); + CustomIDs.Add(16525); + CustomIDs.Add(16524); + CustomIDs.Add(7516); + VanillaIDs.Add(0x3e75); + VanillaIDs.Add(0x3e76); + VanillaIDs.Add(0x3e77); + VanillaIDs.Add(0x3e78); + VanillaIDs.Add(0x3e7d); + VanillaIDs.Add(0x3e7e); + VanillaIDs.Add(0x3e86); + VanillaIDs.Add(0x3f10); + VanillaIDs.Add(0x3f25); + VanillaIDs.Add(0x3f1b); + VanillaIDs.Add(0x3f1c); + VanillaIDs.Add(0x3f1d); + VanillaIDs.Add(0x3f1e); + VanillaIDs.Add(0x451f); + VanillaIDs.Add(0x42ff); + VanillaIDs.Add(0x4300); + VanillaIDs.Add(0x49d4); + VanillaIDs.Add(0x49d5); + VanillaIDs.Add(0x49e9); + VanillaIDs.Add(0x49ea); + VanillaIDs.Add(0x49f4); + VanillaIDs.Add(0x49f7); + VanillaIDs.Add(0x49f9); + VanillaIDs.Add(0x4a06); + VanillaIDs.Add(0x4a31); + VanillaIDs.Add(0x4a32); + VanillaIDs.Add(0x4a35); + VanillaIDs.Add(0x4792); + VanillaIDs.Add(0x452f); + VanillaIDs.Add(0x453f); + VanillaIDs.Add(0x454c); + VanillaIDs.Add(0x455c); + VanillaIDs.Add(0x455d); + VanillaIDs.Add(0x4561); + VanillaIDs.Add(0x4565); + VanillaIDs.Add(0x4566); + VanillaIDs.Add(0x45a0); + VanillaIDs.Add(0x45c8); + VanillaIDs.Add(0x45c9); + VanillaIDs.Add(0x45cd); + VanillaIDs.Add(0x4197); + VanillaIDs.Add(0x4199); + VanillaIDs.Add(0x419b); + VanillaIDs.Add(0x419d); + VanillaIDs.Add(0x419f); + VanillaIDs.Add(0x4198); + VanillaIDs.Add(0x419a); + VanillaIDs.Add(0x419c); + VanillaIDs.Add(0x419e); + VanillaIDs.Add(0x41a0); + VanillaIDs.Add(0x41a1); + VanillaIDs.Add(0x41a2); + VanillaIDs.Add(0x41a3); + VanillaIDs.Add(0x417e); + VanillaIDs.Add(0x404f); + VanillaIDs.Add(0x4051); + VanillaIDs.Add(0x4052); + VanillaIDs.Add(0x4055); + VanillaIDs.Add(0x4053); + VanillaIDs.Add(0x4056); + VanillaIDs.Add(0x405e); + VanillaIDs.Add(0x405f); + VanillaIDs.Add(0x4063); + VanillaIDs.Add(0x406f); + VanillaIDs.Add(0x4074); + VanillaIDs.Add(0x4075); + VanillaIDs.Add(0x4076); + VanillaIDs.Add(0x407d); + VanillaIDs.Add(0x407f); + VanillaIDs.Add(0x4083); + VanillaIDs.Add(0x4080); + VanillaIDs.Add(0x4081); + VanillaIDs.Add(0x4082); + VanillaIDs.Add(0x4084); + VanillaIDs.Add(0x408e); + VanillaIDs.Add(0x4091); + VanillaIDs.Add(0x4092); + VanillaIDs.Add(0x4094); + VanillaIDs.Add(0x4095); + VanillaIDs.Add(0x409c); + VanillaIDs.Add(0x409d); + VanillaIDs.Add(0x40aa); + VanillaIDs.Add(0x40ab); + VanillaIDs.Add(0x40ad); + VanillaIDs.Add(0x40ae); + VanillaIDs.Add(0x272b); + VanillaIDs.Add(0x222a); + VanillaIDs.Add(0x222d); + VanillaIDs.Add(0x222e); + VanillaIDs.Add(0x223b); + VanillaIDs.Add(0x2265); + VanillaIDs.Add(0x2267); + VanillaIDs.Add(0x2268); + VanillaIDs.Add(0x2269); + VanillaIDs.Add(0x2274); + VanillaIDs.Add(0x2290); + VanillaIDs.Add(0x2291); + VanillaIDs.Add(0x2292); + VanillaIDs.Add(0x229c); + VanillaIDs.Add(0x229e); + VanillaIDs.Add(0x22a8); + VanillaIDs.Add(0x22b3); + VanillaIDs.Add(0x22b5); + VanillaIDs.Add(0x22b7); + VanillaIDs.Add(0x22d1); + VanillaIDs.Add(0x4575); + VanillaIDs.Add(0x2335); + VanillaIDs.Add(0x1ebb); + VanillaIDs.Add(0x1cdd); + VanillaIDs.Add(0x1cee); + VanillaIDs.Add(0x1cef); + VanillaIDs.Add(0x1cf1); + VanillaIDs.Add(0x1cf3); + VanillaIDs.Add(0x1cf4); + VanillaIDs.Add(0x1cf7); + VanillaIDs.Add(0x1cfc); + VanillaIDs.Add(0x1d17); + VanillaIDs.Add(0x1d00); + VanillaIDs.Add(0x1d01); + VanillaIDs.Add(0x1d05); + VanillaIDs.Add(0x1d07); + VanillaIDs.Add(0x1d0b); + VanillaIDs.Add(0x1d0d); + VanillaIDs.Add(0x1d0f); + VanillaIDs.Add(0x1d12); + VanillaIDs.Add(0x1d13); + VanillaIDs.Add(0x1d4f); + VanillaIDs.Add(0x1d64); + VanillaIDs.Add(0x1d50); + VanillaIDs.Add(0x1d58); + VanillaIDs.Add(0x1d59); + VanillaIDs.Add(0x1d51); + VanillaIDs.Add(0x1d53); + VanillaIDs.Add(0x1d66); + VanillaIDs.Add(0x1d55); + VanillaIDs.Add(0xdda); + VanillaIDs.Add(0xddd); + VanillaIDs.Add(0xdde); + VanillaIDs.Add(0xde3); + VanillaIDs.Add(0xdf0); + VanillaIDs.Add(0xdfb); + VanillaIDs.Add(0xe00); + VanillaIDs.Add(0xe0b); + VanillaIDs.Add(0xe0c); + VanillaIDs.Add(0xe0e); + VanillaIDs.Add(0xe0f); + VanillaIDs.Add(0xe11); + VanillaIDs.Add(0xfed); + VanillaIDs.Add(0xff7); + VanillaIDs.Add(0xffb); + VanillaIDs.Add(0xfe9); + VanillaIDs.Add(0xb30); + VanillaIDs.Add(0x12e); + VanillaIDs.Add(0x8d3); + VanillaIDs.Add(0x8d4); + VanillaIDs.Add(0x8d5); + VanillaIDs.Add(0x8d7); + VanillaIDs.Add(0xb32); + VanillaIDs.Add(0xb34); + VanillaIDs.Add(0xb38); + VanillaIDs.Add(0xb39); + VanillaIDs.Add(0xb3e); + VanillaIDs.Add(0x12d); + VanillaIDs.Add(0x15); + VanillaIDs.Add(0x26); + VanillaIDs.Add(0x31); + VanillaIDs.Add(0x33); + VanillaIDs.Add(0x4b); + VanillaIDs.Add(0x5c); + VanillaIDs.Add(0x62); + VanillaIDs.Add(0x64); + VanillaIDs.Add(0x71); + VanillaIDs.Add(0x77); + VanillaIDs.Add(0x7f); + VanillaIDs.Add(0x79); + VanillaIDs.Add(0x84); + VanillaIDs.Add(0x90); + VanillaIDs.Add(0x99); + VanillaIDs.Add(0xa4); + VanillaIDs.Add(0xb2); + VanillaIDs.Add(0xa8); + VanillaIDs.Add(0xac); + VanillaIDs.Add(0xb8); + VanillaIDs.Add(0xe2); + VanillaIDs.Add(0x10f); + VanillaIDs.Add(0xf3); + VanillaIDs.Add(0x10e); + VanillaIDs.Add(0x110); + VanillaIDs.Add(0x111); } } } From 5530e083df5e5a1cc72128a380d6f10392d00d39 Mon Sep 17 00:00:00 2001 From: attick Date: Thu, 7 Nov 2019 11:53:19 -0500 Subject: [PATCH 07/10] re-disable buff array search --- Dalamud/Game/Internal/Gui/IconReplacer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index c831f8274..cd9027efd 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -841,11 +841,11 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } - private bool SearchBuffArray(short needle) { + private bool SearchBuffArray(short needle) {/* for (int i = 0; i < 60; i++) { if (Marshal.ReadInt16(activeBuffArray + 4 * i) == needle) return true; } - + */ return false; } From 950f546a17564d934795aff2d50df37c088446b2 Mon Sep 17 00:00:00 2001 From: attick Date: Thu, 7 Nov 2019 11:54:30 -0500 Subject: [PATCH 08/10] Don't forget to re-disable the vtable lookup. --- Dalamud/Game/Internal/Gui/IconReplacer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index cd9027efd..99a54b8bd 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -82,7 +82,7 @@ namespace Dalamud.Game.Internal.Gui { // Check if player is loaded in by trying to get their buffs. // If not, skip everything until we are (game will crash cause I'm lazy). - + /* if (activeBuffArray == IntPtr.Zero) { try { activeBuffArray = FindBuffAddress(); @@ -93,7 +93,7 @@ namespace Dalamud.Game.Internal.Gui { return this.iconHook.Original(self, actionID); } } - + */ if (this.VanillaIDs.Contains(actionID)) return this.iconHook.Original(self, actionID); if (!this.CustomIDs.Contains(actionID)) return actionID; From 17c1febabc6ed2b06ff51350547413732eb0b749 Mon Sep 17 00:00:00 2001 From: attick Date: Tue, 12 Nov 2019 14:41:15 -0500 Subject: [PATCH 09/10] Update icon offsets for 5.11 --- Dalamud/Game/ClientState/ClientStateAddressResolver.cs | 2 +- Dalamud/Game/Internal/Gui/IconReplacer.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs index 885f0b31e..933cf1784 100644 --- a/Dalamud/Game/ClientState/ClientStateAddressResolver.cs +++ b/Dalamud/Game/ClientState/ClientStateAddressResolver.cs @@ -15,7 +15,7 @@ namespace Dalamud.Game.ClientState protected override void Setup64Bit(SigScanner sig) { ActorTable = sig.Module.BaseAddress + 0x1C01D90; LocalContentId = sig.Module.BaseAddress + 0x1C2E000; - JobGaugeData = sig.Module.BaseAddress + 0x1BFD110; + JobGaugeData = sig.Module.BaseAddress + 0x1BF8110; } } } diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 99a54b8bd..011b89cca 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -35,8 +35,8 @@ namespace Dalamud.Game.Internal.Gui { this.Address.Setup(scanner); this.byteBase = scanner.Module.BaseAddress; - this.comboTimer = byteBase + 0x1BB5B50; - this.lastComboMove = byteBase + 0x1BB5B54; + this.comboTimer = byteBase + 0x1BB0B50; + this.lastComboMove = byteBase + 0x1BB0B54; CustomIDs = new HashSet(); VanillaIDs = new HashSet(); From f0cf722996e60efc8250bfb9be41edc4d8b4a222 Mon Sep 17 00:00:00 2001 From: attick Date: Fri, 15 Nov 2019 16:08:47 -0500 Subject: [PATCH 10/10] Disable localPlayer for the time being. --- Dalamud/Game/Internal/Gui/IconReplacer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Game/Internal/Gui/IconReplacer.cs b/Dalamud/Game/Internal/Gui/IconReplacer.cs index 011b89cca..9b0a1d0a8 100644 --- a/Dalamud/Game/Internal/Gui/IconReplacer.cs +++ b/Dalamud/Game/Internal/Gui/IconReplacer.cs @@ -99,7 +99,7 @@ namespace Dalamud.Game.Internal.Gui { // TODO: this is currently broken // As it stands, don't rely on localCharacter.level for anything. - var localPlayer = this.dalamud.ClientState.LocalPlayer; + //var localPlayer = this.dalamud.ClientState.LocalPlayer; // Don't clutter the spaghetti any worse than it already is. var lastMove = Marshal.ReadInt32(this.lastComboMove);