Tweak duplicate result detection

This commit is contained in:
Alex Barney 2020-03-23 16:04:49 -07:00
parent 0bb3446a8b
commit b8b2c26457
4 changed files with 14 additions and 10 deletions

View File

@ -124,13 +124,11 @@ namespace LibHacBuild.CodeGen
{
foreach (ModuleInfo module in modules)
{
var set = new HashSet<long>();
var set = new HashSet<int>();
foreach (ResultInfo result in module.Results)
{
long description = (long)result.DescriptionStart << 32 | (uint)result.DescriptionEnd;
if (!set.Add(description))
if (!set.Add(result.DescriptionStart))
{
throw new InvalidDataException($"Duplicate result {result.Module}-{result.DescriptionStart}-{result.DescriptionEnd}.");
}

View File

@ -124,11 +124,12 @@ Module,DescriptionStart,DescriptionEnd,Name,Summary
2,4748,,AesXtsFileHeaderInvalidKeysInSetSize,
2,4761,4769,SaveDataTransferDataCorrupted,
2,4771,4779,SignedSystemPartitionDataCorrupted,
2,4781,,GameCardLogoDataCorrupted,
2,4791,4799,MultiCommitContextCorrupted,
2,4791,,InvalidMultiCommitContextVersion,The version of the multi-commit context file is to high for the current MultiCommitManager implementation.
2,4790,4799,MultiCommitContextCorrupted,
2,4791,,InvalidMultiCommitContextVersion,The version of the multi-commit context file is too high for the current MultiCommitManager implementation.
2,4792,,InvalidMultiCommitContextState,The multi-commit has not been provisionally committed.
# The range name is a guess. 4812 is currently the only result in it

1 Module,DescriptionStart,DescriptionEnd,Name,Summary
124 2,6005,,InvalidPathFormat,
125 2,6006,,DirectoryUnobtainable,
126 2,6007,,NotNormalized,
127 2,6030,6059,InvalidPathForOperation,
128 2,6030,6059,InvalidPathForOperation, 2,6031,,DirectoryNotDeletable,
129 2,6031,,DirectoryNotDeletable, 2,6032,,DestinationIsSubPathOfSource,
130 2,6032,,DestinationIsSubPathOfSource, 2,6033,,PathNotFoundInSaveDataFileTable,
131 2,6033,,PathNotFoundInSaveDataFileTable, 2,6034,,DifferentDestFileSystem,
132 2,6034,,DifferentDestFileSystem, 2,6061,,InvalidOffset,
133 2,6061,,InvalidOffset, 2,6062,,InvalidSize,
134 2,6062,,InvalidSize, 2,6063,,NullptrArgument,
135 2,6063,,NullptrArgument, 2,6064,,InvalidAlignment,

View File

@ -256,9 +256,9 @@ namespace LibHac.Fs
/// <summary>Error code: 2002-4781; Inner value: 0x255a02</summary>
public static Result.Base GameCardLogoDataCorrupted => new Result.Base(ModuleFs, 4781);
/// <summary>Error code: 2002-4791; Range: 4791-4799; Inner value: 0x256e02</summary>
public static Result.Base MultiCommitContextCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4791, 4799); }
/// <summary>The version of the multi-commit context file is to high for the current MultiCommitManager implementation.<br/>Error code: 2002-4791; Inner value: 0x256e02</summary>
/// <summary>Error code: 2002-4790; Range: 4790-4799; Inner value: 0x256c02</summary>
public static Result.Base MultiCommitContextCorrupted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 4790, 4799); }
/// <summary>The version of the multi-commit context file is too high for the current MultiCommitManager implementation.<br/>Error code: 2002-4791; Inner value: 0x256e02</summary>
public static Result.Base InvalidMultiCommitContextVersion => new Result.Base(ModuleFs, 4791);
/// <summary>The multi-commit has not been provisionally committed.<br/>Error code: 2002-4792; Inner value: 0x257002</summary>
public static Result.Base InvalidMultiCommitContextState => new Result.Base(ModuleFs, 4792);

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using LibHac.Common;
@ -47,7 +48,11 @@ namespace LibHac
foreach (ref readonly Element element in elements)
{
var result = new Result(element.Module, element.DescriptionStart);
dict.Add(result, GetName(element.NameOffset).ToString());
if (!dict.TryAdd(result, GetName(element.NameOffset).ToString()))
{
throw new InvalidDataException("Invalid result name archive: Duplicate result found.");
}
}
return dict;