fix: request titles if necessary
This commit is contained in:
parent
93ecec96c1
commit
38c7505cd5
|
@ -12,6 +12,9 @@ internal unsafe class GameFunctions {
|
|||
[Signature("E8 ?? ?? ?? ?? 83 7B 44 02")]
|
||||
private readonly delegate* unmanaged<AgentInterface*, uint*, byte> _setTitle;
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? 89 6E 58")]
|
||||
private readonly delegate* unmanaged<IntPtr, void> _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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue