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

This commit is contained in:
andres.delikat 2011-01-21 15:05:15 +00:00
parent 2ec181e50f
commit 46d5c40499
3 changed files with 24 additions and 18 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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();
}
}
}