Small fixes.

This commit is contained in:
Ottermandias 2021-09-05 00:05:20 +02:00
parent fb2f212970
commit fe0445434f
4 changed files with 10 additions and 4 deletions

Binary file not shown.

View file

@ -111,12 +111,17 @@ namespace Penumbra.Interop
+ $"{ResourceToPath( ( byte* )pResources[ i ] )}" );
UnloadCharacterResource( oldResources[ i ] );
// Temporary fix against crashes?
// Easiest way to actually remove a file from the resource manager.
// Not doing this keeps them in memory for some reason,
// and then corrupts the state when entering a loading screen that is not a teleport.
// This increases the references of all loaded files by one temporarily, but there is extra logic for 0-references,
// and they get loaded anew with GetResourceAsync, but this gets redirected and thus the modded resource reference is increased twice.
// Then it reduces the refcount of all reduces by 1 again, but this time for real, so the resource gets ref count -1, leading to problems.
if( handle->RefCount <= 0 )
{
handle->RefCount = 1;
handle->IncRef();
handle->RefCount = 1;
handle->DecRef();
}
}
}

View file

@ -171,7 +171,7 @@ namespace Penumbra.UI
.GetField( "_changedSettings", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader );
var currentObjectId = ( int? )_penumbra.ObjectReloader.GetType()
var currentObjectId = ( uint? )_penumbra.ObjectReloader.GetType()
.GetField( "_currentObjectId", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader );

View file

@ -115,6 +115,7 @@ namespace Penumbra.UI
{
_config.IsEnabled = enabled;
_configChanged = true;
Service<ResidentResources>.Get().ReloadPlayerResources();
_base._penumbra.ObjectReloader.RedrawAll( enabled ? RedrawType.WithSettings : RedrawType.WithoutSettings );
if( _config.EnablePlayerWatch )
{