diff --git a/CHANGELIST.md b/CHANGELIST.md
index b276587e..2f3c9c9b 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -35,6 +35,7 @@
- Refine copy protection section showing
- Update Nuget packages
- Normalize newlines in comments and contents
+- Increase JSON accuracy for disc types
### 2.3 (2022-02-05)
- Start overhauling Redump information pulling, again
diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs
index 81d4cdfe..c3c64905 100644
--- a/MPF.Library/InfoTool.cs
+++ b/MPF.Library/InfoTool.cs
@@ -406,6 +406,9 @@ namespace MPF.Library
if (string.IsNullOrEmpty(info.CommonDiscInfo.Contents))
info.CommonDiscInfo.Contents = options.AddPlaceholders ? Template.OptionalValue : string.Empty;
+ // Normalize the disc type with all current information
+ NormalizeDiscType(info);
+
return info;
}
@@ -836,7 +839,7 @@ namespace MPF.Library
/// Size of the current media
/// First layerbreak value, as applicable
/// Second layerbreak value, as applicable
- /// Third ayerbreak value, as applicable
+ /// Third layerbreak value, as applicable
/// String representation of the media, including layer specification
public static string GetFixedMediaType(MediaType? mediaType, long size, long layerbreak, long layerbreak2, long layerbreak3)
{
@@ -1068,6 +1071,69 @@ namespace MPF.Library
#region Normalization
+ ///
+ /// Adjust the disc type based on size and layerbreak information
+ ///
+ /// Existing SubmissionInfo object to fill
+ /// Corrected disc type, if possible
+ public static void NormalizeDiscType(SubmissionInfo info)
+ {
+ // If we have nothing valid, do nothing
+ if (info?.CommonDiscInfo?.Media == null)
+ return;
+
+ switch (info.CommonDiscInfo.Media)
+ {
+ case DiscType.BD25:
+ case DiscType.BD33:
+ case DiscType.BD50:
+ case DiscType.BD66:
+ case DiscType.BD100:
+ case DiscType.BD128:
+ if (info.SizeAndChecksums.Layerbreak3 != default)
+ info.CommonDiscInfo.Media = DiscType.BD128;
+ else if (info.SizeAndChecksums.Layerbreak2 != default)
+ info.CommonDiscInfo.Media = DiscType.BD100;
+ else if (info.SizeAndChecksums.Layerbreak != default && info.SizeAndChecksums.Size > 53_687_063_712)
+ info.CommonDiscInfo.Media = DiscType.BD66;
+ else if (info.SizeAndChecksums.Layerbreak != default)
+ info.CommonDiscInfo.Media = DiscType.BD50;
+ else if (info.SizeAndChecksums.Size > 26_843_531_856)
+ info.CommonDiscInfo.Media = DiscType.BD33;
+ else
+ info.CommonDiscInfo.Media = DiscType.BD25;
+ break;
+
+ case DiscType.DVD5:
+ case DiscType.DVD9:
+ if (info.SizeAndChecksums.Layerbreak != default)
+ info.CommonDiscInfo.Media = DiscType.DVD9;
+ else
+ info.CommonDiscInfo.Media = DiscType.DVD5;
+ break;
+
+ case DiscType.HDDVDSL:
+ case DiscType.HDDVDDL:
+ if (info.SizeAndChecksums.Layerbreak != default)
+ info.CommonDiscInfo.Media = DiscType.HDDVDDL;
+ else
+ info.CommonDiscInfo.Media = DiscType.HDDVDSL;
+ break;
+
+ case DiscType.UMDSL:
+ case DiscType.UMDDL:
+ if (info.SizeAndChecksums.Layerbreak != default)
+ info.CommonDiscInfo.Media = DiscType.UMDDL;
+ else
+ info.CommonDiscInfo.Media = DiscType.UMDSL;
+ break;
+
+ // All other disc types are not processed
+ default:
+ break;
+ }
+ }
+
///
/// Normalize a split set of paths
///
diff --git a/MPF.Test/RedumpLib/ExtensionsTests.cs b/MPF.Test/RedumpLib/ExtensionsTests.cs
index 5baf02e1..19fa2115 100644
--- a/MPF.Test/RedumpLib/ExtensionsTests.cs
+++ b/MPF.Test/RedumpLib/ExtensionsTests.cs
@@ -18,12 +18,17 @@ namespace MPF.Test.RedumpLib
private static readonly DiscType?[] _mappableDiscTypes = new DiscType?[]
{
DiscType.BD25,
+ DiscType.BD33,
DiscType.BD50,
+ DiscType.BD66,
+ DiscType.BD100,
+ DiscType.BD128,
DiscType.CD,
DiscType.DVD5,
DiscType.DVD9,
DiscType.GDROM,
DiscType.HDDVDSL,
+ DiscType.HDDVDDL,
DiscType.NintendoGameCubeGameDisc,
DiscType.NintendoWiiOpticalDiscSL,
DiscType.NintendoWiiOpticalDiscDL,
diff --git a/MPF.Test/RedumpLib/SubmissionInfoTests.cs b/MPF.Test/RedumpLib/SubmissionInfoTests.cs
index 8d556f6e..91c3ba93 100644
--- a/MPF.Test/RedumpLib/SubmissionInfoTests.cs
+++ b/MPF.Test/RedumpLib/SubmissionInfoTests.cs
@@ -133,7 +133,7 @@ namespace MPF.Test.RedumpLib
DumpersAndStatus = new DumpersAndStatusSection()
{
- Status = DumpStatus.TwoOrMoHumanReadablesGreen,
+ Status = DumpStatus.TwoOrMoreGreen,
Dumpers = new string[] { "Dumper1", "Dumper2" },
OtherDumpers = "Dumper3",
},
diff --git a/MPF/ViewModels/DiscInformationViewModel.cs b/MPF/ViewModels/DiscInformationViewModel.cs
index 1634bbab..91c32edd 100644
--- a/MPF/ViewModels/DiscInformationViewModel.cs
+++ b/MPF/ViewModels/DiscInformationViewModel.cs
@@ -638,8 +638,13 @@ namespace MPF.GUI.ViewModels
case DiscType.DVD5:
case DiscType.DVD9:
case DiscType.HDDVDSL:
+ case DiscType.HDDVDDL:
case DiscType.BD25:
+ case DiscType.BD33:
case DiscType.BD50:
+ case DiscType.BD66:
+ case DiscType.BD100:
+ case DiscType.BD128:
case DiscType.NintendoGameCubeGameDisc:
case DiscType.NintendoWiiOpticalDiscSL:
case DiscType.NintendoWiiOpticalDiscDL:
diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs
index 597418e9..fb13fb6f 100644
--- a/MPF/ViewModels/MainViewModel.cs
+++ b/MPF/ViewModels/MainViewModel.cs
@@ -290,7 +290,7 @@ namespace MPF.GUI.ViewModels
CommonDiscInfo = new CommonDiscInfoSection()
{
System = RedumpSystem.IBMPCcompatible,
- Media = DiscType.BD50,
+ Media = DiscType.BD128,
Title = "Game Title",
ForeignTitleNonLatin = "Foreign Game Title",
DiscNumberLetter = "1",
@@ -373,7 +373,7 @@ namespace MPF.GUI.ViewModels
DumpersAndStatus = new DumpersAndStatusSection()
{
- Status = DumpStatus.TwoOrMoHumanReadablesGreen,
+ Status = DumpStatus.TwoOrMoreGreen,
Dumpers = new string[] { "Dumper1", "Dumper2" },
OtherDumpers = "Dumper3",
},
diff --git a/RedumpLib/Data/Enumerations.cs b/RedumpLib/Data/Enumerations.cs
index db90ef17..c4ffa965 100644
--- a/RedumpLib/Data/Enumerations.cs
+++ b/RedumpLib/Data/Enumerations.cs
@@ -44,6 +44,11 @@ namespace RedumpLib.Data
///
/// List of all disc types
///
+ ///
+ /// All names here match Redump names for the types, not official
+ /// naming. Some names had to be extrapolated due to no current support
+ /// in the Redump site.
+ ///
public enum DiscType
{
NONE = 0,
@@ -51,9 +56,21 @@ namespace RedumpLib.Data
[HumanReadable(LongName = "BD-25")]
BD25,
+ [HumanReadable(LongName = "BD-33")]
+ BD33,
+
[HumanReadable(LongName = "BD-50")]
BD50,
+ [HumanReadable(LongName = "BD-66")]
+ BD66,
+
+ [HumanReadable(LongName = "BD-100")]
+ BD100,
+
+ [HumanReadable(LongName = "BD-128")]
+ BD128,
+
[HumanReadable(LongName = "CD")]
CD,
@@ -68,7 +85,10 @@ namespace RedumpLib.Data
[HumanReadable(LongName = "HD-DVD SL")]
HDDVDSL,
-
+
+ [HumanReadable(LongName = "HD-DVD DL")]
+ HDDVDDL,
+
[HumanReadable(LongName = "MIL-CD")]
MILCD,
@@ -99,7 +119,7 @@ namespace RedumpLib.Data
BadDumpRed = 2,
PossibleBadDumpYellow = 3,
OriginalMediaBlue = 4,
- TwoOrMoHumanReadablesGreen = 5,
+ TwoOrMoreGreen = 5,
}
///
diff --git a/RedumpLib/Data/Extensions.cs b/RedumpLib/Data/Extensions.cs
index bb968ae9..f81c997e 100644
--- a/RedumpLib/Data/Extensions.cs
+++ b/RedumpLib/Data/Extensions.cs
@@ -747,7 +747,11 @@ namespace RedumpLib.Data
switch (discType)
{
case DiscType.BD25:
+ case DiscType.BD33:
case DiscType.BD50:
+ case DiscType.BD66:
+ case DiscType.BD100:
+ case DiscType.BD128:
return MediaType.BluRay;
case DiscType.CD:
return MediaType.CDROM;
@@ -757,6 +761,7 @@ namespace RedumpLib.Data
case DiscType.GDROM:
return MediaType.GDROM;
case DiscType.HDDVDSL:
+ case DiscType.HDDVDDL:
return MediaType.HDDVD;
// case DiscType.MILCD: // TODO: Support this?
// return MediaType.MILCD;
@@ -847,9 +852,21 @@ namespace RedumpLib.Data
case "bd25":
case "bd-25":
return DiscType.BD25;
+ case "bd33":
+ case "bd-33":
+ return DiscType.BD33;
case "bd50":
case "bd-50":
return DiscType.BD50;
+ case "bd66":
+ case "bd-66":
+ return DiscType.BD66;
+ case "bd100":
+ case "bd-100":
+ return DiscType.BD100;
+ case "bd128":
+ case "bd-128":
+ return DiscType.BD128;
case "cd":
case "cdrom":
case "cd-rom":
@@ -868,6 +885,9 @@ namespace RedumpLib.Data
case "hddvdsl":
case "hd-dvd sl":
return DiscType.HDDVDSL;
+ case "hddvddl":
+ case "hd-dvd dl":
+ return DiscType.HDDVDDL;
case "milcd":
case "mil-cd":
return DiscType.MILCD;