-Macros work without a TasMovie
-Bugfix: Display showed movie still playing after last frame -Bugfix: Autorestore frame was lost when making rapid changes -Bugfix: Canceling conversion of movie to TasProj stopped movie.
This commit is contained in:
parent
9328dd2f3a
commit
7e29f04f01
|
@ -226,11 +226,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void HandleMovieOnFrameLoop()
|
||||
{
|
||||
if (Movie.IsPlaying && !Movie.IsFinished && Global.Emulator.Frame >= Movie.InputLogLength)
|
||||
{
|
||||
HandlePlaybackEnd();
|
||||
}
|
||||
|
||||
if (!Movie.IsActive)
|
||||
{
|
||||
LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
|
@ -309,6 +304,11 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (Movie is TasMovie) // Was being done in LatchInputFromLog
|
||||
(Movie as TasMovie).GreenzoneCurrentFrame();
|
||||
|
||||
if (Movie.IsPlaying && !Movie.IsFinished && Global.Emulator.Frame >= Movie.InputLogLength)
|
||||
{
|
||||
HandlePlaybackEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HandleMovieLoadState(string path)
|
||||
|
|
|
@ -21,11 +21,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
private IEmulator Emulator { get; set; }
|
||||
// Zones
|
||||
List<MovieZone> zones = new List<MovieZone>();
|
||||
private TasMovie CurrentTasMovie
|
||||
private IMovie CurrentMovie
|
||||
{
|
||||
get { return Global.MovieSession.Movie as TasMovie; }
|
||||
get { return Global.MovieSession.Movie; }
|
||||
}
|
||||
|
||||
// Still need to make sure the user can't load and use macros that
|
||||
// have options only available for TasMovie
|
||||
|
||||
private bool _initializing = false;
|
||||
public MacroInputTool()
|
||||
{
|
||||
|
@ -44,10 +47,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
ReplaceBox.Enabled = CurrentTasMovie is TasMovie;
|
||||
PlaceNum.Enabled = CurrentTasMovie is TasMovie;
|
||||
ReplaceBox.Enabled = CurrentMovie is TasMovie;
|
||||
OverlayBox.Enabled = CurrentMovie is TasMovie;
|
||||
PlaceNum.Enabled = CurrentMovie is TasMovie;
|
||||
|
||||
MovieZone main = new MovieZone(CurrentTasMovie, 0, CurrentTasMovie.InputLogLength);
|
||||
MovieZone main = new MovieZone(CurrentMovie, 0, CurrentMovie.InputLogLength);
|
||||
main.Name = "Entire Movie";
|
||||
|
||||
zones.Add(main);
|
||||
|
@ -67,12 +71,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
zones.Clear();
|
||||
ZonesList.Items.Clear();
|
||||
|
||||
MovieZone main = new MovieZone(CurrentTasMovie, 0, CurrentTasMovie.InputLogLength);
|
||||
main.Name = "Entire Movie";
|
||||
|
||||
zones.Add(main);
|
||||
ZonesList.Items.Add(main.Name + " - length: " + main.Length);
|
||||
ZonesList.Items[0] += " [Zones don't change!]";
|
||||
MacroInputTool_Load(null, null);
|
||||
}
|
||||
|
||||
// These do absolutely nothing.
|
||||
|
@ -101,13 +100,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SetZoneButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (StartNum.Value >= CurrentTasMovie.InputLogLength || EndNum.Value >= CurrentTasMovie.InputLogLength)
|
||||
if (StartNum.Value >= CurrentMovie.InputLogLength || EndNum.Value >= CurrentMovie.InputLogLength)
|
||||
{
|
||||
MessageBox.Show("Start and end frames must be inside the movie.");
|
||||
return;
|
||||
}
|
||||
|
||||
MovieZone newZone = new MovieZone(CurrentTasMovie, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1));
|
||||
MovieZone newZone = new MovieZone(CurrentMovie, (int)StartNum.Value, (int)(EndNum.Value - StartNum.Value + 1));
|
||||
newZone.Name = "Zone " + zones.Count;
|
||||
zones.Add(newZone);
|
||||
ZonesList.Items.Add(newZone.Name + " - length: " + newZone.Length);
|
||||
|
@ -175,11 +174,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (selectedZone == null)
|
||||
return;
|
||||
|
||||
if (!(CurrentTasMovie is TasMovie))
|
||||
if (!(CurrentMovie is TasMovie))
|
||||
{
|
||||
selectedZone.Start = Global.Emulator.Frame;
|
||||
}
|
||||
selectedZone.PlaceZone(CurrentTasMovie);
|
||||
selectedZone.PlaceZone(CurrentMovie);
|
||||
}
|
||||
|
||||
#region "Menu Items"
|
||||
|
@ -201,6 +200,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
zones.Add(loadZone);
|
||||
ZonesList.Items.Add(loadZone.Name + " - length: " + loadZone.Length);
|
||||
|
||||
// Options only for TasMovie
|
||||
if (!(CurrentMovie is TasMovie))
|
||||
{
|
||||
loadZone.Replace = false;
|
||||
loadZone.Overlay = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public MovieZone()
|
||||
{
|
||||
}
|
||||
public MovieZone(TasMovie movie, int start, int length, string key = "")
|
||||
public MovieZone(IMovie movie, int start, int length, string key = "")
|
||||
{
|
||||
Bk2LogEntryGenerator lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator;
|
||||
lg.SetSource(Global.MovieSession.MovieControllerAdapter);
|
||||
|
@ -103,19 +103,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
controller = newController;
|
||||
}
|
||||
|
||||
public void PlaceZone(TasMovie movie)
|
||||
public void PlaceZone(IMovie movie)
|
||||
{
|
||||
// TODO: This should probably do something with undo history batches/naming.
|
||||
|
||||
if (Start > movie.InputLogLength)
|
||||
{ // Cannot place a frame here. Find a nice way around this.
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: This should probably do something with undo history batches/naming.
|
||||
if (!Replace)
|
||||
movie.InsertEmptyFrame(Start, Length);
|
||||
if (!Replace && movie is TasMovie)
|
||||
{ // Can't be done with a regular movie.
|
||||
(movie as TasMovie).InsertEmptyFrame(Start, Length);
|
||||
}
|
||||
|
||||
Bk2LogEntryGenerator logGenerator = new Bk2LogEntryGenerator("");
|
||||
logGenerator.SetSource(targetController);
|
||||
if (Overlay)
|
||||
{
|
||||
for (int i = 0; i < Length; i++)
|
||||
|
@ -123,7 +124,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
controller.SetControllersAsMnemonic(_log[i]);
|
||||
LatchFromSourceButtons(targetController, controller);
|
||||
ORLatchFromSource(targetController, movie.GetInputState(i + Start));
|
||||
movie.SetFrame(i + Start, logGenerator.GenerateLogEntry());
|
||||
movie.PokeFrame(i + Start, targetController);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -132,7 +133,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{ // Copy over the frame.
|
||||
controller.SetControllersAsMnemonic(_log[i]);
|
||||
LatchFromSourceButtons(targetController, controller);
|
||||
movie.SetFrame(i + Start, logGenerator.GenerateLogEntry());
|
||||
movie.PokeFrame(i + Start, targetController);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,6 +158,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.Get<TAStudio>().UpdateValues();
|
||||
}
|
||||
}
|
||||
|
||||
if (movie.InputLogLength >= Global.Emulator.Frame)
|
||||
{
|
||||
movie.SwitchToPlay();
|
||||
Global.Config.MovieEndAction = MovieEndAction.Record;
|
||||
}
|
||||
}
|
||||
|
||||
public void Save(string fileName)
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (frame != Emulator.Frame) // Don't go to a frame if you are already on it!
|
||||
{
|
||||
var restoreFrame = Emulator.Frame;
|
||||
int restoreFrame = Emulator.Frame;
|
||||
|
||||
if (frame <= Emulator.Frame)
|
||||
{
|
||||
|
|
|
@ -126,6 +126,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
CurrentTasMovie.NewBGWorker(_saveBackgroundWorker);
|
||||
}
|
||||
|
||||
private bool _initialized = false;
|
||||
private void Tastudio_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!InitializeOnLoad())
|
||||
|
@ -151,6 +152,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
RefreshDialog();
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
private bool InitializeOnLoad()
|
||||
|
@ -665,12 +667,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_triggerAutoRestore)
|
||||
{
|
||||
if (Global.Emulator.Frame < 50)
|
||||
System.Diagnostics.Debugger.Break();
|
||||
|
||||
int? pauseOn = GlobalWin.MainForm.PauseOnFrame;
|
||||
GoToLastEmulatedFrameIfNecessary(_triggerAutoRestoreFromFrame.Value);
|
||||
|
||||
if (GlobalWin.MainForm.PauseOnFrame.HasValue &&
|
||||
_autoRestoreFrame.HasValue &&
|
||||
_autoRestoreFrame < GlobalWin.MainForm.PauseOnFrame) // If we are already seeking to a later frame don't shorten that journey here
|
||||
{
|
||||
if (pauseOn.HasValue && _autoRestoreFrame.HasValue && _autoRestoreFrame < pauseOn)
|
||||
{ // If we are already seeking to a later frame don't shorten that journey here
|
||||
_autoRestoreFrame = GlobalWin.MainForm.PauseOnFrame;
|
||||
}
|
||||
|
||||
|
@ -685,6 +689,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void Tastudio_Closing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (!_initialized)
|
||||
return;
|
||||
|
||||
_exiting = true;
|
||||
if (AskSaveChanges())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue