diff --git a/Audio/CogAudio.xcodeproj/project.pbxproj b/Audio/CogAudio.xcodeproj/project.pbxproj index 2b9e4dc8e..8ace03c7f 100644 --- a/Audio/CogAudio.xcodeproj/project.pbxproj +++ b/Audio/CogAudio.xcodeproj/project.pbxproj @@ -44,6 +44,8 @@ 17F94DD60B8D0F7000A34E87 /* PluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F94DD40B8D0F7000A34E87 /* PluginController.m */; }; 17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DDC0B8D101100A34E87 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; 832BEF04278DD06D005E1BC4 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 832BEF03278DD06D005E1BC4 /* AVFoundation.framework */; }; + 8347C7412796C58800FA8A7D /* NSFileHandle+CreateFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 8347C73F2796C58800FA8A7D /* NSFileHandle+CreateFile.h */; }; + 8347C7422796C58800FA8A7D /* NSFileHandle+CreateFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8347C7402796C58800FA8A7D /* NSFileHandle+CreateFile.m */; }; 8384912718080FF100E7332D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384912618080FF100E7332D /* Logging.h */; }; 8389F270278E64590074164C /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8389F225278E64590074164C /* config.h */; }; 8389F279278E64590074164C /* utf.h in Headers */ = {isa = PBXBuildFile; fileRef = 8389F236278E64590074164C /* utf.h */; }; @@ -152,6 +154,8 @@ 17F94DDC0B8D101100A34E87 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; }; 32DBCF5E0370ADEE00C91783 /* CogAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CogAudio_Prefix.pch; sourceTree = ""; }; 832BEF03278DD06D005E1BC4 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 8347C73F2796C58800FA8A7D /* NSFileHandle+CreateFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSFileHandle+CreateFile.h"; path = "../../Utils/NSFileHandle+CreateFile.h"; sourceTree = ""; }; + 8347C7402796C58800FA8A7D /* NSFileHandle+CreateFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSFileHandle+CreateFile.m"; path = "../../Utils/NSFileHandle+CreateFile.m"; sourceTree = ""; }; 8384912618080FF100E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = ""; }; 8389F225278E64590074164C /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; 8389F228278E64590074164C /* encoding_utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = encoding_utf.c; sourceTree = ""; }; @@ -378,6 +382,8 @@ 17D21CDC0B8BE5B400D1EBDE /* Utils */ = { isa = PBXGroup; children = ( + 8347C73F2796C58800FA8A7D /* NSFileHandle+CreateFile.h */, + 8347C7402796C58800FA8A7D /* NSFileHandle+CreateFile.m */, 8384912618080FF100E7332D /* Logging.h */, 17D21CF10B8BE5EF00D1EBDE /* Semaphore.h */, 17D21CF20B8BE5EF00D1EBDE /* Semaphore.m */, @@ -742,6 +748,7 @@ 8389F27D278E64590074164C /* strl.h in Headers */, 8389F281278E64590074164C /* msvc.h in Headers */, 8389F2A3278E646E0074164C /* lpc.h in Headers */, + 8347C7412796C58800FA8A7D /* NSFileHandle+CreateFile.h in Headers */, 8389F290278E64590074164C /* boolean.h in Headers */, 8389F295278E64590074164C /* retro_assert.h in Headers */, 8389F28A278E64590074164C /* retro_inline.h in Headers */, @@ -849,6 +856,7 @@ 8389F29B278E64590074164C /* sinc_resampler.c in Sources */, 8389F299278E64590074164C /* memalign.c in Sources */, 17D21CF40B8BE5EF00D1EBDE /* Semaphore.m in Sources */, + 8347C7422796C58800FA8A7D /* NSFileHandle+CreateFile.m in Sources */, 17D21DC80B8BE79700D1EBDE /* CoreAudioUtils.m in Sources */, 839366681815923C006DD712 /* CogPluginMulti.m in Sources */, 17D21EBE0B8BF44000D1EBDE /* AudioPlayer.m in Sources */, diff --git a/Audio/Plugin.h b/Audio/Plugin.h index a4e003251..2054224d8 100644 --- a/Audio/Plugin.h +++ b/Audio/Plugin.h @@ -31,6 +31,7 @@ @required + (NSArray *)mimeTypes; + (NSArray *)fileTypes; //mp3, ogg, etc ++ (NSArray *)fileTypeAssociations; // array of NSArray of NSString, where first item in array is the type name, the second is the icon name, and the rest are the extensions + (float)priority; // should be 0.0 ... 1.0, higher means you get selected first, should default to 1.0 unless you know a reason why any of your extensions may behave badly, ie. greedily taking over some file type extension without performing any header validation on it //For KVO diff --git a/Audio/PluginController.m b/Audio/PluginController.m index 96460eafb..12c6d051c 100644 --- a/Audio/PluginController.m +++ b/Audio/PluginController.m @@ -4,6 +4,8 @@ #import "Logging.h" +#import "NSFileHandle+CreateFile.h" + @implementation PluginController @synthesize sources; @@ -262,6 +264,146 @@ static PluginController *sharedPluginController = nil; ALog(@"Decoders by Extension: %@", self.decodersByExtension); ALog(@"Decoders by Mime Type: %@", self.decodersByMimeType); + +#if 0 + // XXX Keep in sync with Info.plist on disk! + NSString * plistHeader = @"\n\ +\n\ +\n\ +\n\ +\tCFBundleDevelopmentRegion\n\ +\tEnglish\n\ +\tCFBundleDocumentTypes\n\ +\t\n\ +\t\t\n\ +\t\t\tCFBundleTypeExtensions\n\ +\t\t\t\n\ +\t\t\t\t*\n\ +\t\t\t\n\ +\t\t\tCFBundleTypeIconFile\n\ +\t\t\tsong.icns\n\ +\t\t\tCFBundleTypeOSTypes\n\ +\t\t\t\n\ +\t\t\t\t****\n\ +\t\t\t\tfold\n\ +\t\t\t\tdisk\n\ +\t\t\t\n\ +\t\t\tCFBundleTypeRole\n\ +\t\t\tNone\n\ +\t\t\n"; + NSString * plistFooter = @"\t\n\ +\tCFBundleExecutable\n\ +\tCog\n\ +\tCFBundleHelpBookFolder\n\ +\tCog.help\n\ +\tCFBundleHelpBookName\n\ +\torg.cogx.cog.help\n\ +\tCFBundleIdentifier\n\ +\t$(PRODUCT_BUNDLE_IDENTIFIER)\n\ +\tCFBundleInfoDictionaryVersion\n\ +\t6.0\n\ +\tCFBundlePackageType\n\ +\tAPPL\n\ +\tCFBundleShortVersionString\n\ +\t0.08\n\ +\tCFBundleSignature\n\ +\t????\n\ +\tCFBundleVersion\n\ +\tr516\n\ +\tLSApplicationCategoryType\n\ +\tpublic.app-category.music\n\ +\tLSMinimumSystemVersion\n\ +\t$(MACOSX_DEPLOYMENT_TARGET)\n\ +\tNSAppTransportSecurity\n\ +\t\n\ +\t\tNSAllowsArbitraryLoads\n\ +\t\t\n\ +\t\n\ +\tNSAppleScriptEnabled\n\ +\tYES\n\ +\tNSCalendarsUsageDescription\n\ +\tCog has no use for your calendar information. Why are you trying to open your Calendar with an audio player?\n\ +\tNSCameraUsageDescription\n\ +\tCog is an audio player. It will never use your camera. Why is it asking for permission to use your camera?\n\ +\tNSContactsUsageDescription\n\ +\tCog has no use for your contacts information. Why are you trying to open your contacts with an audio player?\n\ +\tNSLocationUsageDescription\n\ +\tCog has no use for your location information. Something is obviously wrong with the application.\n\ +\tNSMainNibFile\n\ +\tMainMenu\n\ +\tNSMicrophoneUsageDescription\n\ +\tCog is an audio player. It does not, however, record audio. Why is it asking for permission to use your microphone?\n\ +\tNSPhotoLibraryUsageDescription\n\ +\tCog is an audio player. Why are you trying to access your Photos Library with an audio player?\n\ +\tNSPrincipalClass\n\ +\tMediaKeysApplication\n\ +\tNSRemindersUsageDescription\n\ +\tCog has no use for your reminders. Why are you trying to access them with an audio player?\n\ +\tSUFeedURL\n\ +\thttps://cogcdn.cog.losno.co/mercury.xml\n\ +\tSUPublicEDKey\n\ +\tomxG7Rp0XK9/YEvKbVy7cd44eVAh1LJB6CmjQwjOJz4=\n\ +\n\ +\n"; + NSMutableArray * decodersRegistered = [[NSMutableArray alloc] init]; + + NSArray * allKeys = [self.decodersByExtension allKeys]; + for (NSString * ext in allKeys) { + NSArray * decoders = [self.decodersByExtension objectForKey:ext]; + for (NSString * decoder in decoders) { + if (![decodersRegistered containsObject:decoder]) { + [decodersRegistered addObject:decoder]; + } + } + } + + NSMutableArray * stringList = [[NSMutableArray alloc] init]; + + [stringList addObject:plistHeader]; + + for (NSString * decoderString in decodersRegistered) { + Class decoder = NSClassFromString(decoderString); + if (decoder && [decoder respondsToSelector:@selector(fileTypeAssociations)]) { + NSArray * types = [decoder fileTypeAssociations]; + for (NSArray * type in types) { + [stringList addObject:@"\t\t\n\ +\t\t\tCFBundleTypeExtensions\n\ +\t\t\t\n\ +"]; + for (size_t i = 2; i < [type count]; ++i) { + [stringList addObject:@"\t\t\t\t"]; + [stringList addObject:[[type objectAtIndex:i] lowercaseString]]; + [stringList addObject:@"\n"]; + } + [stringList addObject:@"\t\t\t\n\ +\t\t\tCFBundleTypeIconFile\n\ +\t\t\t"]; + [stringList addObject:[type objectAtIndex:1]]; + [stringList addObject:@"\n\ +\t\t\tCFBundleTypeName\n\ +\t\t\t"]; + [stringList addObject:[type objectAtIndex:0]]; + [stringList addObject:@"\n\ +\t\t\tCFBundleTypeRole\n\ +\t\t\tViewer\n\ +\t\t\tLSTypeIsPackage\n\ +\t\t\t\n\ +\t\t\n"]; + } + } + } + + [stringList addObject:plistFooter]; + + NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:@"/tmp/Cog_Info.plist" createFile:YES]; + if (!fileHandle) { + DLog(@"Error saving Info.plist!"); + return; + } + [fileHandle truncateFileAtOffset:0]; + [fileHandle writeData:[[stringList componentsJoinedByString:@""] dataUsingEncoding:NSUTF8StringEncoding]]; + [fileHandle closeFile]; +#endif } - (id) audioSourceForURL:(NSURL *)url diff --git a/Plugins/APL/APLDecoder.m b/Plugins/APL/APLDecoder.m index aa3346842..52e854430 100644 --- a/Plugins/APL/APLDecoder.m +++ b/Plugins/APL/APLDecoder.m @@ -17,6 +17,13 @@ return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"APL Link Files", @"song.icns", @"apl"] + ]; +} + - (NSDictionary *)properties { NSMutableDictionary *properties = [[decoder properties] mutableCopy]; @@ -118,4 +125,5 @@ } + @end diff --git a/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm b/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm index df0139c97..5d8c9bc63 100755 --- a/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm +++ b/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm @@ -206,4 +206,14 @@ static CAdPlugDatabase * g_database = NULL; return 0.5; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"AdPlug Files"]; + [ret addObject:@"vg.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + @end diff --git a/Plugins/CoreAudio/CoreAudioDecoder.m b/Plugins/CoreAudio/CoreAudioDecoder.m index 90c48c902..f77f6a6c8 100644 --- a/Plugins/CoreAudio/CoreAudioDecoder.m +++ b/Plugins/CoreAudio/CoreAudioDecoder.m @@ -318,6 +318,25 @@ static SInt64 getSizeProc(void* clientData) { return 1.5; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"WAVE Files", @"wav.icns", @"wav", @"w64"], + @[@"AIFF Files", @"aiff.icns", @"aif", @"aiff", @"aifc"], + @[@"CAF Files", @"song.icns", @"caf"], + @[@"AU Files", @"song.icns", @"au"], + @[@"MPEG Audio Files", @"mp3.icns", @"mp3", @"mp2", @"mp1", @"m2a", @"mpa"], + @[@"MPEG Stream Files", @"song.icns", @"mpeg"], + @[@"MPEG-4 Audio Files", @"m4a.icns", @"m4a", @"mp4", @"m4b", @"m4r"], + @[@"MPEG-4 AAC Audio Files", @"song.icns", @"aac", @"adts"], + @[@"AMR Audio Files", @"song.icns", @"amr"], + @[@"USAC Audio Files", @"song.icns", @"xhe"], + @[@"AC-3 Audio Files", @"song.icns", @"ac3"], + @[@"FLAC Audio Files", @"flac.icns", @"flac"], + @[@"SND Audio Files", @"song.icns", @"snd"] + ]; +} + - (NSDictionary *)properties { return [NSDictionary dictionaryWithObjectsAndKeys: diff --git a/Plugins/CueSheet/CueSheetDecoder.m b/Plugins/CueSheet/CueSheetDecoder.m index 325289720..c73aa466d 100644 --- a/Plugins/CueSheet/CueSheetDecoder.m +++ b/Plugins/CueSheet/CueSheetDecoder.m @@ -31,6 +31,13 @@ return 16.0f; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Cue Sheet Files", @"cue.icns", @"cue"] + ]; +} + - (NSDictionary *)properties { NSMutableDictionary *properties = [[decoder properties] mutableCopy]; diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 44666f46b..939a666da 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -594,6 +594,26 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op) return [NSArray arrayWithObjects:@"application/wma", @"application/x-wma", @"audio/x-wma", @"audio/x-ms-wma", @"audio/x-tak", @"application/ogg", @"audio/aacp", @"audio/mpeg", @"audio/mp4", @"audio/x-mp3", @"audio/x-mp2", @"audio/x-matroska", @"audio/x-ape", @"audio/x-ac3", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-at3", @"audio/wav", @"audio/tta", @"audio/x-tta", @"audio/x-twinvq", nil]; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Windows Media Audio Files", @"song.icns", @"wma", @"asf"], + @[@"TAK Audio Files", @"song.icns", @"tak"], + @[@"MPEG-4 Audio Files", @"m4a.icns", @"mp4", @"m4a"], + @[@"MPEG-4 AAC Audio Files", @"song.icns", @"aac"], + @[@"MPEG Audio Files", @"mp3.icns", @"mp3", @"m2a", @"mpa"], + @[@"Monkey's Audio Files", @"ape.icns", @"ape"], + @[@"AC-3 Audio Files", @"song.icns", @"ac3"], + @[@"DTS Audio Files", @"song.icns", @"dts"], + @[@"DTS-HD MA Audio Files", @"song.icns", @"dtshd"], + @[@"True Audio Files", @"song.icns", @"tta"], + @[@"TrueVQ Audio Files", @"song.icns", @"vqf", @"vqe", @"vql"], + @[@"Real Audio Files", @"song.icns", @"ra", @"rm", @"rmj"], + @[@"Matroska Audio Files", @"song.icns", @"mka"], + @[@"WebM Audio Files", @"song.icns", @"weba"] + ]; +} + + (float)priority { if (@available(macOS 10.15, *)) diff --git a/Plugins/Flac/FlacDecoder.m b/Plugins/Flac/FlacDecoder.m index 8f6ec1eb3..628fbd47e 100644 --- a/Plugins/Flac/FlacDecoder.m +++ b/Plugins/Flac/FlacDecoder.m @@ -366,4 +366,11 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS return 2.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"FLAC Audio Files", @"flac.icns", @"flac"] + ]; +} + @end diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index ab43219d8..723b67b99 100755 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -209,7 +209,7 @@ gme_err_t readCallback( void* data, void* out, long count ) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sfm", @"sgc", @"spc", @"vgm", @"vgz", nil]; + return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sfm", @"sgc", @"spc", nil]; } + (NSArray *)mimeTypes @@ -222,6 +222,17 @@ gme_err_t readCallback( void* data, void* out, long count ) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"Game Music Emu Files"]; + [ret addObject:@"vg.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + + - (void)setSource:(id)s { source = s; diff --git a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm index cdd0faa08..0bfbb9d65 100644 --- a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm +++ b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm @@ -1752,5 +1752,15 @@ static int usf_info(void * context, const char * name, const char * value) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"PSF Format Files"]; + [ret addObject:@"vg.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + @end diff --git a/Plugins/Hively/Hively/HVLDecoder.m b/Plugins/Hively/Hively/HVLDecoder.m index 252e2ecae..fde8a03af 100755 --- a/Plugins/Hively/Hively/HVLDecoder.m +++ b/Plugins/Hively/Hively/HVLDecoder.m @@ -194,6 +194,14 @@ static void oneTimeInit(void) return [NSArray arrayWithObjects:@"hvl", @"ahx", nil]; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Hively Tracker Files", @"song.icns", @"hvl"], + @[@"AHX Tracker Files", @"song.icns", @"ahx"] + ]; +} + + (NSArray *)mimeTypes { return nil; diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.mm b/Plugins/MIDI/MIDI/MIDIDecoder.mm index a997a666a..69bc1f3b0 100755 --- a/Plugins/MIDI/MIDI/MIDIDecoder.mm +++ b/Plugins/MIDI/MIDI/MIDIDecoder.mm @@ -368,4 +368,17 @@ static OSType getOSType(const char * in_) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"General MIDI Files", @"song.icns", @"mid", @"midi", @"kar"], + @[@"RIFF MIDI Files", @"song.icns", @"rmi"], + @[@"MIDS MIDI Files", @"song.icns", @"mids", @"mds"], + @[@"HMI MIDI Files", @"song.icns", @"hmi", @"hmp", @"hmq"], + @[@"id Software MUS MIDI Files", @"song.icns", @"mus"], + @[@"XMI MIDI Files", @"song.icns", @"xmi"], + @[@"Loudness MIDI Files", @"song.icns", @"lds"] + ]; +} + @end diff --git a/Plugins/Musepack/MusepackDecoder.m b/Plugins/Musepack/MusepackDecoder.m index f5d20786e..765173906 100644 --- a/Plugins/Musepack/MusepackDecoder.m +++ b/Plugins/Musepack/MusepackDecoder.m @@ -233,4 +233,11 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Musepack Audio Files", @"mpc.icns", @"mpc"] + ]; +} + @end diff --git a/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm b/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm index c2a540059..6593aac15 100755 --- a/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm +++ b/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm @@ -193,4 +193,14 @@ static void g_push_archive_extensions(std::vector & list) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"libOpenMPT Module Files"]; + [ret addObject:@"song.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + @end diff --git a/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm b/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm index 2d7d7cae2..f4252bc97 100755 --- a/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm +++ b/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm @@ -185,4 +185,14 @@ static void g_push_archive_extensions(std::vector & list) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"libOpenMPT Module Files"]; + [ret addObject:@"song.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + @end diff --git a/Plugins/Opus/Opus/OpusDecoder.m b/Plugins/Opus/Opus/OpusDecoder.m index e588161fc..ff50662f4 100644 --- a/Plugins/Opus/Opus/OpusDecoder.m +++ b/Plugins/Opus/Opus/OpusDecoder.m @@ -188,4 +188,12 @@ opus_int64 sourceTell(void *_stream) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Opus Audio Files", @"ogg.icns", @"opus"], + @[@"Ogg Audio Files", @"ogg.icns", @"ogg"] + ]; +} + @end diff --git a/Plugins/Shorten/ShortenDecoder.mm b/Plugins/Shorten/ShortenDecoder.mm index 28281d476..3f09fcacf 100644 --- a/Plugins/Shorten/ShortenDecoder.mm +++ b/Plugins/Shorten/ShortenDecoder.mm @@ -113,5 +113,12 @@ return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Shorten Audio Files", @"shn.icns", @"shn"] + ]; +} + @end diff --git a/Plugins/Vorbis/VorbisDecoder.m b/Plugins/Vorbis/VorbisDecoder.m index ea53a09e9..f24768d0a 100644 --- a/Plugins/Vorbis/VorbisDecoder.m +++ b/Plugins/Vorbis/VorbisDecoder.m @@ -180,4 +180,11 @@ long sourceTell(void *datasource) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"Ogg Vorbis Files", @"ogg.icns", @"ogg"] + ]; +} + @end diff --git a/Plugins/WavPack/WavPackDecoder.m b/Plugins/WavPack/WavPackDecoder.m index f036ccd5f..d22417b68 100644 --- a/Plugins/WavPack/WavPackDecoder.m +++ b/Plugins/WavPack/WavPackDecoder.m @@ -331,5 +331,11 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount) return 1.0; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"WavPack Audio Files", @"wv.icns", @"wv", @"wvp"] + ]; +} @end diff --git a/Plugins/libvgmPlayer/libvgmDecoder.mm b/Plugins/libvgmPlayer/libvgmDecoder.mm index 09cfe75f7..29329fd73 100755 --- a/Plugins/libvgmPlayer/libvgmDecoder.mm +++ b/Plugins/libvgmPlayer/libvgmDecoder.mm @@ -291,6 +291,16 @@ const int masterVol = 0x10000; // Fixed point 16.16 return 1.25; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"libvgm Files"]; + [ret addObject:@"vg.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + - (void)setSource:(id)s { source = s; diff --git a/Plugins/sidplay/SidDecoder.mm b/Plugins/sidplay/SidDecoder.mm index f3158e912..15e927d87 100755 --- a/Plugins/sidplay/SidDecoder.mm +++ b/Plugins/sidplay/SidDecoder.mm @@ -374,4 +374,12 @@ static void sidTuneLoader(const char* fileName, std::vector& bufferRef) return 0.5; } ++ (NSArray *)fileTypeAssociations +{ + return @[ + @[@"SID Files", @"vg.icns", @"sid"], + @[@"SID MUS Files", @"song.icns", @"mus"] + ]; +} + @end diff --git a/Plugins/vgmstream/vgmstream/VGMDecoder.m b/Plugins/vgmstream/vgmstream/VGMDecoder.m index dadb8c393..b1d3c4135 100644 --- a/Plugins/vgmstream/vgmstream/VGMDecoder.m +++ b/Plugins/vgmstream/vgmstream/VGMDecoder.m @@ -416,4 +416,14 @@ static NSString* get_description_tag(const char* description, const char *tag, c return 0.0; } ++ (NSArray *)fileTypeAssociations +{ + NSMutableArray * ret = [[NSMutableArray alloc] init]; + [ret addObject:@"VGMStream Files"]; + [ret addObject:@"vg.icns"]; + [ret addObjectsFromArray:[self fileTypes]]; + + return [NSArray arrayWithObject:ret]; +} + @end