mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Make IMC handler load temp collections correctly.
This commit is contained in:
parent
00e1736d13
commit
39d339a3d8
4 changed files with 10 additions and 5 deletions
|
|
@ -474,7 +474,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
int priority )
|
||||
{
|
||||
CheckInitialized();
|
||||
if( !Penumbra.TempMods.Collections.Values.FindFirst( c => c.Name == collectionName, out var collection )
|
||||
if( !Penumbra.TempMods.CollectionByName( collectionName, out var collection )
|
||||
&& !Penumbra.CollectionManager.ByName( collectionName, out collection ) )
|
||||
{
|
||||
return PenumbraApiEc.CollectionMissing;
|
||||
|
|
@ -511,7 +511,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
public PenumbraApiEc RemoveTemporaryMod( string tag, string collectionName, int priority )
|
||||
{
|
||||
CheckInitialized();
|
||||
if( !Penumbra.TempMods.Collections.Values.FindFirst( c => c.Name == collectionName, out var collection )
|
||||
if( !Penumbra.TempMods.CollectionByName( collectionName, out var collection )
|
||||
&& !Penumbra.CollectionManager.ByName( collectionName, out collection ) )
|
||||
{
|
||||
return PenumbraApiEc.CollectionMissing;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using OtterGui;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
|
|
@ -29,6 +32,9 @@ public class TempModManager
|
|||
public IReadOnlyDictionary< string, ModCollection > Collections
|
||||
=> _collections;
|
||||
|
||||
public bool CollectionByName( string name, [NotNullWhen( true )] out ModCollection? collection )
|
||||
=> Collections.Values.FindFirst( c => string.Equals( c.Name, name, StringComparison.OrdinalIgnoreCase ), out collection );
|
||||
|
||||
// These functions to check specific redirections or meta manipulations for existence are currently unused.
|
||||
//public bool IsRegistered( string tag, ModCollection? collection, Utf8GamePath gamePath, out FullPath? fullPath, out int priority )
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -82,8 +82,7 @@ public unsafe partial class PathResolver
|
|||
|
||||
var lastUnderscore = split.LastIndexOf( ( byte )'_' );
|
||||
var name = lastUnderscore == -1 ? split.ToString() : split.Substring( 0, lastUnderscore ).ToString();
|
||||
if( Penumbra.TempMods.Collections.Values.FindFirst( c => string.Equals( c.Name, name, StringComparison.OrdinalIgnoreCase ),
|
||||
out var collection )
|
||||
if( Penumbra.TempMods.CollectionByName( name, out var collection )
|
||||
|| Penumbra.CollectionManager.ByName( name, out collection ) )
|
||||
{
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ public partial class MetaManager
|
|||
|
||||
var lastUnderscore = split.LastIndexOf( ( byte )'_' );
|
||||
var name = lastUnderscore == -1 ? split.ToString() : split.Substring( 0, lastUnderscore ).ToString();
|
||||
if( ( Penumbra.TempMods.Collections.TryGetValue( name, out var collection )
|
||||
if( ( Penumbra.TempMods.CollectionByName( name, out var collection )
|
||||
|| Penumbra.CollectionManager.ByName( name, out collection ) )
|
||||
&& collection.HasCache
|
||||
&& collection.MetaCache!._imcFiles.TryGetValue( Utf8GamePath.FromSpan( path.Span, out var p ) ? p : Utf8GamePath.Empty, out var file ) )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue