mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-22 07:47:48 +01:00
Minor changes.
This commit is contained in:
parent
a3ddce0ef5
commit
30a957356a
6 changed files with 33 additions and 29 deletions
|
|
@ -143,11 +143,11 @@ internal unsafe struct Record
|
|||
Crc64 = 0,
|
||||
};
|
||||
|
||||
public static Record CreateResourceComplete(CiByteString path, ResourceHandle* handle, Utf8GamePath originalPath)
|
||||
public static Record CreateResourceComplete(CiByteString path, ResourceHandle* handle, Utf8GamePath originalPath, ReadOnlySpan<byte> additionalData)
|
||||
=> new()
|
||||
{
|
||||
Time = DateTime.UtcNow,
|
||||
Path = path.IsOwned ? path : path.Clone(),
|
||||
Path = CombinedPath(path, additionalData),
|
||||
OriginalPath = originalPath.Path.IsOwned ? originalPath.Path : originalPath.Path.Clone(),
|
||||
Collection = null,
|
||||
Handle = handle,
|
||||
|
|
@ -162,4 +162,17 @@ internal unsafe struct Record
|
|||
LoadState = handle->LoadState,
|
||||
Crc64 = 0,
|
||||
};
|
||||
|
||||
private static CiByteString CombinedPath(CiByteString path, ReadOnlySpan<byte> additionalData)
|
||||
{
|
||||
if (additionalData.Length is 0)
|
||||
return path.IsOwned ? path : path.Clone();
|
||||
|
||||
fixed (byte* ptr = additionalData)
|
||||
{
|
||||
// If a path has additional data and is split, it is always in the form of |{additionalData}|{path},
|
||||
// so we can just read from the start of additional data - 1 and sum their length +2 for the pipes.
|
||||
return new CiByteString(new ReadOnlySpan<byte>(ptr - 1, additionalData.Length + 2 + path.Length)).Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ public sealed class ResourceWatcher : IDisposable, ITab, IUiService
|
|||
_newRecords.Enqueue(record);
|
||||
}
|
||||
|
||||
private unsafe void OnResourceComplete(ResourceHandle* resource, CiByteString path, Utf8GamePath original, ReadOnlySpan<byte> _, bool isAsync)
|
||||
private unsafe void OnResourceComplete(ResourceHandle* resource, CiByteString path, Utf8GamePath original, ReadOnlySpan<byte> additionalData, bool isAsync)
|
||||
{
|
||||
if (!isAsync)
|
||||
return;
|
||||
|
|
@ -269,7 +269,7 @@ public sealed class ResourceWatcher : IDisposable, ITab, IUiService
|
|||
if (!_ephemeral.EnableResourceWatcher)
|
||||
return;
|
||||
|
||||
var record = Record.CreateResourceComplete(path, resource, original);
|
||||
var record = Record.CreateResourceComplete(path, resource, original, additionalData);
|
||||
if (!_ephemeral.OnlyAddMatchingResources || _table.WouldBeVisible(record))
|
||||
_newRecords.Enqueue(record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1104,7 +1104,7 @@ public class DebugTab : Window, ITab, IUiService
|
|||
|
||||
private unsafe void DrawResourceLoader()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Resource Loader"))
|
||||
if (!ImUtf8.CollapsingHeader("Resource Loader"u8))
|
||||
return;
|
||||
|
||||
var ongoingLoads = _resourceLoader.OngoingLoads;
|
||||
|
|
@ -1125,12 +1125,9 @@ public class DebugTab : Window, ITab, IUiService
|
|||
|
||||
foreach (var (handle, original) in ongoingLoads)
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
ImUtf8.Text($"0x{handle:X}");
|
||||
ImGui.TableNextColumn();
|
||||
ImUtf8.Text(((ResourceHandle*)handle)->CsHandle.FileName);
|
||||
ImGui.TableNextColumn();
|
||||
ImUtf8.Text(original.Path.Span);
|
||||
ImUtf8.DrawTableColumn($"0x{handle:X}");
|
||||
ImUtf8.DrawTableColumn(((ResourceHandle*)handle)->CsHandle.FileName);
|
||||
ImUtf8.DrawTableColumn(original.Path.Span);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue