mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 15:27:51 +01:00
Display the additional path data in ResourceTree
This commit is contained in:
parent
b2e1bff782
commit
a6661f15e8
5 changed files with 28 additions and 24 deletions
|
|
@ -111,12 +111,18 @@ internal unsafe partial record ResolveContext(
|
|||
if (resourceHandle == null)
|
||||
throw new ArgumentNullException(nameof(resourceHandle));
|
||||
|
||||
var fullPath = Utf8GamePath.FromByteString(GetResourceHandlePath(resourceHandle), out var p) ? new FullPath(p) : FullPath.Empty;
|
||||
var fileName = resourceHandle->FileName.AsSpan();
|
||||
var additionalData = ByteString.Empty;
|
||||
if (PathDataHandler.Split(fileName, out fileName, out var data))
|
||||
additionalData = ByteString.FromSpanUnsafe(data, false).Clone();
|
||||
|
||||
var fullPath = Utf8GamePath.FromSpan(fileName, out var p) ? new FullPath(p.Clone()) : FullPath.Empty;
|
||||
|
||||
var node = new ResourceNode(type, objectAddress, (nint)resourceHandle, GetResourceHandleLength(resourceHandle), this)
|
||||
{
|
||||
GamePath = gamePath,
|
||||
FullPath = fullPath,
|
||||
GamePath = gamePath,
|
||||
FullPath = fullPath,
|
||||
AdditionalData = additionalData,
|
||||
};
|
||||
if (autoAdd)
|
||||
Global.Nodes.Add((gamePath, (nint)resourceHandle), node);
|
||||
|
|
@ -365,21 +371,6 @@ internal unsafe partial record ResolveContext(
|
|||
return i >= 0 && i < array.Length ? array[i] : null;
|
||||
}
|
||||
|
||||
internal static ByteString GetResourceHandlePath(ResourceHandle* handle, bool stripPrefix = true)
|
||||
{
|
||||
if (handle == null)
|
||||
return ByteString.Empty;
|
||||
|
||||
var name = handle->FileName.AsByteString();
|
||||
if (name.IsEmpty)
|
||||
return ByteString.Empty;
|
||||
|
||||
if (stripPrefix && PathDataHandler.Split(name.Span, out var path, out _))
|
||||
name = ByteString.FromSpanUnsafe(path, name.IsNullTerminated, name.IsAsciiLowerCase, name.IsAscii);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private static ulong GetResourceHandleLength(ResourceHandle* handle)
|
||||
{
|
||||
if (handle == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue