From 08a4523bb297e56ec026d00509733c958164d071 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Tue, 19 Mar 2013 15:09:05 -0400 Subject: [PATCH 1/6] use the app level documents directory instead of /var/mobile This is a big change in that it changes the RetroArch system path where it saves settings, game saves, etc. Using /var/mobile meant that RetroArch only ran on jailbroken devices. This was the only thing requiring a jailbreak. Now not only will it work on vanilla devices, but all settings etc are neating found in the app's documents directory. --- ios/RetroArch/RetroArch_iOS.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index f4d4155522..a76697064a 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -21,6 +21,9 @@ #import "input/BTStack/WiiMoteHelper.h" +#define kDOCSFOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] + + @implementation RetroArch_iOS { UIWindow* _window; @@ -50,7 +53,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { // TODO: Relocate this! - self.system_directory = @"/var/mobile/Library/RetroArch/"; + self.system_directory = [NSString stringWithFormat:@"%@/RetroArch", kDOCSFOLDER]; mkdir([self.system_directory UTF8String], 0755); // Setup window From b335bfbac6289b5b4793e9071d7d9b5b64c7c10e Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Tue, 19 Mar 2013 16:32:07 -0400 Subject: [PATCH 2/6] enable iTunes File Sharing Turning on iTunes File Sharing means being able to easily drop roms into the app by dragging them in via iTunes. --- ios/RetroArch/RetroArch-Info.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/RetroArch/RetroArch-Info.plist b/ios/RetroArch/RetroArch-Info.plist index 2abe058713..fc6a938111 100644 --- a/ios/RetroArch/RetroArch-Info.plist +++ b/ios/RetroArch/RetroArch-Info.plist @@ -26,6 +26,8 @@ UIApplicationExitsOnSuspend + UIFileSharingEnabled + UIRequiredDeviceCapabilities armv7 From fa7730fc4965020d7b1648f0a1dbda90c8538404 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Wed, 20 Mar 2013 22:27:47 -0400 Subject: [PATCH 3/6] dot the system directory to hide it from iTunes Sharing This esssentially hides the retroarch system directory when viewing the documents directory through iTunes Sharing. You can't browse folders this way anyways, so having it visible is essentially useless anyways. You can of course still get to this directoy via tools like iTools (non-jailbroken) or ssh'ing into the device (jailbroken). --- ios/RetroArch/RetroArch_iOS.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index a76697064a..5fb43ee3f6 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -53,7 +53,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { // TODO: Relocate this! - self.system_directory = [NSString stringWithFormat:@"%@/RetroArch", kDOCSFOLDER]; + self.system_directory = [NSString stringWithFormat:@"%@/.RetroArch", kDOCSFOLDER]; mkdir([self.system_directory UTF8String], 0755); // Setup window From 8d500d2cf22e0aaa4f3cd1f6bc462b09a2cdca40 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Wed, 20 Mar 2013 22:43:01 -0400 Subject: [PATCH 4/6] i did! --- ios/RetroArch/RetroArch_iOS.m | 1 - 1 file changed, 1 deletion(-) diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index 5fb43ee3f6..ecc2449e36 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -52,7 +52,6 @@ // UIApplicationDelegate - (void)applicationDidFinishLaunching:(UIApplication *)application { - // TODO: Relocate this! self.system_directory = [NSString stringWithFormat:@"%@/.RetroArch", kDOCSFOLDER]; mkdir([self.system_directory UTF8String], 0755); From c551bca6655c26c33f3e303cae78d8e5535f60dc Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Wed, 20 Mar 2013 22:44:11 -0400 Subject: [PATCH 5/6] open directly to the Documents directory --- ios/RetroArch/RetroArch_iOS.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index ecc2449e36..d9d9aa2128 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -57,7 +57,7 @@ // Setup window self.delegate = self; - [self pushViewController:[RADirectoryList directoryListOrGridWithPath:nil] animated:YES]; + [self pushViewController:[RADirectoryList directoryListOrGridWithPath:kDOCSFOLDER] animated:YES]; _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; _window.rootViewController = self; From 200809f4303e18a5cce52af5983eaaed2e87da04 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Wed, 20 Mar 2013 22:48:58 -0400 Subject: [PATCH 6/6] ignore dotted files/dirs including '.' and '..' --- ios/RetroArch/browser/browser.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RetroArch/browser/browser.m b/ios/RetroArch/browser/browser.m index f933658c1e..57f97e1ccf 100644 --- a/ios/RetroArch/browser/browser.m +++ b/ios/RetroArch/browser/browser.m @@ -67,7 +67,7 @@ NSArray* ra_ios_list_directory(NSString* path) for(struct dirent* item = readdir(dir); item; item = readdir(dir)) { - if (strcmp(item->d_name, ".") == 0 || strcmp(item->d_name, "..") == 0) + if (strncmp(item->d_name, ".", 1) == 0) continue; cpath[cpath_end] = 0;