From 8995ce2cb2a7ee7b7aaaa8b098c7ac459c37ae66 Mon Sep 17 00:00:00 2001 From: meancoot Date: Tue, 26 Mar 2013 20:59:32 -0400 Subject: [PATCH] (iOS) Fixes: Update the default directory used when file browser can't load a directory. Add a cancel button to controller type selection screen. Remove the HAVE_RGUI option. Until the main loop is updated all it does is cause the game to close. Don't show the controller type selection screen if bluetooth is already enabled. Remove unneeded None option for aspect ratio setting. --- ios/RetroArch.xcodeproj/project.pbxproj | 12 ------------ ios/RetroArch/RetroArch_iOS.m | 13 ++++++++----- ios/RetroArch/browser/browser.m | 4 +--- ios/RetroArch/settings/RASettingEnumerationList.m | 12 +++++++----- ios/RetroArch/settings/RASettingsList.m | 1 + ios/RetroArch/settings/settings.h | 2 ++ 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/ios/RetroArch.xcodeproj/project.pbxproj b/ios/RetroArch.xcodeproj/project.pbxproj index 25fc340bfc..1d74a55fff 100644 --- a/ios/RetroArch.xcodeproj/project.pbxproj +++ b/ios/RetroArch.xcodeproj/project.pbxproj @@ -543,15 +543,9 @@ GCC_PREFIX_HEADER = "RetroArch/RetroArch-Prefix.pch"; INFOPLIST_FILE = "RetroArch/RetroArch-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 6.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - "\"$(SRCROOT)/RetroArch/input/BTStack\"", - ); OTHER_CFLAGS = ( "-DHAVE_RARCH_MAIN_WRAP", "-DHAVE_GRIFFIN", - "-DHAVE_RGUI", "-DIOS", "-DHAVE_OPENGL", "-DHAVE_FBO", @@ -585,17 +579,11 @@ GCC_PREFIX_HEADER = "RetroArch/RetroArch-Prefix.pch"; INFOPLIST_FILE = "RetroArch/RetroArch-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 6.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - "\"$(SRCROOT)/RetroArch/input/BTStack\"", - ); OTHER_CFLAGS = ( "-DNS_BLOCK_ASSERTIONS=1", "-DNDEBUG", "-DHAVE_RARCH_MAIN_WRAP", "-DHAVE_GRIFFIN", - "-DHAVE_RGUI", "-DIOS", "-DHAVE_OPENGL", "-DHAVE_FBO", diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index cbda74950e..5bb60e6ff3 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -290,12 +290,12 @@ - (IBAction)startBluetooth { - if (btstack_is_loaded()) + if (btstack_is_loaded() && !btstack_is_running()) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"RetroArch" message:@"Choose Pad Type" delegate:self - cancelButtonTitle:nil + cancelButtonTitle:@"Cancel" otherButtonTitles:@"Wii", @"PS3", nil]; [alert show]; } @@ -305,10 +305,13 @@ { if (btstack_is_loaded()) { - btpad_set_pad_type(buttonIndex == 0); + btpad_set_pad_type(buttonIndex == alertView.firstOtherButtonIndex); - btstack_start(); - [self.topViewController.navigationItem setRightBarButtonItem:[self createBluetoothButton] animated:YES]; + if (buttonIndex != alertView.cancelButtonIndex) + { + btstack_start(); + [self.topViewController.navigationItem setRightBarButtonItem:[self createBluetoothButton] animated:YES]; + } } } diff --git a/ios/RetroArch/browser/browser.m b/ios/RetroArch/browser/browser.m index 57f97e1ccf..488103eb04 100644 --- a/ios/RetroArch/browser/browser.m +++ b/ios/RetroArch/browser/browser.m @@ -98,7 +98,5 @@ NSString* ra_ios_check_path(NSString* path) if (path) [RetroArch_iOS displayErrorMessage:@"Browsed path is not a directory."]; - if (ra_ios_is_directory(@"/var/mobile/RetroArchGames")) return @"/var/mobile/RetroArchGames"; - else if (ra_ios_is_directory(@"/var/mobile")) return @"/var/mobile"; - else return @"/"; + return [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; } diff --git a/ios/RetroArch/settings/RASettingEnumerationList.m b/ios/RetroArch/settings/RASettingEnumerationList.m index 54266e3c9c..c845c753b8 100644 --- a/ios/RetroArch/settings/RASettingEnumerationList.m +++ b/ios/RetroArch/settings/RASettingEnumerationList.m @@ -19,6 +19,7 @@ { RASettingData* _value; UITableView* _view; + unsigned _mainSection; }; - (id)initWithSetting:(RASettingData*)setting fromTable:(UITableView*)table @@ -27,6 +28,7 @@ _value = setting; _view = table; + _mainSection = _value.haveNoneOption ? 1 : 0; [self setTitle: _value.label]; return self; @@ -34,12 +36,12 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView { - return 2; + return _value.haveNoneOption ? 2 : 1; } - (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { - return (section == 1) ? [_value.subValues count] : 1; + return (section == _mainSection) ? _value.subValues.count : 1; } - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath @@ -47,15 +49,15 @@ UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:@"option"]; cell = cell ? cell : [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"option"]; - cell.textLabel.text = (indexPath.section == 1) ? [_value.subValues objectAtIndex:indexPath.row] : @"None"; + cell.textLabel.text = (indexPath.section == _mainSection) ? _value.subValues[indexPath.row] : @"None"; return cell; } - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - _value.value = (indexPath.section == 1) ? [_value.subValues objectAtIndex:indexPath.row] : @""; - + _value.value = (indexPath.section == _mainSection) ? _value.subValues[indexPath.row] : @""; + [_view reloadData]; [[RetroArch_iOS get] popViewControllerAnimated:YES]; } diff --git a/ios/RetroArch/settings/RASettingsList.m b/ios/RetroArch/settings/RASettingsList.m index bb54acd334..c5148ce2cc 100644 --- a/ios/RetroArch/settings/RASettingsList.m +++ b/ios/RetroArch/settings/RASettingsList.m @@ -81,6 +81,7 @@ static RASettingData* subpath_setting(config_file_t* config, NSString* name, NSS result.value = value; result.subValues = values; result.path = path; + result.haveNoneOption = true; return result; } diff --git a/ios/RetroArch/settings/settings.h b/ios/RetroArch/settings/settings.h index 7d21abab33..f834889524 100644 --- a/ios/RetroArch/settings/settings.h +++ b/ios/RetroArch/settings/settings.h @@ -33,6 +33,8 @@ enum SettingTypes @property double rangeMin; @property double rangeMax; +@property bool haveNoneOption; + - (id)initWithType:(enum SettingTypes)aType label:(NSString*)aLabel name:(NSString*)aName; @end