mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Maybe fix face decals not correctly reloading in character collections.
This commit is contained in:
parent
fc1255661c
commit
d2f84aa976
4 changed files with 24 additions and 7 deletions
|
|
@ -24,15 +24,16 @@ public unsafe partial class PathResolver
|
||||||
[Signature( "E8 ?? ?? ?? ?? 48 85 C0 74 21 C7 40" )]
|
[Signature( "E8 ?? ?? ?? ?? 48 85 C0 74 21 C7 40" )]
|
||||||
public Hook< CharacterBaseCreateDelegate >? CharacterBaseCreateHook;
|
public Hook< CharacterBaseCreateDelegate >? CharacterBaseCreateHook;
|
||||||
|
|
||||||
|
private ModCollection? _lastCreatedCollection;
|
||||||
|
|
||||||
private IntPtr CharacterBaseCreateDetour( uint a, IntPtr b, IntPtr c, byte d )
|
private IntPtr CharacterBaseCreateDetour( uint a, IntPtr b, IntPtr c, byte d )
|
||||||
{
|
{
|
||||||
using var cmp = MetaChanger.ChangeCmp( this, out var collection );
|
using var cmp = MetaChanger.ChangeCmp( this, out _lastCreatedCollection );
|
||||||
var ret = CharacterBaseCreateHook!.Original( a, b, c, d );
|
var ret = CharacterBaseCreateHook!.Original( a, b, c, d );
|
||||||
if( LastGameObject != null )
|
if( LastGameObject != null )
|
||||||
{
|
{
|
||||||
DrawObjectToObject[ ret ] = ( collection!, LastGameObject->ObjectIndex );
|
DrawObjectToObject[ ret ] = (_lastCreatedCollection!, LastGameObject->ObjectIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ public unsafe partial class PathResolver
|
||||||
// RSP
|
// RSP
|
||||||
public delegate void RspSetupCharacterDelegate( IntPtr drawObject, IntPtr unk2, float unk3, IntPtr unk4, byte unk5 );
|
public delegate void RspSetupCharacterDelegate( IntPtr drawObject, IntPtr unk2, float unk3, IntPtr unk4, byte unk5 );
|
||||||
|
|
||||||
[Signature( "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 88 54 24 ?? 57 41 56 ", DetourName = "RspSetupCharacterDetour" )]
|
[Signature( "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 88 54 24 ?? 57 41 56", DetourName = "RspSetupCharacterDetour" )]
|
||||||
public Hook< RspSetupCharacterDelegate >? RspSetupCharacterHook;
|
public Hook< RspSetupCharacterDelegate >? RspSetupCharacterHook;
|
||||||
|
|
||||||
private void RspSetupCharacterDetour( IntPtr drawObject, IntPtr unk2, float unk3, IntPtr unk4, byte unk5 )
|
private void RspSetupCharacterDetour( IntPtr drawObject, IntPtr unk2, float unk3, IntPtr unk4, byte unk5 )
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ public unsafe partial class PathResolver
|
||||||
// Humans
|
// Humans
|
||||||
private IntPtr ResolveDecalDetour( IntPtr drawObject, IntPtr path, IntPtr unk3, uint unk4 )
|
private IntPtr ResolveDecalDetour( IntPtr drawObject, IntPtr path, IntPtr unk3, uint unk4 )
|
||||||
=> ResolvePathDetour( drawObject, ResolveDecalPathHook!.Original( drawObject, path, unk3, unk4 ) );
|
=> ResolvePathDetour( drawObject, ResolveDecalPathHook!.Original( drawObject, path, unk3, unk4 ) );
|
||||||
|
|
||||||
private IntPtr ResolveEidDetour( IntPtr drawObject, IntPtr path, IntPtr unk3 )
|
private IntPtr ResolveEidDetour( IntPtr drawObject, IntPtr path, IntPtr unk3 )
|
||||||
=> ResolvePathDetour( drawObject, ResolveEidPathHook!.Original( drawObject, path, unk3 ) );
|
=> ResolvePathDetour( drawObject, ResolveEidPathHook!.Original( drawObject, path, unk3 ) );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,14 @@ public partial class PathResolver : IDisposable
|
||||||
private bool CharacterResolver( Utf8GamePath gamePath, ResourceCategory _1, ResourceType type, int _2, out (FullPath?, object?) data )
|
private bool CharacterResolver( Utf8GamePath gamePath, ResourceCategory _1, ResourceType type, int _2, out (FullPath?, object?) data )
|
||||||
{
|
{
|
||||||
// Check if the path was marked for a specific collection,
|
// Check if the path was marked for a specific collection,
|
||||||
// or if it is a file loaded by a material, and if we are currently in a material load.
|
// or if it is a file loaded by a material, and if we are currently in a material load,
|
||||||
|
// or if it is a face decal path and the current mod collection is set.
|
||||||
// If not use the default collection.
|
// If not use the default collection.
|
||||||
// We can remove paths after they have actually been loaded.
|
// We can remove paths after they have actually been loaded.
|
||||||
// A potential next request will add the path anew.
|
// A potential next request will add the path anew.
|
||||||
var nonDefault = HandleMaterialSubFiles( type, out var collection ) || PathCollections.TryRemove( gamePath.Path, out collection );
|
var nonDefault = HandleMaterialSubFiles( type, out var collection )
|
||||||
|
|| PathCollections.TryRemove( gamePath.Path, out collection )
|
||||||
|
|| HandleDecalFile( type, gamePath, out collection );
|
||||||
if( !nonDefault )
|
if( !nonDefault )
|
||||||
{
|
{
|
||||||
collection = Penumbra.CollectionManager.Default;
|
collection = Penumbra.CollectionManager.Default;
|
||||||
|
|
@ -53,6 +56,20 @@ public partial class PathResolver : IDisposable
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HandleDecalFile( ResourceType type, Utf8GamePath gamePath, out ModCollection? collection )
|
||||||
|
{
|
||||||
|
if( type == ResourceType.Tex
|
||||||
|
&& _lastCreatedCollection != null
|
||||||
|
&& gamePath.Path.Substring( "chara/common/texture/".Length ).StartsWith( 'd', 'e', 'c', 'a', 'l', '_', 'f', 'a', 'c', 'e' ) )
|
||||||
|
{
|
||||||
|
collection = _lastCreatedCollection;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
collection = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void Enable()
|
public void Enable()
|
||||||
{
|
{
|
||||||
if( Enabled )
|
if( Enabled )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue