BasicBot - memory domain picker

This commit is contained in:
adelikat 2015-09-06 19:37:15 -04:00
parent 9116a94002
commit cf0c529601
2 changed files with 44 additions and 4 deletions

View File

@ -40,6 +40,8 @@
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.TurboWhileBottingMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MemoryDomainsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.RunBtn = new System.Windows.Forms.Button();
this.BotStatusStrip = new System.Windows.Forms.StatusStrip();
this.MessageLabel = new System.Windows.Forms.ToolStripStatusLabel();
@ -188,6 +190,7 @@
// OptionsSubMenu
//
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MemoryDomainsMenuItem,
this.TurboWhileBottingMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
@ -201,6 +204,20 @@
this.TurboWhileBottingMenuItem.Text = "Turbo While Botting";
this.TurboWhileBottingMenuItem.Click += new System.EventHandler(this.TurboWhileBottingMenuItem_Click);
//
// MemoryDomainsMenuItem
//
this.MemoryDomainsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripSeparator3});
this.MemoryDomainsMenuItem.Name = "MemoryDomainsMenuItem";
this.MemoryDomainsMenuItem.Size = new System.Drawing.Size(181, 22);
this.MemoryDomainsMenuItem.Text = "Memory Domains";
this.MemoryDomainsMenuItem.DropDownOpened += new System.EventHandler(this.MemoryDomainsMenuItem_DropDownOpened);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
//
// RunBtn
//
this.RunBtn.Location = new System.Drawing.Point(6, 56);
@ -781,5 +798,7 @@
private System.Windows.Forms.ToolStripStatusLabel MessageLabel;
private System.Windows.Forms.GroupBox ControlGroupBox;
private System.Windows.Forms.ToolStripMenuItem TurboWhileBottingMenuItem;
private System.Windows.Forms.ToolStripMenuItem MemoryDomainsMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
}
}

View File

@ -29,6 +29,8 @@ namespace BizHawk.Client.EmuHawk
private bool _dontUpdateValues = false;
private MemoryDomain _currentDomain;
#region Services and Settings
[RequiredService]
@ -330,7 +332,14 @@ namespace BizHawk.Client.EmuHawk
public void Restart()
{
// TODO
if (_currentDomain == null ||
MemoryDomains.Contains(_currentDomain))
{
_currentDomain = MemoryDomains.MainMemory;
}
// TODO restart logic
}
public bool AskSaveChanges()
@ -429,6 +438,14 @@ namespace BizHawk.Client.EmuHawk
TurboWhileBottingMenuItem.Checked = Settings.TurboWhenBotting;
}
private void MemoryDomainsMenuItem_DropDownOpened(object sender, EventArgs e)
{
MemoryDomainsMenuItem.DropDownItems.Clear();
MemoryDomainsMenuItem.DropDownItems.AddRange(
MemoryDomains.MenuItems(SetMemoryDomain, _currentDomain.Name)
.ToArray());
}
private void TurboWhileBottingMenuItem_Click(object sender, EventArgs e)
{
Settings.TurboWhenBotting ^= true;
@ -575,11 +592,15 @@ namespace BizHawk.Client.EmuHawk
#endregion
private void SetMemoryDomain(string name)
{
_currentDomain = MemoryDomains[name];
}
private int GetRamvalue(int addr)
{
// TODO: ability to pick memory domain
// TODO: ability to pick byte size/display type
return MemoryDomains.MainMemory.PeekByte(addr);
// TODO: ability to pick byte size/display type/endian
return _currentDomain.PeekByte(addr);
}
private void Update(bool fast)