Do not delay IMC manipulations.

This commit is contained in:
Ottermandias 2022-07-09 15:23:39 +02:00
parent 74cb08e551
commit 4c90cc84f1
2 changed files with 16 additions and 5 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Penumbra.Collections; using Penumbra.Collections;
using Penumbra.Meta.Files; using Penumbra.Meta.Files;
@ -63,6 +64,7 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
public void Dispose() public void Dispose()
{ {
_manipulations.Clear();
Penumbra.CharacterUtility.LoadingFinished -= ApplyStoredManipulations; Penumbra.CharacterUtility.LoadingFinished -= ApplyStoredManipulations;
DisposeEqp(); DisposeEqp();
DisposeEqdp(); DisposeEqdp();
@ -75,6 +77,12 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
public bool ApplyMod( MetaManipulation manip, IMod mod ) public bool ApplyMod( MetaManipulation manip, IMod mod )
{ {
_manipulations[ manip ] = mod; _manipulations[ manip ] = mod;
// Imc manipulations do not require character utility.
if( manip.ManipulationType == MetaManipulation.Type.Imc )
{
return ApplyMod( manip.Imc );
}
if( !Penumbra.CharacterUtility.Ready ) if( !Penumbra.CharacterUtility.Ready )
{ {
return true; return true;
@ -87,7 +95,6 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
MetaManipulation.Type.Eqdp => ApplyMod( manip.Eqdp ), MetaManipulation.Type.Eqdp => ApplyMod( manip.Eqdp ),
MetaManipulation.Type.Est => ApplyMod( manip.Est ), MetaManipulation.Type.Est => ApplyMod( manip.Est ),
MetaManipulation.Type.Rsp => ApplyMod( manip.Rsp ), MetaManipulation.Type.Rsp => ApplyMod( manip.Rsp ),
MetaManipulation.Type.Imc => ApplyMod( manip.Imc ),
MetaManipulation.Type.Unknown => false, MetaManipulation.Type.Unknown => false,
_ => false, _ => false,
}; };
@ -96,6 +103,12 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
public bool RevertMod( MetaManipulation manip ) public bool RevertMod( MetaManipulation manip )
{ {
var ret = _manipulations.Remove( manip ); var ret = _manipulations.Remove( manip );
// Imc manipulations do not require character utility.
if( manip.ManipulationType == MetaManipulation.Type.Imc )
{
return RevertMod( manip.Imc );
}
if( !Penumbra.CharacterUtility.Ready ) if( !Penumbra.CharacterUtility.Ready )
{ {
return ret; return ret;
@ -108,7 +121,6 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
MetaManipulation.Type.Eqdp => RevertMod( manip.Eqdp ), MetaManipulation.Type.Eqdp => RevertMod( manip.Eqdp ),
MetaManipulation.Type.Est => RevertMod( manip.Est ), MetaManipulation.Type.Est => RevertMod( manip.Est ),
MetaManipulation.Type.Rsp => RevertMod( manip.Rsp ), MetaManipulation.Type.Rsp => RevertMod( manip.Rsp ),
MetaManipulation.Type.Imc => RevertMod( manip.Imc ),
MetaManipulation.Type.Unknown => false, MetaManipulation.Type.Unknown => false,
_ => false, _ => false,
}; };
@ -122,7 +134,7 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
return; return;
} }
foreach( var manip in Manipulations ) foreach( var manip in Manipulations.Where( m => m.ManipulationType != MetaManipulation.Type.Imc ) )
{ {
var _ = manip.ManipulationType switch var _ = manip.ManipulationType switch
{ {
@ -131,7 +143,6 @@ public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaM
MetaManipulation.Type.Eqdp => ApplyMod( manip.Eqdp ), MetaManipulation.Type.Eqdp => ApplyMod( manip.Eqdp ),
MetaManipulation.Type.Est => ApplyMod( manip.Est ), MetaManipulation.Type.Est => ApplyMod( manip.Est ),
MetaManipulation.Type.Rsp => ApplyMod( manip.Rsp ), MetaManipulation.Type.Rsp => ApplyMod( manip.Rsp ),
MetaManipulation.Type.Imc => ApplyMod( manip.Imc ),
MetaManipulation.Type.Unknown => false, MetaManipulation.Type.Unknown => false,
_ => false, _ => false,
}; };

View file

@ -196,7 +196,7 @@ public partial class ConfigWindow
// Draw information about the character utility class from SE, // Draw information about the character utility class from SE,
// displaying all files, their sizes, the default files and the default sizes. // displaying all files, their sizes, the default files and the default sizes.
public unsafe void DrawDebugCharacterUtility() public static unsafe void DrawDebugCharacterUtility()
{ {
if( !ImGui.CollapsingHeader( "Character Utility" ) ) if( !ImGui.CollapsingHeader( "Character Utility" ) )
{ {