From 9ce948e2380904877e4ac922121918010387c8c2 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sun, 4 Sep 2022 02:51:42 +0200 Subject: [PATCH] Stop replacing UI hashes to test if that fixes crashes. --- Penumbra/Interop/Loader/ResourceLoader.Debug.cs | 1 - .../Interop/Loader/ResourceLoader.Replacement.cs | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Penumbra/Interop/Loader/ResourceLoader.Debug.cs b/Penumbra/Interop/Loader/ResourceLoader.Debug.cs index bdcf1220..02af20ce 100644 --- a/Penumbra/Interop/Loader/ResourceLoader.Debug.cs +++ b/Penumbra/Interop/Loader/ResourceLoader.Debug.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection.Metadata; using Dalamud.Hooking; using Dalamud.Logging; using Dalamud.Utility.Signatures; diff --git a/Penumbra/Interop/Loader/ResourceLoader.Replacement.cs b/Penumbra/Interop/Loader/ResourceLoader.Replacement.cs index c14a6720..ddbcf10f 100644 --- a/Penumbra/Interop/Loader/ResourceLoader.Replacement.cs +++ b/Penumbra/Interop/Loader/ResourceLoader.Replacement.cs @@ -97,9 +97,15 @@ public unsafe partial class ResourceLoader return retUnmodified; } - // Replace the hash and path with the correct one for the replacement. - *resourceHash = ComputeHash( resolvedPath.Value.InternalName, pGetResParams ); - path = resolvedPath.Value.InternalName.Path; + // Replace the hash and path with the correct one for the replacement, + // but only for non-UI files. UI files can not reasonably be loaded multiple times at once, + // and seem to cause concurrency problems if multiple UI parts use the same resource for different use-cases. + if( *categoryId != ResourceCategory.Ui ) + { + *resourceHash = ComputeHash( resolvedPath.Value.InternalName, pGetResParams ); + } + + path = resolvedPath.Value.InternalName.Path; var retModified = CallOriginalHandler( isSync, resourceManager, categoryId, resourceType, resourceHash, path, pGetResParams, isUnk ); ResourceLoaded?.Invoke( ( Structs.ResourceHandle* )retModified, gamePath, resolvedPath.Value, data ); return retModified;