From 3d7ff652e016bd9f6d3643c87e13dde5d51413fe Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Fri, 1 Nov 2019 17:43:28 -0600 Subject: [PATCH] Add CommonMountNames --- src/LibHac/Fs/CommonMountNames.cs | 19 +++++++++++++++++++ src/LibHac/Fs/Shim/ContentStorage.cs | 10 +++------- src/LibHac/Fs/Shim/GameCard.cs | 6 +++--- 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 src/LibHac/Fs/CommonMountNames.cs diff --git a/src/LibHac/Fs/CommonMountNames.cs b/src/LibHac/Fs/CommonMountNames.cs new file mode 100644 index 00000000..c4f044cf --- /dev/null +++ b/src/LibHac/Fs/CommonMountNames.cs @@ -0,0 +1,19 @@ +using LibHac.Common; + +namespace LibHac.Fs +{ + internal static class CommonMountNames + { + public static readonly U8String GameCardMountName = new U8String("@Gc"); + public static readonly U8String SystemContentMountName = new U8String("@SystemContent"); + public static readonly U8String UserContentMountName = new U8String("@UserContent"); + public static readonly U8String SdCardContentMountName = new U8String("@SdCardContent"); + public static readonly U8String CalibrationPartitionMountName = new U8String("@CalibFile"); + public static readonly U8String SafePartitionMountName = new U8String("@Safe"); + public static readonly U8String UserPartitionMountName = new U8String("@User"); + public static readonly U8String SystemPartitionMountName = new U8String("@System"); + public static readonly U8String SdCardMountName = new U8String("@Sdcard"); + public static readonly U8String HostMountName = new U8String("@Host"); + public static readonly U8String RegisteredUpdatePartitionMountName = new U8String("@RegUpdate"); + } +} diff --git a/src/LibHac/Fs/Shim/ContentStorage.cs b/src/LibHac/Fs/Shim/ContentStorage.cs index 1c6e0097..8c1c169c 100644 --- a/src/LibHac/Fs/Shim/ContentStorage.cs +++ b/src/LibHac/Fs/Shim/ContentStorage.cs @@ -6,10 +6,6 @@ namespace LibHac.Fs.Shim { public static class ContentStorage { - private static readonly U8String ContentStorageMountNameSystem = new U8String("@SystemContent"); - private static readonly U8String ContentStorageMountNameUser = new U8String("@UserContent"); - private static readonly U8String ContentStorageMountNameSdCard = new U8String("@SdCardContent"); - public static Result MountContentStorage(this FileSystemClient fs, ContentStorageId storageId) { return MountContentStorage(fs, GetContentStorageMountName(storageId), storageId); @@ -35,11 +31,11 @@ namespace LibHac.Fs.Shim switch (storageId) { case ContentStorageId.System: - return ContentStorageMountNameSystem; + return CommonMountNames.SystemContentMountName; case ContentStorageId.User: - return ContentStorageMountNameUser; + return CommonMountNames.UserContentMountName; case ContentStorageId.SdCard: - return ContentStorageMountNameSdCard; + return CommonMountNames.SdCardContentMountName; default: throw new ArgumentOutOfRangeException(nameof(storageId), storageId, null); } diff --git a/src/LibHac/Fs/Shim/GameCard.cs b/src/LibHac/Fs/Shim/GameCard.cs index fe374f6a..e1e3b0f4 100644 --- a/src/LibHac/Fs/Shim/GameCard.cs +++ b/src/LibHac/Fs/Shim/GameCard.cs @@ -68,15 +68,15 @@ namespace LibHac.Fs.Shim public Result GenerateCommonMountName(Span nameBuffer) { - char letter = GetPartitionMountLetter(PartitionId); + char letter = GetGameCardMountNameSuffix(PartitionId); - string mountName = $"@Gc{letter}{Handle.Value:x8}"; + string mountName = $"{CommonMountNames.GameCardMountName}{letter}{Handle.Value:x8}"; new U8Span(mountName).Value.CopyTo(nameBuffer); return Result.Success; } - private static char GetPartitionMountLetter(GameCardPartition partition) + private static char GetGameCardMountNameSuffix(GameCardPartition partition) { switch (partition) {