mirror of
https://github.com/libretro/RetroArch
synced 2025-02-24 18:39:59 +00:00
Ensuring that overlays... and maybe other things... have their settings take place immediately
This commit is contained in:
parent
ace60b5827
commit
589e6ccde1
@ -65,9 +65,10 @@
|
|||||||
/*********************************************/
|
/*********************************************/
|
||||||
@interface RAMenuItemGeneralSetting : NSObject<RAMenuItemBase>
|
@interface RAMenuItemGeneralSetting : NSObject<RAMenuItemBase>
|
||||||
@property (nonatomic) rarch_setting_t* setting;
|
@property (nonatomic) rarch_setting_t* setting;
|
||||||
|
@property (copy) void (^action)();
|
||||||
@property (nonatomic, weak) UITableView* parentTable;
|
@property (nonatomic, weak) UITableView* parentTable;
|
||||||
+ (id)itemForSetting:(rarch_setting_t*)setting;
|
+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action;
|
||||||
- (id)initWithSetting:(rarch_setting_t*)setting;
|
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
@ -78,7 +79,8 @@
|
|||||||
/*********************************************/
|
/*********************************************/
|
||||||
@interface RAMenuItemBooleanSetting : NSObject<RAMenuItemBase>
|
@interface RAMenuItemBooleanSetting : NSObject<RAMenuItemBase>
|
||||||
@property (nonatomic) rarch_setting_t* setting;
|
@property (nonatomic) rarch_setting_t* setting;
|
||||||
- (id)initWithSetting:(rarch_setting_t*)setting;
|
@property (copy) void (^action)();
|
||||||
|
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
@ -199,7 +199,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
|
|
||||||
@implementation RAMenuItemGeneralSetting
|
@implementation RAMenuItemGeneralSetting
|
||||||
|
|
||||||
+ (id)itemForSetting:(rarch_setting_t*)setting
|
+ (id)itemForSetting:(rarch_setting_t*)setting action:(void (^)())action
|
||||||
{
|
{
|
||||||
switch (setting->type) {
|
switch (setting->type) {
|
||||||
case ST_NONE:
|
case ST_NONE:
|
||||||
@ -207,19 +207,19 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
return [RAMenuItemBasic itemWithDescription:BOXSTRING("Shouldn't be called with ST_NONE or ST_ACTION")
|
return [RAMenuItemBasic itemWithDescription:BOXSTRING("Shouldn't be called with ST_NONE or ST_ACTION")
|
||||||
action:^{}];
|
action:^{}];
|
||||||
case ST_BOOL:
|
case ST_BOOL:
|
||||||
return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting];
|
return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting action:action];
|
||||||
case ST_INT:
|
case ST_INT:
|
||||||
case ST_UINT:
|
case ST_UINT:
|
||||||
case ST_FLOAT:
|
case ST_FLOAT:
|
||||||
break;
|
break;
|
||||||
case ST_PATH:
|
case ST_PATH:
|
||||||
case ST_DIR:
|
case ST_DIR:
|
||||||
return [[RAMenuItemPathSetting alloc] initWithSetting:setting];
|
return [[RAMenuItemPathSetting alloc] initWithSetting:setting action:action];
|
||||||
case ST_STRING:
|
case ST_STRING:
|
||||||
case ST_HEX:
|
case ST_HEX:
|
||||||
break;
|
break;
|
||||||
case ST_BIND:
|
case ST_BIND:
|
||||||
return [[RAMenuItemBindSetting alloc] initWithSetting:setting];
|
return [[RAMenuItemBindSetting alloc] initWithSetting:setting action:action];
|
||||||
case ST_GROUP:
|
case ST_GROUP:
|
||||||
case ST_SUB_GROUP:
|
case ST_SUB_GROUP:
|
||||||
case ST_END_GROUP:
|
case ST_END_GROUP:
|
||||||
@ -230,9 +230,9 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setting->type == ST_STRING && setting->values)
|
if (setting->type == ST_STRING && setting->values)
|
||||||
return [[RAMenuItemEnumSetting alloc] initWithSetting:setting];
|
return [[RAMenuItemEnumSetting alloc] initWithSetting:setting action:action];
|
||||||
|
|
||||||
RAMenuItemGeneralSetting* item = [[RAMenuItemGeneralSetting alloc] initWithSetting:setting];
|
RAMenuItemGeneralSetting* item = [[RAMenuItemGeneralSetting alloc] initWithSetting:setting action:action];
|
||||||
|
|
||||||
if (item.setting->type == ST_INT ||
|
if (item.setting->type == ST_INT ||
|
||||||
item.setting->type == ST_UINT ||
|
item.setting->type == ST_UINT ||
|
||||||
@ -242,11 +242,13 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithSetting:(rarch_setting_t*)setting
|
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
if ((self = [super init])) {
|
||||||
_setting = setting;
|
_setting = setting;
|
||||||
return self;
|
_action = action;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UITableViewCell*)cellForTableView:(UITableView*)tableView
|
- (UITableViewCell*)cellForTableView:(UITableView*)tableView
|
||||||
@ -358,10 +360,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
/*********************************************/
|
/*********************************************/
|
||||||
@implementation RAMenuItemBooleanSetting
|
@implementation RAMenuItemBooleanSetting
|
||||||
|
|
||||||
- (id)initWithSetting:(rarch_setting_t*)setting
|
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
if ((self = [super init])) {
|
||||||
_setting = setting;
|
_setting = setting;
|
||||||
|
_action = action;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,8 +392,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
|
|
||||||
- (void)handleBooleanSwitch:(UISwitch*)swt
|
- (void)handleBooleanSwitch:(UISwitch*)swt
|
||||||
{
|
{
|
||||||
if (self.setting)
|
if (self.setting) {
|
||||||
*self.setting->value.boolean = swt.on ? true : false;
|
*self.setting->value.boolean = swt.on ? true : false;
|
||||||
|
}
|
||||||
|
if (self.action) {
|
||||||
|
self.action();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller
|
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller
|
||||||
@ -431,6 +439,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
|
|
||||||
setting_data_set_with_string_representation(weakSelf.setting, newval);
|
setting_data_set_with_string_representation(weakSelf.setting, newval);
|
||||||
[[list navigationController] popViewControllerAnimated:YES];
|
[[list navigationController] popViewControllerAnimated:YES];
|
||||||
|
|
||||||
|
weakSelf.action();
|
||||||
|
|
||||||
[weakSelf.parentTable reloadData];
|
[weakSelf.parentTable reloadData];
|
||||||
}];
|
}];
|
||||||
@ -627,7 +637,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
|||||||
path_buf, sizeof(path_buf));
|
path_buf, sizeof(path_buf));
|
||||||
|
|
||||||
if (setting && ST_ACTION < setting->type && setting->type < ST_GROUP)
|
if (setting && ST_ACTION < setting->type && setting->type < ST_GROUP)
|
||||||
[everything addObject:[RAMenuItemGeneralSetting itemForSetting:setting]];
|
[everything addObject:
|
||||||
|
[RAMenuItemGeneralSetting
|
||||||
|
itemForSetting:setting
|
||||||
|
action:^{
|
||||||
|
driver.menu->selection_ptr = i;
|
||||||
|
if (cbs && cbs->action_ok)
|
||||||
|
cbs->action_ok(path, entry_label, type, i);
|
||||||
|
}]];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[everything addObject:
|
[everything addObject:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user