Add Xbox extras field support

This commit is contained in:
Matt Nadareski
2026-11-11 23:30:14 +01:00
parent feec4aac91
commit 693acdbf8a
14 changed files with 57 additions and 15 deletions

View File

@@ -2412,8 +2412,8 @@ namespace SabreTools.RedumpLib.Test.Data
SiteCode.DiscID,
#pragma warning disable CS0618 // Type or member is obsolete
SiteCode.DiscTitleNonLatin,
#pragma warning restore CS0618 // Type or member is obsolete
SiteCode.DMIHash,
#pragma warning restore CS0618 // Type or member is obsolete
SiteCode.DNASDiscID,
SiteCode.EditionNonLatin,
SiteCode.Filename,
@@ -2426,12 +2426,16 @@ namespace SabreTools.RedumpLib.Test.Data
SiteCode.Multisession,
SiteCode.PCMacHybrid,
SiteCode.PEGIID,
#pragma warning disable CS0618 // Type or member is obsolete
SiteCode.PFIHash,
#pragma warning restore CS0618 // Type or member is obsolete
SiteCode.PostgapType,
SiteCode.Protection,
SiteCode.RingPerfectAudioOffset,
SiteCode.Series,
#pragma warning disable CS0618 // Type or member is obsolete
SiteCode.SSHash,
#pragma warning restore CS0618 // Type or member is obsolete
SiteCode.SSVersion,
SiteCode.SteamAppID,
SiteCode.TitleID,

View File

@@ -112,6 +112,7 @@ namespace SabreTools.RedumpLib.Test.Data
DMI = "DMI",
Cuesheet = "Cuesheet",
Dat = "Datfile",
ExtrasDat = "Extras Datfile",
},
SubmissionControls = new SubmissionControlsSection()

View File

@@ -24,6 +24,7 @@ namespace SabreTools.RedumpLib.Test.Endpoints
[InlineData(PackType.Datfile, "https://redump.info/datfile/ARCH")]
[InlineData(PackType.Sbis, "https://redump.info/sbi/ARCH")]
[InlineData(PackType.BiosDatfile, "https://redump.info/bios/ARCH")]
[InlineData(PackType.ExtrasDatfile, "https://redump.info/extras/ARCH")]
public void BuildUrl_ValidPackType_ValidSystem_Builds(PackType packType, string expected)
{
var endpoint = new RedumpLib.Endpoints.Downloads

View File

@@ -108,6 +108,7 @@ namespace SabreTools.RedumpLib.Test.Tools
DMI = "DMI",
Cuesheet = "Cuesheet",
Dat = "Datfile",
ExtrasDat = "Extras Datfile",
},
SubmissionControls = new SubmissionControlsSection()
@@ -555,7 +556,7 @@ namespace SabreTools.RedumpLib.Test.Tools
[Fact]
public void FormatOutputData_DumpMetadataSection_Formatted()
{
string expected = "Dump Metadata:\n\tComments: XXXXXX\n\tContents: XXXXXX\n\tProtection: XXXXXX\n\tSector Ranges: XXXXXX\n\tSBI: XXXXXX\n\tPrimary Volume Descriptor (PVD): XXXXXX\n\tHeader: XXXXXX\n\tBurst Cutting Area (BCA): XXXXXX\n\tPermanent Information & Control (PIC): XXXXXX\n\tDMI: XXXXXX\n\tCuesheet: XXXXXX\n\tDat:\n\nXXXXXX\n\n\n";
string expected = "Dump Metadata:\n\tComments: XXXXXX\n\tContents: XXXXXX\n\tProtection: XXXXXX\n\tSector Ranges: XXXXXX\n\tSBI: XXXXXX\n\tPrimary Volume Descriptor (PVD): XXXXXX\n\tHeader: XXXXXX\n\tBurst Cutting Area (BCA): XXXXXX\n\tPermanent Information & Control (PIC): XXXXXX\n\tDMI: XXXXXX\n\tCuesheet: XXXXXX\n\tDat:\n\nXXXXXX\n\n\n\tExtras Dat:\n\nXXXXXX\n\n\n";
var builder = new StringBuilder();
DumpMetadataSection? section = new()
@@ -572,6 +573,7 @@ namespace SabreTools.RedumpLib.Test.Tools
DMI = "XXXXXX",
Cuesheet = "XXXXXX",
Dat = "XXXXXX",
ExtrasDat = "XXXXXX",
};
Formatter.FormatOutputData(builder, section);

View File

@@ -189,6 +189,9 @@ namespace SabreTools.RedumpLib.Data
[HumanReadable(LongName = "BIOS", ShortName = "bios")]
BiosDatfile = 4,
[HumanReadable(LongName = "Extras Datfile", ShortName = "extras")]
ExtrasDatfile = 5,
}
/// <summary>

View File

