mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +01:00
Change ResourceHandle strings a bit.
This commit is contained in:
parent
471005b5b1
commit
7ab1426a2c
3 changed files with 10 additions and 5 deletions
|
|
@ -182,7 +182,7 @@ public unsafe partial class ResourceLoader
|
|||
return ReadSqPackHook.Original( resourceManager, fileDescriptor, priority, isSync );
|
||||
}
|
||||
|
||||
if( !Utf8GamePath.FromSpan( fileDescriptor->ResourceHandle->FileNameSpan(), out var gamePath, false ) || gamePath.Length == 0 )
|
||||
if( !fileDescriptor->ResourceHandle->GamePath(out var gamePath) || gamePath.Length == 0 )
|
||||
{
|
||||
return ReadSqPackHook.Original( resourceManager, fileDescriptor, priority, isSync );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ using System.Runtime.InteropServices;
|
|||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
|
||||
namespace Penumbra.Interop.Structs;
|
||||
|
||||
|
|
@ -40,7 +42,7 @@ public unsafe struct ResourceHandle
|
|||
|
||||
public const int SsoSize = 15;
|
||||
|
||||
public byte* FileName()
|
||||
public byte* FileNamePtr()
|
||||
{
|
||||
if( FileNameLength > SsoSize )
|
||||
{
|
||||
|
|
@ -53,8 +55,11 @@ public unsafe struct ResourceHandle
|
|||
}
|
||||
}
|
||||
|
||||
public ReadOnlySpan< byte > FileNameSpan()
|
||||
=> new(FileName(), FileNameLength);
|
||||
public ByteString FileName()
|
||||
=> ByteString.FromByteStringUnsafe( FileNamePtr(), FileNameLength, true );
|
||||
|
||||
public bool GamePath( out Utf8GamePath path )
|
||||
=> Utf8GamePath.FromSpan( new ReadOnlySpan< byte >( FileNamePtr(), FileNameLength ), out path );
|
||||
|
||||
[FieldOffset( 0x00 )]
|
||||
public void** VTable;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public partial class ConfigWindow
|
|||
|
||||
// Draw the name of a resource file.
|
||||
private static unsafe void Text( ResourceHandle* resource )
|
||||
=> Text( resource->FileName(), resource->FileNameLength );
|
||||
=> Text( resource->FileName().Path, resource->FileNameLength );
|
||||
|
||||
// Draw a ByteString as a selectable.
|
||||
internal static unsafe bool Selectable( ByteString s, bool selected )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue