mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-30 12:23:41 +01:00
Make ResourceTrees work with UseNoMods.
This commit is contained in:
parent
5abbd8b110
commit
f978b35b76
7 changed files with 24 additions and 26 deletions
|
|
@ -3,6 +3,7 @@ using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
|
|||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.Meta.Files;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.String;
|
||||
|
|
@ -51,10 +52,8 @@ internal partial record ResolveContext
|
|||
return GenderRace.MidlanderMale;
|
||||
|
||||
var metaCache = Global.Collection.MetaCache;
|
||||
if (metaCache == null)
|
||||
return GenderRace.MidlanderMale;
|
||||
|
||||
var entry = metaCache.GetEqdpEntry(characterRaceCode, accessory, primaryId);
|
||||
var entry = metaCache?.GetEqdpEntry(characterRaceCode, accessory, primaryId)
|
||||
?? ExpandedEqdpFile.GetDefault(Global.MetaFileManager, characterRaceCode, accessory, primaryId);
|
||||
if (entry.ToBits(slot).Item2)
|
||||
return characterRaceCode;
|
||||
|
||||
|
|
@ -62,7 +61,8 @@ internal partial record ResolveContext
|
|||
if (fallbackRaceCode == GenderRace.MidlanderMale)
|
||||
return GenderRace.MidlanderMale;
|
||||
|
||||
entry = metaCache.GetEqdpEntry(fallbackRaceCode, accessory, primaryId);
|
||||
entry = metaCache?.GetEqdpEntry(fallbackRaceCode, accessory, primaryId)
|
||||
?? ExpandedEqdpFile.GetDefault(Global.MetaFileManager, fallbackRaceCode, accessory, primaryId);
|
||||
if (entry.ToBits(slot).Item2)
|
||||
return fallbackRaceCode;
|
||||
|
||||
|
|
@ -271,8 +271,9 @@ internal partial record ResolveContext
|
|||
private (GenderRace RaceCode, string Slot, PrimaryId Set) ResolveHumanExtraSkeletonData(GenderRace raceCode, EstType type,
|
||||
PrimaryId primary)
|
||||
{
|
||||
var metaCache = Global.Collection.MetaCache;
|
||||
var skeletonSet = metaCache?.GetEstEntry(type, raceCode, primary) ?? default;
|
||||
var metaCache = Global.Collection.MetaCache;
|
||||
var skeletonSet = metaCache?.GetEstEntry(type, raceCode, primary)
|
||||
?? EstFile.GetDefault(Global.MetaFileManager, type, raceCode, primary);
|
||||
return (raceCode, type.ToName(), skeletonSet.AsId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Penumbra.GameData.Enums;
|
|||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.Interop.Hooks.PostProcessing;
|
||||
using Penumbra.Interop.PathResolving;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.UI;
|
||||
|
|
@ -19,7 +20,12 @@ using ModelType = FFXIVClientStructs.FFXIV.Client.Graphics.Scene.CharacterBase.M
|
|||
|
||||
namespace Penumbra.Interop.ResourceTree;
|
||||
|
||||
internal record GlobalResolveContext(ObjectIdentification Identifier, ModCollection Collection, TreeBuildCache TreeBuildCache, bool WithUiData)
|
||||
internal record GlobalResolveContext(
|
||||
MetaFileManager MetaFileManager,
|
||||
ObjectIdentification Identifier,
|
||||
ModCollection Collection,
|
||||
TreeBuildCache TreeBuildCache,
|
||||
bool WithUiData)
|
||||
{
|
||||
public readonly Dictionary<(Utf8GamePath, nint), ResourceNode> Nodes = new(128);
|
||||
|
||||
|
|
@ -111,7 +117,7 @@ internal unsafe partial record ResolveContext(
|
|||
if (resourceHandle == null)
|
||||
throw new ArgumentNullException(nameof(resourceHandle));
|
||||
|
||||
var fileName = (ReadOnlySpan<byte>) resourceHandle->FileName.AsSpan();
|
||||
var fileName = (ReadOnlySpan<byte>)resourceHandle->FileName.AsSpan();
|
||||
var additionalData = ByteString.Empty;
|
||||
if (PathDataHandler.Split(fileName, out fileName, out var data))
|
||||
additionalData = ByteString.FromSpanUnsafe(data, false).Clone();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Penumbra.GameData.Data;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Interop;
|
||||
using Penumbra.Interop.PathResolving;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.String.Classes;
|
||||
|
||||
namespace Penumbra.Interop.ResourceTree;
|
||||
|
|
@ -15,6 +16,7 @@ namespace Penumbra.Interop.ResourceTree;
|
|||
public class ResourceTreeFactory(
|
||||
IDataManager gameData,
|
||||
ObjectManager objects,
|
||||
MetaFileManager metaFileManager,
|
||||
CollectionResolver resolver,
|
||||
ObjectIdentification identifier,
|
||||
Configuration config,
|
||||
|
|
@ -78,7 +80,7 @@ public class ResourceTreeFactory(
|
|||
var networked = character.EntityId != 0xE0000000;
|
||||
var tree = new ResourceTree(name, anonymizedName, character.ObjectIndex, (nint)gameObjStruct, (nint)drawObjStruct, localPlayerRelated, related,
|
||||
networked, collectionResolveData.ModCollection.Name, collectionResolveData.ModCollection.AnonymizedName);
|
||||
var globalContext = new GlobalResolveContext(identifier, collectionResolveData.ModCollection,
|
||||
var globalContext = new GlobalResolveContext(metaFileManager, identifier, collectionResolveData.ModCollection,
|
||||
cache, (flags & Flags.WithUiData) != 0);
|
||||
using (var _ = pathState.EnterInternalResolve())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue