From 38afecce4ab8a8ca85e0c96841c087665b21fe07 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Thu, 24 Dec 2020 11:51:53 -0330 Subject: [PATCH] Fix overzealous TV detection in ROM filenames. Fixes #747. --- Changes.txt | 3 +++ src/emucore/Console.cxx | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Changes.txt b/Changes.txt index 2f733a6e3..7386b39c6 100644 --- a/Changes.txt +++ b/Changes.txt @@ -38,6 +38,9 @@ * Fixed autofire bug for trackball controllers. + * Fixed bug in TV autodetection in filenames; a filename containing + 'PAL' would sometimes misdetect as a PAL ROM. + * Fixed Stelladaptor/2600'daptor devices sometimes not being assigned correct default mappings. diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 52620243e..db5850aa4 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -316,13 +316,13 @@ string Console::formatFromFilename() const { R"([ _\-(\[<]+NTSC[ _-]?50)", "NTSC50" }, { R"([ _\-(\[<]+PAL[ _-]?60)", "PAL60" }, { R"([ _\-(\[<]+SECAM[ _-]?60)", "SECAM60" }, - { R"([ _\-(\[<]+NTSC[ _\-)\]>]?)", "NTSC" }, - { R"([ _\-(\[<]+PAL[ _\-)\]>]?)", "PAL" }, - { R"([ _\-(\[<]+SECAM[ _\-)\]>]?)", "SECAM" } + { R"([ _\-(\[<]+NTSC[ _\-)\]>.])", "NTSC" }, + { R"([ _\-(\[<]+PAL[ _\-)\]>.])", "PAL" }, + { R"([ _\-(\[<]+SECAM[ _\-)\]>.])", "SECAM" } }}; - // Get filename *without* extension, and search using regex's above - const string& filename = myOSystem.romFile().getNameWithExt(""); + // Get filename, and search using regex's above + const string& filename = myOSystem.romFile().getName(); for(size_t i = 0; i < Pattern.size(); ++i) { try