Bump LangVersion to 12

- fix IDE0100
- fix IDE0230
- a couple of usages of the collection expression
This commit is contained in:
Morilli 2024-05-28 13:57:01 +02:00
parent ea042d1a70
commit 62b8ec4578
65 changed files with 210 additions and 215 deletions

View File

@ -16,7 +16,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<Features>strict</Features> <Features>strict</Features>
<IsTargetingNetFramework>$(TargetFramework.StartsWith("net4"))</IsTargetingNetFramework> <IsTargetingNetFramework>$(TargetFramework.StartsWith("net4"))</IsTargetingNetFramework>
<LangVersion>10.0</LangVersion> <LangVersion>12.0</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<NoWarn>SA0001</NoWarn> <NoWarn>SA0001</NoWarn>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View File

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Numerics;
namespace BizHawk.Bizware.Graphics namespace BizHawk.Bizware.Graphics
{ {

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.Common
public static class DisplaySurfaceIDParser public static class DisplaySurfaceIDParser
{ {
#pragma warning disable BHI1005 // switching on string, possibly from user input, ArgumentException is correct here #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 public static DisplaySurfaceID? Parse(string? str) => str?.ToLowerInvariant() switch
{ {
null => null, // this makes it easy to cascade the "remembered" value null => null, // this makes it easy to cascade the "remembered" value

View File

@ -81,7 +81,7 @@ namespace BizHawk.Client.Common
// assume we have a header of that size. Otherwise, assume it's just all rom. // assume we have a header of that size. Otherwise, assume it's just all rom.
// Other 'recognized' header sizes may need to be added. // Other 'recognized' header sizes may need to be added.
int headerOffset = fileLength % BankSize; 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); 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; headerOffset = 0;

View File

@ -32,7 +32,7 @@ namespace BizHawk.Client.Common
else else
{ {
var file = new FileInfo($"{saveStatePrefix}.QuickSave{i % 10}.State"); 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(); file.Directory.Create();
} }

View File

@ -90,7 +90,7 @@ namespace BizHawk.Client.Common.cheats
{ {
// Problem: I don't know what the Non-FF Style codes are. // Problem: I don't know what the Non-FF Style codes are.
// TODO: Fix that. // TODO: Fix that.
if (code.StartsWithOrdinal("FF") == false) if (!code.StartsWithOrdinal("FF"))
{ {
return new InvalidCheatCode("This Action Replay Code, is not yet supported."); return new InvalidCheatCode("This Action Replay Code, is not yet supported.");
} }

View File

@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
{ {
foreach (var boundBtn in v) foreach (var boundBtn in v)
{ {
if (_buttons[k] == false && controller.IsPressed(boundBtn)) if (!_buttons[k] && controller.IsPressed(boundBtn))
{ {
_buttonStarts[k] = _emulator.Frame; _buttonStarts[k] = _emulator.Frame;
} }

View File

@ -43,7 +43,7 @@ namespace BizHawk.Client.Common
{ {
var file = new FileInfo(Filename); var file = new FileInfo(Filename);
if (file.Exists == false) if (!file.Exists)
{ {
Loaded = false; Loaded = false;
return false; return false;
@ -84,4 +84,4 @@ namespace BizHawk.Client.Common
return true; return true;
} }
} }
} }

View File

@ -316,7 +316,7 @@ namespace BizHawk.Client.Common
public bool Load(IMemoryDomains domains, string path, bool append) public bool Load(IMemoryDomains domains, string path, bool append)
{ {
var file = new FileInfo(path); var file = new FileInfo(path);
if (file.Exists == false) if (!file.Exists)
{ {
return false; return false;
} }

View File

@ -376,7 +376,7 @@ namespace BizHawk.Client.Common
private bool LoadFile(string path, bool append) private bool LoadFile(string path, bool append)
{ {
var file = new FileInfo(path); var file = new FileInfo(path);
if (file.Exists == false) if (!file.Exists)
{ {
return false; return false;
} }

View File

@ -239,7 +239,7 @@ namespace BizHawk.Client.EmuHawk
// Record movie dialog should not be opened while in need of a reboot, // 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 // Otherwise the wrong sync settings could be set for the recording movie and cause crashes
RecordMovieMenuItem.Enabled = !Tools.IsLoaded<TAStudio>() RecordMovieMenuItem.Enabled = !Tools.IsLoaded<TAStudio>()
&& RebootStatusBarIcon.Visible == false; && !RebootStatusBarIcon.Visible;
PlayFromBeginningMenuItem.Enabled = MovieSession.Movie.IsActive() && !Tools.IsLoaded<TAStudio>(); PlayFromBeginningMenuItem.Enabled = MovieSession.Movie.IsActive() && !Tools.IsLoaded<TAStudio>();
} }

View File

@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk
// Don't do this from browse // Don't do this from browse
if (movie.Hash == _game.Hash if (movie.Hash == _game.Hash
|| _config.PlayMovieMatchHash == false || force) || !_config.PlayMovieMatchHash || force)
{ {
return movie; return movie;
} }

View File

@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (result == false) if (!result)
{ {
_current.Status = Result.EStatus.FalseOnLoad; _current.Status = Result.EStatus.FalseOnLoad;
_results.Add(_current); _results.Add(_current);

View File

@ -353,7 +353,7 @@ namespace BizHawk.Client.EmuHawk
GoToAddress(found); GoToAddress(found);
_findStr = search; _findStr = search;
} }
else if (wrap == false) else if (!wrap)
{ {
FindPrev(value, true); // Search the opposite direction if not found FindPrev(value, true); // Search the opposite direction if not found
} }
@ -400,7 +400,7 @@ namespace BizHawk.Client.EmuHawk
GoToAddress(found); GoToAddress(found);
_findStr = search; _findStr = search;
} }
else if (wrap == false) else if (!wrap)
{ {
FindPrev(value, true); // Search the opposite direction if not found FindPrev(value, true); // Search the opposite direction if not found
} }

View File

@ -163,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (now == false && _emu.Frame % RefreshRate.Value != 0) if (!now && _emu.Frame % RefreshRate.Value != 0)
{ {
return; return;
} }

View File

@ -850,7 +850,7 @@ namespace BizHawk.Client.EmuHawk
var path = _config.PathEntries.CheatsAbsolutePath(_game.System); var path = _config.PathEntries.CheatsAbsolutePath(_game.System);
var f = new FileInfo(path); var f = new FileInfo(path);
if (f.Directory != null && f.Directory.Exists == false) if (f.Directory != null && !f.Directory.Exists)
{ {
f.Directory.Create(); f.Directory.Create();
} }

View File

@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
{ {
InputManager.AutofireStickyXorAdapter.SetSticky(Name, Checked); InputManager.AutofireStickyXorAdapter.SetSticky(Name, Checked);
if (Checked == false) if (!Checked)
{ {
Clear(); Clear();
} }
@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
{ {
InputManager.StickyXorAdapter.SetSticky(Name, Checked); InputManager.StickyXorAdapter.SetSticky(Name, Checked);
if (Checked == false) if (!Checked)
{ {
Clear(); Clear();
} }

View File

@ -24,7 +24,7 @@ namespace BizHawk.Common
public static void EnableDomain(string domain) public static void EnableDomain(string domain)
{ {
if (EnabledLogDomains.Contains(domain) == false) if (!EnabledLogDomains.Contains(domain))
{ {
EnabledLogDomains.Add(domain); EnabledLogDomains.Add(domain);
} }

View File

@ -100,9 +100,8 @@ namespace BizHawk.Emulation.Common
if (!inUser) _expected.Remove(Path.GetFileName(path)); if (!inUser) _expected.Remove(Path.GetFileName(path));
//reminder: this COULD be done on several threads, if it takes even longer //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)); 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 try
{ {
if (line.StartsWith(';')) continue; // comment if (line.StartsWith(';')) continue; // comment

View File

@ -162,7 +162,7 @@ namespace BizHawk.Emulation.Common
return; 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) foreach (var opt in options)
{ {

View File

@ -348,7 +348,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
sbyte a = D[dReg].s8; sbyte a = D[dReg].s8;
sbyte b = ReadValueB(mode, reg); sbyte b = ReadValueB(mode, reg);
int result = a - b; 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; V = result > sbyte.MaxValue || result < sbyte.MinValue;
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
@ -361,7 +361,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
short a = D[dReg].s16; short a = D[dReg].s16;
short b = ReadValueW(mode, reg); short b = ReadValueW(mode, reg);
int result = a - b; 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; V = result > short.MaxValue || result < short.MinValue;
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
@ -374,7 +374,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
int a = D[dReg].s32; int a = D[dReg].s32;
int b = ReadValueL(mode, reg); int b = ReadValueL(mode, reg);
long result = a - b; 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; V = result > int.MaxValue || result < int.MinValue;
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
@ -399,7 +399,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
sbyte a = PeekValueB(mode, reg); sbyte a = PeekValueB(mode, reg);
sbyte b = D[dReg].s8; sbyte b = D[dReg].s8;
int result = a - b; 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; V = result > sbyte.MaxValue || result < sbyte.MinValue;
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
@ -412,7 +412,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
short a = PeekValueW(mode, reg); short a = PeekValueW(mode, reg);
short b = D[dReg].s16; short b = D[dReg].s16;
int result = a - b; 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; V = result > short.MaxValue || result < short.MinValue;
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
@ -425,7 +425,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
int a = PeekValueL(mode, reg); int a = PeekValueL(mode, reg);
int b = D[dReg].s32; int b = D[dReg].s32;
long result = a - b; 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; V = result > int.MaxValue || result < int.MinValue;
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
@ -471,7 +471,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
sbyte b = (sbyte)ReadWord(PC); PC += 2; sbyte b = (sbyte)ReadWord(PC); PC += 2;
sbyte a = PeekValueB(mode, reg); sbyte a = PeekValueB(mode, reg);
int result = a - b; 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; V = result > sbyte.MaxValue || result < sbyte.MinValue;
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
@ -485,7 +485,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
short b = ReadWord(PC); PC += 2; short b = ReadWord(PC); PC += 2;
short a = PeekValueW(mode, reg); short a = PeekValueW(mode, reg);
int result = a - b; 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; V = result > short.MaxValue || result < short.MinValue;
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
@ -499,7 +499,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
int b = ReadLong(PC); PC += 4; int b = ReadLong(PC); PC += 4;
int a = PeekValueL(mode, reg); int a = PeekValueL(mode, reg);
long result = a - b; 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; V = result > int.MaxValue || result < int.MinValue;
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
@ -555,7 +555,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
V = result > sbyte.MaxValue || result < sbyte.MinValue; 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); WriteValueB(mode, reg, (sbyte)result);
if (mode == 0) PendingCycles -= 4; if (mode == 0) PendingCycles -= 4;
else PendingCycles -= 8 + EACyclesBW[mode, reg]; else PendingCycles -= 8 + EACyclesBW[mode, reg];
@ -575,7 +575,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
V = result > short.MaxValue || result < short.MinValue; 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); WriteValueW(mode, reg, (short)result);
} }
if (mode <= 1) PendingCycles -= 4; if (mode <= 1) PendingCycles -= 4;
@ -591,7 +591,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
V = result > int.MaxValue || result < int.MinValue; 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); WriteValueL(mode, reg, (int)result);
if (mode <= 1) PendingCycles -= 8; if (mode <= 1) PendingCycles -= 8;
@ -676,7 +676,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
V = result > sbyte.MaxValue || result < sbyte.MinValue; 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); WriteValueB(mode, reg, (sbyte)result);
if (mode == 0) PendingCycles -= 4; if (mode == 0) PendingCycles -= 4;
else PendingCycles -= 8 + EACyclesBW[mode, reg]; else PendingCycles -= 8 + EACyclesBW[mode, reg];
@ -689,7 +689,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
V = result > short.MaxValue || result < short.MinValue; 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); WriteValueW(mode, reg, (short)result);
if (mode == 0) PendingCycles -= 4; if (mode == 0) PendingCycles -= 4;
else PendingCycles -= 8 + EACyclesBW[mode, reg]; else PendingCycles -= 8 + EACyclesBW[mode, reg];
@ -702,7 +702,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
V = result > int.MaxValue || result < int.MinValue; 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); WriteValueL(mode, reg, (int)result);
if (mode == 0) PendingCycles -= 8; if (mode == 0) PendingCycles -= 8;
else PendingCycles -= 12 + EACyclesL[mode, reg]; else PendingCycles -= 12 + EACyclesL[mode, reg];
@ -755,7 +755,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
V = result > sbyte.MaxValue || result < sbyte.MinValue; 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; if (mode == 0) PendingCycles -= 8;
PendingCycles -= 4 + EACyclesBW[mode, reg]; PendingCycles -= 4 + EACyclesBW[mode, reg];
return; return;
@ -768,7 +768,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
V = result > short.MaxValue || result < short.MinValue; 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; if (mode == 0) PendingCycles -= 8;
PendingCycles -= 4 + EACyclesBW[mode, reg]; PendingCycles -= 4 + EACyclesBW[mode, reg];
return; return;
@ -781,7 +781,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
V = result > int.MaxValue || result < int.MinValue; 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]; PendingCycles -= 6 + EACyclesL[mode, reg];
return; return;
} }
@ -832,7 +832,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
V = result > short.MaxValue || result < short.MinValue; 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]; PendingCycles -= 6 + EACyclesBW[mode, reg];
return; return;
} }
@ -844,7 +844,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
V = result > int.MaxValue || result < int.MinValue; 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]; PendingCycles -= 6 + EACyclesL[mode, reg];
return; return;
} }
@ -890,7 +890,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
V = result > sbyte.MaxValue || result < sbyte.MinValue; V = result > sbyte.MaxValue || result < sbyte.MinValue;
C = ((a < b) ^ ((a ^ b) >= 0) == false); C = (a < b) ^ (a ^ b) < 0;
PendingCycles -= 12; PendingCycles -= 12;
return; return;
} }
@ -902,7 +902,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
V = result > short.MaxValue || result < short.MinValue; V = result > short.MaxValue || result < short.MinValue;
C = ((a < b) ^ ((a ^ b) >= 0) == false); C = (a < b) ^ (a ^ b) < 0;
PendingCycles -= 12; PendingCycles -= 12;
return; return;
} }
@ -914,7 +914,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
V = result > int.MaxValue || result < int.MinValue; V = result > int.MaxValue || result < int.MinValue;
C = ((a < b) ^ ((a ^ b) >= 0) == false); C = (a < b) ^ (a ^ b) < 0;
PendingCycles -= 20; PendingCycles -= 20;
return; return;
} }
@ -954,7 +954,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80) != 0; N = (result & 0x80) != 0;
Z = result == 0; Z = result == 0;
V = result > sbyte.MaxValue || result < sbyte.MinValue; 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; if (mode == 0) PendingCycles -= 8;
else PendingCycles -= 8 + EACyclesBW[mode, reg]; else PendingCycles -= 8 + EACyclesBW[mode, reg];
return; return;
@ -967,7 +967,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x8000) != 0; N = (result & 0x8000) != 0;
Z = result == 0; Z = result == 0;
V = result > short.MaxValue || result < short.MinValue; 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; if (mode == 0) PendingCycles -= 8;
else PendingCycles -= 8 + EACyclesBW[mode, reg]; else PendingCycles -= 8 + EACyclesBW[mode, reg];
return; return;
@ -980,7 +980,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
N = (result & 0x80000000) != 0; N = (result & 0x80000000) != 0;
Z = result == 0; Z = result == 0;
V = result > int.MaxValue || result < int.MinValue; 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; if (mode == 0) PendingCycles -= 14;
else PendingCycles -= 12 + EACyclesL[mode, reg]; else PendingCycles -= 12 + EACyclesL[mode, reg];
return; return;

