Permalink
Browse files

Cocoa Port: The Vertical Sync setting has been removed -- it is now a…

…utomatically set.

- New behavior for layer-backed views (OpenGL on Mountain Lion and
later, or Metal): Vertical Sync is always enabled.
- New behavior for non-layer-backed views (OpenGL on Lion and earlier):
Vertical Sync is only enabled if frameskip is enabled or if the
execution speed is set to 1x or less while the speed limiter is engaged.
- Remove all associated UI for manually setting Vertical Sync.
- Also add a new menu option to the Tools menu for disabling Metal,
instead forcing display views to use OpenGL. (For developer builds
only.)
  • Loading branch information...
rogerman committed Jul 19, 2017
1 parent ddac712 commit e7f1737bdbb80358a06dde06e0d5da1e07d121a5
@@ -12,6 +12,8 @@
<true/>
<key>CoreControl_SpeedScalar</key>
<real>1</real>
<key>Debug_DisableMetal</key>
<false/>
<key>Debug_GDBStubEnableARM9</key>
<false/>
<key>Debug_GDBStubEnableARM7</key>
@@ -38,8 +40,6 @@
<integer>100</integer>
<key>DisplayView_UseBilinearOutput</key>
<true/>
<key>DisplayView_UseVerticalSync</key>
<false/>
<key>DisplayView_VideoFilter</key>
<integer>0</integer>
<key>DisplayViewCombo_Gap</key>
@@ -90,8 +90,6 @@
<dict/>
<key>General_AutoloadROMOption</key>
<integer>10000</integer>
<key>General_DisplayViewsPreferMetal</key>
<true/>
<key>General_DisplayWindowRestorableStates</key>
<array/>
<key>General_DoNotAskMigrate</key>
@@ -155,7 +155,7 @@ - (id)init
fetchObject = NULL;
#ifdef ENABLE_APPLE_METAL
if (IsOSXVersionSupported(10, 11, 0) && [[NSUserDefaults standardUserDefaults] boolForKey:@"General_DisplayViewsPreferMetal"])
if (IsOSXVersionSupported(10, 11, 0) && ![[NSUserDefaults standardUserDefaults] boolForKey:@"Debug_DisableMetal"])
{
fetchObject = new MacMetalFetchObject;

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -537,8 +537,6 @@ - (void) setupUserDefaults
outputFilter:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"]
pixelScaler:[[NSUserDefaults standardUserDefaults] integerForKey:@"DisplayView_OutputFilter"]];
[[self view] setUseVerticalSync:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_UseVerticalSync"]];
[[self view] setIsHUDVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_EnableHUD"]];
[[self view] setIsHUDVideoFPSVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowVideoFPS"]];
[[self view] setIsHUDRender3DFPSVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRender3DFPS"]];
@@ -977,11 +975,6 @@ - (IBAction) changeDisplayGap:(id)sender
[self setDisplayGap:(double)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0];
}
- (IBAction) toggleVerticalSync:(id)sender
{
[[self view] setUseVerticalSync:![[self view] useVerticalSync]];
}
- (IBAction) toggleVideoFiltersPreferGPU:(id)sender
{
[self setVideoFiltersPreferGPU:![self videoFiltersPreferGPU]];
@@ -1040,7 +1033,6 @@ - (IBAction) writeDefaultsDisplayVideoSettings:(id)sender
[[NSUserDefaults standardUserDefaults] setBool:[self videoSourceDeposterize] forKey:@"DisplayView_Deposterize"];
[[NSUserDefaults standardUserDefaults] setInteger:[self videoOutputFilter] forKey:@"DisplayView_OutputFilter"];
[[NSUserDefaults standardUserDefaults] setInteger:[self videoPixelScaler] forKey:@"DisplayView_VideoFilter"];
[[NSUserDefaults standardUserDefaults] setBool:[[self view] useVerticalSync] forKey:@"DisplayView_UseVerticalSync"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@@ -1156,13 +1148,6 @@ - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)theItem
enable = [[self view] canUseShaderBasedFilters];
}
else if (theAction == @selector(toggleVerticalSync:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem *)theItem setState:([[self view] useVerticalSync]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(toggleVideoFiltersPreferGPU:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
@@ -207,10 +207,13 @@ class AudioSampleBlockGenerator;
- (IBAction) toggleAllDisplays:(id)sender;
// Tools Menu
- (IBAction) autoholdSet:(id)sender;
- (IBAction) toggleGPUState:(id)sender;
- (IBAction) toggleGDBStubActivate:(id)sender;
- (IBAction) autoholdSet:(id)sender;
- (IBAction) autoholdClear:(id)sender;
- (IBAction) setVerticalSyncForNonLayerBackedViews:(id)sender;
- (IBAction) changeCoreSpeed:(id)sender;
- (IBAction) changeCoreEmuFlags:(id)sender;
- (IBAction) changeFirmwareSettings:(id)sender;
@@ -349,6 +349,11 @@ - (IBAction) newDisplayWindow:(id)sender
[newWindowController window]; // Just reference the window to force the nib to load.
[[newWindowController view] setAllowViewUpdates:YES];
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
const BOOL useVerticalSync = ([[newWindowController view] layer] != nil) || [cdsCore isFrameSkipEnabled] || (([cdsCore speedScalar] < 1.03f) && [cdsCore isSpeedLimitEnabled]);
[[newWindowController view] setUseVerticalSync:useVerticalSync];
[[newWindowController cdsVideoOutput] handleReloadReprocessRedraw];
[[newWindowController window] makeKeyAndOrderFront:self];
[[newWindowController window] makeMainWindow];
@@ -806,6 +811,8 @@ - (IBAction) changeCoreSpeed:(id)sender
const CGFloat newSpeedScalar = (CGFloat)[CocoaDSUtil getIBActionSenderTag:sender] / 100.0f;
[self changeCoreSpeedWithDouble:newSpeedScalar];
}
[self setVerticalSyncForNonLayerBackedViews:sender];
}
- (IBAction) changeCoreEmuFlags:(id)sender
@@ -903,6 +910,20 @@ - (IBAction) autoholdClear:(id)sender
[inputManager dispatchCommandUsingIBAction:_cmd sender:sender];
}
- (IBAction) setVerticalSyncForNonLayerBackedViews:(id)sender
{
if ( ([[(DisplayWindowController *)[windowList objectAtIndex:0] view] layer] == nil) && ([windowList count] > 0) )
{
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
const BOOL useVerticalSync = [cdsCore isFrameSkipEnabled] || (([cdsCore speedScalar] < 1.03f) && [cdsCore isSpeedLimitEnabled]);
for (DisplayWindowController *windowController in windowList)
{
[[windowController view] setUseVerticalSync:useVerticalSync];
}
}
}
- (IBAction) chooseSlot1R4Directory:(id)sender
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
@@ -1303,10 +1324,11 @@ - (void) cmdHoldToggleSpeedScalar:(NSValue *)cmdAttrValue
{
CommandAttributes cmdAttr;
[cmdAttrValue getValue:&cmdAttr];
const float speedScalar = (cmdAttr.useInputForScalar) ? cmdAttr.input.scalar : cmdAttr.floatValue[0];
const float inputSpeedScalar = (cmdAttr.useInputForScalar) ? cmdAttr.input.scalar : cmdAttr.floatValue[0];
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
[cdsCore setSpeedScalar:(cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) ? lastSetSpeedScalar : speedScalar];
[cdsCore setSpeedScalar:(cmdAttr.input.state == INPUT_ATTRIBUTE_STATE_OFF) ? lastSetSpeedScalar : inputSpeedScalar];
[self setVerticalSyncForNonLayerBackedViews:nil];
}
- (void) cmdToggleSpeedLimiter:(NSValue *)cmdAttrValue
@@ -1333,6 +1355,8 @@ - (void) cmdToggleSpeedLimiter:(NSValue *)cmdAttrValue
[self setStatusText:NSSTRING_STATUS_SPEED_LIMIT_ENABLED];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"CoreControl_EnableSpeedLimit"];
}
[self setVerticalSyncForNonLayerBackedViews:nil];
}
- (void) cmdToggleAutoFrameSkip:(NSValue *)cmdAttrValue
@@ -1359,6 +1383,8 @@ - (void) cmdToggleAutoFrameSkip:(NSValue *)cmdAttrValue
[self setStatusText:NSSTRING_STATUS_AUTO_FRAME_SKIP_ENABLED];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"CoreControl_EnableAutoFrameSkip"];
}
[self setVerticalSyncForNonLayerBackedViews:nil];
}
- (void) cmdToggleCheats:(NSValue *)cmdAttrValue

0 comments on commit e7f1737

Please sign in to comment.