Use UTF-8 literals where applicable

This commit is contained in:
Alex Barney 2022-11-15 20:21:36 -07:00
parent 506a4691bb
commit c97c0f8297
29 changed files with 237 additions and 801 deletions

View file

@ -330,69 +330,36 @@ internal class DeliveryCacheStorageManager
return 1; return 1;
} }
private static ReadOnlySpan<byte> DeliveryCacheMountNamePrefix => // bcat-dc- /// <summary>"<c>bcat-dc-</c>"</summary>
new[] { (byte)'b', (byte)'c', (byte)'a', (byte)'t', (byte)'-', (byte)'d', (byte)'c', (byte)'-' }; private static ReadOnlySpan<byte> DeliveryCacheMountNamePrefix => "bcat-dc-"u8;
private static ReadOnlySpan<byte> RootPath => // :/ /// <summary>"<c>:/</c>"</summary>
new[] { (byte)':', (byte)'/' }; private static ReadOnlySpan<byte> RootPath => ":/"u8;
private static ReadOnlySpan<byte> PassphrasePath => // :/passphrase.bin /// <summary>"<c>:/passphrase.bin</c>"</summary>
new[] private static ReadOnlySpan<byte> PassphrasePath => ":/passphrase.bin"u8;
{
(byte) ':', (byte) '/', (byte) 'p', (byte) 'a', (byte) 's', (byte) 's', (byte) 'p', (byte) 'h',
(byte) 'r', (byte) 'a', (byte) 's', (byte) 'e', (byte) '.', (byte) 'b', (byte) 'i', (byte) 'n'
};
private static ReadOnlySpan<byte> DeliveryListPath => // :/list.msgpack /// <summary>"<c>:/list.msgpack</c>"</summary>
new[] private static ReadOnlySpan<byte> DeliveryListPath => ":/list.msgpack"u8;
{
(byte) ':', (byte) '/', (byte) 'l', (byte) 'i', (byte) 's', (byte) 't', (byte) '.', (byte) 'm',
(byte) 's', (byte) 'g', (byte) 'p', (byte) 'a', (byte) 'c', (byte) 'k'
};
private static ReadOnlySpan<byte> EtagPath => // :/etag.bin /// <summary>"<c>:/etag.bin</c>"</summary>
new[] private static ReadOnlySpan<byte> EtagPath => ":/etag.bin"u8;
{
(byte) ':', (byte) '/', (byte) 'e', (byte) 't', (byte) 'a', (byte) 'g', (byte) '.', (byte) 'b',
(byte) 'i', (byte) 'n'
};
private static ReadOnlySpan<byte> NaRequiredPath => // :/na_required /// <summary>"<c>:/na_required</c>"</summary>
new[] private static ReadOnlySpan<byte> NaRequiredPath => ":/na_required"u8;
{
(byte) ':', (byte) '/', (byte) 'n', (byte) 'a', (byte) '_', (byte) 'r', (byte) 'e', (byte) 'q',
(byte) 'u', (byte) 'i', (byte) 'r', (byte) 'e', (byte) 'd'
};
private static ReadOnlySpan<byte> IndexLockPath => // :/index.lock /// <summary>"<c>:/index.lock</c>"</summary>
new[] private static ReadOnlySpan<byte> IndexLockPath => ":/index.lock"u8;
{
(byte) ':', (byte) '/', (byte) 'i', (byte) 'n', (byte) 'd', (byte) 'e', (byte) 'x', (byte) '.',
(byte) 'l', (byte) 'o', (byte) 'c', (byte) 'k'
};
private static ReadOnlySpan<byte> DirectoriesPath => // :/directories /// <summary>"<c>:/directories</c>"</summary>
new[] private static ReadOnlySpan<byte> DirectoriesPath => ":/directories"u8;
{
(byte) ':', (byte) '/', (byte) 'd', (byte) 'i', (byte) 'r', (byte) 'e', (byte) 'c', (byte) 't',
(byte) 'o', (byte) 'r', (byte) 'i', (byte) 'e', (byte) 's'
};
private static ReadOnlySpan<byte> FilesMetaFileName => // files.meta /// <summary>"<c>files.meta</c>"</summary>
new[] private static ReadOnlySpan<byte> FilesMetaFileName => "files.meta"u8;
{
(byte) 'f', (byte) 'i', (byte) 'l', (byte) 'e', (byte) 's', (byte) '.', (byte) 'm', (byte) 'e',
(byte) 't', (byte) 'a'
};
private static ReadOnlySpan<byte> DirectoriesMetaPath => // :/directories.meta /// <summary>"<c>:/directories.meta</c>"</summary>
new[] private static ReadOnlySpan<byte> DirectoriesMetaPath => ":/directories.meta"u8;
{
(byte) ':', (byte) '/', (byte) 'd', (byte) 'i', (byte) 'r', (byte) 'e', (byte) 'c', (byte) 't',
(byte) 'o', (byte) 'r', (byte) 'i', (byte) 'e', (byte) 's', (byte) '.', (byte) 'm', (byte) 'e',
(byte) 't', (byte) 'a'
};
private static ReadOnlySpan<byte> FilesDirectoryName => // files /// <summary>"<c>files</c>"</summary>
new[] { (byte)'f', (byte)'i', (byte)'l', (byte)'e', (byte)'s' }; private static ReadOnlySpan<byte> FilesDirectoryName => "files"u8;
} }

View file

@ -537,9 +537,5 @@ public class Package1
return (Package1Section)(-1); return (Package1Section)(-1);
} }
private static ReadOnlySpan<byte> LegacyDateCutoff => // 20181107 private static ReadOnlySpan<byte> LegacyDateCutoff => "20181107"u8;
new[]
{
(byte) '2', (byte) '0', (byte) '1', (byte) '8', (byte) '1', (byte) '1', (byte) '0', (byte) '7'
};
} }

View file

@ -45,5 +45,5 @@ public static class Log
} }
/// <summary>"<c>$</c>"</summary> /// <summary>"<c>$</c>"</summary>
public static ReadOnlySpan<byte> EmptyModuleName => new[] { (byte)'$' }; // "$" public static ReadOnlySpan<byte> EmptyModuleName => "$"u8;
} }

View file

