Clean up some movie slop in the frame loop, sbizhawk should now run unnoticeably faster

This commit is contained in:
andres.delikat 2012-08-02 21:30:30 +00:00
parent 4754889131
commit 174dec1472
1 changed files with 23 additions and 25 deletions

View File

@ -1803,7 +1803,7 @@ namespace BizHawk.MultiClient
double frameAdvanceTimestampDelta = (now - FrameAdvanceTimestamp).TotalMilliseconds; double frameAdvanceTimestampDelta = (now - FrameAdvanceTimestamp).TotalMilliseconds;
bool frameProgressTimeElapsed = Global.Config.FrameProgressDelayMs < frameAdvanceTimestampDelta; bool frameProgressTimeElapsed = Global.Config.FrameProgressDelayMs < frameAdvanceTimestampDelta;
if (Global.Emulator.IsLagFrame && frameProgressTimeElapsed && Global.Config.SkipLagFrame) if (Global.Config.SkipLagFrame && Global.Emulator.IsLagFrame && frameProgressTimeElapsed)
{ {
Global.Emulator.FrameAdvance(true); Global.Emulator.FrameAdvance(true);
} }
@ -1902,38 +1902,34 @@ namespace BizHawk.MultiClient
if (!suppressCaptureRewind && Global.Config.RewindEnabled) CaptureRewindState(); if (!suppressCaptureRewind && Global.Config.RewindEnabled) CaptureRewindState();
Global.MovieSession.Movie.CaptureState();
if (!runloop_frameadvance) genSound = true; if (!runloop_frameadvance) genSound = true;
else if (!Global.Config.MuteFrameAdvance) else if (!Global.Config.MuteFrameAdvance)
genSound = true; genSound = true;
MovieSession session = Global.MovieSession;
if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD || Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY) if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD || Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY)
{ {
session.LatchInputFromLog(); Global.MovieSession.Movie.CaptureState();
} Global.MovieSession.LatchInputFromLog();
if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD) if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
{
if (session.MultiTrack.IsActive)
{ {
session.LatchMultitrackPlayerInput(Global.MovieInputSourceAdapter, Global.MultitrackRewiringControllerAdapter); if (Global.MovieSession.MultiTrack.IsActive)
} {
else Global.MovieSession.LatchMultitrackPlayerInput(Global.MovieInputSourceAdapter, Global.MultitrackRewiringControllerAdapter);
{ }
session.LatchInputFromPlayer(Global.MovieInputSourceAdapter); else
{
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
}
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
Global.MovieSession.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint);
} }
} }
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE || Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
session.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint);
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE || Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
{ {
session.LatchInputFromPlayer(Global.MovieInputSourceAdapter); Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
} }
if (-1 != StopOnFrame && StopOnFrame == Global.Emulator.Frame + 1) if (-1 != StopOnFrame && StopOnFrame == Global.Emulator.Frame + 1)
@ -1961,7 +1957,7 @@ namespace BizHawk.MultiClient
//Global.MovieSession.MovieControllerAdapter.SetControllersAsMnemonic(Global.MovieSession.Movie.GetInputFrame(Global.Emulator.Frame)); //Global.MovieSession.MovieControllerAdapter.SetControllersAsMnemonic(Global.MovieSession.Movie.GetInputFrame(Global.Emulator.Frame));
//Global.MovieMode = true; //Global.MovieMode = true;
//adelikat: is Global.MovieMode doing anything anymore? if not we shoudl remove this variable //adelikat: is Global.MovieMode doing anything anymore? if not we shoudl remove this variable
session.LatchInputFromLog(); Global.MovieSession.LatchInputFromLog();
} }
} }
@ -1999,8 +1995,6 @@ namespace BizHawk.MultiClient
} }
} }
if (Global.Emulator.IsLagFrame && Global.Config.AutofireLagFrames) if (Global.Emulator.IsLagFrame && Global.Config.AutofireLagFrames)
{ {
Global.AutoFireController.IncrementStarts(); Global.AutoFireController.IncrementStarts();
@ -2014,13 +2008,17 @@ namespace BizHawk.MultiClient
{ {
UpdateToolsAfter(); UpdateToolsAfter();
if (ReturnToRecording) if (ReturnToRecording)
{
Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD; Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD;
}
PressRewind = false; PressRewind = false;
} }
if (true == UpdateFrame) if (true == UpdateFrame)
{ {
if (ReturnToRecording) if (ReturnToRecording)
{
Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD; Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD;
}
UpdateFrame = false; UpdateFrame = false;
} }