diff --git a/ui/drivers/cocoa/cocoatouch_menu.m b/ui/drivers/cocoa/cocoatouch_menu.m index a11eba022f..4e7b6c0a61 100644 --- a/ui/drivers/cocoa/cocoatouch_menu.m +++ b/ui/drivers/cocoa/cocoatouch_menu.m @@ -135,45 +135,45 @@ @implementation RANumberFormatter - (id)initWithSetting:(const rarch_setting_t*)setting { - if ((self = [super init])) - { - [self setAllowsFloats:(setting->type == ST_FLOAT)]; - - if (setting->flags & SD_FLAG_HAS_RANGE) - { - [self setMinimum:BOXFLOAT(setting->min)]; - [self setMaximum:BOXFLOAT(setting->max)]; - } - } - - return self; + if ((self = [super init])) + { + [self setAllowsFloats:(setting->type == ST_FLOAT)]; + + if (setting->flags & SD_FLAG_HAS_RANGE) + { + [self setMinimum:BOXFLOAT(setting->min)]; + [self setMaximum:BOXFLOAT(setting->max)]; + } + } + + return self; } - (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error { - unsigned i; - bool hasDot = false; - - if (partialString.length) - for (i = 0; i < partialString.length; i ++) - { - unichar ch = [partialString characterAtIndex:i]; - - if (i == 0 && (!self.minimum || self.minimum.intValue < 0) && ch == '-') - continue; - else if (self.allowsFloats && !hasDot && ch == '.') - hasDot = true; - else if (!isdigit(ch)) - return NO; - } - - return YES; + unsigned i; + bool hasDot = false; + + if (partialString.length) + for (i = 0; i < partialString.length; i ++) + { + unichar ch = [partialString characterAtIndex:i]; + + if (i == 0 && (!self.minimum || self.minimum.intValue < 0) && ch == '-') + continue; + else if (self.allowsFloats && !hasDot && ch == '.') + hasDot = true; + else if (!isdigit(ch)) + return NO; + } + + return YES; } - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - NSString* text = (NSString*)[[textField text] stringByReplacingCharactersInRange:range withString:string]; - return [self isPartialStringValid:text newEditingString:nil errorDescription:nil]; + NSString* text = (NSString*)[[textField text] stringByReplacingCharactersInRange:range withString:string]; + return [self isPartialStringValid:text newEditingString:nil errorDescription:nil]; } @end @@ -217,14 +217,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U actionSheet.title = BOXSTRING(title); actionSheet.delegate = delegate; - + for (i = 0; i < items->size; i ++) [actionSheet addButtonWithTitle:BOXSTRING(items->elems[i].data)]; - + actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:BOXSTRING("Cancel")]; - + objc_setAssociatedObject(actionSheet, associated_delegate_key, delegate, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - + [actionSheet showInView:parent]; } @@ -251,7 +251,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section { if (self.hidesHeaders) - return nil; + return nil; return self.sections[section][0]; } @@ -277,7 +277,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)willReloadData { - + } - (void)reloadData @@ -323,11 +323,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (UITableViewCell*)cellForTableView:(UITableView*)tableView { static NSString* const cell_id = @"text"; - + UITableViewCell* result = [tableView dequeueReusableCellWithIdentifier:cell_id]; if (!result) result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id]; - + result.selectionStyle = UITableViewCellSelectionStyleNone; result.textLabel.text = self.description; result.detailTextLabel.text = self.detail ? self.detail(self.userdata) : nil; @@ -356,54 +356,54 @@ static void RunActionSheet(const char* title, const struct string_list* items, U + (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action { - switch (setting->type) { - case ST_NONE: - case ST_ACTION: + switch (setting->type) { + case ST_NONE: + case ST_ACTION: return [RAMenuItemBasic itemWithDescription:BOXSTRING("Shouldn't be called with ST_NONE or ST_ACTION") action:^{}]; - case ST_BOOL: + case ST_BOOL: return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting action:action]; - case ST_INT: - case ST_UINT: + case ST_INT: + case ST_UINT: case ST_FLOAT: break; case ST_PATH: - case ST_DIR: + case ST_DIR: return [[RAMenuItemPathSetting alloc] initWithSetting:setting action:action]; - case ST_STRING: - case ST_HEX: + case ST_STRING: + case ST_HEX: break; - case ST_BIND: + case ST_BIND: return [[RAMenuItemBindSetting alloc] initWithSetting:setting action:action]; - case ST_GROUP: + case ST_GROUP: case ST_SUB_GROUP: case ST_END_GROUP: case ST_END_SUB_GROUP: - default: + default: return [RAMenuItemBasic itemWithDescription:BOXSTRING("Shouldn't be called with ST_*GROUP") action:^{}]; - } + } if (setting->type == ST_STRING && setting->values) return [[RAMenuItemEnumSetting alloc] initWithSetting:setting action:action]; - + RAMenuItemGeneralSetting* item = [[RAMenuItemGeneralSetting alloc] initWithSetting:setting action:action]; - + if (item.setting->type == ST_INT || - item.setting->type == ST_UINT || - item.setting->type == ST_FLOAT) + item.setting->type == ST_UINT || + item.setting->type == ST_FLOAT) item.formatter = [[RANumberFormatter alloc] initWithSetting:item.setting]; - + return item; } - (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action { - if ((self = [super init])) { - _setting = setting; - _action = action; - } - return self; + if ((self = [super init])) { + _setting = setting; + _action = action; + } + return self; } - (UITableViewCell*)cellForTableView:(UITableView*)tableView @@ -411,6 +411,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U char buffer[PATH_MAX_LENGTH]; UITableViewCell* result; static NSString* const cell_id = @"string_setting"; + rarch_setting_t *setting = self.setting; self.parentTable = tableView; @@ -420,23 +421,23 @@ static void RunActionSheet(const char* title, const struct string_list* items, U result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id]; result.selectionStyle = UITableViewCellSelectionStyleNone; } - + [self attachDefaultingGestureTo:result]; result.textLabel.text = BOXSTRING(""); - if (self.setting) + if (setting) { - if (self.setting->short_description) - result.textLabel.text = BOXSTRING(self.setting->short_description); + if (setting->short_description) + result.textLabel.text = BOXSTRING(setting->short_description); - setting_get_string_representation(self.setting, buffer, sizeof(buffer)); + setting_get_string_representation(setting, buffer, sizeof(buffer)); if (buffer[0] == '\0') strlcpy(buffer, "", sizeof(buffer)); result.detailTextLabel.text = BOXSTRING(buffer); - if (self.setting->type == ST_PATH) + if (setting->type == ST_PATH) result.detailTextLabel.text = [result.detailTextLabel.text lastPathComponent]; } return result; @@ -448,18 +449,19 @@ static void RunActionSheet(const char* title, const struct string_list* items, U NSString *desc = BOXSTRING("N/A"); UIAlertView *alertView; UITextField *field; - - if (self.setting && self.setting->short_description) - desc = BOXSTRING(self.setting->short_description); - + rarch_setting_t *setting = self.setting; + + if (setting && setting->short_description) + desc = BOXSTRING(setting->short_description); + alertView = [[UIAlertView alloc] initWithTitle:BOXSTRING("Enter new value") message:desc delegate:self cancelButtonTitle:BOXSTRING("Cancel") otherButtonTitles:BOXSTRING("OK"), nil]; alertView.alertViewStyle = UIAlertViewStylePlainTextInput; field = [alertView textFieldAtIndex:0]; - + field.delegate = self.formatter; - setting_get_string_representation(self.setting, buffer, sizeof(buffer)); + setting_get_string_representation(setting, buffer, sizeof(buffer)); if (buffer[0] == '\0') strlcpy(buffer, "N/A", sizeof(buffer)); @@ -471,14 +473,15 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSString* text = (NSString*)[alertView textFieldAtIndex:0].text; + rarch_setting_t *setting = self.setting; if (buttonIndex != alertView.firstOtherButtonIndex) - return; - if (!text.length) - return; - - setting_set_with_string_representation(self.setting, [text UTF8String]); - [self.parentTable reloadData]; + return; + if (!text.length) + return; + + setting_set_with_string_representation(setting, [text UTF8String]); + [self.parentTable reloadData]; } - (void)attachDefaultingGestureTo:(UIView*)view @@ -486,28 +489,28 @@ static void RunActionSheet(const char* title, const struct string_list* items, U for (UIGestureRecognizer* i in view.gestureRecognizers) [view removeGestureRecognizer:i]; [view addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self - action:@selector(resetValue:)]]; + action:@selector(resetValue:)]]; } - (void)resetValue:(UIGestureRecognizer*)gesture { struct string_list* items; RAMenuItemGeneralSetting __weak* weakSelf; - + if (gesture.state != UIGestureRecognizerStateBegan) return; - + weakSelf = self; items = (struct string_list*)string_split("OK", "|"); - + RunActionSheet("Really Reset Value?", items, self.parentTable, ^(UIActionSheet* actionSheet, NSInteger buttonIndex) { - if (buttonIndex != actionSheet.cancelButtonIndex) - setting_reset_setting(self.setting); - [weakSelf.parentTable reloadData]; + if (buttonIndex != actionSheet.cancelButtonIndex) + setting_reset_setting(self.setting); + [weakSelf.parentTable reloadData]; }); - + string_list_free(items); } @@ -523,42 +526,44 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action { - if ((self = [super init])) - { - _setting = setting; - _action = action; - } + if ((self = [super init])) + { + _setting = setting; + _action = action; + } return self; } - (UITableViewCell*)cellForTableView:(UITableView*)tableView { static NSString* const cell_id = @"boolean_setting"; - + UITableViewCell* result = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:cell_id]; - + rarch_setting_t *setting = self.setting; + if (!result) { result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id]; result.selectionStyle = UITableViewCellSelectionStyleNone; result.accessoryView = [UISwitch new]; } - - result.textLabel.text = BOXSTRING(self.setting->short_description); + + result.textLabel.text = BOXSTRING(setting->short_description); [(id)result.accessoryView removeTarget:nil action:NULL forControlEvents:UIControlEventValueChanged]; [(id)result.accessoryView addTarget:self action:@selector(handleBooleanSwitch:) forControlEvents:UIControlEventValueChanged]; - - if (self.setting) - [(id)result.accessoryView setOn:*self.setting->value.boolean]; + + if (setting) + [(id)result.accessoryView setOn:*setting->value.boolean]; return result; } - (void)handleBooleanSwitch:(UISwitch*)swt { - if (self.setting) - *self.setting->value.boolean = swt.on ? true : false; - if (self.action) - self.action(); + rarch_setting_t *setting = self.setting; + if (setting) + *setting->value.boolean = swt.on ? true : false; + if (self.action) + self.action(); } - (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller @@ -580,46 +585,47 @@ static void RunActionSheet(const char* title, const struct string_list* items, U NSString *path; RADirectoryList* list; RAMenuItemPathSetting __weak* weakSelf = self; + rarch_setting_t *setting = self.setting; - if (self.setting && self.setting->type == ST_ACTION && - self.setting->flags & SD_FLAG_BROWSER_ACTION && - self.setting->action_toggle && - self.setting->change_handler ) - self.setting->action_toggle( self.setting, MENU_ACTION_RIGHT, false); + if (setting && setting->type == ST_ACTION && + setting->flags & SD_FLAG_BROWSER_ACTION && + setting->action_toggle && + setting->change_handler ) + setting->action_toggle( setting, MENU_ACTION_RIGHT, false); - path = BOXSTRING(self.setting->value.string); - - if ( self.setting->type == ST_PATH ) - path = [path stringByDeletingLastPathComponent]; - - list = [[RADirectoryList alloc] initWithPath:path extensions:self.setting->values action: + path = BOXSTRING(setting->value.string); + + if (setting->type == ST_PATH ) + path = [path stringByDeletingLastPathComponent]; + + list = [[RADirectoryList alloc] initWithPath:path extensions:setting->values action: ^(RADirectoryList* list, RADirectoryItem* item) { - const char *newval = ""; - if (item) - { - if (list.forDirectory && !item.isDirectory) - return; + const char *newval = ""; + if (item) + { + if (list.forDirectory && !item.isDirectory) + return; - newval = [item.path UTF8String]; - } - else - { - if (!list.allowBlank) - return; - } + newval = [item.path UTF8String]; + } + else + { + if (!list.allowBlank) + return; + } - setting_set_with_string_representation(weakSelf.setting, newval); - [[list navigationController] popViewControllerAnimated:YES]; + setting_set_with_string_representation(weakSelf.setting, newval); + [[list navigationController] popViewControllerAnimated:YES]; - weakSelf.action(); - - [weakSelf.parentTable reloadData]; + weakSelf.action(); + + [weakSelf.parentTable reloadData]; }]; - list.allowBlank = (self.setting->flags & SD_FLAG_ALLOW_EMPTY); - list.forDirectory = (self.setting->flags & SD_FLAG_PATH_DIR); - + list.allowBlank = (setting->flags & SD_FLAG_ALLOW_EMPTY); + list.forDirectory = (setting->flags & SD_FLAG_PATH_DIR); + [controller.navigationController pushViewController:list animated:YES]; } @@ -637,17 +643,18 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { struct string_list* items; RAMenuItemEnumSetting __weak* weakSelf = self; - - items = (struct string_list*)string_split(self.setting->values, "|"); - RunActionSheet(self.setting->short_description, items, self.parentTable, - ^(UIActionSheet* actionSheet, NSInteger buttonIndex) - { + rarch_setting_t *setting = self.setting; + + items = (struct string_list*)string_split(setting->values, "|"); + RunActionSheet(setting->short_description, items, self.parentTable, + ^(UIActionSheet* actionSheet, NSInteger buttonIndex) + { if (buttonIndex == actionSheet.cancelButtonIndex) - return; - - setting_set_with_string_representation(self.setting, [[actionSheet buttonTitleAtIndex:buttonIndex] UTF8String]); + return; + + setting_set_with_string_representation(setting, [[actionSheet buttonTitleAtIndex:buttonIndex] UTF8String]); [weakSelf.parentTable reloadData]; - }); + }); string_list_free(items); } @@ -669,17 +676,17 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)wasSelectedOnTableView:(UITableView *)tableView ofController:(UIViewController *)controller { self.alert = [[UIAlertView alloc] initWithTitle:BOXSTRING("RetroArch") - message:BOXSTRING(self.setting->short_description) - delegate:self - cancelButtonTitle:BOXSTRING("Cancel") - otherButtonTitles:BOXSTRING("Clear Keyboard"), BOXSTRING("Clear Joystick"), BOXSTRING("Clear Axis"), nil]; + message:BOXSTRING(self.setting->short_description) + delegate:self + cancelButtonTitle:BOXSTRING("Cancel") + otherButtonTitles:BOXSTRING("Clear Keyboard"), BOXSTRING("Clear Joystick"), BOXSTRING("Clear Axis"), nil]; [self.alert show]; - + [self.parentTable reloadData]; - + self.bindTimer = [NSTimer scheduledTimerWithTimeInterval:.1f target:self selector:@selector(checkBind:) - userInfo:nil repeats:YES]; + userInfo:nil repeats:YES]; } - (void)finishWithClickedButton:(bool)clicked @@ -692,19 +699,20 @@ static void RunActionSheet(const char* title, const struct string_list* items, U [self.bindTimer invalidate]; self.bindTimer = nil; - + cocoa_input_reset_icade_buttons(); } - (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { + rarch_setting_t *setting = self.setting; if (buttonIndex == alertView.firstOtherButtonIndex) - BINDFOR(*self.setting).key = RETROK_UNKNOWN; + BINDFOR(*setting).key = RETROK_UNKNOWN; else if(buttonIndex == alertView.firstOtherButtonIndex + 1) - BINDFOR(*self.setting).joykey = NO_BTN; + BINDFOR(*setting).joykey = NO_BTN; else if(buttonIndex == alertView.firstOtherButtonIndex + 2) - BINDFOR(*self.setting).joyaxis = AXIS_NONE; - + BINDFOR(*setting).joyaxis = AXIS_NONE; + [self finishWithClickedButton:true]; } @@ -712,16 +720,17 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { int32_t value = 0; int32_t idx = 0; + rarch_setting_t *setting = self.setting; - if (self.setting->index) - idx = self.setting->index - 1; + if (setting->index) + idx = setting->index - 1; if ((value = cocoa_input_find_any_key())) - BINDFOR(*self.setting).key = input_keymaps_translate_keysym_to_rk(value); + BINDFOR(*setting).key = input_keymaps_translate_keysym_to_rk(value); else if ((value = cocoa_input_find_any_button(idx)) >= 0) - BINDFOR(*self.setting).joykey = value; + BINDFOR(*setting).joykey = value; else if ((value = cocoa_input_find_any_axis(idx))) - BINDFOR(*self.setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1); + BINDFOR(*setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1); else return; @@ -763,135 +772,132 @@ static void RunActionSheet(const char* title, const struct string_list* items, U const char *label = NULL; unsigned menu_type = 0; menu_handle_t *menu = menu_driver_get_ptr(); - + if (!menu) return; - + menu_list_get_last_stack(menu->menu_list, - &dir, &label, &menu_type); + &dir, &label, &menu_type); get_title(label, dir, menu_type, title, sizeof(title)); - + weakSelf = self; self.sections = [NSMutableArray array]; if (!core_name) - core_name = global->system.info.library_name; + core_name = global->system.info.library_name; if (!core_name) - core_name = "No Core"; + core_name = "No Core"; if (!core_version) - core_version = global->system.info.library_version; + core_version = global->system.info.library_version; if (!core_version) - core_version = ""; + core_version = ""; snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, - core_name, core_version); + core_name, core_version); self.title = BOXSTRING(title_msg); everything = [NSMutableArray array]; [everything addObject:BOXSTRING(title)]; - + end = menu_list_get_size(menu->menu_list); - + for (i = menu->begin; i < end; i++) { - rarch_setting_t *setting; - char type_str[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; - menu_file_list_cbs_t *cbs = NULL; - const char *path = NULL, *entry_label = NULL; - unsigned type = 0, w = 0; - - menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path, - &entry_label, &type); - setting = - (rarch_setting_t*)setting_find_setting - (menu->list_settings, - menu->menu_list->selection_buf->list[i].label); + rarch_setting_t *setting; + char type_str[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; + menu_file_list_cbs_t *cbs = NULL; + const char *path = NULL, *entry_label = NULL; + unsigned type = 0, w = 0; - cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset( + menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path, + &entry_label, &type); + setting = setting_find_setting(menu->list_settings, + menu->menu_list->selection_buf->list[i].label); + + cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset( menu->menu_list->selection_buf, i); - if (cbs && cbs->action_get_representation) { - cbs->action_get_representation - (menu->menu_list->selection_buf, - &w, type, i, label, - type_str, sizeof(type_str), - entry_label, path, - path_buf, sizeof(path_buf)); - } - - if (setting && setting->type == ST_ACTION && - setting->flags & SD_FLAG_BROWSER_ACTION && - setting->action_toggle && - setting->change_handler ) - { - [everything - addObject: - [[RAMenuItemPathSetting alloc] - initWithSetting:setting - action:^{}]]; - } - else if (setting && ST_ACTION < setting->type && setting->type < ST_GROUP) - { - [everything - addObject: - [RAMenuItemGeneralSetting - itemForSetting:setting - action:^{ - menu->navigation.selection_ptr = i; - if (cbs && cbs->action_ok) - cbs->action_ok(path, entry_label, type, i); - }]]; - } - else - { - [everything - addObject: - [RAMenuItemBasic - itemWithDescription:BOXSTRING(path_buf) - action:^{ - menu->navigation.selection_ptr = i; - if (cbs && cbs->action_ok) - cbs->action_ok(path, entry_label, type, i); - else - { - if (cbs && cbs->action_start) - cbs->action_start(type, entry_label, MENU_ACTION_START); - if (cbs && cbs->action_toggle) - cbs->action_toggle(type, entry_label, MENU_ACTION_RIGHT, true); - menu_list_push_stack(menu->menu_list, "", - "info_screen", 0, i); - } + if (cbs && cbs->action_get_representation) + cbs->action_get_representation + (menu->menu_list->selection_buf, + &w, type, i, label, + type_str, sizeof(type_str), + entry_label, path, + path_buf, sizeof(path_buf)); - [weakSelf menuRefresh]; - [weakSelf reloadData]; - }]]; - } + if (setting && setting->type == ST_ACTION && + setting->flags & SD_FLAG_BROWSER_ACTION && + setting->action_toggle && + setting->change_handler ) + { + [everything + addObject: + [[RAMenuItemPathSetting alloc] + initWithSetting:setting + action:^{}]]; + } + else if (setting && ST_ACTION < setting->type && setting->type < ST_GROUP) + { + [everything + addObject: + [RAMenuItemGeneralSetting + itemForSetting:setting + action:^{ + menu->navigation.selection_ptr = i; + if (cbs && cbs->action_ok) + cbs->action_ok(path, entry_label, type, i); + }]]; + } + else + { + [everything + addObject: + [RAMenuItemBasic + itemWithDescription:BOXSTRING(path_buf) + action:^{ + menu->navigation.selection_ptr = i; + if (cbs && cbs->action_ok) + cbs->action_ok(path, entry_label, type, i); + else + { + if (cbs && cbs->action_start) + cbs->action_start(type, entry_label, MENU_ACTION_START); + if (cbs && cbs->action_toggle) + cbs->action_toggle(type, entry_label, MENU_ACTION_RIGHT, true); + menu_list_push_stack(menu->menu_list, "", + "info_screen", 0, i); + } + + [weakSelf menuRefresh]; + [weakSelf reloadData]; + }]]; + } } - + [self.sections addObject:everything]; if (menu_list_get_stack_size(menu->menu_list) > 1) - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Back") style:UIBarButtonItemStyleBordered target:weakSelf action:@selector(menuBack)]; + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Back") style:UIBarButtonItemStyleBordered target:weakSelf action:@selector(menuBack)]; else - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Resume") style:UIBarButtonItemStyleBordered target:[RetroArch_iOS get] action:@selector(showGameView)]; + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:BOXSTRING("Resume") style:UIBarButtonItemStyleBordered target:[RetroArch_iOS get] action:@selector(showGameView)]; if ( menu->message_contents[0] != '\0' ) - apple_display_alert(menu->message_contents, NULL); + apple_display_alert(menu->message_contents, NULL); } - (void)menuRefresh { - menu_handle_t *menu = menu_driver_get_ptr(); - if (!menu) - return; - if (!menu->need_refresh) - return; - - menu_entries_deferred_push(menu->menu_list->selection_buf, - menu->menu_list->menu_stack); - menu->need_refresh = false; + menu_handle_t *menu = menu_driver_get_ptr(); + if (!menu) + return; + if (!menu->need_refresh) + return; + + menu_entries_deferred_push(menu->menu_list->selection_buf, + menu->menu_list->menu_stack); + menu->need_refresh = false; } - (void)menuBack @@ -899,11 +905,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) return; - - menu_apply_deferred_settings(); - menu_list_pop_stack(menu->menu_list); - [self menuRefresh]; - [self reloadData]; + + menu_apply_deferred_settings(); + menu_list_pop_stack(menu->menu_list); + [self menuRefresh]; + [self reloadData]; } @end