mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-07-08 18:16:25 +00:00
Fix discrepencies found in MPF
This commit is contained in:
@@ -35,6 +35,78 @@ namespace SabreTools.RedumpLib.Data
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjust the disc type based on size and layerbreak information
|
||||
/// </summary>
|
||||
/// <param name="info">Existing SubmissionInfo object to fill</param>
|
||||
/// <returns>Corrected disc type, if possible</returns>
|
||||
public static void NormalizeDiscType(this SubmissionInfo info)
|
||||
{
|
||||
// If we have nothing valid, do nothing
|
||||
if (info.DiscIdentity.Media is null)
|
||||
return;
|
||||
|
||||
#pragma warning disable IDE0010
|
||||
switch (info.DiscIdentity.Media)
|
||||
{
|
||||
case MediaType.DVD5:
|
||||
case MediaType.DVD9:
|
||||
if (info.DiscIdentifiers.Layerbreak != default)
|
||||
info.DiscIdentity.Media = MediaType.DVD9;
|
||||
else
|
||||
info.DiscIdentity.Media = MediaType.DVD5;
|
||||
break;
|
||||
|
||||
case MediaType.BD25:
|
||||
case MediaType.BD33:
|
||||
case MediaType.BD50:
|
||||
case MediaType.BD66:
|
||||
case MediaType.BD100:
|
||||
case MediaType.BD128:
|
||||
// Extract the size from the hashes
|
||||
long size = ExtractSizeFromHashData(info.DumpMetadata.Dat);
|
||||
|
||||
if (info.DiscIdentifiers.Layerbreak3 != default)
|
||||
info.DiscIdentity.Media = MediaType.BD128;
|
||||
else if (info.DiscIdentifiers.Layerbreak2 != default)
|
||||
info.DiscIdentity.Media = MediaType.BD100;
|
||||
else if (info.DiscIdentifiers.Layerbreak != default && info.DumpMetadata.PICIdentifier == "BDU")
|
||||
info.DiscIdentity.Media = MediaType.BD66;
|
||||
else if (info.DiscIdentifiers.Layerbreak != default && size > 50_050_629_632)
|
||||
info.DiscIdentity.Media = MediaType.BD66;
|
||||
else if (info.DiscIdentifiers.Layerbreak != default)
|
||||
info.DiscIdentity.Media = MediaType.BD50;
|
||||
else if (info.DumpMetadata.PICIdentifier == "BDU")
|
||||
info.DiscIdentity.Media = MediaType.BD33;
|
||||
else if (size > 25_025_314_816)
|
||||
info.DiscIdentity.Media = MediaType.BD33;
|
||||
else
|
||||
info.DiscIdentity.Media = MediaType.BD25;
|
||||
break;
|
||||
|
||||
case MediaType.HDDVDSL:
|
||||
case MediaType.HDDVDDL:
|
||||
if (info.DiscIdentifiers.Layerbreak != default)
|
||||
info.DiscIdentity.Media = MediaType.HDDVDDL;
|
||||
else
|
||||
info.DiscIdentity.Media = MediaType.HDDVDSL;
|
||||
break;
|
||||
|
||||
case MediaType.UMDSL:
|
||||
case MediaType.UMDDL:
|
||||
if (info.DiscIdentifiers.Layerbreak != default)
|
||||
info.DiscIdentity.Media = MediaType.UMDDL;
|
||||
else
|
||||
info.DiscIdentity.Media = MediaType.UMDSL;
|
||||
break;
|
||||
|
||||
// All other disc types are not processed
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjust the disc type based on size and layerbreak information
|
||||
/// </summary>
|
||||
@@ -106,7 +178,8 @@ namespace SabreTools.RedumpLib.Data
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cross-Enumeration
|
||||
|
||||
|
||||
@@ -27,10 +27,13 @@ namespace SabreTools.RedumpLib.Data.Sections
|
||||
[JsonIgnore]
|
||||
public Dictionary<SiteCode, string> ContentsSpecialFields { get; set; } = [];
|
||||
|
||||
// TODO: Add back Dictionary<string, List<string>?> FullProtections
|
||||
[JsonProperty(PropertyName = "protection", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string? Protection { get; set; }
|
||||
|
||||
/// <remarks>This is a non-standard field</remarks>
|
||||
[JsonIgnore]
|
||||
public Dictionary<string, List<string>?>? FullProtections { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "sector_ranges", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string? SectorRanges { get; set; }
|
||||
|
||||
@@ -49,6 +52,10 @@ namespace SabreTools.RedumpLib.Data.Sections
|
||||
[JsonProperty(PropertyName = "pic", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string? PIC { get; set; }
|
||||
|
||||
/// <remarks>This is a non-standard field</remarks>
|
||||
[JsonProperty(PropertyName = "pic_identifier", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string? PICIdentifier { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "cue", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string? Cuesheet { get; set; }
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using SabreTools.RedumpLib.Web;
|
||||
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
|
||||
|
||||
namespace SabreTools.RedumpLib.Tools
|
||||
{
|
||||
@@ -46,11 +45,11 @@ namespace SabreTools.RedumpLib.Tools
|
||||
public static async Task<List<int>?> ValidateUniversalHash(Client client, SubmissionInfo info)
|
||||
{
|
||||
// If we don't have special fields
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields is null)
|
||||
if (info.DumpMetadata.CommentsSpecialFields is null)
|
||||
return null;
|
||||
|
||||
// If we don't have a universal hash
|
||||
string? universalHash = info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash];
|
||||
string? universalHash = info.DiscIdentifiers.UniversalHash;
|
||||
if (string.IsNullOrEmpty(universalHash))
|
||||
return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user