Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-rud committed May 16, 2024
1 parent 6faa0d5 commit 9a0bbc9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
9 changes: 4 additions & 5 deletions XIVComboPlugin/IconReplacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ public class IconReplacer
private readonly IClientState clientState;
private IntPtr comboTimer;

private readonly Dictionary<uint, CustomCombo> combos = new();
private readonly Dictionary<uint, CustomCombo> combos = [];
private readonly Hook<OnGetIconDelegate> iconHook;
private IntPtr lastComboMove;

public unsafe IconReplacer(ISigScanner scanner, IClientState clientState, IJobGauges jobGauges, IGameInteropProvider hookProvider)
{
this.clientState = clientState;

Address = new IconReplacerAddressResolver();
Address.Setup(scanner);
Address = new IconReplacerAddressResolver(scanner);

if (!clientState.IsLoggedIn)
clientState.Login += SetupComboData;
Expand All @@ -40,7 +39,7 @@ public unsafe IconReplacer(ISigScanner scanner, IClientState clientState, IJobGa
iconHook = hookProvider.HookFromAddress<OnGetIconDelegate>(Address.GetIcon, GetIconDetour);
checkerHook = hookProvider.HookFromAddress<OnCheckIsIconReplaceableDelegate>(Address.IsIconReplaceable, (_) => 1);

CustomCombo[] comboList = {
CustomCombo[] comboList = [
// Tanks
new PLD.Combo(clientState, jobGauges),
new WAR.Combo(clientState, jobGauges),
Expand Down Expand Up @@ -69,7 +68,7 @@ public unsafe IconReplacer(ISigScanner scanner, IClientState clientState, IJobGa
new SCH.Combo(clientState, jobGauges),
new AST.Combo(clientState, jobGauges),
new SGE.Combo(clientState, jobGauges),
};
];

foreach (var item in comboList)
{
Expand Down
4 changes: 2 additions & 2 deletions XIVComboPlugin/IconReplacerAddressResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

namespace XIVComboPlugin
{
class IconReplacerAddressResolver : BaseAddressResolver
class IconReplacerAddressResolver
{
public IntPtr GetIcon { get; private set; }
public IntPtr IsIconReplaceable { get; private set; }

protected override void Setup64Bit(ISigScanner sig)
public IconReplacerAddressResolver(ISigScanner sig)
{
this.GetIcon = sig.ScanText("E8 ?? ?? ?? ?? 8B F8 3B DF");
this.IsIconReplaceable = sig.ScanText("E8 ?? ?? ?? ?? 84 C0 74 4C 8B D3");
Expand Down
10 changes: 2 additions & 8 deletions XIVComboPlugin/XIVComboPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@ namespace XIVComboPlugin
class XIVComboPlugin : IDalamudPlugin
{
public string Name => "XIV Combo Plugin";

public ISigScanner TargetModuleScanner { get; init; }
public IClientState ClientState { get; init; }
public IJobGauges JobGauges { get; init; }
public IGameInteropProvider HookProvider { get; init; }

private readonly IconReplacer iconReplacer;

public XIVComboPlugin()
public XIVComboPlugin(ISigScanner scanner, IClientState clientState, IJobGauges jobGauges, IGameInteropProvider hookProvider)
{
this.iconReplacer = new IconReplacer(TargetModuleScanner, ClientState, JobGauges, HookProvider);
this.iconReplacer = new IconReplacer(scanner, clientState, jobGauges, hookProvider);
this.iconReplacer.Enable();
}

Expand Down

0 comments on commit 9a0bbc9

Please sign in to comment.