This commit is contained in:
hegyak 2015-12-01 16:48:23 -08:00
commit addb22ea39
20 changed files with 961 additions and 460 deletions

View File

@ -239,7 +239,9 @@
<Compile Include="tools\RamSearchEngine.cs" /> <Compile Include="tools\RamSearchEngine.cs" />
<Compile Include="tools\Watch\SeparatorWatch.cs" /> <Compile Include="tools\Watch\SeparatorWatch.cs" />
<Compile Include="tools\Watch\Watch.cs" /> <Compile Include="tools\Watch\Watch.cs" />
<Compile Include="tools\Watch\WatchList.cs" /> <Compile Include="tools\Watch\WatchList\WatchDomainComparer.cs" />
<Compile Include="tools\Watch\WatchList\WatchAddressComparer.cs" />
<Compile Include="tools\Watch\WatchList\WatchList.cs" />
<Compile Include="tools\Watch\WatchSize.cs" /> <Compile Include="tools\Watch\WatchSize.cs" />
<Compile Include="tools\Watch\WordWatch.cs" /> <Compile Include="tools\Watch\WordWatch.cs" />
<Compile Include="XmlGame.cs" /> <Compile Include="XmlGame.cs" />

View File

@ -248,12 +248,12 @@ namespace BizHawk.Client.Common
case WatchSize.Separator: case WatchSize.Separator:
return false; return false;
case WatchSize.Byte: case WatchSize.Byte:
return (_watch.Address ?? 0) == addr; return _watch.Address == addr;
case WatchSize.Word: case WatchSize.Word:
return (addr == (_watch.Address ?? 0)) || (addr == (_watch.Address ?? 0) + 1); return (addr == _watch.Address) || (addr == (_watch.Address) + 1);
case WatchSize.DWord: case WatchSize.DWord:
return (addr == (_watch.Address ?? 0)) || (addr == (_watch.Address ?? 0) + 1) || return (addr == (_watch.Address)) || (addr == (_watch.Address) + 1) ||
(addr == (_watch.Address ?? 0) + 2) || (addr == (_watch.Address ?? 0) + 3); (addr == (_watch.Address) + 2) || (addr == (_watch.Address) + 3);
} }
} }
@ -271,22 +271,22 @@ namespace BizHawk.Client.Common
case WatchSize.Byte: case WatchSize.Byte:
return (byte?)_val; return (byte?)_val;
case WatchSize.Word: case WatchSize.Word:
if (addr == (_watch.Address ?? 0)) if (addr == (_watch.Address))
{ {
return (byte)(_val >> 8); return (byte)(_val >> 8);
} }
return (byte)(_val & 0xFF); return (byte)(_val & 0xFF);
case WatchSize.DWord: case WatchSize.DWord:
if (addr == (_watch.Address ?? 0)) if (addr == (_watch.Address))
{ {
return (byte)((_val >> 24) & 0xFF); return (byte)((_val >> 24) & 0xFF);
} }
else if (addr == (_watch.Address ?? 0) + 1) else if (addr == (_watch.Address) + 1)
{ {
return (byte)((_val >> 16) & 0xFF); return (byte)((_val >> 16) & 0xFF);
} }
else if (addr == ((_watch.Address ?? 0)) + 2) else if (addr == ((_watch.Address)) + 2)
{ {
return (byte)((_val >> 8) & 0xFF); return (byte)((_val >> 8) & 0xFF);
} }

View File

@ -346,7 +346,7 @@ namespace BizHawk.Client.Common
_history.AddState(_watchList); _history.AddState(_watchList);
} }
var addresses = watches.Select(x => x.Address ?? 0); var addresses = watches.Select(x => x.Address);
var removeList = _watchList.Where(x => !addresses.Contains(x.Address)).ToList(); var removeList = _watchList.Where(x => !addresses.Contains(x.Address)).ToList();
} }

View File

@ -80,136 +80,6 @@ namespace BizHawk.Client.Common
_previous = GetByte(); _previous = GetByte();
} }
/// <summary>
/// Update the Watch (read it from <see cref="MemoryDomain"/>
/// </summary>
public override void Update()
{
switch (Global.Config.RamWatchDefinePrevious)
{
case PreviousType.Original:
return;
case PreviousType.LastChange:
var temp = _value;
_value = GetByte();
if (_value != temp)
{
_previous = _value;
_changecount++;
}
break;
case PreviousType.LastFrame:
_previous = _value;
_value = GetByte();
if (_value != Previous)
{
_changecount++;
}
break;
}
}
#endregion
//TODO: Implements IFormattable
public string FormatValue(byte val)
{
switch (Type)
{
default:
case DisplayType.Unsigned:
return val.ToString();
case DisplayType.Signed:
return ((sbyte)val).ToString();
case DisplayType.Hex:
return val.ToHexString(2);
case DisplayType.Binary:
return Convert.ToString(val, 2).PadLeft(8, '0').Insert(4, " ");
}
}
#endregion
/*public override string ToString()
{
return Notes + ": " + ValueString;
}*/
#region Properties
#region Implements
/// <summary>
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff
{
get
{
string diff = string.Empty;
byte diffVal = Convert.ToByte(_value - _previous);
if (diffVal > 0)
{
diff = "+";
}
else if (diffVal < 0)
{
diff = "-";
}
return string.Format("{0}{1}", diff, FormatValue(diffVal));
}
}
/// <summary>
/// Get the maximum possible value
/// </summary>
public override uint MaxValue
{
get
{
return byte.MaxValue;
}
}
/// <summary>
/// Get the current value
/// </summary>
public override int Value
{
get
{
return GetByte();
}
}
/// <summary>
/// Gets the current value
/// but with stuff I don't understand
/// </summary>
/// <remarks>zero 15-nov-2015 - bypass LIAR LOGIC, see fdc9ea2aa922876d20ba897fb76909bf75fa6c92 https://github.com/TASVideos/BizHawk/issues/326 </remarks>
public override int ValueNoFreeze
{
get
{
return GetByte(true);
}
}
/// <summary>
/// Get a string representation of the current value
/// </summary>
public override string ValueString
{
get
{
return FormatValue(_value);
}
}
/// <summary> /// <summary>
/// Try to sets the value into the <see cref="MemoryDomain"/> /// Try to sets the value into the <see cref="MemoryDomain"/>
/// at the current <see cref="Watch"/> address /// at the current <see cref="Watch"/> address
@ -290,6 +160,131 @@ namespace BizHawk.Client.Common
} }
} }
/// <summary>
/// Update the Watch (read it from <see cref="MemoryDomain"/>
/// </summary>
public override void Update()
{
switch (Global.Config.RamWatchDefinePrevious)
{
case PreviousType.Original:
return;
case PreviousType.LastChange:
var temp = _value;
_value = GetByte();
if (_value != temp)
{
_previous = _value;
_changecount++;
}
break;
case PreviousType.LastFrame:
_previous = _value;
_value = GetByte();
if (_value != Previous)
{
_changecount++;
}
break;
}
}
#endregion Implements
//TODO: Implements IFormattable
public string FormatValue(byte val)
{
switch (Type)
{
default:
case DisplayType.Unsigned:
return val.ToString();
case DisplayType.Signed:
return ((sbyte)val).ToString();
case DisplayType.Hex:
return val.ToHexString(2);
case DisplayType.Binary:
return Convert.ToString(val, 2).PadLeft(8, '0').Insert(4, " ");
}
}
#endregion
#region Properties
#region Implements
/// <summary>
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff
{
get
{
string diff = string.Empty;
byte diffVal = Convert.ToByte(_value - _previous);
if (diffVal > 0)
{
diff = "+";
}
else if (diffVal < 0)
{
diff = "-";
}
return string.Format("{0}{1}", diff, FormatValue(diffVal));
}
}
/// <summary>
/// Get the maximum possible value
/// </summary>
public override uint MaxValue
{
get
{
return byte.MaxValue;
}
}
/// <summary>
/// Get the current value
/// </summary>
public override int Value
{
get
{
return GetByte();
}
}
/// <summary>
/// Gets the current value
/// but with stuff I don't understand
/// </summary>
/// <remarks>zero 15-nov-2015 - bypass LIAR LOGIC, see fdc9ea2aa922876d20ba897fb76909bf75fa6c92 https://github.com/TASVideos/BizHawk/issues/326 </remarks>
public override int ValueNoFreeze
{
get
{
return GetByte(true);
}
}
/// <summary>
/// Get a string representation of the current value
/// </summary>
public override string ValueString
{
get
{
return FormatValue(_value);
}
}
/// <summary> /// <summary>
/// Get the previous value /// Get the previous value
/// </summary> /// </summary>

View File

