mirror of https://github.com/snes9xgit/snes9x.git
Fix joypads for multiple players
This commit is contained in:
parent
e7c47ef25d
commit
3b5f04a5d1
|
@ -140,6 +140,8 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow";
|
||||||
[self setButtonCode:buttonCode forKeyCode:self.keys[control].integerValue player:player];
|
[self setButtonCode:buttonCode forKeyCode:self.keys[control].integerValue player:player];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSDictionary *joypadPlayerPrefs = [defaults objectForKey:kJoypadPlayerPrefs];
|
||||||
|
|
||||||
for ( S9xJoypad *joypad in [self listJoypads])
|
for ( S9xJoypad *joypad in [self listJoypads])
|
||||||
{
|
{
|
||||||
NSMutableDictionary *joypadPrefs = [[defaults objectForKey:kJoypadInputPrefs] mutableCopy];
|
NSMutableDictionary *joypadPrefs = [[defaults objectForKey:kJoypadInputPrefs] mutableCopy];
|
||||||
|
@ -152,6 +154,14 @@ static NSWindowFrameAutosaveName const kMainWindowIdentifier = @"s9xMainWindow";
|
||||||
|
|
||||||
NSString *key = [self prefsKeyForVendorID:joypad.vendorID productID:joypad.productID index:joypad.index];
|
NSString *key = [self prefsKeyForVendorID:joypad.vendorID productID:joypad.productID index:joypad.index];
|
||||||
|
|
||||||
|
for ( NSString *playerString in joypadPlayerPrefs )
|
||||||
|
{
|
||||||
|
if ( [key isEqualToString:joypadPlayerPrefs[playerString]] )
|
||||||
|
{
|
||||||
|
[self setPlayer:playerString.intValue forVendorID:joypad.vendorID productID:joypad.productID index:joypad.index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableDictionary *devicePrefs = [joypadPrefs[key] mutableCopy];
|
NSMutableDictionary *devicePrefs = [joypadPrefs[key] mutableCopy];
|
||||||
if (devicePrefs == nil)
|
if (devicePrefs == nil)
|
||||||
{
|
{
|
||||||
|
|
|
@ -753,12 +753,6 @@ void SetUpHID (void)
|
||||||
{
|
{
|
||||||
AddDevice((__bridge IOHIDDeviceRef)device);
|
AddDevice((__bridge IOHIDDeviceRef)device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderedDevices.count == 1)
|
|
||||||
{
|
|
||||||
const struct JoypadDevice &deviceStruct = *(allDevices.begin());
|
|
||||||
SetPlayerForJoypad(0, deviceStruct.vendorID, deviceStruct.productID, deviceStruct.index, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue