diff --git a/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs b/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs index 0d650552..83ceb29a 100644 --- a/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs +++ b/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs @@ -20,17 +20,6 @@ namespace DICUI.Test.Utilities } } - [Theory] - [InlineData(KnownSystem.AppleMacintosh, true)] - [InlineData(KnownSystem.MicrosoftXBOX, false)] - [InlineData(KnownSystem.MicrosoftXBOX360, false)] - [InlineData(KnownSystem.SonyPlayStation3, true)] - public void DriveSpeedSupportedTest(KnownSystem? knownSystem, bool expected) - { - bool actual = knownSystem.DoesSupportDriveSpeed(); - Assert.Equal(expected, actual); - } - [Fact] public void IsMarkerTest() { diff --git a/DICUI/MainWindow.xaml.cs b/DICUI/MainWindow.xaml.cs index 28ec929c..60c1041b 100644 --- a/DICUI/MainWindow.xaml.cs +++ b/DICUI/MainWindow.xaml.cs @@ -450,7 +450,7 @@ namespace DICUI StartStopButton.IsEnabled = result && (_drives != null && _drives.Count > 0 ? true : false); // If we're in a type that doesn't support drive speeds - DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed() && _env.System.DoesSupportDriveSpeed(); + DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed(); // Special case for Custom input if (_env.System == KnownSystem.Custom) @@ -530,10 +530,33 @@ namespace DICUI DriveSpeedComboBox.ItemsSource = values; ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values)); + // Find the minimum set to compare against + int preferred = 100; + switch (_currentMediaType) + { + case MediaType.CD: + case MediaType.GDROM: + preferred = _options.preferredDumpSpeedCD; + break; + case MediaType.DVD: + case MediaType.HDDVD: + case MediaType.GameCubeGameDisc: + case MediaType.WiiOpticalDisc: + preferred = _options.preferredDumpSpeedDVD; + break; + case MediaType.BluRay: + preferred = _options.preferredDumpSpeedBD; + break; + default: + preferred = _options.preferredDumpSpeedCD; + break; + } + // Choose the lower of the two speeds between the allowed speeds and the user-defined one + // TODO: Inform more users about setting preferences in the settings so this comparison doesn't need to happen int chosenSpeed = Math.Min( values.Where(s => s <= values[values.Count / 2]).Last(), - _options.preferredDumpSpeedCD + preferred ); // Set the selected speed diff --git a/DICUI/Options.cs b/DICUI/Options.cs index 66d11693..064d6643 100644 --- a/DICUI/Options.cs +++ b/DICUI/Options.cs @@ -13,6 +13,7 @@ namespace DICUI public int preferredDumpSpeedCD { get; set; } public int preferredDumpSpeedDVD { get; set; } + public int preferredDumpSpeedBD { get; set; } public bool QuietMode { get; set; } public bool ParanoidMode { get; set; } @@ -49,7 +50,8 @@ namespace DICUI DefaultOutputPath = ConfigurationManager.AppSettings["DefaultOutputPath"] ?? "ISO"; this.preferredDumpSpeedCD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedCD"], out int maxDumpSpeedCD) ? maxDumpSpeedCD : 72; - this.preferredDumpSpeedDVD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedDVD"], out int maxDumpSpeedDVD) ? maxDumpSpeedDVD : 72; + this.preferredDumpSpeedDVD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedDVD"], out int maxDumpSpeedDVD) ? maxDumpSpeedDVD : 24; + this.preferredDumpSpeedBD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedBD"], out int maxDumpSpeedBD) ? maxDumpSpeedBD : 16; this.QuietMode = Boolean.TryParse(ConfigurationManager.AppSettings["QuietMode"], out bool quietMode) ? quietMode : false; this.ParanoidMode = Boolean.TryParse(ConfigurationManager.AppSettings["ParanoidMode"], out bool paranoidMode) ? paranoidMode : false; @@ -77,9 +79,18 @@ namespace DICUI { switch (type) { - case MediaType.CD: return preferredDumpSpeedCD; - case MediaType.DVD: return preferredDumpSpeedDVD; - default: return 8; + case MediaType.CD: + case MediaType.GDROM: + return preferredDumpSpeedCD; + case MediaType.DVD: + case MediaType.HDDVD: + case MediaType.GameCubeGameDisc: + case MediaType.WiiOpticalDisc: + return preferredDumpSpeedDVD; + case MediaType.BluRay: + return preferredDumpSpeedBD; + default: + return 8; } } } diff --git a/DICUI/OptionsWindow.xaml b/DICUI/OptionsWindow.xaml index d546512a..ed61aebe 100644 --- a/DICUI/OptionsWindow.xaml +++ b/DICUI/OptionsWindow.xaml @@ -6,12 +6,12 @@ xmlns:lui="clr-namespace:DICUI.UI" xmlns:l="clr-namespace:DICUI" mc:Ignorable="d" - Title="Options" Height="400" Width="515.132"> + Title="Options" Height="480" Width="515.132"> - + @@ -45,7 +45,7 @@ - + @@ -55,6 +55,7 @@ + diff --git a/DICUI/OptionsWindow.xaml.cs b/DICUI/OptionsWindow.xaml.cs index 8b53c88e..9fea84de 100644 --- a/DICUI/OptionsWindow.xaml.cs +++ b/DICUI/OptionsWindow.xaml.cs @@ -102,6 +102,7 @@ namespace DICUI DumpSpeedCDSlider.Value = _options.preferredDumpSpeedCD; DumpSpeedDVDSlider.Value = _options.preferredDumpSpeedDVD; + DumpSpeedBDSlider.Value = _options.preferredDumpSpeedBD; } #region Event Handlers @@ -112,6 +113,7 @@ namespace DICUI _options.preferredDumpSpeedCD = Convert.ToInt32(DumpSpeedCDSlider.Value); _options.preferredDumpSpeedDVD = Convert.ToInt32(DumpSpeedDVDSlider.Value); + _options.preferredDumpSpeedBD = Convert.ToInt32(DumpSpeedBDSlider.Value); _options.Save(); Hide(); diff --git a/DICUI/Utilities/DumpEnvironment.cs b/DICUI/Utilities/DumpEnvironment.cs index 3c04fc0e..7d9fe1d4 100644 --- a/DICUI/Utilities/DumpEnvironment.cs +++ b/DICUI/Utilities/DumpEnvironment.cs @@ -1452,11 +1452,8 @@ namespace DICUI.Utilities { try { - // Fast forward to the Security Sector version - while (!sr.ReadLine().Trim().StartsWith("========== SecuritySector ==========")); - - // Now we need to read until the line starts with the version - sr.ReadLine(); // "Unknown: " + // Fast forward to the Security Sector version and read it + while (!sr.ReadLine().Trim().StartsWith("CPR_MAI Key")); ssver = sr.ReadLine().Trim().Split(' ')[4]; // "Version of challenge table: " // Fast forward to the Security Sector Ranges @@ -1466,8 +1463,8 @@ namespace DICUI.Utilities string line = sr.ReadLine().Trim(); // TODO: Clean up these regex definitions - Regex layerRegex = new Regex(@"Layer [01]\s*Unknown:.*, startLBA-endLBA:\s*(\d+)-\s*(\d+)"); - Regex unknownRegex = new Regex(@"Unknown ranges\s*Unknown:.*, startLBA-endLBA:\s*(\d+)-\s*(\d+)"); + Regex layerRegex = new Regex(@"Layer [01].*, startLBA-endLBA:\s*(\d+)-\s*(\d+)"); + Regex unknownRegex = new Regex(@"Unknown ranges.*, startLBA-endLBA:\s*(\d+)-\s*(\d+)"); while (!line.StartsWith("========== Unlock 2 state(wxripper) ==========")) { @@ -1477,7 +1474,7 @@ namespace DICUI.Utilities var match = layerRegex.Match(line); ss += $"{match.Groups[1]}-{match.Groups[2]}\n"; } - else if (line.StartsWith("Unknown")) + else if (line.StartsWith("Unknown ranges")) { var match = unknownRegex.Match(line); ss += $"{match.Groups[1]}-{match.Groups[2]}\n"; @@ -1487,15 +1484,26 @@ namespace DICUI.Utilities } // Fast forward to the aux hashes - while (!line.Trim().StartsWith("