From a3f6f71c64f72daa198ca29097297c847b99b7ed Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 2 Mar 2015 01:06:02 +0000 Subject: [PATCH] MultiHawk - some misc stuff --- BizHawk.Client.MultiHawk/EmulatorWindow.cs | 8 +- BizHawk.Client.MultiHawk/Mainform.Designer.cs | 98 +++++++++---------- BizHawk.Client.MultiHawk/Mainform.cs | 26 ++++- BizHawk.Client.MultiHawk/Mainform.resx | 3 - 4 files changed, 78 insertions(+), 57 deletions(-) diff --git a/BizHawk.Client.MultiHawk/EmulatorWindow.cs b/BizHawk.Client.MultiHawk/EmulatorWindow.cs index 6e77497b36..cc1734a8d0 100644 --- a/BizHawk.Client.MultiHawk/EmulatorWindow.cs +++ b/BizHawk.Client.MultiHawk/EmulatorWindow.cs @@ -164,7 +164,7 @@ namespace BizHawk.Client.MultiHawk var args = str.Split(' '); if (args[0] == "Framebuffer") { - Global.Emulator.VideoProvider().GetVideoBuffer().ReadFromHex(args[1]); + Emulator.VideoProvider().GetVideoBuffer().ReadFromHex(args[1]); } } } @@ -278,7 +278,7 @@ namespace BizHawk.Client.MultiHawk out_h /= 2; } using (new SimpleTime("Save Framebuffer")) - bs.PutLump(BinaryStateLump.Framebuffer, (s) => QuickBmpFile.Save(Global.Emulator.VideoProvider(), s, out_w, out_h)); + bs.PutLump(BinaryStateLump.Framebuffer, (s) => QuickBmpFile.Save(Emulator.VideoProvider(), s, out_w, out_h)); } if (IAmMaster) @@ -289,7 +289,7 @@ namespace BizHawk.Client.MultiHawk delegate(TextWriter tw) { // this never should have been a core's responsibility - tw.WriteLine("Frame {0}", Global.Emulator.Frame); + tw.WriteLine("Frame {0}", Emulator.Frame); Global.MovieSession.HandleMovieSaveState(tw); }); } @@ -398,7 +398,7 @@ namespace BizHawk.Client.MultiHawk } var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write)); - var saveram = Global.Emulator.AsSaveRam().CloneSaveRam(); + var saveram = Emulator.AsSaveRam().CloneSaveRam(); writer.Write(saveram, 0, saveram.Length); writer.Close(); diff --git a/BizHawk.Client.MultiHawk/Mainform.Designer.cs b/BizHawk.Client.MultiHawk/Mainform.Designer.cs index 293c5c842c..7c8ed9d9c2 100644 --- a/BizHawk.Client.MultiHawk/Mainform.Designer.cs +++ b/BizHawk.Client.MultiHawk/Mainform.Designer.cs @@ -44,6 +44,11 @@ this.RebootCoresMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ViewSubMenu = new System.Windows.Forms.ToolStripMenuItem(); + this._1xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._2xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._3xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this._4xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MovieSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.RecordMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PlayMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -61,11 +66,6 @@ this.FameStatusBarLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.StatusBarMessageLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.PlayRecordStatusButton = new System.Windows.Forms.ToolStripDropDownButton(); - this.ViewSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._1xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._2xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._3xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._4xMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainformMenu.SuspendLayout(); this.WorkspacePanel.SuspendLayout(); this.MainStatusBar.SuspendLayout(); @@ -145,7 +145,7 @@ // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(57, 6); // // toolStripSeparator7 // @@ -173,7 +173,7 @@ // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(57, 6); // // toolStripSeparator5 // @@ -200,6 +200,46 @@ this.ExitMenuItem.Text = "E&xit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // + // ViewSubMenu + // + this.ViewSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this._1xMenuItem, + this._2xMenuItem, + this._3xMenuItem, + this._4xMenuItem}); + this.ViewSubMenu.Name = "ViewSubMenu"; + this.ViewSubMenu.Size = new System.Drawing.Size(44, 20); + this.ViewSubMenu.Text = "&View"; + this.ViewSubMenu.DropDownOpened += new System.EventHandler(this.ViewSubMenu_DropDownOpened); + // + // _1xMenuItem + // + this._1xMenuItem.Name = "_1xMenuItem"; + this._1xMenuItem.Size = new System.Drawing.Size(85, 22); + this._1xMenuItem.Text = "&1x"; + this._1xMenuItem.Click += new System.EventHandler(this._1xMenuItem_Click); + // + // _2xMenuItem + // + this._2xMenuItem.Name = "_2xMenuItem"; + this._2xMenuItem.Size = new System.Drawing.Size(85, 22); + this._2xMenuItem.Text = "&2x"; + this._2xMenuItem.Click += new System.EventHandler(this._2xMenuItem_Click); + // + // _3xMenuItem + // + this._3xMenuItem.Name = "_3xMenuItem"; + this._3xMenuItem.Size = new System.Drawing.Size(85, 22); + this._3xMenuItem.Text = "&3x"; + this._3xMenuItem.Click += new System.EventHandler(this._3xMenuItem_Click); + // + // _4xMenuItem + // + this._4xMenuItem.Name = "_4xMenuItem"; + this._4xMenuItem.Size = new System.Drawing.Size(85, 22); + this._4xMenuItem.Text = "&4x"; + this._4xMenuItem.Click += new System.EventHandler(this._4xMenuItem_Click); + // // MovieSubMenu // this.MovieSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -307,8 +347,8 @@ this.MainStatusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1, this.FameStatusBarLabel, - this.StatusBarMessageLabel, - this.PlayRecordStatusButton}); + this.PlayRecordStatusButton, + this.StatusBarMessageLabel}); this.MainStatusBar.Location = new System.Drawing.Point(0, 379); this.MainStatusBar.Name = "MainStatusBar"; this.MainStatusBar.Size = new System.Drawing.Size(651, 22); @@ -342,46 +382,6 @@ this.PlayRecordStatusButton.Size = new System.Drawing.Size(29, 20); this.PlayRecordStatusButton.Text = "No movie is active"; // - // ViewSubMenu - // - this.ViewSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._1xMenuItem, - this._2xMenuItem, - this._3xMenuItem, - this._4xMenuItem}); - this.ViewSubMenu.Name = "ViewSubMenu"; - this.ViewSubMenu.Size = new System.Drawing.Size(44, 20); - this.ViewSubMenu.Text = "&View"; - this.ViewSubMenu.DropDownOpened += new System.EventHandler(this.ViewSubMenu_DropDownOpened); - // - // _1xMenuItem - // - this._1xMenuItem.Name = "_1xMenuItem"; - this._1xMenuItem.Size = new System.Drawing.Size(152, 22); - this._1xMenuItem.Text = "&1x"; - this._1xMenuItem.Click += new System.EventHandler(this._1xMenuItem_Click); - // - // _2xMenuItem - // - this._2xMenuItem.Name = "_2xMenuItem"; - this._2xMenuItem.Size = new System.Drawing.Size(152, 22); - this._2xMenuItem.Text = "&2x"; - this._2xMenuItem.Click += new System.EventHandler(this._2xMenuItem_Click); - // - // _3xMenuItem - // - this._3xMenuItem.Name = "_3xMenuItem"; - this._3xMenuItem.Size = new System.Drawing.Size(152, 22); - this._3xMenuItem.Text = "&3x"; - this._3xMenuItem.Click += new System.EventHandler(this._3xMenuItem_Click); - // - // _4xMenuItem - // - this._4xMenuItem.Name = "_4xMenuItem"; - this._4xMenuItem.Size = new System.Drawing.Size(152, 22); - this._4xMenuItem.Text = "&4x"; - this._4xMenuItem.Click += new System.EventHandler(this._4xMenuItem_Click); - // // Mainform // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.Client.MultiHawk/Mainform.cs b/BizHawk.Client.MultiHawk/Mainform.cs index 1cd88c8b47..b78740a94d 100644 --- a/BizHawk.Client.MultiHawk/Mainform.cs +++ b/BizHawk.Client.MultiHawk/Mainform.cs @@ -933,7 +933,6 @@ namespace BizHawk.Client.MultiHawk var runFrame = false; _runloopFrameadvance = false; var currentTimestamp = Stopwatch.GetTimestamp(); - var suppressCaptureRewind = false; double frameAdvanceTimestampDeltaMs = (double)(currentTimestamp - _frameAdvanceTimestamp) / Stopwatch.Frequency * 1000.0; bool frameProgressTimeElapsed = frameAdvanceTimestampDeltaMs >= Global.Config.FrameProgressDelayMs; @@ -1052,17 +1051,20 @@ namespace BizHawk.Client.MultiHawk private void RecordMovieMenuItem_Click(object sender, EventArgs e) { new RecordMovie().ShowDialog(); + UpdateMainText(); } private void PlayMovieMenuItem_Click(object sender, EventArgs e) { new PlayMovie().ShowDialog(); + UpdateMainText(); } private void StopMovieMenuItem_Click(object sender, EventArgs e) { Global.MovieSession.StopMovie(true); SetMainformMovieInfo(); + UpdateMainText(); //UpdateStatusSlots(); // TODO } @@ -1243,6 +1245,7 @@ namespace BizHawk.Client.MultiHawk EmulatorWindows.SessionName = file.FullName; Global.Config.RecentRomSessions.Add(file.FullName); SaveSessionMenuItem_Click(sender, e); + UpdateMainText(); } } } @@ -1287,9 +1290,27 @@ namespace BizHawk.Client.MultiHawk EmulatorWindows.SessionName = file.FullName; LoadRomSession(EmulatorWindowList.FromJson(json)); Global.Config.RecentRomSessions.Add(file.FullName); + UpdateMainText(); } } + private void UpdateMainText() + { + string text = "MultiHawk"; + + if (!string.IsNullOrWhiteSpace(EmulatorWindows.SessionName)) + { + text += " - " + Path.GetFileNameWithoutExtension(EmulatorWindows.SessionName); + } + + if (Global.MovieSession.Movie.IsActive) + { + text += " - " + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); + } + + Text = text; + } + private static FileInfo GetFileFromUser(string filter) { var ofd = new OpenFileDialog @@ -1326,6 +1347,7 @@ namespace BizHawk.Client.MultiHawk } EmulatorWindows.Clear(); + UpdateMainText(); } private void LoadRomSession(IEnumerable entries) @@ -1334,6 +1356,7 @@ namespace BizHawk.Client.MultiHawk { LoadRom(entry.RomName); EmulatorWindows.Last().Location = new Point(entry.Wndx, entry.Wndy); + UpdateMainText(); } } @@ -1347,6 +1370,7 @@ namespace BizHawk.Client.MultiHawk EmulatorWindows.SessionName = file.FullName; LoadRomSession(EmulatorWindowList.FromJson(json)); Global.Config.RecentRomSessions.Add(file.FullName); + UpdateMainText(); } else { diff --git a/BizHawk.Client.MultiHawk/Mainform.resx b/BizHawk.Client.MultiHawk/Mainform.resx index 4f1d11d960..f0e0413d85 100644 --- a/BizHawk.Client.MultiHawk/Mainform.resx +++ b/BizHawk.Client.MultiHawk/Mainform.resx @@ -123,7 +123,4 @@ 153, 17 - - 153, 17 - \ No newline at end of file