Revert "Fix WUP-028 on Catalina, make controller configuration compatible between macOS versions"

This reverts commit 160282c42a.
This commit is contained in:
Lior Halphon 2020-05-01 00:25:40 +03:00
parent 160282c42a
commit 40562b1c54
7 changed files with 6 additions and 12 deletions

View File

@ -126,14 +126,14 @@ hacksByName = @{
JOYSubElementStructs: @{ JOYSubElementStructs: @{
// Rumble // Rumble
@(1357): @[ @(1364): @[
@{@"reportID": @(1), @"size":@1, @"offset":@0, @"usagePage":@(0xFF00), @"usage":@1, @"min": @0, @"max": @1}, @{@"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": @(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": @(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}, @{@"reportID": @(4), @"size":@1, @"offset":@3, @"usagePage":@(0xFF00), @"usage":@1, @"min": @0, @"max": @1},
], ],
@(4): @[ @(11): @[
// Player 1 // Player 1

View File

@ -36,7 +36,7 @@
- (uint64_t)uniqueID - (uint64_t)uniqueID
{ {
return _element1.persistentUniqueID; return _element1.uniqueID;
} }
- (NSString *)description - (NSString *)description

View File

@ -40,7 +40,7 @@
- (uint64_t)uniqueID - (uint64_t)uniqueID
{ {
return _element.persistentUniqueID; return _element.uniqueID;
} }
- (NSString *)description - (NSString *)description

View File

@ -50,7 +50,7 @@
- (uint64_t)uniqueID - (uint64_t)uniqueID
{ {
return _element.persistentUniqueID; return _element.uniqueID;
} }
- (NSString *)description - (NSString *)description

View File

@ -173,17 +173,13 @@ typedef struct __attribute__((packed)) {
JOYElement *previousAxisElement = nil; JOYElement *previousAxisElement = nil;
id previous = nil; id previous = nil;
unsigned persistentUniqueID = 0;
for (id _element in array) { for (id _element in array) {
if (_element == previous) continue; // Some elements are reported twice for some reason if (_element == previous) continue; // Some elements are reported twice for some reason
previous = _element; previous = _element;
NSArray *elements = nil; NSArray *elements = nil;
JOYElement *element = [[JOYElement alloc] initWithElement:(__bridge IOHIDElementRef)_element]; 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<NSDictionary <NSString *,NSNumber *>*> *subElementDefs = hacks[JOYSubElementStructs][@(element.persistentUniqueID)]; NSArray<NSDictionary <NSString *,NSNumber *>*> *subElementDefs = hacks[JOYSubElementStructs][@(element.uniqueID)];
bool isOutput = false; bool isOutput = false;
if (subElementDefs && element.uniqueID != element.parentID) { if (subElementDefs && element.uniqueID != element.parentID) {

View File

@ -10,7 +10,6 @@
@property (readonly) uint16_t usage; @property (readonly) uint16_t usage;
@property (readonly) uint16_t usagePage; @property (readonly) uint16_t usagePage;
@property (readonly) uint32_t uniqueID; @property (readonly) uint32_t uniqueID;
@property unsigned persistentUniqueID;
@property int32_t min; @property int32_t min;
@property int32_t max; @property int32_t max;
@property (readonly) int32_t reportID; @property (readonly) int32_t reportID;

View File

@ -34,7 +34,6 @@
_usage = usage; _usage = usage;
_usagePage = usagePage; _usagePage = usagePage;
_uniqueID = (uint32_t)((_parent.uniqueID << 16) | offset); _uniqueID = (uint32_t)((_parent.uniqueID << 16) | offset);
self.persistentUniqueID = (uint32_t)((_parent.persistentUniqueID << 16) | offset);
_min = min; _min = min;
_max = max; _max = max;
_reportID = _parent.reportID; _reportID = _parent.reportID;