cog/Plugins/GME/GameContainer.m

51 lines
967 B
Matlab
Raw Normal View History

2007-10-11 23:11:58 +00:00
//
// GameFile.m
// Cog
//
// Created by Vincent Spader on 5/29/06.
// Copyright 2006 Vincent Spader. All rights reserved.
//
#import <GME/gme.h>
#import "GameContainer.h"
#import "GameDecoder.h"
@implementation GameContainer
+ (NSArray *)fileTypes
{
//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];
2007-10-11 23:11:58 +00:00
}
2007-10-14 18:56:23 +00:00
+ (NSArray *)mimeTypes
{
return nil;
}
2007-10-11 23:11:58 +00:00
//This really should be source...
+ (NSArray *)urlsForContainerURL:(NSURL *)url
{
if (![url isFileURL]) {
return nil;
2007-10-11 23:11:58 +00:00
}
gme_err_t error;
Music_Emu *emu;
error = gme_open_file([[url path] UTF8String], &emu, 44100);
int track_count = gme_track_count(emu);
2007-10-19 02:23:10 +00:00
2007-10-11 23:11:58 +00:00
NSMutableArray *tracks = [NSMutableArray array];
2007-10-19 02:23:10 +00:00
2007-10-11 23:11:58 +00:00
int i;
for (i = 0; i < track_count; i++) {
[tracks addObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"#%i", i]]];
}
return tracks;
}
@end