Play Movie Dialog - add a "include .state" checkbox. If checked it will show .state files that have input data

This commit is contained in:
andres.delikat 2011-07-23 20:52:47 +00:00
parent 8295e6d65b
commit c73112cdf6
4 changed files with 144 additions and 76 deletions

View File

@ -294,6 +294,7 @@
//Play Movie Dialog
public bool PlayMovie_IncludeSubdir = true;
public bool PlayMovie_ShowStateFiles = false;
//TI83
public bool TI83disableSaveSlotKeys = true;
@ -314,16 +315,16 @@
public string ToggleFullscreenBinding = "Alt+Return";
public string QuickSave = "I";
public string QuickLoad = "P";
public string SelectSlot0 = "0";
public string SelectSlot1 = "1";
public string SelectSlot2 = "2";
public string SelectSlot3 = "3";
public string SelectSlot4 = "4";
public string SelectSlot5 = "5";
public string SelectSlot6 = "6";
public string SelectSlot7 = "7";
public string SelectSlot8 = "8";
public string SelectSlot9 = "9";
public string SelectSlot0 = "D0";
public string SelectSlot1 = "D1";
public string SelectSlot2 = "D2";
public string SelectSlot3 = "D3";
public string SelectSlot4 = "D4";
public string SelectSlot5 = "D5";
public string SelectSlot6 = "D6";
public string SelectSlot7 = "D7";
public string SelectSlot8 = "D8";
public string SelectSlot9 = "D9";
public string SaveSlot0 = "Shift+F10";
public string SaveSlot1 = "Shift+F1";
public string SaveSlot2 = "Shift+F2";
@ -376,7 +377,7 @@
public string MTDecrementPlayer = "";
public string AVIRecordBinding = "";
public string AVIStopBinding = "";
// SMS / GameGear Settings
public bool SmsEnableFM = true;
public bool SmsAllowOverlock = false;

View File

@ -1144,11 +1144,21 @@ namespace BizHawk.MultiClient
case "LoadSlot7": if (!IsNullEmulator()) LoadState("QuickSave7"); break;
case "LoadSlot8": if (!IsNullEmulator()) LoadState("QuickSave8"); break;
case "LoadSlot9": if (!IsNullEmulator()) LoadState("QuickSave9"); break;
case "SelectSlot0": OnSelectSlot(0); break;
case "SelectSlot1": OnSelectSlot(1); break;
case "SelectSlot2": OnSelectSlot(2); break;
case "SelectSlot3": OnSelectSlot(3); break;
case "SelectSlot4": OnSelectSlot(4); break;
case "SelectSlot0":
OnSelectSlot(0);
break;
case "SelectSlot1":
OnSelectSlot(1);
break;
case "SelectSlot2":
OnSelectSlot(2);
break;
case "SelectSlot3":
OnSelectSlot(3);
break;
case "SelectSlot4":
OnSelectSlot(4);
break;
case "SelectSlot5": OnSelectSlot(5); break;
case "SelectSlot6": OnSelectSlot(6); break;
case "SelectSlot7": OnSelectSlot(7); break;

View File

