mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-22 15:57:46 +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:
|
case CollectionType.Default:
|
||||||
Default = newCollection;
|
Default = newCollection;
|
||||||
if( Penumbra.CharacterUtility.Ready )
|
if( Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods)
|
||||||
{
|
{
|
||||||
Penumbra.ResidentResources.Reload();
|
Penumbra.ResidentResources.Reload();
|
||||||
Default.SetFiles();
|
Default.SetFiles();
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ public partial class ModCollection
|
||||||
|
|
||||||
++_collection.ChangeCounter;
|
++_collection.ChangeCounter;
|
||||||
|
|
||||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready )
|
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods )
|
||||||
{
|
{
|
||||||
Penumbra.ResidentResources.Reload();
|
Penumbra.ResidentResources.Reload();
|
||||||
MetaManipulations.SetFiles();
|
MetaManipulations.SetFiles();
|
||||||
|
|
@ -239,7 +239,7 @@ public partial class ModCollection
|
||||||
if( addMetaChanges )
|
if( addMetaChanges )
|
||||||
{
|
{
|
||||||
++_collection.ChangeCounter;
|
++_collection.ChangeCounter;
|
||||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready )
|
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods )
|
||||||
{
|
{
|
||||||
Penumbra.ResidentResources.Reload();
|
Penumbra.ResidentResources.Reload();
|
||||||
MetaManipulations.SetFiles();
|
MetaManipulations.SetFiles();
|
||||||
|
|
@ -297,7 +297,7 @@ public partial class ModCollection
|
||||||
AddMetaFiles();
|
AddMetaFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready )
|
if( _collection == Penumbra.CollectionManager.Default && Penumbra.CharacterUtility.Ready && Penumbra.Config.EnableMods )
|
||||||
{
|
{
|
||||||
Penumbra.ResidentResources.Reload();
|
Penumbra.ResidentResources.Reload();
|
||||||
MetaManipulations.SetFiles();
|
MetaManipulations.SetFiles();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ public unsafe partial class CharacterUtility
|
||||||
public readonly InternalIndex Index;
|
public readonly InternalIndex Index;
|
||||||
public readonly Structs.CharacterUtility.Index GlobalIndex;
|
public readonly Structs.CharacterUtility.Index GlobalIndex;
|
||||||
|
|
||||||
public IReadOnlyCollection< MetaReverter > Entries
|
public IReadOnlyCollection< MetaReverter > Entries
|
||||||
=> _entries;
|
=> _entries;
|
||||||
|
|
||||||
private IntPtr _defaultResourceData = IntPtr.Zero;
|
private IntPtr _defaultResourceData = IntPtr.Zero;
|
||||||
|
|
@ -95,8 +95,14 @@ public unsafe partial class CharacterUtility
|
||||||
{
|
{
|
||||||
if( _entries.Count > 0 )
|
if( _entries.Count > 0 )
|
||||||
{
|
{
|
||||||
|
foreach( var entry in _entries )
|
||||||
|
{
|
||||||
|
entry.Disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
_entries.Clear();
|
_entries.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetResourceInternal();
|
ResetResourceInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,6 +112,7 @@ public unsafe partial class CharacterUtility
|
||||||
public readonly IntPtr Data;
|
public readonly IntPtr Data;
|
||||||
public readonly int Length;
|
public readonly int Length;
|
||||||
public readonly bool Resetter;
|
public readonly bool Resetter;
|
||||||
|
public bool Disposed;
|
||||||
|
|
||||||
public MetaReverter( List list, IntPtr data, int length )
|
public MetaReverter( List list, IntPtr data, int length )
|
||||||
{
|
{
|
||||||
|
|
@ -124,29 +131,34 @@ public unsafe partial class CharacterUtility
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
var list = List._entries;
|
if( !Disposed )
|
||||||
var wasCurrent = ReferenceEquals( this, list.First?.Value );
|
|
||||||
list.Remove( this );
|
|
||||||
if( !wasCurrent )
|
|
||||||
{
|
{
|
||||||
return;
|
var list = List._entries;
|
||||||
}
|
var wasCurrent = ReferenceEquals( this, list.First?.Value );
|
||||||
|
list.Remove( this );
|
||||||
|
if( !wasCurrent )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( list.Count == 0 )
|
if( list.Count == 0 )
|
||||||
{
|
|
||||||
List.SetResourceToDefaultCollection();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var next = list.First!.Value;
|
|
||||||
if( next.Resetter )
|
|
||||||
{
|
{
|
||||||
List.SetResourceToDefaultCollection();
|
List.SetResourceToDefaultCollection();
|
||||||
}
|
}
|
||||||
else
|
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 )
|
private byte SetupVisorDetour( IntPtr drawObject, ushort modelId, byte visorState )
|
||||||
{
|
{
|
||||||
var resolveData = GetResolveData( drawObject );
|
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 );
|
return _setupVisorHook.Original( drawObject, modelId, visorState );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,7 +184,7 @@ public unsafe partial class PathResolver
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var resolveData = GetResolveData( drawObject );
|
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 );
|
_rspSetupCharacterHook.Original( drawObject, unk2, unk3, unk4, unk5 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +200,7 @@ public unsafe partial class PathResolver
|
||||||
{
|
{
|
||||||
_inChangeCustomize = true;
|
_inChangeCustomize = true;
|
||||||
var resolveData = GetResolveData( human );
|
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
|
using var decals = resolveData.Valid
|
||||||
? new CharacterUtility.DecalReverter( resolveData.ModCollection, DrawObjectState.UsesDecal( 0, data ) )
|
? new CharacterUtility.DecalReverter( resolveData.ModCollection, DrawObjectState.UsesDecal( 0, data ) )
|
||||||
: null;
|
: null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue