diff --git a/Penumbra/Interop/Resolver/PathResolver.Meta.cs b/Penumbra/Interop/Resolver/PathResolver.Meta.cs index ba0c453b..1121cb29 100644 --- a/Penumbra/Interop/Resolver/PathResolver.Meta.cs +++ b/Penumbra/Interop/Resolver/PathResolver.Meta.cs @@ -202,7 +202,7 @@ public unsafe partial class PathResolver var resolveData = GetResolveData( human ); using var eqp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetEqpFile() : null; using var decals = resolveData.Valid - ? new CharacterUtility.DecalReverter( resolveData.ModCollection, DrawObjectState.UsesDecal(0, data) ) + ? new CharacterUtility.DecalReverter( resolveData.ModCollection, DrawObjectState.UsesDecal( 0, data ) ) : null; return _changeCustomize.Original( human, data, skipEquipment ); } diff --git a/Penumbra/Mods/Editor/Mod.Editor.Duplicates.cs b/Penumbra/Mods/Editor/Mod.Editor.Duplicates.cs index 0f9ef463..b0a136af 100644 --- a/Penumbra/Mods/Editor/Mod.Editor.Duplicates.cs +++ b/Penumbra/Mods/Editor/Mod.Editor.Duplicates.cs @@ -273,7 +273,7 @@ public partial class Mod try { var mod = new Mod( modDirectory ); - mod.Reload( out _ ); + mod.Reload( true, out _ ); var editor = new Editor( mod, mod.Default ); editor.DuplicatesFinished = false; editor.CheckDuplicates( editor.AvailableFiles.OrderByDescending( f => f.FileSize ).ToArray() ); diff --git a/Penumbra/Mods/Editor/Mod.Editor.Files.cs b/Penumbra/Mods/Editor/Mod.Editor.Files.cs index 480261ee..9f1d8fa5 100644 --- a/Penumbra/Mods/Editor/Mod.Editor.Files.cs +++ b/Penumbra/Mods/Editor/Mod.Editor.Files.cs @@ -267,7 +267,7 @@ public partial class Mod if( deletions > 0 ) { - _mod.Reload( out _ ); + _mod.Reload( false, out _ ); UpdateFiles(); } } diff --git a/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs b/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs index 0d908866..a169cecc 100644 --- a/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs +++ b/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs @@ -60,7 +60,7 @@ public partial class Mod dir.Refresh(); mod.ModPath = dir; - if( !mod.Reload( out var metaChange ) ) + if( !mod.Reload( false, out var metaChange ) ) { Penumbra.Log.Error( $"Error reloading moved mod {mod.Name}." ); return; @@ -81,7 +81,7 @@ public partial class Mod var oldName = mod.Name; ModPathChanged.Invoke( ModPathChangeType.StartingReload, mod, mod.ModPath, mod.ModPath ); - if( !mod.Reload( out var metaChange ) ) + if( !mod.Reload( true, out var metaChange ) ) { Penumbra.Log.Warning( mod.Name.Length == 0 ? $"Reloading mod {oldName} has failed, new name is empty. Deleting instead." @@ -135,7 +135,7 @@ public partial class Mod return; } - var mod = LoadMod( modFolder ); + var mod = LoadMod( modFolder, true ); if( mod == null ) { return; diff --git a/Penumbra/Mods/Manager/Mod.Manager.Root.cs b/Penumbra/Mods/Manager/Mod.Manager.Root.cs index 2bf658c2..7ad2140f 100644 --- a/Penumbra/Mods/Manager/Mod.Manager.Root.cs +++ b/Penumbra/Mods/Manager/Mod.Manager.Root.cs @@ -84,7 +84,7 @@ public sealed partial class Mod { foreach( var modFolder in BasePath.EnumerateDirectories() ) { - var mod = LoadMod( modFolder ); + var mod = LoadMod( modFolder, false ); if( mod == null ) { continue; diff --git a/Penumbra/Mods/Mod.BasePath.cs b/Penumbra/Mods/Mod.BasePath.cs index 2456dec2..22760adf 100644 --- a/Penumbra/Mods/Mod.BasePath.cs +++ b/Penumbra/Mods/Mod.BasePath.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Linq; namespace Penumbra.Mods; @@ -26,7 +27,7 @@ public partial class Mod _default = new SubMod( this ); } - private static Mod? LoadMod( DirectoryInfo modPath ) + private static Mod? LoadMod( DirectoryInfo modPath, bool incorporateMetaChanges ) { modPath.Refresh(); if( !modPath.Exists ) @@ -36,7 +37,7 @@ public partial class Mod } var mod = new Mod( modPath ); - if( !mod.Reload( out _ ) ) + if( !mod.Reload( incorporateMetaChanges, out _ ) ) { // Can not be base path not existing because that is checked before. Penumbra.Log.Error( $"Mod at {modPath} without name is not supported." ); @@ -46,7 +47,7 @@ public partial class Mod return mod; } - private bool Reload( out MetaChangeType metaChange ) + private bool Reload( bool incorporateMetaChanges, out MetaChangeType metaChange ) { metaChange = MetaChangeType.Deletion; ModPath.Refresh(); @@ -63,8 +64,23 @@ public partial class Mod LoadDefaultOption(); LoadAllGroups(); + if( incorporateMetaChanges ) + { + IncorporateAllMetaChanges( true ); + } + ComputeChangedItems(); SetCounts(); return true; } + + // Convert all .meta and .rgsp files to their respective meta changes and add them to their options. + // Deletes the source files if delete is true. + private void IncorporateAllMetaChanges( bool delete ) + { + foreach( var subMod in AllSubMods.OfType< SubMod >() ) + { + subMod.IncorporateMetaChanges( ModPath, delete ); + } + } } \ No newline at end of file diff --git a/Penumbra/Mods/Mod.Creation.cs b/Penumbra/Mods/Mod.Creation.cs index d9c64cc1..35095002 100644 --- a/Penumbra/Mods/Mod.Creation.cs +++ b/Penumbra/Mods/Mod.Creation.cs @@ -122,7 +122,7 @@ public partial class Mod internal static void CreateDefaultFiles( DirectoryInfo directory ) { var mod = new Mod( directory ); - mod.Reload( out _ ); + mod.Reload( false, out _ ); foreach( var file in mod.FindUnusedFiles() ) { if( Utf8GamePath.FromFile( new FileInfo( file.FullName ), directory, out var gamePath, true ) )