diff options
author | fuzzard <fuzzard@kodi.tv> | 2020-11-04 15:47:04 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2021-05-19 12:19:27 +1000 |
commit | 228895cedc09a9203ea930959541aefb268987ac (patch) | |
tree | 83be26f2ae56acce74dfce3c570ebbf6d690cd21 | |
parent | ad4fb7fa0745985280ffb3a3c154621144501804 (diff) |
[Darwin][Input] Extend GCController support to osx
-rw-r--r-- | cmake/scripts/osx/ArchSetup.cmake | 3 | ||||
-rw-r--r-- | cmake/treedata/darwin_embedded/subdirs.txt | 2 | ||||
-rw-r--r-- | cmake/treedata/osx/subdirs.txt | 1 | ||||
-rw-r--r-- | xbmc/peripherals/PeripheralTypes.h | 16 | ||||
-rw-r--r-- | xbmc/peripherals/Peripherals.cpp | 10 | ||||
-rw-r--r-- | xbmc/platform/darwin/ios-common/peripherals/CMakeLists.txt | 10 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/CMakeLists.txt | 10 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/InputKey.h (renamed from xbmc/platform/darwin/ios-common/peripherals/InputKey.h) | 0 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/Input_Gamecontroller.h (renamed from xbmc/platform/darwin/ios-common/peripherals/Input_Gamecontroller.h) | 6 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm (renamed from xbmc/platform/darwin/ios-common/peripherals/Input_Gamecontroller.mm) | 24 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/PeripheralBusGCController.h (renamed from xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.h) | 12 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/PeripheralBusGCController.mm (renamed from xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.mm) | 80 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/PeripheralBusGCControllerManager.h (renamed from xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.h) | 10 | ||||
-rw-r--r-- | xbmc/platform/darwin/peripherals/PeripheralBusGCControllerManager.mm (renamed from xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.mm) | 18 |
14 files changed, 101 insertions, 101 deletions
diff --git a/cmake/scripts/osx/ArchSetup.cmake b/cmake/scripts/osx/ArchSetup.cmake index f723aa24c4..8dc3907eac 100644 --- a/cmake/scripts/osx/ArchSetup.cmake +++ b/cmake/scripts/osx/ArchSetup.cmake @@ -35,7 +35,8 @@ list(APPEND DEPLIBS "-framework DiskArbitration" "-framework IOKit" "-framework ApplicationServices" "-framework AppKit" "-framework CoreAudio" "-framework AudioToolbox" "-framework CoreGraphics" "-framework CoreMedia" - "-framework VideoToolbox" "-framework Security") + "-framework VideoToolbox" "-framework Security" + "-framework GameController") set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13) set(CMAKE_XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME OFF) diff --git a/cmake/treedata/darwin_embedded/subdirs.txt b/cmake/treedata/darwin_embedded/subdirs.txt index 718c5c59bc..20bfa02a70 100644 --- a/cmake/treedata/darwin_embedded/subdirs.txt +++ b/cmake/treedata/darwin_embedded/subdirs.txt @@ -5,8 +5,8 @@ xbmc/input/touch/generic input/touch/generic xbmc/platform/darwin platform/darwin xbmc/platform/darwin/ios-common platform/ios-common xbmc/platform/darwin/ios-common/network platform/ios-common/network -xbmc/platform/darwin/ios-common/peripherals platform/ios-common/peripherals xbmc/platform/darwin/ios-common/storage platform/ios-common/storage +xbmc/platform/darwin/peripherals platform/darwin/peripherals xbmc/platform/darwin/network platform/darwin/network xbmc/platform/darwin/utils platform/darwin/utils xbmc/platform/posix posix diff --git a/cmake/treedata/osx/subdirs.txt b/cmake/treedata/osx/subdirs.txt index fa28aa0efb..fea7db61a4 100644 --- a/cmake/treedata/osx/subdirs.txt +++ b/cmake/treedata/osx/subdirs.txt @@ -7,6 +7,7 @@ xbmc/platform/darwin/osx/network platform/darwin/osx/network xbmc/platform/darwin/osx/peripherals platform/osx/peripherals xbmc/platform/darwin/osx/powermanagement platform/darwin/osx/powermanagement xbmc/platform/darwin/osx/storage platform/osx/storage +xbmc/platform/darwin/peripherals platform/darwin/peripherals xbmc/platform/darwin/utils platform/darwin/utils xbmc/platform/posix posix xbmc/platform/posix/filesystem platform/posix/filesystem diff --git a/xbmc/peripherals/PeripheralTypes.h b/xbmc/peripherals/PeripheralTypes.h index 74994774b2..425ac0f930 100644 --- a/xbmc/peripherals/PeripheralTypes.h +++ b/xbmc/peripherals/PeripheralTypes.h @@ -33,8 +33,8 @@ enum PeripheralBusType #ifdef TARGET_ANDROID PERIPHERAL_BUS_ANDROID, #endif -#if defined(TARGET_DARWIN_EMBEDDED) - PERIPHERAL_BUS_DARWINEMBEDDED, +#if defined(TARGET_DARWIN) + PERIPHERAL_BUS_GCCONTROLLER, #endif PERIPHERAL_BUS_APPLICATION, }; @@ -190,9 +190,9 @@ public: case PERIPHERAL_BUS_ANDROID: return "android"; #endif -#if defined(TARGET_DARWIN_EMBEDDED) - case PERIPHERAL_BUS_DARWINEMBEDDED: - return "darwin_embedded"; +#if defined(TARGET_DARWIN) + case PERIPHERAL_BUS_GCCONTROLLER: + return "darwin_gccontroller"; #endif case PERIPHERAL_BUS_APPLICATION: return "application"; @@ -218,9 +218,9 @@ public: else if (strTypeLowerCase == "android") return PERIPHERAL_BUS_ANDROID; #endif -#if defined(TARGET_DARWIN_EMBEDDED) - else if (strTypeLowerCase == "darwin_embedded") - return PERIPHERAL_BUS_DARWINEMBEDDED; +#if defined(TARGET_DARWIN) + else if (strTypeLowerCase == "darwin_gccontroller") + return PERIPHERAL_BUS_GCCONTROLLER; #endif else if (strTypeLowerCase == "application") return PERIPHERAL_BUS_APPLICATION; diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index 7062abfe8f..8465f20429 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -20,8 +20,8 @@ #include <utility> #if defined(TARGET_ANDROID) #include "platform/android/peripherals/PeripheralBusAndroid.h" -#elif defined(TARGET_DARWIN_EMBEDDED) -#include "platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.h" +#elif defined(TARGET_DARWIN) +#include "platform/darwin/peripherals/PeripheralBusGCController.h" #endif #include "FileItem.h" #include "GUIUserMessages.h" @@ -100,7 +100,6 @@ void CPeripherals::Initialise() { Clear(); -#if !defined(TARGET_DARWIN_TVOS) CDirectory::Create("special://profile/peripheral_data"); /* load mappings from peripherals.xml */ @@ -117,8 +116,8 @@ void CPeripherals::Initialise() busses.push_back(std::make_shared<CPeripheralBusAddon>(*this)); #if defined(TARGET_ANDROID) busses.push_back(std::make_shared<CPeripheralBusAndroid>(*this)); -#elif defined(TARGET_DARWIN_EMBEDDED) - busses.push_back(std::make_shared<CPeripheralBusDarwinEmbedded>(*this)); +#elif defined(TARGET_DARWIN) + busses.push_back(std::make_shared<CPeripheralBusGCController>(*this)); #endif busses.push_back(std::make_shared<CPeripheralBusApplication>(*this)); @@ -135,7 +134,6 @@ void CPeripherals::Initialise() MESSAGING::CApplicationMessenger::GetInstance().RegisterReceiver(this); CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this); -#endif } void CPeripherals::Clear() diff --git a/xbmc/platform/darwin/ios-common/peripherals/CMakeLists.txt b/xbmc/platform/darwin/ios-common/peripherals/CMakeLists.txt deleted file mode 100644 index f9adab7de1..0000000000 --- a/xbmc/platform/darwin/ios-common/peripherals/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -set(SOURCES Input_Gamecontroller.mm - PeripheralBusDarwinEmbedded.mm - PeripheralBusDarwinEmbeddedManager.mm) - -set(HEADERS Input_Gamecontroller.h - InputKey.h - PeripheralBusDarwinEmbedded.h - PeripheralBusDarwinEmbeddedManager.h) - -core_add_library(platform_darwinembedded_peripherals) diff --git a/xbmc/platform/darwin/peripherals/CMakeLists.txt b/xbmc/platform/darwin/peripherals/CMakeLists.txt new file mode 100644 index 0000000000..a91f19fc51 --- /dev/null +++ b/xbmc/platform/darwin/peripherals/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCES Input_Gamecontroller.mm + PeripheralBusGCController.mm + PeripheralBusGCControllerManager.mm) + +set(HEADERS Input_Gamecontroller.h + InputKey.h + PeripheralBusGCController.h + PeripheralBusGCControllerManager.h) + +core_add_library(platform_darwin_peripherals) diff --git a/xbmc/platform/darwin/ios-common/peripherals/InputKey.h b/xbmc/platform/darwin/peripherals/InputKey.h index 9afaa661a7..9afaa661a7 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/InputKey.h +++ b/xbmc/platform/darwin/peripherals/InputKey.h diff --git a/xbmc/platform/darwin/ios-common/peripherals/Input_Gamecontroller.h b/xbmc/platform/darwin/peripherals/Input_Gamecontroller.h index 8ca0407f24..138c7f7837 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/Input_Gamecontroller.h +++ b/xbmc/platform/darwin/peripherals/Input_Gamecontroller.h @@ -12,11 +12,11 @@ #import <Foundation/Foundation.h> enum class GCCONTROLLER_TYPE; -@class CBPeripheralBusDarwinEmbeddedManager; +@class CBPeripheralBusGCControllerManager; -@interface Input_IOSGamecontroller : NSObject +@interface Input_GCController : NSObject -- (instancetype)initWithName:(CBPeripheralBusDarwinEmbeddedManager*)callbackManager; +- (instancetype)initWithName:(CBPeripheralBusGCControllerManager*)callbackManager; - (PERIPHERALS::PeripheralScanResults)GetGCDevices; - (GCCONTROLLER_TYPE)GetGCControllerType:(int)deviceID; - (int)checkOptionalButtons:(int)deviceID; diff --git a/xbmc/platform/darwin/ios-common/peripherals/Input_Gamecontroller.mm b/xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm index 2f389fcdb5..001b4396ec 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/Input_Gamecontroller.mm +++ b/xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm @@ -13,8 +13,8 @@ #include "threads/SingleLock.h" #include "utils/log.h" -#import "platform/darwin/ios-common/peripherals/InputKey.h" -#import "platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.h" +#import "platform/darwin/peripherals/InputKey.h" +#import "platform/darwin/peripherals/PeripheralBusGCControllerManager.h" #import <Foundation/Foundation.h> #import <GameController/GCController.h> @@ -37,12 +37,12 @@ struct PlayerControllerState BOOL RightThumbDownPressed; }; -@implementation Input_IOSGamecontroller +@implementation Input_GCController { NSMutableArray* controllerArray; // State for each controller struct PlayerControllerState controllerState[4]; - CBPeripheralBusDarwinEmbeddedManager* cbmanager; + CBPeripheralBusGCControllerManager* cbmanager; CCriticalSection m_GCMutex; CCriticalSection m_controllerMutex; } @@ -155,14 +155,14 @@ struct PlayerControllerState CLog::Log(LOGDEBUG, "INPUT - GAMECONTROLLER: microGamepad changehandler added"); [self microValueChangeHandler:controller]; } - if (@available(iOS 13.0, tvOS 13.0, *)) + if (@available(iOS 13.0, tvOS 13.0, macOS 10.15, *)) { // Do Nothing - Cant negate @available } else { - // pausevaluechangehandler only required for <= *os12 - CLog::Log(LOGDEBUG, "INPUT - GAMECONTROLLER: <= *OS12 pauseValueChangeHandler added"); + // pausevaluechangehandler only required for <= *os12/macos10.14 + CLog::Log(LOGDEBUG, "INPUT - GAMECONTROLLER: pauseValueChangeHandler added"); [self pauseValueChangeHandler:controller]; } } @@ -395,7 +395,7 @@ struct PlayerControllerState withAxis:GCCONTROLLER_EXTENDED_GAMEPAD_AXIS::RIGHT withplayerIndex:playerIndex]; } - if (@available(iOS 12.1, tvOS 12.1, *)) + if (@available(iOS 12.1, tvOS 12.1, macOS 10.14.1, *)) { // Left Thumbstick Button if (gamepad.leftThumbstickButton == element) @@ -521,8 +521,8 @@ struct PlayerControllerState else peripheralScanResult.m_strDeviceName = "Unknown Gamepad"; - peripheralScanResult.m_busType = PERIPHERALS::PERIPHERAL_BUS_DARWINEMBEDDED; - peripheralScanResult.m_mappedBusType = PERIPHERALS::PERIPHERAL_BUS_DARWINEMBEDDED; + peripheralScanResult.m_busType = PERIPHERALS::PERIPHERAL_BUS_GCCONTROLLER; + peripheralScanResult.m_mappedBusType = PERIPHERALS::PERIPHERAL_BUS_GCCONTROLLER; peripheralScanResult.m_iSequence = 0; scanresults.m_results.push_back(peripheralScanResult); } @@ -566,7 +566,7 @@ struct PlayerControllerState [controller.extendedGamepad performSelector:@selector(buttonOptions)] != nil) ++optionalButtonCount; - if (@available(iOS 12.1, tvOS 12.1, *)) + if (@available(iOS 12.1, tvOS 12.1, macOS 10.14.1, *)) { if (controller.extendedGamepad.leftThumbstickButton) ++optionalButtonCount; @@ -577,7 +577,7 @@ struct PlayerControllerState return optionalButtonCount; } -- (instancetype)initWithName:(CBPeripheralBusDarwinEmbeddedManager*)callbackManager +- (instancetype)initWithName:(CBPeripheralBusGCControllerManager*)callbackManager { self = [super init]; if (!self) diff --git a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.h b/xbmc/platform/darwin/peripherals/PeripheralBusGCController.h index c0227f0bd7..128417df1a 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.h +++ b/xbmc/platform/darwin/peripherals/PeripheralBusGCController.h @@ -18,15 +18,15 @@ #include <utility> #include <vector> -struct PeripheralBusDarwinEmbeddedWrapper; +struct PeripheralBusGCControllerWrapper; namespace PERIPHERALS { -class CPeripheralBusDarwinEmbedded : public CPeripheralBus +class CPeripheralBusGCController : public CPeripheralBus { public: - explicit CPeripheralBusDarwinEmbedded(CPeripherals& manager); - ~CPeripheralBusDarwinEmbedded() override; + explicit CPeripheralBusGCController(CPeripherals& manager); + ~CPeripheralBusGCController() override; // specialisation of CPeripheralBus bool InitializeProperties(CPeripheral& peripheral) override; @@ -44,14 +44,14 @@ public: const std::string& getDeviceLocationPrefix() { // Initialize the static variable - static std::string DeviceLocationPrefix("darwinembedded/inputdevice/"); + static std::string DeviceLocationPrefix("darwin/inputdevice/"); return DeviceLocationPrefix; } private: void GetEvents(std::vector<kodi::addon::PeripheralEvent>& events); - std::unique_ptr<PeripheralBusDarwinEmbeddedWrapper> m_peripheralDarwinEmbedded; + std::unique_ptr<PeripheralBusGCControllerWrapper> m_peripheralGCController; std::string GetDeviceLocation(int deviceId); bool GetDeviceId(const std::string& deviceLocation, int& deviceId); diff --git a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.mm b/xbmc/platform/darwin/peripherals/PeripheralBusGCController.mm index abdd4dac93..7034ff89e4 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.mm +++ b/xbmc/platform/darwin/peripherals/PeripheralBusGCController.mm @@ -6,7 +6,7 @@ * See LICENSES/README.md for more information. */ -#include "PeripheralBusDarwinEmbedded.h" +#include "PeripheralBusGCController.h" #include "ServiceBroker.h" #include "addons/kodi-dev-kit/include/kodi/addon-instance/peripheral/PeripheralUtils.h" @@ -16,33 +16,33 @@ #include "threads/SingleLock.h" #include "utils/log.h" -#include "platform/darwin/ios-common/peripherals/InputKey.h" -#import "platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.h" +#include "platform/darwin/peripherals/InputKey.h" +#import "platform/darwin/peripherals/PeripheralBusGCControllerManager.h" -#define JOYSTICK_PROVIDER_DARWINEMBEDDED "darwinembedded" +#define JOYSTICK_PROVIDER_DARWIN_GCController "GCController" -struct PeripheralBusDarwinEmbeddedWrapper +struct PeripheralBusGCControllerWrapper { - CBPeripheralBusDarwinEmbeddedManager* callbackClass; + CBPeripheralBusGCControllerManager* callbackClass; }; -PERIPHERALS::CPeripheralBusDarwinEmbedded::CPeripheralBusDarwinEmbedded(CPeripherals& manager) - : CPeripheralBus("PeripBusDarwinEmbedded", manager, PERIPHERAL_BUS_DARWINEMBEDDED) +PERIPHERALS::CPeripheralBusGCController::CPeripheralBusGCController(CPeripherals& manager) + : CPeripheralBus("PeripBusGCController", manager, PERIPHERAL_BUS_GCCONTROLLER) { - m_peripheralDarwinEmbedded = std::make_unique<PeripheralBusDarwinEmbeddedWrapper>(); - m_peripheralDarwinEmbedded->callbackClass = - [[CBPeripheralBusDarwinEmbeddedManager alloc] initWithName:this]; + m_peripheralGCController = std::make_unique<PeripheralBusGCControllerWrapper>(); + m_peripheralGCController->callbackClass = + [[CBPeripheralBusGCControllerManager alloc] initWithName:this]; m_bNeedsPolling = false; // get all currently connected input devices m_scanResults = GetInputDevices(); } -PERIPHERALS::CPeripheralBusDarwinEmbedded::~CPeripheralBusDarwinEmbedded() +PERIPHERALS::CPeripheralBusGCController::~CPeripheralBusGCController() { } -bool PERIPHERALS::CPeripheralBusDarwinEmbedded::InitializeProperties(CPeripheral& peripheral) +bool PERIPHERALS::CPeripheralBusGCController::InitializeProperties(CPeripheral& peripheral) { // Returns true regardless, why is it necessary? if (!CPeripheralBus::InitializeProperties(peripheral)) @@ -50,7 +50,7 @@ bool PERIPHERALS::CPeripheralBusDarwinEmbedded::InitializeProperties(CPeripheral if (peripheral.Type() != PERIPHERALS::PERIPHERAL_JOYSTICK) { - CLog::Log(LOGWARNING, "CPeripheralBusDarwinEmbedded: invalid peripheral type: %s", + CLog::Log(LOGWARNING, "CPeripheralBusGCController: invalid peripheral type: %s", PERIPHERALS::PeripheralTypeTranslator::TypeToString(peripheral.Type())); return false; } @@ -60,59 +60,59 @@ bool PERIPHERALS::CPeripheralBusDarwinEmbedded::InitializeProperties(CPeripheral if (!GetDeviceId(peripheral.Location(), deviceId)) { CLog::Log(LOGWARNING, - "CPeripheralBusDarwinEmbedded: failed to initialize properties for peripheral \"%s\"", + "CPeripheralBusGCController: failed to initialize properties for peripheral \"%s\"", peripheral.Location().c_str()); return false; } - CLog::Log(LOGDEBUG, "CPeripheralBusDarwinEmbedded: Initializing device \"{}\"", + CLog::Log(LOGDEBUG, "CPeripheralBusGCController: Initializing device \"{}\"", peripheral.DeviceName()); auto& joystick = static_cast<CPeripheralJoystick&>(peripheral); joystick.SetRequestedPort(deviceId); - joystick.SetProvider(JOYSTICK_PROVIDER_DARWINEMBEDDED); + joystick.SetProvider(JOYSTICK_PROVIDER_DARWIN_GCController); - auto controllerType = [m_peripheralDarwinEmbedded->callbackClass GetControllerType:deviceId]; + auto controllerType = [m_peripheralGCController->callbackClass GetControllerType:deviceId]; switch (controllerType) { case GCCONTROLLER_TYPE::EXTENDED: // Extended Gamepad - joystick.SetButtonCount([m_peripheralDarwinEmbedded->callbackClass + joystick.SetButtonCount([m_peripheralGCController->callbackClass GetControllerButtonCount:deviceId withControllerType:controllerType]); - joystick.SetAxisCount([m_peripheralDarwinEmbedded->callbackClass + joystick.SetAxisCount([m_peripheralGCController->callbackClass GetControllerAxisCount:deviceId withControllerType:controllerType]); break; case GCCONTROLLER_TYPE::MICRO: // Micro Gamepad - joystick.SetButtonCount([m_peripheralDarwinEmbedded->callbackClass + joystick.SetButtonCount([m_peripheralGCController->callbackClass GetControllerButtonCount:deviceId withControllerType:controllerType]); - joystick.SetAxisCount([m_peripheralDarwinEmbedded->callbackClass + joystick.SetAxisCount([m_peripheralGCController->callbackClass GetControllerAxisCount:deviceId withControllerType:controllerType]); break; default: - CLog::Log(LOGDEBUG, "CPeripheralBusDarwinEmbedded: Unknown Controller Type"); + CLog::Log(LOGDEBUG, "CPeripheralBusGCController: Unknown Controller Type"); return false; } - CLog::Log(LOGDEBUG, "CPeripheralBusDarwinEmbedded: Device has %u buttons and %u axes", + CLog::Log(LOGDEBUG, "CPeripheralBusGCController: Device has %u buttons and %u axes", joystick.ButtonCount(), joystick.AxisCount()); return true; } -void PERIPHERALS::CPeripheralBusDarwinEmbedded::Initialise(void) +void PERIPHERALS::CPeripheralBusGCController::Initialise(void) { CPeripheralBus::Initialise(); TriggerDeviceScan(); } -bool PERIPHERALS::CPeripheralBusDarwinEmbedded::PerformDeviceScan(PeripheralScanResults& results) +bool PERIPHERALS::CPeripheralBusGCController::PerformDeviceScan(PeripheralScanResults& results) { CSingleLock lock(m_critSectionResults); results = m_scanResults; @@ -120,30 +120,30 @@ bool PERIPHERALS::CPeripheralBusDarwinEmbedded::PerformDeviceScan(PeripheralScan return true; } -void PERIPHERALS::CPeripheralBusDarwinEmbedded::SetScanResults( +void PERIPHERALS::CPeripheralBusGCController::SetScanResults( const PERIPHERALS::PeripheralScanResults& resScanResults) { CSingleLock lock(m_critSectionResults); m_scanResults = resScanResults; } -void PERIPHERALS::CPeripheralBusDarwinEmbedded::GetEvents( +void PERIPHERALS::CPeripheralBusGCController::GetEvents( std::vector<kodi::addon::PeripheralEvent>& events) { CSingleLock lock(m_critSectionStates); std::vector<kodi::addon::PeripheralEvent> digitalEvents; - digitalEvents = [m_peripheralDarwinEmbedded->callbackClass GetButtonEvents]; + digitalEvents = [m_peripheralGCController->callbackClass GetButtonEvents]; std::vector<kodi::addon::PeripheralEvent> axisEvents; - axisEvents = [m_peripheralDarwinEmbedded->callbackClass GetAxisEvents]; + axisEvents = [m_peripheralGCController->callbackClass GetAxisEvents]; events.reserve(digitalEvents.size() + axisEvents.size()); // preallocate memory events.insert(events.end(), digitalEvents.begin(), digitalEvents.end()); events.insert(events.end(), axisEvents.begin(), axisEvents.end()); } -bool PERIPHERALS::CPeripheralBusDarwinEmbedded::GetDeviceId(const std::string& deviceLocation, - int& deviceId) +bool PERIPHERALS::CPeripheralBusGCController::GetDeviceId(const std::string& deviceLocation, + int& deviceId) { if (deviceLocation.empty() || !StringUtils::StartsWith(deviceLocation, getDeviceLocationPrefix()) || @@ -158,7 +158,7 @@ bool PERIPHERALS::CPeripheralBusDarwinEmbedded::GetDeviceId(const std::string& d return true; } -void PERIPHERALS::CPeripheralBusDarwinEmbedded::ProcessEvents() +void PERIPHERALS::CPeripheralBusGCController::ProcessEvents() { std::vector<kodi::addon::PeripheralEvent> events; { @@ -202,24 +202,24 @@ void PERIPHERALS::CPeripheralBusDarwinEmbedded::ProcessEvents() } } -std::string PERIPHERALS::CPeripheralBusDarwinEmbedded::GetDeviceLocation(int deviceId) +std::string PERIPHERALS::CPeripheralBusGCController::GetDeviceLocation(int deviceId) { - return [m_peripheralDarwinEmbedded->callbackClass GetDeviceLocation:deviceId]; + return [m_peripheralGCController->callbackClass GetDeviceLocation:deviceId]; } -PERIPHERALS::PeripheralScanResults PERIPHERALS::CPeripheralBusDarwinEmbedded::GetInputDevices() +PERIPHERALS::PeripheralScanResults PERIPHERALS::CPeripheralBusGCController::GetInputDevices() { - CLog::Log(LOGINFO, "CPeripheralBusDarwinEmbedded: scanning for input devices..."); + CLog::Log(LOGINFO, "CPeripheralBusGCController: scanning for input devices..."); - return [m_peripheralDarwinEmbedded->callbackClass GetInputDevices]; + return [m_peripheralGCController->callbackClass GetInputDevices]; } -void PERIPHERALS::CPeripheralBusDarwinEmbedded::callOnDeviceAdded(const std::string& strLocation) +void PERIPHERALS::CPeripheralBusGCController::callOnDeviceAdded(const std::string& strLocation) { OnDeviceAdded(strLocation); } -void PERIPHERALS::CPeripheralBusDarwinEmbedded::callOnDeviceRemoved(const std::string& strLocation) +void PERIPHERALS::CPeripheralBusGCController::callOnDeviceRemoved(const std::string& strLocation) { OnDeviceRemoved(strLocation); } diff --git a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.h b/xbmc/platform/darwin/peripherals/PeripheralBusGCControllerManager.h index 2da2ef3765..2232ad1b81 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.h +++ b/xbmc/platform/darwin/peripherals/PeripheralBusGCControllerManager.h @@ -10,19 +10,19 @@ #include "peripherals/PeripheralTypes.h" #include "threads/CriticalSection.h" -#import "platform/darwin/ios-common/peripherals/Input_Gamecontroller.h" -#include "platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.h" +#import "platform/darwin/peripherals/Input_Gamecontroller.h" +#include "platform/darwin/peripherals/PeripheralBusGCController.h" #include <string> #include <vector> #import <Foundation/Foundation.h> -@interface CBPeripheralBusDarwinEmbeddedManager : NSObject +@interface CBPeripheralBusGCControllerManager : NSObject -@property(nonatomic, strong) Input_IOSGamecontroller* input_GC; +@property(nonatomic, strong) Input_GCController* input_GC; -- (instancetype)initWithName:(PERIPHERALS::CPeripheralBusDarwinEmbedded*)parentClass; +- (instancetype)initWithName:(PERIPHERALS::CPeripheralBusGCController*)parentClass; - (PERIPHERALS::PeripheralScanResults)GetInputDevices; - (void)DeviceAdded:(int)deviceID; - (void)DeviceRemoved:(int)deviceID; diff --git a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.mm b/xbmc/platform/darwin/peripherals/PeripheralBusGCControllerManager.mm index 82973ba29f..8281e8daba 100644 --- a/xbmc/platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbeddedManager.mm +++ b/xbmc/platform/darwin/peripherals/PeripheralBusGCControllerManager.mm @@ -6,22 +6,22 @@ * See LICENSES/README.md for more information. */ -#import "PeripheralBusDarwinEmbeddedManager.h" +#import "PeripheralBusGCControllerManager.h" #include "peripherals/PeripheralTypes.h" #include "threads/SingleLock.h" #include "utils/StringUtils.h" #include "utils/log.h" -#include "platform/darwin/ios-common/peripherals/InputKey.h" -#import "platform/darwin/ios-common/peripherals/Input_Gamecontroller.h" -#include "platform/darwin/ios-common/peripherals/PeripheralBusDarwinEmbedded.h" +#include "platform/darwin/peripherals/InputKey.h" +#import "platform/darwin/peripherals/Input_Gamecontroller.h" +#include "platform/darwin/peripherals/PeripheralBusGCController.h" #pragma mark - objc implementation -@implementation CBPeripheralBusDarwinEmbeddedManager +@implementation CBPeripheralBusGCControllerManager { - PERIPHERALS::CPeripheralBusDarwinEmbedded* parentClass; + PERIPHERALS::CPeripheralBusGCController* parentClass; std::vector<kodi::addon::PeripheralEvent> m_digitalEvents; std::vector<kodi::addon::PeripheralEvent> m_axisEvents; CCriticalSection m_eventMutex; @@ -52,13 +52,13 @@ #pragma mark - init -- (instancetype)initWithName:(PERIPHERALS::CPeripheralBusDarwinEmbedded*)initClass +- (instancetype)initWithName:(PERIPHERALS::CPeripheralBusGCController*)initClass { self = [super init]; parentClass = initClass; - _input_GC = [[Input_IOSGamecontroller alloc] initWithName:self]; + _input_GC = [[Input_GCController alloc] initWithName:self]; return self; } @@ -175,7 +175,7 @@ // Only log if message has any data if (message) { - CLog::Log(LOGDEBUG, "CBPeripheralBusDarwinEmbeddedManager: inputhandler - ID {} - Action {}", + CLog::Log(LOGDEBUG, "CBPeripheralBusGCControllerManager: inputhandler - ID {} - Action {}", controllerID, message.UTF8String); } } |