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