diff --git a/Penumbra/Interop/ResourceLoading/ResourceLoader.cs b/Penumbra/Interop/ResourceLoading/ResourceLoader.cs index 94fdcce4..b8cc4742 100644 --- a/Penumbra/Interop/ResourceLoading/ResourceLoader.cs +++ b/Penumbra/Interop/ResourceLoading/ResourceLoader.cs @@ -76,8 +76,7 @@ public unsafe class ResourceLoader : IDisposable } private void ResourceHandler(ref ResourceCategory category, ref ResourceType type, ref int hash, ref Utf8GamePath path, - Utf8GamePath original, - GetResourceParameters* parameters, ref bool sync, ref ResourceHandle* returnValue) + Utf8GamePath original, GetResourceParameters* parameters, ref bool sync, ref ResourceHandle* returnValue) { if (returnValue != null) return; @@ -93,7 +92,7 @@ public unsafe class ResourceLoader : IDisposable if (resolvedPath == null || !Utf8GamePath.FromByteString(resolvedPath.Value.InternalName, out var p)) { - returnValue = _resources.GetOriginalResource(sync, category, type, hash, path.Path, parameters); + returnValue = _resources.GetOriginalResource(sync, ref category, ref type, ref hash, path.Path, parameters); ResourceLoaded?.Invoke(returnValue, path, resolvedPath, data); return; } @@ -103,7 +102,7 @@ public unsafe class ResourceLoader : IDisposable hash = ComputeHash(resolvedPath.Value.InternalName, parameters); var oldPath = path; path = p; - returnValue = _resources.GetOriginalResource(sync, category, type, hash, path.Path, parameters); + returnValue = _resources.GetOriginalResource(sync, ref category, ref type, ref hash, path.Path, parameters); ResourceLoaded?.Invoke(returnValue, oldPath, resolvedPath.Value, data); } diff --git a/Penumbra/Interop/ResourceLoading/ResourceService.cs b/Penumbra/Interop/ResourceLoading/ResourceService.cs index 47107f44..792f8a8e 100644 --- a/Penumbra/Interop/ResourceLoading/ResourceService.cs +++ b/Penumbra/Interop/ResourceLoading/ResourceService.cs @@ -110,18 +110,26 @@ public unsafe class ResourceService : IDisposable if (returnValue != null) return returnValue; - return GetOriginalResource(isSync, *categoryId, *resourceType, *resourceHash, gamePath.Path, pGetResParams, isUnk); + return GetOriginalResource(isSync, categoryId, resourceType, resourceHash, gamePath.Path.Path, pGetResParams, isUnk); } - /// Call the original GetResource function. - public ResourceHandle* GetOriginalResource(bool sync, ResourceCategory categoryId, ResourceType type, int hash, ByteString path, + private ResourceHandle* GetOriginalResource(bool sync, ResourceCategory* categoryId, ResourceType* type, int* hash, byte* path, GetResourceParameters* resourceParameters = null, bool unk = false) => sync - ? _getResourceSyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, &categoryId, &type, &hash, path.Path, + ? _getResourceSyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, categoryId, type, hash, path, resourceParameters) - : _getResourceAsyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, &categoryId, &type, &hash, path.Path, - resourceParameters, - unk); + : _getResourceAsyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, categoryId, type, hash, path, + resourceParameters, unk); + + /// Call the original GetResource function. + public ResourceHandle* GetOriginalResource(bool sync, ref ResourceCategory categoryId, ref ResourceType type, ref int hash, ByteString path, + GetResourceParameters* resourceParameters = null, bool unk = false) + { + var ptrCategory = (ResourceCategory*)Unsafe.AsPointer(ref categoryId); + var ptrType = (ResourceType*)Unsafe.AsPointer(ref type); + var ptrHash = (int*)Unsafe.AsPointer(ref hash); + return GetOriginalResource(sync, ptrCategory, ptrType, ptrHash, path.Path, resourceParameters, unk); + } #endregion