XbeExplorer : Render GameRating as readable string too

This commit is contained in:
PatrickvL 2019-03-21 14:54:07 +01:00
parent c123aaa023
commit 7d86a82050
2 changed files with 22 additions and 2 deletions

View file

@ -1196,7 +1196,7 @@ var
GridAddRow(Result, ['dwAlternateTitleId[' + IntToStr(i) + ']', 'Dword', _offset(PXbeCertificate(nil).dwAlternateTitleId[i], o), DWord2Str(Cert.dwAlternateTitleId[i]), TitleIDToString(Cert.dwAlternateTitleId[i])]);
GridAddRow(Result, ['dwAllowedMedia', 'Dword', _offset(PXbeCertificate(nil).dwAllowedMedia, o), DWord2Str(Cert.dwAllowedMedia), AllowedMediaToString(Cert.dwAllowedMedia)]);
GridAddRow(Result, ['dwGameRegion', 'Dword', _offset(PXbeCertificate(nil).dwGameRegion, o), DWord2Str(Cert.dwGameRegion), GameRegionToString(Cert.dwGameRegion)]);
GridAddRow(Result, ['dwGameRatings', 'Dword', _offset(PXbeCertificate(nil).dwGameRatings, o), DWord2Str(Cert.dwGameRatings)]);
GridAddRow(Result, ['dwGameRatings', 'Dword', _offset(PXbeCertificate(nil).dwGameRatings, o), DWord2Str(Cert.dwGameRatings), GameRatingToString(Cert.dwGameRatings)]);
GridAddRow(Result, ['dwDiskNumber', 'Dword', _offset(PXbeCertificate(nil).dwDiskNumber, o), DWord2Str(Cert.dwDiskNumber)]);
GridAddRow(Result, ['dwVersion', 'Dword', _offset(PXbeCertificate(nil).dwVersion, o), DWord2Str(Cert.dwVersion)]);
GridAddRow(Result, ['bzLanKey', 'Byte[16]', _offset(PXbeCertificate(nil).bzLanKey, o), PByteToHexString(@Cert.bzLanKey[0], 16)]);

View file

@ -126,6 +126,7 @@ procedure XbeLoaded;
function GetReadableTitle(const pCertificate: PXBE_CERTIFICATE): string;
function AllowedMediaToString(const aAllowedMedia: Cardinal): string;
function GameRegionToString(const aGameRegion: Cardinal): string;
function GameRatingToString(const aGameRating: Cardinal): string;
function GameDisplayFrequency(const aGameRegion: Cardinal): int;
function XbeHeaderInitFlagsToString(const Flag: DWORD): string;
function GetXbeType(const aXbeHeader: PXbeHeader): TXbeType;
@ -326,6 +327,25 @@ begin
end;
end;
function GameRatingToString(const aGameRating: Cardinal): string;
const
GameRatingStrings: array [0..6] of string = (
// Info from: http://xboxdevwiki.net/EEPROM
'(RP) Rating Pending',
'(AO) Adults Only',
'(M) Mature',
'(T) Teen',
'(E) Everyone',
'(K-A) Kids to Adults',
'(EC) Early Childhood'
);
begin
if aGameRating < Length(GameRatingStrings) then
Result := GameRatingStrings[aGameRating]
else
Result := 'ERROR: Unknown rating';
end;
function XbeHeaderInitFlagsToString(const Flag: DWORD): string;
begin
Result := '';
@ -849,7 +869,7 @@ begin
_LogEx(DxbxFormat('Allowed Media : 0x%.8x (%s)', [m_Certificate.dwAllowedMedia, AllowedMediaToString(m_Certificate.dwAllowedMedia)]));
_LogEx(DxbxFormat('Game Region : 0x%.8x (%s)', [m_Certificate.dwGameRegion, GameRegionToString(m_Certificate.dwGameRegion)]));
_LogEx(DxbxFormat('Game Ratings : 0x%.8x', [m_Certificate.dwGameRatings]));
_LogEx(DxbxFormat('Game Ratings : 0x%.8x (%s)', [m_Certificate.dwGameRatings, GameRatingToString(m_Certificate.dwGameRatings)]));
_LogEx(DxbxFormat('Disk Number : 0x%.8x', [m_Certificate.dwDiskNumber]));
_LogEx(DxbxFormat('Version : 0x%.8x', [m_Certificate.dwVersion]));