summaryrefslogtreecommitdiff
path: root/macosx/plugins/DFInput/macsrc/PadController.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-10-05 03:15:55 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-10-05 03:15:55 +0000
commit609b09af544e8adf4f1a841f77cfe3c1203173f4 (patch)
tree90f512d1a100fbcb1bdad5bd9a2a1ff43acb3abd /macosx/plugins/DFInput/macsrc/PadController.m
parent78e3ae579f91d019329f09977a7f94293001d291 (diff)
Don’t load old pad preferences on OS X if we already have new ones.
Do a quick static analyze when building for release. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@87356 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFInput/macsrc/PadController.m')
-rwxr-xr-xmacosx/plugins/DFInput/macsrc/PadController.m19
1 files changed, 13 insertions, 6 deletions
diff --git a/macosx/plugins/DFInput/macsrc/PadController.m b/macosx/plugins/DFInput/macsrc/PadController.m
index b35e7439..c08ae578 100755
--- a/macosx/plugins/DFInput/macsrc/PadController.m
+++ b/macosx/plugins/DFInput/macsrc/PadController.m
@@ -131,20 +131,27 @@ static void SetDefaultConfig() {
g.cfg.PadDef[1].KeyDef[DKEY_SQUARE].J.Button = 3;
}
-
-
void LoadPADConfig()
{
SetDefaultConfig();
- [[NSUserDefaults standardUserDefaults] registerDefaults:
+ BOOL tryToLoadOld = YES;
+ //Do we have the new settings?
+ //This is placed here so we don't have the prefskey defined.
+ NSUserDefaults *usrDefaults = [NSUserDefaults standardUserDefaults];
+ if ([usrDefaults objectForKey:PrefsKey]) {
+ //Yes we do, don't load the old.
+ tryToLoadOld = NO;
+ }
+
+ [usrDefaults registerDefaults:
@{PrefsKey: @{kDFPad1: DefaultPadArray(0),
kDFPad2: DefaultPadArray(1),
kDFThreading: @YES}}];
- //Load the old preferences if present.
+ //Load the old preferences if present and we don't have new ones.
NSFileManager *fm = [NSFileManager defaultManager];
NSString *oldPrefPath = [NSString pathWithComponents:@[NSHomeDirectory(), @"Library", @"Preferences", @"net.pcsxr.DFInput.plist"]];
- if ([fm fileExistsAtPath:oldPrefPath]) {
+ if ([fm fileExistsAtPath:oldPrefPath] && tryToLoadOld) {
char buf[256] = {0};
int current = 0, a = 0, b = 0, c = 0;
@@ -301,7 +308,7 @@ void LoadPADConfig()
//Delete the old preferences
[fm removeItemAtPath:oldPrefPath error:NULL];
} else {
- NSDictionary *dfPrefs = [[NSUserDefaults standardUserDefaults] dictionaryForKey:PrefsKey];
+ NSDictionary *dfPrefs = [usrDefaults dictionaryForKey:PrefsKey];
g.cfg.Threaded = [dfPrefs[kDFThreading] boolValue];
LoadPadArray(0, dfPrefs[kDFPad1]);
LoadPadArray(1, dfPrefs[kDFPad2]);