Hex Editor - on restart don't reset the domain to domain 0 (unless the selected domain doesn't exist, such as in a core change)

This commit is contained in:
adelikat 2012-09-15 15:13:40 +00:00
parent 4a1c1be9ac
commit dd64c9d1c9
1 changed files with 34 additions and 0 deletions

View File

@ -247,12 +247,46 @@ namespace BizHawk.MultiClient
}
}
private int? GetDomainInt(string name)
{
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (Global.Emulator.MemoryDomains[i].Name == name)
{
return i;
}
}
return null;
}
public void Restart()
{
if (!this.IsHandleCreated || this.IsDisposed) return;
int? theDomain = null;
if (Domain.Name.ToLower() == "rom file")
{
theDomain = 999;
}
else
{
theDomain = GetDomainInt(Domain.Name);
}
SetMemoryDomainMenu(); //Calls update routines
if (theDomain != null)
{
SetMemoryDomain(theDomain ?? 0);
}
ResetScrollBar();
SetDataSize(DataSize);
UpdateValues();
AddressLabel.Text = GenerateAddressString();