@@ -50,6 +50,11 @@ namespace SabreTools.RedumpLib.Data
/// </summary>
public readonly bool HasBios;
/// <summary>
/// System has an extras pack
/// </summary>
public readonly bool HasExtras;
/// <summary>
/// List of valid media types for the system
/// </summary>
@@ -78,6 +83,7 @@ namespace SabreTools.RedumpLib.Data
bool hasDat = false,
bool hasSbi = false,
bool hasBios = false,
bool hasExtras = false,
List<PhysicalMediaType?>? mediaTypes = null)
{
Name = name;
@@ -89,6 +95,7 @@ namespace SabreTools.RedumpLib.Data
HasDat = hasDat;
HasSbi = hasSbi;
HasBios = hasBios;
HasExtras = hasExtras;
MediaTypes = mediaTypes ?? [null];
}
@@ -235,6 +242,7 @@ namespace SabreTools.RedumpLib.Data
hasCues: true,
hasDat: true,
hasBios: true,
hasExtras: true,
mediaTypes: [PhysicalMediaType.XGD, PhysicalMediaType.DVD, PhysicalMediaType.CDROM]);
// https://en.wikipedia.org/wiki/Xbox_360
@@ -243,6 +251,7 @@ namespace SabreTools.RedumpLib.Data
code: "XBOX360",
hasCues: true,
hasDat: true,
hasExtras: true,
mediaTypes: [PhysicalMediaType.XGD, PhysicalMediaType.DVD, PhysicalMediaType.CDROM]);
// https://en.wikipedia.org/wiki/Xbox_One

View File

@@ -59,12 +59,15 @@ namespace SabreTools.RedumpLib.Data.Sections
[JsonProperty(PropertyName = "dmi", NullValueHandling = NullValueHandling.Ignore)]
public string? DMI { get; set; }
[JsonProperty(PropertyName = "cue", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty(PropertyName = "cuesheet", NullValueHandling = NullValueHandling.Ignore)]
public string? Cuesheet { get; set; }
[JsonProperty(PropertyName = "files_xml", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty(PropertyName = "dat", NullValueHandling = NullValueHandling.Ignore)]
public string? Dat { get; set; }
[JsonProperty(PropertyName = "extras", NullValueHandling = NullValueHandling.Ignore)]
public string? ExtrasDat { get; set; }
/// <inheritdoc/>
public object Clone()
{
@@ -108,6 +111,7 @@ namespace SabreTools.RedumpLib.Data.Sections
DMI = this.DMI,
Cuesheet = this.Cuesheet,
Dat = this.Dat,
ExtrasDat = this.ExtrasDat,
};
}
}

View File

@@ -127,6 +127,7 @@ namespace SabreTools.RedumpLib.Data
public static readonly SiteCode DisneyInteractiveID = new("<b>Disney Interactive ID</b>:",
isCommentCode: true);
[Obsolete("Use SubmissionInfo.DumpMetadata.ExtrasDat instead")]
public static readonly SiteCode DMIHash = new("<b>DMI</b>:",
isCommentCode: true);
@@ -262,6 +263,7 @@ namespace SabreTools.RedumpLib.Data
public static readonly SiteCode PEGIID = new("<b>PEGI ID</b>:",
isCommentCode: true);
[Obsolete("Use SubmissionInfo.DumpMetadata.ExtrasDat instead")]
public static readonly SiteCode PFIHash = new("<b>PFI</b>:",
isCommentCode: true);
@@ -311,6 +313,7 @@ namespace SabreTools.RedumpLib.Data
public static readonly SiteCode SierraID = new("<b>Sierra ID</b>:",
isCommentCode: true);
[Obsolete("Use SubmissionInfo.DumpMetadata.ExtrasDat instead")]
public static readonly SiteCode SSHash = new("<b>SS</b>:",
isCommentCode: true);
@@ -406,7 +409,9 @@ namespace SabreTools.RedumpLib.Data
DiscTitleNonLatin,
#pragma warning restore CS0618 // Type or member is obsolete
DisneyInteractiveID,
#pragma warning disable CS0618 // Type or member is obsolete
DMIHash,
#pragma warning restore CS0618 // Type or member is obsolete
DNASDiscID,
EditionNonLatin,
@@ -454,7 +459,9 @@ namespace SabreTools.RedumpLib.Data
Patches,
PCMacHybrid,
PEGIID,
#pragma warning disable CS0618 // Type or member is obsolete
PFIHash,
#pragma warning restore CS0618 // Type or member is obsolete
PlayableDemos,
PonyCanyonID,
PostgapType,
@@ -468,7 +475,9 @@ namespace SabreTools.RedumpLib.Data
SelenID,
Series,
SierraID,
#pragma warning disable CS0618 // Type or member is obsolete
SSHash,
#pragma warning restore CS0618 // Type or member is obsolete
SSVersion,
SteamAppID,
SteamCsmCsdDepotID,

View File

@@ -75,6 +75,7 @@
public const string DMIField = "DMI";
public const string CuesheetField = "Cuesheet";
public const string DatField = "Dat";
public const string ExtrasDatField = "Extras Dat";
#endregion

View File

