Skip to content

Commit

Permalink
Resharper cleanups. Should all be functionally equivalent. Not tested…
Browse files Browse the repository at this point in the history
… yet.
  • Loading branch information
davidwhitney committed Apr 16, 2020
1 parent ab94375 commit 2a3e3d5
Show file tree
Hide file tree
Showing 58 changed files with 904 additions and 1,108 deletions.
4 changes: 2 additions & 2 deletions CoreBoy.Test.Unit/GPU/PixelFifoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class PixelFifoTest
public void SetUp()
{
var registers = new MemoryRegisters(GpuRegister.Values().ToArray());
registers.Put(GpuRegister.BGP, 0b11100100);
_fifo = new DmgPixelFifo(new NullDisplay(), new Lcdc(), registers);
registers.Put(GpuRegister.Bgp, 0b11100100);
_fifo = new DmgPixelFifo(new NullDisplay(), registers);
}

[Test]
Expand Down
38 changes: 19 additions & 19 deletions CoreBoy.Test.Unit/Memory/Cart/Rtc/RealTimeClockTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public void TestLatch()
{
_clock.Forward(new TimeSpan(5, 8, 12, 2));

_rtc.latch();
_rtc.Latch();
_clock.Forward(new TimeSpan(10, 5, 19, 4));

AssertClockEquals(5, 8, 12, 2);

_rtc.unlatch();
_rtc.Unlatch();

AssertClockEquals(5 + 10, 8 + 5, 12 + 19, 2 + 4);
}
Expand All @@ -44,22 +44,22 @@ public void TestCounterOverflow()
{
_clock.Forward(new TimeSpan(511, 23, 59, 59));

Assert.False(_rtc.isCounterOverflow());
Assert.False(_rtc.IsCounterOverflow());

_clock.Forward(TimeSpan.FromSeconds(1));

AssertClockEquals(0, 0, 0, 0);
Assert.True(_rtc.isCounterOverflow());
Assert.True(_rtc.IsCounterOverflow());

_clock.Forward(new TimeSpan(10, 5, 19, 4));

AssertClockEquals(10, 5, 19, 4);
Assert.True(_rtc.isCounterOverflow());
Assert.True(_rtc.IsCounterOverflow());

_rtc.clearCounterOverflow();
_rtc.ClearCounterOverflow();

AssertClockEquals(10, 5, 19, 4);
Assert.False(_rtc.isCounterOverflow());
Assert.False(_rtc.IsCounterOverflow());
}

[Test]
Expand All @@ -69,19 +69,19 @@ public void SetClock()

AssertClockEquals(10, 5, 19, 4);

_rtc.setHalt(true);
_rtc.SetHalt(true);

Assert.True(_rtc.isHalt());
Assert.True(_rtc.IsHalt());

_rtc.setDayCounter(10);
_rtc.setHours(16);
_rtc.setMinutes(21);
_rtc.setSeconds(32);
_rtc.SetDayCounter(10);
_rtc.SetHours(16);
_rtc.SetMinutes(21);
_rtc.SetSeconds(32);

_clock.Forward(new TimeSpan(1, 1, 1, 1)); // should be ignored after unhalt
_rtc.setHalt(false);
_rtc.SetHalt(false);

Assert.False(_rtc.isHalt());
Assert.False(_rtc.IsHalt());

AssertClockEquals(10, 16, 21, 32);

Expand All @@ -92,10 +92,10 @@ public void SetClock()

