From 330bc2b4830026412e65c3d9bbfeed63e415c313 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sun, 16 Jan 2022 01:04:24 -0700 Subject: [PATCH] Ensure Host shim is updated for 13.1.0 --- src/LibHac/Fs/Common/WindowsPath.cs | 4 ++-- src/LibHac/Fs/Impl/CommonMountNames.cs | 19 +++++++++++++++++-- src/LibHac/Fs/Shim/Host.cs | 16 ++++------------ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/LibHac/Fs/Common/WindowsPath.cs b/src/LibHac/Fs/Common/WindowsPath.cs index 57657537..977450fc 100644 --- a/src/LibHac/Fs/Common/WindowsPath.cs +++ b/src/LibHac/Fs/Common/WindowsPath.cs @@ -159,9 +159,9 @@ public static class WindowsPath return DosDevicePathPrefixLength; } - public static bool IsWindowsPath(ReadOnlySpan path, bool checkForwardSlash) + public static bool IsWindowsPath(ReadOnlySpan path, bool allowForwardSlashForUnc) { - return IsWindowsDrive(path) || IsDosDevicePath(path) || IsUncPath(path, checkForwardSlash, true); + return IsWindowsDrive(path) || IsDosDevicePath(path) || IsUncPath(path, allowForwardSlashForUnc, true); } public static int GetWindowsSkipLength(ReadOnlySpan path) diff --git a/src/LibHac/Fs/Impl/CommonMountNames.cs b/src/LibHac/Fs/Impl/CommonMountNames.cs index a3850c88..63e10a9b 100644 --- a/src/LibHac/Fs/Impl/CommonMountNames.cs +++ b/src/LibHac/Fs/Impl/CommonMountNames.cs @@ -7,25 +7,32 @@ public static class CommonMountNames public const char ReservedMountNamePrefixCharacter = '@'; // Filesystem names. + /// "@Host" public static ReadOnlySpan HostRootFileSystemMountName => // "@Host" - new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t' }; + new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t' }; + /// "@Sdcard" public static ReadOnlySpan SdCardFileSystemMountName => // "@Sdcard" new[] { (byte)'@', (byte)'S', (byte)'d', (byte)'c', (byte)'a', (byte)'r', (byte)'d' }; + /// "@Gc" public static ReadOnlySpan GameCardFileSystemMountName => // "@Gc" new[] { (byte)'@', (byte)'G', (byte)'c' }; + /// "U" public static ReadOnlySpan GameCardFileSystemMountNameUpdateSuffix => // "U" new[] { (byte)'U' }; + /// "N" public static ReadOnlySpan GameCardFileSystemMountNameNormalSuffix => // "N" new[] { (byte)'N' }; + /// "S" public static ReadOnlySpan GameCardFileSystemMountNameSecureSuffix => // "S" new[] { (byte)'S' }; // Built-in storage names. + /// "@CalibFile" public static ReadOnlySpan BisCalibrationFilePartitionMountName => // "@CalibFile" new[] { @@ -33,16 +40,20 @@ public static class CommonMountNames (byte)'l', (byte)'e' }; + /// "@Safe" public static ReadOnlySpan BisSafeModePartitionMountName => // "@Safe" new[] { (byte)'@', (byte)'S', (byte)'a', (byte)'f', (byte)'e' }; + /// "@User" public static ReadOnlySpan BisUserPartitionMountName => // "@User" new[] { (byte)'@', (byte)'U', (byte)'s', (byte)'e', (byte)'r' }; + /// "@System" public static ReadOnlySpan BisSystemPartitionMountName => // "@System" new[] { (byte)'@', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; //Content storage names. + /// "@SystemContent" public static ReadOnlySpan ContentStorageSystemMountName => // "@SystemContent" new[] { @@ -50,6 +61,7 @@ public static class CommonMountNames (byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'t' }; + /// "@UserContent" public static ReadOnlySpan ContentStorageUserMountName => // "@UserContent" new[] { @@ -57,6 +69,7 @@ public static class CommonMountNames (byte)'t', (byte)'e', (byte)'n', (byte)'t' }; + /// "@SdCardContent" public static ReadOnlySpan ContentStorageSdCardMountName => // "@SdCardContent" new[] { @@ -65,6 +78,7 @@ public static class CommonMountNames }; // Registered update partition + /// "@RegUpdate" public static ReadOnlySpan RegisteredUpdatePartitionMountName => // "@RegUpdate" new[] { @@ -72,9 +86,10 @@ public static class CommonMountNames (byte)'t', (byte)'e' }; + /// "@Nintendo" public static ReadOnlySpan SdCardNintendoRootDirectoryName => // "Nintendo" new[] { (byte)'N', (byte)'i', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'d', (byte)'o' }; -} +} \ No newline at end of file diff --git a/src/LibHac/Fs/Shim/Host.cs b/src/LibHac/Fs/Shim/Host.cs index fe0d78b5..dc9bc64f 100644 --- a/src/LibHac/Fs/Shim/Host.cs +++ b/src/LibHac/Fs/Shim/Host.cs @@ -19,12 +19,13 @@ namespace LibHac.Fs.Shim; /// /// Contains functions for mounting file systems from a host computer. /// -/// Based on nnSdk 11.4.0 +/// Based on nnSdk 13.4.0 [SkipLocalsInit] public static class Host { - private static ReadOnlySpan HostRootFileSystemPath => // "@Host:/" - new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)':', (byte)'/' }; + /// "@Host:/" + private static ReadOnlySpan HostRootFileSystemPath => + new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)':', (byte)'/' }; private const int HostRootFileSystemPathLength = 7; @@ -122,12 +123,6 @@ public static class Host private static Result OpenHostFileSystem(FileSystemClient fs, ref UniqueRef outFileSystem, U8Span mountName, U8Span path, MountHostOption option) { - if (mountName.IsNull()) - return ResultFs.NullptrArgument.Log(); - - if (path.IsNull()) - return ResultFs.NullptrArgument.Log(); - if (WindowsPath.IsWindowsDrive(mountName)) return ResultFs.InvalidMountName.Log(); @@ -167,9 +162,6 @@ public static class Host Result rc = fs.Impl.CheckMountName(mountName); if (rc.IsFailure()) return rc; - if (path.IsNull()) - return ResultFs.NullptrArgument.Log(); - outMountNameGenerator.Reset(new HostCommonMountNameGenerator(path)); if (!outMountNameGenerator.HasValue)