From 395cded5efb7805ab2f0536e00c8378f23280d94 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 24 Nov 2025 13:14:24 -0500 Subject: [PATCH] Clarify the unmounted device case (fixes #921) --- CHANGELIST.md | 1 + MPF.Frontend/Tools/ProtectionTool.cs | 11 +++++++---- MPF.Frontend/Tools/SubmissionGenerator.cs | 10 ++++++++-- MPF.Frontend/ViewModels/MainViewModel.cs | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 46a2abbe..b7f796a9 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -74,6 +74,7 @@ - Ensure volume label is trimmed if used in filenames - Remove DPM identifier for StarForce Keyless - New Redumper Drive Pregap Start option +- Clarify the unmounted device case ### 3.5.0 (2025-10-10) diff --git a/MPF.Frontend/Tools/ProtectionTool.cs b/MPF.Frontend/Tools/ProtectionTool.cs index 1c7aa02b..5b8968f0 100644 --- a/MPF.Frontend/Tools/ProtectionTool.cs +++ b/MPF.Frontend/Tools/ProtectionTool.cs @@ -207,13 +207,16 @@ namespace MPF.Frontend.Tools /// Format found protections to a deduplicated, ordered string /// /// Dictionary of file to list of protection mappings + /// Drive object representing the current drive /// Detected protections, if any - public static string? FormatProtections(Dictionary>? protections) + public static string? FormatProtections(Dictionary>? protections, Drive? drive) { // If the filtered list is empty in some way, return if (protections == null) - return "(CHECK WITH PROTECTIONID)"; - else if (protections.Count == 0) + return "[EXTERNAL SCAN NEEDED]"; + else if (protections.Count == 0 && drive?.Name == null) + return "Mounted disc path missing [EXTERNAL SCAN NEEDED]"; + else if (protections.Count == 0 && drive?.Name != null) return "None found [OMIT FROM SUBMISSION]"; // Sanitize context-sensitive protections @@ -637,7 +640,7 @@ namespace MPF.Frontend.Tools foundProtections = foundProtections.FindAll(p => p != "StarForce"); } } - + if (foundProtections.Exists(p => p.StartsWith("StarForce Keyless"))) { foundProtections = foundProtections.FindAll(p => !p.StartsWith("StarForce Keyless")); diff --git a/MPF.Frontend/Tools/SubmissionGenerator.cs b/MPF.Frontend/Tools/SubmissionGenerator.cs index 8b59ee73..d363a810 100644 --- a/MPF.Frontend/Tools/SubmissionGenerator.cs +++ b/MPF.Frontend/Tools/SubmissionGenerator.cs @@ -131,9 +131,15 @@ namespace MPF.Frontend.Tools { Dictionary>? protections = null; if (options.ScanForProtection) - protections = await ProtectionTool.RunCombinedProtectionScans(basePath, drive, options, protectionProgress); + { + // Explicitly note missing/invalid device paths + if (drive?.Name == null) + resultProgress?.Report(ResultEventArgs.Success("No mounted device path found, protection outputs may be incomplete!")); - var protectionString = ProtectionTool.FormatProtections(protections); + protections = await ProtectionTool.RunCombinedProtectionScans(basePath, drive, options, protectionProgress); + } + + var protectionString = ProtectionTool.FormatProtections(protections, drive); info.CopyProtection.Protection += protectionString; info.CopyProtection.FullProtections = ReformatProtectionDictionary(protections); diff --git a/MPF.Frontend/ViewModels/MainViewModel.cs b/MPF.Frontend/ViewModels/MainViewModel.cs index 36ad2337..0d72adde 100644 --- a/MPF.Frontend/ViewModels/MainViewModel.cs +++ b/MPF.Frontend/ViewModels/MainViewModel.cs @@ -1959,7 +1959,7 @@ namespace MPF.Frontend.ViewModels try { var protections = await ProtectionTool.RunProtectionScanOnPath(CurrentDrive.Name, Options, progress); - var output = ProtectionTool.FormatProtections(protections); + var output = ProtectionTool.FormatProtections(protections, CurrentDrive); LogLn($"Detected the following protections in {CurrentDrive.Name}:\r\n\r\n{output}"); return output;