2016-01-07 19:48:21 -05:00
|
|
|
#import "SettingsViewController.h"
|
2019-04-08 20:27:54 -04:00
|
|
|
#import "ResolutionFactorSelectorViewController.h"
|
2016-01-07 19:48:21 -05:00
|
|
|
#include "../AppConfig.h"
|
|
|
|
#include "PreferenceDefs.h"
|
2017-02-11 19:34:36 -05:00
|
|
|
#include "../gs/GSH_OpenGL/GSH_OpenGL.h"
|
2016-01-07 19:48:21 -05:00
|
|
|
|
|
|
|
@implementation SettingsViewController
|
|
|
|
|
2019-04-08 20:27:54 -04:00
|
|
|
-(void)updateResolutionFactorLabel
|
|
|
|
{
|
|
|
|
int factor = CAppConfig::GetInstance().GetPreferenceInteger(PREF_CGSH_OPENGL_RESOLUTION_FACTOR);
|
|
|
|
[resolutionFactor setText: [NSString stringWithFormat: @"%dx", factor]];
|
|
|
|
}
|
|
|
|
|
2016-01-07 19:48:21 -05:00
|
|
|
-(void)viewDidLoad
|
|
|
|
{
|
|
|
|
[showFpsSwitch setOn: CAppConfig::GetInstance().GetPreferenceBoolean(PREFERENCE_UI_SHOWFPS)];
|
|
|
|
[showVirtualPadSwitch setOn: CAppConfig::GetInstance().GetPreferenceBoolean(PREFERENCE_UI_SHOWVIRTUALPAD)];
|
2016-01-08 10:16:11 -05:00
|
|
|
|
2019-04-08 20:27:54 -04:00
|
|
|
[self updateResolutionFactorLabel];
|
2016-01-19 10:32:11 -05:00
|
|
|
[forceBilinearFiltering setOn: CAppConfig::GetInstance().GetPreferenceBoolean(PREF_CGSH_OPENGL_FORCEBILINEARTEXTURES)];
|
|
|
|
|
2016-04-04 12:14:23 -04:00
|
|
|
[enableAudioOutput setOn: CAppConfig::GetInstance().GetPreferenceBoolean(PREFERENCE_AUDIO_ENABLEOUTPUT)];
|
|
|
|
|
2019-04-08 19:59:16 -04:00
|
|
|
NSString* versionString = [NSString stringWithFormat: @"%s - %s", PLAY_VERSION, __DATE__];
|
2016-01-08 10:16:11 -05:00
|
|
|
versionInfoLabel.text = versionString;
|
2016-01-07 19:48:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
-(void)viewDidDisappear: (BOOL)animated
|
|
|
|
{
|
|
|
|
CAppConfig::GetInstance().SetPreferenceBoolean(PREFERENCE_UI_SHOWFPS, showFpsSwitch.isOn);
|
|
|
|
CAppConfig::GetInstance().SetPreferenceBoolean(PREFERENCE_UI_SHOWVIRTUALPAD, showVirtualPadSwitch.isOn);
|
|
|
|
|
2016-01-19 10:32:11 -05:00
|
|
|
CAppConfig::GetInstance().SetPreferenceBoolean(PREF_CGSH_OPENGL_FORCEBILINEARTEXTURES, forceBilinearFiltering.isOn);
|
|
|
|
|
2016-04-04 12:14:23 -04:00
|
|
|
CAppConfig::GetInstance().SetPreferenceBoolean(PREFERENCE_AUDIO_ENABLEOUTPUT, enableAudioOutput.isOn);
|
|
|
|
|
2016-01-07 19:48:21 -05:00
|
|
|
CAppConfig::GetInstance().Save();
|
|
|
|
}
|
|
|
|
|
2019-04-08 20:27:54 -04:00
|
|
|
-(void)tableView: (UITableView*)tableView didSelectRowAtIndexPath: (NSIndexPath*)indexPath
|
|
|
|
{
|
|
|
|
[tableView deselectRowAtIndexPath: indexPath animated: YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)prepareForSegue: (UIStoryboardSegue*)segue sender: (id)sender
|
|
|
|
{
|
|
|
|
if([segue.destinationViewController isKindOfClass: [ResolutionFactorSelectorViewController class]])
|
|
|
|
{
|
|
|
|
ResolutionFactorSelectorViewController* selector = (ResolutionFactorSelectorViewController*)segue.destinationViewController;
|
|
|
|
selector.factor = CAppConfig::GetInstance().GetPreferenceInteger(PREF_CGSH_OPENGL_RESOLUTION_FACTOR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-(IBAction)returnToSettings: (UIStoryboardSegue*)segue
|
|
|
|
{
|
|
|
|
if([segue.sourceViewController isKindOfClass: [ResolutionFactorSelectorViewController class]])
|
|
|
|
{
|
|
|
|
ResolutionFactorSelectorViewController* selector = (ResolutionFactorSelectorViewController*)segue.sourceViewController;
|
|
|
|
CAppConfig::GetInstance().SetPreferenceInteger(PREF_CGSH_OPENGL_RESOLUTION_FACTOR, selector.factor);
|
|
|
|
[self updateResolutionFactorLabel];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-07 19:48:21 -05:00
|
|
|
@end
|