From 7fb3f1c62eb984015fcbbcaf09eb54edc8b7031b Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 18 Mar 2026 22:10:52 -0400 Subject: [PATCH] Add Steam filter if specific example exists --- CHANGELIST.md | 1 + MPF.Frontend.Test/Tools/ProtectionToolTests.cs | 13 +++++++++++++ MPF.Frontend/Tools/PhysicalTool.cs | 6 ++---- MPF.Frontend/Tools/ProtectionTool.cs | 8 ++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 0ef1f8c9..e22e6753 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -76,6 +76,7 @@ - Attempt to fix image scanning issues - Parse and process Steam AppIDs and DepotIDs (Bestest) - Minor cleanup from missed recommendations +- Add Steam filter if specific example exists ### 3.6.0 (2025-11-28) diff --git a/MPF.Frontend.Test/Tools/ProtectionToolTests.cs b/MPF.Frontend.Test/Tools/ProtectionToolTests.cs index 28be2fe4..4ed85294 100644 --- a/MPF.Frontend.Test/Tools/ProtectionToolTests.cs +++ b/MPF.Frontend.Test/Tools/ProtectionToolTests.cs @@ -817,6 +817,19 @@ namespace MPF.Frontend.Test.Tools Assert.Equal("StarForce Keyless", sanitized); } + [Fact] + public void SanitizeFoundProtections_Steam() + { + List protections = + [ + "Steam", + "Steam (.sis/.csm/.csd)", + ]; + + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); + Assert.Equal("Steam (.sis/.csm/.csd)", sanitized); + } + [Fact] public void SanitizeFoundProtections_Sysiphus() { diff --git a/MPF.Frontend/Tools/PhysicalTool.cs b/MPF.Frontend/Tools/PhysicalTool.cs index 30d300bc..31c916c8 100644 --- a/MPF.Frontend/Tools/PhysicalTool.cs +++ b/MPF.Frontend/Tools/PhysicalTool.cs @@ -195,9 +195,8 @@ namespace MPF.Frontend.Tools if (!File.Exists(sis)) continue; - long sisSize = new FileInfo(sis).Length; - // Arbitrary filesize cap, a disc would need over 100x the normal amount of depots to go over this + long sisSize = new FileInfo(sis).Length; if (sisSize > 10_000) continue; @@ -268,9 +267,8 @@ namespace MPF.Frontend.Tools if (!File.Exists(sis)) continue; - long sisSize = new FileInfo(sis).Length; - // Arbitrary filesize cap, a disc would need over 100x the normal amount of depots to go over this. + long sisSize = new FileInfo(sis).Length; if (sisSize > 10_000) continue; diff --git a/MPF.Frontend/Tools/ProtectionTool.cs b/MPF.Frontend/Tools/ProtectionTool.cs index 7b3009d1..d6cd8d43 100644 --- a/MPF.Frontend/Tools/ProtectionTool.cs +++ b/MPF.Frontend/Tools/ProtectionTool.cs @@ -651,6 +651,14 @@ namespace MPF.Frontend.Tools foundProtections.Add("StarForce Keyless"); } + // Steam + if (foundProtections.Exists(p => p == "Steam") + && foundProtections.Exists(p => p.StartsWith("Steam") + && p.Length > "Steam".Length)) + { + foundProtections = foundProtections.FindAll(p => p != "Steam"); + } + // Sysiphus if (foundProtections.Exists(p => p == "Sysiphus") && foundProtections.Exists(p => p.StartsWith("Sysiphus") && p.Length > "Sysiphus".Length))