Fixed a bug where the screen would not redraw when certain controllers are rumbling in specific strengths in the Cocoa port

This commit is contained in:
Lior Halphon 2021-04-11 23:36:42 +03:00
parent 80f422d0ca
commit 251dd15ff9
1 changed files with 10 additions and 3 deletions

View File

@ -166,6 +166,7 @@ typedef union {
double _sentRumbleAmp;
unsigned _rumbleCounter;
bool _deviceCantSendReports;
dispatch_queue_t _rumbleQueue;
}
- (instancetype)initWithDevice:(IOHIDDeviceRef) device hacks:(NSDictionary *)hacks
@ -490,9 +491,11 @@ typedef union {
{.timeEnabled = 0, .dutyLength = 0, .enabled = 0, .dutyOff = 0, .dutyOn = 0},
}
};
}
_rumbleQueue = dispatch_queue_create([NSString stringWithFormat:@"Rumble Queue for %@", self.deviceName].UTF8String,
NULL);
return self;
}
@ -564,7 +567,9 @@ typedef union {
}
}
}
[self updateRumble];
dispatch_async(_rumbleQueue, ^{
[self updateRumble];
});
}
- (void)elementChanged:(IOHIDElementRef)element
@ -699,7 +704,9 @@ typedef union {
_physicallyConnected = false;
[exposedControllers removeObject:self];
[self setRumbleAmplitude:0];
[self updateRumble];
dispatch_sync(_rumbleQueue, ^{
[self updateRumble];
});
_device = nil;
}