tastudio: Recording mode

a bit inconsistent with how it switches to record right now
This commit is contained in:
feos 2016-08-03 22:29:27 +03:00
parent 178820746c
commit 170681c3ad
7 changed files with 44 additions and 6 deletions

View File

@ -23,6 +23,9 @@ namespace BizHawk.Client.Common
LagLog.RemoveFrom(frame);
LagLog[frame] = Global.Emulator.AsInputPollable().IsLagFrame;
if (IsRecording)
StateManager.Invalidate(frame + 1);
if (frame != 0)
ChangeLog.SetGeneralRedo();
}

View File

@ -218,6 +218,11 @@ namespace BizHawk.Client.Common
_mode = Moviemode.Play;
}
public override void SwitchToRecord()
{
_mode = Moviemode.Record;
}
/// <summary>
/// Removes lag log and greenzone after this frame
/// </summary>

View File

@ -45,11 +45,20 @@ namespace BizHawk.Client.EmuHawk
BookMarkControl.SelectBranchExternal(true);
}
public bool WantsToControlReadOnly { get { return false; } }
public bool WantsToControlReadOnly { get { return true; } }
public void ToggleReadOnly()
{
GlobalWin.OSD.AddMessage("TAStudio does not allow manual readonly toggle");
if (CurrentTasMovie.IsPlaying)
{
TastudioRecordMode();
GlobalWin.OSD.AddMessage("Tastudio: Recording mode");
}
else if (CurrentTasMovie.IsRecording)
{
TastudioPlayMode();
GlobalWin.OSD.AddMessage("Tastudio: Playback mode");
}
}
public bool WantsToControlStopMovie { get; private set; }

View File

@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
{
if (Global.Game.Hash != CurrentTasMovie.Hash)
{
TastudioToStopMovie();
TastudioStopMovie();
TasView.AllColumns.Clear();
StartNewTasMovie();
SetUpColumns();

View File

@ -54,6 +54,7 @@ namespace BizHawk.Client.EmuHawk
private int? _autoRestoreFrame; // The frame auto-restore will restore to, if set
private bool? _autoRestorePaused = null;
private int? _seekStartFrame = null;
private bool _wasRecording = false;
private void JumpToGreenzone()
{
@ -92,6 +93,11 @@ namespace BizHawk.Client.EmuHawk
public void StopSeeking()
{
_seekBackgroundWorker.CancelAsync();
if (_wasRecording)
{
TastudioRecordMode();
_wasRecording = false;
}
if (IgnoreSeekFrame)
{
GlobalWin.MainForm.UnpauseEmulator();

View File

@ -50,7 +50,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
CurrentTasMovie.SwitchToPlay();
TastudioPlayMode();
int lastState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame).Key; // Simply getting the last state doesn't work if that state is the frame. [dispaly isn't saved in the state, need to emulate to frame]
if (lastState > Emulator.Frame)

View File

@ -639,6 +639,7 @@ namespace BizHawk.Client.EmuHawk
return true;
}
private bool StartNewMovieWrapper(bool record, IMovie movie = null)
{
_initializing = true;
@ -656,6 +657,7 @@ namespace BizHawk.Client.EmuHawk
if (AskSaveChanges())
LoadFile(new FileInfo(path));
}
private void DummyLoadMacro(string path)
{
if (!TasView.AnyRowsSelected)
@ -682,7 +684,19 @@ namespace BizHawk.Client.EmuHawk
#endregion
private void TastudioToStopMovie()
private void TastudioPlayMode()
{
CurrentTasMovie.SwitchToPlay();
GlobalWin.MainForm.SetMainformMovieInfo();
}
private void TastudioRecordMode()
{
CurrentTasMovie.SwitchToRecord();
GlobalWin.MainForm.SetMainformMovieInfo();
}
private void TastudioStopMovie()
{
Global.MovieSession.StopMovie(false);
GlobalWin.MainForm.SetMainformMovieInfo();
@ -795,7 +809,8 @@ namespace BizHawk.Client.EmuHawk
if (frame == Emulator.Frame)
return;
CurrentTasMovie.SwitchToPlay();
_wasRecording = CurrentTasMovie.IsRecording || _wasRecording;
TastudioPlayMode();
KeyValuePair<int, byte[]> closestState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame);
if (closestState.Value != null && (frame < Emulator.Frame || closestState.Key > Emulator.Frame))
{