diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-PR10309.patch b/packages/mediacenter/kodi/patches/kodi-999.99-PR10309.patch new file mode 100644 index 0000000000..72888acee1 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-999.99-PR10309.patch @@ -0,0 +1,135 @@ +From ee2dc577a03d86ac61e06bc95aaff1d1eddbf593 Mon Sep 17 00:00:00 2001 +From: Garrett Brown +Date: Thu, 18 Aug 2016 14:10:36 -0700 +Subject: [PATCH] Rename CPeripherals::GetAddon() to GetAddonWithButtonMap() + and move to addon bus + +--- + xbmc/peripherals/Peripherals.cpp | 26 +++++---------------- + xbmc/peripherals/Peripherals.h | 2 +- + xbmc/peripherals/addons/AddonButtonMapping.cpp | 2 +- + xbmc/peripherals/addons/AddonInputHandling.cpp | 2 +- + .../peripherals/bus/virtual/PeripheralBusAddon.cpp | 27 ++++++++++++++++++---- + 5 files changed, 31 insertions(+), 28 deletions(-) + +diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp +index 629846d..30f160e 100644 +--- a/xbmc/peripherals/Peripherals.cpp ++++ b/xbmc/peripherals/Peripherals.cpp +@@ -762,29 +762,15 @@ void CPeripherals::ProcessEvents(void) + bus->ProcessEvents(); + } + +-PeripheralAddonPtr CPeripherals::GetAddon(const CPeripheral* device) ++PeripheralAddonPtr CPeripherals::GetAddonWithButtonMap(const CPeripheral* device) + { +- PeripheralAddonPtr addon; +- + PeripheralBusAddonPtr addonBus = std::static_pointer_cast(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 +- PeripheralAddonPtr peripheralAddon; +- unsigned int index; +- if (addonBus->SplitLocation(device->Location(), addon, index)) +- addon = std::move(peripheralAddon); +- } +- else +- { +- // Otherwise, have the add-on bus find a suitable add-on +- addonBus->GetAddonWithButtonMap(device, addon); +- } +- } ++ PeripheralAddonPtr addon; ++ ++ PeripheralAddonPtr addonWithButtonMap; ++ if (addonBus && addonBus->GetAddonWithButtonMap(device, addonWithButtonMap)) ++ addon = std::move(addonWithButtonMap); + + return addon; + } +diff --git a/xbmc/peripherals/Peripherals.h b/xbmc/peripherals/Peripherals.h +index b66970d..33ca7fb 100644 +--- a/xbmc/peripherals/Peripherals.h ++++ b/xbmc/peripherals/Peripherals.h +@@ -239,7 +239,7 @@ namespace PERIPHERALS + // implementation of IEventScannerCallback + virtual void ProcessEvents(void) override; + +- virtual PeripheralAddonPtr GetAddon(const CPeripheral* device); ++ virtual PeripheralAddonPtr GetAddonWithButtonMap(const CPeripheral* device); + + virtual void ResetButtonMaps(const std::string& controllerId); + +diff --git a/xbmc/peripherals/addons/AddonButtonMapping.cpp b/xbmc/peripherals/addons/AddonButtonMapping.cpp +index 818e894..32a45c2 100644 +--- a/xbmc/peripherals/addons/AddonButtonMapping.cpp ++++ b/xbmc/peripherals/addons/AddonButtonMapping.cpp +@@ -29,7 +29,7 @@ using namespace PERIPHERALS; + + CAddonButtonMapping::CAddonButtonMapping(CPeripheral* peripheral, IButtonMapper* mapper) + { +- PeripheralAddonPtr addon = g_peripherals.GetAddon(peripheral); ++ PeripheralAddonPtr addon = g_peripherals.GetAddonWithButtonMap(peripheral); + + if (!addon) + { +diff --git a/xbmc/peripherals/addons/AddonInputHandling.cpp b/xbmc/peripherals/addons/AddonInputHandling.cpp +index 7a29c9e..89527f4 100644 +--- a/xbmc/peripherals/addons/AddonInputHandling.cpp ++++ b/xbmc/peripherals/addons/AddonInputHandling.cpp +@@ -32,7 +32,7 @@ using namespace PERIPHERALS; + + CAddonInputHandling::CAddonInputHandling(CPeripheral* peripheral, IInputHandler* handler, IDriverReceiver* receiver) + { +- PeripheralAddonPtr addon = g_peripherals.GetAddon(peripheral); ++ PeripheralAddonPtr addon = g_peripherals.GetAddonWithButtonMap(peripheral); + + if (!addon) + { +diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp +index b533686..2426285 100644 +--- a/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp ++++ b/xbmc/peripherals/bus/virtual/PeripheralBusAddon.cpp +@@ -80,15 +80,32 @@ bool CPeripheralBusAddon::GetAddon(const std::string &strId, AddonPtr &addon) co + bool CPeripheralBusAddon::GetAddonWithButtonMap(const CPeripheral* device, PeripheralAddonPtr &addon) const + { + CSingleLock lock(m_critSection); +- for (const auto& addonIt : m_addons) ++ ++ // If device is from an add-on, try to use that add-on ++ if (device && device->GetBusType() == PERIPHERAL_BUS_ADDON) + { +- if (addonIt->HasButtonMaps()) ++ PeripheralAddonPtr addonWithButtonMap; ++ unsigned int index; ++ if (SplitLocation(device->Location(), addonWithButtonMap, index)) + { +- addon = addonIt; +- return true; ++ if (addonWithButtonMap->HasButtonMaps()) ++ addon = std::move(addonWithButtonMap); + } + } +- return false; ++ ++ if (!addon) ++ { ++ auto it = std::find_if(m_addons.begin(), m_addons.end(), ++ [](const PeripheralAddonPtr& addon) ++ { ++ return addon->HasButtonMaps(); ++ }); ++ ++ if (it != m_addons.end()) ++ addon = *it; ++ } ++ ++ return addon.get() != nullptr; + } + + unsigned int CPeripheralBusAddon::GetAddonCount(void) const