Cocoa Port:

- Enable Speed Limit, Enable Auto Frame Skip, and Enable Cheats options now remember their states between app runs, instead of always being reset to enabled on startup.
This commit is contained in:
rogerman 2013-04-24 20:58:36 +00:00
parent 21faaa78b4
commit a9750234c9
3 changed files with 23 additions and 5 deletions

View File

@ -1037,8 +1037,8 @@
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[[NSUserDefaults standardUserDefaults] setInteger:[cdsCore slot1DeviceType] forKey:@"EmulationSLOT1_DeviceType"];
[[NSUserDefaults standardUserDefaults] setObject:[[cdsCore slot1R4URL] path] forKey:@"EmulationSLOT1_R4StoragePath"];
[[NSUserDefaults standardUserDefaults] setInteger:[cdsCore slot1DeviceType] forKey:@"EmulationSlot1_DeviceType"];
[[NSUserDefaults standardUserDefaults] setObject:[[cdsCore slot1R4URL] path] forKey:@"EmulationSlot1_R4StoragePath"];
}
- (IBAction) writeDefaultsSoundSettings:(id)sender
@ -1226,11 +1226,13 @@
{
[cdsCore setIsSpeedLimitEnabled:NO];
[self setStatusText:NSSTRING_STATUS_SPEED_LIMIT_DISABLED];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"CoreControl_EnableSpeedLimit"];
}
else
{
[cdsCore setIsSpeedLimitEnabled:YES];
[self setStatusText:NSSTRING_STATUS_SPEED_LIMIT_ENABLED];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"CoreControl_EnableSpeedLimit"];
}
}
@ -1250,11 +1252,13 @@
{
[cdsCore setIsFrameSkipEnabled:NO];
[self setStatusText:NSSTRING_STATUS_AUTO_FRAME_SKIP_DISABLED];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"CoreControl_EnableAutoFrameSkip"];
}
else
{
[cdsCore setIsFrameSkipEnabled:YES];
[self setStatusText:NSSTRING_STATUS_AUTO_FRAME_SKIP_ENABLED];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"CoreControl_EnableAutoFrameSkip"];
}
}
@ -1274,11 +1278,13 @@
{
[cdsCore setIsCheatingEnabled:NO];
[self setStatusText:NSSTRING_STATUS_CHEATS_DISABLED];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"CoreControl_EnableCheats"];
}
else
{
[cdsCore setIsCheatingEnabled:YES];
[self setStatusText:NSSTRING_STATUS_CHEATS_ENABLED];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"CoreControl_EnableCheats"];
}
}
@ -1860,7 +1866,7 @@
return;
}
[[NSUserDefaults standardUserDefaults] setObject:[selectedDirURL path] forKey:@"EmulationSLOT1_R4StoragePath"];
[[NSUserDefaults standardUserDefaults] setObject:[selectedDirURL path] forKey:@"EmulationSlot1_R4StoragePath"];
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore setSlot1R4URL:selectedDirURL];

View File

@ -307,6 +307,13 @@
- (void)applicationWillTerminate:(NSNotification *)notification
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
// Save some settings to user defaults before app termination
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore isSpeedLimitEnabled] forKey:@"CoreControl_EnableSpeedLimit"];
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore isFrameSkipEnabled] forKey:@"CoreControl_EnableAutoFrameSkip"];
[[NSUserDefaults standardUserDefaults] setBool:[cdsCore isCheatingEnabled] forKey:@"CoreControl_EnableCheats"];
[cdsCoreController setContent:nil];
}
@ -444,10 +451,15 @@
[cdsCore setMaxJITBlockSize:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_MaxJITBlockSize"]];
// Set the SLOT-1 device settings per user preferences.
NSString *slot1R4Path = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"EmulationSLOT1_R4StoragePath"];
[cdsCore setSlot1DeviceType:[[NSUserDefaults standardUserDefaults] integerForKey:@"EmulationSLOT1_DeviceType"]];
NSString *slot1R4Path = (NSString *)[[NSUserDefaults standardUserDefaults] objectForKey:@"EmulationSlot1_R4StoragePath"];
[cdsCore setSlot1DeviceType:[[NSUserDefaults standardUserDefaults] integerForKey:@"EmulationSlot1_DeviceType"]];
[cdsCore setSlot1R4URL:(slot1R4Path != nil) ? [NSURL fileURLWithPath:slot1R4Path] : nil];
// Set the miscellaneous emulations settings per user preferences.
[cdsCore setIsSpeedLimitEnabled:[[NSUserDefaults standardUserDefaults] boolForKey:@"CoreControl_EnableSpeedLimit"]];
[cdsCore setIsFrameSkipEnabled:[[NSUserDefaults standardUserDefaults] boolForKey:@"CoreControl_EnableAutoFrameSkip"]];
[cdsCore setIsCheatingEnabled:[[NSUserDefaults standardUserDefaults] boolForKey:@"CoreControl_EnableCheats"]];
// Set up the firmware per user preferences.
NSMutableDictionary *newFWDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[[NSUserDefaults standardUserDefaults] objectForKey:@"FirmwareConfig_Nickname"], @"Nickname",