diff --git a/src/buttonmapper/ControllerTransformer.cpp b/src/buttonmapper/ControllerTransformer.cpp index d7dff96c..722d7da3 100644 --- a/src/buttonmapper/ControllerTransformer.cpp +++ b/src/buttonmapper/ControllerTransformer.cpp @@ -46,25 +46,12 @@ void CControllerTransformer::OnAdd(const DevicePtr& driverInfo, const ButtonMap& else return; - const std::string& familyName = m_familyManager.GetFamily(driverInfo->Name(), driverInfo->Provider()); - - CJoystickFamily family(familyName); - CDriverGeometry geometry(driverInfo->ButtonCount(), - driverInfo->HatCount(), - driverInfo->AxisCount()); - - CControllerModel& familyModel = m_familyModels[family]; - CControllerModel& geometryModel = m_geometryModels[geometry]; - for (auto itTo = buttonMap.begin(); itTo != buttonMap.end(); ++itTo) { // Only allow controller map items where "from" compares before "to" for (auto itFrom = buttonMap.begin(); itFrom->first < itTo->first; ++itFrom) { - if (family.IsValid()) - AddControllerMap(familyModel, itFrom->first, itFrom->second, itTo->first, itTo->second); - if (geometry.IsValid()) - AddControllerMap(geometryModel, itFrom->first, itFrom->second, itTo->first, itTo->second); + AddControllerMap(m_controllerModel, itFrom->first, itFrom->second, itTo->first, itTo->second); } } } @@ -143,17 +130,7 @@ void CControllerTransformer::TransformFeatures(const ADDON::Joystick& driverInfo ControllerMapItem needle = { bSwap ? toController : fromController, bSwap ? fromController : toController }; - const std::string& familyName = m_familyManager.GetFamily(driverInfo.Name(), driverInfo.Provider()); - - CJoystickFamily family(familyName); - CDriverGeometry geometry(driverInfo.ButtonCount(), - driverInfo.HatCount(), - driverInfo.AxisCount()); - - CControllerModel& familyModel = m_familyModels[family]; - CControllerModel& geometryModel = m_geometryModels[geometry]; - - std::array models = { &familyModel, &geometryModel }; + std::array models = { &m_controllerModel }; for (CControllerModel* model : models) { diff --git a/src/buttonmapper/ControllerTransformer.h b/src/buttonmapper/ControllerTransformer.h index ceb35a7a..5a381df7 100644 --- a/src/buttonmapper/ControllerTransformer.h +++ b/src/buttonmapper/ControllerTransformer.h @@ -56,11 +56,7 @@ namespace JOYSTICK const std::string& controllerFrom, const FeatureVector& featuresFrom, const std::string& controllerTo, const FeatureVector& featuresTo); - typedef std::map FamilyMap; - typedef std::map GeomoetryMap; - - FamilyMap m_familyModels; - GeomoetryMap m_geometryModels; + CControllerModel m_controllerModel; DeviceSet m_observedDevices; CJoystickFamilyManager& m_familyManager; };