@@ -31,20 +31,17 @@ namespace SabreTools.RedumpLib.Endpoints
Host = "redump.info",
};
// HACK: Make copies of the pack and system
var pack = Pack;
var system = System;
string systemName = system?.Code ?? string.Empty;
switch (pack)
string systemName = System?.Code ?? string.Empty;
switch (Pack)
{
case PackType.Cuesheets: ub.Path = $"cues/{systemName}"; break;
case PackType.Datfile: ub.Path = $"datfile/{systemName}"; break;
case PackType.Sbis: ub.Path = $"sbi/{systemName}"; break;
case PackType.BiosDatfile: ub.Path = $"bios/{systemName}"; break;
case PackType.ExtrasDatfile: ub.Path = $"extras/{systemName}"; break;
// Invalid
default: throw new ArgumentOutOfRangeException(nameof(pack));
default: throw new ArgumentOutOfRangeException(nameof(Pack));
}
return ub.ToString();

View File

@@ -516,12 +516,14 @@ namespace SabreTools.RedumpLib.Tools
return true;
// Microsoft Xbox and Xbox 360
#pragma warning disable CS0618 // Type or member is obsolete
if (siteCode == SiteCode.DMIHash)
return true;
else if (siteCode == SiteCode.PFIHash)
return true;
else if (siteCode == SiteCode.SSHash)
return true;
#pragma warning restore CS0618 // Type or member is obsolete
else if (siteCode == SiteCode.SSVersion)
return true;
else if (siteCode == SiteCode.XMID)
@@ -570,17 +572,21 @@ namespace SabreTools.RedumpLib.Tools
// For some outdated tags, we need to use alternate names
text = text.Replace("<b>Demos</b>:", SiteCode.PlayableDemos.Code);
text = text.Replace("<b>Disney ID</b>:", SiteCode.DisneyInteractiveID.HTML);
text = text.Replace("DMI:", SiteCode.DMIHash.HTML);
text = text.Replace("<b>LucasArts ID</b>:", SiteCode.LucasArtsID.Code);
text = text.Replace("SS version:", SiteCode.SSVersion.HTML);
text = text.Replace("XeMID:", SiteCode.XeMID.HTML);
text = text.Replace("XMID:", SiteCode.XMID.HTML);
// These tags are obsolete
#pragma warning disable CS0618 // Type or member is obsolete
text = text.Replace("DMI:", SiteCode.DMIHash.HTML);
text = text.Replace("PFI:", SiteCode.PFIHash.HTML);
text = text.Replace("SS:", SiteCode.SSHash.HTML);
text = text.Replace("SSv1:", SiteCode.SSHash.HTML);
text = text.Replace("<b>SSv1</b>:", SiteCode.SSHash.HTML);
text = text.Replace("SSv2:", SiteCode.SSHash.HTML);
text = text.Replace("<b>SSv2</b>:", SiteCode.SSHash.HTML);
text = text.Replace("SS version:", SiteCode.SSVersion.HTML);
text = text.Replace("XeMID:", SiteCode.XeMID.HTML);
text = text.Replace("XMID:", SiteCode.XMID.HTML);
#pragma warning restore CS0618 // Type or member is obsolete
return text;
}

View File

@@ -30,9 +30,11 @@ namespace SabreTools.RedumpLib.Tools
SiteCode.XMID,
SiteCode.XeMID,
#pragma warning disable CS0618 // Type or member is obsolete
SiteCode.DMIHash,
SiteCode.PFIHash,
SiteCode.SSHash,
#pragma warning restore CS0618 // Type or member is obsolete
SiteCode.SSVersion,
SiteCode.Filename,
@@ -427,6 +429,7 @@ namespace SabreTools.RedumpLib.Tools
AddIfExists(output, Template.DMIField, section.DMI, 1);
AddIfExists(output, Template.CuesheetField, section.Cuesheet, 1);
AddIfExists(output, Template.DatField, section.Dat + "\n", 1);
AddIfExists(output, Template.ExtrasDatField, section.ExtrasDat + "\n", 1);
}
/// <summary>

View File

@@ -1537,6 +1537,7 @@ namespace SabreTools.RedumpLib.Web
PackType.Datfile => system.HasDat,
PackType.Sbis => system.HasSbi,
PackType.BiosDatfile => system.HasBios,
PackType.ExtrasDatfile => system.HasExtras,
_ => false,
};
}

View File

@@ -68,6 +68,7 @@ namespace SabreTools.RedumpLib.Web
_ = await client.DownloadPacks(PackType.Datfile, systems, outDir, useSubfolders ? "dat" : null);
_ = await client.DownloadPacks(PackType.Sbis, systems, outDir, useSubfolders ? "sbi" : null);
_ = await client.DownloadPacks(PackType.BiosDatfile, systems, outDir, useSubfolders ? "bios" : null);
_ = await client.DownloadPacks(PackType.ExtrasDatfile, systems, outDir, useSubfolders ? "extras" : null);
if (includeDatabase)
_ = await client.DownloadDatabase(outDir, useSubfolders ? "db" : null);