Add CommonMountNames

This commit is contained in:
Alex Barney 2019-11-01 17:43:28 -06:00
parent ac70990fa0
commit 3d7ff652e0
3 changed files with 25 additions and 10 deletions

View file

@ -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");
}
}

View file

@ -6,10 +6,6 @@ namespace LibHac.Fs.Shim
{ {
public static class ContentStorage 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) public static Result MountContentStorage(this FileSystemClient fs, ContentStorageId storageId)
{ {
return MountContentStorage(fs, GetContentStorageMountName(storageId), storageId); return MountContentStorage(fs, GetContentStorageMountName(storageId), storageId);
@ -35,11 +31,11 @@ namespace LibHac.Fs.Shim
switch (storageId) switch (storageId)
{ {
case ContentStorageId.System: case ContentStorageId.System:
return ContentStorageMountNameSystem; return CommonMountNames.SystemContentMountName;
case ContentStorageId.User: case ContentStorageId.User:
return ContentStorageMountNameUser; return CommonMountNames.UserContentMountName;
case ContentStorageId.SdCard: case ContentStorageId.SdCard:
return ContentStorageMountNameSdCard; return CommonMountNames.SdCardContentMountName;
default: default:
throw new ArgumentOutOfRangeException(nameof(storageId), storageId, null); throw new ArgumentOutOfRangeException(nameof(storageId), storageId, null);
} }

View file

@ -68,15 +68,15 @@ namespace LibHac.Fs.Shim
public Result GenerateCommonMountName(Span<byte> nameBuffer) public Result GenerateCommonMountName(Span<byte> 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); new U8Span(mountName).Value.CopyTo(nameBuffer);
return Result.Success; return Result.Success;
} }
private static char GetPartitionMountLetter(GameCardPartition partition) private static char GetGameCardMountNameSuffix(GameCardPartition partition)
{ {
switch (partition) switch (partition)
{ {