summaryrefslogtreecommitdiff
path: root/macosx/ConfigurationController.m
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-07-20 05:09:43 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-07-20 05:09:43 +0000
commitd6942932d64a02aa92b1e04e91f6126f33fdb05e (patch)
tree7cad698308e39abc2b0e1c71674c610ec3ce74dd /macosx/ConfigurationController.m
parentb8d0d24d56dbc0ee64f4ec9a72ab917604d8109d (diff)
downloadpcsxr-d6942932d64a02aa92b1e04e91f6126f33fdb05e.tar.gz
OS X: Move source files to their own folder.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@90999 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/ConfigurationController.m')
-rwxr-xr-xmacosx/ConfigurationController.m291
1 files changed, 0 insertions, 291 deletions
diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m
deleted file mode 100755
index aef8f7f4..00000000
--- a/macosx/ConfigurationController.m
+++ /dev/null
@@ -1,291 +0,0 @@
-#import "ConfigurationController.h"
-#import "PcsxrController.h"
-#import "PluginList.h"
-#import "PcsxrPlugin.h"
-#import "PcsxrMemCardController.h"
-#import "PcsxrMemCardHandler.h"
-#include "psxcommon.h"
-#include "plugins.h"
-
-NSString *const memChangeNotifier = @"PcsxrMemoryCardDidChangeNotifier";
-NSString *const memCardChangeNumberKey = @"PcsxrMemoryCardThatChangedKey";
-
-@interface ConfigurationController ()
-@property (strong) NSMutableDictionary *checkBoxDefaults;
-- (NSString *)keyForSender:(id)sender;
-@end
-
-@implementation ConfigurationController
-@synthesize autoVTypeCell;
-@synthesize bwMdecCell;
-@synthesize checkBoxDefaults = _checkBoxDefaults;
-@synthesize consoleOutputCell;
-@synthesize enableNetPlayCell;
-@synthesize noCDAudioCell;
-@synthesize noFastBootCell;
-@synthesize noXaAudioCell;
-@synthesize rCountFixCell;
-@synthesize sioIrqAlwaysCell;
-@synthesize spuIrqAlwaysCell;
-@synthesize usesDynarecCell;
-@synthesize usesHleCell;
-@synthesize vSyncWAFixCell;
-@synthesize vTypePALCell;
-@synthesize widescreen;
-
-+ (void)setMemoryCard:(NSInteger)theCard toURL:(NSURL *)theURL;
-{
- if (theCard == 1) {
- [[NSUserDefaults standardUserDefaults] setURL:theURL forKey:@"Mcd1"];
- strlcpy(Config.Mcd1, [[theURL path] fileSystemRepresentation], MAXPATHLEN );
- } else {
- [[NSUserDefaults standardUserDefaults] setURL:theURL forKey:@"Mcd2"];
- strlcpy(Config.Mcd2, [[theURL path] fileSystemRepresentation], MAXPATHLEN );
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil userInfo:
- @{memCardChangeNumberKey: @(theCard)}];
-}
-
-+ (void)setMemoryCard:(NSInteger)theCard toPath:(NSString *)theFile
-{
- [self setMemoryCard:theCard toURL:[NSURL fileURLWithPath:theFile isDirectory:NO]];
-}
-
-- (IBAction)setCheckbox:(id)sender
-{
- if ([sender isKindOfClass:[NSMatrix class]]) {
- sender = [sender selectedCell];
- }
-
- NSString *key = [self keyForSender:sender];
- if (key) {
- [[NSUserDefaults standardUserDefaults] setBool:[sender intValue] ? YES : NO forKey:key];
- [PcsxrController setConfigFromDefaults];
- }
-}
-
-- (IBAction)setCheckboxInverse:(id)sender
-{
- if ([sender isKindOfClass:[NSMatrix class]]) {
- sender = [sender selectedCell];
- }
-
- NSString *key = [self keyForSender:sender];
- if (key) {
- [[NSUserDefaults standardUserDefaults] setBool:[sender intValue] ? NO : YES forKey:key];
- [PcsxrController setConfigFromDefaults];
- }
-}
-
-- (IBAction)mcdChangeClicked:(id)sender
-{
- NSInteger tag = [sender tag];
- char *mcd;
- NSOpenPanel *openDlg = [NSOpenPanel openPanel];
- NSString *path;
-
- if (tag == 1) {
- mcd = Config.Mcd1;
- } else {
- mcd = Config.Mcd2;
- }
-
- path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:mcd length:strlen(mcd)];
-
- [openDlg setAllowedFileTypes:[PcsxrMemCardHandler supportedUTIs]];
- [openDlg setDirectoryURL:[NSURL fileURLWithPath:[path stringByDeletingLastPathComponent] isDirectory:YES]];
- [openDlg setNameFieldStringValue:[path lastPathComponent]];
- [openDlg beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
- if (result == NSFileHandlingPanelOKButton) {
- NSURL *mcdURL = [openDlg URLs][0];
-
- [ConfigurationController setMemoryCard:tag toURL:mcdURL];
- }
- }];
-}
-
-- (IBAction)mcdNewClicked:(id)sender
-{
- NSInteger tag = [sender tag];
- char *mcd;
- NSSavePanel *openDlg = [NSSavePanel savePanel];
- NSString *path;
-
- if (tag == 1) {
- mcd = Config.Mcd1;
- } else {
- mcd = Config.Mcd2;
- }
-
- path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:mcd length:strlen(mcd)];
-
- [openDlg setDirectoryURL:[NSURL fileURLWithPath:[path stringByDeletingLastPathComponent] isDirectory:YES]];
- [openDlg setNameFieldStringValue:NSLocalizedString(@"New Memory Card.mcd", nil)];
- [openDlg setAllowedFileTypes:[PcsxrMemCardHandler supportedUTIs]];
-
- [openDlg beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
- if (result == NSFileHandlingPanelOKButton) {
- NSURL *mcdURL = [openDlg URL];
- const char *fileSysRep;
-
- if ([mcdURL respondsToSelector:@selector(fileSystemRepresentation)]) {
- fileSysRep = [mcdURL fileSystemRepresentation];
- } else {
- fileSysRep = [[mcdURL path] fileSystemRepresentation];
- }
-
- //Workaround/kludge to make sure we create a memory card before posting a notification
- strlcpy(mcd, fileSysRep, MAXPATHLEN);
- CreateMcd(mcd);
-
- [ConfigurationController setMemoryCard:tag toURL:mcdURL];
- }
- }];
-}
-
-- (IBAction)setVideoType:(id)sender
-{
- NSInteger tag = [[sender selectedItem] tag];
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
- if (3 == tag) {
- [defaults setBool:YES forKey:@"AutoDetectVideoType"];
- } else if (1 == tag || 2 == tag) {
- [defaults setBool:NO forKey:@"AutoDetectVideoType"];
- [defaults setBool:tag==2 forKey:@"VideoTypePAL"];
- } else {
- return;
- }
- [PcsxrController setConfigFromDefaults];
-
- if ([sender pullsDown]) {
- NSArray *items = [sender itemArray];
- for (id object in items) {
- [object setState:NSOffState];
- }
-
- [[sender selectedItem] setState:NSOnState];
- }
-}
-
-- (void)windowWillClose:(NSNotification *)notification
-{
- [memCardEdit stopMemoryAnimation];
-}
-
-- (void)windowDidBecomeMain:(NSNotification *)notification
-{
- [memCardEdit beginMemoryAnimation];
-}
-
-- (void)awakeFromNib
-{
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
- [[self window] center];
-
- // setup checkboxes
- self.checkBoxDefaults = [[NSMutableDictionary alloc] init];
-
- // check that the outlets are active before adding them
- if (noXaAudioCell)
- _checkBoxDefaults[@"NoXaAudio"] = noXaAudioCell;
- if (enableNetPlayCell)
- _checkBoxDefaults[@"NetPlay"] = enableNetPlayCell;
- if (sioIrqAlwaysCell)
- _checkBoxDefaults[@"SioIrqAlways"] = sioIrqAlwaysCell;
- if (bwMdecCell)
- _checkBoxDefaults[@"BlackAndWhiteMDECVideo"] = bwMdecCell;
- if (autoVTypeCell)
- _checkBoxDefaults[@"AutoDetectVideoType"] = autoVTypeCell;
- if (vTypePALCell)
- _checkBoxDefaults[@"VideoTypePAL"] = vTypePALCell;
- if (noCDAudioCell)
- _checkBoxDefaults[@"NoCDAudio"] = noCDAudioCell;
- if (usesHleCell)
- _checkBoxDefaults[@"UseHLE"] = usesHleCell;
- if (usesDynarecCell)
- _checkBoxDefaults[@"NoDynarec"] = usesDynarecCell;
- if (consoleOutputCell)
- _checkBoxDefaults[@"ConsoleOutput"] = consoleOutputCell;
- if (spuIrqAlwaysCell)
- _checkBoxDefaults[@"SpuIrqAlways"] = spuIrqAlwaysCell;
- if (rCountFixCell)
- _checkBoxDefaults[@"RootCounterFix"] = rCountFixCell;
- if (vSyncWAFixCell)
- _checkBoxDefaults[@"VideoSyncWAFix"] = vSyncWAFixCell;
- if (noFastBootCell)
- _checkBoxDefaults[@"NoFastBoot"] = noFastBootCell;
- if (widescreen)
- _checkBoxDefaults[@"Widescreen"] = widescreen;
-
- // make the visuals match the defaults
-
- for (NSString* key in _checkBoxDefaults) {
- if ([defaults integerForKey:key]) {
- [_checkBoxDefaults[key] setNextState];
- }
- }
-
- // special cases
- if (![PcsxrController biosAvailable]) {
- // no bios means always use HLE
- [usesHleCell setState:NSOnState];
- [usesHleCell setEnabled:NO];
- }
-
-
- // setup labels
-
- NSInteger tag = [defaults integerForKey:@"AutoDetectVideoType"];
- if (tag)
- tag = 3;
- else {
- tag = [defaults integerForKey:@"VideoTypePAL"]+1;
- }
- [vTypePALCell setAutoenablesItems:NO];
- if ([vTypePALCell pullsDown]) {
- [[vTypePALCell itemAtIndex:[vTypePALCell indexOfItemWithTag:tag]] setState:NSOnState];
- } else {
- [vTypePALCell selectItemAtIndex:[vTypePALCell indexOfItemWithTag:tag]];
- }
-
- // setup plugin lists
- PluginList *list = [PluginList list];
-
- [list refreshPlugins];
- [graphicsPlugin setPluginsTo:[list pluginsForType:PSE_LT_GPU] withType: PSE_LT_GPU];
- [soundPlugin setPluginsTo:[list pluginsForType:PSE_LT_SPU] withType: PSE_LT_SPU];
- [padPlugin setPluginsTo:[list pluginsForType:PSE_LT_PAD] withType: PSE_LT_PAD];
- [cdromPlugin setPluginsTo:[list pluginsForType:PSE_LT_CDR] withType: PSE_LT_CDR];
- [netPlugin setPluginsTo:[list pluginsForType:PSE_LT_NET] withType: PSE_LT_NET];
- [sio1Plugin setPluginsTo:[list pluginsForType:PSE_LT_SIO1] withType:PSE_LT_SIO1];
-
- // Setup hotkey view
- [hkController initialize];
-}
-
-- (NSString *)keyForSender:(id)sender
-{
- for (NSString *key in [self.checkBoxDefaults keyEnumerator]) {
- id object = (self.checkBoxDefaults)[key];
- if ([object isEqual:sender])
- return key;
- }
-
- return nil;
-}
-
-- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
-{
- NSWindow *window = [self window];
- if(tabViewItem == hkTab) {
- [window makeFirstResponder:(NSView*)hkController];
- }
- else if([window firstResponder] == (NSView*)hkController) {
- [hkController resignFirstResponder];
- }
-}
-
-@end