@ -9,6 +9,9 @@ using System.Text;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
/// <summary>
/// This class holds a double word (32 bits) <see cref="Watch"/>
/// </summary>
public sealed class DWordWatch : Watch public sealed class DWordWatch : Watch
{ {
#region Fields #region Fields
@ -20,6 +23,18 @@ namespace BizHawk.Client.Common
#region cTor(s) #region cTor(s)
/// <summary>
/// Inialize a new instance of <see cref="DWordWatch"/>
/// </summary>
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <param name="value">Current value</param>
/// <param name="previous">Previous value</param>
/// <param name="changeCount">How many times value has changed</param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.DWord"/></exception>
internal DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, uint value, uint previous, int changeCount) internal DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, uint value, uint previous, int changeCount)
: base(domain, address, WatchSize.DWord, type, bigEndian, note) : base(domain, address, WatchSize.DWord, type, bigEndian, note)
{ {
@ -28,15 +43,13 @@ namespace BizHawk.Client.Common
this._changecount = changeCount; this._changecount = changeCount;
} }
internal DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note)
:this(domain, address, type, bigEndian, note, 0, 0, 0)
{
_previous = GetDWord();
_value = GetDWord();
}
#endregion #endregion
#region Methods
/// <summary>
/// Enumerate wich <see cref="DisplayType"/> are valid for a <see cref="DWordWatch"/>
/// </summary>
public static IEnumerable<DisplayType> ValidTypes public static IEnumerable<DisplayType> ValidTypes
{ {
get get
@ -51,80 +64,31 @@ namespace BizHawk.Client.Common
} }
} }
#region Implements
/// <summary>
/// Get a list a <see cref="DisplayType"/> that can be used for this <see cref="DWordWatch"/>
/// </summary>
/// <returns>An enumartion that contains all valid <see cref="DisplayType"/></returns>
public override IEnumerable<DisplayType> AvailableTypes() public override IEnumerable<DisplayType> AvailableTypes()
{ {
yield return DisplayType.Unsigned; return ValidTypes;
yield return DisplayType.Signed;
yield return DisplayType.Hex;
yield return DisplayType.Binary;
yield return DisplayType.FixedPoint_20_12;
yield return DisplayType.FixedPoint_16_16;
yield return DisplayType.Float;
}
public override int Value
{
get { return (int)GetDWord(); }
}
public override int ValueNoFreeze
{
get { return (int)GetDWord(true); }
}
public override int Previous
{
get { return (int)_previous; }
}
public override string PreviousStr
{
get { return FormatValue(_previous); }
} }
/// <summary>
/// Reset the previous value; set it to the current one
/// </summary>
public override void ResetPrevious() public override void ResetPrevious()
{ {
_previous = GetWord(); _previous = GetWord();
} }
public override uint MaxValue /// <summary>
{ /// Try to sets the value into the <see cref="MemoryDomain"/>
get { return uint.MaxValue; } /// at the current <see cref="Watch"/> address
} /// </summary>
/// <param name="value">Value to set</param>
public override string ValueString /// <returns>True if value successfully sets; othewise, false</returns>
{
get { return FormatValue(GetDWord()); }
}
/*public override string ToString()
{
return Notes + ": " + ValueString;
}*/
public string FormatValue(uint val)
{
switch (Type)
{
default:
case DisplayType.Unsigned:
return val.ToString();
case DisplayType.Signed:
return ((int)val).ToString();
case DisplayType.Hex:
return val.ToHexString(8);
case DisplayType.FixedPoint_20_12:
return string.Format("{0:0.######}", val / 4096.0);
case DisplayType.FixedPoint_16_16:
return string.Format("{0:0.######}", val / 65536.0);
case DisplayType.Float:
var bytes = BitConverter.GetBytes(val);
var _float = BitConverter.ToSingle(bytes, 0);
//return string.Format("{0:0.######}", _float);
return _float.ToString(); // adelikat: decided that we like sci notation instead of spooky rounding
}
}
public override bool Poke(string value) public override bool Poke(string value)
{ {
try try
@ -221,11 +185,9 @@ namespace BizHawk.Client.Common
} }
} }
public override string Diff /// <summary>
{ /// Update the Watch (read it from <see cref="MemoryDomain"/>
get { return FormatValue(_previous - _value); } /// </summary>
}
public override void Update() public override void Update()
{ {
switch (Global.Config.RamWatchDefinePrevious) switch (Global.Config.RamWatchDefinePrevious)
@ -253,5 +215,120 @@ namespace BizHawk.Client.Common
break; break;
} }
} }
#endregion Implements
//TODO: Implements IFormattable
public string FormatValue(uint val)
{
switch (Type)
{
default:
case DisplayType.Unsigned:
return val.ToString();
case DisplayType.Signed:
return ((int)val).ToString();
case DisplayType.Hex:
return val.ToHexString(8);
case DisplayType.FixedPoint_20_12:
return string.Format("{0:0.######}", val / 4096.0);
case DisplayType.FixedPoint_16_16:
return string.Format("{0:0.######}", val / 65536.0);
case DisplayType.Float:
var bytes = BitConverter.GetBytes(val);
var _float = BitConverter.ToSingle(bytes, 0);
//return string.Format("{0:0.######}", _float);
return _float.ToString(); // adelikat: decided that we like sci notation instead of spooky rounding
}
}
#endregion
#region Properties
#region Implements
/// <summary>
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff
{
get
{
return FormatValue(_previous - _value);
}
}
/// <summary>
/// Get the maximum possible value
/// </summary>
public override uint MaxValue
{
get
{
return uint.MaxValue;
}
}
/// <summary>
/// Get the current value
/// </summary>
public override int Value
{
get
{
return (int)GetDWord();
}
}
/// <summary>
/// Gets the current value
/// but with stuff I don't understand
/// </summary>
public override int ValueNoFreeze
{
get
{
return (int)GetDWord(true);
}
}
/// <summary>
/// Get a string representation of the current value
/// </summary>
public override string ValueString
{
get
{
return FormatValue(GetDWord());
}
}
/// <summary>
/// Get the previous value
/// </summary>
public override int Previous
{
get
{
return (int)_previous;
}
}
/// <summary>
/// Get a string representation of the previous value
/// </summary>
public override string PreviousStr
{
get
{
return FormatValue(_previous);
}
}
#endregion Implements
#endregion
} }
} }

View File

