From 476c494f4e073b873836cbaca68b07f18cc8c4b3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 19 Jul 2023 13:33:14 -0400 Subject: [PATCH] Universal hash only for audio discs (fixes #524) --- CHANGELIST.md | 1 + MPF.Core/Utilities/EnumExtensions.cs | 1 + MPF.Modules/DiscImageCreator/Parameters.cs | 9 ++++++--- MPF.Modules/Redumper/Parameters.cs | 10 +++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index d378a2ec..6b3674e9 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -1,6 +1,7 @@ ### WIP (xxxx-xx-xx) - Ensure custom parameters properly set +- Universal hash only for audio discs ### 2.6.1 (2023-07-19) diff --git a/MPF.Core/Utilities/EnumExtensions.cs b/MPF.Core/Utilities/EnumExtensions.cs index 2e691676..2df66be7 100644 --- a/MPF.Core/Utilities/EnumExtensions.cs +++ b/MPF.Core/Utilities/EnumExtensions.cs @@ -101,6 +101,7 @@ namespace MPF.Core.Utilities case RedumpSystem.HasbroVideoNowJr: case RedumpSystem.HasbroVideoNowXP: case RedumpSystem.PhilipsCDi: + case RedumpSystem.PlayStationGameSharkUpdates: case RedumpSystem.SuperAudioCD: return true; default: diff --git a/MPF.Modules/DiscImageCreator/Parameters.cs b/MPF.Modules/DiscImageCreator/Parameters.cs index 4ccc2096..832cb674 100644 --- a/MPF.Modules/DiscImageCreator/Parameters.cs +++ b/MPF.Modules/DiscImageCreator/Parameters.cs @@ -445,9 +445,12 @@ namespace MPF.Modules.DiscImageCreator string cdMultiSessionInfo = GetMultisessionInformation($"{basePath}_disc.txt") ?? string.Empty; info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Multisession] = cdMultiSessionInfo; - // Attempt to get the universal hash - string universalHash = GetUniversalHash($"{basePath}_disc.txt") ?? string.Empty; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash] = universalHash; + // Attempt to get the universal hash, if it's an audio disc + if (this.System.IsAudio()) + { + string universalHash = GetUniversalHash($"{basePath}_disc.txt") ?? string.Empty; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash] = universalHash; + } break; diff --git a/MPF.Modules/Redumper/Parameters.cs b/MPF.Modules/Redumper/Parameters.cs index fd10a336..ef50ae36 100644 --- a/MPF.Modules/Redumper/Parameters.cs +++ b/MPF.Modules/Redumper/Parameters.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using MPF.Core.Converters; using MPF.Core.Data; +using MPF.Core.Utilities; using RedumpLib.Data; namespace MPF.Modules.Redumper @@ -275,9 +276,12 @@ namespace MPF.Modules.Redumper string cdMultiSessionInfo = GetMultisessionInformation($"{basePath}.log") ?? string.Empty; info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Multisession] = cdMultiSessionInfo; - // Attempt to get the universal hash - string universalHash = GetUniversalHash($"{basePath}.log") ?? string.Empty; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash] = universalHash; + // Attempt to get the universal hash, if it's an audio disc + if (this.System.IsAudio()) + { + string universalHash = GetUniversalHash($"{basePath}.log") ?? string.Empty; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash] = universalHash; + } // Attempt to get the non-zero data start string ringNonZeroDataStart = GetRingNonZeroDataStart($"{basePath}.log") ?? string.Empty;