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