diff --git a/CHANGELIST.md b/CHANGELIST.md index 00b375a1..81fe1f6e 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -64,6 +64,7 @@ - Make system private to DumpEnvironment - Make drive private to DumpEnvironment - Simplify RequiredProgramsExist logic +- Reduce complexity of ProcessSystem method ### 3.1.9a (2024-05-21) diff --git a/MPF.Core/SubmissionInfoTool.cs b/MPF.Core/SubmissionInfoTool.cs index 90da2d83..3b1d1fd4 100644 --- a/MPF.Core/SubmissionInfoTool.cs +++ b/MPF.Core/SubmissionInfoTool.cs @@ -106,7 +106,15 @@ namespace MPF.Core ProcessMediaType(info, mediaType, options.AddPlaceholders); // Extract info based specifically on RedumpSystem - _ = await ProcessSystem(info, system, drive, options.AddPlaceholders, resultProgress); + ProcessSystem(info, system, drive, options.AddPlaceholders); + + // Run anti-modchip check, if necessary + if (drive != null && SupportsAntiModchipScans(system) && info.CopyProtection!.AntiModchip == YesNo.NULL) + { + resultProgress?.Report(ResultEventArgs.Success("Checking for anti-modchip strings... this might take a while!")); + info.CopyProtection.AntiModchip = await InfoTool.GetAntiModchipDetected(drive) ? YesNo.Yes : YesNo.No; + resultProgress?.Report(ResultEventArgs.Success("Anti-modchip string scan complete!")); + } // Run copy protection, if possible or necessary if (SupportsCopyProtectionScans(system)) @@ -581,11 +589,7 @@ namespace MPF.Core /// /// Processes default data based on system type /// - private static async Task ProcessSystem(SubmissionInfo info, - RedumpSystem? system, - Drive? drive, - bool addPlaceholders, - IProgress? resultProgress = null) + private static bool ProcessSystem(SubmissionInfo info, RedumpSystem? system, Drive? drive, bool addPlaceholders) { // Extract info based specifically on RedumpSystem switch (system) @@ -796,13 +800,6 @@ namespace MPF.Core } } - if (drive != null && info.CopyProtection!.AntiModchip == YesNo.NULL) - { - resultProgress?.Report(ResultEventArgs.Success("Checking for anti-modchip strings... this might take a while!")); - info.CopyProtection.AntiModchip = await InfoTool.GetAntiModchipDetected(drive) ? YesNo.Yes : YesNo.No; - resultProgress?.Report(ResultEventArgs.Success("Anti-modchip string scan complete!")); - } - break; case RedumpSystem.SonyPlayStation2: @@ -876,6 +873,18 @@ namespace MPF.Core return true; } + /// + /// Helper to determine if a system requires an anti-modchip scan + /// + private static bool SupportsAntiModchipScans(RedumpSystem? system) + { + return system switch + { + RedumpSystem.SonyPlayStation => true, + _ => false, + }; + } + /// /// Helper to determine if a system requires a copy protection scan ///