From 04035ac524eb94be33d362a35072f4befbddaf83 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 22 Apr 2023 21:51:18 -0400 Subject: [PATCH] Add suppl support to Xbox --- CHANGELIST.md | 1 + MPF.Modules/DiscImageCreator/Parameters.cs | 64 ++++++++++++++++++---- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 09a48458..c57d997d 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -32,6 +32,7 @@ - Add datafile helper method - Start migrating to datafile serialization - Prepare for future DIC changes +- Add suppl support to Xbox ### 2.5 (2023-03-12) diff --git a/MPF.Modules/DiscImageCreator/Parameters.cs b/MPF.Modules/DiscImageCreator/Parameters.cs index b02caf22..efa79967 100644 --- a/MPF.Modules/DiscImageCreator/Parameters.cs +++ b/MPF.Modules/DiscImageCreator/Parameters.cs @@ -541,13 +541,33 @@ namespace MPF.Modules.DiscImageCreator info.CommonDiscInfo.Region = xgd1Info.InternalRegion; } - if (GetXGDAuxInfo($"{basePath}_disc.txt", out string xgd1DMIHash, out string xgd1PFIHash, out string xgd1SSHash, out string xgd1SS, out string xgd1SSVer)) + // If we have the new, external DAT + if (File.Exists($"{basePath}_suppl.dat")) { - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd1DMIHash; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd1PFIHash; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer; - info.Extras.SecuritySectorRanges = xgd1SS ?? ""; + Datafile suppl = GetDatafile($"{basePath}_suppl.dat"); + if (GetXGDAuxHashInfo(suppl, out string xgd1DMIHash, out string xgd1PFIHash, out string xgd1SSHash)) + { + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd1DMIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd1PFIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash; + } + + if (GetXGDAuxSSInfo($"{basePath}_disc.txt", out string xgd1SS, out string xgd1SSVer)) + { + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer; + info.Extras.SecuritySectorRanges = xgd1SS ?? ""; + } + } + else + { + if (GetXGDAuxInfo($"{basePath}_disc.txt", out string xgd1DMIHash, out string xgd1PFIHash, out string xgd1SSHash, out string xgd1SS, out string xgd1SSVer)) + { + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd1DMIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd1PFIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer; + info.Extras.SecuritySectorRanges = xgd1SS ?? ""; + } } break; @@ -564,13 +584,33 @@ namespace MPF.Modules.DiscImageCreator info.CommonDiscInfo.Region = xgd23Info.InternalRegion; } - if (GetXGDAuxInfo($"{basePath}_disc.txt", out string xgd23DMIHash, out string xgd23PFIHash, out string xgd23SSHash, out string xgd23SS, out string xgd23SSVer)) + // If we have the new, external DAT + if (File.Exists($"{basePath}_suppl.dat")) { - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd23DMIHash; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd23PFIHash; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash; - info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer; - info.Extras.SecuritySectorRanges = xgd23SS ?? ""; + Datafile suppl = GetDatafile($"{basePath}_suppl.dat"); + if (GetXGDAuxHashInfo(suppl, out string xgd23DMIHash, out string xgd23PFIHash, out string xgd23SSHash)) + { + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd23DMIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd23PFIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash; + } + + if (GetXGDAuxSSInfo($"{basePath}_disc.txt", out string xgd23SS, out string xgd23SSVer)) + { + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer; + info.Extras.SecuritySectorRanges = xgd23SS ?? ""; + } + } + else + { + if (GetXGDAuxInfo($"{basePath}_disc.txt", out string xgd23DMIHash, out string xgd23PFIHash, out string xgd23SSHash, out string xgd23SS, out string xgd23SSVer)) + { + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd23DMIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd23PFIHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash; + info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer; + info.Extras.SecuritySectorRanges = xgd23SS ?? ""; + } } break;