mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-02 13:53:42 +01:00
Fix issues with EQDP files for invalid characters.
This commit is contained in:
parent
19866c5638
commit
28752e2630
4 changed files with 24 additions and 9 deletions
|
|
@ -31,12 +31,22 @@ public readonly struct EqdpCache : IDisposable
|
||||||
manager.SetFile(_eqdpFiles[i], index);
|
manager.SetFile(_eqdpFiles[i], index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetaList.MetaReverter TemporarilySetFiles(MetaFileManager manager, GenderRace genderRace, bool accessory)
|
public MetaList.MetaReverter? TemporarilySetFiles(MetaFileManager manager, GenderRace genderRace, bool accessory)
|
||||||
{
|
{
|
||||||
var idx = CharacterUtilityData.EqdpIdx(genderRace, accessory);
|
var idx = CharacterUtilityData.EqdpIdx(genderRace, accessory);
|
||||||
Debug.Assert(idx >= 0, $"Invalid Gender, Race or Accessory for EQDP file {genderRace}, {accessory}.");
|
if (idx < 0)
|
||||||
|
{
|
||||||
|
Penumbra.Log.Warning($"Invalid Gender, Race or Accessory for EQDP file {genderRace}, {accessory}.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var i = CharacterUtilityData.EqdpIndices.IndexOf(idx);
|
var i = CharacterUtilityData.EqdpIndices.IndexOf(idx);
|
||||||
Debug.Assert(i >= 0, $"Invalid Gender, Race or Accessory for EQDP file {genderRace}, {accessory}.");
|
if (i < 0)
|
||||||
|
{
|
||||||
|
Penumbra.Log.Warning($"Invalid Gender, Race or Accessory for EQDP file {genderRace}, {accessory}.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return manager.TemporarilySetFile(_eqdpFiles[i], idx);
|
return manager.TemporarilySetFile(_eqdpFiles[i], idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ public class MetaCache : IDisposable, IEnumerable<KeyValuePair<MetaManipulation,
|
||||||
public MetaList.MetaReverter TemporarilySetEqpFile()
|
public MetaList.MetaReverter TemporarilySetEqpFile()
|
||||||
=> _eqpCache.TemporarilySetFiles(_manager);
|
=> _eqpCache.TemporarilySetFiles(_manager);
|
||||||
|
|
||||||
public MetaList.MetaReverter TemporarilySetEqdpFile(GenderRace genderRace, bool accessory)
|
public MetaList.MetaReverter? TemporarilySetEqdpFile(GenderRace genderRace, bool accessory)
|
||||||
=> _eqdpCache.TemporarilySetFiles(_manager, genderRace, accessory);
|
=> _eqdpCache.TemporarilySetFiles(_manager, genderRace, accessory);
|
||||||
|
|
||||||
public MetaList.MetaReverter TemporarilySetGmpFile()
|
public MetaList.MetaReverter TemporarilySetGmpFile()
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,14 @@ public partial class ModCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for short periods of changed files.
|
// Used for short periods of changed files.
|
||||||
public MetaList.MetaReverter TemporarilySetEqdpFile(CharacterUtility utility, GenderRace genderRace, bool accessory)
|
public MetaList.MetaReverter? TemporarilySetEqdpFile(CharacterUtility utility, GenderRace genderRace, bool accessory)
|
||||||
=> _cache?.Meta.TemporarilySetEqdpFile(genderRace, accessory)
|
{
|
||||||
?? utility.TemporarilyResetResource(CharacterUtilityData.EqdpIdx(genderRace, accessory));
|
if (_cache != null)
|
||||||
|
return _cache?.Meta.TemporarilySetEqdpFile(genderRace, accessory);
|
||||||
|
|
||||||
|
var idx = CharacterUtilityData.EqdpIdx(genderRace, accessory);
|
||||||
|
return idx >= 0 ? utility.TemporarilyResetResource(idx) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public MetaList.MetaReverter TemporarilySetEqpFile(CharacterUtility utility)
|
public MetaList.MetaReverter TemporarilySetEqpFile(CharacterUtility utility)
|
||||||
=> _cache?.Meta.TemporarilySetEqpFile()
|
=> _cache?.Meta.TemporarilySetEqpFile()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Penumbra.Services;
|
||||||
namespace Penumbra.Collections;
|
namespace Penumbra.Collections;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A ModCollection is a named set of ModSettings to all of the users' installed mods.
|
/// A ModCollection is a named set of ModSettings to all the users' installed mods.
|
||||||
/// Settings to mods that are not installed anymore are kept as long as no call to CleanUnavailableSettings is made.
|
/// Settings to mods that are not installed anymore are kept as long as no call to CleanUnavailableSettings is made.
|
||||||
/// Invariants:
|
/// Invariants:
|
||||||
/// - Index is the collections index in the ModCollection.Manager
|
/// - Index is the collections index in the ModCollection.Manager
|
||||||
|
|
@ -113,7 +113,7 @@ public partial class ModCollection
|
||||||
{
|
{
|
||||||
Debug.Assert(index > 0, "Collection duplicated with non-positive index.");
|
Debug.Assert(index > 0, "Collection duplicated with non-positive index.");
|
||||||
return new ModCollection(name, index, 0, CurrentVersion, Settings.Select(s => s?.DeepCopy()).ToList(),
|
return new ModCollection(name, index, 0, CurrentVersion, Settings.Select(s => s?.DeepCopy()).ToList(),
|
||||||
DirectlyInheritsFrom.ToList(), UnusedSettings.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.DeepCopy()));
|
[.. DirectlyInheritsFrom], UnusedSettings.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.DeepCopy()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Constructor for reading from files. </summary>
|
/// <summary> Constructor for reading from files. </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue