From b11cc9582440fd162d058aefc942a6441eb80675 Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Sun, 29 Nov 2009 13:31:23 +0000 Subject: git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@38448 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/ConfigurationController.m | 69 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) (limited to 'macosx/ConfigurationController.m') diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m index e62465e2..be5bf69d 100644 --- a/macosx/ConfigurationController.m +++ b/macosx/ConfigurationController.m @@ -33,10 +33,69 @@ } } +- (IBAction)mcdChangeClicked:(id)sender +{ + int tag = [sender tag]; + char *mcd; + NSTextField *label; + NSOpenPanel *openDlg = [NSOpenPanel openPanel]; + NSString *path; + + if (tag == 1) { mcd = Config.Mcd1; label = mcd1Label; } + else { mcd = Config.Mcd2; label = mcd2Label; } + + [openDlg setCanChooseFiles:YES]; + [openDlg setCanChooseDirectories:NO]; + + path = [NSString stringWithCString:mcd]; + + if ([openDlg runModalForDirectory:[path stringByDeletingLastPathComponent] file:[path lastPathComponent]] == NSOKButton) { + NSArray* files = [openDlg filenames]; + strcpy(mcd, (const char *)[[files objectAtIndex:0] fileSystemRepresentation]); + + [label setTitleWithMnemonic:[NSString stringWithCString:mcd]]; + + if (tag == 1) + [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd1"]; + else + [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd2"]; + + LoadMcds(Config.Mcd1, Config.Mcd2); + } +} + +- (IBAction)mcdNewClicked:(id)sender +{ + int tag = [sender tag]; + char *mcd; + NSTextField *label; + NSSavePanel *openDlg = [NSSavePanel savePanel]; + NSString *path; + + if (tag == 1) { mcd = Config.Mcd1; label = mcd1Label; } + else { mcd = Config.Mcd2; label = mcd2Label; } + + path = [NSString stringWithCString:mcd]; + + if ([openDlg runModalForDirectory:[path stringByDeletingLastPathComponent] file:@"New Memory Card File.mcr"] == NSOKButton) { + strcpy(mcd, (const char *)[[openDlg filename] fileSystemRepresentation]); + + [label setTitleWithMnemonic:[NSString stringWithCString:mcd]]; + + if (tag == 1) + [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd1"]; + else + [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithCString:mcd] forKey:@"Mcd2"]; + + CreateMcd(mcd); + LoadMcds(Config.Mcd1, Config.Mcd2); + } +} + - (IBAction)setVideoType:(id)sender { int tag = [[sender selectedItem] tag]; - + if (3 == tag) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"AutoDetectVideoType"]; } else if (1 == tag || 2 == tag) { @@ -46,7 +105,7 @@ return; } [PcsxController setConfigFromDefaults]; - + if ([sender pullsDown]) { NSArray *items = [sender itemArray]; int i; @@ -98,6 +157,10 @@ [usesHleCell setEnabled:NO]; } + // setup labels + [mcd1Label setTitleWithMnemonic:[NSString stringWithCString:Config.Mcd1]]; + [mcd2Label setTitleWithMnemonic:[NSString stringWithCString:Config.Mcd2]]; + int tag = [defaults integerForKey:@"AutoDetectVideoType"]; if (tag) tag = 3; @@ -136,7 +199,7 @@ if ([object isEqual:sender]) return key; } - + return nil; } -- cgit v1.2.3