Ram Search - Memory domain select
This commit is contained in:
parent
0c5a252b1a
commit
f7198ae966
|
@ -57,6 +57,15 @@ namespace BizHawk
|
|||
PokeByte = pokeByte;
|
||||
}
|
||||
|
||||
public MemoryDomain(MemoryDomain domain)
|
||||
{
|
||||
Name = domain.Name;
|
||||
Size = domain.Size;
|
||||
Endian = domain.Endian;
|
||||
PeekByte = domain.PeekByte;
|
||||
PokeByte = domain.PokeByte;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
|
|
|
@ -250,7 +250,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
CloseGame();
|
||||
Global.Emulator = new NullEmulator();
|
||||
RamSearch1.StartNewSearch();
|
||||
RamSearch1.Restart();
|
||||
Text = "BizHawk";
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ namespace BizHawk.MultiClient
|
|||
LoadRom(filePaths[0]);
|
||||
}
|
||||
|
||||
bool IsNullEmulator()
|
||||
public bool IsNullEmulator()
|
||||
{
|
||||
if (Global.Emulator is NullEmulator)
|
||||
return true;
|
||||
|
@ -440,7 +440,7 @@ namespace BizHawk.MultiClient
|
|||
else throttle.SetCoreFps(60);
|
||||
SetSpeedPercent(Global.Config.SpeedPercent);
|
||||
}
|
||||
RamSearch1.StartNewSearch();
|
||||
RamSearch1.Restart();
|
||||
CurrentlyOpenRom = path;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
this.Value = new System.Windows.Forms.ColumnHeader();
|
||||
this.Previous = new System.Windows.Forms.ColumnHeader();
|
||||
this.Changes = new System.Windows.Forms.ColumnHeader();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.startNewSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.searchToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.newSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -125,11 +129,9 @@
|
|||
this.AutoSearchCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.MemDomainLabel = new System.Windows.Forms.Label();
|
||||
this.OutputLabel = new System.Windows.Forms.Label();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.startNewSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.searchToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.memoryDomainsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SearchtoolStrip1.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.SuspendLayout();
|
||||
|
@ -137,7 +139,6 @@
|
|||
this.toolStrip2.SuspendLayout();
|
||||
this.CompareToBox.SuspendLayout();
|
||||
this.ComparisonBox.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SearchtoolStrip1
|
||||
|
@ -300,6 +301,34 @@
|
|||
this.Changes.Text = "Changes";
|
||||
this.Changes.Width = 55;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.startNewSearchToolStripMenuItem,
|
||||
this.toolStripSeparator9,
|
||||
this.searchToolStripMenuItem2});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(170, 54);
|
||||
//
|
||||
// startNewSearchToolStripMenuItem
|
||||
//
|
||||
this.startNewSearchToolStripMenuItem.Name = "startNewSearchToolStripMenuItem";
|
||||
this.startNewSearchToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
|
||||
this.startNewSearchToolStripMenuItem.Text = "&Start New Search";
|
||||
this.startNewSearchToolStripMenuItem.Click += new System.EventHandler(this.startNewSearchToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator9
|
||||
//
|
||||
this.toolStripSeparator9.Name = "toolStripSeparator9";
|
||||
this.toolStripSeparator9.Size = new System.Drawing.Size(166, 6);
|
||||
//
|
||||
// searchToolStripMenuItem2
|
||||
//
|
||||
this.searchToolStripMenuItem2.Name = "searchToolStripMenuItem2";
|
||||
this.searchToolStripMenuItem2.Size = new System.Drawing.Size(169, 22);
|
||||
this.searchToolStripMenuItem2.Text = "&Search";
|
||||
this.searchToolStripMenuItem2.Click += new System.EventHandler(this.searchToolStripMenuItem2_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -431,6 +460,7 @@
|
|||
// searchToolStripMenuItem
|
||||
//
|
||||
this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.memoryDomainsToolStripMenuItem,
|
||||
this.searchToolStripMenuItem1,
|
||||
this.undoToolStripMenuItem,
|
||||
this.copyValueToPrevToolStripMenuItem,
|
||||
|
@ -1052,33 +1082,11 @@
|
|||
this.OutputLabel.TabIndex = 9;
|
||||
this.OutputLabel.Text = " ";
|
||||
//
|
||||
// contextMenuStrip1
|
||||
// memoryDomainsToolStripMenuItem
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.startNewSearchToolStripMenuItem,
|
||||
this.toolStripSeparator9,
|
||||
this.searchToolStripMenuItem2});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(170, 54);
|
||||
//
|
||||
// startNewSearchToolStripMenuItem
|
||||
//
|
||||
this.startNewSearchToolStripMenuItem.Name = "startNewSearchToolStripMenuItem";
|
||||
this.startNewSearchToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
|
||||
this.startNewSearchToolStripMenuItem.Text = "&Start New Search";
|
||||
this.startNewSearchToolStripMenuItem.Click += new System.EventHandler(this.startNewSearchToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator9
|
||||
//
|
||||
this.toolStripSeparator9.Name = "toolStripSeparator9";
|
||||
this.toolStripSeparator9.Size = new System.Drawing.Size(166, 6);
|
||||
//
|
||||
// searchToolStripMenuItem2
|
||||
//
|
||||
this.searchToolStripMenuItem2.Name = "searchToolStripMenuItem2";
|
||||
this.searchToolStripMenuItem2.Size = new System.Drawing.Size(169, 22);
|
||||
this.searchToolStripMenuItem2.Text = "&Search";
|
||||
this.searchToolStripMenuItem2.Click += new System.EventHandler(this.searchToolStripMenuItem2_Click);
|
||||
this.memoryDomainsToolStripMenuItem.Name = "memoryDomainsToolStripMenuItem";
|
||||
this.memoryDomainsToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.memoryDomainsToolStripMenuItem.Text = "&Memory Domains";
|
||||
//
|
||||
// RamSearch
|
||||
//
|
||||
|
@ -1103,6 +1111,7 @@
|
|||
this.LocationChanged += new System.EventHandler(this.RamSearch_LocationChanged);
|
||||
this.SearchtoolStrip1.ResumeLayout(false);
|
||||
this.SearchtoolStrip1.PerformLayout();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
|
||||
|
@ -1117,7 +1126,6 @@
|
|||
this.CompareToBox.PerformLayout();
|
||||
this.ComparisonBox.ResumeLayout(false);
|
||||
this.ComparisonBox.PerformLayout();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -1224,5 +1232,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem startNewSearchToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
|
||||
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem2;
|
||||
private System.Windows.Forms.ToolStripMenuItem memoryDomainsToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -18,8 +18,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
//TODO:
|
||||
//Window position gets saved but doesn't load properly
|
||||
//Multiple memory domains
|
||||
//Context Menu - if highlighted items - show Highlight dependent functions
|
||||
//Format address - number of digits based on max value of domain
|
||||
|
||||
string systemID = "NULL";
|
||||
List<Watch> searchList = new List<Watch>();
|
||||
|
@ -28,10 +28,12 @@ namespace BizHawk.MultiClient
|
|||
List<Watch> prevList = new List<Watch>();
|
||||
private bool IsAWeededList = false; //For deciding whether the weeded list is relevant (0 size could mean all were removed in a legit preview
|
||||
|
||||
MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { });
|
||||
|
||||
public enum SCompareTo { PREV, VALUE, ADDRESS, CHANGES };
|
||||
public enum SOperator { LESS, GREATER, LESSEQUAL, GREATEREQUAL, EQUAL, NOTEQUAL, DIFFBY };
|
||||
public enum SSigned { SIGNED, UNSIGNED, HEX };
|
||||
|
||||
|
||||
//Reset window position item
|
||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||
int defaultHeight;
|
||||
|
@ -47,7 +49,7 @@ namespace BizHawk.MultiClient
|
|||
for (int x = 0; x < searchList.Count; x++)
|
||||
{
|
||||
searchList[x].prev = searchList[x].value;
|
||||
searchList[x].PeekAddress(Global.Emulator.MainMemory);
|
||||
searchList[x].PeekAddress(Domain);
|
||||
|
||||
if (searchList[x].prev != searchList[x].value)
|
||||
searchList[x].changecount++;
|
||||
|
@ -65,7 +67,7 @@ namespace BizHawk.MultiClient
|
|||
defaultWidth = this.Size.Width; //Save these first so that the user can restore to its original size
|
||||
defaultHeight = this.Size.Height;
|
||||
|
||||
if (Global.Emulator.MainMemory.Endian == Endian.Big)
|
||||
if (Domain.Endian == Endian.Big)
|
||||
{
|
||||
bigEndianToolStripMenuItem.Checked = true;
|
||||
littleEndianToolStripMenuItem.Checked = false;
|
||||
|
@ -85,6 +87,49 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
this.Size = new System.Drawing.Size(Global.Config.RamSearchWidth, Global.Config.RamSearchHeight);
|
||||
}
|
||||
|
||||
SetMemoryDomainMenu();
|
||||
}
|
||||
|
||||
private void SetMemoryDomainMenu()
|
||||
{
|
||||
memoryDomainsToolStripMenuItem.DropDownItems.Clear();
|
||||
if (Global.Emulator.MemoryDomains.Count > 0)
|
||||
{
|
||||
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
|
||||
{
|
||||
string str = Global.Emulator.MemoryDomains[x].ToString();
|
||||
var item = new ToolStripMenuItem();
|
||||
item.Text = str;
|
||||
{
|
||||
int z = x;
|
||||
item.Click += (o, ev) => SetMemoryDomain(z);
|
||||
}
|
||||
if (x == 0)
|
||||
{
|
||||
//item.Checked = true; //TODO: figure out how to check/uncheck these in SetMemoryDomain
|
||||
SetMemoryDomain(x);
|
||||
}
|
||||
memoryDomainsToolStripMenuItem.DropDownItems.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
memoryDomainsToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
SetMemoryDomainMenu(); //Calls Start New Search
|
||||
}
|
||||
|
||||
private void SetMemoryDomain(int pos)
|
||||
{
|
||||
if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check
|
||||
{
|
||||
Domain = Global.Emulator.MemoryDomains[pos];
|
||||
}
|
||||
SetPlatformAndMemoryDomainLabel();
|
||||
StartNewSearch();
|
||||
}
|
||||
|
||||
private void SetTotal()
|
||||
|
@ -273,13 +318,13 @@ namespace BizHawk.MultiClient
|
|||
return false;
|
||||
}
|
||||
|
||||
public void StartNewSearch()
|
||||
private void StartNewSearch()
|
||||
{
|
||||
weededList.Clear();
|
||||
IsAWeededList = false;
|
||||
searchList.Clear();
|
||||
undoList.Clear();
|
||||
GetMemoryDomain();
|
||||
SetPlatformAndMemoryDomainLabel();
|
||||
int startaddress = 0;
|
||||
if (Global.Emulator.SystemId == "PCE")
|
||||
startaddress = 0x1F0000; //For now, until Emulator core functionality can better handle a prefix
|
||||
|
@ -302,14 +347,14 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x <= ((Global.Emulator.MainMemory.Size / divisor)-1); x++)
|
||||
for (int x = 0; x <= ((Domain.Size / divisor)-1); x++)
|
||||
{
|
||||
searchList.Add(new Watch());
|
||||
searchList[x].address = count + startaddress;
|
||||
searchList[x].type = GetDataSize();
|
||||
searchList[x].bigendian = GetBigEndian();
|
||||
searchList[x].signed = GetDataType();
|
||||
searchList[x].PeekAddress(Global.Emulator.MainMemory);
|
||||
searchList[x].PeekAddress(Domain);
|
||||
searchList[x].prev = searchList[x].value;
|
||||
if (includeMisalignedToolStripMenuItem.Checked)
|
||||
count++;
|
||||
|
@ -357,9 +402,9 @@ namespace BizHawk.MultiClient
|
|||
StartNewSearch();
|
||||
}
|
||||
|
||||
private void GetMemoryDomain()
|
||||
private void SetPlatformAndMemoryDomainLabel()
|
||||
{
|
||||
string memoryDomain = "Main memory";
|
||||
string memoryDomain = Domain.ToString();
|
||||
systemID = Global.Emulator.SystemId;
|
||||
MemDomainLabel.Text = systemID + " " + memoryDomain;
|
||||
}
|
||||
|
|
|
@ -163,6 +163,9 @@
|
|||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>259, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>358, 17</value>
|
||||
</metadata>
|
||||
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
|
@ -194,9 +197,6 @@
|
|||
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>358, 17</value>
|
||||
</metadata>
|
||||
<data name="DataSizetoolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
|
|
Loading…
Reference in New Issue