@ -32,11 +32,6 @@
this.Cancel = new System.Windows.Forms.Button();
this.OK = new System.Windows.Forms.Button();
this.BrowseMovies = new System.Windows.Forms.Button();
this.MovieView = new BizHawk.VirtualListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.DetailsView = new System.Windows.Forms.ListView();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
@ -46,6 +41,12 @@
this.MovieCount = new System.Windows.Forms.Label();
this.ReadOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.IncludeSubDirectories = new System.Windows.Forms.CheckBox();
this.MovieView = new BizHawk.VirtualListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.ShowStateFiles = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@ -53,7 +54,7 @@
//
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(628, 352);
this.Cancel.Location = new System.Drawing.Point(678, 352);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 0;
@ -64,7 +65,7 @@
// OK
//
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.Location = new System.Drawing.Point(547, 352);
this.OK.Location = new System.Drawing.Point(597, 352);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 1;
@ -83,55 +84,6 @@
this.BrowseMovies.UseVisualStyleBackColor = true;
this.BrowseMovies.Click += new System.EventHandler(this.BrowseMovies_Click);
//
// MovieView
//
this.MovieView.AllowDrop = true;
this.MovieView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.MovieView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4});
this.MovieView.FullRowSelect = true;
this.MovieView.GridLines = true;
this.MovieView.HideSelection = false;
this.MovieView.ItemCount = 0;
this.MovieView.Location = new System.Drawing.Point(12, 28);
this.MovieView.MultiSelect = false;
this.MovieView.Name = "MovieView";
this.MovieView.selectedItem = -1;
this.MovieView.Size = new System.Drawing.Size(413, 303);
this.MovieView.TabIndex = 3;
this.MovieView.UseCompatibleStateImageBehavior = false;
this.MovieView.View = System.Windows.Forms.View.Details;
this.MovieView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.MovieView_ColumnClick);
this.MovieView.DragDrop += new System.Windows.Forms.DragEventHandler(this.MovieView_DragDrop);
this.MovieView.SelectedIndexChanged += new System.EventHandler(this.MovieView_SelectedIndexChanged);
this.MovieView.DragEnter += new System.Windows.Forms.DragEventHandler(this.MovieView_DragEnter);
this.MovieView.DoubleClick += new System.EventHandler(this.MovieView_DoubleClick);
//
// columnHeader1
//
this.columnHeader1.Text = "File";
this.columnHeader1.Width = 120;
//
// columnHeader2
//
this.columnHeader2.Text = "SysID";
this.columnHeader2.Width = 42;
//
// columnHeader3
//
this.columnHeader3.Text = "Game";
this.columnHeader3.Width = 149;
//
// columnHeader4
//
this.columnHeader4.Text = "Length";
this.columnHeader4.Width = 97;
//
// DetailsView
//
this.DetailsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -166,7 +118,7 @@
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.DetailsView);
this.groupBox1.Location = new System.Drawing.Point(444, 28);
this.groupBox1.Location = new System.Drawing.Point(494, 28);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(259, 303);
this.groupBox1.TabIndex = 6;
@ -212,7 +164,7 @@
this.ReadOnlyCheckBox.AutoSize = true;
this.ReadOnlyCheckBox.Checked = true;
this.ReadOnlyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.ReadOnlyCheckBox.Location = new System.Drawing.Point(444, 356);
this.ReadOnlyCheckBox.Location = new System.Drawing.Point(494, 356);
this.ReadOnlyCheckBox.Name = "ReadOnlyCheckBox";
this.ReadOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.ReadOnlyCheckBox.TabIndex = 8;
@ -223,7 +175,7 @@
//
this.IncludeSubDirectories.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.IncludeSubDirectories.AutoSize = true;
this.IncludeSubDirectories.Location = new System.Drawing.Point(107, 356);
this.IncludeSubDirectories.Location = new System.Drawing.Point(123, 337);
this.IncludeSubDirectories.Name = "IncludeSubDirectories";
this.IncludeSubDirectories.Size = new System.Drawing.Size(131, 17);
this.IncludeSubDirectories.TabIndex = 9;
@ -231,13 +183,75 @@
this.IncludeSubDirectories.UseVisualStyleBackColor = true;
this.IncludeSubDirectories.CheckedChanged += new System.EventHandler(this.IncludeSubDirectories_CheckedChanged);
//
// MovieView
//
this.MovieView.AllowDrop = true;
this.MovieView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.MovieView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4});
this.MovieView.FullRowSelect = true;
this.MovieView.GridLines = true;
this.MovieView.HideSelection = false;
this.MovieView.ItemCount = 0;
this.MovieView.Location = new System.Drawing.Point(12, 28);
this.MovieView.MultiSelect = false;
this.MovieView.Name = "MovieView";
this.MovieView.selectedItem = -1;
this.MovieView.Size = new System.Drawing.Size(463, 303);
this.MovieView.TabIndex = 3;
this.MovieView.UseCompatibleStateImageBehavior = false;
this.MovieView.View = System.Windows.Forms.View.Details;
this.MovieView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.MovieView_ColumnClick);
this.MovieView.DragDrop += new System.Windows.Forms.DragEventHandler(this.MovieView_DragDrop);
this.MovieView.SelectedIndexChanged += new System.EventHandler(this.MovieView_SelectedIndexChanged);
this.MovieView.DragEnter += new System.Windows.Forms.DragEventHandler(this.MovieView_DragEnter);
this.MovieView.DoubleClick += new System.EventHandler(this.MovieView_DoubleClick);
//
// columnHeader1
//
this.columnHeader1.Text = "File";
this.columnHeader1.Width = 221;
//
// columnHeader2
//
this.columnHeader2.Text = "SysID";
this.columnHeader2.Width = 43;
//
// columnHeader3
//
this.columnHeader3.Text = "Game";
this.columnHeader3.Width = 129;
//
// columnHeader4
//
this.columnHeader4.Text = "Length";
this.columnHeader4.Width = 64;
//
// ShowStateFiles
//
this.ShowStateFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ShowStateFiles.AutoSize = true;
this.ShowStateFiles.Location = new System.Drawing.Point(123, 358);
this.ShowStateFiles.Name = "ShowStateFiles";
this.ShowStateFiles.Size = new System.Drawing.Size(128, 17);
this.ShowStateFiles.TabIndex = 10;
this.ShowStateFiles.Text = "Show valid .state files";
this.ShowStateFiles.UseVisualStyleBackColor = true;
this.ShowStateFiles.CheckedChanged += new System.EventHandler(this.ShowStateFiles_CheckedChanged);
//
// PlayMovie
//
this.AcceptButton = this.OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(715, 387);
this.ClientSize = new System.Drawing.Size(765, 387);
this.Controls.Add(this.ShowStateFiles);
this.Controls.Add(this.IncludeSubDirectories);
this.Controls.Add(this.ReadOnlyCheckBox);
this.Controls.Add(this.MovieCount);
@ -277,5 +291,6 @@
private System.Windows.Forms.Label MovieCount;
private System.Windows.Forms.CheckBox ReadOnlyCheckBox;
private System.Windows.Forms.CheckBox IncludeSubDirectories;
private System.Windows.Forms.CheckBox ShowStateFiles;
}
}

