From 40562b1c54176bc52021ba6bfed56a1dcbd4b94e Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 1 May 2020 00:25:40 +0300 Subject: [PATCH] Revert "Fix WUP-028 on Catalina, make controller configuration compatible between macOS versions" This reverts commit 160282c42af29f80b7e271e319015a60d2ad6e30. --- JoyKit/ControllerConfiguration.inc | 4 ++-- JoyKit/JOYAxes2D.m | 2 +- JoyKit/JOYAxis.m | 2 +- JoyKit/JOYButton.m | 2 +- JoyKit/JOYController.m | 6 +----- JoyKit/JOYElement.h | 1 - JoyKit/JOYSubElement.m | 1 - 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/JoyKit/ControllerConfiguration.inc b/JoyKit/ControllerConfiguration.inc index 6c81e9f..cf327f9 100644 --- a/JoyKit/ControllerConfiguration.inc +++ b/JoyKit/ControllerConfiguration.inc @@ -126,14 +126,14 @@ hacksByName = @{ JOYSubElementStructs: @{ // Rumble - @(1357): @[ + @(1364): @[ @{@"reportID": @(1), @"size":@1, @"offset":@0, @"usagePage":@(0xFF00), @"usage":@1, @"min": @0, @"max": @1}, @{@"reportID": @(2), @"size":@1, @"offset":@1, @"usagePage":@(0xFF00), @"usage":@1, @"min": @0, @"max": @1}, @{@"reportID": @(3), @"size":@1, @"offset":@2, @"usagePage":@(0xFF00), @"usage":@1, @"min": @0, @"max": @1}, @{@"reportID": @(4), @"size":@1, @"offset":@3, @"usagePage":@(0xFF00), @"usage":@1, @"min": @0, @"max": @1}, ], - @(4): @[ + @(11): @[ // Player 1 diff --git a/JoyKit/JOYAxes2D.m b/JoyKit/JOYAxes2D.m index a1b91d2..624ccef 100644 --- a/JoyKit/JOYAxes2D.m +++ b/JoyKit/JOYAxes2D.m @@ -36,7 +36,7 @@ - (uint64_t)uniqueID { - return _element1.persistentUniqueID; + return _element1.uniqueID; } - (NSString *)description diff --git a/JoyKit/JOYAxis.m b/JoyKit/JOYAxis.m index 74a4563..169eaee 100644 --- a/JoyKit/JOYAxis.m +++ b/JoyKit/JOYAxis.m @@ -40,7 +40,7 @@ - (uint64_t)uniqueID { - return _element.persistentUniqueID; + return _element.uniqueID; } - (NSString *)description diff --git a/JoyKit/JOYButton.m b/JoyKit/JOYButton.m index a904299..3e6026d 100644 --- a/JoyKit/JOYButton.m +++ b/JoyKit/JOYButton.m @@ -50,7 +50,7 @@ - (uint64_t)uniqueID { - return _element.persistentUniqueID; + return _element.uniqueID; } - (NSString *)description diff --git a/JoyKit/JOYController.m b/JoyKit/JOYController.m index 10ec6e4..b4810ab 100644 --- a/JoyKit/JOYController.m +++ b/JoyKit/JOYController.m @@ -173,17 +173,13 @@ typedef struct __attribute__((packed)) { JOYElement *previousAxisElement = nil; id previous = nil; - unsigned persistentUniqueID = 0; for (id _element in array) { if (_element == previous) continue; // Some elements are reported twice for some reason previous = _element; NSArray *elements = nil; JOYElement *element = [[JOYElement alloc] initWithElement:(__bridge IOHIDElementRef)_element]; - /* Cookie is not persistent across macOS versions because Apple added kIOHIDElementTypeInput_NULL - in a backwards incompatible manner. We must maintain our own cookie-like ID. */ - element.persistentUniqueID = persistentUniqueID++; - NSArray*> *subElementDefs = hacks[JOYSubElementStructs][@(element.persistentUniqueID)]; + NSArray*> *subElementDefs = hacks[JOYSubElementStructs][@(element.uniqueID)]; bool isOutput = false; if (subElementDefs && element.uniqueID != element.parentID) { diff --git a/JoyKit/JOYElement.h b/JoyKit/JOYElement.h index 4a6c311..860c247 100644 --- a/JoyKit/JOYElement.h +++ b/JoyKit/JOYElement.h @@ -10,7 +10,6 @@ @property (readonly) uint16_t usage; @property (readonly) uint16_t usagePage; @property (readonly) uint32_t uniqueID; -@property unsigned persistentUniqueID; @property int32_t min; @property int32_t max; @property (readonly) int32_t reportID; diff --git a/JoyKit/JOYSubElement.m b/JoyKit/JOYSubElement.m index 01b121a..55e289e 100644 --- a/JoyKit/JOYSubElement.m +++ b/JoyKit/JOYSubElement.m @@ -34,7 +34,6 @@ _usage = usage; _usagePage = usagePage; _uniqueID = (uint32_t)((_parent.uniqueID << 16) | offset); - self.persistentUniqueID = (uint32_t)((_parent.persistentUniqueID << 16) | offset); _min = min; _max = max; _reportID = _parent.reportID;