Lots of little fixups to movie code, disable Disable Message config in Message Config as I won't be implmenting that before release

This commit is contained in:
andres.delikat 2011-07-13 01:29:13 +00:00
parent 4c5b48fd7c
commit a228e05f38
3 changed files with 66 additions and 40 deletions

View File

@ -24,8 +24,8 @@ namespace BizHawk.MultiClient
SavestateManager StateSlots = new SavestateManager(); SavestateManager StateSlots = new SavestateManager();
//Movie variables //Movie variables
public Movie InputLog = new Movie("", MOVIEMODE.INACTIVE); public Movie InputLog = new Movie();
public Movie UserMovie = new Movie("", MOVIEMODE.INACTIVE); public Movie UserMovie = new Movie();
public bool PressFrameAdvance = false; public bool PressFrameAdvance = false;
public bool PressRewind = false; public bool PressRewind = false;
@ -121,8 +121,8 @@ namespace BizHawk.MultiClient
if (Global.Sound != null) Global.Sound.StartSound(); if (Global.Sound != null) Global.Sound.StartSound();
}; };
Input.Initialize(); Input.Initialize();
InitControls(); InitControls();
Global.Emulator = new NullEmulator(); Global.Emulator = new NullEmulator();
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
Global.Sound = new Sound(Handle, Global.DSound); Global.Sound = new Sound(Handle, Global.DSound);
@ -392,11 +392,9 @@ namespace BizHawk.MultiClient
private void LoadMoviesFromRecent(string movie) private void LoadMoviesFromRecent(string movie)
{ {
Movie m = new Movie(movie, MOVIEMODE.PLAY); bool r;
ReadOnly = true; Movie m = new Movie(movie, MOVIEMODE.PLAY, out r);
StartNewMovie(m, false);
/*
bool r = true; // LoadRom(rom);
if (!r) if (!r)
{ {
Global.Sound.StopSound(); Global.Sound.StopSound();
@ -405,8 +403,11 @@ namespace BizHawk.MultiClient
Global.Config.RecentMovies.Remove(movie); Global.Config.RecentMovies.Remove(movie);
Global.Sound.StartSound(); Global.Sound.StartSound();
} }
*/ else
//TODO: make StartNewMovie or Movie constructor {
ReadOnly = true;
StartNewMovie(m, false);
}
} }
public static ControllerDefinition ClientControlsDef = new ControllerDefinition public static ControllerDefinition ClientControlsDef = new ControllerDefinition

View File

@ -30,6 +30,8 @@
{ {
this.OK = new System.Windows.Forms.Button(); this.OK = new System.Windows.Forms.Button();
this.MessageTypeBox = new System.Windows.Forms.GroupBox(); this.MessageTypeBox = new System.Windows.Forms.GroupBox();
this.MultitrackLabel = new System.Windows.Forms.Label();
this.MultitrackRadio = new System.Windows.Forms.RadioButton();
this.RerecLabel = new System.Windows.Forms.Label(); this.RerecLabel = new System.Windows.Forms.Label();
this.RerecordsRadio = new System.Windows.Forms.RadioButton(); this.RerecordsRadio = new System.Windows.Forms.RadioButton();
this.MessLabel = new System.Windows.Forms.Label(); this.MessLabel = new System.Windows.Forms.Label();
@ -80,8 +82,6 @@
this.LInputColorDialog = new System.Windows.Forms.ColorDialog(); this.LInputColorDialog = new System.Windows.Forms.ColorDialog();
this.MovieColorDialog = new System.Windows.Forms.ColorDialog(); this.MovieColorDialog = new System.Windows.Forms.ColorDialog();
this.MovieInputColorDialog = new System.Windows.Forms.ColorDialog(); this.MovieInputColorDialog = new System.Windows.Forms.ColorDialog();
this.MultitrackRadio = new System.Windows.Forms.RadioButton();
this.MultitrackLabel = new System.Windows.Forms.Label();
this.MessageTypeBox.SuspendLayout(); this.MessageTypeBox.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.XNumeric)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.XNumeric)).BeginInit();
@ -123,6 +123,28 @@
this.MessageTypeBox.TabStop = false; this.MessageTypeBox.TabStop = false;
this.MessageTypeBox.Text = "Message Type"; this.MessageTypeBox.Text = "Message Type";
// //
// MultitrackLabel
//
this.MultitrackLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.MultitrackLabel.AutoSize = true;
this.MultitrackLabel.Location = new System.Drawing.Point(126, 163);
this.MultitrackLabel.Name = "MultitrackLabel";
this.MultitrackLabel.Size = new System.Drawing.Size(49, 13);
this.MultitrackLabel.TabIndex = 13;
this.MultitrackLabel.Text = "255, 255";
//
// MultitrackRadio
//
this.MultitrackRadio.AutoSize = true;
this.MultitrackRadio.Location = new System.Drawing.Point(6, 161);
this.MultitrackRadio.Name = "MultitrackRadio";
this.MultitrackRadio.Size = new System.Drawing.Size(71, 17);
this.MultitrackRadio.TabIndex = 12;
this.MultitrackRadio.TabStop = true;
this.MultitrackRadio.Text = "Multitrack";
this.MultitrackRadio.UseVisualStyleBackColor = true;
this.MultitrackRadio.CheckedChanged += new System.EventHandler(this.MultitrackRadio_CheckedChanged);
//
// RerecLabel // RerecLabel
// //
this.RerecLabel.Anchor = System.Windows.Forms.AnchorStyles.None; this.RerecLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
@ -626,28 +648,6 @@
this.TL.UseVisualStyleBackColor = true; this.TL.UseVisualStyleBackColor = true;
this.TL.Click += new System.EventHandler(this.TL_CheckedChanged); this.TL.Click += new System.EventHandler(this.TL_CheckedChanged);
// //
// MultitrackRadio
//
this.MultitrackRadio.AutoSize = true;
this.MultitrackRadio.Location = new System.Drawing.Point(6, 161);
this.MultitrackRadio.Name = "MultitrackRadio";
this.MultitrackRadio.Size = new System.Drawing.Size(71, 17);
this.MultitrackRadio.TabIndex = 12;
this.MultitrackRadio.TabStop = true;
this.MultitrackRadio.Text = "Multitrack";
this.MultitrackRadio.UseVisualStyleBackColor = true;
this.MultitrackRadio.CheckedChanged += new System.EventHandler(this.MultitrackRadio_CheckedChanged);
//
// MultitrackLabel
//
this.MultitrackLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.MultitrackLabel.AutoSize = true;
this.MultitrackLabel.Location = new System.Drawing.Point(126, 163);
this.MultitrackLabel.Name = "MultitrackLabel";
this.MultitrackLabel.Size = new System.Drawing.Size(49, 13);
this.MultitrackLabel.TabIndex = 13;
this.MultitrackLabel.Text = "255, 255";
//
// MessageConfig // MessageConfig
// //
this.AcceptButton = this.OK; this.AcceptButton = this.OK;

