File tree Expand file tree Collapse file tree 5 files changed +11
-19
lines changed
src/BizHawk.Client.Common/tools/Watch Expand file tree Collapse file tree 5 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -99,10 +99,6 @@ public string FormatValue(byte val)
99
99
100
100
public override string Diff => $ "{ _value - _previous : +#;-#;0} ";
101
101
102
- public override bool IsValid => Domain . Size == 0 || Address < Domain . Size ;
103
-
104
- public override uint MaxValue => byte . MaxValue ;
105
-
106
102
public override int Value => GetByte ( ) ;
107
103
108
104
public override string ValueString => FormatValue ( GetByte ( ) ) ;
Original file line number Diff line number Diff line change @@ -100,10 +100,6 @@ public string FormatValue(uint val)
100
100
101
101
public override string Diff => $ "{ _value - ( long ) _previous : +#;-#;0} ";
102
102
103
- public override bool IsValid => Domain . Size == 0 || Address < ( Domain . Size - 3 ) ;
104
-
105
- public override uint MaxValue => uint . MaxValue ;
106
-
107
103
public override int Value => ( int ) GetDWord ( ) ;
108
104
109
105
public override string ValueString => FormatValue ( GetDWord ( ) ) ;
Original file line number Diff line number Diff line change @@ -90,11 +90,6 @@ public override void ResetPrevious()
90
90
/// </summary>
91
91
public override string Diff => "" ;
92
92
93
- /// <summary>
94
- /// Ignore that stuff
95
- /// </summary>
96
- public override uint MaxValue => 0 ;
97
-
98
93
/// <summary>
99
94
/// Ignore that stuff
100
95
/// </summary>
Original file line number Diff line number Diff line change @@ -502,7 +502,15 @@ public override string ToString()
502
502
/// <summary>
503
503
/// Gets the maximum possible value
504
504
/// </summary>
505
- public abstract uint MaxValue { get ; }
505
+ public uint MaxValue
506
+ => Size switch
507
+ {
508
+ WatchSize . Separator => 0 ,
509
+ WatchSize . Byte => byte . MaxValue ,
510
+ WatchSize . Word => ushort . MaxValue ,
511
+ WatchSize . DWord => uint . MaxValue ,
512
+ _ => throw new InvalidOperationException ( )
513
+ } ;
506
514
507
515
/// <summary>
508
516
/// Gets the current value
@@ -517,7 +525,8 @@ public override string ToString()
517
525
/// <summary>
518
526
/// Returns true if the Watch is valid, false otherwise
519
527
/// </summary>
520
- public abstract bool IsValid { get ; }
528
+ public virtual bool IsValid
529
+ => Domain . Size is 0 || Address <= Domain . Size - unchecked ( ( long ) Size ) ;
521
530
522
531
/// <summary>
523
532
/// Try to sets the value into the <see cref="MemoryDomain"/>
Original file line number Diff line number Diff line change @@ -98,10 +98,6 @@ public string FormatValue(ushort val)
98
98
99
99
public override string Diff => $ "{ _value - _previous : +#;-#;0} ";
100
100
101
- public override bool IsValid => Domain . Size == 0 || Address < ( Domain . Size - 1 ) ;
102
-
103
- public override uint MaxValue => ushort . MaxValue ;
104
-
105
101
public override int Value => GetWord ( ) ;
106
102
107
103
public override string ValueString => FormatValue ( GetWord ( ) ) ;
You can’t perform that action at this time.
0 commit comments