Exemplo n.º 1
0
void CGUIControllerList::RegisterController(const std::string& addonId, const ADDON::VECADDONS& addonCache)
{
  auto it = std::find_if(addonCache.begin(), addonCache.end(),
    [addonId](const AddonPtr& addon)
    {
      return addon->ID() == addonId;
    });

  if (it != addonCache.end())
  {
    ControllerPtr newController = std::dynamic_pointer_cast<CController>(*it);
    if (newController && newController->LoadLayout())
      m_controllers.push_back(newController);
  }
}
Exemplo n.º 2
0
unsigned int CAddonCallbacksPeripheral::FeatureCount(void* addonData, const char* controllerId, JOYSTICK_FEATURE_TYPE type)
{
  using namespace ADDON;
  using namespace GAME;

  unsigned int count = 0;

  AddonPtr addon;
  if (CAddonMgr::GetInstance().GetAddon(controllerId, addon, ADDON_GAME_CONTROLLER))
  {
    ControllerPtr controller = std::static_pointer_cast<CController>(addon);
    if (controller->LoadLayout())
      count = controller->Layout().FeatureCount(CPeripheralAddonTranslator::TranslateFeatureType(type));
  }

  return count;
}