View File

@ -92,6 +92,32 @@ namespace BizHawk.MultiClient
}
}
private int AddStateToList(string filename)
{
using (var file = new HawkFile(filename))
{
if (!file.Exists)
return 0;
else
{
int x = IsDuplicate(filename);
if (x == 0)
{
Movie m = new Movie(file.CanonicalFullPath, MOVIEMODE.INACTIVE);
m.LoadMovie(); //State files will have to load everything unfortunately
if (m.Length() > 0)
{
MovieList.Add(m);
sortReverse = false;
sortedCol = "";
x = MovieList.Count - 1;
}
}
return x;
}
}
}
private int AddMovieToList(string filename)
{
using (var file = new HawkFile(filename))
@ -213,6 +239,7 @@ namespace BizHawk.MultiClient
private void PlayMovie_Load(object sender, EventArgs e)
{
IncludeSubDirectories.Checked = Global.Config.PlayMovie_IncludeSubdir;
ShowStateFiles.Checked = Global.Config.PlayMovie_ShowStateFiles;
string d = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
if (!Directory.Exists(d))
Directory.CreateDirectory(d);
@ -223,6 +250,11 @@ namespace BizHawk.MultiClient
AddMovieToList(f);
foreach (string f in Directory.GetFiles(d, "*.mc2"))
AddMovieToList(f);
if (Global.Config.PlayMovie_ShowStateFiles)
{
foreach (string f in Directory.GetFiles(d, "*.state"))
AddStateToList(f);
}
if (Global.Config.PlayMovie_IncludeSubdir)
{
@ -235,6 +267,11 @@ namespace BizHawk.MultiClient
AddMovieToList(f);
foreach (string f in Directory.GetFiles(dir, "*.mc2"))
AddMovieToList(f);
if (Global.Config.PlayMovie_ShowStateFiles)
{
foreach (string f in Directory.GetFiles(d, "*.state"))
AddStateToList(f);
}
}
}
@ -329,5 +366,10 @@ namespace BizHawk.MultiClient
Global.Config.PlayMovie_IncludeSubdir = IncludeSubDirectories.Checked;
}
private void ShowStateFiles_CheckedChanged(object sender, EventArgs e)
{
Global.Config.PlayMovie_ShowStateFiles = ShowStateFiles.Checked;
}
}
}