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: @{
// 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

View File

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

View File

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

View File

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

View File

@ -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<NSDictionary <NSString *,NSNumber *>*> *subElementDefs = hacks[JOYSubElementStructs][@(element.persistentUniqueID)];
NSArray<NSDictionary <NSString *,NSNumber *>*> *subElementDefs = hacks[JOYSubElementStructs][@(element.uniqueID)];
bool isOutput = false;
if (subElementDefs && element.uniqueID != element.parentID) {

View File

@ -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;

View File

@ -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;