From 0d767911e4e90e8d6177cfd96d0d1d327fbc01b4 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 4 Jul 2026 20:00:25 -0400 Subject: [PATCH] Add BIOS paths to builder --- SabreTools.RedumpLib/Web/UrlBuilder.cs | 63 ++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/SabreTools.RedumpLib/Web/UrlBuilder.cs b/SabreTools.RedumpLib/Web/UrlBuilder.cs index ff55c28..d64047e 100644 --- a/SabreTools.RedumpLib/Web/UrlBuilder.cs +++ b/SabreTools.RedumpLib/Web/UrlBuilder.cs @@ -75,6 +75,30 @@ namespace SabreTools.RedumpLib.Web #endregion + #region BIOS File Names + + /// + /// Microsoft XBOX BIOS datfile filename + /// + public const string MicrosoftXboxBIOSFilename = "Microsoft%20-%20Xbox%20-%20BIOS%20Images%20%289%29%20%282026-06-16%29.dat"; + + /// + /// Nintendo GameCube BIOS datfile filename + /// + public const string NintendoGameCubeBIOSFilename = "Nintendo%20-%20GameCube%20-%20BIOS%20Images%20%2817%29%20%282026-06-16%29.dat"; + + /// + /// Sony PlayStation BIOS datfile filename + /// + public const string SonyPlayStationBIOSFilename = "Sony%20-%20PlayStation%20-%20BIOS%20Images%20%2824%29%20%282026-06-16%29.dat"; + + /// + /// Sony PlayStation 2 BIOS datfile filename + /// + public const string SonyPlayStation2BIOSFilename = "Sony%20-%20PlayStation%202%20-%20BIOS%20Datfile%20%28140%29%20%282026-06-16%29.dat"; + + #endregion + // TODO: Add filter statements for discs #endregion @@ -95,11 +119,35 @@ namespace SabreTools.RedumpLib.Web /// /// Build a /static/bios/ path URL /// - /// BIOS datfile filename, required - public static string BuildBiosUrl(string filename) + /// System to retrieve static BIOS datfile for, required + /// Handles the non-BIOS variants of systems for compatibility + public static string BuildBiosUrl(PhysicalSystem system) { var sb = new StringBuilder(); +#pragma warning disable IDE0072 // Add missing cases + string? filename = system switch + { + PhysicalSystem.MicrosoftXbox => MicrosoftXboxBIOSFilename, + PhysicalSystem.MicrosoftXboxBIOS => MicrosoftXboxBIOSFilename, + + PhysicalSystem.NintendoGameCube => NintendoGameCubeBIOSFilename, + PhysicalSystem.NintendoGameCubeBIOS => NintendoGameCubeBIOSFilename, + + PhysicalSystem.SonyPlayStation => SonyPlayStationBIOSFilename, + PhysicalSystem.SonyPlayStationBIOS => SonyPlayStationBIOSFilename, + + PhysicalSystem.SonyPlayStation2 => SonyPlayStation2BIOSFilename, + PhysicalSystem.SonyPlayStation2BIOS => SonyPlayStation2BIOSFilename, + + _ => null, + }; +#pragma warning restore IDE0072 // Add missing cases + + // Ignore invalid BIOS systems + if (filename is null) + return string.Empty; + sb.Append(SiteBaseUrl); sb.AppendFormat(BiosPath, filename); @@ -406,11 +454,20 @@ namespace SabreTools.RedumpLib.Web /// TODO: Handle download_dat_variant? public static string BuildPackUrl(PackType packType, PhysicalSystem system) { + // Hack to support the static BIOS sets + if (packType == PackType.Datfile + && (system == PhysicalSystem.MicrosoftXboxBIOS + || system == PhysicalSystem.NintendoGameCubeBIOS + || system == PhysicalSystem.SonyPlayStationBIOS + || system == PhysicalSystem.SonyPlayStation2BIOS)) + { + return BuildBiosUrl(system); + } + var sb = new StringBuilder(); sb.Append(SiteBaseUrl); - // TODO: Handle BIOS DAT links somehow string systemName = system.ShortName() ?? string.Empty; switch (packType) {