Revert stupid changes due to ResourceCategory change.

This commit is contained in:
Ottermandias 2023-10-05 21:22:09 +02:00
parent 48863c1b64
commit 422324b6d7
4 changed files with 11 additions and 20 deletions

@ -1 +1 @@
Subproject commit f97df642999d4edc6dce7fac64903485b5a2fa11 Subproject commit 34e3299f28c5e1d2b7d071ba8a3f851f5d1fa057

View file

@ -92,7 +92,7 @@ public unsafe class ResourceLoader : IDisposable
if (resolvedPath == null || !Utf8GamePath.FromByteString(resolvedPath.Value.InternalName, out var p)) if (resolvedPath == null || !Utf8GamePath.FromByteString(resolvedPath.Value.InternalName, out var p))
{ {
returnValue = _resources.GetOriginalResource(sync, ref category, ref type, ref hash, path.Path, parameters); returnValue = _resources.GetOriginalResource(sync, category, type, hash, path.Path, parameters);
ResourceLoaded?.Invoke(returnValue, path, resolvedPath, data); ResourceLoaded?.Invoke(returnValue, path, resolvedPath, data);
return; return;
} }
@ -102,7 +102,7 @@ public unsafe class ResourceLoader : IDisposable
hash = ComputeHash(resolvedPath.Value.InternalName, parameters); hash = ComputeHash(resolvedPath.Value.InternalName, parameters);
var oldPath = path; var oldPath = path;
path = p; path = p;
returnValue = _resources.GetOriginalResource(sync, ref category, ref type, ref hash, path.Path, parameters); returnValue = _resources.GetOriginalResource(sync, category, type, hash, path.Path, parameters);
ResourceLoaded?.Invoke(returnValue, oldPath, resolvedPath.Value, data); ResourceLoaded?.Invoke(returnValue, oldPath, resolvedPath.Value, data);
} }

View file

@ -110,26 +110,17 @@ public unsafe class ResourceService : IDisposable
if (returnValue != null) if (returnValue != null)
return returnValue; return returnValue;
return GetOriginalResource(isSync, categoryId, resourceType, resourceHash, gamePath.Path.Path, pGetResParams, isUnk); return GetOriginalResource(isSync, *categoryId, *resourceType, *resourceHash, gamePath.Path, pGetResParams, isUnk);
} }
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,
resourceParameters)
: _getResourceAsyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, categoryId, type, hash, path,
resourceParameters, unk);
/// <summary> Call the original GetResource function. </summary> /// <summary> Call the original GetResource function. </summary>
public ResourceHandle* GetOriginalResource(bool sync, ref ResourceCategory categoryId, ref ResourceType type, ref int hash, ByteString path, public ResourceHandle* GetOriginalResource(bool sync, ResourceCategory categoryId, ResourceType type, int hash, ByteString path,
GetResourceParameters* resourceParameters = null, bool unk = false) GetResourceParameters* resourceParameters = null, bool unk = false)
{ => sync
var ptrCategory = (ResourceCategory*)Unsafe.AsPointer(ref categoryId); ? _getResourceSyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, &categoryId, &type, &hash, path.Path,
var ptrType = (ResourceType*)Unsafe.AsPointer(ref type); resourceParameters)
var ptrHash = (int*)Unsafe.AsPointer(ref hash); : _getResourceAsyncHook.OriginalDisposeSafe(_resourceManager.ResourceManager, &categoryId, &type, &hash, path.Path,
return GetOriginalResource(sync, ptrCategory, ptrType, ptrHash, path.Path, resourceParameters, unk); resourceParameters, unk);
}
#endregion #endregion

View file

@ -858,7 +858,7 @@ public class DebugTab : Window, ITab
return; return;
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TextUnformatted(r->Category.ToString()); ImGui.TextUnformatted(((ResourceCategory)r->Type.Value).ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TextUnformatted(r->FileType.ToString("X")); ImGui.TextUnformatted(r->FileType.ToString("X"));
ImGui.TableNextColumn(); ImGui.TableNextColumn();