Play Movie - add .state to browse dialog and do logic to check if it has an inputlog, if not then show a message and don't load, else load it as a movie. Also dialog cleanups

This commit is contained in:
andres.delikat 2011-07-23 22:30:51 +00:00
parent d8b6432d9a
commit 36eef14f60
2 changed files with 23 additions and 6 deletions

View File

@ -80,11 +80,11 @@
// BrowseMovies // BrowseMovies
// //
this.BrowseMovies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.BrowseMovies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BrowseMovies.Location = new System.Drawing.Point(12, 352); this.BrowseMovies.Image = global::BizHawk.MultiClient.Properties.Resources.OpenFile;
this.BrowseMovies.Location = new System.Drawing.Point(12, 337);
this.BrowseMovies.Name = "BrowseMovies"; this.BrowseMovies.Name = "BrowseMovies";
this.BrowseMovies.Size = new System.Drawing.Size(75, 23); this.BrowseMovies.Size = new System.Drawing.Size(31, 23);
this.BrowseMovies.TabIndex = 2; this.BrowseMovies.TabIndex = 2;
this.BrowseMovies.Text = "Browse...";
this.toolTip1.SetToolTip(this.BrowseMovies, "Browse for additional movie files"); this.toolTip1.SetToolTip(this.BrowseMovies, "Browse for additional movie files");
this.BrowseMovies.UseVisualStyleBackColor = true; this.BrowseMovies.UseVisualStyleBackColor = true;
this.BrowseMovies.Click += new System.EventHandler(this.BrowseMovies_Click); this.BrowseMovies.Click += new System.EventHandler(this.BrowseMovies_Click);
@ -253,7 +253,7 @@
// //
this.Scan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.Scan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Scan.Image = global::BizHawk.MultiClient.Properties.Resources.Scan; this.Scan.Image = global::BizHawk.MultiClient.Properties.Resources.Scan;
this.Scan.Location = new System.Drawing.Point(448, 337); this.Scan.Location = new System.Drawing.Point(49, 337);
this.Scan.Name = "Scan"; this.Scan.Name = "Scan";
this.Scan.Size = new System.Drawing.Size(27, 23); this.Scan.Size = new System.Drawing.Size(27, 23);
this.Scan.TabIndex = 11; this.Scan.TabIndex = 11;

View File

@ -69,7 +69,7 @@ namespace BizHawk.MultiClient
{ {
OpenFileDialog ofd = new OpenFileDialog(); OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, ""); ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
ofd.Filter = "Movie files (*.tas)|*.TAS;*.ZIP;*.7z|FCEUX Movies|*.FM2|PCEjin Movies|*.MC2|Archive Files|*.zip;*.7z|All Files|*.*"; ofd.Filter = "Movie files (*.tas)|*.TAS;*.ZIP;*.7z|FCEUX Movies|*.FM2|PCEjin Movies|*.MC2|Savestates|*.state|Archive Files|*.zip;*.7z|All Files|*.*";
Global.Sound.StopSound(); Global.Sound.StopSound();
var result = ofd.ShowDialog(); var result = ofd.ShowDialog();
@ -81,6 +81,17 @@ namespace BizHawk.MultiClient
return; return;
else else
{ {
if (file.Extension.ToUpper() == "STATE")
{
Movie m = new Movie(file.FullName, MOVIEMODE.INACTIVE);
m.LoadMovie(); //State files will have to load everything unfortunately
if (m.Length() == 0)
{
MessageBox.Show("No input log detected in this savestate, aborting", "Can not load file", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return;
}
}
int x = AddMovieToList(ofd.FileName); int x = AddMovieToList(ofd.FileName);
if (x > 0) if (x > 0)
{ {
@ -295,7 +306,13 @@ namespace BizHawk.MultiClient
private void MovieView_SelectedIndexChanged(object sender, EventArgs e) private void MovieView_SelectedIndexChanged(object sender, EventArgs e)
{ {
DetailsView.Items.Clear(); DetailsView.Items.Clear();
if (MovieView.SelectedIndices.Count < 1) return; if (MovieView.SelectedIndices.Count < 1)
{
OK.Enabled = false;
return;
}
else
OK.Enabled = true;
int x = MovieView.SelectedIndices[0]; int x = MovieView.SelectedIndices[0];
Dictionary<string, string> h = MovieList[x].Header.HeaderParams; Dictionary<string, string> h = MovieList[x].Header.HeaderParams;