Ram Watch/Search, Hex Editor - set endian based on the endianness of the memory domain by default

This commit is contained in:
adelikat 2012-06-02 21:48:09 +00:00
parent 0a0c4b43ae
commit 393dd9dcfe
4 changed files with 45 additions and 19 deletions

View File

@ -258,6 +258,10 @@ namespace BizHawk.MultiClient
public void SetMemoryDomain(MemoryDomain d) public void SetMemoryDomain(MemoryDomain d)
{ {
Domain = d; Domain = d;
if (d.Endian == Endian.Big)
BigEndian = true;
else
BigEndian = false;
maxRow = Domain.Size / 2; maxRow = Domain.Size / 2;
SetUpScrollBar(); SetUpScrollBar();
vScrollBar1.Value = 0; vScrollBar1.Value = 0;

View File

@ -100,6 +100,18 @@ namespace BizHawk.MultiClient
SetMemoryDomainMenu(); SetMemoryDomainMenu();
} }
private void SetEndian()
{
if (Domain.Endian == Endian.Big)
{
SetBigEndian();
}
else
{
SetLittleEndian();
}
}
private void LoadConfigSettings() private void LoadConfigSettings()
{ {
ColumnPositionSet(); ColumnPositionSet();
@ -111,16 +123,7 @@ namespace BizHawk.MultiClient
defaultPrevWidth = SearchListView.Columns[Global.Config.RamSearchPrevIndex].Width; defaultPrevWidth = SearchListView.Columns[Global.Config.RamSearchPrevIndex].Width;
defaultChangesWidth = SearchListView.Columns[Global.Config.RamSearchChangesIndex].Width; defaultChangesWidth = SearchListView.Columns[Global.Config.RamSearchChangesIndex].Width;
if (Domain.Endian == Endian.Big) SetEndian();
{
bigEndianToolStripMenuItem.Checked = true;
littleEndianToolStripMenuItem.Checked = false;
}
else
{
bigEndianToolStripMenuItem.Checked = false;
littleEndianToolStripMenuItem.Checked = true;
}
if (Global.Config.RamSearchSaveWindowPosition && Global.Config.RamSearchWndx >= 0 && Global.Config.RamSearchWndy >= 0) if (Global.Config.RamSearchSaveWindowPosition && Global.Config.RamSearchWndx >= 0 && Global.Config.RamSearchWndy >= 0)
this.Location = new Point(Global.Config.RamSearchWndx, Global.Config.RamSearchWndy); this.Location = new Point(Global.Config.RamSearchWndx, Global.Config.RamSearchWndy);
@ -175,6 +178,7 @@ namespace BizHawk.MultiClient
private void SetMemoryDomainNew(int pos) private void SetMemoryDomainNew(int pos)
{ {
SetMemoryDomain(pos); SetMemoryDomain(pos);
SetEndian();
StartNewSearch(); StartNewSearch();
} }
@ -1218,16 +1222,26 @@ namespace BizHawk.MultiClient
SetSpecificValueBoxMaxLength(); SetSpecificValueBoxMaxLength();
} }
private void bigEndianToolStripMenuItem_Click(object sender, EventArgs e) private void SetLittleEndian()
{
bigEndianToolStripMenuItem.Checked = false;
littleEndianToolStripMenuItem.Checked = true;
}
private void SetBigEndian()
{ {
bigEndianToolStripMenuItem.Checked = true; bigEndianToolStripMenuItem.Checked = true;
littleEndianToolStripMenuItem.Checked = false; littleEndianToolStripMenuItem.Checked = false;
} }
private void bigEndianToolStripMenuItem_Click(object sender, EventArgs e)
{
SetBigEndian();
}
private void littleEndianToolStripMenuItem_Click(object sender, EventArgs e) private void littleEndianToolStripMenuItem_Click(object sender, EventArgs e)
{ {
bigEndianToolStripMenuItem.Checked = false; SetLittleEndian();
littleEndianToolStripMenuItem.Checked = true;
} }
private void AutoSearchCheckBox_CheckedChanged(object sender, EventArgs e) private void AutoSearchCheckBox_CheckedChanged(object sender, EventArgs e)

View File

@ -428,6 +428,7 @@ namespace BizHawk.MultiClient
RamWatchNewWatch r = new RamWatchNewWatch(); RamWatchNewWatch r = new RamWatchNewWatch();
r.location = GetPromptPoint(); r.location = GetPromptPoint();
r.SetEndian(Domain.Endian);
Global.Sound.StopSound(); Global.Sound.StopSound();
r.ShowDialog(); r.ShowDialog();
Global.Sound.StartSound(); Global.Sound.StartSound();

View File

@ -76,6 +76,18 @@ namespace BizHawk.MultiClient
LittleEndianRadio.Checked = true; LittleEndianRadio.Checked = true;
} }
public void SetEndian(Endian endian)
{
if (endian == Endian.Big)
{
BigEndianRadio.Checked = true;
}
else
{
LittleEndianRadio.Checked = true;
}
}
private void RamWatchNewWatch_Load(object sender, EventArgs e) private void RamWatchNewWatch_Load(object sender, EventArgs e)
{ {
if (!customSetup) if (!customSetup)
@ -83,14 +95,9 @@ namespace BizHawk.MultiClient
Watch w = new Watch(); Watch w = new Watch();
SetTypeRadio(w.type); SetTypeRadio(w.type);
SetSignedRadio(w.signed); SetSignedRadio(w.signed);
AddressBox.Text = "0000"; AddressBox.Text = "0000";
if (w.bigendian == true)
BigEndianRadio.Checked = true;
else
LittleEndianRadio.Checked = true;
} }
if (location.X > 0 && location.Y > 0) if (location.X > 0 && location.Y > 0)
this.Location = location; this.Location = location;
} }