Allow clock throttle to take over for audio / vsync throttles during fast forward or rewind for proper speed control.
This commit is contained in:
parent
f9da63d71d
commit
28f1ad1c0e
|
@ -18,9 +18,9 @@ namespace BizHawk.Client.Common
|
|||
public static MovieSession MovieSession = new MovieSession();
|
||||
|
||||
/// <summary>
|
||||
/// whether throttling is force-disabled by use of fast forward
|
||||
/// Used to disable secondary throttling (e.g. vsync, audio) for unthrottled modes or when the primary (clock) throttle is taking over (e.g. during fast forward/rewind).
|
||||
/// </summary>
|
||||
public static bool ForceNoThrottle;
|
||||
public static bool DisableSecondaryThrottling;
|
||||
|
||||
public static Controller NullControls;
|
||||
public static AutofireController AutofireNullControls;
|
||||
|
|
|
@ -633,7 +633,7 @@ TESTEROO:
|
|||
//maybe the user wants vsync, but not vsync throttle.
|
||||
//this makes sense... but we dont have the infrastructure to support it now (we'd have to enable triple buffering or something like that)
|
||||
//so what we're gonna do is disable vsync no matter what if throttling is off, and maybe nobody will notice.
|
||||
if (Global.ForceNoThrottle)
|
||||
if (Global.DisableSecondaryThrottling)
|
||||
vsync = false;
|
||||
|
||||
if (LastVsyncSetting != vsync || LastVsyncSettingGraphicsControl != presentationPanel.GraphicsControl)
|
||||
|
|
|
@ -159,65 +159,62 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void DrawMessages(IBlitter g)
|
||||
{
|
||||
if (!Global.ClientControls["MaxTurbo"])
|
||||
messages.RemoveAll(m => DateTime.Now > m.ExpireAt);
|
||||
int line = 1;
|
||||
if (Global.Config.StackOSDMessages)
|
||||
{
|
||||
messages.RemoveAll(m => DateTime.Now > m.ExpireAt);
|
||||
int line = 1;
|
||||
if (Global.Config.StackOSDMessages)
|
||||
for (int i = messages.Count - 1; i >= 0; i--, line++)
|
||||
{
|
||||
for (int i = messages.Count - 1; i >= 0; i--, line++)
|
||||
float x = GetX(g, Global.Config.DispMessagex, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
float y = GetY(g, Global.Config.DispMessagey, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
if (Global.Config.DispMessageanchor < 2)
|
||||
{
|
||||
float x = GetX(g, Global.Config.DispMessagex, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
float y = GetY(g, Global.Config.DispMessagey, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
if (Global.Config.DispMessageanchor < 2)
|
||||
{
|
||||
y += ((line - 1) * 18);
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= ((line - 1) * 18);
|
||||
}
|
||||
|
||||
g.DrawString(messages[i].Message, MessageFont, Color.Black, x + 2, y + 2);
|
||||
g.DrawString(messages[i].Message, MessageFont, FixedMessagesColor, x, y);
|
||||
y += ((line - 1) * 18);
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= ((line - 1) * 18);
|
||||
}
|
||||
|
||||
g.DrawString(messages[i].Message, MessageFont, Color.Black, x + 2, y + 2);
|
||||
g.DrawString(messages[i].Message, MessageFont, FixedMessagesColor, x, y);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (messages.Any())
|
||||
{
|
||||
if (messages.Any())
|
||||
int i = messages.Count - 1;
|
||||
|
||||
float x = GetX(g, Global.Config.DispMessagex, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
float y = GetY(g, Global.Config.DispMessagey, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
if (Global.Config.DispMessageanchor < 2)
|
||||
{
|
||||
int i = messages.Count - 1;
|
||||
|
||||
float x = GetX(g, Global.Config.DispMessagex, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
float y = GetY(g, Global.Config.DispMessagey, Global.Config.DispMessageanchor, messages[i].Message);
|
||||
if (Global.Config.DispMessageanchor < 2)
|
||||
{
|
||||
y += ((line - 1) * 18);
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= ((line - 1) * 18);
|
||||
}
|
||||
|
||||
g.DrawString(messages[i].Message, MessageFont, Color.Black, x + 2, y + 2);
|
||||
g.DrawString(messages[i].Message, MessageFont, FixedMessagesColor, x, y);
|
||||
y += ((line - 1) * 18);
|
||||
}
|
||||
else
|
||||
{
|
||||
y -= ((line - 1) * 18);
|
||||
}
|
||||
|
||||
g.DrawString(messages[i].Message, MessageFont, Color.Black, x + 2, y + 2);
|
||||
g.DrawString(messages[i].Message, MessageFont, FixedMessagesColor, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var text in GUITextList)
|
||||
foreach (var text in GUITextList)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
float posx = GetX(g, text.X, text.Anchor, text.Message);
|
||||
float posy = GetY(g, text.Y, text.Anchor, text.Message);
|
||||
float posx = GetX(g, text.X, text.Anchor, text.Message);
|
||||
float posy = GetY(g, text.Y, text.Anchor, text.Message);
|
||||
|
||||
g.DrawString(text.Message, MessageFont, text.BackGround, posx + 2, posy + 2);
|
||||
g.DrawString(text.Message, MessageFont, text.ForeColor, posx, posy);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g.DrawString(text.Message, MessageFont, text.BackGround, posx + 2, posy + 2);
|
||||
g.DrawString(text.Message, MessageFont, text.ForeColor, posx, posy);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1651,30 +1651,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SyncThrottle()
|
||||
{
|
||||
//TODO - this is a bit confusing. theres a difference between signal_unthrottle and Global.ForceNoThrottle. Isn't that kind of weird?
|
||||
//someone should evaluate these different modes and clean that up.
|
||||
|
||||
//TODO - did we change 'unthrottled' nomenclature to turbo? is turbo defined as 'temporarily disable throttle entirely'?
|
||||
|
||||
var rewind = Global.Rewinder.RewindActive && (Global.ClientControls["Rewind"] || PressRewind);
|
||||
var fastforward = Global.ClientControls["Fast Forward"] || FastForward;
|
||||
var superfastforward = IsTurboing;
|
||||
var fastForward = Global.ClientControls["Fast Forward"] || FastForward;
|
||||
var superFastForward = IsTurboing;
|
||||
|
||||
int speedPercent = fastforward ? Global.Config.SpeedPercentAlternate : Global.Config.SpeedPercent;
|
||||
int speedPercent = fastForward ? Global.Config.SpeedPercentAlternate : Global.Config.SpeedPercent;
|
||||
|
||||
if (rewind)
|
||||
{
|
||||
speedPercent = Math.Max(speedPercent / Global.Rewinder.RewindFrequency, 5);
|
||||
}
|
||||
|
||||
//zero 11-oct-2014 - i think this is more correct..
|
||||
//Global.ForceNoThrottle = _unthrottled || fastforward;
|
||||
Global.ForceNoThrottle = _unthrottled || fastforward || superfastforward;
|
||||
Global.DisableSecondaryThrottling = _unthrottled || fastForward || superFastForward || rewind;
|
||||
|
||||
// realtime throttle is never going to be so exact that using a double here is wrong
|
||||
_throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate);
|
||||
_throttle.signal_paused = EmulatorPaused;
|
||||
_throttle.signal_unthrottle = _unthrottled || superfastforward;
|
||||
_throttle.signal_unthrottle = _unthrottled || superFastForward;
|
||||
_throttle.signal_overrideSecondaryThrottle = (fastForward || rewind) && (Global.Config.SoundThrottle || Global.Config.VSyncThrottle || Global.Config.VSync);
|
||||
_throttle.SetSpeedPercent(speedPercent);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
samplesProvided = 2 * nsampgot;
|
||||
|
||||
if (!Global.ForceNoThrottle)
|
||||
if (!Global.DisableSecondaryThrottling)
|
||||
while (samplesNeeded < samplesProvided)
|
||||
{
|
||||
System.Threading.Thread.Sleep((samplesProvided - samplesNeeded) / 88); // let audio clock control sleep time
|
||||
|
|
|
@ -21,33 +21,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool signal_frameAdvance;
|
||||
public bool signal_unthrottle;
|
||||
public bool signal_continuousframeAdvancing; //continuousframeAdvancing
|
||||
public bool signal_overrideSecondaryThrottle;
|
||||
|
||||
public int cfg_frameskiprate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Global.ClientControls["MaxTurbo"])
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.Config.FrameSkip;
|
||||
}
|
||||
return Global.Config.FrameSkip;
|
||||
}
|
||||
}
|
||||
|
||||
public bool cfg_frameLimit
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Global.ClientControls["MaxTurbo"])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.Config.ClockThrottle;
|
||||
}
|
||||
return Global.Config.ClockThrottle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,14 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Global.ClientControls["MaxTurbo"])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.Config.AutoMinimizeSkipping;
|
||||
}
|
||||
return Global.Config.AutoMinimizeSkipping;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +97,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (framestoskip < 1)
|
||||
framestoskip += ffSkipRate;
|
||||
}
|
||||
else if ((signal_paused || /*autoframeskipenab && frameskiprate ||*/ cfg_frameLimit) && allowSleep)
|
||||
else if ((signal_paused || /*autoframeskipenab && frameskiprate ||*/ cfg_frameLimit || signal_overrideSecondaryThrottle) && allowSleep)
|
||||
{
|
||||
SpeedThrottle(signal_paused);
|
||||
}
|
||||
|
@ -160,7 +141,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (ulong)Environment.TickCount;
|
||||
}
|
||||
|
||||
|
||||
#if WINDOWS
|
||||
[DllImport("winmm.dll", EntryPoint = "timeBeginPeriod")]
|
||||
static extern uint timeBeginPeriod(uint uMilliseconds);
|
||||
|
@ -333,7 +313,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
void SpeedThrottle(bool paused)
|
||||
{
|
||||
AutoFrameSkip_BeforeThrottle();
|
||||
|
|
Loading…
Reference in New Issue