mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-22 21:32:52 +02:00
Make sure reports are only sent from one thread
This commit is contained in:
@@ -115,7 +115,7 @@
|
|||||||
[NSCursor unhide];
|
[NSCursor unhide];
|
||||||
}
|
}
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[lastController setRumbleAmplitude:0];
|
[self setRumble:0];
|
||||||
[JOYController unregisterListener:self];
|
[JOYController unregisterListener:self];
|
||||||
}
|
}
|
||||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||||
@@ -272,7 +272,9 @@
|
|||||||
|
|
||||||
- (void)setRumble:(double)amp
|
- (void)setRumble:(double)amp
|
||||||
{
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[lastController setRumbleAmplitude:amp];
|
[lastController setRumbleAmplitude:amp];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)controller:(JOYController *)controller movedAxis:(JOYAxis *)axis
|
- (void)controller:(JOYController *)controller movedAxis:(JOYAxis *)axis
|
||||||
@@ -301,7 +303,7 @@
|
|||||||
{
|
{
|
||||||
if (![self.window isMainWindow]) return;
|
if (![self.window isMainWindow]) return;
|
||||||
if (controller != lastController) {
|
if (controller != lastController) {
|
||||||
[lastController setRumbleAmplitude:0];
|
[self setRumble:0];
|
||||||
lastController = controller;
|
lastController = controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +321,9 @@
|
|||||||
![preferred_joypad isEqualToString:controller.uniqueID]) {
|
![preferred_joypad isEqualToString:controller.uniqueID]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[controller setPlayerLEDs:1 << player];
|
[controller setPlayerLEDs:1 << player];
|
||||||
|
});
|
||||||
NSDictionary *mapping = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"JoyKitInstanceMapping"][controller.uniqueID];
|
NSDictionary *mapping = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"JoyKitInstanceMapping"][controller.uniqueID];
|
||||||
if (!mapping) {
|
if (!mapping) {
|
||||||
mapping = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"JoyKitNameMapping"][controller.deviceName];
|
mapping = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"JoyKitNameMapping"][controller.deviceName];
|
||||||
|
Reference in New Issue
Block a user