diff --git a/TheHeartOfTheParty/GameFunctions.cs b/TheHeartOfTheParty/GameFunctions.cs index dbecb5b..77537f4 100755 --- a/TheHeartOfTheParty/GameFunctions.cs +++ b/TheHeartOfTheParty/GameFunctions.cs @@ -12,6 +12,9 @@ internal unsafe class GameFunctions { [Signature("E8 ?? ?? ?? ?? 83 7B 44 02")] private readonly delegate* unmanaged _setTitle; + [Signature("E8 ?? ?? ?? ?? 89 6E 58")] + private readonly delegate* unmanaged _requestTitles; + [Signature("48 8D 0D ?? ?? ?? ?? BD ?? ?? ?? ?? E8 ?? ?? ?? ?? 84 C0 75", ScanType = ScanType.StaticAddress)] private readonly IntPtr _titleList; @@ -19,6 +22,14 @@ internal unsafe class GameFunctions { SignatureHelper.Initialise(this); } + internal void RequestTitles() { + if (*(byte*) (this._titleList + 0x61) == 1) { + return; + } + + this._requestTitles(this._titleList); + } + internal bool IsTitleUnlocked(uint titleId) { if (titleId > ushort.MaxValue) { return false; @@ -32,7 +43,7 @@ internal unsafe class GameFunctions { if (agent == null) { return false; } - + return this._setTitle(agent, &titleId) != 0; } } diff --git a/TheHeartOfTheParty/PluginUi.cs b/TheHeartOfTheParty/PluginUi.cs index c3da745..206d13e 100755 --- a/TheHeartOfTheParty/PluginUi.cs +++ b/TheHeartOfTheParty/PluginUi.cs @@ -47,6 +47,10 @@ internal class PluginUi : IDisposable { return; } + if (ImGui.IsWindowAppearing()) { + this.Plugin.Functions.RequestTitles(); + } + var anyChanged = false; anyChanged |= ImGui.Checkbox("Only show unlocked titles", ref this.Plugin.Config.OnlyUnlocked);