mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-23 11:31:41 +00:00
Joystick controller fixes
- only poll for joystick connectivity once per second - if keypad joystick enabled, pump the handler
This commit is contained in:
parent
575bb2448b
commit
5c6c66f243
@ -92,21 +92,32 @@ void gldriver_joystick_reset(void) {
|
|||||||
|
|
||||||
- (void)connectivityPoll:(NSNotification *)notification
|
- (void)connectivityPoll:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
NSArray *joysticks = [DDHidJoystick allJoysticks];
|
static unsigned int counter = 0;
|
||||||
BOOL changed = ([joysticks count] != [self.allJoysticks count]);
|
counter = (counter+1) % 60;
|
||||||
for (DDHidJoystick *joystick in joysticks)
|
if (counter == 0)
|
||||||
{
|
{
|
||||||
NSString *key =[NSString stringWithFormat:@"%@-%@-%@", [joystick manufacturer], [joystick serialNumber], [joystick transport]];
|
NSArray *joysticks = [DDHidJoystick allJoysticks];
|
||||||
if (![self.allJoysticks objectForKey:key])
|
BOOL changed = ([joysticks count] != [self.allJoysticks count]);
|
||||||
|
for (DDHidJoystick *joystick in joysticks)
|
||||||
{
|
{
|
||||||
changed = YES;
|
NSString *key =[NSString stringWithFormat:@"%@-%@-%@", [joystick manufacturer], [joystick serialNumber], [joystick transport]];
|
||||||
break;
|
if (![self.allJoysticks objectForKey:key])
|
||||||
|
{
|
||||||
|
changed = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
[self resetJoysticks];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changed)
|
#ifdef KEYPAD_JOYSTICK
|
||||||
|
if (joy_mode == JOY_KPAD)
|
||||||
{
|
{
|
||||||
[self resetJoysticks];
|
c_keys_handle_input(-1, 0, 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
Loading…
Reference in New Issue
Block a user