From 8d74a3ccef02673df05e1596b436b3a161dea33f Mon Sep 17 00:00:00 2001 From: vspader Date: Sat, 20 Oct 2007 03:17:43 +0000 Subject: [PATCH] Fixed file types for multi-track game music files. --- Plugins/GME/GameContainer.m | 21 +++------------------ Plugins/GME/GameDecoder.m | 15 ++++++++++++--- Plugins/GME/GameMetadataReader.m | 6 +++--- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/Plugins/GME/GameContainer.m b/Plugins/GME/GameContainer.m index 680559118..77fbb2fc2 100755 --- a/Plugins/GME/GameContainer.m +++ b/Plugins/GME/GameContainer.m @@ -15,17 +15,8 @@ + (NSArray *)fileTypes { - NSMutableArray *types = [NSMutableArray array]; - gme_type_t const* type = gme_type_list(); - while(*type) - { - //We're digging a little deep here, but there seems to be no other choice. - [types addObject:[NSString stringWithCString:(*type)->extension_ encoding: NSASCIIStringEncoding]]; - - type++; - } - - return [[types copy] autorelease]; + //There doesn't seem to be a way to get this list. These are the only multitrack types. + return [NSArray arrayWithObjects:@"ay", @"gbs", @"nsf", @"nsfe", @"sap", nil]; } + (NSArray *)mimeTypes @@ -37,7 +28,7 @@ + (NSArray *)urlsForContainerURL:(NSURL *)url { if (![url isFileURL]) { - return [NSArray array]; + return nil; } gme_err_t error; @@ -45,12 +36,6 @@ error = gme_open_file([[url path] UTF8String], &emu, 44100); int track_count = gme_track_count(emu); - //If there is only one track, we shouldn't append the # - if (track_count == 1) { - NSLog(@"Track count is 1...%@", url); - return [NSArray arrayWithObject:url]; - } - NSMutableArray *tracks = [NSMutableArray array]; int i; diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index b321b9e3c..b91da230a 100755 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -7,7 +7,6 @@ // #import "GameDecoder.h" -#import "GameContainer.h" @implementation GameDecoder @@ -158,12 +157,22 @@ gme_err_t readCallback( void* data, void* out, long count ) + (NSArray *)fileTypes { - return [GameContainer fileTypes]; + NSMutableArray *types = [NSMutableArray array]; + gme_type_t const* type = gme_type_list(); + while(*type) + { + //We're digging a little deep here, but there seems to be no other choice. + [types addObject:[NSString stringWithCString:(*type)->extension_ encoding: NSASCIIStringEncoding]]; + + type++; + } + + return [[types copy] autorelease]; } + (NSArray *)mimeTypes { - return [GameContainer fileTypes]; + return nil; } - (void)setSource:(id)s diff --git a/Plugins/GME/GameMetadataReader.m b/Plugins/GME/GameMetadataReader.m index 78a525cd6..4fb163f1b 100644 --- a/Plugins/GME/GameMetadataReader.m +++ b/Plugins/GME/GameMetadataReader.m @@ -8,7 +8,7 @@ #import "GameMetadataReader.h" -#import "GameContainer.h" +#import "GameDecoder.h" #import @@ -16,12 +16,12 @@ + (NSArray *)fileTypes { - return [GameContainer fileTypes]; + return [GameDecoder fileTypes]; } + (NSArray *)mimeTypes { - return [GameContainer mimeTypes]; + return [GameDecoder mimeTypes]; } + (NSDictionary *)metadataForURL:(NSURL *)url