From c8a4a61028bb2f684183168dbc581308a87f7904 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 3 Feb 2022 22:28:14 -0800 Subject: [PATCH] Normalize PS1/PS2 executable names --- CHANGELIST.md | 1 + MPF.Modules/BaseParameters.cs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 74cc6863..fa1b47c8 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -79,6 +79,7 @@ - Make error clearer if something is unsupported in Check - Ensure drive is not null for volume labels - Check explicitly for no matches on Redump pull +- Normalize PS1/PS2 executable names ### 2.2 (2021-12-30) - Fix Saturn header finding diff --git a/MPF.Modules/BaseParameters.cs b/MPF.Modules/BaseParameters.cs index a6057b55..f31bee88 100644 --- a/MPF.Modules/BaseParameters.cs +++ b/MPF.Modules/BaseParameters.cs @@ -1176,11 +1176,18 @@ namespace MPF.Modules if (!string.IsNullOrEmpty(bootValue)) { var match = Regex.Match(bootValue, @"cdrom.?:\\?(.*)"); - if (match != null && match.Groups.Count > 1) + if (match.Groups.Count > 1) { - exeName = match.Groups[1].Value; - exeName = exeName.Split(';')[0]; - serial = exeName.Replace('_', '-').Replace(".", string.Empty); + // EXE name may have a trailing `;` after + // EXE name should always be in all caps + exeName = match.Groups[1].Value + .Split(';')[0] + .ToUpperInvariant(); + + // Serial is most of the EXE name normalized + serial = exeName + .Replace('_', '-') + .Replace(".", string.Empty); } }