diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-06-06 16:25:30 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-06-06 16:25:30 +0000 |
| commit | 99d48611d9604491cc2e95380a2b13e00db4d4b5 (patch) | |
| tree | ac5ac337cce20302a0226742ec565bc2787c4ee2 | |
| parent | b8990e60c03f545bac3ada06e4034a5508faf337 (diff) | |
| download | pcsxr-99d48611d9604491cc2e95380a2b13e00db4d4b5.tar.gz | |
OS X: Begin working on a metadata importer for the memory cards.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@90602 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | macosx/Pcsxr-QL/Pcsxr-QL-Info.plist | 2 | ||||
| -rw-r--r-- | macosx/Pcsxr.xcodeproj/project.pbxproj | 205 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/GetMetadataForFile.h | 18 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/GetMetadataForFile.m | 34 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/Psx-Memcard-Info.plist | 86 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/Psx-Memcard-Prefix.pch | 11 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/en.lproj/InfoPlist.strings | 2 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/en.lproj/schema.strings | 20 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/main.c | 195 | ||||
| -rw-r--r-- | macosx/Psx-Memcard/schema.xml | 60 |
10 files changed, 632 insertions, 1 deletions
diff --git a/macosx/Pcsxr-QL/Pcsxr-QL-Info.plist b/macosx/Pcsxr-QL/Pcsxr-QL-Info.plist index 3646ec14..11614251 100644 --- a/macosx/Pcsxr-QL/Pcsxr-QL-Info.plist +++ b/macosx/Pcsxr-QL/Pcsxr-QL-Info.plist @@ -20,7 +20,7 @@ <key>CFBundleIconFile</key> <string></string> <key>CFBundleIdentifier</key> - <string>com.github.maddthesane.${PRODUCT_NAME:rfc1034identifier}</string> + <string>net.pcsxr.${PRODUCT_NAME:rfc1034identifier}</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj index da80ffb4..2f7413f4 100644 --- a/macosx/Pcsxr.xcodeproj/project.pbxproj +++ b/macosx/Pcsxr.xcodeproj/project.pbxproj @@ -170,6 +170,15 @@ 551A779E17869FC70052D185 /* libSPUSharedCode.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 551A76E71786971B0052D185 /* libSPUSharedCode.dylib */; }; 551A77A017869FED0052D185 /* libSPUSharedCode.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 551A76E71786971B0052D185 /* libSPUSharedCode.dylib */; }; 551A77E71786A4DD0052D185 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551A76AC178693C60052D185 /* Carbon.framework */; }; + 5525BC5E19421A760018AF2F /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551A76AF178693D60052D185 /* CoreServices.framework */; }; + 5525BC5F19421A760018AF2F /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551A76B2178693EA0052D185 /* CoreFoundation.framework */; }; + 5525BC6019421A760018AF2F /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551A74A217868B110052D185 /* CoreData.framework */; }; + 5525BC6119421A760018AF2F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551A74A317868B110052D185 /* Foundation.framework */; }; + 5525BC6719421A760018AF2F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5525BC6519421A760018AF2F /* InfoPlist.strings */; }; + 5525BC6919421A760018AF2F /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 5525BC6819421A760018AF2F /* main.c */; }; + 5525BC6B19421A760018AF2F /* GetMetadataForFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 5525BC6A19421A760018AF2F /* GetMetadataForFile.m */; }; + 5525BC7819421D4F0018AF2F /* schema.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5525BC7719421D4F0018AF2F /* schema.xml */; }; + 5525BC7C194221EC0018AF2F /* schema.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5525BC7E194221EC0018AF2F /* schema.strings */; }; 55268A5A1876244E00A82269 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 551A74A317868B110052D185 /* Foundation.framework */; }; 5529EA11169CBE3400BAA2A5 /* RecentItemsMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 5550D2721683C923006C56B5 /* RecentItemsMenu.m */; }; 553FECEE18DF5A8300C7B007 /* AddPluginSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 553FECB818DF5A8300C7B007 /* AddPluginSheet.xib */; }; @@ -337,6 +346,13 @@ remoteGlobalIDString = 551A776517869E430052D185; remoteInfo = DFNet; }; + 5525BC7519421A810018AF2F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5525BC5C19421A750018AF2F; + remoteInfo = "Psx-Memcard"; + }; 55534AFF18183E5B006D6BCB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; @@ -647,6 +663,15 @@ 551A777317869E830052D185 /* dfnet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dfnet.c; sourceTree = "<group>"; }; 551A777417869E830052D185 /* dfnet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = dfnet.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 551A777817869E830052D185 /* unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unix.c; sourceTree = "<group>"; }; + 5525BC5D19421A750018AF2F /* Psx-Memcard.mdimporter */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Psx-Memcard.mdimporter"; sourceTree = BUILT_PRODUCTS_DIR; }; + 5525BC6419421A760018AF2F /* Psx-Memcard-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Psx-Memcard-Info.plist"; sourceTree = "<group>"; }; + 5525BC6619421A760018AF2F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 5525BC6819421A760018AF2F /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; }; + 5525BC6A19421A760018AF2F /* GetMetadataForFile.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GetMetadataForFile.m; sourceTree = "<group>"; }; + 5525BC7019421A760018AF2F /* Psx-Memcard-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Psx-Memcard-Prefix.pch"; sourceTree = "<group>"; }; + 5525BC7719421D4F0018AF2F /* schema.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = schema.xml; sourceTree = "<group>"; }; + 5525BC7B19421DDC0018AF2F /* GetMetadataForFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GetMetadataForFile.h; sourceTree = "<group>"; }; + 5525BC7D194221EC0018AF2F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/schema.strings; sourceTree = "<group>"; }; 5539965D178BB1B100859644 /* OSXPlugLocalization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSXPlugLocalization.h; sourceTree = "<group>"; }; 553FECB918DF5A8300C7B007 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AddPluginSheet.xib; sourceTree = "<group>"; }; 553FECBD18DF5A8300C7B007 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Configuration.xib; sourceTree = "<group>"; }; @@ -967,6 +992,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5525BC5A19421A750018AF2F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5525BC5F19421A760018AF2F /* CoreFoundation.framework in Frameworks */, + 5525BC6019421A760018AF2F /* CoreData.framework in Frameworks */, + 5525BC5E19421A760018AF2F /* CoreServices.framework in Frameworks */, + 5525BC6119421A760018AF2F /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 55534AED18183BFA006D6BCB /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -987,6 +1023,7 @@ 551A74AF17868BE90052D185 /* plugins */, 55534AF318183BFA006D6BCB /* updateInfoPlist */, 550E343D18E6293D00A1AD21 /* Pcsxr-QL */, + 5525BC6219421A760018AF2F /* Psx-Memcard */, 551A749D17868B110052D185 /* Frameworks */, 1AB674ADFE9D54B511CA2CBB /* Products */, ); @@ -1019,6 +1056,7 @@ 551A776D17869E430052D185 /* DFNet.psxplugin */, 55534AF018183BFA006D6BCB /* updateInfoPlist */, 550E343718E6293D00A1AD21 /* Pcsxr-QL.qlgenerator */, + 5525BC5D19421A750018AF2F /* Psx-Memcard.mdimporter */, ); name = Products; sourceTree = "<group>"; @@ -1624,6 +1662,29 @@ path = ../../../plugins/dfnet; sourceTree = "<group>"; }; + 5525BC6219421A760018AF2F /* Psx-Memcard */ = { + isa = PBXGroup; + children = ( + 5525BC7B19421DDC0018AF2F /* GetMetadataForFile.h */, + 5525BC6A19421A760018AF2F /* GetMetadataForFile.m */, + 5525BC6319421A760018AF2F /* Supporting Files */, + ); + path = "Psx-Memcard"; + sourceTree = "<group>"; + }; + 5525BC6319421A760018AF2F /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 5525BC7E194221EC0018AF2F /* schema.strings */, + 5525BC7719421D4F0018AF2F /* schema.xml */, + 5525BC6419421A760018AF2F /* Psx-Memcard-Info.plist */, + 5525BC6519421A760018AF2F /* InfoPlist.strings */, + 5525BC6819421A760018AF2F /* main.c */, + 5525BC7019421A760018AF2F /* Psx-Memcard-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = "<group>"; + }; 55534AF318183BFA006D6BCB /* updateInfoPlist */ = { isa = PBXGroup; children = ( @@ -1776,6 +1837,7 @@ 2BB3D6D005427FE200831ACB /* PBXBuildRule */, ); dependencies = ( + 5525BC7619421A810018AF2F /* PBXTargetDependency */, 55534B0018183E5B006D6BCB /* PBXTargetDependency */, 551A778517869F4B0052D185 /* PBXTargetDependency */, 551A778717869F4B0052D185 /* PBXTargetDependency */, @@ -1970,6 +2032,23 @@ productReference = 551A776D17869E430052D185 /* DFNet.psxplugin */; productType = "com.apple.product-type.bundle"; }; + 5525BC5C19421A750018AF2F /* Psx-Memcard */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5525BC7119421A760018AF2F /* Build configuration list for PBXNativeTarget "Psx-Memcard" */; + buildPhases = ( + 5525BC5919421A750018AF2F /* Sources */, + 5525BC5A19421A750018AF2F /* Frameworks */, + 5525BC5B19421A750018AF2F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Psx-Memcard"; + productName = "Psx-Memcard"; + productReference = 5525BC5D19421A750018AF2F /* Psx-Memcard.mdimporter */; + productType = "com.apple.product-type.bundle"; + }; 55534AEF18183BFA006D6BCB /* updateInfoPlist */ = { isa = PBXNativeTarget; buildConfigurationList = 55534AFD18183BFB006D6BCB /* Build configuration list for PBXNativeTarget "updateInfoPlist" */; @@ -2032,6 +2111,7 @@ 551A776517869E430052D185 /* DFNet */, 551A75C617868C4E0052D185 /* Bladesio1 */, 550E343618E6293D00A1AD21 /* Pcsxr-QL */, + 5525BC5C19421A750018AF2F /* Psx-Memcard */, 55534AEF18183BFA006D6BCB /* updateInfoPlist */, ); }; @@ -2156,6 +2236,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5525BC5B19421A750018AF2F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5525BC7819421D4F0018AF2F /* schema.xml in Resources */, + 5525BC7C194221EC0018AF2F /* schema.strings in Resources */, + 5525BC6719421A760018AF2F /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXRezBuildPhase section */ @@ -2409,6 +2499,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5525BC5919421A750018AF2F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5525BC6919421A760018AF2F /* main.c in Sources */, + 5525BC6B19421A760018AF2F /* GetMetadataForFile.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 55534AEC18183BFA006D6BCB /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2475,6 +2574,11 @@ target = 551A776517869E430052D185 /* DFNet */; targetProxy = 551A779217869F4B0052D185 /* PBXContainerItemProxy */; }; + 5525BC7619421A810018AF2F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5525BC5C19421A750018AF2F /* Psx-Memcard */; + targetProxy = 5525BC7519421A810018AF2F /* PBXContainerItemProxy */; + }; 55534B0018183E5B006D6BCB /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 55534AEF18183BFA006D6BCB /* updateInfoPlist */; @@ -2785,6 +2889,22 @@ name = NetSfPeopsOpenGLConfig.xib; sourceTree = "<group>"; }; + 5525BC6519421A760018AF2F /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 5525BC6619421A760018AF2F /* en */, + ); + name = InfoPlist.strings; + sourceTree = "<group>"; + }; + 5525BC7E194221EC0018AF2F /* schema.strings */ = { + isa = PBXVariantGroup; + children = ( + 5525BC7D194221EC0018AF2F /* en */, + ); + name = schema.strings; + sourceTree = "<group>"; + }; 553FECB818DF5A8300C7B007 /* AddPluginSheet.xib */ = { isa = PBXVariantGroup; children = ( @@ -3301,6 +3421,81 @@ }; name = Release; }; + 5525BC7219421A760018AF2F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Psx-Memcard/Psx-Memcard-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + INFOPLIST_FILE = "Psx-Memcard/Psx-Memcard-Info.plist"; + INSTALL_PATH = "@executable_path/../Contents/Library/Spotlight"; + LIBRARY_STYLE = BUNDLE; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = mdimporter; + }; + name = Debug; + }; + 5525BC7319421A760018AF2F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Psx-Memcard/Psx-Memcard-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + INFOPLIST_FILE = "Psx-Memcard/Psx-Memcard-Info.plist"; + INSTALL_PATH = "@executable_path/../Contents/Library/Spotlight"; + LIBRARY_STYLE = BUNDLE; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = mdimporter; + }; + name = Release; + }; + 5525BC7419421A760018AF2F /* Instrument */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Psx-Memcard/Psx-Memcard-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + INFOPLIST_FILE = "Psx-Memcard/Psx-Memcard-Info.plist"; + INSTALL_PATH = "@executable_path/../Contents/Library/Spotlight"; + LIBRARY_STYLE = BUNDLE; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = mdimporter; + }; + name = Instrument; + }; 55534AFA18183BFB006D6BCB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3689,6 +3884,7 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_NS_ASSERTIONS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -3807,6 +4003,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 5525BC7119421A760018AF2F /* Build configuration list for PBXNativeTarget "Psx-Memcard" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5525BC7219421A760018AF2F /* Debug */, + 5525BC7319421A760018AF2F /* Release */, + 5525BC7419421A760018AF2F /* Instrument */, + ); + defaultConfigurationIsVisible = 0; + }; 55534AFD18183BFB006D6BCB /* Build configuration list for PBXNativeTarget "updateInfoPlist" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/macosx/Psx-Memcard/GetMetadataForFile.h b/macosx/Psx-Memcard/GetMetadataForFile.h new file mode 100644 index 00000000..1d876978 --- /dev/null +++ b/macosx/Psx-Memcard/GetMetadataForFile.h @@ -0,0 +1,18 @@ +// +// GetMetadataForFile.h +// Pcsxr +// +// Created by C.W. Betts on 6/6/14. +// +// + +#ifndef Pcsxr_GetMetadataForFile_h +#define Pcsxr_GetMetadataForFile_h + +#include <CoreFoundation/CoreFoundation.h> + +#define __private_extern __attribute__((visibility("hidden"))) + +__private_extern Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile); + +#endif diff --git a/macosx/Psx-Memcard/GetMetadataForFile.m b/macosx/Psx-Memcard/GetMetadataForFile.m new file mode 100644 index 00000000..731cd928 --- /dev/null +++ b/macosx/Psx-Memcard/GetMetadataForFile.m @@ -0,0 +1,34 @@ +// +// GetMetadataForFile.m +// Psx-Memcard +// +// Created by C.W. Betts on 6/6/14. +// +// + +#include <CoreFoundation/CoreFoundation.h> +#import <Foundation/Foundation.h> +#include "GetMetadataForFile.h" + +//============================================================================== +// +// Get metadata attributes from document files +// +// The purpose of this function is to extract useful information from the +// file formats for your document, and set the values into the attribute +// dictionary for Spotlight to include. +// +//============================================================================== + +Boolean GetMetadataForFile(void *thisInterface, CFMutableDictionaryRef attributes, CFStringRef contentTypeUTI, CFStringRef pathToFile) +{ + Boolean ok = FALSE; + @autoreleasepool { + NSMutableDictionary *attr = (__bridge NSMutableDictionary*)attributes; + NSString *path = (__bridge NSString*)pathToFile; + + } + + // Return the status + return ok; +} diff --git a/macosx/Psx-Memcard/Psx-Memcard-Info.plist b/macosx/Psx-Memcard/Psx-Memcard-Info.plist new file mode 100644 index 00000000..73f47645 --- /dev/null +++ b/macosx/Psx-Memcard/Psx-Memcard-Info.plist @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeRole</key> + <string>MDImporter</string> + <key>LSItemContentTypes</key> + <array> + <string>com.codeplex.pcsxr.memcard</string> + </array> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>net.pcsxr.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>CFPlugInDynamicRegisterFunction</key> + <string></string> + <key>CFPlugInDynamicRegistration</key> + <false/> + <key>CFPlugInFactories</key> + <dict> + <key>E6CB501C-9D5C-4CAF-A9DA-A6940F261514</key> + <string>MetadataImporterPluginFactory</string> + </dict> + <key>CFPlugInTypes</key> + <dict> + <key>8B08C4BF-415B-11D8-B3F9-0003936726FC</key> + <array> + <string>E6CB501C-9D5C-4CAF-A9DA-A6940F261514</string> + </array> + </dict> + <key>CFPlugInUnloadFunction</key> + <string></string> + <key>LSMinimumSystemVersion</key> + <string>${MACOSX_DEPLOYMENT_TARGET}</string> + <key>UTImportedTypeDeclarations</key> + <array> + <dict> + <key>UTTypeConformsTo</key> + <array> + <string>public.data</string> + <string>public.content</string> + </array> + <key>UTTypeDescription</key> + <string>PCSXR Memory Card</string> + <key>UTTypeIconFile</key> + <string>pcsxrmemcard</string> + <key>UTTypeIdentifier</key> + <string>com.codeplex.pcsxr.memcard</string> + <key>UTTypeReferenceURL</key> + <string>http://pcsxr.codeplex.com/</string> + <key>UTTypeTagSpecification</key> + <dict> + <key>com.apple.ostype</key> + <array> + <string>Pmcr</string> + </array> + <key>public.filename-extension</key> + <array> + <string>mcr</string> + <string>mc</string> + <string>mem</string> + <string>vgs</string> + <string>mcd</string> + <string>gme</string> + <string>ddf</string> + </array> + </dict> + </dict> + </array> +</dict> +</plist> diff --git a/macosx/Psx-Memcard/Psx-Memcard-Prefix.pch b/macosx/Psx-Memcard/Psx-Memcard-Prefix.pch new file mode 100644 index 00000000..90d8f859 --- /dev/null +++ b/macosx/Psx-Memcard/Psx-Memcard-Prefix.pch @@ -0,0 +1,11 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#include <CoreFoundation/CoreFoundation.h> + +#ifdef __OBJC__ + #import <Foundation/Foundation.h> +#endif diff --git a/macosx/Psx-Memcard/en.lproj/InfoPlist.strings b/macosx/Psx-Memcard/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..477b28ff --- /dev/null +++ b/macosx/Psx-Memcard/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/macosx/Psx-Memcard/en.lproj/schema.strings b/macosx/Psx-Memcard/en.lproj/schema.strings new file mode 100644 index 00000000..b0dfaeab --- /dev/null +++ b/macosx/Psx-Memcard/en.lproj/schema.strings @@ -0,0 +1,20 @@ +/* ---------- + + + This file is only needed if you are defining a custom importer attribute. + Most importer plugins will not need to do this. + Add this file to your project's localized resources if you have defined a custom attribute. + + + ----------*/ + + +/* Localized DisplayNames for your custom metadata attributes */ +/* The form is: "myMetadataKey" = "My Metadata Key"; */ +/* The name on the left is the name defined in schema.xml */ +/* The name on the right is what the user will see */ + +/* Localized Description of you custom metadata attributes */ +/* The form is: "myMetadataKey.Description" = "stuff"; +/* com_Foo_YourAttrName should be definded in the schema.xml file */ +/* The value on the right will be displayed by the Finder etc.. */ diff --git a/macosx/Psx-Memcard/main.c b/macosx/Psx-Memcard/main.c new file mode 100644 index 00000000..df328ebb --- /dev/null +++ b/macosx/Psx-Memcard/main.c @@ -0,0 +1,195 @@ +// +// main.c +// Psx-Memcard +// +// Created by C.W. Betts on 6/6/14. +// +// + +#include <CoreFoundation/CoreFoundation.h> +#include <CoreFoundation/CFPlugInCOM.h> +#include <CoreServices/CoreServices.h> +#include "GetMetadataForFile.h" + +// ----------------------------------------------------------------------------- +// constants +// ----------------------------------------------------------------------------- + + +#define PLUGIN_ID "E6CB501C-9D5C-4CAF-A9DA-A6940F261514" + +// +// Below is the generic glue code for all plug-ins. +// +// You should not have to modify this code aside from changing +// names if you decide to change the names defined in the Info.plist +// + + +// ----------------------------------------------------------------------------- +// typedefs +// ----------------------------------------------------------------------------- + +// The layout for an instance of MetaDataImporterPlugIn +typedef struct __MetadataImporterPluginType +{ + MDImporterInterfaceStruct *conduitInterface; + CFUUIDRef factoryID; + UInt32 refCount; +} MDImporterType; + +// ----------------------------------------------------------------------------- +// prototypes +// ----------------------------------------------------------------------------- +// Forward declaration for the IUnknown implementation. +// + +static MDImporterType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID); +static void DeallocMetadataImporterPluginType(MDImporterType *thisInstance); +static HRESULT MetadataImporterQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv); +extern void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID); +static ULONG MetadataImporterPluginAddRef(void *thisInstance); +static ULONG MetadataImporterPluginRelease(void *thisInstance); +// ----------------------------------------------------------------------------- +// testInterfaceFtbl definition +// ----------------------------------------------------------------------------- +// The TestInterface function table. +// + +static MDImporterInterfaceStruct testInterfaceFtbl = { + NULL, + MetadataImporterQueryInterface, + MetadataImporterPluginAddRef, + MetadataImporterPluginRelease, + GetMetadataForFile +}; + + +// ----------------------------------------------------------------------------- +// AllocMetadataImporterPluginType +// ----------------------------------------------------------------------------- +// Utility function that allocates a new instance. +// You can do some initial setup for the importer here if you wish +// like allocating globals etc... +// +MDImporterType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID) +{ + MDImporterType *theNewInstance; + + theNewInstance = (MDImporterType *)calloc(sizeof(MDImporterType), 1); + + /* Point to the function table */ + theNewInstance->conduitInterface = &testInterfaceFtbl; + + /* Retain and keep an open instance refcount for each factory. */ + theNewInstance->factoryID = CFRetain(inFactoryID); + CFPlugInAddInstanceForFactory(inFactoryID); + + /* This function returns the IUnknown interface so set the refCount to one. */ + theNewInstance->refCount = 1; + return theNewInstance; +} + +// ----------------------------------------------------------------------------- +// DeallocPsx_MemcardMDImporterPluginType +// ----------------------------------------------------------------------------- +// Utility function that deallocates the instance when +// the refCount goes to zero. +// In the current implementation importer interfaces are never deallocated +// but implement this as this might change in the future +// +void DeallocMetadataImporterPluginType(MDImporterType *thisInstance) +{ + CFUUIDRef theFactoryID = thisInstance->factoryID; + + free(thisInstance); + if (theFactoryID){ + CFPlugInRemoveInstanceForFactory(theFactoryID); + CFRelease(theFactoryID); + } +} + +// ----------------------------------------------------------------------------- +// MetadataImporterQueryInterface +// ----------------------------------------------------------------------------- +// Implementation of the IUnknown QueryInterface function. +// +HRESULT MetadataImporterQueryInterface(void *thisInstance, REFIID iid, LPVOID *ppv) +{ + CFUUIDRef interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, iid); + + if (CFEqual(interfaceID,kMDImporterInterfaceID)){ + /* If the Right interface was requested, bump the ref count, + * set the ppv parameter equal to the instance, and + * return good status. + */ + ((MDImporterType*)thisInstance)->conduitInterface->AddRef(thisInstance); + *ppv = thisInstance; + CFRelease(interfaceID); + return S_OK; + } else if (CFEqual(interfaceID,IUnknownUUID)){ + /* If the IUnknown interface was requested, same as above. */ + ((MDImporterType*)thisInstance )->conduitInterface->AddRef(thisInstance); + *ppv = thisInstance; + CFRelease(interfaceID); + return S_OK; + } else { + /* Requested interface unknown, bail with error. */ + *ppv = NULL; + CFRelease(interfaceID); + return E_NOINTERFACE; + } +} + +// ----------------------------------------------------------------------------- +// MetadataImporterPluginAddRef +// ----------------------------------------------------------------------------- +// Implementation of reference counting for this type. Whenever an interface +// is requested, bump the refCount for the instance. NOTE: returning the +// refcount is a convention but is not required so don't rely on it. +// +ULONG MetadataImporterPluginAddRef(void *thisInstance) +{ + return ++((MDImporterType*) thisInstance)->refCount; +} + +// ----------------------------------------------------------------------------- +// SampleCMPluginRelease +// ----------------------------------------------------------------------------- +// When an interface is released, decrement the refCount. +// If the refCount goes to zero, deallocate the instance. +// +ULONG MetadataImporterPluginRelease(void *thisInstance) +{ + ((MDImporterType*)thisInstance)->refCount -= 1; + if (((MDImporterType*)thisInstance)->refCount == 0){ + DeallocMetadataImporterPluginType((MDImporterType*)thisInstance); + return 0; + }else{ + return ((MDImporterType*) thisInstance )->refCount; + } +} + +// ----------------------------------------------------------------------------- +// Psx_MemcardMDImporterPluginFactory +// ----------------------------------------------------------------------------- +// Implementation of the factory function for this type. +// +void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID) +{ + MDImporterType *result; + CFUUIDRef uuid; + + /* If correct type is being requested, allocate an + * instance of TestType and return the IUnknown interface. + */ + if (CFEqual(typeID,kMDImporterTypeID)){ + uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID)); + result = AllocMetadataImporterPluginType(uuid); + CFRelease(uuid); + return result; + } + /* If the requested type is incorrect, return NULL. */ + return NULL; +} + diff --git a/macosx/Psx-Memcard/schema.xml b/macosx/Psx-Memcard/schema.xml new file mode 100644 index 00000000..4e072263 --- /dev/null +++ b/macosx/Psx-Memcard/schema.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<schema version="1.0" xmlns="http://www.apple.com/metadata" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apple.com/metadata file:///System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/MetadataSchema.xsd"> + <!-- + The 'attributes' section defines custom attributes that this metadata importer supports. + Below is an example of a multivalued string attribute. Uncomment this part + of the file if you need to define a custom attribute. + + 'multivalued' indicates whether the attribute is an array type or not. + + 'type' indicates the data type of the attribute. + Available types are CFString, CFNumber, CFDate, CFBoolean and CFData. + + If you don't need to define a custom attribute, it is safe to remove this section. + + <attributes> + <attribute name="com_Foo_YourAttrName" multivalued="true" type="CFString"/> + </attributes> + + + To see the system's definitions for the builtin attributes and file types, look at the system schema, + /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/schema.xml + --> + + <attributes> + <!-- + <attribute name="net_sourceforge_playerpro_tracker_instumentlist" multivalued="true" type="CFString"/> + <attribute name="net_sourceforge_playerpro_tracker_patternlist" multivalued="true" type="CFString"/> + <attribute name="net_sourceforge_playerpro_tracker_totalpatterns" multivalued="false" nosearch="true" type="CFNumber"/> + <attribute name="net_sourceforge_playerpro_tracker_partitionlength" multivalued="false" nosearch="true" type="CFNumber"/> + <attribute name="net_sourceforge_playerpro_tracker_totalinstruments" multivalued="false" nosearch="true" type="CFNumber"/> + <attribute name="net_sourceforge_playerpro_tracker_totaltracks" multivalued="false" nosearch="true" type="CFNumber"/> + <attribute name="net_sourceforge_playerpro_tracker_formatdescription" multivalued="false" nosearch="true" type="CFString"/> + <attribute name="net_sourceforge_playerpro_tracker_madkinfo" multivalued="false" type="CFString" /> + --> + </attributes> + + <types> + <type name="com.codeplex.pcsxr.memcard"> <!-- add one <type>...</type> entry for each UTI that you need to define.--> + + <!-- 'allattrs' is a whitespace separated list of all of the attributes that this UTI type normally has. + It does not have to be exhaustive. --> + <allattrs> + kMDItemTitle + kMDItemDurationSeconds + kMDItemCodecs + </allattrs> + <!-- 'displayattrs' is a whitespace separated list of the attributes that should normally be displayed when previewing files of this UTI type. --> + <displayattrs> + kMDItemTitle + kMDItemDurationSeconds + kMDItemCodecs + </displayattrs> + </type> + + </types> +</schema> + |
