From d580a33a7f664910001a75c8d5c879c9e86db546 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 8 Apr 2016 13:10:01 +0300 Subject: [PATCH] Save user's preferences in the Cocoa port --- Cocoa/Document.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Cocoa/Document.m b/Cocoa/Document.m index fbd483d7f..0c1f9cac7 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -58,7 +58,12 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, unsigned char r, unsigned char g, un if (self) { has_debugger_input = [[NSConditionLock alloc] initWithCondition:0]; debugger_input_queue = [[NSMutableArray alloc] init]; - [self initCGB]; + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"EmulateDMG"]) { + [self initDMG]; + } + else { + [self initCGB]; + } } return self; } @@ -142,6 +147,10 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, unsigned char r, unsigned char g, un else { [self initDMG]; } + if ([sender tag] != 0) { + /* User explictly selected a model, save the preference */ + [[NSUserDefaults standardUserDefaults] setBool:!gb.is_cgb forKey:@"EmulateDMG"]; + } [self readFromFile:self.fileName ofType:@"gb"]; [self start]; } @@ -165,6 +174,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, unsigned char r, unsigned char g, un [super windowControllerDidLoadNib:aController]; self.consoleOutput.textContainerInset = NSMakeSize(4, 4); [self.view becomeFirstResponder]; + self.view.shouldBlendFrameWithPrevious = ![[NSUserDefaults standardUserDefaults] boolForKey:@"DisableFrameBlending"]; [self start]; } @@ -216,6 +226,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, unsigned char r, unsigned char g, un - (IBAction)toggleBlend:(id)sender { self.view.shouldBlendFrameWithPrevious ^= YES; + [[NSUserDefaults standardUserDefaults] setBool:!self.view.shouldBlendFrameWithPrevious forKey:@"DisableFrameBlending"]; } - (BOOL)validateUserInterfaceItem:(id)anItem