ResourceTree: WIP - Path resolution

This commit is contained in:
Exter-N 2023-11-04 18:30:36 +01:00
parent 2852562a03
commit fd163f8f66
13 changed files with 452 additions and 142 deletions

View file

@ -1,5 +1,6 @@
using OtterGui.Filesystem;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
using Penumbra.Interop.Services;
using Penumbra.Interop.Structs;
using Penumbra.Meta;
@ -61,6 +62,26 @@ public struct EstCache : IDisposable
return manager.TemporarilySetFile(file, idx);
}
private readonly EstFile? GetEstFile(EstManipulation.EstType type)
{
return type switch
{
EstManipulation.EstType.Face => _estFaceFile,
EstManipulation.EstType.Hair => _estHairFile,
EstManipulation.EstType.Body => _estBodyFile,
EstManipulation.EstType.Head => _estHeadFile,
_ => null,
};
}
internal ushort GetEstEntry(MetaFileManager manager, EstManipulation.EstType type, GenderRace genderRace, SetId setId)
{
var file = GetEstFile(type);
return file != null
? file[genderRace, setId.Id]
: EstFile.GetDefault(manager, type, genderRace, setId);
}
public void Reset()
{
_estFaceFile?.Reset();

View file

@ -1,4 +1,5 @@
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
using Penumbra.Interop.Services;
using Penumbra.Interop.Structs;
using Penumbra.Meta;
@ -186,6 +187,23 @@ public class MetaCache : IDisposable, IEnumerable<KeyValuePair<MetaManipulation,
public bool GetImcFile(Utf8GamePath path, [NotNullWhen(true)] out Meta.Files.ImcFile? file)
=> _imcCache.GetImcFile(path, out file);
public ImcEntry GetImcEntry(Utf8GamePath path, EquipSlot slot, Variant variantIdx, out bool exists)
=> GetImcFile(path, out var file)
? file.GetEntry(Meta.Files.ImcFile.PartIndex(slot), variantIdx, out exists)
: Meta.Files.ImcFile.GetDefault(_manager, path, slot, variantIdx, out exists);
internal EqdpEntry GetEqdpEntry(GenderRace race, bool accessory, SetId setId)
{
var eqdpFile = _eqdpCache.EqdpFile(race, accessory);
if (eqdpFile != null)
return setId.Id < eqdpFile.Count ? eqdpFile[setId] : default;
else
return Meta.Files.ExpandedEqdpFile.GetDefault(_manager, race, accessory, setId);
}
internal ushort GetEstEntry(EstManipulation.EstType type, GenderRace genderRace, SetId setId)
=> _estCache.GetEstEntry(_manager, type, genderRace, setId);
/// <summary> Use this when CharacterUtility becomes ready. </summary>
private void ApplyStoredManipulations()
{