Skip to content

Commit

Permalink
[Remove Questg Marker Limit] Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Caraxi committed Oct 11, 2023
1 parent 48a4935 commit b9aad2c
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions Tweaks/UiAdjustment/RemoveQuestMarkerLimit.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
using FFXIVClientStructs.FFXIV.Client.Game;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using FFXIVClientStructs.Interop;
using SimpleTweaksPlugin.TweakSystem;
using SimpleTweaksPlugin.Utility;

namespace SimpleTweaksPlugin.Tweaks.UiAdjustment;

[TweakName("Remove Quest Marker Limit")]
[TweakDescription("Allow the map and minimap to display markers for more than 5 active quests.")]
[Changelog(UnreleasedVersion, "Fix tweak not working since API 9")]
public unsafe class RemoveQuestMarkerLimit : UiAdjustments.SubTweak {
public override string Name => "Remove Quest Marker Limit";
public override string Description => "Allow the map and minimap to display markers for more than 5 active quests.";

private delegate void* SetQuestMarkerInfoDelegate(Map* map, uint index, ushort questId, Utf8String* name, ushort recommendedLevel);
[TweakHook, Signature("E8 ?? ?? ?? ?? 0F B6 5B 0A", DetourName = nameof(SetQuestMarkerInfoDetour))]
private HookWrapper<SetQuestMarkerInfoDelegate> setQuestMarkerInfoHook;

protected override void Enable() {
this.setQuestMarkerInfoHook ??= Common.Hook<SetQuestMarkerInfoDelegate>(
"E8 ?? ?? ?? ?? 0F B6 5B 0A",
this.SetQuestMarkerInfoDetour
);
this.setQuestMarkerInfoHook?.Enable();

base.Enable();
}

protected override void Disable() {
this.setQuestMarkerInfoHook?.Disable();
base.Disable();
}

public override void Dispose() {
this.setQuestMarkerInfoHook?.Dispose();
base.Dispose();
}

private void* SetQuestMarkerInfoDetour(Map* map, uint index, ushort questId, Utf8String* name, ushort recommendedLevel) {
var result = this.setQuestMarkerInfoHook.Original(map, index, questId, name, recommendedLevel);
if (QuestManager.Instance()->NormalQuestsSpan[(int)index].IsHidden) {
map->QuestDataSpan[(int)index].ShouldRender = true;
var result = setQuestMarkerInfoHook.Original(map, index, questId, name, recommendedLevel);
if (!QuestManager.Instance()->NormalQuestsSpan[(int)index].IsHidden) {
map->QuestDataSpan.GetPointer((int) index)->ShouldRender = true;
}
return result;
}
Expand Down

0 comments on commit b9aad2c

Please sign in to comment.