diff --git a/src/emucore/Bankswitch.cxx b/src/emucore/Bankswitch.cxx index d95013e5d..6779da998 100644 --- a/src/emucore/Bankswitch.cxx +++ b/src/emucore/Bankswitch.cxx @@ -33,6 +33,12 @@ Bankswitch::Type Bankswitch::nameToType(const string& name) return Bankswitch::Type::_AUTO; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +string Bankswitch::typeToDesc(Bankswitch::Type type) +{ + return BSList[int(type)].desc; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bankswitch::Type Bankswitch::typeFromExtension(const FilesystemNode& file) { @@ -100,35 +106,35 @@ Bankswitch::Description Bankswitch::BSList[int(Bankswitch::Type::NumSchemes)] = { "3E" , "3E (32K Tigervision)" }, { "3E+" , "3E+ (TJ modified DASH)" }, { "3F" , "3F (512K Tigervision)" }, - { "4A50" , "4A50 (64K 4A50 + ram)" }, + { "4A50" , "4A50 (64K 4A50 + RAM)" }, { "4K" , "4K (4K Atari)" }, - { "4KSC" , "4KSC (CPUWIZ 4K + ram)" }, + { "4KSC" , "4KSC (CPUWIZ 4K + RAM)" }, { "AR" , "AR (Supercharger)" }, { "BF" , "BF (CPUWIZ 256K)" }, - { "BFSC" , "BFSC (CPUWIZ 256K + ram)" }, + { "BFSC" , "BFSC (CPUWIZ 256K + RAM)" }, { "BUS" , "BUS (Experimental)" }, { "CDF" , "CDF (Chris, Darrell, Fred)" }, { "CM" , "CM (SpectraVideo CompuMate)" }, { "CTY" , "CTY (CDW - Chetiry)" }, - { "CV" , "CV (Commavid extra ram)" }, + { "CV" , "CV (Commavid extra RAM)" }, { "CV+" , "CV+ (Extended Commavid)" }, { "DASH" , "DASH (Experimental)" }, { "DF" , "DF (CPUWIZ 128K)" }, - { "DFSC" , "DFSC (CPUWIZ 128K + ram)" }, + { "DFSC" , "DFSC (CPUWIZ 128K + RAM)" }, { "DPC" , "DPC (Pitfall II)" }, { "DPC+" , "DPC+ (Enhanced DPC)" }, { "E0" , "E0 (8K Parker Bros)" }, { "E7" , "E7 (16K M-network)" }, { "E78K" , "E78K (8K M-network)" }, { "EF" , "EF (64K H. Runner)" }, - { "EFSC" , "EFSC (64K H. Runner + ram)" }, + { "EFSC" , "EFSC (64K H. Runner + RAM)" }, { "F0" , "F0 (Dynacom Megaboy)" }, { "F4" , "F4 (32K Atari)" }, - { "F4SC" , "F4SC (32K Atari + ram)" }, + { "F4SC" , "F4SC (32K Atari + RAM)" }, { "F6" , "F6 (16K Atari)" }, - { "F6SC" , "F6SC (16K Atari + ram)" }, + { "F6SC" , "F6SC (16K Atari + RAM)" }, { "F8" , "F8 (8K Atari)" }, - { "F8SC" , "F8SC (8K Atari + ram)" }, + { "F8SC" , "F8SC (8K Atari + RAM)" }, { "FA" , "FA (CBS RAM Plus)" }, { "FA2" , "FA2 (CBS RAM Plus 24/28K)" }, { "FC" , "FC (32K Amiga)" }, diff --git a/src/emucore/Bankswitch.hxx b/src/emucore/Bankswitch.hxx index d0aa0502f..749c07ae9 100644 --- a/src/emucore/Bankswitch.hxx +++ b/src/emucore/Bankswitch.hxx @@ -67,6 +67,9 @@ class Bankswitch // Convert string to BSType enum static Bankswitch::Type nameToType(const string& name); + // Convert BSType enum to description string + static string typeToDesc(Bankswitch::Type type); + // Determine bankswitch type by filename extension // Use '_AUTO' if unknown static Bankswitch::Type typeFromExtension(const FilesystemNode& file); diff --git a/src/emucore/CartDetector.cxx b/src/emucore/CartDetector.cxx index e7ac42cbf..d6b319ee3 100644 --- a/src/emucore/CartDetector.cxx +++ b/src/emucore/CartDetector.cxx @@ -62,6 +62,7 @@ #include "CartX07.hxx" #include "MD5.hxx" #include "Props.hxx" +#include "Logger.hxx" #include "CartDetector.hxx" @@ -535,6 +536,11 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si else if(isProbablyMDM(image, size)) type = Bankswitch::Type::_MDM; + ostringstream ss; + + ss << "Bankswitching type '" << Bankswitch::typeToDesc(type) << "' detected"; + Logger::debug(ss.str()); + return type; } diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index d9a1030a8..4d313b50d 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -824,6 +824,7 @@ void Console::setControllers(const string& romMd5) // Try to detect controllers if(image != nullptr && size != 0) { + Logger::debug(myProperties.get(PropType::Cart_Name) + ":"); leftType = ControllerDetector::detectType(image, size, leftType, !swappedPorts ? Controller::Jack::Left : Controller::Jack::Right, myOSystem.settings()); rightType = ControllerDetector::detectType(image, size, rightType, diff --git a/src/emucore/ControllerDetector.cxx b/src/emucore/ControllerDetector.cxx index 48487187e..0a78d700e 100644 --- a/src/emucore/ControllerDetector.cxx +++ b/src/emucore/ControllerDetector.cxx @@ -34,7 +34,7 @@ Controller::Type ControllerDetector::detectType(const uInt8* image, size_t size, cerr << "Controller auto-detection not consistent: " << Controller::getName(type) << ", " << Controller::getName(detectedType) << endl; } - Logger::debug(Controller::getName(detectedType) + " detected for " + + Logger::debug("'" + Controller::getName(detectedType) + "' detected for " + (port == Controller::Jack::Left ? "left" : "right") + " port"); return detectedType; } diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index 7b626411b..77ea9059a 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -394,7 +394,7 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props) if(!instance().hasConsole() && node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr) { - bsDetected = Bankswitch::typeToName(CartDetector::autodetectType(image, size)) + " detected"; + bsDetected = Bankswitch::typeToDesc(CartDetector::autodetectType(image, size)) + " detected"; } } } diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 397c8ad35..e7ec39959 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -22,6 +22,9 @@ #include "Font.hxx" #include "OSystem.hxx" #include "ControllerDetector.hxx" +#include "Bankswitch.hxx" +#include "CartDetector.hxx" +#include "Logger.hxx" #include "Props.hxx" #include "PNGLibrary.hxx" #include "Rect.hxx" @@ -132,11 +135,12 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node) myRomInfo.push_back("Note: " + myProperties.get(PropType::Cart_Note)); bool swappedPorts = myProperties.get(PropType::Console_SwapPorts) == "YES"; - // Load the image for controller auto detection + // Load the image for controller and bankswitch type auto detection string left = myProperties.get(PropType::Controller_Left); string right = myProperties.get(PropType::Controller_Right); Controller::Type leftType = Controller::getType(left); Controller::Type rightType = Controller::getType(right); + string bsDetected = myProperties.get(PropType::Cart_Type); try { ByteBuffer image; @@ -146,12 +150,15 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node) if(node.exists() && !node.isDirectory() && (image = instance().openROM(node, md5, size)) != nullptr) { + Logger::debug(myProperties.get(PropType::Cart_Name) + ":"); left = ControllerDetector::detectName(image.get(), size, leftType, !swappedPorts ? Controller::Jack::Left : Controller::Jack::Right, instance().settings()); right = ControllerDetector::detectName(image.get(), size, rightType, !swappedPorts ? Controller::Jack::Right : Controller::Jack::Left, instance().settings()); + if (bsDetected == "AUTO") + bsDetected = Bankswitch::typeToName(CartDetector::autodetectType(image, size)); } } catch(const runtime_error&) @@ -162,6 +169,8 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node) } if(left != "" && right != "") myRomInfo.push_back("Controllers: " + (left + " (left), " + right + " (right)")); + if (bsDetected != "") + myRomInfo.push_back("Type: " + Bankswitch::typeToDesc(Bankswitch::nameToType(bsDetected))); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -