Tastudio - for devleoper builds add a Greenzone Integrity Check menu item, runs through the movie and verifies the greenzone states are identical to the data gathered from emulating and replaying the movie and savestating

This commit is contained in:
adelikat 2014-10-05 14:11:30 +00:00
parent cfff19b808
commit 99e6b7ce27
4 changed files with 90 additions and 30 deletions

View File

@ -333,12 +333,20 @@ namespace BizHawk.Client.Common
}
}
public bool HasGreenzone
public bool HasGreenzone // TODO: get rid of wrappers like this now that we expose the state manager directly
{
get
{
return StateManager.Any();
}
}
public TasStateManager TasStateManager
{
get
{
return StateManager;
}
}
}
}

View File

@ -2537,6 +2537,12 @@ namespace BizHawk.Client.EmuHawk
_throttle.Step(true, -1);
}
// TODO: for Tastudio debugging, coudl be removed if unused, it is a bad idea for anything else to clal this
public void FrameAdvance()
{
StepRunLoop_Core();
}
private void StepRunLoop_Core()
{
var runFrame = false;

View File

@ -67,6 +67,7 @@ namespace BizHawk.Client.EmuHawk
this.InsertNumFramesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.TruncateMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ClearGreenzoneMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ConfigSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.SetMaxUndoLevelsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
@ -123,7 +124,8 @@ namespace BizHawk.Client.EmuHawk
this.InsertNumFramesContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
this.TruncateContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ClearGreenzoneMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GreenzoneICheckSeparator = new System.Windows.Forms.ToolStripSeparator();
this.GreenZzoneIntegrityCheckMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TASMenu.SuspendLayout();
this.TasStatusStrip.SuspendLayout();
this.RightClickMenu.SuspendLayout();
@ -260,7 +262,9 @@ namespace BizHawk.Client.EmuHawk
this.InsertNumFramesMenuItem,
this.toolStripSeparator6,
this.TruncateMenuItem,
this.ClearGreenzoneMenuItem});
this.ClearGreenzoneMenuItem,
this.GreenzoneICheckSeparator,
this.GreenZzoneIntegrityCheckMenuItem});
this.EditSubMenu.Name = "EditSubMenu";
this.EditSubMenu.Size = new System.Drawing.Size(39, 20);
this.EditSubMenu.Text = "&Edit";
@ -271,7 +275,7 @@ namespace BizHawk.Client.EmuHawk
this.UndoMenuItem.Enabled = false;
this.UndoMenuItem.Name = "UndoMenuItem";
this.UndoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
this.UndoMenuItem.Size = new System.Drawing.Size(272, 22);
this.UndoMenuItem.Size = new System.Drawing.Size(282, 22);
this.UndoMenuItem.Text = "&Undo";
//
// RedoMenuItem
@ -279,7 +283,7 @@ namespace BizHawk.Client.EmuHawk
this.RedoMenuItem.Enabled = false;
this.RedoMenuItem.Name = "RedoMenuItem";
this.RedoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
this.RedoMenuItem.Size = new System.Drawing.Size(272, 22);
this.RedoMenuItem.Size = new System.Drawing.Size(282, 22);
this.RedoMenuItem.Text = "&Redo";
//
// SelectionUndoMenuItem
@ -287,7 +291,7 @@ namespace BizHawk.Client.EmuHawk
this.SelectionUndoMenuItem.Enabled = false;
this.SelectionUndoMenuItem.Name = "SelectionUndoMenuItem";
this.SelectionUndoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q)));
this.SelectionUndoMenuItem.Size = new System.Drawing.Size(272, 22);
this.SelectionUndoMenuItem.Size = new System.Drawing.Size(282, 22);
this.SelectionUndoMenuItem.Text = "Selection Undo";
//
// SelectionRedoMenuItem
@ -295,18 +299,18 @@ namespace BizHawk.Client.EmuHawk
this.SelectionRedoMenuItem.Enabled = false;
this.SelectionRedoMenuItem.Name = "SelectionRedoMenuItem";
this.SelectionRedoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W)));
this.SelectionRedoMenuItem.Size = new System.Drawing.Size(272, 22);
this.SelectionRedoMenuItem.Size = new System.Drawing.Size(282, 22);
this.SelectionRedoMenuItem.Text = "Selection Redo";
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(269, 6);
this.toolStripSeparator5.Size = new System.Drawing.Size(279, 6);
//
// DeselectMenuItem
//
this.DeselectMenuItem.Name = "DeselectMenuItem";
this.DeselectMenuItem.Size = new System.Drawing.Size(272, 22);
this.DeselectMenuItem.Size = new System.Drawing.Size(282, 22);
this.DeselectMenuItem.Text = "Deselect";
this.DeselectMenuItem.Click += new System.EventHandler(this.DeselectMenuItem_Click);
//
@ -315,7 +319,7 @@ namespace BizHawk.Client.EmuHawk
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
this.SelectAllMenuItem.ShortcutKeyDisplayString = "";
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.SelectAllMenuItem.Size = new System.Drawing.Size(272, 22);
this.SelectAllMenuItem.Size = new System.Drawing.Size(282, 22);
this.SelectAllMenuItem.Text = "Select &All";
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
//
@ -324,7 +328,7 @@ namespace BizHawk.Client.EmuHawk
this.SelectBetweenMarkersMenuItem.Name = "SelectBetweenMarkersMenuItem";
this.SelectBetweenMarkersMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.A)));
this.SelectBetweenMarkersMenuItem.Size = new System.Drawing.Size(272, 22);
this.SelectBetweenMarkersMenuItem.Size = new System.Drawing.Size(282, 22);
this.SelectBetweenMarkersMenuItem.Text = "Select between Markers";
this.SelectBetweenMarkersMenuItem.Click += new System.EventHandler(this.SelectBetweenMarkersMenuItem_Click);
//
@ -332,20 +336,20 @@ namespace BizHawk.Client.EmuHawk
//
this.ReselectClipboardMenuItem.Name = "ReselectClipboardMenuItem";
this.ReselectClipboardMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
this.ReselectClipboardMenuItem.Size = new System.Drawing.Size(272, 22);
this.ReselectClipboardMenuItem.Size = new System.Drawing.Size(282, 22);
this.ReselectClipboardMenuItem.Text = "Reselect Clipboard";
this.ReselectClipboardMenuItem.Click += new System.EventHandler(this.ReselectClipboardMenuItem_Click);
//
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(269, 6);
this.toolStripSeparator7.Size = new System.Drawing.Size(279, 6);
//
// CopyMenuItem
//
this.CopyMenuItem.Name = "CopyMenuItem";
this.CopyMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.CopyMenuItem.Size = new System.Drawing.Size(272, 22);
this.CopyMenuItem.Size = new System.Drawing.Size(282, 22);
this.CopyMenuItem.Text = "Copy";
this.CopyMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
//
@ -353,7 +357,7 @@ namespace BizHawk.Client.EmuHawk
//
this.PasteMenuItem.Name = "PasteMenuItem";
this.PasteMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.PasteMenuItem.Size = new System.Drawing.Size(272, 22);
this.PasteMenuItem.Size = new System.Drawing.Size(282, 22);
this.PasteMenuItem.Text = "&Paste";
this.PasteMenuItem.Click += new System.EventHandler(this.PasteMenuItem_Click);
//
@ -362,7 +366,7 @@ namespace BizHawk.Client.EmuHawk
this.PasteInsertMenuItem.Name = "PasteInsertMenuItem";
this.PasteInsertMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.V)));
this.PasteInsertMenuItem.Size = new System.Drawing.Size(272, 22);
this.PasteInsertMenuItem.Size = new System.Drawing.Size(282, 22);
this.PasteInsertMenuItem.Text = "&Paste Insert";
this.PasteInsertMenuItem.Click += new System.EventHandler(this.PasteInsertMenuItem_Click);
//
@ -370,21 +374,21 @@ namespace BizHawk.Client.EmuHawk
//
this.CutMenuItem.Name = "CutMenuItem";
this.CutMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.CutMenuItem.Size = new System.Drawing.Size(272, 22);
this.CutMenuItem.Size = new System.Drawing.Size(282, 22);
this.CutMenuItem.Text = "&Cut";
this.CutMenuItem.Click += new System.EventHandler(this.CutMenuItem_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(269, 6);
this.toolStripSeparator8.Size = new System.Drawing.Size(279, 6);
//
// ClearMenuItem
//
this.ClearMenuItem.Name = "ClearMenuItem";
this.ClearMenuItem.ShortcutKeyDisplayString = "";
this.ClearMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)));
this.ClearMenuItem.Size = new System.Drawing.Size(272, 22);
this.ClearMenuItem.Size = new System.Drawing.Size(282, 22);
this.ClearMenuItem.Text = "Clear";
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
@ -392,7 +396,7 @@ namespace BizHawk.Client.EmuHawk
//
this.DeleteFramesMenuItem.Name = "DeleteFramesMenuItem";
this.DeleteFramesMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.DeleteFramesMenuItem.Size = new System.Drawing.Size(272, 22);
this.DeleteFramesMenuItem.Size = new System.Drawing.Size(282, 22);
this.DeleteFramesMenuItem.Text = "&Delete";
this.DeleteFramesMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click);
//
@ -400,7 +404,7 @@ namespace BizHawk.Client.EmuHawk
//
this.CloneMenuItem.Name = "CloneMenuItem";
this.CloneMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert)));
this.CloneMenuItem.Size = new System.Drawing.Size(272, 22);
this.CloneMenuItem.Size = new System.Drawing.Size(282, 22);
this.CloneMenuItem.Text = "&Clone";
this.CloneMenuItem.Click += new System.EventHandler(this.CloneMenuItem_Click);
//
@ -409,7 +413,7 @@ namespace BizHawk.Client.EmuHawk
this.InsertFrameMenuItem.Name = "InsertFrameMenuItem";
this.InsertFrameMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.Insert)));
this.InsertFrameMenuItem.Size = new System.Drawing.Size(272, 22);
this.InsertFrameMenuItem.Size = new System.Drawing.Size(282, 22);
this.InsertFrameMenuItem.Text = "&Insert";
this.InsertFrameMenuItem.Click += new System.EventHandler(this.InsertFrameMenuItem_Click);
//
@ -418,22 +422,29 @@ namespace BizHawk.Client.EmuHawk
this.InsertNumFramesMenuItem.Name = "InsertNumFramesMenuItem";
this.InsertNumFramesMenuItem.ShortcutKeyDisplayString = "";
this.InsertNumFramesMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert;
this.InsertNumFramesMenuItem.Size = new System.Drawing.Size(272, 22);
this.InsertNumFramesMenuItem.Size = new System.Drawing.Size(282, 22);
this.InsertNumFramesMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(269, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(279, 6);
//
// TruncateMenuItem
//
this.TruncateMenuItem.Name = "TruncateMenuItem";
this.TruncateMenuItem.Size = new System.Drawing.Size(272, 22);
this.TruncateMenuItem.Size = new System.Drawing.Size(282, 22);
this.TruncateMenuItem.Text = "&Truncate Movie";
this.TruncateMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click);
//
// ClearGreenzoneMenuItem
//
this.ClearGreenzoneMenuItem.Name = "ClearGreenzoneMenuItem";
this.ClearGreenzoneMenuItem.Size = new System.Drawing.Size(282, 22);
this.ClearGreenzoneMenuItem.Text = "&Clear Greenzone";
this.ClearGreenzoneMenuItem.Click += new System.EventHandler(this.ClearGreenzoneMenuItem_Click);
//
// ConfigSubMenu
//
this.ConfigSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -888,12 +899,19 @@ namespace BizHawk.Client.EmuHawk
this.TruncateContextMenuItem.Text = "Truncate Movie";
this.TruncateContextMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click);
//
// ClearGreenzoneMenuItem
// GreenzoneICheckSeparator
//
this.ClearGreenzoneMenuItem.Name = "ClearGreenzoneMenuItem";
this.ClearGreenzoneMenuItem.Size = new System.Drawing.Size(272, 22);
this.ClearGreenzoneMenuItem.Text = "&Clear Greenzone";
this.ClearGreenzoneMenuItem.Click += new System.EventHandler(this.ClearGreenzoneMenuItem_Click);
this.GreenzoneICheckSeparator.Name = "GreenzoneICheckSeparator";
this.GreenzoneICheckSeparator.Size = new System.Drawing.Size(279, 6);
//
// GreenZzoneIntegrityCheckMenuItem
//
this.GreenZzoneIntegrityCheckMenuItem.Name = "GreenZzoneIntegrityCheckMenuItem";
this.GreenZzoneIntegrityCheckMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.I)));
this.GreenZzoneIntegrityCheckMenuItem.Size = new System.Drawing.Size(282, 22);
this.GreenZzoneIntegrityCheckMenuItem.Text = "Greenzone Integrity Check";
this.GreenZzoneIntegrityCheckMenuItem.Click += new System.EventHandler(this.GreenZzoneIntegrityCheckMenuItem_Click);
//
// TAStudio
//
@ -1017,5 +1035,7 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripSeparator toolStripSeparator18;
private System.Windows.Forms.ToolStripMenuItem TruncateContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem ClearGreenzoneMenuItem;
private System.Windows.Forms.ToolStripSeparator GreenzoneICheckSeparator;
private System.Windows.Forms.ToolStripMenuItem GreenZzoneIntegrityCheckMenuItem;
}
}

View File

@ -629,6 +629,10 @@ namespace BizHawk.Client.EmuHawk
ClearGreenzoneMenuItem.Enabled =
_currentTasMovie != null && _currentTasMovie.HasGreenzone;
GreenzoneICheckSeparator.Visible =
GreenZzoneIntegrityCheckMenuItem.Visible =
VersionInfo.DeveloperBuild;
}
private void DeselectMenuItem_Click(object sender, EventArgs e)
@ -1117,5 +1121,27 @@ namespace BizHawk.Client.EmuHawk
}
#endregion
private void GreenZzoneIntegrityCheckMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.MainForm.RebootCore();
GlobalWin.MainForm.FrameAdvance();
var frame = Global.Emulator.Frame;
if (_currentTasMovie.TasStateManager.HasState(frame))
{
var state = (byte[])Global.Emulator.SaveStateBinary().Clone();
var greenzone = _currentTasMovie.TasStateManager[frame];
if (!state.SequenceEqual(greenzone))
{
MessageBox.Show("bad data at frame: " + frame);
return;
}
}
MessageBox.Show("Integrity Check passed");
}
}
}