mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Clean unused functions.
This commit is contained in:
parent
03d3c38ad5
commit
f9c45a2f3f
8 changed files with 9 additions and 100 deletions
|
|
@ -10,17 +10,11 @@ public sealed class EqdpCache(MetaFileManager manager, ModCollection collection)
|
|||
private readonly Dictionary<(PrimaryId Id, GenderRace GenderRace, bool Accessory), (EqdpEntry Entry, EqdpEntry InverseMask)> _fullEntries =
|
||||
[];
|
||||
|
||||
public override void SetFiles()
|
||||
{ }
|
||||
|
||||
public EqdpEntry ApplyFullEntry(PrimaryId id, GenderRace genderRace, bool accessory, EqdpEntry originalEntry)
|
||||
=> _fullEntries.TryGetValue((id, genderRace, accessory), out var pair)
|
||||
? (originalEntry & pair.InverseMask) | pair.Entry
|
||||
: originalEntry;
|
||||
|
||||
protected override void IncorporateChangesInternal()
|
||||
{ }
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Clear();
|
||||
|
|
@ -46,8 +40,8 @@ public sealed class EqdpCache(MetaFileManager manager, ModCollection collection)
|
|||
if (!_fullEntries.Remove(tuple, out var pair))
|
||||
return;
|
||||
|
||||
var mask = Eqdp.Mask(identifier.Slot);
|
||||
var newMask = pair.InverseMask | mask;
|
||||
var mask = Eqdp.Mask(identifier.Slot);
|
||||
var newMask = pair.InverseMask | mask;
|
||||
if (newMask is not EqdpEntry.FullMask)
|
||||
_fullEntries[tuple] = (pair.Entry & ~mask, newMask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@ namespace Penumbra.Collections.Cache;
|
|||
|
||||
public sealed class EqpCache(MetaFileManager manager, ModCollection collection) : MetaCacheBase<EqpIdentifier, EqpEntry>(manager, collection)
|
||||
{
|
||||
public override void SetFiles()
|
||||
{ }
|
||||
|
||||
protected override void IncorporateChangesInternal()
|
||||
{ }
|
||||
|
||||
public unsafe EqpEntry GetValues(CharacterArmor* armor)
|
||||
=> GetSingleValue(armor[0].Set, EquipSlot.Head)
|
||||
| GetSingleValue(armor[1].Set, EquipSlot.Body)
|
||||
|
|
@ -28,12 +22,6 @@ public sealed class EqpCache(MetaFileManager manager, ModCollection collection)
|
|||
public void Reset()
|
||||
=> Clear();
|
||||
|
||||
protected override void ApplyModInternal(EqpIdentifier identifier, EqpEntry entry)
|
||||
{ }
|
||||
|
||||
protected override void RevertModInternal(EqpIdentifier identifier)
|
||||
{ }
|
||||
|
||||
protected override void Dispose(bool _)
|
||||
=> Clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,6 @@ namespace Penumbra.Collections.Cache;
|
|||
|
||||
public sealed class EstCache(MetaFileManager manager, ModCollection collection) : MetaCacheBase<EstIdentifier, EstEntry>(manager, collection)
|
||||
{
|
||||
public override void SetFiles()
|
||||
{ }
|
||||
|
||||
protected override void IncorporateChangesInternal()
|
||||
{ }
|
||||
|
||||
public EstEntry GetEstEntry(EstIdentifier identifier)
|
||||
=> TryGetValue(identifier, out var entry)
|
||||
? entry.Entry
|
||||
|
|
@ -20,12 +14,6 @@ public sealed class EstCache(MetaFileManager manager, ModCollection collection)
|
|||
public void Reset()
|
||||
=> Clear();
|
||||
|
||||
protected override void ApplyModInternal(EstIdentifier identifier, EstEntry entry)
|
||||
{ }
|
||||
|
||||
protected override void RevertModInternal(EstIdentifier identifier)
|
||||
{ }
|
||||
|
||||
protected override void Dispose(bool _)
|
||||
=> Clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,21 +6,9 @@ namespace Penumbra.Collections.Cache;
|
|||
|
||||
public sealed class GmpCache(MetaFileManager manager, ModCollection collection) : MetaCacheBase<GmpIdentifier, GmpEntry>(manager, collection)
|
||||
{
|
||||
public override void SetFiles()
|
||||
{ }
|
||||
|
||||
protected override void IncorporateChangesInternal()
|
||||
{ }
|
||||
|
||||
public void Reset()
|
||||
=> Clear();
|
||||
|
||||
protected override void ApplyModInternal(GmpIdentifier identifier, GmpEntry entry)
|
||||
{ }
|
||||
|
||||
protected override void RevertModInternal(GmpIdentifier identifier)
|
||||
{ }
|
||||
|
||||
protected override void Dispose(bool _)
|
||||
=> Clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,30 +4,19 @@ using Penumbra.Mods.Editor;
|
|||
|
||||
namespace Penumbra.Collections.Cache;
|
||||
|
||||
public abstract class MetaCacheBase<TIdentifier, TEntry>
|
||||
public abstract class MetaCacheBase<TIdentifier, TEntry>(MetaFileManager manager, ModCollection collection)
|
||||
: Dictionary<TIdentifier, (IMod Source, TEntry Entry)>
|
||||
where TIdentifier : unmanaged, IMetaIdentifier
|
||||
where TEntry : unmanaged
|
||||
{
|
||||
protected MetaCacheBase(MetaFileManager manager, ModCollection collection)
|
||||
{
|
||||
Manager = manager;
|
||||
Collection = collection;
|
||||
if (!Manager.CharacterUtility.Ready)
|
||||
Manager.CharacterUtility.LoadingFinished += IncorporateChanges;
|
||||
}
|
||||
|
||||
protected readonly MetaFileManager Manager;
|
||||
protected readonly ModCollection Collection;
|
||||
protected readonly MetaFileManager Manager = manager;
|
||||
protected readonly ModCollection Collection = collection;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Manager.CharacterUtility.LoadingFinished -= IncorporateChanges;
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public abstract void SetFiles();
|
||||
|
||||
public bool ApplyMod(IMod source, TIdentifier identifier, TEntry entry)
|
||||
{
|
||||
lock (this)
|
||||
|
|
@ -59,20 +48,12 @@ public abstract class MetaCacheBase<TIdentifier, TEntry>
|
|||
return true;
|
||||
}
|
||||
|
||||
private void IncorporateChanges()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
IncorporateChangesInternal();
|
||||
}
|
||||
|
||||
if (Manager.ActiveCollections.Default == Collection && Manager.Config.EnableMods)
|
||||
SetFiles();
|
||||
}
|
||||
protected virtual void ApplyModInternal(TIdentifier identifier, TEntry entry)
|
||||
{ }
|
||||
|
||||
protected abstract void ApplyModInternal(TIdentifier identifier, TEntry entry);
|
||||
protected abstract void RevertModInternal(TIdentifier identifier);
|
||||
protected abstract void IncorporateChangesInternal();
|
||||
protected virtual void RevertModInternal(TIdentifier identifier)
|
||||
{ }
|
||||
|
||||
protected virtual void Dispose(bool _)
|
||||
{ }
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ public sealed class ImcCache(MetaFileManager manager, ModCollection collection)
|
|||
{
|
||||
private readonly Dictionary<ByteString, (ImcFile, HashSet<ImcIdentifier>)> _imcFiles = [];
|
||||
|
||||
public override void SetFiles()
|
||||
{ }
|
||||
|
||||
public bool HasFile(ByteString path)
|
||||
=> _imcFiles.ContainsKey(path);
|
||||
|
||||
|
|
@ -28,10 +25,6 @@ public sealed class ImcCache(MetaFileManager manager, ModCollection collection)
|
|||
return true;
|
||||
}
|
||||
|
||||
protected override void IncorporateChangesInternal()
|
||||
{ }
|
||||
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
foreach (var (_, (file, set)) in _imcFiles)
|
||||
|
|
|
|||
|
|
@ -29,16 +29,6 @@ public class MetaCache(MetaFileManager manager, ModCollection collection)
|
|||
.Concat(Imc.Select(kvp => ((IMetaIdentifier)kvp.Key, kvp.Value.Source)))
|
||||
.Concat(GlobalEqp.Select(kvp => ((IMetaIdentifier)kvp.Key, kvp.Value)));
|
||||
|
||||
public void SetFiles()
|
||||
{
|
||||
Eqp.SetFiles();
|
||||
Eqdp.SetFiles();
|
||||
Est.SetFiles();
|
||||
Gmp.SetFiles();
|
||||
Rsp.SetFiles();
|
||||
Imc.SetFiles();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Eqp.Reset();
|
||||
|
|
|
|||
|
|
@ -5,22 +5,9 @@ namespace Penumbra.Collections.Cache;
|
|||
|
||||
public sealed class RspCache(MetaFileManager manager, ModCollection collection) : MetaCacheBase<RspIdentifier, RspEntry>(manager, collection)
|
||||
{
|
||||
public override void SetFiles()
|
||||
{ }
|
||||
|
||||
protected override void IncorporateChangesInternal()
|
||||
{ }
|
||||
|
||||
public void Reset()
|
||||
=> Clear();
|
||||
|
||||
protected override void ApplyModInternal(RspIdentifier identifier, RspEntry entry)
|
||||
{ }
|
||||
|
||||
protected override void RevertModInternal(RspIdentifier identifier)
|
||||
{ }
|
||||
|
||||
|
||||
protected override void Dispose(bool _)
|
||||
=> Clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue