Make penumbra initialization before game code has run possible.

This commit is contained in:
Ottermandias 2022-06-29 11:42:55 +02:00
parent f13893cf77
commit 9ae843731d
19 changed files with 610 additions and 672 deletions

View file

@ -11,7 +11,6 @@ public unsafe class CharacterUtility : IDisposable
[Signature( "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? 00 48 8D 8E ?? ?? 00 00 E8 ?? ?? ?? 00 33 D2", ScanType = ScanType.StaticAddress )]
private readonly Structs.CharacterUtility** _characterUtilityAddress = null;
// Only required for migration anymore.
public delegate void LoadResources( Structs.CharacterUtility* address );
@ -62,12 +61,12 @@ public unsafe class CharacterUtility : IDisposable
public CharacterUtility()
{
SignatureHelper.Initialise( this );
LoadingFinished += () => PluginLog.Debug( "Loading of CharacterUtility finished." );
LoadDefaultResources( true );
Dalamud.Framework.Update += LoadDefaultResources;
LoadingFinished += () => PluginLog.Debug( "Loading of CharacterUtility finished." );
}
// We store the default data of the resources so we can always restore them.
private void LoadDefaultResources( bool repeat )
private void LoadDefaultResources( object _ )
{
var missingCount = 0;
if( Address == null )
@ -96,12 +95,7 @@ public unsafe class CharacterUtility : IDisposable
{
Ready = true;
LoadingFinished.Invoke();
}
else if( repeat )
{
PluginLog.Debug( "Custom load of character resources triggered." );
LoadCharacterResources();
LoadDefaultResources( false );
Dalamud.Framework.Update -= LoadDefaultResources;
}
}