View File

@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
{ {
private void MOVEtSR() private void MOVEtSR()
{ {
if (S == false) if (!S)
throw new Exception("Write to SR when not in supervisor mode. supposed to trap or something..."); throw new Exception("Write to SR when not in supervisor mode. supposed to trap or something...");
int mode = (op >> 3) & 7; int mode = (op >> 3) & 7;
@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
private void MOVEUSP() private void MOVEUSP()
{ {
if (S == false) if (!S)
throw new Exception("MOVE to USP when not supervisor. needs to trap"); throw new Exception("MOVE to USP when not supervisor. needs to trap");
int dir = (op >> 3) & 1; int dir = (op >> 3) & 1;
@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
private void ANDI_SR() private void ANDI_SR()
{ {
if (S == false) if (!S)
throw new Exception("trap!"); throw new Exception("trap!");
SR &= ReadWord(PC); PC += 2; SR &= ReadWord(PC); PC += 2;
PendingCycles -= 20; PendingCycles -= 20;
@ -85,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
private void EORI_SR() private void EORI_SR()
{ {
if (S == false) if (!S)
throw new Exception("trap!"); throw new Exception("trap!");
SR ^= ReadWord(PC); PC += 2; SR ^= ReadWord(PC); PC += 2;
PendingCycles -= 20; PendingCycles -= 20;
@ -101,7 +101,7 @@ namespace BizHawk.Emulation.Cores.Components.M68000
private void ORI_SR() private void ORI_SR()
{ {
if (S == false) if (!S)
throw new Exception("trap!"); throw new Exception("trap!");
SR |= ReadWord(PC); PC += 2; SR |= ReadWord(PC); PC += 2;
PendingCycles -= 20; PendingCycles -= 20;
@ -160,4 +160,4 @@ namespace BizHawk.Emulation.Cores.Components.M68000
PC = ReadLong(vector * 4); // Jump to vector PC = ReadLong(vector * 4); // Jump to vector
} }
} }
} }

View File

@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{ {
int lastCycles = PendingCycles; 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 >> 8));
WriteMemory((ushort)(S-- + 0x2100), (byte)PC); WriteMemory((ushort)(S-- + 0x2100), (byte)PC);
@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 8; 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 >> 8));
WriteMemory((ushort)(S-- + 0x2100), (byte)PC); WriteMemory((ushort)(S-- + 0x2100), (byte)PC);
@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 8; 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 >> 8));
WriteMemory((ushort)(S-- + 0x2100), (byte)PC); WriteMemory((ushort)(S-- + 0x2100), (byte)PC);
@ -87,7 +87,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x01: // ORA (addr,X) case 0x01: // ORA (addr,X)
value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000))); value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000)));
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -124,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x05: // ORA zp case 0x05: // ORA zp
value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000)); value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000));
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -161,7 +161,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x09: // ORA #nn case 0x09: // ORA #nn
value8 = ReadMemory(PC++); value8 = ReadMemory(PC++);
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -193,7 +193,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x0D: // ORA addr case 0x0D: // ORA addr
value8 = ReadMemory(ReadWord(PC)); PC += 2; value8 = ReadMemory(ReadWord(PC)); PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -230,7 +230,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x10: // BPL +/-rel case 0x10: // BPL +/-rel
rel8 = (sbyte)ReadMemory(PC++); rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8); value16 = (ushort)(PC + rel8);
if (FlagN == false) if (!FlagN)
{ {
PendingCycles -= 2; PendingCycles -= 2;
PC = value16; PC = value16;
@ -240,7 +240,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x11: // ORA (addr),Y case 0x11: // ORA (addr),Y
temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)); temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000));
value8 = ReadMemory((ushort)(temp16 + Y)); value8 = ReadMemory((ushort)(temp16 + Y));
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -257,7 +257,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x12: // ORA (addr) case 0x12: // ORA (addr)
value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000))); value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)));
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -288,7 +288,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x15: // ORA zp,X case 0x15: // ORA zp,X
value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000)); value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000));
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -326,7 +326,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x19: // ORA addr,Y case 0x19: // ORA addr,Y
value8 = ReadMemory((ushort)(ReadWord(PC) + Y)); value8 = ReadMemory((ushort)(ReadWord(PC) + Y));
PC += 2; PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -357,7 +357,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x1D: // ORA addr,X case 0x1D: // ORA addr,X
value8 = ReadMemory((ushort)(ReadWord(PC) + X)); value8 = ReadMemory((ushort)(ReadWord(PC) + X));
PC += 2; PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A |= value8; A |= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -401,7 +401,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x21: // AND (addr,X) case 0x21: // AND (addr,X)
value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000))); value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000)));
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -436,7 +436,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x25: // AND zp case 0x25: // AND zp
value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000)); value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000));
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -473,7 +473,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
goto AfterClearTFlag; goto AfterClearTFlag;
case 0x29: // AND #nn case 0x29: // AND #nn
value8 = ReadMemory(PC++); value8 = ReadMemory(PC++);
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -504,7 +504,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x2D: // AND addr case 0x2D: // AND addr
value8 = ReadMemory(ReadWord(PC)); PC += 2; value8 = ReadMemory(ReadWord(PC)); PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -551,7 +551,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x31: // AND (addr),Y case 0x31: // AND (addr),Y
temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)); temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000));
value8 = ReadMemory((ushort)(temp16 + Y)); value8 = ReadMemory((ushort)(temp16 + Y));
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -568,7 +568,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x32: // AND (addr) case 0x32: // AND (addr)
value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000))); value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)));
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -592,7 +592,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x35: // AND zp,X case 0x35: // AND zp,X
value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000)); value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000));
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -630,7 +630,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x39: // AND addr,Y case 0x39: // AND addr,Y
value8 = ReadMemory((ushort)(ReadWord(PC) + Y)); value8 = ReadMemory((ushort)(ReadWord(PC) + Y));
PC += 2; PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -660,7 +660,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x3D: // AND addr,X case 0x3D: // AND addr,X
value8 = ReadMemory((ushort)(ReadWord(PC) + X)); value8 = ReadMemory((ushort)(ReadWord(PC) + X));
PC += 2; PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A &= value8; A &= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -703,7 +703,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
goto AfterClearTFlag; goto AfterClearTFlag;
case 0x41: // EOR (addr,X) case 0x41: // EOR (addr,X)
value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000))); value8 = ReadMemory(ReadWordPageWrap((ushort)((byte)(ReadMemory(PC++) + X) + 0x2000)));
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -747,7 +747,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x45: // EOR zp case 0x45: // EOR zp
value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000)); value8 = ReadMemory((ushort)(ReadMemory(PC++) + 0x2000));
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -784,7 +784,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x49: // EOR #nn case 0x49: // EOR #nn
value8 = ReadMemory(PC++); value8 = ReadMemory(PC++);
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -811,7 +811,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x4D: // EOR addr case 0x4D: // EOR addr
value8 = ReadMemory(ReadWord(PC)); PC += 2; value8 = ReadMemory(ReadWord(PC)); PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -848,7 +848,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x50: // BVC +/-rel case 0x50: // BVC +/-rel
rel8 = (sbyte)ReadMemory(PC++); rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8); value16 = (ushort)(PC + rel8);
if (FlagV == false) if (!FlagV)
{ {
PendingCycles -= 2; PendingCycles -= 2;
PC = value16; PC = value16;
@ -858,7 +858,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x51: // EOR (addr),Y case 0x51: // EOR (addr),Y
temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)); temp16 = ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000));
value8 = ReadMemory((ushort)(temp16 + Y)); value8 = ReadMemory((ushort)(temp16 + Y));
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -875,7 +875,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x52: // EOR (addr) case 0x52: // EOR (addr)
value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000))); value8 = ReadMemory(ReadWordPageWrap((ushort)(ReadMemory(PC++) + 0x2000)));
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -905,7 +905,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
break; break;
case 0x55: // EOR zp,X case 0x55: // EOR zp,X
value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000)); value8 = ReadMemory((ushort)(((ReadMemory(PC++) + X) & 0xFF) + 0x2000));
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -943,7 +943,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x59: // EOR addr,Y case 0x59: // EOR addr,Y
value8 = ReadMemory((ushort)(ReadWord(PC) + Y)); value8 = ReadMemory((ushort)(ReadWord(PC) + Y));
PC += 2; PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -965,7 +965,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x5D: // EOR addr,X case 0x5D: // EOR addr,X
value8 = ReadMemory((ushort)(ReadWord(PC) + X)); value8 = ReadMemory((ushort)(ReadWord(PC) + X));
PC += 2; PC += 2;
if (FlagT == false) if (!FlagT)
{ {
A ^= value8; A ^= value8;
P = (byte)((P & 0x7D) | TableNZ[A]); P = (byte)((P & 0x7D) | TableNZ[A]);
@ -1032,7 +1032,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1077,7 +1077,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1134,7 +1134,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1181,7 +1181,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1247,7 +1247,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1283,7 +1283,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1294,7 +1294,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 7; PendingCycles -= 7;
break; break;
case 0x73: // TII src, dest, len case 0x73: // TII src, dest, len
if (InBlockTransfer == false) if (!InBlockTransfer)
{ {
InBlockTransfer = true; InBlockTransfer = true;
btFrom = ReadWord(PC); PC += 2; btFrom = ReadWord(PC); PC += 2;
@ -1348,7 +1348,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1405,7 +1405,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1451,7 +1451,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
FlagC = temp > 0xFF; FlagC = temp > 0xFF;
source8 = (byte)temp; source8 = (byte)temp;
} }
if (FlagT == false) if (!FlagT)
A = source8; A = source8;
else else
{ {
@ -1569,7 +1569,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0x90: // BCC +/-rel case 0x90: // BCC +/-rel
rel8 = (sbyte)ReadMemory(PC++); rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8); value16 = (ushort)(PC + rel8);
if (FlagC == false) if (!FlagC)
{ {
PendingCycles -= 2; PendingCycles -= 2;
PC = value16; PC = value16;
@ -1858,7 +1858,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 2; PendingCycles -= 2;
break; break;
case 0xC3: // TDD src, dest, len case 0xC3: // TDD src, dest, len
if (InBlockTransfer == false) if (!InBlockTransfer)
{ {
InBlockTransfer = true; InBlockTransfer = true;
btFrom = ReadWord(PC); PC += 2; btFrom = ReadWord(PC); PC += 2;
@ -1958,7 +1958,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0xD0: // BNE +/-rel case 0xD0: // BNE +/-rel
rel8 = (sbyte)ReadMemory(PC++); rel8 = (sbyte)ReadMemory(PC++);
value16 = (ushort)(PC + rel8); value16 = (ushort)(PC + rel8);
if (FlagZ == false) if (!FlagZ)
{ {
PendingCycles -= 2; PendingCycles -= 2;
PC = value16; PC = value16;
@ -1981,7 +1981,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 7; PendingCycles -= 7;
break; break;
case 0xD3: // TIN src, dest, len case 0xD3: // TIN src, dest, len
if (InBlockTransfer == false) if (!InBlockTransfer)
{ {
InBlockTransfer = true; InBlockTransfer = true;
btFrom = ReadWord(PC); PC += 2; btFrom = ReadWord(PC); PC += 2;
@ -2103,7 +2103,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 7; PendingCycles -= 7;
break; break;
case 0xE3: // TIA src, dest, len case 0xE3: // TIA src, dest, len
if (InBlockTransfer == false) if (!InBlockTransfer)
{ {
InBlockTransfer = true; InBlockTransfer = true;
btFrom = ReadWord(PC); PC += 2; btFrom = ReadWord(PC); PC += 2;
@ -2312,7 +2312,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
PendingCycles -= 7; PendingCycles -= 7;
break; break;
case 0xF3: // TAI src, dest, len case 0xF3: // TAI src, dest, len
if (InBlockTransfer == false) if (!InBlockTransfer)
{ {
InBlockTransfer = true; InBlockTransfer = true;
btFrom = ReadWord(PC); PC += 2; btFrom = ReadWord(PC); PC += 2;
@ -2340,7 +2340,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
case 0xF4: // SET case 0xF4: // SET
int a; // TODO remove these extra checks int a; // TODO remove these extra checks
string b = Disassemble(PC, out a); 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); Console.WriteLine("SETTING T FLAG, NEXT INSTRUCTION IS UNHANDLED: {0}", b);
FlagT = true; FlagT = true;
PendingCycles -= 2; PendingCycles -= 2;

View File

@ -236,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
public void WriteTimerEnable(byte value) 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 TimerValue = TimerReloadValue; // timer value is reset when toggled from off to on
TimerTickCounter = 0; 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 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
}; };
} }
} }

View File

@ -1146,7 +1146,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BVC() private void RelBranch_Stage2_BVC()
{ {
branch_taken = FlagV == false; branch_taken = !FlagV;
RelBranch_Stage2(); RelBranch_Stage2();
} }
@ -1158,7 +1158,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BPL() private void RelBranch_Stage2_BPL()
{ {
branch_taken = FlagN == false; branch_taken = !FlagN;
RelBranch_Stage2(); RelBranch_Stage2();
} }
@ -1170,7 +1170,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BCC() private void RelBranch_Stage2_BCC()
{ {
branch_taken = FlagC == false; branch_taken = !FlagC;
RelBranch_Stage2(); RelBranch_Stage2();
} }
@ -1182,7 +1182,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
private void RelBranch_Stage2_BNE() private void RelBranch_Stage2_BNE()
{ {
branch_taken = FlagZ == false; branch_taken = !FlagZ;
RelBranch_Stage2(); RelBranch_Stage2();
} }

View File

@ -381,7 +381,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
long cycles = cpuCycle - _lastCycle; long cycles = cpuCycle - _lastCycle;
// check whether tape is actually playing // check whether tape is actually playing
if (tapeMotor == false) if (!tapeMotor)
{ {
// it's not playing. Update lastCycle and return // it's not playing. Update lastCycle and return
_lastCycle = cpuCycle; _lastCycle = cpuCycle;

View File

@ -125,7 +125,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media
writer.Write(syncBytes40); // sync 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(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(syncBytes40); // sync
writer.Write(EncodeGcr(writtenData)); // data writer.Write(EncodeGcr(writtenData)); // data
writer.Write(Enumerable.Repeat((byte)0x55, gapLength).ToArray()); // gap writer.Write(Enumerable.Repeat((byte)0x55, gapLength).ToArray()); // gap

View File

@ -418,7 +418,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
bool is48k = _machine.IsIn48kMode(); bool is48k = _machine.IsIn48kMode();
// check whether tape is actually playing // check whether tape is actually playing
if (_tapeIsPlaying == false) if (!_tapeIsPlaying)
{ {
// it's not playing. Update lastCycle and return // it's not playing. Update lastCycle and return
_lastCycle = cpuCycle; _lastCycle = cpuCycle;

View File

@ -90,7 +90,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// memory paging // memory paging
// this is controlled by writes to port 0x7ffd // 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 // 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; Last7ffd = value;

View File

@ -93,7 +93,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// memory paging // memory paging
// this is controlled by writes to port 0x7ffd // 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 // 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; Last7ffd = value;

View File

@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_tia.New_Frame = false; _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 _tia.AudioClocks = 0; // we need this here since the async sound provider won't check in this case
} }

View File

@ -403,8 +403,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// These signatures are attributed to the MESS project // These signatures are attributed to the MESS project
return ContainsAny(rom, new List<byte[]> return ContainsAny(rom, new List<byte[]>
{ {
new byte[] { 0x44, 0x50, 0x43, 0x2B }, // why is this checking the same value twice? ...
new byte[] { 0x44, 0x50, 0x43, 0x2B }, "DPC+"u8.ToArray(),
"DPC+"u8.ToArray(),
}); });
} }

View File

@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
if (c.IsPressed(Definition.BoolButtons[7])) retVal = 0x0D; if (c.IsPressed(Definition.BoolButtons[7])) retVal = 0x0D;
if (c.IsPressed(Definition.BoolButtons[12])) retVal = 0x0E; 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 retVal |= 0x30; // always set these bits
return retVal; return retVal;
} }
@ -300,7 +300,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
if (c.IsPressed(Definition.BoolButtons[18])) retVal = 0x04; if (c.IsPressed(Definition.BoolButtons[18])) retVal = 0x04;
if (c.IsPressed(Definition.BoolButtons[19])) retVal = 0x08; 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 retVal |= 0x30; // always set these bits
return retVal; return retVal;
} }

View File

@ -169,7 +169,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void RenderBackgroundM0(int scanLine) private void RenderBackgroundM0(int scanLine)
{ {
if (DisplayOn == false) if (!DisplayOn)
{ {
Array.Clear(FrameBuffer, scanLine * 256, 256); Array.Clear(FrameBuffer, scanLine * 256, 256);
return; return;
@ -204,7 +204,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void RenderBackgroundM1(int scanLine) private void RenderBackgroundM1(int scanLine)
{ {
if (DisplayOn == false) if (!DisplayOn)
{ {
Array.Clear(FrameBuffer, scanLine * 256, 256); Array.Clear(FrameBuffer, scanLine * 256, 256);
return; return;
@ -237,7 +237,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void RenderBackgroundM2(int scanLine) private void RenderBackgroundM2(int scanLine)
{ {
if (DisplayOn == false) if (!DisplayOn)
{ {
Array.Clear(FrameBuffer, scanLine * 256, 256); Array.Clear(FrameBuffer, scanLine * 256, 256);
return; return;
@ -274,7 +274,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void RenderBackgroundM3(int scanLine) private void RenderBackgroundM3(int scanLine)
{ {
if (DisplayOn == false) if (!DisplayOn)
{ {
Array.Clear(FrameBuffer, scanLine * 256, 256); Array.Clear(FrameBuffer, scanLine * 256, 256);
return; return;
@ -312,19 +312,15 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void RenderTmsSprites(int scanLine) private void RenderTmsSprites(int scanLine)
{ {
if (EnableDoubledSprites == false) if (EnableDoubledSprites)
{
RenderTmsSpritesStandard(scanLine);
}
else
{
RenderTmsSpritesDouble(scanLine); RenderTmsSpritesDouble(scanLine);
} else
RenderTmsSpritesStandard(scanLine);
} }
private void RenderTmsSpritesStandard(int scanLine) private void RenderTmsSpritesStandard(int scanLine)
{ {
if (DisplayOn == false) return; if (!DisplayOn) return;
Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(ScanlinePriorityBuffer, 0, 256);
Array.Clear(SpriteCollisionBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256);
@ -391,7 +387,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void RenderTmsSpritesDouble(int scanLine) private void RenderTmsSpritesDouble(int scanLine)
{ {
if (DisplayOn == false) return; if (!DisplayOn) return;
Array.Clear(ScanlinePriorityBuffer, 0, 256); Array.Clear(ScanlinePriorityBuffer, 0, 256);
Array.Clear(SpriteCollisionBuffer, 0, 256); Array.Clear(SpriteCollisionBuffer, 0, 256);
@ -517,4 +513,4 @@ namespace BizHawk.Emulation.Cores.ColecoVision
} }
} }
} }
} }

View File

@ -1408,7 +1408,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// since the units run concurrently, the APU frame sequencer is ran last because // since the units run concurrently, the APU frame sequencer is ran last because
// it can change the output values of the pulse/triangle channels // it can change the output values of the pulse/triangle channels
// we want the changes to affect it on the *next* cycle. // we want the changes to affect it on the *next* cycle.
if (sequencer_irq_flag == false) if (!sequencer_irq_flag)
sequencer_irq = false; sequencer_irq = false;
if (DebugCallbackDivider != 0) if (DebugCallbackDivider != 0)

View File

@ -136,7 +136,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPpu(int addr) public override byte ReadPpu(int addr)
{ {
if (chr_enabled == false) if (!chr_enabled)
{ {
return 0x12; return 0x12;
} }

View File

@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr) public override byte ReadPrg(int addr)
{ {
if (prg_mode == false) if (!prg_mode)
{ {
int bank = (prg_reg >> 1) & prg_bank_mask_32k; int bank = (prg_reg >> 1) & prg_bank_mask_32k;
return Rom[(bank * 0x8000) + addr + chip_offset]; return Rom[(bank * 0x8000) + addr + chip_offset];

View File

@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
protected override int Get_PRGBank_8K(int addr) protected override int Get_PRGBank_8K(int addr)
{ {
int bank_8k = mmc3.Get_PRGBank_8K(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) else if (addr < 0x2000)
{ {
return prg_page*4; return prg_page*4;
@ -80,4 +80,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return bank_1k | chr_block_or; return bank_1k | chr_block_or;
} }
} }
} }

View File

@ -53,7 +53,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr) public override byte ReadPrg(int addr)
{ {
if (prg_mode == false) if (!prg_mode)
{ {
return Rom[((prg_reg >> 1) * 0x8000) + addr]; return Rom[((prg_reg >> 1) * 0x8000) + addr];
} }

View File

@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_16k = (byte)(value & 7); prg_bank_16k = (byte)(value & 7);
SyncPRG(); SyncPRG();
if (value.Bit(3) == false) if (!value.Bit(3))
{ {
if (holydiver) if (holydiver)
SetMirrorType(EMirrorType.Horizontal); SetMirrorType(EMirrorType.Horizontal);

View File

@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr) public override byte ReadPrg(int addr)
{ {
if (prg_mode == false) if (!prg_mode)
{ {
int bank = (prg_reg >> 1) & prg_bank_mask_32k; int bank = (prg_reg >> 1) & prg_bank_mask_32k;
return Rom[(bank * 0x8000) + addr]; return Rom[(bank * 0x8000) + addr];

View File

@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
int baseAddr = resetSwitchMode && resetFlag ? 0x80000 : 0; 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))]; return Rom[baseAddr + (( ((prg_page >> 1) & prg_mask_32k) << 15) + (addr & 0x7FFF))];
} }

View File

@ -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 //maybe only the multicarts do it, to keep the game from clobbering vram on accident
//vram_protected = o; //vram_protected = o;
if (o && S == false) if (o && !S)
{ {
_prgBanks16K[0] = (byte)(p); _prgBanks16K[0] = (byte)(p);
_prgBanks16K[1] = (byte)(p); _prgBanks16K[1] = (byte)(p);
@ -74,22 +74,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
_prgBanks16K[0] = (byte)((p & ~1)); _prgBanks16K[0] = (byte)((p & ~1));
_prgBanks16K[1] = (byte)((p & ~1) + 1); _prgBanks16K[1] = (byte)((p & ~1) + 1);
} }
if (o == false && S == false && L == false) if (!o && !S && !L)
{ {
_prgBanks16K[0] = (byte)p; _prgBanks16K[0] = (byte)p;
_prgBanks16K[1] = (byte)(p & 0x38); _prgBanks16K[1] = (byte)(p & 0x38);
} }
if (o == false && S && L == false) if (!o && S && !L)
{ {
_prgBanks16K[0] = (byte)(p & 0x3E); _prgBanks16K[0] = (byte)(p & 0x3E);
_prgBanks16K[1] = (byte)(p & 0x38); _prgBanks16K[1] = (byte)(p & 0x38);
} }
if (o == false && S == false && L) if (!o && !S && L)
{ {
_prgBanks16K[0] = (byte)p; _prgBanks16K[0] = (byte)p;
_prgBanks16K[1] = (byte)(p | 0x07); _prgBanks16K[1] = (byte)(p | 0x07);
} }
if (o == false && S && L) if (!o && S && L)
{ {
_prgBanks16K[0] = (byte)(p & 0x3E); _prgBanks16K[0] = (byte)(p & 0x3E);
_prgBanks16K[1] = (byte)(p | 0x07); _prgBanks16K[1] = (byte)(p | 0x07);

View File

@ -74,7 +74,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
} }
else else
{ {
if (prg_mode == false) if (!prg_mode)
{ {
return Rom[((prg_page >> 1) * 0x8000) + addr + chip1_offset]; return Rom[((prg_page >> 1) * 0x8000) + addr + chip1_offset];
} }

View File

@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr) public override byte ReadPrg(int addr)
{ {
if (prg_mode == false) if (!prg_mode)
{ {
return Rom[((prg_page >> 1) * 0x8000) + addr]; return Rom[((prg_page >> 1) * 0x8000) + addr];
} }

View File

@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr) public override byte ReadPrg(int addr)
{ {
if (prg_mode == false) if (!prg_mode)
{ {
return Rom[(((prg_page >> 1) * 0x8000) + addr) & prg_byte_mask]; return Rom[(((prg_page >> 1) * 0x8000) + addr) & prg_byte_mask];
} }

View File

@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPrg(int addr) public override byte ReadPrg(int addr)
{ {
if (prg_mode == false) if (!prg_mode)
{ {
return Rom[((prg_reg >> 1) * 0x8000) + addr]; return Rom[((prg_reg >> 1) * 0x8000) + addr];
} }

View File

@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_16k = (byte)((value >> 4) & 7); prg_bank_16k = (byte)((value >> 4) & 7);
SyncPRG(); SyncPRG();
if (value.Bit(3) == false) if (!value.Bit(3))
SetMirrorType(EMirrorType.OneScreenA); SetMirrorType(EMirrorType.OneScreenA);
else else
SetMirrorType(EMirrorType.OneScreenB); SetMirrorType(EMirrorType.OneScreenB);

View File

@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (AdpcmIsPlaying && (value & 0x20) == 0) if (AdpcmIsPlaying && (value & 0x20) == 0)
AdpcmIsPlaying = false; // clearing this bit stops playback AdpcmIsPlaying = false; // clearing this bit stops playback
if (AdpcmIsPlaying == false && (value & 0x20) != 0) if (!AdpcmIsPlaying && (value & 0x20) != 0)
{ {
if ((value & 0x40) == 0) if ((value & 0x40) == 0)
Console.WriteLine("a thing that's normally set is not set"); Console.WriteLine("a thing that's normally set is not set");
@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
_scsi.Think(); _scsi.Think();
} }
if (_scsi.DataTransferInProgress == false) if (!_scsi.DataTransferInProgress)
Port180B = 0; Port180B = 0;
} }
@ -254,7 +254,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
private byte ReadNibble() private byte ReadNibble()
{ {
byte value; byte value;
if (nibble == false) if (!nibble)
value = (byte)(RAM[ReadAddress] >> 4); value = (byte)(RAM[ReadAddress] >> 4);
else else
{ {
@ -275,13 +275,13 @@ namespace BizHawk.Emulation.Cores.PCEngine
int m = StepFactor[mag]; int m = StepFactor[mag];
int adjustment = StepSize[(magnitude * 8) + mag]; int adjustment = StepSize[(magnitude * 8) + mag];
magnitude = AddClamped(magnitude, m, 0, 48); magnitude = AddClamped(magnitude, m, 0, 48);
if (positive == false) adjustment *= -1; if (!positive) adjustment *= -1;
playingSample = AddClamped(playingSample, adjustment, 0, 4095); playingSample = AddClamped(playingSample, adjustment, 0, 4095);
} }
private void AdpcmEmitSample() private void AdpcmEmitSample()
{ {
if (AdpcmIsPlaying == false) if (!AdpcmIsPlaying)
_synchronizer.EnqueueSample(0, 0); _synchronizer.EnqueueSample(0, 0);
else else
{ {

View File

@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM
{ {
if (BramEnabled && BramLocked == false) if (BramEnabled && !BramLocked)
return BRAM[addr & 0x7FF]; return BRAM[addr & 0x7FF];
return 0xFF; return 0xFF;
} }
@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM
{ {
if (BramEnabled && BramLocked == false) if (BramEnabled && !BramLocked)
{ {
BRAM[addr & 0x7FF] = value; BRAM[addr & 0x7FF] = value;
SaveRamModified = true; SaveRamModified = true;
@ -95,4 +95,4 @@ namespace BizHawk.Emulation.Cores.PCEngine
Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value); Log.Error("MEM", "UNHANDLED WRITE: {0:X6}:{1:X2}", addr, value);
} }
} }
} }

View File

@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM
{ {
if (BramEnabled && BramLocked == false) if (BramEnabled && !BramLocked)
return BRAM[addr & 0x7FF]; return BRAM[addr & 0x7FF];
return 0xFF; return 0xFF;
} }
@ -61,7 +61,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
} }
else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM
{ {
if (BramEnabled && BramLocked == false) if (BramEnabled && !BramLocked)
{ {
BRAM[addr & 0x7FF] = value; BRAM[addr & 0x7FF] = value;
SaveRamModified = true; SaveRamModified = true;
@ -75,4 +75,4 @@ namespace BizHawk.Emulation.Cores.PCEngine
//CoreComm.MemoryCallbackSystem.CallWrite((uint)addr); //CoreComm.MemoryCallbackSystem.CallWrite((uint)addr);
} }
} }
} }

View File

@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
private void WriteArcadeCard(int addr, byte value) private void WriteArcadeCard(int addr, byte value)
{ {
if (ArcadeCard == false) if (!ArcadeCard)
{ {
return; return;
} }
@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
private byte ReadArcadeCard(int addr) private byte ReadArcadeCard(int addr)
{ {
if (ArcadeCard == false) return 0xFF; if (!ArcadeCard) return 0xFF;
var page = ArcadePage[(addr >> 4) & 3]; var page = ArcadePage[(addr >> 4) & 3];
switch (addr & 0x0F) switch (addr & 0x0F)
{ {
@ -144,7 +144,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
ser.Sync(nameof(ShiftAmount), ref ShiftAmount); ser.Sync(nameof(ShiftAmount), ref ShiftAmount);
ser.Sync(nameof(RotateAmount), ref RotateAmount); ser.Sync(nameof(RotateAmount), ref RotateAmount);
if (ArcadeCardRewindHack == false || ser.IsText) if (!ArcadeCardRewindHack || ser.IsText)
{ {
ser.Sync("ArcadeRAM", ref ArcadeRam, false); ser.Sync("ArcadeRAM", ref ArcadeRam, false);
} }
@ -163,4 +163,4 @@ namespace BizHawk.Emulation.Cores.PCEngine
ser.EndSection(); ser.EndSection();
} }
} }
} }

View File

@ -18,7 +18,7 @@
_selectedController = 0; _selectedController = 0;
} }
if (Clr == false && prevSel == false && Sel) if (!Clr && !prevSel && Sel)
{ {
_selectedController++; _selectedController++;
} }
@ -43,7 +43,7 @@
value |= 0x40; value |= 0x40;
} }
if (Type != NecSystemType.TurboCD && BramEnabled == false) if (Type != NecSystemType.TurboCD && !BramEnabled)
{ {
value |= 0x80; value |= 0x80;
} }

View File

@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
lp.Comm.ShowMessage( 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."); "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. // 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. // 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", ""); lp.Game.AddOption("SuperSysCard", "");
} }
if (lp.Game["NeedSuperSysCard"] && lp.Game["SuperSysCard"] == false) if (lp.Game["NeedSuperSysCard"] && !lp.Game["SuperSysCard"])
{ {
lp.Comm.ShowMessage( 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."); "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.");

View File

@ -125,7 +125,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
byte result = 0x3F; byte result = 0x3F;
if (sel == false) if (!sel)
{ {
if (c.IsPressed($"P{PortNum} B1")) result &= 0xFE; if (c.IsPressed($"P{PortNum} B1")) result &= 0xFE;
if (c.IsPressed($"P{PortNum} B2")) result &= 0xFD; if (c.IsPressed($"P{PortNum} B2")) result &= 0xFD;

View File

@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
cpu.Execute(455 - HBlankCycles - 2); cpu.Execute(455 - HBlankCycles - 2);
if (InActiveDisplay == false && DmaRequested) if (!InActiveDisplay && DmaRequested)
RunDmaForScanline(); RunDmaForScanline();
ScanLine++; ScanLine++;
@ -122,7 +122,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
Array.Clear(PriorityBuffer, 0, FrameWidth); Array.Clear(PriorityBuffer, 0, FrameWidth);
if (BackgroundEnabled == false) if (!BackgroundEnabled)
{ {
int p = vce.Palette[256]; int p = vce.Palette[256];
fixed (int* FBptr = FrameBuffer) fixed (int* FBptr = FrameBuffer)
@ -202,7 +202,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
Array.Clear(PriorityBuffer, 0, FrameWidth); Array.Clear(PriorityBuffer, 0, FrameWidth);
if (BackgroundEnabled == false) if (!BackgroundEnabled)
{ {
for (int i = 0; i < FrameWidth; i++) for (int i = 0; i < FrameWidth; i++)
FrameBuffer[((ActiveLine + ViewStartLine - pce.Settings.TopLine) * FramePitch) + i] = vce.Palette[256]; 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) public void RenderSpritesScanline(bool show)
{ {
if (SpritesEnabled == false) if (!SpritesEnabled)
{ {
return; return;
} }
@ -286,7 +286,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
patternNo &= 0x1FE; patternNo &= 0x1FE;
int yofs = 0; int yofs = 0;
if (vflip == false) if (!vflip)
{ {
yofs = (ActiveLine - y) & 15; yofs = (ActiveLine - y) & 15;
if (height == 32) if (height == 32)
@ -351,7 +351,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
} }
} }
if (hflip == false) if (!hflip)
{ {
if (x + width > 0 && y + height > 0) if (x + width > 0 && y + height > 0)
{ {

View File

@ -228,10 +228,10 @@ namespace BizHawk.Emulation.Cores.PCEngine
CPU.Execute(455 - VDC1.HBlankCycles - 2); CPU.Execute(455 - VDC1.HBlankCycles - 2);
if (InActiveDisplay == false && VDC1.DmaRequested) if (!InActiveDisplay && VDC1.DmaRequested)
VDC1.RunDmaForScanline(); VDC1.RunDmaForScanline();
if (InActiveDisplay == false && VDC2.DmaRequested) if (!InActiveDisplay && VDC2.DmaRequested)
VDC2.RunDmaForScanline(); VDC2.RunDmaForScanline();
VDC1.RCRCounter++; VDC1.RCRCounter++;
@ -280,7 +280,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
private unsafe void RenderBackgroundScanline(VDC vdc, byte priority, bool show) private unsafe void RenderBackgroundScanline(VDC vdc, byte priority, bool show)
{ {
if (vdc.BackgroundEnabled == false) if (!vdc.BackgroundEnabled)
return; return;
// per-line parameters // per-line parameters
@ -351,7 +351,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
private void RenderSpritesScanline(VDC vdc, byte lowPriority, byte highPriority, bool show) private void RenderSpritesScanline(VDC vdc, byte lowPriority, byte highPriority, bool show)
{ {
if (vdc.SpritesEnabled == false) if (!vdc.SpritesEnabled)
return; return;
// clear inter-sprite priority buffer // clear inter-sprite priority buffer
@ -378,7 +378,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
patternNo &= 0x1FE; patternNo &= 0x1FE;
int yofs; int yofs;
if (vflip == false) if (!vflip)
{ {
yofs = (vdc.ActiveLine - y) & 15; yofs = (vdc.ActiveLine - y) & 15;
if (height == 32) if (height == 32)
@ -442,7 +442,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
} }
} }
} }
if (hflip == false) if (!hflip)
{ {
if (x + width > 0 && y + height > 0) if (x + width > 0 && y + height > 0)
{ {

View File

@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
Cpu.TraceCallback = null; Cpu.TraceCallback = null;
} }
if (IsGameGear_C == false) if (!IsGameGear_C)
{ {
Cpu.NonMaskableInterrupt = controller.IsPressed("Pause"); Cpu.NonMaskableInterrupt = controller.IsPressed("Pause");
} }

View File

@ -173,7 +173,7 @@
private byte ReadPort0() private byte ReadPort0()
{ {
if (IsGameGear_C == false) if (!IsGameGear_C)
{ {
return 0xFF; return 0xFF;
} }
@ -242,4 +242,4 @@
} }
} }
} }
} }

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (ScanLine >= FrameHeight) if (ScanLine >= FrameHeight)
return; return;
if (DisplayOn == false) if (!DisplayOn)
{ {
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
FrameBuffer[(ScanLine * 256) + x] = Palette[BackdropColor]; FrameBuffer[(ScanLine * 256) + x] = Palette[BackdropColor];
@ -64,7 +64,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (VFlip) if (VFlip)
yOfs = 7 - yOfs; 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) + 0] + PaletteBase] : Palette[BackdropColor];
FrameBuffer[(ScanLine * 256) + horzOffset++] = show ? Palette[PatternBuffer[(tileNo * 64) + (yOfs * 8) + 1] + 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() internal void ProcessOverscan()
{ {
if (Sms.Settings.DisplayOverscan == false) if (!Sms.Settings.DisplayOverscan)
return; return;
if (OverscanFrameBuffer == null) if (OverscanFrameBuffer == null)
@ -346,7 +346,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (mode != VdpMode.GameGear) if (mode != VdpMode.GameGear)
return; return;
if (Sms.Settings.ShowClippedRegions == false) if (!Sms.Settings.ShowClippedRegions)
{ {
int yStart = (FrameHeight - 144) / 2; int yStart = (FrameHeight - 144) / 2;
for (int y = 0; y < 144; y++) for (int y = 0; y < 144; y++)

View File

@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (ScanLine >= FrameHeight) if (ScanLine >= FrameHeight)
return; return;
if (DisplayOn == false) if (!DisplayOn)
{ {
Array.Clear(FrameBuffer, ScanLine * 256, 256); Array.Clear(FrameBuffer, ScanLine * 256, 256);
return; return;
@ -68,7 +68,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (ScanLine >= FrameHeight) if (ScanLine >= FrameHeight)
return; return;
if (DisplayOn == false) if (!DisplayOn)
{ {
Array.Clear(FrameBuffer, ScanLine * 256, 256); Array.Clear(FrameBuffer, ScanLine * 256, 256);
return; return;
@ -105,13 +105,13 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
private void RenderTmsSprites(bool show) private void RenderTmsSprites(bool show)
{ {
if (ScanLine >= FrameHeight || DisplayOn == false) if (ScanLine >= FrameHeight || !DisplayOn)
return; return;
if (EnableDoubledSprites == false) if (EnableDoubledSprites)
RenderTmsSpritesStandard(show);
else
RenderTmsSpritesDouble(show); RenderTmsSpritesDouble(show);
else
RenderTmsSpritesStandard(show);
} }
private void RenderTmsSpritesStandard(bool show) private void RenderTmsSpritesStandard(bool show)

View File

@ -239,7 +239,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
private void CheckVideoMode() private void CheckVideoMode()
{ {
if (Mode4Bit == false) // check old TMS modes if (!Mode4Bit) // check old TMS modes
{ {
if (Mode1Bit) TmsMode = 1; if (Mode1Bit) TmsMode = 1;
else if (Mode2Bit) TmsMode = 2; else if (Mode2Bit) TmsMode = 2;

View File

@ -811,7 +811,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
LagCount++; LagCount++;
//what happens to sound in this case? //what happens to sound in this case?
if (render == false) if (!render)
{ {
Frame++; Frame++;
return true; return true;

View File

@ -104,7 +104,7 @@ namespace BizHawk.Emulation.Cores.Components
Channels[VoiceLatch].Volume = (byte)(value & 0x1F); Channels[VoiceLatch].Volume = (byte)(value & 0x1F);
Channels[VoiceLatch].Enabled = (value & 0x80) != 0; Channels[VoiceLatch].Enabled = (value & 0x80) != 0;
Channels[VoiceLatch].DDA = (value & 0x40) != 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 //for the soudn debugger, this might be a useful indication that a new note has begun.. but not for sure
WaveTableWriteOffset = 0; WaveTableWriteOffset = 0;
@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Components
Channels[VoiceLatch].Panning = value; Channels[VoiceLatch].Panning = value;
break; break;
case 6: // Wave data case 6: // Wave data
if (Channels[VoiceLatch].DDA == false) if (!Channels[VoiceLatch].DDA)
{ {
Channels[VoiceLatch].Wave[WaveTableWriteOffset++] = (short)((value * 2047) - 32767); Channels[VoiceLatch].Wave[WaveTableWriteOffset++] = (short)((value * 2047) - 32767);
WaveTableWriteOffset &= 31; WaveTableWriteOffset &= 31;
@ -193,8 +193,8 @@ namespace BizHawk.Emulation.Cores.Components
private void MixChannel(short[] samples, int start, int len, PSGChannel channel) private void MixChannel(short[] samples, int start, int len, PSGChannel channel)
{ {
if (channel.Enabled == false) return; if (!channel.Enabled) return;
if (channel.DDA == false && channel.Volume == 0) return; if (!channel.DDA && channel.Volume == 0) return;
short[] wave = channel.Wave; short[] wave = channel.Wave;
int freq; int freq;
@ -283,4 +283,4 @@ namespace BizHawk.Emulation.Cores.Components
public long Time; public long Time;
} }
} }
} }

View File

@ -13,8 +13,8 @@ namespace BizHawk.Tests.Common.checksums
[TestMethod] [TestMethod]
public void TestSHA1Empty() public void TestSHA1Empty()
{ {
byte[] data = Array.Empty<byte>(); // empty data 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 }; 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))); Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.Compute(data)));
} }
@ -22,15 +22,15 @@ namespace BizHawk.Tests.Common.checksums
[TestMethod] [TestMethod]
public void TestSHA1Simple() public void TestSHA1Simple()
{ {
byte[] data = { (byte)'h', (byte)'a', (byte)'s', (byte)'h' }; // random short data 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 }; 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.Compute(data)));
Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(Array.Empty<byte>(), data))); Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(Array.Empty<byte>(), data)));
Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(data, Array.Empty<byte>()))); Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(data, Array.Empty<byte>())));
data = new[] { (byte)'h', (byte)'a' }; data = "ha"u8.ToArray();
byte[] data2 = { (byte)'s', (byte)'h' }; byte[] data2 = "sh"u8.ToArray();
Assert.IsTrue(expectedSha.SequenceEqual(SHA1Checksum.ComputeConcat(data, data2))); 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."; const string testString = "The quick brown fox jumps over the lazy dog.";
byte[] data = Encoding.ASCII.GetBytes(testString); 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))); Assert.IsTrue(expectedSha1.SequenceEqual(SHA1Checksum.Compute(data)));
data = new byte[65]; data = new byte[65];
Encoding.ASCII.GetBytes(testString).CopyTo(data, 0); 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<byte>(data, 0, 64)))); Assert.IsTrue(expectedSha2.SequenceEqual(SHA1Checksum.Compute(new Span<byte>(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))); Assert.IsTrue(expectedSha3.SequenceEqual(SHA1Checksum.Compute(data)));
} }
} }