@ -3,37 +3,73 @@ using System.Collections.Generic;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
/// <summary>
/// This class holds a separator for RamWatch
/// Use the static property Instance to get it
/// </summary>
public sealed class SeparatorWatch : Watch public sealed class SeparatorWatch : Watch
{ {
/// <summary>
/// Initialize a new separator instance
/// </summary>
internal SeparatorWatch() internal SeparatorWatch()
:base(null, 0, WatchSize.Separator, DisplayType.Separator, true, string.Empty) :base(null, 0, WatchSize.Separator, DisplayType.Separator, true, string.Empty)
{ } { }
/// <summary>
/// Gets the separator instance
/// </summary>
public static SeparatorWatch Instance public static SeparatorWatch Instance
{ {
get { return new SeparatorWatch(); } get { return new SeparatorWatch(); }
} }
/// <summary>
/// Get the appropriate DisplayType
/// </summary>
/// <returns>DisplayType.Separator nothing else</returns>
public override IEnumerable<DisplayType> AvailableTypes()
{
yield return DisplayType.Separator;
}
#region Stuff to ignore
/// <summary>
/// Ignore that stuff
/// </summary>
public override int Value public override int Value
{ {
get { return 0; } get { return 0; }
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override int ValueNoFreeze public override int ValueNoFreeze
{ {
get { return 0; } get { return 0; }
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override int Previous public override int Previous
{ {
get { return 0; } get { return 0; }
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override string ValueString public override string ValueString
{ {
get { return string.Empty; } get { return string.Empty; }
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override string PreviousStr public override string PreviousStr
{ {
get { return string.Empty; } get { return string.Empty; }
@ -44,28 +80,40 @@ namespace BizHawk.Client.Common
return "----"; return "----";
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override bool Poke(string value) public override bool Poke(string value)
{ {
return false; return false;
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override void ResetPrevious() public override void ResetPrevious()
{ {
return; return;
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override string Diff { get { return string.Empty; } } public override string Diff { get { return string.Empty; } }
/// <summary>
/// Ignore that stuff
/// </summary>
public override uint MaxValue public override uint MaxValue
{ {
get { return 0; } get { return 0; }
} }
/// <summary>
/// Ignore that stuff
/// </summary>
public override void Update() { return; } public override void Update() { return; }
public override IEnumerable<DisplayType> AvailableTypes() #endregion
{
yield return DisplayType.Separator;
}
} }
} }

View File

@ -429,10 +429,16 @@ namespace BizHawk.Client.Common
/// <returns>True if both object are equals; otherwise, false</returns> /// <returns>True if both object are equals; otherwise, false</returns>
public bool Equals(Watch other) public bool Equals(Watch other)
{ {
return !object.ReferenceEquals(other, null) && if (object.ReferenceEquals(other, null))
this._domain == other._domain && {
this._address == other._address && return false;
this._size == other._size; }
else
{
return this._domain == other._domain &&
this._address == other._address &&
this._size == other._size;
}
} }
#endregion IEquatable<Watch> #endregion IEquatable<Watch>
@ -478,7 +484,7 @@ namespace BizHawk.Client.Common
{ {
return 1; return 1;
} }
else if (_address.Equals(other._address)) else if (_address.Equals(other._address))
{ {
return ((int)_size).CompareTo((int)other._size); return ((int)_size).CompareTo((int)other._size);
} }
@ -518,7 +524,7 @@ namespace BizHawk.Client.Common
/// <returns>int that can serves as a unique representation of current Watch</returns> /// <returns>int that can serves as a unique representation of current Watch</returns>
public override int GetHashCode() public override int GetHashCode()
{ {
return this.Domain.GetHashCode() + (int)(this.Address ?? 0); return this.Domain.GetHashCode() + (int)(this.Address);
} }
/// <summary> /// <summary>
@ -539,7 +545,7 @@ namespace BizHawk.Client.Common
public override string ToString() public override string ToString()
{ {
return string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}" return string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}"
, (Address ?? 0).ToHexString((Domain.Size - 1).NumHexDigits()) , Address.ToHexString((Domain.Size - 1).NumHexDigits())
, SizeAsChar , SizeAsChar
, TypeAsChar , TypeAsChar
, Convert.ToInt32(BigEndian) , Convert.ToInt32(BigEndian)
@ -605,7 +611,7 @@ namespace BizHawk.Client.Common
/// <summary> /// <summary>
/// Gets the address in the <see cref="MemoryDomain"/> /// Gets the address in the <see cref="MemoryDomain"/>
/// </summary> /// </summary>
public long? Address public long Address
{ {
get get
{ {
@ -699,9 +705,16 @@ namespace BizHawk.Client.Common
{ {
return _domain; return _domain;
} }
set internal set
{ {
_domain = value; if (_domain.Name == value.Name)
{
_domain = value;
}
else
{
throw new InvalidOperationException("You cannot set diffrent domain to a watch on the fly");
}
} }
} }
@ -719,7 +732,7 @@ namespace BizHawk.Client.Common
} }
else else
{ {
return null; return string.Empty;
} }
} }
} }

View File

@ -0,0 +1,94 @@
using System.Collections.Generic;
namespace BizHawk.Client.Common
{
/// <summary>
/// This class hold a collection <see cref="Watch"/>
/// Different memory domain can be mixed
/// </summary>
public sealed partial class WatchList
{
/// <summary>
/// Netsed private class that define how to compare two <see cref="Watch"/>
/// based on their address
/// </summary>
private struct WatchAddressComparer
: IEqualityComparer<Watch>,
IComparer<Watch>
{
/// <summary>
/// Compare two <see cref="Watch"/> between them
/// and determine wich one comes first.
/// If they are equals, comapraison will done one the domain and next on size
/// </summary>
/// <param name="x">First <see cref="Watch"/></param>
/// <returns>True if <see cref="Watch"/> are equal; otherwise, false</returns>
/// <returns></returns>
public int Compare(Watch x, Watch y)
{
if (Equals(x, y))
{
return 0;
}
else if (x.Address.Equals(y.Address))
{
if (x.Domain.Name.Equals(y.Domain.Name))
{
return x.Size.CompareTo(y.Size);
}
else
{
return x.Domain.Name.CompareTo(y.Domain.Name);
}
}
else
{
return x.Address.CompareTo(y.Address);
}
}
/// <summary>
/// Determine if two <see cref="Watch"/> are equals
/// </summary>
/// <param name="x">First <see cref="Watch"/></param>
/// <param name="y">Second <see cref="Watch"/></param>
/// <returns>True if <see cref="Watch"/> are equal; otherwise, false</returns>
public bool Equals(Watch x, Watch y)
{
if (object.ReferenceEquals(x, null))
{
if (object.ReferenceEquals(y, null))
{
return true;
}
else
{
return false;
}
}
else if (object.ReferenceEquals(y, null))
{
return false;
}
else if (object.ReferenceEquals(x, y))
{
return true;
}
else
{
return x.Address.Equals(y.Address);
}
}
/// <summary>
/// Get the hash value of specified <see cref="Watch"/>
/// </summary>
/// <param name="obj">Watch to get hash</param>
/// <returns>int that can serves as a unique representation of current Watch</returns>
public int GetHashCode(Watch obj)
{
return obj.GetHashCode();
}
}
}
}

View File

@ -0,0 +1,94 @@
using System.Collections.Generic;
namespace BizHawk.Client.Common
{
/// <summary>
/// This class hold a collection <see cref="Watch"/>
/// Different memory domain can be mixed
/// </summary>
public sealed partial class WatchList
{
/// <summary>
/// Netsed private class that define how to compare two <see cref="Watch"/>
/// based on their domain
/// </summary>
private struct WatchDomainComparer
: IEqualityComparer<Watch>,
IComparer<Watch>
{
/// <summary>
/// Compare two <see cref="Watch"/> between them
/// and determine wich one comes first.
/// If they are equals, comapraison will done one the address and next on size
/// </summary>
/// <param name="x">First <see cref="Watch"/></param>
/// <returns>True if <see cref="Watch"/> are equal; otherwise, false</returns>
/// <returns></returns>
public int Compare(Watch x, Watch y)
{
if(Equals(x, y))
{
return 0;
}
else if(x.Domain.Name.Equals(y.Domain.Name))
{
if (x.Address.Equals(y.Address))
{
return x.Size.CompareTo(y.Size);
}
else
{
return x.Address.CompareTo(y.Address);
}
}
else
{
return x.Domain.Name.CompareTo(y.Domain.Name);
}
}
/// <summary>
/// Determine if two <see cref="Watch"/> are equals
/// </summary>
/// <param name="x">First <see cref="Watch"/></param>
/// <param name="y">Second <see cref="Watch"/></param>
/// <returns>True if <see cref="Watch"/> are equal; otherwise, false</returns>
public bool Equals(Watch x, Watch y)
{
if(object.ReferenceEquals(x, null))
{
if(object.ReferenceEquals(y, null))
{
return true;
}
else
{
return false;
}
}
else if(object.ReferenceEquals(y, null))
{
return false;
}
else if(object.ReferenceEquals(x,y))
{
return true;
}
else
{
return x.Domain.Name.Equals(y.Domain.Name);
}
}
/// <summary>
/// Get the hash value of specified <see cref="Watch"/>
/// </summary>
/// <param name="obj">Watch to get hash</param>
/// <returns>int that can serves as a unique representation of current Watch</returns>
public int GetHashCode(Watch obj)
{
return obj.GetHashCode();
}
}
}
}

View File

@ -1,23 +1,27 @@
using System.Collections; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using BizHawk.Common.NumberExtensions; using BizHawk.Common.NumberExtensions;
using BizHawk.Common.StringExtensions; using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public class WatchList : IList<Watch> /// <summary>
/// This class hold a collection <see cref="Watch"/>
/// Different memory domain can be mixed
/// </summary>
public sealed partial class WatchList
: IList<Watch>
{ {
private IMemoryDomains _memoryDomains; #region Fields
private List<Watch> _watchList = new List<Watch>();
private MemoryDomain _domain;
private string _currentFilename = string.Empty;
private string _systemid;
public const string ADDRESS = "AddressColumn"; public const string ADDRESS = "AddressColumn";
public const string VALUE = "ValueColumn"; public const string VALUE = "ValueColumn";
@ -27,14 +31,62 @@ namespace BizHawk.Client.Common
public const string DOMAIN = "DomainColumn"; public const string DOMAIN = "DomainColumn";
public const string NOTES = "NotesColumn"; public const string NOTES = "NotesColumn";
private static readonly WatchDomainComparer domainComparer = new WatchDomainComparer();
private static readonly WatchAddressComparer addressComparer = new WatchAddressComparer();
private static IMemoryDomains _memoryDomains;
private List<Watch> _watchList = new List<Watch>(0);
private MemoryDomain _domain;
private string _currentFilename = string.Empty;
private string _systemid;
#endregion
#region cTor(s)
/// <summary>
/// Initialize a new instance of <see cref="WatchList"/> that will
/// contains a set of <see cref="Watch"/>
/// </summary>
/// <param name="core">All available memomry domains</param>
/// <param name="domain">Domain you want to watch</param>
/// <param name="systemid">System identifier (NES, SNES, ...)</param>
[Obsolete("Use the constructor with two parameters instead")]
public WatchList(IMemoryDomains core, MemoryDomain domain, string systemid) public WatchList(IMemoryDomains core, MemoryDomain domain, string systemid)
{ {
_memoryDomains = core; if (_memoryDomains == null)
{
_memoryDomains = core;
}
_domain = domain; _domain = domain;
_systemid = systemid; _systemid = systemid;
} }
public void RefreshDomans(IMemoryDomains core, MemoryDomain domain) /// <summary>
/// Initialize a new instance of <see cref="WatchList"/> that will
/// contains a set of <see cref="Watch"/>
/// </summary>
/// <param name="core">All available memomry domains</param>
/// <param name="domain">Domain you want to watch</param>
/// <param name="systemid">System identifier (NES, SNES, ...)</param>
public WatchList(IMemoryDomains core, string systemid)
{
if (_memoryDomains == null)
{
_memoryDomains = core;
}
//TODO: Remove this after tests
_domain = core.MainMemory;
_systemid = systemid;
}
#endregion
#region Methods
[Obsolete("Use the method with single parameter instead")]
public void RefreshDomains(IMemoryDomains core, MemoryDomain domain)
{ {
_memoryDomains = core; _memoryDomains = core;
_domain = domain; _domain = domain;
@ -48,7 +100,20 @@ namespace BizHawk.Client.Common
}); });
} }
public enum WatchPrevDef { LastSearch, Original, LastFrame, LastChange } public void RefreshDomains(IMemoryDomains core)
{
_memoryDomains = core;
Parallel.ForEach<Watch>(_watchList, watch =>
{
watch.Domain = core[watch.Domain.Name];
watch.ResetPrevious();
watch.Update();
watch.ClearChangeCount();
}
);
}
#endregion
public string AddressFormatStr // TODO: this is probably compensating for not using the ToHex string extension public string AddressFormatStr // TODO: this is probably compensating for not using the ToHex string extension
{ {
@ -65,19 +130,30 @@ namespace BizHawk.Client.Common
public int Count public int Count
{ {
get { return _watchList.Count; } get
{
return _watchList.Count;
}
} }
public int WatchCount public int WatchCount
{ {
get { return _watchList.Count(w => !w.IsSeparator); } get
{
return _watchList.Count<Watch>(watch => !watch.IsSeparator);
}
} }
[Obsolete("Use count property instead")]
public int ItemCount public int ItemCount
{ {
get { return _watchList.Count; } get
{
return Count;
}
} }
[Obsolete("Use domain from individual watch instead")]
public MemoryDomain Domain public MemoryDomain Domain
{ {
get { return _domain; } get { return _domain; }
@ -117,23 +193,12 @@ namespace BizHawk.Client.Common
case ADDRESS: case ADDRESS:
if (reverse) if (reverse)
{ {
_watchList = _watchList _watchList.Sort(addressComparer);
.OrderByDescending(x => x.Address) _watchList.Reverse();
.ThenBy(x => x.Domain.Name)
.ThenBy(x => x.Size)
.ThenBy(x => x.Type)
.ThenBy(x => x.BigEndian)
.ToList();
} }
else else
{ {
_watchList = _watchList _watchList.Sort();
.OrderBy(x => x.Address)
.ThenBy(x => x.Domain.Name)
.ThenBy(x => x.Size)
.ThenBy(x => x.Type)
.ThenBy(x => x.BigEndian)
.ToList();
} }
break; break;
@ -165,7 +230,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderByDescending(x => x.PreviousStr) .OrderByDescending(x => x.PreviousStr)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -174,7 +239,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderBy(x => x.PreviousStr) .OrderBy(x => x.PreviousStr)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -186,7 +251,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderByDescending(x => x.Diff) .OrderByDescending(x => x.Diff)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -195,7 +260,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderBy(x => x.Diff) .OrderBy(x => x.Diff)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -207,7 +272,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderByDescending(x => x.ChangeCount) .OrderByDescending(x => x.ChangeCount)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -216,7 +281,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderBy(x => x.ChangeCount) .OrderBy(x => x.ChangeCount)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -226,23 +291,12 @@ namespace BizHawk.Client.Common
case DOMAIN: case DOMAIN:
if (reverse) if (reverse)
{ {
_watchList = _watchList _watchList.Sort(domainComparer);
.OrderByDescending(x => x.Domain) _watchList.Reverse();
.ThenBy(x => x.Address ?? 0)
.ThenBy(x => x.Size)
.ThenBy(x => x.Type)
.ThenBy(x => x.BigEndian)
.ToList();
} }
else else
{ {
_watchList = _watchList _watchList.Sort(domainComparer);
.OrderBy(x => x.Domain)
.ThenBy(x => x.Address ?? 0)
.ThenBy(x => x.Size)
.ThenBy(x => x.Type)
.ThenBy(x => x.BigEndian)
.ToList();
} }
break; break;
@ -251,7 +305,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderByDescending(x => x.Notes) .OrderByDescending(x => x.Notes)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -260,7 +314,7 @@ namespace BizHawk.Client.Common
{ {
_watchList = _watchList _watchList = _watchList
.OrderBy(x => x.Notes) .OrderBy(x => x.Notes)
.ThenBy(x => x.Address ?? 0) .ThenBy(x => x.Address)
.ThenBy(x => x.Size) .ThenBy(x => x.Size)
.ThenBy(x => x.Type) .ThenBy(x => x.Type)
.ToList(); .ToList();
@ -279,11 +333,11 @@ namespace BizHawk.Client.Common
public void UpdateValues() public void UpdateValues()
{ {
foreach (var watch in _watchList) Parallel.ForEach<Watch>(_watchList, watch =>
{ {
watch.Update(); watch.Update();
} });
} }
public void Add(Watch watch) public void Add(Watch watch)
{ {
@ -534,7 +588,7 @@ namespace BizHawk.Client.Common
size, size,
type, type,
bigEndian, bigEndian,
notes)); notes));
_domain = _memoryDomains[domain]; _domain = _memoryDomains[domain];
} }

View File

@ -1,13 +1,17 @@
using BizHawk.Common.NumberExtensions; using System;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using BizHawk.Common.NumberExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
/// <summary>
/// This class holds a word (16 bits) <see cref="Watch"/>
/// </summary>
public sealed class WordWatch : Watch public sealed class WordWatch : Watch
{ {
#region Fields #region Fields
@ -19,6 +23,18 @@ namespace BizHawk.Client.Common
#region cTor(s) #region cTor(s)
/// <summary>
/// Inialize a new instance of <see cref="WordWatch"/>
/// </summary>
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <param name="value">Current value</param>
/// <param name="previous">Previous value</param>
/// <param name="changeCount">How many times value has changed</param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.Word"/></exception>
internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, ushort value, ushort previous, int changeCount) internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, ushort value, ushort previous, int changeCount)
: base(domain, address, WatchSize.Word, type, bigEndian, note) : base(domain, address, WatchSize.Word, type, bigEndian, note)
{ {
@ -27,15 +43,13 @@ namespace BizHawk.Client.Common
this._changecount = changeCount; this._changecount = changeCount;
} }
internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note)
:this(domain, address, type, bigEndian, note, 0, 0, 0)
{
_previous = GetWord();
_value = GetWord();
}
#endregion #endregion
#region Methods
/// <summary>
/// Enumerate wich <see cref="DisplayType"/> are valid for a <see cref="WordWatch"/>
/// </summary>
public static IEnumerable<DisplayType> ValidTypes public static IEnumerable<DisplayType> ValidTypes
{ {
get get
@ -48,73 +62,31 @@ namespace BizHawk.Client.Common
} }
} }
#region Implements
/// <summary>
/// Get a list a <see cref="DisplayType"/> that can be used for this <see cref="WordWatch"/>
/// </summary>
/// <returns>An enumartion that contains all valid <see cref="DisplayType"/></returns>
public override IEnumerable<DisplayType> AvailableTypes() public override IEnumerable<DisplayType> AvailableTypes()
{ {
yield return DisplayType.Unsigned; return ValidTypes;
yield return DisplayType.Signed;
yield return DisplayType.Hex;
yield return DisplayType.Binary;
yield return DisplayType.FixedPoint_12_4;
}
public override uint MaxValue
{
get { return ushort.MaxValue; }
}
public override int Value
{
get { return GetWord(); }
}
public override int ValueNoFreeze
{
get { return GetWord(true); }
}
public override int Previous
{
get { return _previous; }
}
public override string PreviousStr
{
get { return FormatValue(_previous); }
} }
/// <summary>
/// Reset the previous value; set it to the current one
/// </summary>
public override void ResetPrevious() public override void ResetPrevious()
{ {
_previous = GetWord(); _previous = GetWord();
} }
public override string ValueString /// <summary>
{ /// Try to sets the value into the <see cref="MemoryDomain"/>
get { return FormatValue(GetWord()); } /// at the current <see cref="Watch"/> address
} /// </summary>
/// <param name="value">Value to set</param>
/*public override string ToString() /// <returns>True if value successfully sets; othewise, false</returns>
{
return Notes + ": " + ValueString;
}*/
public string FormatValue(ushort val)
{
switch (Type)
{
default:
case DisplayType.Unsigned:
return val.ToString();
case DisplayType.Signed:
return ((short)val).ToString();
case DisplayType.Hex:
return val.ToHexString(4);
case DisplayType.FixedPoint_12_4:
return string.Format("{0:F4}", val / 16.0);
case DisplayType.Binary:
return Convert.ToString(val, 2).PadLeft(16, '0').Insert(8, " ").Insert(4, " ").Insert(14, " ");
}
}
public override bool Poke(string value) public override bool Poke(string value)
{ {
try try
@ -199,11 +171,9 @@ namespace BizHawk.Client.Common
} }
} }
public override string Diff /// <summary>
{ /// Update the Watch (read it from <see cref="MemoryDomain"/>
get { return FormatValue((ushort)(_previous - _value)); } /// </summary>
}
public override void Update() public override void Update()
{ {
switch (Global.Config.RamWatchDefinePrevious) switch (Global.Config.RamWatchDefinePrevious)
@ -232,5 +202,115 @@ namespace BizHawk.Client.Common
break; break;
} }
} }
#endregion Implements
//TODO: Implements IFormattable
public string FormatValue(ushort val)
{
switch (Type)
{
default:
case DisplayType.Unsigned:
return val.ToString();
case DisplayType.Signed:
return ((short)val).ToString();
case DisplayType.Hex:
return val.ToHexString(4);
case DisplayType.FixedPoint_12_4:
return string.Format("{0:F4}", val / 16.0);
case DisplayType.Binary:
return Convert.ToString(val, 2).PadLeft(16, '0').Insert(8, " ").Insert(4, " ").Insert(14, " ");
}
}
#endregion
#region Properties
#region Implements
/// <summary>
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff
{
get
{
return FormatValue((ushort)(_previous - _value));
}
}
/// <summary>
/// Get the maximum possible value
/// </summary>
public override uint MaxValue
{
get
{
return ushort.MaxValue;
}
}
/// <summary>
/// Gets the current value
/// </summary>
public override int Value
{
get
{
return GetWord();
}
}
/// <summary>
/// Gets the current value
/// but with stuff I don't understand
/// </summary>
public override int ValueNoFreeze
{
get
{
return GetWord(true);
}
}
/// <summary>
/// Get a string representation of the current value
/// </summary>
public override string ValueString
{
get
{
return FormatValue(GetWord());
}
}
/// <summary>
/// Get the previous value
/// </summary>
public override int Previous
{
get
{
return _previous;
}
}
/// <summary>
/// Get a string representation of the previous value
/// </summary>
public override string PreviousStr
{
get
{
return FormatValue(_previous);
}
}
#endregion Implements
#endregion
} }
} }

