(iOS) Remove the Settings button on the top bar if a settings view controller is present in the backstack (prevents recursive opening of settings menu)
This commit is contained in:
parent
542a6b0385
commit
d67fc02b26
|
@ -208,6 +208,7 @@ static void event_reload_config(void* userdata)
|
||||||
bool _isGameTop;
|
bool _isGameTop;
|
||||||
bool _isPaused;
|
bool _isPaused;
|
||||||
bool _isRunning;
|
bool _isRunning;
|
||||||
|
uint32_t _settingMenusInBackStack;
|
||||||
|
|
||||||
RAModuleInfo* _module;
|
RAModuleInfo* _module;
|
||||||
}
|
}
|
||||||
|
@ -268,11 +269,17 @@ static void event_reload_config(void* userdata)
|
||||||
// UINavigationController: Never animate when pushing onto, or popping, an RAGameView
|
// UINavigationController: Never animate when pushing onto, or popping, an RAGameView
|
||||||
- (void)pushViewController:(UIViewController*)theView animated:(BOOL)animated
|
- (void)pushViewController:(UIViewController*)theView animated:(BOOL)animated
|
||||||
{
|
{
|
||||||
|
if ([theView respondsToSelector:@selector(isSettingsView)] && [(id)theView isSettingsView])
|
||||||
|
_settingMenusInBackStack ++;
|
||||||
|
|
||||||
[super pushViewController:theView animated:animated && !_isGameTop];
|
[super pushViewController:theView animated:animated && !_isGameTop];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIViewController*)popViewControllerAnimated:(BOOL)animated
|
- (UIViewController*)popViewControllerAnimated:(BOOL)animated
|
||||||
{
|
{
|
||||||
|
if ([self.topViewController respondsToSelector:@selector(isSettingsView)] && [(id)self.topViewController isSettingsView])
|
||||||
|
_settingMenusInBackStack --;
|
||||||
|
|
||||||
return [super popViewControllerAnimated:animated && !_isGameTop];
|
return [super popViewControllerAnimated:animated && !_isGameTop];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,11 +370,15 @@ static void event_reload_config(void* userdata)
|
||||||
#pragma mark PAUSE MENU
|
#pragma mark PAUSE MENU
|
||||||
- (UIBarButtonItem*)createSettingsButton
|
- (UIBarButtonItem*)createSettingsButton
|
||||||
{
|
{
|
||||||
return [[UIBarButtonItem alloc]
|
if (_settingMenusInBackStack == 0)
|
||||||
initWithTitle:@"Settings"
|
return [[UIBarButtonItem alloc]
|
||||||
style:UIBarButtonItemStyleBordered
|
initWithTitle:@"Settings"
|
||||||
target:[RetroArch_iOS get]
|
style:UIBarButtonItemStyleBordered
|
||||||
action:@selector(showSystemSettings)];
|
target:[RetroArch_iOS get]
|
||||||
|
action:@selector(showSystemSettings)];
|
||||||
|
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)showPauseMenu:(id)sender
|
- (IBAction)showPauseMenu:(id)sender
|
||||||
|
|
|
@ -50,6 +50,8 @@ enum SettingTypes
|
||||||
- (id)initWithSettings:(NSArray*)values title:(NSString*)title;
|
- (id)initWithSettings:(NSArray*)values title:(NSString*)title;
|
||||||
- (void)handleCustomAction:(NSString*)action withUserData:(id)data;
|
- (void)handleCustomAction:(NSString*)action withUserData:(id)data;
|
||||||
- (void)writeSettings:(NSArray*)settingList toConfig:(config_file_t*)config;
|
- (void)writeSettings:(NSArray*)settingList toConfig:(config_file_t*)config;
|
||||||
|
|
||||||
|
- (bool)isSettingsView;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface RASettingsList : RASettingsSubList
|
@interface RASettingsList : RASettingsSubList
|
||||||
|
|
|
@ -348,6 +348,11 @@ static RASettingData* custom_action(NSString* action, id data)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (bool)isSettingsView
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)handleCustomAction:(NSString*)action withUserData:(id)data
|
- (void)handleCustomAction:(NSString*)action withUserData:(id)data
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue