diff --git a/build/CodeGen/results.csv b/build/CodeGen/results.csv index c95aa55b..39f37d15 100644 --- a/build/CodeGen/results.csv +++ b/build/CodeGen/results.csv @@ -35,7 +35,7 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary 2,2961,,InvalidGameCardHandleOnOpenSecurePartition, 2,3001,,NotImplemented, -2,3002,,, +2,3002,,UnsupportedVersion, 2,3003,,SaveDataPathAlreadyExists, 2,3005,,OutOfRange, @@ -59,17 +59,17 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary 2,4245,,InvalidRomHostHandle, 2,4301,4499,SaveDataCorrupted, -2,4302,,, +2,4302,,UnsupportedSaveVersion, 2,4303,,InvalidSaveDataEntryType, 2,4315,,InvalidSaveDataHeader, -2,4362,,, -2,4363,,, -2,4364,,InvalidHashInSaveIvfc, -2,4372,,SaveIvfcHashIsEmpty, -2,4373,,InvalidHashInSaveIvfcTopLayer, +2,4362,,InvalidSaveDataIvfcMagic, +2,4363,,InvalidSaveDataIvfcHashValidationBit, +2,4364,,InvalidSaveDataIvfcHash, +2,4372,,EmptySaveDataIvfcHash, +2,4373,,InvalidSaveDataHashInIvfcTopLayer, -2,4402,,, -2,4427,,, +2,4402,,SaveDataInvalidGptPartitionSignature, +2,4427,,IncompleteBlockInZeroBitmapHashStorageFileSaveData, 2,4441,4459,SaveDataHostFileSystemCorrupted, 2,4442,,SaveDataHostEntryCorrupted, 2,4443,,SaveDataHostFileDataCorrupted, @@ -83,10 +83,10 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary 2,4501,4599,NcaCorrupted, 2,4601,4639,IntegrityVerificationStorageCorrupted, -2,4602,,, -2,4603,,, -2,4604,,InvalidHashInIvfc, -2,4612,,IvfcHashIsEmpty, +2,4602,,InvalidIvfcMagic, +2,4603,,InvalidIvfcHashValidationBit, +2,4604,,InvalidIvfcHash, +2,4612,,EmptyIvfcHash, 2,4613,,InvalidHashInIvfcTopLayer, 2,4641,4659,PartitionFileSystemCorrupted, @@ -97,7 +97,7 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary 2,4646,,InvalidPartitionFileSystemEntryNameOffset, 2,4661,4679,BuiltInStorageCorrupted, -2,4662,,, +2,4662,,InvalidGptPartitionSignature, 2,4681,4699,FatFileSystemCorrupted, @@ -125,8 +125,9 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary 2,4771,4779,SignedSystemPartitionDataCorrupted, 2,4781,,GameCardLogoDataCorrupted, -2,4811,4819,, -2,4812,,, +# The range name is a guess. 4812 is currently the only result in it +2,4811,4819,ZeroBitmapFileCorrupted, +2,4812,,IncompleteBlockInZeroBitmapHashStorageFile, 2,5000,5999,Unexpected, 2,5307,,UnexpectedErrorInHostFileFlush, @@ -197,6 +198,7 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary 2,6465,,UserNotExist, 2,6600,6699,EntryNotFound, +2,6606,,TargetProgramIndexNotFound,Specified program index is not found 2,6700,6799,OutOfResource, 2,6706,,MappingTableFull, 2,6707,,AllocationTableInsufficientFreeBlocks, diff --git a/src/LibHac/Fs/ResultFs.cs b/src/LibHac/Fs/ResultFs.cs index 2e67f58a..871f9512 100644 --- a/src/LibHac/Fs/ResultFs.cs +++ b/src/LibHac/Fs/ResultFs.cs @@ -88,7 +88,7 @@ namespace LibHac.Fs /// Error code: 2002-3001; Inner value: 0x177202 public static Result.Base NotImplemented => new Result.Base(ModuleFs, 3001); /// Error code: 2002-3002; Inner value: 0x177402 - public static Result.Base Result3002 => new Result.Base(ModuleFs, 3002); + public static Result.Base UnsupportedVersion => new Result.Base(ModuleFs, 3002); /// Error code: 2002-3003; Inner value: 0x177602 public static Result.Base SaveDataPathAlreadyExists => new Result.Base(ModuleFs, 3003); /// Error code: 2002-3005; Inner value: 0x177a02 @@ -131,25 +131,25 @@ namespace LibHac.Fs /// Error code: 2002-4301; Range: 4301-4499; Inner value: 0x219a02 public static Result.Base SaveDataCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4301, 4499); } /// Error code: 2002-4302; Inner value: 0x219c02 - public static Result.Base Result4302 => new Result.Base(ModuleFs, 4302); + public static Result.Base UnsupportedSaveVersion => new Result.Base(ModuleFs, 4302); /// Error code: 2002-4303; Inner value: 0x219e02 public static Result.Base InvalidSaveDataEntryType => new Result.Base(ModuleFs, 4303); /// Error code: 2002-4315; Inner value: 0x21b602 public static Result.Base InvalidSaveDataHeader => new Result.Base(ModuleFs, 4315); /// Error code: 2002-4362; Inner value: 0x221402 - public static Result.Base Result4362 => new Result.Base(ModuleFs, 4362); + public static Result.Base InvalidSaveDataIvfcMagic => new Result.Base(ModuleFs, 4362); /// Error code: 2002-4363; Inner value: 0x221602 - public static Result.Base Result4363 => new Result.Base(ModuleFs, 4363); + public static Result.Base InvalidSaveDataIvfcHashValidationBit => new Result.Base(ModuleFs, 4363); /// Error code: 2002-4364; Inner value: 0x221802 - public static Result.Base InvalidHashInSaveIvfc => new Result.Base(ModuleFs, 4364); + public static Result.Base InvalidSaveDataIvfcHash => new Result.Base(ModuleFs, 4364); /// Error code: 2002-4372; Inner value: 0x222802 - public static Result.Base SaveIvfcHashIsEmpty => new Result.Base(ModuleFs, 4372); + public static Result.Base EmptySaveDataIvfcHash => new Result.Base(ModuleFs, 4372); /// Error code: 2002-4373; Inner value: 0x222a02 - public static Result.Base InvalidHashInSaveIvfcTopLayer => new Result.Base(ModuleFs, 4373); + public static Result.Base InvalidSaveDataHashInIvfcTopLayer => new Result.Base(ModuleFs, 4373); /// Error code: 2002-4402; Inner value: 0x226402 - public static Result.Base Result4402 => new Result.Base(ModuleFs, 4402); + public static Result.Base SaveDataInvalidGptPartitionSignature => new Result.Base(ModuleFs, 4402); /// Error code: 2002-4427; Inner value: 0x229602 - public static Result.Base Result4427 => new Result.Base(ModuleFs, 4427); + public static Result.Base IncompleteBlockInZeroBitmapHashStorageFileSaveData => new Result.Base(ModuleFs, 4427); /// Error code: 2002-4441; Range: 4441-4459; Inner value: 0x22b202 public static Result.Base SaveDataHostFileSystemCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4441, 4459); } @@ -175,13 +175,13 @@ namespace LibHac.Fs /// Error code: 2002-4601; Range: 4601-4639; Inner value: 0x23f202 public static Result.Base IntegrityVerificationStorageCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4601, 4639); } /// Error code: 2002-4602; Inner value: 0x23f402 - public static Result.Base Result4602 => new Result.Base(ModuleFs, 4602); + public static Result.Base InvalidIvfcMagic => new Result.Base(ModuleFs, 4602); /// Error code: 2002-4603; Inner value: 0x23f602 - public static Result.Base Result4603 => new Result.Base(ModuleFs, 4603); + public static Result.Base InvalidIvfcHashValidationBit => new Result.Base(ModuleFs, 4603); /// Error code: 2002-4604; Inner value: 0x23f802 - public static Result.Base InvalidHashInIvfc => new Result.Base(ModuleFs, 4604); + public static Result.Base InvalidIvfcHash => new Result.Base(ModuleFs, 4604); /// Error code: 2002-4612; Inner value: 0x240802 - public static Result.Base IvfcHashIsEmpty => new Result.Base(ModuleFs, 4612); + public static Result.Base EmptyIvfcHash => new Result.Base(ModuleFs, 4612); /// Error code: 2002-4613; Inner value: 0x240a02 public static Result.Base InvalidHashInIvfcTopLayer => new Result.Base(ModuleFs, 4613); @@ -201,7 +201,7 @@ namespace LibHac.Fs /// Error code: 2002-4661; Range: 4661-4679; Inner value: 0x246a02 public static Result.Base BuiltInStorageCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4661, 4679); } /// Error code: 2002-4662; Inner value: 0x246c02 - public static Result.Base Result4662 => new Result.Base(ModuleFs, 4662); + public static Result.Base InvalidGptPartitionSignature => new Result.Base(ModuleFs, 4662); /// Error code: 2002-4681; Range: 4681-4699; Inner value: 0x249202 public static Result.Base FatFileSystemCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4681, 4699); } @@ -253,9 +253,9 @@ namespace LibHac.Fs public static Result.Base GameCardLogoDataCorrupted => new Result.Base(ModuleFs, 4781); /// Error code: 2002-4811; Range: 4811-4819; Inner value: 0x259602 - public static Result.Base Range4811To4819 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4811, 4819); } + public static Result.Base ZeroBitmapFileCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4811, 4819); } /// Error code: 2002-4812; Inner value: 0x259802 - public static Result.Base Result4812 => new Result.Base(ModuleFs, 4812); + public static Result.Base IncompleteBlockInZeroBitmapHashStorageFile => new Result.Base(ModuleFs, 4812); /// Error code: 2002-5000; Range: 5000-5999; Inner value: 0x271002 public static Result.Base Unexpected { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 5000, 5999); } @@ -386,6 +386,8 @@ namespace LibHac.Fs /// Error code: 2002-6600; Range: 6600-6699; Inner value: 0x339002 public static Result.Base EntryNotFound { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 6600, 6699); } + /// Specified program index is not found
Error code: 2002-6606; Inner value: 0x339c02
+ public static Result.Base TargetProgramIndexNotFound => new Result.Base(ModuleFs, 6606); /// Error code: 2002-6700; Range: 6700-6799; Inner value: 0x345802 public static Result.Base OutOfResource { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 6700, 6799); } diff --git a/src/LibHac/FsSystem/IntegrityVerificationStorage.cs b/src/LibHac/FsSystem/IntegrityVerificationStorage.cs index 1e9d9761..a0df10a0 100644 --- a/src/LibHac/FsSystem/IntegrityVerificationStorage.cs +++ b/src/LibHac/FsSystem/IntegrityVerificationStorage.cs @@ -45,7 +45,7 @@ namespace LibHac.FsSystem if (BlockValidities[blockIndex] == Validity.Invalid && integrityCheckLevel == IntegrityCheckLevel.ErrorOnInvalid) { // Todo: Differentiate between the top and lower layers - ThrowHelper.ThrowResult(ResultFs.InvalidHashInIvfc.Value, "Hash error!"); + ThrowHelper.ThrowResult(ResultFs.InvalidIvfcHash.Value, "Hash error!"); } bool needsHashCheck = integrityCheckLevel != IntegrityCheckLevel.None && @@ -106,7 +106,7 @@ namespace LibHac.FsSystem if (validity == Validity.Invalid && integrityCheckLevel == IntegrityCheckLevel.ErrorOnInvalid) { - ThrowHelper.ThrowResult(ResultFs.InvalidHashInIvfc.Value, "Hash error!"); + ThrowHelper.ThrowResult(ResultFs.InvalidIvfcHash.Value, "Hash error!"); } } finally diff --git a/src/LibHac/FsSystem/Save/SaveResults.cs b/src/LibHac/FsSystem/Save/SaveResults.cs index 768c8f08..a7b46196 100644 --- a/src/LibHac/FsSystem/Save/SaveResults.cs +++ b/src/LibHac/FsSystem/Save/SaveResults.cs @@ -18,36 +18,36 @@ namespace LibHac.FsSystem.Save return result; } - if (ResultFs.Result3002.Includes(result)) + if (ResultFs.UnsupportedVersion.Includes(result)) { - return ResultFs.Result4302.Value; + return ResultFs.UnsupportedSaveVersion.Value; } if (ResultFs.IntegrityVerificationStorageCorrupted.Includes(result)) { - if (ResultFs.Result4602.Includes(result)) + if (ResultFs.InvalidIvfcMagic.Includes(result)) { - return ResultFs.Result4362.Value; + return ResultFs.InvalidSaveDataIvfcMagic.Value; } - if (ResultFs.Result4603.Includes(result)) + if (ResultFs.InvalidIvfcHashValidationBit.Includes(result)) { - return ResultFs.Result4363.Value; + return ResultFs.InvalidSaveDataIvfcHashValidationBit.Value; } - if (ResultFs.InvalidHashInIvfc.Includes(result)) + if (ResultFs.InvalidIvfcHash.Includes(result)) { - return ResultFs.InvalidHashInSaveIvfc.Value; + return ResultFs.InvalidSaveDataIvfcHash.Value; } - if (ResultFs.IvfcHashIsEmpty.Includes(result)) + if (ResultFs.EmptyIvfcHash.Includes(result)) { - return ResultFs.SaveIvfcHashIsEmpty.Value; + return ResultFs.EmptySaveDataIvfcHash.Value; } if (ResultFs.InvalidHashInIvfcTopLayer.Includes(result)) { - return ResultFs.InvalidHashInSaveIvfcTopLayer.Value; + return ResultFs.InvalidSaveDataHashInIvfcTopLayer.Value; } return result; @@ -55,9 +55,9 @@ namespace LibHac.FsSystem.Save if (ResultFs.BuiltInStorageCorrupted.Includes(result)) { - if (ResultFs.Result4662.Includes(result)) + if (ResultFs.InvalidGptPartitionSignature.Includes(result)) { - return ResultFs.Result4402.Value; + return ResultFs.SaveDataInvalidGptPartitionSignature.Value; } return result; @@ -73,11 +73,11 @@ namespace LibHac.FsSystem.Save return result; } - if (ResultFs.Range4811To4819.Includes(result)) + if (ResultFs.ZeroBitmapFileCorrupted.Includes(result)) { - if (ResultFs.Result4812.Includes(result)) + if (ResultFs.IncompleteBlockInZeroBitmapHashStorageFile.Includes(result)) { - return ResultFs.Result4427.Value; + return ResultFs.IncompleteBlockInZeroBitmapHashStorageFileSaveData.Value; } return result; diff --git a/src/LibHac/ResultNameResolver.cs b/src/LibHac/ResultNameResolver.cs index f251c675..8cf1b9f8 100644 --- a/src/LibHac/ResultNameResolver.cs +++ b/src/LibHac/ResultNameResolver.cs @@ -21,6 +21,8 @@ namespace LibHac return archiveReader.GetDictionary(); } + // To save a bunch of space in the assembly, Results with their names are packed into + // an archive and unpacked at runtime. private readonly ref struct ResultArchiveReader { private readonly ReadOnlySpan _data;