View File

@ -42,6 +42,7 @@
this.AddMarkerButton = new System.Windows.Forms.Button(); this.AddMarkerButton = new System.Windows.Forms.Button();
this.RemoveMarkerButton = new System.Windows.Forms.Button(); this.RemoveMarkerButton = new System.Windows.Forms.Button();
this.ScrollToMarkerButton = new System.Windows.Forms.Button(); this.ScrollToMarkerButton = new System.Windows.Forms.Button();
this.AddMarkerWithTextButton = new System.Windows.Forms.Button();
this.MarkerView = new BizHawk.Client.EmuHawk.InputRoll(); this.MarkerView = new BizHawk.Client.EmuHawk.InputRoll();
this.MarkerContextMenu.SuspendLayout(); this.MarkerContextMenu.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -63,7 +64,7 @@
// //
this.JumpToMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.JumpTo; this.JumpToMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.JumpTo;
this.JumpToMarkerToolStripMenuItem.Name = "JumpToMarkerToolStripMenuItem"; this.JumpToMarkerToolStripMenuItem.Name = "JumpToMarkerToolStripMenuItem";
this.JumpToMarkerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.JumpToMarkerToolStripMenuItem.Size = new System.Drawing.Size(125, 22);
this.JumpToMarkerToolStripMenuItem.Text = "Jump To"; this.JumpToMarkerToolStripMenuItem.Text = "Jump To";
this.JumpToMarkerToolStripMenuItem.Click += new System.EventHandler(this.JumpToMarkerToolStripMenuItem_Click); this.JumpToMarkerToolStripMenuItem.Click += new System.EventHandler(this.JumpToMarkerToolStripMenuItem_Click);
// //
@ -71,7 +72,7 @@
// //
this.ScrollToMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ScrollTo; this.ScrollToMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ScrollTo;
this.ScrollToMarkerToolStripMenuItem.Name = "ScrollToMarkerToolStripMenuItem"; this.ScrollToMarkerToolStripMenuItem.Name = "ScrollToMarkerToolStripMenuItem";
this.ScrollToMarkerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.ScrollToMarkerToolStripMenuItem.Size = new System.Drawing.Size(125, 22);
this.ScrollToMarkerToolStripMenuItem.Text = "Scroll To"; this.ScrollToMarkerToolStripMenuItem.Text = "Scroll To";
this.ScrollToMarkerToolStripMenuItem.Click += new System.EventHandler(this.ScrollToMarkerToolStripMenuItem_Click); this.ScrollToMarkerToolStripMenuItem.Click += new System.EventHandler(this.ScrollToMarkerToolStripMenuItem_Click);
// //
@ -79,7 +80,7 @@
// //
this.EditMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pencil; this.EditMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pencil;
this.EditMarkerToolStripMenuItem.Name = "EditMarkerToolStripMenuItem"; this.EditMarkerToolStripMenuItem.Name = "EditMarkerToolStripMenuItem";
this.EditMarkerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.EditMarkerToolStripMenuItem.Size = new System.Drawing.Size(125, 22);
this.EditMarkerToolStripMenuItem.Text = "Edit"; this.EditMarkerToolStripMenuItem.Text = "Edit";
this.EditMarkerToolStripMenuItem.Click += new System.EventHandler(this.EditMarkerToolStripMenuItem_Click); this.EditMarkerToolStripMenuItem.Click += new System.EventHandler(this.EditMarkerToolStripMenuItem_Click);
// //
@ -87,20 +88,20 @@
// //
this.AddMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.add; this.AddMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.add;
this.AddMarkerToolStripMenuItem.Name = "AddMarkerToolStripMenuItem"; this.AddMarkerToolStripMenuItem.Name = "AddMarkerToolStripMenuItem";
this.AddMarkerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.AddMarkerToolStripMenuItem.Size = new System.Drawing.Size(125, 22);
this.AddMarkerToolStripMenuItem.Text = "Add"; this.AddMarkerToolStripMenuItem.Text = "Add";
this.AddMarkerToolStripMenuItem.Click += new System.EventHandler(this.AddMarkerToolStripMenuItem_Click); this.AddMarkerToolStripMenuItem.Click += new System.EventHandler(this.AddMarkerToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(122, 6);
// //
// RemoveMarkerToolStripMenuItem // RemoveMarkerToolStripMenuItem
// //
this.RemoveMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveMarkerToolStripMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete;
this.RemoveMarkerToolStripMenuItem.Name = "RemoveMarkerToolStripMenuItem"; this.RemoveMarkerToolStripMenuItem.Name = "RemoveMarkerToolStripMenuItem";
this.RemoveMarkerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.RemoveMarkerToolStripMenuItem.Size = new System.Drawing.Size(125, 22);
this.RemoveMarkerToolStripMenuItem.Text = "Remove"; this.RemoveMarkerToolStripMenuItem.Text = "Remove";
this.RemoveMarkerToolStripMenuItem.Click += new System.EventHandler(this.RemoveMarkerToolStripMenuItem_Click); this.RemoveMarkerToolStripMenuItem.Click += new System.EventHandler(this.RemoveMarkerToolStripMenuItem_Click);
// //
@ -109,7 +110,7 @@
this.JumpToMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.JumpToMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.JumpToMarkerButton.Enabled = false; this.JumpToMarkerButton.Enabled = false;
this.JumpToMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.JumpTo; this.JumpToMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.JumpTo;
this.JumpToMarkerButton.Location = new System.Drawing.Point(6, 174); this.JumpToMarkerButton.Location = new System.Drawing.Point(61, 174);
this.JumpToMarkerButton.Name = "JumpToMarkerButton"; this.JumpToMarkerButton.Name = "JumpToMarkerButton";
this.JumpToMarkerButton.Size = new System.Drawing.Size(23, 23); this.JumpToMarkerButton.Size = new System.Drawing.Size(23, 23);
this.JumpToMarkerButton.TabIndex = 8; this.JumpToMarkerButton.TabIndex = 8;
@ -122,7 +123,7 @@
this.EditMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.EditMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.EditMarkerButton.Enabled = false; this.EditMarkerButton.Enabled = false;
this.EditMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pencil; this.EditMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pencil;
this.EditMarkerButton.Location = new System.Drawing.Point(64, 174); this.EditMarkerButton.Location = new System.Drawing.Point(119, 174);
this.EditMarkerButton.Name = "EditMarkerButton"; this.EditMarkerButton.Name = "EditMarkerButton";
this.EditMarkerButton.Size = new System.Drawing.Size(23, 23); this.EditMarkerButton.Size = new System.Drawing.Size(23, 23);
this.EditMarkerButton.TabIndex = 9; this.EditMarkerButton.TabIndex = 9;
@ -134,11 +135,11 @@
// //
this.AddMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.AddMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.AddMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.add; this.AddMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.add;
this.AddMarkerButton.Location = new System.Drawing.Point(93, 174); this.AddMarkerButton.Location = new System.Drawing.Point(3, 174);
this.AddMarkerButton.Name = "AddMarkerButton"; this.AddMarkerButton.Name = "AddMarkerButton";
this.AddMarkerButton.Size = new System.Drawing.Size(23, 23); this.AddMarkerButton.Size = new System.Drawing.Size(23, 23);
this.AddMarkerButton.TabIndex = 6; this.AddMarkerButton.TabIndex = 6;
this.toolTip1.SetToolTip(this.AddMarkerButton, "Add Marker"); this.toolTip1.SetToolTip(this.AddMarkerButton, "Add Marker to Emulated Frame");
this.AddMarkerButton.UseVisualStyleBackColor = true; this.AddMarkerButton.UseVisualStyleBackColor = true;
this.AddMarkerButton.Click += new System.EventHandler(this.AddMarkerToolStripMenuItem_Click); this.AddMarkerButton.Click += new System.EventHandler(this.AddMarkerToolStripMenuItem_Click);
// //
@ -147,7 +148,7 @@
this.RemoveMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.RemoveMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.RemoveMarkerButton.Enabled = false; this.RemoveMarkerButton.Enabled = false;
this.RemoveMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete;
this.RemoveMarkerButton.Location = new System.Drawing.Point(122, 174); this.RemoveMarkerButton.Location = new System.Drawing.Point(148, 174);
this.RemoveMarkerButton.Name = "RemoveMarkerButton"; this.RemoveMarkerButton.Name = "RemoveMarkerButton";
this.RemoveMarkerButton.Size = new System.Drawing.Size(23, 23); this.RemoveMarkerButton.Size = new System.Drawing.Size(23, 23);
this.RemoveMarkerButton.TabIndex = 7; this.RemoveMarkerButton.TabIndex = 7;
@ -160,7 +161,7 @@
this.ScrollToMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.ScrollToMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ScrollToMarkerButton.Enabled = false; this.ScrollToMarkerButton.Enabled = false;
this.ScrollToMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ScrollTo; this.ScrollToMarkerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ScrollTo;
this.ScrollToMarkerButton.Location = new System.Drawing.Point(35, 174); this.ScrollToMarkerButton.Location = new System.Drawing.Point(90, 174);
this.ScrollToMarkerButton.Name = "ScrollToMarkerButton"; this.ScrollToMarkerButton.Name = "ScrollToMarkerButton";
this.ScrollToMarkerButton.Size = new System.Drawing.Size(23, 23); this.ScrollToMarkerButton.Size = new System.Drawing.Size(23, 23);
this.ScrollToMarkerButton.TabIndex = 10; this.ScrollToMarkerButton.TabIndex = 10;
@ -168,6 +169,18 @@
this.ScrollToMarkerButton.UseVisualStyleBackColor = true; this.ScrollToMarkerButton.UseVisualStyleBackColor = true;
this.ScrollToMarkerButton.Click += new System.EventHandler(this.ScrollToMarkerToolStripMenuItem_Click); this.ScrollToMarkerButton.Click += new System.EventHandler(this.ScrollToMarkerToolStripMenuItem_Click);
// //
// AddMarkerWithTextButton
//
this.AddMarkerWithTextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.AddMarkerWithTextButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.AddEdit;
this.AddMarkerWithTextButton.Location = new System.Drawing.Point(32, 174);
this.AddMarkerWithTextButton.Name = "AddMarkerWithTextButton";
this.AddMarkerWithTextButton.Size = new System.Drawing.Size(23, 23);
this.AddMarkerWithTextButton.TabIndex = 11;
this.toolTip1.SetToolTip(this.AddMarkerWithTextButton, "Add Marker with Text to Emulated Frame");
this.AddMarkerWithTextButton.UseVisualStyleBackColor = true;
this.AddMarkerWithTextButton.Click += new System.EventHandler(this.AddMarkerWithTextToolStripMenuItem_Click);
//
// MarkerView // MarkerView
// //
this.MarkerView.AllowColumnReorder = false; this.MarkerView.AllowColumnReorder = false;
@ -202,10 +215,11 @@
// MarkerControl // MarkerControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.AddMarkerWithTextButton);
this.Controls.Add(this.MarkerView); this.Controls.Add(this.MarkerView);
this.Controls.Add(this.EditMarkerButton);
this.Controls.Add(this.JumpToMarkerButton); this.Controls.Add(this.JumpToMarkerButton);
this.Controls.Add(this.ScrollToMarkerButton); this.Controls.Add(this.ScrollToMarkerButton);
this.Controls.Add(this.EditMarkerButton);
this.Controls.Add(this.RemoveMarkerButton); this.Controls.Add(this.RemoveMarkerButton);
this.Controls.Add(this.AddMarkerButton); this.Controls.Add(this.AddMarkerButton);
this.Name = "MarkerControl"; this.Name = "MarkerControl";
@ -232,6 +246,7 @@
private System.Windows.Forms.ToolStripMenuItem RemoveMarkerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem RemoveMarkerToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem JumpToMarkerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem JumpToMarkerToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.Button AddMarkerWithTextButton;
} }
} }

