erpt: actually support non-sequential ids, nintendo why

This commit is contained in:
Michael Scire
2024-03-28 04:36:14 -07:00
parent b4d453882d
commit e6cf70a18a
7 changed files with 91 additions and 36 deletions

View File

@@ -62,7 +62,10 @@ namespace ams::erpt::srv {
static Result AddId(Report *report, FieldId field_id) {
static_assert(MaxFieldStringSize < ElementSize_256);
R_TRY(AddStringValue(report, FieldString[field_id], strnlen(FieldString[field_id], MaxFieldStringSize)));
const auto index = FindFieldIndex(field_id);
AMS_ASSERT(index.has_value());
R_TRY(AddStringValue(report, FieldString[index.value()], strnlen(FieldString[index.value()], MaxFieldStringSize)));
R_SUCCEED();
}