Fix some bugs and start work on new collections tab.

This commit is contained in:
Ottermandias 2023-04-18 18:44:53 +02:00
parent e9fc57022e
commit fba5bc6820
26 changed files with 1346 additions and 717 deletions

View file

@ -1,12 +1,12 @@
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Component.GUI;
using Penumbra.GameData;
namespace Penumbra.Interop.Services;
/// <summary>
/// <summary>
/// Handle font reloading via game functions.
/// May cause a interface flicker while reloading.
/// May cause a interface flicker while reloading.
/// </summary>
public unsafe class FontReloader
{
@ -21,24 +21,27 @@ public unsafe class FontReloader
Penumbra.Log.Error("Could not reload fonts, function could not be found.");
}
private readonly AtkModule* _atkModule = null!;
private readonly delegate* unmanaged<AtkModule*, bool, bool, void> _reloadFontsFunc = null!;
private AtkModule* _atkModule = null!;
private delegate* unmanaged<AtkModule*, bool, bool, void> _reloadFontsFunc = null!;
public FontReloader()
public FontReloader(Dalamud.Game.Framework dFramework)
{
var framework = Framework.Instance();
if (framework == null)
return;
dFramework.RunOnFrameworkThread(() =>
{
var framework = Framework.Instance();
if (framework == null)
return;
var uiModule = framework->GetUiModule();
if (uiModule == null)
return;
var uiModule = framework->GetUiModule();
if (uiModule == null)
return;
var atkModule = uiModule->GetRaptureAtkModule();
if (atkModule == null)
return;
var atkModule = uiModule->GetRaptureAtkModule();
if (atkModule == null)
return;
_atkModule = &atkModule->AtkModule;
_reloadFontsFunc = ((delegate* unmanaged<AtkModule*, bool, bool, void>*)_atkModule->vtbl)[Offsets.ReloadFontsVfunc];
_atkModule = &atkModule->AtkModule;
_reloadFontsFunc = ((delegate* unmanaged<AtkModule*, bool, bool, void>*)_atkModule->vtbl)[Offsets.ReloadFontsVfunc];
});
}
}