random code cleanup
This commit is contained in:
parent
85d6002673
commit
76a30e5d71
|
@ -885,10 +885,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
snes9X.PutSettings(s);
|
||||
AddOnScreenMessage($"Sprite {layer} Layer {(result ? "On" : "Off")}");
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4650,7 +4650,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (_singleInstanceServer.IsMessageComplete) break;
|
||||
}
|
||||
|
||||
var payloadString = System.Text.Encoding.ASCII.GetString(payloadBytes.GetBuffer(), 0, (int)payloadBytes.Length);
|
||||
var payloadString = Encoding.ASCII.GetString(payloadBytes.GetBuffer(), 0, (int)payloadBytes.Length);
|
||||
var args = payloadString.Split('|').Select(a => Encoding.UTF8.GetString(a.HexStringToBytes())).ToArray();
|
||||
|
||||
Console.WriteLine("RECEIVED SINGLE INSTANCE FORWARDED ARGS:");
|
||||
|
|
|
@ -1242,7 +1242,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// find the control under the mouse
|
||||
Point m = Cursor.Position;
|
||||
Control top = this;
|
||||
Control found = null;
|
||||
Control found;
|
||||
do
|
||||
{
|
||||
found = top.GetChildAtPoint(top.PointToClient(m), GetChildAtPointSkip.Invisible);
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
_values[PatternList.SelectedIndex] = unchecked((int) ValueNum.Value).ToString(NumberFormatInfo.InvariantInfo);
|
||||
_values[PatternList.SelectedIndex] = ((int) ValueNum.Value).ToString(NumberFormatInfo.InvariantInfo);
|
||||
UpdatePattern();
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ using BizHawk.Common;
|
|||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public readonly struct AxisSpec
|
||||
public readonly record struct AxisSpec
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the axis constraints that apply artificial constraints to float values
|
||||
|
|
|
@ -85,6 +85,5 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public string Scope { get; }
|
||||
}
|
||||
#nullable restore
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,71 +34,59 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public virtual ushort PeekUshort(long addr, bool bigEndian)
|
||||
{
|
||||
Endian endian = bigEndian ? Endian.Big : Endian.Little;
|
||||
switch (endian)
|
||||
if (bigEndian)
|
||||
{
|
||||
default:
|
||||
case Endian.Big:
|
||||
return (ushort)((PeekByte(addr) << 8) | PeekByte(addr + 1));
|
||||
case Endian.Little:
|
||||
return (ushort)(PeekByte(addr) | (PeekByte(addr + 1) << 8));
|
||||
}
|
||||
|
||||
return (ushort)(PeekByte(addr) | (PeekByte(addr + 1) << 8));
|
||||
}
|
||||
|
||||
public virtual uint PeekUint(long addr, bool bigEndian)
|
||||
{
|
||||
Endian endian = bigEndian ? Endian.Big : Endian.Little;
|
||||
switch (endian)
|
||||
if (bigEndian)
|
||||
{
|
||||
default:
|
||||
case Endian.Big:
|
||||
return (uint)((PeekByte(addr) << 24)
|
||||
| (PeekByte(addr + 1) << 16)
|
||||
| (PeekByte(addr + 2) << 8)
|
||||
| (PeekByte(addr + 3) << 0));
|
||||
case Endian.Little:
|
||||
}
|
||||
|
||||
return (uint)((PeekByte(addr) << 0)
|
||||
| (PeekByte(addr + 1) << 8)
|
||||
| (PeekByte(addr + 2) << 16)
|
||||
| (PeekByte(addr + 3) << 24));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PokeUshort(long addr, ushort val, bool bigEndian)
|
||||
{
|
||||
Endian endian = bigEndian ? Endian.Big : Endian.Little;
|
||||
switch (endian)
|
||||
if (bigEndian)
|
||||
{
|
||||
default:
|
||||
case Endian.Big:
|
||||
PokeByte(addr + 0, (byte)(val >> 8));
|
||||
PokeByte(addr + 1, (byte)val);
|
||||
break;
|
||||
case Endian.Little:
|
||||
}
|
||||
else
|
||||
{
|
||||
PokeByte(addr + 0, (byte)val);
|
||||
PokeByte(addr + 1, (byte)(val >> 8));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PokeUint(long addr, uint val, bool bigEndian)
|
||||
{
|
||||
Endian endian = bigEndian ? Endian.Big : Endian.Little;
|
||||
switch (endian)
|
||||
if (bigEndian)
|
||||
{
|
||||
default:
|
||||
case Endian.Big:
|
||||
PokeByte(addr + 0, (byte)(val >> 24));
|
||||
PokeByte(addr + 1, (byte)(val >> 16));
|
||||
PokeByte(addr + 2, (byte)(val >> 8));
|
||||
PokeByte(addr + 3, (byte)val);
|
||||
break;
|
||||
case Endian.Little:
|
||||
}
|
||||
else
|
||||
{
|
||||
PokeByte(addr + 0, (byte)val);
|
||||
PokeByte(addr + 1, (byte)(val >> 8));
|
||||
PokeByte(addr + 2, (byte)(val >> 16));
|
||||
PokeByte(addr + 3, (byte)(val >> 24));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +95,7 @@ namespace BizHawk.Emulation.Common
|
|||
if (addresses is null) throw new ArgumentNullException(paramName: nameof(addresses));
|
||||
if (values is null) throw new ArgumentNullException(paramName: nameof(values));
|
||||
|
||||
if ((long) addresses.Count() != values.Length)
|
||||
if ((long)addresses.Count() != values.Length)
|
||||
{
|
||||
throw new InvalidOperationException("Invalid length of values array");
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Common
|
|||
Firmware = firmware;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) => obj is FirmwareID other
|
||||
public override bool Equals(object? obj) => obj is FirmwareID other
|
||||
&& other.Firmware == Firmware && other.System == System;
|
||||
|
||||
public override int GetHashCode() => (System, Firmware).GetHashCode();
|
||||
|
|
Loading…
Reference in New Issue