diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-12-11 04:11:51 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-12-11 04:11:51 +0000 |
| commit | 5174e012aae4d340b373c2d7c5d028d6e849d9f8 (patch) | |
| tree | 56277e83cbce33072ed0dfe5ee7f3d3d8e32a3c0 | |
| parent | 287d77d5995567fcba738c97af558f36e51462ca (diff) | |
| download | pcsxr-5174e012aae4d340b373c2d7c5d028d6e849d9f8.tar.gz | |
Rewrote the file handling on Mac OS X.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@73141 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | macosx/English.lproj/AddPluginSheet.xib | 85 | ||||
| -rw-r--r-- | macosx/English.lproj/PcsxrMemCardDocument.xib | 127 | ||||
| -rw-r--r-- | macosx/Info.plist | 64 | ||||
| -rw-r--r-- | macosx/Pcsxr.xcodeproj/project.pbxproj | 26 | ||||
| -rw-r--r-- | macosx/PcsxrController.h | 2 | ||||
| -rw-r--r-- | macosx/PcsxrController.m | 26 | ||||
| -rw-r--r-- | macosx/PcsxrFileHandle.h | 15 | ||||
| -rw-r--r-- | macosx/PcsxrMemCardDocument.m | 100 | ||||
| -rw-r--r-- | macosx/PcsxrMemCardHandler.h (renamed from macosx/PcsxrMemCardDocument.h) | 9 | ||||
| -rw-r--r-- | macosx/PcsxrMemCardHandler.m | 66 | ||||
| -rw-r--r-- | macosx/PcsxrPluginDocument.h | 20 | ||||
| -rw-r--r-- | macosx/PcsxrPluginDocument.m | 95 | ||||
| -rw-r--r-- | macosx/PcsxrPluginHandler.h | 19 | ||||
| -rw-r--r-- | macosx/PcsxrPluginHandler.m | 80 |
14 files changed, 284 insertions, 450 deletions
diff --git a/macosx/English.lproj/AddPluginSheet.xib b/macosx/English.lproj/AddPluginSheet.xib index f2b70ab1..b137eed5 100644 --- a/macosx/English.lproj/AddPluginSheet.xib +++ b/macosx/English.lproj/AddPluginSheet.xib @@ -30,7 +30,7 @@ </object> <array class="NSMutableArray" key="IBDocument.RootObjects" id="677976933"> <object class="NSCustomObject" id="156968336"> - <string key="NSClassName">PcsxrPluginDocument</string> + <string key="NSClassName">PcsxrPluginHandler</string> </object> <object class="NSCustomObject" id="801828069"> <string key="NSClassName">FirstResponder</string> @@ -301,14 +301,6 @@ </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">addPluginSheet</string> - <reference key="source" ref="156968336"/> - <reference key="destination" ref="14544256"/> - </object> - <int key="connectionID">50</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">delegate</string> <reference key="source" ref="14544256"/> <reference key="destination" ref="156968336"/> @@ -492,77 +484,22 @@ <object class="IBClassDescriber" key="IBDocument.Classes"> <array class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="IBPartialClassDescription"> - <string key="className">NSDocument</string> - <dictionary class="NSMutableDictionary" key="actions"> - <string key="printDocument:">id</string> - <string key="revertDocumentToSaved:">id</string> - <string key="runPageLayout:">id</string> - <string key="saveDocument:">id</string> - <string key="saveDocumentAs:">id</string> - <string key="saveDocumentTo:">id</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="actionInfosByName"> - <object class="IBActionInfo" key="printDocument:"> - <string key="name">printDocument:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="revertDocumentToSaved:"> - <string key="name">revertDocumentToSaved:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="runPageLayout:"> - <string key="name">runPageLayout:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="saveDocument:"> - <string key="name">saveDocument:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="saveDocumentAs:"> - <string key="name">saveDocumentAs:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="saveDocumentTo:"> - <string key="name">saveDocumentTo:</string> - <string key="candidateClassName">id</string> - </object> - </dictionary> - <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">PcsxrPluginDocument</string> - <string key="superclassName">NSDocument</string> - <object class="NSMutableDictionary" key="actions"> - <string key="NS.key.0">closeAddPluginSheet:</string> - <string key="NS.object.0">id</string> - </object> - <object class="NSMutableDictionary" key="actionInfosByName"> - <string key="NS.key.0">closeAddPluginSheet:</string> - <object class="IBActionInfo" key="NS.object.0"> - <string key="name">closeAddPluginSheet:</string> - <string key="candidateClassName">id</string> - </object> + <string key="className">PcsxrPluginHandler</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">pluginName</string> + <string key="NS.object.0">NSTextField</string> </object> - <dictionary class="NSMutableDictionary" key="outlets"> - <string key="addPluginSheet">NSWindow</string> - <string key="pluginName">NSTextField</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> - <object class="IBToOneOutletInfo" key="addPluginSheet"> - <string key="name">addPluginSheet</string> - <string key="candidateClassName">NSWindow</string> - </object> - <object class="IBToOneOutletInfo" key="pluginName"> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <string key="NS.key.0">pluginName</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> <string key="name">pluginName</string> <string key="candidateClassName">NSTextField</string> </object> - </dictionary> + </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/PcsxrPluginDocument.h</string> + <string key="minorKey">./Classes/PcsxrPluginHandler.h</string> </object> </object> </array> diff --git a/macosx/English.lproj/PcsxrMemCardDocument.xib b/macosx/English.lproj/PcsxrMemCardDocument.xib index f19add63..a5caad42 100644 --- a/macosx/English.lproj/PcsxrMemCardDocument.xib +++ b/macosx/English.lproj/PcsxrMemCardDocument.xib @@ -33,7 +33,7 @@ <object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="512844837"> - <string key="NSClassName">PcsxrMemCardDocument</string> + <string key="NSClassName">PcsxrMemCardHandler</string> </object> <object class="NSCustomObject" id="613418571"> <string key="NSClassName">FirstResponder</string> @@ -319,14 +319,6 @@ <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"/> @@ -580,121 +572,22 @@ <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> + <string key="className">PcsxrMemCardHandler</string> + <string key="superclassName">NSWindowController</string> <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> + <string key="NS.key.0">cardPath</string> + <string key="NS.object.0">NSTextField</string> </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> + <string key="NS.key.0">cardPath</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> + <string key="name">cardPath</string> + <string key="candidateClassName">NSTextField</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/PcsxrMemCardDocument.h</string> + <string key="minorKey">./Classes/PcsxrMemCardHandler.h</string> </object> </object> </object> diff --git a/macosx/Info.plist b/macosx/Info.plist index f47522d3..c7a63a03 100644 --- a/macosx/Info.plist +++ b/macosx/Info.plist @@ -27,8 +27,6 @@ </array> <key>LSTypeIsPackage</key> <true/> - <key>NSDocumentClass</key> - <string>PcsxrPluginDocument</string> </dict> <dict> <key>CFBundleTypeExtensions</key> @@ -75,8 +73,6 @@ </array> <key>LSTypeIsPackage</key> <false/> - <key>NSDocumentClass</key> - <string>PcsxrMemCardDocument</string> </dict> <dict> <key>CFBundleTypeExtensions</key> @@ -100,6 +96,25 @@ <key>LSTypeIsPackage</key> <false/> </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>iso</string> + <string>bin</string> + <string>mdf</string> + <string>img</string> + </array> + <key>CFBundleTypeName</key> + <string>PlayStation Disc</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSItemContentTypes</key> + <array> + <string>com.codeplex.pcsxr.mdfdisc</string> + <string>com.apple.disk-image-ndif</string> + <string>public.iso-image</string> + </array> + </dict> </array> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> @@ -137,6 +152,25 @@ <dict> <key>UTTypeConformsTo</key> <array> + <string>public.disk-image</string> + <string>public.content</string> + <string>public.data</string> + </array> + <key>UTTypeDescription</key> + <string>PlayStation Disc</string> + <key>UTTypeIdentifier</key> + <string>com.codeplex.pcsxr.mdfdisc</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>mdf</string> + </array> + </dict> + </dict> + <dict> + <key>UTTypeConformsTo</key> + <array> <string>com.apple.package</string> <string>com.apple.bundle</string> </array> @@ -217,27 +251,5 @@ </dict> </dict> </array> - <key>UTImportedTypeDeclarations</key> - <array> - <dict> - <key>UTTypeConformsTo</key> - <array> - <string>public.disk-image</string> - <string>public.content</string> - <string>public.data</string> - </array> - <key>UTTypeDescription</key> - <string>PlayStation Disc</string> - <key>UTTypeIdentifier</key> - <string>com.codeplex.pcsxr.mdfdisc</string> - <key>UTTypeTagSpecification</key> - <dict> - <key>public.filename-extension</key> - <array> - <string>mdf</string> - </array> - </dict> - </dict> - </array> </dict> </plist> diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj index 659a8104..43642251 100644 --- a/macosx/Pcsxr.xcodeproj/project.pbxproj +++ b/macosx/Pcsxr.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ 2B143D08078A2CBD00AF745A /* pcsxrmemcard.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D03078A2CBD00AF745A /* pcsxrmemcard.icns */; }; 2B143D09078A2CBD00AF745A /* psxbios.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D04078A2CBD00AF745A /* psxbios.icns */; }; 2B143D0A078A2CBD00AF745A /* psxplugin.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B143D05078A2CBD00AF745A /* psxplugin.icns */; }; - 2B3E356D06937D1C00763C7D /* PcsxrPluginDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3E356B06937D1C00763C7D /* PcsxrPluginDocument.m */; }; 2B400D910789F58A00BA271E /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B02C04304E145D000880C5B /* Carbon.framework */; }; 2B4DE99205FF9307003EFEF0 /* PluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B4DE98E05FF9307003EFEF0 /* PluginController.m */; }; 2BB3D6A405427FE200831ACB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2BA178B20514CE260026D74D /* InfoPlist.strings */; }; @@ -42,7 +41,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 */; }; + 55BBA693149455E1003B2CEC /* PcsxrMemCardHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 55BBA692149455E1003B2CEC /* PcsxrMemCardHandler.m */; }; + 55BBA69614945628003B2CEC /* PcsxrPluginHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 55BBA69514945628003B2CEC /* PcsxrPluginHandler.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 */; }; @@ -231,8 +231,6 @@ 2B143D04078A2CBD00AF745A /* psxbios.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = psxbios.icns; sourceTree = "<group>"; }; 2B143D05078A2CBD00AF745A /* psxplugin.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = psxplugin.icns; sourceTree = "<group>"; }; 2B2189D204D96C7A00179945 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; - 2B3E356A06937D1C00763C7D /* PcsxrPluginDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxrPluginDocument.h; sourceTree = "<group>"; }; - 2B3E356B06937D1C00763C7D /* PcsxrPluginDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxrPluginDocument.m; sourceTree = "<group>"; }; 2B4DE98D05FF9307003EFEF0 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; }; 2B4DE98E05FF9307003EFEF0 /* PluginController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginController.m; sourceTree = "<group>"; }; 2B690C760635C65C00CDA575 /* ExceptionHandling.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExceptionHandling.framework; path = /System/Library/Frameworks/ExceptionHandling.framework; sourceTree = "<absolute>"; }; @@ -272,8 +270,11 @@ 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>"; }; + 55BBA690149454DE003B2CEC /* PcsxrFileHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxrFileHandle.h; sourceTree = "<group>"; }; + 55BBA691149455E1003B2CEC /* PcsxrMemCardHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxrMemCardHandler.h; sourceTree = "<group>"; }; + 55BBA692149455E1003B2CEC /* PcsxrMemCardHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxrMemCardHandler.m; sourceTree = "<group>"; }; + 55BBA69414945628003B2CEC /* PcsxrPluginHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PcsxrPluginHandler.h; sourceTree = "<group>"; }; + 55BBA69514945628003B2CEC /* PcsxrPluginHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PcsxrPluginHandler.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>"; }; @@ -459,14 +460,15 @@ 2BBB1127051DC00500B84448 /* PluginList.m */, 2BA44360052DB2EA00E21DDD /* PcsxrPlugin.h */, 2BA44361052DB2EA00E21DDD /* PcsxrPlugin.m */, - 2B3E356A06937D1C00763C7D /* PcsxrPluginDocument.h */, - 2B3E356B06937D1C00763C7D /* PcsxrPluginDocument.m */, 55A9021E147D7C380037E18F /* PcsxrMemCardController.h */, 55A9021F147D7C380037E18F /* PcsxrMemCardController.m */, 55A90227147D89380037E18F /* PcsxrMemoryObject.h */, 55A90228147D89380037E18F /* PcsxrMemoryObject.m */, - 55C7A20F148B298F00C22ABC /* PcsxrMemCardDocument.h */, - 55C7A210148B298F00C22ABC /* PcsxrMemCardDocument.m */, + 55BBA690149454DE003B2CEC /* PcsxrFileHandle.h */, + 55BBA691149455E1003B2CEC /* PcsxrMemCardHandler.h */, + 55BBA692149455E1003B2CEC /* PcsxrMemCardHandler.m */, + 55BBA69414945628003B2CEC /* PcsxrPluginHandler.h */, + 55BBA69514945628003B2CEC /* PcsxrPluginHandler.m */, ); name = MacOSX; sourceTree = "<group>"; @@ -780,7 +782,6 @@ 2BB3D6C305427FE200831ACB /* Plugin.c in Sources */, 2BB3D6C405427FE200831ACB /* PcsxrPlugin.m in Sources */, 2B4DE99205FF9307003EFEF0 /* PluginController.m in Sources */, - 2B3E356D06937D1C00763C7D /* PcsxrPluginDocument.m in Sources */, 71F4C5890FDED12800529849 /* cdriso.c in Sources */, 71F4C58B0FDED12800529849 /* cdrom.c in Sources */, 71F4C58D0FDED12800529849 /* cheat.c in Sources */, @@ -815,7 +816,8 @@ 559366D012B694DF004ACC1E /* ix86_sse.c in Sources */, 55A90220147D7C380037E18F /* PcsxrMemCardController.m in Sources */, 55A90229147D89380037E18F /* PcsxrMemoryObject.m in Sources */, - 55C7A212148B298F00C22ABC /* PcsxrMemCardDocument.m in Sources */, + 55BBA693149455E1003B2CEC /* PcsxrMemCardHandler.m in Sources */, + 55BBA69614945628003B2CEC /* PcsxrPluginHandler.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macosx/PcsxrController.h b/macosx/PcsxrController.h index b6d46e9a..8d5be9d7 100644 --- a/macosx/PcsxrController.h +++ b/macosx/PcsxrController.h @@ -6,7 +6,7 @@ @class ConfigurationController; -@interface PcsxrController : NSObject +@interface PcsxrController : NSObject <NSApplicationDelegate> { ConfigurationController *preferencesController; PluginList *pluginList; diff --git a/macosx/PcsxrController.m b/macosx/PcsxrController.m index 987d9820..d284354d 100644 --- a/macosx/PcsxrController.m +++ b/macosx/PcsxrController.m @@ -2,6 +2,8 @@ #import "PcsxrController.h" #import "ConfigurationController.h" #import "EmuThread.h" +#import "PcsxrMemCardHandler.h" +#import "PcsxrPluginHandler.h" #include "psxcommon.h" #include "plugins.h" #include "misc.h" @@ -447,4 +449,28 @@ NSString *saveStatePath; return NO; } +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename error:nil]; + if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.plugin", (CFStringRef)utiFile)) { + PcsxrPluginHandler *hand = [[PcsxrPluginHandler alloc] init]; + BOOL isHandled = [hand handleFile:filename]; + [hand release]; + return isHandled; + } else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.memcard", (CFStringRef)utiFile)) { + PcsxrMemCardHandler *hand = [[PcsxrMemCardHandler alloc] init]; + BOOL isHandled = [hand handleFile:filename]; + [hand release]; + return isHandled; + } else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.freeze", (CFStringRef)utiFile)) { + //TODO: handle freeze states + return NO; + } else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.mdfdisc", (CFStringRef)utiFile) || UTTypeEqual((CFStringRef)@"com.apple.disk-image-ndif", (CFStringRef)utiFile) || UTTypeEqual((CFStringRef)@"public.iso-image", (CFStringRef)utiFile)) { + //TODO: handle ISOs and family + return NO; + } else { + return NO; + } +} + @end diff --git a/macosx/PcsxrFileHandle.h b/macosx/PcsxrFileHandle.h new file mode 100644 index 00000000..3b29bde3 --- /dev/null +++ b/macosx/PcsxrFileHandle.h @@ -0,0 +1,15 @@ +// +// PcsxrFileHandle.h +// Pcsxr +// +// Created by Charles Betts on 12/10/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@protocol PcsxrFileHandle <NSObject> + +- (BOOL)handleFile:(NSString *)theFile; + +@end diff --git a/macosx/PcsxrMemCardDocument.m b/macosx/PcsxrMemCardDocument.m deleted file mode 100644 index aa130378..00000000 --- a/macosx/PcsxrMemCardDocument.m +++ /dev/null @@ -1,100 +0,0 @@ -// -// 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 diff --git a/macosx/PcsxrMemCardDocument.h b/macosx/PcsxrMemCardHandler.h index b0466bbb..996272ec 100644 --- a/macosx/PcsxrMemCardDocument.h +++ b/macosx/PcsxrMemCardHandler.h @@ -1,19 +1,18 @@ // -// PcsxrMemCardDocument.h +// PcsxrMemCardHandler.h // Pcsxr // -// Created by Charles Betts on 12/3/11. +// Created by Charles Betts on 12/10/11. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> +#import "PcsxrFileHandle.h" -@interface PcsxrMemCardDocument : NSDocument { - IBOutlet NSWindow *changeMemCardSheet; +@interface PcsxrMemCardHandler : NSWindowController <PcsxrFileHandle> { IBOutlet NSTextField *cardPath; int memChosen; } - - (IBAction)setMemCard:(id)sender; @end diff --git a/macosx/PcsxrMemCardHandler.m b/macosx/PcsxrMemCardHandler.m new file mode 100644 index 00000000..4cfcb513 --- /dev/null +++ b/macosx/PcsxrMemCardHandler.m @@ -0,0 +1,66 @@ +// +// PcsxrMemCardHandler.m +// Pcsxr +// +// Created by Charles Betts on 12/10/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "PcsxrMemCardHandler.h" +#import "ConfigurationController.h" + +@implementation PcsxrMemCardHandler + +- (id)initWithWindow:(NSWindow *)window +{ + self = [super initWithWindow:window]; + if (self) { + // Initialization code here. + } + + return self; +} + +- (id)init +{ + if (self = [super initWithWindowNibName:@"PcsxrMemCardDocument"]) { + memChosen = 0; + } + return self; +} + +- (void)windowDidLoad +{ + [super windowDidLoad]; + + // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. +} + +- (IBAction)setMemCard:(id)sender +{ + memChosen = [sender tag]; + + [NSApp stopModal]; +} + + +- (BOOL)handleFile:(NSString *)theFile +{ + if (![self window]) { + [NSBundle loadNibNamed:@"PcsxrMemCardDocument" owner:self]; + } + [cardPath setObjectValue:[[NSURL fileURLWithPath:theFile] lastPathComponent]]; + + [NSApp runModalForWindow:[self window]]; + + [NSApp endSheet:[self window]]; + [[self window] orderOut:self]; + + if (memChosen != 0) { + [ConfigurationController setMemoryCard:memChosen toPath:theFile]; + } + return YES; +} + + +@end diff --git a/macosx/PcsxrPluginDocument.h b/macosx/PcsxrPluginDocument.h deleted file mode 100644 index dc6baef5..00000000 --- a/macosx/PcsxrPluginDocument.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// PcsxrPluginDocument.h -// Pcsxr -// -// Created by Gil Pedersen on Thu Jul 01 2004. -// Copyright (c) 2004 __MyCompanyName__. All rights reserved. -// - -#import <AppKit/AppKit.h> - - -@interface PcsxrPluginDocument : NSDocument { - IBOutlet NSWindow *addPluginSheet; - IBOutlet NSTextField *pluginName; - - BOOL moveOK; -} -- (IBAction)closeAddPluginSheet:(id)sender; - -@end diff --git a/macosx/PcsxrPluginDocument.m b/macosx/PcsxrPluginDocument.m deleted file mode 100644 index 3d19f491..00000000 --- a/macosx/PcsxrPluginDocument.m +++ /dev/null @@ -1,95 +0,0 @@ -// -// PcsxrPluginDocument.m -// Pcsxr -// -// Created by Gil Pedersen on Thu Jul 01 2004. -// Copyright (c) 2004 __MyCompanyName__. All rights reserved. -// - -#import "PcsxrPluginDocument.h" - - -@implementation PcsxrPluginDocument - -- (BOOL)showAddPluginSheet:(NSWindow *)window forName:(NSString *)name -// User has asked to see the custom display. Display it. -{ - if (!addPluginSheet) - [NSBundle loadNibNamed:@"AddPluginSheet" owner:self]; - - [pluginName setObjectValue:name]; - - [NSApp beginSheet:addPluginSheet - modalForWindow:window - modalDelegate:nil - didEndSelector:nil - contextInfo:nil]; - [NSApp runModalForWindow:addPluginSheet]; - // Sheet is up here. - [NSApp endSheet:addPluginSheet]; - [addPluginSheet orderOut:self]; - - return moveOK; -} - -- (IBAction)closeAddPluginSheet:(id)sender -{ - if ([[sender keyEquivalent] isEqualToString:@"\r"]) { - moveOK = YES; - } else { - moveOK = NO; - } - [NSApp stopModal]; -} - -- (BOOL)loadDataRepresentation:(NSData *)docData ofType:(NSString *)docType -{ - //NSLog(@"loadDataRepresentation"); - return NO; -} - -- (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)docType -{ - if ([self showAddPluginSheet:nil forName:[wrapper filename]]) { - NSString *dst = [NSString stringWithFormat:@"%@/%@", - [[NSBundle mainBundle] builtInPlugInsPath], - [wrapper filename]]; - - if ([wrapper writeToFile:dst atomically:NO updateFilenames:NO]) { - [[NSWorkspace sharedWorkspace] noteFileSystemChanged:[[NSBundle mainBundle] builtInPlugInsPath]]; - NSRunInformationalAlertPanel(NSLocalizedString(@"Installation Succesfull", nil), - NSLocalizedString(@"The installation of the specified plugin was succesfull. In order to use it, please restart the application.", nil), - nil, nil, nil); - } else { - NSRunAlertPanel(NSLocalizedString(@"Installation Failed!", nil), - NSLocalizedString(@"The installation of the specified plugin failed. Please try again, or make a manual install.", nil), - nil, nil, nil); - } - } - - // Tell the NSDocument that we can't handle the file, since we are already done with it - return NO; -} - -- (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)flag -{ - - return nil; -} - -- (NSString *)windowNibName { - // Implement this to return a nib to load OR implement -makeWindowControllers to manually create your controllers. - return @"PcsxrPluginDocument"; -} - -- (NSData *)dataRepresentationOfType:(NSString *)type { - // Implement to provide a persistent data representation of your document OR remove this and implement the file-wrapper or file path based save methods. - return nil; -} -/* -- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type { - // Implement to load a persistent data representation of your document OR remove this and implement the file-wrapper or file path based load methods. - return YES; -}*/ - -@end diff --git a/macosx/PcsxrPluginHandler.h b/macosx/PcsxrPluginHandler.h new file mode 100644 index 00000000..8b79a4fb --- /dev/null +++ b/macosx/PcsxrPluginHandler.h @@ -0,0 +1,19 @@ +// +// PcsxrPluginHandler.h +// Pcsxr +// +// Created by Charles Betts on 12/10/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import <Cocoa/Cocoa.h> +#import "PcsxrFileHandle.h" + +@interface PcsxrPluginHandler : NSWindowController <PcsxrFileHandle> { + IBOutlet NSTextField *pluginName; + + BOOL moveOK; +} +- (IBAction)closeAddPluginSheet:(id)sender; + +@end diff --git a/macosx/PcsxrPluginHandler.m b/macosx/PcsxrPluginHandler.m new file mode 100644 index 00000000..84919c56 --- /dev/null +++ b/macosx/PcsxrPluginHandler.m @@ -0,0 +1,80 @@ +// +// PcsxrPluginHandler.m +// Pcsxr +// +// Created by Charles Betts on 12/10/11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "PcsxrPluginHandler.h" + +@implementation PcsxrPluginHandler + +- (id)initWithWindow:(NSWindow *)window +{ + self = [super initWithWindow:window]; + if (self) { + // Initialization code here. + } + + return self; +} + +- (id)init +{ + if (self = [super initWithWindowNibName:@"AddPluginSheet"]) { + moveOK = NO; + } + return self; +} + +- (void)windowDidLoad +{ + [super windowDidLoad]; + + // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. +} + +- (IBAction)closeAddPluginSheet:(id)sender +{ + if ([[sender keyEquivalent] isEqualToString:@"\r"]) { + moveOK = YES; + } else { + moveOK = NO; + } + [NSApp stopModal]; +} + +- (BOOL)handleFile:(NSString *)theFile +{ + if (![self window]) + [NSBundle loadNibNamed:@"AddPluginSheet" owner:self]; + + [pluginName setObjectValue:[[NSURL fileURLWithPath:theFile] lastPathComponent]]; + + [NSApp runModalForWindow:[self window]]; + // Sheet is up here. + [NSApp endSheet:[self window]]; + [[self window] orderOut:self]; + if (moveOK == YES) { + NSFileWrapper *wrapper = [[NSFileWrapper alloc] initWithPath:theFile]; + NSString *dst = [NSString stringWithFormat:@"%@/%@", + [[NSBundle mainBundle] builtInPlugInsPath], + [wrapper filename]]; + if ([wrapper writeToFile:dst atomically:NO updateFilenames:NO]) { + [[NSWorkspace sharedWorkspace] noteFileSystemChanged:[[NSBundle mainBundle] builtInPlugInsPath]]; + NSRunInformationalAlertPanel(NSLocalizedString(@"Installation Succesfull", nil), + NSLocalizedString(@"The installation of the specified plugin was succesfull. In order to use it, please restart the application.", nil), + nil, nil, nil); + } else { + NSRunAlertPanel(NSLocalizedString(@"Installation Failed!", nil), + NSLocalizedString(@"The installation of the specified plugin failed. Please try again, or make a manual install.", nil), + nil, nil, nil); + } + [wrapper release]; + } + return YES; +} + + +@end |