View File

@ -15,7 +15,7 @@ namespace BizHawk.MultiClient
public SubtitleList Subtitles = new SubtitleList(); public SubtitleList Subtitles = new SubtitleList();
private bool IsText = true; private bool IsText = true;
private string Filename; public string Filename; //TODO: replace GetFilename() method
public bool MakeBackup = true; //Flag for making backup before altering movie public bool MakeBackup = true; //Flag for making backup before altering movie
private MOVIEMODE MovieMode = new MOVIEMODE(); private MOVIEMODE MovieMode = new MOVIEMODE();
@ -25,9 +25,32 @@ namespace BizHawk.MultiClient
public int lastLog; public int lastLog;
public int rerecordCount; public int rerecordCount;
/// <summary>
/// Allows checking if file exists
/// </summary>
/// <param name="filename"></param>
/// <param name="m"></param>
/// <param name="exists"></param>
public Movie(string filename, MOVIEMODE m, out bool exists)
{
FileInfo f = new FileInfo(filename);
if (!f.Exists)
{
filename = "";
exists = false;
}
else
{
Filename = filename;
exists = true;
}
MovieMode = m;
lastLog = 0;
rerecordCount = 0;
}
public Movie(string filename, MOVIEMODE m) public Movie(string filename, MOVIEMODE m)
{ {
Filename = filename; //TODO: Validate that file is writable
MovieMode = m; MovieMode = m;
lastLog = 0; lastLog = 0;
rerecordCount = 0; rerecordCount = 0;
@ -128,7 +151,7 @@ namespace BizHawk.MultiClient
// Log.Truncate(Global.Emulator.Frame); // Log.Truncate(Global.Emulator.Frame);
// } // }
//TODO: truncation here instead of loadstate will make VBA stil loadstates //Note: Truncation here instead of loadstate will make VBA style loadstates
//(Where an entire movie is loaded then truncated on the next frame //(Where an entire movie is loaded then truncated on the next frame
//this allows users to restore a movie with any savestate from that "timeline" //this allows users to restore a movie with any savestate from that "timeline"
@ -159,6 +182,7 @@ namespace BizHawk.MultiClient
public void WriteMovie() public void WriteMovie()
{ {
if (Filename == "") return;
Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName); Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName);
if (IsText) if (IsText)
WriteText(Filename); WriteText(Filename);
@ -168,6 +192,7 @@ namespace BizHawk.MultiClient
public void WriteBackup() public void WriteBackup()
{ {
if (Filename == "") return;
Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName); Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName);
string BackupName = Filename; string BackupName = Filename;
BackupName = BackupName.Insert(Filename.LastIndexOf("."), String.Format(".{0:yyyy-MM-dd HH.mm.ss}", DateTime.Now)); BackupName = BackupName.Insert(Filename.LastIndexOf("."), String.Format(".{0:yyyy-MM-dd HH.mm.ss}", DateTime.Now));
@ -181,7 +206,7 @@ namespace BizHawk.MultiClient
private void WriteText(string file) private void WriteText(string file)
{ {
if (file.Length == 0) return; //Nothing to write if (file.Length == 0) return; //Nothing to write
int length = Log.GetMovieLength(); int length = Log.GetMovieLength();
using (StreamWriter sw = new StreamWriter(file)) using (StreamWriter sw = new StreamWriter(file))
@ -320,7 +345,7 @@ namespace BizHawk.MultiClient
{ {
continue; continue;
} }
//TODO: don't reiterate this entire if chain, make a function called by this and loadmovie
else if (str.Contains(MovieHeader.EMULATIONVERSION)) else if (str.Contains(MovieHeader.EMULATIONVERSION))
{ {
str = ParseHeader(str, MovieHeader.EMULATIONVERSION); str = ParseHeader(str, MovieHeader.EMULATIONVERSION);