private void AssertClockEquals(int days, int hours, int minutes, int seconds)
{
Assert.AreEqual(days, _rtc.getDayCounter());
Assert.AreEqual(hours, _rtc.getHours());
Assert.AreEqual(minutes, _rtc.getMinutes());
Assert.AreEqual(seconds, _rtc.getSeconds());
Assert.AreEqual(days, _rtc.GetDayCounter());
Assert.AreEqual(hours, _rtc.GetHours());
Assert.AreEqual(minutes, _rtc.GetMinutes());
Assert.AreEqual(seconds, _rtc.GetSeconds());
}
}
}
8 changes: 4 additions & 4 deletions CoreBoy.Test.Unit/Sound/AbstractLengthCounterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ protected void wchn(int register, int value)
{
if (register == 1)
{
lengthCounter.setLength(0 - value);
lengthCounter.SetLength(0 - value);
}
else if (register == 4)
{
lengthCounter.setNr4(value);
lengthCounter.SetNr4(value);
}
else
{
Expand All @@ -39,7 +39,7 @@ protected void delayClocks(int clocks)
{
for (int i = 0; i < clocks; i++)
{
lengthCounter.tick();
lengthCounter.Tick();
}
}

Expand All @@ -50,7 +50,7 @@ protected void delayApu(int apuUnit)

protected void syncApu()
{
lengthCounter.reset();
lengthCounter.Reset();
}
}
}
6 changes: 3 additions & 3 deletions CoreBoy.Test.Unit/Sound/LengthCounterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ and b
*/
private void shouldBeOn()
{
if (lengthCounter.isEnabled())
if (lengthCounter.IsEnabled())
{
Assert.AreNotEqual(0, lengthCounter.getValue());
Assert.AreNotEqual(0, lengthCounter.GetValue());
}
}

Expand All @@ -276,7 +276,7 @@ private void shouldBeAlmostOff()

private void shouldBeOff()
{
Assert.True(lengthCounter.isEnabled() && lengthCounter.getValue() == 0);
Assert.True(lengthCounter.IsEnabled() && lengthCounter.GetValue() == 0);
}

private void delay(int cpuCycles)
Expand Down
14 changes: 7 additions & 7 deletions CoreBoy.Test.Unit/Sound/LengthTriggerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public void test05()
begin();
wchn(1, -1);
wchn(4, 0x40);
Assert.True(lengthCounter.isEnabled());
Assert.AreEqual(0, lengthCounter.getValue());
Assert.True(lengthCounter.IsEnabled());
Assert.AreEqual(0, lengthCounter.GetValue());
}

/*
Expand Down Expand Up @@ -252,11 +252,11 @@ public void test12()
wchn(4, 0x40);
wchn(4, 0xc0);
delayApu(maxlen - 3);
Assert.True(lengthCounter.isEnabled());
Assert.AreNotEqual(0, lengthCounter.getValue());
Assert.True(lengthCounter.IsEnabled());
Assert.AreNotEqual(0, lengthCounter.GetValue());
delayApu(1);
Assert.True(lengthCounter.isEnabled());
Assert.AreEqual(0, lengthCounter.getValue());
Assert.True(lengthCounter.IsEnabled());
Assert.AreEqual(0, lengthCounter.GetValue());
}

/*
Expand Down Expand Up @@ -301,7 +301,7 @@ private void endNoDelay(int remainingLength)

private void endPassive(int remainingLength)
{
Assert.AreEqual(remainingLength, lengthCounter.getValue());
Assert.AreEqual(remainingLength, lengthCounter.GetValue());
}

}
Expand Down
12 changes: 6 additions & 6 deletions CoreBoy.Test.Unit/Sound/LfsrTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public void testLfsr()
int previousValue = 0;
for (int i = 0; i < 100; i++)
{
lfsr.nextBit(false);
Assert.AreNotEqual(previousValue, lfsr.getValue());
previousValue = lfsr.getValue();
lfsr.NextBit(false);
Assert.AreNotEqual(previousValue, lfsr.Value);
previousValue = lfsr.Value;
}
}

Expand All @@ -27,9 +27,9 @@ public void testLfsrWidth7()
int previousValue = 0;
for (int i = 0; i < 100; i++)
{
lfsr.nextBit(true);
Assert.AreNotEqual(previousValue, lfsr.getValue());
previousValue = lfsr.getValue();
lfsr.NextBit(true);
Assert.AreNotEqual(previousValue, lfsr.Value);
previousValue = lfsr.Value;
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions CoreBoy.Test.Unit/Sound/SweepTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private void begin()

private void shouldBeOn()
{
Assert.True(sweep.isEnabled());
Assert.True(sweep.IsEnabled());
}

/*
Expand All @@ -305,14 +305,14 @@ lda NR52
*/
private void shouldBeAlmostOff()
{
Assert.True(sweep.isEnabled());
Assert.True(sweep.IsEnabled());
delayApu(1);
shouldBeOff();
}

private void shouldBeOff()
{
Assert.False(sweep.isEnabled());
Assert.False(sweep.IsEnabled());
}

