diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-12-04 06:09:59 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-12-04 06:09:59 +0000 |
| commit | 3bd6d16afd6b068de6b061a87cba955f5ca3ff88 (patch) | |
| tree | 77cd021219ac202826edf2ad857e210feffe6496 | |
| parent | c057388716aadb2f7d5d20c12da29ce89396402b (diff) | |
| download | pcsxr-3bd6d16afd6b068de6b061a87cba955f5ca3ff88.tar.gz | |
Made it so that opening a memory card on PCSXR for the Mac allows you to set which slot you want to put it in. Just ignore the "Could not open file" warning for now: It's wrong.
Added a class method to ConfigurationController that will set a memory card based on a path passed to it. Also made ConfigurationController listen for when a memory card is changed.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@72844 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | macosx/ConfigurationController.h | 1 | ||||
| -rw-r--r-- | macosx/ConfigurationController.m | 41 | ||||
| -rw-r--r-- | macosx/English.lproj/PcsxrMemCardDocument.xib | 723 | ||||
| -rw-r--r-- | macosx/Info.plist | 2 | ||||
| -rw-r--r-- | macosx/Pcsxr.xcodeproj/project.pbxproj | 19 | ||||
| -rw-r--r-- | macosx/PcsxrMemCardDocument.h | 19 | ||||
| -rw-r--r-- | macosx/PcsxrMemCardDocument.m | 100 |
7 files changed, 893 insertions, 12 deletions
diff --git a/macosx/ConfigurationController.h b/macosx/ConfigurationController.h index 964e4eda..d6ef4491 100644 --- a/macosx/ConfigurationController.h +++ b/macosx/ConfigurationController.h @@ -45,5 +45,6 @@ - (BOOL)memoryCardWindowIsVisible; - (NSString *)keyForSender:(id)sender; ++ (void)setMemoryCard:(int)theCard toPath:(NSString *)theFile; @end diff --git a/macosx/ConfigurationController.m b/macosx/ConfigurationController.m index 0faccc89..ab3dc22c 100644 --- a/macosx/ConfigurationController.m +++ b/macosx/ConfigurationController.m @@ -6,8 +6,24 @@ #include "psxcommon.h" #include "plugins.h" +NSString *memChangeNotifier = @"PcsxrMemoryCardDidChangeNotifier"; + + @implementation ConfigurationController ++ (void)setMemoryCard:(int)theCard toPath:(NSString *)theFile +{ + if (theCard == 1) { + [[NSUserDefaults standardUserDefaults] setObject:theFile forKey:@"Mcd1"]; + strcpy(Config.Mcd1, [theFile fileSystemRepresentation] ); + } else { + [[NSUserDefaults standardUserDefaults] setObject:theFile forKey:@"Mcd2"]; + strcpy(Config.Mcd2, [theFile fileSystemRepresentation] ); + } + + [[NSNotificationCenter defaultCenter] postNotificationName:memChangeNotifier object:nil]; +} + - (IBAction)setCheckbox:(id)sender { if ([sender isKindOfClass:[NSMatrix class]]) { @@ -58,14 +74,9 @@ if ([openDlg runModal] == NSFileHandlingPanelOKButton) { NSArray* urls = [openDlg URLs]; NSString *mcdPath = [[urls objectAtIndex:0] path]; - strcpy(mcd, (const char *)[mcdPath fileSystemRepresentation]); + [ConfigurationController setMemoryCard:tag toPath:mcdPath]; [label setTitleWithMnemonic:mcdPath]; - - if (tag == 1) - [[NSUserDefaults standardUserDefaults] setObject:mcdPath forKey:@"Mcd1"]; - else - [[NSUserDefaults standardUserDefaults] setObject:mcdPath forKey:@"Mcd2"]; } [openDlg release]; } @@ -90,15 +101,10 @@ if ([openDlg runModal] == NSFileHandlingPanelOKButton) { NSString *mcdPath = [[openDlg URL] path]; - strcpy(mcd, (const char *)[mcdPath fileSystemRepresentation]); + [ConfigurationController setMemoryCard:tag toPath:mcdPath]; [label setTitleWithMnemonic:mcdPath]; - if (tag == 1) - [[NSUserDefaults standardUserDefaults] setObject:mcdPath forKey:@"Mcd1"]; - else - [[NSUserDefaults standardUserDefaults] setObject:mcdPath forKey:@"Mcd2"]; - CreateMcd(mcd); } [openDlg release]; @@ -129,12 +135,22 @@ } } +- (void)memoryCardDidChangeNotification:(NSNotification *)aNote +{ + NSString *path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:Config.Mcd1 length:strlen(Config.Mcd1)]; + [mcd1Label setTitleWithMnemonic:path]; + path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:Config.Mcd2 length:strlen(Config.Mcd2)]; + [mcd2Label setTitleWithMnemonic:path]; +} + - (void)awakeFromNib { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [[self window] center]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(memoryCardDidChangeNotification:) name:memChangeNotifier object:nil]; + // setup checkboxes checkBoxDefaults = [[NSMutableDictionary alloc] init]; @@ -201,6 +217,7 @@ - (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; [checkBoxDefaults release]; if (memCardEdit) { [memCardEdit release]; diff --git a/macosx/English.lproj/PcsxrMemCardDocument.xib b/macosx/English.lproj/PcsxrMemCardDocument.xib new file mode 100644 index 00000000..f19add63 --- /dev/null +++ b/macosx/English.lproj/PcsxrMemCardDocument.xib @@ -0,0 +1,723 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> + <data> + <int key="IBDocument.SystemTarget">1060</int> + <string key="IBDocument.SystemVersion">11C74</string> + <string key="IBDocument.InterfaceBuilderVersion">1938</string> + <string key="IBDocument.AppKitVersion">1138.23</string> + <string key="IBDocument.HIToolboxVersion">567.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> + <string key="NS.object.0">1938</string> + </object> + <object class="NSArray" key="IBDocument.IntegratedClassDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSTextField</string> + <string>NSView</string> + <string>NSWindowTemplate</string> + <string>NSTextFieldCell</string> + <string>NSImageCell</string> + <string>NSButtonCell</string> + <string>NSImageView</string> + <string>NSButton</string> + <string>NSCustomObject</string> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="512844837"> + <string key="NSClassName">PcsxrMemCardDocument</string> + </object> + <object class="NSCustomObject" id="613418571"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSWindowTemplate" id="275939982"> + <int key="NSWindowStyleMask">1</int> + <int key="NSWindowBacking">2</int> + <string key="NSWindowRect">{{133, 235}, {416, 155}}</string> + <int key="NSWTFlags">1886912512</int> + <string key="NSWindowTitle">Memory Card</string> + <string key="NSWindowClass">NSWindow</string> + <string key="NSViewClass">View</string> + <nil key="NSUserInterfaceItemIdentifier"/> + <string key="NSWindowContentMinSize">{94, 86}</string> + <object class="NSView" key="NSWindowView" id="568628114"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="665473807"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">289</int> + <string key="NSFrame">{{129, 19}, {90, 34}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="678958260"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="300791902"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">Cancel</string> + <object class="NSFont" key="NSSupport" id="867415120"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">13</double> + <int key="NSfFlags">1558</int> + </object> + <reference key="NSControlView" ref="665473807"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">1</int> + <object class="NSFont" key="NSAlternateImage" id="265803471"> + <string key="NSName">Helvetica</string> + <double key="NSSize">13</double> + <int key="NSfFlags">16</int> + </object> + <string key="NSAlternateContents"/> + <string type="base64-UTF8" key="NSKeyEquivalent">Gw</string> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="678958260"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">289</int> + <string key="NSFrame">{{222, 19}, {90, 34}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="128155738"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <int key="NSTag">1</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="492161327"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">Slot 1</string> + <reference key="NSSupport" ref="867415120"/> + <reference key="NSControlView" ref="678958260"/> + <int key="NSButtonFlags">-2035924737</int> + <int key="NSButtonFlags2">1</int> + <reference key="NSAlternateImage" ref="265803471"/> + <string key="NSAlternateContents"/> + <object class="NSMutableString" key="NSKeyEquivalent"> + <bytes key="NS.bytes">DQ</bytes> + </object> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSImageView" id="762837022"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">268</int> + <object class="NSMutableSet" key="NSDragTypes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="set.sortedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>Apple PDF pasteboard type</string> + <string>Apple PICT pasteboard type</string> + <string>Apple PNG pasteboard type</string> + <object class="NSMutableString"> + <characters key="NS.bytes">NSFilenamesPboardType</characters> + </object> + <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> + <string>NeXT TIFF v4.0 pasteboard type</string> + <object class="NSMutableString"> + <characters key="NS.bytes">NeXT filename pasteboard type</characters> + </object> + </object> + </object> + <string key="NSFrame">{{20, 70}, {64, 64}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="540719925"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSImageCell" key="NSCell" id="1016542061"> + <int key="NSCellFlags">130560</int> + <int key="NSCellFlags2">33554432</int> + <object class="NSCustomResource" key="NSContents"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">pcsxrmemcard</string> + </object> + <int key="NSAlign">0</int> + <int key="NSScale">1</int> + <int key="NSStyle">0</int> + <bool key="NSAnimates">NO</bool> + </object> + <bool key="NSEditable">NO</bool> + </object> + <object class="NSTextField" id="540719925"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{100, 118}, {290, 17}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="141278915"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="374738302"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Memory Card Selection</string> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande-Bold</string> + <double key="NSSize">13</double> + <int key="NSfFlags">2072</int> + </object> + <reference key="NSControlView" ref="540719925"/> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlBackgroundColor</string> + <object class="NSColor" key="NSColor" id="541592704"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="132234883"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + </object> + </object> + <object class="NSTextField" id="399829104"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">266</int> + <string key="NSFrame">{{100, 51}, {290, 34}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="665473807"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="878757412"> + <int key="NSCellFlags">69336577</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Select which memory card slot you want to put this card in.</string> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">11</double> + <int key="NSfFlags">3100</int> + </object> + <reference key="NSControlView" ref="399829104"/> + <object class="NSColor" key="NSBackgroundColor" id="767541651"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <reference key="NSColor" ref="541592704"/> + </object> + <reference key="NSTextColor" ref="132234883"/> + </object> + </object> + <object class="NSTextField" id="141278915"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{100, 93}, {290, 17}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="399829104"/> + <string key="NSReuseIdentifierKey">_NS:3944</string> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="745195555"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272630784</int> + <string key="NSContents">Label</string> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">13</double> + <int key="NSfFlags">1044</int> + </object> + <string key="NSCellIdentifier">_NS:3944</string> + <reference key="NSControlView" ref="141278915"/> + <reference key="NSBackgroundColor" ref="767541651"/> + <reference key="NSTextColor" ref="132234883"/> + </object> + </object> + <object class="NSButton" id="128155738"> + <reference key="NSNextResponder" ref="568628114"/> + <int key="NSvFlags">289</int> + <string key="NSFrame">{{312, 19}, {90, 34}}</string> + <reference key="NSSuperview" ref="568628114"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <int key="NSTag">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="911160075"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">Slot 2</string> + <reference key="NSSupport" ref="867415120"/> + <reference key="NSControlView" ref="128155738"/> + <int key="NSButtonFlags">-2035924737</int> + <int key="NSButtonFlags2">1</int> + <reference key="NSAlternateImage" ref="265803471"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + </object> + <string key="NSFrameSize">{416, 155}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="762837022"/> + </object> + <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> + <string key="NSMinSize">{94, 108}</string> + <string key="NSMaxSize">{10000000000000, 10000000000000}</string> + <bool key="NSWindowIsRestorable">YES</bool> + </object> + <object class="NSCustomObject" id="796877042"> + <string key="NSClassName">NSApplication</string> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">window</string> + <reference key="source" ref="512844837"/> + <reference key="destination" ref="275939982"/> + </object> + <int key="connectionID">18</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">setMemCard:</string> + <reference key="source" ref="512844837"/> + <reference key="destination" ref="678958260"/> + </object> + <int key="connectionID">100039</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">setMemCard:</string> + <reference key="source" ref="512844837"/> + <reference key="destination" ref="128155738"/> + </object> + <int key="connectionID">100040</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">cardPath</string> + <reference key="source" ref="512844837"/> + <reference key="destination" ref="141278915"/> + </object> + <int key="connectionID">100042</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">changeMemCardSheet</string> + <reference key="source" ref="512844837"/> + <reference key="destination" ref="275939982"/> + </object> + <int key="connectionID">100043</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">setMemCard:</string> + <reference key="source" ref="512844837"/> + <reference key="destination" ref="665473807"/> + </object> + <int key="connectionID">100044</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="275939982"/> + <reference key="destination" ref="512844837"/> + </object> + <int key="connectionID">17</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">nextKeyView</string> + <reference key="source" ref="678958260"/> + <reference key="destination" ref="665473807"/> + </object> + <int key="connectionID">100033</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">nextKeyView</string> + <reference key="source" ref="128155738"/> + <reference key="destination" ref="665473807"/> + </object> + <int key="connectionID">100038</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <object class="NSArray" key="object" id="0"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <reference key="children" ref="580458321"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="512844837"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="613418571"/> + <reference key="parent" ref="0"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5</int> + <reference key="object" ref="275939982"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="568628114"/> + </object> + <reference key="parent" ref="0"/> + <string key="objectName">Window</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6</int> + <reference key="object" ref="568628114"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="762837022"/> + <reference ref="540719925"/> + <reference ref="141278915"/> + <reference ref="665473807"/> + <reference ref="128155738"/> + <reference ref="678958260"/> + <reference ref="399829104"/> + </object> + <reference key="parent" ref="275939982"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="796877042"/> + <reference key="parent" ref="0"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100021</int> + <reference key="object" ref="665473807"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="300791902"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100022</int> + <reference key="object" ref="678958260"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="492161327"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100023</int> + <reference key="object" ref="762837022"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1016542061"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100024</int> + <reference key="object" ref="540719925"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="374738302"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100025</int> + <reference key="object" ref="399829104"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="878757412"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100028</int> + <reference key="object" ref="878757412"/> + <reference key="parent" ref="399829104"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100029</int> + <reference key="object" ref="374738302"/> + <reference key="parent" ref="540719925"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100030</int> + <reference key="object" ref="1016542061"/> + <reference key="parent" ref="762837022"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100031</int> + <reference key="object" ref="492161327"/> + <reference key="parent" ref="678958260"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100032</int> + <reference key="object" ref="300791902"/> + <reference key="parent" ref="665473807"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100034</int> + <reference key="object" ref="141278915"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="745195555"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100035</int> + <reference key="object" ref="745195555"/> + <reference key="parent" ref="141278915"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100036</int> + <reference key="object" ref="128155738"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="911160075"/> + </object> + <reference key="parent" ref="568628114"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100037</int> + <reference key="object" ref="911160075"/> + <reference key="parent" ref="128155738"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.IBPluginDependency</string> + <string>-2.IBPluginDependency</string> + <string>-3.IBPluginDependency</string> + <string>100021.IBPluginDependency</string> + <string>100022.IBPluginDependency</string> + <string>100023.IBPluginDependency</string> + <string>100024.IBPluginDependency</string> + <string>100025.IBPluginDependency</string> + <string>100028.IBPluginDependency</string> + <string>100029.IBPluginDependency</string> + <string>100030.IBPluginDependency</string> + <string>100031.IBPluginDependency</string> + <string>100032.IBPluginDependency</string> + <string>100034.IBPluginDependency</string> + <string>100035.IBPluginDependency</string> + <string>100036.IBPluginDependency</string> + <string>100037.IBPluginDependency</string> + <string>5.IBPluginDependency</string> + <string>5.IBWindowTemplateEditedContentRect</string> + <string>6.IBPluginDependency</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{133, 170}, {507, 413}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <reference key="dict.values" ref="0"/> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference key="dict.sortedKeys" ref="0"/> + <reference key="dict.values" ref="0"/> + </object> + <nil key="sourceID"/> + <int key="maxID">100044</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">NSDocument</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>printDocument:</string> + <string>revertDocumentToSaved:</string> + <string>runPageLayout:</string> + <string>saveDocument:</string> + <string>saveDocumentAs:</string> + <string>saveDocumentTo:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>printDocument:</string> + <string>revertDocumentToSaved:</string> + <string>runPageLayout:</string> + <string>saveDocument:</string> + <string>saveDocumentAs:</string> + <string>saveDocumentTo:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBActionInfo"> + <string key="name">printDocument:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">revertDocumentToSaved:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">runPageLayout:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">saveDocument:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">saveDocumentAs:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">saveDocumentTo:</string> + <string key="candidateClassName">id</string> + </object> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/NSDocument.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">PcsxrMemCardDocument</string> + <string key="superclassName">NSDocument</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">setMemCard:</string> + <string key="NS.object.0">id</string> + </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <string key="NS.key.0">setMemCard:</string> + <object class="IBActionInfo" key="NS.object.0"> + <string key="name">setMemCard:</string> + <string key="candidateClassName">id</string> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>cardPath</string> + <string>changeMemCardSheet</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSTextField</string> + <string>NSWindow</string> + </object> + </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>cardPath</string> + <string>changeMemCardSheet</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBToOneOutletInfo"> + <string key="name">cardPath</string> + <string key="candidateClassName">NSTextField</string> + </object> + <object class="IBToOneOutletInfo"> + <string key="name">changeMemCardSheet</string> + <string key="candidateClassName">NSWindow</string> + </object> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/PcsxrMemCardDocument.h</string> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <real value="1060" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string> + <real value="1060" key="NS.object.0"/> + </object> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> + <integer value="3000" key="NS.object.0"/> + </object> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes"> + <string key="NS.key.0">pcsxrmemcard</string> + <string key="NS.object.0">{128, 128}</string> + </object> + </data> +</archive> diff --git a/macosx/Info.plist b/macosx/Info.plist index e960fad4..c098366e 100644 --- a/macosx/Info.plist +++ b/macosx/Info.plist @@ -75,6 +75,8 @@ </array> <key>LSTypeIsPackage</key> <false/> + <key>NSDocumentClass</key> + <string>PcsxrMemCardDocument</string> </dict> <dict> <key>CFBundleTypeExtensions</key> diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj index 0c1122a0..5aff9eaf 100644 --- a/macosx/Pcsxr.xcodeproj/project.pbxproj +++ b/macosx/Pcsxr.xcodeproj/project.pbxproj @@ -42,6 +42,8 @@ 55A90220147D7C380037E18F /* PcsxrMemCardController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55A9021F147D7C380037E18F /* PcsxrMemCardController.m */; }; 55A90223147D7C7A0037E18F /* MemCardManager.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55A90221147D7C7A0037E18F /* MemCardManager.xib */; }; 55A90229147D89380037E18F /* PcsxrMemoryObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 55A90228147D89380037E18F /* PcsxrMemoryObject.m */; }; + 55C7A212148B298F00C22ABC /* PcsxrMemCardDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C7A210148B298F00C22ABC /* PcsxrMemCardDocument.m */; }; + 55C7A214148B2B3800C22ABC /* PcsxrMemCardDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C7A216148B2B3800C22ABC /* PcsxrMemCardDocument.xib */; }; 712FD1E81093096F00575A92 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 712FD1E51093096F00575A92 /* debug.c */; }; 712FD1E91093096F00575A92 /* socket.c in Sources */ = {isa = PBXBuildFile; fileRef = 712FD1E61093096F00575A92 /* socket.c */; }; 713B530E110B75650002F164 /* ppf.c in Sources */ = {isa = PBXBuildFile; fileRef = 713B530C110B75650002F164 /* ppf.c */; }; @@ -270,6 +272,9 @@ 55A90222147D7C7A0037E18F /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = MemCardManager.xib; sourceTree = "<group>"; }; 55A90227147D89380037E18F /* PcsxrMemoryObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxrMemoryObject.h; sourceTree = "<group>"; }; 55A90228147D89380037E18F /* PcsxrMemoryObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxrMemoryObject.m; sourceTree = "<group>"; }; + 55C7A20F148B298F00C22ABC /* PcsxrMemCardDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxrMemCardDocument.h; sourceTree = "<group>"; }; + 55C7A210148B298F00C22ABC /* PcsxrMemCardDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxrMemCardDocument.m; sourceTree = "<group>"; }; + 55C7A215148B2B3800C22ABC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/PcsxrMemCardDocument.xib; sourceTree = "<group>"; }; 712FD1E51093096F00575A92 /* debug.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; path = debug.c; sourceTree = "<group>"; }; 712FD1E61093096F00575A92 /* socket.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; path = socket.c; sourceTree = "<group>"; }; 712FD1E71093096F00575A92 /* socket.h */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.h; path = socket.h; sourceTree = "<group>"; }; @@ -414,6 +419,7 @@ 28F0C3C7146521B000A90285 /* PCSXR.xib */, 28F0C3CA146521B700A90285 /* AddPluginSheet.xib */, 55A90221147D7C7A0037E18F /* MemCardManager.xib */, + 55C7A216148B2B3800C22ABC /* PcsxrMemCardDocument.xib */, ); name = Resources; path = English.lproj; @@ -459,6 +465,8 @@ 55A9021F147D7C380037E18F /* PcsxrMemCardController.m */, 55A90227147D89380037E18F /* PcsxrMemoryObject.h */, 55A90228147D89380037E18F /* PcsxrMemoryObject.m */, + 55C7A20F148B298F00C22ABC /* PcsxrMemCardDocument.h */, + 55C7A210148B298F00C22ABC /* PcsxrMemCardDocument.m */, ); name = MacOSX; sourceTree = "<group>"; @@ -753,6 +761,7 @@ 28F0C3CC146521B700A90285 /* AddPluginSheet.xib in Resources */, 559DACEE146C72FF00C5DF71 /* Localizable.strings in Resources */, 55A90223147D7C7A0037E18F /* MemCardManager.xib in Resources */, + 55C7A214148B2B3800C22ABC /* PcsxrMemCardDocument.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -806,6 +815,7 @@ 559366D012B694DF004ACC1E /* ix86_sse.c in Sources */, 55A90220147D7C380037E18F /* PcsxrMemCardController.m in Sources */, 55A90229147D89380037E18F /* PcsxrMemoryObject.m in Sources */, + 55C7A212148B298F00C22ABC /* PcsxrMemCardDocument.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -906,6 +916,15 @@ name = MemCardManager.xib; sourceTree = "<group>"; }; + 55C7A216148B2B3800C22ABC /* PcsxrMemCardDocument.xib */ = { + isa = PBXVariantGroup; + children = ( + 55C7A215148B2B3800C22ABC /* English */, + ); + name = PcsxrMemCardDocument.xib; + path = ..; + sourceTree = "<group>"; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ diff --git a/macosx/PcsxrMemCardDocument.h b/macosx/PcsxrMemCardDocument.h new file mode 100644 index 00000000..b0466bbb --- /dev/null +++ b/macosx/PcsxrMemCardDocument.h @@ -0,0 +1,19 @@ +// +// PcsxrMemCardDocument.h +// Pcsxr +// +// Created by Charles Betts on 12/3/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +@interface PcsxrMemCardDocument : NSDocument { + IBOutlet NSWindow *changeMemCardSheet; + IBOutlet NSTextField *cardPath; + int memChosen; +} + +- (IBAction)setMemCard:(id)sender; + +@end diff --git a/macosx/PcsxrMemCardDocument.m b/macosx/PcsxrMemCardDocument.m new file mode 100644 index 00000000..aa130378 --- /dev/null +++ b/macosx/PcsxrMemCardDocument.m @@ -0,0 +1,100 @@ +// +// PcsxrMemCardDocument.m +// Pcsxr +// +// Created by Charles Betts on 12/3/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "PcsxrMemCardDocument.h" +#import "ConfigurationController.h" + +@implementation PcsxrMemCardDocument + +- (int)showMemoryCardChooserForFile:(NSString *)theFile +{ + if (!changeMemCardSheet) { + [NSBundle loadNibNamed:[self windowNibName] owner:self]; + } + [cardPath setObjectValue:theFile]; + + [NSApp runModalForWindow:changeMemCardSheet]; + + [NSApp endSheet:changeMemCardSheet]; + [changeMemCardSheet orderOut:self]; + + return memChosen; +} + +- (id)init +{ + self = [super init]; + if (self) { + memChosen = 0; + } + return self; +} + +- (NSString *)windowNibName +{ + // Override returning the nib file name of the document + // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. + return @"PcsxrMemCardDocument"; +} + +- (void)windowControllerDidLoadNib:(NSWindowController *)aController +{ + [super windowControllerDidLoadNib:aController]; + // Add any code here that needs to be executed once the windowController has loaded the document's window. +} + +#if 0 +- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError +{ + /* + Insert code here to write your document to data of the specified type. If outError != NULL, ensure that you create and set an appropriate error when returning nil. + You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. + */ + if (outError) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; + } + return nil; +} + +- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError +{ + /* + Insert code here to read your document from the given data of the specified type. If outError != NULL, ensure that you create and set an appropriate error when returning NO. + You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead. + If you override either of these, you should also override -isEntireFileLoaded to return NO if the contents are lazily loaded. + */ + if (outError) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; + } + return YES; +} +#endif + +- (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)typeName error:(NSError **)outError +{ + int chosen = [self showMemoryCardChooserForFile:[fileWrapper filename]]; + if (chosen == 0) { + if (outError) { + *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:nil]; + } + return NO; + } else { + [ConfigurationController setMemoryCard:chosen toPath:[[self fileURL] path]]; + //TODO: make this return YES so that "File Can't be Opened" dialog box doesn't pop up, but the window itself doesn't stay on the screen. + return NO; + } +} + +- (IBAction)setMemCard:(id)sender +{ + memChosen = [sender tag]; + + [NSApp stopModal]; +} + +@end |
