@@ -25,6 +25,8 @@ public enum Mode
25
25
private Mode _mode = Mode . New ;
26
26
private bool _loading = true ;
27
27
28
+ private string _sysBusDomainName = null ! ;
29
+
28
30
private bool _changedSize ;
29
31
private bool _changedDisplayType ;
30
32
@@ -34,6 +36,8 @@ public enum Mode
34
36
35
37
private readonly HexTextBox AddressBox ;
36
38
39
+ private readonly TextBox AddressWithPointersBox ;
40
+
37
41
private readonly CheckBox BigEndianCheckBox ;
38
42
39
43
private readonly ComboBox DisplayTypeDropDown ;
@@ -54,6 +58,8 @@ private int SelectedWidth
54
58
55
59
private readonly ComboBox SizeDropDown ;
56
60
61
+ private readonly CheckBoxEx UsePointerSyntaxCheckbox ;
62
+
57
63
public WatchEditor ( )
58
64
{
59
65
_changedDisplayType = false ;
@@ -94,8 +100,40 @@ public WatchEditor()
94
100
{
95
101
Controls = { new LabelEx { Text = "0x" } , AddressBox } ,
96
102
} ;
103
+ AddressWithPointersBox = new ( ) { Size = new ( 100 , 20 ) , Visible = false } ;
104
+ SingleColumnFLP flpAddrOptions = new ( )
105
+ {
106
+ Controls = { flpAddr , AddressWithPointersBox } ,
107
+ } ;
97
108
tlpMain . Controls . Add ( label1 , row : row , column : 0 ) ;
98
- tlpMain . Controls . Add ( flpAddr , row : row , column : 1 ) ;
109
+ tlpMain . Controls . Add ( flpAddrOptions , row : row , column : 1 ) ;
110
+ row ++ ;
111
+
112
+ UsePointerSyntaxCheckbox = new ( ) { Enabled = MemoryDomains . HasSystemBus , Text = "Use pointer syntax" } ;
113
+ UsePointerSyntaxCheckbox . CheckedChanged += ( checkedChangedSender , _ ) =>
114
+ {
115
+ var isChecked = ( ( CheckBox ) checkedChangedSender ) . Checked ;
116
+ flpAddr . Visible = ! ( AddressWithPointersBox . Visible = isChecked ) ;
117
+ if ( isChecked )
118
+ {
119
+ if ( ( string ) DomainDropDown . SelectedItem == _sysBusDomainName ! )
120
+ {
121
+ AddressWithPointersBox . Text = $ "0x{ AddressBox . Text } ";
122
+ }
123
+ else
124
+ {
125
+ DomainDropDown . SelectedItem = _sysBusDomainName ;
126
+ AddressWithPointersBox . Text = string . Empty ;
127
+ }
128
+ AddressBox . Text = string . Empty ;
129
+ }
130
+ else
131
+ {
132
+ //TODO eval and copy back
133
+ AddressWithPointersBox . Text = string . Empty ;
134
+ }
135
+ } ;
136
+ tlpMain . Controls . Add ( UsePointerSyntaxCheckbox , row : row , column : 1 ) ;
99
137
row ++ ;
100
138
101
139
LocLabelEx label3 = new ( ) { Anchor = AnchorStyles . Right , Text = "Size:" } ;
@@ -187,6 +225,7 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
187
225
}
188
226
189
227
_loading = false ;
228
+ _sysBusDomainName = MemoryDomains . SystemBus . ToString ( ) ;
190
229
SetAddressBoxProperties ( ) ;
191
230
192
231
switch ( _mode )
@@ -206,7 +245,9 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
206
245
NotesBox . Enabled = false ;
207
246
NotesBox . Text = "" ;
208
247
209
- AddressBox . Enabled = false ;
248
+ AddressBox . Enabled = AddressWithPointersBox . Enabled
249
+ = UsePointerSyntaxCheckbox . Enabled
250
+ = false ;
210
251
AddressBox . Text = Watches . Select ( a => a . AddressString ) . Aggregate ( ( addrStr , nextStr ) => $ "{ addrStr } ,{ nextStr } ") ;
211
252
212
253
BigEndianCheckBox . ThreeState = true ;
@@ -220,7 +261,15 @@ private void RamWatchNewWatch_Load(object sender, EventArgs e)
220
261
{
221
262
NotesBox . Text = Watches [ 0 ] . Notes ;
222
263
NotesBox . Select ( ) ;
223
- AddressBox . SetFromLong ( Watches [ 0 ] . Address ) ;
264
+ if ( Watches [ 0 ] is NeoWatch neo )
265
+ {
266
+ UsePointerSyntaxCheckbox . Checked = true ;
267
+ AddressWithPointersBox . Text = neo . AddressString ;
268
+ }
269
+ else
270
+ {
271
+ AddressBox . SetFromLong ( Watches [ 0 ] . Address ) ;
272
+ }
224
273
}
225
274
226
275
SetBigEndianCheckBox ( ) ;
@@ -321,17 +370,25 @@ private void Ok_Click(object sender, EventArgs e)
321
370
default :
322
371
case Mode . New :
323
372
var domain = MemoryDomains . FirstOrDefault ( d => d . Name == DomainDropDown . SelectedItem . ToString ( ) ) ;
324
- var address = AddressBox . ToLong ( ) ?? 0 ;
325
373
var notes = NotesBox . Text ;
326
374
var type = Watch . StringToDisplayType ( DisplayTypeDropDown . SelectedItem . ToString ( ) ) ;
327
375
var bigEndian = BigEndianCheckBox . Checked ;
328
- Watches . Add ( Watch . GenerateWatch (
329
- domain ,
330
- address ,
331
- ( WatchSize ) SelectedWidth ,
332
- type ,
333
- bigEndian : bigEndian ,
334
- note : notes ) ) ;
376
+ var addrWithPointers = AddressWithPointersBox . Text ;
377
+ if ( addrWithPointers . Length is not 0 )
378
+ {
379
+ //TODO
380
+ }
381
+ else
382
+ {
383
+ var address = AddressBox . ToLong ( ) ?? 0 ;
384
+ Watches . Add ( Watch . GenerateWatch (
385
+ domain ,
386
+ address ,
387
+ ( WatchSize ) SelectedWidth ,
388
+ type ,
389
+ bigEndian : bigEndian ,
390
+ note : notes ) ) ;
391
+ }
335
392
break ;
336
393
case Mode . Edit :
337
394
DoEdit ( ) ;
0 commit comments