Skip to content

Commit

Permalink
Merge pull request #292 from ToddLa/settings-gardening
Browse files Browse the repository at this point in the history
Settings Gardening
  • Loading branch information
yoshisuga authored Mar 7, 2021
2 parents 3a0d08e + cf2ba0c commit 5600ced
Show file tree
Hide file tree
Showing 24 changed files with 174 additions and 1,125 deletions.
52 changes: 17 additions & 35 deletions iOS-res/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,24 @@ The emulator controls are the following ones:
- **Nearest** Dont appy any filtering, aka `FatBits`
- **Linear** Apply a smoothing image filter over the emulator screen.

**Border** a border that will surround the emulator screen.
- **Light** - a bright thick border
- **Dark** - a think dark border
- **Solid** - a blue solid border, with rounded corners.
**Skin** choose the artwork and layout of the onscreen controlls.
- **Default** - the default MAME4iOS look.
- **Light Border** - Default + a bright thick border
- **Dark Border** - Default + a think dark border
- **Classic** - the old MAME4iOS look.

**Screen Shader** effect to apply to the emulator screen.
- **None** dont use any effect.
- **Default** use the default `simpleTron`.
- **simpleTron** simple CRT effect.
- **megaTron** more advanced CRT effect.
- **ulTron** even more advanced CRT effect.

**Vector Shader** effect to apply to vector games.
- **None** dont use any effect.
- **Default** use the default `lineTron`.
- **lineTron** simple vector effect with fade out.

**Effects** a cool/retro effect to apply to the emulator screen.
- **CRT** Apply a CRT like filter over the image.
- **Scanline** Apply a scanline filter over the image.

**Colorspace** the [color space](https://en.wikipedia.org/wiki/Color_space) to use.
- **DeviceRGB** just use the color space of the device.
Expand Down Expand Up @@ -129,40 +139,14 @@ The emulator controls are the following ones:

**Cheats** Enables the reading of the cheat database, if present, and the Cheat menu in the user interface.

**Force 60hz sync** If enabled, forces 60Hz video emulatiob for smoother gameplay in some games (use with caution since it could broke other games like cave ones).

**Save Hiscores** If enabled, saves hiscores on some games not saving on NVRAM. It could cause problems with some games or save states.

**Native TV-OUT** If you want native iOS TVOUT mirror or you use and external 3rd party TVOUT app, you can turn off MAME4iOS native TVOUT.

**Threaded video** Enable video threading for better performance on multicore devices.

**Video Thread Priority** Sets the video thread priority if video thread is also enabled.

**Double buffer** Avoids flickering.

**Main Thread Priority** Sets the main thread priority.

**Show FPS** Shows ON/OFF fps.

**Emulated Resolution** Force MAME internal drawing resolution, use hires resolution to improve artwork rendering at the expense of performance.

**Throttle** Configures the default thottling setting. When throttling is on, MAME attempts to keep the game running at the game's intended speed. When throttling is off, MAME runs the game as fast as it can.

**Frame Skip** Specifies the frameskip value. This is the number of frames out of every 12 to drop when running. For example, if you say -frameskip 2,then MAME will display 10 out of every 12 frames. By skipping those frames, you may be able to get full speed in a game that requires more horsepower than your device has. The default value is autoframekip that Automatically determines the frameskip level while you're playing the game, adjusting it constantly in a frantic attempt to keep the game running at full speed.

**Force Pixel Aspect** Enable it to force pixel aspect ratio bypassing MAME video selection.

**Sleep on idle** Allows MAME to give time back to the system (sleep) when running with -throttle. This allows other programs to have some CPU time, assuming that the game isn't taxing 100% of your CPU resources. This option can potentially cause hiccups in performance if other demanding programs are running.

**Show Info/Warnings** Shows Game Info and any warnings when a game is selected.

**Low Latency Audio** Uses no queues (AudioUnit) to play audio with low latency.

**Native TV-OUT** If you want native iOS TVOUT mirror or you use and external 3rd party TVOUT app, you can turn off MAME4iOS native TVOUT.

**Overscan TV-OUT** You can set the amount of TV overscan correction.

## FAVORITES

You can mark (or unmark) your ROMS in the MAME4iOS game selection window as favorites by long pressing to get a context menu.
Expand Down Expand Up @@ -233,8 +217,6 @@ we suppoprt a small subset of the keys supported by the command line MAME.
⌘+Z | TOGGLE FPS DISPLAY
⌘+H | TOGGLE HUD DISPLAY
⌘+F | TOGGLE FILTER (Nearest and Linear)
⌘+T | TOGGLE THROTTLE
⌘+V | TOGGLE VSYNC
⌘+P | TOGGLE PAUSE
⌘+A | TOGGLE `Keep Aspect Ratio`
⌘+X | TOGGLE `Force Pixel Aspect`
Expand Down
13 changes: 5 additions & 8 deletions iOS/Bootstrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
externalWindow = [[UIWindow alloc] initWithFrame:CGRectZero];
externalWindow.hidden = YES;

if(g_pref_nativeTVOUT)
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(prepareScreen) name:UIScreenDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(prepareScreen) name:UIScreenDidDisconnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateScreen) name:UIScreenModeDidChangeNotification object:nil];
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(prepareScreen) name:UIScreenDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(prepareScreen) name:UIScreenDidDisconnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateScreen) name:UIScreenModeDidChangeNotification object:nil];

