Fix behaviour for non-main-map resources in debug.

This commit is contained in:
Ottermandias 2022-03-18 11:07:36 +01:00
parent 6949011acf
commit d07355c0f8
3 changed files with 7 additions and 12 deletions

View file

@ -21,7 +21,7 @@ public unsafe partial class ResourceLoader
{ {
public ResourceHandle* OriginalResource; public ResourceHandle* OriginalResource;
public ResourceHandle* ManipulatedResource; public ResourceHandle* ManipulatedResource;
public Utf8GamePath OriginalPath; public Utf8GamePath OriginalPath;
public FullPath ManipulatedPath; public FullPath ManipulatedPath;
public ResourceCategory Category; public ResourceCategory Category;
public object? ResolverInfo; public object? ResolverInfo;
@ -52,7 +52,7 @@ public unsafe partial class ResourceLoader
} }
var crc = ( uint )originalPath.Path.Crc32; var crc = ( uint )originalPath.Path.Crc32;
var originalResource = ( *ResourceManager )->FindResourceHandle( &handle->Category, &handle->FileType, &crc ); var originalResource = FindResource( handle->Category, handle->FileType, crc );
_debugList[ manipulatedPath.Value ] = new DebugData() _debugList[ manipulatedPath.Value ] = new DebugData()
{ {
OriginalResource = originalResource, OriginalResource = originalResource,
@ -113,9 +113,12 @@ public unsafe partial class ResourceLoader
// Find a resource in the resource manager by its category, extension and crc-hash // Find a resource in the resource manager by its category, extension and crc-hash
public static ResourceHandle* FindResource( ResourceCategory cat, uint ext, uint crc32 ) public static ResourceHandle* FindResource( ResourceCategory cat, uint ext, uint crc32 )
{ {
var manager = *ResourceManager; var manager = *ResourceManager;
var catIdx = ( uint )cat >> 0x18;
cat = ( ResourceCategory )( ushort )cat;
var category = ( ResourceGraph.CategoryContainer* )manager->ResourceGraph->ContainerArray + ( int )cat; var category = ( ResourceGraph.CategoryContainer* )manager->ResourceGraph->ContainerArray + ( int )cat;
var extMap = FindInMap( category->MainMap, ext ); var extMap = FindInMap( ( StdMap< uint, Pointer< StdMap< uint, Pointer< ResourceHandle > > > >* )category->CategoryMaps[ catIdx ],
ext );
if( extMap == null ) if( extMap == null )
{ {
return null; return null;

View file

@ -77,7 +77,6 @@ public class MetaCollection
// and that the contained manipulations are still valid and non-default manipulations. // and that the contained manipulations are still valid and non-default manipulations.
public bool Validate( ModMeta modMeta ) public bool Validate( ModMeta modMeta )
{ {
var defaultFiles = Penumbra.MetaDefaults;
SortLists(); SortLists();
foreach( var group in GroupData ) foreach( var group in GroupData )
{ {

View file

@ -10,19 +10,14 @@ using Penumbra.Api;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.Interop; using Penumbra.Interop;
using Penumbra.Mods; using Penumbra.Mods;
using Penumbra.PlayerWatch;
using Penumbra.UI; using Penumbra.UI;
using Penumbra.Util; using Penumbra.Util;
using System.Linq; using System.Linq;
using Penumbra.Interop.Loader; using Penumbra.Interop.Loader;
using Penumbra.Interop.Resolver; using Penumbra.Interop.Resolver;
using Penumbra.Meta.Manipulations;
namespace Penumbra; namespace Penumbra;
public class MetaDefaults
{ }
public class Penumbra : IDalamudPlugin public class Penumbra : IDalamudPlugin
{ {
public string Name public string Name
@ -38,7 +33,6 @@ public class Penumbra : IDalamudPlugin
public static ResidentResourceManager ResidentResources { get; private set; } = null!; public static ResidentResourceManager ResidentResources { get; private set; } = null!;
public static CharacterUtility CharacterUtility { get; private set; } = null!; public static CharacterUtility CharacterUtility { get; private set; } = null!;
public static MetaDefaults MetaDefaults { get; private set; } = null!;
public static ModManager ModManager { get; private set; } = null!; public static ModManager ModManager { get; private set; } = null!;
public static ResourceLoader ResourceLoader { get; set; } = null!; public static ResourceLoader ResourceLoader { get; set; } = null!;
@ -68,7 +62,6 @@ public class Penumbra : IDalamudPlugin
ResidentResources = new ResidentResourceManager(); ResidentResources = new ResidentResourceManager();
CharacterUtility = new CharacterUtility(); CharacterUtility = new CharacterUtility();
MetaDefaults = new MetaDefaults();
ResourceLoader = new ResourceLoader( this ); ResourceLoader = new ResourceLoader( this );
ResourceLogger = new ResourceLogger( ResourceLoader ); ResourceLogger = new ResourceLogger( ResourceLoader );
ModManager = new ModManager(); ModManager = new ModManager();