mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Add CommonMountNames
This commit is contained in:
parent
ac70990fa0
commit
3d7ff652e0
3 changed files with 25 additions and 10 deletions
19
src/LibHac/Fs/CommonMountNames.cs
Normal file
19
src/LibHac/Fs/CommonMountNames.cs
Normal 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");
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -68,15 +68,15 @@ namespace LibHac.Fs.Shim
|
|||
|
||||
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);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
private static char GetPartitionMountLetter(GameCardPartition partition)
|
||||
private static char GetGameCardMountNameSuffix(GameCardPartition partition)
|
||||
{
|
||||
switch (partition)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue