Tastudio - when clearing, invalidate on the first non-empty input rather than first selected row

This commit is contained in:
adelikat 2019-11-24 17:53:27 -06:00
parent 5bbdf2a49e
commit cb912bea58
2 changed files with 24 additions and 3 deletions

View File

@ -625,11 +625,32 @@ namespace BizHawk.Client.EmuHawk
}
}
private int? FirstNonEmptySelectedFrame
{
get
{
var lg = CurrentTasMovie.LogGeneratorInstance();
lg.SetSource(Global.MovieSession.MovieControllerInstance());
var empty = lg.EmptyEntry;
foreach (var row in TasView.SelectedRows)
{
if (CurrentTasMovie[row].LogEntry != empty)
{
return row;
}
}
return null;
}
}
private void ClearFramesMenuItem_Click(object sender, EventArgs e)
{
if (TasView.AnyRowsSelected)
{
bool needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
var firstWithInput = FirstNonEmptySelectedFrame;
bool needsToRollback = firstWithInput.HasValue && firstWithInput < Emulator.Frame;
int rollBackFrame = TasView.FirstSelectedIndex ?? 0;
CurrentTasMovie.ChangeLog.BeginNewBatch($"Clear frames {TasView.SelectedRows.Min()}-{TasView.SelectedRows.Max()}");

View File

@ -54,7 +54,7 @@ namespace BizHawk.Client.EmuHawk
public TAStudioSettings Settings { get; set; }
[ConfigPersist]
public Font TasViewFont { get; set; } = new Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
public Font TasViewFont { get; set; } = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
public class TAStudioSettings
{
@ -706,7 +706,7 @@ namespace BizHawk.Client.EmuHawk
var loadZone = new MovieZone(path)
{
Start = TasView.FirstSelectedIndex.Value
Start = TasView.FirstSelectedIndex ?? 0
};
loadZone.PlaceZone(CurrentTasMovie);
}