improved QuadTari fix

This commit is contained in:
thrust26 2021-03-02 19:01:50 +01:00
parent 75527ca670
commit fbf2271e73
4 changed files with 17 additions and 19 deletions

View File

@ -203,21 +203,23 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::defineControllerMappings( void PhysicalKeyboardHandler::defineControllerMappings(
const Controller::Type type, Controller::Jack port, const string& md5) const Controller::Type type, Controller::Jack port, const Properties& properties)
{ {
//const string& test = myOSystem.settings().getString("aq");
// determine controller events to use // determine controller events to use
switch(type) switch(type)
{ {
case Controller::Type::QuadTari: case Controller::Type::QuadTari:
if(port == Controller::Jack::Left) if(port == Controller::Jack::Left)
{ {
myLeftMode = getMode(md5, PropType::Controller_Left1); myLeftMode = getMode(properties, PropType::Controller_Left1);
myLeft2ndMode = getMode(md5, PropType::Controller_Left2); myLeft2ndMode = getMode(properties, PropType::Controller_Left2);
} }
else else
{ {
myRightMode = getMode(md5, PropType::Controller_Right1); myRightMode = getMode(properties, PropType::Controller_Right1);
myRight2ndMode = getMode(md5, PropType::Controller_Right2); myRight2ndMode = getMode(properties, PropType::Controller_Right2);
} }
break; break;
@ -235,17 +237,13 @@ void PhysicalKeyboardHandler::defineControllerMappings(
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalKeyboardHandler::getMode(const string& md5, const PropType propType) EventMode PhysicalKeyboardHandler::getMode(const Properties& properties, const PropType propType)
{ {
Properties properties; const string& propName = properties.get(propType);
if(myOSystem.propSet().getMD5(md5, properties)) if(!propName.empty())
{ return getMode(Controller::getType(propName));
const string& propName = properties.get(propType);
if(!propName.empty())
return getMode(Controller::getType(propName));
}
return getMode(Controller::Type::Joystick); return getMode(Controller::Type::Joystick);
} }

View File

@ -52,7 +52,7 @@ class PhysicalKeyboardHandler
/** define mappings for current controllers */ /** define mappings for current controllers */
void defineControllerMappings(const Controller::Type type, Controller::Jack port, void defineControllerMappings(const Controller::Type type, Controller::Jack port,
const string& md5); const Properties& properties);
/** enable mappings for emulation mode */ /** enable mappings for emulation mode */
void enableEmulationMappings(); void enableEmulationMappings();
@ -113,7 +113,7 @@ class PhysicalKeyboardHandler
void enableMapping(const Event::Type event, EventMode mode); void enableMapping(const Event::Type event, EventMode mode);
/** return event mode for given property */ /** return event mode for given property */
EventMode getMode(const string& md5, const PropType propType); EventMode getMode(const Properties& properties, const PropType propType);
/** return event mode for given controller type */ /** return event mode for given controller type */
EventMode getMode(const Controller::Type type); EventMode getMode(const Controller::Type type);

View File

@ -806,7 +806,7 @@ void Console::setControllers(const string& romMd5)
myLeftControl = std::move(myCMHandler->leftController()); myLeftControl = std::move(myCMHandler->leftController());
myRightControl = std::move(myCMHandler->rightController()); myRightControl = std::move(myCMHandler->rightController());
myOSystem.eventHandler().defineKeyControllerMappings( myOSystem.eventHandler().defineKeyControllerMappings(
Controller::Type::CompuMate, Controller::Jack::Left, romMd5); Controller::Type::CompuMate, Controller::Jack::Left, myProperties);
myOSystem.eventHandler().defineJoyControllerMappings( myOSystem.eventHandler().defineJoyControllerMappings(
Controller::Type::CompuMate, Controller::Jack::Left); Controller::Type::CompuMate, Controller::Jack::Left);
} }
@ -898,7 +898,7 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
{ {
unique_ptr<Controller> controller; unique_ptr<Controller> controller;
myOSystem.eventHandler().defineKeyControllerMappings(type, port, romMd5); myOSystem.eventHandler().defineKeyControllerMappings(type, port, myProperties);
myOSystem.eventHandler().defineJoyControllerMappings(type, port); myOSystem.eventHandler().defineJoyControllerMappings(type, port);
switch(type) switch(type)

View File

@ -218,8 +218,8 @@ class EventHandler
Enable controller specific keyboard event mappings. Enable controller specific keyboard event mappings.
*/ */
void defineKeyControllerMappings(const Controller::Type type, Controller::Jack port, void defineKeyControllerMappings(const Controller::Type type, Controller::Jack port,
const string& md5) { const Properties& properties) {
myPKeyHandler->defineControllerMappings(type, port, md5); myPKeyHandler->defineControllerMappings(type, port, properties);
} }
/** /**