minor refactoring

This commit is contained in:
Thomas Jentzsch 2019-08-16 06:54:17 +02:00
parent af84fbccc5
commit d531d8e686
4 changed files with 15 additions and 15 deletions

View File

@ -784,7 +784,7 @@ void Console::createAudioQueue()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::setControllers(const string& rommd5) void Console::setControllers(const string& romMd5)
{ {
// Check for CompuMate scheme; it is special in that a handler creates both // Check for CompuMate scheme; it is special in that a handler creates both
// controllers for us, and associates them with the bankswitching class // controllers for us, and associates them with the bankswitching class
@ -822,8 +822,8 @@ void Console::setControllers(const string& rommd5)
!swappedPorts ? Controller::Jack::Right : Controller::Jack::Left, myOSystem.settings()); !swappedPorts ? Controller::Jack::Right : Controller::Jack::Left, myOSystem.settings());
} }
unique_ptr<Controller> leftC = getControllerPort(rommd5, left, Controller::Jack::Left), unique_ptr<Controller> leftC = getControllerPort(left, Controller::Jack::Left, romMd5),
rightC = getControllerPort(rommd5, right, Controller::Jack::Right); rightC = getControllerPort(right, Controller::Jack::Right, romMd5);
// Swap the ports if necessary // Swap the ports if necessary
if(!swappedPorts) if(!swappedPorts)
@ -848,10 +848,10 @@ void Console::setControllers(const string& rommd5)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Controller> Console::getControllerPort(const string& rommd5, unique_ptr<Controller> Console::getControllerPort(const string& controllerName,
const string& controllerName, Controller::Jack port) Controller::Jack port, const string& romMd5)
{ {
unique_ptr<Controller> controller; // = std::move(myLeftControl); // TJ: why was this there? unique_ptr<Controller> controller;
myOSystem.eventHandler().defineKeyControllerMappings(controllerName, port); myOSystem.eventHandler().defineKeyControllerMappings(controllerName, port);
myOSystem.eventHandler().defineJoyControllerMappings(controllerName, port); myOSystem.eventHandler().defineJoyControllerMappings(controllerName, port);
@ -924,7 +924,7 @@ unique_ptr<Controller> Console::getControllerPort(const string& rommd5,
} }
else if(controllerName == "KIDVID") else if(controllerName == "KIDVID")
{ {
controller = make_unique<KidVid>(port, myEvent, *mySystem, rommd5); controller = make_unique<KidVid>(port, myEvent, *mySystem, romMd5);
} }
else if(controllerName == "MINDLINK") else if(controllerName == "MINDLINK")
{ {

View File

@ -85,7 +85,7 @@ class Console : public Serializable, public ConsoleIO
/** /**
Sets the left and right controllers for the console. Sets the left and right controllers for the console.
*/ */
void setControllers(const string& rommd5); void setControllers(const string& roMd5);
/** /**
Get the controller plugged into the specified jack Get the controller plugged into the specified jack
@ -339,8 +339,8 @@ class Console : public Serializable, public ConsoleIO
/** /**
Selects the left or right controller depending on ROM properties Selects the left or right controller depending on ROM properties
*/ */
unique_ptr<Controller> getControllerPort(const string& rommd5, unique_ptr<Controller> getControllerPort(const string& controllerName,
const string& controllerName, Controller::Jack port); Controller::Jack port, const string& romMd5);
/** /**
Loads a user-defined palette file (from OSystem::paletteFile), filling the Loads a user-defined palette file (from OSystem::paletteFile), filling the

View File

@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KidVid::KidVid(Jack jack, const Event& event, const System& system, KidVid::KidVid(Jack jack, const Event& event, const System& system,
const string& rommd5) const string& romMd5)
: Controller(jack, event, system, Controller::Type::KidVid), : Controller(jack, event, system, Controller::Type::KidVid),
myEnabled(myJack == Jack::Right), myEnabled(myJack == Jack::Right),
// mySampleFile(nullptr), // mySampleFile(nullptr),
@ -41,9 +41,9 @@ KidVid::KidVid(Jack jack, const Event& event, const System& system,
myBlockIdx(0) myBlockIdx(0)
{ {
// Right now, there are only two games that use the KidVid // Right now, there are only two games that use the KidVid
if(rommd5 == "ee6665683ebdb539e89ba620981cb0f6") if(romMd5 == "ee6665683ebdb539e89ba620981cb0f6")
myGame = KVBBEARS; // Berenstain Bears myGame = KVBBEARS; // Berenstain Bears
else if(rommd5 == "a204cd4fb1944c86e800120706512a64") else if(romMd5 == "a204cd4fb1944c86e800120706512a64")
myGame = KVSMURFS; // Smurfs Save the Day myGame = KVSMURFS; // Smurfs Save the Day
else else
myEnabled = false; myEnabled = false;

View File

@ -45,10 +45,10 @@ class KidVid : public Controller
@param jack The jack the controller is plugged into @param jack The jack the controller is plugged into
@param event The event object to use for events @param event The event object to use for events
@param system The system using this controller @param system The system using this controller
@param md5sum The md5 of the ROM using this controller @param romMd5 The md5 of the ROM using this controller
*/ */
KidVid(Jack jack, const Event& event, const System& system, KidVid(Jack jack, const Event& event, const System& system,
const string& md5sum); const string& romMd5);
virtual ~KidVid(); virtual ~KidVid();
public: public: