From 4bebdb30c6347f9c9b23e3b4c574920db9ca9ff3 Mon Sep 17 00:00:00 2001 From: Florin9doi Date: Tue, 28 Apr 2020 00:19:20 +0300 Subject: [PATCH] iOS : File association --- ios/AppDelegate.mm | 16 +++++ ios/PPSSPP-Info.plist | 134 ++++++++++++++++++++++++++++++++++++++++++ ios/main.mm | 5 -- 3 files changed, 150 insertions(+), 5 deletions(-) diff --git a/ios/AppDelegate.mm b/ios/AppDelegate.mm index 289db7f942..ab79d0be07 100644 --- a/ios/AppDelegate.mm +++ b/ios/AppDelegate.mm @@ -72,6 +72,22 @@ } -(BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + int argc = 1; + char *argv[3] = { 0 }; + NSURL* nsUrl = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; + + if (nsUrl != nullptr && nsUrl.isFileURL) { + NSString *nsString = nsUrl.path; + const char *string = nsString.UTF8String; + argv[argc++] = (char*)string; + } + + NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; + NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"]; + NativeInit(argc, (const char**)argv, documentsPath.UTF8String, bundlePath.UTF8String, NULL); + + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.viewController = [[ViewController alloc] init]; diff --git a/ios/PPSSPP-Info.plist b/ios/PPSSPP-Info.plist index 74234337c8..55d219357c 100644 --- a/ios/PPSSPP-Info.plist +++ b/ios/PPSSPP-Info.plist @@ -68,5 +68,139 @@ UILaunchStoryboardName Launch Screen + CFBundleDocumentTypes + + + CFBundleTypeIconFiles + + CFBundleTypeName + ISO File + LSHandlerRank + Owner + LSItemContentTypes + + ppsspp.iso + + + + CFBundleTypeIconFiles + + CFBundleTypeName + CSO File + LSHandlerRank + Owner + LSItemContentTypes + + ppsspp.cso + + + + CFBundleTypeIconFiles + + CFBundleTypeName + ELF File + LSHandlerRank + Owner + LSItemContentTypes + + ppsspp.elf + + + + CFBundleTypeIconFiles + + CFBundleTypeName + PBP File + LSHandlerRank + Owner + LSItemContentTypes + + ppsspp.pbp + + + + UTExportedTypeDeclarations + + + UTTypeConformsTo + + public.data + public.iso-image + + UTTypeDescription + ISO File + UTTypeIconFiles + + UTTypeIdentifier + ppsspp.iso + UTTypeTagSpecification + + public.filename-extension + + iso + + + + + UTTypeConformsTo + + public.data + dyn.ah62d4rv4ge80g65t + + UTTypeDescription + CSO File + UTTypeIconFiles + + UTTypeIdentifier + ppsspp.cso + UTTypeTagSpecification + + public.filename-extension + + cso + + + + + UTTypeConformsTo + + public.data + dyn.ah62d4rv4ge80n5dg + + UTTypeDescription + ELF File + UTTypeIconFiles + + UTTypeIdentifier + ppsspp.elf + UTTypeTagSpecification + + public.filename-extension + + elf + + + + + UTTypeConformsTo + + public.data + dyn.ah62d4rv4ge81a2xu + + UTTypeDescription + PBP File + UTTypeIconFiles + + UTTypeIdentifier + ppsspp.pbp + UTTypeTagSpecification + + public.filename-extension + + pbp + + + + diff --git a/ios/main.mm b/ios/main.mm index b01e784113..4c9f004c5f 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -218,11 +218,6 @@ int main(int argc, char *argv[]) PROFILE_INIT(); @autoreleasepool { - NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/assets/"]; - - NativeInit(argc, (const char**)argv, documentsPath.UTF8String, bundlePath.UTF8String, NULL); - return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class])); } }