diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-09-10 18:43:18 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-09-10 18:43:18 +0000 |
| commit | 4b4f074b6659f33b4f9e1c9784861409d8debd97 (patch) | |
| tree | 0fbd7f1ea28c9431cd8bafbaaac5d689d55d5dd6 /macosx/plugins | |
| parent | a3ac4842bd5c7058b1363f7d3307f61724fc7178 (diff) | |
| download | pcsxr-4b4f074b6659f33b4f9e1c9784861409d8debd97.tar.gz | |
Convert Objective-C code to modern syntax, mainly for the NSDictionaries.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@87115 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins')
12 files changed, 361 insertions, 400 deletions
diff --git a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m index 9d2c075a..90ad3b6c 100755 --- a/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m +++ b/macosx/plugins/Bladesio1/macsrc/PluginConfigController.m @@ -55,14 +55,12 @@ void AboutDlgProc() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); @@ -98,20 +96,17 @@ void ReadConfig() { NSDictionary *keyValues; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - [NSDictionary dictionaryWithObjectsAndKeys: - @NO, kSioEnabled, - @33307, kSioPort, - @"127.0.0.1", kSioIPAddress, - @(PLAYER_DISABLED), kSioPlayer, - nil], PrefsKey, nil]]; + [defaults registerDefaults:@{PrefsKey: @{kSioEnabled: @NO, + kSioPort: @33307, + kSioIPAddress: @"127.0.0.1", + kSioPlayer: @(PLAYER_DISABLED)}}]; keyValues = [defaults dictionaryForKey:PrefsKey]; - settings.enabled = [[keyValues objectForKey:kSioEnabled] boolValue]; - settings.port = [[keyValues objectForKey:kSioPort] unsignedShortValue]; - settings.player = [[keyValues objectForKey:kSioPlayer] intValue]; - strlcpy(settings.ip, [[keyValues objectForKey:kSioIPAddress] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(settings.ip)); + settings.enabled = [keyValues[kSioEnabled] boolValue]; + settings.port = [keyValues[kSioPort] unsignedShortValue]; + settings.player = [keyValues[kSioPlayer] intValue]; + strlcpy(settings.ip, [keyValues[kSioIPAddress] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(settings.ip)); } @implementation Bladesio1PluginConfigController @@ -137,9 +132,9 @@ void ReadConfig() return; } - [writeDic setObject:(([enabledButton state] == NSOnState) ? @YES : @NO) forKey:kSioEnabled]; - [writeDic setObject:theAddress forKey:kSioIPAddress]; - [writeDic setObject:@((u16)[portField intValue]) forKey:kSioPort]; + writeDic[kSioEnabled] = (([enabledButton state] == NSOnState) ? @YES : @NO); + writeDic[kSioIPAddress] = theAddress; + writeDic[kSioPort] = @((u16)[portField intValue]); { int player; @@ -149,7 +144,7 @@ void ReadConfig() case 1: player = PLAYER_MASTER; break; case 2: player = PLAYER_SLAVE; break; } - [writeDic setObject:@(player) forKey:kSioPlayer]; + writeDic[kSioPlayer] = @(player); } // write to defaults @@ -166,7 +161,7 @@ void ReadConfig() { BOOL isEnabled = [enabledButton state] == NSOnState ? YES : NO; - for (NSView *subView in [[[configBox subviews] objectAtIndex:0] subviews]) { + for (NSView *subView in [[configBox subviews][0] subviews]) { if ([subView isKindOfClass:[NSTextField class]] && ![(NSTextField*)subView isEditable]) { [(NSTextField*)subView setTextColor:isEnabled ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; } else { @@ -192,11 +187,11 @@ void ReadConfig() // load from preferences keyValues = [[defaults dictionaryForKey:PrefsKey] mutableCopy]; - [enabledButton setState: [[keyValues objectForKey:kSioEnabled] boolValue] ? NSOnState : NSOffState]; - [ipAddressField setTitleWithMnemonic:[keyValues objectForKey:kSioIPAddress]]; - [portField setIntValue:[[keyValues objectForKey:kSioPort] intValue]]; + [enabledButton setState: [keyValues[kSioEnabled] boolValue] ? NSOnState : NSOffState]; + [ipAddressField setTitleWithMnemonic:keyValues[kSioIPAddress]]; + [portField setIntValue:[keyValues[kSioPort] intValue]]; - switch ([[keyValues objectForKey:kSioPlayer] integerValue]) { + switch ([keyValues[kSioPlayer] integerValue]) { default: case PLAYER_DISABLED: [playerMenu selectItemAtIndex:0]; break; case PLAYER_MASTER: [playerMenu selectItemAtIndex:1]; break; diff --git a/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m b/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m index 6ea5d12f..df20efb2 100755 --- a/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m +++ b/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m @@ -58,14 +58,12 @@ void AboutDlgProc() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); @@ -92,18 +90,15 @@ void ReadConfig() { NSDictionary *keyValues; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - [NSDictionary dictionaryWithObjectsAndKeys: - @YES, @"Threaded", - @64, @"Cache Size", - @0, @"Speed", - nil], PrefsKey, nil]]; + [defaults registerDefaults:@{PrefsKey: @{@"Threaded": @YES, + @"Cache Size": @64, + @"Speed": @0}}]; keyValues = [defaults dictionaryForKey:PrefsKey]; - ReadMode = ([[keyValues objectForKey:@"Threaded"] boolValue] ? THREADED : NORMAL); - CacheSize = [[keyValues objectForKey:@"Cache Size"] intValue]; - CdrSpeed = [[keyValues objectForKey:@"Speed"] integerValue]; + ReadMode = ([keyValues[@"Threaded"] boolValue] ? THREADED : NORMAL); + CacheSize = [keyValues[@"Cache Size"] intValue]; + CdrSpeed = [keyValues[@"Speed"] integerValue]; } @implementation PluginConfigController @@ -121,17 +116,17 @@ void ReadConfig() NSMutableDictionary *writeDic = [keyValues mutableCopy]; - [writeDic setObject:([Cached intValue] ? @YES : @NO) forKey:@"Threaded"]; - [writeDic setObject:@([CacheSize integerValue]) forKey:@"Cache Size"]; + writeDic[@"Threaded"] = ([Cached intValue] ? @YES : @NO); + writeDic[@"Cache Size"] = @([CacheSize integerValue]); switch ([CdSpeed indexOfSelectedItem]) { - case 1: [writeDic setObject:@1 forKey:@"Speed"]; break; - case 2: [writeDic setObject:@2 forKey:@"Speed"]; break; - case 3: [writeDic setObject:@4 forKey:@"Speed"]; break; - case 4: [writeDic setObject:@8 forKey:@"Speed"]; break; - case 5: [writeDic setObject:@16 forKey:@"Speed"]; break; - case 6: [writeDic setObject:@32 forKey:@"Speed"]; break; - default: [writeDic setObject:@0 forKey:@"Speed"]; break; + case 1: writeDic[@"Speed"] = @1; break; + case 2: writeDic[@"Speed"] = @2; break; + case 3: writeDic[@"Speed"] = @4; break; + case 4: writeDic[@"Speed"] = @8; break; + case 5: writeDic[@"Speed"] = @16; break; + case 6: writeDic[@"Speed"] = @32; break; + default: writeDic[@"Speed"] = @0; break; } // write to defaults @@ -154,10 +149,10 @@ void ReadConfig() // load from preferences self.keyValues = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]]; - [Cached setIntValue:[[keyValues objectForKey:@"Threaded"] intValue]]; - [CacheSize setIntegerValue:[[keyValues objectForKey:@"Cache Size"] integerValue]]; + [Cached setIntValue:[keyValues[@"Threaded"] intValue]]; + [CacheSize setIntegerValue:[keyValues[@"Cache Size"] integerValue]]; - switch ([[keyValues objectForKey:@"Speed"] intValue]) { + switch ([keyValues[@"Speed"] intValue]) { case 1: [CdSpeed selectItemAtIndex:1]; break; case 2: [CdSpeed selectItemAtIndex:2]; break; case 4: [CdSpeed selectItemAtIndex:3]; break; diff --git a/macosx/plugins/DFInput/macsrc/ControllerList.m b/macosx/plugins/DFInput/macsrc/ControllerList.m index ed486314..583c0ad3 100755 --- a/macosx/plugins/DFInput/macsrc/ControllerList.m +++ b/macosx/plugins/DFInput/macsrc/ControllerList.m @@ -113,7 +113,7 @@ static const int DPad[DKEY_TOTAL] = { row:(NSInteger)rowIndex { if ([[aTableColumn identifier] isEqualToString:@"key"]) { - return [labelText objectAtIndex:rowIndex]; + return labelText[rowIndex]; } else { char buf[256] = {0}; diff --git a/macosx/plugins/DFInput/macsrc/PadController.m b/macosx/plugins/DFInput/macsrc/PadController.m index f667717a..06b1f05a 100755 --- a/macosx/plugins/DFInput/macsrc/PadController.m +++ b/macosx/plugins/DFInput/macsrc/PadController.m @@ -137,12 +137,9 @@ void LoadPADConfig() { SetDefaultConfig(); [[NSUserDefaults standardUserDefaults] registerDefaults: - [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys: - DefaultPadArray(0), kDFPad1, - DefaultPadArray(1), kDFPad2, - @YES, kDFThreading, - nil] - forKey:PrefsKey]]; + @{PrefsKey: @{kDFPad1: DefaultPadArray(0), + kDFPad2: DefaultPadArray(1), + kDFThreading: @YES}}]; //Load the old preferences if present. NSFileManager *fm = [NSFileManager defaultManager]; @@ -305,9 +302,9 @@ void LoadPADConfig() [fm removeItemAtPath:oldPrefPath error:NULL]; } else { NSDictionary *dfPrefs = [[NSUserDefaults standardUserDefaults] dictionaryForKey:PrefsKey]; - g.cfg.Threaded = [[dfPrefs objectForKey:kDFThreading] boolValue]; - LoadPadArray(0, [dfPrefs objectForKey:kDFPad1]); - LoadPadArray(1, [dfPrefs objectForKey:kDFPad2]); + g.cfg.Threaded = [dfPrefs[kDFThreading] boolValue]; + LoadPadArray(0, dfPrefs[kDFPad1]); + LoadPadArray(1, dfPrefs[kDFPad2]); } } @@ -316,18 +313,16 @@ void SavePADConfig() NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *pad1Dict = nil, *pad2Dict = nil; NSDictionary *prefDict = [defaults dictionaryForKey:PrefsKey]; - pad1Dict = [[NSMutableDictionary alloc] initWithDictionary:[prefDict objectForKey:kDFPad1]]; - pad2Dict = [[NSMutableDictionary alloc] initWithDictionary:[prefDict objectForKey:kDFPad2]]; + pad1Dict = [[NSMutableDictionary alloc] initWithDictionary:prefDict[kDFPad1]]; + pad2Dict = [[NSMutableDictionary alloc] initWithDictionary:prefDict[kDFPad2]]; prefDict = nil; [pad1Dict addEntriesFromDictionary:SavePadArray(0)]; [pad2Dict addEntriesFromDictionary:SavePadArray(1)]; - [defaults setObject:[NSDictionary dictionaryWithObjectsAndKeys: - g.cfg.Threaded ? @YES : @NO, kDFThreading, - pad1Dict, kDFPad1, - pad2Dict, kDFPad2, - nil] forKey:PrefsKey]; + [defaults setObject:@{kDFThreading: g.cfg.Threaded ? @YES : @NO, + kDFPad1: pad1Dict, + kDFPad2: pad2Dict} forKey:PrefsKey]; [defaults synchronize]; } @@ -352,14 +347,12 @@ void DoAbout() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); diff --git a/macosx/plugins/DFInput/macsrc/cfgHelper.m b/macosx/plugins/DFInput/macsrc/cfgHelper.m index 406252fc..638624a6 100644 --- a/macosx/plugins/DFInput/macsrc/cfgHelper.m +++ b/macosx/plugins/DFInput/macsrc/cfgHelper.m @@ -63,21 +63,21 @@ NSDictionary *DefaultPadArray(int padnum) [NSMutableDictionary dictionaryWithObjectsAndKeys:@3, joyVal, @(BUTTON), joyType, nil], dSquare, nil]; if (padnum == 0) { - [[mutArray objectForKey:dSelect] setObject:@9 forKey:dfKey]; - [[mutArray objectForKey:dStart] setObject:@10 forKey:dfKey]; - [[mutArray objectForKey:dUp] setObject:@127 forKey:dfKey]; - [[mutArray objectForKey:dRight] setObject:@125 forKey:dfKey]; - [[mutArray objectForKey:dDown] setObject:@126 forKey:dfKey]; - [[mutArray objectForKey:dLeft] setObject:@124 forKey:dfKey]; - [[mutArray objectForKey:dL2] setObject:@16 forKey:dfKey]; - [[mutArray objectForKey:dR2] setObject:@18 forKey:dfKey]; - [[mutArray objectForKey:dL1] setObject:@14 forKey:dfKey]; - [[mutArray objectForKey:dR1] setObject:@15 forKey:dfKey]; - [[mutArray objectForKey:dTriangle] setObject:@3 forKey:dfKey]; - [[mutArray objectForKey:dCircle] setObject:@8 forKey:dfKey]; - [[mutArray objectForKey:dCross] setObject:@7 forKey:dfKey]; - [[mutArray objectForKey:dSquare] setObject:@2 forKey:dfKey]; - [mutArray setObject:[NSDictionary dictionaryWithObject:@12 forKey:dfKey] forKey:dAnalog]; + mutArray[dSelect][dfKey] = @9; + mutArray[dStart][dfKey] = @10; + mutArray[dUp][dfKey] = @127; + mutArray[dRight][dfKey] = @125; + mutArray[dDown][dfKey] = @126; + mutArray[dLeft][dfKey] = @124; + mutArray[dL2][dfKey] = @16; + mutArray[dR2][dfKey] = @18; + mutArray[dL1][dfKey] = @14; + mutArray[dR1][dfKey] = @15; + mutArray[dTriangle][dfKey] = @3; + mutArray[dCircle][dfKey] = @8; + mutArray[dCross][dfKey] = @7; + mutArray[dSquare][dfKey] = @2; + mutArray[dAnalog] = @{dfKey: @12}; } return [NSDictionary dictionaryWithDictionary:mutArray]; } @@ -86,21 +86,21 @@ static NSDictionary *DictionaryFromButtonDef(KEYDEF theKey) { NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithCapacity:3]; if (theKey.Key) { - [mutDict setObject:@(theKey.Key) forKey:dfKey]; + mutDict[dfKey] = @(theKey.Key); } if (theKey.JoyEvType != NONE) { - [mutDict setObject:@(theKey.JoyEvType) forKey:joyType]; + mutDict[joyType] = @(theKey.JoyEvType); switch (theKey.JoyEvType) { case BUTTON: - [mutDict setObject:@(theKey.J.Button) forKey:joyVal]; + mutDict[joyVal] = @(theKey.J.Button); break; case HAT: - [mutDict setObject:@(theKey.J.Hat) forKey:joyVal]; + mutDict[joyVal] = @(theKey.J.Hat); break; case AXIS: - [mutDict setObject:@(theKey.J.Axis) forKey:joyVal]; + mutDict[joyVal] = @(theKey.J.Axis); break; case NONE: @@ -119,9 +119,9 @@ static void SetKeyFromDictionary(NSDictionary *inDict, KEYDEF *outDef) if (!inDict) { return; } - NSNumber *theJoyType = [inDict objectForKey:joyType]; + NSNumber *theJoyType = inDict[joyType]; if (theJoyType) { - NSNumber *theJoyVal = [inDict objectForKey:joyVal]; + NSNumber *theJoyVal = inDict[joyVal]; outDef->JoyEvType = [theJoyType unsignedCharValue]; switch (outDef->JoyEvType) { case BUTTON: @@ -140,7 +140,7 @@ static void SetKeyFromDictionary(NSDictionary *inDict, KEYDEF *outDef) break; } } - NSNumber *keyVal = [inDict objectForKey:dfKey]; + NSNumber *keyVal = inDict[dfKey]; if (keyVal) { outDef->Key = [keyVal unsignedShortValue]; } @@ -149,88 +149,88 @@ static void SetKeyFromDictionary(NSDictionary *inDict, KEYDEF *outDef) void LoadPadArray(int padnum, NSDictionary *nsPrefs) { PADDEF *curDef = &g.cfg.PadDef[padnum]; - curDef->DevNum = [[nsPrefs objectForKey:deviceNumber] charValue]; - curDef->Type = [[nsPrefs objectForKey:padType] unsignedShortValue]; + curDef->DevNum = [nsPrefs[deviceNumber] charValue]; + curDef->Type = [nsPrefs[padType] unsignedShortValue]; curDef->VisualVibration = 0; //Not implemented on OS X right now. //Analog buttons - SetKeyFromDictionary([nsPrefs objectForKey:dL3], &curDef->KeyDef[DKEY_L3]); - SetKeyFromDictionary([nsPrefs objectForKey:dR3], &curDef->KeyDef[DKEY_R3]); - SetKeyFromDictionary([nsPrefs objectForKey:dAnalog], &curDef->KeyDef[DKEY_ANALOG]); + SetKeyFromDictionary(nsPrefs[dL3], &curDef->KeyDef[DKEY_L3]); + SetKeyFromDictionary(nsPrefs[dR3], &curDef->KeyDef[DKEY_R3]); + SetKeyFromDictionary(nsPrefs[dAnalog], &curDef->KeyDef[DKEY_ANALOG]); //Analog sticks - SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogXP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]); - SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogXM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]); - SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogYP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]); - SetKeyFromDictionary([nsPrefs objectForKey:dLeftAnalogYM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]); + SetKeyFromDictionary(nsPrefs[dLeftAnalogXP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]); + SetKeyFromDictionary(nsPrefs[dLeftAnalogXM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]); + SetKeyFromDictionary(nsPrefs[dLeftAnalogYP], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]); + SetKeyFromDictionary(nsPrefs[dLeftAnalogYM], &curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]); - SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogXP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]); - SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogXM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]); - SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogYP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]); - SetKeyFromDictionary([nsPrefs objectForKey:dRightAnalogYM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]); + SetKeyFromDictionary(nsPrefs[dRightAnalogXP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]); + SetKeyFromDictionary(nsPrefs[dRightAnalogXM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]); + SetKeyFromDictionary(nsPrefs[dRightAnalogYP], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]); + SetKeyFromDictionary(nsPrefs[dRightAnalogYM], &curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]); //Digital shouldurs - SetKeyFromDictionary([nsPrefs objectForKey:dL1], &curDef->KeyDef[DKEY_L1]); - SetKeyFromDictionary([nsPrefs objectForKey:dL2], &curDef->KeyDef[DKEY_L2]); - SetKeyFromDictionary([nsPrefs objectForKey:dR1], &curDef->KeyDef[DKEY_R1]); - SetKeyFromDictionary([nsPrefs objectForKey:dR2], &curDef->KeyDef[DKEY_R2]); + SetKeyFromDictionary(nsPrefs[dL1], &curDef->KeyDef[DKEY_L1]); + SetKeyFromDictionary(nsPrefs[dL2], &curDef->KeyDef[DKEY_L2]); + SetKeyFromDictionary(nsPrefs[dR1], &curDef->KeyDef[DKEY_R1]); + SetKeyFromDictionary(nsPrefs[dR2], &curDef->KeyDef[DKEY_R2]); //Digital buttons - SetKeyFromDictionary([nsPrefs objectForKey:dSelect], &curDef->KeyDef[DKEY_SELECT]); - SetKeyFromDictionary([nsPrefs objectForKey:dStart], &curDef->KeyDef[DKEY_START]); - SetKeyFromDictionary([nsPrefs objectForKey:dUp], &curDef->KeyDef[DKEY_UP]); - SetKeyFromDictionary([nsPrefs objectForKey:dRight], &curDef->KeyDef[DKEY_RIGHT]); - SetKeyFromDictionary([nsPrefs objectForKey:dDown], &curDef->KeyDef[DKEY_DOWN]); - SetKeyFromDictionary([nsPrefs objectForKey:dLeft], &curDef->KeyDef[DKEY_LEFT]); - SetKeyFromDictionary([nsPrefs objectForKey:dTriangle], &curDef->KeyDef[DKEY_TRIANGLE]); - SetKeyFromDictionary([nsPrefs objectForKey:dCircle], &curDef->KeyDef[DKEY_CIRCLE]); - SetKeyFromDictionary([nsPrefs objectForKey:dCross], &curDef->KeyDef[DKEY_CROSS]); - SetKeyFromDictionary([nsPrefs objectForKey:dSquare], &curDef->KeyDef[DKEY_SQUARE]); + SetKeyFromDictionary(nsPrefs[dSelect], &curDef->KeyDef[DKEY_SELECT]); + SetKeyFromDictionary(nsPrefs[dStart], &curDef->KeyDef[DKEY_START]); + SetKeyFromDictionary(nsPrefs[dUp], &curDef->KeyDef[DKEY_UP]); + SetKeyFromDictionary(nsPrefs[dRight], &curDef->KeyDef[DKEY_RIGHT]); + SetKeyFromDictionary(nsPrefs[dDown], &curDef->KeyDef[DKEY_DOWN]); + SetKeyFromDictionary(nsPrefs[dLeft], &curDef->KeyDef[DKEY_LEFT]); + SetKeyFromDictionary(nsPrefs[dTriangle], &curDef->KeyDef[DKEY_TRIANGLE]); + SetKeyFromDictionary(nsPrefs[dCircle], &curDef->KeyDef[DKEY_CIRCLE]); + SetKeyFromDictionary(nsPrefs[dCross], &curDef->KeyDef[DKEY_CROSS]); + SetKeyFromDictionary(nsPrefs[dSquare], &curDef->KeyDef[DKEY_SQUARE]); } NSDictionary *SavePadArray(int padnum) { NSMutableDictionary *mutArray = [NSMutableDictionary dictionary]; PADDEF *curDef = &g.cfg.PadDef[padnum]; - [mutArray setObject:@(curDef->DevNum) forKey:deviceNumber]; - [mutArray setObject:@(curDef->Type) forKey:padType]; + mutArray[deviceNumber] = @(curDef->DevNum); + mutArray[padType] = @(curDef->Type); switch (curDef->Type) { case PSE_PAD_TYPE_ANALOGPAD: { - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_L3]) forKey:dL3]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_R3]) forKey:dR3]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_ANALOG]) forKey:dAnalog]; + mutArray[dL3] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L3]); + mutArray[dR3] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R3]); + mutArray[dAnalog] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_ANALOG]); - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]) forKey:dLeftAnalogXP]; - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]) forKey:dLeftAnalogXM]; - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]) forKey:dLeftAnalogYP]; - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]) forKey:dLeftAnalogYM]; + mutArray[dLeftAnalogXP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XP]); + mutArray[dLeftAnalogXM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_XM]); + mutArray[dLeftAnalogYP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YP]); + mutArray[dLeftAnalogYM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_LEFT][ANALOG_YM]); - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]) forKey:dRightAnalogXP]; - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]) forKey:dRightAnalogXM]; - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]) forKey:dRightAnalogYP]; - [mutArray setObject:DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]) forKey:dRightAnalogYM]; + mutArray[dRightAnalogXP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XP]); + mutArray[dRightAnalogXM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_XM]); + mutArray[dRightAnalogYP] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YP]); + mutArray[dRightAnalogYM] = DictionaryFromButtonDef(curDef->AnalogDef[ANALOG_RIGHT][ANALOG_YM]); } //Fall through case PSE_PAD_TYPE_STANDARD: { - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_L1]) forKey:dL1]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_L2]) forKey:dL2]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_R1]) forKey:dR1]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_R2]) forKey:dR2]; + mutArray[dL1] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L1]); + mutArray[dL2] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_L2]); + mutArray[dR1] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R1]); + mutArray[dR2] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_R2]); - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_SELECT]) forKey:dSelect]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_START]) forKey:dStart]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_UP]) forKey:dUp]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_RIGHT]) forKey:dRight]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_DOWN]) forKey:dDown]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_LEFT]) forKey:dLeft]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_TRIANGLE]) forKey:dTriangle]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_CIRCLE]) forKey:dCircle]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_CROSS]) forKey:dCross]; - [mutArray setObject:DictionaryFromButtonDef(curDef->KeyDef[DKEY_SQUARE]) forKey:dSquare]; + mutArray[dSelect] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_SELECT]); + mutArray[dStart] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_START]); + mutArray[dUp] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_UP]); + mutArray[dRight] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_RIGHT]); + mutArray[dDown] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_DOWN]); + mutArray[dLeft] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_LEFT]); + mutArray[dTriangle] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_TRIANGLE]); + mutArray[dCircle] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_CIRCLE]); + mutArray[dCross] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_CROSS]); + mutArray[dSquare] = DictionaryFromButtonDef(curDef->KeyDef[DKEY_SQUARE]); } break; diff --git a/macosx/plugins/DFNet/macsrc/PluginConfigController.m b/macosx/plugins/DFNet/macsrc/PluginConfigController.m index 92ede4c4..434a108b 100755 --- a/macosx/plugins/DFNet/macsrc/PluginConfigController.m +++ b/macosx/plugins/DFNet/macsrc/PluginConfigController.m @@ -60,14 +60,12 @@ void AboutDlgProc() [icon setSize:NSMakeSize(64, 64)]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); @@ -95,18 +93,15 @@ void ReadConfig() NSDictionary *keyValues; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - [NSDictionary dictionaryWithObjectsAndKeys: - @"127.0.0.1", kIPADDRKEY, - @33306, kIPPORT, - @1, kPLAYERNUM, - nil], PrefsKey, nil]]; + [defaults registerDefaults:@{PrefsKey: @{kIPADDRKEY: @"127.0.0.1", + kIPPORT: @33306, + kPLAYERNUM: @1}}]; keyValues = [defaults dictionaryForKey:PrefsKey]; - conf.PortNum = [[keyValues objectForKey:kIPPORT] intValue]; - conf.PlayerNum = [[keyValues objectForKey:kPLAYERNUM] intValue]; - strlcpy(conf.ipAddress, [[keyValues objectForKey:kIPADDRKEY] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(conf.ipAddress)); + conf.PortNum = [keyValues[kIPPORT] intValue]; + conf.PlayerNum = [keyValues[kPLAYERNUM] intValue]; + strlcpy(conf.ipAddress, [keyValues[kIPADDRKEY] cStringUsingEncoding:NSASCIIStringEncoding], sizeof(conf.ipAddress)); } @implementation PluginConfigController @@ -132,9 +127,9 @@ void ReadConfig() NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]]; - [writeDic setObject:@((unsigned short)[portNum intValue]) forKey:kIPPORT]; - [writeDic setObject:@([playerNum intValue]) forKey:kPLAYERNUM]; - [writeDic setObject:theAddress forKey:kIPADDRKEY]; + writeDic[kIPPORT] = @((unsigned short)[portNum intValue]); + writeDic[kPLAYERNUM] = @([playerNum intValue]); + writeDic[kIPADDRKEY] = theAddress; // write to defaults [defaults setObject:writeDic forKey:PrefsKey]; @@ -152,9 +147,9 @@ void ReadConfig() ReadConfig(); NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; - [ipAddress setStringValue:[keyValues objectForKey:kIPADDRKEY]]; - [portNum setIntValue:[[keyValues objectForKey:kIPPORT] unsignedShortValue]]; - [playerNum setIntValue:[[keyValues objectForKey:kPLAYERNUM] intValue]]; + [ipAddress setStringValue:keyValues[kIPADDRKEY]]; + [portNum setIntValue:[keyValues[kIPPORT] unsignedShortValue]]; + [playerNum setIntValue:[keyValues[kPLAYERNUM] intValue]]; } @end diff --git a/macosx/plugins/DFSound/macsrc/NamedSlider.m b/macosx/plugins/DFSound/macsrc/NamedSlider.m index 90a89eb5..1529471f 100755 --- a/macosx/plugins/DFSound/macsrc/NamedSlider.m +++ b/macosx/plugins/DFSound/macsrc/NamedSlider.m @@ -9,7 +9,7 @@ NSInteger index = [self integerValue]; if (index >= 0 && index < [strings count]) - return [strings objectAtIndex:index]; + return strings[index]; if (!pluginClass) { return @"(Unknown)"; diff --git a/macosx/plugins/DFSound/macsrc/PluginController.m b/macosx/plugins/DFSound/macsrc/PluginController.m index 12a2b3d7..d57e63f2 100755 --- a/macosx/plugins/DFSound/macsrc/PluginController.m +++ b/macosx/plugins/DFSound/macsrc/PluginController.m @@ -72,14 +72,12 @@ void DoAbout() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); @@ -109,29 +107,25 @@ void ReadConfig(void) { NSDictionary *keyValues; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - [NSDictionary dictionaryWithObjectsAndKeys: - @YES, @"High Compatibility Mode", - @YES, @"SPU IRQ Wait", - @NO, @"XA Pitch", - @NO, @"Mono Sound Output", - @0, @"Interpolation Quality", - @1, @"Reverb Quality", - @3, @"Volume", - nil], PrefsKey, - nil]]; + [defaults registerDefaults:@{PrefsKey: @{@"High Compatibility Mode": @YES, + @"SPU IRQ Wait": @YES, + @"XA Pitch": @NO, + @"Mono Sound Output": @NO, + @"Interpolation Quality": @0, + @"Reverb Quality": @1, + @"Volume": @3}}]; keyValues = [defaults dictionaryForKey:PrefsKey]; - iUseTimer = [[keyValues objectForKey:@"High Compatibility Mode"] boolValue] ? 2 : 0; - iSPUIRQWait = [[keyValues objectForKey:@"SPU IRQ Wait"] boolValue]; - iDisStereo = [[keyValues objectForKey:@"Mono Sound Output"] boolValue]; - iXAPitch = [[keyValues objectForKey:@"XA Pitch"] boolValue]; + iUseTimer = [keyValues[@"High Compatibility Mode"] boolValue] ? 2 : 0; + iSPUIRQWait = [keyValues[@"SPU IRQ Wait"] boolValue]; + iDisStereo = [keyValues[@"Mono Sound Output"] boolValue]; + iXAPitch = [keyValues[@"XA Pitch"] boolValue]; - iUseInterpolation = [[keyValues objectForKey:@"Interpolation Quality"] intValue]; - iUseReverb = [[keyValues objectForKey:@"Reverb Quality"] intValue]; + iUseInterpolation = [keyValues[@"Interpolation Quality"] intValue]; + iUseReverb = [keyValues[@"Reverb Quality"] intValue]; - iVolume = 5 - [[keyValues objectForKey:@"Volume"] intValue]; + iVolume = 5 - [keyValues[@"Volume"] intValue]; } @implementation PluginController @@ -146,15 +140,15 @@ void ReadConfig(void) NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:self.keyValues]; - [writeDic setObject:([hiCompBox intValue] ? @YES : @NO) forKey:@"High Compatibility Mode"]; - [writeDic setObject:([irqWaitBox intValue] ? @YES : @NO) forKey:@"SPU IRQ Wait"]; - [writeDic setObject:([monoSoundBox intValue] ? @YES : @NO) forKey:@"Mono Sound Output"]; - [writeDic setObject:([xaSpeedBox intValue] ? @YES : @NO) forKey:@"XA Pitch"]; + writeDic[@"High Compatibility Mode"] = ([hiCompBox intValue] ? @YES : @NO); + writeDic[@"SPU IRQ Wait"] = ([irqWaitBox intValue] ? @YES : @NO); + writeDic[@"Mono Sound Output"] = ([monoSoundBox intValue] ? @YES : @NO); + writeDic[@"XA Pitch"] = ([xaSpeedBox intValue] ? @YES : @NO); - [writeDic setObject:@([interpolValue intValue]) forKey:@"Interpolation Quality"]; - [writeDic setObject:@([reverbValue intValue]) forKey:@"Reverb Quality"]; + writeDic[@"Interpolation Quality"] = @([interpolValue intValue]); + writeDic[@"Reverb Quality"] = @([reverbValue intValue]); - [writeDic setObject:@([volumeValue intValue]) forKey:@"Volume"]; + writeDic[@"Volume"] = @([volumeValue intValue]); // write to defaults [defaults setObject:writeDic forKey:PrefsKey]; @@ -182,14 +176,14 @@ void ReadConfig(void) /* load from preferences */ self.keyValues = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:PrefsKey]]; - [hiCompBox setIntValue:[[keyValues objectForKey:@"High Compatibility Mode"] boolValue]]; - [irqWaitBox setIntValue:[[keyValues objectForKey:@"SPU IRQ Wait"] boolValue]]; - [monoSoundBox setIntValue:[[keyValues objectForKey:@"Mono Sound Output"] boolValue]]; - [xaSpeedBox setIntValue:[[keyValues objectForKey:@"XA Pitch"] boolValue]]; + [hiCompBox setIntValue:[keyValues[@"High Compatibility Mode"] boolValue]]; + [irqWaitBox setIntValue:[keyValues[@"SPU IRQ Wait"] boolValue]]; + [monoSoundBox setIntValue:[keyValues[@"Mono Sound Output"] boolValue]]; + [xaSpeedBox setIntValue:[keyValues[@"XA Pitch"] boolValue]]; - [interpolValue setIntValue:[[keyValues objectForKey:@"Interpolation Quality"] intValue]]; - [reverbValue setIntValue:[[keyValues objectForKey:@"Reverb Quality"] intValue]]; - [volumeValue setIntValue:[[keyValues objectForKey:@"Volume"] intValue]]; + [interpolValue setIntValue:[keyValues[@"Interpolation Quality"] intValue]]; + [reverbValue setIntValue:[keyValues[@"Reverb Quality"] intValue]]; + [volumeValue setIntValue:[keyValues[@"Volume"] intValue]]; } - (void)awakeFromNib diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m index d891c74c..53cf1230 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m @@ -63,14 +63,12 @@ void AboutDlgProc() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); @@ -98,28 +96,28 @@ BOOL isShaderEnabled() { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; - return [[keyValues objectForKey:@"UseShader"] boolValue]; + return [keyValues[@"UseShader"] boolValue]; } NSURL *PSXVertexShader() { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; - return [NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]; + return [NSURL URLByResolvingBookmarkData:keyValues[@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]; } NSURL *PSXFragmentShader() { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; - return [NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]; + return [NSURL URLByResolvingBookmarkData:keyValues[@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]; } float PSXShaderQuality() { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; - return (float)[[keyValues objectForKey:@"ShaderQuality"] intValue]; + return (float)[keyValues[@"ShaderQuality"] intValue]; } void ReadConfig(void) @@ -127,34 +125,30 @@ void ReadConfig(void) NSDictionary *keyValues; NSBundle *selfBundle = [NSBundle bundleWithIdentifier:APP_ID]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - [NSDictionary dictionaryWithObjectsAndKeys: - @NO, @"FPS Counter", - @NO, @"Auto Full Screen", - @NO, @"Frame Skipping", - @YES, @"Frame Limit", - @NO, @"VSync", - @NO, @"Enable Hacks", - @1, @"Dither Mode", - @((unsigned int)0), @"Hacks", - [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], @"VertexShader", - [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], @"FragmentShader", - @NO, @"UseShader", - @4, @"ShaderQuality", - nil], PrefsKey, - nil]]; + [defaults registerDefaults:@{PrefsKey: @{@"FPS Counter": @NO, + @"Auto Full Screen": @NO, + @"Frame Skipping": @NO, + @"Frame Limit": @YES, + @"VSync": @NO, + @"Enable Hacks": @NO, + @"Dither Mode": @1, + @"Hacks": @((unsigned int)0), + @"VertexShader": [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], + @"FragmentShader": [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil], + @"UseShader": @NO, + @"ShaderQuality": @4}}]; keyValues = [defaults dictionaryForKey:PrefsKey]; - iShowFPS = [[keyValues objectForKey:@"FPS Counter"] boolValue]; - iWindowMode = [[keyValues objectForKey:@"Auto Full Screen"] boolValue] ? 0 : 1; - UseFrameSkip = [[keyValues objectForKey:@"Frame Skipping"] boolValue]; - UseFrameLimit = [[keyValues objectForKey:@"Frame Limit"] boolValue]; + iShowFPS = [keyValues[@"FPS Counter"] boolValue]; + iWindowMode = [keyValues[@"Auto Full Screen"] boolValue] ? 0 : 1; + UseFrameSkip = [keyValues[@"Frame Skipping"] boolValue]; + UseFrameLimit = [keyValues[@"Frame Limit"] boolValue]; //??? = [[keyValues objectForKey:@"VSync"] boolValue]; - iUseFixes = [[keyValues objectForKey:@"Enable Hacks"] boolValue]; + iUseFixes = [keyValues[@"Enable Hacks"] boolValue]; - iUseDither = [[keyValues objectForKey:@"Dither Mode"] intValue]; - dwCfgFixes = [[keyValues objectForKey:@"Hacks"] unsignedIntValue]; + iUseDither = [keyValues[@"Dither Mode"] intValue]; + dwCfgFixes = [keyValues[@"Hacks"] unsignedIntValue]; iResX = 640; iResY = 480; @@ -199,25 +193,25 @@ void ReadConfig(void) NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues]; - [writeDic setObject:([fpsCounter intValue] ? @YES : @NO) forKey:@"FPS Counter"]; - [writeDic setObject:([autoFullScreen intValue] ? @YES : @NO) forKey:@"Auto Full Screen"]; - [writeDic setObject:([frameSkipping intValue] ? @YES : @NO) forKey:@"Frame Skipping"]; + writeDic[@"FPS Counter"] = ([fpsCounter intValue] ? @YES : @NO); + writeDic[@"Auto Full Screen"] = ([autoFullScreen intValue] ? @YES : @NO); + writeDic[@"Frame Skipping"] = ([frameSkipping intValue] ? @YES : @NO); //[writeDic setObject:@([frameLimit intValue]) forKey:@"Frame Limit"]; - [writeDic setObject:([vSync intValue] ? @YES : @NO) forKey:@"VSync"]; - [writeDic setObject:([hackEnable intValue] ? @YES : @NO) forKey:@"Enable Hacks"]; - [writeDic setObject:([shaders intValue] ? @YES : @NO) forKey:@"UseShader"]; - [writeDic setObject:@([shaderQualitySelector indexOfSelectedItem] + 1) forKey:@"ShaderQuality"]; - [writeDic setObject:@([ditherMode indexOfSelectedItem]) forKey:@"Dither Mode"]; + writeDic[@"VSync"] = ([vSync intValue] ? @YES : @NO); + writeDic[@"Enable Hacks"] = ([hackEnable intValue] ? @YES : @NO); + writeDic[@"UseShader"] = ([shaders intValue] ? @YES : @NO); + writeDic[@"ShaderQuality"] = @([shaderQualitySelector indexOfSelectedItem] + 1); + writeDic[@"Dither Mode"] = @([ditherMode indexOfSelectedItem]); unsigned int hackValues = 0; for (NSCell *control in [hacksMatrix cells]) { hackValues |= [control intValue] << ([control tag] - 1); } - [writeDic setObject:@(hackValues) forKey:@"Hacks"]; + writeDic[@"Hacks"] = @(hackValues); - [writeDic setObject:[vertexPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil] forKey:@"VertexShader"]; - [writeDic setObject:[fragmentPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil] forKey:@"FragmentShader"]; + writeDic[@"VertexShader"] = [vertexPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil]; + writeDic[@"FragmentShader"] = [fragmentPath bookmarkDataWithOptions:NSURLBookmarkCreationPreferFileIDResolution includingResourceValuesForKeys:nil relativeToURL:nil error:nil]; // write to defaults [defaults setObject:writeDic forKey:PrefsKey]; @@ -239,7 +233,7 @@ void ReadConfig(void) - (IBAction)hackToggle:(id)sender { BOOL enable = [sender intValue] ? YES : NO; - NSArray *views = [[[hacksView subviews] objectAtIndex:0] subviews]; + NSArray *views = [[hacksView subviews][0] subviews]; for (NSView *control in views) { if ([control isKindOfClass:[NSControl class]]) { @@ -253,7 +247,7 @@ void ReadConfig(void) - (IBAction)toggleShader:(id)sender { BOOL enable = [sender intValue] ? YES : NO; - NSArray *views = [[[shadersView subviews] objectAtIndex:0] subviews]; + NSArray *views = [[shadersView subviews][0] subviews]; for (NSView *control in views) { if ([control isKindOfClass:[NSControl class]]) { @@ -309,11 +303,11 @@ void ReadConfig(void) { BOOL resetPrefs = NO; - [self setVertexPathInfo:[NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]]; + [self setVertexPathInfo:[NSURL URLByResolvingBookmarkData:keyValues[@"VertexShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]]; if (!vertexPath) { resetPrefs = YES; } - [self setFragmentPathInfo:[NSURL URLByResolvingBookmarkData:[keyValues objectForKey:@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]]; + [self setFragmentPathInfo:[NSURL URLByResolvingBookmarkData:keyValues[@"FragmentShader"] options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:NULL error:nil]]; if (!fragmentPath) { resetPrefs = YES; } @@ -323,17 +317,17 @@ void ReadConfig(void) [self setFragmentPathInfo:[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"]]; } } - [fpsCounter setIntValue:[[keyValues objectForKey:@"FPS Counter"] intValue]]; - [autoFullScreen setIntValue:[[keyValues objectForKey:@"Auto Full Screen"] intValue]]; - [frameSkipping setIntValue:[[keyValues objectForKey:@"Frame Skipping"] intValue]]; - [vSync setIntValue:[[keyValues objectForKey:@"VSync"] intValue]]; - [hackEnable setIntValue:[[keyValues objectForKey:@"Enable Hacks"] intValue]]; - [shaders setIntValue:[[keyValues objectForKey:@"UseShader"] intValue]]; + [fpsCounter setIntValue:[keyValues[@"FPS Counter"] intValue]]; + [autoFullScreen setIntValue:[keyValues[@"Auto Full Screen"] intValue]]; + [frameSkipping setIntValue:[keyValues[@"Frame Skipping"] intValue]]; + [vSync setIntValue:[keyValues[@"VSync"] intValue]]; + [hackEnable setIntValue:[keyValues[@"Enable Hacks"] intValue]]; + [shaders setIntValue:[keyValues[@"UseShader"] intValue]]; - [ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] intValue]]; - [shaderQualitySelector selectItemAtIndex:[[keyValues objectForKey:@"ShaderQuality"] intValue] - 1]; + [ditherMode selectItemAtIndex:[keyValues[@"Dither Mode"] intValue]]; + [shaderQualitySelector selectItemAtIndex:[keyValues[@"ShaderQuality"] intValue] - 1]; - unsigned int hackValues = [[keyValues objectForKey:@"Hacks"] unsignedIntValue]; + unsigned int hackValues = [keyValues[@"Hacks"] unsignedIntValue]; for (NSCell *control in [hacksMatrix cells]) { [control setIntValue:(hackValues >> ([control tag] - 1)) & 1]; diff --git a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m index 17431fc3..0ad6dd74 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginWindowController.m @@ -45,7 +45,7 @@ NSRect windowFrame; [gameWindow makeKeyAndOrderFront:nil]; [gameController showWindow:nil]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[[gameWindow screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[[gameWindow screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue]; if (CGDisplayIsCaptured(display)) { [gameController setFullscreen:YES]; } @@ -89,7 +89,7 @@ NSRect windowFrame; { NSWindow *window = [self window]; NSScreen *screen = [window screen]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue]; NSDisableScreenUpdates(); diff --git a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m index 90043735..8d13d59b 100755 --- a/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m +++ b/macosx/plugins/PeopsXgl/macsrc/NetSfPeopsOpenGLPluginConfigController.m @@ -69,14 +69,12 @@ void AboutDlgProc() [icon setSize:size]; NSDictionary *infoPaneDict = - [[NSDictionary alloc] initWithObjectsAndKeys: - [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", - icon, @"ApplicationIcon", - [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", - [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", - [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", - credits, @"Credits", - nil]; + @{@"ApplicationName": [bundle objectForInfoDictionaryKey:@"CFBundleName"], + @"ApplicationIcon": icon, + @"ApplicationVersion": [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], + @"Version": [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], + @"Copyright": [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], + @"Credits": credits}; dispatch_async(dispatch_get_main_queue(), ^{ [NSApp orderFrontStandardAboutPanelWithOptions:infoPaneDict]; }); @@ -126,10 +124,10 @@ void PrepFactoryDefaultPreferences(void) NSDictionary* keyValues = [defaults dictionaryForKey:PrefsKey]; BOOL windowSizeNeedsReset = NO; if (keyValues) { - NSSize size = NSSizeFromString([keyValues objectForKey:kWindowSize]); - if (![keyValues objectForKey:kWindowSize]) { + NSSize size = NSSizeFromString(keyValues[kWindowSize]); + if (!keyValues[kWindowSize]) { windowSizeNeedsReset = YES; - } else if ([[keyValues objectForKey:kWindowSize] isKindOfClass:[NSNumber class]]) { + } else if ([keyValues[kWindowSize] isKindOfClass:[NSNumber class]]) { windowSizeNeedsReset = YES; } else if (size.height == 0 || size.width == 0) { windowSizeNeedsReset = YES; @@ -137,43 +135,40 @@ void PrepFactoryDefaultPreferences(void) } if (windowSizeNeedsReset) { NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] initWithDictionary:keyValues]; - [tmpDict setObject:NSStringFromSize(NSMakeSize(800, 600)) forKey:kWindowSize]; + tmpDict[kWindowSize] = NSStringFromSize(NSMakeSize(800, 600)); [defaults setObject:tmpDict forKey:PrefsKey]; [defaults synchronize]; } keyValues = nil; - [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - [NSDictionary dictionaryWithObjectsAndKeys: - @NO, kFPSCounter, - @NO, kAutoFullScreen, - @NO, kFrameSkipping, - @YES, kFrameLimit, - @NO, kVSync, - @NO, kHacksEnable, - @0, @"Dither Mode", - @0, kHacks, + [defaults registerDefaults:@{PrefsKey: @{kFPSCounter: @NO, + kAutoFullScreen: @NO, + kFrameSkipping: @NO, + kFrameLimit: @YES, + kVSync: @NO, + kHacksEnable: @NO, + @"Dither Mode": @0, + kHacks: @0, - @YES, @"Proportional Resize", + @"Proportional Resize": @YES, //[NSSize stringWithCString: @"default"], @"Fullscreen Resolution", - @2, @"Offscreen Drawing Level", - @0, @"Texture Color Depth Level", - @0, @"Texture Enhancement Level", - @0, @"Texture Filter Level", - @0, @"Frame Buffer Level", - NSStringFromSize(NSMakeSize(800, 600)), kWindowSize, - @NO, @"Draw Scanlines", + @"Offscreen Drawing Level": @2, + @"Texture Color Depth Level": @0, + @"Texture Enhancement Level": @0, + @"Texture Filter Level": @0, + @"Frame Buffer Level": @0, + kWindowSize: NSStringFromSize(NSMakeSize(800, 600)), + @"Draw Scanlines": @NO, // nasty: - [NSArchiver archivedDataWithRootObject: [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.25]], @"Scanline Color", - @NO, @"Advanced Blending", - @NO, @"Opaque Pass", - @NO, @"Blur", - @YES, @"Z Mask Clipping", - @NO, @"Wireframe Mode", - @YES, @"Emulate mjpeg decoder", // helps remove unsightly vertical line in movies - @NO, @"Fast mjpeg decoder", - @YES, @"GteAccuracy", - nil], PrefsKey, nil]]; + @"Scanline Color": [NSArchiver archivedDataWithRootObject: [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.25]], + @"Advanced Blending": @NO, + @"Opaque Pass": @NO, + @"Blur": @NO, + @"Z Mask Clipping": @YES, + @"Wireframe Mode": @NO, + @"Emulate mjpeg decoder": @YES, // helps remove unsightly vertical line in movies + @"Fast mjpeg decoder": @NO, + @"GteAccuracy": @YES}}]; } void ReadConfig(void) @@ -192,26 +187,26 @@ void ReadConfig(void) // bind all prefs settings to their PCSXR counterparts // with a little finagling to make it work as expected - iShowFPS = [[keyValues objectForKey:kFPSCounter] boolValue]; + iShowFPS = [keyValues[kFPSCounter] boolValue]; - if ([[keyValues objectForKey:kFrameLimit] boolValue]){ + if ([keyValues[kFrameLimit] boolValue]){ bUseFrameLimit = 1; iFrameLimit = 2; // required fFrameRate = 60; // required (some number, 60 seems ok) } // Dithering is either on or off in OpenGL plug, but hey - bDrawDither = [[keyValues objectForKey:@"Dither Mode"] intValue]; + bDrawDither = [keyValues[@"Dither Mode"] intValue]; - bChangeWinMode = [[keyValues objectForKey:kAutoFullScreen] boolValue] ? 2 : 1; - bUseFrameSkip = [[keyValues objectForKey:kFrameSkipping] boolValue]; + bChangeWinMode = [keyValues[kAutoFullScreen] boolValue] ? 2 : 1; + bUseFrameSkip = [keyValues[kFrameSkipping] boolValue]; - bUseFixes = [[keyValues objectForKey:kHacksEnable] boolValue]; - dwCfgFixes = [[keyValues objectForKey:kHacks] unsignedIntValue]; + bUseFixes = [keyValues[kHacksEnable] boolValue]; + dwCfgFixes = [keyValues[kHacks] unsignedIntValue]; // we always start out at 800x600 (at least until resizing the window is implemented) - NSSize winSize = NSSizeFromString([keyValues objectForKey:kWindowSize]); + NSSize winSize = NSSizeFromString(keyValues[kWindowSize]); if (bChangeWinMode == 1) { iResX = winSize.width; iResY = winSize.height; @@ -220,9 +215,9 @@ void ReadConfig(void) iResY = 600; } - iBlurBuffer = [[keyValues objectForKey:@"Blur"] boolValue]; // not noticeable, but doesn't harm - iUseScanLines = [[keyValues objectForKey:@"Draw Scanlines"] boolValue]; // works - NSColor* scanColor = [NSUnarchiver unarchiveObjectWithData:[keyValues objectForKey:@"Scanline Color"]]; + iBlurBuffer = [keyValues[@"Blur"] boolValue]; // not noticeable, but doesn't harm + iUseScanLines = [keyValues[@"Draw Scanlines"] boolValue]; // works + NSColor* scanColor = [NSUnarchiver unarchiveObjectWithData:keyValues[@"Scanline Color"]]; scanColor = [scanColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]]; iScanlineColor[0] = [scanColor redComponent]; iScanlineColor[1] = [scanColor greenComponent]; @@ -230,29 +225,29 @@ void ReadConfig(void) iScanlineColor[3] = [scanColor alphaComponent]; iScanBlend = 0; // we always draw nice since it costs nothing. - iUseMask = [[keyValues objectForKey:@"Z Mask Clipping"] boolValue]; // works, clips polygons with primitive "Z" buffer - bUseLines = [[keyValues objectForKey:@"Wireframe Mode"] boolValue]; // works, aka "Wireframe" mode - iOffscreenDrawing = [[keyValues objectForKey:@"Offscreen Drawing Level"] intValue]; // draw offscreen for texture building? + iUseMask = [keyValues[@"Z Mask Clipping"] boolValue]; // works, clips polygons with primitive "Z" buffer + bUseLines = [keyValues[@"Wireframe Mode"] boolValue]; // works, aka "Wireframe" mode + iOffscreenDrawing = [keyValues[@"Offscreen Drawing Level"] intValue]; // draw offscreen for texture building? if (iOffscreenDrawing > 4) iOffscreenDrawing = 4; if (iOffscreenDrawing < 0) iOffscreenDrawing = 0; // texture quality, whatever that means (doesn't hurt), more like "texture handling" or "texture performance" - iFrameTexType = [[keyValues objectForKey:@"Frame Buffer Level"] intValue]; + iFrameTexType = [keyValues[@"Frame Buffer Level"] intValue]; if (iFrameTexType > 3) iFrameTexType = 3; if (iFrameTexType < 0) iFrameTexType = 0; - iTexQuality = [[keyValues objectForKey:@"Texture Color Depth Level"] intValue]; + iTexQuality = [keyValues[@"Texture Color Depth Level"] intValue]; if (iTexQuality > 4) iTexQuality = 4; if (iTexQuality < 0) iTexQuality = 0; // MAG_FILTER = LINEAR, etc. - iFilterType = [[keyValues objectForKey:@"Texture Filter Level"] intValue]; + iFilterType = [keyValues[@"Texture Filter Level"] intValue]; if (iFilterType > 2) iFilterType = 2; if (iFilterType < 0) iFilterType = 0; // stretches textures (more detail). You'd think it would look great, but it's not massively better. NEEDS iFilterType to be of any use. - iHiResTextures = [[keyValues objectForKey:@"Texture Enhancement Level"] intValue]; + iHiResTextures = [keyValues[@"Texture Enhancement Level"] intValue]; if (iHiResTextures > 2) iHiResTextures = 2; if (iHiResTextures < 0) iHiResTextures = 0; @@ -263,9 +258,9 @@ void ReadConfig(void) if (iHiResTextures && !iFilterType) iFilterType = 1; // needed to see any real effect - bUseFastMdec = [[keyValues objectForKey:@"Emulate mjpeg decoder"] boolValue]; - bUse15bitMdec = [[keyValues objectForKey:@"Fast mjpeg decoder"] boolValue]; - bGteAccuracy = [[keyValues objectForKey:@"GteAccuracy"] boolValue]; + bUseFastMdec = [keyValues[@"Emulate mjpeg decoder"] boolValue]; + bUse15bitMdec = [keyValues[@"Fast mjpeg decoder"] boolValue]; + bGteAccuracy = [keyValues[@"GteAccuracy"] boolValue]; if (iShowFPS) ulKeybits |= KEY_SHOWFPS; @@ -305,29 +300,29 @@ void ReadConfig(void) NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues]; - [writeDic setObject:([fpsCounter integerValue] ? @YES : @NO) forKey:kFPSCounter]; - [writeDic setObject:[NSArchiver archivedDataWithRootObject:[scanlineColorWell color]] forKey:@"Scanline Color"]; - [writeDic setObject:([frameSkipping integerValue] ? @YES : @NO) forKey:kFrameSkipping]; - [writeDic setObject:([autoFullScreen integerValue] ? @YES : @NO) forKey:kAutoFullScreen]; + writeDic[kFPSCounter] = ([fpsCounter integerValue] ? @YES : @NO); + writeDic[@"Scanline Color"] = [NSArchiver archivedDataWithRootObject:[scanlineColorWell color]]; + writeDic[kFrameSkipping] = ([frameSkipping integerValue] ? @YES : @NO); + writeDic[kAutoFullScreen] = ([autoFullScreen integerValue] ? @YES : @NO); //[writeDic setObject:([frameLimit integerValue] ? @YES : @NO) forKey:kFrameLimit]; - [writeDic setObject:([proportionalResize integerValue] ? @YES : @NO) forKey:@"Proportional Resize"]; - [writeDic setObject:@([ditherMode indexOfSelectedItem]) forKey:@"Dither Mode"]; - [writeDic setObject:@([offscreenDrawing indexOfSelectedItem]) forKey:@"Offscreen Drawing Level"]; - [writeDic setObject:@([texColorDepth indexOfSelectedItem]) forKey:@"Texture Color Depth Level"]; - [writeDic setObject:@([texEnhancment integerValue]) forKey:@"Texture Enhancement Level"]; - [writeDic setObject:@([texFiltering integerValue]) forKey:@"Texture Filter Level"]; - [writeDic setObject:@([frameBufferEffects indexOfSelectedItem]) forKey:@"Frame Buffer Level"]; - [writeDic setObject:([drawScanlines integerValue] ? @YES : @NO) forKey:@"Draw Scanlines"]; - [writeDic setObject:([advancedBlending integerValue] ? @YES : @NO) forKey:@"Advanced Blending"]; - [writeDic setObject:([opaquePass integerValue] ? @YES : @NO) forKey:@"Opaque Pass"]; - [writeDic setObject:([blurEffect integerValue] ? @YES : @NO) forKey:@"Blur"]; - [writeDic setObject:([zMaskClipping integerValue] ? @YES : @NO) forKey:@"Z Mask Clipping"]; - [writeDic setObject:([wireframeOnly integerValue] ? @YES : @NO) forKey:@"Wireframe Mode"]; - [writeDic setObject:([mjpegDecoder integerValue] ? @YES : @NO) forKey:@"Emulate mjpeg decoder"]; - [writeDic setObject:([mjpegDecoder15bit integerValue] ? @YES : @NO) forKey:@"Fast mjpeg decoder"]; - [writeDic setObject:([gteAccuracy integerValue] ? @YES : @NO) forKey:@"GteAccuracy"]; - [writeDic setObject:([vSync integerValue] ? @YES : @NO) forKey:kVSync]; - [writeDic setObject:NSStringFromSize(NSMakeSize([windowWidth integerValue], [windowHeighth integerValue])) forKey:kWindowSize]; + writeDic[@"Proportional Resize"] = ([proportionalResize integerValue] ? @YES : @NO); + writeDic[@"Dither Mode"] = @([ditherMode indexOfSelectedItem]); + writeDic[@"Offscreen Drawing Level"] = @([offscreenDrawing indexOfSelectedItem]); + writeDic[@"Texture Color Depth Level"] = @([texColorDepth indexOfSelectedItem]); + writeDic[@"Texture Enhancement Level"] = @([texEnhancment integerValue]); + writeDic[@"Texture Filter Level"] = @([texFiltering integerValue]); + writeDic[@"Frame Buffer Level"] = @([frameBufferEffects indexOfSelectedItem]); + writeDic[@"Draw Scanlines"] = ([drawScanlines integerValue] ? @YES : @NO); + writeDic[@"Advanced Blending"] = ([advancedBlending integerValue] ? @YES : @NO); + writeDic[@"Opaque Pass"] = ([opaquePass integerValue] ? @YES : @NO); + writeDic[@"Blur"] = ([blurEffect integerValue] ? @YES : @NO); + writeDic[@"Z Mask Clipping"] = ([zMaskClipping integerValue] ? @YES : @NO); + writeDic[@"Wireframe Mode"] = ([wireframeOnly integerValue] ? @YES : @NO); + writeDic[@"Emulate mjpeg decoder"] = ([mjpegDecoder integerValue] ? @YES : @NO); + writeDic[@"Fast mjpeg decoder"] = ([mjpegDecoder15bit integerValue] ? @YES : @NO); + writeDic[@"GteAccuracy"] = ([gteAccuracy integerValue] ? @YES : @NO); + writeDic[kVSync] = ([vSync integerValue] ? @YES : @NO); + writeDic[kWindowSize] = NSStringFromSize(NSMakeSize([windowWidth integerValue], [windowHeighth integerValue])); [defaults setObject:writeDic forKey:PrefsKey]; [defaults synchronize]; @@ -355,8 +350,8 @@ void ReadConfig(void) - (void)loadHacksValues { - unsigned int hackValues = [[self.keyValues objectForKey:kHacks] unsignedIntValue]; - [hackEnable setIntegerValue:[[self.keyValues objectForKey:kHacksEnable] boolValue]]; + unsigned int hackValues = [(self.keyValues)[kHacks] unsignedIntValue]; + [hackEnable setIntegerValue:[(self.keyValues)[kHacksEnable] boolValue]]; // build refs to hacks checkboxes for (NSControl *control in [hacksMatrix cells]) { @@ -379,30 +374,30 @@ void ReadConfig(void) [self loadHacksValues]; - [autoFullScreen setIntegerValue:[[keyValues objectForKey:kAutoFullScreen] boolValue]]; - [ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] integerValue]]; - [fpsCounter setIntegerValue:[[keyValues objectForKey:kFPSCounter] boolValue]]; - [scanlineColorWell setColor:[NSUnarchiver unarchiveObjectWithData: [keyValues objectForKey:@"Scanline Color"]]]; - [frameSkipping setIntegerValue:[[keyValues objectForKey:kFrameSkipping] boolValue]]; - [advancedBlending setIntegerValue:[[keyValues objectForKey:@"Advanced Blending"] boolValue]]; - [texFiltering setIntegerValue:[[keyValues objectForKey:@"Texture Filter Level"] integerValue]]; - [texEnhancment setIntegerValue:[[keyValues objectForKey:@"Texture Enhancement Level"] integerValue]]; - [zMaskClipping setIntegerValue:[[keyValues objectForKey:@"Z Mask Clipping"] integerValue]]; - [mjpegDecoder setIntegerValue:[[keyValues objectForKey:@"Emulate mjpeg decoder"] boolValue]]; - [mjpegDecoder15bit setIntegerValue:[[keyValues objectForKey:@"Fast mjpeg decoder"] boolValue]]; - [drawScanlines setIntegerValue:[[keyValues objectForKey:@"Draw Scanlines"] boolValue]]; - [offscreenDrawing selectItemAtIndex:[[keyValues objectForKey:@"Offscreen Drawing Level"] integerValue]]; - [advancedBlending setIntegerValue:[[keyValues objectForKey:@"Advanced Blending"] boolValue]]; - [opaquePass setIntegerValue:[[keyValues objectForKey:@"Opaque Pass"] boolValue]]; - [wireframeOnly setIntegerValue:[[keyValues objectForKey:@"Wireframe Mode"] boolValue]]; - [blurEffect setIntegerValue:[[keyValues objectForKey:@"Blur"] boolValue]]; - [texColorDepth selectItemAtIndex:[[keyValues objectForKey:@"Texture Color Depth Level"] integerValue]]; - [gteAccuracy setIntegerValue:[[keyValues objectForKey:@"GteAccuracy"] boolValue]]; - [scanlineColorWell setEnabled:[[keyValues objectForKey:@"Draw Scanlines"] boolValue]]; - [frameBufferEffects selectItemAtIndex:[[keyValues objectForKey:@"Frame Buffer Level"] integerValue]]; - [vSync setIntegerValue:[[keyValues objectForKey:kVSync] boolValue]]; - [proportionalResize setIntegerValue:[[keyValues objectForKey:@"Proportional Resize"] boolValue]]; - NSSize winSize = NSSizeFromString([keyValues objectForKey:kWindowSize]); + [autoFullScreen setIntegerValue:[keyValues[kAutoFullScreen] boolValue]]; + [ditherMode selectItemAtIndex:[keyValues[@"Dither Mode"] integerValue]]; + [fpsCounter setIntegerValue:[keyValues[kFPSCounter] boolValue]]; + [scanlineColorWell setColor:[NSUnarchiver unarchiveObjectWithData: keyValues[@"Scanline Color"]]]; + [frameSkipping setIntegerValue:[keyValues[kFrameSkipping] boolValue]]; + [advancedBlending setIntegerValue:[keyValues[@"Advanced Blending"] boolValue]]; + [texFiltering setIntegerValue:[keyValues[@"Texture Filter Level"] integerValue]]; + [texEnhancment setIntegerValue:[keyValues[@"Texture Enhancement Level"] integerValue]]; + [zMaskClipping setIntegerValue:[keyValues[@"Z Mask Clipping"] integerValue]]; + [mjpegDecoder setIntegerValue:[keyValues[@"Emulate mjpeg decoder"] boolValue]]; + [mjpegDecoder15bit setIntegerValue:[keyValues[@"Fast mjpeg decoder"] boolValue]]; + [drawScanlines setIntegerValue:[keyValues[@"Draw Scanlines"] boolValue]]; + [offscreenDrawing selectItemAtIndex:[keyValues[@"Offscreen Drawing Level"] integerValue]]; + [advancedBlending setIntegerValue:[keyValues[@"Advanced Blending"] boolValue]]; + [opaquePass setIntegerValue:[keyValues[@"Opaque Pass"] boolValue]]; + [wireframeOnly setIntegerValue:[keyValues[@"Wireframe Mode"] boolValue]]; + [blurEffect setIntegerValue:[keyValues[@"Blur"] boolValue]]; + [texColorDepth selectItemAtIndex:[keyValues[@"Texture Color Depth Level"] integerValue]]; + [gteAccuracy setIntegerValue:[keyValues[@"GteAccuracy"] boolValue]]; + [scanlineColorWell setEnabled:[keyValues[@"Draw Scanlines"] boolValue]]; + [frameBufferEffects selectItemAtIndex:[keyValues[@"Frame Buffer Level"] integerValue]]; + [vSync setIntegerValue:[keyValues[kVSync] boolValue]]; + [proportionalResize setIntegerValue:[keyValues[@"Proportional Resize"] boolValue]]; + NSSize winSize = NSSizeFromString(keyValues[kWindowSize]); [windowWidth setIntegerValue:winSize.width]; [windowHeighth setIntegerValue:winSize.height]; } @@ -424,8 +419,8 @@ void ReadConfig(void) hackValues |= [control intValue] << ([control tag] - 1); } NSMutableDictionary *writeDic = self.keyValues; - [writeDic setObject:@(hackValues) forKey:kHacks]; - [writeDic setObject:([hackEnable integerValue] ? @YES : @NO) forKey:kHacksEnable]; + writeDic[kHacks] = @(hackValues); + writeDic[kHacksEnable] = ([hackEnable integerValue] ? @YES : @NO); } [sheet orderOut:nil]; } diff --git a/macosx/plugins/PeopsXgl/macsrc/PluginWindowController.m b/macosx/plugins/PeopsXgl/macsrc/PluginWindowController.m index e2abff7b..8ef05168 100755 --- a/macosx/plugins/PeopsXgl/macsrc/PluginWindowController.m +++ b/macosx/plugins/PeopsXgl/macsrc/PluginWindowController.m @@ -98,7 +98,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination) [glInstance reshape]; // [glView update]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[[gameWindow screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[[gameWindow screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue]; if (CGDisplayIsCaptured(display)) { [gameController setFullscreen:YES]; } @@ -138,7 +138,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination) - (NSRect) screenFrame { NSWindow* wind = [self window]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[[wind screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[[wind screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue]; return NSMakeRect (0,0,CGDisplayPixelsWide(display), CGDisplayPixelsHigh(display)); } @@ -271,7 +271,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination) NSWindow *window = [self window]; NSScreen *screen = [window screen]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue]; NSRect newPlace; @@ -358,7 +358,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination) NSWindow *window = [self window]; NSScreen *screen = [window screen]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue]; if ([self fullscreen]){ [window setLevel: NSScreenSaverWindowLevel]; @@ -371,7 +371,7 @@ NSRect FitRectInRect(NSRect source, NSRect destination) // if in fullscreen, we must abdicate mouse hiding and level. NSWindow *window = [self window]; NSScreen *screen = [window screen]; - CGDirectDisplayID display = (CGDirectDisplayID)[[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; + CGDirectDisplayID display = (CGDirectDisplayID)[[screen deviceDescription][@"NSScreenNumber"] unsignedIntValue]; if ([self fullscreen]){ [window setLevel: NSNormalWindowLevel]; |
