Remove redundant check for controller 'Auto' type.

This commit is contained in:
Stephen Anthony 2019-03-09 20:04:51 -03:30
parent e61caf069b
commit 0e9915823d
2 changed files with 9 additions and 13 deletions

View File

@ -823,15 +823,13 @@ void Console::setControllers(const string& rommd5)
const uInt8* image = myCart->getImage(size); const uInt8* image = myCart->getImage(size);
const bool swappedPorts = myProperties.get(Console_SwapPorts) != "NO"; const bool swappedPorts = myProperties.get(Console_SwapPorts) != "NO";
// try to detect controllers // Try to detect controllers
if(image != nullptr || size != 0) if(image != nullptr || size != 0)
{ {
left = ControllerDetector::detectType(image, size, left, left = ControllerDetector::detectType(image, size, left,
!swappedPorts ? Controller::Left : Controller::Right, !swappedPorts ? Controller::Left : Controller::Right, myOSystem.settings());
myOSystem.settings());
right = ControllerDetector::detectType(image, size, right, right = ControllerDetector::detectType(image, size, right,
!swappedPorts ? Controller::Right : Controller::Left, !swappedPorts ? Controller::Right : Controller::Left, myOSystem.settings());
myOSystem.settings());
} }
unique_ptr<Controller> leftC = getControllerPort(rommd5, left, Controller::Left), unique_ptr<Controller> leftC = getControllerPort(rommd5, left, Controller::Left),

View File

@ -138,14 +138,12 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
if(node.exists() && !node.isDirectory() && if(node.exists() && !node.isDirectory() &&
(image = instance().openROM(node, md5, size)) != nullptr) (image = instance().openROM(node, md5, size)) != nullptr)
{ {
if(BSPF::equalsIgnoreCase(left, "AUTO")) left = ControllerDetector::detectName(image.get(), size, left,
left = ControllerDetector::detectName(image.get(), size, left, !swappedPorts ? Controller::Jack::Left : Controller::Jack::Right,
!swappedPorts ? Controller::Jack::Left : Controller::Jack::Right, instance().settings());
instance().settings()); right = ControllerDetector::detectName(image.get(), size, right,
if(BSPF::equalsIgnoreCase(right, "AUTO")) !swappedPorts ? Controller::Jack::Right : Controller::Jack::Left,
right = ControllerDetector::detectName(image.get(), size, right, instance().settings());
!swappedPorts ? Controller::Jack::Right : Controller::Jack::Left,
instance().settings());
} }
} }
catch(const runtime_error&) catch(const runtime_error&)