From 8da3cda2b3d231298d3dd602fe879521106e91c2 Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Sun, 25 Jul 2010 02:48:41 +0000 Subject: Ported DFCdrom to osx, removed old CDDeviceInterface plugin git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@55123 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- .../project.pbxproj | 299 ------- .../English.lproj/InfoPlist.strings | Bin 558 -> 0 bytes macosx/plugins/CDDeviceInterface/Info.plist | 22 - macosx/plugins/CDDeviceInterface/src/PlugCD.c | 901 --------------------- macosx/plugins/CDDeviceInterface/src/PlugCD.h | 120 --- macosx/plugins/CDDeviceInterface/version.plist | 16 - .../DFCdrom/DFCdrom.xcodeproj/project.pbxproj | 360 ++++++++ macosx/plugins/DFCdrom/English.lproj/Credits.rtf | 13 + .../DFCdromPluginConfig.nib/classes.nib | 18 + .../English.lproj/DFCdromPluginConfig.nib/info.nib | 16 + .../DFCdromPluginConfig.nib/keyedobjects.nib | Bin 0 -> 8896 bytes .../DFCdrom/English.lproj/InfoPlist.strings | Bin 0 -> 486 bytes macosx/plugins/DFCdrom/Info.plist | 22 + .../DFCdrom/macsrc/PluginConfigController.h | 18 + .../DFCdrom/macsrc/PluginConfigController.m | 158 ++++ macosx/plugins/DFCdrom/macsrc/cdr-macosx.c | 215 +++++ macosx/plugins/DFCdrom/macsrc/cfg.c | 53 ++ macosx/plugins/DFCdrom/version.plist | 16 + 18 files changed, 889 insertions(+), 1358 deletions(-) delete mode 100644 macosx/plugins/CDDeviceInterface/CDDeviceInterfacePlugin.xcodeproj/project.pbxproj delete mode 100755 macosx/plugins/CDDeviceInterface/English.lproj/InfoPlist.strings delete mode 100644 macosx/plugins/CDDeviceInterface/Info.plist delete mode 100644 macosx/plugins/CDDeviceInterface/src/PlugCD.c delete mode 100644 macosx/plugins/CDDeviceInterface/src/PlugCD.h delete mode 100644 macosx/plugins/CDDeviceInterface/version.plist create mode 100644 macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj create mode 100644 macosx/plugins/DFCdrom/English.lproj/Credits.rtf create mode 100644 macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/classes.nib create mode 100644 macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/info.nib create mode 100644 macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/keyedobjects.nib create mode 100755 macosx/plugins/DFCdrom/English.lproj/InfoPlist.strings create mode 100644 macosx/plugins/DFCdrom/Info.plist create mode 100644 macosx/plugins/DFCdrom/macsrc/PluginConfigController.h create mode 100644 macosx/plugins/DFCdrom/macsrc/PluginConfigController.m create mode 100644 macosx/plugins/DFCdrom/macsrc/cdr-macosx.c create mode 100644 macosx/plugins/DFCdrom/macsrc/cfg.c create mode 100644 macosx/plugins/DFCdrom/version.plist (limited to 'macosx/plugins') diff --git a/macosx/plugins/CDDeviceInterface/CDDeviceInterfacePlugin.xcodeproj/project.pbxproj b/macosx/plugins/CDDeviceInterface/CDDeviceInterfacePlugin.xcodeproj/project.pbxproj deleted file mode 100644 index 066d4788..00000000 --- a/macosx/plugins/CDDeviceInterface/CDDeviceInterfacePlugin.xcodeproj/project.pbxproj +++ /dev/null @@ -1,299 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 2BC4895406DF958C00274548 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BC4895306DF958C00274548 /* CoreAudio.framework */; }; - 2BC4897906DF966200274548 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BC4897706DF966200274548 /* CoreServices.framework */; }; - 2BD707140555995400CB5D9B /* PlugCD.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BD707110555995400CB5D9B /* PlugCD.c */; }; - 2BD707150555995400CB5D9B /* PlugCD.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BD707120555995400CB5D9B /* PlugCD.h */; }; - 2BD707180555997500CB5D9B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BD707170555997500CB5D9B /* IOKit.framework */; }; - 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; - 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 2BC4895306DF958C00274548 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; - 2BC4897706DF966200274548 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; - 2BD707110555995400CB5D9B /* PlugCD.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = PlugCD.c; path = src/PlugCD.c; sourceTree = SOURCE_ROOT; }; - 2BD707120555995400CB5D9B /* PlugCD.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PlugCD.h; path = src/PlugCD.h; sourceTree = SOURCE_ROOT; }; - 2BD707170555997500CB5D9B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 8D576316048677EA00EA77CD /* CDDeviceInterface.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CDDeviceInterface.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D576313048677EA00EA77CD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, - 2BD707180555997500CB5D9B /* IOKit.framework in Frameworks */, - 2BC4895406DF958C00274548 /* CoreAudio.framework in Frameworks */, - 2BC4897906DF966200274548 /* CoreServices.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* CdrDevMac */ = { - isa = PBXGroup; - children = ( - 08FB77AFFE84173DC02AAC07 /* Source */, - 089C167CFE841241C02AAC07 /* Resources */, - 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, - 19C28FB6FE9D52B211CA2CBB /* Products */, - ); - name = CdrDevMac; - sourceTree = ""; - }; - 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 2BC4897706DF966200274548 /* CoreServices.framework */, - 2BC4895306DF958C00274548 /* CoreAudio.framework */, - 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, - 2BD707170555997500CB5D9B /* IOKit.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 8D576317048677EA00EA77CD /* Info.plist */, - 8D5B49A704867FD3000E48DA /* InfoPlist.strings */, - ); - name = Resources; - sourceTree = ""; - }; - 08FB77AFFE84173DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 2BD707110555995400CB5D9B /* PlugCD.c */, - 2BD707120555995400CB5D9B /* PlugCD.h */, - 2BC488C406DF90FF00274548 /* CoreAudioUtils */, - ); - name = Source; - sourceTree = ""; - }; - 19C28FB6FE9D52B211CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D576316048677EA00EA77CD /* CDDeviceInterface.psxplugin */, - ); - name = Products; - sourceTree = ""; - }; - 2BC488C406DF90FF00274548 /* CoreAudioUtils */ = { - isa = PBXGroup; - children = ( - ); - name = CoreAudioUtils; - path = src/CoreAudioUtils; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8D57630E048677EA00EA77CD /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 2BD707150555995400CB5D9B /* PlugCD.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8D57630D048677EA00EA77CD /* CDDeviceInterface */ = { - isa = PBXNativeTarget; - buildConfigurationList = 710735990FDEED75004AD098 /* Build configuration list for PBXNativeTarget "CDDeviceInterface" */; - buildPhases = ( - 8D57630E048677EA00EA77CD /* Headers */, - 8D57630F048677EA00EA77CD /* Resources */, - 8D576311048677EA00EA77CD /* Sources */, - 8D576313048677EA00EA77CD /* Frameworks */, - 8D576315048677EA00EA77CD /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = CDDeviceInterface; - productInstallPath = "$(HOME)/Library/Bundles"; - productName = CdrDevMac; - productReference = 8D576316048677EA00EA77CD /* CDDeviceInterface.psxplugin */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 7107359E0FDEED75004AD098 /* Build configuration list for PBXProject "CDDeviceInterfacePlugin" */; - hasScannedForEncodings = 1; - mainGroup = 089C166AFE841209C02AAC07 /* CdrDevMac */; - projectDirPath = ""; - targets = ( - 8D57630D048677EA00EA77CD /* CDDeviceInterface */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D57630F048677EA00EA77CD /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 8D576315048677EA00EA77CD /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D576311048677EA00EA77CD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2BD707140555995400CB5D9B /* PlugCD.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 7107359A0FDEED75004AD098 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_MODEL_TUNING = ""; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins"; - LIBRARY_STYLE = BUNDLE; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = CDDeviceInterface; - SECTORDER_FLAGS = ""; - SYMROOT = ../../build; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = psxplugin; - }; - name = Development; - }; - 7107359B0FDEED75004AD098 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUGGING_SYMBOLS = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = ""; - GCC_OPTIMIZATION_LEVEL = s; - GCC_PRECOMPILE_PREFIX_HEADER = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins"; - LIBRARY_STYLE = BUNDLE; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = CDDeviceInterface; - SECTORDER_FLAGS = ""; - SYMROOT = ../../build; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = psxplugin; - ZERO_LINK = NO; - }; - name = Deployment; - }; - 7107359F0FDEED75004AD098 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_MODEL_TUNING = ""; - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ../../../libpcsxcore; - STRIP_INSTALLED_PRODUCT = NO; - }; - name = Development; - }; - 710735A00FDEED75004AD098 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_MODEL_TUNING = ""; - HEADER_SEARCH_PATHS = ../../../libpcsxcore; - }; - name = Deployment; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 710735990FDEED75004AD098 /* Build configuration list for PBXNativeTarget "CDDeviceInterface" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7107359A0FDEED75004AD098 /* Development */, - 7107359B0FDEED75004AD098 /* Deployment */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Development; - }; - 7107359E0FDEED75004AD098 /* Build configuration list for PBXProject "CDDeviceInterfacePlugin" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7107359F0FDEED75004AD098 /* Development */, - 710735A00FDEED75004AD098 /* Deployment */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Development; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/macosx/plugins/CDDeviceInterface/English.lproj/InfoPlist.strings b/macosx/plugins/CDDeviceInterface/English.lproj/InfoPlist.strings deleted file mode 100755 index 3f9ed475..00000000 Binary files a/macosx/plugins/CDDeviceInterface/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/macosx/plugins/CDDeviceInterface/Info.plist b/macosx/plugins/CDDeviceInterface/Info.plist deleted file mode 100644 index b121197a..00000000 --- a/macosx/plugins/CDDeviceInterface/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - CDDeviceInterface - CFBundleIconFile - - CFBundleIdentifier - net.pcsx.CDDeviceInterfacePlugin - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - PsxP - CFBundleSignature - CdDI - CFBundleVersion - 1.0 - - diff --git a/macosx/plugins/CDDeviceInterface/src/PlugCD.c b/macosx/plugins/CDDeviceInterface/src/PlugCD.c deleted file mode 100644 index 18e848bf..00000000 --- a/macosx/plugins/CDDeviceInterface/src/PlugCD.c +++ /dev/null @@ -1,901 +0,0 @@ -/*************************************************************************** - PlugCD.c - CDDeviceInterface - - Created by Gil Pedersen on Fri July 18 2003. - Copyright (c) 2003,2004 Gil Pedersen. - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//#include "plugins.h" -#include "PlugCD.h" - -//#define USE_DEVICE_INTERFACE - -long CDRclose(void); - -///////////////////////////////////////////////////////// -typedef void* HWND; -#include "psemu_plugin_defs.h" - -const char *LibName = "CD-ROM Device Interface"; -const int version = 0; -const int revision = 1; -const int build = 0; - -const char *PSEgetLibName(void) { - return LibName; -} - -unsigned long PSEgetLibType(void) { - return PSE_LT_CDR; -} - -unsigned long PSEgetLibVersion(void) { - return version << 16 | revision << 8 | build; -} -///////////////////////////////////////////////////////// - -//#define SysPrintf printf -#define SysPrintf(...) ((void)0) - -#define UseMultiThreaded 1 -#define NoIdleSleep 1 - -struct CdrStat { - unsigned long Type; - unsigned long Status; - unsigned char Time[3]; -}; - -MMCDeviceInterface **cdInterface; -pthread_t readThread; -pthread_cond_t readCond; -pthread_mutex_t readMutex; -char deviceFilePath[ 256 ]; - -kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator, mach_port_t *masterPort ) -{ - kern_return_t kernResult; - CFMutableDictionaryRef classesToMatch; - int i; - - kernResult = IOMasterPort( bootstrap_port, masterPort ); - if ( kernResult != KERN_SUCCESS ) - { - SysPrintf( "IOMasterPort returned %d\n", kernResult ); - return kernResult; - } - - for (i = 0; i < 2; i++) - { - // CD media are instances of class kIOCDMediaClass/kIODVDMediaClass. - classesToMatch = IOServiceMatching( (i == 0) ? kIOCDMediaClass : kIODVDMediaClass ); - - if ( classesToMatch == NULL ) - { - SysPrintf( "IOServiceMatching returned a NULL dictionary.\n" ); - continue; - } - else - { - // Each IOMedia object has a property with key kIOMediaEjectable - // which is true if the media is indeed ejectable. So add property - // to CFDictionary for matching. - CFDictionarySetValue( classesToMatch, - CFSTR( kIOMediaEjectableKey ), kCFBooleanTrue ); - } - kernResult = IOServiceGetMatchingServices( *masterPort, - classesToMatch, mediaIterator ); - if ( (kernResult != KERN_SUCCESS) || (*mediaIterator == NULL) ) - SysPrintf( "No ejectable CD media found.\n kernResult = %d\n", kernResult ); - else - break; - } - - return kernResult; -} - -kern_return_t GetDeviceFilePath( io_service_t media, - char *deviceFilePath, CFIndex maxPathSize ) -{ - kern_return_t kernResult = KERN_FAILURE; - CFTypeRef deviceFilePathAsCFString; - - deviceFilePathAsCFString = IORegistryEntryCreateCFProperty( - media, CFSTR( kIOBSDNameKey ), - kCFAllocatorDefault, 0 ); - *deviceFilePath = '\0'; - if ( deviceFilePathAsCFString ) - { - size_t devPathLength = strlen( _PATH_DEV )+0;//+1; - - strcpy( deviceFilePath, _PATH_DEV ); - // Add "r" before the BSD node name from the I/O Registry - // to specify the raw disk node. The raw disk node receives - // I/O requests directly and does not go through the - // buffer cache. - // strcat( deviceFilePath, "r"); // apparently som cd-rom drives don't like this - - if ( CFStringGetCString( deviceFilePathAsCFString, - deviceFilePath + devPathLength, - maxPathSize - devPathLength, - kCFStringEncodingASCII ) ) - { - SysPrintf( "BSD path: %s\n", deviceFilePath ); - kernResult = KERN_SUCCESS; - } - CFRelease( deviceFilePathAsCFString ); - } - - return kernResult; -} - -MMCDeviceInterface ** GetMMCInterfaceForDevice(io_service_t service) -{ - SInt32 score; - HRESULT herr; - kern_return_t err; - IOCFPlugInInterface **plugInInterface = NULL; - MMCDeviceInterface **mmcInterface = NULL; - - // Create the IOCFPlugIn interface so we can query it. - err = IOCreatePlugInInterfaceForService ( service, - kIOMMCDeviceUserClientTypeID, - kIOCFPlugInInterfaceID, - &plugInInterface, - &score ); - - if ( err != noErr ) - { - SysPrintf("IOCreatePlugInInterfaceForService returned %d\n", err); - return NULL; - } - - // Query the interface for the MMCDeviceInterface. - herr = ( *plugInInterface )->QueryInterface ( plugInInterface, - CFUUIDGetUUIDBytes ( kIOMMCDeviceInterfaceID ), - ( LPVOID ) &mmcInterface ); - if ( herr != S_OK ) - { - SysPrintf("QueryInterface returned %ld\n", herr); - return NULL; - } - -// ( *mmcInterface )->Release ( mmcInterface ); -// IODestroyPlugInInterface ( plugInInterface ); - - return mmcInterface; -} - -int GetCDROMServices() -{ - mach_port_t masterPort; - CFMutableDictionaryRef matchingDict; - CFMutableDictionaryRef subDict; - io_service_t nextDevice; - io_iterator_t iterator; - kern_return_t kr; - int retVal = -1; - - // first create a master_port for my task - kr = IOMasterPort(MACH_PORT_NULL, &masterPort); - if (kr || !masterPort) - { - SysPrintf("ERR: Couldn't create a master IOKit Port(%08x)\n", kr); - return -1; - } - - // Create the dictionaries - matchingDict = CFDictionaryCreateMutable ( kCFAllocatorDefault, 0, NULL, NULL ); - subDict = CFDictionaryCreateMutable ( kCFAllocatorDefault, 0, NULL, NULL ); - - // Create a dictionary with the "SCSITaskDeviceCategory" key = "SCSITaskAuthoringDevice" - // TODO: examine if this also work on non-authoring capable devices - CFDictionarySetValue ( subDict, - CFSTR ( kIOPropertySCSITaskDeviceCategory ), - CFSTR ( kIOPropertySCSITaskAuthoringDevice ) ); - - // Add the dictionary to the main dictionary with the key "IOPropertyMatch" to - // narrow the search to the above dictionary. - CFDictionarySetValue ( matchingDict, - CFSTR ( kIOPropertyMatchKey ), - subDict ); - - - kr = IOServiceGetMatchingServices( masterPort, - matchingDict, &iterator ); - if ( (kr != KERN_SUCCESS) || (iterator == NULL) ) { - SysPrintf( "No CDROM drives found.\n kernResult = %d\n", kr ); - goto error; - } - - // Find best cdrom drive - i.e. the first :-) - while(nextDevice = IOIteratorNext( iterator )) { - cdInterface = GetMMCInterfaceForDevice(nextDevice); - kr = IOObjectRelease(nextDevice); - break; // hack - } - IOObjectRelease( iterator ); - - retVal = 0; -error: - // Now done with the master_port - if (masterPort) - mach_port_deallocate(mach_task_self(), masterPort); - - return retVal; -} - -/* determine if the tray is open for our cd-drive */ -int TrayIsOpen() -{ -#ifdef USE_DEVICE_INTERFACE - if (cdInterface) { - if ((*cdInterface)->GetTrayState) { - IOReturn res; - char state; - - res = (*cdInterface)->GetTrayState(cdInterface, &state); - if (kIOReturnSuccess == res) { - if (kMMCDeviceTrayOpen == state) - return true; - } - } - } -#endif - return true; -} - -/* opens tray if no media is in the device */ -void TrayOpen() -{ - if (TrayIsOpen()) - return; - - if (cdInterface) { - if ((*cdInterface)->SetTrayState) { - (*cdInterface)->SetTrayState(cdInterface, kMMCDeviceTrayOpen); - } - } -} - -long openDisc() -{ - mach_port_t masterPort = NULL; - kern_return_t kernResult; - io_iterator_t mediaIterator; - io_service_t media; - CFTypeRef toc_cf; - //dk_cd_read_disc_info_t cd_read_disc_info; - //dk_cd_read_track_info_t cd_read_track_info; - //CDDiscInfo di; CDTrackInfo ti; - u_int16_t speed; - int i; - - CD.cd = 0; - CD.status = 0x10; - - // Find 1st CD - kernResult = FindEjectableCDMedia( &mediaIterator, &masterPort ); - if ( kernResult != KERN_SUCCESS ) - return -1; - - media = IOIteratorNext( mediaIterator ); - if (NULL == media) - return -1; - - // Release the iterator. - IOObjectRelease( mediaIterator ); - - // Get The device path - kernResult = GetDeviceFilePath( media, deviceFilePath, - sizeof( deviceFilePath ) ); - if ( kernResult != KERN_SUCCESS ) - return -1; - - toc_cf = IORegistryEntryCreateCFProperty(media,CFSTR(kIOCDMediaTOCKey),kCFAllocatorDefault,0); - if(toc_cf != nil) - { - CDTOC *toc = (CDTOC *)CFDataGetBytePtr(toc_cf); - int ndesc; - - ndesc = CDTOCGetDescriptorCount(toc); - if (CD.tl) free(CD.tl); - CD.tl = calloc(ndesc, sizeof(Track)); - if (NULL == CD.tl) - return -1; - - CD.numtracks = 0; - for (i=0; idescriptors[i]; - - if(desc->point < 100) - { - CD.tl[CD.numtracks].type = ((desc->control & 0x0f) != 0) ? Mode2 : Audio; // TODO: set correct type - CD.tl[CD.numtracks].num = desc->point; - CD.tl[CD.numtracks].start[2] = desc->p.frame; - CD.tl[CD.numtracks].start[1] = desc->p.second; - CD.tl[CD.numtracks].start[0] = desc->p.minute; - - if (CD.numtracks) { - CD.tl[CD.numtracks-1].end[2] = desc->p.frame; - CD.tl[CD.numtracks-1].end[1] = desc->p.second; - CD.tl[CD.numtracks-1].end[0] = desc->p.minute; - } - //normalizeTime(CD.tl[0].start); - //normalizeTime(CD.tl[0].end); - CD.numtracks++; - } - } - CDMSF end = CDConvertTrackNumberToMSF(0xa2, toc); - CD.tl[CD.numtracks-1].end[2] = end.frame; - CD.tl[CD.numtracks-1].end[1] = end.second; - CD.tl[CD.numtracks-1].end[0] = end.minute; - - CFRelease(toc_cf); - } else { - SysPrintf("failed to read cdrom toc information\n"); - IOObjectRelease( mediaIterator ); - return -1; - } - - IOObjectRelease( media ); - - // Free master port if we created one. - if (masterPort) - mach_port_deallocate(mach_task_self(), masterPort); - - // Now open it - CD.cd = open(deviceFilePath, O_RDONLY, 0); - if (CD.cd <= 0) { - perror("failed to open cd: "); - CD.cd = 0; - return -1; - } - - // get number of tracks -/* memset(&cd_read_disc_info, 0, sizeof(dk_cd_read_disc_info_t)); - cd_read_disc_info.bufferLength = sizeof(CDDiscInfo); - cd_read_disc_info.buffer = &di; - if (ioctl(CD.cd, DKIOCCDREADDISCINFO, &cd_read_disc_info) < 0) { - perror("error reading cd info: "); - CD.numtracks = 1; - } - else { - CD.numtracks = di.lastTrackNumberInLastSessionLSB-di.firstTrackNumberInLastSessionLSB+1; - } - - CD.tl = calloc(CD.numtracks, sizeof(Track)); - for (i=0; i return total length of cd - // otherwise return start in bcd time format -long getTD(int track, unsigned char* buffer) -{ - // lasttrack just keeps track of which track TD was requested last (go fig) - - if (track > getNumTracks()) - { -// SysPrintf("getTD bad %2d\n", track); - return -1; - } - - if (track == 0) - { - buffer[0] = CD.tl[CD.numtracks-1].end[0]; - buffer[1] = CD.tl[CD.numtracks-1].end[1]; - buffer[2] = CD.tl[CD.numtracks-1].end[2]; - } - else - { - buffer[0] = CD.tl[track-1].start[0]; - buffer[1] = CD.tl[track-1].start[1]; - buffer[2] = CD.tl[track-1].start[2]; - } -// SysPrintf("getTD %2d %02d:%02d:%02d\n", track, (int)buffer[0], -// (int)buffer[1], (int)buffer[2]); - - // bcd encode it - buffer[0] = intToBCD(buffer[0]); - buffer[1] = intToBCD(buffer[1]); - buffer[2] = intToBCD(buffer[2]); -// SysPrintf("end getTD()\r\n"); - return 0; -} - -// return the sector address - the buffer address + 12 bytes for subheader offset. -unsigned char* getSector(int subchannel) -{ - SysPrintf("getSector()\n"); - - if (readThread) { - int err; - // wait until we can obtain a lock */ - err = pthread_mutex_lock(&readMutex); - if (err != 0) { - SysPrintf("failed to lock mutex, error = %i\n", err); - } else { - err = pthread_mutex_unlock(&readMutex); - if (err != 0) { - SysPrintf("failed to unlock mutex, error = %i\n", err); - } - } - } - - if (CD.sector == -1) - return NULL; - else { - return CD.buffer /*+ (CD.sector - CD.bufferPos)*/ + ((subchannel) ? 0 : 12); - } -} - -// returns the number of tracks -char getNumTracks() -{ -// SysPrintf("start getNumTracks()\r\n"); - // if there's no open cd, return -1 - if (CD.cd == 0) { - return -1; - } - -// SysPrintf("numtracks %d\n",CD.numtracks); -// SysPrintf("end getNumTracks()\r\n"); - return CD.numtracks; -} - -// read the sector pointed to by pos -int readSector(off_t pos, unsigned char *buffer) -{ - int len; - - SysPrintf("start readit()\n"); - - if (0 == CD.cd) - return 0; - - // go to the sector - pos = lseek(CD.cd, pos, SEEK_SET); - if (pos < 0) - goto error; - - // and read it into the buffer - len = read(CD.cd, buffer, 2352); - if (len < 2352) - goto error; - - SysPrintf("end readit()\n"); - return 2352; - -error: - perror("CD read error"); - return 0; -} - -void seekSector(const unsigned char m, const unsigned char s, const unsigned char f) -{ - int err; - SysPrintf("start seekSector()\n"); - - if (0 == CD.cd) - return; - - if (readThread) { - // wait until we're done reading - err = pthread_mutex_lock(&readMutex); - if (err != 0) { - SysPrintf("failed to lock mutex, error = %i\n", err); - } else { - // calc byte to search for - CD.sector = (( (m * 60) + (s - 2)) * 75 + f) * 2352; - - // unlock again, since the mutex won't be set until - // we signal a cond later in this function - err = pthread_mutex_unlock(&readMutex); - if (err != 0) { - SysPrintf("failed to unlock mutex, error = %i\n", err); - } - } - } else { - // calc byte to search for - CD.sector = (( (m * 60) + (s - 2)) * 75 + f) * 2352; - } -// SysPrintf("seek %d %02d:%02d:%02d",CD.sector, (int)m, (int)s, (int)f); - - // is it cached? -#if 0 - if ((CD.sector >= CD.bufferPos) && - (CD.sector < (CD.bufferPos + CD.bufferSize)) ) { -// SysPrintf(" cached %d %d\n",CD.sector - CD.bufferPos,BUFFER_SIZE); -// SysPrintf("end seekSector()\r\n"); - return; - } - // not cached - read a few blocks into the cache - else -#endif - { - if (readThread) { - SysPrintf("end seekSector()\n"); - - // signal that a new sector is ready to be read - if (pthread_cond_broadcast(&readCond) == 0) - return; - - SysPrintf("failed to signal 'readCond'\n"); - } - - CD.bufferSize = readSector(CD.sector, CD.buffer); - if (CD.bufferSize==0) CD.sector = -1; - else CD.bufferPos = CD.sector; - } - SysPrintf("end seekSector()\n"); -} - -/* handles reading from the cd */ -void *read_thread(void *arg) -{ - struct timespec dT = { 20, 0 }; // 20 s - //struct timespec dT = { 0, 400*1000*1000 }; // 400 ms - int err; - - pthread_mutex_lock(&readMutex); - //pthread_cleanup_push(pthread_exit, 0); - - for (;;) { - // wait until we're signalled - if (NoIdleSleep) { - err = pthread_cond_timedwait_relative_np(&readCond, &readMutex, &dT); - pthread_testcancel(); - } else { - err = pthread_cond_wait(&readCond, &readMutex); - } - if (err == EINVAL) { - SysPrintf("failed cond wait for 'readCond', error = %i\n", err); - return (void *)-1; - } - - CD.bufferSize = readSector(CD.sector, CD.buffer); - if (CD.bufferSize==0) CD.sector = -1; - else CD.bufferPos = CD.sector; - } - //pthread_cleanup_pop(1); - - return 0; -} - -long CDRopen(void) -{ - SysPrintf("CDR_open()\n"); - if (UseMultiThreaded && !readThread) { - int err; - - err = pthread_cond_init(&readCond, NULL); - if (err != 0) { - SysPrintf("failed to create conditional, error=%i\n" - "going to single thread mode\n", err); - } else { - err = pthread_mutex_init(&readMutex, NULL); - if (err != 0) { - SysPrintf("failed to create mutex, error=%i\n" - "going to single thread mode\n", err); - } else { - struct sched_param params; - int policy; - - err = pthread_create(&readThread, NULL, read_thread, NULL); - if (err!=0) { - SysPrintf("failed to create read thread, error=%i\n" - "going to single thread mode\n", err); - } else { - // set the thread to maximum priority - pthread_getschedparam(readThread, &policy, ¶ms); - params.sched_priority = sched_get_priority_max(policy); - pthread_setschedparam(readThread, policy, ¶ms); - } - } - } - } - - if (openDisc() < 0) { - TrayOpen(); - return 0; - } - - seekSector(0,2,0); - - SysPrintf("end CDR_open()\n"); - return 0; -} - -long CDRinit(void) { - -#ifdef USE_DEVICE_INTERFACE - return GetCDROMServices(); -#endif - - return 0; -} - -long CDRshutdown(void) { - // do cleanup - CDRclose(); - - return 0; -} - -long CDRclose(void) { - SysPrintf("start CDR_close()\n"); - - if (!CD.cd) - return 0; - - if (readThread) { - int termVal = 0; - // make sure we're done reading - pthread_mutex_lock(&readMutex); - pthread_mutex_unlock(&readMutex); - - // kill read thread - pthread_cancel(readThread); - //pthread_kill(readThread, SIGTERM); - pthread_cond_broadcast(&readCond); - pthread_join(readThread, (void **)&termVal); - - // remove fluff - pthread_mutex_destroy(&readMutex); - pthread_cond_destroy(&readCond); - - readThread = 0; - } - - close(CD.cd); - CD.cd = 0; - - SysPrintf("end CDR_close()\n"); - return 0; -} - -long CDRgetTN(unsigned char *buffer) { - //SysPrintf("start CDRgetTN()\n"); - return getTN(buffer); -} - -long CDRgetTD(unsigned char track, unsigned char *buffer) { - unsigned char temp[3]; - int result = getTD((int)track, temp); - - // SysPrintf("start CDRgetTD()\n"); - - if (result == -1) return -1; - - buffer[1] = temp[1]; - buffer[2] = temp[0]; - - return 0; -} - -/* called when the psx requests a read */ -long CDRreadTrack(unsigned char *time) { -// SysPrintf("start CDR_readTrack()\r\n"); - //SysPrintf("readTrack at %02d:%02d:%02d\n", BCDToInt(time[0]), BCDToInt(time[1]), BCDToInt(time[2])); - - if (CD.cd != 0) - seekSector(BCDToInt(time[0]), BCDToInt(time[1]), BCDToInt(time[2])); - -// SysPrintf("end CDR_readTrack()\r\n"); - return PSE_CDR_ERR_SUCCESS; -} - -/* called after the read should be finished, and the data is needed */ -unsigned char *CDRgetBuffer(void) { - //SysPrintf("start CDR_getBuffer()\n"); -// SysPrintf("start CDR_getBuffer()\r\n"); - if (CD.cd == 0) - return NULL; - - return getSector(0); -} - -unsigned char *CDRgetBufferSub(void) { - //SysPrintf("start CDR_getBuffer()\n"); -// SysPrintf("start CDR_getBuffer()\r\n"); - return getSector(1); -} - -/* from PSX manual p. 83 */ -#define CDR_STATUS_UNKNOWN 0x00 -#define CDR_STATUS_ERROR 0x02 /* command error detected */ -#define CDR_STATUS_STANDBY 0x04 /* spindle motor rotating */ -#define CDR_STATUS_SEEK_ERROR 0x08 /* seek error detected */ -#define CDR_STATUS_SHELL_OPEN 0x10 /* once shell open */ -#define CDR_STATUS_READING 0x20 /* reading data sectors */ -#define CDR_STATUS_SEEKING 0x40 -#define CDR_STATUS_PLAYING 0x80 /* playing CD-DA */ - -// reads cdr status - from old plugin -// type: -// 0x00 - unknown -// 0x01 - data -// 0x02 - audio -// 0xff - no cdrom -// status: (only shell open supported) -// 0x00 - unknown -// 0x01 - error -// 0x04 - seek error -> no disk??? -// 0x10 - shell open -> tray open -// 0x20 - reading -// 0x40 - seeking -// 0x80 - playing -// time: -// byte 0 - minute -// byte 1 - second -// byte 2 - frame - -long CDRgetStatus(struct CdrStat *stat) -{ - if (CD.cd == 0) { - // no cd - check for disc - if (openDisc() < 0) { - if (TrayIsOpen()) { - stat->Type = 0xff;//0x00; - stat->Status |= CDR_STATUS_SHELL_OPEN; - } else { - TrayOpen(); - stat->Type = 0xff; // indicates no cd - stat->Status = CDR_STATUS_UNKNOWN; - } - stat->Time[0] = - stat->Time[1] = - stat->Time[2] = 0; - return 0; - } - } - - if (CD.tl[0].type == Mode1 || CD.tl[0].type == Mode2) { - stat->Type = 0x01; - stat->Status = CDR_STATUS_UNKNOWN; - } else if (CD.tl[0].type == Audio) { - stat->Type = 0x02; - stat->Status = CDR_STATUS_UNKNOWN; // FIXME - } else { - stat->Type = 0x00; - stat->Status = CDR_STATUS_UNKNOWN; // FIXME - } - - stat->Time[0] = - stat->Time[1] = - stat->Time[2] = 0; // FIXME - - return 0; -} - -char *CDRgetDriveLetter(void) { - //SysPrintf("start CDR_getBuffer()\n"); -// SysPrintf("start CDR_getBuffer()\r\n"); - return deviceFilePath; -} - -#if 0 -AudioFilePlayID cdFilePlayID; -long CDRplay(unsigned char *sector) -{ - // TODO: find the correct track... - - NewAudioFilePlayID(&fsref, &cdFilePlayID); - - return 0; -} - -long CDRstop(void) -{ - - return 0; -} -#endif -/* -long (CALLBACK* CDRconfigure)(void); -long (CALLBACK* CDRtest)(void); -void (CALLBACK* CDRabout)(void); -*/ - -#ifdef TEST -int main (int argc, int *argv) -{ - CDRopen(); - CDRclose(); - return 0; -} -#endif diff --git a/macosx/plugins/CDDeviceInterface/src/PlugCD.h b/macosx/plugins/CDDeviceInterface/src/PlugCD.h deleted file mode 100644 index 9ca68acf..00000000 --- a/macosx/plugins/CDDeviceInterface/src/PlugCD.h +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - PlugCD.h - CDDeviceInterface - - Created by Gil Pedersen on Fri July 18 2003. - Copyright (c) 2003,2004 Gil Pedersen. - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -#ifndef _PLUGCD_H_ -#define _PLUGCD_H_ - -#include - -#define CHAR_LEN 256 - -// 2352 is a sector size -#define BUFFER_SECTORS 50 -#define BUFFER_SIZE BUFFER_SECTORS*2352 -#define BZIP_BUFFER_SECTORS 10 - -// 74 minutes * 60 sex/min * 75 frames/sec * 96 bytes needed per frame -#define TOTAL_CD_LENGTH 74*60*75 -#define BYTES_PER_SUBCHANNEL_FRAME 96 -#define MAX_SUBCHANNEL_DATA TOTAL_CD_LENGTH*BYTES_PER_SUBCHANNEL_FRAME - -typedef struct { - char dn[128]; - char fn[128]; -} cd_conf; - -cd_conf CDConfiguration; - -int rc; - -enum TrackType -{ - unknown, Mode1, Mode2, Audio, Pregap = 0x80 -}; - -typedef struct -{ - enum TrackType type; - char num; - unsigned char start[3]; - unsigned char end[3]; -} Track; - -struct -{ - int cd; - FILE* cdda; - int numtracks; - long bufferPos; - long bufferSize; - long sector; - long sectorType; - long status; - Track* tl; - unsigned char buffer[BUFFER_SIZE]; -} CD; - -void CDDAclose(void); - -// function headers for cdreader.c -char getNumTracks(); -void seekSector(const unsigned char m, const unsigned char s, const unsigned char f); -unsigned char* getSector(); -void newCD(const char * filename); -void readit(); - - -// subtracts two times in integer format (non-BCD) -> l - r = a -#define sub(l, r, a)\ - a[1] = 0;\ - a[0] = 0;\ - a[2] = l[2] - r[2];\ - if ((char)a[2] < 0)\ - {\ - a[2] += 75;\ - a[1] -= 1;\ - }\ - a[1] += l[1] - r[1];\ - if ((char)a[1] < 0)\ - {\ - a[1] += 60;\ - a[0] -= 1;\ - }\ - a[0] += l[0] - r[0];\ - -// converts a time like 17:61:00 to 18:01:00 -#define normalizeTime(c)\ - while(c[2] > 75)\ - {\ - c[2] -= 75;\ - c[1] += 1;\ - }\ - while(c[1] > 60)\ - {\ - c[1] -= 60;\ - c[0] += 1;\ - } - -// converts uchar in c to BCD character -#define intToBCD(c) (unsigned char)((c%10) | ((c/10)<<4)) - -// converts BCD number in c to uchar -#define BCDToInt(c) (unsigned char)((c & 0x0F) + 10 * ((c & 0xF0) >> 4)) - -#endif - diff --git a/macosx/plugins/CDDeviceInterface/version.plist b/macosx/plugins/CDDeviceInterface/version.plist deleted file mode 100644 index 78195202..00000000 --- a/macosx/plugins/CDDeviceInterface/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 38 - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - ProjectName - CdrDevMac - SourceVersion - 2350000 - - diff --git a/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj b/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj new file mode 100644 index 00000000..e5767cbf --- /dev/null +++ b/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj @@ -0,0 +1,360 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 2BD707180555997500CB5D9B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BD707170555997500CB5D9B /* IOKit.framework */; }; + 713DB2E811F113C30001BDD4 /* cdr.c in Sources */ = {isa = PBXBuildFile; fileRef = 713DB2E311F113C30001BDD4 /* cdr.c */; }; + 713DB2E911F113C30001BDD4 /* cdr.h in Headers */ = {isa = PBXBuildFile; fileRef = 713DB2E411F113C30001BDD4 /* cdr.h */; }; + 713DB2EB11F113C30001BDD4 /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = 713DB2E611F113C30001BDD4 /* util.c */; }; + 71F3C32811F3CD0B007B9F12 /* cdr-macosx.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F3C32411F3CD0B007B9F12 /* cdr-macosx.c */; }; + 71F3C32911F3CD0B007B9F12 /* cfg.c in Sources */ = {isa = PBXBuildFile; fileRef = 71F3C32511F3CD0B007B9F12 /* cfg.c */; }; + 71F3C32A11F3CD0B007B9F12 /* PluginConfigController.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F3C32611F3CD0B007B9F12 /* PluginConfigController.h */; }; + 71F3C32B11F3CD0B007B9F12 /* PluginConfigController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F3C32711F3CD0B007B9F12 /* PluginConfigController.m */; }; + 71F3C38611F3CFED007B9F12 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F3C38511F3CFED007B9F12 /* AppKit.framework */; }; + 71F3C38811F3CFF7007B9F12 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F3C38711F3CFF7007B9F12 /* Carbon.framework */; }; + 71F3C47A11F3D108007B9F12 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 71F3C47811F3D108007B9F12 /* Credits.rtf */; }; + 71F3C49D11F3D2B3007B9F12 /* DFCdromPluginConfig.nib in Resources */ = {isa = PBXBuildFile; fileRef = 71F3C49B11F3D2B3007B9F12 /* DFCdromPluginConfig.nib */; }; + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; + 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; + 2BD707170555997500CB5D9B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; + 713DB2E311F113C30001BDD4 /* cdr.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; name = cdr.c; path = ../../../plugins/dfcdrom/cdr.c; sourceTree = SOURCE_ROOT; }; + 713DB2E411F113C30001BDD4 /* cdr.h */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.h; name = cdr.h; path = ../../../plugins/dfcdrom/cdr.h; sourceTree = SOURCE_ROOT; }; + 713DB2E611F113C30001BDD4 /* util.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; name = util.c; path = ../../../plugins/dfcdrom/util.c; sourceTree = SOURCE_ROOT; }; + 71F3C32411F3CD0B007B9F12 /* cdr-macosx.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; name = "cdr-macosx.c"; path = "macsrc/cdr-macosx.c"; sourceTree = ""; }; + 71F3C32511F3CD0B007B9F12 /* cfg.c */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.c; name = cfg.c; path = macsrc/cfg.c; sourceTree = ""; }; + 71F3C32611F3CD0B007B9F12 /* PluginConfigController.h */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.h; name = PluginConfigController.h; path = macsrc/PluginConfigController.h; sourceTree = ""; }; + 71F3C32711F3CD0B007B9F12 /* PluginConfigController.m */ = {isa = PBXFileReference; fileEncoding = 0; lastKnownFileType = sourcecode.c.objc; name = PluginConfigController.m; path = macsrc/PluginConfigController.m; sourceTree = ""; }; + 71F3C38511F3CFED007B9F12 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 71F3C38711F3CFF7007B9F12 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; + 71F3C47911F3D108007B9F12 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; + 71F3C49C11F3D2B3007B9F12 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/DFCdromPluginConfig.nib; sourceTree = ""; }; + 8D576316048677EA00EA77CD /* DFCdrom.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DFCdrom.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D576313048677EA00EA77CD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, + 2BD707180555997500CB5D9B /* IOKit.framework in Frameworks */, + 71F3C38611F3CFED007B9F12 /* AppKit.framework in Frameworks */, + 71F3C38811F3CFF7007B9F12 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 089C166AFE841209C02AAC07 /* CdrDevMac */ = { + isa = PBXGroup; + children = ( + 08FB77AFFE84173DC02AAC07 /* Source Files */, + 089C167CFE841241C02AAC07 /* Resources */, + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, + 19C28FB6FE9D52B211CA2CBB /* Products */, + ); + name = CdrDevMac; + sourceTree = ""; + }; + 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 71F3C38511F3CFED007B9F12 /* AppKit.framework */, + 71F3C38711F3CFF7007B9F12 /* Carbon.framework */, + 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, + 2BD707170555997500CB5D9B /* IOKit.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C167CFE841241C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 71F3C49B11F3D2B3007B9F12 /* DFCdromPluginConfig.nib */, + 71F3C47811F3D108007B9F12 /* Credits.rtf */, + 8D576317048677EA00EA77CD /* Info.plist */, + 8D5B49A704867FD3000E48DA /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AFFE84173DC02AAC07 /* Source Files */ = { + isa = PBXGroup; + children = ( + 71F3C32111F3CCEF007B9F12 /* macsrc */, + 71F3C30911F3CC22007B9F12 /* src */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 19C28FB6FE9D52B211CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D576316048677EA00EA77CD /* DFCdrom.psxplugin */, + ); + name = Products; + sourceTree = ""; + }; + 71F3C30911F3CC22007B9F12 /* src */ = { + isa = PBXGroup; + children = ( + 713DB2E311F113C30001BDD4 /* cdr.c */, + 713DB2E411F113C30001BDD4 /* cdr.h */, + 713DB2E611F113C30001BDD4 /* util.c */, + ); + name = src; + sourceTree = ""; + }; + 71F3C32111F3CCEF007B9F12 /* macsrc */ = { + isa = PBXGroup; + children = ( + 71F3C32411F3CD0B007B9F12 /* cdr-macosx.c */, + 71F3C32511F3CD0B007B9F12 /* cfg.c */, + 71F3C32611F3CD0B007B9F12 /* PluginConfigController.h */, + 71F3C32711F3CD0B007B9F12 /* PluginConfigController.m */, + ); + name = macsrc; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8D57630E048677EA00EA77CD /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 713DB2E911F113C30001BDD4 /* cdr.h in Headers */, + 71F3C32A11F3CD0B007B9F12 /* PluginConfigController.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8D57630D048677EA00EA77CD /* DFCdrom */ = { + isa = PBXNativeTarget; + buildConfigurationList = 710735990FDEED75004AD098 /* Build configuration list for PBXNativeTarget "DFCdrom" */; + buildPhases = ( + 8D57630E048677EA00EA77CD /* Headers */, + 8D57630F048677EA00EA77CD /* Resources */, + 8D576311048677EA00EA77CD /* Sources */, + 8D576313048677EA00EA77CD /* Frameworks */, + 8D576315048677EA00EA77CD /* Rez */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DFCdrom; + productInstallPath = "$(HOME)/Library/Bundles"; + productName = CdrDevMac; + productReference = 8D576316048677EA00EA77CD /* DFCdrom.psxplugin */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 089C1669FE841209C02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 7107359E0FDEED75004AD098 /* Build configuration list for PBXProject "DFCdrom" */; + hasScannedForEncodings = 1; + mainGroup = 089C166AFE841209C02AAC07 /* CdrDevMac */; + projectDirPath = ""; + targets = ( + 8D57630D048677EA00EA77CD /* DFCdrom */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D57630F048677EA00EA77CD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */, + 71F3C47A11F3D108007B9F12 /* Credits.rtf in Resources */, + 71F3C49D11F3D2B3007B9F12 /* DFCdromPluginConfig.nib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 8D576315048677EA00EA77CD /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D576311048677EA00EA77CD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 713DB2E811F113C30001BDD4 /* cdr.c in Sources */, + 713DB2EB11F113C30001BDD4 /* util.c in Sources */, + 71F3C32811F3CD0B007B9F12 /* cdr-macosx.c in Sources */, + 71F3C32911F3CD0B007B9F12 /* cfg.c in Sources */, + 71F3C32B11F3CD0B007B9F12 /* PluginConfigController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 71F3C47811F3D108007B9F12 /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + 71F3C47911F3D108007B9F12 /* English */, + ); + name = Credits.rtf; + sourceTree = ""; + }; + 71F3C49B11F3D2B3007B9F12 /* DFCdromPluginConfig.nib */ = { + isa = PBXVariantGroup; + children = ( + 71F3C49C11F3D2B3007B9F12 /* English */, + ); + name = DFCdromPluginConfig.nib; + sourceTree = ""; + }; + 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C167EFE841241C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7107359A0FDEED75004AD098 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins"; + LIBRARY_STYLE = BUNDLE; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = DFCdrom; + SECTORDER_FLAGS = ""; + SYMROOT = ../../build; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = psxplugin; + }; + name = Development; + }; + 7107359B0FDEED75004AD098 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUGGING_SYMBOLS = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = s; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_UNKNOWN_PRAGMAS = NO; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Playstation Emulator Plugins"; + LIBRARY_STYLE = BUNDLE; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = DFCdrom; + SECTORDER_FLAGS = ""; + SYMROOT = ../../build; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = psxplugin; + ZERO_LINK = NO; + }; + name = Deployment; + }; + 7107359F0FDEED75004AD098 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_MODEL_TUNING = ""; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = "_MACOSX=1"; + HEADER_SEARCH_PATHS = ( + ../../../libpcsxcore, + ../.., + ../../../plugins/dfcdrom, + ); + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Development; + }; + 710735A00FDEED75004AD098 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_MODEL_TUNING = ""; + GCC_PREPROCESSOR_DEFINITIONS = "_MACOSX=1"; + HEADER_SEARCH_PATHS = ( + ../../../libpcsxcore, + ../.., + ../../../plugins/dfcdrom, + ); + }; + name = Deployment; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 710735990FDEED75004AD098 /* Build configuration list for PBXNativeTarget "DFCdrom" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7107359A0FDEED75004AD098 /* Development */, + 7107359B0FDEED75004AD098 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; + 7107359E0FDEED75004AD098 /* Build configuration list for PBXProject "DFCdrom" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7107359F0FDEED75004AD098 /* Development */, + 710735A00FDEED75004AD098 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; +/* End XCConfigurationList section */ + }; + rootObject = 089C1669FE841209C02AAC07 /* Project object */; +} diff --git a/macosx/plugins/DFCdrom/English.lproj/Credits.rtf b/macosx/plugins/DFCdrom/English.lproj/Credits.rtf new file mode 100644 index 00000000..76fa6442 --- /dev/null +++ b/macosx/plugins/DFCdrom/English.lproj/Credits.rtf @@ -0,0 +1,13 @@ +{\rtf1\mac\ansicpg10025\cocoartf824\cocoasubrtf420 +{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs24 \cf0 Original coder: +\f1\b0 \ + linuzappz\ +\ + +\f0\b Macintosh Port: +\f1\b0 \ + Wei Mingzhi} \ No newline at end of file diff --git a/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/classes.nib b/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/classes.nib new file mode 100644 index 00000000..b1e8f6c7 --- /dev/null +++ b/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/classes.nib @@ -0,0 +1,18 @@ +{ + IBClasses = ( + { + ACTIONS = {cancel = id; ok = id; }; + CLASS = DFCdromPluginConfigController; + LANGUAGE = ObjC; + OUTLETS = {CacheSize = NSSlider; Cached = NSControl; CdSpeed = NSPopUpButton; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {"" = id; }; + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/info.nib b/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/info.nib new file mode 100644 index 00000000..f90f50b0 --- /dev/null +++ b/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 117 49 561 249 0 0 1024 746 + IBFramework Version + 446.1 + IBOpenObjects + + 5 + + IBSystem Version + 8P2137 + + diff --git a/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/keyedobjects.nib b/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/keyedobjects.nib new file mode 100644 index 00000000..64a50213 Binary files /dev/null and b/macosx/plugins/DFCdrom/English.lproj/DFCdromPluginConfig.nib/keyedobjects.nib differ diff --git a/macosx/plugins/DFCdrom/English.lproj/InfoPlist.strings b/macosx/plugins/DFCdrom/English.lproj/InfoPlist.strings new file mode 100755 index 00000000..ea885a5d Binary files /dev/null and b/macosx/plugins/DFCdrom/English.lproj/InfoPlist.strings differ diff --git a/macosx/plugins/DFCdrom/Info.plist b/macosx/plugins/DFCdrom/Info.plist new file mode 100644 index 00000000..ee25402f --- /dev/null +++ b/macosx/plugins/DFCdrom/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + DFCdrom + CFBundleIconFile + + CFBundleIdentifier + net.pcsx.DFCdrom + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + PsxP + CFBundleSignature + CdDI + CFBundleVersion + 1.0 + + diff --git a/macosx/plugins/DFCdrom/macsrc/PluginConfigController.h b/macosx/plugins/DFCdrom/macsrc/PluginConfigController.h new file mode 100644 index 00000000..b7f6fafb --- /dev/null +++ b/macosx/plugins/DFCdrom/macsrc/PluginConfigController.h @@ -0,0 +1,18 @@ +#define PluginConfigController DFCdromPluginConfigController + +#import + +@interface PluginConfigController : NSWindowController +{ + IBOutlet NSControl *Cached; + IBOutlet NSSlider *CacheSize; + IBOutlet NSPopUpButton *CdSpeed; + + NSMutableDictionary *keyValues; +} +- (IBAction)cancel:(id)sender; +- (IBAction)ok:(id)sender; + +- (void)loadValues; + +@end diff --git a/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m b/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m new file mode 100644 index 00000000..02b3a76d --- /dev/null +++ b/macosx/plugins/DFCdrom/macsrc/PluginConfigController.m @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2010, Wei Mingzhi . + * All Rights Reserved. + * + * Based on: Cdrom for Psemu Pro like Emulators + * By: linuzappz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#import "PluginConfigController.h" +#include "cdr.h" + +#define APP_ID @"net.pcsx.DFCdrom" +#define PrefsKey APP_ID @" Settings" + +static PluginConfigController *windowController; + +void AboutDlgProc() +{ + // Get parent application instance + NSApplication *app = [NSApplication sharedApplication]; + NSBundle *bundle = [NSBundle bundleWithIdentifier:APP_ID]; + + // Get Credits.rtf + NSString *path = [bundle pathForResource:@"Credits" ofType:@"rtf"]; + NSAttributedString *credits; + if (path) { + credits = [[[NSAttributedString alloc] initWithPath: path + documentAttributes:NULL] autorelease]; + } else { + credits = [[[NSAttributedString alloc] initWithString:@""] autorelease]; + } + + // Get Application Icon + NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[bundle bundlePath]]; + NSSize size = NSMakeSize(64, 64); + [icon setSize:size]; + + [app orderFrontStandardAboutPanelWithOptions:[NSDictionary dictionaryWithObjectsAndKeys: + [bundle objectForInfoDictionaryKey:@"CFBundleName"], @"ApplicationName", + icon, @"ApplicationIcon", + [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"ApplicationVersion", + [bundle objectForInfoDictionaryKey:@"CFBundleVersion"], @"Version", + [bundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"], @"Copyright", + credits, @"Credits", + nil]]; +} + +void ConfDlgProc() +{ + NSWindow *window; + + if (windowController == nil) { + windowController = [[PluginConfigController alloc] initWithWindowNibName:@"DFCdromPluginConfig"]; + } + window = [windowController window]; + + [windowController loadValues]; + + [window center]; + [window makeKeyAndOrderFront:nil]; +} + +void ReadConfig() +{ + NSDictionary *keyValues; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: + [[NSMutableDictionary alloc] initWithObjectsAndKeys: + [NSNumber numberWithBool:YES], @"Threaded", + [NSNumber numberWithInt:64], @"Cache Size", + [NSNumber numberWithInt:0], @"Speed", + nil], PrefsKey, nil]]; + + keyValues = [defaults dictionaryForKey:PrefsKey]; + + ReadMode = ([[keyValues objectForKey:@"Threaded"] boolValue] ? THREADED : NORMAL); + CacheSize = [[keyValues objectForKey:@"Cache Size"] intValue]; + CdrSpeed = [[keyValues objectForKey:@"Speed"] intValue]; +} + +@implementation PluginConfigController + +- (IBAction)cancel:(id)sender +{ + [self close]; +} + +- (IBAction)ok:(id)sender +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + NSMutableDictionary *writeDic = [NSMutableDictionary dictionaryWithDictionary:keyValues]; + + [writeDic setObject:[NSNumber numberWithInt:[Cached intValue]] forKey:@"Threaded"]; + [writeDic setObject:[NSNumber numberWithInt:[CacheSize intValue]] forKey:@"Cache Size"]; + + switch ([CdSpeed indexOfSelectedItem]) { + case 1: [writeDic setObject:[NSNumber numberWithInt:1] forKey:@"Speed"]; break; + case 2: [writeDic setObject:[NSNumber numberWithInt:2] forKey:@"Speed"]; break; + case 3: [writeDic setObject:[NSNumber numberWithInt:4] forKey:@"Speed"]; break; + case 4: [writeDic setObject:[NSNumber numberWithInt:8] forKey:@"Speed"]; break; + case 5: [writeDic setObject:[NSNumber numberWithInt:16] forKey:@"Speed"]; break; + case 6: [writeDic setObject:[NSNumber numberWithInt:32] forKey:@"Speed"]; break; + default: [writeDic setObject:[NSNumber numberWithInt:0] forKey:@"Speed"]; break; + } + + // write to defaults + [defaults setObject:writeDic forKey:PrefsKey]; + [defaults synchronize]; + + // and set global values accordingly + ReadConfig(); + + [self close]; +} + +- (void)loadValues +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + ReadConfig(); + + // load from preferences + [keyValues release]; + keyValues = [[defaults dictionaryForKey:PrefsKey] retain]; + + [Cached setIntValue:[[keyValues objectForKey:@"Threaded"] intValue]]; + [CacheSize setIntValue:[[keyValues objectForKey:@"Cache Size"] intValue]]; + + switch ([[keyValues objectForKey:@"Speed"] intValue]) { + case 1: [CdSpeed selectItemAtIndex:1]; break; + case 2: [CdSpeed selectItemAtIndex:2]; break; + case 4: [CdSpeed selectItemAtIndex:3]; break; + case 8: [CdSpeed selectItemAtIndex:4]; break; + case 16: [CdSpeed selectItemAtIndex:5]; break; + case 32: [CdSpeed selectItemAtIndex:6]; break; + default: [CdSpeed selectItemAtIndex:0]; break; + } +} + +- (void)awakeFromNib +{ +} + +@end diff --git a/macosx/plugins/DFCdrom/macsrc/cdr-macosx.c b/macosx/plugins/DFCdrom/macsrc/cdr-macosx.c new file mode 100644 index 00000000..4b7fdfbe --- /dev/null +++ b/macosx/plugins/DFCdrom/macsrc/cdr-macosx.c @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2010, Wei Mingzhi . + * All Rights Reserved. + * + * Based on: Cdrom for Psemu Pro like Emulators + * By: linuzappz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "cdr.h" + +#ifdef _MACOSX + +#include +#include +#include +#include +#include +#include +#include + +int cdHandle = -1; +char cdDevice[4096] = ""; + +static void FindCdDevice(char *dev) { + io_object_t next_media; + kern_return_t kern_result; + io_iterator_t media_iterator; + CFMutableDictionaryRef classes_to_match; + const char *name, *cd = kIOCDMediaClass, *dvd = kIODVDMediaClass; + + dev[0] = '\0'; + name = cd; + +start: + classes_to_match = IOServiceMatching(name); + if (classes_to_match == NULL) goto end; + + CFDictionarySetValue(classes_to_match, CFSTR(kIOMediaEjectableKey), + kCFBooleanTrue); + + kern_result = IOServiceGetMatchingServices(kIOMasterPortDefault, + classes_to_match, &media_iterator); + + if (kern_result != KERN_SUCCESS) goto end; + + next_media = IOIteratorNext(media_iterator); + if (next_media != 0) { + char psz_buf[0x32]; + size_t dev_path_length; + CFTypeRef str_bsd_path; + + do { + str_bsd_path = IORegistryEntryCreateCFProperty(next_media, + CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0); + + if (str_bsd_path == NULL) { + IOObjectRelease(next_media); + continue; + } + + strcpy(psz_buf, "/dev/r"); + dev_path_length = strlen(psz_buf); + + if (CFStringGetCString(str_bsd_path, (char *)&psz_buf + dev_path_length, + sizeof(psz_buf) - dev_path_length, kCFStringEncodingASCII)) + { + CFRelease(str_bsd_path); + IOObjectRelease(next_media); + IOObjectRelease(media_iterator); + strcpy(dev, psz_buf); + PRINTF("Found CD-ROM Device: %s\n", dev); + return; + } + + CFRelease(str_bsd_path); + IOObjectRelease(next_media); + } while ((next_media = IOIteratorNext(media_iterator)) != 0); + } + + IOObjectRelease(media_iterator); + +end: + if (dev[0] == '\0') { + if (name == cd) { + name = dvd; // Is this really necessary or correct? Dunno... + goto start; + } + } +} + +int OpenCdHandle(const char *dev) { + if (dev != NULL && dev[0] != '\0') strcpy(cdDevice, dev); + else if (cdDevice[0] == '\0') FindCdDevice(cdDevice); + + cdHandle = open(cdDevice, O_RDONLY, 0); + if (cdHandle < 0) return -1; + + if (CdrSpeed > 0) { + u_int16_t speed = kCDSpeedMin * CdrSpeed; + ioctl(cdHandle, DKIOCCDSETSPEED, &speed); + } + + return 0; +} + +void CloseCdHandle() { + if (cdHandle != -1) close(cdHandle); + cdHandle = -1; +} + +int IsCdHandleOpen() { + return 1; +} + +long GetTN(unsigned char *buffer) { + if (cdHandle < 0) return -1; + + // TODO + buffer[0] = 0; + buffer[1] = 0; + return 0; +} + +long GetTD(unsigned char track, unsigned char *buffer) { + if (cdHandle < 0) return -1; + + // TODO + memset(buffer + 1, 0, 3); + return 0; +} + +long GetTE(unsigned char track, unsigned char *m, unsigned char *s, unsigned char *f) { + return -1; // TODO +} + +long ReadSector(crdata *cr) { + int lba; + dk_cd_read_t r; + + if (cdHandle < 0) return -1; + + lba = msf_to_lba(cr->msf.cdmsf_min0, cr->msf.cdmsf_sec0, cr->msf.cdmsf_frame0); + + memset(&r, 0, sizeof(r)); + + r.offset = lba * CD_FRAMESIZE_RAW; + r.sectorArea = 0xF8; + r.sectorType = kCDSectorTypeUnknown; + r.bufferLength = CD_FRAMESIZE_RAW; + r.buffer = cr->buf; + + if (ioctl(cdHandle, DKIOCCDREAD, &r) != kIOReturnSuccess) { + return -1; + } + + return 0; +} + +long PlayCDDA(unsigned char *sector) { + return 0; // TODO +} + +long StopCDDA() { + return 0; // TODO +} + +long GetStatus(int playing, struct CdrStat *stat) { + memset(stat, 0, sizeof(struct CdrStat)); + stat->Type = 0x01; + + // Close and reopen the CD handle. If opening failed, + // then there is no CD in drive. + // Note that this WILL be screwed if user inserted another + // removable device such as USB stick when tray is open. + // There may be a better way, but this should do the job. + if (cdHandle >= 0) { + close(cdHandle); + cdHandle = -1; + } + + cdHandle = open(cdDevice, O_RDONLY, 0); + if (cdHandle < 0) { + // No CD in drive + stat->Type = 0xff; + stat->Status |= 0x10; + } else if (CdrSpeed > 0) { + u_int16_t speed = kCDSpeedMin * CdrSpeed; + ioctl(cdHandle, DKIOCCDSETSPEED, &speed); + } + + return 0; +} + +unsigned char *ReadSub(const unsigned char *time) { + return NULL; // TODO +} + +char *CDRgetDriveLetter(void) { + return cdDevice; +} + +#endif diff --git a/macosx/plugins/DFCdrom/macsrc/cfg.c b/macosx/plugins/DFCdrom/macsrc/cfg.c new file mode 100644 index 00000000..6b5c1513 --- /dev/null +++ b/macosx/plugins/DFCdrom/macsrc/cfg.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010, Wei Mingzhi . + * All Rights Reserved. + * + * Based on: Cdrom for Psemu Pro like Emulators + * By: linuzappz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "cdr.h" + +void AboutDlgProc(); +void ConfDlgProc(); +void ReadConfig(); + +char CdromDev[256]; +long ReadMode; +long UseSubQ; +long CacheSize; +long CdrSpeed; +long SpinDown; + +void LoadConf() { + strcpy(CdromDev, ""); + ReadMode = THREADED; + UseSubQ = 0; + CacheSize = 64; + CdrSpeed = 0; + SpinDown = SPINDOWN_VENDOR_SPECIFIC; + + ReadConfig(); +} + +long CDRconfigure() { + ConfDlgProc(); + return 0; +} + +void CDRabout() { + AboutDlgProc(); +} \ No newline at end of file diff --git a/macosx/plugins/DFCdrom/version.plist b/macosx/plugins/DFCdrom/version.plist new file mode 100644 index 00000000..a9c51a62 --- /dev/null +++ b/macosx/plugins/DFCdrom/version.plist @@ -0,0 +1,16 @@ + + + + + BuildVersion + 38 + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + ProjectName + DFCdrom + SourceVersion + 2350000 + + -- cgit v1.2.3