Exemple #1
0
bool CPeripheralAddon::MapFeature(const CPeripheral* device,
                                  const std::string& strControllerId,
                                  const ADDON::JoystickFeature& feature)
{
  if (!m_bProvidesButtonMaps)
    return false;

  PERIPHERAL_ERROR retVal;

  ADDON::Joystick joystickInfo;
  GetJoystickInfo(device, joystickInfo);

  JOYSTICK_INFO joystickStruct;
  joystickInfo.ToStruct(joystickStruct);

  JOYSTICK_FEATURE addonFeature;
  feature.ToStruct(addonFeature);

  try { LogError(retVal = m_pStruct->MapFeatures(&joystickStruct, strControllerId.c_str(),
                                                 1, &addonFeature), "MapFeatures()"); }
  catch (std::exception &e) { LogException(e, "MapFeatures()"); return false;  }

  if (retVal == PERIPHERAL_NO_ERROR)
  {
    // Notify observing button maps
    RefreshButtonMaps(device->DeviceName());
  }

  return retVal == PERIPHERAL_NO_ERROR;
}
Exemple #2
0
bool CPeripheralAddon::MapFeature(const CPeripheral* device,
                                  const std::string& strControllerId,
                                  const ADDON::JoystickFeature& feature)
{
  if (!m_bProvidesButtonMaps)
    return false;

  PERIPHERAL_ERROR retVal;

  ADDON::Joystick joystickInfo;
  GetJoystickInfo(device, joystickInfo);

  JOYSTICK_INFO joystickStruct;
  joystickInfo.ToStruct(joystickStruct);

  JOYSTICK_FEATURE addonFeature;
  feature.ToStruct(addonFeature);

  LogError(retVal = m_pStruct->MapFeatures(&joystickStruct, strControllerId.c_str(),
                                                 1, &addonFeature), "MapFeatures()");
  return retVal == PERIPHERAL_NO_ERROR;
}