@ -165,6 +165,7 @@ namespace LibHac.Fs.Impl
private Buffer32 _buffer; private Buffer32 _buffer;
[UnscopedRef] [UnscopedRef]
[MethodImpl(MethodImplOptions.NoInlining)]
private ReadOnlySpan<byte> ToValueString(int value) private ReadOnlySpan<byte> ToValueString(int value)
{ {
bool success = Utf8Formatter.TryFormat(value, _buffer.Bytes, out int length); bool success = Utf8Formatter.TryFormat(value, _buffer.Bytes, out int length);
@ -180,9 +181,9 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case Priority.Realtime: return new[] { (byte)'R', (byte)'e', (byte)'a', (byte)'l', (byte)'t', (byte)'i', (byte)'m', (byte)'e' }; case Priority.Realtime: return "Realtime"u8;
case Priority.Normal: return new[] { (byte)'N', (byte)'o', (byte)'r', (byte)'m', (byte)'a', (byte)'l' }; case Priority.Normal: return "Normal"u8;
case Priority.Low: return new[] { (byte)'L', (byte)'o', (byte)'w' }; case Priority.Low: return "Low"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -192,10 +193,10 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case PriorityRaw.Realtime: return new[] { (byte)'R', (byte)'e', (byte)'a', (byte)'l', (byte)'t', (byte)'i', (byte)'m', (byte)'e' }; case PriorityRaw.Realtime: return "Realtime"u8;
case PriorityRaw.Normal: return new[] { (byte)'N', (byte)'o', (byte)'r', (byte)'m', (byte)'a', (byte)'l' }; case PriorityRaw.Normal: return "Normal"u8;
case PriorityRaw.Low: return new[] { (byte)'L', (byte)'o', (byte)'w' }; case PriorityRaw.Low: return "Low"u8;
case PriorityRaw.Background: return new[] { (byte)'B', (byte)'a', (byte)'c', (byte)'k', (byte)'g', (byte)'r', (byte)'o', (byte)'u', (byte)'n', (byte)'d' }; case PriorityRaw.Background: return "Background"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -205,8 +206,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case ImageDirectoryId.Nand: return new[] { (byte)'N', (byte)'a', (byte)'n', (byte)'d' }; case ImageDirectoryId.Nand: return "Nand"u8;
case ImageDirectoryId.SdCard: return new[] { (byte)'S', (byte)'d', (byte)'C', (byte)'a', (byte)'r', (byte)'d' }; case ImageDirectoryId.SdCard: return "SdCard"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -216,9 +217,9 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case ContentStorageId.System: return new[] { (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; case ContentStorageId.System: return "System"u8;
case ContentStorageId.User: return new[] { (byte)'U', (byte)'s', (byte)'e', (byte)'r' }; case ContentStorageId.User: return "User"u8;
case ContentStorageId.SdCard: return new[] { (byte)'S', (byte)'d', (byte)'C', (byte)'a', (byte)'r', (byte)'d' }; case ContentStorageId.SdCard: return "SdCard"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -228,10 +229,10 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case GameCardPartition.Update: return new[] { (byte)'U', (byte)'p', (byte)'d', (byte)'a', (byte)'t', (byte)'e' }; case GameCardPartition.Update: return "Update"u8;
case GameCardPartition.Normal: return new[] { (byte)'N', (byte)'o', (byte)'r', (byte)'m', (byte)'a', (byte)'l' }; case GameCardPartition.Normal: return "Normal"u8;
case GameCardPartition.Secure: return new[] { (byte)'S', (byte)'e', (byte)'c', (byte)'u', (byte)'r', (byte)'e' }; case GameCardPartition.Secure: return "Secure"u8;
case GameCardPartition.Logo: return new[] { (byte)'L', (byte)'o', (byte)'g', (byte)'o' }; case GameCardPartition.Logo: return "Logo"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -241,10 +242,10 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case SaveDataSpaceId.System: return new[] { (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; case SaveDataSpaceId.System: return "System"u8;
case SaveDataSpaceId.User: return new[] { (byte)'U', (byte)'s', (byte)'e', (byte)'r' }; case SaveDataSpaceId.User: return "User"u8;
case SaveDataSpaceId.SdSystem: return new[] { (byte)'S', (byte)'d', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; case SaveDataSpaceId.SdSystem: return "SdSystem"u8;
case SaveDataSpaceId.ProperSystem: return new[] { (byte)'P', (byte)'r', (byte)'o', (byte)'p', (byte)'e', (byte)'r', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; case SaveDataSpaceId.ProperSystem: return "ProperSystem"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -254,8 +255,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case SaveDataFormatType.Normal: return new[] { (byte)'N', (byte)'o', (byte)'r', (byte)'m', (byte)'a', (byte)'l' }; case SaveDataFormatType.Normal: return "Normal"u8;
case SaveDataFormatType.NoJournal: return new[] { (byte)'N', (byte)'o', (byte)'J', (byte)'o', (byte)'u', (byte)'r', (byte)'n', (byte)'a', (byte)'l' }; case SaveDataFormatType.NoJournal: return "NoJournal"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -265,11 +266,11 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case ContentType.Meta: return new[] { (byte)'M', (byte)'e', (byte)'t', (byte)'a' }; case ContentType.Meta: return "Meta"u8;
case ContentType.Control: return new[] { (byte)'C', (byte)'o', (byte)'n', (byte)'t', (byte)'r', (byte)'o', (byte)'l' }; case ContentType.Control: return "Control"u8;
case ContentType.Manual: return new[] { (byte)'M', (byte)'a', (byte)'n', (byte)'u', (byte)'a', (byte)'l' }; case ContentType.Manual: return "Manual"u8;
case ContentType.Logo: return new[] { (byte)'L', (byte)'o', (byte)'g', (byte)'o' }; case ContentType.Logo: return "Logo"u8;
case ContentType.Data: return new[] { (byte)'D', (byte)'a', (byte)'t', (byte)'a' }; case ContentType.Data: return "Data"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -279,23 +280,23 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case BisPartitionId.BootPartition1Root: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'i', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'1', (byte)'R', (byte)'o', (byte)'o', (byte)'t' }; case BisPartitionId.BootPartition1Root: return "BootPartition1Root"u8;
case BisPartitionId.BootPartition2Root: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'i', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'2', (byte)'R', (byte)'o', (byte)'o', (byte)'t' }; case BisPartitionId.BootPartition2Root: return "BootPartition2Root"u8;
case BisPartitionId.UserDataRoot: return new[] { (byte)'U', (byte)'s', (byte)'e', (byte)'r', (byte)'D', (byte)'a', (byte)'t', (byte)'a', (byte)'R', (byte)'o', (byte)'o', (byte)'t' }; case BisPartitionId.UserDataRoot: return "UserDataRoot"u8;
case BisPartitionId.BootConfigAndPackage2Part1: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'C', (byte)'o', (byte)'n', (byte)'f', (byte)'i', (byte)'g', (byte)'A', (byte)'n', (byte)'d', (byte)'P', (byte)'a', (byte)'c', (byte)'k', (byte)'a', (byte)'g', (byte)'e', (byte)'2', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'1' }; case BisPartitionId.BootConfigAndPackage2Part1: return "BootConfigAndPackage2Part1"u8;
case BisPartitionId.BootConfigAndPackage2Part2: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'C', (byte)'o', (byte)'n', (byte)'f', (byte)'i', (byte)'g', (byte)'A', (byte)'n', (byte)'d', (byte)'P', (byte)'a', (byte)'c', (byte)'k', (byte)'a', (byte)'g', (byte)'e', (byte)'2', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'2' }; case BisPartitionId.BootConfigAndPackage2Part2: return "BootConfigAndPackage2Part2"u8;
case BisPartitionId.BootConfigAndPackage2Part3: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'C', (byte)'o', (byte)'n', (byte)'f', (byte)'i', (byte)'g', (byte)'A', (byte)'n', (byte)'d', (byte)'P', (byte)'a', (byte)'c', (byte)'k', (byte)'a', (byte)'g', (byte)'e', (byte)'2', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'3' }; case BisPartitionId.BootConfigAndPackage2Part3: return "BootConfigAndPackage2Part3"u8;
case BisPartitionId.BootConfigAndPackage2Part4: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'C', (byte)'o', (byte)'n', (byte)'f', (byte)'i', (byte)'g', (byte)'A', (byte)'n', (byte)'d', (byte)'P', (byte)'a', (byte)'c', (byte)'k', (byte)'a', (byte)'g', (byte)'e', (byte)'2', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'4' }; case BisPartitionId.BootConfigAndPackage2Part4: return "BootConfigAndPackage2Part4"u8;
case BisPartitionId.BootConfigAndPackage2Part5: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'C', (byte)'o', (byte)'n', (byte)'f', (byte)'i', (byte)'g', (byte)'A', (byte)'n', (byte)'d', (byte)'P', (byte)'a', (byte)'c', (byte)'k', (byte)'a', (byte)'g', (byte)'e', (byte)'2', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'5' }; case BisPartitionId.BootConfigAndPackage2Part5: return "BootConfigAndPackage2Part5"u8;
case BisPartitionId.BootConfigAndPackage2Part6: return new[] { (byte)'B', (byte)'o', (byte)'o', (byte)'t', (byte)'C', (byte)'o', (byte)'n', (byte)'f', (byte)'i', (byte)'g', (byte)'A', (byte)'n', (byte)'d', (byte)'P', (byte)'a', (byte)'c', (byte)'k', (byte)'a', (byte)'g', (byte)'e', (byte)'2', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'6' }; case BisPartitionId.BootConfigAndPackage2Part6: return "BootConfigAndPackage2Part6"u8;
case BisPartitionId.CalibrationBinary: return new[] { (byte)'C', (byte)'a', (byte)'l', (byte)'i', (byte)'b', (byte)'r', (byte)'a', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'B', (byte)'i', (byte)'n', (byte)'a', (byte)'r', (byte)'y' }; case BisPartitionId.CalibrationBinary: return "CalibrationBinary"u8;
case BisPartitionId.CalibrationFile: return new[] { (byte)'C', (byte)'a', (byte)'l', (byte)'i', (byte)'b', (byte)'r', (byte)'a', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'F', (byte)'i', (byte)'l', (byte)'e' }; case BisPartitionId.CalibrationFile: return "CalibrationFile"u8;
case BisPartitionId.SafeMode: return new[] { (byte)'S', (byte)'a', (byte)'f', (byte)'e', (byte)'M', (byte)'o', (byte)'d', (byte)'e' }; case BisPartitionId.SafeMode: return "SafeMode"u8;
case BisPartitionId.User: return new[] { (byte)'U', (byte)'s', (byte)'e', (byte)'r' }; case BisPartitionId.User: return "User"u8;
case BisPartitionId.System: return new[] { (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; case BisPartitionId.System: return "System"u8;
case BisPartitionId.SystemProperEncryption: return new[] { (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m', (byte)'P', (byte)'r', (byte)'o', (byte)'p', (byte)'e', (byte)'r', (byte)'E', (byte)'n', (byte)'c', (byte)'r', (byte)'y', (byte)'p', (byte)'t', (byte)'i', (byte)'o', (byte)'n' }; case BisPartitionId.SystemProperEncryption: return "SystemProperEncryption"u8;
case BisPartitionId.SystemProperPartition: return new[] { (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m', (byte)'P', (byte)'r', (byte)'o', (byte)'p', (byte)'e', (byte)'r', (byte)'P', (byte)'a', (byte)'r', (byte)'t', (byte)'i', (byte)'t', (byte)'i', (byte)'o', (byte)'n' }; case BisPartitionId.SystemProperPartition: return "SystemProperPartition"u8;
case (BisPartitionId)35: return new[] { (byte)'I', (byte)'n', (byte)'v', (byte)'a', (byte)'l', (byte)'i', (byte)'d' }; case (BisPartitionId)35: return "Invalid"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -305,8 +306,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case DirectoryEntryType.Directory: return new[] { (byte)'D', (byte)'i', (byte)'r', (byte)'e', (byte)'c', (byte)'t', (byte)'o', (byte)'r', (byte)'y' }; case DirectoryEntryType.Directory: return "Directory"u8;
case DirectoryEntryType.File: return new[] { (byte)'F', (byte)'i', (byte)'l', (byte)'e' }; case DirectoryEntryType.File: return "File"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -316,7 +317,7 @@ namespace LibHac.Fs.Impl
{ {
switch (value.Flags) switch (value.Flags)
{ {
case MountHostOptionFlag.PseudoCaseSensitive: return new[] { (byte)'M', (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)'O', (byte)'p', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'F', (byte)'l', (byte)'a', (byte)'g', (byte)'_', (byte)'P', (byte)'s', (byte)'e', (byte)'u', (byte)'d', (byte)'o', (byte)'C', (byte)'a', (byte)'s', (byte)'e', (byte)'S', (byte)'e', (byte)'n', (byte)'s', (byte)'i', (byte)'t', (byte)'i', (byte)'v', (byte)'e' }; case MountHostOptionFlag.PseudoCaseSensitive: return "MountHostOptionFlag_PseudoCaseSensitive"u8;
default: return ToValueString((int)value.Flags); default: return ToValueString((int)value.Flags);
} }
} }
@ -326,12 +327,12 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case MemoryCapacity.Capacity1GB: return new[] { (byte)'1', (byte)'G', (byte)'B' }; case MemoryCapacity.Capacity1GB: return "1GB"u8;
case MemoryCapacity.Capacity2GB: return new[] { (byte)'2', (byte)'G', (byte)'B' }; case MemoryCapacity.Capacity2GB: return "2GB"u8;
case MemoryCapacity.Capacity4GB: return new[] { (byte)'4', (byte)'G', (byte)'B' }; case MemoryCapacity.Capacity4GB: return "4GB"u8;
case MemoryCapacity.Capacity8GB: return new[] { (byte)'8', (byte)'G', (byte)'B' }; case MemoryCapacity.Capacity8GB: return "8GB"u8;
case MemoryCapacity.Capacity16GB: return new[] { (byte)'1', (byte)'6', (byte)'G', (byte)'B' }; case MemoryCapacity.Capacity16GB: return "16GB"u8;
case MemoryCapacity.Capacity32GB: return new[] { (byte)'3', (byte)'2', (byte)'G', (byte)'B' }; case MemoryCapacity.Capacity32GB: return "32GB"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -341,8 +342,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case SelSec.T1: return new[] { (byte)'T', (byte)'1' }; case SelSec.T1: return "T1"u8;
case SelSec.T2: return new[] { (byte)'T', (byte)'2' }; case SelSec.T2: return "T2"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -352,8 +353,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case KekIndex.Version0: return new[] { (byte)'V', (byte)'e', (byte)'r', (byte)'s', (byte)'i', (byte)'o', (byte)'n', (byte)'0' }; case KekIndex.Version0: return "Version0"u8;
case KekIndex.ForDev: return new[] { (byte)'V', (byte)'e', (byte)'r', (byte)'s', (byte)'i', (byte)'o', (byte)'n', (byte)'F', (byte)'o', (byte)'r', (byte)'D', (byte)'e', (byte)'v' }; case KekIndex.ForDev: return "VersionForDev"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -363,8 +364,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case AccessControl1ClockRate.ClockRate25MHz: return new[] { (byte)'2', (byte)'5', (byte)' ', (byte)'M', (byte)'H', (byte)'z' }; case AccessControl1ClockRate.ClockRate25MHz: return "25 MHz"u8;
case AccessControl1ClockRate.ClockRate50MHz: return new[] { (byte)'5', (byte)'0', (byte)' ', (byte)'M', (byte)'H', (byte)'z' }; case AccessControl1ClockRate.ClockRate50MHz: return "50 MHz"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -374,12 +375,12 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case FwVersion.ForDev: return new[] { (byte)'F', (byte)'o', (byte)'r', (byte)'D', (byte)'e', (byte)'v' }; case FwVersion.ForDev: return "ForDev"u8;
case FwVersion.Since1_0_0: return new[] { (byte)'1', (byte)'.', (byte)'0', (byte)'.', (byte)'0' }; case FwVersion.Since1_0_0: return "1.0.0"u8;
case FwVersion.Since4_0_0: return new[] { (byte)'4', (byte)'.', (byte)'0', (byte)'.', (byte)'0' }; case FwVersion.Since4_0_0: return "4.0.0"u8;
case FwVersion.Since9_0_0: return new[] { (byte)'9', (byte)'.', (byte)'0', (byte)'.', (byte)'0' }; case FwVersion.Since9_0_0: return "9.0.0"u8;
case FwVersion.Since11_0_0: return new[] { (byte)'1', (byte)'1', (byte)'.', (byte)'0', (byte)'.', (byte)'0' }; case FwVersion.Since11_0_0: return "11.0.0"u8;
case FwVersion.Since12_0_0: return new[] { (byte)'1', (byte)'2', (byte)'.', (byte)'0', (byte)'.', (byte)'0' }; case FwVersion.Since12_0_0: return "12.0.0"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -389,8 +390,8 @@ namespace LibHac.Fs.Impl
{ {
switch (value) switch (value)
{ {
case GameCardCompatibilityType.Normal: return new[] { (byte)'N', (byte)'o', (byte)'r', (byte)'m', (byte)'a', (byte)'l' }; case GameCardCompatibilityType.Normal: return "Normal"u8;
case GameCardCompatibilityType.Terra: return new[] { (byte)'T', (byte)'e', (byte)'r', (byte)'r', (byte)'a' }; case GameCardCompatibilityType.Terra: return "Terra"u8;
default: return ToValueString((int)value); default: return ToValueString((int)value);
} }
} }
@ -828,456 +829,174 @@ namespace LibHac.Fs.Impl
internal static class AccessLogStrings internal static class AccessLogStrings
{ {
/// <summary>"<c>$fs</c>"</summary> /// <summary>"<c>$fs</c>"</summary>
public static ReadOnlySpan<byte> FsModuleName => // "$fs" public static ReadOnlySpan<byte> FsModuleName => "$fs"u8;
new[] { (byte)'$', (byte)'f', (byte)'s' };
/// <summary>"<c>0.17.0</c>"</summary> /// <summary>"<c>0.17.0</c>"</summary>
public static ReadOnlySpan<byte> LogLibHacVersion => // "0.17.0" public static ReadOnlySpan<byte> LogLibHacVersion => "0.17.0"u8;
new[]
{
(byte)'0', (byte)'.', (byte)'1', (byte)'7', (byte)'.', (byte)'0'
};
/// <summary>"<c>"</c>"</summary> /// <summary>"<c>"</c>"</summary>
public static byte LogQuote => (byte)'"'; public static byte LogQuote => (byte)'"';
/// <summary>"<c>true</c>"</summary> /// <summary>"<c>true</c>"</summary>
public static ReadOnlySpan<byte> LogTrue => // "true" public static ReadOnlySpan<byte> LogTrue => "true"u8;
new[] { (byte)'t', (byte)'r', (byte)'u', (byte)'e' };
/// <summary>"<c>false</c>"</summary> /// <summary>"<c>false</c>"</summary>
public static ReadOnlySpan<byte> LogFalse => // "false" public static ReadOnlySpan<byte> LogFalse => "false"u8;
new[] { (byte)'f', (byte)'a', (byte)'l', (byte)'s', (byte)'e' };
/// <summary>"<c>, entry_buffer_count: </c>"</summary> /// <summary>"<c>, entry_buffer_count: </c>"</summary>
public static ReadOnlySpan<byte> LogEntryBufferCount => // ", entry_buffer_count: " public static ReadOnlySpan<byte> LogEntryBufferCount => ", entry_buffer_count: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'e', (byte)'n', (byte)'t', (byte)'r', (byte)'y', (byte)'_',
(byte)'b', (byte)'u', (byte)'f', (byte)'f', (byte)'e', (byte)'r', (byte)'_', (byte)'c',
(byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)':', (byte)' '
};
/// <summary>"<c>, entry_count: </c>"</summary> /// <summary>"<c>, entry_count: </c>"</summary>
public static ReadOnlySpan<byte> LogEntryCount => // ", entry_count: " public static ReadOnlySpan<byte> LogEntryCount => ", entry_count: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'e', (byte)'n', (byte)'t', (byte)'r', (byte)'y', (byte)'_',
(byte)'c', (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)':', (byte)' '
};
/// <summary>"<c>, offset: </c>"</summary> /// <summary>"<c>, offset: </c>"</summary>
public static ReadOnlySpan<byte> LogOffset => // ", offset: " public static ReadOnlySpan<byte> LogOffset => ", offset: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'o', (byte)'f', (byte)'f', (byte)'s', (byte)'e', (byte)'t',
(byte)':', (byte)' '
};
/// <summary>"<c>, size: </c>"</summary> /// <summary>"<c>, size: </c>"</summary>
public static ReadOnlySpan<byte> LogSize => // ", size: " public static ReadOnlySpan<byte> LogSize => ", size: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'i', (byte)'z', (byte)'e', (byte)':', (byte)' '
};
/// <summary>"<c>, read_size: </c>"</summary> /// <summary>"<c>, read_size: </c>"</summary>
public static ReadOnlySpan<byte> LogReadSize => // ", read_size: " public static ReadOnlySpan<byte> LogReadSize => ", read_size: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'r', (byte)'e', (byte)'a', (byte)'d', (byte)'_', (byte)'s',
(byte)'i', (byte)'z', (byte)'e', (byte)':', (byte)' '
};
/// <summary>"<c>, write_option: Flush</c>"</summary> /// <summary>"<c>, write_option: Flush</c>"</summary>
public static ReadOnlySpan<byte> LogWriteOptionFlush => // ", write_option: Flush" public static ReadOnlySpan<byte> LogWriteOptionFlush => ", write_option: Flush"u8;
new[]
{
(byte)',', (byte)' ', (byte)'w', (byte)'r', (byte)'i', (byte)'t', (byte)'e', (byte)'_',
(byte)'o', (byte)'p', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' ',
(byte)'F', (byte)'l', (byte)'u', (byte)'s', (byte)'h'
};
/// <summary>"<c>, open_mode: 0x</c>"</summary> /// <summary>"<c>, open_mode: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogOpenMode => // ", open_mode: 0x" public static ReadOnlySpan<byte> LogOpenMode => ", open_mode: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'o', (byte)'p', (byte)'e', (byte)'n', (byte)'_', (byte)'m',
(byte)'o', (byte)'d', (byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, path: "</c>"</summary> /// <summary>"<c>, path: "</c>"</summary>
public static ReadOnlySpan<byte> LogPath => // ", path: "" public static ReadOnlySpan<byte> LogPath => ", path: \""u8;
new[]
{
(byte)',', (byte)' ', (byte)'p', (byte)'a', (byte)'t', (byte)'h', (byte)':', (byte)' ',
(byte)'"'
};
/// <summary>"<c>", new_path: "</c>"</summary> /// <summary>"<c>", new_path: "</c>"</summary>
public static ReadOnlySpan<byte> LogNewPath => // "", new_path: "" public static ReadOnlySpan<byte> LogNewPath => "\", new_path: \""u8;
new[]
{
(byte)'"', (byte)',', (byte)' ', (byte)'n', (byte)'e', (byte)'w', (byte)'_', (byte)'p',
(byte)'a', (byte)'t', (byte)'h', (byte)':', (byte)' ', (byte)'"'
};
/// <summary>"<c>", entry_type: </c>"</summary> /// <summary>"<c>", entry_type: </c>"</summary>
public static ReadOnlySpan<byte> LogEntryType => // "", entry_type: " public static ReadOnlySpan<byte> LogEntryType => "\", entry_type: "u8;
new[]
{
(byte)'"', (byte)',', (byte)' ', (byte)'e', (byte)'n', (byte)'t', (byte)'r', (byte)'y',
(byte)'_', (byte)'t', (byte)'y', (byte)'p', (byte)'e', (byte)':', (byte)' '
};
/// <summary>"<c>, name: "</c>"</summary> /// <summary>"<c>, name: "</c>"</summary>
public static ReadOnlySpan<byte> LogName => // ", name: "" public static ReadOnlySpan<byte> LogName => ", name: \""u8;
new[]
{
(byte)',', (byte)' ', (byte)'n', (byte)'a', (byte)'m', (byte)'e', (byte)':', (byte)' ',
(byte)'"'
};
/// <summary>"<c>", commit_option: 0x</c>"</summary> /// <summary>"<c>", commit_option: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogCommitOption => // "", commit_option: 0x" public static ReadOnlySpan<byte> LogCommitOption => "\", commit_option: 0x"u8;
new[]
{
(byte)'"', (byte)',', (byte)' ', (byte)'c', (byte)'o', (byte)'m', (byte)'m', (byte)'i',
(byte)'t', (byte)'_', (byte)'o', (byte)'p', (byte)'t', (byte)'i', (byte)'o', (byte)'n',
(byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>", is_mounted: "</c>"</summary> /// <summary>"<c>", is_mounted: "</c>"</summary>
public static ReadOnlySpan<byte> LogIsMounted => // "", is_mounted: "" public static ReadOnlySpan<byte> LogIsMounted => "\", is_mounted: \""u8;
new[]
{
(byte)'"', (byte)',', (byte)' ', (byte)'i', (byte)'s', (byte)'_', (byte)'m', (byte)'o',
(byte)'u', (byte)'n', (byte)'t', (byte)'e', (byte)'d', (byte)':', (byte)' ', (byte)'"'
};
/// <summary>"<c>, applicationid: 0x</c>"</summary> /// <summary>"<c>, applicationid: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogApplicationId => // ", applicationid: 0x" public static ReadOnlySpan<byte> LogApplicationId => ", applicationid: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'a', (byte)'p', (byte)'p', (byte)'l', (byte)'i', (byte)'c',
(byte)'a', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'i', (byte)'d', (byte)':',
(byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, programid: 0x</c>"</summary> /// <summary>"<c>, programid: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogProgramId => // ", programid: 0x" public static ReadOnlySpan<byte> LogProgramId => ", programid: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'p', (byte)'r', (byte)'o', (byte)'g', (byte)'r', (byte)'a',
(byte)'m', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, dataid: 0x</c>"</summary> /// <summary>"<c>, dataid: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogDataId => // ", dataid: 0x" public static ReadOnlySpan<byte> LogDataId => ", dataid: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'d', (byte)'a', (byte)'t', (byte)'a', (byte)'i', (byte)'d',
(byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, bispartitionid: </c>"</summary> /// <summary>"<c>, bispartitionid: </c>"</summary>
public static ReadOnlySpan<byte> LogBisPartitionId => // ", bispartitionid: " public static ReadOnlySpan<byte> LogBisPartitionId => ", bispartitionid: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'b', (byte)'i', (byte)'s', (byte)'p', (byte)'a', (byte)'r',
(byte)'t', (byte)'i', (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)'i', (byte)'d',
(byte)':', (byte)' '
};
/// <summary>"<c>, content_type: </c>"</summary> /// <summary>"<c>, content_type: </c>"</summary>
public static ReadOnlySpan<byte> LogContentType => // ", content_type: " public static ReadOnlySpan<byte> LogContentType => ", content_type: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'c', (byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n',
(byte)'t', (byte)'_', (byte)'t', (byte)'y', (byte)'p', (byte)'e', (byte)':', (byte)' '
};
/// <summary>"<c>, contentstorageid: </c>"</summary> /// <summary>"<c>, contentstorageid: </c>"</summary>
public static ReadOnlySpan<byte> LogContentStorageId => // ", contentstorageid: " public static ReadOnlySpan<byte> LogContentStorageId => ", contentstorageid: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'c', (byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n',
(byte)'t', (byte)'s', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)'i', (byte)'d', (byte)':', (byte)' '
};
/// <summary>"<c>, imagedirectoryid: </c>"</summary> /// <summary>"<c>, imagedirectoryid: </c>"</summary>
public static ReadOnlySpan<byte> LogImageDirectoryId => // ", imagedirectoryid: " public static ReadOnlySpan<byte> LogImageDirectoryId => ", imagedirectoryid: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'i', (byte)'m', (byte)'a', (byte)'g', (byte)'e', (byte)'d',
(byte)'i', (byte)'r', (byte)'e', (byte)'c', (byte)'t', (byte)'o', (byte)'r', (byte)'y',
(byte)'i', (byte)'d', (byte)':', (byte)' '
};
/// <summary>"<c>, gamecard_handle: 0x</c>"</summary> /// <summary>"<c>, gamecard_handle: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogGameCardHandle => // ", gamecard_handle: 0x" public static ReadOnlySpan<byte> LogGameCardHandle => ", gamecard_handle: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'g', (byte)'a', (byte)'m', (byte)'e', (byte)'c', (byte)'a',
(byte)'r', (byte)'d', (byte)'_', (byte)'h', (byte)'a', (byte)'n', (byte)'d', (byte)'l',
(byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, gamecard_partition: </c>"</summary> /// <summary>"<c>, gamecard_partition: </c>"</summary>
public static ReadOnlySpan<byte> LogGameCardPartition => // ", gamecard_partition: " public static ReadOnlySpan<byte> LogGameCardPartition => ", gamecard_partition: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'g', (byte)'a', (byte)'m', (byte)'e', (byte)'c', (byte)'a',
(byte)'r', (byte)'d', (byte)'_', (byte)'p', (byte)'a', (byte)'r', (byte)'t', (byte)'i',
(byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' '
};
/// <summary>"<c>, mount_host_option: </c>"</summary> /// <summary>"<c>, mount_host_option: </c>"</summary>
public static ReadOnlySpan<byte> LogMountHostOption => // ", mount_host_option: " public static ReadOnlySpan<byte> LogMountHostOption => ", mount_host_option: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'m', (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)'_',
(byte)'h', (byte)'o', (byte)'s', (byte)'t', (byte)'_', (byte)'o', (byte)'p', (byte)'t',
(byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' '
};
/// <summary>"<c>, root_path: "</c>"</summary> /// <summary>"<c>, root_path: "</c>"</summary>
public static ReadOnlySpan<byte> LogRootPath => // ", root_path: "" public static ReadOnlySpan<byte> LogRootPath => ", root_path: \""u8;
new[]
{
(byte)',', (byte)' ', (byte)'r', (byte)'o', (byte)'o', (byte)'t', (byte)'_', (byte)'p',
(byte)'a', (byte)'t', (byte)'h', (byte)':', (byte)' ', (byte)'"'
};
/// <summary>"<c>, userid: 0x</c>"</summary> /// <summary>"<c>, userid: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogUserId => // ", userid: 0x" public static ReadOnlySpan<byte> LogUserId => ", userid: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'u', (byte)'s', (byte)'e', (byte)'r', (byte)'i', (byte)'d',
(byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, index: </c>"</summary> /// <summary>"<c>, index: </c>"</summary>
public static ReadOnlySpan<byte> LogIndex => // ", index: " public static ReadOnlySpan<byte> LogIndex => ", index: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'i', (byte)'n', (byte)'d', (byte)'e', (byte)'x', (byte)':',
(byte)' '
};
/// <summary>"<c>, save_data_owner_id: 0x</c>"</summary> /// <summary>"<c>, save_data_owner_id: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataOwnerId => // ", save_data_owner_id: 0x" public static ReadOnlySpan<byte> LogSaveDataOwnerId => ", save_data_owner_id: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'o', (byte)'w', (byte)'n', (byte)'e',
(byte)'r', (byte)'_', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, save_data_size: </c>"</summary> /// <summary>"<c>, save_data_size: </c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataSize => // ", save_data_size: " public static ReadOnlySpan<byte> LogSaveDataSize => ", save_data_size: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'s', (byte)'i', (byte)'z', (byte)'e',
(byte)':', (byte)' '
};
/// <summary>"<c>, save_data_journal_size: </c>"</summary> /// <summary>"<c>, save_data_journal_size: </c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataJournalSize => // ", save_data_journal_size: " public static ReadOnlySpan<byte> LogSaveDataJournalSize => ", save_data_journal_size: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'j', (byte)'o', (byte)'u', (byte)'r',
(byte)'n', (byte)'a', (byte)'l', (byte)'_', (byte)'s', (byte)'i', (byte)'z', (byte)'e',
(byte)':', (byte)' '
};
/// <summary>"<c>, save_data_flags: 0x</c>"</summary> /// <summary>"<c>, save_data_flags: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataFlags => // ", save_data_flags: 0x" public static ReadOnlySpan<byte> LogSaveDataFlags => ", save_data_flags: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'f', (byte)'l', (byte)'a', (byte)'g',
(byte)'s', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, savedataid: 0x</c>"</summary> /// <summary>"<c>, savedataid: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataId => // ", savedataid: 0x" public static ReadOnlySpan<byte> LogSaveDataId => ", savedataid: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'d', (byte)'a',
(byte)'t', (byte)'a', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, savedataspaceid: </c>"</summary> /// <summary>"<c>, savedataspaceid: </c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataSpaceId => // ", savedataspaceid: " public static ReadOnlySpan<byte> LogSaveDataSpaceId => ", savedataspaceid: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'d', (byte)'a',
(byte)'t', (byte)'a', (byte)'s', (byte)'p', (byte)'a', (byte)'c', (byte)'e', (byte)'i',
(byte)'d', (byte)':', (byte)' '
};
/// <summary>"<c>, save_data_format_type: </c>"</summary> /// <summary>"<c>, save_data_format_type: </c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataFormatType => // ", save_data_format_type: " public static ReadOnlySpan<byte> LogSaveDataFormatType => ", save_data_format_type: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'f', (byte)'o', (byte)'r', (byte)'m',
(byte)'a', (byte)'t', (byte)'_', (byte)'t', (byte)'y', (byte)'p', (byte)'e', (byte)':',
(byte)' '
};
/// <summary>"<c>, save_data_time_stamp: </c>"</summary> /// <summary>"<c>, save_data_time_stamp: </c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataTimeStamp => // ", save_data_time_stamp: " public static ReadOnlySpan<byte> LogSaveDataTimeStamp => ", save_data_time_stamp: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'t', (byte)'i', (byte)'m', (byte)'e',
(byte)'_', (byte)'s', (byte)'t', (byte)'a', (byte)'m', (byte)'p', (byte)':', (byte)' '
};
/// <summary>"<c>, save_data_commit_id: 0x</c>"</summary> /// <summary>"<c>, save_data_commit_id: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogSaveDataCommitId => // ", save_data_commit_id: 0x" public static ReadOnlySpan<byte> LogSaveDataCommitId => ", save_data_commit_id: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'_', (byte)'d',
(byte)'a', (byte)'t', (byte)'a', (byte)'_', (byte)'c', (byte)'o', (byte)'m', (byte)'m',
(byte)'i', (byte)'t', (byte)'_', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0',
(byte)'x'
};
/// <summary>"<c>, restore_flag: </c>"</summary> /// <summary>"<c>, restore_flag: </c>"</summary>
public static ReadOnlySpan<byte> LogRestoreFlag => // ", restore_flag: " public static ReadOnlySpan<byte> LogRestoreFlag => ", restore_flag: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'r', (byte)'e', (byte)'s', (byte)'t', (byte)'o', (byte)'r',
(byte)'e', (byte)'_', (byte)'f', (byte)'l', (byte)'a', (byte)'g', (byte)':', (byte)' '
};
/// <summary>"<c>sdk_version: </c>"</summary> /// <summary>"<c>sdk_version: </c>"</summary>
public static ReadOnlySpan<byte> LogSdkVersion => // "sdk_version: " public static ReadOnlySpan<byte> LogSdkVersion => "sdk_version: "u8;
new[]
{
(byte)'s', (byte)'d', (byte)'k', (byte)'_', (byte)'v', (byte)'e', (byte)'r', (byte)'s',
(byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' '
};
/// <summary>"<c>, spec: </c>"</summary> /// <summary>"<c>, spec: </c>"</summary>
public static ReadOnlySpan<byte> LogSpec => // ", spec: " public static ReadOnlySpan<byte> LogSpec => ", spec: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'p', (byte)'e', (byte)'c', (byte)':', (byte)' '
};
/// <summary>"<c>NX</c>"</summary> /// <summary>"<c>NX</c>"</summary>
public static ReadOnlySpan<byte> LogNx => // "NX" public static ReadOnlySpan<byte> LogNx => "NX"u8;
new[] { (byte)'N', (byte)'X' };
/// <summary>"<c>, program_index: </c>"</summary> /// <summary>"<c>, program_index: </c>"</summary>
public static ReadOnlySpan<byte> LogProgramIndex => // ", program_index: " public static ReadOnlySpan<byte> LogProgramIndex => ", program_index: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'p', (byte)'r', (byte)'o', (byte)'g', (byte)'r', (byte)'a',
(byte)'m', (byte)'_', (byte)'i', (byte)'n', (byte)'d', (byte)'e', (byte)'x', (byte)':',
(byte)' '
};
/// <summary>"<c>, for_system: true</c>"</summary> /// <summary>"<c>, for_system: true</c>"</summary>
public static ReadOnlySpan<byte> LogForSystem => // ", for_system: true" public static ReadOnlySpan<byte> LogForSystem => ", for_system: true"u8;
new[]
{
(byte)',', (byte)' ', (byte)'f', (byte)'o', (byte)'r', (byte)'_', (byte)'s', (byte)'y',
(byte)'s', (byte)'t', (byte)'e', (byte)'m', (byte)':', (byte)' ', (byte)'t', (byte)'r',
(byte)'u', (byte)'e'
};
/// <summary>"<c>"FS_ACCESS: { </c>"</summary> /// <summary>"<c>"FS_ACCESS: { </c>"</summary>
public static ReadOnlySpan<byte> LogLineStart => // "FS_ACCESS: { " public static ReadOnlySpan<byte> LogLineStart => "FS_ACCESS: { "u8;
new[]
{
(byte)'F', (byte)'S', (byte)'_', (byte)'A', (byte)'C', (byte)'C', (byte)'E', (byte)'S',
(byte)'S', (byte)':', (byte)' ', (byte)'{', (byte)' '
};
/// <summary>"<c> }\n</c>"</summary> /// <summary>"<c> }\n</c>"</summary>
public static ReadOnlySpan<byte> LogLineEnd => // " }\n" public static ReadOnlySpan<byte> LogLineEnd => " }\n"u8;
new[] { (byte)' ', (byte)'}', (byte)'\n' };
/// <summary>"<c>start: </c>"</summary> /// <summary>"<c>start: </c>"</summary>
public static ReadOnlySpan<byte> LogStart => // "start: " public static ReadOnlySpan<byte> LogStart => "start: "u8;
new[]
{
(byte)'s', (byte)'t', (byte)'a', (byte)'r', (byte)'t', (byte)':', (byte)' '
};
/// <summary>"<c>, end: </c>"</summary> /// <summary>"<c>, end: </c>"</summary>
public static ReadOnlySpan<byte> LogEnd => // ", end: " public static ReadOnlySpan<byte> LogEnd => ", end: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'e', (byte)'n', (byte)'d', (byte)':', (byte)' '
};
/// <summary>"<c>, result: 0x</c>"</summary> /// <summary>"<c>, result: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogResult => // ", result: 0x" public static ReadOnlySpan<byte> LogResult => ", result: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'r', (byte)'e', (byte)'s', (byte)'u', (byte)'l', (byte)'t',
(byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, handle: 0x</c>"</summary> /// <summary>"<c>, handle: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogHandle => // ", handle: 0x" public static ReadOnlySpan<byte> LogHandle => ", handle: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'h', (byte)'a', (byte)'n', (byte)'d', (byte)'l', (byte)'e',
(byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, priority: </c>"</summary> /// <summary>"<c>, priority: </c>"</summary>
public static ReadOnlySpan<byte> LogPriority => // ", priority: " public static ReadOnlySpan<byte> LogPriority => ", priority: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'p', (byte)'r', (byte)'i', (byte)'o', (byte)'r', (byte)'i',
(byte)'t', (byte)'y', (byte)':', (byte)' '
};
/// <summary>"<c>, function: "</c>"</summary> /// <summary>"<c>, function: "</c>"</summary>
public static ReadOnlySpan<byte> LogFunction => // ", function: "" public static ReadOnlySpan<byte> LogFunction => ", function: \""u8;
new[]
{
(byte)',', (byte)' ', (byte)'f', (byte)'u', (byte)'n', (byte)'c', (byte)'t', (byte)'i',
(byte)'o', (byte)'n', (byte)':', (byte)' ', (byte)'"'
};
/// <summary>"<c>, cachestoragelist_handle: 0x</c>"</summary> /// <summary>"<c>, cachestoragelist_handle: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogCacheStorageListHandle => public static ReadOnlySpan<byte> LogCacheStorageListHandle => ", cachestoragelist_handle: 0x"u8;
new[]
{
(byte)',', (byte)' ', (byte)'c', (byte)'a', (byte)'c', (byte)'h', (byte)'e', (byte)'s',
(byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e', (byte)'l', (byte)'i',
(byte)'s', (byte)'t', (byte)'_', (byte)'h', (byte)'a', (byte)'n', (byte)'d', (byte)'l',
(byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, infobuffercount: 0x</c>"</summary> /// <summary>"<c>, infobuffercount: 0x</c>"</summary>
public static ReadOnlySpan<byte> LogInfoBufferCount => public static ReadOnlySpan<byte> LogInfoBufferCount => ", infobuffercount: 0x</c>"u8;
new[]
{
(byte)',', (byte)' ', (byte)'i', (byte)'n', (byte)'f', (byte)'o', (byte)'b', (byte)'u',
(byte)'f', (byte)'f', (byte)'e', (byte)'r', (byte)'c', (byte)'o', (byte)'u', (byte)'n',
(byte)'t', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, cache_storage_count: </c>"</summary> /// <summary>"<c>, cache_storage_count: </c>"</summary>
public static ReadOnlySpan<byte> LogCacheStorageCount => public static ReadOnlySpan<byte> LogCacheStorageCount => ", cache_storage_count: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'c', (byte)'a', (byte)'c', (byte)'h', (byte)'e', (byte)'_',
(byte)'s', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e', (byte)'_',
(byte)'c', (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)':', (byte)' '
};
} }
} }