View File

@ -137,7 +137,13 @@ namespace BizHawk.Client.EmuHawk
private void AddMarkerToolStripMenuItem_Click(object sender, EventArgs e) private void AddMarkerToolStripMenuItem_Click(object sender, EventArgs e)
{ {
AddMarkerPopUp(); AddMarker();
MarkerView_SelectedIndexChanged(null, null);
}
private void AddMarkerWithTextToolStripMenuItem_Click(object sender, EventArgs e)
{
AddMarker(editText: true);
MarkerView_SelectedIndexChanged(null, null); MarkerView_SelectedIndexChanged(null, null);
} }
@ -152,31 +158,38 @@ namespace BizHawk.Client.EmuHawk
} }
} }
public void AddMarkerPopUp(int? frame = null) public void AddMarker(bool editText = false, int? frame = null)
{ {
// feos: we specify the selected frame if we call it from TasView, otherwise it should be added to the emulated frame // feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame
var markerFrame = frame ?? Global.Emulator.Frame; var markerFrame = frame ?? Global.Emulator.Frame;
InputPrompt i = new InputPrompt
{
Text = "Marker for frame " + markerFrame,
TextInputType = InputPrompt.InputType.Text,
Message = "Enter a message",
InitialValue =
Markers.IsMarker(markerFrame) ?
Markers.PreviousOrCurrent(markerFrame).Message :
""
};
var result = i.ShowHawkDialog(); if (editText)
if (result == DialogResult.OK)
{ {
Markers.Add(new TasMovieMarker(markerFrame, i.PromptText)); InputPrompt i = new InputPrompt
{
Text = "Marker for frame " + markerFrame,
TextInputType = InputPrompt.InputType.Text,
Message = "Enter a message",
InitialValue =
Markers.IsMarker(markerFrame) ?
Markers.PreviousOrCurrent(markerFrame).Message :
""
};
var result = i.ShowHawkDialog();
if (result == DialogResult.OK)
{
Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
UpdateValues();
}
}
else
{
Markers.Add(new TasMovieMarker(markerFrame, ""));
UpdateValues(); UpdateValues();
} }
} }
public void EditMarkerPopUp(TasMovieMarker marker) public bool EditMarkerPopUp(TasMovieMarker marker)
{ {
var markerFrame = marker.Frame; var markerFrame = marker.Frame;
InputPrompt i = new InputPrompt InputPrompt i = new InputPrompt
@ -196,7 +209,9 @@ namespace BizHawk.Client.EmuHawk
{ {
marker.Message = i.PromptText; marker.Message = i.PromptText;
UpdateValues(); UpdateValues();
return true;
} }
return false;
} }
public void UpdateValues() public void UpdateValues()
@ -264,10 +279,5 @@ namespace BizHawk.Client.EmuHawk
} }
return -1; return -1;
} }
private void JumpToMarkerToolStripMenuItem_Click(object sender, MouseEventArgs e)
{
}
} }
} }

