mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Update for even more DIC changes
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="150"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -45,7 +45,7 @@
|
||||
</Grid>
|
||||
|
||||
<GroupBox Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Preferred Dump Speed">
|
||||
<Grid Height="60">
|
||||
<Grid Height="100">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="2.0*"/>
|
||||
@@ -55,6 +55,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="CD-ROM" />
|
||||
@@ -65,6 +66,10 @@
|
||||
<Slider x:Name="DumpSpeedDVDSlider" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForDVDAsCollection}}" />
|
||||
<TextBox x:Name="DumpSpeedDVDTextBox" Grid.Row="1" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedDVDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="BD-ROM" />
|
||||
<Slider x:Name="DumpSpeedBDSlider" Grid.Row="2" Grid.Column="1" Minimum="1" Maximum="16" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForBDAsCollection}}" />
|
||||
<TextBox x:Name="DumpSpeedBDTextBox" Grid.Row="2" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedBDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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: <CRC32>"
|
||||
// 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: <VER>"
|
||||
|
||||
// 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("<rom"))
|
||||
while (!line.StartsWith("<rom"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
line = sr.ReadLine().Trim();
|
||||
}
|
||||
|
||||
// Read in the hashes to the proper parts
|
||||
sshash = line.Trim();
|
||||
pfihash = sr.ReadLine().Trim();
|
||||
dmihash = sr.ReadLine().Trim();
|
||||
while (line.StartsWith("<rom"))
|
||||
{
|
||||
if (line.Contains("SS.bin"))
|
||||
sshash = line;
|
||||
else if (line.Contains("PFI.bin"))
|
||||
pfihash = line;
|
||||
else if (line.Contains("DMI.bin"))
|
||||
dmihash = line;
|
||||
|
||||
if (sr.EndOfStream)
|
||||
break;
|
||||
|
||||
line = sr.ReadLine().Trim();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace DICUI.Utilities
|
||||
case MediaType.DVD:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.GameCubeGameDisc:
|
||||
case MediaType.WiiOpticalDisc:
|
||||
return true;
|
||||
@@ -66,18 +67,6 @@ namespace DICUI.Utilities
|
||||
return Converters.KnownSystemToString(system);
|
||||
}
|
||||
|
||||
public static bool DoesSupportDriveSpeed(this KnownSystem? system)
|
||||
{
|
||||
switch (system)
|
||||
{
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static KnownSystemCategory Category(this KnownSystem? system)
|
||||
{
|
||||
if (system < KnownSystem.MarkerConsoleEnd)
|
||||
|
||||
@@ -234,11 +234,16 @@ namespace DICUI.Utilities
|
||||
|
||||
// Drive Speed
|
||||
if (Command == DICCommand.Audio
|
||||
|| Command == DICCommand.BluRay
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.GDROM
|
||||
|| Command == DICCommand.Swap)
|
||||
|| Command == DICCommand.Swap
|
||||
|| Command == DICCommand.XBOX
|
||||
|| Command == DICCommand.XBOXSwap
|
||||
|| Command == DICCommand.XGD2Swap
|
||||
|| Command == DICCommand.XGD3Swap)
|
||||
{
|
||||
if (DriveSpeed != null)
|
||||
parameters.Add(DriveSpeed.ToString());
|
||||
@@ -610,8 +615,13 @@ namespace DICUI.Utilities
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
Command = DICCommand.BluRay;
|
||||
index = 3;
|
||||
index = 4;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.Close:
|
||||
@@ -848,8 +858,13 @@ namespace DICUI.Utilities
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
Command = DICCommand.XBOX;
|
||||
index = 3;
|
||||
index = 4;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.XBOXSwap:
|
||||
@@ -865,7 +880,12 @@ namespace DICUI.Utilities
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
for (int i = 3; i < parts.Count; i++)
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
for (int i = 4; i < parts.Count; i++)
|
||||
{
|
||||
if (!Int64.TryParse(parts[i], out long temp))
|
||||
return false;
|
||||
|
||||
@@ -32,9 +32,9 @@ build:
|
||||
|
||||
# post-build step
|
||||
after_build:
|
||||
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/2326718/DiscImageCreator_20180828.zip
|
||||
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/2342102/DiscImageCreator_20180901.zip
|
||||
- ps: appveyor DownloadFile http://www.rawdump.net/tools/subdump_fua_0x28.zip
|
||||
- 7z e DiscImageCreator_20180828.zip -oDICUI\bin\Debug\Programs Release_ANSI\*
|
||||
- 7z e DiscImageCreator_20180901.zip -oDICUI\bin\Debug\Programs Release_ANSI\*
|
||||
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug *
|
||||
- mv DICUI\bin\Debug\subdump_fua_0x28.exe DICUI\bin\Debug\subdump.exe
|
||||
- 7z a DICUI.zip DICUI\bin\Debug\*
|
||||
|
||||
Reference in New Issue
Block a user