mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-09 17:44:42 +01:00
Fix some meta bugs.
This commit is contained in:
parent
35c6e0ec88
commit
62d3053d34
4 changed files with 35 additions and 23 deletions
|
|
@ -97,7 +97,7 @@ public partial class ModCollection
|
|||
{
|
||||
case CollectionType.Default:
|
||||
Default = newCollection;
|
||||
if( Penumbra.CharacterUtility.Ready )
|
||||
if( Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods)
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
Default.SetFiles();
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public partial class ModCollection
|
|||
|
||||
++_collection.ChangeCounter;
|
||||
|
||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready )
|
||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods )
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
MetaManipulations.SetFiles();
|
||||
|
|
@ -239,7 +239,7 @@ public partial class ModCollection
|
|||
if( addMetaChanges )
|
||||
{
|
||||
++_collection.ChangeCounter;
|
||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready )
|
||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods )
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
MetaManipulations.SetFiles();
|
||||
|
|
@ -297,7 +297,7 @@ public partial class ModCollection
|
|||
AddMetaFiles();
|
||||
}
|
||||
|
||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready )
|
||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods )
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
MetaManipulations.SetFiles();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public unsafe partial class CharacterUtility
|
|||
public readonly InternalIndex Index;
|
||||
public readonly Structs.CharacterUtility.Index GlobalIndex;
|
||||
|
||||
public IReadOnlyCollection< MetaReverter > Entries
|
||||
public IReadOnlyCollection< MetaReverter > Entries
|
||||
=> _entries;
|
||||
|
||||
private IntPtr _defaultResourceData = IntPtr.Zero;
|
||||
|
|
@ -95,8 +95,14 @@ public unsafe partial class CharacterUtility
|
|||
{
|
||||
if( _entries.Count > 0 )
|
||||
{
|
||||
foreach( var entry in _entries )
|
||||
{
|
||||
entry.Disposed = true;
|
||||
}
|
||||
|
||||
_entries.Clear();
|
||||
}
|
||||
|
||||
ResetResourceInternal();
|
||||
}
|
||||
|
||||
|
|
@ -106,6 +112,7 @@ public unsafe partial class CharacterUtility
|
|||
public readonly IntPtr Data;
|
||||
public readonly int Length;
|
||||
public readonly bool Resetter;
|
||||
public bool Disposed;
|
||||
|
||||
public MetaReverter( List list, IntPtr data, int length )
|
||||
{
|
||||
|
|
@ -124,29 +131,34 @@ public unsafe partial class CharacterUtility
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
var list = List._entries;
|
||||
var wasCurrent = ReferenceEquals( this, list.First?.Value );
|
||||
list.Remove( this );
|
||||
if( !wasCurrent )
|
||||
if( !Disposed )
|
||||
{
|
||||
return;
|
||||
}
|
||||
var list = List._entries;
|
||||
var wasCurrent = ReferenceEquals( this, list.First?.Value );
|
||||
list.Remove( this );
|
||||
if( !wasCurrent )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( list.Count == 0 )
|
||||
{
|
||||
List.SetResourceToDefaultCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
var next = list.First!.Value;
|
||||
if( next.Resetter )
|
||||
if( list.Count == 0 )
|
||||
{
|
||||
List.SetResourceToDefaultCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
List.SetResourceInternal( next.Data, next.Length );
|
||||
var next = list.First!.Value;
|
||||
if( next.Resetter )
|
||||
{
|
||||
List.SetResourceToDefaultCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
List.SetResourceInternal( next.Data, next.Length );
|
||||
}
|
||||
}
|
||||
|
||||
Disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public unsafe partial class PathResolver
|
|||
private byte SetupVisorDetour( IntPtr drawObject, ushort modelId, byte visorState )
|
||||
{
|
||||
var resolveData = GetResolveData( drawObject );
|
||||
using var eqp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetGmpFile() : null;
|
||||
using var gmp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetGmpFile() : null;
|
||||
return _setupVisorHook.Original( drawObject, modelId, visorState );
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ public unsafe partial class PathResolver
|
|||
else
|
||||
{
|
||||
var resolveData = GetResolveData( drawObject );
|
||||
using var eqp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetCmpFile() : null;
|
||||
using var cmp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetCmpFile() : null;
|
||||
_rspSetupCharacterHook.Original( drawObject, unk2, unk3, unk4, unk5 );
|
||||
}
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ public unsafe partial class PathResolver
|
|||
{
|
||||
_inChangeCustomize = true;
|
||||
var resolveData = GetResolveData( human );
|
||||
using var eqp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetEqpFile() : null;
|
||||
using var cmp = resolveData.Valid ? resolveData.ModCollection.TemporarilySetCmpFile() : null;
|
||||
using var decals = resolveData.Valid
|
||||
? new CharacterUtility.DecalReverter( resolveData.ModCollection, DrawObjectState.UsesDecal( 0, data ) )
|
||||
: null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue