Watch refactoring
Some improvement when you get Available types. Used to return a new array each time you call the function. It has been transformed into an IEnumrable and yield return. DisplayType, PreviousType and Watchsize have been moved outside the Watch Class
This commit is contained in:
parent
128c09e7b4
commit
1e2f4e12be
|
@ -20,6 +20,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
@ -29,6 +30,24 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1" MembersFormat="FullSignature">
|
||||
<Class Name="BizHawk.Client.EmuHawk.ConfigPersistAttribute">
|
||||
<Position X="11.5" Y="0.75" Width="1.5" />
|
||||
<Position X="11.5" Y="0.75" Width="1.75" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Attributes\ConfigPersistAttribute.cs</FileName>
|
||||
|
@ -12,17 +12,6 @@
|
|||
<Compartments>
|
||||
<Compartment Name="Nested Types" Collapsed="false" />
|
||||
</Compartments>
|
||||
<NestedTypes>
|
||||
<Enum Name="BizHawk.Client.Common.Watch.DisplayType">
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Enum Name="BizHawk.Client.Common.Watch.PreviousType">
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Enum Name="BizHawk.Client.Common.Watch.WatchSize">
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
</NestedTypes>
|
||||
<TypeIdentifier />
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.SeparatorWatch">
|
||||
|
@ -42,7 +31,7 @@
|
|||
<TypeIdentifier />
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.WatchList">
|
||||
<Position X="27.25" Y="1" Width="5" />
|
||||
<Position X="30.75" Y="1" Width="5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Nested Types" Collapsed="false" />
|
||||
</Compartments>
|
||||
|
@ -75,5 +64,17 @@
|
|||
<FileName>Interfaces\IToolFormAutoConfig.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Enum Name="BizHawk.Client.Common.WatchSize">
|
||||
<Position X="26.5" Y="3.75" Width="1.5" />
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Enum Name="BizHawk.Client.Common.DisplayType">
|
||||
<Position X="26.5" Y="1" Width="1.5" />
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Enum Name="BizHawk.Client.Common.PreviousType">
|
||||
<Position X="28.5" Y="1" Width="1.5" />
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
|
@ -234,7 +234,7 @@
|
|||
<Compile Include="tools\CheatList.cs" />
|
||||
<Compile Include="tools\Watch\ByteWatch.cs" />
|
||||
<Compile Include="tools\Watch\DisplayType.cs" />
|
||||
<Compile Include="tools\Watch\DwordWatch.cs" />
|
||||
<Compile Include="tools\Watch\DWordWatch.cs" />
|
||||
<Compile Include="tools\Watch\PreviousType.cs" />
|
||||
<Compile Include="tools\RamSearchEngine.cs" />
|
||||
<Compile Include="tools\Watch\SeparatorWatch.cs" />
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
// Watch Settings
|
||||
public RecentFiles RecentWatches = new RecentFiles(8);
|
||||
public Watch.PreviousType RamWatchDefinePrevious = Watch.PreviousType.LastFrame;
|
||||
public PreviousType RamWatchDefinePrevious = PreviousType.LastFrame;
|
||||
public bool DisplayRamWatch = false;
|
||||
|
||||
// Hex Editor Colors
|
||||
|
|
|
@ -44,10 +44,10 @@ namespace BizHawk.Client.Common
|
|||
var watch = Watch.GenerateWatch(
|
||||
Global.Emulator.AsMemoryDomains()["System Bus"],
|
||||
decoder.Address,
|
||||
Watch.WatchSize.Byte,
|
||||
Watch.DisplayType.Hex,
|
||||
code,
|
||||
false);
|
||||
WatchSize.Byte,
|
||||
DisplayType.Hex,
|
||||
false,
|
||||
code);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
watch,
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Common.ReflectionExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
@ -288,7 +286,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
|||
if (Global.Emulator.HasRegions())
|
||||
{
|
||||
var region = Global.Emulator.AsRegionable().Region;
|
||||
if (region == DisplayType.PAL)
|
||||
if (region == Emulation.Common.DisplayType.PAL)
|
||||
{
|
||||
movie.HeaderEntries.Add(HeaderKeys.PAL, "1");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -35,8 +37,9 @@ namespace BizHawk.Client.Common
|
|||
cheat.Address ?? 0,
|
||||
cheat.Size,
|
||||
cheat.Type,
|
||||
cheat.Name,
|
||||
cheat.BigEndian ?? false);
|
||||
cheat.BigEndian ?? false,
|
||||
cheat.Name
|
||||
);
|
||||
_compare = cheat.Compare;
|
||||
_val = cheat.Value ?? 0;
|
||||
|
||||
|
@ -87,7 +90,7 @@ namespace BizHawk.Client.Common
|
|||
get { return _watch.Domain; }
|
||||
}
|
||||
|
||||
public Watch.WatchSize Size
|
||||
public WatchSize Size
|
||||
{
|
||||
get { return _watch.Size; }
|
||||
}
|
||||
|
@ -97,7 +100,7 @@ namespace BizHawk.Client.Common
|
|||
get { return _watch.SizeAsChar; }
|
||||
}
|
||||
|
||||
public Watch.DisplayType Type
|
||||
public DisplayType Type
|
||||
{
|
||||
get { return _watch.Type; }
|
||||
}
|
||||
|
@ -124,13 +127,13 @@ namespace BizHawk.Client.Common
|
|||
switch (_watch.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Separator:
|
||||
case WatchSize.Separator:
|
||||
return string.Empty;
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return (_watch as ByteWatch).FormatValue((byte)_val);
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return (_watch as WordWatch).FormatValue((ushort)_val);
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return (_watch as DWordWatch).FormatValue((uint)_val);
|
||||
}
|
||||
}
|
||||
|
@ -145,13 +148,13 @@ namespace BizHawk.Client.Common
|
|||
switch (_watch.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Separator:
|
||||
case WatchSize.Separator:
|
||||
return string.Empty;
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return (_watch as ByteWatch).FormatValue((byte)_compare.Value);
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return (_watch as WordWatch).FormatValue((ushort)_compare.Value);
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return (_watch as DWordWatch).FormatValue((uint)_compare.Value);
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +203,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private string GetStringForPulse(int val)
|
||||
{
|
||||
if (_watch.Type == Watch.DisplayType.Hex)
|
||||
if (_watch.Type == DisplayType.Hex)
|
||||
{
|
||||
return val.ToString("X8");
|
||||
}
|
||||
|
@ -223,13 +226,13 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
switch(_watch.Size)
|
||||
{
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
_watch.Poke((_watch as ByteWatch).FormatValue((byte)_val));
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
_watch.Poke((_watch as WordWatch).FormatValue((ushort)_val));
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
_watch.Poke((_watch as DWordWatch).FormatValue((uint)_val));
|
||||
break;
|
||||
}
|
||||
|
@ -242,13 +245,13 @@ namespace BizHawk.Client.Common
|
|||
switch (_watch.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Separator:
|
||||
case WatchSize.Separator:
|
||||
return false;
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return (_watch.Address ?? 0) == addr;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return (addr == (_watch.Address ?? 0)) || (addr == (_watch.Address ?? 0) + 1);
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return (addr == (_watch.Address ?? 0)) || (addr == (_watch.Address ?? 0) + 1) ||
|
||||
(addr == (_watch.Address ?? 0) + 2) || (addr == (_watch.Address ?? 0) + 3);
|
||||
}
|
||||
|
@ -264,17 +267,17 @@ namespace BizHawk.Client.Common
|
|||
switch (_watch.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Separator:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Separator:
|
||||
case WatchSize.Byte:
|
||||
return (byte?)_val;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
if (addr == (_watch.Address ?? 0))
|
||||
{
|
||||
return (byte)(_val >> 8);
|
||||
}
|
||||
|
||||
return (byte)(_val & 0xFF);
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
if (addr == (_watch.Address ?? 0))
|
||||
{
|
||||
return (byte)((_val >> 24) & 0xFF);
|
||||
|
@ -330,9 +333,9 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public void SetType(Watch.DisplayType type)
|
||||
public void SetType(DisplayType type)
|
||||
{
|
||||
if (Watch.AvailableTypes(_watch.Size).Contains(type))
|
||||
if (_watch.IsDiplayTypeAvailable(type))
|
||||
{
|
||||
_watch.Type = type;
|
||||
Changes();
|
||||
|
|
|
@ -293,7 +293,7 @@ namespace BizHawk.Client.Common
|
|||
/// <param name="addr">The starting address for which you will get the number of bytes
|
||||
/// <param name="size">The number of bytes of the cheat to return</param>
|
||||
/// <returns>The value, or null if it can't resolve the address with a given cheat</returns>
|
||||
public int? GetCheatValue(MemoryDomain domain, long addr, Watch.WatchSize size)
|
||||
public int? GetCheatValue(MemoryDomain domain, long addr, WatchSize size)
|
||||
{
|
||||
var activeCheat = _cheatList.FirstOrDefault(cheat => cheat.Contains(addr));
|
||||
if (activeCheat == (Cheat)null)
|
||||
|
@ -304,21 +304,21 @@ namespace BizHawk.Client.Common
|
|||
switch (activeCheat.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return activeCheat.Value;
|
||||
case Watch.WatchSize.Word:
|
||||
if (size == Watch.WatchSize.Byte)
|
||||
case WatchSize.Word:
|
||||
if (size == WatchSize.Byte)
|
||||
{
|
||||
return GetByteValue(domain, addr);
|
||||
}
|
||||
|
||||
return activeCheat.Value;
|
||||
case Watch.WatchSize.DWord:
|
||||
if (size == Watch.WatchSize.Byte)
|
||||
case WatchSize.DWord:
|
||||
if (size == WatchSize.Byte)
|
||||
{
|
||||
return GetByteValue(domain, addr);
|
||||
}
|
||||
else if (size == Watch.WatchSize.Word)
|
||||
else if (size == WatchSize.Word)
|
||||
{
|
||||
if (activeCheat.Address == addr)
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ namespace BizHawk.Client.Common
|
|||
else
|
||||
{
|
||||
// Set to hex for saving
|
||||
cheat.SetType(Watch.DisplayType.Hex);
|
||||
cheat.SetType(DisplayType.Hex);
|
||||
|
||||
sb
|
||||
.Append(cheat.AddressStr).Append('\t')
|
||||
|
@ -447,8 +447,8 @@ namespace BizHawk.Client.Common
|
|||
else
|
||||
{
|
||||
int? compare;
|
||||
var size = Watch.WatchSize.Byte;
|
||||
var type = Watch.DisplayType.Hex;
|
||||
var size = WatchSize.Byte;
|
||||
var type = DisplayType.Hex;
|
||||
var bigendian = false;
|
||||
|
||||
if (s.Length < 6)
|
||||
|
@ -486,8 +486,8 @@ namespace BizHawk.Client.Common
|
|||
address,
|
||||
size,
|
||||
type,
|
||||
name,
|
||||
bigendian);
|
||||
bigendian,
|
||||
name);
|
||||
|
||||
Add(new Cheat(watch, value, compare, !Global.Config.DisableCheatsOnLoad && enabled));
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace BizHawk.Client.Common
|
|||
switch (_settings.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
if (_settings.Mode == Settings.SearchMode.Detailed)
|
||||
{
|
||||
for (int i = 0; i < domain.Size; i++)
|
||||
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
if (_settings.Mode == Settings.SearchMode.Detailed)
|
||||
{
|
||||
for (int i = 0; i < domain.Size - 1; i += _settings.CheckMisAligned ? 1 : 2)
|
||||
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
if (_settings.Mode == Settings.SearchMode.Detailed)
|
||||
{
|
||||
for (int i = 0; i < domain.Size - 3; i += _settings.CheckMisAligned ? 1 : 4)
|
||||
|
@ -142,6 +142,8 @@ namespace BizHawk.Client.Common
|
|||
_settings.Size,
|
||||
_settings.Type,
|
||||
_settings.BigEndian,
|
||||
string.Empty,
|
||||
0,
|
||||
_watchList[index].Previous,
|
||||
(_watchList[index] as IMiniWatchDetails).ChangeCount
|
||||
);
|
||||
|
@ -154,6 +156,8 @@ namespace BizHawk.Client.Common
|
|||
_settings.Size,
|
||||
_settings.Type,
|
||||
_settings.BigEndian,
|
||||
string.Empty,
|
||||
0,
|
||||
_watchList[index].Previous,
|
||||
0
|
||||
);
|
||||
|
@ -185,7 +189,7 @@ namespace BizHawk.Client.Common
|
|||
break;
|
||||
}
|
||||
|
||||
if (_settings.PreviousType == Watch.PreviousType.LastSearch)
|
||||
if (_settings.PreviousType == PreviousType.LastSearch)
|
||||
{
|
||||
SetPreviousToCurrent();
|
||||
}
|
||||
|
@ -292,24 +296,21 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public void SetType(Watch.DisplayType type)
|
||||
{
|
||||
if (Watch.AvailableTypes(_settings.Size).Contains(type))
|
||||
public void SetType(DisplayType type)
|
||||
{
|
||||
_settings.Type = type;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetEndian(bool bigendian)
|
||||
{
|
||||
_settings.BigEndian = bigendian;
|
||||
}
|
||||
|
||||
public void SetPreviousType(Watch.PreviousType type)
|
||||
public void SetPreviousType(PreviousType type)
|
||||
{
|
||||
if (_settings.Mode == Settings.SearchMode.Fast)
|
||||
{
|
||||
if (type == Watch.PreviousType.LastFrame)
|
||||
if (type == PreviousType.LastFrame)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
@ -370,7 +371,7 @@ namespace BizHawk.Client.Common
|
|||
switch (_settings.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
if (_settings.Mode == Settings.SearchMode.Detailed)
|
||||
{
|
||||
foreach (var addr in addresses)
|
||||
|
@ -387,7 +388,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
if (_settings.Mode == Settings.SearchMode.Detailed)
|
||||
{
|
||||
foreach (var addr in addresses)
|
||||
|
@ -404,7 +405,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
if (_settings.Mode == Settings.SearchMode.Detailed)
|
||||
{
|
||||
foreach (var addr in addresses)
|
||||
|
@ -553,7 +554,7 @@ namespace BizHawk.Client.Common
|
|||
return watchList.Where(x => GetValue(x.Address) != x.Previous);
|
||||
|
||||
case ComparisonOperator.GreaterThan:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) > ToFloat(x.Previous));
|
||||
}
|
||||
|
@ -561,7 +562,7 @@ namespace BizHawk.Client.Common
|
|||
return watchList.Where(x => SignExtendAsNeeded(GetValue(x.Address)) > SignExtendAsNeeded(x.Previous));
|
||||
|
||||
case ComparisonOperator.GreaterThanEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) >= ToFloat(x.Previous));
|
||||
}
|
||||
|
@ -569,7 +570,7 @@ namespace BizHawk.Client.Common
|
|||
return watchList.Where(x => SignExtendAsNeeded(GetValue(x.Address)) >= SignExtendAsNeeded(x.Previous));
|
||||
|
||||
case ComparisonOperator.LessThan:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) < ToFloat(x.Previous));
|
||||
}
|
||||
|
@ -577,7 +578,7 @@ namespace BizHawk.Client.Common
|
|||
return watchList.Where(x => SignExtendAsNeeded(GetValue(x.Address)) < SignExtendAsNeeded(x.Previous));
|
||||
|
||||
case ComparisonOperator.LessThanEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) <= ToFloat(x.Previous));
|
||||
}
|
||||
|
@ -587,13 +588,14 @@ namespace BizHawk.Client.Common
|
|||
case ComparisonOperator.DifferentBy:
|
||||
if (_differentBy.HasValue)
|
||||
{
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) + _differentBy.Value == ToFloat(x.Previous))
|
||||
|| (ToFloat(GetValue(x.Address)) - _differentBy.Value == ToFloat(x.Previous)));
|
||||
}
|
||||
|
||||
return watchList.Where(x => {
|
||||
return watchList.Where(x =>
|
||||
{
|
||||
long val = SignExtendAsNeeded(GetValue(x.Address));
|
||||
long prev = SignExtendAsNeeded(x.Previous);
|
||||
return (val + _differentBy.Value == prev) || (val - _differentBy.Value == prev);
|
||||
|
@ -615,14 +617,14 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
default:
|
||||
case ComparisonOperator.Equal:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) == ToFloat(_compareValue.Value));
|
||||
}
|
||||
|
||||
return watchList.Where(x => GetValue(x.Address) == _compareValue.Value);
|
||||
case ComparisonOperator.NotEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) != ToFloat(_compareValue.Value));
|
||||
}
|
||||
|
@ -630,28 +632,28 @@ namespace BizHawk.Client.Common
|
|||
return watchList.Where(x => GetValue(x.Address) != _compareValue.Value);
|
||||
|
||||
case ComparisonOperator.GreaterThan:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) > ToFloat(_compareValue.Value));
|
||||
}
|
||||
|
||||
return watchList.Where(x => SignExtendAsNeeded(GetValue(x.Address)) > _compareValue.Value);
|
||||
case ComparisonOperator.GreaterThanEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) >= ToFloat(_compareValue.Value));
|
||||
}
|
||||
|
||||
return watchList.Where(x => SignExtendAsNeeded(GetValue(x.Address)) >= _compareValue.Value);
|
||||
case ComparisonOperator.LessThan:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) < ToFloat(_compareValue.Value));
|
||||
}
|
||||
|
||||
return watchList.Where(x => SignExtendAsNeeded(GetValue(x.Address)) < _compareValue.Value);
|
||||
case ComparisonOperator.LessThanEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => ToFloat(GetValue(x.Address)) <= ToFloat(_compareValue.Value));
|
||||
}
|
||||
|
@ -660,7 +662,7 @@ namespace BizHawk.Client.Common
|
|||
case ComparisonOperator.DifferentBy:
|
||||
if (_differentBy.HasValue)
|
||||
{
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) + _differentBy.Value == _compareValue.Value) ||
|
||||
(ToFloat(GetValue(x.Address)) - _differentBy.Value == _compareValue.Value));
|
||||
|
@ -783,42 +785,42 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
default:
|
||||
case ComparisonOperator.Equal:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - ToFloat(x.Previous)) == _compareValue.Value);
|
||||
}
|
||||
|
||||
return watchList.Where(x => (SignExtendAsNeeded(GetValue(x.Address)) - SignExtendAsNeeded(x.Previous)) == _compareValue.Value);
|
||||
case ComparisonOperator.NotEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - x.Previous) != _compareValue.Value);
|
||||
}
|
||||
|
||||
return watchList.Where(x => (SignExtendAsNeeded(GetValue(x.Address)) - SignExtendAsNeeded(x.Previous)) != _compareValue.Value);
|
||||
case ComparisonOperator.GreaterThan:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - x.Previous) > _compareValue.Value);
|
||||
}
|
||||
|
||||
return watchList.Where(x => (SignExtendAsNeeded(GetValue(x.Address)) - SignExtendAsNeeded(x.Previous)) > _compareValue.Value);
|
||||
case ComparisonOperator.GreaterThanEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - x.Previous) >= _compareValue.Value);
|
||||
}
|
||||
|
||||
return watchList.Where(x => (SignExtendAsNeeded(GetValue(x.Address)) - SignExtendAsNeeded(x.Previous)) >= _compareValue.Value);
|
||||
case ComparisonOperator.LessThan:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - x.Previous) < _compareValue.Value);
|
||||
}
|
||||
|
||||
return watchList.Where(x => (SignExtendAsNeeded(GetValue(x.Address)) - SignExtendAsNeeded(x.Previous)) < _compareValue.Value);
|
||||
case ComparisonOperator.LessThanEqual:
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - x.Previous) <= _compareValue.Value);
|
||||
}
|
||||
|
@ -827,7 +829,7 @@ namespace BizHawk.Client.Common
|
|||
case ComparisonOperator.DifferentBy:
|
||||
if (_differentBy.HasValue)
|
||||
{
|
||||
if (_settings.Type == Watch.DisplayType.Float)
|
||||
if (_settings.Type == DisplayType.Float)
|
||||
{
|
||||
return watchList.Where(x => (ToFloat(GetValue(x.Address)) - x.Previous + _differentBy.Value == _compareValue) ||
|
||||
(ToFloat(GetValue(x.Address)) - x.Previous - _differentBy.Value == x.Previous));
|
||||
|
@ -861,15 +863,15 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private long SignExtendAsNeeded(long val)
|
||||
{
|
||||
if (_settings.Type != Watch.DisplayType.Signed) return val;
|
||||
if (_settings.Type != DisplayType.Signed) return val;
|
||||
switch (_settings.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return (sbyte)val;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return (short)val;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return (int)val;
|
||||
}
|
||||
}
|
||||
|
@ -880,15 +882,15 @@ namespace BizHawk.Client.Common
|
|||
switch (_settings.Size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
var theByte = _settings.Domain.PeekByte(addr % Domain.Size);
|
||||
return theByte;
|
||||
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
var theWord = _settings.Domain.PeekWord(addr % Domain.Size, _settings.BigEndian);
|
||||
return theWord;
|
||||
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
var theDWord = _settings.Domain.PeekDWord(addr % Domain.Size, _settings.BigEndian);
|
||||
return theDWord;
|
||||
}
|
||||
|
@ -922,7 +924,7 @@ namespace BizHawk.Client.Common
|
|||
int ChangeCount { get; }
|
||||
|
||||
void ClearChangeCount();
|
||||
void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian);
|
||||
void Update(PreviousType type, MemoryDomain domain, bool bigendian);
|
||||
}
|
||||
|
||||
private sealed class MiniByteWatch : IMiniWatch
|
||||
|
@ -1020,7 +1022,7 @@ namespace BizHawk.Client.Common
|
|||
get { return _changecount; }
|
||||
}
|
||||
|
||||
public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian)
|
||||
public void Update(PreviousType type, MemoryDomain domain, bool bigendian)
|
||||
{
|
||||
var value = domain.PeekByte(Address % domain.Size);
|
||||
|
||||
|
@ -1031,13 +1033,13 @@ namespace BizHawk.Client.Common
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case Watch.PreviousType.Original:
|
||||
case Watch.PreviousType.LastSearch:
|
||||
case PreviousType.Original:
|
||||
case PreviousType.LastSearch:
|
||||
break;
|
||||
case Watch.PreviousType.LastFrame:
|
||||
case PreviousType.LastFrame:
|
||||
_previous = _prevFrame;
|
||||
break;
|
||||
case Watch.PreviousType.LastChange:
|
||||
case PreviousType.LastChange:
|
||||
if (_prevFrame != value)
|
||||
_previous = _prevFrame;
|
||||
break;
|
||||
|
@ -1081,7 +1083,7 @@ namespace BizHawk.Client.Common
|
|||
get { return _changecount; }
|
||||
}
|
||||
|
||||
public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian)
|
||||
public void Update(PreviousType type, MemoryDomain domain, bool bigendian)
|
||||
{
|
||||
var value = domain.PeekWord(Address % domain.Size, bigendian);
|
||||
if (value != Previous)
|
||||
|
@ -1091,13 +1093,13 @@ namespace BizHawk.Client.Common
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case Watch.PreviousType.Original:
|
||||
case Watch.PreviousType.LastSearch:
|
||||
case PreviousType.Original:
|
||||
case PreviousType.LastSearch:
|
||||
break;
|
||||
case Watch.PreviousType.LastFrame:
|
||||
case PreviousType.LastFrame:
|
||||
_previous = _prevFrame;
|
||||
break;
|
||||
case Watch.PreviousType.LastChange:
|
||||
case PreviousType.LastChange:
|
||||
if (_prevFrame != value)
|
||||
_previous = _prevFrame;
|
||||
break;
|
||||
|
@ -1141,7 +1143,7 @@ namespace BizHawk.Client.Common
|
|||
get { return _changecount; }
|
||||
}
|
||||
|
||||
public void Update(Watch.PreviousType type, MemoryDomain domain, bool bigendian)
|
||||
public void Update(PreviousType type, MemoryDomain domain, bool bigendian)
|
||||
{
|
||||
var value = domain.PeekDWord(Address % domain.Size, bigendian);
|
||||
if (value != Previous)
|
||||
|
@ -1151,13 +1153,13 @@ namespace BizHawk.Client.Common
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case Watch.PreviousType.Original:
|
||||
case Watch.PreviousType.LastSearch:
|
||||
case PreviousType.Original:
|
||||
case PreviousType.LastSearch:
|
||||
break;
|
||||
case Watch.PreviousType.LastFrame:
|
||||
case PreviousType.LastFrame:
|
||||
_previous = _prevFrame;
|
||||
break;
|
||||
case Watch.PreviousType.LastChange:
|
||||
case PreviousType.LastChange:
|
||||
if (_prevFrame != value)
|
||||
_previous = _prevFrame;
|
||||
break;
|
||||
|
@ -1177,15 +1179,15 @@ namespace BizHawk.Client.Common
|
|||
public Settings(IMemoryDomains memoryDomains)
|
||||
{
|
||||
BigEndian = memoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big;
|
||||
Size = (Watch.WatchSize)memoryDomains.MainMemory.ByteSize;
|
||||
Type = Watch.DisplayType.Unsigned;
|
||||
Size = (WatchSize)memoryDomains.MainMemory.ByteSize;
|
||||
Type = DisplayType.Unsigned;
|
||||
Mode = memoryDomains.MainMemory.Size > (1024 * 1024) ?
|
||||
SearchMode.Fast :
|
||||
SearchMode.Detailed;
|
||||
|
||||
Domain = memoryDomains.MainMemory;
|
||||
CheckMisAligned = false;
|
||||
PreviousType = Watch.PreviousType.LastSearch;
|
||||
PreviousType = PreviousType.LastSearch;
|
||||
}
|
||||
|
||||
/*Require restart*/
|
||||
|
@ -1193,13 +1195,13 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public SearchMode Mode { get; set; }
|
||||
public MemoryDomain Domain { get; set; }
|
||||
public Watch.WatchSize Size { get; set; }
|
||||
public WatchSize Size { get; set; }
|
||||
public bool CheckMisAligned { get; set; }
|
||||
|
||||
/*Can be changed mid-search*/
|
||||
public Watch.DisplayType Type { get; set; }
|
||||
public DisplayType Type { get; set; }
|
||||
public bool BigEndian { get; set; }
|
||||
public Watch.PreviousType PreviousType { get; set; }
|
||||
public PreviousType PreviousType { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -10,36 +10,49 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public sealed class ByteWatch : Watch
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private byte _previous;
|
||||
private byte _value;
|
||||
|
||||
public ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string notes)
|
||||
#endregion
|
||||
|
||||
#region cTor(s)
|
||||
|
||||
internal ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, byte value, byte previous, int changeCount)
|
||||
: base(domain, address, WatchSize.Byte, type, bigEndian, note)
|
||||
{
|
||||
_address = address;
|
||||
_domain = domain;
|
||||
_value = _previous = GetByte();
|
||||
if (AvailableTypes(WatchSize.Byte).Contains(type))
|
||||
{
|
||||
_type = type;
|
||||
this._value = value;
|
||||
this._previous = previous;
|
||||
this._changecount = changeCount;
|
||||
}
|
||||
|
||||
_bigEndian = bigEndian;
|
||||
if (notes != null)
|
||||
internal ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note)
|
||||
:this(domain, address, type, bigEndian, note, 0, 0, 0)
|
||||
{
|
||||
Notes = notes;
|
||||
_previous = GetByte();
|
||||
_value = GetByte();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static IEnumerable<DisplayType> ValidTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return DisplayType.Unsigned;
|
||||
yield return DisplayType.Signed;
|
||||
yield return DisplayType.Hex;
|
||||
yield return DisplayType.Binary;
|
||||
}
|
||||
}
|
||||
|
||||
public ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, byte prev, int changeCount, string notes = null)
|
||||
: this(domain, address, type, bigEndian, notes)
|
||||
public override IEnumerable<DisplayType> AvailableTypes()
|
||||
{
|
||||
_previous = prev;
|
||||
_changecount = changeCount;
|
||||
}
|
||||
|
||||
public override long? Address
|
||||
{
|
||||
get { return _address; }
|
||||
yield return DisplayType.Unsigned;
|
||||
yield return DisplayType.Signed;
|
||||
yield return DisplayType.Hex;
|
||||
yield return DisplayType.Binary;
|
||||
}
|
||||
|
||||
public override int? Value
|
||||
|
@ -77,27 +90,6 @@ namespace BizHawk.Client.Common
|
|||
return Notes + ": " + ValueString;
|
||||
}
|
||||
|
||||
public override bool IsSeparator
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override WatchSize Size
|
||||
{
|
||||
get { return WatchSize.Byte; }
|
||||
}
|
||||
|
||||
public static List<DisplayType> ValidTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<DisplayType>
|
||||
{
|
||||
DisplayType.Unsigned, DisplayType.Signed, DisplayType.Hex, DisplayType.Binary
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override uint MaxValue
|
||||
{
|
||||
get { return byte.MaxValue; }
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public abstract partial class Watch
|
||||
{
|
||||
/// <summary>
|
||||
/// This enum is used to specify how you want your <see cref="Watch"/> to be displayed
|
||||
/// </summary>
|
||||
|
@ -58,5 +51,4 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
Float
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,35 +11,55 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public sealed class DWordWatch : Watch
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private uint _value;
|
||||
private uint _previous;
|
||||
|
||||
public DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string notes)
|
||||
{
|
||||
_domain = domain;
|
||||
_address = address;
|
||||
_value = _previous = GetDWord();
|
||||
#endregion
|
||||
|
||||
if (AvailableTypes(WatchSize.DWord).Contains(type))
|
||||
#region cTor(s)
|
||||
|
||||
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)
|
||||
{
|
||||
_type = type;
|
||||
this._value = value;
|
||||
this._previous = previous;
|
||||
this._changecount = changeCount;
|
||||
}
|
||||
|
||||
_bigEndian = bigEndian;
|
||||
|
||||
if (notes != null)
|
||||
internal DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note)
|
||||
:this(domain, address, type, bigEndian, note, 0, 0, 0)
|
||||
{
|
||||
Notes = notes;
|
||||
_previous = GetDWord();
|
||||
_value = GetDWord();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static IEnumerable<DisplayType> ValidTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return DisplayType.Unsigned;
|
||||
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 DWordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, uint prev, int changeCount, string notes = null)
|
||||
: this(domain, address, type, bigEndian, notes)
|
||||
public override IEnumerable<DisplayType> AvailableTypes()
|
||||
{
|
||||
_previous = prev;
|
||||
_changecount = changeCount;
|
||||
_type = type;
|
||||
_bigEndian = bigEndian;
|
||||
yield return DisplayType.Unsigned;
|
||||
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
|
||||
|
@ -67,22 +87,6 @@ namespace BizHawk.Client.Common
|
|||
_previous = GetWord();
|
||||
}
|
||||
|
||||
public override WatchSize Size
|
||||
{
|
||||
get { return WatchSize.DWord; }
|
||||
}
|
||||
|
||||
public static List<DisplayType> ValidTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<DisplayType>
|
||||
{
|
||||
DisplayType.Unsigned, DisplayType.Signed, DisplayType.Hex, DisplayType.FixedPoint_20_12, DisplayType.FixedPoint_16_16, DisplayType.Float
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override uint MaxValue
|
||||
{
|
||||
get { return uint.MaxValue; }
|
||||
|
|
|
@ -5,8 +5,6 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public abstract partial class Watch
|
||||
{
|
||||
public enum PreviousType
|
||||
{
|
||||
Original = 0,
|
||||
|
@ -14,5 +12,4 @@ namespace BizHawk.Client.Common
|
|||
LastFrame = 2,
|
||||
LastChange = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public sealed class SeparatorWatch : Watch
|
||||
{
|
||||
internal SeparatorWatch()
|
||||
:base(null, 0, WatchSize.Separator, DisplayType.Separator, true, string.Empty)
|
||||
{ }
|
||||
|
||||
public static SeparatorWatch Instance
|
||||
{
|
||||
get { return new SeparatorWatch(); }
|
||||
}
|
||||
|
||||
public override long? Address
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override int? Value
|
||||
{
|
||||
get { return null; }
|
||||
|
@ -29,11 +29,6 @@ namespace BizHawk.Client.Common
|
|||
get { return null; }
|
||||
}
|
||||
|
||||
public override string AddressString
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public override string ValueString
|
||||
{
|
||||
get { return string.Empty; }
|
||||
|
@ -49,26 +44,6 @@ namespace BizHawk.Client.Common
|
|||
return "----";
|
||||
}
|
||||
|
||||
public override bool IsSeparator
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override WatchSize Size
|
||||
{
|
||||
get { return WatchSize.Separator; }
|
||||
}
|
||||
|
||||
public static List<DisplayType> ValidTypes
|
||||
{
|
||||
get { return new List<DisplayType> { DisplayType.Separator }; }
|
||||
}
|
||||
|
||||
public override DisplayType Type
|
||||
{
|
||||
get { return DisplayType.Separator; }
|
||||
}
|
||||
|
||||
public override bool Poke(string value)
|
||||
{
|
||||
return false;
|
||||
|
@ -87,5 +62,10 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
public override void Update() { return; }
|
||||
|
||||
public override IEnumerable<DisplayType> AvailableTypes()
|
||||
{
|
||||
yield return DisplayType.Separator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using BizHawk.Emulation.Common;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -14,9 +15,42 @@ namespace BizHawk.Client.Common
|
|||
protected long _address;
|
||||
protected MemoryDomain _domain;
|
||||
protected DisplayType _type;
|
||||
protected WatchSize _size;
|
||||
protected bool _bigEndian;
|
||||
protected int _changecount;
|
||||
protected string _notes = string.Empty;
|
||||
protected string _notes;
|
||||
protected int _changecount = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region cTor(s)
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a new instance of <see cref="Watch"/>
|
||||
/// </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="size">A <see cref="WatchSize"/> (byte, word, double word)</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>
|
||||
protected Watch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note)
|
||||
{
|
||||
if (IsDiplayTypeAvailable(type))
|
||||
{
|
||||
this._domain = domain;
|
||||
this._address = address;
|
||||
this._size = size;
|
||||
this._type = type;
|
||||
this._bigEndian = bigEndian;
|
||||
this._notes = note;
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException(string.Format("DisplayType {0} is invalid for this type of Watch", type.ToString()), "type");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -24,27 +58,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Static
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of Available types for specific <see cref="WatchSize"/>
|
||||
/// </summary>
|
||||
/// <param name="size">Desired size</param>
|
||||
/// <returns>An array of <see cref="DisplayType"/> that ca be used to be displayed</returns>
|
||||
public static List<DisplayType> AvailableTypes(WatchSize size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
default:
|
||||
case WatchSize.Separator:
|
||||
return SeparatorWatch.ValidTypes;
|
||||
case WatchSize.Byte:
|
||||
return ByteWatch.ValidTypes;
|
||||
case WatchSize.Word:
|
||||
return WordWatch.ValidTypes;
|
||||
case WatchSize.DWord:
|
||||
return DWordWatch.ValidTypes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a <see cref="Watch"/> from a given string
|
||||
/// String is tab separate
|
||||
|
@ -105,8 +118,8 @@ namespace BizHawk.Client.Common
|
|||
address,
|
||||
size,
|
||||
type,
|
||||
notes,
|
||||
bigEndian
|
||||
bigEndian,
|
||||
notes
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@ -123,11 +136,13 @@ namespace BizHawk.Client.Common
|
|||
/// <param name="address">The address into the <see cref="MemoryDomain"/></param>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="type">How the watch will be displayed</param>
|
||||
/// <param name="bigendian">Endianess (true for big endian)</param>
|
||||
/// <param name="bigEndian">Endianess (true for big endian)</param>
|
||||
/// <param name="note">A custom note about the <see cref="Watch"/></param>
|
||||
/// <param name="value">The current watch value</param>
|
||||
/// <param name="prev">Previous value</param>
|
||||
/// <param name="changecount">How many times value has change</param>
|
||||
/// <param name="changeCount">Number of changes occurs in current <see cref="Watch"/></param>
|
||||
/// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
|
||||
public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigendian, long prev, int changecount)
|
||||
public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note, long value, long prev, int changeCount)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -135,11 +150,11 @@ namespace BizHawk.Client.Common
|
|||
case WatchSize.Separator:
|
||||
return SeparatorWatch.Instance;
|
||||
case WatchSize.Byte:
|
||||
return new ByteWatch(domain, address, type, bigendian, (byte)prev, changecount);
|
||||
return new ByteWatch(domain, address, type, bigEndian, note, (byte)value, (byte)prev, changeCount);
|
||||
case WatchSize.Word:
|
||||
return new WordWatch(domain, address, type, bigendian, (ushort)prev, changecount);
|
||||
return new WordWatch(domain, address, type, bigEndian, note, (ushort)value, (ushort)prev, changeCount);
|
||||
case WatchSize.DWord:
|
||||
return new DWordWatch(domain, address, type, bigendian, (uint)prev, changecount);
|
||||
return new DWordWatch(domain, address, type, bigEndian, note, (uint)value, (uint)prev, changeCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,13 +166,35 @@ namespace BizHawk.Client.Common
|
|||
/// <param name="address">The address into the <see cref="MemoryDomain"/></param>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="type">How the watch will be displayed</param>
|
||||
/// <param name="bigendian">Endianess (true for big endian)</param>
|
||||
/// <param name="bigEndian">Endianess (true for big endian)</param>
|
||||
/// <param name="note">A customp note about your watch</param>
|
||||
/// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
|
||||
public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, string notes, bool bigEndian)
|
||||
public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian, string note)
|
||||
{
|
||||
return GenerateWatch(domain, address, size, type, bigEndian, 0, 0);
|
||||
return GenerateWatch(domain, address, size, type, bigEndian, note, 0, 0, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a new <see cref="Watch"/> instance
|
||||
/// Can be either <see cref="ByteWatch"/>, <see cref="WordWatch"/>, <see cref="DWordWatch"/> or <see cref="SeparatorWatch"/>
|
||||
/// </summary>
|
||||
/// <param name="domain">The <see cref="MemoryDomain"/> where you want to watch</param>
|
||||
/// <param name="address">The address into the <see cref="MemoryDomain"/></param>
|
||||
/// <param name="size">The size</param>
|
||||
/// <param name="type">How the watch will be displayed</param>
|
||||
/// <param name="bigEndian">Endianess (true for big endian)</param>
|
||||
/// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
|
||||
public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian)
|
||||
{
|
||||
return GenerateWatch(domain, address, size, type, bigEndian, string.Empty, 0, 0, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality operator between two <see cref="Watch"/>
|
||||
/// </summary>
|
||||
/// <param name="a">First watch</param>
|
||||
/// <param name="b">Second watch</param>
|
||||
/// <returns>True if both watch are equals; otherwise, false</returns>
|
||||
public static bool operator ==(Watch a, Watch b)
|
||||
{
|
||||
if (object.ReferenceEquals(a, null) || object.ReferenceEquals(b, null))
|
||||
|
@ -174,16 +211,34 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality operator between a <see cref="Watch"/> and a <see cref="Cheat"/>
|
||||
/// </summary>
|
||||
/// <param name="a">The watch</param>
|
||||
/// <param name="b">The cheat</param>
|
||||
/// <returns>True if they are equals; otherwise, false</returns>
|
||||
public static bool operator ==(Watch a, Cheat b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inequality operator between two <see cref="Watch"/>
|
||||
/// </summary>
|
||||
/// <param name="a">First watch</param>
|
||||
/// <param name="b">Second watch</param>
|
||||
/// <returns>True if both watch are different; otherwise, false</returns>
|
||||
public static bool operator !=(Watch a, Watch b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inequality operator between a <see cref="Watch"/> and a <see cref="Cheat"/>
|
||||
/// </summary>
|
||||
/// <param name="a">The watch</param>
|
||||
/// <param name="b">The cheat</param>
|
||||
/// <returns>True if they are different; otherwise, false</returns>
|
||||
public static bool operator !=(Watch a, Cheat b)
|
||||
{
|
||||
return !(a == b);
|
||||
|
@ -193,7 +248,20 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Abstracts
|
||||
|
||||
/// <summary>
|
||||
/// Get a list a <see cref="DisplayType"/> that can be used for this <see cref="Watch"/>
|
||||
/// </summary>
|
||||
/// <returns>An enumartion that contains all valid <see cref="DisplayType"/></returns>
|
||||
public abstract IEnumerable<DisplayType> AvailableTypes();
|
||||
|
||||
/// <summary>
|
||||
/// Reset the previous value
|
||||
/// </summary>
|
||||
public abstract void ResetPrevious();
|
||||
|
||||
/// <summary>
|
||||
/// Update the Watch (read it from <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public abstract void Update();
|
||||
|
||||
#endregion Abstracts
|
||||
|
@ -283,6 +351,9 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#endregion Protected
|
||||
|
||||
/// <summary>
|
||||
/// Set the number of changes to 0
|
||||
/// </summary>
|
||||
public void ClearChangeCount()
|
||||
{
|
||||
_changecount = 0;
|
||||
|
@ -315,11 +386,26 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hash the current watch and gets a unique value
|
||||
/// </summary>
|
||||
/// <returns>int that can serves as a unique representation of current Watch</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.Domain.GetHashCode() + (int)(this.Address ?? 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if the specified <see cref="DisplayType"/> can be
|
||||
/// used for the current <see cref="Watch"/>
|
||||
/// </summary>
|
||||
/// <param name="type"><see cref="DisplayType"/> you want to check</param>
|
||||
/// <returns></returns>
|
||||
public bool IsDiplayTypeAvailable(DisplayType type)
|
||||
{
|
||||
return AvailableTypes().Where<DisplayType>(d => d == type).Any<DisplayType>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transform the current instance into a string
|
||||
/// </summary>
|
||||
|
@ -348,19 +434,16 @@ namespace BizHawk.Client.Common
|
|||
//zero 15-nov-2015 - bypass LIAR LOGIC, see fdc9ea2aa922876d20ba897fb76909bf75fa6c92 https://github.com/TASVideos/BizHawk/issues/326
|
||||
public abstract int? ValueNoFreeze { get; }
|
||||
public abstract string ValueString { get; }
|
||||
public abstract WatchSize Size { get; }
|
||||
public abstract bool Poke(string value);
|
||||
public abstract int? Previous { get; }
|
||||
public abstract string PreviousStr { get; }
|
||||
|
||||
#endregion Abstracts
|
||||
|
||||
#region Virtual
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address in the <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public virtual long? Address
|
||||
public long? Address
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -369,61 +452,9 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the endianess of current <see cref="Watch"/>
|
||||
/// True for big endian, flase for little endian
|
||||
/// Gets the format tha should be used by string.Format()
|
||||
/// </summary>
|
||||
public virtual bool BigEndian
|
||||
{
|
||||
get
|
||||
{
|
||||
return _bigEndian;
|
||||
}
|
||||
set
|
||||
{
|
||||
_bigEndian = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or set the way current <see cref="Watch"/> is displayed
|
||||
/// </summary>
|
||||
public virtual DisplayType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
set
|
||||
{
|
||||
_type = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address in the <see cref="MemoryDomain"/> formatted as string
|
||||
/// </summary>
|
||||
public virtual string AddressString
|
||||
{
|
||||
get
|
||||
{
|
||||
return _address.ToString(AddressFormatStr);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value that defined if the current <see cref="Watch"/> is actually a <see cref="SeparatorWatch"/>
|
||||
/// </summary>
|
||||
public virtual bool IsSeparator
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Virtual
|
||||
|
||||
public string AddressFormatStr
|
||||
private string AddressFormatStr
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -436,6 +467,36 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address in the <see cref="MemoryDomain"/> formatted as string
|
||||
/// </summary>
|
||||
public string AddressString
|
||||
{
|
||||
get
|
||||
{
|
||||
return _address.ToString(AddressFormatStr);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the endianess of current <see cref="Watch"/>
|
||||
/// True for big endian, flase for little endian
|
||||
/// </summary>
|
||||
public bool BigEndian
|
||||
{
|
||||
get
|
||||
{
|
||||
return _bigEndian;
|
||||
}
|
||||
set
|
||||
{
|
||||
_bigEndian = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of time tha value of current <see cref="Watch"/> has changed
|
||||
/// </summary>
|
||||
public int ChangeCount
|
||||
{
|
||||
get
|
||||
|
@ -444,6 +505,28 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or set the way current <see cref="Watch"/> is displayed
|
||||
/// </summary>
|
||||
public DisplayType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (IsDiplayTypeAvailable(value))
|
||||
{
|
||||
_type = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException(string.Format("DisplayType {0} is invalid for this type of Watch", value.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets current <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
|
@ -478,14 +561,32 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value that defined if the current address is
|
||||
/// well in the range of current <see cref="MemoryDomain"/>
|
||||
/// </summary>
|
||||
public bool IsOutOfRange
|
||||
{
|
||||
get
|
||||
{
|
||||
return !IsSeparator && (Domain.Size != 0 && Address.Value >= Domain.Size);
|
||||
return !IsSeparator && (_domain.Size != 0 && _address >= _domain.Size);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value that defined if the current <see cref="Watch"/> is actually a <see cref="SeparatorWatch"/>
|
||||
/// </summary>
|
||||
public bool IsSeparator
|
||||
{
|
||||
get
|
||||
{
|
||||
return this is SeparatorWatch;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets notes for current <see cref="Watch"/>
|
||||
/// </summary>
|
||||
public string Notes
|
||||
{
|
||||
get
|
||||
|
@ -498,6 +599,17 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current size of the watch
|
||||
/// </summary>
|
||||
public WatchSize Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static string DisplayTypeToString(DisplayType type)
|
||||
|
|
|
@ -533,8 +533,8 @@ namespace BizHawk.Client.Common
|
|||
addr,
|
||||
size,
|
||||
type,
|
||||
notes,
|
||||
bigEndian));
|
||||
bigEndian,
|
||||
notes));
|
||||
_domain = _memoryDomains[domain];
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public abstract partial class Watch
|
||||
{
|
||||
/// <summary>
|
||||
/// This enum specify the size of a <see cref="Watch"/>
|
||||
/// </summary>
|
||||
|
@ -33,5 +31,4 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
Separator = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,33 +10,51 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public sealed class WordWatch : Watch
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private ushort _previous;
|
||||
private ushort _value;
|
||||
|
||||
public WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string notes)
|
||||
{
|
||||
_domain = domain;
|
||||
_address = address;
|
||||
_value = _previous = GetWord();
|
||||
#endregion
|
||||
|
||||
if (AvailableTypes(WatchSize.Word).Contains(type))
|
||||
#region cTor(s)
|
||||
|
||||
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)
|
||||
{
|
||||
_type = type;
|
||||
this._value = value;
|
||||
this._previous = previous;
|
||||
this._changecount = changeCount;
|
||||
}
|
||||
|
||||
_bigEndian = bigEndian;
|
||||
|
||||
if (notes != null)
|
||||
internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note)
|
||||
:this(domain, address, type, bigEndian, note, 0, 0, 0)
|
||||
{
|
||||
Notes = notes;
|
||||
_previous = GetWord();
|
||||
_value = GetWord();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static IEnumerable<DisplayType> ValidTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return DisplayType.Unsigned;
|
||||
yield return DisplayType.Signed;
|
||||
yield return DisplayType.Hex;
|
||||
yield return DisplayType.Binary;
|
||||
yield return DisplayType.FixedPoint_12_4;
|
||||
}
|
||||
}
|
||||
|
||||
public WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, ushort prev, int changeCount, string notes = null)
|
||||
: this(domain, address, type, bigEndian, notes)
|
||||
public override IEnumerable<DisplayType> AvailableTypes()
|
||||
{
|
||||
_previous = prev;
|
||||
_changecount = changeCount;
|
||||
yield return DisplayType.Unsigned;
|
||||
yield return DisplayType.Signed;
|
||||
yield return DisplayType.Hex;
|
||||
yield return DisplayType.Binary;
|
||||
yield return DisplayType.FixedPoint_12_4;
|
||||
}
|
||||
|
||||
public override uint MaxValue
|
||||
|
@ -69,22 +87,6 @@ namespace BizHawk.Client.Common
|
|||
_previous = GetWord();
|
||||
}
|
||||
|
||||
public override WatchSize Size
|
||||
{
|
||||
get { return WatchSize.Word; }
|
||||
}
|
||||
|
||||
public static List<DisplayType> ValidTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<DisplayType>
|
||||
{
|
||||
DisplayType.Unsigned, DisplayType.Signed, DisplayType.Hex, DisplayType.FixedPoint_12_4, DisplayType.Binary
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override string ValueString
|
||||
{
|
||||
get { return FormatValue(GetWord()); }
|
||||
|
|
|
@ -3346,7 +3346,7 @@
|
|||
//
|
||||
// JaboResolutionHeightBox
|
||||
//
|
||||
this.JaboResolutionHeightBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.JaboResolutionHeightBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.JaboResolutionHeightBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.JaboResolutionHeightBox.Location = new System.Drawing.Point(127, 90);
|
||||
this.JaboResolutionHeightBox.MaxLength = 4;
|
||||
|
@ -3355,11 +3355,11 @@
|
|||
this.JaboResolutionHeightBox.Size = new System.Drawing.Size(52, 20);
|
||||
this.JaboResolutionHeightBox.TabIndex = 34;
|
||||
this.JaboResolutionHeightBox.Text = "0";
|
||||
this.JaboResolutionHeightBox.Type = BizHawk.Client.Common.Watch.DisplayType.Signed;
|
||||
this.JaboResolutionHeightBox.Type = BizHawk.Client.Common.DisplayType.Signed;
|
||||
//
|
||||
// JaboResolutionWidthBox
|
||||
//
|
||||
this.JaboResolutionWidthBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.JaboResolutionWidthBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.JaboResolutionWidthBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.JaboResolutionWidthBox.Location = new System.Drawing.Point(127, 60);
|
||||
this.JaboResolutionWidthBox.MaxLength = 4;
|
||||
|
@ -3368,7 +3368,7 @@
|
|||
this.JaboResolutionWidthBox.Size = new System.Drawing.Size(52, 20);
|
||||
this.JaboResolutionWidthBox.TabIndex = 33;
|
||||
this.JaboResolutionWidthBox.Text = "0";
|
||||
this.JaboResolutionWidthBox.Type = BizHawk.Client.Common.Watch.DisplayType.Signed;
|
||||
this.JaboResolutionWidthBox.Type = BizHawk.Client.Common.DisplayType.Signed;
|
||||
//
|
||||
// label71
|
||||
//
|
||||
|
|
|
@ -251,7 +251,7 @@
|
|||
// StopOnFrameTextBox
|
||||
//
|
||||
this.StopOnFrameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.StopOnFrameTextBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.DWord;
|
||||
this.StopOnFrameTextBox.ByteSize = BizHawk.Client.Common.WatchSize.DWord;
|
||||
this.StopOnFrameTextBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.StopOnFrameTextBox.Location = new System.Drawing.Point(438, 355);
|
||||
this.StopOnFrameTextBox.MaxLength = 10;
|
||||
|
@ -259,7 +259,7 @@
|
|||
this.StopOnFrameTextBox.Nullable = true;
|
||||
this.StopOnFrameTextBox.Size = new System.Drawing.Size(54, 20);
|
||||
this.StopOnFrameTextBox.TabIndex = 58;
|
||||
this.StopOnFrameTextBox.Type = BizHawk.Client.Common.Watch.DisplayType.Unsigned;
|
||||
this.StopOnFrameTextBox.Type = BizHawk.Client.Common.DisplayType.Unsigned;
|
||||
this.StopOnFrameTextBox.TextChanged += new System.EventHandler(this.StopOnFrameTextBox_TextChanged_1);
|
||||
//
|
||||
// MovieView
|
||||
|
|
|
@ -231,7 +231,7 @@
|
|||
//
|
||||
// CompareBox
|
||||
//
|
||||
this.CompareBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.CompareBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.CompareBox.Location = new System.Drawing.Point(113, 91);
|
||||
this.CompareBox.MaxLength = 2;
|
||||
|
@ -239,11 +239,11 @@
|
|||
this.CompareBox.Nullable = true;
|
||||
this.CompareBox.Size = new System.Drawing.Size(65, 20);
|
||||
this.CompareBox.TabIndex = 15;
|
||||
this.CompareBox.Type = BizHawk.Client.Common.Watch.DisplayType.Hex;
|
||||
this.CompareBox.Type = BizHawk.Client.Common.DisplayType.Hex;
|
||||
//
|
||||
// ValueBox
|
||||
//
|
||||
this.ValueBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.ValueBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.ValueBox.Location = new System.Drawing.Point(113, 65);
|
||||
this.ValueBox.MaxLength = 2;
|
||||
|
@ -252,7 +252,7 @@
|
|||
this.ValueBox.Size = new System.Drawing.Size(65, 20);
|
||||
this.ValueBox.TabIndex = 12;
|
||||
this.ValueBox.Text = "00";
|
||||
this.ValueBox.Type = BizHawk.Client.Common.Watch.DisplayType.Hex;
|
||||
this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex;
|
||||
//
|
||||
// CheatEdit
|
||||
//
|
||||
|
|
|
@ -3,14 +3,15 @@ using System.Linq;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using Emu = BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class CheatEdit : UserControl
|
||||
{
|
||||
public IMemoryDomains MemoryDomains { get; set; }
|
||||
public Emu.IMemoryDomains MemoryDomains { get; set; }
|
||||
|
||||
public CheatEdit()
|
||||
{
|
||||
|
@ -78,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
ValueHexIndLabel.Text =
|
||||
CompareHexIndLabel.Text =
|
||||
_cheat.Type == Watch.DisplayType.Hex ? HexInd : string.Empty;
|
||||
_cheat.Type == DisplayType.Hex ? HexInd : string.Empty;
|
||||
|
||||
BigEndianCheckBox.Checked = _cheat.BigEndian.Value;
|
||||
|
||||
|
@ -99,7 +100,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void SetFormToDefault()
|
||||
{
|
||||
_loading = true;
|
||||
SetSizeSelected(Watch.WatchSize.Byte);
|
||||
SetSizeSelected(WatchSize.Byte);
|
||||
PopulateTypeDropdown();
|
||||
|
||||
NameBox.Text = string.Empty;
|
||||
|
@ -111,11 +112,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
ValueBox.ByteSize =
|
||||
CompareBox.ByteSize =
|
||||
Watch.WatchSize.Byte;
|
||||
WatchSize.Byte;
|
||||
|
||||
ValueBox.Type =
|
||||
CompareBox.Type =
|
||||
Watch.DisplayType.Hex;
|
||||
DisplayType.Hex;
|
||||
|
||||
ValueBox.ResetText();
|
||||
CompareBox.ResetText();
|
||||
|
@ -126,31 +127,31 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
BigEndianCheckBox.Checked = false;
|
||||
|
||||
SetTypeSelected(Watch.DisplayType.Hex);
|
||||
SetTypeSelected(DisplayType.Hex);
|
||||
|
||||
CheckFormState();
|
||||
CompareBox.Text = string.Empty; // TODO: A needed hack until WatchValueBox.ToRawInt() becomes nullable
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
private void SetSizeSelected(Watch.WatchSize size)
|
||||
private void SetSizeSelected(WatchSize size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
SizeDropDown.SelectedIndex = 0;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
SizeDropDown.SelectedIndex = 1;
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
SizeDropDown.SelectedIndex = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTypeSelected(Watch.DisplayType type)
|
||||
private void SetTypeSelected(Common.DisplayType type)
|
||||
{
|
||||
foreach (var item in DisplayTypeDropDown.Items)
|
||||
{
|
||||
|
@ -162,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SetDomainSelected(MemoryDomain domain)
|
||||
private void SetDomainSelected(Emu.MemoryDomain domain)
|
||||
{
|
||||
foreach (var item in DomainDropDown.Items)
|
||||
{
|
||||
|
@ -181,13 +182,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
default:
|
||||
case 0:
|
||||
DisplayTypeDropDown.Items.AddRange(ByteWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
|
||||
foreach(DisplayType t in ByteWatch.ValidTypes)
|
||||
{
|
||||
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
DisplayTypeDropDown.Items.AddRange(WordWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
|
||||
foreach (DisplayType t in WordWatch.ValidTypes)
|
||||
{
|
||||
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
DisplayTypeDropDown.Items.AddRange(DWordWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
|
||||
foreach (DisplayType t in DWordWatch.ValidTypes)
|
||||
{
|
||||
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -222,17 +232,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private Watch.WatchSize GetCurrentSize()
|
||||
private WatchSize GetCurrentSize()
|
||||
{
|
||||
switch (SizeDropDown.SelectedIndex)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return Watch.WatchSize.Byte;
|
||||
return WatchSize.Byte;
|
||||
case 1:
|
||||
return Watch.WatchSize.Word;
|
||||
return WatchSize.Word;
|
||||
case 2:
|
||||
return Watch.WatchSize.DWord;
|
||||
return WatchSize.DWord;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +305,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()];
|
||||
var address = AddressBox.ToRawInt().Value;
|
||||
//var address = AddressBox.ToRawInt() ?? 0;
|
||||
if (address < domain.Size)
|
||||
{
|
||||
var watch = Watch.GenerateWatch(
|
||||
|
@ -303,8 +312,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
AddressBox.ToRawInt().Value,
|
||||
GetCurrentSize(),
|
||||
Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()),
|
||||
NameBox.Text,
|
||||
BigEndianCheckBox.Checked);
|
||||
BigEndianCheckBox.Checked,
|
||||
NameBox.Text
|
||||
);
|
||||
|
||||
return new Cheat(
|
||||
watch,
|
||||
|
|
|
@ -243,10 +243,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
var watch = Watch.GenerateWatch(
|
||||
MemoryDomains["System Bus"],
|
||||
address,
|
||||
Watch.WatchSize.Byte,
|
||||
Watch.DisplayType.Hex,
|
||||
name,
|
||||
false);
|
||||
WatchSize.Byte,
|
||||
Client.Common.DisplayType.Hex,
|
||||
false,
|
||||
name);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
watch,
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{'E', 14 },
|
||||
{'F', 15 }
|
||||
};
|
||||
private readonly Dictionary<char, int> _GENgameGenieTable = new Dictionary<char, int>
|
||||
private readonly Dictionary<char, long> _GENgameGenieTable = new Dictionary<char, long>
|
||||
{
|
||||
{ 'A', 0 },
|
||||
{ 'B', 1 },
|
||||
|
@ -355,7 +355,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//A Watch needs to be generated so we can make a cheat out of that. This is due to how the Cheat engine works.
|
||||
//System Bus Domain, The Address to Watch, Byte size (Byte), Hex Display, Description. Not Big Endian.
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
if (RAMCompare == null)
|
||||
{
|
||||
|
@ -472,17 +472,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (byteSize == 8)
|
||||
{
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
else if (byteSize == 16)
|
||||
{
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
else if (byteSize == 32)
|
||||
{
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.DWord, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.DWord, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
//Clear old Inputs
|
||||
|
@ -520,7 +520,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
foreach (var t in code)
|
||||
{
|
||||
hexcode <<= 5;
|
||||
int y;
|
||||
long y;
|
||||
_GENgameGenieTable.TryGetValue(t, out y);
|
||||
hexcode |= y;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
address = add.ToString("X6");
|
||||
value = val.ToString("X4");
|
||||
//Game Geneie, modifies the "ROM" which is why it says, "MD CART"
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["MD CART"], long.Parse(address, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, true);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["MD CART"], long.Parse(address, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, true, txtDescription.Text);
|
||||
//Add Cheat
|
||||
Global.CheatList.Add(new Cheat(watch, val));
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//System Bus Domain, The Address to Watch, Byte size (Byte), Hex Display, Description, Big Endian.
|
||||
if (byteSize == 1)
|
||||
{
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["68K RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["68K RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
//Clear old Inputs
|
||||
|
@ -604,7 +604,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
if (byteSize == 2)
|
||||
{
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["68K RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, true);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["68K RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, true, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
//Clear old Inputs
|
||||
|
@ -729,14 +729,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (byteSize == 8)
|
||||
{
|
||||
//We have a Byte sized value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["RDRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, true);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["RDRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, true, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
if (byteSize == 16)
|
||||
{
|
||||
//We have a Word (Double Byte) sized Value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["RDRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, true);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["RDRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, true, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//A Watch needs to be generated so we can make a cheat out of that. This is due to how the Cheat engine works.
|
||||
//System Bus Domain, The Address to Watch, Byte size (Word), Hex Display, Description. Big Endian.
|
||||
//We have a Byte sized value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
if (strCompare == "00")
|
||||
{
|
||||
|
@ -964,14 +964,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (byteSize == 8)
|
||||
{
|
||||
//We have a Byte sized value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
if (byteSize == 16)
|
||||
{
|
||||
//We have a Word (Double Byte) sized Value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
|
@ -1043,14 +1043,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (byteSize == 8)
|
||||
{
|
||||
//We have a Byte sized value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["Work Ram High"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, true);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["Work Ram High"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, true, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
if (byteSize == 16)
|
||||
{
|
||||
//We have a Word (Double Byte) sized Value
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["Work Ram High"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, true);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["Work Ram High"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, true, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//A Watch needs to be generated so we can make a cheat out of that. This is due to how the Cheat engine works.
|
||||
//System Bus Domain, The Address to Watch, Byte size (Byte), Hex Display, Description. Not Big Endian.
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["Main RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["Main RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Byte, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
//Take Watch, Add our Value we want, and it should be active when addded
|
||||
|
||||
if (RAMCompare == null)
|
||||
|
@ -1238,14 +1238,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (byteSize == 16)
|
||||
{
|
||||
//System Bus Domain, The Address to Watch, Byte size (Byte), Hex Display, Description. Not Big Endian.
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
if (byteSize == 8)
|
||||
{
|
||||
//Is this correct?
|
||||
//I don't think so, but Changing it to CARTROM, causes a major issue.
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Word, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(RAMAddress, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, false, txtDescription.Text);
|
||||
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||
}
|
||||
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||
|
|
|
@ -316,10 +316,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
var watch = Watch.GenerateWatch(
|
||||
MemoryDomains["MD CART"],
|
||||
address,
|
||||
Watch.WatchSize.Word,
|
||||
Watch.DisplayType.Hex,
|
||||
name,
|
||||
true
|
||||
WatchSize.Word,
|
||||
Client.Common.DisplayType.Hex,
|
||||
true,
|
||||
name
|
||||
);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
|
|
|
@ -105,11 +105,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private Watch.WatchSize WatchSize
|
||||
private WatchSize WatchSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Watch.WatchSize)DataSize;
|
||||
return (WatchSize)DataSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
AddressLabel.Text = GenerateAddressString();
|
||||
}
|
||||
|
||||
public void SetToAddresses(IEnumerable<long> addresses, MemoryDomain domain, Watch.WatchSize size)
|
||||
public void SetToAddresses(IEnumerable<long> addresses, MemoryDomain domain, WatchSize size)
|
||||
{
|
||||
DataSize = (int)size;
|
||||
SetDataSize(DataSize);
|
||||
|
@ -546,7 +546,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.CheatList.IsActive(_domain, address))
|
||||
{
|
||||
return Global.CheatList.GetCheatValue(_domain, address, (Watch.WatchSize)DataSize ).Value;
|
||||
return Global.CheatList.GetCheatValue(_domain, address, (WatchSize)DataSize ).Value;
|
||||
}
|
||||
|
||||
switch (dataSize)
|
||||
|
@ -723,11 +723,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
default:
|
||||
case 1:
|
||||
return new ByteWatch(_domain, address, Watch.DisplayType.Hex, BigEndian, string.Empty);
|
||||
return Watch.GenerateWatch(_domain, address, WatchSize.Byte, Client.Common.DisplayType.Hex, BigEndian, string.Empty);
|
||||
case 2:
|
||||
return new WordWatch(_domain, address, Watch.DisplayType.Hex, BigEndian, string.Empty);
|
||||
return Watch.GenerateWatch(_domain, address, WatchSize.Word, Client.Common.DisplayType.Hex, BigEndian, string.Empty);
|
||||
case 4:
|
||||
return new DWordWatch(_domain, address, Watch.DisplayType.Hex, BigEndian, string.Empty);
|
||||
return Watch.GenerateWatch(_domain, address, WatchSize.DWord, Client.Common.DisplayType.Hex, BigEndian, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -757,8 +757,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_domain,
|
||||
address,
|
||||
WatchSize,
|
||||
Watch.DisplayType.Hex,
|
||||
string.Empty,
|
||||
Client.Common.DisplayType.Hex,
|
||||
BigEndian);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
|
@ -776,8 +775,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_domain,
|
||||
address,
|
||||
WatchSize,
|
||||
Watch.DisplayType.Hex,
|
||||
string.Empty,
|
||||
Client.Common.DisplayType.Hex,
|
||||
BigEndian);
|
||||
|
||||
cheats.Add(new Cheat(
|
||||
|
@ -1616,9 +1614,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
address => Watch.GenerateWatch(
|
||||
_domain,
|
||||
address,
|
||||
(Watch.WatchSize)DataSize,
|
||||
Watch.DisplayType.Hex,
|
||||
string.Empty,
|
||||
(WatchSize)DataSize,
|
||||
Client.Common.DisplayType.Hex,
|
||||
BigEndian));
|
||||
|
||||
poke.SetWatch(watches);
|
||||
|
@ -2109,7 +2106,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var gaps = (int)cheat.Size - (int)DataSize;
|
||||
|
||||
if (cheat.Size == Watch.WatchSize.DWord && DataSize == 2)
|
||||
if (cheat.Size == WatchSize.DWord && DataSize == 2)
|
||||
{
|
||||
gaps -= 1;
|
||||
}
|
||||
|
|
|
@ -183,10 +183,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
var watch = Watch.GenerateWatch(
|
||||
MemoryDomains["System Bus"],
|
||||
AddressBox.ToRawInt().Value,
|
||||
Watch.WatchSize.Byte,
|
||||
Watch.DisplayType.Hex,
|
||||
GameGenieCode.Text,
|
||||
false);
|
||||
WatchSize.Byte,
|
||||
Client.Common.DisplayType.Hex,
|
||||
false,
|
||||
GameGenieCode.Text);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
watch,
|
||||
|
|
|
@ -213,10 +213,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
var watch = Watch.GenerateWatch(
|
||||
MemoryDomains["System Bus"],
|
||||
address,
|
||||
Watch.WatchSize.Byte,
|
||||
Watch.DisplayType.Hex,
|
||||
name,
|
||||
bigEndian: false
|
||||
WatchSize.Byte,
|
||||
Client.Common.DisplayType.Hex,
|
||||
false,
|
||||
name
|
||||
);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
//
|
||||
// NumFramesBox
|
||||
//
|
||||
this.NumFramesBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.NumFramesBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.NumFramesBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.NumFramesBox.Location = new System.Drawing.Point(138, 16);
|
||||
this.NumFramesBox.MaxLength = 5;
|
||||
|
@ -77,7 +77,7 @@
|
|||
this.NumFramesBox.Size = new System.Drawing.Size(51, 20);
|
||||
this.NumFramesBox.TabIndex = 3;
|
||||
this.NumFramesBox.Text = "1";
|
||||
this.NumFramesBox.Type = BizHawk.Client.Common.Watch.DisplayType.Unsigned;
|
||||
this.NumFramesBox.Type = BizHawk.Client.Common.DisplayType.Unsigned;
|
||||
//
|
||||
// FramesPrompt
|
||||
//
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public static void ViewInHexEditor(MemoryDomain domain, IEnumerable<long> addresses, Watch.WatchSize size)
|
||||
public static void ViewInHexEditor(MemoryDomain domain, IEnumerable<long> addresses, WatchSize size)
|
||||
{
|
||||
GlobalWin.Tools.Load<HexEditor>();
|
||||
GlobalWin.Tools.HexEditor.SetToAddresses(addresses, domain, size);
|
||||
|
|
|
@ -583,7 +583,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
MessageBox.Show("It seems that the object CustomMainForm does not have a public default constructor. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
catch (TypeLoadException ex)
|
||||
catch (TypeLoadException)
|
||||
{
|
||||
MessageBox.Show("It seems that the object CustomMainForm does not exists. Please review the code.", "No, no, no. Wrong Way !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
//
|
||||
// ValueBox
|
||||
//
|
||||
this.ValueBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.ValueBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.ValueBox.Location = new System.Drawing.Point(82, 57);
|
||||
this.ValueBox.MaxLength = 2;
|
||||
|
@ -108,7 +108,7 @@
|
|||
this.ValueBox.Size = new System.Drawing.Size(116, 20);
|
||||
this.ValueBox.TabIndex = 10;
|
||||
this.ValueBox.Text = "00";
|
||||
this.ValueBox.Type = BizHawk.Client.Common.Watch.DisplayType.Hex;
|
||||
this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex;
|
||||
//
|
||||
// ValueHexLabel
|
||||
//
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
ValueBox.ByteSize = _watchList[0].Size;
|
||||
ValueBox.Type = _watchList[0].Type;
|
||||
|
||||
ValueHexLabel.Text = _watchList[0].Type == Watch.DisplayType.Hex ? "0x" : string.Empty;
|
||||
ValueHexLabel.Text = _watchList[0].Type == DisplayType.Hex ? "0x" : string.Empty;
|
||||
ValueBox.Text = _watchList[0].ValueString.Replace(" ", string.Empty);
|
||||
DomainLabel.Text = _watchList[0].Domain.Name;
|
||||
SizeLabel.Text = _watchList[0].Size.ToString();
|
||||
|
|
|
@ -957,7 +957,7 @@
|
|||
//
|
||||
this.SpecificValueBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SpecificValueBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.Byte;
|
||||
this.SpecificValueBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
|
||||
this.SpecificValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.SpecificValueBox.Enabled = false;
|
||||
this.SpecificValueBox.Location = new System.Drawing.Point(114, 38);
|
||||
|
@ -967,7 +967,7 @@
|
|||
this.SpecificValueBox.Size = new System.Drawing.Size(72, 20);
|
||||
this.SpecificValueBox.TabIndex = 15;
|
||||
this.SpecificValueBox.Text = "00";
|
||||
this.SpecificValueBox.Type = BizHawk.Client.Common.Watch.DisplayType.Hex;
|
||||
this.SpecificValueBox.Type = BizHawk.Client.Common.DisplayType.Hex;
|
||||
this.SpecificValueBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged);
|
||||
//
|
||||
// NumberOfChangesRadio
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
private void HardSetDisplayTypeDropDown(Watch.DisplayType type)
|
||||
private void HardSetDisplayTypeDropDown(BizHawk.Client.Common.DisplayType type)
|
||||
{
|
||||
foreach (var item in DisplayTypeDropdown.Items)
|
||||
{
|
||||
|
@ -97,17 +97,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void HardSetSizeDropDown(Watch.WatchSize size)
|
||||
private void HardSetSizeDropDown(WatchSize size)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
SizeDropdown.SelectedIndex = 0;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
SizeDropdown.SelectedIndex = 1;
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
SizeDropdown.SelectedIndex = 2;
|
||||
break;
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void DoDisplayTypeClick(Watch.DisplayType type)
|
||||
private void DoDisplayTypeClick(BizHawk.Client.Common.DisplayType type)
|
||||
{
|
||||
if (_settings.Type != type)
|
||||
{
|
||||
|
@ -668,15 +668,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
WatchListView.Refresh();
|
||||
}
|
||||
|
||||
private void SetPreviousStype(Watch.PreviousType type)
|
||||
private void SetPreviousStype(PreviousType type)
|
||||
{
|
||||
_settings.PreviousType = type;
|
||||
_searches.SetPreviousType(type);
|
||||
}
|
||||
|
||||
private void SetSize(Watch.WatchSize size)
|
||||
private void SetSize(WatchSize size)
|
||||
{
|
||||
SpecificValueBox.ByteSize = _settings.Size = size;
|
||||
_settings.Size = size;
|
||||
SpecificValueBox.ByteSize = size;
|
||||
if (!string.IsNullOrEmpty(SpecificAddressBox.Text))
|
||||
{
|
||||
SpecificAddressBox.Text = "0";
|
||||
|
@ -687,29 +688,37 @@ namespace BizHawk.Client.EmuHawk
|
|||
SpecificValueBox.Text = "0";
|
||||
}
|
||||
|
||||
if (!Watch.AvailableTypes(size).Contains(_settings.Type))
|
||||
{
|
||||
_settings.Type = Watch.AvailableTypes(size)[0];
|
||||
}
|
||||
|
||||
_dropdownDontfire = true;
|
||||
bool isTypeCompatible = false;
|
||||
switch (size)
|
||||
{
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
isTypeCompatible = ByteWatch.ValidTypes.Where(t => t == _settings.Type).Any();
|
||||
SizeDropdown.SelectedIndex = 0;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
|
||||
case WatchSize.Word:
|
||||
isTypeCompatible = WordWatch.ValidTypes.Where(t => t == _settings.Type).Any();
|
||||
SizeDropdown.SelectedIndex = 1;
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
|
||||
case WatchSize.DWord:
|
||||
isTypeCompatible = DWordWatch.ValidTypes.Where(t => t == _settings.Type).Any();
|
||||
SizeDropdown.SelectedIndex = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isTypeCompatible)
|
||||
{
|
||||
_settings.Type = Client.Common.DisplayType.Unsigned;
|
||||
}
|
||||
|
||||
_dropdownDontfire = true;
|
||||
|
||||
PopulateTypeDropDown();
|
||||
_dropdownDontfire = false;
|
||||
SpecificValueBox.Type = _settings.Type;
|
||||
SetReboot(true);
|
||||
NewSearch();
|
||||
}
|
||||
|
||||
private void PopulateTypeDropDown()
|
||||
|
@ -718,7 +727,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
var next = string.Empty;
|
||||
|
||||
DisplayTypeDropdown.Items.Clear();
|
||||
var types = Watch.AvailableTypes(_settings.Size);
|
||||
|
||||
IEnumerable<Client.Common.DisplayType> types = null;
|
||||
switch (_settings.Size)
|
||||
{
|
||||
case WatchSize.Byte:
|
||||
types = ByteWatch.ValidTypes;
|
||||
break;
|
||||
|
||||
case WatchSize.Word:
|
||||
types = WordWatch.ValidTypes;
|
||||
break;
|
||||
|
||||
case WatchSize.DWord:
|
||||
types = DWordWatch.ValidTypes;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var typeStr = Watch.DisplayTypeToString(type);
|
||||
|
@ -780,9 +805,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings.Mode = RamSearchEngine.Settings.SearchMode.Fast;
|
||||
|
||||
if (_settings.PreviousType == Watch.PreviousType.LastFrame || _settings.PreviousType == Watch.PreviousType.LastChange)
|
||||
if (_settings.PreviousType == PreviousType.LastFrame || _settings.PreviousType == PreviousType.LastChange)
|
||||
{
|
||||
SetPreviousStype(Watch.PreviousType.LastSearch);
|
||||
SetPreviousStype(PreviousType.LastSearch);
|
||||
}
|
||||
|
||||
NumberOfChangesRadio.Enabled = false;
|
||||
|
@ -1077,16 +1102,32 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SizeSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
ByteMenuItem.Checked = _settings.Size == Watch.WatchSize.Byte;
|
||||
WordMenuItem.Checked = _settings.Size == Watch.WatchSize.Word;
|
||||
DWordMenuItem.Checked = _settings.Size == Watch.WatchSize.DWord;
|
||||
ByteMenuItem.Checked = _settings.Size == WatchSize.Byte;
|
||||
WordMenuItem.Checked = _settings.Size == WatchSize.Word;
|
||||
DWordMenuItem.Checked = _settings.Size == WatchSize.DWord;
|
||||
}
|
||||
|
||||
private void DisplayTypeSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
DisplayTypeSubMenu.DropDownItems.Clear();
|
||||
|
||||
foreach (var type in Watch.AvailableTypes(_settings.Size))
|
||||
IEnumerable<Client.Common.DisplayType> types = null;
|
||||
switch (_settings.Size)
|
||||
{
|
||||
case WatchSize.Byte:
|
||||
types = ByteWatch.ValidTypes;
|
||||
break;
|
||||
|
||||
case WatchSize.Word:
|
||||
types = WordWatch.ValidTypes;
|
||||
break;
|
||||
|
||||
case WatchSize.DWord:
|
||||
types = DWordWatch.ValidTypes;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var item = new ToolStripMenuItem
|
||||
{
|
||||
|
@ -1111,16 +1152,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (_settings.PreviousType)
|
||||
{
|
||||
default:
|
||||
case Watch.PreviousType.LastSearch:
|
||||
case PreviousType.LastSearch:
|
||||
Previous_LastSearchMenuItem.Checked = true;
|
||||
break;
|
||||
case Watch.PreviousType.LastFrame:
|
||||
case PreviousType.LastFrame:
|
||||
PreviousFrameMenuItem.Checked = true;
|
||||
break;
|
||||
case Watch.PreviousType.Original:
|
||||
case PreviousType.Original:
|
||||
Previous_OriginalMenuItem.Checked = true;
|
||||
break;
|
||||
case Watch.PreviousType.LastChange:
|
||||
case PreviousType.LastChange:
|
||||
Previous_LastChangeMenuItem.Checked = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1141,17 +1182,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ByteMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetSize(Watch.WatchSize.Byte);
|
||||
SetSize(WatchSize.Byte);
|
||||
}
|
||||
|
||||
private void WordMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetSize(Watch.WatchSize.Word);
|
||||
SetSize(WatchSize.Word);
|
||||
}
|
||||
|
||||
private void DWordMenuItem_Click_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetSize(Watch.WatchSize.DWord);
|
||||
SetSize(WatchSize.DWord);
|
||||
}
|
||||
|
||||
private void CheckMisalignedMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1162,22 +1203,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void Previous_LastFrameMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetPreviousStype(Watch.PreviousType.LastFrame);
|
||||
SetPreviousStype(PreviousType.LastFrame);
|
||||
}
|
||||
|
||||
private void Previous_LastSearchMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetPreviousStype(Watch.PreviousType.LastSearch);
|
||||
SetPreviousStype(PreviousType.LastSearch);
|
||||
}
|
||||
|
||||
private void Previous_OriginalMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetPreviousStype(Watch.PreviousType.Original);
|
||||
SetPreviousStype(PreviousType.Original);
|
||||
}
|
||||
|
||||
private void Previous_LastChangeMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetPreviousStype(Watch.PreviousType.LastChange);
|
||||
SetPreviousStype(PreviousType.LastChange);
|
||||
}
|
||||
|
||||
private void BigEndianMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1459,7 +1500,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
WatchListView.Refresh();
|
||||
}
|
||||
|
||||
private Watch.WatchSize SelectedSize
|
||||
private WatchSize SelectedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -1467,11 +1508,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
default:
|
||||
case 0:
|
||||
return Watch.WatchSize.Byte;
|
||||
return WatchSize.Byte;
|
||||
case 1:
|
||||
return Watch.WatchSize.Word;
|
||||
return WatchSize.Word;
|
||||
case 2:
|
||||
return Watch.WatchSize.DWord;
|
||||
return WatchSize.DWord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var sb = new StringBuilder();
|
||||
foreach (var watch in SelectedItems)
|
||||
{
|
||||
sb.AppendLine(watch.ToString());
|
||||
sb.AppendLine(ToString());
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
|
@ -925,24 +925,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void DefinePreviousValueSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
PreviousFrameMenuItem.Checked = Global.Config.RamWatchDefinePrevious == Watch.PreviousType.LastFrame;
|
||||
LastChangeMenuItem.Checked = Global.Config.RamWatchDefinePrevious == Watch.PreviousType.LastChange;
|
||||
OriginalMenuItem.Checked = Global.Config.RamWatchDefinePrevious == Watch.PreviousType.Original;
|
||||
PreviousFrameMenuItem.Checked = Global.Config.RamWatchDefinePrevious == PreviousType.LastFrame;
|
||||
LastChangeMenuItem.Checked = Global.Config.RamWatchDefinePrevious == PreviousType.LastChange;
|
||||
OriginalMenuItem.Checked = Global.Config.RamWatchDefinePrevious == PreviousType.Original;
|
||||
}
|
||||
|
||||
private void PreviousFrameMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.RamWatchDefinePrevious = Watch.PreviousType.LastFrame;
|
||||
Global.Config.RamWatchDefinePrevious = PreviousType.LastFrame;
|
||||
}
|
||||
|
||||
private void LastChangeMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.RamWatchDefinePrevious = Watch.PreviousType.LastChange;
|
||||
Global.Config.RamWatchDefinePrevious = PreviousType.LastChange;
|
||||
}
|
||||
|
||||
private void OriginalMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.RamWatchDefinePrevious = Watch.PreviousType.Original;
|
||||
Global.Config.RamWatchDefinePrevious = PreviousType.Original;
|
||||
}
|
||||
|
||||
private void WatchesOnScreenMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using Emu = BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private readonly List<Watch> _watchList = new List<Watch>();
|
||||
|
||||
public IMemoryDomains MemoryDomains { get; set; }
|
||||
public Emu.IMemoryDomains MemoryDomains { get; set; }
|
||||
|
||||
private Mode _mode = Mode.New;
|
||||
private bool _loading = true;
|
||||
|
@ -64,13 +64,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
case Mode.Edit:
|
||||
switch (_watchList[0].Size)
|
||||
{
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
SizeDropDown.SelectedItem = SizeDropDown.Items[0];
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
SizeDropDown.SelectedItem = SizeDropDown.Items[1];
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
SizeDropDown.SelectedItem = SizeDropDown.Items[2];
|
||||
break;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void SetWatch(MemoryDomain domain, IEnumerable<Watch> watches = null, Mode mode = Mode.New)
|
||||
public void SetWatch(Emu.MemoryDomain domain, IEnumerable<Watch> watches = null, Mode mode = Mode.New)
|
||||
{
|
||||
if (watches != null)
|
||||
{
|
||||
|
@ -160,13 +160,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
default:
|
||||
case 0:
|
||||
DisplayTypeDropDown.Items.AddRange(ByteWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
|
||||
foreach(DisplayType t in ByteWatch.ValidTypes)
|
||||
{
|
||||
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
DisplayTypeDropDown.Items.AddRange(WordWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
|
||||
foreach (DisplayType t in WordWatch.ValidTypes)
|
||||
{
|
||||
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
DisplayTypeDropDown.Items.AddRange(DWordWatch.ValidTypes.ConvertAll(e => Watch.DisplayTypeToString(e)).ToArray());
|
||||
foreach (DisplayType t in DWordWatch.ValidTypes)
|
||||
{
|
||||
DisplayTypeDropDown.Items.Add(Watch.DisplayTypeToString(t));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -209,7 +218,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
var domain = MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ??
|
||||
MemoryDomains.MainMemory;
|
||||
BigEndianCheckBox.Checked = domain.EndianType == MemoryDomain.Endian.Big;
|
||||
BigEndianCheckBox.Checked = domain.EndianType == Emu.MemoryDomain.Endian.Big;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
@ -236,13 +245,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (SizeDropDown.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
_watchList.Add(new ByteWatch(domain, address, type, bigendian, notes));
|
||||
_watchList.Add(Watch.GenerateWatch(domain, address, WatchSize.Byte, type, bigendian, notes));
|
||||
break;
|
||||
case 1:
|
||||
_watchList.Add(new WordWatch(domain, address, type, bigendian, notes));
|
||||
_watchList.Add(Watch.GenerateWatch(domain, address, WatchSize.Word, type, bigendian, notes));
|
||||
break;
|
||||
case 2:
|
||||
_watchList.Add(new DWordWatch(domain, address, type, bigendian, notes));
|
||||
_watchList.Add(Watch.GenerateWatch(domain, address, WatchSize.DWord, type, bigendian, notes));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -261,8 +270,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
watch.Address ?? 0,
|
||||
watch.Size,
|
||||
watch.Type,
|
||||
watch.Notes,
|
||||
watch.BigEndian));
|
||||
watch.BigEndian,
|
||||
watch.Notes));
|
||||
}
|
||||
|
||||
DoEdit();
|
||||
|
@ -283,17 +292,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
for (var i = 0; i < _watchList.Count; i++)
|
||||
{
|
||||
var size = Watch.WatchSize.Byte;
|
||||
var size = WatchSize.Byte;
|
||||
switch (SizeDropDown.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
size = Watch.WatchSize.Byte;
|
||||
size = WatchSize.Byte;
|
||||
break;
|
||||
case 1:
|
||||
size = Watch.WatchSize.Word;
|
||||
size = WatchSize.Word;
|
||||
break;
|
||||
case 2:
|
||||
size = Watch.WatchSize.DWord;
|
||||
size = WatchSize.DWord;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -302,8 +311,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
_watchList.Count == 1 ? AddressBox.ToRawInt() ?? 0 : _watchList[i].Address ?? 0,
|
||||
size,
|
||||
_watchList[i].Type,
|
||||
_watchList[i].Notes,
|
||||
_watchList[i].BigEndian
|
||||
_watchList[i].BigEndian,
|
||||
_watchList[i].Notes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,14 @@ using System.Windows.Forms;
|
|||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Client.Common;
|
||||
using System.Linq;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class WatchValueBox : TextBox, INumberBox
|
||||
{
|
||||
private Watch.WatchSize _size = Watch.WatchSize.Byte;
|
||||
private Watch.DisplayType _type = Watch.DisplayType.Hex;
|
||||
private WatchSize _size = WatchSize.Byte;
|
||||
private DisplayType _type = DisplayType.Hex;
|
||||
private bool _nullable = true;
|
||||
|
||||
public WatchValueBox()
|
||||
|
@ -21,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public bool Nullable { get { return _nullable; } set { _nullable = value; } }
|
||||
|
||||
public Watch.WatchSize ByteSize
|
||||
public WatchSize ByteSize
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -36,9 +37,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (changed)
|
||||
{
|
||||
SetMaxLength();
|
||||
if (!Watch.AvailableTypes(value).Contains(_type))
|
||||
|
||||
bool isTypeCompatible = false;
|
||||
switch (value)
|
||||
{
|
||||
Type = Watch.AvailableTypes(value)[0];
|
||||
case WatchSize.Byte:
|
||||
isTypeCompatible = ByteWatch.ValidTypes.Where(t => t == _type).Any();
|
||||
break;
|
||||
|
||||
case WatchSize.Word:
|
||||
isTypeCompatible = WordWatch.ValidTypes.Where(t => t == _type).Any();
|
||||
break;
|
||||
|
||||
case WatchSize.DWord:
|
||||
isTypeCompatible = DWordWatch.ValidTypes.Where(t => t == _type).Any();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isTypeCompatible)
|
||||
{
|
||||
_type = DisplayType.Unsigned;
|
||||
}
|
||||
|
||||
ResetText();
|
||||
|
@ -46,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public Watch.DisplayType Type
|
||||
public DisplayType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -69,11 +87,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (ByteSize)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return byte.MaxValue;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return ushort.MaxValue;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return uint.MaxValue;
|
||||
}
|
||||
}
|
||||
|
@ -86,11 +104,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (ByteSize)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return sbyte.MaxValue;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return short.MaxValue;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return int.MaxValue;
|
||||
}
|
||||
}
|
||||
|
@ -103,11 +121,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (ByteSize)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
return sbyte.MinValue;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
return short.MinValue;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
return int.MinValue;
|
||||
}
|
||||
}
|
||||
|
@ -154,20 +172,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (Type)
|
||||
{
|
||||
default:
|
||||
case Watch.DisplayType.Signed:
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Signed:
|
||||
case DisplayType.Unsigned:
|
||||
Text = "0";
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
Text = 0.ToHexString(MaxLength);
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.Float:
|
||||
Text = "0.0";
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
Text = "0".PadLeft(((int)_size) * 8);
|
||||
break;
|
||||
}
|
||||
|
@ -181,75 +199,75 @@ namespace BizHawk.Client.EmuHawk
|
|||
default:
|
||||
MaxLength = 8;
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
switch (_size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
MaxLength = 8;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
MaxLength = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
switch (_size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
MaxLength = 2;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
MaxLength = 4;
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
MaxLength = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
switch (_size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
MaxLength = 4;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
MaxLength = 6;
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
MaxLength = 11;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
switch (_size)
|
||||
{
|
||||
default:
|
||||
case Watch.WatchSize.Byte:
|
||||
case WatchSize.Byte:
|
||||
MaxLength = 3;
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
case WatchSize.Word:
|
||||
MaxLength = 5;
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
case WatchSize.DWord:
|
||||
MaxLength = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
MaxLength = 9;
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
MaxLength = 21;
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
MaxLength = 64;
|
||||
break;
|
||||
}
|
||||
|
@ -282,44 +300,44 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (_type)
|
||||
{
|
||||
default:
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
if (!e.KeyChar.IsBinary())
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
if (!e.KeyChar.IsFixedPoint())
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
if (!e.KeyChar.IsFloat())
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
if (!e.KeyChar.IsHex())
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
if (!e.KeyChar.IsSigned())
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
if (!e.KeyChar.IsUnsigned())
|
||||
{
|
||||
e.Handled = true;
|
||||
|
@ -337,7 +355,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (_type)
|
||||
{
|
||||
default:
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
int? val = ToRawInt() ?? 0;
|
||||
if (val == MaxSignedInt)
|
||||
{
|
||||
|
@ -350,7 +368,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
var uval = (uint)(ToRawInt() ?? 0);
|
||||
if (uval == MaxUnsignedInt)
|
||||
{
|
||||
|
@ -363,7 +381,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = uval.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
var bval = (uint)(ToRawInt() ?? 0);
|
||||
if (bval == MaxUnsignedInt)
|
||||
{
|
||||
|
@ -377,7 +395,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var numBits = ((int)ByteSize) * 8;
|
||||
Text = Convert.ToString(bval, 2).PadLeft(numBits, '0');
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
var hexVal = (uint)(ToRawInt() ?? 0);
|
||||
if (hexVal == MaxUnsignedInt)
|
||||
{
|
||||
|
@ -390,7 +408,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = hexVal.ToHexString(MaxLength);
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
var f12val = double.Parse(text);
|
||||
if (f12val > Max12_4 - _12_4_Unit)
|
||||
{
|
||||
|
@ -403,7 +421,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = f12val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
var f24val = double.Parse(text);
|
||||
if (f24val >= Max20_12 - _20_12_Unit)
|
||||
{
|
||||
|
@ -416,7 +434,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = f24val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
var f16val = double.Parse(text);
|
||||
if (f16val >= Max16_16 - _16_16_Unit)
|
||||
{
|
||||
|
@ -429,7 +447,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = f16val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
var dval = double.Parse(text);
|
||||
if (dval > double.MaxValue - 1)
|
||||
{
|
||||
|
@ -449,7 +467,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (_type)
|
||||
{
|
||||
default:
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
var val = ToRawInt();
|
||||
if (!val.HasValue)
|
||||
{
|
||||
|
@ -466,7 +484,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
var uval = (uint)(ToRawInt() ?? 0);
|
||||
if (uval == 0)
|
||||
{
|
||||
|
@ -479,7 +497,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = uval.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
var bval = (uint)(ToRawInt() ?? 0);
|
||||
if (bval == 0)
|
||||
{
|
||||
|
@ -493,7 +511,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var numBits = ((int)ByteSize) * 8;
|
||||
Text = Convert.ToString(bval, 2).PadLeft(numBits, '0');
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
var hexVal = (uint)(ToRawInt() ?? 0);
|
||||
if (hexVal == 0)
|
||||
{
|
||||
|
@ -506,7 +524,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = hexVal.ToHexString(MaxLength);
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
var f12val = double.Parse(text);
|
||||
if (f12val < 0 + _12_4_Unit)
|
||||
{
|
||||
|
@ -519,7 +537,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = f12val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
var f24val = double.Parse(text);
|
||||
if (f24val < 0 + _20_12_Unit)
|
||||
{
|
||||
|
@ -532,7 +550,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = f24val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
var f16val = double.Parse(text);
|
||||
if (f16val < 0 + _16_16_Unit)
|
||||
{
|
||||
|
@ -545,7 +563,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Text = f16val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
var dval = double.Parse(text);
|
||||
if (dval > double.MaxValue - 1)
|
||||
{
|
||||
|
@ -575,24 +593,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
switch (_type)
|
||||
{
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
Text = Text.OnlySigned();
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
Text = Text.OnlyUnsigned();
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
Text = Text.OnlyBinary();
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
Text = Text.OnlyHex();
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
Text = Text.OnlyFixedPoint();
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
Text = Text.OnlyFloat();
|
||||
break;
|
||||
}
|
||||
|
@ -614,7 +632,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
switch (_type)
|
||||
{
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
if (Text.IsSigned())
|
||||
{
|
||||
if (Text == "-")
|
||||
|
@ -623,49 +641,49 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
if (Text.IsUnsigned())
|
||||
{
|
||||
return (int)uint.Parse(Text);
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
if (Text.IsBinary())
|
||||
{
|
||||
return Convert.ToInt32(Text, 2);
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
if (Text.IsHex())
|
||||
{
|
||||
return int.Parse(Text, NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
if (Text.IsFixedPoint())
|
||||
{
|
||||
return (int)(double.Parse(Text) * 16.0);
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
if (Text.IsFixedPoint())
|
||||
{
|
||||
return (int)(double.Parse(Text) * 4096.0);
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
if (Text.IsFixedPoint())
|
||||
{
|
||||
return (int)(double.Parse(Text) * 65536.0);
|
||||
}
|
||||
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
if (Text.IsFloat())
|
||||
{
|
||||
float val = float.Parse(Text);
|
||||
|
@ -686,31 +704,31 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (_type)
|
||||
{
|
||||
default:
|
||||
case Watch.DisplayType.Signed:
|
||||
case DisplayType.Signed:
|
||||
Text = val.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Unsigned:
|
||||
case DisplayType.Unsigned:
|
||||
var uval = (uint)val.Value;
|
||||
Text = uval.ToString();
|
||||
break;
|
||||
case Watch.DisplayType.Binary:
|
||||
case DisplayType.Binary:
|
||||
var bval = (uint)val.Value;
|
||||
var numBits = ((int)ByteSize) * 8;
|
||||
Text = Convert.ToString(bval, 2).PadLeft(numBits, '0');
|
||||
break;
|
||||
case Watch.DisplayType.Hex:
|
||||
case DisplayType.Hex:
|
||||
Text = val.Value.ToHexString(MaxLength);
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_12_4:
|
||||
case DisplayType.FixedPoint_12_4:
|
||||
Text = string.Format("{0:F5}", val.Value / 16.0);
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_20_12:
|
||||
case DisplayType.FixedPoint_20_12:
|
||||
Text = string.Format("{0:F5}", val.Value / 4096.0);
|
||||
break;
|
||||
case Watch.DisplayType.FixedPoint_16_16:
|
||||
case DisplayType.FixedPoint_16_16:
|
||||
Text = string.Format("{0:F5}", val.Value / 65536.0);
|
||||
break;
|
||||
case Watch.DisplayType.Float:
|
||||
case DisplayType.Float:
|
||||
var bytes = BitConverter.GetBytes(val.Value);
|
||||
float _float = BitConverter.ToSingle(bytes, 0);
|
||||
Text = string.Format("{0:F6}", _float);
|
||||
|
|
|
@ -375,7 +375,6 @@ namespace BizHawk.Client.MultiHawk
|
|||
|
||||
int[] videoBuffer = videoProvider.GetVideoBuffer();
|
||||
|
||||
TESTEROO:
|
||||
int bufferWidth = videoProvider.BufferWidth;
|
||||
int bufferHeight = videoProvider.BufferHeight;
|
||||
bool isGlTextureId = videoBuffer.Length == 1;
|
||||
|
|
|
@ -251,7 +251,7 @@
|
|||
// StopOnFrameTextBox
|
||||
//
|
||||
this.StopOnFrameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.StopOnFrameTextBox.ByteSize = BizHawk.Client.Common.Watch.WatchSize.DWord;
|
||||
this.StopOnFrameTextBox.ByteSize = BizHawk.Client.Common.WatchSize.DWord;
|
||||
this.StopOnFrameTextBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.StopOnFrameTextBox.Location = new System.Drawing.Point(438, 355);
|
||||
this.StopOnFrameTextBox.MaxLength = 10;
|
||||
|
@ -259,7 +259,7 @@
|
|||
this.StopOnFrameTextBox.Nullable = true;
|
||||
this.StopOnFrameTextBox.Size = new System.Drawing.Size(54, 20);
|
||||
this.StopOnFrameTextBox.TabIndex = 58;
|
||||
this.StopOnFrameTextBox.Type = BizHawk.Client.Common.Watch.DisplayType.Unsigned;
|
||||
this.StopOnFrameTextBox.Type = BizHawk.Client.Common.DisplayType.Unsigned;
|
||||
this.StopOnFrameTextBox.TextChanged += new System.EventHandler(this.StopOnFrameTextBox_TextChanged_1);
|
||||
//
|
||||
// MovieView
|
||||
|
|
|
@ -252,8 +252,8 @@ Global
|
|||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Debug|x86.Build.0 = Debug|x86
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8E2F11F2-3955-4382-8C3A-CEBA1276CAEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
|
|
Loading…
Reference in New Issue