diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/GBA.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/GBA.cs
index 9d1f8294d8..f2733da900 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/GBA.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/GBA.cs
@@ -1,8 +1,4 @@
using BizHawk.Emulation.Common;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/IGBAGPUViewable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/IGBAGPUViewable.cs
index 61ab70ef68..b470766aa4 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/IGBAGPUViewable.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/IGBAGPUViewable.cs
@@ -6,11 +6,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public interface IGBAGPUViewable : IEmulatorService
{
GBAGPUMemoryAreas GetMemoryAreas();
+
///
/// calls correspond to entering hblank (maybe) and in a regular frame, the sequence of calls will be 160, 161, ..., 227, 0, ..., 159
///
- ///
- ///
void SetScanlineCallback(Action callback, int scanline);
}
@@ -18,7 +17,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
// the pointers are assumed to stay valid as long as the IEmulator is valid, maybe
// this will need some change for a managed core (lifecycle management, etc)
-
public IntPtr vram;
public IntPtr oam;
public IntPtr mmio;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IDebuggable.cs
index d7538d3c7b..fab17f6458 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IDebuggable.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IDebuggable.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using BizHawk.Emulation.Common;
@@ -25,12 +24,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
}
private readonly MemoryCallbackSystem _memorycallbacks = new MemoryCallbackSystem();
- public IMemoryCallbackSystem MemoryCallbacks { get { return _memorycallbacks; } }
+ public IMemoryCallbackSystem MemoryCallbacks => _memorycallbacks;
[FeatureNotImplemented]
- public void Step(StepType type) { throw new NotImplementedException(); }
+ public void Step(StepType type)
+ {
+ throw new NotImplementedException();
+ }
[FeatureNotImplemented]
- public int TotalExecutedCycles { get { throw new NotImplementedException(); } }
+ public int TotalExecutedCycles
+ {
+ get { throw new NotImplementedException(); }
+ }
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs
index d86306ea4f..ea14fb717e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
@@ -27,6 +23,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
throw new ArgumentOutOfRangeException(nameof(scanline), "Scanline must be in [0, 227]!");
}
+
if (callback == null)
{
scanlinecb = null;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISaveRam.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISaveRam.cs
index dccaf0f449..4058e83441 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISaveRam.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISaveRam.cs
@@ -1,20 +1,11 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
public partial class VBANext : ISaveRam
{
- public bool SaveRamModified
- {
- get
- {
- return LibVBANext.SaveRamSize(Core) != 0;
- }
- }
+ public bool SaveRamModified => LibVBANext.SaveRamSize(Core) != 0;
public byte[] CloneSaveRam()
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISettings.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISettings.cs
index 580a55e34d..6888588004 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISettings.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISettings.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using BizHawk.Common;
using BizHawk.Emulation.Common;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISoundProvider.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISoundProvider.cs
index 3a9896c4a4..02f8b301e9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISoundProvider.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.ISoundProvider.cs
@@ -5,23 +5,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
public partial class VBANext : ISoundProvider
{
- private short[] soundbuff = new short[2048];
- private int numsamp;
+ private readonly short[] _soundbuff = new short[2048];
+ private int _numsamp;
public void GetSamplesSync(out short[] samples, out int nsamp)
{
- samples = soundbuff;
- nsamp = numsamp;
+ samples = _soundbuff;
+ nsamp = _numsamp;
}
public void DiscardSamples()
{
}
- public bool CanProvideAsync
- {
- get { return false; }
- }
+ public bool CanProvideAsync => false;
public void SetSyncMode(SyncSoundMode mode)
{
@@ -31,10 +28,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
}
}
- public SyncSoundMode SyncMode
- {
- get { return SyncSoundMode.Sync; }
- }
+ public SyncSoundMode SyncMode => SyncSoundMode.Sync;
public void GetSamplesAsync(short[] samples)
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IStatable.cs
index ac817b3039..ed28391129 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IStatable.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IStatable.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using Newtonsoft.Json;
using BizHawk.Emulation.Common;
@@ -10,10 +8,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
public partial class VBANext : IStatable
{
- public bool BinarySaveStatesPreferred
- {
- get { return true; }
- }
+ public bool BinarySaveStatesPreferred => true;
public void SaveStateText(TextWriter writer)
{
@@ -26,6 +21,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
s.ExtraData.Frame = Frame;
ser.Serialize(writer, s);
+
// write extra copy of stuff we don't use
writer.WriteLine();
writer.WriteLine("Frame {0}", Frame);
@@ -46,10 +42,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public void SaveStateBinary(BinaryWriter writer)
{
- if (!LibVBANext.BinStateSave(Core, savebuff, savebuff.Length))
+ if (!LibVBANext.BinStateSave(Core, _savebuff, _savebuff.Length))
throw new InvalidOperationException("Core's BinStateSave() returned false!");
- writer.Write(savebuff.Length);
- writer.Write(savebuff);
+ writer.Write(_savebuff.Length);
+ writer.Write(_savebuff);
// other variables
writer.Write(IsLagFrame);
@@ -60,10 +56,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public void LoadStateBinary(BinaryReader reader)
{
int length = reader.ReadInt32();
- if (length != savebuff.Length)
+ if (length != _savebuff.Length)
throw new InvalidOperationException("Save buffer size mismatch!");
- reader.Read(savebuff, 0, length);
- if (!LibVBANext.BinStateLoad(Core, savebuff, savebuff.Length))
+ reader.Read(_savebuff, 0, length);
+ if (!LibVBANext.BinStateLoad(Core, _savebuff, _savebuff.Length))
throw new InvalidOperationException("Core's BinStateLoad() returned false!");
// other variables
@@ -74,19 +70,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public byte[] SaveStateBinary()
{
- var ms = new MemoryStream(savebuff2, true);
+ var ms = new MemoryStream(_savebuff2, true);
var bw = new BinaryWriter(ms);
SaveStateBinary(bw);
bw.Flush();
- if (ms.Position != savebuff2.Length)
+ if (ms.Position != _savebuff2.Length)
throw new InvalidOperationException();
ms.Close();
- return savebuff2;
+ return _savebuff2;
}
- private JsonSerializer ser = new JsonSerializer() { Formatting = Formatting.Indented };
- private byte[] savebuff;
- private byte[] savebuff2;
+ private JsonSerializer ser = new JsonSerializer { Formatting = Formatting.Indented };
+ private readonly byte[] _savebuff;
+ private readonly byte[] _savebuff2;
private class TextStateData
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IVideoProvider.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IVideoProvider.cs
index 7455c52209..71163d453c 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IVideoProvider.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IVideoProvider.cs
@@ -1,42 +1,40 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
using BizHawk.Emulation.Common;
+using BizHawk.Emulation.Cores.Nintendo.Gameboy;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
public partial class VBANext : IVideoProvider
{
- public int VirtualWidth { get { return 240; } }
- public int VirtualHeight { get { return 160; } }
- public int BufferWidth { get { return 240; } }
- public int BufferHeight { get { return 160; } }
+ public int VirtualWidth => 240;
+ public int VirtualHeight => 160;
+ public int BufferWidth => 240;
+ public int BufferHeight => 160;
- public int BackgroundColor
- {
- get { return unchecked((int)0xff000000); }
- }
+ public int BackgroundColor => unchecked((int)0xff000000);
public int[] GetVideoBuffer()
{
- return videobuff;
+ return _videobuff;
}
- private int[] videobuff = new int[240 * 160];
- private int[] videopalette = new int[65536];
+ private readonly int[] _videobuff = new int[240 * 160];
+ private readonly int[] _videopalette = new int[65536];
private void SetupColors()
{
- int[] tmp = BizHawk.Emulation.Cores.Nintendo.Gameboy.GBColors.GetLut(Gameboy.GBColors.ColorType.vivid);
+ int[] tmp = GBColors.GetLut(GBColors.ColorType.vivid);
+
// reorder
for (int i = 0; i < 32768; i++)
{
int j = i & 0x3e0 | (i & 0x1f) << 10 | i >> 10 & 0x1f;
- videopalette[i] = tmp[j];
+ _videopalette[i] = tmp[j];
}
+
// duplicate
- Array.Copy(videopalette, 0, videopalette, 32768, 32768);
+ Array.Copy(_videopalette, 0, _videopalette, 32768, 32768);
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBARegisterHelper.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBARegisterHelper.cs
index f947a55ed0..ddb50a3d07 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBARegisterHelper.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBARegisterHelper.cs
@@ -9,8 +9,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
public unsafe class VBARegisterHelper
{
- IntPtr _origin;
- Dictionary _locs = new Dictionary();
+ private readonly IntPtr _origin;
+ private readonly Dictionary _locs = new Dictionary();
public VBARegisterHelper(IntPtr Core)
{
@@ -27,11 +27,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
int* p = (int*)_locs[name];
return *p;
}
+
public void SetRegister(string name, int val)
{
int* p = (int*)_locs[name];
*p = val;
}
+
public Dictionary GetAllRegisters()
{
var ret = new Dictionary();
@@ -39,6 +41,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
ret[kvp.Key] = GetRegister(kvp.Key);
}
+
return ret;
}
@@ -48,10 +51,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
int* p = (int*)_origin;
for (int i = 0; i < 17; i++)
{
- sb.Append(string.Format("r{0}:{1:X8}", i, p[i]));
+ sb.Append($"r{i}:{p[i]:X8}");
if (i != 16)
+ {
sb.Append(' ');
+ }
}
+
return sb.ToString();
}
}