@@ -20,6 +20,8 @@ public enum Mode { New, Duplicate, Edit }
2020 private Mode _mode = Mode . New ;
2121 private bool _loading = true ;
2222
23+ private string _sysBusDomainName = null ! ;
24+
2325 private bool _changedSize ;
2426 private bool _changedDisplayType ;
2527
@@ -29,6 +31,8 @@ public enum Mode { New, Duplicate, Edit }
2931
3032 private readonly HexTextBox AddressBox ;
3133
34+ private readonly TextBox AddressWithPointersBox ;
35+
3236 private readonly CheckBox BigEndianCheckBox ;
3337
3438 private readonly ComboBox DisplayTypeDropDown ;
@@ -49,6 +53,8 @@ private int SelectedWidth
4953
5054 private readonly ComboBox SizeDropDown ;
5155
56+ private readonly CheckBoxEx UsePointerSyntaxCheckbox ;
57+
5258 public WatchEditor ( )
5359 {
5460 _changedDisplayType = false ;
@@ -89,8 +95,40 @@ public WatchEditor()
8995 {
9096 Controls = { new LabelEx { Text = "0x" } , AddressBox } ,
9197 } ;
98+ AddressWithPointersBox = new ( ) { Size = new ( 100 , 20 ) , Visible = false } ;
99+ SingleColumnFLP flpAddrOptions = new ( )
100+ {
101+ Controls = { flpAddr , AddressWithPointersBox } ,
102+ } ;
92103 tlpMain . Controls . Add ( label1 , row : row , column : 0 ) ;
93- tlpMain . Controls . Add ( flpAddr , row : row , column : 1 ) ;
104+ tlpMain . Controls . Add ( flpAddrOptions , row : row , column : 1 ) ;
105+ row ++ ;
106+
107+ UsePointerSyntaxCheckbox = new ( ) { Enabled = MemoryDomains . HasSystemBus , Text = "Use pointer syntax" } ;
108+ UsePointerSyntaxCheckbox . CheckedChanged += ( checkedChangedSender , _ ) =>
109+ {
110+ var isChecked = ( ( CheckBox ) checkedChangedSender ) . Checked ;
111+ flpAddr . Visible = ! ( AddressWithPointersBox . Visible = isChecked ) ;
112+ if ( isChecked )
113+ {
114+ if ( ( string ) DomainDropDown . SelectedItem == _sysBusDomainName ! )
115+ {
116+ AddressWithPointersBox . Text = $ "0x{ AddressBox . Text } ";
117+ }
118+ else
119+ {
120+ DomainDropDown . SelectedItem = _sysBusDomainName ;
121+ AddressWithPointersBox . Text = string . Empty ;
122+ }
123+ AddressBox . Text = string . Empty ;
124+ }
125+ else
126+ {
127+ //TODO eval and copy back
128+ AddressWithPointersBox . Text = string . Empty ;
129+ }
130+ } ;
131+ tlpMain . Controls . Add ( UsePointerSyntaxCheckbox , row : row , column : 1 ) ;
94132 row ++ ;
95133
96134 LocLabelEx label3 = new ( ) { Anchor = AnchorStyles . Right , Text = "Size:" } ;
@@ -182,6 +220,7 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
182220 }
183221
184222 _loading = false ;
223+ _sysBusDomainName = MemoryDomains . SystemBus . ToString ( ) ;
185224 SetAddressBoxProperties ( ) ;
186225
187226 switch ( _mode )
@@ -201,7 +240,9 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
201240 NotesBox . Enabled = false ;
202241 NotesBox . Text = "" ;
203242
204- AddressBox . Enabled = false ;
243+ AddressBox . Enabled = AddressWithPointersBox . Enabled
244+ = UsePointerSyntaxCheckbox . Enabled
245+ = false ;
205246 AddressBox . Text = Watches . Select ( a => a . AddressString ) . Aggregate ( ( addrStr , nextStr ) => $ "{ addrStr } ,{ nextStr } ") ;
206247
207248 BigEndianCheckBox . ThreeState = true ;
@@ -215,7 +256,15 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
215256 {
216257 NotesBox . Text = Watches [ 0 ] . Notes ;
217258 NotesBox . Select ( ) ;
218- AddressBox . SetFromLong ( Watches [ 0 ] . Address ) ;
259+ if ( Watches [ 0 ] is NeoWatch neo )
260+ {
261+ UsePointerSyntaxCheckbox . Checked = true ;
262+ AddressWithPointersBox . Text = neo . AddressString ;
263+ }
264+ else
265+ {
266+ AddressBox . SetFromLong ( Watches [ 0 ] . Address ) ;
267+ }
219268 }
220269
221270 SetBigEndianCheckBox ( ) ;
@@ -316,17 +365,25 @@ private void Ok_Click(object sender, EventArgs e)
316365 default :
317366 case Mode . New :
318367 var domain = MemoryDomains . FirstOrDefault ( d => d . Name == DomainDropDown . SelectedItem . ToString ( ) ) ;
319- var address = AddressBox . ToLong ( ) ?? 0 ;
320368 var notes = NotesBox . Text ;
321369 var type = Watch . StringToDisplayType ( DisplayTypeDropDown . SelectedItem . ToString ( ) ) ;
322370 var bigEndian = BigEndianCheckBox . Checked ;
323- Watches . Add ( Watch . GenerateWatch (
324- domain ,
325- address ,
326- ( WatchSize ) SelectedWidth ,
327- type ,
328- bigEndian : bigEndian ,
329- note : notes ) ) ;
371+ var addrWithPointers = AddressWithPointersBox . Text ;
372+ if ( addrWithPointers . Length is not 0 )
373+ {
374+ //TODO
375+ }
376+ else
377+ {
378+ var address = AddressBox . ToLong ( ) ?? 0 ;
379+ Watches . Add ( Watch . GenerateWatch (
380+ domain ,
381+ address ,
382+ ( WatchSize ) SelectedWidth ,
383+ type ,
384+ bigEndian : bigEndian ,
385+ note : notes ) ) ;
386+ }
330387 break ;
331388 case Mode . Edit :
332389 DoEdit ( ) ;
0 commit comments