Ram Search/Ram Watch - support multiple addresses with the View in Hex Editor feature
This commit is contained in:
parent
e33396a548
commit
efbd1b2b4e
|
@ -549,7 +549,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public void GoToAddress(int address)
|
||||
private void GoToAddress(int address)
|
||||
{
|
||||
if (address < 0)
|
||||
{
|
||||
|
@ -568,6 +568,20 @@ namespace BizHawk.MultiClient
|
|||
AddressLabel.Text = GenerateAddressString();
|
||||
}
|
||||
|
||||
public void SetToAddresses(List<int> addresses)
|
||||
{
|
||||
if (addresses.Any())
|
||||
{
|
||||
SetHighlighted(addresses[0]);
|
||||
SecondaryHighlightedAddresses.Clear();
|
||||
SecondaryHighlightedAddresses.AddRange(addresses.Where(x => x != addresses[0]).ToList());
|
||||
ClearNibbles();
|
||||
UpdateValues();
|
||||
MemoryViewerBox.Refresh();
|
||||
AddressLabel.Text = GenerateAddressString();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHighlighted(int address)
|
||||
{
|
||||
if (address < 0)
|
||||
|
|
|
@ -125,5 +125,12 @@ namespace BizHawk.MultiClient
|
|||
Global.MainForm.HexEditor1.UpdateValues();
|
||||
Global.MainForm.Cheats_UpdateValues();
|
||||
}
|
||||
|
||||
public static void ViewInHexEditor(MemoryDomain domain, IEnumerable<int> addresses)
|
||||
{
|
||||
Global.MainForm.LoadHexEditor();
|
||||
Global.MainForm.HexEditor1.SetDomain(domain);
|
||||
Global.MainForm.HexEditor1.SetToAddresses(addresses.ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -310,6 +310,23 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private List<Watch> SelectedWatches
|
||||
{
|
||||
get
|
||||
{
|
||||
var selected = new List<Watch>();
|
||||
ListView.SelectedIndexCollection indices = WatchListView.SelectedIndices;
|
||||
if (indices.Count > 0)
|
||||
{
|
||||
foreach (int index in indices)
|
||||
{
|
||||
selected.Add(Searches[index]);
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetRemovedMessage(int val)
|
||||
{
|
||||
MessageLabel.Text = val.ToString() + " address" + (val != 1 ? "es" : String.Empty) + " removed";
|
||||
|
@ -322,7 +339,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void SetDomainLabel()
|
||||
{
|
||||
MemDomainLabel.Text = Searches.DomainName;
|
||||
MemDomainLabel.Text = Searches.Domain.Name;
|
||||
}
|
||||
|
||||
private void LoadFileFromRecent(string path)
|
||||
|
@ -341,7 +358,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void SetPlatformAndMemoryDomainLabel()
|
||||
{
|
||||
MemDomainLabel.Text = Global.Emulator.SystemId + " " + Searches.DomainName;
|
||||
MemDomainLabel.Text = Global.Emulator.SystemId + " " + Searches.Domain.Name;
|
||||
}
|
||||
|
||||
private void SetMemoryDomain(int pos)
|
||||
|
@ -700,26 +717,6 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private List<Watch> SelectedWatches
|
||||
{
|
||||
get
|
||||
{
|
||||
var selected = new List<Watch>();
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
foreach (int index in indexes)
|
||||
{
|
||||
if (!Searches[index].IsSeparator)
|
||||
{
|
||||
selected.Add(Searches[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
|
||||
private void FreezeAddress()
|
||||
{
|
||||
ToolHelpers.FreezeAddress(SelectedWatches);
|
||||
|
@ -852,7 +849,7 @@ namespace BizHawk.MultiClient
|
|||
private void MemoryDomainsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
MemoryDomainsSubMenu.DropDownItems.Clear();
|
||||
MemoryDomainsSubMenu.DropDownItems.AddRange(ToolHelpers.GenerateMemoryDomainMenuItems(SetMemoryDomain, Searches.DomainName, MaxSupportedSize));
|
||||
MemoryDomainsSubMenu.DropDownItems.AddRange(ToolHelpers.GenerateMemoryDomainMenuItems(SetMemoryDomain, Searches.Domain.Name, MaxSupportedSize));
|
||||
}
|
||||
|
||||
private void SizeSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
@ -1229,13 +1226,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (SelectedIndices.Count > 0)
|
||||
if (SelectedWatches.Any())
|
||||
{
|
||||
Global.MainForm.LoadHexEditor();
|
||||
Global.MainForm.HexEditor1.SetDomain(Settings.Domain);
|
||||
Global.MainForm.HexEditor1.GoToAddress(Searches[SelectedIndices[0]].Address.Value);
|
||||
|
||||
//TODO: secondary highlighted on remaining indexes
|
||||
ToolHelpers.ViewInHexEditor(Searches.Domain, SelectedWatches.Select(x => x.Address.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -188,9 +188,9 @@ namespace BizHawk.MultiClient
|
|||
get { return _watchList.Count; }
|
||||
}
|
||||
|
||||
public string DomainName
|
||||
public MemoryDomain Domain
|
||||
{
|
||||
get { return _settings.Domain.Name; }
|
||||
get { return _settings.Domain; }
|
||||
}
|
||||
|
||||
public void Update()
|
||||
|
|
|
@ -600,10 +600,10 @@ namespace BizHawk.MultiClient
|
|||
get
|
||||
{
|
||||
var selected = new List<Watch>();
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count > 0)
|
||||
ListView.SelectedIndexCollection indices = WatchListView.SelectedIndices;
|
||||
if (indices.Count > 0)
|
||||
{
|
||||
foreach (int index in indexes)
|
||||
foreach (int index in indices)
|
||||
{
|
||||
if (!Watches[index].IsSeparator)
|
||||
{
|
||||
|
@ -1141,12 +1141,19 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count > 0)
|
||||
var selected = SelectedWatches;
|
||||
if (selected.Any())
|
||||
{
|
||||
Global.MainForm.LoadHexEditor();
|
||||
Global.MainForm.HexEditor1.SetDomain(Watches[indexes[0]].Domain);
|
||||
Global.MainForm.HexEditor1.GoToAddress(Watches[indexes[0]].Address.Value);
|
||||
|
||||
if (selected.Select(x => x.Domain).Distinct().Count() > 1)
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(selected[0].Domain, new List<int> { selected.First().Address.Value });
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolHelpers.ViewInHexEditor(selected[0].Domain, selected.Select(x => x.Address.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue