Updated ResourceLoader to possibly deal with SSO.

This commit is contained in:
Ottermandias 2021-07-17 23:45:40 +02:00
parent 83cad76b62
commit fa6516ac5d
2 changed files with 20 additions and 2 deletions

View file

@ -201,7 +201,7 @@ namespace Penumbra.Interop
return ReadSqpackHook?.OriginalFunction( pFileHandler, pFileDesc, priority, isSync ) ?? 0;
}
var gameFsPath = Marshal.PtrToStringAnsi( new IntPtr( pFileDesc->ResourceHandle->FileName ) );
var gameFsPath = Marshal.PtrToStringAnsi( new IntPtr( pFileDesc->ResourceHandle->FileName() ) );
var isRooted = Path.IsPathRooted( gameFsPath );

View file

@ -5,7 +5,25 @@ namespace Penumbra.Structs
[StructLayout( LayoutKind.Explicit )]
public unsafe struct ResourceHandle
{
public const int SsoSize = 15;
public byte* FileName()
{
if( FileNameLength > SsoSize )
{
return _fileName;
}
fixed( byte** name = &_fileName )
{
return ( byte* )name;
}
}
[FieldOffset( 0x48 )]
public byte* FileName;
private byte* _fileName;
[FieldOffset( 0x58 )]
public int FileNameLength;
}
}