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(
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
switch(type)
{
case Controller::Type::QuadTari:
if(port == Controller::Jack::Left)
{
myLeftMode = getMode(md5, PropType::Controller_Left1);
myLeft2ndMode = getMode(md5, PropType::Controller_Left2);
myLeftMode = getMode(properties, PropType::Controller_Left1);
myLeft2ndMode = getMode(properties, PropType::Controller_Left2);
}
else
{
myRightMode = getMode(md5, PropType::Controller_Right1);
myRight2ndMode = getMode(md5, PropType::Controller_Right2);
myRightMode = getMode(properties, PropType::Controller_Right1);
myRight2ndMode = getMode(properties, PropType::Controller_Right2);
}
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))
{
const string& propName = properties.get(propType);
if(!propName.empty())
return getMode(Controller::getType(propName));
if(!propName.empty())
return getMode(Controller::getType(propName));
}
return getMode(Controller::Type::Joystick);
}

View File

@ -52,7 +52,7 @@ class PhysicalKeyboardHandler
/** define mappings for current controllers */
void defineControllerMappings(const Controller::Type type, Controller::Jack port,
const string& md5);
const Properties& properties);
/** enable mappings for emulation mode */
void enableEmulationMappings();
@ -113,7 +113,7 @@ class PhysicalKeyboardHandler
void enableMapping(const Event::Type event, EventMode mode);
/** 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 */
EventMode getMode(const Controller::Type type);

View File

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

View File

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