void Reset(string romFilename) { // Gameboy itself doesn't support reset so i see no reason to contrive one. Just create a fresh one // Wait for previous frame to finish drawing while (drawFrame) { } drawFrame = false; bool consoleWndVisibile = (consoleWindow != null) ? consoleWindow.Visible : false; bool bgWndVisibile = (bgWnd != null) ? bgWnd.Visible : false; string rom = romFilename; dmg = new DmgSystem(); dmg.OnFrame = () => this.Draw(); // Bit hacky, maintain breakpoints between reset List <Breakpoint> breakpoints = null; if (dbgConsole != null) { breakpoints = dbgConsole.Breakpoints; } dbgConsole = new DmgDebugConsole(dmg); if (breakpoints != null) { dbgConsole.Breakpoints = breakpoints; } if (consoleWindow != null) { consoleWindow.Dispose(); } consoleWindow = new DmgConsoleWindow(dmg, dbgConsole); consoleWindow.Visible = consoleWndVisibile; consoleWindow.Location = new Point(Location.X + Width + 20, Location.Y); if (bgWnd != null) { bgWnd.Dispose(); } bgWnd = new BgWindow(dmg); bgWnd.Visible = bgWndVisibile; dmg.PowerOn(rom); this.Text = dmg.rom.RomName; dbgConsole.PeekSequentialInstructions(); dbgConsole.DmgMode = DmgDebugConsole.Mode.Running; }
public DmgConsoleWindow(DmgSystem dmg, DmgDebugConsole dbgConsole) { this.dmg = dmg; this.dbgConsole = dbgConsole; InitializeComponent(); this.ClientSize = new System.Drawing.Size(880, 775); this.Text = "DMG Console"; this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = FormBorderStyle.FixedDialog; // This is the only way i found to stop the annoying bong sound effect when pressing enter on a text box! this.Controls.Add(okButton); okButton.Visible = false; this.AcceptButton = okButton; codeWnd.Location = new System.Drawing.Point(10, 10); codeWnd.Multiline = true; codeWnd.ReadOnly = true; codeWnd.Width = 500; codeWnd.Height = 350; codeWnd.Enabled = true; codeWnd.Font = new Font(FontFamily.GenericMonospace, console.Font.Size); this.Controls.Add(codeWnd); console.Location = new System.Drawing.Point(10, 370); console.Multiline = true; console.ReadOnly = true; console.Width = 500; console.Height = 350; console.Enabled = true; console.Font = new Font(FontFamily.GenericMonospace, console.Font.Size); this.Controls.Add(console); commandInput.Location = new System.Drawing.Point(10, console.Location.Y + console.Height + 10); commandInput.Width = ClientSize.Width - 20; commandInput.KeyUp += CommandInput_KeyUp; this.Controls.Add(commandInput); commandInput.Focus(); dmgSnapshot.Location = new System.Drawing.Point(console.Location.X + console.Width + 10, 10); dmgSnapshot.Multiline = true; dmgSnapshot.Width = 350; dmgSnapshot.Height = 720; dmgSnapshot.Enabled = false; dmgSnapshot.Font = new Font(FontFamily.GenericMonospace, console.Font.Size); this.Controls.Add(dmgSnapshot); RefreshDmgSnapshot(); }