From 258a88464aca84021b8d778bb26efd6cf6924a0d Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 8 Nov 2019 15:05:21 -0800 Subject: [PATCH] Fix VGM metadata and properties reading --- Plugins/GME/GME.xcodeproj/project.pbxproj | 12 ++++-- Plugins/GME/GamePropertiesReader.h | 17 +++++++++ Plugins/GME/GamePropertiesReader.m | 45 +++++++++++++++++++++++ 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 Plugins/GME/GamePropertiesReader.h create mode 100644 Plugins/GME/GamePropertiesReader.m diff --git a/Plugins/GME/GME.xcodeproj/project.pbxproj b/Plugins/GME/GME.xcodeproj/project.pbxproj index 6a32ab80c..1abd80abf 100644 --- a/Plugins/GME/GME.xcodeproj/project.pbxproj +++ b/Plugins/GME/GME.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 17C8F3440CBED3BE008D969D /* GameDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F33E0CBED3BE008D969D /* GameDecoder.m */; }; 17C8F3C30CBED649008D969D /* GME.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17C8F3370CBED393008D969D /* GME.framework */; }; 17DA34BB0CC052030003F6B2 /* GameMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17DA34B90CC052030003F6B2 /* GameMetadataReader.m */; }; + 8319C750237629D400BFFAE0 /* GamePropertiesReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 8319C74F237629D400BFFAE0 /* GamePropertiesReader.m */; }; 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ @@ -59,6 +60,8 @@ 17DA34B80CC052030003F6B2 /* GameMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameMetadataReader.h; sourceTree = ""; }; 17DA34B90CC052030003F6B2 /* GameMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameMetadataReader.m; sourceTree = ""; }; 32DBCF630370AF2F00C91783 /* GME_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GME_Prefix.pch; sourceTree = ""; }; + 8319C74E237629D300BFFAE0 /* GamePropertiesReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamePropertiesReader.h; sourceTree = ""; }; + 8319C74F237629D400BFFAE0 /* GamePropertiesReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GamePropertiesReader.m; sourceTree = ""; }; 833F68351CDBCAB200AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; 835C888F22CC1883001B4B3F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 8384912E1808175400E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = ""; }; @@ -114,15 +117,17 @@ 08FB77AFFE84173DC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( - 83FAF8A518ADD4D100057CAF /* PlaylistController.h */, - 8384912E1808175400E7332D /* Logging.h */, - 17C8F3470CBED3C7008D969D /* Plugin.h */, 17C8F33B0CBED3BE008D969D /* GameContainer.h */, 17C8F33C0CBED3BE008D969D /* GameContainer.m */, 17C8F33D0CBED3BE008D969D /* GameDecoder.h */, 17C8F33E0CBED3BE008D969D /* GameDecoder.m */, 17DA34B80CC052030003F6B2 /* GameMetadataReader.h */, 17DA34B90CC052030003F6B2 /* GameMetadataReader.m */, + 8319C74E237629D300BFFAE0 /* GamePropertiesReader.h */, + 8319C74F237629D400BFFAE0 /* GamePropertiesReader.m */, + 8384912E1808175400E7332D /* Logging.h */, + 83FAF8A518ADD4D100057CAF /* PlaylistController.h */, + 17C8F3470CBED3C7008D969D /* Plugin.h */, ); name = Classes; sourceTree = ""; @@ -260,6 +265,7 @@ 17C8F3420CBED3BE008D969D /* GameContainer.m in Sources */, 17C8F3440CBED3BE008D969D /* GameDecoder.m in Sources */, 17DA34BB0CC052030003F6B2 /* GameMetadataReader.m in Sources */, + 8319C750237629D400BFFAE0 /* GamePropertiesReader.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Plugins/GME/GamePropertiesReader.h b/Plugins/GME/GamePropertiesReader.h new file mode 100644 index 000000000..368d2371f --- /dev/null +++ b/Plugins/GME/GamePropertiesReader.h @@ -0,0 +1,17 @@ +// +// GamePropertiesReader.h +// GME +// +// Created by Christopher Snowhill on 11/08/19. +// Copyright 2019 __LoSnoCo__. All rights reserved. +// + +#import + +#import "Plugin.h" + +@interface GamePropertiesReader : NSObject { + +} + +@end diff --git a/Plugins/GME/GamePropertiesReader.m b/Plugins/GME/GamePropertiesReader.m new file mode 100644 index 000000000..82d66b6d5 --- /dev/null +++ b/Plugins/GME/GamePropertiesReader.m @@ -0,0 +1,45 @@ +// +// VGMPropertiesReader.m +// VGMStream +// +// Created by Christopher Snowhill on 10/18/19. +// Copyright 2019 __LoSnoCo__. All rights reserved. +// + +#import "GamePropertiesReader.h" +#import "GameDecoder.h" + +@implementation GamePropertiesReader + ++ (NSArray *)fileTypes +{ + return [GameDecoder fileTypes]; +} + ++ (NSArray *)mimeTypes +{ + return [GameDecoder mimeTypes]; +} + ++ (float)priority +{ + return [GameDecoder priority]; +} + ++ (NSDictionary *)propertiesForSource:(id)source +{ + GameDecoder * decoder = [[GameDecoder alloc] init]; + + NSDictionary * properties = [NSDictionary dictionary]; + + if ([decoder open:source]) + { + properties = [decoder properties]; + + [decoder close]; + } + + return properties; +} + +@end