2015-08-02 22:19:12 -04:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
using System.Windows.Forms ;
using Mesen.GUI.Forms ;
namespace Mesen.GUI.Debugger
{
public partial class frmBreakpoint : BaseConfigForm
{
public frmBreakpoint ( Breakpoint breakpoint )
{
InitializeComponent ( ) ;
Entity = breakpoint ;
2016-01-09 13:15:43 -05:00
if ( breakpoint . Type > = BreakpointType . ReadVram ) {
radPpu . Checked = true ;
} else {
radCpu . Checked = true ;
}
2015-08-02 22:19:12 -04:00
2016-01-09 13:15:43 -05:00
AddBinding ( "SpecificAddress" , radSpecificAddress , radAnyAddress ) ;
2015-08-02 22:19:12 -04:00
AddBinding ( "Enabled" , chkEnabled ) ;
2016-01-09 13:15:43 -05:00
AddBinding ( "IsAbsoluteAddress" , chkAbsolute ) ;
2015-08-02 22:19:12 -04:00
AddBinding ( "Address" , txtAddress ) ;
2016-01-09 13:15:43 -05:00
AddBinding ( "BreakOnRead" , chkRead ) ;
AddBinding ( "BreakOnWrite" , chkWrite ) ;
AddBinding ( "BreakOnExec" , chkExec ) ;
AddBinding ( "BreakOnReadVram" , chkReadVram ) ;
AddBinding ( "BreakOnWriteVram" , chkWriteVram ) ;
AddBinding ( "Condition" , txtCondition ) ;
this . toolTip . SetToolTip ( this . chkAbsolute , "Check to set an absolute address based on the exact address in PRG/CHR ROM (not CPU/PPU memory)" ) ;
2016-02-13 23:14:56 -05:00
this . toolTip . SetToolTip ( this . picHelp , "Most expressions/operators are accepted (C++ syntax)." + Environment . NewLine + "Note: Use the $ prefix to denote hexadecimal values." + Environment . NewLine + Environment . NewLine + "A/X/Y/PS/SP: Value of registers" + Environment . NewLine + "Irq/Nmi: True if the Irq/Nmi flags are set" + Environment . NewLine + "Cycle/Scanline: Current cycle (0-340)/scanline(-1 to 260) of the PPU" + Environment . NewLine + "Value: Current value being read/written from/to memory" + Environment . NewLine + "[<address>]: Value at address (CPU)" + Environment . NewLine + Environment . NewLine + "Examples:" + Environment . NewLine + "a == 10 || x == $23" + Environment . NewLine + "scanline == 10 && (cycle >= 55 && cycle <= 100)" + Environment . NewLine + "x == [$150] || y == [10]" ) ;
2016-01-09 13:15:43 -05:00
}
protected override bool ValidateInput ( )
{
return chkRead . Checked | | chkWrite . Checked | | chkExec . Checked | | chkReadVram . Checked | | chkWriteVram . Checked | | txtCondition . Text . Length > 0 ;
2015-08-02 22:19:12 -04:00
}
2016-01-09 13:15:43 -05:00
private void txtAddress_Enter ( object sender , EventArgs e )
2015-08-02 22:19:12 -04:00
{
2016-01-09 13:15:43 -05:00
radSpecificAddress . Checked = true ;
}
private void chkWriteVram_Enter ( object sender , EventArgs e )
{
radPpu . Checked = true ;
}
private void chkRead_Enter ( object sender , EventArgs e )
{
radCpu . Checked = true ;
}
private void radCpu_CheckedChanged ( object sender , EventArgs e )
{
if ( radCpu . Checked ) {
chkReadVram . Checked = false ;
chkWriteVram . Checked = false ;
2015-08-02 22:19:12 -04:00
}
2016-01-09 13:15:43 -05:00
}
private void radPpu_CheckedChanged ( object sender , EventArgs e )
{
if ( radPpu . Checked ) {
chkRead . Checked = false ;
chkWrite . Checked = false ;
chkExec . Checked = false ;
2015-08-02 22:19:12 -04:00
}
}
}
}