diff --git a/.editorconfig b/.editorconfig
index 3b3e030434..de87d7b5b4 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,19 +12,107 @@ csharp_indent_switch_labels = true
csharp_indent_case_contents = true
csharp_indent_labels = one_less_than_current
-# Globalization rules
-dotnet_code_quality.CA1305.excluded_symbol_names = T:System.Byte|T:System.SByte|T:System.Int16|T:System.UInt16|T:System.Int32|T:System.UInt32|T:System.Int64|T:System.UInt64|T:System.String|T:System.Text.StringBuilder|T:System.Convert
+# Style rules
+# Can't be in .globalconfig because dotnet format doesn't respect that https://github.com/dotnet/format/issues/1643
-dotnet_diagnostic.CA1305.severity = error
-dotnet_diagnostic.CA2101.severity = suggestion
+# Remove unnecessary cast
+dotnet_diagnostic.IDE0004.severity = warning
+# Remove unnecessary import
+dotnet_diagnostic.IDE0005.severity = warning
+# Use var instead of explicit type
+dotnet_diagnostic.IDE0007.severity = suggestion
+# Use explicit type instead of var
+dotnet_diagnostic.IDE0008.severity = suggestion
+# Inline variable declaration
+dotnet_diagnostic.IDE0018.severity = warning
+# Use pattern matching to avoid as followed by a null check
+dotnet_diagnostic.IDE0019.severity = warning
+# Use pattern matching to avoid is check followed by a cast (with variable)
+dotnet_diagnostic.IDE0020.severity = warning
+# Use expression body for methods
+dotnet_diagnostic.IDE0022.severity = suggestion
+# Use expression body for properties
+dotnet_diagnostic.IDE0025.severity = suggestion
+# Use expression body for indexers
+dotnet_diagnostic.IDE0026.severity = suggestion
+# Use expression body for accessors
+dotnet_diagnostic.IDE0027.severity = suggestion
+# Null check can be simplified
+dotnet_diagnostic.IDE0029.severity = warning
+# Null check can be simplified
+dotnet_diagnostic.IDE0030.severity = warning
+# Use null propagation
+dotnet_diagnostic.IDE0031.severity = warning
+# Use auto property
+dotnet_diagnostic.IDE0032.severity = suggestion
+# Simplify default expression
+dotnet_diagnostic.IDE0034.severity = suggestion
+# Use pattern matching to avoid is check followed by a cast (without variable)
+dotnet_diagnostic.IDE0038.severity = warning
+# Use is null check
+dotnet_diagnostic.IDE0041.severity = warning
+# Deconstruct variable declaration
+dotnet_diagnostic.IDE0042.severity = suggestion
+# dotnet_diagnostic.IDE0049.severity = error # see SA1121
+# Remove unused private member
+dotnet_diagnostic.IDE0051.severity = suggestion
+# Remove unread private member
+dotnet_diagnostic.IDE0052.severity = silent # TODO: should be warning imo, but there's too much violation currently
+# Use compound assignment
+dotnet_diagnostic.IDE0054.severity = warning
+# Use index operator
+dotnet_diagnostic.IDE0056.severity = warning
+# Use range operator
+dotnet_diagnostic.IDE0057.severity = warning
+# Use simple using statement
+dotnet_diagnostic.IDE0063.severity = suggestion
+# Make struct fields writable
+dotnet_diagnostic.IDE0064.severity = error
+# using directive placement
+dotnet_diagnostic.IDE0065.severity = error
+# Use switch expression
+dotnet_diagnostic.IDE0066.severity = suggestion
+# Use System.HashCode.Combine
+dotnet_diagnostic.IDE0070.severity = warning
+# Simplify interpolation
+dotnet_diagnostic.IDE0071.severity = suggestion
+# Use coalesce compound assignment
+dotnet_diagnostic.IDE0074.severity = suggestion
+# Use pattern matching
+dotnet_diagnostic.IDE0078.severity = suggestion
+# Convert typeof to nameof
+dotnet_diagnostic.IDE0082.severity = warning
+# Use pattern matching (not operator)
+dotnet_diagnostic.IDE0083.severity = warning
+# Simplify new expression
+dotnet_diagnostic.IDE0090.severity = suggestion
+# Remove unnecessary equality operator
+dotnet_diagnostic.IDE0100.severity = warning
+# Remove unnecessary discard
+dotnet_diagnostic.IDE0110.severity = warning
+# Simplify LINQ expression
+dotnet_diagnostic.IDE0120.severity = error
+# Namespace does not match folder structure
+dotnet_diagnostic.IDE0130.severity = silent # should be warning imo
+# Use tuple to swap values
+dotnet_diagnostic.IDE0180.severity = suggestion
+# Use UTF-8 string literal
+dotnet_diagnostic.IDE0230.severity = warning
+# Nullable directive is redundant
+dotnet_diagnostic.IDE0240.severity = warning
+# Nullable directive is unnecessary
+dotnet_diagnostic.IDE0241.severity = warning
+# Struct can be made 'readonly'
+dotnet_diagnostic.IDE0250.severity = suggestion
+# Use pattern matching
+dotnet_diagnostic.IDE0260.severity = suggestion
+# Use nameof
+dotnet_diagnostic.IDE0280.severity = error
-# Performance rules
-dotnet_code_quality.CA1826.exclude_ordefault_methods = true
+csharp_style_var_when_type_is_apparent = true
+csharp_style_var_elsewhere = true
-dotnet_diagnostic.CA1805.severity = silent
-dotnet_diagnostic.CA1822.severity = silent
-dotnet_diagnostic.CA1838.severity = suggestion
-
-# Usage rules
-dotnet_diagnostic.CA1816.severity = none
-dotnet_diagnostic.CA2201.severity = suggestion
+csharp_style_expression_bodied_methods = when_on_single_line
+csharp_style_expression_bodied_properties = when_on_single_line
+csharp_style_expression_bodied_indexers = when_on_single_line
+csharp_style_expression_bodied_accessors = when_on_single_line
diff --git a/.globalconfig b/.globalconfig
new file mode 100644
index 0000000000..ac86222fc3
--- /dev/null
+++ b/.globalconfig
@@ -0,0 +1,18 @@
+is_global = true
+
+# Globalization rules
+dotnet_code_quality.CA1305.excluded_symbol_names = T:System.Byte|T:System.SByte|T:System.Int16|T:System.UInt16|T:System.Int32|T:System.UInt32|T:System.Int64|T:System.UInt64|T:System.String|T:System.Text.StringBuilder|T:System.Convert
+
+dotnet_diagnostic.CA1305.severity = error
+dotnet_diagnostic.CA2101.severity = suggestion
+
+# Performance rules
+dotnet_code_quality.CA1826.exclude_ordefault_methods = true
+
+dotnet_diagnostic.CA1805.severity = silent
+dotnet_diagnostic.CA1822.severity = silent
+dotnet_diagnostic.CA1838.severity = suggestion
+
+# Usage rules
+dotnet_diagnostic.CA1816.severity = none
+dotnet_diagnostic.CA2201.severity = suggestion
diff --git a/Common.props b/Common.props
index 4f26374ee2..801423663c 100644
--- a/Common.props
+++ b/Common.props
@@ -6,6 +6,7 @@
Recommended
Recommended
Recommended
+ true
$(MSBuildProjectDirectory)/../../Common.ruleset
true
true
diff --git a/src/BizHawk.BizInvoke/BizExvoker.cs b/src/BizHawk.BizInvoke/BizExvoker.cs
index c2afe764e8..9afc683e5e 100644
--- a/src/BizHawk.BizInvoke/BizExvoker.cs
+++ b/src/BizHawk.BizInvoke/BizExvoker.cs
@@ -67,8 +67,7 @@ namespace BizHawk.BizInvoke
foreach (var a in methods)
{
- MethodBuilder unused;
- var delegateType = BizInvokeUtilities.CreateDelegateType(a.Info, a.Attr!.CallingConvention, typeBuilder, out unused).CreateType()!;
+ var delegateType = BizInvokeUtilities.CreateDelegateType(a.Info, a.Attr!.CallingConvention, typeBuilder, out _).CreateType()!;
DelegateTypes.Add(new StoredDelegateInfo(a.Info, delegateType, a.Attr.EntryPoint ?? a.Info.Name));
}
StorageType = typeBuilder.CreateType()!;
diff --git a/src/BizHawk.BizInvoke/CallingConventionAdapter.cs b/src/BizHawk.BizInvoke/CallingConventionAdapter.cs
index 373c8bd131..24b7b5e521 100644
--- a/src/BizHawk.BizInvoke/CallingConventionAdapter.cs
+++ b/src/BizHawk.BizInvoke/CallingConventionAdapter.cs
@@ -167,7 +167,7 @@ namespace BizHawk.BizInvoke
{
WaterboxWrapper = OSTailoredCode.IsUnixHost
? new NativeConvention()
- : (ICallingConventionAdapter)new MsHostSysVGuest();
+ : new MsHostSysVGuest();
}
private readonly Dictionary? _slots;
@@ -247,7 +247,7 @@ namespace BizHawk.BizInvoke
public MsHostSysVGuest()
{
const int size = 4 * 1024 * 1024;
- _memory = new((ulong)size);
+ _memory = new(size);
_refs = new WeakReference[size / BlockSize];
}
diff --git a/src/BizHawk.BizInvoke/MemoryBlock.cs b/src/BizHawk.BizInvoke/MemoryBlock.cs
index 19ac4fedcf..5618910598 100644
--- a/src/BizHawk.BizInvoke/MemoryBlock.cs
+++ b/src/BizHawk.BizInvoke/MemoryBlock.cs
@@ -1,7 +1,5 @@
using System;
using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
using BizHawk.Common;
namespace BizHawk.BizInvoke
@@ -19,7 +17,7 @@ namespace BizHawk.BizInvoke
Size = WaterboxUtils.AlignUp(size);
_pal = OSTailoredCode.IsUnixHost
- ? (IMemoryBlockPal)new MemoryBlockLinuxPal(Size)
+ ? new MemoryBlockLinuxPal(Size)
: new MemoryBlockWindowsPal(Size);
Start = _pal!.Start;
EndExclusive = Start + Size;
diff --git a/src/BizHawk.BizInvoke/MemoryViewStream.cs b/src/BizHawk.BizInvoke/MemoryViewStream.cs
index 175482e2cd..cc5559d58e 100644
--- a/src/BizHawk.BizInvoke/MemoryViewStream.cs
+++ b/src/BizHawk.BizInvoke/MemoryViewStream.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Runtime.InteropServices;
using BizHawk.Common;
namespace BizHawk.BizInvoke
diff --git a/src/BizHawk.BizInvoke/POSIXLibC.cs b/src/BizHawk.BizInvoke/POSIXLibC.cs
index b62d2fbbc8..5b851d6aad 100644
--- a/src/BizHawk.BizInvoke/POSIXLibC.cs
+++ b/src/BizHawk.BizInvoke/POSIXLibC.cs
@@ -1,8 +1,6 @@
using System;
using System.Runtime.InteropServices;
-using static BizHawk.BizInvoke.MemoryBlock;
-
namespace BizHawk.BizInvoke
{
public static class POSIXLibC
diff --git a/src/BizHawk.Bizware.BizwareGL/BitmapBuffer.cs b/src/BizHawk.Bizware.BizwareGL/BitmapBuffer.cs
index 6508d4f83e..7e03c06cde 100644
--- a/src/BizHawk.Bizware.BizwareGL/BitmapBuffer.cs
+++ b/src/BizHawk.Bizware.BizwareGL/BitmapBuffer.cs
@@ -527,7 +527,7 @@ namespace BizHawk.Bizware.BizwareGL
k--;
for (var i = 1; i < 32; i <<= 1)
{
- k = k | k >> i;
+ k |= k >> i;
}
var candidate = k + 1;
diff --git a/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs b/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs
index 1f569b7066..a81c39872b 100644
--- a/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs
+++ b/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs
@@ -1,7 +1,5 @@
using System;
-using Silk.NET.OpenGL.Legacy;
-
using static SDL2.SDL;
namespace BizHawk.Bizware.Graphics
diff --git a/src/BizHawk.Client.Common/Api/Classes/EmuClientApi.cs b/src/BizHawk.Client.Common/Api/Classes/EmuClientApi.cs
index 396f87c7e6..745bef098a 100644
--- a/src/BizHawk.Client.Common/Api/Classes/EmuClientApi.cs
+++ b/src/BizHawk.Client.Common/Api/Classes/EmuClientApi.cs
@@ -1,8 +1,6 @@
using System;
using System.Drawing;
using System.IO;
-
-using BizHawk.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
diff --git a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs
index 0c227478a5..91b6aebb3d 100644
--- a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs
+++ b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs
@@ -58,7 +58,7 @@ namespace BizHawk.Client.Common
// ALL button names with P{controller} prefixes
foreach (var button in _inputManager.ActiveController.ToBoolButtonNameList(controller))
{
- Set(button, buttons.TryGetValue(button, out var state) ? state : (bool?) null, controller);
+ Set(button, buttons.TryGetValue(button, out var state) ? state : null, controller);
}
}
diff --git a/src/BizHawk.Client.Common/Api/Classes/MemoryApi.cs b/src/BizHawk.Client.Common/Api/Classes/MemoryApi.cs
index 394b4cc9af..5ce463ff57 100644
--- a/src/BizHawk.Client.Common/Api/Classes/MemoryApi.cs
+++ b/src/BizHawk.Client.Common/Api/Classes/MemoryApi.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using BizHawk.Common;
-using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
diff --git a/src/BizHawk.Client.Common/Api/HttpCommunication.cs b/src/BizHawk.Client.Common/Api/HttpCommunication.cs
index 1e5604343c..1270b8d058 100644
--- a/src/BizHawk.Client.Common/Api/HttpCommunication.cs
+++ b/src/BizHawk.Client.Common/Api/HttpCommunication.cs
@@ -1,5 +1,3 @@
-#pragma warning disable CA2007
-
using System;
using System.Collections.Generic;
using System.Net.Http;
diff --git a/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs b/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs
index 5a1c1e3a2d..70948564b0 100644
--- a/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs
+++ b/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs
@@ -763,7 +763,6 @@ namespace BizHawk.Client.Common
}
var videoProvider = job.VideoProvider;
- var glTextureProvider = videoProvider as IGLTextureProvider;
var simulate = job.Simulate;
var chainOutsize = job.ChainOutsize;
@@ -824,7 +823,7 @@ namespace BizHawk.Client.Common
Texture2d videoTexture = null;
if (!simulate)
{
- if (glTextureProvider != null && _gl.DispMethodEnum == EDispMethod.OpenGL)
+ if (videoProvider is IGLTextureProvider glTextureProvider && _gl.DispMethodEnum == EDispMethod.OpenGL)
{
// FYI: this is a million years from happening on n64, since it's all geriatric non-FBO code
videoTexture = _gl.WrapGLTexture2d(new(glTextureProvider.GetGLTexture()), bufferWidth, bufferHeight);
diff --git a/src/BizHawk.Client.Common/DisplayManager/IBlitter.cs b/src/BizHawk.Client.Common/DisplayManager/IBlitter.cs
index 42b01856be..47db7c2f5e 100644
--- a/src/BizHawk.Client.Common/DisplayManager/IBlitter.cs
+++ b/src/BizHawk.Client.Common/DisplayManager/IBlitter.cs
@@ -1,7 +1,5 @@
using System.Drawing;
-using BizHawk.Bizware.BizwareGL;
-
namespace BizHawk.Client.Common
{
///
diff --git a/src/BizHawk.Client.Common/DisplayManager/OSDManager.cs b/src/BizHawk.Client.Common/DisplayManager/OSDManager.cs
index cbfa23a0d5..11d930cd4e 100644
--- a/src/BizHawk.Client.Common/DisplayManager/OSDManager.cs
+++ b/src/BizHawk.Client.Common/DisplayManager/OSDManager.cs
@@ -3,8 +3,6 @@ using System.Linq;
using System.Text;
using System.Drawing;
using System.Collections.Generic;
-
-using BizHawk.Bizware.BizwareGL;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
diff --git a/src/BizHawk.Client.Common/lua/CommonLibs/SQLiteLuaLibrary.cs b/src/BizHawk.Client.Common/lua/CommonLibs/SQLiteLuaLibrary.cs
index 48b6c34372..9ac0170f49 100644
--- a/src/BizHawk.Client.Common/lua/CommonLibs/SQLiteLuaLibrary.cs
+++ b/src/BizHawk.Client.Common/lua/CommonLibs/SQLiteLuaLibrary.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
// ReSharper disable UnusedMember.Global
namespace BizHawk.Client.Common
diff --git a/src/BizHawk.Client.Common/lua/LuaHelperLibs/NESLuaLibrary.cs b/src/BizHawk.Client.Common/lua/LuaHelperLibs/NESLuaLibrary.cs
index 7bd2c791eb..33bc9a7e1a 100644
--- a/src/BizHawk.Client.Common/lua/LuaHelperLibs/NESLuaLibrary.cs
+++ b/src/BizHawk.Client.Common/lua/LuaHelperLibs/NESLuaLibrary.cs
@@ -143,7 +143,7 @@ namespace BizHawk.Client.Common
nhs.DispBackground = show;
Settings = nhs;
break;
- case QuickNES.QuickNESSettings _:
+ case QuickNES.QuickNESSettings:
return;
default:
throw new InvalidOperationException();
@@ -209,7 +209,7 @@ namespace BizHawk.Client.Common
Settings = nhs;
break;
- case QuickNES.QuickNESSettings _:
+ case QuickNES.QuickNESSettings:
return;
default:
throw new InvalidOperationException();
diff --git a/src/BizHawk.Client.Common/movie/tasproj/StateDictionary.cs b/src/BizHawk.Client.Common/movie/tasproj/StateDictionary.cs
index 4e980ecfe8..ffdb67fa1d 100644
--- a/src/BizHawk.Client.Common/movie/tasproj/StateDictionary.cs
+++ b/src/BizHawk.Client.Common/movie/tasproj/StateDictionary.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Text;
using System.IO;
using BizHawk.Common;
diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs b/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs
index b32e904f2d..303d7c5a86 100644
--- a/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs
+++ b/src/BizHawk.Client.Common/movie/tasproj/TasLagLog.cs
@@ -15,7 +15,7 @@ namespace BizHawk.Client.Common
get
{
var result = _lagLog.TryGetValue(frame, out var lag);
- return result ? (bool?)lag : null;
+ return result ? lag : null;
}
set
diff --git a/src/BizHawk.Client.Common/rewind/ZeldaWinder.cs b/src/BizHawk.Client.Common/rewind/ZeldaWinder.cs
index 4c6df66e43..af6b8db8b2 100644
--- a/src/BizHawk.Client.Common/rewind/ZeldaWinder.cs
+++ b/src/BizHawk.Client.Common/rewind/ZeldaWinder.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Runtime.InteropServices;
using System.Threading.Tasks;
using BizHawk.Common;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Client.Common/tools/Cheat.cs b/src/BizHawk.Client.Common/tools/Cheat.cs
index d4bff54e7d..40f4b6a83b 100644
--- a/src/BizHawk.Client.Common/tools/Cheat.cs
+++ b/src/BizHawk.Client.Common/tools/Cheat.cs
@@ -67,9 +67,9 @@ namespace BizHawk.Client.Common
public long? Address => _watch.Address;
- public int? Value => IsSeparator ? (int?)null : _val;
+ public int? Value => IsSeparator ? null : _val;
- public bool? BigEndian => IsSeparator ? (bool?)null : _watch.BigEndian;
+ public bool? BigEndian => IsSeparator ? null : _watch.BigEndian;
public int? Compare => _compare.HasValue && !IsSeparator ? _compare : null;
@@ -304,7 +304,7 @@ namespace BizHawk.Client.Common
public static bool operator ==(Cheat a, Cheat b)
{
// If one is null, but not both, return false.
- if ((object)a == null || (object)b == null)
+ if (a is null || b is null)
{
return false;
}
@@ -320,7 +320,7 @@ namespace BizHawk.Client.Common
public static bool operator ==(Cheat a, Watch b)
{
// If one is null, but not both, return false.
- if ((object)a == null || (object)b == null)
+ if (a is null || b is null)
{
return false;
}
diff --git a/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs b/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs
index 6035f0341a..d9189bcd20 100644
--- a/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs
+++ b/src/BizHawk.Client.Common/tools/Watch/ByteWatch.cs
@@ -141,7 +141,7 @@ namespace BizHawk.Client.Common
/// Get a string representation of difference
/// between current value and the previous one
///
- public override string Diff => $"{_value - (short)_previous:+#;-#;0}";
+ public override string Diff => $"{_value - _previous:+#;-#;0}";
///
/// Returns true if the Watch is valid, false otherwise
diff --git a/src/BizHawk.Client.Common/tools/Watch/Watch.cs b/src/BizHawk.Client.Common/tools/Watch/Watch.cs
index 44689faf01..a823371abb 100644
--- a/src/BizHawk.Client.Common/tools/Watch/Watch.cs
+++ b/src/BizHawk.Client.Common/tools/Watch/Watch.cs
@@ -150,7 +150,7 @@ namespace BizHawk.Client.Common
/// True if both watch are equals; otherwise, false
public static bool operator ==(Watch a, Watch b)
{
- if (ReferenceEquals(a, null) || ReferenceEquals(b, null))
+ if (a is null || b is null)
{
return false;
}
@@ -171,7 +171,7 @@ namespace BizHawk.Client.Common
/// True if they are equals; otherwise, false
public static bool operator ==(Watch a, Cheat b)
{
- if (ReferenceEquals(a, null) || ReferenceEquals(b, null))
+ if (a is null || b is null)
{
return false;
}
@@ -325,7 +325,7 @@ namespace BizHawk.Client.Common
/// True if both object are equals; otherwise, false
public bool Equals(Watch other)
{
- if (ReferenceEquals(other, null))
+ if (other is null)
{
return false;
}
@@ -342,7 +342,7 @@ namespace BizHawk.Client.Common
/// True if both object are equals; otherwise, false
public bool Equals(Cheat other)
{
- return !ReferenceEquals(other, null)
+ return other is not null
&& _domain == other.Domain
&& Address == other.Address
&& Size == other.Size;
diff --git a/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchEqualityComparer.cs b/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchEqualityComparer.cs
index 4b3140f47a..ac93363e22 100644
--- a/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchEqualityComparer.cs
+++ b/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchEqualityComparer.cs
@@ -18,12 +18,12 @@ namespace BizHawk.Client.Common
/// True if are equal; otherwise, false
public bool Equals(Watch x, Watch y)
{
- if (ReferenceEquals(x, null))
+ if (x is null)
{
- return ReferenceEquals(y, null);
+ return y is null;
}
- if (ReferenceEquals(y, null))
+ if (y is null)
{
return false;
}
diff --git a/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs b/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs
index 58d1d25322..4317a4436f 100644
--- a/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs
+++ b/src/BizHawk.Client.Common/tools/Watch/WordWatch.cs
@@ -146,7 +146,7 @@ namespace BizHawk.Client.Common
/// Get a string representation of difference
/// between current value and the previous one
///
- public override string Diff => $"{_value - (int)_previous:+#;-#;0}";
+ public override string Diff => $"{_value - _previous:+#;-#;0}";
///
/// Returns true if the Watch is valid, false otherwise
diff --git a/src/BizHawk.Client.DiscoHawk/Program.cs b/src/BizHawk.Client.DiscoHawk/Program.cs
index d6b061b37a..e48e94a96b 100644
--- a/src/BizHawk.Client.DiscoHawk/Program.cs
+++ b/src/BizHawk.Client.DiscoHawk/Program.cs
@@ -3,9 +3,6 @@ using System.Runtime.InteropServices;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
-
-using BizHawk.Common;
-using BizHawk.Common.PathExtensions;
using BizHawk.Emulation.DiscSystem;
using OSTC = EXE_PROJECT.OSTailoredCode;
diff --git a/src/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs b/src/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs
index 8a718bfce4..326d52405d 100644
--- a/src/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs
+++ b/src/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs
@@ -644,7 +644,7 @@ namespace BizHawk.Client.EmuHawk
IntPtr* pStream = &stream;
AVIWriterImports.AVICOMPRESSOPTIONS* popts = _popts;
AVIWriterImports.AVICOMPRESSOPTIONS** ppopts = &popts;
- return AVIWriterImports.AVISaveOptions(owner, 0, 1, (void*)pStream, (void*)ppopts);
+ return AVIWriterImports.AVISaveOptions(owner, 0, 1, pStream, ppopts);
}
}
@@ -654,10 +654,10 @@ namespace BizHawk.Client.EmuHawk
public void OpenFile(string destPath, Parameters parameters, CodecToken videoCodecToken)
{
static int mmioFOURCC(string str) => (
- ((int)(byte)(str[0]))
- | ((int)(byte)(str[1]) << 8)
- | ((int)(byte)(str[2]) << 16)
- | ((int)(byte)(str[3]) << 24)
+ (byte)(str[0])
+ | ((byte)(str[1]) << 8)
+ | ((byte)(str[2]) << 16)
+ | ((byte)(str[3]) << 24)
);
this._parameters = parameters;
diff --git a/src/BizHawk.Client.EmuHawk/AVOut/JMDWriter.cs b/src/BizHawk.Client.EmuHawk/AVOut/JMDWriter.cs
index b14a7e2d8a..4ec8f34b8d 100644
--- a/src/BizHawk.Client.EmuHawk/AVOut/JMDWriter.cs
+++ b/src/BizHawk.Client.EmuHawk/AVOut/JMDWriter.cs
@@ -9,7 +9,6 @@ using System.Threading;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
-using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
diff --git a/src/BizHawk.Client.EmuHawk/AVOut/SynclessRecordingTools.cs b/src/BizHawk.Client.EmuHawk/AVOut/SynclessRecordingTools.cs
index 45981c468b..8945f95b6e 100644
--- a/src/BizHawk.Client.EmuHawk/AVOut/SynclessRecordingTools.cs
+++ b/src/BizHawk.Client.EmuHawk/AVOut/SynclessRecordingTools.cs
@@ -51,8 +51,8 @@ namespace BizHawk.Client.EmuHawk
foreach (var line in lines)
{
int idx = line.IndexOf('=');
- string key = line.Substring(0, idx);
- string value = line.Substring(idx + 1, line.Length - (idx + 1));
+ string key = line[..idx];
+ string value = line[(idx + 1)..];
if (key == "framesdir")
{
framesDir = value;
diff --git a/src/BizHawk.Client.EmuHawk/ArchiveChooser.cs b/src/BizHawk.Client.EmuHawk/ArchiveChooser.cs
index ba04e1a64c..16cda64e09 100644
--- a/src/BizHawk.Client.EmuHawk/ArchiveChooser.cs
+++ b/src/BizHawk.Client.EmuHawk/ArchiveChooser.cs
@@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
catch (ArgumentException ex)
{
string errMsg = ex.Message;
- errMsg = errMsg.Substring(errMsg.IndexOf('-') + 2);
+ errMsg = errMsg[(errMsg.IndexOf('-') + 2)..];
// Balloon is bugged on first invocation
_errorBalloon.Show($"Error parsing RegEx: {errMsg}", tb);
diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/HexTextBox.cs b/src/BizHawk.Client.EmuHawk/CustomControls/HexTextBox.cs
index 0879aa3f74..8a8d13e521 100644
--- a/src/BizHawk.Client.EmuHawk/CustomControls/HexTextBox.cs
+++ b/src/BizHawk.Client.EmuHawk/CustomControls/HexTextBox.cs
@@ -285,7 +285,7 @@ namespace BizHawk.Client.EmuHawk
public void SetFromRawInt(int? val)
{
- Text = val.HasValue ? val.ToString() : "";
+ Text = val?.ToString() ?? "";
}
}
}
diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/Cell.cs b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/Cell.cs
index 7d850c28c1..ce631c8a30 100644
--- a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/Cell.cs
+++ b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/Cell.cs
@@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
public static bool operator ==(Cell a, Cell b)
{
- return a?.Equals(b) ?? ReferenceEquals(b, null);
+ return a?.Equals(b) ?? b is null;
}
public static bool operator !=(Cell a, Cell b)
diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs b/src/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs
index 0635757861..1350eaa892 100644
--- a/src/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs
+++ b/src/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs
@@ -2,8 +2,6 @@
using System.Drawing;
using System.Windows.Forms;
-using BizHawk.Common;
-
// http://www.codeproject.com/Articles/154680/A-customizable-NET-WinForms-Message-Box
namespace BizHawk.Client.EmuHawk.CustomControls
{
diff --git a/src/BizHawk.Client.EmuHawk/Extensions/CoreExtensions.cs b/src/BizHawk.Client.EmuHawk/Extensions/CoreExtensions.cs
index 21687d8296..46a3b2f96f 100644
--- a/src/BizHawk.Client.EmuHawk/Extensions/CoreExtensions.cs
+++ b/src/BizHawk.Client.EmuHawk/Extensions/CoreExtensions.cs
@@ -9,7 +9,6 @@ using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using BizHawk.Emulation.Cores.Arcades.MAME;
using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS;
using BizHawk.Emulation.Cores.Nintendo.GBA;
-using BizHawk.Emulation.Cores.Sega.MasterSystem;
namespace BizHawk.Client.EmuHawk.CoreExtensions
{
diff --git a/src/BizHawk.Client.EmuHawk/LogWindow.cs b/src/BizHawk.Client.EmuHawk/LogWindow.cs
index bc258c38db..8f417a4c60 100644
--- a/src/BizHawk.Client.EmuHawk/LogWindow.cs
+++ b/src/BizHawk.Client.EmuHawk/LogWindow.cs
@@ -92,7 +92,7 @@ namespace BizHawk.Client.EmuHawk
if (invoked)
{
//basically an easy way to post an update message which should hopefully happen before anything else happens (redraw or user interaction)
- BeginInvoke((Action)doUpdateListSize);
+ BeginInvoke(doUpdateListSize);
}
else
doUpdateListSize();
diff --git a/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs b/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs
index 6287a192ed..3e094cdbb1 100644
--- a/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs
+++ b/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Windows.Forms;
using System.Linq;
using System.Collections.Generic;
diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs
index 925fca98be..f6b1ddeabb 100644
--- a/src/BizHawk.Client.EmuHawk/MainForm.cs
+++ b/src/BizHawk.Client.EmuHawk/MainForm.cs
@@ -1208,7 +1208,7 @@ namespace BizHawk.Client.EmuHawk
//NOTE: these must go together, because in the case of screen rotation, X and Y are transformed together
if(mouseX != null && mouseY != null)
{
- var p = DisplayManager.UntransformPoint(new Point((int) mouseX.Value.Value, (int) mouseY.Value.Value));
+ var p = DisplayManager.UntransformPoint(new Point(mouseX.Value.Value, mouseY.Value.Value));
float x = p.X / (float)_currentVideoProvider.BufferWidth;
float y = p.Y / (float)_currentVideoProvider.BufferHeight;
finalHostController.AcceptNewAxis("WMouse X", (int) ((x * 20000) - 10000));
@@ -3810,8 +3810,6 @@ namespace BizHawk.Client.EmuHawk
IOpenAdvanced ioa = args.OpenAdvanced;
var oaOpenrom = ioa as OpenAdvanced_OpenRom;
- var oaMame = ioa as OpenAdvanced_MAME;
- var oaRetro = ioa as OpenAdvanced_Libretro;
var ioaRetro = ioa as IOpenAdvancedLibretro;
// we need to inform LoadRom which Libretro core to use...
@@ -3846,7 +3844,7 @@ namespace BizHawk.Client.EmuHawk
// we need to replace the path in the OpenAdvanced with the canonical one the user chose.
// It can't be done until loader.LoadRom happens (for CanonicalFullPath)
// i'm not sure this needs to be more abstractly engineered yet until we have more OpenAdvanced examples
- if (oaRetro != null)
+ if (ioa is OpenAdvanced_Libretro oaRetro)
{
oaRetro.token.Path = loader.CanonicalFullPath;
}
@@ -3856,7 +3854,7 @@ namespace BizHawk.Client.EmuHawk
oaOpenrom.Path = loader.CanonicalFullPath;
}
- if (oaMame != null)
+ if (ioa is OpenAdvanced_MAME oaMame)
{
oaMame.Path = loader.CanonicalFullPath;
}
@@ -3871,7 +3869,7 @@ namespace BizHawk.Client.EmuHawk
InputManager.SyncControls(Emulator, MovieSession, Config);
_multiDiskMode = false;
- if (oaOpenrom != null && Path.GetExtension(oaOpenrom.Path.Replace("|", "")).ToLowerInvariant() == ".xml" && !(Emulator is LibsnesCore))
+ if (oaOpenrom != null && Path.GetExtension(oaOpenrom.Path.Replace("|", "")).ToLowerInvariant() == ".xml" && Emulator is not LibsnesCore)
{
// this is a multi-disk bundler file
// determine the xml assets and create RomStatusDetails for all of them
diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegrationDownloaderForm.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegrationDownloaderForm.cs
index ee6ed35f47..cbe3e517b8 100644
--- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegrationDownloaderForm.cs
+++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RAIntegrationDownloaderForm.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Linq;
using System.Threading;
using System.Windows.Forms;
diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs
index 42e5a2c49c..2a619a59dc 100644
--- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs
+++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.GameVerification.cs
@@ -119,7 +119,7 @@ namespace BizHawk.Client.EmuHawk
// end of the path has ;
var end = exePath.IndexOf(';');
if (end < 0) break;
- exePath = exePath.Substring(index, end - index);
+ exePath = exePath[index..end];
}
buffer.AddRange(Encoding.ASCII.GetBytes(exePath));
diff --git a/src/BizHawk.Client.EmuHawk/ScreenSaver.cs b/src/BizHawk.Client.EmuHawk/ScreenSaver.cs
index f9018e2921..906dc025d1 100644
--- a/src/BizHawk.Client.EmuHawk/ScreenSaver.cs
+++ b/src/BizHawk.Client.EmuHawk/ScreenSaver.cs
@@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
}
private static readonly IScreenBlankTimer _screenBlankTimer = OSTailoredCode.IsUnixHost
- ? (IScreenBlankTimer) new UnixScreenBlankTimer()
+ ? new UnixScreenBlankTimer()
: new Win32ScreenBlankTimer();
private static int ctr;
diff --git a/src/BizHawk.Client.EmuHawk/Sound/Sound.cs b/src/BizHawk.Client.EmuHawk/Sound/Sound.cs
index 20a773d41c..782d8f2b92 100644
--- a/src/BizHawk.Client.EmuHawk/Sound/Sound.cs
+++ b/src/BizHawk.Client.EmuHawk/Sound/Sound.cs
@@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
{
// if DirectSound or XAudio is chosen, use OpenAL, otherwise comply with the user's choice
_outputDevice = config.SoundOutputMethod == ESoundOutputMethod.Dummy
- ? (ISoundOutput) new DummySoundOutput(this)
+ ? new DummySoundOutput(this)
: new OpenALSoundOutput(this, config.SoundDevice);
}
else
diff --git a/src/BizHawk.Client.EmuHawk/Throttle.cs b/src/BizHawk.Client.EmuHawk/Throttle.cs
index 311c492627..a686550bf5 100644
--- a/src/BizHawk.Client.EmuHawk/Throttle.cs
+++ b/src/BizHawk.Client.EmuHawk/Throttle.cs
@@ -139,7 +139,7 @@ namespace BizHawk.Client.EmuHawk
private static readonly Func TimeBeginPeriod = OSTailoredCode.IsUnixHost
? u => u
- : (Func) Win32Imports.timeBeginPeriod;
+ : Win32Imports.timeBeginPeriod;
private static readonly int tmethod;
private static readonly ulong afsfreq;
diff --git a/src/BizHawk.Client.EmuHawk/config/ControllerConfig/ControllerConfigPanel.cs b/src/BizHawk.Client.EmuHawk/config/ControllerConfig/ControllerConfigPanel.cs
index 6d230cee0b..7398d88845 100644
--- a/src/BizHawk.Client.EmuHawk/config/ControllerConfig/ControllerConfigPanel.cs
+++ b/src/BizHawk.Client.EmuHawk/config/ControllerConfig/ControllerConfigPanel.cs
@@ -4,8 +4,6 @@ using System.Drawing;
using System.Linq;
using System.Windows.Forms;
-using BizHawk.Client.Common;
-
namespace BizHawk.Client.EmuHawk
{
// this is a little messy right now because of remnants of the old config system
diff --git a/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs b/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs
index c1d4832e03..bc08aed90f 100644
--- a/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs
+++ b/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs
@@ -183,7 +183,7 @@ namespace BizHawk.Client.EmuHawk
lvFirmwares.Groups.Add(
key: sysID,
headerText: SystemGroupNames.TryGetValue(sysID, out var name) ? name : "FIX ME (FirmwaresConfig.cs)");
- return lvFirmwares.Groups[lvFirmwares.Groups.Count - 1];
+ return lvFirmwares.Groups[^1];
}
// we'll use this font for displaying the hash, so they don't look all jagged in a long list
diff --git a/src/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs b/src/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs
index 652ec9fcd0..4be0c56dd7 100644
--- a/src/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs
+++ b/src/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs
@@ -192,7 +192,7 @@ namespace BizHawk.Client.EmuHawk
try
{
- lines.Add(line.Substring(0, i), int.Parse(line.Substring(i + 1)));
+ lines.Add(line[..i], int.Parse(line[(i + 1)..]));
}
catch (FormatException)
{
diff --git a/src/BizHawk.Client.EmuHawk/config/GB/SameBoyColorChooserForm.cs b/src/BizHawk.Client.EmuHawk/config/GB/SameBoyColorChooserForm.cs
index 85d5ecf22e..7f9c775af9 100644
--- a/src/BizHawk.Client.EmuHawk/config/GB/SameBoyColorChooserForm.cs
+++ b/src/BizHawk.Client.EmuHawk/config/GB/SameBoyColorChooserForm.cs
@@ -162,7 +162,7 @@ namespace BizHawk.Client.EmuHawk
try
{
- lines.Add(line.Substring(0, i), int.Parse(line.Substring(i + 1)));
+ lines.Add(line[..i], int.Parse(line[(i + 1)..]));
}
catch (FormatException)
{
diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs b/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
index 5bc3177954..a0a08fe5c0 100644
--- a/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
+++ b/src/BizHawk.Client.EmuHawk/config/NES/NESSoundConfig.cs
@@ -1,5 +1,4 @@
using System;
-using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Client.EmuHawk/debug/FirmwareAutopatchDebugToolForm.cs b/src/BizHawk.Client.EmuHawk/debug/FirmwareAutopatchDebugToolForm.cs
index 2d42aeff84..3768ab1f40 100644
--- a/src/BizHawk.Client.EmuHawk/debug/FirmwareAutopatchDebugToolForm.cs
+++ b/src/BizHawk.Client.EmuHawk/debug/FirmwareAutopatchDebugToolForm.cs
@@ -23,10 +23,10 @@ namespace BizHawk.Client.EmuHawk.ForDebugging
public FirmwareAutopatchDebugToolForm()
{
static string LabelFragment(string hash)
- => $"{hash.Substring(0, 8)}... {FirmwareDatabase.FirmwareFilesByHash[hash].RecommendedName}";
+ => $"{hash[..8]}... {FirmwareDatabase.FirmwareFilesByHash[hash].RecommendedName}";
List<(string Label, FirmwarePatchOption PatchOption)> patches = FirmwareDatabase.AllPatches
.Select(static fpo => ($"{LabelFragment(fpo.BaseHash)} --> {LabelFragment(fpo.TargetHash)}", fpo)).ToList();
- patches.Sort(static (a, b) => a.Label.CompareTo(b.Label));
+ patches.Sort(static (a, b) => string.CompareOrdinal(a.Label, b.Label));
ComboBox comboPatchsets = new() { Size = new(300, 23) };
foreach (var tuple in patches) comboPatchsets.Items.Add(tuple.Label);
SzTextBoxEx txtBaseFile = new() { Size = new(224, 23) };
diff --git a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
index 9057baf30d..a4d06c5a03 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs
@@ -452,7 +452,7 @@ namespace BizHawk.Client.EmuHawk
{
var indices = SelectedIndices.ToList();
if (indices.Count == 0
- || indices[indices.Count - 1] == MainForm.CheatList.Count - 1) // at end already
+ || indices[^1] == MainForm.CheatList.Count - 1) // at end already
{
return;
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
index 75a80c03b9..9310742463 100644
--- a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs
@@ -1374,7 +1374,7 @@ namespace BizHawk.Client.EmuHawk
// and add HighlightedAddress if present
if (_highlightedAddress.HasValue)
{
- addresses[addresses.Length - 1] = _highlightedAddress.Value;
+ addresses[^1] = _highlightedAddress.Value;
}
// these need to be sorted. it's not just for HighlightedAddress, _secondaryHighlightedAddresses can even be jumbled
@@ -2224,7 +2224,7 @@ namespace BizHawk.Client.EmuHawk
{
ushort hi = _domain.PeekUshort(((addr+(i<<3)+(j<<1) )^0x0), bigEndian);
ushort lo = _domain.PeekUshort(((addr+(i<<3)+(j<<1) + 32)^0x0), bigEndian);
- matVals[i,j] = (int)(((hi << 16) | lo)) / 65536.0f;
+ matVals[i,j] = ((hi << 16) | lo) / 65536.0f;
}
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
index c269c3ed27..f0c0196d3e 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
@@ -309,7 +309,7 @@ namespace BizHawk.Client.EmuHawk
private void OnLuaFileChanged(LuaFile item)
{
- if (item.Enabled && LuaImp.ScriptList.Contains(item) == true)
+ if (item.Enabled && LuaImp.ScriptList.Contains(item))
{
RefreshLuaScript(item);
}
@@ -380,7 +380,7 @@ namespace BizHawk.Client.EmuHawk
{
while (LuaImp.ScriptList.Count > 0)
{
- RemoveLuaFile(LuaImp.ScriptList[LuaImp.ScriptList.Count - 1]);
+ RemoveLuaFile(LuaImp.ScriptList[^1]);
}
}
@@ -1036,7 +1036,7 @@ namespace BizHawk.Client.EmuHawk
{
var indices = LuaListView.SelectedRows.ToList();
if (indices.Count == 0
- || indices[indices.Count - 1] == LuaImp.ScriptList.Count - 1) // at end already
+ || indices[^1] == LuaImp.ScriptList.Count - 1) // at end already
{
return;
}
@@ -1330,7 +1330,7 @@ namespace BizHawk.Client.EmuHawk
var split = words[0].Split(Path.DirectorySeparatorChar);
luaListTemp.Add(LuaImp.ScriptList[i]);
- luaListTemp[i].Name = split[split.Length - 1];
+ luaListTemp[i].Name = split[^1];
}
// Script, Path
diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaLibraries.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaLibraries.cs
index b43b24670b..38b53b33f6 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaLibraries.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaLibraries.cs
@@ -5,7 +5,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
-using System.Text;
using System.Threading;
using NLua;
diff --git a/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.ButtonSelect.cs b/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.ButtonSelect.cs
index 9bae454334..dc5beeaabd 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.ButtonSelect.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.ButtonSelect.cs
@@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
}
}
- key = key.Substring(0, key.Length - 1);
+ key = key[..^1];
SelectedZone.InputKey = key;
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs b/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
index 8f24b8e70a..3823a2d81b 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Macros/MacroInput.cs
@@ -209,7 +209,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
- if (!(CurrentMovie is ITasMovie))
+ if (CurrentMovie is not ITasMovie)
{
SelectedZone.Start = Emulator.Frame;
}
@@ -238,7 +238,7 @@ namespace BizHawk.Client.EmuHawk
ZonesList.Items.Add($"{loadZone.Name} - length: {loadZone.Length}");
// Options only for TasMovie
- if (!(CurrentMovie is ITasMovie))
+ if (CurrentMovie is not ITasMovie)
{
loadZone.Replace = false;
loadZone.Overlay = false;
diff --git a/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs b/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs
index 2188a12192..6dc2f0b581 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs
@@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk
}
key = key.Replace("LogKey:", "").Replace("#", "");
- key = key.Substring(0, key.Length - 1);
+ key = key[..^1];
_inputKey = key;
Length = length;
@@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
logGenerator.GenerateLogEntry(); // Reference and create all buttons.
string movieKey = logGenerator.GenerateLogKey().Replace("LogKey:", "").Replace("#", "");
- movieKey = movieKey.Substring(0, movieKey.Length - 1);
+ movieKey = movieKey[..^1];
if (key == movieKey)
{
for (int i = 0; i < length; i++)
@@ -239,7 +239,7 @@ namespace BizHawk.Client.EmuHawk
var lg = _movieSession.Movie.LogGeneratorInstance(_movieSession.MovieController);
string key = lg.GenerateLogKey();
key = key.Replace("LogKey:", "").Replace("#", "");
- key = key.Substring(0, key.Length - 1);
+ key = key[..^1];
string[] emuKeys = key.Split('|');
string[] macroKeys = _inputKey.Split('|');
foreach (var macro in macroKeys)
diff --git a/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
index 9ea13ecaeb..4842cc1f86 100644
--- a/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs
@@ -3,13 +3,11 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
-using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
-using BizHawk.Common;
using BizHawk.Common.PathExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Cores.Sega.MasterSystem;
@@ -121,15 +119,13 @@ namespace BizHawk.Client.EmuHawk
private void SaveButton_Click(object sender, EventArgs e)
{
- FileInfo dummy;
- DoSave(out dummy);
+ DoSave(out var dummy);
}
private void SaveRunButton_Click(object sender, EventArgs e)
{
- FileInfo fileInfo;
- if (!DoSave(out fileInfo))
+ if (!DoSave(out var fileInfo))
return;
DialogResult = DialogResult.OK;
diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs b/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
index 315b23c95a..e58ede885a 100644
--- a/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs
@@ -1,7 +1,5 @@
using System;
using System.Drawing;
-
-using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs b/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
index 15848f2897..c3e84c8d4e 100644
--- a/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs
@@ -4,7 +4,6 @@ using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
-using System.Text;
using System.Windows.Forms;
using System.Xml.XPath;
using System.Xml.Linq;
diff --git a/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs b/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
index 0611f1036d..e0e2ba993f 100644
--- a/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs
@@ -53,9 +53,9 @@ namespace BizHawk.Client.EmuHawk
var buf = canvas.Bat.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, canvas.Bat.PixelFormat);
var pitch = buf.Stride / 4;
var begin = (int*)buf.Scan0.ToPointer();
- var vram = (ushort*)view.Vram;
- var patternBuffer = (byte*)view.BackgroundCache;
- var palette = (int*)view.PaletteCache;
+ var vram = view.Vram;
+ var patternBuffer = view.BackgroundCache;
+ var palette = view.PaletteCache;
int* p = begin;
for (int y = 0; y < height; ++y)
@@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
{
Viewer.GetGpuData(_vdcType, view =>
{
- var vram = (ushort*)view.Vram;
+ var vram = view.Vram;
int xTile = e.X / 8;
int yTile = e.Y / 8;
int tileNo = vram[(ushort)((yTile * view.BatWidth) + xTile)] & 0x07FF;
diff --git a/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs b/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
index 8818c91fbc..ef69543b23 100644
--- a/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs
@@ -81,8 +81,8 @@ namespace BizHawk.Client.EmuHawk
int* dest = (int*)lockData.Scan0;
int pitch = lockData.Stride / sizeof(int);
- byte* src = (byte*)view.SpriteCache;
- int* pal = (int*)view.PaletteCache + 256 + _spPalNum * 16;
+ byte* src = view.SpriteCache;
+ int* pal = view.PaletteCache + 256 + _spPalNum * 16;
for (int tile = 0; tile < 512; tile++)
{
int srcAddr = tile * 256;
@@ -103,8 +103,8 @@ namespace BizHawk.Client.EmuHawk
int* dest = (int*)lockData.Scan0;
int pitch = lockData.Stride / sizeof(int);
- byte* src = (byte*)view.BackgroundCache;
- int* pal = (int*)view.PaletteCache + _bgPalNum * 16;
+ byte* src = view.BackgroundCache;
+ int* pal = view.PaletteCache + _bgPalNum * 16;
for (int tile = 0; tile < 2048; tile++)
{
int srcAddr = tile * 64;
@@ -121,7 +121,7 @@ namespace BizHawk.Client.EmuHawk
{
Viewer.GetGpuData(checkBoxVDC2.Checked ? 1 : 0, view =>
{
- int* pal = (int*)view.PaletteCache;
+ int* pal = view.PaletteCache;
DrawPalette(bmpViewBGPal.Bmp, pal);
DrawPalette(bmpViewSPPal.Bmp, pal + 256);
});
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs
index af60b9dbc3..fc31e2a445 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs
index e1e4e74cc3..3d992848ce 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs
@@ -302,7 +302,7 @@ namespace BizHawk.Client.EmuHawk
{
if (p[i] == lastValue)
{
- _counts[_counts.Count - 1]++;
+ _counts[^1]++;
}
else
{
@@ -335,7 +335,7 @@ namespace BizHawk.Client.EmuHawk
{
if (p[i] == lastValue)
{
- _counts[_counts.Count - 1]++;
+ _counts[^1]++;
}
else
{
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs
index 4e10b3c469..135b5709a9 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs
@@ -1325,7 +1325,7 @@ namespace BizHawk.Client.EmuHawk
else if (e.KeyCode == Keys.OemMinus || e.KeyCode == Keys.Subtract)
{
_axisTypedValue = _axisTypedValue.StartsWith('-')
- ? _axisTypedValue.Substring(1)
+ ? _axisTypedValue[1..]
: $"-{_axisTypedValue}";
}
else if (e.KeyCode == Keys.Back)
@@ -1335,7 +1335,7 @@ namespace BizHawk.Client.EmuHawk
_axisTypedValue = value.ToString(NumberFormatInfo.InvariantInfo);
}
- _axisTypedValue = _axisTypedValue.Substring(0, _axisTypedValue.Length - 1);
+ _axisTypedValue = _axisTypedValue[..^1];
if (_axisTypedValue == "" || _axisTypedValue == "-")
{
value = 0f;
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs
index e5d170c6b9..c519f1d7f2 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs
@@ -469,7 +469,7 @@ namespace BizHawk.Client.EmuHawk
{
_tasClipboard.Clear();
int linesToPaste = lines.Length;
- if (lines[lines.Length - 1] == "") linesToPaste--;
+ if (lines[^1] == "") linesToPaste--;
for (int i = 0; i < linesToPaste; i++)
{
var line = ControllerFromMnemonicStr(lines[i]);
@@ -511,7 +511,7 @@ namespace BizHawk.Client.EmuHawk
{
_tasClipboard.Clear();
int linesToPaste = lines.Length;
- if (lines[lines.Length - 1] == "") linesToPaste--;
+ if (lines[^1] == "") linesToPaste--;
for (int i = 0; i < linesToPaste; i++)
{
var line = ControllerFromMnemonicStr(lines[i]);
diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs
index 46e8e49169..1463aaab5d 100644
--- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs
@@ -11,7 +11,6 @@ using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Common;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
-using BizHawk.Emulation.Cores.Nintendo.N64;
namespace BizHawk.Client.EmuHawk
{
@@ -228,7 +227,7 @@ namespace BizHawk.Client.EmuHawk
}
// Start Scenario 1: A regular movie is active
- if (MovieSession.Movie.IsActive() && !(MovieSession.Movie is ITasMovie))
+ if (MovieSession.Movie.IsActive() && MovieSession.Movie is not ITasMovie)
{
var changesString = "Would you like to save the current movie before closing it?";
if (MovieSession.Movie.Changes)
@@ -451,8 +450,8 @@ namespace BizHawk.Client.EmuHawk
BoolPatterns[i] = new AutoPatternBool(1, 1);
}
- BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0);
- BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool(
+ BoolPatterns[^2] = new AutoPatternBool(1, 0);
+ BoolPatterns[^1] = new AutoPatternBool(
Config.AutofireOn, Config.AutofireOff);
for (int i = fStart; i < AxisPatterns.Length - 2; i++)
@@ -460,8 +459,8 @@ namespace BizHawk.Client.EmuHawk
AxisPatterns[i] = new AutoPatternAxis(new[] { 1 });
}
- AxisPatterns[AxisPatterns.Length - 2] = new AutoPatternAxis(new[] { 1 });
- AxisPatterns[AxisPatterns.Length - 1] = new AutoPatternAxis(1, Config.AutofireOn, 0, Config.AutofireOff);
+ AxisPatterns[^2] = new AutoPatternAxis(new[] { 1 });
+ AxisPatterns[^1] = new AutoPatternAxis(1, Config.AutofireOn, 0, Config.AutofireOff);
SetUpToolStripColumns();
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
index ab0d1c71ae..b2c55fed72 100644
--- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
@@ -85,10 +85,10 @@ namespace BizHawk.Client.EmuHawk
// If the form inherits ToolFormBase, it will set base properties such as Tools, Config, etc
private void SetBaseProperties(IToolForm form)
{
- if (!(form is FormBase f)) return;
+ if (form is not FormBase f) return;
f.Config = _config;
- if (!(form is ToolFormBase tool)) return;
+ if (form is not ToolFormBase tool) return;
tool.SetToolFormBaseProps(_displayManager, _inputManager, _owner, _movieSession, this, _game);
}
@@ -121,7 +121,7 @@ namespace BizHawk.Client.EmuHawk
_tools.Remove(existingTool);
}
- if (!(CreateInstance(toolPath) is T newTool)) return null;
+ if (CreateInstance(toolPath) is not T newTool) return null;
if (newTool is Form form) form.Owner = _owner;
if (!ServiceInjector.UpdateServices(_emulator.ServiceProvider, newTool)) return null; //TODO pass `true` for `mayCache` when from EmuHawk assembly
@@ -402,7 +402,7 @@ namespace BizHawk.Client.EmuHawk
var converter = TypeDescriptor.GetConverter(prop.PropertyType);
val = converter.ConvertFromString(null, CultureInfo.InvariantCulture, str);
}
- else if (!(val is bool) && prop.PropertyType.IsPrimitive)
+ else if (val is not bool && prop.PropertyType.IsPrimitive)
{
// numeric constants are similarly hosed
val = Convert.ChangeType(val, prop.PropertyType, CultureInfo.InvariantCulture);
diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
index 1043ec4126..d4969112b6 100644
--- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs
@@ -128,8 +128,7 @@ namespace BizHawk.Client.EmuHawk
{
foreach (var control in ControllerPanel.Controls)
{
- var vp = control as VirtualPad;
- if (vp == null)
+ if (control is not VirtualPad vp)
{
continue;
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs
index 4825036f52..13516d0fd4 100644
--- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs
@@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
private void UpdateCoreAssociation()
{
- if (!(_ownerEmulator is Octoshock psx))
+ if (_ownerEmulator is not Octoshock psx)
{
return;
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs
index 976ad383aa..40d6d1d638 100644
--- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs
@@ -170,8 +170,8 @@ namespace BizHawk.Client.EmuHawk
private void SetAnalog()
{
- _stickyXorAdapter.SetAxis(XName, HasValue ? X : (int?)null);
- _stickyXorAdapter.SetAxis(YName, HasValue ? Y : (int?)null);
+ _stickyXorAdapter.SetAxis(XName, HasValue ? X : null);
+ _stickyXorAdapter.SetAxis(YName, HasValue ? Y : null);
Refresh();
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
index 486e72e743..d2f6370e9c 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs
@@ -415,7 +415,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var row in clipboardRows)
{
var watch = Watch.FromString(row, MemoryDomains);
- if ((object)watch != null)
+ if (watch is not null)
{
_watches.Add(watch);
}
@@ -910,7 +910,7 @@ namespace BizHawk.Client.EmuHawk
{
var indices = SelectedIndices.ToList();
if (indices.Count == 0
- || indices[indices.Count - 1] == _watches.Count - 1) // at end already
+ || indices[^1] == _watches.Count - 1) // at end already
{
return;
}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Watch/WatchValueBox.cs b/src/BizHawk.Client.EmuHawk/tools/Watch/WatchValueBox.cs
index 2e09d34efe..08875e8cd3 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Watch/WatchValueBox.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Watch/WatchValueBox.cs
@@ -195,7 +195,7 @@ namespace BizHawk.Client.EmuHawk
{
default:
case WatchDisplayType.Signed:
- int? val = ToRawInt() ?? 0;
+ int val = ToRawInt() ?? 0;
if (val == MaxSignedInt)
{
val = MinSignedInt;
@@ -307,12 +307,8 @@ namespace BizHawk.Client.EmuHawk
{
default:
case WatchDisplayType.Signed:
- var val = ToRawInt();
- if (!val.HasValue)
- {
- Text = "";
- }
- else if (val == MinSignedInt)
+ int val = ToRawInt() ?? 0;
+ if (val == MinSignedInt)
{
val = MaxSignedInt;
}
@@ -468,7 +464,7 @@ namespace BizHawk.Client.EmuHawk
{
default:
case WatchDisplayType.Signed:
- Text = val.ToString();
+ Text = val.Value.ToString();
break;
case WatchDisplayType.Unsigned:
var uval = (uint)val.Value;
diff --git a/src/BizHawk.Common/BPSPatcher.cs b/src/BizHawk.Common/BPSPatcher.cs
index 556f9a2a9f..3b6bc1e5f6 100644
--- a/src/BizHawk.Common/BPSPatcher.cs
+++ b/src/BizHawk.Common/BPSPatcher.cs
@@ -2,8 +2,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
-
-using BizHawk.Common.BufferExtensions;
using BizHawk.Common.CollectionExtensions;
namespace BizHawk.Common
diff --git a/src/BizHawk.Common/Bit.cs b/src/BizHawk.Common/Bit.cs
index 0ba4f5dab5..fb1aff55ef 100644
--- a/src/BizHawk.Common/Bit.cs
+++ b/src/BizHawk.Common/Bit.cs
@@ -1,4 +1,3 @@
-using System;
using System.Diagnostics;
namespace BizHawk.Common
diff --git a/src/BizHawk.Common/CustomCollections.cs b/src/BizHawk.Common/CustomCollections.cs
index eaf172bf88..c89a4e540c 100644
--- a/src/BizHawk.Common/CustomCollections.cs
+++ b/src/BizHawk.Common/CustomCollections.cs
@@ -110,7 +110,7 @@ namespace BizHawk.Common
else
{
// All items *after* the item
- startIndex = startIndex + 1;
+ startIndex++;
}
if (startIndex < _list.Count)
{
diff --git a/src/BizHawk.Common/Extensions/StringExtensions.cs b/src/BizHawk.Common/Extensions/StringExtensions.cs
index ec78797793..4a15b1b6a2 100644
--- a/src/BizHawk.Common/Extensions/StringExtensions.cs
+++ b/src/BizHawk.Common/Extensions/StringExtensions.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
diff --git a/src/BizHawk.Common/HawkFile/HawkFile.cs b/src/BizHawk.Common/HawkFile/HawkFile.cs
index 67231a929f..ac544d5331 100644
--- a/src/BizHawk.Common/HawkFile/HawkFile.cs
+++ b/src/BizHawk.Common/HawkFile/HawkFile.cs
@@ -297,7 +297,7 @@ namespace BizHawk.Common
#if DEBUG
if (path.IndexOf('|') != i) Console.WriteLine($"{nameof(HawkFile)} path contains multiple '|'");
#endif
- return i == -1 ? ((string, string)?) null : (path.Substring(0, i), path.Substring(i + 1));
+ return i == -1 ? null : (path.Substring(0, i), path.Substring(i + 1));
}
}
}
diff --git a/src/BizHawk.Common/IMonitor.cs b/src/BizHawk.Common/IMonitor.cs
index 172f6ba50c..8e54fd9405 100644
--- a/src/BizHawk.Common/IMonitor.cs
+++ b/src/BizHawk.Common/IMonitor.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace BizHawk.Common
+namespace BizHawk.Common
{
public interface IMonitor
{
diff --git a/src/BizHawk.Common/OSTailoredCode.cs b/src/BizHawk.Common/OSTailoredCode.cs
index 2ad2538cce..638d96df74 100644
--- a/src/BizHawk.Common/OSTailoredCode.cs
+++ b/src/BizHawk.Common/OSTailoredCode.cs
@@ -1,4 +1,6 @@
+#pragma warning disable IDE0240
#nullable enable
+#pragma warning restore IDE0240
using System;
using System.Diagnostics;
diff --git a/src/BizHawk.Emulation.Common/Base Implementations/LinkedDisassemblable.cs b/src/BizHawk.Emulation.Common/Base Implementations/LinkedDisassemblable.cs
index af8b935091..600f100e6e 100644
--- a/src/BizHawk.Emulation.Common/Base Implementations/LinkedDisassemblable.cs
+++ b/src/BizHawk.Emulation.Common/Base Implementations/LinkedDisassemblable.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
namespace BizHawk.Emulation.Common
diff --git a/src/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs b/src/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs
index 5d4bd1fe11..3a14bc6786 100644
--- a/src/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs
+++ b/src/BizHawk.Emulation.Common/Base Implementations/MemoryCallbackSystem.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Runtime.CompilerServices;
namespace BizHawk.Emulation.Common
{
diff --git a/src/BizHawk.Emulation.Common/Database/FirmwarePatchData.cs b/src/BizHawk.Emulation.Common/Database/FirmwarePatchData.cs
index ea21eed775..371ffe8851 100644
--- a/src/BizHawk.Emulation.Common/Database/FirmwarePatchData.cs
+++ b/src/BizHawk.Emulation.Common/Database/FirmwarePatchData.cs
@@ -1,4 +1,3 @@
-#nullable enable
using System;
diff --git a/src/BizHawk.Emulation.Common/Database/FirmwarePatchOption.cs b/src/BizHawk.Emulation.Common/Database/FirmwarePatchOption.cs
index f017205486..6cd4d69876 100644
--- a/src/BizHawk.Emulation.Common/Database/FirmwarePatchOption.cs
+++ b/src/BizHawk.Emulation.Common/Database/FirmwarePatchOption.cs
@@ -1,4 +1,3 @@
-#nullable enable
using System.Collections.Generic;
diff --git a/src/BizHawk.Emulation.Common/Extensions.cs b/src/BizHawk.Emulation.Common/Extensions.cs
index 42a1b28193..d3e83b7d85 100644
--- a/src/BizHawk.Emulation.Common/Extensions.cs
+++ b/src/BizHawk.Emulation.Common/Extensions.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
diff --git a/src/BizHawk.Emulation.Common/N64RomByteswapper.cs b/src/BizHawk.Emulation.Common/N64RomByteswapper.cs
index 4244eaf8a8..e986da338f 100644
--- a/src/BizHawk.Emulation.Common/N64RomByteswapper.cs
+++ b/src/BizHawk.Emulation.Common/N64RomByteswapper.cs
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.InteropServices;
using BizHawk.Common;
diff --git a/src/BizHawk.Emulation.Common/SaveController.cs b/src/BizHawk.Emulation.Common/SaveController.cs
index 0c423b3df2..079710f514 100644
--- a/src/BizHawk.Emulation.Common/SaveController.cs
+++ b/src/BizHawk.Emulation.Common/SaveController.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using BizHawk.Common;
diff --git a/src/BizHawk.Emulation.Common/ServiceInjector.cs b/src/BizHawk.Emulation.Common/ServiceInjector.cs
index 7ac06df321..38f8416919 100644
--- a/src/BizHawk.Emulation.Common/ServiceInjector.cs
+++ b/src/BizHawk.Emulation.Common/ServiceInjector.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Reflection;
using BizHawk.Common.ReflectionExtensions;
diff --git a/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs b/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs
index 629ea3416e..b7f1c357a4 100644
--- a/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs
+++ b/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs
@@ -1,8 +1,6 @@
using System.Collections.Generic;
using System.Drawing;
-using BizHawk.Emulation.Common;
-
namespace BizHawk.Emulation.Common
{
public abstract class PadSchemaControl
diff --git a/src/BizHawk.Emulation.Cores/Arcades/MAME/LibMAME.cs b/src/BizHawk.Emulation.Cores/Arcades/MAME/LibMAME.cs
index a6d05c56b0..26012f006b 100644
--- a/src/BizHawk.Emulation.Cores/Arcades/MAME/LibMAME.cs
+++ b/src/BizHawk.Emulation.Cores/Arcades/MAME/LibMAME.cs
@@ -1,6 +1,5 @@
using System;
using System.Runtime.InteropServices;
-using System.Text;
using BizHawk.BizInvoke;
diff --git a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.ISettable.cs b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.ISettable.cs
index fdaacf4cea..36b76190ec 100644
--- a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.ISettable.cs
+++ b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.ISettable.cs
@@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
if (hashdata.Contains("^"))
{
hashdata = hashdata.RemoveSuffix("^");
- name = name + " (BAD DUMP)";
+ name += " (BAD DUMP)";
}
hashdata = hashdata.Replace("R", "CRC:").Replace("S", " SHA:");
diff --git a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.IVideoProvider.cs b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.IVideoProvider.cs
index 108f83d92c..92ec289baa 100644
--- a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.IVideoProvider.cs
+++ b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.IVideoProvider.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/DataMovement.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/DataMovement.cs
index d8743ce290..57c02a77a8 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/DataMovement.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/DataMovement.cs
@@ -508,7 +508,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
string address = DisassembleAddress(mode, reg, ref pc);
info.Mnemonic = size == 0 ? "movem.w" : "movem.l";
- info.Args = DisassembleRegisterList0((uint)registers) + ", " + address;
+ info.Args = DisassembleRegisterList0(registers) + ", " + address;
info.Length = pc - info.PC;
}
diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs
index 67f1270680..77b0370435 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs
@@ -1126,7 +1126,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
int quotient = dest / source;
int remainder = dest % source;
- V = ((int)quotient < short.MinValue || (int)quotient > short.MaxValue);
+ V = (quotient < short.MinValue || quotient > short.MaxValue);
N = (quotient & 0x8000) != 0;
Z = quotient == 0;
C = false;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/ProgramFlow.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/ProgramFlow.cs
index 4014ea26a9..9aa956a982 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/ProgramFlow.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/ProgramFlow.cs
@@ -58,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
sbyte displacement8 = (sbyte)op;
int cond = (op >> 8) & 0x0F;
- if (TestCondition(cond) == true)
+ if (TestCondition(cond))
{
if (displacement8 != 0)
{
@@ -169,7 +169,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
private void DBcc()
{
- if (TestCondition((op >> 8) & 0x0F) == true)
+ if (TestCondition((op >> 8) & 0x0F))
{
PC += 2; // condition met, break out of loop
PendingCycles -= 12;
@@ -712,7 +712,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
int mode = (op >> 3) & 7;
int reg = (op >> 0) & 7;
- if (TestCondition(cond) == true)
+ if (TestCondition(cond))
{
WriteValueB(mode, reg, -1);
if (mode == 0) PendingCycles -= 6;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs
index 8a3064fac7..7836d650e0 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs
@@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
{
int mode = (op >> 3) & 7;
int reg = (op >> 0) & 7;
- WriteValueW(mode, reg, (short)SR);
+ WriteValueW(mode, reg, SR);
PendingCycles -= (mode == 0) ? 6 : 8 + EACyclesBW[mode, reg];
}
@@ -151,7 +151,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
private void TrapVector(int vector)
{
- short sr = (short)SR; // capture current SR.
+ short sr = SR; // capture current SR.
S = true; // switch to supervisor mode, if not already in it.
A[7].s32 -= 4; // Push PC on stack
WriteLong(A[7].s32, PC);
diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/MC68000.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/MC68000.cs
index cfffb03804..ec0ff46723 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/68000/MC68000.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/68000/MC68000.cs
@@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
set
{
if (value == s) return;
- if (value == true) // entering supervisor mode
+ if (value) // entering supervisor mode
{
Console.WriteLine("&^&^&^&^& ENTER SUPERVISOR MODE");
usp = A[7].s32;
@@ -142,7 +142,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
{
// TODO: Entering interrupt is not free. how many cycles does it take?
//Log.Error("CPU","****** ENTER INTERRUPT {0} *******", Interrupt);
- short sr = (short)SR; // capture current SR.
+ short sr = SR; // capture current SR.
S = true; // switch to supervisor mode, if not already in it.
A[7].s32 -= 4; // Push PC on stack
WriteLong(A[7].s32, PC);
diff --git a/src/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs b/src/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs
index 150fc63bc7..34d2d7828e 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/CP1610/CP1610.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using BizHawk.Common;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Operations.cs b/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Operations.cs
index 5f3c9dbc7e..21f503bbe7 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Operations.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Operations.cs
@@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
public void IN_Func(byte dest, byte src)
{
- Regs[dest] = ReadHardware((byte)(Regs[src]));
+ Regs[dest] = ReadHardware(Regs[src]);
}
///
diff --git a/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Registers.cs b/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Registers.cs
index f5b0deeca0..2981c7ebe1 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Registers.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.Registers.cs
@@ -174,7 +174,7 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
public bool IRQRequest
{
get => Regs[IRQR] > 0;
- set => Regs[IRQR] = value == true ? (byte)1 : (byte)0;
+ set => Regs[IRQR] = value ? (byte)1 : (byte)0;
}
///
diff --git a/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.cs b/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.cs
index 07b47caf40..5d031e8359 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/FairchildF8/F3850.cs
@@ -183,7 +183,7 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
case END:
OnExecFetch?.Invoke(RegPC0);
TraceCallback?.Invoke(State());
- opcode = (byte)Regs[DB];
+ opcode = Regs[DB];
instr_pntr = 0;
FetchInstruction();
break;
@@ -600,13 +600,13 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
// Place the high order byte of DC0 on the data bus
// CYCLE LENGTH: L
case ROMC_06:
- Regs[DB] = (byte)Regs[DC0h];
+ Regs[DB] = Regs[DC0h];
break;
// Place the high order byte of PC1 on the data bus
// CYCLE LENGTH: L
case ROMC_07:
- Regs[DB] = (byte)Regs[PC1h];
+ Regs[DB] = Regs[PC1h];
break;
// All devices copy the contents of PC0 into PC1. The CPU outputs zero on the data bus in this ROMC state.
@@ -622,7 +622,7 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
// The device whose address space includes the contents of the DC0 register must place the low order byte of DC0 onto the data bus
// CYCLE LENGTH: L
case ROMC_09:
- Regs[DB] = (byte)Regs[DC0l];
+ Regs[DB] = Regs[DC0l];
break;
// All devices add the 8-bit value on the data bus, treated as a signed binary number, to the data counter
@@ -635,7 +635,7 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
// The device whose address space includes the value in PC1 must place the low order byte of PC1 on the data bus
// CYCLE LENGTH: L
case ROMC_0B:
- Regs[DB] = (byte)Regs[PC1l];
+ Regs[DB] = Regs[PC1l];
break;
// The device whose address space includes the contents of the PC0 register must place the contents of the memory word addressed by PC0
@@ -765,13 +765,13 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
// The device whose address space includes the contents of PC0 must place the low order byte of PC0 onto the data bus
// CYCLE LENGTH: L
case ROMC_1E:
- Regs[DB] = (byte)Regs[PC0l];
+ Regs[DB] = Regs[PC0l];
break;
// The device whose address space includes the contents of PC0 must place the high order byte of PC0 onto the data bus
// CYCLE LENGTH: L
case ROMC_1F:
- Regs[DB] = (byte)Regs[PC0h];
+ Regs[DB] = Regs[PC0h];
break;
}
diff --git a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs
index 9806634fbb..a6a8a7456e 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs
@@ -541,7 +541,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x30: // BMI +/-rel
rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8);
- if (FlagN == true)
+ if (FlagN)
{
PendingCycles -= 2;
PC = value16;
@@ -1213,7 +1213,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x70: // BVS +/-rel
rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8);
- if (FlagV == true)
+ if (FlagV)
{
PendingCycles -= 2;
PC = value16;
@@ -1747,7 +1747,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0xB0: // BCS +/-rel
rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8);
- if (FlagC == true)
+ if (FlagC)
{
PendingCycles -= 2;
PC = value16;
@@ -2255,7 +2255,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0xF0: // BEQ +/-rel
rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8);
- if (FlagZ == true)
+ if (FlagZ)
{
PendingCycles -= 2;
PC = value16;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280_CDL.cs b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280_CDL.cs
index 73dd223f77..98601be50b 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280_CDL.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280_CDL.cs
@@ -22,10 +22,9 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{
if ((kvp.Value[i] & (byte)CDLUsage.Code) != 0)
{
- int unused;
string dis = DisassembleExt(
0,
- out unused,
+ out int unused,
addr => md.PeekByte(addr + i),
addr => md.PeekUshort(addr + i, bigEndian: false));
w.WriteLine("0x{0:x8}: {1}", i, dis);
diff --git a/src/BizHawk.Emulation.Cores/CPUs/LR35902/Execute.cs b/src/BizHawk.Emulation.Cores/CPUs/LR35902/Execute.cs
index 92f3700d1a..d2b7843e06 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/LR35902/Execute.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/LR35902/Execute.cs
@@ -584,21 +584,21 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
instr_table[256 * 60 * 2 + 60 * 2 + 1] = IDLE;
instr_table[256 * 60 * 2 + 60 * 2 + 2] = IDLE;
instr_table[256 * 60 * 2 + 60 * 2 + 3] = HALT;
- instr_table[256 * 60 * 2 + 60 * 2 + 4] = (ushort)0;
+ instr_table[256 * 60 * 2 + 60 * 2 + 4] = 0;
// GBC Halt loop
instr_table[256 * 60 * 2 + 60 * 3] = IDLE;
instr_table[256 * 60 * 2 + 60 * 3 + 1] = IDLE;
instr_table[256 * 60 * 2 + 60 * 3 + 2] = HALT_CHK;
instr_table[256 * 60 * 2 + 60 * 3 + 3] = HALT;
- instr_table[256 * 60 * 2 + 60 * 3 + 4] = (ushort)0;
+ instr_table[256 * 60 * 2 + 60 * 3 + 4] = 0;
// spec Halt loop
instr_table[256 * 60 * 2 + 60 * 4] = HALT_CHK;
instr_table[256 * 60 * 2 + 60 * 4 + 1] = IDLE;
instr_table[256 * 60 * 2 + 60 * 4 + 2] = IDLE;
instr_table[256 * 60 * 2 + 60 * 4 + 3] = HALT;
- instr_table[256 * 60 * 2 + 60 * 4 + 4] = (ushort)0;
+ instr_table[256 * 60 * 2 + 60 * 4 + 4] = 0;
// Stop loop
instr_table[256 * 60 * 2 + 60 * 5] = IDLE;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/LR35902/Tables_Direct.cs b/src/BizHawk.Emulation.Cores/CPUs/LR35902/Tables_Direct.cs
index 959ece3872..ed4612d751 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/LR35902/Tables_Direct.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/LR35902/Tables_Direct.cs
@@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
IDLE,
RD, W, PCl, PCh,
INC16, PCl, PCh,
- COND_CHECK, cond, (ushort)0,
+ COND_CHECK, cond, 0,
IDLE,
ASGN, Z, 0,
IDLE,
diff --git a/src/BizHawk.Emulation.Cores/CPUs/MC6800/Operations.cs b/src/BizHawk.Emulation.Cores/CPUs/MC6800/Operations.cs
index ea74430924..eab346e9e6 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/MC6800/Operations.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/MC6800/Operations.cs
@@ -382,7 +382,7 @@ namespace BizHawk.Emulation.Cores.Components.MC6800
}
if (FlagC || (((a >> 4) & 0xF) > 9) || ((((a >> 4) & 0xF) > 8) && ((a & 0xF) > 9)))
{
- CF |= (byte)(6 << 4);
+ CF |= 6 << 4;
}
a += CF;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/MC6809/Operations.cs b/src/BizHawk.Emulation.Cores/CPUs/MC6809/Operations.cs
index 2a03682fc9..6259dd9946 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/MC6809/Operations.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/MC6809/Operations.cs
@@ -448,7 +448,7 @@ namespace BizHawk.Emulation.Cores.Components.MC6809
}
if (FlagC || (((a >> 4) & 0xF) > 9) || ((((a >> 4) & 0xF) > 8) && ((a & 0xF) > 9)))
{
- CF |= (byte)(6 << 4);
+ CF |= 6 << 4;
}
a += CF;
diff --git a/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Disassembler.cs b/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Disassembler.cs
index 481e663637..d88c7491ff 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Disassembler.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Disassembler.cs
@@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
- return MOS6502X.Disassemble((ushort)addr, out length, a => m.PeekByte((int)a));
+ return MOS6502X.Disassemble((ushort)addr, out length, a => m.PeekByte(a));
}
}
diff --git a/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs b/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs
index 8bdae2ba4a..56bdb7e631 100644
--- a/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs
+++ b/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs
@@ -1140,7 +1140,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BVS()
{
- branch_taken = FlagV == true;
+ branch_taken = FlagV;
RelBranch_Stage2();
}
@@ -1152,7 +1152,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BMI()
{
- branch_taken = FlagN == true;
+ branch_taken = FlagN;
RelBranch_Stage2();
}
@@ -1164,7 +1164,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BCS()
{
- branch_taken = FlagC == true;
+ branch_taken = FlagC;
RelBranch_Stage2();
}
@@ -1176,7 +1176,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BEQ()
{
- branch_taken = FlagZ == true;
+ branch_taken = FlagZ;
RelBranch_Stage2();
}
@@ -1209,7 +1209,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
if (RDY)
{
_link.DummyReadMemory(PC);
- alu_temp = (byte)PC + (int)(sbyte)opcode2;
+ alu_temp = (byte)PC + (sbyte)opcode2;
PC &= 0xFF00;
PC |= (ushort)(alu_temp & 0xFF);
@@ -1273,7 +1273,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
rdy_freeze = !RDY;
if (RDY)
{
- PC = (ushort)((_link.ReadMemory((ushort)(PC)) << 8) + opcode2);
+ PC = (ushort)((_link.ReadMemory(PC) << 8) + opcode2);
}
}
diff --git a/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IMemoryDomains.cs b/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IMemoryDomains.cs
index 3b8b8959fd..0d1c9da77f 100644
--- a/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IMemoryDomains.cs
+++ b/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IMemoryDomains.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.ITraceable.cs b/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.ITraceable.cs
index fc17a6deb6..b93cec25c7 100644
--- a/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.ITraceable.cs
+++ b/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.ITraceable.cs
@@ -1,5 +1,3 @@
-using System;
-
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
diff --git a/src/BizHawk.Emulation.Cores/Calculators/TI83/TI83Common.cs b/src/BizHawk.Emulation.Cores/Calculators/TI83/TI83Common.cs
index 886bd1206c..2e4f0251e0 100644
--- a/src/BizHawk.Emulation.Cores/Calculators/TI83/TI83Common.cs
+++ b/src/BizHawk.Emulation.Cores/Calculators/TI83/TI83Common.cs
@@ -1,6 +1,4 @@
-using System;
-
-using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Calculators.TI83
{
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.ISettable.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.ISettable.cs
index d04fa67f81..0d50bdd4b0 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.ISettable.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.ISettable.cs
@@ -31,12 +31,12 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// restore user settings to devices
if (_machine != null && _machine.AYDevice != null)
{
- ((AY38912)_machine.AYDevice as AY38912).PanningConfiguration = o.AYPanConfig;
+ ((AY38912)_machine.AYDevice).PanningConfiguration = o.AYPanConfig;
_machine.AYDevice.Volume = o.AYVolume;
}
if (_machine != null && _machine.TapeBuzzer != null)
{
- ((Beeper)_machine.TapeBuzzer as Beeper).Volume = o.TapeVolume;
+ ((Beeper)_machine.TapeBuzzer).Volume = o.TapeVolume;
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.Messaging.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.Messaging.cs
index 0e7d4a297b..3e3b0294d4 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.Messaging.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.Messaging.cs
@@ -419,7 +419,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
int end = _machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].DataPeriods.Count;
double p = 0;
if (end != 0)
- p = ((double)pos / (double)end) * 100.0;
+ p = (pos / (double)end) * 100.0;
sb.Append(p.ToString("N0", NumberFormatInfo.InvariantInfo) + "%");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
@@ -443,7 +443,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
// work out overall position within the tape
p = 0;
- p = ((double)ourPos / (double)cnt) * 100.0;
+ p = (ourPos / (double)cnt) * 100.0;
sb.Append(p.ToString("N0", NumberFormatInfo.InvariantInfo) + "%");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs
index 5d3e7529a6..760bb98a7c 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs
@@ -1,5 +1,4 @@
-using BizHawk.Common;
-using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
using BizHawk.Emulation.Cores.Properties;
using System;
@@ -30,21 +29,21 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
var settings = lp.Settings ?? new AmstradCPCSettings();
var syncSettings = lp.SyncSettings ?? new AmstradCPCSyncSettings();
- PutSyncSettings((AmstradCPCSyncSettings)syncSettings);
- PutSettings((AmstradCPCSettings)settings);
+ PutSyncSettings(syncSettings);
+ PutSettings(settings);
- DeterministicEmulation = ((AmstradCPCSyncSettings)syncSettings).DeterministicEmulation;
+ DeterministicEmulation = syncSettings.DeterministicEmulation;
switch (SyncSettings.MachineType)
{
case MachineType.CPC464:
ControllerDefinition = AmstradCPCControllerDefinition;
- Init(MachineType.CPC464, _files, ((AmstradCPCSyncSettings)syncSettings).AutoStartStopTape,
- ((AmstradCPCSyncSettings)syncSettings).BorderType);
+ Init(MachineType.CPC464, _files, syncSettings.AutoStartStopTape,
+ syncSettings.BorderType);
break;
case MachineType.CPC6128:
ControllerDefinition = AmstradCPCControllerDefinition;
- Init(MachineType.CPC6128, _files, ((AmstradCPCSyncSettings)syncSettings).AutoStartStopTape, ((AmstradCPCSyncSettings)syncSettings).BorderType);
+ Init(MachineType.CPC6128, _files, syncSettings.AutoStartStopTape, syncSettings.BorderType);
break;
default:
throw new InvalidOperationException("Machine not yet emulated");
@@ -70,20 +69,20 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
ser.Register(new StateSerializer(SyncState));
// initialize sound mixer and attach the various ISoundProvider devices
- SoundMixer = new SoundProviderMixer((int)(32767 / 10), "Tape Audio", (ISoundProvider)_machine.TapeBuzzer);
+ SoundMixer = new SoundProviderMixer(32767 / 10, "Tape Audio", (ISoundProvider)_machine.TapeBuzzer);
if (_machine.AYDevice != null)
SoundMixer.AddSource(_machine.AYDevice, "AY-3-3912");
// set audio device settings
if (_machine.AYDevice != null && _machine.AYDevice.GetType() == typeof(AY38912))
{
- ((AY38912)_machine.AYDevice).PanningConfiguration = ((AmstradCPCSettings)settings).AYPanConfig;
- _machine.AYDevice.Volume = ((AmstradCPCSettings)settings).AYVolume;
+ ((AY38912)_machine.AYDevice).PanningConfiguration = settings.AYPanConfig;
+ _machine.AYDevice.Volume = settings.AYVolume;
}
if (_machine.TapeBuzzer != null)
{
- ((Beeper)_machine.TapeBuzzer).Volume = ((AmstradCPCSettings)settings).TapeVolume;
+ ((Beeper)_machine.TapeBuzzer).Volume = settings.TapeVolume;
}
ser.Register(SoundMixer);
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Datacorder/DatacorderDevice.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Datacorder/DatacorderDevice.cs
index 5adefec4ce..5670a8547d 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Datacorder/DatacorderDevice.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Datacorder/DatacorderDevice.cs
@@ -605,7 +605,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
// update lastCycle and return currentstate
- _lastCycle = cpuCycle - (long)cycles;
+ _lastCycle = cpuCycle - cycles;
// play the buzzer
//_buzzer.ProcessPulseValue(false, currentState);
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPD765.Timing.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPD765.Timing.cs
index 29555c75f9..f269e7a3c6 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPD765.Timing.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPD765.Timing.cs
@@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
long dPerSecond = (long)(frameSize * dRate);
DriveCyclesPerMs = dPerSecond / 1000;
- long TStatesPerDriveCycle = (long)((double)_machine.GateArray.Z80ClockSpeed / DriveClock);
+ long TStatesPerDriveCycle = (long)(_machine.GateArray.Z80ClockSpeed / DriveClock);
StatesPerDriveTick = TStatesPerDriveCycle;
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPS765.Static.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPS765.Static.cs
index 44cbe24081..ae70ad7a2f 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPS765.Static.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Disk/NECUPS765.Static.cs
@@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (bitNumber < 0 || bitNumber > 7)
return;
- int db = (int)dataByte;
+ int db = dataByte;
db |= 1 << bitNumber;
@@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (bitNumber < 0 || bitNumber > 7)
return;
- int db = (int)dataByte;
+ int db = dataByte;
db &= ~(1 << bitNumber);
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Display/CRCT_6845.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Display/CRCT_6845.cs
index a84e66c9bd..d1f6d33d9b 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Display/CRCT_6845.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Display/CRCT_6845.cs
@@ -78,37 +78,37 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
///
/// The total frame width (in characters)
///
- public int FrameWidth => (int)Regs[HOR_TOTAL] + 1;
+ public int FrameWidth => Regs[HOR_TOTAL] + 1;
///
/// The total frame height (in scanlines)
///
- public int FrameHeight => ((int)Regs[VER_TOTAL] + 1) * ((int)Regs[MAX_RASTER_ADDR] + 1);
+ public int FrameHeight => (Regs[VER_TOTAL] + 1) * (Regs[MAX_RASTER_ADDR] + 1);
///
/// The total frame height (in scanlines)
///
- public int FrameHeightInChars => ((int)Regs[VER_TOTAL] + 1);
+ public int FrameHeightInChars => (Regs[VER_TOTAL] + 1);
///
/// The width of the display area (in characters)
///
- public int DisplayWidth => (int)Regs[HOR_DISPLAYED];
+ public int DisplayWidth => Regs[HOR_DISPLAYED];
///
/// The width of the display area (in scanlines)
///
- public int DisplayHeight => (int)Regs[VER_DISPLAYED] * ((int)Regs[MAX_RASTER_ADDR] + 1);
+ public int DisplayHeight => Regs[VER_DISPLAYED] * (Regs[MAX_RASTER_ADDR] + 1);
///
/// The width of the display area (in scanlines)
///
- public int DisplayHeightInChars => (int)Regs[VER_DISPLAYED];
+ public int DisplayHeightInChars => Regs[VER_DISPLAYED];
///
/// The character at which to start HSYNC
///
- public int HorizontalSyncPos => (int)Regs[HOR_SYNC_POS];
+ public int HorizontalSyncPos => Regs[HOR_SYNC_POS];
///
/// Width (in characters) of the HSYNC
@@ -118,7 +118,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
///
/// The vertical scanline at which to start VSYNC
///
- public int VerticalSyncPos => (int)Regs[VER_SYNC_POS] * ((int)Regs[MAX_RASTER_ADDR] + 1);
+ public int VerticalSyncPos => Regs[VER_SYNC_POS] * (Regs[MAX_RASTER_ADDR] + 1);
///
/// Height (in scanlines) of the VSYNC
@@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
///
/// The number of scanlines in one character (MAXRASTER)
///
- public int ScanlinesPerCharacter => (int)Regs[MAX_RASTER_ADDR] + 1;
+ public int ScanlinesPerCharacter => Regs[MAX_RASTER_ADDR] + 1;
///
/// Returns the starting video page address as specified within R12
@@ -868,7 +868,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
case 9:
case 10:
case 11:
- if ((int)ChipType == 0 || (int)ChipType == 1)
+ if (ChipType is CRCTType.HD6845S or CRCTType.UM6845 or CRCTType.UM6845R)
{
addressed = true;
data = 0;
@@ -877,9 +877,9 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
case 12:
case 13:
addressed = true;
- if ((int)ChipType == 0)
+ if (ChipType is CRCTType.HD6845S or CRCTType.UM6845)
data = Regs[SelectedRegister];
- else if ((int)ChipType == 1)
+ else if (ChipType is CRCTType.UM6845R)
data = 0;
break;
case 14:
@@ -906,12 +906,12 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
else if (SelectedRegister == 31)
{
- if ((int)ChipType == 1)
+ if (ChipType == CRCTType.UM6845R)
{
addressed = true;
data = 0x0ff;
}
- else if ((int)ChipType == 0 || (int)ChipType == 2)
+ else if (ChipType is CRCTType.HD6845S or CRCTType.UM6845 or CRCTType.MC6845)
{
addressed = true;
data = 0;
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/SoundOutput/AY38912.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/SoundOutput/AY38912.cs
index 396409ce5b..0e2134c332 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/SoundOutput/AY38912.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/SoundOutput/AY38912.cs
@@ -583,7 +583,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_tStatesPerFrame = frameTactCount;
_samplesPerFrame = sampleRate / 50; //882
- _tStatesPerSample = (double)frameTactCount / (double)_samplesPerFrame; // 90; //(int)Math.Round(((double)_tStatesPerFrame * 50D) /
+ _tStatesPerSample = frameTactCount / (double)_samplesPerFrame; // 90; //(int)Math.Round(((double)_tStatesPerFrame * 50D) /
//(16D * (double)_sampleRate),
//MidpointRounding.AwayFromZero);
_audioBuffer = new short[_samplesPerFrame * 2];
@@ -609,7 +609,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// get the current length of the audiobuffer
int bufferLength = _samplesPerFrame; // _audioBuffer.Length;
- double toEnd = ((double)(bufferLength * cycle) / (double)_tStatesPerFrame);
+ double toEnd = (bufferLength * cycle / (double)_tStatesPerFrame);
// loop through the number of samples we need to render
while (_audioBufferIndex < toEnd)
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Disk/FloppyDisk.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Disk/FloppyDisk.cs
index 539c907807..8b77b899b3 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Disk/FloppyDisk.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Disk/FloppyDisk.cs
@@ -126,7 +126,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// deterministic 'random' implementation
int n = origData[i] + m + 1;
if (n > 0xff)
- n = n - 0xff;
+ n -= 0xff;
else if (n < 0)
n = 0xff + n;
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Tape/CDT/CdtConverter.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Tape/CDT/CdtConverter.cs
index 911d53f129..8591e2f000 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Tape/CDT/CdtConverter.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Media/Tape/CDT/CdtConverter.cs
@@ -76,7 +76,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
for (int i = 0; i < origPeriods; i++)
{
int orig = db.DataPeriods[i];
- int np = (int)((double)orig * multiplier);
+ int np = (int)(orig * multiplier);
int nnp = ClockAdjust(orig);
tb.DataPeriods.Add(np);
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs
index de5823ed8d..9bc3ec6539 100644
--- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/SoundProviderMixer.cs
@@ -1,7 +1,6 @@
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
-using System.Linq;
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
{
diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
index 703a7f51a7..9cb55e5548 100644
--- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
@@ -15,8 +15,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
[CoreConstructor(VSystemID.Raw.C64)]
public C64(CoreLoadParameters lp)
{
- PutSyncSettings((C64SyncSettings)lp.SyncSettings ?? new C64SyncSettings());
- PutSettings((C64Settings)lp.Settings ?? new C64Settings());
+ PutSyncSettings(lp.SyncSettings ?? new C64SyncSettings());
+ PutSettings(lp.Settings ?? new C64Settings());
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Sid.SoundProvider.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Sid.SoundProvider.cs
index 1cc3e97650..cff7a41f8c 100644
--- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Sid.SoundProvider.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Sid.SoundProvider.cs
@@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
for (int i = 0; i < _outputBufferIndex; i++)
{
_mixer = _outputBufferNotFiltered[i] + _outputBufferFiltered[i];
- _mixer = _mixer >> 7;
+ _mixer >>= 7;
_mixer = (_mixer * _volumeAtSampleTime[i]) >> 4;
_mixer -= _volumeAtSampleTime[i] << 8;
diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Disk.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Disk.cs
index 3644ff4805..3ff51cd770 100644
--- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Disk.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Disk.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
using BizHawk.Common;
diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs
index a6a97c3ac4..ae875049ab 100644
--- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/G64.cs
@@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media
var data = trackData[trackIndex];
var buffer = Enumerable.Repeat(dataFillerValue, trackMaxLength).ToArray();
- var dataBytes = data.Select(d => unchecked((byte)d)).ToArray();
+ var dataBytes = data.Select(d => unchecked(d)).ToArray();
Array.Copy(dataBytes, buffer, dataBytes.Length);
trackMemWriter.Write((ushort)dataBytes.Length);
trackMemWriter.Write(buffer);
diff --git a/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs b/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs
index 831df2718d..a7d147424b 100644
--- a/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs
@@ -1,6 +1,5 @@
using BizHawk.Emulation.Common;
using System;
-using System.Text;
namespace BizHawk.Emulation.Cores.Computers.MSX
{
diff --git a/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs b/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs
index 6f4a7f42cb..ad78413d0b 100644
--- a/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs
@@ -29,8 +29,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
// look up game in db before transforming ROM
var hash_md5 = MD5Checksum.ComputePrefixedHex(rom.RomData);
var gi = Database.CheckDatabase(hash_md5);
- var dict = (gi != null) ? gi.GetOptions() : null;
- string s_mapper;
+ var dict = gi?.GetOptions();
Array.Copy(rom.RomData, RomData, RomData.Length);
@@ -56,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
mapper_1 = 3;
Console.WriteLine("Using Ascii 8 KB Mapper");
}
- else if (!dict.TryGetValue("mapper", out s_mapper))
+ else if (!dict.TryGetValue("mapper", out string s_mapper))
{
mapper_1 = 3;
Console.WriteLine("Using Ascii 8 KB Mapper");
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Datacorder/DatacorderDevice.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Datacorder/DatacorderDevice.cs
index e50989e972..eddac7f77a 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Datacorder/DatacorderDevice.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Datacorder/DatacorderDevice.cs
@@ -562,7 +562,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// update lastCycle and return currentstate
- _lastCycle = cpuCycle - (long)cycles;
+ _lastCycle = cpuCycle - cycles;
return currentState;
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.Timing.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.Timing.cs
index 82b6cdcb69..04304bd056 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.Timing.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.Timing.cs
@@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
long dPerSecond = (long)(frameSize * dRate);
DriveCyclesPerMs = dPerSecond / 1000;
- long TStatesPerDriveCycle = (long)((double)_machine.ULADevice.ClockSpeed / DriveClock);
+ long TStatesPerDriveCycle = (long)(_machine.ULADevice.ClockSpeed / DriveClock);
StatesPerDriveTick = TStatesPerDriveCycle;
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPS765.Static.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPS765.Static.cs
index 319951ff3a..1d638fc8d2 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPS765.Static.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPS765.Static.cs
@@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (bitNumber < 0 || bitNumber > 7)
return;
- int db = (int)dataByte;
+ int db = dataByte;
db |= 1 << bitNumber;
@@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (bitNumber < 0 || bitNumber > 7)
return;
- int db = (int)dataByte;
+ int db = dataByte;
db &= ~(1 << bitNumber);
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Input/StandardKeyboard.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Input/StandardKeyboard.cs
index eb9e7eb96c..b799a6f620 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Input/StandardKeyboard.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Input/StandardKeyboard.cs
@@ -166,7 +166,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
lineIndex++;
lines >>= 1;
}
- var result = (byte)status;
+ var result = status;
return result;
}
@@ -248,10 +248,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// mask out lower 4 bits
- result = result & 0x1f;
+ result &= 0x1f;
// set bit 5 & 7 to 1
- result = result | 0xa0;
+ result |= 0xa0;
return true;
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AY38912.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AY38912.cs
index 70f6f17fc4..17e34ae24a 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AY38912.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/SoundOuput/AY38912.cs
@@ -587,8 +587,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
mult_const = ((_chipFrequency / 8) << 14) / _machine.ULADevice.ClockSpeed;
- var aytickspercputick = (double)_machine.ULADevice.ClockSpeed / (double)_chipFrequency;
- int ayCyclesPerSample = (int)((double)_tStatesPerSample * (double)aytickspercputick);
+ var aytickspercputick = _machine.ULADevice.ClockSpeed / (double)_chipFrequency;
+ int ayCyclesPerSample = (int)(_tStatesPerSample * (double)aytickspercputick);
}
///
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/Pentagon128K/Pentagon128.Port.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/Pentagon128K/Pentagon128.Port.cs
index 15fdfd9b04..72889d1b0d 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/Pentagon128K/Pentagon128.Port.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/Pentagon128K/Pentagon128.Port.cs
@@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (lowByte == 0x1f)
{
if (LocateUniqueJoystick(JoystickType.Kempston) != null)
- return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston) as KempstonJoystick).JoyLine;
+ return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston)).JoyLine;
InputRead = true;
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.Port.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.Port.cs
index b0bc16cf01..5aee11266a 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.Port.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.Port.cs
@@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (LocateUniqueJoystick(JoystickType.Kempston) != null)
{
InputRead = true;
- return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston) as KempstonJoystick).JoyLine;
+ return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston)).JoyLine;
}
InputRead = true;
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus2a/ZX128Plus2a.Port.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus2a/ZX128Plus2a.Port.cs
index f5d9f10f2b..6301e8ee43 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus2a/ZX128Plus2a.Port.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus2a/ZX128Plus2a.Port.cs
@@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (LocateUniqueJoystick(JoystickType.Kempston) != null)
{
InputRead = true;
- return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston) as KempstonJoystick).JoyLine;
+ return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston)).JoyLine;
}
InputRead = true;
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus3/ZX128Plus3.Port.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus3/ZX128Plus3.Port.cs
index de2bbe6f5b..1c1a94ccf0 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus3/ZX128Plus3.Port.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128KPlus3/ZX128Plus3.Port.cs
@@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (LocateUniqueJoystick(JoystickType.Kempston) != null)
{
InputRead = true;
- return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston) as KempstonJoystick).JoyLine;
+ return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston)).JoyLine;
}
InputRead = true;
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Port.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Port.cs
index afdfed943a..0ef9edc856 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Port.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Port.cs
@@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (LocateUniqueJoystick(JoystickType.Kempston) != null)
{
InputRead = true;
- return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston) as KempstonJoystick).JoyLine;
+ return (byte)((KempstonJoystick)LocateUniqueJoystick(JoystickType.Kempston)).JoyLine;
}
// not a lag frame
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Disk/FloppyDisk.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Disk/FloppyDisk.cs
index a0a9ca1e41..760a0507ed 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Disk/FloppyDisk.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Disk/FloppyDisk.cs
@@ -126,7 +126,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// deterministic 'random' implementation
int n = origData[i] + m + 1;
if (n > 0xff)
- n = n - 0xff;
+ n -= 0xff;
else if (n < 0)
n = 0xff + n;
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/PZX/PzxConverter.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/PZX/PzxConverter.cs
index 5393316afb..aa487e45e4 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/PZX/PzxConverter.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/PZX/PzxConverter.cs
@@ -244,7 +244,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
t.InitialPulseLevel = initPulseLevel == 1;
bool bLevel = !t.InitialPulseLevel;
- dCount = (int)(dCount & 0x7FFFFFFF);
+ dCount &= 0x7FFFFFFF;
pos += 4;
tail = GetWordValue(b, pos);
@@ -277,11 +277,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
for (int i = 7; i >= 0; i--)
{
- if (by.Bit(i) == true)
+ if (by.Bit(i))
{
foreach (var pu in s1)
{
- t.DataPeriods.Add((int)pu);
+ t.DataPeriods.Add(pu);
bLevel = !bLevel;
t.DataLevels.Add(bLevel);
}
@@ -291,7 +291,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
foreach (var pu in s0)
{
- t.DataPeriods.Add((int)pu);
+ t.DataPeriods.Add(pu);
bLevel = !bLevel;
t.DataLevels.Add(bLevel);
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TAP/TapConverter.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TAP/TapConverter.cs
index dca42b861a..1abb0e77ee 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TAP/TapConverter.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/TAP/TapConverter.cs
@@ -339,7 +339,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// add the last byte
- for (byte c = 0x80; c != (byte)(0x80 >> BIT_COUNT_IN_LAST); c >>= 1)
+ for (byte c = 0x80; c != 0x80 >> BIT_COUNT_IN_LAST; c >>= 1)
{
if ((blockdata[pos] & c) != 0)
{
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavConverter.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavConverter.cs
index 2b092d2897..cf498216cb 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavConverter.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavConverter.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
@@ -108,7 +107,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
smpCounter++;
if ((state < 0 && sample < 0) || (state >= 0 && sample >= 0))
continue;
- t.DataPeriods.Add((int)(((double)smpCounter * (double)rate) / (double)0.9838560885608856));
+ t.DataPeriods.Add((int)((smpCounter * (double)rate) / (double)0.9838560885608856));
currLevel = !currLevel;
t.DataLevels.Add(currLevel);
smpCounter = 0;
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavHeader.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavHeader.cs
index 1dcb626e61..5787213a9d 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavHeader.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Media/Tape/WAV/WavHeader.cs
@@ -43,12 +43,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
throw new FormatException($"Not supported RIFF type: '{Encoding.ASCII.GetString(BitConverter.GetBytes(riffType))}'");
}
- int chunkId;
- int chunkSize;
while (stream.Position < stream.Length)
{
- StreamHelper.Read(stream, out chunkId);
- StreamHelper.Read(stream, out chunkSize);
+ StreamHelper.Read(stream, out int chunkId);
+ StreamHelper.Read(stream, out int chunkSize);
string strChunkId = Encoding.ASCII.GetString(
BitConverter.GetBytes(chunkId));
if (strChunkId == "fmt ")
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs
index c73fc395f8..cc560ad184 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Messaging.cs
@@ -391,7 +391,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
int end = _machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].DataPeriods.Count;
double p = 0;
if (end != 0)
- p = ((double)pos / (double)end) * 100.0;
+ p = (pos / (double)end) * 100.0;
sb.Append(p.ToString("N0", NumberFormatInfo.InvariantInfo) + "%");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
@@ -415,7 +415,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// work out overall position within the tape
p = 0;
- p = ((double)ourPos / (double)cnt) * 100.0;
+ p = (ourPos / (double)cnt) * 100.0;
sb.Append(p.ToString("N0", NumberFormatInfo.InvariantInfo) + "%");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
}
diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs
index f9ccaa0a70..d4460aa83a 100644
--- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs
+++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs
@@ -1,5 +1,4 @@
-using BizHawk.Common;
-using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
using BizHawk.Emulation.Cores.Properties;
using System;
@@ -41,12 +40,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
var joysticks = new List
{
- ((ZXSpectrumSyncSettings)syncSettings).JoystickType1,
- ((ZXSpectrumSyncSettings)syncSettings).JoystickType2,
- ((ZXSpectrumSyncSettings)syncSettings).JoystickType3
+ syncSettings.JoystickType1,
+ syncSettings.JoystickType2,
+ syncSettings.JoystickType3
};
- DeterministicEmulation = ((ZXSpectrumSyncSettings)syncSettings).DeterministicEmulation;
+ DeterministicEmulation = syncSettings.DeterministicEmulation;
if (lp.DeterministicEmulationRequested)
{
@@ -113,8 +112,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// initialize sound mixer and attach the various ISoundProvider devices
SoundMixer = new SyncSoundMixer(targetSampleCount: 882);
- SoundMixer.PinSource(_machine.BuzzerDevice, "System Beeper", (int)(32767 / 10));
- SoundMixer.PinSource(_machine.TapeBuzzer, "Tape Audio", (int)(32767 / 10));
+ SoundMixer.PinSource(_machine.BuzzerDevice, "System Beeper", 32767 / 10);
+ SoundMixer.PinSource(_machine.TapeBuzzer, "Tape Audio", 32767 / 10);
if (_machine.AYDevice != null)
{
SoundMixer.PinSource(_machine.AYDevice, "AY-3-3912");
@@ -123,18 +122,18 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// set audio device settings
if (_machine.AYDevice != null && _machine.AYDevice.GetType() == typeof(AY38912))
{
- ((AY38912)_machine.AYDevice).PanningConfiguration = ((ZXSpectrumSettings)settings).AYPanConfig;
- _machine.AYDevice.Volume = ((ZXSpectrumSettings)settings).AYVolume;
+ ((AY38912)_machine.AYDevice).PanningConfiguration = settings.AYPanConfig;
+ _machine.AYDevice.Volume = settings.AYVolume;
}
if (_machine.BuzzerDevice != null)
{
- _machine.BuzzerDevice.Volume = ((ZXSpectrumSettings)settings).EarVolume;
+ _machine.BuzzerDevice.Volume = settings.EarVolume;
}
if (_machine.TapeBuzzer != null)
{
- _machine.TapeBuzzer.Volume = ((ZXSpectrumSettings)settings).TapeVolume;
+ _machine.TapeBuzzer.Volume = settings.TapeVolume;
}
DCFilter dc = new DCFilter(SoundMixer, 512);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
index aedd6d4ec9..babcfed61b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
@@ -27,8 +27,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
ServiceProvider = ser;
_ram = new byte[128];
- Settings = (A2600Settings)settings ?? new A2600Settings();
- SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();
+ Settings = settings ?? new A2600Settings();
+ SyncSettings = syncSettings ?? new A2600SyncSettings();
_controllerDeck = new Atari2600ControllerDeck(SyncSettings.Port1, SyncSettings.Port2);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600Controllers.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600Controllers.cs
index 73de38020a..47cc13cfb8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600Controllers.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600Controllers.cs
@@ -148,7 +148,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public int Read_Pot(IController c, int pot)
{
- int x = (int)c.AxisValue(Definition.Axes[pot]);
+ int x = c.AxisValue(Definition.Axes[pot]);
x = -x;
x += 127;
@@ -266,7 +266,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
byte temp2 = 0;
int temp1 = (int)Math.Floor(angle / 45);
- temp1 = temp1 % 4;
+ temp1 %= 4;
if (temp1 == 0)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.ISoundProvider.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.ISoundProvider.cs
index b91f8b9f75..95a73b0e56 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.ISoundProvider.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.ISoundProvider.cs
@@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// convert from 31khz to 44khz
for (var i = 0; i < samples.Length / 2; i++)
{
- samples[i * 2] = samples31Khz[(int)(((double)samples31Khz.Length / (double)(samples.Length / 2)) * i)];
+ samples[i * 2] = samples31Khz[(int)((samples31Khz.Length / (double)(samples.Length / 2)) * i)];
samples[(i * 2) + 1] = samples[i * 2];
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs
index ea000557da..38eca51957 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.cs
@@ -94,8 +94,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
_blip.SetRates(1789773, 44100);
- _settings = (A7800Settings)settings ?? new A7800Settings();
- _syncSettings = (A7800SyncSettings)syncSettings ?? new A7800SyncSettings();
+ _settings = settings ?? new A7800Settings();
+ _syncSettings = syncSettings ?? new A7800SyncSettings();
_controllerDeck = new A7800HawkControllerDeck(_syncSettings.Port1, _syncSettings.Port2);
var highscoreBios = comm.CoreFileProvider.GetFirmware(new("A78", "Bios_HSC"), "Some functions may not work without the high score BIOS.");
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSG.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSG.cs
index a8a47dda96..231dc9d5c1 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSG.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSG.cs
@@ -1,6 +1,5 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
-using System;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Maria.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Maria.cs
index 9ae9f74da9..5997032234 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Maria.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Maria.cs
@@ -359,7 +359,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
global_write_mode = temp.Bit(7);
GFX_Objects[header_counter].ind_mode = temp.Bit(5);
header_pointer++;
- temp = (byte)(ReadMemory((ushort)(current_DLL_addr + header_pointer)));
+ temp = ReadMemory((ushort)(current_DLL_addr + header_pointer));
GFX_Objects[header_counter].addr |= (ushort)(temp << 8);
header_pointer++;
temp = ReadMemory((ushort)(current_DLL_addr + header_pointer));
@@ -372,7 +372,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
}
else
{
- temp_w = (temp_w - 1);
+ temp_w--;
temp_w = (0x1F - temp_w);
GFX_Objects[header_counter].width = (byte)(temp_w & 0x1F);
}
@@ -390,13 +390,13 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
else
{
int temp_w = (temp & 0x1F); // this is the 2's complement of width (for reasons that escape me)
- temp_w = (temp_w - 1);
+ temp_w--;
temp_w = (0x1F - temp_w);
GFX_Objects[header_counter].width = (byte)(temp_w & 0x1F);
GFX_Objects[header_counter].palette = (byte)((temp & 0xE0) >> 5);
header_pointer++;
- temp = (byte)(ReadMemory((ushort)(current_DLL_addr + header_pointer)));
+ temp = ReadMemory((ushort)(current_DLL_addr + header_pointer));
GFX_Objects[header_counter].addr |= (ushort)(temp << 8);
header_pointer++;
GFX_Objects[header_counter].h_pos = ReadMemory((ushort)(current_DLL_addr + header_pointer));
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs
index 0e0c9ed63b..ce6a6cb15f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/MemoryMap.cs
@@ -12,8 +12,6 @@ SHADOW
7. RAM 001X X000 0000 0000 - 001X X111 1111 1111
*/
-using System;
-
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
public partial class A7800Hawk
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs b/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs
index 62e4b40ba6..76fe74d9e6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs
@@ -150,7 +150,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
byte temp2 = 0;
int temp1 = (int)Math.Floor(angle / 1.25);
- temp1 = temp1 % 4;
+ temp1 %= 4;
if (temp1 == 0)
{
@@ -252,7 +252,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
byte temp2 = 0;
int temp1 = (int)Math.Floor(angle / 1.25);
- temp1 = temp1 % 4;
+ temp1 %= 4;
if (temp1 == 0)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs b/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs
index bb8f216120..232400c178 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs
@@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
- _syncSettings = (ColecoSyncSettings)syncSettings ?? new ColecoSyncSettings();
+ _syncSettings = syncSettings ?? new ColecoSyncSettings();
bool skipBios = _syncSettings.SkipBiosIntro;
_cpu = new Z80A
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Coleco/SN76489col.cs b/src/BizHawk.Emulation.Cores/Consoles/Coleco/SN76489col.cs
index b558dab3ed..fa6238f0e8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Coleco/SN76489col.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Coleco/SN76489col.cs
@@ -160,14 +160,14 @@ namespace BizHawk.Emulation.Cores.ColecoVision
if (noise_type)
{
int bit = (noise & 1) ^ ((noise >> 1) & 1);
- noise = noise >> 1;
+ noise >>= 1;
noise |= bit << 14;
}
else
{
int bit = noise & 1;
- noise = noise >> 1;
+ noise >>= 1;
noise |= bit << 14;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Audio.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Audio.cs
index 508cc1bf95..39ec65e9aa 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Audio.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Audio.cs
@@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
Period = 1.0 / SampleRate;
SamplesPerFrame = (int)(SampleRate / refreshRate);
- CyclesPerSample = (double)ClockPerFrame / (double)SamplesPerFrame;
+ CyclesPerSample = ClockPerFrame / (double)SamplesPerFrame;
SampleBuffer = new short[SamplesPerFrame];
_blip = new BlipBuffer(SamplesPerFrame);
_blip.SetRates(ClockPerFrame * refreshRate, SampleRate);
@@ -49,16 +49,16 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
else
{
int SamplesPerWave = (int)(SampleRate / tone_freqs[tone]);
- double RadPerSample = (Math.PI * 2) / (double) SamplesPerWave;
+ double RadPerSample = (Math.PI * 2) / SamplesPerWave;
double SinVal = 0;
- int NumSamples = (int)(((double)FrameClock - (double)lastCycle) / CyclesPerSample);
+ int NumSamples = (int)((FrameClock - (double)lastCycle) / CyclesPerSample);
int startPos = lastCycle;
for (int i = 0; i < NumSamples; i++)
{
- SinVal = Math.Sin(RadPerSample * (double) (i * SamplesPerWave));
+ SinVal = Math.Sin(RadPerSample * (i * SamplesPerWave));
_blip.AddDelta((uint)startPos, (int) (Math.Floor(SinVal * 127) + 128) * 1024);
startPos += (int)CyclesPerSample;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_HANG.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_HANG.cs
index 3669709934..15816c65c7 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_HANG.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_HANG.cs
@@ -1,10 +1,4 @@
-
-using BizHawk.Common;
-using BizHawk.Common.NumberExtensions;
-using System;
-using System.Collections;
-
-namespace BizHawk.Emulation.Cores.Consoles.ChannelF
+namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
///
/// Hangman ChannelF Cartridge
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_MAZE.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_MAZE.cs
index df851e1e06..391a84cc1c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_MAZE.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_MAZE.cs
@@ -1,10 +1,4 @@
-
-using BizHawk.Common;
-using BizHawk.Common.NumberExtensions;
-using System;
-using System.Collections;
-
-namespace BizHawk.Emulation.Cores.Consoles.ChannelF
+namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
///
/// ChannelF Cartridge that utilises 2102 SRAM over IO
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_SCHACH.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_SCHACH.cs
index 132bf82d7b..35a527d44f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_SCHACH.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_SCHACH.cs
@@ -1,8 +1,4 @@
-
-using BizHawk.Common;
-using System;
-
-namespace BizHawk.Emulation.Cores.Consoles.ChannelF
+namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
///
/// Saba Schach Mapper
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_STD.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_STD.cs
index d12f9ab482..93ddc4d786 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_STD.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Cart/mapper_STD.cs
@@ -1,8 +1,4 @@
-
-using BizHawk.Common;
-using System;
-
-namespace BizHawk.Emulation.Cores.Consoles.ChannelF
+namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
///
/// Standard ChannelF Cartridge
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.IVideoProvider.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.IVideoProvider.cs
index 742dc03ce2..630e86d2e0 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.IVideoProvider.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.IVideoProvider.cs
@@ -63,7 +63,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
//public int _frameHz => region == RegionType.NTSC ? 60 : 50;
public int[] CroppedBuffer = new int[102 * 58];
public int VirtualWidth => BufferWidth * 4;
- public int VirtualHeight => (int)((double)BufferHeight * 1.43) * 4;
+ public int VirtualHeight => (int)(BufferHeight * 1.43) * 4;
public int BufferWidth => 102; //128
public int BufferHeight => 58; //64
public int BackgroundColor => Colors.ARGB(0xFF, 0xFF, 0xFF);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.InputPollable.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.InputPollable.cs
index 20af8691dd..e4ce1a40f3 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.InputPollable.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.InputPollable.cs
@@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
StateConsole[i] = currState;
noInput = false;
- if (key == "RESET" && StateConsole[i] == true)
+ if (key == "RESET" && StateConsole[i])
{
CPU.Reset();
for (int l = 0; l < OutputLatch.Length; l++)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs
index a838db5fa7..ddc8206bdd 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.FairchildF8;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Ports.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Ports.cs
index 7a6bd50d3c..de6c30f28d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Ports.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Ports.cs
@@ -131,7 +131,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
default:
// possible write to cartridge hardware
- Cartridge.WritePort(addr, (byte)(value));
+ Cartridge.WritePort(addr, value);
break;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Video.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Video.cs
index 4b2d8b2596..33bbce1a1f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Video.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/Video.cs
@@ -1,6 +1,4 @@
-using BizHawk.Common;
-
-namespace BizHawk.Emulation.Cores.Consoles.ChannelF
+namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
///
/// Video related functions
diff --git a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs
index a9ed4171fa..aac5341308 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs
@@ -40,8 +40,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{
if (skip == 0)
{
- x_pos = x_pos + (x_vel - 128.0) / 256.0 * (vec_scale + 2);
- y_pos = y_pos - (y_vel - 128.0) / 256.0 * (vec_scale + 2);
+ x_pos += (x_vel - 128.0) / 256.0 * (vec_scale + 2);
+ y_pos -= (y_vel - 128.0) / 256.0 * (vec_scale + 2);
}
else
{
@@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
for (int i = 0; i < line_pointer; i++)
{
- if (line_vis[i] == true)
+ if (line_vis[i])
{
start_x = draw_lines[i * 4];
start_y = draw_lines[i * 4 + 1];
@@ -200,7 +200,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
for (int i = 0; i < line_pointer_old_screen; i++)
{
- if (line_vis_old_screen[i] == true)
+ if (line_vis_old_screen[i])
{
start_x = draw_lines_old_screen[i * 4];
start_y = draw_lines_old_screen[i * 4 + 1];
diff --git a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs
index 4351765001..1142efd525 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.cs
@@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
serialport = new SerialPort();
_settings = new object(); // TODO: wtf is this
- _syncSettings = (VectrexSyncSettings)syncSettings ?? new VectrexSyncSettings();
+ _syncSettings = syncSettings ?? new VectrexSyncSettings();
_controllerDeck = new VectrexHawkControllerDeck(_syncSettings.Port1, _syncSettings.Port2);
/*var Bios =*/ _bios = comm.CoreFileProvider.GetFirmwareOrThrow(new("VEC", "Bios"), "BIOS Not Found, Cannot Load");
@@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
ServiceProvider = ser;
_settings = new object(); // TODO: wtf is this
- _syncSettings = (VectrexSyncSettings)syncSettings ?? new VectrexSyncSettings();
+ _syncSettings = syncSettings ?? new VectrexSyncSettings();
_tracer = new TraceBuffer(cpu.TraceHeader);
ser.Register(_tracer);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Controllers/IntellivisionControllers.cs b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Controllers/IntellivisionControllers.cs
index 7bd0304508..376b35cdd8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Controllers/IntellivisionControllers.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Controllers/IntellivisionControllers.cs
@@ -154,8 +154,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
}
- int x = (int)c.AxisValue(Definition.Axes[0]);
- int y = (int)c.AxisValue(Definition.Axes[1]);
+ int x = c.AxisValue(Definition.Axes[0]);
+ int y = c.AxisValue(Definition.Axes[1]);
result |= CalcDirection(x, y);
return result;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs
index 13dd422c4d..4c9de47561 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs
@@ -16,8 +16,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
_rom = rom;
- _settings = (IntvSettings)settings ?? new IntvSettings();
- _syncSettings = (IntvSyncSettings)syncSettings ?? new IntvSyncSettings();
+ _settings = settings ?? new IntvSettings();
+ _syncSettings = syncSettings ?? new IntvSyncSettings();
_controllerDeck = new IntellivisionControllerDeck(_syncSettings.Port1, _syncSettings.Port2);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/PSG.cs b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/PSG.cs
index 72c3ad7b81..3f3c24bcf8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/PSG.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/PSG.cs
@@ -146,7 +146,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
{
if (addr >= 0x01F0 && addr <= 0x01FF)
{
- return (ushort)(Register[addr - 0x01F0]);
+ return Register[addr - 0x01F0];
}
return null;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/STIC.cs b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/STIC.cs
index a1c812f63b..ec49aa5d55 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Intellivision/STIC.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Intellivision/STIC.cs
@@ -140,7 +140,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
else if (reg < 0x28)
{
- value = (ushort)(0x3FFF);
+ value = 0x3FFF;
}
else if (reg < 0x2D)
{
@@ -148,7 +148,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
else if (reg < 0x30)
{
- value = (ushort)(0x3FFF);
+ value = 0x3FFF;
}
else if (reg < 0x33)
{
@@ -163,7 +163,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
else if (reg < 0x40)
{
- value = (ushort)(0x3FFF);
+ value = 0x3FFF;
}
Register[reg] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs b/src/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs
index c0b7d5cb47..13b4274582 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs
@@ -323,7 +323,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
{
VDC_status &= 0xFE;
if (VDC_ctrl.Bit(0)) { Core.cpu.IRQPending = false; }
- LY_ret = LY_ret + 1;
+ LY_ret++;
}
}
@@ -1555,7 +1555,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
{
VDC_status &= 0xFE;
if (VDC_ctrl.Bit(0)) { Core.cpu.IRQPending = false; }
- LY_ret = LY_ret + 1;
+ LY_ret++;
}
}
@@ -1638,7 +1638,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
{
VDC_status &= 0xFE;
if (VDC_ctrl.Bit(0)) { Core.cpu.IRQPending = false; }
- LY_ret = LY_ret + 1;
+ LY_ret++;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs
index 53c8a6dc3a..aef73aec30 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs
@@ -270,7 +270,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (SQ1_shift > 0)
{
int shadow_frq = SQ1_frq_shadow;
- shadow_frq = shadow_frq >> SQ1_shift;
+ shadow_frq >>= SQ1_shift;
if (SQ1_negate) { shadow_frq = -shadow_frq; }
shadow_frq += SQ1_frq_shadow;
@@ -727,7 +727,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (NOISE_wdth_md)
{
- NOISE_LFSR = NOISE_LFSR & 0x7FBF;
+ NOISE_LFSR &= 0x7FBF;
NOISE_LFSR |= (bit_lfsr << 6);
}
@@ -782,7 +782,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if ((SQ1_swp_prd > 0))
{
int shadow_frq = SQ1_frq_shadow;
- shadow_frq = shadow_frq >> SQ1_shift;
+ shadow_frq >>= SQ1_shift;
if (SQ1_negate) { shadow_frq = -shadow_frq; }
shadow_frq += SQ1_frq_shadow;
@@ -809,7 +809,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
// after writing, we repeat the process and do another overflow check
shadow_frq = SQ1_frq_shadow;
- shadow_frq = shadow_frq >> SQ1_shift;
+ shadow_frq >>= SQ1_shift;
if (SQ1_negate) { shadow_frq = -shadow_frq; }
shadow_frq += SQ1_frq_shadow;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBA_Init_State.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBA_Init_State.cs
index 27404f36d3..baafbf52ae 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBA_Init_State.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBA_Init_State.cs
@@ -1,7 +1,4 @@
-using BizHawk.Emulation.Common;
-using System;
-
-// This RAM state has been verified by TiKevin83 and CasualPokeplayer on various GBA consoles
+// This RAM state has been verified by TiKevin83 and CasualPokeplayer on various GBA consoles
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_GB_PPU.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_GB_PPU.cs
index 97e79b2048..85581c19b7 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_GB_PPU.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_GB_PPU.cs
@@ -989,7 +989,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
read_case_prev = 0;
// calculate the row number of the tiles to be fetched
- y_tile = (((int)scroll_y + LY) >> 3) % 32;
+ y_tile = ((scroll_y + LY) >> 3) % 32;
x_tile = scroll_x >> 3;
temp_fetch = y_tile * 32 + (x_tile + tile_inc) % 32;
@@ -1816,7 +1816,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
uint retG = ((G * 3 + B) << 1) & 0xFF;
uint retB = ((R * 3 + G * 2 + B * 11) >> 1) & 0xFF;
- BG_palette[BG_bytes_index >> 1] = (uint)(0xFF000000 | (retR << 16) | (retG << 8) | retB);
+ BG_palette[BG_bytes_index >> 1] = 0xFF000000 | (retR << 16) | (retG << 8) | retB;
}
public void color_compute_OBJ()
@@ -1842,7 +1842,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
uint retG = ((G * 3 + B) << 1) & 0xFF;
uint retB = ((R * 3 + G * 2 + B * 11) >> 1) & 0xFF;
- OBJ_palette[OBJ_bytes_index >> 1] = (uint)(0xFF000000 | (retR << 16) | (retG << 8) | retB);
+ OBJ_palette[OBJ_bytes_index >> 1] = 0xFF000000 | (retR << 16) | (retG << 8) | retB;
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs
index 5b777d3380..84d8bb7562 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs
@@ -996,7 +996,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
read_case_prev = 0;
// calculate the row number of the tiles to be fetched
- y_tile = (((int)scroll_y + LY) >> 3) % 32;
+ y_tile = ((scroll_y + LY) >> 3) % 32;
x_tile = scroll_x >> 3;
temp_fetch = y_tile * 32 + (x_tile + tile_inc) % 32;
@@ -1760,7 +1760,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
uint retG = ((G * 3 + B) << 1) & 0xFF;
uint retB = ((R * 3 + G * 2 + B * 11) >> 1) & 0xFF;
- BG_palette[BG_bytes_index >> 1] = (uint)(0xFF000000 | (retR << 16) | (retG << 8) | retB);
+ BG_palette[BG_bytes_index >> 1] = 0xFF000000 | (retR << 16) | (retG << 8) | retB;
}
public void color_compute_OBJ()
@@ -1786,7 +1786,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
uint retG = ((G * 3 + B) << 1) & 0xFF;
uint retB = ((R * 3 + G * 2 + B * 11) >> 1) & 0xFF;
- OBJ_palette[OBJ_bytes_index >> 1] = (uint)(0xFF000000 | (retR << 16) | (retG << 8) | retB);
+ OBJ_palette[OBJ_bytes_index >> 1] = 0xFF000000 | (retR << 16) | (retG << 8) | retB;
}
public override void SyncState(Serializer ser)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs
index d8c0b401db..49eeb27e63 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs
@@ -1,7 +1,6 @@
using BizHawk.Common.NumberExtensions;
using BizHawk.Emulation.Common;
using System;
-using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
@@ -382,7 +381,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
if (is_GBC)
{
- for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)(frame_buffer[j] | (0x30303 << (clear_counter * 2))); }
+ for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = frame_buffer[j] | (0x30303 << (clear_counter * 2)); }
clear_counter++;
if (clear_counter == 4)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs
index 6750ccd5a9..b3c68f1da4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.cs
@@ -152,7 +152,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
serialport = new SerialPort();
_ = PutSettings(settings ?? new GBSettings());
- _syncSettings = (GBSyncSettings)syncSettings ?? new GBSyncSettings();
+ _syncSettings = syncSettings ?? new GBSyncSettings();
is_GBC = _syncSettings.ConsoleMode switch
{
@@ -211,7 +211,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
ServiceProvider = ser;
_ = PutSettings(settings ?? new GBSettings());
- _syncSettings = (GBSyncSettings)syncSettings ?? new GBSyncSettings();
+ _syncSettings = syncSettings ?? new GBSyncSettings();
_tracer = new TraceBuffer(cpu.TraceHeader);
ser.Register(_tracer);
@@ -684,13 +684,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
mapper.RTC_Get(hours & 0xFF, 2);
- remaining = remaining - (hours * 3600);
+ remaining -= (hours * 3600);
int minutes = (int)Math.Floor(remaining / 60.0);
mapper.RTC_Get(minutes & 0xFF, 1);
- remaining = remaining - (minutes * 60);
+ remaining -= (minutes * 60);
mapper.RTC_Get(remaining & 0xFF, 0);
}
@@ -711,7 +711,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
mapper.RTC_Get(days_upper, 20);
mapper.RTC_Get(days & 0xFF, 12);
- remaining = remaining - (days * 86400);
+ remaining -= (days * 86400);
int minutes = (int)Math.Floor(remaining / 60.0);
int minutes_upper = (minutes >> 8) & 0xF;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs
index bbc9e36d7c..de9635e99d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs
@@ -578,7 +578,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
read_case_prev = 0;
// calculate the row number of the tiles to be fetched
- y_tile = (((int)scroll_y + LY) >> 3) % 32;
+ y_tile = ((scroll_y + LY) >> 3) % 32;
x_tile = scroll_x >> 3;
temp_fetch = y_tile * 32 + (x_tile + tile_inc) % 32;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs
index 22bc1c2821..c25e688cac 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC1.cs
@@ -47,10 +47,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
int temp4 = (addr & 0x10);
int temp6 = (addr & 0x40);
- temp0 = temp0 << 6;
- temp1 = temp1 << 3;
- temp4 = temp4 >> 3;
- temp6 = temp6 >> 6;
+ temp0 <<= 6;
+ temp1 <<= 3;
+ temp4 >>= 3;
+ temp6 >>= 6;
addr &= 0x1AC;
addr |= (ushort)(temp0 | temp1 | temp4 | temp6);
@@ -85,10 +85,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
int temp4 = (addr & 0x10);
int temp6 = (addr & 0x40);
- temp0 = temp0 << 6;
- temp1 = temp1 << 3;
- temp4 = temp4 >> 3;
- temp6 = temp6 >> 6;
+ temp0 <<= 6;
+ temp1 <<= 3;
+ temp4 >>= 3;
+ temp6 >>= 6;
addr &= 0x1AC;
addr |= (ushort)(temp0 | temp1 | temp4 | temp6);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs
index 84bedfc472..f326dd172a 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_Sachen_MMC2.cs
@@ -47,10 +47,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
int temp4 = (addr & 0x10);
int temp6 = (addr & 0x40);
- temp0 = temp0 << 6;
- temp1 = temp1 << 3;
- temp4 = temp4 >> 3;
- temp6 = temp6 >> 6;
+ temp0 <<= 6;
+ temp1 <<= 3;
+ temp4 >>= 3;
+ temp6 >>= 6;
addr &= 0x1AC;
addr |= (ushort)(temp0 | temp1 | temp4 | temp6);
@@ -86,10 +86,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
int temp4 = (addr & 0x10);
int temp6 = (addr & 0x40);
- temp0 = temp0 << 6;
- temp1 = temp1 << 3;
- temp4 = temp4 >> 3;
- temp6 = temp6 >> 6;
+ temp0 <<= 6;
+ temp1 <<= 3;
+ temp4 >>= 3;
+ temp6 >>= 6;
addr &= 0x1AC;
addr |= (ushort)(temp0 | temp1 | temp4 | temp6);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/SerialPort.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/SerialPort.cs
index 75d49aaeb6..d2cf7c0823 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/SerialPort.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/SerialPort.cs
@@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (((value & 2) > 0) && Core.GBC_compat)
{
clk_rate = 16;
- serial_clock = 16 - (int)(Core.timer.divider_reg % 8) - 1;
+ serial_clock = 16 - Core.timer.divider_reg % 8 - 1;
// if the clock rate is changing and it's on a GBA/C, the parity of (cpu.totalexecutedcycles & 512) effects the first bit
// Not sure exactly how yet
@@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
else
{
clk_rate = 512;
- serial_clock = 512 - (int)(Core.timer.divider_reg % 256) - 1;
+ serial_clock = 512 - Core.timer.divider_reg % 256 - 1;
// there seems to be some clock inverting happening on some transfers
// not sure of the exact nature of it, here is one method that gives correct result on one test rom but not others
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs
index b555fb7c1d..825b2ea42e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs
@@ -40,8 +40,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
- linkSettings = (GBLinkSettings)lp.Settings ?? new GBLinkSettings();
- linkSyncSettings = (GBLinkSyncSettings)lp.SyncSettings ?? new GBLinkSyncSettings();
+ linkSettings = lp.Settings ?? new GBLinkSettings();
+ linkSyncSettings = lp.SyncSettings ?? new GBLinkSyncSettings();
_controllerDeck = new(
GBHawkControllerDeck.DefaultControllerName,
GBHawkControllerDeck.DefaultControllerName);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.cs
index 23b6d2871c..b3ac4a216b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.cs
@@ -40,8 +40,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
- Link3xSettings = (GBLink3xSettings)lp.Settings ?? new GBLink3xSettings();
- Link3xSyncSettings = (GBLink3xSyncSettings)lp.SyncSettings ?? new GBLink3xSyncSettings();
+ Link3xSettings = lp.Settings ?? new GBLink3xSettings();
+ Link3xSyncSettings = lp.SyncSettings ?? new GBLink3xSyncSettings();
_controllerDeck = new(
GBHawkControllerDeck.DefaultControllerName,
GBHawkControllerDeck.DefaultControllerName,
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink4x/GBHawkLink4x.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink4x/GBHawkLink4x.cs
index 563b7660ce..cc33f7f576 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink4x/GBHawkLink4x.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink4x/GBHawkLink4x.cs
@@ -60,8 +60,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
var ser = new BasicServiceProvider(this);
- Link4xSettings = (GBLink4xSettings)lp.Settings ?? new GBLink4xSettings();
- Link4xSyncSettings = (GBLink4xSyncSettings)lp.SyncSettings ?? new GBLink4xSyncSettings();
+ Link4xSettings = lp.Settings ?? new GBLink4xSettings();
+ Link4xSyncSettings = lp.SyncSettings ?? new GBLink4xSyncSettings();
_controllerDeck = new(
GBHawkControllerDeck.DefaultControllerName,
GBHawkControllerDeck.DefaultControllerName,
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GBColors.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GBColors.cs
index 8abeb88248..49d86db34d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GBColors.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GBColors.cs
@@ -132,7 +132,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
// "gameboy colors" mode on older versions of VBA
private static int gbGetValue(int min, int max, int v)
{
- return (int)(min + (float)(max - min) * (2.0 * (v / 31.0) - (v / 31.0) * (v / 31.0)));
+ return (int)(min + (max - min) * (2.0 * (v / 31.0) - (v / 31.0) * (v / 31.0)));
}
public static Triple OldVBAColor(Triple c, bool sgb, bool agb)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs
index cf035e51ca..a4f7f5c4b9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs
@@ -1,9 +1,6 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
-using Newtonsoft.Json;
-
using BizHawk.Common;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs
index 37d89f58f3..178f0f70f4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs
@@ -1,6 +1,4 @@
-using System;
-
-using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.ITraceable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.ITraceable.cs
index 1fed847e53..1332210c25 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.ITraceable.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.ITraceable.cs
@@ -14,8 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
{
var regs = GetCpuFlagsAndRegisters();
uint pc = (uint)regs["PC"].Value;
- var length = 0;
- var disasm = Disassemble(MemoryDomains.SystemBus, pc, out length);
+ var disasm = Disassemble(MemoryDomains.SystemBus, pc, out int length);
var sb = new StringBuilder();
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs
index 0339160a9d..1f2974cafd 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs
@@ -36,8 +36,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
SaveType = 1;
}
- _syncSettings = (N64SyncSettings)syncSettings ?? new N64SyncSettings();
- _settings = (N64Settings)settings ?? new N64Settings();
+ _syncSettings = syncSettings ?? new N64SyncSettings();
+ _settings = settings ?? new N64Settings();
_disableExpansionSlot = _syncSettings.DisableExpansionSlot;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISaveRam.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISaveRam.cs
index d5c0270603..573a19a6c0 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISaveRam.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.ISaveRam.cs
@@ -1,6 +1,4 @@
using System;
-using System.IO;
-using BizHawk.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
index 3a8cbe1637..697555ec3a 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
@@ -354,7 +354,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank_16k = prg_banks_16k[bank_16k];
addr = (bank_16k << 14) | ofs;
if (jump2)
- addr = addr + (jump2_outer_bank << 18);
+ addr += (jump2_outer_bank << 18);
return Rom[addr];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
index 5477a9af28..214fb46aaa 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
@@ -5,7 +5,6 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
-using System;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
index 280afb72e7..8c5a24ea0b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
@@ -252,7 +252,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int bank_1k = base.Get_CHRBank_1K(addr);
if ((exRegs[1] & 0x4) > 0)
- bank_1k = (bank_1k | 0x100);
+ bank_1k |= 0x100;
else
bank_1k = (bank_1k & 0x7F) | (exRegs[1] << 3 & 0x80);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
index 2b8f5385d1..334bfb1b53 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
@@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
temp = mmc3.prg_regs_8k[i];
if ((exRegs[1] & 0x8) > 0)
- temp = temp & 0x1F;
+ temp &= 0x1F;
else
temp = ((temp & 0x0F) | (exRegs[1] & 0x10));
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs
index 04690ba427..d5d9641ea8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper219.cs
@@ -27,10 +27,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prgregs[2] = 0xFE;
prgregs[3] = 0xFF;
- byte r0_0 = (byte)(0 & ~1);
- byte r0_1 = (byte)(0 | 1);
- byte r1_0 = (byte)(2 & ~1);
- byte r1_1 = (byte)(2 | 1);
+ byte r0_0 = 0 & ~1;
+ byte r0_1 = 0 | 1;
+ byte r1_0 = 2 & ~1;
+ byte r1_1 = 2 | 1;
chrregs[0] = 4;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs
index 810f55d495..d7149fff1c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs
@@ -63,15 +63,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case 0:
prg_banks_8k[0] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[1] = (byte)((prg_high * 2 + 1) ^ prg_low_val);
- prg_high = prg_high | 0x01;
+ prg_high |= 0x01;
prg_banks_8k[2] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[3] = (byte)((prg_high * 2 + 1) ^ prg_low_val);
break;
case 1:
prg_banks_8k[0] = (byte)((prg_high*2+0) ^ prg_low_val);
prg_banks_8k[1] = (byte)((prg_high*2+1) ^ prg_low_val);
- prg_banks_8k[2] = (byte)(0xFE);
- prg_banks_8k[3] = (byte)(0xFF);
+ prg_banks_8k[2] = 0xFE;
+ prg_banks_8k[3] = 0xFF;
//maybe all 4?
break;
case 2:
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
index 2829c21cbd..055d13ae12 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
@@ -99,7 +99,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private int CHR_OR()
{
int temp = regs[2] >> 4;
- temp = temp << 8;
+ temp <<= 8;
int x = regs[0] | (temp);
return x;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs
index 95a941abac..bd253236cb 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs
@@ -109,7 +109,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SetPrg32k(value>>1);
break;
case 0x1FF2: //0x5FF2
- chr_banks_8k[0] = (byte)value;
+ chr_banks_8k[0] = value;
ApplyMemoryMapMask(chr_bank_mask_8k, chr_banks_8k);
break;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper204.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper204.cs
index 06977218b1..7e1a6f095a 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper204.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper204.cs
@@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
_reg1 = addr & 0x6;
_reg2 = _reg1 + ((_reg1 == 0x6) ? 0 : (addr & 1));
- _reg1 = _reg1 + ((_reg1 == 0x6) ? 1 : (addr & 1));
+ _reg1 += ((_reg1 == 0x6) ? 1 : (addr & 1));
SetMirrorType(addr.Bit(0) ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper218.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper218.cs
index 2b312b0e1c..d6ae6bbdcc 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper218.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper218.cs
@@ -58,7 +58,7 @@
if ((addr & chr_addr_mask) != 0)
addr = addr & 0x3ff | 0x400;
else
- addr = addr & 0x3ff;
+ addr &= 0x3ff;
return addr;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
index f167e84583..c62ee92d39 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
@@ -64,12 +64,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//maybe only the multicarts do it, to keep the game from clobbering vram on accident
//vram_protected = o;
- if (o == true && S == false)
+ if (o && S == false)
{
_prgBanks16K[0] = (byte)(p);
_prgBanks16K[1] = (byte)(p);
}
- if (o == true && S == true)
+ if (o && S)
{
_prgBanks16K[0] = (byte)((p & ~1));
_prgBanks16K[1] = (byte)((p & ~1) + 1);
@@ -79,17 +79,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
_prgBanks16K[0] = (byte)p;
_prgBanks16K[1] = (byte)(p & 0x38);
}
- if (o == false && S == true && L == false)
+ if (o == false && S && L == false)
{
_prgBanks16K[0] = (byte)(p & 0x3E);
_prgBanks16K[1] = (byte)(p & 0x38);
}
- if (o == false && S == false && L == true)
+ if (o == false && S == false && L)
{
_prgBanks16K[0] = (byte)p;
_prgBanks16K[1] = (byte)(p | 0x07);
}
- if (o == false && S == true && L == true)
+ if (o == false && S && L)
{
_prgBanks16K[0] = (byte)(p & 0x3E);
_prgBanks16K[1] = (byte)(p | 0x07);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MapperPropAttribute.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MapperPropAttribute.cs
index 9e333acdd8..dc73bfec26 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MapperPropAttribute.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MapperPropAttribute.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Linq;
namespace BizHawk.Emulation.Cores.Nintendo.NES
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
index fb731b3876..cfca9a6d68 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
@@ -359,10 +359,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//patch in vector reading
if (Patch_Vectors)
{
- if (addr == 0x7FFA) return (byte)(NMI_VECTOR & 0xFF);
- else if (addr == 0x7FFB) return (byte)((NMI_VECTOR >> 8) & 0xFF);
- else if (addr == 0x7FFC) return (byte)(RESET_VECTOR & 0xFF);
- else if (addr == 0x7FFD) { return (byte)((RESET_VECTOR >> 8) & 0xFF); }
+ if (addr == 0x7FFA) return NMI_VECTOR & 0xFF;
+ else if (addr == 0x7FFB) return (NMI_VECTOR >> 8) & 0xFF;
+ else if (addr == 0x7FFC) return RESET_VECTOR & 0xFF;
+ else if (addr == 0x7FFD) { return (RESET_VECTOR >> 8) & 0xFF; }
return NES.DB;
}
else
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
index f741d5e5a1..6233c0e4a8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
@@ -143,7 +143,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (NES._isVS)
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
return NES.CIRAM[addr];
@@ -169,7 +169,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr &= 0x2FFF;
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
index 2be163861f..731f27057f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
@@ -167,7 +167,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (NES._isVS)
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
return NES.CIRAM[addr];
@@ -194,7 +194,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
index d40cadd113..f0d74c0090 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
@@ -329,7 +329,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (NES._isVS)
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
return NES.CIRAM[addr];
@@ -356,7 +356,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
index 1ffe5c2543..344e85e50a 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
@@ -273,7 +273,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void ClockCpu()
{
- if (irq_mode == true)
+ if (irq_mode)
{
irq_countdown--;
if (irq_countdown == 0)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
index ba4bfe53dc..736cc040f8 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
@@ -165,8 +165,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if ((exRegs[3] & 0x2)>0)
{
- prg_regs_8k[2] = (byte)(exRegs[4]);
- prg_regs_8k[3] = (byte)(exRegs[5]);
+ prg_regs_8k[2] = exRegs[4];
+ prg_regs_8k[3] = exRegs[5];
}
UpdatePrg();
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
index 038763d1d7..e1d07bc448 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
@@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- bank_1k = bank_1k | (exRegs[2] << 3);
+ bank_1k |= (exRegs[2] << 3);
return Vrom[(bank_1k << 10) + (addr & 0x3FF)];
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs
index 5b7d0d23d6..45c68de8d6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UxROM.cs
@@ -117,7 +117,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (NES._isVS)
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
return NES.CIRAM[addr];
@@ -144,7 +144,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr &= 0x2FFF;
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
index b5d6b3c3b9..a251a0c48d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
@@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (NES._isVS)
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
return NES.CIRAM[addr];
@@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
index 969de22ec7..6ebbe1476c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
@@ -90,12 +90,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
static VRC6()
{
int idx = 0;
- byte bank, mask, a10;
for (int b003 = 0; b003 < 16; b003++)
{
for (int banknum = 0; banknum < 16; banknum++)
{
- GetBankByte(b003, banknum, out bank, out mask, out a10);
+ GetBankByte(b003, banknum, out byte bank, out byte mask, out byte a10);
Banks[idx] = bank;
Masks[idx] = mask;
A10s[idx] = a10;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs
index 56dbb05c14..85ac8a353b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VS_M99.cs
@@ -66,7 +66,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr<0x800)
{
return NES.CIRAM[addr];
@@ -88,7 +88,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- addr = addr - 0x2000;
+ addr -= 0x2000;
if (addr < 0x800)
{
NES.CIRAM[addr] = value;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs
index f535e0471f..fe9f778c0c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/FDS.cs
@@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// silly little hack
int tmp = currentside != null ? (int)currentside : 1234567;
ser.Sync(nameof(currentside), ref tmp);
- currentside = tmp == 1234567 ? null : (int?)tmp;
+ currentside = tmp == 1234567 ? null : tmp;
}
for (int i = 0; i < NumSides; i++)
ser.Sync("diskdiffs" + i, ref diskdiffs[i], true);
@@ -180,7 +180,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
else
{
- bw.Write((int)0);
+ bw.Write(0);
}
}
bw.Close();
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
index cfa279c862..522a8385a6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
@@ -896,7 +896,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int r = pal[c, 0];
int g = pal[c, 1];
int b = pal[c, 2];
- palette_compiled[c] = (int)unchecked((int)0xFF000000 | (r << 16) | (g << 8) | b);
+ palette_compiled[c] = unchecked((int)0xFF000000 | (r << 16) | (g << 8) | b);
}
}
else
@@ -910,7 +910,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int g = pal[c, 1];
int b = pal[c, 2];
Palettes.ApplyDeemphasis(ref r, ref g, ref b, d);
- palette_compiled[i] = (int)unchecked((int)0xFF000000 | (r << 16) | (g << 8) | b);
+ palette_compiled[i] = unchecked((int)0xFF000000 | (r << 16) | (g << 8) | b);
}
}
}
@@ -1017,7 +1017,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
ret = cheat_value[i];
}
- else if ((cheat_compare_type[i] == 1) && ((int)ret == cheat_compare_val[i]))
+ else if ((cheat_compare_type[i] == 1) && (ret == cheat_compare_val[i]))
{
ret = cheat_value[i];
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IMemoryDomains.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IMemoryDomains.cs
index d932edc92f..faf3f19f46 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IMemoryDomains.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IMemoryDomains.cs
@@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
domains.Add(CIRAMdomain);
domains.Add(OAMdoman);
- if (!(Board is FDS) && Board.SaveRam != null)
+ if (Board is not FDS && Board.SaveRam != null)
{
var BatteryRam = new MemoryDomainByteArray("Battery RAM", MemoryDomain.Endian.Little, Board.SaveRam, true, 1);
domains.Add(BatteryRam);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs
index 088b3ea4ea..4a952d00c6 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs
@@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
fdsBios = tmp;
}
- SyncSettings = (NESSyncSettings)syncSettings ?? new NESSyncSettings();
+ SyncSettings = syncSettings ?? new NESSyncSettings();
ControllerSettings = SyncSettings.Controls;
videoProvider = new MyVideoProvider(this);
@@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// expects this to be set.
RomStatus = game.Status;
}
- PutSettings((NESSettings)settings ?? new NESSettings());
+ PutSettings(settings ?? new NESSettings());
// we need to put this here because the line directly above will overwrite palette intialization anywhere else
// TODO: What if settings are later loaded?
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.iNES.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.iNES.cs
index 430e4c7c96..26d85972a9 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.iNES.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.iNES.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Linq;
using System.Text;
using BizHawk.Common.NumberExtensions;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs
index e80233da8c..5505ef1a7d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs
@@ -2,7 +2,6 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
-using System;
using System.Runtime.CompilerServices;
namespace BizHawk.Emulation.Cores.Nintendo.NES
@@ -660,7 +659,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (reg_2000.obj_size_16)
{
int bank = (patternNumber & 1) << 12;
- patternNumber = patternNumber & ~1;
+ patternNumber &= ~1;
patternNumber |= (line >> 3) & 1;
patternAddress = (patternNumber << 4) | bank;
}
@@ -869,7 +868,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (reg_2000.obj_size_16)
{
int bank = (patternNumber & 1) << 12;
- patternNumber = patternNumber & ~1;
+ patternNumber &= ~1;
patternNumber |= (line >> 3) & 1;
patternAddress = (patternNumber << 4) | bank;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ISettable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ISettable.cs
index 2c17efed1c..8e617aaaba 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ISettable.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ISettable.cs
@@ -126,7 +126,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
for (int c = 0; c < 64 * 8; c++)
{
int a = c & 63;
- byte[] inp = { (byte)pal[a, 0], (byte)pal[a, 1], (byte)pal[a, 2] };
+ byte[] inp = { pal[a, 0], pal[a, 1], pal[a, 2] };
byte[] outp = new byte[3];
Nes_NTSC_Colors.Emphasis(inp, outp, c);
_Palette[c * 3] = outp[0];
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs
index d49579cd0a..c75bd9348f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs
@@ -50,9 +50,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
string mappername = Marshal.PtrToStringAnsi(QN.qn_get_mapper(Context, ref mapper));
Console.WriteLine("QuickNES: Booted with Mapper #{0} \"{1}\"", mapper, mappername);
BoardName = mappername;
- PutSettings((QuickNESSettings)settings ?? new QuickNESSettings());
+ PutSettings(settings ?? new QuickNESSettings());
- _syncSettings = (QuickNESSyncSettings)syncSettings ?? new QuickNESSyncSettings();
+ _syncSettings = syncSettings ?? new QuickNESSyncSettings();
_syncSettingsNext = _syncSettings.Clone();
SetControllerDefinition();
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs
index ac125797b9..5d1cdd0d3e 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs
@@ -364,10 +364,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
private string _getAscii(sbyte* ptr)
{
int len = 0;
- sbyte* junko = (sbyte*)ptr;
+ sbyte* junko = ptr;
while (junko[len] != 0) len++;
- return new string((sbyte*)str, 0, len, System.Text.Encoding.ASCII);
+ return new string(str, 0, len, System.Text.Encoding.ASCII);
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_QUERY.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_QUERY.cs
index 9bc56c84b3..d5f70386ba 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_QUERY.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_QUERY.cs
@@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
_comm->id = (uint)id;
_comm->addr = addr;
- _comm->value = (byte)val;
+ _comm->value = val;
_core.Message(eMessage.eMessage_QUERY_poke);
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs
index 1d4fc8a32a..0c82bbb75d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs
@@ -303,7 +303,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
default:
return 0;
case 0:
- var x = (int)controller.AxisValue("0Mouse X");
+ var x = controller.AxisValue("0Mouse X");
if (LimitAnalogChangeSensitivity)
{
x = x.Clamp(-10, 10);
@@ -311,7 +311,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
return (short)x;
case 1:
- var y = (int)controller.AxisValue("0Mouse Y");
+ var y = controller.AxisValue("0Mouse Y");
if (LimitAnalogChangeSensitivity)
{
y = y.Clamp(-10, 10);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs
index f9548ef40c..f8cb97d710 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs
@@ -56,8 +56,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
game.FirmwareHash = SHA1Checksum.ComputeDigestHex(sgbRomData);
}
- _settings = (SnesSettings)settings ?? new SnesSettings();
- _syncSettings = (SnesSyncSettings)syncSettings ?? new SnesSyncSettings();
+ _settings = settings ?? new SnesSettings();
+ _syncSettings = syncSettings ?? new SnesSyncSettings();
_videocb = snes_video_refresh;
_inputpollcb = snes_input_poll;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SnesColors.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SnesColors.cs
index 643cb289e0..5932ef9ee7 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SnesColors.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/SnesColors.cs
@@ -10,7 +10,7 @@
public static void BsnesColor(out int or, out int og, out int ob, int l, int r, int g, int b)
{
// bizhawk through r3808, from bsnes
- double luma = (double)l / 15.0;
+ double luma = l / 15.0;
int ar = (int)(luma * r + 0.5);
int ag = (int)(luma * g + 0.5);
int ab = (int)(luma * b + 0.5);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs
index eeedeb9db2..ebaee20a3d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs
@@ -4,10 +4,6 @@ using BizHawk.Emulation.Cores.Waterbox;
using System.IO;
using System.ComponentModel;
using BizHawk.Common;
-using System.Collections.Generic;
-using System.Linq;
-
-using BizHawk.Emulation.Cores.Nintendo.SNES;
namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs
index 9a6c1dbc06..32914f6b8f 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubGBHawk/SubGBHawk.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy;
@@ -16,8 +15,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk
public SubGBHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ GBHawk.GBHawk.GBSettings settings, GBHawk.GBHawk.GBSyncSettings syncSettings)
{
- var subGBSettings = (GBHawk.GBHawk.GBSettings)settings ?? new GBHawk.GBHawk.GBSettings();
- var subGBSyncSettings = (GBHawk.GBHawk.GBSyncSettings)syncSettings ?? new GBHawk.GBHawk.GBSyncSettings();
+ var subGBSettings = settings ?? new GBHawk.GBHawk.GBSettings();
+ var subGBSyncSettings = syncSettings ?? new GBHawk.GBHawk.GBSyncSettings();
_GBCore = new GBHawk.GBHawk(comm, game, rom, subGBSettings, subGBSyncSettings, true);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs
index 3bd7c25ad1..67990a2ace 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SubNESHawk/SubNESHawk.cs
@@ -11,8 +11,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
[CoreConstructor(VSystemID.Raw.NES, Priority = CorePriority.SuperLow)]
public SubNESHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ NES.NES.NESSettings settings, NES.NES.NESSyncSettings syncSettings)
{
- var subNesSettings = (NES.NES.NESSettings)settings ?? new NES.NES.NESSettings();
- var subNesSyncSettings = (NES.NES.NESSyncSettings)syncSettings ?? new NES.NES.NESSyncSettings();
+ var subNesSettings = settings ?? new NES.NES.NESSettings();
+ var subNesSyncSettings = syncSettings ?? new NES.NES.NESSyncSettings();
_nesCore = new NES.NES(comm, game, rom, subNesSettings, subNesSyncSettings, true);
diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IMemoryDomains.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IMemoryDomains.cs
index e3d704065d..59a1075653 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IMemoryDomains.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IMemoryDomains.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using BizHawk.Emulation.Common;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.Input.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.Input.cs
index 015f16f8ad..a77a22eada 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.Input.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.Input.cs
@@ -20,7 +20,7 @@
if (Clr == false && prevSel == false && Sel)
{
- _selectedController = _selectedController + 1;
+ _selectedController++;
}
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs
index f3b13a3e05..504e57fd51 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs
@@ -31,8 +31,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
SystemId = VSystemID.Raw.PCECD;
Type = NecSystemType.TurboCD;
this.disc = lp.Discs[0].DiscData;
- Settings = (PCESettings)lp.Settings ?? new PCESettings();
- _syncSettings = (PCESyncSettings)lp.SyncSettings ?? new PCESyncSettings();
+ Settings = lp.Settings ?? new PCESettings();
+ _syncSettings = lp.SyncSettings ?? new PCESyncSettings();
var (rom, biosInfo) = lp.Comm.CoreFileProvider.GetFirmwareWithGameInfoOrThrow(
new("PCECD", "Bios"),
@@ -96,8 +96,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
break;
}
- Settings = (PCESettings)lp.Settings ?? new PCESettings();
- _syncSettings = (PCESyncSettings)lp.SyncSettings ?? new PCESyncSettings();
+ Settings = lp.Settings ?? new PCESettings();
+ _syncSettings = lp.SyncSettings ?? new PCESyncSettings();
Init(lp.Game, lp.Roms[0].RomData);
_controllerDeck = new PceControllerDeck(
diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs
index 0c8c980a09..602253077c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs
@@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
case 0x0D: Registers[5] = value; break;
case 0x0E:
// CPU Store Immediate VDC Select
- CPU.WriteVDC = (value & 1) == 0 ? (Action)VDC1.WriteVDC : VDC2.WriteVDC;
+ CPU.WriteVDC = (value & 1) == 0 ? VDC1.WriteVDC : VDC2.WriteVDC;
Registers[6] = value;
break;
}
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs
index 6e59a44d12..529d460f7b 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs
@@ -29,8 +29,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
var ser = new BasicServiceProvider(this);
- linkSettings = (GGLinkSettings)lp.Settings ?? new GGLinkSettings();
- linkSyncSettings = (GGLinkSyncSettings)lp.SyncSettings ?? new GGLinkSyncSettings();
+ linkSettings = lp.Settings ?? new GGLinkSettings();
+ linkSyncSettings = lp.SyncSettings ?? new GGLinkSyncSettings();
_controllerDeck = new GGHawkLinkControllerDeck(GGHawkLinkControllerDeck.DefaultControllerName, GGHawkLinkControllerDeck.DefaultControllerName);
var temp_set_L = new SMS.SmsSettings();
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/MemoryMap.Sega.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/MemoryMap.Sega.cs
index 634b96a88c..0ffd7ddd62 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/MemoryMap.Sega.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/MemoryMap.Sega.cs
@@ -152,7 +152,7 @@
{
if (BiosMapped)
{
- Bios_bank = (byte)value;
+ Bios_bank = value;
}
else
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs
index c16cf8a959..561342ec0d 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs
@@ -1,5 +1,4 @@
-using BizHawk.Common;
-using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs
index 92240f1294..57314b447c 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs
@@ -1,8 +1,4 @@
-
-using BizHawk.Common;
-using BizHawk.Emulation.Common;
-
-namespace BizHawk.Emulation.Cores.Sega.MasterSystem
+namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
public partial class SMS
{
@@ -134,7 +130,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (SyncSettings.Port1 == SMSControllerTypes.Phaser)
{
byte phaserX = (byte)(_controller.AxisValue("P1 X") + 20);
- int phaserY = (int)_controller.AxisValue("P1 Y");
+ int phaserY = _controller.AxisValue("P1 Y");
int scanline = Vdp.ScanLine;
if (!LatchLightPhaser1 && phaserY >= scanline - phaserRadius && phaserY <= scanline + phaserRadius)
@@ -155,7 +151,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (SyncSettings.Port2 == SMSControllerTypes.Phaser)
{
byte phaserX = (byte)(_controller.AxisValue("P2 X") + 20);
- int phaserY = (int)_controller.AxisValue("P2 Y");
+ int phaserY = _controller.AxisValue("P2 Y");
int scanline = Vdp.ScanLine;
if (!LatchLightPhaser2 && phaserY >= scanline - phaserRadius && phaserY <= scanline + phaserRadius)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs
index adbdff3c3d..3d28136829 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs
@@ -26,8 +26,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
- Settings = (SmsSettings)settings ?? new SmsSettings();
- SyncSettings = (SmsSyncSettings)syncSettings ?? new SmsSyncSettings();
+ Settings = settings ?? new SmsSettings();
+ SyncSettings = syncSettings ?? new SmsSyncSettings();
IsGameGear = game.System == VSystemID.Raw.GG;
IsGameGear_C = game.System == VSystemID.Raw.GG;
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMSControllers.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMSControllers.cs
index 02c3484da7..e2b9596099 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMSControllers.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMSControllers.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Linq;
using BizHawk.Common;
@@ -223,7 +222,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P1 Right"))
paddle1Pos = 255;
else
- paddle1Pos = (int)c.AxisValue("P1 Paddle");
+ paddle1Pos = c.AxisValue("P1 Paddle");
if (pin)
{
@@ -256,7 +255,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P2 Right"))
paddle2Pos = 255;
else
- paddle2Pos = (int)c.AxisValue("P2 Paddle");
+ paddle2Pos = c.AxisValue("P2 Paddle");
if (pin)
{
@@ -289,7 +288,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P2 Right"))
paddle2Pos = 255;
else
- paddle2Pos = (int)c.AxisValue("P2 Paddle");
+ paddle2Pos = c.AxisValue("P2 Paddle");
if (pin)
{
@@ -361,7 +360,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P1 Right"))
p1X = SportsPadMax;
else
- p1X = (int)c.AxisValue("P1 X");
+ p1X = c.AxisValue("P1 X");
int p1Y;
if (c.IsPressed("P1 Up"))
@@ -369,7 +368,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P1 Down"))
p1Y = SportsPadMax;
else
- p1Y = (int)c.AxisValue("P1 Y");
+ p1Y = c.AxisValue("P1 Y");
if (is_JPN)
{
@@ -455,7 +454,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P2 Right"))
p2X = SportsPadMax;
else
- p2X = (int)c.AxisValue("P2 X");
+ p2X = c.AxisValue("P2 X");
int p2Y;
if (c.IsPressed("P2 Up"))
@@ -463,7 +462,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P2 Down"))
p2Y = SportsPadMax;
else
- p2Y = (int)c.AxisValue("P2 Y");
+ p2Y = c.AxisValue("P2 Y");
if (is_JPN)
{
@@ -531,7 +530,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P2 Right"))
p2X = SportsPadMax;
else
- p2X = (int)c.AxisValue("P2 X");
+ p2X = c.AxisValue("P2 X");
int p2Y;
if (c.IsPressed("P2 Down"))
@@ -539,7 +538,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (c.IsPressed("P2 Up"))
p2Y = SportsPadMax;
else
- p2Y = (int)c.AxisValue("P2 Y");
+ p2Y = c.AxisValue("P2 Y");
if (is_JPN)
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs
index 4e979b7c80..cc49718845 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs
@@ -1,7 +1,6 @@
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
-using System;
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ISettable.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ISettable.cs
index 50913cd510..da2c9cded4 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ISettable.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.ISettable.cs
@@ -268,7 +268,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
[DisplayName("Low Pass Range")]
[Description("Only active when filter type is lowpass. Range is 0 - 0xffff. Default value is 40%")]
[TypeConverter(typeof(UshortToHexConverter))]
- [DefaultValue((ushort)0x6666)]
+ [DefaultValue(0x6666)]
public ushort LowPassRange { get; set; }
[DisplayName("Three band low cutoff")]
@@ -298,7 +298,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
[Description("Magic pink by default. Requires core reboot")]
[TypeConverter(typeof(UintToHexConverter))]
- [DefaultValue((uint)0xffff00ff)]
+ [DefaultValue(0xffff00ff)]
public uint BackdropColor { get; set; }
public LibGPGX.InitSettings GetNativeSettings(GameInfo game)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs
index 9fa74b0838..2d901ab2e5 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs
@@ -147,7 +147,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
mmd.Add(new MemoryDomainIntPtr("DCache", MemoryDomain.Endian.Little, ptr, size, true, 4));
mmd.Add(new MemoryDomainDelegate("System Bus", 0x1_0000_0000, MemoryDomain.Endian.Little,
- (a) => { byte v; OctoshockDll.shock_PeekMemory(psx, (uint)a, out v); return v; },
+ (a) => { OctoshockDll.shock_PeekMemory(psx, (uint)a, out byte v); return v; },
(a, v) => { OctoshockDll.shock_PokeMemory(psx, (uint)a, v); },
4));
diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs
index e6f14d1fba..daa47e8d35 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs
@@ -94,8 +94,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
ConnectTracer();
DriveLightEnabled = true;
- _Settings = (Settings)settings ?? new Settings();
- _SyncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
+ _Settings = settings ?? new Settings();
+ _SyncSettings = syncSettings ?? new SyncSettings();
Discs = discs;
@@ -754,7 +754,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
//change the disc if needed, and valid
//also if frame is 0, we need to set a disc no matter what
- int requestedDisc = (int)_controller.AxisValue("Disc Select");
+ int requestedDisc = _controller.AxisValue("Disc Select");
if (requestedDisc != CurrentDiscIndexMounted && CurrentTrayOpen
|| Frame == 0
)
diff --git a/src/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs b/src/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs
index 3bfb16f81e..044b411809 100644
--- a/src/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs
+++ b/src/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs
@@ -15,8 +15,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
public WonderSwan(byte[] file, bool deterministic, WonderSwan.Settings settings, WonderSwan.SyncSettings syncSettings)
{
ServiceProvider = new BasicServiceProvider(this);
- _settings = (Settings)settings ?? new Settings();
- _syncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
+ _settings = settings ?? new Settings();
+ _syncSettings = syncSettings ?? new SyncSettings();
DeterministicEmulation = deterministic; // when true, remember to force the RTC flag!
Core = BizSwan.bizswan_new();
diff --git a/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs b/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs
index 21a233c9be..4a7cf528b3 100644
--- a/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs
+++ b/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs
@@ -211,7 +211,7 @@ namespace BizHawk.Emulation.Cores.Components
else
{
if (channel.Frequency <= 1) return;
- freq = PsgBase / (32 * ((int)channel.Frequency));
+ freq = PsgBase / (32 * channel.Frequency);
}
int globalPanFactorLeft = VolumeReductionTable[MainVolumeLeft];
diff --git a/src/BizHawk.Emulation.Cores/Sound/SyncSoundMixer.cs b/src/BizHawk.Emulation.Cores/Sound/SyncSoundMixer.cs
index c721a72a71..333f250407 100644
--- a/src/BizHawk.Emulation.Cores/Sound/SyncSoundMixer.cs
+++ b/src/BizHawk.Emulation.Cores/Sound/SyncSoundMixer.cs
@@ -214,9 +214,9 @@ namespace BizHawk.Emulation.Cores.Components
}
// final hard limit
- if (sampleVal > (int)FinalMaxVolume)
+ if (sampleVal > FinalMaxVolume)
{
- sampleVal = (int)FinalMaxVolume;
+ sampleVal = FinalMaxVolume;
}
samples[i] = (short)sampleVal;
diff --git a/src/BizHawk.Emulation.Cores/Sound/YM2413.cs b/src/BizHawk.Emulation.Cores/Sound/YM2413.cs
index 9de245f8bd..843cd71e42 100644
--- a/src/BizHawk.Emulation.Cores/Sound/YM2413.cs
+++ b/src/BizHawk.Emulation.Cores/Sound/YM2413.cs
@@ -334,7 +334,7 @@ namespace BizHawk.Emulation.Cores.Components
{
for (int i = 0; i < DB_MUTE + DB_MUTE; i++)
{
- DB2LIN_TABLE[i] = (short)((double)((1 << DB2LIN_AMP_BITS) - 1) * Math.Pow(10, -(double)i * DB_STEP / 20));
+ DB2LIN_TABLE[i] = (short)(((1 << DB2LIN_AMP_BITS) - 1) * Math.Pow(10, -(double)i * DB_STEP / 20));
if (i >= DB_MUTE) DB2LIN_TABLE[i] = 0;
DB2LIN_TABLE[i + DB_MUTE + DB_MUTE] = (short)(-DB2LIN_TABLE[i]);
}
@@ -390,14 +390,14 @@ namespace BizHawk.Emulation.Cores.Components
private static void makePmTable()
{
for (int i = 0; i < PM_PG_WIDTH; i++)
- pmtable[i] = (int)((double)PM_AMP * Math.Pow(2, (double)PM_DEPTH * saw(2.0 * Math.PI * i / PM_PG_WIDTH) / 1200));
+ pmtable[i] = (int)(PM_AMP * Math.Pow(2, PM_DEPTH * saw(2.0 * Math.PI * i / PM_PG_WIDTH) / 1200));
}
/* Table for Amp Modulator */
private static void makeAmTable()
{
for (int i = 0; i < AM_PG_WIDTH; i++)
- amtable[i] = (int)((double)AM_DEPTH / 2 / DB_STEP * (1.0 + saw(2.0 * Math.PI * i / PM_PG_WIDTH)));
+ amtable[i] = (int)(AM_DEPTH / 2 / DB_STEP * (1.0 + saw(2.0 * Math.PI * i / PM_PG_WIDTH)));
}
/* Phase increment counter table */
@@ -910,8 +910,8 @@ namespace BizHawk.Emulation.Cores.Components
makeDphaseTable();
makeDphaseARTable();
makeDphaseDRTable();
- pm_dphase = (uint)RATE_ADJUST(PM_SPEED * PM_DP_WIDTH / (clk / 72));
- am_dphase = (uint)RATE_ADJUST(AM_SPEED * AM_DP_WIDTH / (clk / 72));
+ pm_dphase = RATE_ADJUST(PM_SPEED * PM_DP_WIDTH / (clk / 72));
+ am_dphase = RATE_ADJUST(AM_SPEED * AM_DP_WIDTH / (clk / 72));
}
private static void maketables(uint c, uint r)
@@ -1079,7 +1079,7 @@ namespace BizHawk.Emulation.Cores.Components
/* Update AM, PM unit */
private static void update_ampm(OPLL opll)
{
- opll.pm_phase = (uint)((opll.pm_phase + pm_dphase) & (PM_DP_WIDTH - 1));
+ opll.pm_phase = (opll.pm_phase + pm_dphase) & (PM_DP_WIDTH - 1);
opll.am_phase = (int)((opll.am_phase + am_dphase) & (AM_DP_WIDTH - 1));
opll.lfo_am = amtable[HIGHBITS((uint)opll.am_phase, AM_DP_BITS - AM_PG_BITS)];
opll.lfo_pm = pmtable[HIGHBITS(opll.pm_phase, PM_DP_BITS - PM_PG_BITS)];
@@ -1093,7 +1093,7 @@ namespace BizHawk.Emulation.Cores.Components
else
slot.phase += slot.dphase;
- slot.phase &= unchecked((uint)(DP_WIDTH - 1));
+ slot.phase &= unchecked(DP_WIDTH - 1);
slot.pgout = HIGHBITS(slot.phase, DP_BASE_BITS);
}
@@ -1436,8 +1436,8 @@ namespace BizHawk.Emulation.Cores.Components
{
int i, v, ch;
- data = data & 0xff;
- reg = reg & 0x3f;
+ data &= 0xff;
+ reg &= 0x3f;
opll.reg[reg] = (byte)data;
switch (reg)
diff --git a/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs b/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs
index 7d0dcb1848..63840d3a0e 100644
--- a/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs
+++ b/src/BizHawk.Emulation.Cores/Waterbox/WaterboxMemoryDomain.cs
@@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
if ((ulong)addr < (ulong)Size)
{
byte ret = 0;
- _access.Access((IntPtr)(byte*)&ret, addr, 1, false);
+ _access.Access((IntPtr)(&ret), addr, 1, false);
return ret;
}
@@ -181,7 +181,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
{
if ((ulong)addr < (ulong)Size)
{
- _access.Access((IntPtr)(byte*)&val, addr, 1, true);
+ _access.Access((IntPtr)(&val), addr, 1, true);
}
else
{
diff --git a/src/BizHawk.Emulation.Cores/vpads_schemata/ZXSpectrumSchema.cs b/src/BizHawk.Emulation.Cores/vpads_schemata/ZXSpectrumSchema.cs
index ba8389cc13..42eaeb8767 100644
--- a/src/BizHawk.Emulation.Cores/vpads_schemata/ZXSpectrumSchema.cs
+++ b/src/BizHawk.Emulation.Cores/vpads_schemata/ZXSpectrumSchema.cs
@@ -136,7 +136,7 @@ namespace BizHawk.Emulation.Cores
}
int txtLength = b.DisName.Length;
- int btnSize = System.Convert.ToInt32((double)stdButtonWidth * b.WidthFactor);
+ int btnSize = System.Convert.ToInt32(stdButtonWidth * b.WidthFactor);
string disp = b.DisName;
diff --git a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs
index 1944589e23..fc0387d96b 100644
--- a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs
+++ b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Linq;
using BizHawk.Common.PathExtensions;
using BizHawk.Emulation.DiscSystem.CUE;
diff --git a/src/BizHawk.Tests/Emulation.Common/Base Implementations/MemoryCallbackSystemTests.cs b/src/BizHawk.Tests/Emulation.Common/Base Implementations/MemoryCallbackSystemTests.cs
index 5cacef19ab..8753a7a57a 100644
--- a/src/BizHawk.Tests/Emulation.Common/Base Implementations/MemoryCallbackSystemTests.cs
+++ b/src/BizHawk.Tests/Emulation.Common/Base Implementations/MemoryCallbackSystemTests.cs
@@ -1,10 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
diff --git a/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs b/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs
index 98e26a48a1..9a885f3bc5 100644
--- a/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs
+++ b/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs
@@ -1,6 +1,4 @@
-using System.Linq;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;