diff --git a/Common.props b/Common.props index 75784b774c..bbe207169d 100644 --- a/Common.props +++ b/Common.props @@ -16,7 +16,7 @@ prompt strict $(TargetFramework.StartsWith("net4")) - 10.0 + 12.0 true SA0001 enable diff --git a/src/BizHawk.Bizware.Graphics/ImGuiResourceCache.cs b/src/BizHawk.Bizware.Graphics/ImGuiResourceCache.cs index 25920242a5..150177a4d3 100644 --- a/src/BizHawk.Bizware.Graphics/ImGuiResourceCache.cs +++ b/src/BizHawk.Bizware.Graphics/ImGuiResourceCache.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Drawing; -using System.Numerics; namespace BizHawk.Bizware.Graphics { diff --git a/src/BizHawk.Client.Common/Api/DisplaySurfaceID.cs b/src/BizHawk.Client.Common/Api/DisplaySurfaceID.cs index 4358fc3f5f..39bb034ebf 100644 --- a/src/BizHawk.Client.Common/Api/DisplaySurfaceID.cs +++ b/src/BizHawk.Client.Common/Api/DisplaySurfaceID.cs @@ -15,7 +15,7 @@ namespace BizHawk.Client.Common public static class DisplaySurfaceIDParser { #pragma warning disable BHI1005 // switching on string, possibly from user input, ArgumentException is correct here - [return: NotNullIfNotNull("str")] + [return: NotNullIfNotNull(nameof(str))] public static DisplaySurfaceID? Parse(string? str) => str?.ToLowerInvariant() switch { null => null, // this makes it easy to cascade the "remembered" value diff --git a/src/BizHawk.Client.Common/RomGame.cs b/src/BizHawk.Client.Common/RomGame.cs index f7e75d2102..bd7305f35f 100644 --- a/src/BizHawk.Client.Common/RomGame.cs +++ b/src/BizHawk.Client.Common/RomGame.cs @@ -81,7 +81,7 @@ namespace BizHawk.Client.Common // assume we have a header of that size. Otherwise, assume it's just all rom. // Other 'recognized' header sizes may need to be added. int headerOffset = fileLength % BankSize; - if (headerOffset.In(0, 128, 512) == false) + if (!headerOffset.In(0, 128, 512)) { Console.WriteLine("ROM was not a multiple of 1024 bytes, and not a recognized header size: {0}. Assume it's purely ROM data.", headerOffset); headerOffset = 0; diff --git a/src/BizHawk.Client.Common/SaveSlotManager.cs b/src/BizHawk.Client.Common/SaveSlotManager.cs index 96bfa3221e..146c676493 100644 --- a/src/BizHawk.Client.Common/SaveSlotManager.cs +++ b/src/BizHawk.Client.Common/SaveSlotManager.cs @@ -32,7 +32,7 @@ namespace BizHawk.Client.Common else { var file = new FileInfo($"{saveStatePrefix}.QuickSave{i % 10}.State"); - if (file.Directory != null && file.Directory.Exists == false) + if (file.Directory != null && !file.Directory.Exists) { file.Directory.Create(); } diff --git a/src/BizHawk.Client.Common/cheats/GameSharkDecoder.cs b/src/BizHawk.Client.Common/cheats/GameSharkDecoder.cs index 2ddbe54c89..bf07a1e71f 100644 --- a/src/BizHawk.Client.Common/cheats/GameSharkDecoder.cs +++ b/src/BizHawk.Client.Common/cheats/GameSharkDecoder.cs @@ -90,7 +90,7 @@ namespace BizHawk.Client.Common.cheats { // Problem: I don't know what the Non-FF Style codes are. // TODO: Fix that. - if (code.StartsWithOrdinal("FF") == false) + if (!code.StartsWithOrdinal("FF")) { return new InvalidCheatCode("This Action Replay Code, is not yet supported."); } diff --git a/src/BizHawk.Client.Common/controllers/AutofireController.cs b/src/BizHawk.Client.Common/controllers/AutofireController.cs index 854562f323..34d377f241 100644 --- a/src/BizHawk.Client.Common/controllers/AutofireController.cs +++ b/src/BizHawk.Client.Common/controllers/AutofireController.cs @@ -65,7 +65,7 @@ namespace BizHawk.Client.Common { foreach (var boundBtn in v) { - if (_buttons[k] == false && controller.IsPressed(boundBtn)) + if (!_buttons[k] && controller.IsPressed(boundBtn)) { _buttonStarts[k] = _emulator.Frame; } diff --git a/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs b/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs index b70c152c26..6e01fabee3 100644 --- a/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs +++ b/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs @@ -43,7 +43,7 @@ namespace BizHawk.Client.Common { var file = new FileInfo(Filename); - if (file.Exists == false) + if (!file.Exists) { Loaded = false; return false; @@ -84,4 +84,4 @@ namespace BizHawk.Client.Common return true; } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Client.Common/tools/CheatList.cs b/src/BizHawk.Client.Common/tools/CheatList.cs index cf4fcbba9e..0bb69f183b 100644 --- a/src/BizHawk.Client.Common/tools/CheatList.cs +++ b/src/BizHawk.Client.Common/tools/CheatList.cs @@ -316,7 +316,7 @@ namespace BizHawk.Client.Common public bool Load(IMemoryDomains domains, string path, bool append) { var file = new FileInfo(path); - if (file.Exists == false) + if (!file.Exists) { return false; } diff --git a/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs b/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs index ee418b0461..2ce1d8ea9a 100644 --- a/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs +++ b/src/BizHawk.Client.Common/tools/Watch/WatchList/WatchList.cs @@ -376,7 +376,7 @@ namespace BizHawk.Client.Common private bool LoadFile(string path, bool append) { var file = new FileInfo(path); - if (file.Exists == false) + if (!file.Exists) { return false; } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 3d394ba46a..8cc5fec2cd 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -239,7 +239,7 @@ namespace BizHawk.Client.EmuHawk // Record movie dialog should not be opened while in need of a reboot, // Otherwise the wrong sync settings could be set for the recording movie and cause crashes RecordMovieMenuItem.Enabled = !Tools.IsLoaded() - && RebootStatusBarIcon.Visible == false; + && !RebootStatusBarIcon.Visible; PlayFromBeginningMenuItem.Enabled = MovieSession.Movie.IsActive() && !Tools.IsLoaded(); } diff --git a/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index f65b3d6fa9..265b071b3b 100644 --- a/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk // Don't do this from browse if (movie.Hash == _game.Hash - || _config.PlayMovieMatchHash == false || force) + || !_config.PlayMovieMatchHash || force) { return movie; } diff --git a/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs b/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs index 5e5e8f89aa..5d2ed21043 100644 --- a/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs +++ b/src/BizHawk.Client.EmuHawk/tools/BatchRunner.cs @@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk return; } - if (result == false) + if (!result) { _current.Status = Result.EStatus.FalseOnLoad; _results.Add(_current); diff --git a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index df99162fc7..55862239be 100644 --- a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -353,7 +353,7 @@ namespace BizHawk.Client.EmuHawk GoToAddress(found); _findStr = search; } - else if (wrap == false) + else if (!wrap) { FindPrev(value, true); // Search the opposite direction if not found } @@ -400,7 +400,7 @@ namespace BizHawk.Client.EmuHawk GoToAddress(found); _findStr = search; } - else if (wrap == false) + else if (!wrap) { FindPrev(value, true); // Search the opposite direction if not found } diff --git a/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs b/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs index 10077e0ec6..d9dd5864e6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs +++ b/src/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs @@ -163,7 +163,7 @@ namespace BizHawk.Client.EmuHawk return; } - if (now == false && _emu.Frame % RefreshRate.Value != 0) + if (!now && _emu.Frame % RefreshRate.Value != 0) { return; } diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs index af79645601..a0b1d49498 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -850,7 +850,7 @@ namespace BizHawk.Client.EmuHawk var path = _config.PathEntries.CheatsAbsolutePath(_game.System); var f = new FileInfo(path); - if (f.Directory != null && f.Directory.Exists == false) + if (f.Directory != null && !f.Directory.Exists) { f.Directory.Create(); } diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs index 72c7eced5f..8ec35d0fe6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs @@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk { InputManager.AutofireStickyXorAdapter.SetSticky(Name, Checked); - if (Checked == false) + if (!Checked) { Clear(); } @@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk { InputManager.StickyXorAdapter.SetSticky(Name, Checked); - if (Checked == false) + if (!Checked) { Clear(); } diff --git a/src/BizHawk.Common/Log.cs b/src/BizHawk.Common/Log.cs index 4b73db550f..69ba5628fb 100644 --- a/src/BizHawk.Common/Log.cs +++ b/src/BizHawk.Common/Log.cs @@ -24,7 +24,7 @@ namespace BizHawk.Common public static void EnableDomain(string domain) { - if (EnabledLogDomains.Contains(domain) == false) + if (!EnabledLogDomains.Contains(domain)) { EnabledLogDomains.Add(domain); } diff --git a/src/BizHawk.Emulation.Common/Database/Database.cs b/src/BizHawk.Emulation.Common/Database/Database.cs index 585c30a05e..f98ac30fde 100644 --- a/src/BizHawk.Emulation.Common/Database/Database.cs +++ b/src/BizHawk.Emulation.Common/Database/Database.cs @@ -100,9 +100,8 @@ namespace BizHawk.Emulation.Common if (!inUser) _expected.Remove(Path.GetFileName(path)); //reminder: this COULD be done on several threads, if it takes even longer using var reader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)); - while (reader.EndOfStream == false) + while (reader.ReadLine() is string line) { - var line = reader.ReadLine() ?? ""; try { if (line.StartsWith(';')) continue; // comment diff --git a/src/BizHawk.Emulation.Common/Database/GameInfo.cs b/src/BizHawk.Emulation.Common/Database/GameInfo.cs index 9cc80b935f..4928ad32c4 100644 --- a/src/BizHawk.Emulation.Common/Database/GameInfo.cs +++ b/src/BizHawk.Emulation.Common/Database/GameInfo.cs @@ -162,7 +162,7 @@ namespace BizHawk.Emulation.Common return; } - var options = metaData.Split(';').Where(opt => string.IsNullOrEmpty(opt) == false).ToArray(); + var options = metaData.Split(';').Where(opt => !string.IsNullOrEmpty(opt)).ToArray(); foreach (var opt in options) { diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs index 77b0370435..d3ffba6a8b 100644 --- a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs +++ b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs @@ -348,7 +348,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 sbyte a = D[dReg].s8; sbyte b = ReadValueB(mode, reg); int result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; N = (result & 0x80) != 0; Z = result == 0; @@ -361,7 +361,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 short a = D[dReg].s16; short b = ReadValueW(mode, reg); int result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > short.MaxValue || result < short.MinValue; N = (result & 0x8000) != 0; Z = result == 0; @@ -374,7 +374,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 int a = D[dReg].s32; int b = ReadValueL(mode, reg); long result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > int.MaxValue || result < int.MinValue; N = (result & 0x80000000) != 0; Z = result == 0; @@ -399,7 +399,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 sbyte a = PeekValueB(mode, reg); sbyte b = D[dReg].s8; int result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; N = (result & 0x80) != 0; Z = result == 0; @@ -412,7 +412,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 short a = PeekValueW(mode, reg); short b = D[dReg].s16; int result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > short.MaxValue || result < short.MinValue; N = (result & 0x8000) != 0; Z = result == 0; @@ -425,7 +425,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 int a = PeekValueL(mode, reg); int b = D[dReg].s32; long result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > int.MaxValue || result < int.MinValue; N = (result & 0x80000000) != 0; Z = result == 0; @@ -471,7 +471,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 sbyte b = (sbyte)ReadWord(PC); PC += 2; sbyte a = PeekValueB(mode, reg); int result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; N = (result & 0x80) != 0; Z = result == 0; @@ -485,7 +485,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 short b = ReadWord(PC); PC += 2; short a = PeekValueW(mode, reg); int result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > short.MaxValue || result < short.MinValue; N = (result & 0x8000) != 0; Z = result == 0; @@ -499,7 +499,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 int b = ReadLong(PC); PC += 4; int a = PeekValueL(mode, reg); long result = a - b; - X = C = ((a < b) ^ ((a ^ b) >= 0) == false); + X = C = (a < b) ^ (a ^ b) < 0; V = result > int.MaxValue || result < int.MinValue; N = (result & 0x80000000) != 0; Z = result == 0; @@ -555,7 +555,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80) != 0; Z = result == 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; - C = X = ((value < data) ^ ((value ^ data) >= 0) == false); + C = X = (value < data) ^ (value ^ data) < 0; WriteValueB(mode, reg, (sbyte)result); if (mode == 0) PendingCycles -= 4; else PendingCycles -= 8 + EACyclesBW[mode, reg]; @@ -575,7 +575,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x8000) != 0; Z = result == 0; V = result > short.MaxValue || result < short.MinValue; - C = X = ((value < data) ^ ((value ^ data) >= 0) == false); + C = X = (value < data) ^ (value ^ data) < 0; WriteValueW(mode, reg, (short)result); } if (mode <= 1) PendingCycles -= 4; @@ -591,7 +591,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80000000) != 0; Z = result == 0; V = result > int.MaxValue || result < int.MinValue; - C = X = ((value < data) ^ ((value ^ data) >= 0) == false); + C = X = (value < data) ^ (value ^ data) < 0; } WriteValueL(mode, reg, (int)result); if (mode <= 1) PendingCycles -= 8; @@ -676,7 +676,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80) != 0; Z = result == 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; - C = X = ((0 < value) ^ ((0 ^ value) >= 0) == false); + C = X = (0 < value) ^ (0 ^ value) < 0; WriteValueB(mode, reg, (sbyte)result); if (mode == 0) PendingCycles -= 4; else PendingCycles -= 8 + EACyclesBW[mode, reg]; @@ -689,7 +689,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x8000) != 0; Z = result == 0; V = result > short.MaxValue || result < short.MinValue; - C = X = ((0 < value) ^ ((0 ^ value) >= 0) == false); + C = X = (0 < value) ^ (0 ^ value) < 0; WriteValueW(mode, reg, (short)result); if (mode == 0) PendingCycles -= 4; else PendingCycles -= 8 + EACyclesBW[mode, reg]; @@ -702,7 +702,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80000000) != 0; Z = result == 0; V = result > int.MaxValue || result < int.MinValue; - C = X = ((0 < value) ^ ((0 ^ value) >= 0) == false); + C = X = (0 < value) ^ (0 ^ value) < 0; WriteValueL(mode, reg, (int)result); if (mode == 0) PendingCycles -= 8; else PendingCycles -= 12 + EACyclesL[mode, reg]; @@ -755,7 +755,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80) != 0; Z = result == 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; if (mode == 0) PendingCycles -= 8; PendingCycles -= 4 + EACyclesBW[mode, reg]; return; @@ -768,7 +768,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x8000) != 0; Z = result == 0; V = result > short.MaxValue || result < short.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; if (mode == 0) PendingCycles -= 8; PendingCycles -= 4 + EACyclesBW[mode, reg]; return; @@ -781,7 +781,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80000000) != 0; Z = result == 0; V = result > int.MaxValue || result < int.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; PendingCycles -= 6 + EACyclesL[mode, reg]; return; } @@ -832,7 +832,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x8000) != 0; Z = result == 0; V = result > short.MaxValue || result < short.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; PendingCycles -= 6 + EACyclesBW[mode, reg]; return; } @@ -844,7 +844,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80000000) != 0; Z = result == 0; V = result > int.MaxValue || result < int.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; PendingCycles -= 6 + EACyclesL[mode, reg]; return; } @@ -890,7 +890,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80) != 0; Z = result == 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; PendingCycles -= 12; return; } @@ -902,7 +902,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x8000) != 0; Z = result == 0; V = result > short.MaxValue || result < short.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; PendingCycles -= 12; return; } @@ -914,7 +914,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80000000) != 0; Z = result == 0; V = result > int.MaxValue || result < int.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; PendingCycles -= 20; return; } @@ -954,7 +954,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80) != 0; Z = result == 0; V = result > sbyte.MaxValue || result < sbyte.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; if (mode == 0) PendingCycles -= 8; else PendingCycles -= 8 + EACyclesBW[mode, reg]; return; @@ -967,7 +967,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x8000) != 0; Z = result == 0; V = result > short.MaxValue || result < short.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; if (mode == 0) PendingCycles -= 8; else PendingCycles -= 8 + EACyclesBW[mode, reg]; return; @@ -980,7 +980,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 N = (result & 0x80000000) != 0; Z = result == 0; V = result > int.MaxValue || result < int.MinValue; - C = ((a < b) ^ ((a ^ b) >= 0) == false); + C = (a < b) ^ (a ^ b) < 0; if (mode == 0) PendingCycles -= 14; else PendingCycles -= 12 + EACyclesL[mode, reg]; return; diff --git a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs index 7836d650e0..948a9d4c71 100644 --- a/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs +++ b/src/BizHawk.Emulation.Cores/CPUs/68000/Instructions/Supervisor.cs @@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 { private void MOVEtSR() { - if (S == false) + if (!S) throw new Exception("Write to SR when not in supervisor mode. supposed to trap or something..."); int mode = (op >> 3) & 7; @@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 private void MOVEUSP() { - if (S == false) + if (!S) throw new Exception("MOVE to USP when not supervisor. needs to trap"); int dir = (op >> 3) & 1; @@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 private void ANDI_SR() { - if (S == false) + if (!S) throw new Exception("trap!"); SR &= ReadWord(PC); PC += 2; PendingCycles -= 20; @@ -85,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 private void EORI_SR() { - if (S == false) + if (!S) throw new Exception("trap!"); SR ^= ReadWord(PC); PC += 2; PendingCycles -= 20; @@ -101,7 +101,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000 private void ORI_SR() { - if (S == false) + if (!S) throw new Exception("trap!"); SR |= ReadWord(PC); PC += 2; PendingCycles -= 20; @@ -160,4 +160,4 @@ namespace BizHawk.Emulation.Cores.Components.M68000 PC = ReadLong(vector * 4); // Jump to vector } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs index a6a8a7456e..d3e66d091a 100644 --- a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs +++ b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs @@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 { int lastCycles = PendingCycles; - if (IRQ1Assert && FlagI == false && LagIFlag == false && (IRQControlByte & IRQ1Selector) == 0 && InBlockTransfer == false) + if (IRQ1Assert && !FlagI && !LagIFlag && (IRQControlByte & IRQ1Selector) == 0 && !InBlockTransfer) { WriteMemory((ushort)(S-- + 0x2100), (byte)(PC >> 8)); WriteMemory((ushort)(S-- + 0x2100), (byte)PC); @@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 8; } - if (TimerAssert && FlagI == false && LagIFlag == false && (IRQControlByte & TimerSelector) == 0 && InBlockTransfer == false) + if (TimerAssert && !FlagI && !LagIFlag && (IRQControlByte & TimerSelector) == 0 && !InBlockTransfer) { WriteMemory((ushort)(S-- + 0x2100), (byte)(PC >> 8)); WriteMemory((ushort)(S-- + 0x2100), (byte)PC); @@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 8; } - if (IRQ2Assert && FlagI == false && LagIFlag == false && (IRQControlByte & IRQ2Selector) == 0 && InBlockTransfer == false) + if (IRQ2Assert && !FlagI && !LagIFlag && (IRQControlByte & IRQ2Selector) == 0 && !InBlockTransfer) { WriteMemory((ushort)(S-- + 0x2100), (byte)(PC >> 8)); WriteMemory((ushort)(S-- + 0x2100), (byte)PC); @@ -87,7 +87,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x01: // ORA (addr,X) value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000))); - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -124,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x05: // ORA zp value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000)); - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -161,7 +161,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x09: // ORA #nn value8 = ReadMemory(PC++); - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -193,7 +193,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x0D: // ORA addr value8 = ReadMemory(ReadWord(PC)); PC += 2; - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -230,7 +230,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x10: // BPL +/-rel rel8 = (sbyte)ReadMemory(PC++); value16 = (ushort)(PC + rel8); - if (FlagN == false) + if (!FlagN) { PendingCycles -= 2; PC = value16; @@ -240,7 +240,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x11: // ORA (addr),Y temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)); value8 = ReadMemory((ushort)(temp16 + Y)); - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -257,7 +257,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x12: // ORA (addr) value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000))); - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -288,7 +288,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x15: // ORA zp,X value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000)); - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -326,7 +326,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x19: // ORA addr,Y value8 = ReadMemory((ushort)(ReadWord(PC) + Y)); PC += 2; - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -357,7 +357,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x1D: // ORA addr,X value8 = ReadMemory((ushort)(ReadWord(PC) + X)); PC += 2; - if (FlagT == false) + if (!FlagT) { A |= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -401,7 +401,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x21: // AND (addr,X) value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000))); - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -436,7 +436,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x25: // AND zp value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000)); - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -473,7 +473,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 goto AfterClearTFlag; case 0x29: // AND #nn value8 = ReadMemory(PC++); - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -504,7 +504,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x2D: // AND addr value8 = ReadMemory(ReadWord(PC)); PC += 2; - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -551,7 +551,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x31: // AND (addr),Y temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)); value8 = ReadMemory((ushort)(temp16 + Y)); - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -568,7 +568,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x32: // AND (addr) value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000))); - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -592,7 +592,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x35: // AND zp,X value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000)); - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -630,7 +630,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x39: // AND addr,Y value8 = ReadMemory((ushort)(ReadWord(PC) + Y)); PC += 2; - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -660,7 +660,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x3D: // AND addr,X value8 = ReadMemory((ushort)(ReadWord(PC) + X)); PC += 2; - if (FlagT == false) + if (!FlagT) { A &= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -703,7 +703,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 goto AfterClearTFlag; case 0x41: // EOR (addr,X) value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000))); - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -747,7 +747,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x45: // EOR zp value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000)); - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -784,7 +784,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x49: // EOR #nn value8 = ReadMemory(PC++); - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -811,7 +811,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x4D: // EOR addr value8 = ReadMemory(ReadWord(PC)); PC += 2; - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -848,7 +848,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x50: // BVC +/-rel rel8 = (sbyte)ReadMemory(PC++); value16 = (ushort)(PC + rel8); - if (FlagV == false) + if (!FlagV) { PendingCycles -= 2; PC = value16; @@ -858,7 +858,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x51: // EOR (addr),Y temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)); value8 = ReadMemory((ushort)(temp16 + Y)); - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -875,7 +875,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x52: // EOR (addr) value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000))); - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -905,7 +905,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 break; case 0x55: // EOR zp,X value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000)); - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -943,7 +943,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x59: // EOR addr,Y value8 = ReadMemory((ushort)(ReadWord(PC) + Y)); PC += 2; - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -965,7 +965,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x5D: // EOR addr,X value8 = ReadMemory((ushort)(ReadWord(PC) + X)); PC += 2; - if (FlagT == false) + if (!FlagT) { A ^= value8; P = (byte)((P & 0x7D) | TableNZ[A]); @@ -1032,7 +1032,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1077,7 +1077,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1134,7 +1134,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1181,7 +1181,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1247,7 +1247,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1283,7 +1283,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1294,7 +1294,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 7; break; case 0x73: // TII src, dest, len - if (InBlockTransfer == false) + if (!InBlockTransfer) { InBlockTransfer = true; btFrom = ReadWord(PC); PC += 2; @@ -1348,7 +1348,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1405,7 +1405,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1451,7 +1451,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 FlagC = temp > 0xFF; source8 = (byte)temp; } - if (FlagT == false) + if (!FlagT) A = source8; else { @@ -1569,7 +1569,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0x90: // BCC +/-rel rel8 = (sbyte)ReadMemory(PC++); value16 = (ushort)(PC + rel8); - if (FlagC == false) + if (!FlagC) { PendingCycles -= 2; PC = value16; @@ -1858,7 +1858,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 2; break; case 0xC3: // TDD src, dest, len - if (InBlockTransfer == false) + if (!InBlockTransfer) { InBlockTransfer = true; btFrom = ReadWord(PC); PC += 2; @@ -1958,7 +1958,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0xD0: // BNE +/-rel rel8 = (sbyte)ReadMemory(PC++); value16 = (ushort)(PC + rel8); - if (FlagZ == false) + if (!FlagZ) { PendingCycles -= 2; PC = value16; @@ -1981,7 +1981,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 7; break; case 0xD3: // TIN src, dest, len - if (InBlockTransfer == false) + if (!InBlockTransfer) { InBlockTransfer = true; btFrom = ReadWord(PC); PC += 2; @@ -2103,7 +2103,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 7; break; case 0xE3: // TIA src, dest, len - if (InBlockTransfer == false) + if (!InBlockTransfer) { InBlockTransfer = true; btFrom = ReadWord(PC); PC += 2; @@ -2312,7 +2312,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 PendingCycles -= 7; break; case 0xF3: // TAI src, dest, len - if (InBlockTransfer == false) + if (!InBlockTransfer) { InBlockTransfer = true; btFrom = ReadWord(PC); PC += 2; @@ -2340,7 +2340,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 case 0xF4: // SET int a; // TODO remove these extra checks string b = Disassemble(PC, out a); - if (b.StartsWithOrdinal("ADC") == false && b.StartsWithOrdinal("EOR") == false && b.StartsWithOrdinal("AND") == false && b.StartsWithOrdinal("ORA") == false) + if (!b.StartsWithOrdinal("ADC") && !b.StartsWithOrdinal("EOR") && !b.StartsWithOrdinal("AND") && !b.StartsWithOrdinal("ORA")) Console.WriteLine("SETTING T FLAG, NEXT INSTRUCTION IS UNHANDLED: {0}", b); FlagT = true; PendingCycles -= 2; diff --git a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs index f17360fa68..2b019d533a 100644 --- a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs +++ b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs @@ -236,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 public void WriteTimerEnable(byte value) { - if (TimerEnabled == false && (value & 1) == 1) + if (!TimerEnabled && (value & 1) == 1) { TimerValue = TimerReloadValue; // timer value is reset when toggled from off to on TimerTickCounter = 0; @@ -420,4 +420,4 @@ namespace BizHawk.Emulation.Cores.Components.H6280 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs b/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs index 56bdb7e631..1421d7606f 100644 --- a/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs +++ b/src/BizHawk.Emulation.Cores/CPUs/MOS 6502X/Execute.cs @@ -1146,7 +1146,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502 private void RelBranch_Stage2_BVC() { - branch_taken = FlagV == false; + branch_taken = !FlagV; RelBranch_Stage2(); } @@ -1158,7 +1158,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502 private void RelBranch_Stage2_BPL() { - branch_taken = FlagN == false; + branch_taken = !FlagN; RelBranch_Stage2(); } @@ -1170,7 +1170,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502 private void RelBranch_Stage2_BCC() { - branch_taken = FlagC == false; + branch_taken = !FlagC; RelBranch_Stage2(); } @@ -1182,7 +1182,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502 private void RelBranch_Stage2_BNE() { - branch_taken = FlagZ == false; + branch_taken = !FlagZ; RelBranch_Stage2(); } 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 cf6acdcb39..049c1983f7 100644 --- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Datacorder/DatacorderDevice.cs +++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/Hardware/Datacorder/DatacorderDevice.cs @@ -381,7 +381,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC long cycles = cpuCycle - _lastCycle; // check whether tape is actually playing - if (tapeMotor == false) + if (!tapeMotor) { // it's not playing. Update lastCycle and return _lastCycle = cpuCycle; diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs index 98ef0649cf..017ab2ae36 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/D64.cs @@ -125,7 +125,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media writer.Write(syncBytes40); // sync writer.Write(EncodeGcr(new byte[] { (byte)(errorType == ErrorType.DataNotFound ? 0x00 : 0x08), headerChecksum, sectorNo, trackNo, formatA, formatB, 0x0F, 0x0F })); // header - writer.Write(new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 }); // gap + writer.Write("UUUUUUUUU"u8.ToArray()); // gap writer.Write(syncBytes40); // sync writer.Write(EncodeGcr(writtenData)); // data writer.Write(Enumerable.Repeat((byte)0x55, gapLength).ToArray()); // gap 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 e4b7dd6f7e..11c65a50d5 100644 --- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Datacorder/DatacorderDevice.cs +++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Datacorder/DatacorderDevice.cs @@ -418,7 +418,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum bool is48k = _machine.IsIn48kMode(); // check whether tape is actually playing - if (_tapeIsPlaying == false) + if (!_tapeIsPlaying) { // it's not playing. Update lastCycle and return _lastCycle = cpuCycle; 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 72889d1b0d..a51cb3e202 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 @@ -90,7 +90,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum // memory paging // this is controlled by writes to port 0x7ffd // but it is only partially decoded so it actually responds to any port with bits 1 and 15 reset - if (portBits[1] == false && portBits[15] == false) + if (!portBits[1] && !portBits[15]) { Last7ffd = value; 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 5aee11266a..b5329eaa6a 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 @@ -93,7 +93,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum // memory paging // this is controlled by writes to port 0x7ffd // but it is only partially decoded so it actually responds to any port with bits 1 and 15 reset - if (portBits[1] == false && portBits[15] == false) + if (!portBits[1] && !portBits[15]) { Last7ffd = value; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IEmulator.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IEmulator.cs index 94882dce2e..5c25d54345 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IEmulator.cs @@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _tia.New_Frame = false; - if (renderSound == false) + if (!renderSound) { _tia.AudioClocks = 0; // we need this here since the async sound provider won't check in this case } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.RomHeuristics.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.RomHeuristics.cs index cf9e71d603..00689a57ea 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.RomHeuristics.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.RomHeuristics.cs @@ -403,8 +403,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // These signatures are attributed to the MESS project return ContainsAny(rom, new List { - new byte[] { 0x44, 0x50, 0x43, 0x2B }, - new byte[] { 0x44, 0x50, 0x43, 0x2B }, + // why is this checking the same value twice? ... + "DPC+"u8.ToArray(), + "DPC+"u8.ToArray(), }); } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs b/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs index 76fe74d9e6..486fa4a663 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoControllers.cs @@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision if (c.IsPressed(Definition.BoolButtons[7])) retVal = 0x0D; if (c.IsPressed(Definition.BoolButtons[12])) retVal = 0x0E; - if (c.IsPressed(Definition.BoolButtons[5]) == false) retVal |= 0x40; + if (!c.IsPressed(Definition.BoolButtons[5])) retVal |= 0x40; retVal |= 0x30; // always set these bits return retVal; } @@ -300,7 +300,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision if (c.IsPressed(Definition.BoolButtons[18])) retVal = 0x04; if (c.IsPressed(Definition.BoolButtons[19])) retVal = 0x08; - if (c.IsPressed(Definition.BoolButtons[5]) == false) retVal |= 0x40; + if (!c.IsPressed(Definition.BoolButtons[5])) retVal |= 0x40; retVal |= 0x30; // always set these bits return retVal; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Coleco/TMS9918A.cs b/src/BizHawk.Emulation.Cores/Consoles/Coleco/TMS9918A.cs index b6c3b14e36..69d17fc203 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Coleco/TMS9918A.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Coleco/TMS9918A.cs @@ -169,7 +169,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision private void RenderBackgroundM0(int scanLine) { - if (DisplayOn == false) + if (!DisplayOn) { Array.Clear(FrameBuffer, scanLine * 256, 256); return; @@ -204,7 +204,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision private void RenderBackgroundM1(int scanLine) { - if (DisplayOn == false) + if (!DisplayOn) { Array.Clear(FrameBuffer, scanLine * 256, 256); return; @@ -237,7 +237,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision private void RenderBackgroundM2(int scanLine) { - if (DisplayOn == false) + if (!DisplayOn) { Array.Clear(FrameBuffer, scanLine * 256, 256); return; @@ -274,7 +274,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision private void RenderBackgroundM3(int scanLine) { - if (DisplayOn == false) + if (!DisplayOn) { Array.Clear(FrameBuffer, scanLine * 256, 256); return; @@ -312,19 +312,15 @@ namespace BizHawk.Emulation.Cores.ColecoVision private void RenderTmsSprites(int scanLine) { - if (EnableDoubledSprites == false) - { - RenderTmsSpritesStandard(scanLine); - } - else - { + if (EnableDoubledSprites) RenderTmsSpritesDouble(scanLine); - } + else + RenderTmsSpritesStandard(scanLine); } private void RenderTmsSpritesStandard(int scanLine) { - if (DisplayOn == false) return; + if (!DisplayOn) return; Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256); @@ -391,7 +387,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision private void RenderTmsSpritesDouble(int scanLine) { - if (DisplayOn == false) return; + if (!DisplayOn) return; Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256); @@ -517,4 +513,4 @@ namespace BizHawk.Emulation.Cores.ColecoVision } } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/APU.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/APU.cs index 337ad9c43d..c5b27cc01a 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/APU.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/APU.cs @@ -1408,7 +1408,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES // since the units run concurrently, the APU frame sequencer is ran last because // it can change the output values of the pulse/triangle channels // we want the changes to affect it on the *next* cycle. - if (sequencer_irq_flag == false) + if (!sequencer_irq_flag) sequencer_irq = false; if (DebugCallbackDivider != 0) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs index 85c83aaa74..4942d049aa 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CNROM.cs @@ -136,7 +136,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPpu(int addr) { - if (chr_enabled == false) + if (!chr_enabled) { return 0x12; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs index 41cd228132..ff79dfd1ad 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs @@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPrg(int addr) { - if (prg_mode == false) + if (!prg_mode) { int bank = (prg_reg >> 1) & prg_bank_mask_32k; return Rom[(bank * 0x8000) + addr + chip_offset]; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs index d97f26cab2..5c0261d96f 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper115.cs @@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES protected override int Get_PRGBank_8K(int addr) { int bank_8k = mmc3.Get_PRGBank_8K(addr); - if (prg_mode_mapper == false) return bank_8k; + if (!prg_mode_mapper) return bank_8k; else if (addr < 0x2000) { return prg_page*4; @@ -80,4 +80,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES return bank_1k | chr_block_or; } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs index 8725b3bb64..e61664bf03 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper058.cs @@ -53,7 +53,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPrg(int addr) { - if (prg_mode == false) + if (!prg_mode) { return Rom[((prg_reg >> 1) * 0x8000) + addr]; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs index a6cb9cce09..076ffc8ecc 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs @@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES prg_bank_16k = (byte)(value & 7); SyncPRG(); - if (value.Bit(3) == false) + if (!value.Bit(3)) { if (holydiver) SetMirrorType(EMirrorType.Horizontal); diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs index bcdcc613e7..d42d2eec9f 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs @@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPrg(int addr) { - if (prg_mode == false) + if (!prg_mode) { int bank = (prg_reg >> 1) & prg_bank_mask_32k; return Rom[(bank * 0x8000) + addr]; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs index 19f8c8bd20..d640636644 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper226.cs @@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { int baseAddr = resetSwitchMode && resetFlag ? 0x80000 : 0; - if (prg_mode == false) + if (!prg_mode) { return Rom[baseAddr + (( ((prg_page >> 1) & prg_mask_32k) << 15) + (addr & 0x7FFF))]; } 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 c62ee92d39..3b1ed6409b 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs @@ -64,7 +64,7 @@ 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 && S == false) + if (o && !S) { _prgBanks16K[0] = (byte)(p); _prgBanks16K[1] = (byte)(p); @@ -74,22 +74,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES _prgBanks16K[0] = (byte)((p & ~1)); _prgBanks16K[1] = (byte)((p & ~1) + 1); } - if (o == false && S == false && L == false) + if (!o && !S && !L) { _prgBanks16K[0] = (byte)p; _prgBanks16K[1] = (byte)(p & 0x38); } - if (o == false && S && L == false) + if (!o && S && !L) { _prgBanks16K[0] = (byte)(p & 0x3E); _prgBanks16K[1] = (byte)(p & 0x38); } - if (o == false && S == false && L) + if (!o && !S && L) { _prgBanks16K[0] = (byte)p; _prgBanks16K[1] = (byte)(p | 0x07); } - if (o == false && S && L) + if (!o && S && L) { _prgBanks16K[0] = (byte)(p & 0x3E); _prgBanks16K[1] = (byte)(p | 0x07); diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs index c87c00cee1..c8bd71b5b2 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper230.cs @@ -74,7 +74,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } else { - if (prg_mode == false) + if (!prg_mode) { return Rom[((prg_page >> 1) * 0x8000) + addr + chip1_offset]; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper233.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper233.cs index e7993e79e0..c9d9017fb9 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper233.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper233.cs @@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPrg(int addr) { - if (prg_mode == false) + if (!prg_mode) { return Rom[((prg_page >> 1) * 0x8000) + addr]; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs index fd6a985da7..5194b7b4c6 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper61.cs @@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPrg(int addr) { - if (prg_mode == false) + if (!prg_mode) { return Rom[(((prg_page >> 1) * 0x8000) + addr) & prg_byte_mask]; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs index e5e5df2a0e..d67f8540d2 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper62.cs @@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public override byte ReadPrg(int addr) { - if (prg_mode == false) + if (!prg_mode) { return Rom[((prg_reg >> 1) * 0x8000) + addr]; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs index fc03420811..d3808a4c66 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs @@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES prg_bank_16k = (byte)((value >> 4) & 7); SyncPRG(); - if (value.Bit(3) == false) + if (!value.Bit(3)) SetMirrorType(EMirrorType.OneScreenA); else SetMirrorType(EMirrorType.OneScreenB); diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/ADPCM.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/ADPCM.cs index 6e61a6400b..df422e314a 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/ADPCM.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/ADPCM.cs @@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Cores.PCEngine if (AdpcmIsPlaying && (value & 0x20) == 0) AdpcmIsPlaying = false; // clearing this bit stops playback - if (AdpcmIsPlaying == false && (value & 0x20) != 0) + if (!AdpcmIsPlaying && (value & 0x20) != 0) { if ((value & 0x40) == 0) Console.WriteLine("a thing that's normally set is not set"); @@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Cores.PCEngine _scsi.Think(); } - if (_scsi.DataTransferInProgress == false) + if (!_scsi.DataTransferInProgress) Port180B = 0; } @@ -254,7 +254,7 @@ namespace BizHawk.Emulation.Cores.PCEngine private byte ReadNibble() { byte value; - if (nibble == false) + if (!nibble) value = (byte)(RAM[ReadAddress] >> 4); else { @@ -275,13 +275,13 @@ namespace BizHawk.Emulation.Cores.PCEngine int m = StepFactor[mag]; int adjustment = StepSize[(magnitude * 8) + mag]; magnitude = AddClamped(magnitude, m, 0, 48); - if (positive == false) adjustment *= -1; + if (!positive) adjustment *= -1; playingSample = AddClamped(playingSample, adjustment, 0, 4095); } private void AdpcmEmitSample() { - if (AdpcmIsPlaying == false) + if (!AdpcmIsPlaying) _synchronizer.EnqueueSample(0, 0); else { diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.TurboCD.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.TurboCD.cs index bd1e30a810..e6aac80656 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.TurboCD.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.TurboCD.cs @@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.PCEngine if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM { - if (BramEnabled && BramLocked == false) + if (BramEnabled && !BramLocked) return BRAM[addr & 0x7FF]; return 0xFF; } @@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.PCEngine else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM { - if (BramEnabled && BramLocked == false) + if (BramEnabled && !BramLocked) { BRAM[addr & 0x7FF] = value; SaveRamModified = true; @@ -95,4 +95,4 @@ namespace BizHawk.Emulation.Cores.PCEngine Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value); } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.cs index f60cb7655f..a52f76fb30 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/MemoryMap.cs @@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.PCEngine if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM { - if (BramEnabled && BramLocked == false) + if (BramEnabled && !BramLocked) return BRAM[addr & 0x7FF]; return 0xFF; } @@ -61,7 +61,7 @@ namespace BizHawk.Emulation.Cores.PCEngine } else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM { - if (BramEnabled && BramLocked == false) + if (BramEnabled && !BramLocked) { BRAM[addr & 0x7FF] = value; SaveRamModified = true; @@ -75,4 +75,4 @@ namespace BizHawk.Emulation.Cores.PCEngine //CoreComm.MemoryCallbackSystem.CallWrite((uint)addr); } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.ArcadeCard.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.ArcadeCard.cs index 33ce5525af..9807b714ce 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.ArcadeCard.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.ArcadeCard.cs @@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.PCEngine private void WriteArcadeCard(int addr, byte value) { - if (ArcadeCard == false) + if (!ArcadeCard) { return; } @@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.PCEngine private byte ReadArcadeCard(int addr) { - if (ArcadeCard == false) return 0xFF; + if (!ArcadeCard) return 0xFF; var page = ArcadePage[(addr >> 4) & 3]; switch (addr & 0x0F) { @@ -144,7 +144,7 @@ namespace BizHawk.Emulation.Cores.PCEngine ser.Sync(nameof(ShiftAmount), ref ShiftAmount); ser.Sync(nameof(RotateAmount), ref RotateAmount); - if (ArcadeCardRewindHack == false || ser.IsText) + if (!ArcadeCardRewindHack || ser.IsText) { ser.Sync("ArcadeRAM", ref ArcadeRam, false); } @@ -163,4 +163,4 @@ namespace BizHawk.Emulation.Cores.PCEngine ser.EndSection(); } } -} \ No newline at end of file +} 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 a77a22eada..381f3f04d5 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.Input.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.Input.cs @@ -18,7 +18,7 @@ _selectedController = 0; } - if (Clr == false && prevSel == false && Sel) + if (!Clr && !prevSel && Sel) { _selectedController++; } @@ -43,7 +43,7 @@ value |= 0x40; } - if (Type != NecSystemType.TurboCD && BramEnabled == false) + if (Type != NecSystemType.TurboCD && !BramEnabled) { value |= 0x80; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index 504e57fd51..066fb3fd15 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.PCEngine lp.Comm.ShowMessage( "The PCE-CD System Card you have selected is not recognized in our database. That might mean it's a bad dump, or isn't the correct rom."); } - else if (biosInfo["BIOS"] == false) + else if (!biosInfo["BIOS"]) { // zeromus says: someone please write a note about how this could possibly happen. // it seems like this is a relic of using gameDB for storing whether something is a bios? firmwareDB should be handling it now. @@ -62,7 +62,7 @@ namespace BizHawk.Emulation.Cores.PCEngine lp.Game.AddOption("SuperSysCard", ""); } - if (lp.Game["NeedSuperSysCard"] && lp.Game["SuperSysCard"] == false) + if (lp.Game["NeedSuperSysCard"] && !lp.Game["SuperSysCard"]) { lp.Comm.ShowMessage( "This game requires a version 3.0 System card and won't run with the system card you've selected. Try selecting a 3.0 System Card in the firmware configuration."); diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PceControllerDeck.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PceControllerDeck.cs index 674f850bd5..a4e48c0a72 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PceControllerDeck.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PceControllerDeck.cs @@ -125,7 +125,7 @@ namespace BizHawk.Emulation.Cores.PCEngine { byte result = 0x3F; - if (sel == false) + if (!sel) { if (c.IsPressed($"P{PortNum} B1")) result &= 0xFE; if (c.IsPressed($"P{PortNum} B2")) result &= 0xFD; diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs index aff3a72b5f..ada80b224d 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.Render.cs @@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Cores.PCEngine cpu.Execute(455 - HBlankCycles - 2); - if (InActiveDisplay == false && DmaRequested) + if (!InActiveDisplay && DmaRequested) RunDmaForScanline(); ScanLine++; @@ -122,7 +122,7 @@ namespace BizHawk.Emulation.Cores.PCEngine { Array.Clear(PriorityBuffer, 0, FrameWidth); - if (BackgroundEnabled == false) + if (!BackgroundEnabled) { int p = vce.Palette[256]; fixed (int* FBptr = FrameBuffer) @@ -202,7 +202,7 @@ namespace BizHawk.Emulation.Cores.PCEngine { Array.Clear(PriorityBuffer, 0, FrameWidth); - if (BackgroundEnabled == false) + if (!BackgroundEnabled) { for (int i = 0; i < FrameWidth; i++) FrameBuffer[((ActiveLine + ViewStartLine - pce.Settings.TopLine) * FramePitch) + i] = vce.Palette[256]; @@ -242,7 +242,7 @@ namespace BizHawk.Emulation.Cores.PCEngine public void RenderSpritesScanline(bool show) { - if (SpritesEnabled == false) + if (!SpritesEnabled) { return; } @@ -286,7 +286,7 @@ namespace BizHawk.Emulation.Cores.PCEngine patternNo &= 0x1FE; int yofs = 0; - if (vflip == false) + if (!vflip) { yofs = (ActiveLine - y) & 15; if (height == 32) @@ -351,7 +351,7 @@ namespace BizHawk.Emulation.Cores.PCEngine } } - if (hflip == false) + if (!hflip) { if (x + width > 0 && y + height > 0) { diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs index 3f08e6b54d..ebe019eed1 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs @@ -228,10 +228,10 @@ namespace BizHawk.Emulation.Cores.PCEngine CPU.Execute(455 - VDC1.HBlankCycles - 2); - if (InActiveDisplay == false && VDC1.DmaRequested) + if (!InActiveDisplay && VDC1.DmaRequested) VDC1.RunDmaForScanline(); - if (InActiveDisplay == false && VDC2.DmaRequested) + if (!InActiveDisplay && VDC2.DmaRequested) VDC2.RunDmaForScanline(); VDC1.RCRCounter++; @@ -280,7 +280,7 @@ namespace BizHawk.Emulation.Cores.PCEngine private unsafe void RenderBackgroundScanline(VDC vdc, byte priority, bool show) { - if (vdc.BackgroundEnabled == false) + if (!vdc.BackgroundEnabled) return; // per-line parameters @@ -351,7 +351,7 @@ namespace BizHawk.Emulation.Cores.PCEngine private void RenderSpritesScanline(VDC vdc, byte lowPriority, byte highPriority, bool show) { - if (vdc.SpritesEnabled == false) + if (!vdc.SpritesEnabled) return; // clear inter-sprite priority buffer @@ -378,7 +378,7 @@ namespace BizHawk.Emulation.Cores.PCEngine patternNo &= 0x1FE; int yofs; - if (vflip == false) + if (!vflip) { yofs = (vdc.ActiveLine - y) & 15; if (height == 32) @@ -442,7 +442,7 @@ namespace BizHawk.Emulation.Cores.PCEngine } } } - if (hflip == false) + if (!hflip) { if (x + width > 0 && y + height > 0) { 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 561342ec0d..1c044015e4 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs @@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem Cpu.TraceCallback = null; } - if (IsGameGear_C == false) + if (!IsGameGear_C) { Cpu.NonMaskableInterrupt = controller.IsPressed("Pause"); } 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 34f99d66ed..0a476501e4 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs @@ -173,7 +173,7 @@ private byte ReadPort0() { - if (IsGameGear_C == false) + if (!IsGameGear_C) { return 0xFF; } @@ -242,4 +242,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.Mode4.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.Mode4.cs index 623a70c60b..eb9d9849e3 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.Mode4.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.Mode4.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (ScanLine >= FrameHeight) return; - if (DisplayOn == false) + if (!DisplayOn) { for (int x = 0; x < 256; x++) FrameBuffer[(ScanLine * 256) + x] = Palette[BackdropColor]; @@ -64,7 +64,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (VFlip) yOfs = 7 - yOfs; - if (HFlip == false) + if (!HFlip) { FrameBuffer[(ScanLine * 256) + horzOffset++] = show ? Palette[PatternBuffer[(tileNo * 64) + (yOfs * 8) + 0] + PaletteBase] : Palette[BackdropColor]; FrameBuffer[(ScanLine * 256) + horzOffset++] = show ? Palette[PatternBuffer[(tileNo * 64) + (yOfs * 8) + 1] + PaletteBase] : Palette[BackdropColor]; @@ -288,7 +288,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem internal void ProcessOverscan() { - if (Sms.Settings.DisplayOverscan == false) + if (!Sms.Settings.DisplayOverscan) return; if (OverscanFrameBuffer == null) @@ -346,7 +346,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (mode != VdpMode.GameGear) return; - if (Sms.Settings.ShowClippedRegions == false) + if (!Sms.Settings.ShowClippedRegions) { int yStart = (FrameHeight - 144) / 2; for (int y = 0; y < 144; y++) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs index 3106ffd3a8..1a4935d614 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs @@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (ScanLine >= FrameHeight) return; - if (DisplayOn == false) + if (!DisplayOn) { Array.Clear(FrameBuffer, ScanLine * 256, 256); return; @@ -68,7 +68,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if (ScanLine >= FrameHeight) return; - if (DisplayOn == false) + if (!DisplayOn) { Array.Clear(FrameBuffer, ScanLine * 256, 256); return; @@ -105,13 +105,13 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private void RenderTmsSprites(bool show) { - if (ScanLine >= FrameHeight || DisplayOn == false) + if (ScanLine >= FrameHeight || !DisplayOn) return; - if (EnableDoubledSprites == false) - RenderTmsSpritesStandard(show); - else + if (EnableDoubledSprites) RenderTmsSpritesDouble(show); + else + RenderTmsSpritesStandard(show); } private void RenderTmsSpritesStandard(bool show) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs index cc49718845..9636504730 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs @@ -239,7 +239,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private void CheckVideoMode() { - if (Mode4Bit == false) // check old TMS modes + if (!Mode4Bit) // check old TMS modes { if (Mode1Bit) TmsMode = 1; else if (Mode2Bit) TmsMode = 2; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index 9b20ba1998..882d1a226c 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -811,7 +811,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX LagCount++; //what happens to sound in this case? - if (render == false) + if (!render) { Frame++; return true; diff --git a/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs b/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs index 4a7cf528b3..0a768e5659 100644 --- a/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs +++ b/src/BizHawk.Emulation.Cores/Sound/HuC6280PSG.cs @@ -104,7 +104,7 @@ namespace BizHawk.Emulation.Cores.Components Channels[VoiceLatch].Volume = (byte)(value & 0x1F); Channels[VoiceLatch].Enabled = (value & 0x80) != 0; Channels[VoiceLatch].DDA = (value & 0x40) != 0; - if (Channels[VoiceLatch].Enabled == false && Channels[VoiceLatch].DDA) + if (!Channels[VoiceLatch].Enabled && Channels[VoiceLatch].DDA) { //for the soudn debugger, this might be a useful indication that a new note has begun.. but not for sure WaveTableWriteOffset = 0; @@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Components Channels[VoiceLatch].Panning = value; break; case 6: // Wave data - if (Channels[VoiceLatch].DDA == false) + if (!Channels[VoiceLatch].DDA) { Channels[VoiceLatch].Wave[WaveTableWriteOffset++] = (short)((value * 2047) - 32767); WaveTableWriteOffset &= 31; @@ -193,8 +193,8 @@ namespace BizHawk.Emulation.Cores.Components private void MixChannel(short[] samples, int start, int len, PSGChannel channel) { - if (channel.Enabled == false) return; - if (channel.DDA == false && channel.Volume == 0) return; + if (!channel.Enabled) return; + if (!channel.DDA && channel.Volume == 0) return; short[] wave = channel.Wave; int freq; @@ -283,4 +283,4 @@ namespace BizHawk.Emulation.Cores.Components public long Time; } } -} \ No newline at end of file +} diff --git a/src/BizHawk.Tests/Common/checksums/SHA1Tests.cs b/src/BizHawk.Tests/Common/checksums/SHA1Tests.cs index 8481e513ff..753e841567 100644 --- a/src/BizHawk.Tests/Common/checksums/SHA1Tests.cs +++ b/src/BizHawk.Tests/Common/checksums/SHA1Tests.cs @@ -13,8 +13,8 @@ namespace BizHawk.Tests.Common.checksums [TestMethod] public void TestSHA1Empty() { - byte[] data = Array.Empty(); // empty data - byte[] expectedSha = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09 }; + byte[] data = []; // empty data + byte[] expectedSha = [0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09]; Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.Compute(data))); } @@ -22,15 +22,15 @@ namespace BizHawk.Tests.Common.checksums [TestMethod] public void TestSHA1Simple() { - byte[] data = { (byte)'h', (byte)'a', (byte)'s', (byte)'h' }; // random short data - byte[] expectedSha = { 0x23, 0x46, 0xad, 0x27, 0xd7, 0x56, 0x8b, 0xa9, 0x89, 0x6f, 0x1b, 0x7d, 0xa6, 0xb5, 0x99, 0x12, 0x51, 0xde, 0xbd, 0xf2 }; + byte[] data = "hash"u8.ToArray(); // random short data + byte[] expectedSha = [0x23, 0x46, 0xad, 0x27, 0xd7, 0x56, 0x8b, 0xa9, 0x89, 0x6f, 0x1b, 0x7d, 0xa6, 0xb5, 0x99, 0x12, 0x51, 0xde, 0xbd, 0xf2]; Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.Compute(data))); Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(Array.Empty(), data))); Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(data, Array.Empty()))); - data = new[] { (byte)'h', (byte)'a' }; - byte[] data2 = { (byte)'s', (byte)'h' }; + data = "ha"u8.ToArray(); + byte[] data2 = "sh"u8.ToArray(); Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(data, data2))); } @@ -40,17 +40,17 @@ namespace BizHawk.Tests.Common.checksums { const string testString = "The quick brown fox jumps over the lazy dog."; byte[] data = Encoding.ASCII.GetBytes(testString); - byte[] expectedSha1 = { 0x40, 0x8d, 0x94, 0x38, 0x42, 0x16, 0xf8, 0x90, 0xff, 0x7a, 0x0c, 0x35, 0x28, 0xe8, 0xbe, 0xd1, 0xe0, 0xb0, 0x16, 0x21 }; + byte[] expectedSha1 = [0x40, 0x8d, 0x94, 0x38, 0x42, 0x16, 0xf8, 0x90, 0xff, 0x7a, 0x0c, 0x35, 0x28, 0xe8, 0xbe, 0xd1, 0xe0, 0xb0, 0x16, 0x21]; Assert.IsTrue(expectedSha1.SequenceEqual(SHA1Checksum.Compute(data))); data = new byte[65]; Encoding.ASCII.GetBytes(testString).CopyTo(data, 0); - byte[] expectedSha2 = { 0x65, 0x87, 0x84, 0xE2, 0x68, 0xBF, 0xB1, 0x67, 0x94, 0x7B, 0xB7, 0xF3, 0xFB, 0x76, 0x69, 0x62, 0x79, 0x3E, 0x8C, 0x46 }; + byte[] expectedSha2 = [0x65, 0x87, 0x84, 0xE2, 0x68, 0xBF, 0xB1, 0x67, 0x94, 0x7B, 0xB7, 0xF3, 0xFB, 0x76, 0x69, 0x62, 0x79, 0x3E, 0x8C, 0x46]; Assert.IsTrue(expectedSha2.SequenceEqual(SHA1Checksum.Compute(new Span(data, 0, 64)))); - byte[] expectedSha3 = { 0x34, 0xF3, 0xA2, 0x57, 0xBD, 0x12, 0x5E, 0x6E, 0x0E, 0x28, 0xD0, 0xE5, 0xDA, 0xBE, 0x22, 0x28, 0x97, 0xFA, 0x69, 0x55 }; + byte[] expectedSha3 = [0x34, 0xF3, 0xA2, 0x57, 0xBD, 0x12, 0x5E, 0x6E, 0x0E, 0x28, 0xD0, 0xE5, 0xDA, 0xBE, 0x22, 0x28, 0x97, 0xFA, 0x69, 0x55]; Assert.IsTrue(expectedSha3.SequenceEqual(SHA1Checksum.Compute(data))); } }