/*
Expand All @@ -331,9 +331,9 @@ private void syncSweep()
wregNR(10, 0x11);
wregNR(13, 0xff);
wregNR(14, 0x83);
while (sweep.isEnabled())
while (sweep.IsEnabled())
{
sweep.tick();
sweep.Tick();
}
}

Expand All @@ -342,15 +342,15 @@ private void wregNR(int reg, int value)
switch (reg)
{
case 10:
sweep.setNr10(value);
sweep.SetNr10(value);
break;

case 13:
sweep.setNr13(value);
sweep.SetNr13(value);
break;

case 14:
sweep.setNr14(value);
sweep.SetNr14(value);
break;

default:
Expand All @@ -362,7 +362,7 @@ private void delayApu(int apuCycles)
{
for (int i = 0; i < Gameboy.TicksPerSec / 256 * apuCycles; i++)
{
sweep.tick();
sweep.Tick();
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion CoreBoy.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DE/@EntryIndexedValue">DE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HL/@EntryIndexedValue">HL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PC/@EntryIndexedValue">PC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RAM/@EntryIndexedValue">RAM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SP/@EntryIndexedValue">SP</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Blargg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=gameboy/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -12,10 +13,14 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Initilise/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Joypad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lcdc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lfsr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mooneye/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=multicart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=negging/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opcode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opcodes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=RETI/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=runnables/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SRAM/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SRAM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=svbk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tima/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
38 changes: 19 additions & 19 deletions CoreBoy/Gameboy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,30 @@ public Gameboy(
_sound = new Sound(soundOutput, _gbc);
_serialPort = new SerialPort(interruptManager, serialEndpoint, SpeedMode);

Mmu.addAddressSpace(rom);
Mmu.addAddressSpace(_gpu);
Mmu.addAddressSpace(new Joypad(interruptManager, controller));
Mmu.addAddressSpace(interruptManager);
Mmu.addAddressSpace(_serialPort);
Mmu.addAddressSpace(_timer);
Mmu.addAddressSpace(_dma);
Mmu.addAddressSpace(_sound);

Mmu.addAddressSpace(new Ram(0xc000, 0x1000));
Mmu.AddAddressSpace(rom);
Mmu.AddAddressSpace(_gpu);
Mmu.AddAddressSpace(new Joypad(interruptManager, controller));
Mmu.AddAddressSpace(interruptManager);
Mmu.AddAddressSpace(_serialPort);
Mmu.AddAddressSpace(_timer);
Mmu.AddAddressSpace(_dma);
Mmu.AddAddressSpace(_sound);

Mmu.AddAddressSpace(new Ram(0xc000, 0x1000));
if (_gbc)
{
Mmu.addAddressSpace(SpeedMode);
Mmu.addAddressSpace(_hdma);
Mmu.addAddressSpace(new GbcRam());
Mmu.addAddressSpace(new UndocumentedGbcRegisters());
Mmu.AddAddressSpace(SpeedMode);
Mmu.AddAddressSpace(_hdma);
Mmu.AddAddressSpace(new GbcRam());
Mmu.AddAddressSpace(new UndocumentedGbcRegisters());
}
else
{
Mmu.addAddressSpace(new Ram(0xd000, 0x1000));
Mmu.AddAddressSpace(new Ram(0xd000, 0x1000));
}

Mmu.addAddressSpace(new Ram(0xff80, 0x7f));
Mmu.addAddressSpace(new ShadowAddressSpace(Mmu, 0xe000, 0xc000, 0x1e00));
Mmu.AddAddressSpace(new Ram(0xff80, 0x7f));
Mmu.AddAddressSpace(new ShadowAddressSpace(Mmu, 0xe000, 0xc000, 0x1e00));

Cpu = new Cpu(Mmu, interruptManager, _gpu, display, SpeedMode);

Expand Down Expand Up @@ -147,7 +147,7 @@ public void Run(CancellationToken token)

public Gpu.Mode? Tick()
{
_timer.tick();
_timer.Tick();
if (_hdma.IsTransferInProgress())
{
_hdma.Tick();
Expand All @@ -158,7 +158,7 @@ public void Run(CancellationToken token)
}

_dma.Tick();
_sound.tick();
_sound.Tick();
_serialPort.Tick();
return _gpu.Tick();
}
Expand Down
Loading

0 comments on commit 2a3e3d5

Please sign in to comment.