Exemplo n.º 1
0
PeripheralAddonPtr CPeripherals::GetAddonWithButtonMap(const CPeripheral* device)
{
  PeripheralBusAddonPtr addonBus = std::static_pointer_cast<CPeripheralBusAddon>(GetBusByType(PERIPHERAL_BUS_ADDON));

  PeripheralAddonPtr addon;

  PeripheralAddonPtr addonWithButtonMap;
  if (addonBus && addonBus->GetAddonWithButtonMap(device, addonWithButtonMap))
    addon = std::move(addonWithButtonMap);

  return addon;
}
Exemplo n.º 2
0
void CPeripherals::ResetButtonMaps(const std::string& controllerId)
{
  PeripheralBusAddonPtr addonBus = std::static_pointer_cast<CPeripheralBusAddon>(GetBusByType(PERIPHERAL_BUS_ADDON));

  PeripheralVector peripherals;
  GetPeripheralsWithFeature(peripherals, FEATURE_JOYSTICK);

  for (auto& peripheral : peripherals)
  {
    PeripheralAddonPtr addon;
    if (addonBus->GetAddonWithButtonMap(peripheral.get(), addon))
    {
      CAddonButtonMap buttonMap(peripheral.get(), addon, controllerId);
      buttonMap.Reset();
    }
  }
}
Exemplo n.º 3
0
PeripheralAddonPtr CPeripherals::GetAddon(const CPeripheral* device)
{
  PeripheralAddonPtr addon;

  PeripheralBusAddonPtr addonBus = std::static_pointer_cast<CPeripheralBusAddon>(GetBusByType(PERIPHERAL_BUS_ADDON));
  if (device && addonBus)
  {
    PeripheralBusType busType = device->GetBusType();

    if (busType == PERIPHERAL_BUS_ADDON)
    {
      // If device is from an add-on, use that add-on
      unsigned int index;
      addonBus->SplitLocation(device->Location(), addon, index);
    }
    else
    {
      // Otherwise, have the add-on bus find a suitable add-on
      addonBus->GetAddonWithButtonMap(device, addon);
    }
  }

  return addon;
}