From 46d5c4049900841dd9cd89c13c4a0c2222ca36a9 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Fri, 21 Jan 2011 15:05:15 +0000 Subject: [PATCH] Ram Watch - update values during Game.Tick, TODO: make the value updating faster, and move this to once per frame instead of once per message loop --- BizHawk.MultiClient/MainForm.cs | 3 ++- BizHawk.MultiClient/RamWatch.Designer.cs | 29 ++++++++++++------------ BizHawk.MultiClient/RamWatch.cs | 10 +++++--- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 19743f6a42..148fd2ce27 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -20,6 +20,7 @@ namespace BizHawk.MultiClient private int SaveSlot = 0; //Saveslot sytem private bool EmulatorPaused = false; + RamWatch RamWatch1 = new RamWatch(); public MainForm(string[] args) { @@ -350,6 +351,7 @@ namespace BizHawk.MultiClient } Global.Sound.UpdateSound(Global.Emulator.SoundProvider); Global.RenderPanel.Render(Global.Emulator.VideoProvider); + RamWatch1.UpdateValues(); } private bool wasMaximized = false; @@ -792,7 +794,6 @@ namespace BizHawk.MultiClient private void LoadRamWatch() //TODO: accept a filename parameter and feed it to ram watch for loading { - RamWatch RamWatch1 = new RamWatch(); if (Global.Config.AutoLoadRamWatch) RamWatch1.LoadWatchFromRecent(Global.Config.RecentWatches.GetRecentFileByPosition(0)); RamWatch1.Show(); diff --git a/BizHawk.MultiClient/RamWatch.Designer.cs b/BizHawk.MultiClient/RamWatch.Designer.cs index b8cce977e1..e4ee9cc205 100644 --- a/BizHawk.MultiClient/RamWatch.Designer.cs +++ b/BizHawk.MultiClient/RamWatch.Designer.cs @@ -42,6 +42,8 @@ this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.watchesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.newWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -60,8 +62,6 @@ this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); this.WatchCountLabel = new System.Windows.Forms.Label(); - this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.menuStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); @@ -175,6 +175,18 @@ this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(201, 6); // + // restoreWindowSizeToolStripMenuItem + // + this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; + this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size"; + this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(201, 6); + // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; @@ -328,18 +340,6 @@ this.WatchCountLabel.TabIndex = 4; this.WatchCountLabel.Text = "0 watches"; // - // restoreWindowSizeToolStripMenuItem - // - this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; - this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size"; - this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(201, 6); - // // RamWatch // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -354,6 +354,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "Ram Watch"; this.Load += new System.EventHandler(this.RamWatch_Load); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.RamWatch_Paint); this.Resize += new System.EventHandler(this.RamWatch_Resize); this.LocationChanged += new System.EventHandler(this.RamWatch_LocationChanged); this.menuStrip1.ResumeLayout(false); diff --git a/BizHawk.MultiClient/RamWatch.cs b/BizHawk.MultiClient/RamWatch.cs index 12915b467f..f7873ba973 100644 --- a/BizHawk.MultiClient/RamWatch.cs +++ b/BizHawk.MultiClient/RamWatch.cs @@ -29,12 +29,12 @@ namespace BizHawk.MultiClient public void UpdateValues() { - if (Global.Emulator is NullEmulator) return; for (int x = 0; x < watchList.Count; x++) { watchList[x].value = Global.Emulator.MainMemory.PeekByte(watchList[x].address); //TODO: readbytes based on type, size, endian values } + DisplayWatchList(); } public RamWatch() @@ -424,7 +424,7 @@ namespace BizHawk.MultiClient MoveDown(); } - private void DisplayWatchList() + public void DisplayWatchList() { WatchListView.Items.Clear(); for (int x = 0; x < watchList.Count; x++) @@ -434,7 +434,6 @@ namespace BizHawk.MultiClient item.SubItems.Add(watchList[x].notes); WatchListView.Items.Add(item); } - UpdateValues(); } private void RamWatch_Load(object sender, EventArgs e) @@ -573,5 +572,10 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection i = this.WatchListView.SelectedIndices; i = WatchListView.SelectedIndices; } + + private void RamWatch_Paint(object sender, PaintEventArgs e) + { + UpdateValues(); + } } }