Skip to content

Commit

Permalink
Add duty recorder indicator widget
Browse files Browse the repository at this point in the history
  • Loading branch information
haroldiedema committed Aug 12, 2024
1 parent 7b141da commit 2587ea9
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 36 deletions.
11 changes: 7 additions & 4 deletions Umbra/i18n/de.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Umbra/i18n/en.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Umbra/i18n/fr.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Umbra/i18n/ja.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions Umbra/i18n/zh.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using Umbra.Common;

namespace Umbra.Widgets.Library.DutyRecorderIndicator;

internal sealed partial class DutyRecorderIndicator
{
protected override IEnumerable<IWidgetConfigVariable> GetConfigVariables()
{
return [
..DefaultIconToolbarWidgetConfigVariables,
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Dalamud.Hooking;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using System.Collections.Generic;
using Umbra.Common;

namespace Umbra.Widgets.Library.DutyRecorderIndicator;

internal sealed unsafe partial class DutyRecorderIndicator
{
private delegate bool DisplayRecordingIndicatorDelegate(nint agent);

private Hook<DisplayRecordingIndicatorDelegate>? DisplayRecordingIndicatorHook { get; set; }

private void SetupHook()
{
DisplayRecordingIndicatorHook = Framework
.Service<IGameInteropProvider>()
.HookFromSignature<DisplayRecordingIndicatorDelegate>(
"E8 ?? ?? ?? ?? 44 0F B6 C0 BA 4F 00 00 00",
DisplayRecordingIndicatorDetour
);

DisplayRecordingIndicatorHook?.Enable();
}

private void DisposeHook()
{
DisplayRecordingIndicatorHook?.Dispose();
}

private bool DisplayRecordingIndicatorDetour(nint agent)
{
return DisplayRecordingIndicatorHook?.Original(agent) ?? false;
}

private bool IsRecordingDuty => DisplayRecordingIndicatorHook?.Original(0) ?? false;

}
Loading

0 comments on commit 2587ea9

Please sign in to comment.