diff --git a/CHANGELIST.md b/CHANGELIST.md index 4b2d2f5c..3a0c6ff0 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -39,6 +39,7 @@ - Fix saving path settings if set from dialog - Allow default system if skipping system detection enabled - Add internal support for all Redump site codes +- Use the Volume Label special site code ### 2.1 (2021-07-22) - Enum, no more diff --git a/MPF.Core/Data/Drive.cs b/MPF.Core/Data/Drive.cs index c0dca89f..2098249f 100644 --- a/MPF.Core/Data/Drive.cs +++ b/MPF.Core/Data/Drive.cs @@ -48,7 +48,12 @@ namespace MPF.Core.Data /// /// Media label as read by Windows /// - public string VolumeLabel + public string VolumeLabel => driveInfo?.VolumeLabel; + + /// + /// Media label as read by Windows, formatted to avoid odd outputs + /// + public string FormattedVolumeLabel { get { @@ -250,7 +255,7 @@ namespace MPF.Core.Data return RedumpSystem.IBMPCcompatible; // Audio CD - if (this.VolumeLabel.Equals("Audio CD", StringComparison.OrdinalIgnoreCase)) + if (this.FormattedVolumeLabel.Equals("Audio CD", StringComparison.OrdinalIgnoreCase)) { return RedumpSystem.AudioCD; } @@ -280,7 +285,7 @@ namespace MPF.Core.Data && Directory.EnumerateFiles(Path.Combine(drivePath, "VIDEO_TS")).Any()) { // TODO: Maybe add video track hashes to compare for Xbox and X360? - if (this.VolumeLabel.StartsWith("SEP13011042", StringComparison.OrdinalIgnoreCase)) + if (this.FormattedVolumeLabel.StartsWith("SEP13011042", StringComparison.OrdinalIgnoreCase)) return RedumpSystem.MicrosoftXbox; return RedumpSystem.DVDVideo; @@ -346,19 +351,19 @@ namespace MPF.Core.Data } // Sony PlayStation 3 - if (this.VolumeLabel.Equals("PS3VOLUME", StringComparison.OrdinalIgnoreCase)) + if (this.FormattedVolumeLabel.Equals("PS3VOLUME", StringComparison.OrdinalIgnoreCase)) { return RedumpSystem.SonyPlayStation3; } // Sony PlayStation 4 - if (this.VolumeLabel.Equals("PS4VOLUME", StringComparison.OrdinalIgnoreCase)) + if (this.FormattedVolumeLabel.Equals("PS4VOLUME", StringComparison.OrdinalIgnoreCase)) { return RedumpSystem.SonyPlayStation4; } // Sony PlayStation 5 - if (this.VolumeLabel.Equals("PS5VOLUME", StringComparison.OrdinalIgnoreCase)) + if (this.FormattedVolumeLabel.Equals("PS5VOLUME", StringComparison.OrdinalIgnoreCase)) { return RedumpSystem.SonyPlayStation5; } diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index 68d2a5b9..7b6f0ee4 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -158,6 +158,10 @@ namespace MPF.Library if (!string.IsNullOrWhiteSpace(info.SizeAndChecksums.CRC32)) info.TracksAndWriteOffsets.ClrMameProData = null; + // Add the volume label to comments, if possible + if (!string.IsNullOrWhiteSpace(drive?.VolumeLabel) && !info.CommonDiscInfo.Comments.Contains(Template.VolumeLabelCommentField)) + info.CommonDiscInfo.Comments += $"{Template.VolumeLabelCommentField} {drive.VolumeLabel}\n"; + // Extract info based generically on MediaType switch (mediaType) { diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index f76d864b..1e603eb5 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -827,7 +827,7 @@ namespace MPF.GUI.ViewModels // Set the output filename, if we changed drives or it's not already if (driveChanged || string.IsNullOrEmpty(App.Instance.OutputFilenameTextBox.Text)) - App.Instance.OutputFilenameTextBox.Text = (drive?.VolumeLabel ?? systemType.LongName()) + (extension ?? ".bin"); + App.Instance.OutputFilenameTextBox.Text = (drive?.FormattedVolumeLabel ?? systemType.LongName()) + (extension ?? ".bin"); // If the extension for the file changed, update that automatically else if (Path.GetExtension(App.Instance.OutputFilenameTextBox.Text) != extension)