[self prepareScreen];
#endif
Expand Down Expand Up @@ -284,7 +281,7 @@ - (void)prepareScreen
return;
}

if ([[UIScreen screens] count] > 1 && g_pref_nativeTVOUT) {
if ([[UIScreen screens] count] > 1) {

// Internal display is 0, external is 1.
UIScreen* externalScreen = [[UIScreen screens] objectAtIndex:1];
Expand Down Expand Up @@ -328,7 +325,7 @@ - (void)setupScreen:(UIScreen*)screen
{
if (screen != nil)
{
[screen setOverscanCompensation:UIScreenOverscanCompensationNone];
[screen setOverscanCompensation:UIScreenOverscanCompensationInsetBounds];
[externalWindow setScreen:screen];

for (UIView *view in externalWindow.subviews)
Expand Down
67 changes: 1 addition & 66 deletions iOS/EmulatorController.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ -(GCControllerButtonInput*)buttonOptionsSafe {return [self respondsToSelector:@s
NSString* g_pref_skin;
NSString* g_pref_colorspace;

int g_pref_metal = 0;
int g_pref_integer_scale_only = 0;
int g_pref_showFPS = 0;

Expand Down Expand Up @@ -175,9 +174,6 @@ -(GCControllerButtonInput*)buttonOptionsSafe {return [self respondsToSelector:@s

int g_pref_nintendoBAYX = 0;

int g_pref_nativeTVOUT = 1;
int g_pref_overscanTVOUT = 1;

int g_pref_lightgun_enabled = 1;
int g_pref_lightgun_bottom_reload = 0;

Expand All @@ -193,8 +189,6 @@ -(GCControllerButtonInput*)buttonOptionsSafe {return [self respondsToSelector:@s
float g_buttons_size = 1.0f;
float g_stick_size = 1.0f;

int global_low_latency_sound = 0;

int prev_myosd_light_gun = 0;
int prev_myosd_mouse = 0;

Expand Down Expand Up @@ -713,6 +707,7 @@ - (void)runMenu:(int)player from:(UIView*)view
}
}
[menu addAction:[UIAlertAction actionWithTitle:@"Settings" style:UIAlertActionStyleDefault image:[UIImage systemImageNamed:@"gear" withPointSize:size] handler:^(UIAlertAction* action) {
[self hideMenuHUD];
[self runSettings];
}]];

Expand Down Expand Up @@ -917,7 +912,6 @@ -(void)updateOptions{
[skinManager setCurrentSkin:g_pref_skin];

g_pref_integer_scale_only = op.integerScalingOnly;
g_pref_metal = TRUE;
g_pref_showFPS = [op showFPS];
g_pref_showHUD = [op showHUD];

Expand All @@ -929,9 +923,6 @@ -(void)updateOptions{

myosd_pxasp1 = [op p1aspx];

g_pref_nativeTVOUT = [op tvoutNative];
g_pref_overscanTVOUT = [op overscanValue];

g_pref_input_touch_type = [op touchtype];
g_pref_analog_DZ_value = [op analogDeadZoneValue];
g_pref_ext_control_type = [op controltype];
Expand All @@ -946,12 +937,8 @@ -(void)updateOptions{
default:myosd_sound_value=-1;}


myosd_throttle = [op throttle];
myosd_cheat = [op cheats];
myosd_vsync = [op vsync] == 1 ? 6000 : -1;

myosd_sleep = [op sleep];

g_pref_nintendoBAYX = [op nintendoBAYX];

g_pref_full_num_buttons = [op numbuttons] - 1; // -1 == Auto
Expand Down Expand Up @@ -986,24 +973,11 @@ -(void)updateOptions{
myosd_waysStick = 8;
}

if([op fsvalue] == 0)
{
myosd_frameskip_value = -1;
}
else
{
myosd_frameskip_value = [op fsvalue]-1;
}

myosd_force_pxaspect = [op forcepxa];

myosd_res = [op emures]+1;

myosd_filter_clones = op.filterClones;
myosd_filter_not_working = op.filterNotWorking;

global_low_latency_sound = [op lowlsound];

myosd_autofire = [op autofire];
myosd_hiscore = [op hiscore];

Expand Down Expand Up @@ -1053,13 +1027,6 @@ -(void)updateOptions{
turboBtnEnabled[BTN_L1] = [op turboLEnabled];
turboBtnEnabled[BTN_R1] = [op turboREnabled];

// ignore some settings in the Metal case
if (g_pref_metal && [MetalScreenView isSupported]) {
myosd_sleep = 1; // sleep to let Metal get work done.
myosd_vsync = -1; // dont force 60Hz, just use the machine value, let MAME frameskip do what it can.
myosd_frameskip_value = -1; // AUTO frameskip
}

#if TARGET_OS_IOS
g_pref_lightgun_enabled = [op lightgunEnabled];
g_pref_lightgun_bottom_reload = [op lightgunBottomScreenReload];
Expand All @@ -1081,23 +1048,11 @@ -(void)updateOptions{
// DONE button on Settings dialog
-(void)done:(id)sender {

Options *op = [[Options alloc] init];

// have the parent of the options/setting dialog dismiss
// we present settings two ways, from in-game menu (we are parent) and from ChooseGameUI (it is the parent)
UIViewController* parent = self.topViewController.presentingViewController;
[(parent ?: self) dismissViewControllerAnimated:YES completion:^{

if(global_low_latency_sound != [op lowlsound])
{
if(myosd_sound_value!=-1)
{
myosd_closeSound();
global_low_latency_sound = [op lowlsound];
myosd_openSound(myosd_sound_value, 1);
}
}

// if we are at the root menu, exit and restart.
if (myosd_inGame == 0 || g_mame_reset)
myosd_exitGame = 1;
Expand Down Expand Up @@ -2594,23 +2549,11 @@ - (void)buildScreenView {
[self setNeedsUpdateOfHomeIndicatorAutoHidden];

if (externalView != nil)
{
r = externalView.window.screen.bounds;

CGFloat overscan = (g_pref_overscanTVOUT * 0.025f);
CGFloat overscan_x = ceil(r.size.width * overscan / 2.0);
CGFloat overscan_y = ceil(r.size.height * overscan / 2.0);

r = CGRectInset(r, overscan_x, overscan_y);
}
else if (g_device_is_fullscreen)
{
r = rFrames[g_device_is_landscape ? LANDSCAPE_VIEW_FULL : PORTRAIT_VIEW_FULL];
}
else
{
r = rFrames[g_device_is_landscape ? LANDSCAPE_VIEW_NOT_FULL : PORTRAIT_VIEW_NOT_FULL];
}

// Handle Safe Area (iPhone X and above) adjust the view down away from the notch, before adjusting for aspect
if ( externalView == nil ) {
Expand Down Expand Up @@ -2952,10 +2895,6 @@ -(void)commandKey:(char)key {
[self changeUI];
break;
}
case 'T':
myosd_throttle = !myosd_throttle;
[self changeUI];
break;
case 'X':
myosd_force_pxaspect = !myosd_force_pxaspect;
[self changeUI];
Expand Down Expand Up @@ -3879,9 +3818,6 @@ -(void)moveROMS {
// tell the SkinManager new files have arived.
[self->skinManager reload];

// reset MAME last game selected...
myosd_last_game_selected = 0;

// reload the MAME menu....
[self reload];

Expand Down Expand Up @@ -4529,7 +4465,6 @@ -(void)showControllerHUD:(GCController*)controller {

NSString* title = [NSString stringWithFormat:@":%@:%@", menu.unmappedSfSymbolsName ?: @"line.horizontal.3.circle", name];
UIImage* image = [UIImage imageWithString:title withFont:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]];
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[g_menuHUD addImage:image];
[g_menuHUD addSeparator];

Expand Down
2 changes: 0 additions & 2 deletions iOS/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ extern int g_pref_analog_DZ_value;
extern int g_pref_input_touch_type;
extern int g_pref_ext_control_type;
extern int g_pref_nintendoBAYX;
extern int g_pref_nativeTVOUT;
extern int g_pref_overscanTVOUT;

extern float g_buttons_size;
extern float g_stick_size;
Expand Down
24 changes: 9 additions & 15 deletions iOS/InputOptionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -527,50 +527,45 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

NSUInteger row = [indexPath row];
NSUInteger section = [indexPath section];
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];

if(section==1 && row==0)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped type:kTypeTouchType list:arrayTouchType];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"touchtype" list:arrayTouchType title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}
if(section==1 && row==1)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeStickType list:arrayStickType];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"sticktype" list:arrayStickType title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}
if(section==1 && row==2)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeStickSizeValue list:arrayStickSizeValue];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"stickSize" list:arrayStickSizeValue title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}


if(section==2 && row==0)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeNumButtons list:arrayNumbuttons];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"numbuttons" list:arrayNumbuttons title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}
if(section==2 && row==2)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeAutofireValue list:arrayAutofireValue];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"autofire" list:arrayAutofireValue title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}

if(section==2 && row==3)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeButtonSizeValue list:arrayButtonSizeValue];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"buttonSize" list:arrayButtonSizeValue title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}

if(section==3 && row==0)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeControlType list:Options.arrayControlType];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"controltype" list:Options.arrayControlType title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}

Expand All @@ -586,8 +581,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

if(section==6 && row==0)
{
ListOptionController *listController = [[ListOptionController alloc] initWithStyle:UITableViewStyleGrouped
type:kTypeAnalogDZValue list:arrayAnalogDZValue];
ListOptionController *listController = [[ListOptionController alloc] initWithKey:@"analogDeadZoneValue" list:arrayAnalogDZValue title:cell.textLabel.text];
[[self navigationController] pushViewController:listController animated:YES];
}

Expand Down
5 changes: 0 additions & 5 deletions iOS/ListOptionController.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,9 @@ NS_ASSUME_NONNULL_BEGIN

@interface ListOptionController : OptionsTableViewController

- (instancetype)initWithType:(NSInteger)typeValue list:(NSArray<NSString*> *)listValue;

- (instancetype)initWithKey:(NSString*)keyValue list:(NSArray<NSString*>*)listValue;
- (instancetype)initWithKey:(NSString*)keyValue list:(NSArray<NSString*>*)listValue title:(NSString*)titleValue;

// old code is calling this, use just initWithType:list: or initWithKey:list: instead
- (instancetype)initWithStyle:(UITableViewStyle)style type:(NSInteger)typeValue list:(NSArray<NSString*>*)listValue;

@end

NS_ASSUME_NONNULL_END
Expand Down
Loading

0 comments on commit 5600ced

Please sign in to comment.