From 7d86a82050be2a1b461fca0dc5e2fea952a88948 Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Thu, 21 Mar 2019 14:54:07 +0100 Subject: [PATCH] XbeExplorer : Render GameRating as readable string too --- .../Tools/XBEExplorer/uXBEExplorerMain.pas | 2 +- Source/Delphi/src/uXbe.pas | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Source/Delphi/src/Tools/XBEExplorer/uXBEExplorerMain.pas b/Source/Delphi/src/Tools/XBEExplorer/uXBEExplorerMain.pas index 7a2c78b7..486eb2ad 100644 --- a/Source/Delphi/src/Tools/XBEExplorer/uXBEExplorerMain.pas +++ b/Source/Delphi/src/Tools/XBEExplorer/uXBEExplorerMain.pas @@ -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)]); diff --git a/Source/Delphi/src/uXbe.pas b/Source/Delphi/src/uXbe.pas index abb88a11..79b00cbc 100644 --- a/Source/Delphi/src/uXbe.pas +++ b/Source/Delphi/src/uXbe.pas @@ -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]));