View File

@ -123,7 +123,4 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>168, 17</value> <value>168, 17</value>
</metadata> </metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>168, 17</value>
</metadata>
</root> </root>

View File

@ -153,6 +153,7 @@ namespace BizHawk.Client.EmuHawk
this.MarkerControl = new BizHawk.Client.EmuHawk.MarkerControl(); this.MarkerControl = new BizHawk.Client.EmuHawk.MarkerControl();
this.RightClickMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.RightClickMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.SetMarkersContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SetMarkersContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SetMarkerWithTextContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RemoveMarkersContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RemoveMarkersContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
this.DeselectContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DeselectContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -1215,6 +1216,7 @@ namespace BizHawk.Client.EmuHawk
// //
this.RightClickMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.RightClickMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SetMarkersContextMenuItem, this.SetMarkersContextMenuItem,
this.SetMarkerWithTextContextMenuItem,
this.RemoveMarkersContextMenuItem, this.RemoveMarkersContextMenuItem,
this.toolStripSeparator15, this.toolStripSeparator15,
this.DeselectContextMenuItem, this.DeselectContextMenuItem,
@ -1240,32 +1242,39 @@ namespace BizHawk.Client.EmuHawk
this.StartNewProjectFromNowMenuItem, this.StartNewProjectFromNowMenuItem,
this.StartANewProjectFromSaveRamMenuItem}); this.StartANewProjectFromSaveRamMenuItem});
this.RightClickMenu.Name = "RightClickMenu"; this.RightClickMenu.Name = "RightClickMenu";
this.RightClickMenu.Size = new System.Drawing.Size(273, 458); this.RightClickMenu.Size = new System.Drawing.Size(270, 502);
this.RightClickMenu.Opened += new System.EventHandler(this.RightClickMenu_Opened); this.RightClickMenu.Opened += new System.EventHandler(this.RightClickMenu_Opened);
// //
// SetMarkersContextMenuItem // SetMarkersContextMenuItem
// //
this.SetMarkersContextMenuItem.Name = "SetMarkersContextMenuItem"; this.SetMarkersContextMenuItem.Name = "SetMarkersContextMenuItem";
this.SetMarkersContextMenuItem.Size = new System.Drawing.Size(272, 22); this.SetMarkersContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.SetMarkersContextMenuItem.Text = "Set Markers"; this.SetMarkersContextMenuItem.Text = "Set Markers";
this.SetMarkersContextMenuItem.Click += new System.EventHandler(this.SetMarkersMenuItem_Click); this.SetMarkersContextMenuItem.Click += new System.EventHandler(this.SetMarkersMenuItem_Click);
// //
// SetMarkerWithTextContextMenuItem
//
this.SetMarkerWithTextContextMenuItem.Name = "SetMarkerWithTextContextMenuItem";
this.SetMarkerWithTextContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.SetMarkerWithTextContextMenuItem.Text = "Set Marker with Text";
this.SetMarkerWithTextContextMenuItem.Click += new System.EventHandler(this.SetMarkerWithTextMenuItem_Click);
//
// RemoveMarkersContextMenuItem // RemoveMarkersContextMenuItem
// //
this.RemoveMarkersContextMenuItem.Name = "RemoveMarkersContextMenuItem"; this.RemoveMarkersContextMenuItem.Name = "RemoveMarkersContextMenuItem";
this.RemoveMarkersContextMenuItem.Size = new System.Drawing.Size(272, 22); this.RemoveMarkersContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.RemoveMarkersContextMenuItem.Text = "Remove Markers"; this.RemoveMarkersContextMenuItem.Text = "Remove Markers";
this.RemoveMarkersContextMenuItem.Click += new System.EventHandler(this.RemoveMarkersMenuItem_Click); this.RemoveMarkersContextMenuItem.Click += new System.EventHandler(this.RemoveMarkersMenuItem_Click);
// //
// toolStripSeparator15 // toolStripSeparator15
// //
this.toolStripSeparator15.Name = "toolStripSeparator15"; this.toolStripSeparator15.Name = "toolStripSeparator15";
this.toolStripSeparator15.Size = new System.Drawing.Size(269, 6); this.toolStripSeparator15.Size = new System.Drawing.Size(266, 6);
// //
// DeselectContextMenuItem // DeselectContextMenuItem
// //
this.DeselectContextMenuItem.Name = "DeselectContextMenuItem"; this.DeselectContextMenuItem.Name = "DeselectContextMenuItem";
this.DeselectContextMenuItem.Size = new System.Drawing.Size(272, 22); this.DeselectContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.DeselectContextMenuItem.Text = "Deselect"; this.DeselectContextMenuItem.Text = "Deselect";
this.DeselectContextMenuItem.Click += new System.EventHandler(this.DeselectMenuItem_Click); this.DeselectContextMenuItem.Click += new System.EventHandler(this.DeselectMenuItem_Click);
// //
@ -1274,39 +1283,39 @@ namespace BizHawk.Client.EmuHawk
this.SelectBetweenMarkersContextMenuItem.Name = "SelectBetweenMarkersContextMenuItem"; this.SelectBetweenMarkersContextMenuItem.Name = "SelectBetweenMarkersContextMenuItem";
this.SelectBetweenMarkersContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) this.SelectBetweenMarkersContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.A))); | System.Windows.Forms.Keys.A)));
this.SelectBetweenMarkersContextMenuItem.Size = new System.Drawing.Size(272, 22); this.SelectBetweenMarkersContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.SelectBetweenMarkersContextMenuItem.Text = "Select between Markers"; this.SelectBetweenMarkersContextMenuItem.Text = "Select between Markers";
this.SelectBetweenMarkersContextMenuItem.Click += new System.EventHandler(this.SelectBetweenMarkersMenuItem_Click); this.SelectBetweenMarkersContextMenuItem.Click += new System.EventHandler(this.SelectBetweenMarkersMenuItem_Click);
// //
// toolStripSeparator16 // toolStripSeparator16
// //
this.toolStripSeparator16.Name = "toolStripSeparator16"; this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(269, 6); this.toolStripSeparator16.Size = new System.Drawing.Size(266, 6);
// //
// UngreenzoneContextMenuItem // UngreenzoneContextMenuItem
// //
this.UngreenzoneContextMenuItem.Name = "UngreenzoneContextMenuItem"; this.UngreenzoneContextMenuItem.Name = "UngreenzoneContextMenuItem";
this.UngreenzoneContextMenuItem.Size = new System.Drawing.Size(272, 22); this.UngreenzoneContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.UngreenzoneContextMenuItem.Text = "Clear Greenzone"; this.UngreenzoneContextMenuItem.Text = "Clear Greenzone";
this.UngreenzoneContextMenuItem.Click += new System.EventHandler(this.ClearGreenzoneMenuItem_Click); this.UngreenzoneContextMenuItem.Click += new System.EventHandler(this.ClearGreenzoneMenuItem_Click);
// //
// CancelSeekContextMenuItem // CancelSeekContextMenuItem
// //
this.CancelSeekContextMenuItem.Name = "CancelSeekContextMenuItem"; this.CancelSeekContextMenuItem.Name = "CancelSeekContextMenuItem";
this.CancelSeekContextMenuItem.Size = new System.Drawing.Size(272, 22); this.CancelSeekContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.CancelSeekContextMenuItem.Text = "Cancel Seek"; this.CancelSeekContextMenuItem.Text = "Cancel Seek";
this.CancelSeekContextMenuItem.Click += new System.EventHandler(this.CancelSeekContextMenuItem_Click); this.CancelSeekContextMenuItem.Click += new System.EventHandler(this.CancelSeekContextMenuItem_Click);
// //
// toolStripSeparator17 // toolStripSeparator17
// //
this.toolStripSeparator17.Name = "toolStripSeparator17"; this.toolStripSeparator17.Name = "toolStripSeparator17";
this.toolStripSeparator17.Size = new System.Drawing.Size(269, 6); this.toolStripSeparator17.Size = new System.Drawing.Size(266, 6);
// //
// copyToolStripMenuItem // copyToolStripMenuItem
// //
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; this.copyToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(272, 22); this.copyToolStripMenuItem.Size = new System.Drawing.Size(269, 22);
this.copyToolStripMenuItem.Text = "Copy"; this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click); this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
// //
@ -1314,7 +1323,7 @@ namespace BizHawk.Client.EmuHawk
// //
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+V"; this.pasteToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+V";
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(272, 22); this.pasteToolStripMenuItem.Size = new System.Drawing.Size(269, 22);
this.pasteToolStripMenuItem.Text = "Paste"; this.pasteToolStripMenuItem.Text = "Paste";
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.PasteMenuItem_Click); this.pasteToolStripMenuItem.Click += new System.EventHandler(this.PasteMenuItem_Click);
// //
@ -1322,7 +1331,7 @@ namespace BizHawk.Client.EmuHawk
// //
this.pasteInsertToolStripMenuItem.Name = "pasteInsertToolStripMenuItem"; this.pasteInsertToolStripMenuItem.Name = "pasteInsertToolStripMenuItem";
this.pasteInsertToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+V"; this.pasteInsertToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+V";
this.pasteInsertToolStripMenuItem.Size = new System.Drawing.Size(272, 22); this.pasteInsertToolStripMenuItem.Size = new System.Drawing.Size(269, 22);
this.pasteInsertToolStripMenuItem.Text = "Paste Insert"; this.pasteInsertToolStripMenuItem.Text = "Paste Insert";
this.pasteInsertToolStripMenuItem.Click += new System.EventHandler(this.PasteInsertMenuItem_Click); this.pasteInsertToolStripMenuItem.Click += new System.EventHandler(this.PasteInsertMenuItem_Click);
// //
@ -1330,20 +1339,20 @@ namespace BizHawk.Client.EmuHawk
// //
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+X"; this.cutToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+X";
this.cutToolStripMenuItem.Size = new System.Drawing.Size(272, 22); this.cutToolStripMenuItem.Size = new System.Drawing.Size(269, 22);
this.cutToolStripMenuItem.Text = "Cut"; this.cutToolStripMenuItem.Text = "Cut";
this.cutToolStripMenuItem.Click += new System.EventHandler(this.CutMenuItem_Click); this.cutToolStripMenuItem.Click += new System.EventHandler(this.CutMenuItem_Click);
// //
// separateToolStripMenuItem // separateToolStripMenuItem
// //
this.separateToolStripMenuItem.Name = "separateToolStripMenuItem"; this.separateToolStripMenuItem.Name = "separateToolStripMenuItem";
this.separateToolStripMenuItem.Size = new System.Drawing.Size(269, 6); this.separateToolStripMenuItem.Size = new System.Drawing.Size(266, 6);
// //
// ClearContextMenuItem // ClearContextMenuItem
// //
this.ClearContextMenuItem.Name = "ClearContextMenuItem"; this.ClearContextMenuItem.Name = "ClearContextMenuItem";
this.ClearContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete))); this.ClearContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete)));
this.ClearContextMenuItem.Size = new System.Drawing.Size(272, 22); this.ClearContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.ClearContextMenuItem.Text = "Clear"; this.ClearContextMenuItem.Text = "Clear";
this.ClearContextMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click); this.ClearContextMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
// //
@ -1351,7 +1360,7 @@ namespace BizHawk.Client.EmuHawk
// //
this.DeleteFramesContextMenuItem.Name = "DeleteFramesContextMenuItem"; this.DeleteFramesContextMenuItem.Name = "DeleteFramesContextMenuItem";
this.DeleteFramesContextMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete; this.DeleteFramesContextMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.DeleteFramesContextMenuItem.Size = new System.Drawing.Size(272, 22); this.DeleteFramesContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.DeleteFramesContextMenuItem.Text = "Delete"; this.DeleteFramesContextMenuItem.Text = "Delete";
this.DeleteFramesContextMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click); this.DeleteFramesContextMenuItem.Click += new System.EventHandler(this.DeleteFramesMenuItem_Click);
// //
@ -1359,7 +1368,7 @@ namespace BizHawk.Client.EmuHawk
// //
this.CloneContextMenuItem.Name = "CloneContextMenuItem"; this.CloneContextMenuItem.Name = "CloneContextMenuItem";
this.CloneContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert))); this.CloneContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert)));
this.CloneContextMenuItem.Size = new System.Drawing.Size(272, 22); this.CloneContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.CloneContextMenuItem.Text = "Clone"; this.CloneContextMenuItem.Text = "Clone";
this.CloneContextMenuItem.Click += new System.EventHandler(this.CloneMenuItem_Click); this.CloneContextMenuItem.Click += new System.EventHandler(this.CloneMenuItem_Click);
// //
@ -1368,7 +1377,7 @@ namespace BizHawk.Client.EmuHawk
this.InsertFrameContextMenuItem.Name = "InsertFrameContextMenuItem"; this.InsertFrameContextMenuItem.Name = "InsertFrameContextMenuItem";
this.InsertFrameContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) this.InsertFrameContextMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.Insert))); | System.Windows.Forms.Keys.Insert)));
this.InsertFrameContextMenuItem.Size = new System.Drawing.Size(272, 22); this.InsertFrameContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.InsertFrameContextMenuItem.Text = "Insert"; this.InsertFrameContextMenuItem.Text = "Insert";
this.InsertFrameContextMenuItem.Click += new System.EventHandler(this.InsertFrameMenuItem_Click); this.InsertFrameContextMenuItem.Click += new System.EventHandler(this.InsertFrameMenuItem_Click);
// //
@ -1376,45 +1385,45 @@ namespace BizHawk.Client.EmuHawk
// //
this.InsertNumFramesContextMenuItem.Name = "InsertNumFramesContextMenuItem"; this.InsertNumFramesContextMenuItem.Name = "InsertNumFramesContextMenuItem";
this.InsertNumFramesContextMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert; this.InsertNumFramesContextMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert;
this.InsertNumFramesContextMenuItem.Size = new System.Drawing.Size(272, 22); this.InsertNumFramesContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.InsertNumFramesContextMenuItem.Text = "Insert # of Frames"; this.InsertNumFramesContextMenuItem.Text = "Insert # of Frames";
this.InsertNumFramesContextMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click); this.InsertNumFramesContextMenuItem.Click += new System.EventHandler(this.InsertNumFramesMenuItem_Click);
// //
// toolStripSeparator18 // toolStripSeparator18
// //
this.toolStripSeparator18.Name = "toolStripSeparator18"; this.toolStripSeparator18.Name = "toolStripSeparator18";
this.toolStripSeparator18.Size = new System.Drawing.Size(269, 6); this.toolStripSeparator18.Size = new System.Drawing.Size(266, 6);
// //
// TruncateContextMenuItem // TruncateContextMenuItem
// //
this.TruncateContextMenuItem.Name = "TruncateContextMenuItem"; this.TruncateContextMenuItem.Name = "TruncateContextMenuItem";
this.TruncateContextMenuItem.Size = new System.Drawing.Size(272, 22); this.TruncateContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.TruncateContextMenuItem.Text = "Truncate Movie"; this.TruncateContextMenuItem.Text = "Truncate Movie";
this.TruncateContextMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click); this.TruncateContextMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click);
// //
// BranchContextMenuItem // BranchContextMenuItem
// //
this.BranchContextMenuItem.Name = "BranchContextMenuItem"; this.BranchContextMenuItem.Name = "BranchContextMenuItem";
this.BranchContextMenuItem.Size = new System.Drawing.Size(272, 22); this.BranchContextMenuItem.Size = new System.Drawing.Size(269, 22);
this.BranchContextMenuItem.Text = "&Branch"; this.BranchContextMenuItem.Text = "&Branch";
this.BranchContextMenuItem.Click += new System.EventHandler(this.BranchContextMenuItem_Click); this.BranchContextMenuItem.Click += new System.EventHandler(this.BranchContextMenuItem_Click);
// //
// StartFromNowSeparator // StartFromNowSeparator
// //
this.StartFromNowSeparator.Name = "StartFromNowSeparator"; this.StartFromNowSeparator.Name = "StartFromNowSeparator";
this.StartFromNowSeparator.Size = new System.Drawing.Size(269, 6); this.StartFromNowSeparator.Size = new System.Drawing.Size(266, 6);
// //
// StartNewProjectFromNowMenuItem // StartNewProjectFromNowMenuItem
// //
this.StartNewProjectFromNowMenuItem.Name = "StartNewProjectFromNowMenuItem"; this.StartNewProjectFromNowMenuItem.Name = "StartNewProjectFromNowMenuItem";
this.StartNewProjectFromNowMenuItem.Size = new System.Drawing.Size(272, 22); this.StartNewProjectFromNowMenuItem.Size = new System.Drawing.Size(269, 22);
this.StartNewProjectFromNowMenuItem.Text = "Start a new project from Now"; this.StartNewProjectFromNowMenuItem.Text = "Start a new project from Now";
this.StartNewProjectFromNowMenuItem.Click += new System.EventHandler(this.StartNewProjectFromNowMenuItem_Click); this.StartNewProjectFromNowMenuItem.Click += new System.EventHandler(this.StartNewProjectFromNowMenuItem_Click);
// //
// StartANewProjectFromSaveRamMenuItem // StartANewProjectFromSaveRamMenuItem
// //
this.StartANewProjectFromSaveRamMenuItem.Name = "StartANewProjectFromSaveRamMenuItem"; this.StartANewProjectFromSaveRamMenuItem.Name = "StartANewProjectFromSaveRamMenuItem";
this.StartANewProjectFromSaveRamMenuItem.Size = new System.Drawing.Size(272, 22); this.StartANewProjectFromSaveRamMenuItem.Size = new System.Drawing.Size(269, 22);
this.StartANewProjectFromSaveRamMenuItem.Text = "Start a new project from SaveRam"; this.StartANewProjectFromSaveRamMenuItem.Text = "Start a new project from SaveRam";
this.StartANewProjectFromSaveRamMenuItem.Click += new System.EventHandler(this.StartANewProjectFromSaveRamMenuItem_Click); this.StartANewProjectFromSaveRamMenuItem.Click += new System.EventHandler(this.StartANewProjectFromSaveRamMenuItem_Click);
// //
@ -1436,6 +1445,7 @@ namespace BizHawk.Client.EmuHawk
this.BookMarkControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.BookMarkControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.BookMarkControl.HoverInterval = 1;
this.BookMarkControl.Location = new System.Drawing.Point(-2, 5); this.BookMarkControl.Location = new System.Drawing.Point(-2, 5);
this.BookMarkControl.Name = "BookMarkControl"; this.BookMarkControl.Name = "BookMarkControl";
this.BookMarkControl.Size = new System.Drawing.Size(204, 163); this.BookMarkControl.Size = new System.Drawing.Size(204, 163);
@ -1677,5 +1687,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem NewFromNowMenuItem; private System.Windows.Forms.ToolStripMenuItem NewFromNowMenuItem;
private System.Windows.Forms.ToolStripMenuItem NewFromCurrentSaveRamMenuItem; private System.Windows.Forms.ToolStripMenuItem NewFromCurrentSaveRamMenuItem;
private System.Windows.Forms.ToolStripMenuItem SetBranchCellHoverIntervalMenuItem; private System.Windows.Forms.ToolStripMenuItem SetBranchCellHoverIntervalMenuItem;
private System.Windows.Forms.ToolStripMenuItem SetMarkerWithTextContextMenuItem;
} }
} }

