Avoid round-trip via string in `Cheat.Pulse`

This commit is contained in:
YoshiRulz 2025-03-29 08:47:17 +10:00
parent 943090681b
commit 09903d53c0
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 20 additions and 13 deletions

View File

@ -167,17 +167,24 @@ namespace BizHawk.Client.Common
{
if (ShouldPoke())
{
switch (_watch.Size)
try
{
case WatchSize.Byte:
_watch.Poke(((ByteWatch)_watch).FormatValue((byte)_val));
break;
case WatchSize.Word:
_watch.Poke(((WordWatch)_watch).FormatValue((ushort)_val));
break;
case WatchSize.DWord:
_watch.Poke(((DWordWatch)_watch).FormatValue((uint)_val));
break;
switch (_watch.Size)
{
case WatchSize.Byte:
_watch.PokeByte(unchecked((byte) _val));
break;
case WatchSize.Word:
_watch.PokeWord(unchecked((ushort) _val));
break;
case WatchSize.DWord:
_watch.PokeDWord(unchecked((uint) _val));
break;
}
}
catch
{
// ignore (matches `*Watch.Poke` implementations)
}
}

View File

@ -285,7 +285,7 @@ namespace BizHawk.Client.Common
: 0;
}
protected void PokeByte(byte val)
protected internal void PokeByte(byte val)
{
if (IsValid)
{
@ -293,7 +293,7 @@ namespace BizHawk.Client.Common
}
}
protected void PokeWord(ushort val)
protected internal void PokeWord(ushort val)
{
if (IsValid)
{
@ -301,7 +301,7 @@ namespace BizHawk.Client.Common
}
}
protected void PokeDWord(uint val)
protected internal void PokeDWord(uint val)
{
if (IsValid)
{