diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index ac44b9f1d..a3ee78f39 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -713,7 +713,14 @@ void Console::setControllers(const string& rommd5) bool swapPaddles = myProperties.get(Controller_SwapPaddles) == "YES"; // Construct left controller - if(left == "BOOSTERGRIP") + if(left == "JOYSTICK") + { + // Already created in c'tor + // We save some time by not looking at all the other types + leftC = myLeftControl ? std::move(myLeftControl) : + make_ptr(Controller::Left, myEvent, *mySystem); + } + else if(left == "BOOSTERGRIP") { leftC = make_ptr(Controller::Left, myEvent, *mySystem); } @@ -757,13 +764,16 @@ void Console::setControllers(const string& rommd5) { leftC = make_ptr(Controller::Left, myEvent, *mySystem); } - else - { - leftC = make_ptr(Controller::Left, myEvent, *mySystem); - } // Construct right controller - if(right == "BOOSTERGRIP") + if(right == "JOYSTICK") + { + // Already created in c'tor + // We save some time by not looking at all the other types + rightC = myRightControl ? std::move(myRightControl) : + make_ptr(Controller::Right, myEvent, *mySystem); + } + else if(right == "BOOSTERGRIP") { rightC = make_ptr(Controller::Right, myEvent, *mySystem); } @@ -824,10 +834,6 @@ void Console::setControllers(const string& rommd5) { rightC = make_ptr(Controller::Right, myEvent, *mySystem); } - else - { - rightC = make_ptr(Controller::Right, myEvent, *mySystem); - } // Swap the ports if necessary if(myProperties.get(Console_SwapPorts) == "NO")