Merge pull request #1298 from LukeUsher/fix-titleid-rendering

If the prefix of a title_id is non printable, render the entire serial as hex
This commit is contained in:
Luke Usher 2018-06-19 11:10:35 +01:00 committed by GitHub
commit ad07eefd3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -88,13 +88,13 @@ std::string FormatTitleId(uint32_t title_id)
char pTitleId1 = (title_id >> 24) & 0xFF;
char pTitleId2 = (title_id >> 16) & 0xFF;
if (isalnum(pTitleId1) && isalnum(pTitleId2)) {
ss << pTitleId1 << pTitleId2;
} else {
// Prefix was non-printable, so we need to print a hex reprentation
ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << (uint16_t)((title_id & 0xFFFF0000) >> 16);
if (!isalnum(pTitleId1) || !isalnum(pTitleId2)) {
// Prefix was non-printable, so we need to print a hex reprentation of the entire title_id
ss << std::setfill('0') << std::setw(8) << std::hex << std::uppercase << title_id;
return ss.str();
}
ss << pTitleId1 << pTitleId2;
ss << "-";
ss << std::setfill('0') << std::setw(3) << std::dec << (title_id & 0x0000FFFF);