diff --git a/Penumbra/Collections/Cache/AtchCache.cs b/Penumbra/Collections/Cache/AtchCache.cs
index 9e0f6caf..10990553 100644
--- a/Penumbra/Collections/Cache/AtchCache.cs
+++ b/Penumbra/Collections/Cache/AtchCache.cs
@@ -2,7 +2,6 @@ using Penumbra.GameData.Enums;
using Penumbra.GameData.Files;
using Penumbra.GameData.Files.AtchStructs;
using Penumbra.Meta;
-using Penumbra.Meta.Files;
using Penumbra.Meta.Manipulations;
namespace Penumbra.Collections.Cache;
@@ -37,7 +36,7 @@ public sealed class AtchCache(MetaFileManager manager, ModCollection collection)
protected override void ApplyModInternal(AtchIdentifier identifier, AtchEntry entry)
{
- ++Collection.AtchChangeCounter;
+ Collection.Counters.IncrementAtch();
ApplyFile(identifier, entry);
}
@@ -68,7 +67,7 @@ public sealed class AtchCache(MetaFileManager manager, ModCollection collection)
protected override void RevertModInternal(AtchIdentifier identifier)
{
- ++Collection.AtchChangeCounter;
+ Collection.Counters.IncrementAtch();
if (!_atchFiles.TryGetValue(identifier.GenderRace, out var pair))
return;
diff --git a/Penumbra/Collections/Cache/CollectionCache.cs b/Penumbra/Collections/Cache/CollectionCache.cs
index 64cf54ea..bc431e88 100644
--- a/Penumbra/Collections/Cache/CollectionCache.cs
+++ b/Penumbra/Collections/Cache/CollectionCache.cs
@@ -177,7 +177,7 @@ public sealed class CollectionCache : IDisposable
var (paths, manipulations) = ModData.RemoveMod(mod);
if (addMetaChanges)
- _collection.IncrementCounter();
+ _collection.Counters.IncrementChange();
foreach (var path in paths)
{
@@ -250,7 +250,7 @@ public sealed class CollectionCache : IDisposable
if (addMetaChanges)
{
- _collection.IncrementCounter();
+ _collection.Counters.IncrementChange();
_manager.MetaFileManager.ApplyDefaultFiles(_collection);
}
}
@@ -408,12 +408,12 @@ public sealed class CollectionCache : IDisposable
// Identify and record all manipulated objects for this entire collection.
private void SetChangedItems()
{
- if (_changedItemsSaveCounter == _collection.ChangeCounter)
+ if (_changedItemsSaveCounter == _collection.Counters.Change)
return;
try
{
- _changedItemsSaveCounter = _collection.ChangeCounter;
+ _changedItemsSaveCounter = _collection.Counters.Change;
_changedItems.Clear();
// Skip IMCs because they would result in far too many false-positive items,
// since they are per set instead of per item-slot/item/variant.
diff --git a/Penumbra/Collections/Cache/CollectionCacheManager.cs b/Penumbra/Collections/Cache/CollectionCacheManager.cs
index a3b6bb83..c3e00502 100644
--- a/Penumbra/Collections/Cache/CollectionCacheManager.cs
+++ b/Penumbra/Collections/Cache/CollectionCacheManager.cs
@@ -187,7 +187,7 @@ public class CollectionCacheManager : IDisposable, IService
foreach (var mod in _modStorage)
cache.AddModSync(mod, false);
- collection.IncrementCounter();
+ collection.Counters.IncrementChange();
MetaFileManager.ApplyDefaultFiles(collection);
ResolvedFileChanged.Invoke(collection, ResolvedFileChanged.Type.FullRecomputeFinished, Utf8GamePath.Empty, FullPath.Empty,
@@ -297,7 +297,7 @@ public class CollectionCacheManager : IDisposable, IService
private void IncrementCounters()
{
foreach (var collection in _storage.Where(c => c.HasCache))
- collection.IncrementCounter();
+ collection.Counters.IncrementChange();
MetaFileManager.CharacterUtility.LoadingFinished -= IncrementCounters;
}
diff --git a/Penumbra/Collections/Cache/ImcCache.cs b/Penumbra/Collections/Cache/ImcCache.cs
index cac52f99..0f610d90 100644
--- a/Penumbra/Collections/Cache/ImcCache.cs
+++ b/Penumbra/Collections/Cache/ImcCache.cs
@@ -39,7 +39,7 @@ public sealed class ImcCache(MetaFileManager manager, ModCollection collection)
protected override void ApplyModInternal(ImcIdentifier identifier, ImcEntry entry)
{
- ++Collection.ImcChangeCounter;
+ Collection.Counters.IncrementImc();
ApplyFile(identifier, entry);
}
@@ -71,7 +71,7 @@ public sealed class ImcCache(MetaFileManager manager, ModCollection collection)
protected override void RevertModInternal(ImcIdentifier identifier)
{
- ++Collection.ImcChangeCounter;
+ Collection.Counters.IncrementImc();
var path = identifier.GamePath().Path;
if (!_imcFiles.TryGetValue(path, out var pair))
return;
diff --git a/Penumbra/Collections/CollectionCounters.cs b/Penumbra/Collections/CollectionCounters.cs
new file mode 100644
index 00000000..91d240d6
--- /dev/null
+++ b/Penumbra/Collections/CollectionCounters.cs
@@ -0,0 +1,28 @@
+namespace Penumbra.Collections;
+
+public struct CollectionCounters(int changeCounter)
+{
+ /// Count the number of changes of the effective file list.
+ public int Change { get; private set; } = changeCounter;
+
+ /// Count the number of IMC-relevant changes of the effective file list.
+ public int Imc { get; private set; }
+
+ /// Count the number of ATCH-relevant changes of the effective file list.
+ public int Atch { get; private set; }
+
+ /// Increment the number of changes in the effective file list.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public int IncrementChange()
+ => ++Change;
+
+ /// Increment the number of IMC-relevant changes in the effective file list.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public int IncrementImc()
+ => ++Imc;
+
+ /// Increment the number of ATCH-relevant changes in the effective file list.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public int IncrementAtch()
+ => ++Imc;
+}
diff --git a/Penumbra/Collections/Manager/CollectionStorage.cs b/Penumbra/Collections/Manager/CollectionStorage.cs
index a326fb92..cdbe11dc 100644
--- a/Penumbra/Collections/Manager/CollectionStorage.cs
+++ b/Penumbra/Collections/Manager/CollectionStorage.cs
@@ -372,7 +372,7 @@ public class CollectionStorage : IReadOnlyList, IDisposable, ISer
{
var (settings, _) = collection[mod.Index];
if (settings is { Enabled: true })
- collection.IncrementCounter();
+ collection.Counters.IncrementChange();
}
}
}
diff --git a/Penumbra/Collections/Manager/TempCollectionManager.cs b/Penumbra/Collections/Manager/TempCollectionManager.cs
index 5c893232..e5b844c8 100644
--- a/Penumbra/Collections/Manager/TempCollectionManager.cs
+++ b/Penumbra/Collections/Manager/TempCollectionManager.cs
@@ -75,7 +75,7 @@ public class TempCollectionManager : IDisposable, IService
_storage.Delete(collection);
Penumbra.Log.Debug($"Deleted temporary collection {collection.Id}.");
- GlobalChangeCounter += Math.Max(collection.ChangeCounter + 1 - GlobalChangeCounter, 0);
+ GlobalChangeCounter += Math.Max(collection.Counters.Change + 1 - GlobalChangeCounter, 0);
for (var i = 0; i < Collections.Count; ++i)
{
if (Collections[i].Collection != collection)
diff --git a/Penumbra/Collections/ModCollection.cs b/Penumbra/Collections/ModCollection.cs
index db9c19cb..95e78da0 100644
--- a/Penumbra/Collections/ModCollection.cs
+++ b/Penumbra/Collections/ModCollection.cs
@@ -50,18 +50,7 @@ public partial class ModCollection
/// The index of the collection is set and kept up-to-date by the CollectionManager.
public int Index { get; internal set; }
- ///
- /// Count the number of changes of the effective file list.
- /// This is used for material and imc changes.
- ///
- public int ChangeCounter { get; private set; }
-
- public uint ImcChangeCounter { get; set; }
- public uint AtchChangeCounter { get; set; }
-
- /// Increment the number of changes in the effective file list.
- public int IncrementCounter()
- => ++ChangeCounter;
+ public CollectionCounters Counters;
///
/// If a ModSetting is null, it can be inherited from other collections.
@@ -213,7 +202,7 @@ public partial class ModCollection
Id = id;
LocalId = localId;
Index = index;
- ChangeCounter = changeCounter;
+ Counters = new CollectionCounters(changeCounter);
Settings = appliedSettings;
UnusedSettings = settings;
DirectlyInheritsFrom = inheritsFrom;
diff --git a/Penumbra/Interop/PathResolving/PathDataHandler.cs b/Penumbra/Interop/PathResolving/PathDataHandler.cs
index 5439151f..25d4f7ea 100644
--- a/Penumbra/Interop/PathResolving/PathDataHandler.cs
+++ b/Penumbra/Interop/PathResolving/PathDataHandler.cs
@@ -32,7 +32,7 @@ public static class PathDataHandler
/// Create the encoding path for an IMC file.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static FullPath CreateImc(CiByteString path, ModCollection collection)
- => new($"|{collection.LocalId.Id}_{collection.ImcChangeCounter}_{DiscriminatorString}|{path}");
+ => new($"|{collection.LocalId.Id}_{collection.Counters.Imc}_{DiscriminatorString}|{path}");
/// Create the encoding path for a TMB file.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -47,17 +47,17 @@ public static class PathDataHandler
/// Create the encoding path for an ATCH file.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static FullPath CreateAtch(CiByteString path, ModCollection collection)
- => new($"|{collection.LocalId.Id}_{collection.AtchChangeCounter}_{DiscriminatorString}|{path}");
+ => new($"|{collection.LocalId.Id}_{collection.Counters.Atch}_{DiscriminatorString}|{path}");
/// Create the encoding path for a MTRL file.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static FullPath CreateMtrl(CiByteString path, ModCollection collection, Utf8GamePath originalPath)
- => new($"|{collection.LocalId.Id}_{collection.ChangeCounter}_{originalPath.Path.Crc32:X8}_{DiscriminatorString}|{path}");
+ => new($"|{collection.LocalId.Id}_{collection.Counters.Change}_{originalPath.Path.Crc32:X8}_{DiscriminatorString}|{path}");
/// The base function shared by most file types.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static FullPath CreateBase(CiByteString path, ModCollection collection)
- => new($"|{collection.LocalId.Id}_{collection.ChangeCounter}_{DiscriminatorString}|{path}");
+ => new($"|{collection.LocalId.Id}_{collection.Counters.Change}_{DiscriminatorString}|{path}");
/// Read an additional data blurb and parse it into usable data for all file types but Materials.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/Penumbra/UI/Tabs/Debug/DebugTab.cs b/Penumbra/UI/Tabs/Debug/DebugTab.cs
index 125dbfa1..95afb10f 100644
--- a/Penumbra/UI/Tabs/Debug/DebugTab.cs
+++ b/Penumbra/UI/Tabs/Debug/DebugTab.cs
@@ -204,7 +204,7 @@ public class DebugTab : Window, ITab, IUiService
if (collection.HasCache)
{
using var color = PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value());
- using var node = TreeNode($"{collection.Name} (Change Counter {collection.ChangeCounter})###{collection.Name}");
+ using var node = TreeNode($"{collection.Name} (Change Counter {collection.Counters.Change})###{collection.Name}");
if (!node)
continue;
@@ -239,7 +239,7 @@ public class DebugTab : Window, ITab, IUiService
else
{
using var color = PushColor(ImGuiCol.Text, ColorId.UndefinedMod.Value());
- TreeNode($"{collection.AnonymizedName} (Change Counter {collection.ChangeCounter})",
+ TreeNode($"{collection.AnonymizedName} (Change Counter {collection.Counters.Change})",
ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
}
}