View File

@ -628,7 +628,7 @@ namespace BizHawk.Client.EmuHawk
else else
{ {
ClearLeftMouseStates(); ClearLeftMouseStates();
MarkerControl.AddMarkerPopUp(TasView.CurrentCell.RowIndex.Value); MarkerControl.AddMarker(false, TasView.CurrentCell.RowIndex.Value);
} }
} }
} }

View File

@ -583,12 +583,23 @@ namespace BizHawk.Client.EmuHawk
private void SetMarkersMenuItem_Click(object sender, EventArgs e) private void SetMarkersMenuItem_Click(object sender, EventArgs e)
{ {
if (TasView.SelectedRows.Count() > 50)
{
var result = MessageBox.Show("Are you sure you want to add more than 50 markers?", "Add markers", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result != DialogResult.OK)
return;
}
foreach (var index in TasView.SelectedRows) foreach (var index in TasView.SelectedRows)
{ {
MarkerControl.AddMarkerPopUp(index); MarkerControl.AddMarker(false, index);
} }
} }
private void SetMarkerWithTextMenuItem_Click(object sender, EventArgs e)
{
MarkerControl.AddMarker(true, TasView.SelectedRows.FirstOrDefault());
}
private void RemoveMarkersMenuItem_Click(object sender, EventArgs e) private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
{ {
IEnumerable<TasMovieMarker> markers = CurrentTasMovie.Markers.Where(m => TasView.SelectedRows.Contains(m.Frame)); IEnumerable<TasMovieMarker> markers = CurrentTasMovie.Markers.Where(m => TasView.SelectedRows.Contains(m.Frame));

View File

@ -172,10 +172,10 @@ namespace BizHawk.Client.EmuHawk
{ {
var nextColor = Color.White; var nextColor = Color.White;
var isCheat = Global.CheatList.IsActive(_settings.Domain, _searches[index].Address ?? 0); var isCheat = Global.CheatList.IsActive(_settings.Domain, _searches[index].Address);
var isWeeded = Settings.PreviewMode && !_forcePreviewClear && _searches.Preview(_searches[index].Address ?? 0); var isWeeded = Settings.PreviewMode && !_forcePreviewClear && _searches.Preview(_searches[index].Address);
if (_searches[index].Address.Value >= _searches[index].Domain.Size) if (_searches[index].Address >= _searches[index].Domain.Size)
{ {
nextColor = Color.PeachPuff; nextColor = Color.PeachPuff;
} }
@ -852,7 +852,7 @@ namespace BizHawk.Client.EmuHawk
watches.Load(file.FullName, append); watches.Load(file.FullName, append);
var watchList = watches.Where(x => !x.IsSeparator); var watchList = watches.Where(x => !x.IsSeparator);
var addresses = watchList.Select(x => x.Address ?? 0).ToList(); var addresses = watchList.Select(x => x.Address).ToList();
if (truncate) if (truncate)
{ {
@ -1319,7 +1319,7 @@ namespace BizHawk.Client.EmuHawk
private void FreezeAddressMenuItem_Click(object sender, EventArgs e) private void FreezeAddressMenuItem_Click(object sender, EventArgs e)
{ {
var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address ?? 0)); var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address));
if (allCheats) if (allCheats)
{ {
SelectedWatches.UnfreezeAll(); SelectedWatches.UnfreezeAll();
@ -1463,7 +1463,7 @@ namespace BizHawk.Client.EmuHawk
var allCheats = true; var allCheats = true;
foreach (var index in SelectedIndices) foreach (var index in SelectedIndices)
{ {
if (!Global.CheatList.IsActive(_settings.Domain, _searches[index].Address ?? 0)) if (!Global.CheatList.IsActive(_settings.Domain, _searches[index].Address))
{ {
allCheats = false; allCheats = false;
} }
@ -1490,7 +1490,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (SelectedWatches.Any()) if (SelectedWatches.Any())
{ {
ToolHelpers.ViewInHexEditor(_searches.Domain, SelectedWatches.Select(x => x.Address ?? 0), SelectedSize); ToolHelpers.ViewInHexEditor(_searches.Domain, SelectedWatches.Select(x => x.Address), SelectedSize);
} }
} }

View File

@ -219,7 +219,7 @@ namespace BizHawk.Client.EmuHawk
if (_watches != null && !string.IsNullOrWhiteSpace(_watches.CurrentFileName)) if (_watches != null && !string.IsNullOrWhiteSpace(_watches.CurrentFileName))
{ {
_watches.RefreshDomans(_memoryDomains, _memoryDomains.MainMemory); _watches.RefreshDomains(_memoryDomains, _memoryDomains.MainMemory);
_watches.Reload(); _watches.Reload();
SetPlatformAndMemoryDomainLabel(); SetPlatformAndMemoryDomainLabel();
UpdateStatusBar(); UpdateStatusBar();
@ -251,7 +251,7 @@ namespace BizHawk.Client.EmuHawk
{ {
for (var i = 0; i < _watches.Count; i++) for (var i = 0; i < _watches.Count; i++)
{ {
var frozen = !_watches[i].IsSeparator && Global.CheatList.IsActive(_watches[i].Domain, _watches[i].Address ?? 0); var frozen = !_watches[i].IsSeparator && Global.CheatList.IsActive(_watches[i].Domain, _watches[i].Address);
GlobalWin.OSD.AddGUIText( GlobalWin.OSD.AddGUIText(
_watches[i].ToString(), _watches[i].ToString(),
Global.Config.DispRamWatchx, Global.Config.DispRamWatchx,
@ -286,7 +286,7 @@ namespace BizHawk.Client.EmuHawk
return true; return true;
} }
if (Global.CheatList.IsActive(_watches.Domain, watch.Address ?? 0)) if (Global.CheatList.IsActive(_watches.Domain, watch.Address))
{ {
return true; return true;
} }
@ -321,7 +321,7 @@ namespace BizHawk.Client.EmuHawk
{ {
for (var i = 0; i < _watches.Count; i++) for (var i = 0; i < _watches.Count; i++)
{ {
var frozen = !_watches[i].IsSeparator && Global.CheatList.IsActive(_watches[i].Domain, _watches[i].Address ?? 0); var frozen = !_watches[i].IsSeparator && Global.CheatList.IsActive(_watches[i].Domain, _watches[i].Address);
GlobalWin.OSD.AddGUIText( GlobalWin.OSD.AddGUIText(
_watches[i].ToString(), _watches[i].ToString(),
Global.Config.DispRamWatchx, Global.Config.DispRamWatchx,
@ -585,7 +585,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
ErrorIconButton.Visible = _watches.Where(watch => !watch.IsSeparator).Any(watch => (watch.Address ?? 0) >= watch.Domain.Size); ErrorIconButton.Visible = _watches.Where(watch => !watch.IsSeparator).Any(watch => (watch.Address) >= watch.Domain.Size);
MessageLabel.Text = message; MessageLabel.Text = message;
} }
@ -608,11 +608,11 @@ namespace BizHawk.Client.EmuHawk
{ {
color = BackColor; color = BackColor;
} }
else if (_watches[index].Address.Value >= _watches[index].Domain.Size) else if (_watches[index].Address >= _watches[index].Domain.Size)
{ {
color = Color.PeachPuff; color = Color.PeachPuff;
} }
else if (Global.CheatList.IsActive(_watches.Domain, _watches[index].Address ?? 0)) else if (Global.CheatList.IsActive(_watches.Domain, _watches[index].Address))
{ {
color = Color.LightCyan; color = Color.LightCyan;
} }
@ -813,7 +813,7 @@ namespace BizHawk.Client.EmuHawk
private void FreezeAddressMenuItem_Click(object sender, EventArgs e) private void FreezeAddressMenuItem_Click(object sender, EventArgs e)
{ {
var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address ?? 0)); var allCheats = SelectedWatches.All(x => Global.CheatList.IsActive(x.Domain, x.Address));
if (allCheats) if (allCheats)
{ {
SelectedWatches.UnfreezeAll(); SelectedWatches.UnfreezeAll();
@ -1074,7 +1074,7 @@ namespace BizHawk.Client.EmuHawk
SelectedIndices.Any() && SelectedIndices.Any() &&
SelectedWatches.All(w => w.Domain.CanPoke()); SelectedWatches.All(w => w.Domain.CanPoke());
var allCheats = _watches.All(x => Global.CheatList.IsActive(x.Domain, x.Address ?? 0)); var allCheats = _watches.All(x => Global.CheatList.IsActive(x.Domain, x.Address));
if (allCheats) if (allCheats)
{ {
@ -1108,11 +1108,11 @@ namespace BizHawk.Client.EmuHawk
if (selected.Select(x => x.Domain).Distinct().Count() > 1) if (selected.Select(x => x.Domain).Distinct().Count() > 1)
{ {
ToolHelpers.ViewInHexEditor(selected[0].Domain, new List<long> { selected.First().Address ?? 0 }, selected.First().Size); ToolHelpers.ViewInHexEditor(selected[0].Domain, new List<long> { selected.First().Address }, selected.First().Size);
} }
else else
{ {
ToolHelpers.ViewInHexEditor(selected.First().Domain, selected.Select(x => x.Address ?? 0), selected.First().Size); ToolHelpers.ViewInHexEditor(selected.First().Domain, selected.Select(x => x.Address ), selected.First().Size);
} }
} }
} }
@ -1127,7 +1127,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var watch in selected) foreach (var watch in selected)
{ {
debugger.AddBreakpoint((uint)watch.Address.Value, MemoryCallbackType.Read); debugger.AddBreakpoint((uint)watch.Address, MemoryCallbackType.Read);
} }
} }
} }
@ -1142,7 +1142,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var watch in selected) foreach (var watch in selected)
{ {
debugger.AddBreakpoint((uint)watch.Address.Value, MemoryCallbackType.Write); debugger.AddBreakpoint((uint)watch.Address, MemoryCallbackType.Write);
} }
} }
} }
@ -1194,7 +1194,7 @@ namespace BizHawk.Client.EmuHawk
private void ErrorIconButton_Click(object sender, EventArgs e) private void ErrorIconButton_Click(object sender, EventArgs e)
{ {
var items = _watches var items = _watches
.Where(watch => (watch.Address ?? 0) >= watch.Domain.Size) .Where(watch => (watch.Address) >= watch.Domain.Size)
.ToList(); .ToList();
foreach (var item in items) foreach (var item in items)

View File

@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk
else else
{ {
NotesBox.Text = _watchList[0].Notes; NotesBox.Text = _watchList[0].Notes;
AddressBox.SetFromLong(_watchList[0].Address ?? 0); AddressBox.SetFromLong(_watchList[0].Address);
} }
SetBigEndianCheckBox(); SetBigEndianCheckBox();
@ -267,7 +267,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_watchList.Add(Watch.GenerateWatch( _watchList.Add(Watch.GenerateWatch(
watch.Domain, watch.Domain,
watch.Address ?? 0, watch.Address,
watch.Size, watch.Size,
watch.Type, watch.Type,
watch.BigEndian, watch.BigEndian,
@ -308,7 +308,7 @@ namespace BizHawk.Client.EmuHawk
_watchList[i] = Watch.GenerateWatch( _watchList[i] = Watch.GenerateWatch(
_watchList[i].Domain, _watchList[i].Domain,
_watchList.Count == 1 ? AddressBox.ToRawInt() ?? 0 : _watchList[i].Address ?? 0, _watchList.Count == 1 ? AddressBox.ToRawInt() ?? 0 : _watchList[i].Address,
size, size,
_watchList[i].Type, _watchList[i].Type,
_watchList[i].BigEndian, _watchList[i].BigEndian,