View file

@ -673,7 +673,7 @@ public ref struct Path
Span<byte> writeBuffer = GetWriteBuffer(); Span<byte> writeBuffer = GetWriteBuffer();
ReadOnlySpan<byte> search = new[] { (byte)':', (byte)'/', (byte)'/', (byte)'/' }; // ":///" ReadOnlySpan<byte> search = ":///"u8;
int index = StringUtils.Find(writeBuffer, search); int index = StringUtils.Find(writeBuffer, search);
if (index >= 0) if (index >= 0)
{ {
@ -681,8 +681,7 @@ public ref struct Path
writeBuffer[index + 3] = AltDirectorySeparator; writeBuffer[index + 3] = AltDirectorySeparator;
} }
ReadOnlySpan<byte> hostMountUnc = new[] // "@Host://" ReadOnlySpan<byte> hostMountUnc = "@Host://"u8;
{ (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)':', (byte)'/', (byte)'/' };
if (StringUtils.Compare(writeBuffer, hostMountUnc, 8) == 0) if (StringUtils.Compare(writeBuffer, hostMountUnc, 8) == 0)
{ {
writeBuffer[6] = AltDirectorySeparator; writeBuffer[6] = AltDirectorySeparator;
@ -1258,7 +1257,7 @@ public static class PathFunctions
/// <see cref="ResultFs.InvalidArgument"/>: <paramref name="pathBuffer"/> was too small to contain the built path.</returns> /// <see cref="ResultFs.InvalidArgument"/>: <paramref name="pathBuffer"/> was too small to contain the built path.</returns>
internal static Result SetUpFixedPathSaveMetaName(scoped ref Path path, Span<byte> pathBuffer, uint metaType) internal static Result SetUpFixedPathSaveMetaName(scoped ref Path path, Span<byte> pathBuffer, uint metaType)
{ {
ReadOnlySpan<byte> metaExtension = new[] { (byte)'.', (byte)'m', (byte)'e', (byte)'t', (byte)'a' }; // ".meta" ReadOnlySpan<byte> metaExtension = ".meta"u8;
var sb = new U8StringBuilder(pathBuffer); var sb = new U8StringBuilder(pathBuffer);
sb.Append((byte)'/').AppendFormat(metaType, 'x', 8).Append(metaExtension); sb.Append((byte)'/').AppendFormat(metaType, 'x', 8).Append(metaExtension);
@ -1280,11 +1279,7 @@ public static class PathFunctions
/// <see cref="ResultFs.InvalidArgument"/>: <paramref name="pathBuffer"/> was too small to contain the built path.</returns> /// <see cref="ResultFs.InvalidArgument"/>: <paramref name="pathBuffer"/> was too small to contain the built path.</returns>
internal static Result SetUpFixedPathSaveMetaDir(scoped ref Path path, Span<byte> pathBuffer, ulong saveDataId) internal static Result SetUpFixedPathSaveMetaDir(scoped ref Path path, Span<byte> pathBuffer, ulong saveDataId)
{ {
ReadOnlySpan<byte> metaDirectoryName = new[] ReadOnlySpan<byte> metaDirectoryName = "/saveMeta/"u8;
{
(byte)'/', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'M', (byte)'e', (byte)'t',
(byte)'a', (byte)'/'
};
var sb = new U8StringBuilder(pathBuffer); var sb = new U8StringBuilder(pathBuffer);
sb.Append(metaDirectoryName).AppendFormat(saveDataId, 'x', 16); sb.Append(metaDirectoryName).AppendFormat(saveDataId, 'x', 16);

View file

@ -16,15 +16,9 @@ namespace LibHac.Fs;
/// <remarks>Based on nnSdk 13.4.0 (FS 13.1.0)</remarks> /// <remarks>Based on nnSdk 13.4.0 (FS 13.1.0)</remarks>
public static class PathFormatter public static class PathFormatter
{ {
private static ReadOnlySpan<byte> InvalidCharacter => private static ReadOnlySpan<byte> InvalidCharacter => ":*?<>|"u8;
new[] { (byte)':', (byte)'*', (byte)'?', (byte)'<', (byte)'>', (byte)'|' }; private static ReadOnlySpan<byte> InvalidCharacterForHostName => ":*<>|$"u8;
private static ReadOnlySpan<byte> InvalidCharacterForMountName => "*?<>|"u8;
private static ReadOnlySpan<byte> InvalidCharacterForHostName =>
new[] { (byte)':', (byte)'*', (byte)'<', (byte)'>', (byte)'|', (byte)'$' };
private static ReadOnlySpan<byte> InvalidCharacterForMountName =>
new[] { (byte)'*', (byte)'?', (byte)'<', (byte)'>', (byte)'|' };
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Result CheckHostName(ReadOnlySpan<byte> name) private static Result CheckHostName(ReadOnlySpan<byte> name)

View file

@ -126,8 +126,7 @@ public static class PathUtility
/* /*
The optimized code is equivalent to this: The optimized code is equivalent to this:
ReadOnlySpan<byte> invalidChars = new[] ReadOnlySpan<byte> invalidChars = ":*?<>|"u8;
{(byte) ':', (byte) '*', (byte) '?', (byte) '<', (byte) '>', (byte) '|'};
for (int i = 0; i < invalidChars.Length; i++) for (int i = 0; i < invalidChars.Length; i++)
{ {

View file

@ -24,9 +24,5 @@ internal static class CommonPaths
public const char GameCardFileSystemMountNameNormalSuffix = 'N'; public const char GameCardFileSystemMountNameNormalSuffix = 'N';
public const char GameCardFileSystemMountNameSecureSuffix = 'S'; public const char GameCardFileSystemMountNameSecureSuffix = 'S';
public static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => // Nintendo public static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => "Nintendo"u8;
new[]
{
(byte)'N', (byte)'i', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'d', (byte)'o'
};
} }

View file

@ -527,107 +527,46 @@ internal class FileSystemAccessor : IDisposable
} }
/// <summary>"<c>$fs</c>"</summary> /// <summary>"<c>$fs</c>"</summary>
private static ReadOnlySpan<byte> LogFsModuleName => new[] { (byte)'$', (byte)'f', (byte)'s' }; // "$fs" private static ReadOnlySpan<byte> LogFsModuleName => "$fs"u8;
/// <summary>"<c>------ FS ERROR INFORMATION ------\n</c>"</summary> /// <summary>"<c>------ FS ERROR INFORMATION ------\n</c>"</summary>
private static ReadOnlySpan<byte> LogFsErrorInfo => // "------ FS ERROR INFORMATION ------\n" private static ReadOnlySpan<byte> LogFsErrorInfo => "------ FS ERROR INFORMATION ------\n"u8;
new[]
{
(byte)'-', (byte)'-', (byte)'-', (byte)'-', (byte)'-', (byte)'-', (byte)' ', (byte)'F',
(byte)'S', (byte)' ', (byte)'E', (byte)'R', (byte)'R', (byte)'O', (byte)'R', (byte)' ',
(byte)'I', (byte)'N', (byte)'F', (byte)'O', (byte)'R', (byte)'M', (byte)'A', (byte)'T',
(byte)'I', (byte)'O', (byte)'N', (byte)' ', (byte)'-', (byte)'-', (byte)'-', (byte)'-',
(byte)'-', (byte)'-', (byte)'\n'
};
/// <summary>"<c>Error: File not closed</c>"</summary> /// <summary>"<c>Error: File not closed</c>"</summary>
private static ReadOnlySpan<byte> LogFileNotClosed => // "Error: File not closed" private static ReadOnlySpan<byte> LogFileNotClosed => "Error: File not closed"u8;
new[]
{
(byte)'E', (byte)'r', (byte)'r', (byte)'o', (byte)'r', (byte)':', (byte)' ', (byte)'F',
(byte)'i', (byte)'l', (byte)'e', (byte)' ', (byte)'n', (byte)'o', (byte)'t', (byte)' ',
(byte)'c', (byte)'l', (byte)'o', (byte)'s', (byte)'e', (byte)'d'
};
/// <summary>"<c>Error: Directory not closed</c>"</summary> /// <summary>"<c>Error: Directory not closed</c>"</summary>
private static ReadOnlySpan<byte> LogDirectoryNotClosed => // "Error: Directory not closed" private static ReadOnlySpan<byte> LogDirectoryNotClosed => "Error: Directory not closed"u8;
new[]
{
(byte)'E', (byte)'r', (byte)'r', (byte)'o', (byte)'r', (byte)':', (byte)' ', (byte)'D',
(byte)'i', (byte)'r', (byte)'e', (byte)'c', (byte)'t', (byte)'o', (byte)'r', (byte)'y',
(byte)' ', (byte)'n', (byte)'o', (byte)'t', (byte)' ', (byte)'c', (byte)'l', (byte)'o',
(byte)'s', (byte)'e', (byte)'d'
};
/// <summary>"<c> (mount_name: "</c>"</summary> /// <summary>"<c> (mount_name: "</c>"</summary>
private static ReadOnlySpan<byte> LogMountName => // " (mount_name: "" private static ReadOnlySpan<byte> LogMountName => " (mount_name: \""u8;
new[]
{
(byte)' ', (byte)'(', (byte)'m', (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)'_',
(byte)'n', (byte)'a', (byte)'m', (byte)'e', (byte)':', (byte)' ', (byte)'"'
};
/// <summary>"<c>", count: </c>"</summary> /// <summary>"<c>", count: </c>"</summary>
private static ReadOnlySpan<byte> LogCount => // "", count: " private static ReadOnlySpan<byte> LogCount => "\", count: "u8;
new[]
{
(byte)'"', (byte)',', (byte)' ', (byte)'c', (byte)'o', (byte)'u', (byte)'n', (byte)'t',
(byte)':', (byte)' '
};
/// <summary>"<c>)\n</c>"</summary> /// <summary>"<c>)\n</c>"</summary>
public static ReadOnlySpan<byte> LogLineEnd => new[] { (byte)')', (byte)'\n' }; // ")\n" public static ReadOnlySpan<byte> LogLineEnd => ")\n"u8;
/// <summary>"<c> | </c>"</summary> /// <summary>"<c> | </c>"</summary>
public static ReadOnlySpan<byte> LogOrOperator => new[] { (byte)' ', (byte)'|', (byte)' ' }; // " | " public static ReadOnlySpan<byte> LogOrOperator => " | "u8;
/// <summary>"<c>OpenMode_Read</c>"</summary> /// <summary>"<c>OpenMode_Read</c>"</summary>
private static ReadOnlySpan<byte> LogOpenModeRead => // "OpenMode_Read" private static ReadOnlySpan<byte> LogOpenModeRead => "OpenMode_Read"u8;
new[]
{
(byte)'O', (byte)'p', (byte)'e', (byte)'n', (byte)'M', (byte)'o', (byte)'d', (byte)'e',
(byte)'_', (byte)'R', (byte)'e', (byte)'a', (byte)'d'
};
/// <summary>"<c>OpenMode_Write</c>"</summary> /// <summary>"<c>OpenMode_Write</c>"</summary>
private static ReadOnlySpan<byte> LogOpenModeWrite => // "OpenMode_Write" private static ReadOnlySpan<byte> LogOpenModeWrite => "OpenMode_Write"u8;
new[]
{
(byte)'O', (byte)'p', (byte)'e', (byte)'n', (byte)'M', (byte)'o', (byte)'d', (byte)'e',
(byte)'_', (byte)'W', (byte)'r', (byte)'i', (byte)'t', (byte)'e'
};
/// <summary>"<c>OpenMode_AllowAppend</c>"</summary> /// <summary>"<c>OpenMode_AllowAppend</c>"</summary>
private static ReadOnlySpan<byte> LogOpenModeAppend => // "OpenMode_AllowAppend" private static ReadOnlySpan<byte> LogOpenModeAppend => "OpenMode_AllowAppend"u8;
new[]
{
(byte)'O', (byte)'p', (byte)'e', (byte)'n', (byte)'M', (byte)'o', (byte)'d', (byte)'e',
(byte)'_', (byte)'A', (byte)'l', (byte)'l', (byte)'o', (byte)'w', (byte)'A', (byte)'p',
(byte)'p', (byte)'e', (byte)'n', (byte)'d'
};
/// <summary>"<c> handle: 0x</c>"</summary> /// <summary>"<c> handle: 0x</c>"</summary>
private static ReadOnlySpan<byte> LogHandle => // " handle: 0x" private static ReadOnlySpan<byte> LogHandle => " handle: 0x"u8;
new[]
{
(byte)' ', (byte)' ', (byte)' ', (byte)' ', (byte)' ', (byte)'h', (byte)'a', (byte)'n',
(byte)'d', (byte)'l', (byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x'
};
/// <summary>"<c>, open_mode: </c>"</summary> /// <summary>"<c>, open_mode: </c>"</summary>
private static ReadOnlySpan<byte> LogOpenMode => // ", open_mode: " private static ReadOnlySpan<byte> LogOpenMode => ", open_mode: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'o', (byte)'p', (byte)'e', (byte)'n', (byte)'_', (byte)'m',
(byte)'o', (byte)'d', (byte)'e', (byte)':', (byte)' '
};
/// <summary>"<c>, size:</c>"</summary> /// <summary>"<c>, size: </c>"</summary>
private static ReadOnlySpan<byte> LogSize => // ", size: " private static ReadOnlySpan<byte> LogSize => ", size: "u8;
new[]
{
(byte)',', (byte)' ', (byte)'s', (byte)'i', (byte)'z', (byte)'e', (byte)':', (byte)' '
};
private void DumpUnclosedAccessorList(OpenMode fileOpenModeMask, OpenDirectoryMode directoryOpenModeMask) private void DumpUnclosedAccessorList(OpenMode fileOpenModeMask, OpenDirectoryMode directoryOpenModeMask)
{ {

View file

@ -458,10 +458,10 @@ public static class UserFileSystem
{ {
UnsafeHelpers.SkipParamInit(out freeSpace); UnsafeHelpers.SkipParamInit(out freeSpace);
if (subPath.IsEmpty() && StringUtils.Compare(subPath, new[] { (byte)'/' }) != 0) if (subPath.IsEmpty() && StringUtils.Compare(subPath, "/"u8) != 0)
return ResultFs.InvalidMountName.Log(); return ResultFs.InvalidMountName.Log();
return fileSystem.GetFreeSpaceSize(out freeSpace, new U8Span(new[] { (byte)'/' })); return fileSystem.GetFreeSpaceSize(out freeSpace, new U8Span("/"u8));
} }
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog()) if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())

View file

@ -93,7 +93,7 @@ public static class UserFileSystemPrivate
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
res = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref info), ReadOnlySpan<byte>.Empty, res = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref info), ReadOnlySpan<byte>.Empty,
QueryId.QueryUnpreparedFileInformation, new U8Span(new[] { (byte)'/' })); QueryId.QueryUnpreparedFileInformation, new U8Span("/"u8));
fs.Impl.AbortIfNeeded(res); fs.Impl.AbortIfNeeded(res);
return res; return res;
} }

View file

@ -8,88 +8,50 @@ public static class CommonMountNames
// Filesystem names. // Filesystem names.
/// <summary>"<c>@Host</c>"</summary> /// <summary>"<c>@Host</c>"</summary>
public static ReadOnlySpan<byte> HostRootFileSystemMountName => // "@Host" public static ReadOnlySpan<byte> HostRootFileSystemMountName => "@Host"u8;
new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t' };
/// <summary>"<c>@Sdcard</c>"</summary> /// <summary>"<c>@Sdcard</c>"</summary>
public static ReadOnlySpan<byte> SdCardFileSystemMountName => // "@Sdcard" public static ReadOnlySpan<byte> SdCardFileSystemMountName => "@Sdcard"u8;
new[] { (byte)'@', (byte)'S', (byte)'d', (byte)'c', (byte)'a', (byte)'r', (byte)'d' };
/// <summary>"<c>@Gc</c>"</summary> /// <summary>"<c>@Gc</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountName => // "@Gc" public static ReadOnlySpan<byte> GameCardFileSystemMountName => "@Gc"u8;
new[] { (byte)'@', (byte)'G', (byte)'c' };
/// <summary>"<c>U</c>"</summary> /// <summary>"<c>U</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountNameUpdateSuffix => // "U" public static ReadOnlySpan<byte> GameCardFileSystemMountNameUpdateSuffix => "U"u8;
new[] { (byte)'U' };
/// <summary>"<c>N</c>"</summary> /// <summary>"<c>N</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountNameNormalSuffix => // "N" public static ReadOnlySpan<byte> GameCardFileSystemMountNameNormalSuffix => "N"u8;
new[] { (byte)'N' };
/// <summary>"<c>S</c>"</summary> /// <summary>"<c>S</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountNameSecureSuffix => // "S" public static ReadOnlySpan<byte> GameCardFileSystemMountNameSecureSuffix => "S"u8;
new[] { (byte)'S' };
// Built-in storage names. // Built-in storage names.
/// <summary>"<c>@CalibFile</c>"</summary> /// <summary>"<c>@CalibFile</c>"</summary>
public static ReadOnlySpan<byte> BisCalibrationFilePartitionMountName => // "@CalibFile" public static ReadOnlySpan<byte> BisCalibrationFilePartitionMountName => "@CalibFile"u8;
new[]
{
(byte)'@', (byte)'C', (byte)'a', (byte)'l', (byte)'i', (byte)'b', (byte)'F', (byte)'i',
(byte)'l', (byte)'e'
};
/// <summary>"<c>@Safe</c>"</summary> /// <summary>"<c>@Safe</c>"</summary>
public static ReadOnlySpan<byte> BisSafeModePartitionMountName => // "@Safe" public static ReadOnlySpan<byte> BisSafeModePartitionMountName => "@Safe"u8;
new[] { (byte)'@', (byte)'S', (byte)'a', (byte)'f', (byte)'e' };
/// <summary>"<c>@User</c>"</summary> /// <summary>"<c>@User</c>"</summary>
public static ReadOnlySpan<byte> BisUserPartitionMountName => // "@User" public static ReadOnlySpan<byte> BisUserPartitionMountName => "@User"u8;
new[] { (byte)'@', (byte)'U', (byte)'s', (byte)'e', (byte)'r' };
/// <summary>"<c>@System</c>"</summary> /// <summary>"<c>@System</c>"</summary>
public static ReadOnlySpan<byte> BisSystemPartitionMountName => // "@System" public static ReadOnlySpan<byte> BisSystemPartitionMountName => "@System"u8;
new[] { (byte)'@', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' };
//Content storage names. //Content storage names.
/// <summary>"<c>@SystemContent</c>"</summary> /// <summary>"<c>@SystemContent</c>"</summary>
public static ReadOnlySpan<byte> ContentStorageSystemMountName => // "@SystemContent" public static ReadOnlySpan<byte> ContentStorageSystemMountName => "@SystemContent"u8;
new[]
{
(byte)'@', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m', (byte)'C',
(byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'t'
};
/// <summary>"<c>@UserContent</c>"</summary> /// <summary>"<c>@UserContent</c>"</summary>
public static ReadOnlySpan<byte> ContentStorageUserMountName => // "@UserContent" public static ReadOnlySpan<byte> ContentStorageUserMountName => "@UserContent"u8;
new[]
{
(byte)'@', (byte)'U', (byte)'s', (byte)'e', (byte)'r', (byte)'C', (byte)'o', (byte)'n',
(byte)'t', (byte)'e', (byte)'n', (byte)'t'
};
/// <summary>"<c>@SdCardContent</c>"</summary> /// <summary>"<c>@SdCardContent</c>"</summary>
public static ReadOnlySpan<byte> ContentStorageSdCardMountName => // "@SdCardContent" public static ReadOnlySpan<byte> ContentStorageSdCardMountName => "@SdCardContent"u8;
new[]
{
(byte)'@', (byte)'S', (byte)'d', (byte)'C', (byte)'a', (byte)'r', (byte)'d', (byte)'C',
(byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'t'
};
// Registered update partition // Registered update partition
/// <summary>"<c>@RegUpdate</c>"</summary> /// <summary>"<c>@RegUpdate</c>"</summary>
public static ReadOnlySpan<byte> RegisteredUpdatePartitionMountName => // "@RegUpdate" public static ReadOnlySpan<byte> RegisteredUpdatePartitionMountName => "@RegUpdate"u8;
new[]
{
(byte)'@', (byte)'R', (byte)'e', (byte)'g', (byte)'U', (byte)'p', (byte)'d', (byte)'a',
(byte)'t', (byte)'e'
};
/// <summary>"<c>@Nintendo</c>"</summary> /// <summary>"<c>Nintendo</c>"</summary>
public static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => // "Nintendo" public static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => "Nintendo"u8;
new[]
{
(byte)'N', (byte)'i', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'d', (byte)'o'
};
} }

View file

@ -61,10 +61,5 @@ public static class CustomStorage
} }
/// <summary>"<c>CustomStorage0</c>"</summary> /// <summary>"<c>CustomStorage0</c>"</summary>
private static ReadOnlySpan<byte> CustomStorageDirectoryName => private static ReadOnlySpan<byte> CustomStorageDirectoryName => "CustomStorage0"u8;
new[]
{
(byte)'C', (byte)'u', (byte)'s', (byte)'t', (byte)'o', (byte)'m', (byte)'S', (byte)'t',
(byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e', (byte)'0'
};
} }

View file

@ -24,8 +24,7 @@ namespace LibHac.Fs.Shim;
public static class Host public static class Host
{ {
/// <summary>"<c>@Host:/</c>"</summary> /// <summary>"<c>@Host:/</c>"</summary>
private static ReadOnlySpan<byte> HostRootFileSystemPath => private static ReadOnlySpan<byte> HostRootFileSystemPath => "@Host:/"u8;
new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)':', (byte)'/' };
private const int HostRootFileSystemPathLength = 7; private const int HostRootFileSystemPathLength = 7;

View file

@ -29,7 +29,7 @@ public static class SignedSystemPartition
static Result Operate(ref bool isValid, FileSystemAccessor fileSystem) static Result Operate(ref bool isValid, FileSystemAccessor fileSystem)
{ {
Result res = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref isValid), ReadOnlySpan<byte>.Empty, Result res = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref isValid), ReadOnlySpan<byte>.Empty,
QueryId.IsSignedSystemPartition, new U8Span(new[] { (byte)'/' })); QueryId.IsSignedSystemPartition, new U8Span("/"u8));
if (res.IsFailure()) if (res.IsFailure())
{ {

View file

@ -64,13 +64,5 @@ internal readonly struct AccessLogService
} }
/// <summary>"<c>FS_ACCESS: { multi_program_tag: true }\n</c>"</summary> /// <summary>"<c>FS_ACCESS: { multi_program_tag: true }\n</c>"</summary>
private static ReadOnlySpan<byte> MultiProgramTag => // FS_ACCESS: { multi_program_tag: true }\n private static ReadOnlySpan<byte> MultiProgramTag => "FS_ACCESS: { multi_program_tag: true }\n"u8;
new[]
{
(byte)'F', (byte)'S', (byte)'_', (byte)'A', (byte)'C', (byte)'C', (byte)'E', (byte)'S',
(byte)'S', (byte)':', (byte)' ', (byte)'{', (byte)' ', (byte)'m', (byte)'u', (byte)'l',
(byte)'t', (byte)'i', (byte)'_', (byte)'p', (byte)'r', (byte)'o', (byte)'g', (byte)'r',
(byte)'a', (byte)'m', (byte)'_', (byte)'t', (byte)'a', (byte)'g', (byte)':', (byte)' ',
(byte)'t', (byte)'r', (byte)'u', (byte)'e', (byte)' ', (byte)'}', (byte)'\n'
};
} }

View file

@ -292,7 +292,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
_baseFileSystem.Destroy(); _baseFileSystem.Destroy();
} }
private static ReadOnlySpan<byte> RootDir => new[] { (byte)'/' }; private static ReadOnlySpan<byte> RootDir => "/"u8;
private Result SetUpPath(ref Path fsPath, in PathSf sfPath) private Result SetUpPath(ref Path fsPath, in PathSf sfPath)
{ {

View file

@ -55,8 +55,7 @@ internal class MultiCommitManager : IMultiCommitManager
private const long CommitContextFileSize = 0x200; private const long CommitContextFileSize = 0x200;
/// <summary>"<c>/commitinfo</c>"</summary> /// <summary>"<c>/commitinfo</c>"</summary>
private static ReadOnlySpan<byte> CommitContextFileName => private static ReadOnlySpan<byte> CommitContextFileName => "/commitinfo"u8;
new[] { (byte)'/', (byte)'c', (byte)'o', (byte)'m', (byte)'m', (byte)'i', (byte)'t', (byte)'i', (byte)'n', (byte)'f', (byte)'o' };
private SharedRef<ISaveDataMultiCommitCoreInterface> _multiCommitInterface; private SharedRef<ISaveDataMultiCommitCoreInterface> _multiCommitInterface;
private readonly SharedRef<IFileSystem>[] _fileSystems; private readonly SharedRef<IFileSystem>[] _fileSystems;

View file

@ -480,7 +480,7 @@ public class NcaFileSystemServiceImpl
{ {
UnsafeHelpers.SkipParamInit(out isDirectory); UnsafeHelpers.SkipParamInit(out isDirectory);
ReadOnlySpan<byte> mountSeparator = new[] { (byte)':', (byte)'/' }; ReadOnlySpan<byte> mountSeparator = ":/"u8;
if (StringUtils.Compare(mountSeparator, path, mountSeparator.Length) != 0) if (StringUtils.Compare(mountSeparator, path, mountSeparator.Length) != 0)
{ {
@ -502,8 +502,8 @@ public class NcaFileSystemServiceImpl
ReadOnlySpan<byte> fileExtension = path.Value.Slice(pathLen - 4); ReadOnlySpan<byte> fileExtension = path.Value.Slice(pathLen - 4);
ReadOnlySpan<byte> ncaExtension = new[] { (byte)'.', (byte)'n', (byte)'c', (byte)'a' }; ReadOnlySpan<byte> ncaExtension = ".nca"u8;
ReadOnlySpan<byte> nspExtension = new[] { (byte)'.', (byte)'n', (byte)'s', (byte)'p' }; ReadOnlySpan<byte> nspExtension = ".nsp"u8;
if (StringUtils.CompareCaseInsensitive(fileExtension, ncaExtension) == 0 || if (StringUtils.CompareCaseInsensitive(fileExtension, ncaExtension) == 0 ||
StringUtils.CompareCaseInsensitive(fileExtension, nspExtension) == 0) StringUtils.CompareCaseInsensitive(fileExtension, nspExtension) == 0)
@ -531,8 +531,7 @@ public class NcaFileSystemServiceImpl
using var pathRoot = new Path(); using var pathRoot = new Path();
using var pathData = new Path(); using var pathData = new Path();
Result res = PathFunctions.SetUpFixedPath(ref pathData.Ref(), Result res = PathFunctions.SetUpFixedPath(ref pathData.Ref(), "/data"u8);
new[] { (byte)'/', (byte)'d', (byte)'a', (byte)'t', (byte)'a' });
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
res = pathRoot.Combine(in path, in pathData); res = pathRoot.Combine(in path, in pathData);
@ -551,7 +550,7 @@ public class NcaFileSystemServiceImpl
private Result ParseNsp(ref U8Span path, ref SharedRef<IFileSystem> outFileSystem, private Result ParseNsp(ref U8Span path, ref SharedRef<IFileSystem> outFileSystem,
ref SharedRef<IFileSystem> baseFileSystem) ref SharedRef<IFileSystem> baseFileSystem)
{ {
ReadOnlySpan<byte> nspExtension = new[] { (byte)'.', (byte)'n', (byte)'s', (byte)'p' }; ReadOnlySpan<byte> nspExtension = ".nsp"u8;
// Search for the end of the nsp part of the path // Search for the end of the nsp part of the path
int nspPathLen = 0; int nspPathLen = 0;
@ -648,17 +647,17 @@ public class NcaFileSystemServiceImpl
return Result.Success; return Result.Success;
case FileSystemProxyType.Code: case FileSystemProxyType.Code:
dirName = new[] { (byte)'/', (byte)'c', (byte)'o', (byte)'d', (byte)'e', (byte)'/' }; dirName = "/code/"u8;
break; break;
case FileSystemProxyType.Rom: case FileSystemProxyType.Rom:
case FileSystemProxyType.Control: case FileSystemProxyType.Control:
case FileSystemProxyType.Manual: case FileSystemProxyType.Manual:
case FileSystemProxyType.Meta: case FileSystemProxyType.Meta:
case FileSystemProxyType.RegisteredUpdate: case FileSystemProxyType.RegisteredUpdate:
dirName = new[] { (byte)'/', (byte)'d', (byte)'a', (byte)'t', (byte)'a', (byte)'/' }; dirName = "/data/"u8;
break; break;
case FileSystemProxyType.Logo: case FileSystemProxyType.Logo:
dirName = new[] { (byte)'/', (byte)'l', (byte)'o', (byte)'g', (byte)'o', (byte)'/' }; dirName = "/logo/"u8;
break; break;
default: default:
@ -905,17 +904,9 @@ public class NcaFileSystemServiceImpl
} }
} }
private static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => // Nintendo private static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => "Nintendo"u8;
new[]
{
(byte)'N', (byte)'i', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'d', (byte)'o'
};
private static ReadOnlySpan<byte> ContentStorageDirectoryName => // Contents private static ReadOnlySpan<byte> ContentStorageDirectoryName => "Contents"u8;
new[]
{
(byte)'C', (byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'t', (byte)'s'
};
} }
public readonly struct InternalProgramIdRangeForSpeedEmulation public readonly struct InternalProgramIdRangeForSpeedEmulation

View file

@ -621,7 +621,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
using var pathRoot = new Path(); using var pathRoot = new Path();
res = PathFunctions.SetUpFixedPath(ref pathRoot.Ref(), new[] { (byte)'/' }); res = PathFunctions.SetUpFixedPath(ref pathRoot.Ref(), "/"u8);
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
fileSystem.Get.GetFreeSpaceSize(out long freeSpaceSize, in pathRoot); fileSystem.Get.GetFreeSpaceSize(out long freeSpaceSize, in pathRoot);
@ -854,7 +854,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
if (path.Str[0] == NullTerminator) if (path.Str[0] == NullTerminator)
{ {
res = saveDataRootPath.Initialize(new[] { (byte)'.' }); res = saveDataRootPath.Initialize("."u8);
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
} }
else else
@ -2583,7 +2583,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
using var pathRoot = new Path(); using var pathRoot = new Path();
res = PathFunctions.SetUpFixedPath(ref pathRoot.Ref(), new[] { (byte)'/' }); res = PathFunctions.SetUpFixedPath(ref pathRoot.Ref(), "/"u8);
if (res.IsFailure()) return res.Miss(); if (res.IsFailure()) return res.Miss();
res = fileSystem.Get.CleanDirectoryRecursively(in pathRoot); res = fileSystem.Get.CleanDirectoryRecursively(in pathRoot);

View file

@ -346,12 +346,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
public Result DeleteAllSaveDataMetas(ulong saveDataId, SaveDataSpaceId spaceId) public Result DeleteAllSaveDataMetas(ulong saveDataId, SaveDataSpaceId spaceId)
{ {
ReadOnlySpan<byte> metaDirName = // /saveMeta ReadOnlySpan<byte> metaDirName = "/saveMeta"u8;
new[]
{
(byte)'/', (byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'M', (byte)'e', (byte)'t',
(byte)'a'
};
Unsafe.SkipInit(out Array18<byte> saveDataIdDirectoryNameBuffer); Unsafe.SkipInit(out Array18<byte> saveDataIdDirectoryNameBuffer);
@ -697,11 +692,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
if (spaceId == SaveDataSpaceId.Temporary) if (spaceId == SaveDataSpaceId.Temporary)
{ {
saveDirName = new[] { (byte)'/', (byte)'t', (byte)'e', (byte)'m', (byte)'p' }; // /temp saveDirName = "/temp"u8;
} }
else else
{ {
saveDirName = new[] { (byte)'/', (byte)'s', (byte)'a', (byte)'v', (byte)'e' }; // /save saveDirName = "/save"u8;
} }
res = PathFunctions.SetUpFixedPath(ref saveDataAreaDirectoryName.Ref(), saveDirName); res = PathFunctions.SetUpFixedPath(ref saveDataAreaDirectoryName.Ref(), saveDirName);

View file

@ -37,15 +37,9 @@ public class SaveDataIndexer : ISaveDataIndexer
private const long LastPublishedIdFileSize = sizeof(long); private const long LastPublishedIdFileSize = sizeof(long);
private const int MaxPathLength = 0x30; private const int MaxPathLength = 0x30;
private static ReadOnlySpan<byte> LastPublishedIdFileName => // lastPublishedId private static ReadOnlySpan<byte> LastPublishedIdFileName => "lastPublishedId"u8;
new[]
{
(byte)'l', (byte)'a', (byte)'s', (byte)'t', (byte)'P', (byte)'u', (byte)'b', (byte)'l',
(byte)'i', (byte)'s', (byte)'h', (byte)'e', (byte)'d', (byte)'I', (byte)'d'
};
private static ReadOnlySpan<byte> MountDelimiter => // :/ private static ReadOnlySpan<byte> MountDelimiter => ":/"u8;
new[] { (byte)':', (byte)'/' };
private delegate void SaveDataValueTransform(ref SaveDataIndexerValue value, ReadOnlySpan<byte> updateData); private delegate void SaveDataValueTransform(ref SaveDataIndexerValue value, ReadOnlySpan<byte> updateData);

View file

@ -231,36 +231,16 @@ internal class SaveDataIndexerManager : ISaveDataIndexerManager, IDisposable
} }
/// <summary>"<c>saveDataIxrDb</c>"</summary> /// <summary>"<c>saveDataIxrDb</c>"</summary>
private static ReadOnlySpan<byte> BisIndexerMountName => private static ReadOnlySpan<byte> BisIndexerMountName => "saveDataIxrDb"u8;
new[]
{
(byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'D', (byte)'a', (byte)'t', (byte)'a',
(byte)'I', (byte)'x', (byte)'r', (byte)'D', (byte)'b'
};
/// <summary>"<c>saveDataIxrDbSd</c>"</summary> /// <summary>"<c>saveDataIxrDbSd</c>"</summary>
private static ReadOnlySpan<byte> SdCardIndexerMountName => private static ReadOnlySpan<byte> SdCardIndexerMountName => "saveDataIxrDbSd"u8;
new[]
{
(byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'D', (byte)'a', (byte)'t', (byte)'a',
(byte)'I', (byte)'x', (byte)'r', (byte)'D', (byte)'b', (byte)'S', (byte)'d'
};
/// <summary>"<c>saveDataIxrDbPr</c>"</summary> /// <summary>"<c>saveDataIxrDbPr</c>"</summary>
private static ReadOnlySpan<byte> ProperBisIndexerMountName => private static ReadOnlySpan<byte> ProperBisIndexerMountName => "saveDataIxrDbPr"u8;
new[]
{
(byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'D', (byte)'a', (byte)'t', (byte)'a',
(byte)'I', (byte)'x', (byte)'r', (byte)'D', (byte)'b', (byte)'P', (byte)'r'
};
/// <summary>"<c>saveDataIxrDbSf</c>"</summary> /// <summary>"<c>saveDataIxrDbSf</c>"</summary>
private static ReadOnlySpan<byte> SafeModeIndexerMountName => private static ReadOnlySpan<byte> SafeModeIndexerMountName => "saveDataIxrDbSf"u8;
new[]
{
(byte)'s', (byte)'a', (byte)'v', (byte)'e', (byte)'D', (byte)'a', (byte)'t', (byte)'a',
(byte)'I', (byte)'x', (byte)'r', (byte)'D', (byte)'b', (byte)'S', (byte)'f'
};
} }
/// <summary> /// <summary>

View file

@ -525,7 +525,7 @@ public class ConcatenationFileSystem : IFileSystem
base.Dispose(); base.Dispose();
} }
private static ReadOnlySpan<byte> RootPath => new[] { (byte)'/' }; private static ReadOnlySpan<byte> RootPath => "/"u8;
/// <summary> /// <summary>
/// Appends the two-digit-padded <paramref name="index"/> to the given <see cref="Path"/>. /// Appends the two-digit-padded <paramref name="index"/> to the given <see cref="Path"/>.

View file

@ -30,10 +30,10 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
{ {
private const int IdealWorkBufferSize = 0x100000; // 1 MiB private const int IdealWorkBufferSize = 0x100000; // 1 MiB
private static ReadOnlySpan<byte> CommittedDirectoryName => new[] { (byte)'/', (byte)'0' }; private static ReadOnlySpan<byte> CommittedDirectoryName => "/0"u8;
private static ReadOnlySpan<byte> ModifiedDirectoryName => new[] { (byte)'/', (byte)'1' }; private static ReadOnlySpan<byte> ModifiedDirectoryName => "/1"u8;
private static ReadOnlySpan<byte> SynchronizingDirectoryName => new[] { (byte)'/', (byte)'_' }; private static ReadOnlySpan<byte> SynchronizingDirectoryName => "/_"u8;
private static ReadOnlySpan<byte> LockFileName => new[] { (byte)'/', (byte)'.', (byte)'l', (byte)'o', (byte)'c', (byte)'k' }; private static ReadOnlySpan<byte> LockFileName => "/.lock"u8;
private IFileSystem _baseFs; private IFileSystem _baseFs;
private SdkMutexType _mutex; private SdkMutexType _mutex;
@ -735,26 +735,11 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
// always writing the extra data directly to the /extradata file. // always writing the extra data directly to the /extradata file.
// Everything below this point is a LibHac extension. // Everything below this point is a LibHac extension.
private static ReadOnlySpan<byte> CommittedExtraDataName => // "/ExtraData0" private static ReadOnlySpan<byte> CommittedExtraDataName => "/ExtraData0"u8;
new[]
{
(byte)'/', (byte)'E', (byte)'x', (byte)'t', (byte)'r', (byte)'a', (byte)'D', (byte)'a',
(byte)'t', (byte)'a', (byte)'0'
};
private static ReadOnlySpan<byte> ModifiedExtraDataName => // "/ExtraData1" private static ReadOnlySpan<byte> ModifiedExtraDataName => "/ExtraData1"u8;
new[]
{
(byte)'/', (byte)'E', (byte)'x', (byte)'t', (byte)'r', (byte)'a', (byte)'D', (byte)'a',
(byte)'t', (byte)'a', (byte)'1'
};
private static ReadOnlySpan<byte> SynchronizingExtraDataName => // "/ExtraData_" private static ReadOnlySpan<byte> SynchronizingExtraDataName => "/ExtraData_"u8;
new[]
{
(byte)'/', (byte)'E', (byte)'x', (byte)'t', (byte)'r', (byte)'a', (byte)'D', (byte)'a',
(byte)'t', (byte)'a', (byte)'_'
};
/// <summary> /// <summary>
/// Initializes the save data's extra data files. /// Initializes the save data's extra data files.

View file

@ -744,74 +744,20 @@ public class HierarchicalIntegrityVerificationStorage : IStorage
} }
/// <summary>"<c>HierarchicalIntegrityVerificationStorage::Master</c>"</summary> /// <summary>"<c>HierarchicalIntegrityVerificationStorage::Master</c>"</summary>
public static ReadOnlySpan<byte> MasterKey => // "HierarchicalIntegrityVerificationStorage::Master" public static ReadOnlySpan<byte> MasterKey => "HierarchicalIntegrityVerificationStorage::Master"u8;
new[]
{
(byte)'H', (byte)'i', (byte)'e', (byte)'r', (byte)'a', (byte)'r', (byte)'c', (byte)'h',
(byte)'i', (byte)'c', (byte)'a', (byte)'l', (byte)'I', (byte)'n', (byte)'t', (byte)'e',
(byte)'g', (byte)'r', (byte)'i', (byte)'t', (byte)'y', (byte)'V', (byte)'e', (byte)'r',
(byte)'i', (byte)'f', (byte)'i', (byte)'c', (byte)'a', (byte)'t', (byte)'i', (byte)'o',
(byte)'n', (byte)'S', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)':', (byte)':', (byte)'M', (byte)'a', (byte)'s', (byte)'t', (byte)'e', (byte)'r'
};
/// <summary>"<c>HierarchicalIntegrityVerificationStorage::L1</c>"</summary> /// <summary>"<c>HierarchicalIntegrityVerificationStorage::L1</c>"</summary>
public static ReadOnlySpan<byte> L1Key => // "HierarchicalIntegrityVerificationStorage::L1" public static ReadOnlySpan<byte> L1Key => "HierarchicalIntegrityVerificationStorage::L1"u8;
new[]
{
(byte)'H', (byte)'i', (byte)'e', (byte)'r', (byte)'a', (byte)'r', (byte)'c', (byte)'h',
(byte)'i', (byte)'c', (byte)'a', (byte)'l', (byte)'I', (byte)'n', (byte)'t', (byte)'e',
(byte)'g', (byte)'r', (byte)'i', (byte)'t', (byte)'y', (byte)'V', (byte)'e', (byte)'r',
(byte)'i', (byte)'f', (byte)'i', (byte)'c', (byte)'a', (byte)'t', (byte)'i', (byte)'o',
(byte)'n', (byte)'S', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)':', (byte)':', (byte)'L', (byte)'1'
};
/// <summary>"<c>HierarchicalIntegrityVerificationStorage::L2</c>"</summary> /// <summary>"<c>HierarchicalIntegrityVerificationStorage::L2</c>"</summary>
public static ReadOnlySpan<byte> L2Key => // "HierarchicalIntegrityVerificationStorage::L2" public static ReadOnlySpan<byte> L2Key => "HierarchicalIntegrityVerificationStorage::L2"u8;
new[]
{
(byte)'H', (byte)'i', (byte)'e', (byte)'r', (byte)'a', (byte)'r', (byte)'c', (byte)'h',
(byte)'i', (byte)'c', (byte)'a', (byte)'l', (byte)'I', (byte)'n', (byte)'t', (byte)'e',
(byte)'g', (byte)'r', (byte)'i', (byte)'t', (byte)'y', (byte)'V', (byte)'e', (byte)'r',
(byte)'i', (byte)'f', (byte)'i', (byte)'c', (byte)'a', (byte)'t', (byte)'i', (byte)'o',
(byte)'n', (byte)'S', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)':', (byte)':', (byte)'L', (byte)'2'
};
/// <summary>"<c>HierarchicalIntegrityVerificationStorage::L3</c>"</summary> /// <summary>"<c>HierarchicalIntegrityVerificationStorage::L3</c>"</summary>
public static ReadOnlySpan<byte> L3Key => // "HierarchicalIntegrityVerificationStorage::L3" public static ReadOnlySpan<byte> L3Key => "HierarchicalIntegrityVerificationStorage::L3"u8;
new[]
{
(byte)'H', (byte)'i', (byte)'e', (byte)'r', (byte)'a', (byte)'r', (byte)'c', (byte)'h',
(byte)'i', (byte)'c', (byte)'a', (byte)'l', (byte)'I', (byte)'n', (byte)'t', (byte)'e',
(byte)'g', (byte)'r', (byte)'i', (byte)'t', (byte)'y', (byte)'V', (byte)'e', (byte)'r',
(byte)'i', (byte)'f', (byte)'i', (byte)'c', (byte)'a', (byte)'t', (byte)'i', (byte)'o',
(byte)'n', (byte)'S', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)':', (byte)':', (byte)'L', (byte)'3'
};
/// <summary>"<c>HierarchicalIntegrityVerificationStorage::L4</c>"</summary> /// <summary>"<c>HierarchicalIntegrityVerificationStorage::L4</c>"</summary>
public static ReadOnlySpan<byte> L4Key => // "HierarchicalIntegrityVerificationStorage::L4" public static ReadOnlySpan<byte> L4Key => "HierarchicalIntegrityVerificationStorage::L4"u8;
new[]
{
(byte)'H', (byte)'i', (byte)'e', (byte)'r', (byte)'a', (byte)'r', (byte)'c', (byte)'h',
(byte)'i', (byte)'c', (byte)'a', (byte)'l', (byte)'I', (byte)'n', (byte)'t', (byte)'e',
(byte)'g', (byte)'r', (byte)'i', (byte)'t', (byte)'y', (byte)'V', (byte)'e', (byte)'r',
(byte)'i', (byte)'f', (byte)'i', (byte)'c', (byte)'a', (byte)'t', (byte)'i', (byte)'o',
(byte)'n', (byte)'S', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)':', (byte)':', (byte)'L', (byte)'4'
};
/// <summary>"<c>HierarchicalIntegrityVerificationStorage::L5</c>"</summary> /// <summary>"<c>HierarchicalIntegrityVerificationStorage::L5</c>"</summary>
public static ReadOnlySpan<byte> L5Key => // "HierarchicalIntegrityVerificationStorage::L5" public static ReadOnlySpan<byte> L5Key => "HierarchicalIntegrityVerificationStorage::L5"u8;
new[]
{
(byte)'H', (byte)'i', (byte)'e', (byte)'r', (byte)'a', (byte)'r', (byte)'c', (byte)'h',
(byte)'i', (byte)'c', (byte)'a', (byte)'l', (byte)'I', (byte)'n', (byte)'t', (byte)'e',
(byte)'g', (byte)'r', (byte)'i', (byte)'t', (byte)'y', (byte)'V', (byte)'e', (byte)'r',
(byte)'i', (byte)'f', (byte)'i', (byte)'c', (byte)'a', (byte)'t', (byte)'i', (byte)'o',
(byte)'n', (byte)'S', (byte)'t', (byte)'o', (byte)'r', (byte)'a', (byte)'g', (byte)'e',
(byte)':', (byte)':', (byte)'L', (byte)'5'
};
} }

View file

@ -55,9 +55,7 @@ public class PartitionFileSystemCore<T> : IFileSystem where T : unmanaged, IPart
if (!_isInitialized) if (!_isInitialized)
return ResultFs.PreconditionViolation.Log(); return ResultFs.PreconditionViolation.Log();
ReadOnlySpan<byte> rootPath = new[] { (byte)'/' }; if (path != "/"u8)
if (path != rootPath)
return ResultFs.PathNotFound.Log(); return ResultFs.PathNotFound.Log();
outDirectory.Reset(new PartitionDirectory(this, mode)); outDirectory.Reset(new PartitionDirectory(this, mode));
@ -95,7 +93,7 @@ public class PartitionFileSystemCore<T> : IFileSystem where T : unmanaged, IPart
if (path.IsEmpty() || pathStr[0] != '/') if (path.IsEmpty() || pathStr[0] != '/')
return ResultFs.InvalidPathFormat.Log(); return ResultFs.InvalidPathFormat.Log();
ReadOnlySpan<byte> rootPath = new[] { (byte)'/' }; ReadOnlySpan<byte> rootPath = "/"u8;
if (StringUtils.Compare(rootPath, pathStr, 2) == 0) if (StringUtils.Compare(rootPath, pathStr, 2) == 0)
{ {

View file

@ -33,7 +33,7 @@ internal static class Utility
public IFileSystem DestFileSystem; public IFileSystem DestFileSystem;
} }
private static ReadOnlySpan<byte> RootPath => new[] { (byte)'/' }; private static ReadOnlySpan<byte> RootPath => "/"u8;
private static Result IterateDirectoryRecursivelyInternal(IFileSystem fs, ref Path workPath, private static Result IterateDirectoryRecursivelyInternal(IFileSystem fs, ref Path workPath,
ref DirectoryEntry dirEntry, FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile, ref DirectoryEntry dirEntry, FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,

View file

@ -24,12 +24,7 @@ public class FlatMapKeyValueStore<TKey> : IDisposable where TKey : unmanaged, IE
private MemoryResource _memoryResource; private MemoryResource _memoryResource;
private MemoryResource _memoryResourceForAutoBuffers; private MemoryResource _memoryResourceForAutoBuffers;
private static ReadOnlySpan<byte> ArchiveFileName => // /imkvdb.arc private static ReadOnlySpan<byte> ArchiveFileName => "/imkvdb.arc"u8;
new[]
{
(byte)'/', (byte)'i', (byte)'m', (byte)'k', (byte)'v', (byte)'d', (byte)'b', (byte)'.',
(byte)'a', (byte)'r', (byte)'c'
};
public int Count => _index.Count; public int Count => _index.Count;