Gameboy - make debugger useful by connecting it to the multiclient events

This commit is contained in:
adelikat 2012-05-19 13:33:45 +00:00
parent abba87738f
commit b08d338761
5 changed files with 44 additions and 12 deletions

View File

@ -15,12 +15,16 @@ namespace BizHawk.Emulation.Consoles.Gameboy
{
public partial class Debugger : Form, Gameboy.IDebuggerAPI
{
readonly Gameboy gb;
public Debugger(Gameboy gb)
Gameboy gb;
public Debugger()
{
InitializeComponent();
}
public void LoadCore(Gameboy gb)
{
this.gb = gb;
gb.DebuggerAPI = this;
InitializeComponent();
Refresh();
}
@ -76,13 +80,15 @@ namespace BizHawk.Emulation.Consoles.Gameboy
bool Running = false;
void DoRun()
{
Running = true;
gb.RunForever();
Running = false;
Global.MainForm.UnpauseEmulator();
//Running = true;
//gb.RunForever();
//Running = false;
}
void DoBreak()
{
Global.MainForm.PauseEmulator(); //adelikat: This is probably "rounding" the break to the nearest frame, but without it, break fails
gb.DebugBreak = true;
}
@ -400,5 +406,24 @@ namespace BizHawk.Emulation.Consoles.Gameboy
autoloadToolStripMenuItem.Checked = Global.Config.AutoloadGBDebugger;
}
public void UpdateValues()
{
if (!this.IsHandleCreated || this.IsDisposed) return;
Refresh();
}
public void Restart()
{
if (!this.IsHandleCreated || this.IsDisposed) return;
if (Global.Emulator is Gameboy)
{
LoadCore(Global.Emulator as Gameboy);
}
else
{
this.Close();
}
}
}
}

View File

@ -1065,7 +1065,7 @@ namespace BizHawk.MultiClient
private void debuggerToolStripMenuItem1_Click(object sender, EventArgs e)
{
Global.MainForm.OpenGameboyDebugger();
Global.MainForm.LoadGBDebugger();
}
private void tAStudioToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -70,6 +70,7 @@ namespace BizHawk.MultiClient
public ToolBox ToolBox1 = new ToolBox();
public TI83KeyPad TI83KeyPad1 = new TI83KeyPad();
public TAStudio TAStudio1 = new TAStudio();
public Debugger GBDebugger = new Debugger();
#if WINDOWS
public LuaConsole LuaConsole1 = new LuaConsole();
#endif
@ -1924,6 +1925,7 @@ namespace BizHawk.MultiClient
PCEBGViewer1.UpdateValues();
PCEBGViewer1.Generate(); // TODO: just a makeshift. PCE core should provide callbacks.
TAStudio1.UpdateValues();
GBDebugger.UpdateValues();
}
private unsafe Image MakeScreenshotImage()
@ -2449,6 +2451,7 @@ namespace BizHawk.MultiClient
PCEBGViewer1.Restart();
TI83KeyPad1.Restart();
Cheats1.Restart();
GBDebugger.Restart();
ToolBox1.Restart();
#if WINDOWS
LuaConsole1.Restart();
@ -2780,12 +2783,17 @@ namespace BizHawk.MultiClient
#endif
}
public void OpenGameboyDebugger()
public void LoadGBDebugger()
{
if (Global.Emulator is Gameboy)
{
Debugger gbDebugger = new Debugger(Global.Emulator as Gameboy);
gbDebugger.Show();
if (!GBDebugger.IsHandleCreated || GBDebugger.IsDisposed)
{
GBDebugger.LoadCore(Global.Emulator as Gameboy);
GBDebugger.Show();
}
else
GBDebugger.Focus();
}
}

View File

@ -312,7 +312,6 @@ namespace BizHawk.MultiClient
private void PauseButton_Click(object sender, EventArgs e)
{
Global.MainForm.TogglePause();
}

View File

@ -133,7 +133,7 @@ namespace BizHawk.MultiClient
private void toolStripButton6_Click(object sender, EventArgs e)
{
Global.MainForm.OpenGameboyDebugger();
Global.MainForm.LoadGBDebugger();
}
}
}