diff --git a/DICUI.csproj b/DICUI.csproj
index d0e4e9c1..ce7cf677 100644
--- a/DICUI.csproj
+++ b/DICUI.csproj
@@ -69,6 +69,8 @@
+
+
diff --git a/DumpInformation.cs b/DumpInformation.cs
index 90f55aae..32599f0c 100644
--- a/DumpInformation.cs
+++ b/DumpInformation.cs
@@ -100,6 +100,8 @@ namespace DICUI
&& File.Exists(combinedBase + "_mainInfo.txt")
&& File.Exists(combinedBase + "_volDesc.txt");
case DiscType.Floppy:
+ return File.Exists(combinedBase + "_cmd.txt")
+ && File.Exists(combinedBase + "_disc.txt");
default:
return false;
}
@@ -136,15 +138,12 @@ namespace DICUI
{ Template.RegionField, "World (CHANGE THIS)" },
{ Template.LanguagesField, "Klingon (CHANGE THIS)" },
{ Template.DiscSerialField, Template.RequiredIfExistsValue },
- { Template.MouldSIDField, Template.RequiredIfExistsValue },
- { Template.AdditionalMouldField, Template.RequiredIfExistsValue },
{ Template.BarcodeField, Template.OptionalValue},
{ Template.CommentsField, Template.OptionalValue },
{ Template.ContentsField, Template.OptionalValue },
{ Template.VersionField, Template.RequiredIfExistsValue },
{ Template.EditionField, "Original (VERIFY THIS)" },
- { Template.PVDField, GetPVD(combinedBase + "_mainInfo.txt") },
- { Template.DATField, GetDatfile(combinedBase + ".dat") },
+ { Template.DATField, GetDatfile(combinedBase + ".dat") }, // TODO: Petition sarami to add .dat output for floppy images
};
// Now we want to do a check by DiscType and extract all required info
@@ -154,7 +153,10 @@ namespace DICUI
case DiscType.GDROM: // TODO: Verify GD-ROM outputs this
mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue;
mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue;
+ mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
+ mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
+ mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
mappings[Template.ErrorCountField] = GetErrorCount(combinedBase + ".img_EdcEcc.txt",
combinedBase + "_c2Error.txt",
combinedBase + "_mainError.txt").ToString();
@@ -198,7 +200,10 @@ namespace DICUI
case DiscType.BD25:
mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue;
mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue;
+ mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
+ mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
+ mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
// System-specific options
switch (sys)
@@ -228,8 +233,11 @@ namespace DICUI
mappings["Inner " + Template.MasteringRingField] = Template.RequiredIfExistsValue;
mappings["Outer " + Template.MasteringSIDField] = Template.RequiredIfExistsValue;
mappings["Inner " + Template.MasteringSIDField] = Template.RequiredIfExistsValue;
+ mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
+ mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
mappings["Outer " + Template.ToolstampField] = Template.RequiredIfExistsValue;
mappings["Inner " + Template.ToolstampField] = Template.RequiredIfExistsValue;
+ mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
mappings[Template.LayerbreakField] = GetLayerbreak(combinedBase + "_disc.txt");
// System-specific options
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index ca384d92..5939fecf 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -21,7 +21,7 @@ namespace DICUI
private string subdumpPath;
// Private UI-related variables
- private List> _drives { get; set; }
+ private List> _drives { get; set; }
private List _driveSpeeds { get { return new List { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 }; } }
private List> _systems { get; set; }
private Process childProcess { get; set; }
@@ -196,7 +196,7 @@ namespace DICUI
private async void StartDumping()
{
// Local variables
- string driveLetter = cmb_DriveLetter.Text;
+ var driveLetter = cmb_DriveLetter.SelectedItem as Tuple;
string outputDirectory = txt_OutputDirectory.Text;
string outputFilename = txt_OutputFilename.Text;
btn_StartStop.Content = UIElements.StopDumping;
@@ -206,7 +206,8 @@ namespace DICUI
// Validate that everything is good
if (string.IsNullOrWhiteSpace(txt_CustomParameters.Text)
- || !Utilities.ValidateParameters(txt_CustomParameters.Text))
+ || !Utilities.ValidateParameters(txt_CustomParameters.Text)
+ || (driveLetter.Item3 ^ selected.Item3 == DiscType.Floppy))
{
lbl_Status.Content = "Error! Current configuration is not supported!";
btn_StartStop.Content = UIElements.StartDumping;
@@ -273,7 +274,7 @@ namespace DICUI
StartInfo = new ProcessStartInfo()
{
FileName = sgRawPath,
- Arguments = "-v -r 4100 -R " + driveLetter + ": " + "ad 01 00 00 00 00 00 00 10 04 00 00 -o \"PIC.bin\""
+ Arguments = "-v -r 4100 -R " + driveLetter.Item1 + ": " + "ad 01 00 00 00 00 00 00 10 04 00 00 -o \"PIC.bin\""
},
};
childProcess.Start();
@@ -294,7 +295,7 @@ namespace DICUI
StartInfo = new ProcessStartInfo()
{
FileName = subdumpPath,
- Arguments = "-i " + driveLetter + ": -f " + Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(outputFilename) + "_subdump.sub") + "-mode 6 -rereadnum 25 -fix 2",
+ Arguments = "-i " + driveLetter.Item1 + ": -f " + Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(outputFilename) + "_subdump.sub") + "-mode 6 -rereadnum 25 -fix 2",
},
};
childProcess.Start();
@@ -339,7 +340,7 @@ namespace DICUI
StartInfo = new ProcessStartInfo()
{
FileName = psxtPath,
- Arguments = "--libcryptdrvfast " + driveLetter + " > " + "\"" + Path.Combine(outputDirectory, "libcryptdrv.log"),
+ Arguments = "--libcryptdrvfast " + driveLetter.Item1 + " > " + "\"" + Path.Combine(outputDirectory, "libcryptdrv.log"),
},
};
childProcess.Start();
@@ -393,7 +394,12 @@ namespace DICUI
CancelDumping();
- var driveTuple = cmb_DriveLetter.SelectedItem as Tuple;
+ var driveTuple = cmb_DriveLetter.SelectedItem as Tuple;
+ if (driveTuple.Item3)
+ {
+ return;
+ }
+
await Task.Run(() =>
{
childProcess = new Process()
@@ -453,6 +459,7 @@ namespace DICUI
// If we're in a type that doesn't support drive speeds
switch (tuple.Item3)
{
+ case DiscType.Floppy:
case DiscType.BD25:
case DiscType.BD50:
cmb_DriveSpeed.IsEnabled = false;
@@ -487,13 +494,13 @@ namespace DICUI
if (cmb_DiscType.SelectedIndex > 0)
{
var selected = cmb_DiscType.SelectedValue as Tuple;
- var driveletter = cmb_DriveLetter.SelectedValue as Tuple;
+ var driveletter = cmb_DriveLetter.SelectedValue as Tuple;
string discType = Utilities.GetBaseCommand(selected.Item3);
List defaultParams = Utilities.GetDefaultParameters(selected.Item2, selected.Item3);
txt_CustomParameters.Text = discType
+ " " + driveletter.Item1
+ " \"" + Path.Combine(txt_OutputDirectory.Text, txt_OutputFilename.Text) + "\" "
- + (selected.Item3 != DiscType.BD25 && selected.Item3 != DiscType.BD50 ? (int)cmb_DriveSpeed.SelectedItem + " " : "")
+ + (selected.Item3 != DiscType.Floppy && selected.Item3 != DiscType.BD25 && selected.Item3 != DiscType.BD50 ? (int)cmb_DriveSpeed.SelectedItem + " " : "")
+ string.Join(" ", defaultParams);
}
}
@@ -504,7 +511,7 @@ namespace DICUI
///
private void GetOutputNames()
{
- var driveTuple = cmb_DriveLetter.SelectedItem as Tuple;
+ var driveTuple = cmb_DriveLetter.SelectedItem as Tuple;
var discTuple = cmb_DiscType.SelectedItem as Tuple;
if (driveTuple != null && discTuple != null)
@@ -525,8 +532,8 @@ namespace DICUI
private void SetSupportedDriveSpeed()
{
// Get the drive letter from the selected item
- var selected = cmb_DriveLetter.SelectedItem as Tuple;
- if (selected == null)
+ var selected = cmb_DriveLetter.SelectedItem as Tuple;
+ if (selected == null || selected.Item3)
{
return;
}
@@ -671,20 +678,40 @@ namespace DICUI
Grid.SetRow(defaultOutputPathSetting, 4);
Grid.SetColumn(defaultOutputPathSetting, 1);
+ var buttonGrid = new Grid
+ {
+ Margin = new Thickness(5),
+ HorizontalAlignment = HorizontalAlignment.Stretch,
+ VerticalAlignment = VerticalAlignment.Stretch,
+ };
+ buttonGrid.ColumnDefinitions.Add(new ColumnDefinition());
+ buttonGrid.ColumnDefinitions.Add(new ColumnDefinition());
+ buttonGrid.RowDefinitions.Add(new RowDefinition());
+ Grid.SetRow(buttonGrid, 5);
+ Grid.SetColumn(buttonGrid, 0);
+ Grid.SetColumnSpan(buttonGrid, 2);
+
Button acceptButton = new Button();
acceptButton.Name = "btn_Settings_Accept";
acceptButton.Content = "Accept";
acceptButton.Click += btn_Settings_Accept_Click;
- Grid.SetRow(acceptButton, 5);
+ acceptButton.VerticalAlignment = VerticalAlignment.Center;
+ acceptButton.HorizontalAlignment = HorizontalAlignment.Center;
+ Grid.SetRow(acceptButton, 0);
Grid.SetColumn(acceptButton, 0);
Button cancelButton = new Button();
cancelButton.Name = "btn_Settings_Cancel";
cancelButton.Content = "Cancel";
cancelButton.Click += btn_Settings_Cancel_Click;
- Grid.SetRow(cancelButton, 5);
+ cancelButton.VerticalAlignment = VerticalAlignment.Center;
+ cancelButton.HorizontalAlignment = HorizontalAlignment.Center;
+ Grid.SetRow(cancelButton, 0);
Grid.SetColumn(cancelButton, 1);
+ buttonGrid.Children.Add(acceptButton);
+ buttonGrid.Children.Add(cancelButton);
+
// Add all of the UI elements
grid.Children.Add(dicPathLabel);
grid.Children.Add(dicPathSetting);
@@ -696,8 +723,7 @@ namespace DICUI
grid.Children.Add(subdumpPathSetting);
grid.Children.Add(defaultOutputPathLabel);
grid.Children.Add(defaultOutputPathSetting);
- grid.Children.Add(acceptButton);
- grid.Children.Add(cancelButton);
+ grid.Children.Add(buttonGrid);
// Now show the child window
childWindow.Content = grid;
diff --git a/Utilities.cs b/Utilities.cs
index 9263c2d8..576ec2f6 100644
--- a/Utilities.cs
+++ b/Utilities.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Management;
using System.Text.RegularExpressions;
namespace DICUI
@@ -642,17 +643,47 @@ namespace DICUI
///
/// Active drives, matched to labels, if possible
///
+ /// https://stackoverflow.com/questions/3060796/how-to-distinguish-between-usb-and-floppy-devices?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
+ /// https://msdn.microsoft.com/en-us/library/aa394173(v=vs.85).aspx
/// This returns a List of Tuples whose structure is as follows:
/// Item 1: Drive letter
/// Item 2: Volume label
+ /// Item 3: (True for floppy drive, false otherwise)
///
- public static List> CreateListOfDrives()
+ public static List> CreateListOfDrives()
{
- // TODO: Floppy drives show up as DriveType.Removable, but so do USB drives
- return DriveInfo.GetDrives()
+ // Get the floppy drives
+ List> floppyDrives = new List>();
+ try
+ {
+ ManagementObjectSearcher searcher =
+ new ManagementObjectSearcher("root\\CIMV2",
+ "SELECT * FROM Win32_LogicalDisk");
+
+ foreach (ManagementObject queryObj in searcher.Get())
+ {
+ uint? mediaType = (uint?)queryObj["MediaType"];
+ if (mediaType != null && ((mediaType > 0 && mediaType < 11) || (mediaType > 12 && mediaType < 22)))
+ {
+ char devId = queryObj["DeviceID"].ToString()[0];
+ floppyDrives.Add(new Tuple(devId, "FLOPPY", true));
+ }
+ }
+ }
+ catch
+ {
+ // No-op
+ }
+
+ // Get the optical disc drives
+ List> discDrives = DriveInfo.GetDrives()
.Where(d => d.DriveType == DriveType.CDRom && d.IsReady)
- .Select(d => new Tuple(d.Name[0], d.VolumeLabel))
+ .Select(d => new Tuple(d.Name[0], d.VolumeLabel, false))
.ToList();
+
+ // Add the two lists together, order, and return
+ floppyDrives.AddRange(discDrives);
+ return floppyDrives.OrderBy(i => i.Item1).ToList();
}
///