diff --git a/BizHawk.Common/Buffer.cs b/BizHawk.Common/Buffer.cs
deleted file mode 100644
index 06086e845a..0000000000
--- a/BizHawk.Common/Buffer.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-#nullable disable
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace BizHawk.Common
-{
- ///
- /// Implements a data simple data buffer with proper life cycle and no bounds checking
- ///
- public unsafe class CBuffer : IDisposable
- {
- public GCHandle Hnd;
- public T[] Arr;
- public void* Ptr;
- public byte* Byteptr;
- public int Len;
- public int Itemsize;
-
- public void Write08(int addr, byte val) { Byteptr[addr] = val; }
- public void Write32(int addr, uint val) { *(uint*)(Byteptr + addr) = val; }
- public byte Read08(int addr) { return Byteptr[addr]; }
- public ushort Read16(int addr) { return *(ushort*)(Byteptr + addr); }
- public uint Read32(int addr) { return *(uint*)(Byteptr + addr); }
-
- public static CBuffer malloc(int amt, int itemsize)
- {
- return new CBuffer(amt, itemsize);
- }
-
- public CBuffer(T[] arr, int itemsize)
- {
- Itemsize = itemsize;
- Len = arr.Length;
- Arr = arr;
- Hnd = GCHandle.Alloc(arr, GCHandleType.Pinned);
- Ptr = Hnd.AddrOfPinnedObject().ToPointer();
- Byteptr = (byte*)Ptr;
- }
- public CBuffer(int amt, int itemsize)
- {
- Itemsize = itemsize;
- Len = amt;
- Arr = new T[amt];
- Hnd = GCHandle.Alloc(this.Arr, GCHandleType.Pinned);
- Ptr = Hnd.AddrOfPinnedObject().ToPointer();
- Byteptr = (byte*)Ptr;
- Util.Memset(Byteptr, 0, Len * itemsize);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (Arr != null)
- {
- Hnd.Free();
- }
- Arr = null;
- }
- }
-
- ~CBuffer() { Dispose(true); }
- }
-
- public sealed class ByteBuffer : CBuffer
- {
- public ByteBuffer(int amt) : base(amt,1) { }
- public ByteBuffer(byte[] arr) : base(arr,1) { }
- public byte this[int index]
- {
- #if DEBUG
- get => this.Arr[index];
- set => this.Arr[index] = value;
- #else
- set => Write08(index, value);
- get => Read08(index);
- #endif
- }
- }
-
- public sealed class IntBuffer : CBuffer
- {
- public IntBuffer(int amt) : base(amt, 4) { }
- public IntBuffer(int[] arr) : base(arr,4) { }
- public int this[int index]
- {
- #if DEBUG
- get => this.Arr[index];
- set => this.Arr[index] = value;
- #else
- set => Write32(index<<2, (uint) value);
- get => (int)Read32(index<<2);
- #endif
- }
- }
-
- public sealed class ShortBuffer : CBuffer
- {
- public ShortBuffer(int amt) : base(amt, 2) { }
- public ShortBuffer(short[] arr) : base(arr, 2) { }
- public short this[int index]
- {
-#if DEBUG
- get => this.Arr[index];
- set => this.Arr[index] = value;
-#else
- set => Write32(index << 1, (uint)value);
- get => (short)Read16(index << 1);
-#endif
- }
- }
-}
\ No newline at end of file
diff --git a/BizHawk.Common/Serializer.cs b/BizHawk.Common/Serializer.cs
index 0c40d102fe..a8732a4e0e 100644
--- a/BizHawk.Common/Serializer.cs
+++ b/BizHawk.Common/Serializer.cs
@@ -166,16 +166,6 @@ namespace BizHawk.Common
}
}
- public void Sync(string name, ref ByteBuffer byteBuf)
- {
- SyncBuffer(name, 1, byteBuf.Len, byteBuf.Ptr);
- }
-
- public void Sync(string name, ref IntBuffer byteBuf)
- {
- SyncBuffer(name, 4, byteBuf.Len, byteBuf.Ptr);
- }
-
public void Sync(string name, ref byte[] val, bool useNull)
{
if (IsText)
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs
index 1899121854..fdca6ccde0 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IMemoryDomains.cs
@@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
domains.Add(new MemoryDomainDelegate(
"Cart Ram",
- _mapper.CartRam.Len,
+ _mapper.CartRam.Length,
MemoryDomain.Endian.Little,
addr => _mapper.CartRam[(int)addr],
(addr, value) => _mapper.CartRam[(int)addr] = value, 1));
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs
index 097695f046..8618f8db47 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs
@@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public virtual bool HasCartRam => false;
- public virtual ByteBuffer CartRam => new ByteBuffer(0);
+ public virtual byte[] CartRam => new byte[0];
public virtual byte ReadMemory(ushort addr)
{
@@ -34,10 +34,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
}
- public virtual void Dispose()
- {
- }
-
public virtual void ClockCpu()
{
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs
index 0483bab90b..8381ade505 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs
@@ -25,18 +25,18 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _lowbank2K;
private int _rambank1K;
private bool _hasRam;
- private ByteBuffer _ram = new ByteBuffer(256 * 1024); // Up to 256k
+ private byte[] _ram = new byte[256 * 1024]; // Up to 256k
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("lowbank_2k", ref _lowbank2K);
ser.Sync("rambank_1k", ref _rambank1K);
- ser.Sync("cart_ram", ref _ram);
+ ser.Sync("cart_ram", ref _ram, false);
ser.Sync("hasRam", ref _hasRam);
}
@@ -45,16 +45,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_lowbank2K = 0;
_rambank1K = 0;
_hasRam = false;
- _ram = new ByteBuffer(256 * 1024);
+ _ram = new byte[256 * 1024];
base.HardReset();
}
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
- }
-
public override byte ReadMemory(ushort addr)
{
if (addr < 0x1000)
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs
index 538e8ce427..ec803c7874 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs
@@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class m4A50 : MapperBase
{
- private ByteBuffer _ram = new ByteBuffer(32768);
+ private byte[] _ram = new byte[32768];
private byte _lastData = 0xFF;
private ushort _lastAddress = 0xFFFF;
@@ -89,17 +89,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
-
- public override void Dispose()
- {
- _ram.Dispose();
- base.Dispose();
- }
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
- ser.Sync("cartRam", ref _ram);
+ ser.Sync("cartRam", ref _ram, false);
ser.Sync("lastData", ref _lastData);
ser.Sync("lastAddress", ref _lastAddress);
@@ -117,7 +111,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override void HardReset()
{
- _ram = new ByteBuffer(32768);
+ _ram = new byte[32768];
_lastData = 0xFF;
_lastAddress = 0xFFFF;
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs
index 1b1398c8ec..d31e5b62ea 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs
@@ -39,15 +39,15 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
InitializeSettings();
}
- private ByteBuffer _superChargerImage = new ByteBuffer(8192);
- private IntBuffer _imageOffsets = new IntBuffer(2);
+ private byte[] _superChargerImage = new byte[8192];
+ private int[] _imageOffsets = new int[2];
private bool _writePending;
private int _distinctAccesses;
private bool _writeEnabled;
private byte _dataHoldRegister;
private byte _numberOfLoadImages;
- private ByteBuffer _loadedImages;
- private ByteBuffer _header = new ByteBuffer(256);
+ private byte[] _loadedImages;
+ private byte[] _header = new byte[256];
private bool _powerIndicator; // Indicates if the ROM's power is on or off
private int _powerRomCycle; // Indicates when the power was last turned on
private int _size;
@@ -63,7 +63,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_numberOfLoadImages = (byte)(_size / 8448);
// TODO: why are we making a redundant copy?
- _loadedImages = new ByteBuffer(_size);
+ _loadedImages = new byte[_size];
for (int i = 0; i < size; i++)
{
_loadedImages[i] = Core.Rom[i];
@@ -166,12 +166,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _superChargerImage;
+ public override byte[] CartRam => _superChargerImage;
public override void HardReset()
{
- _superChargerImage = new ByteBuffer(8192);
- _imageOffsets = new IntBuffer(2);
+ _superChargerImage = new byte[8192];
+ _imageOffsets = new int[2];
_writePending = false;
_distinctAccesses = 0;
@@ -180,7 +180,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_numberOfLoadImages = 0;
_loadedImages = null;
- _header = new ByteBuffer(256);
+ _header = new byte[256];
_powerIndicator = false;
_powerRomCycle = 0;
_size = 0;
@@ -191,28 +191,19 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
base.HardReset();
}
- public override void Dispose()
- {
- _superChargerImage.Dispose();
- _imageOffsets.Dispose();
- _loadedImages.Dispose();
- _header.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync("superChargerImage", ref _superChargerImage);
- ser.Sync("imageOffsets", ref _imageOffsets);
+ ser.Sync("superChargerImage", ref _superChargerImage, false);
+ ser.Sync("imageOffsets", ref _imageOffsets, false);
ser.Sync("writePending", ref _writePending);
ser.Sync("distinctAccesses", ref _distinctAccesses);
ser.Sync("writeEnabled", ref _writeEnabled);
ser.Sync("dataHoldRegister", ref _dataHoldRegister);
ser.Sync("numberOfLoadImages", ref _numberOfLoadImages);
- ser.Sync("loadedImages", ref _loadedImages);
+ ser.Sync("loadedImages", ref _loadedImages, false);
- ser.Sync("header", ref _header);
+ ser.Sync("header", ref _header, false);
ser.Sync("powerIndicator", ref _powerIndicator);
ser.Sync("powerRomCycle", ref _powerRomCycle);
ser.Sync("size", ref _size);
@@ -225,7 +216,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override void ClockCpu()
{
_elapsedCycles++;
-
}
private byte ReadMem(ushort addr, bool peek)
@@ -468,7 +458,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_header[i] = _loadedImages[(image * 8448) + 8192 + i];
}
- if (Checksum(_header.Arr.Take(8).ToArray()) != 0x55)
+ if (Checksum(_header.Take(8).ToArray()) != 0x55)
{
Console.WriteLine("WARNING: The Supercharger header checksum is invalid...");
}
@@ -481,7 +471,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
int bank = _header[16 + j] & 0x03;
int page = (_header[16 + j] >> 2) & 0x07;
- var src = _loadedImages.Arr.Skip((image * 8448) + (j * 256)).Take(256).ToArray();
+ var src = _loadedImages.Skip((image * 8448) + (j * 256)).Take(256).ToArray();
byte sum = (byte)(Checksum(src) + _header[16 + j] + _header[64 + j]);
if (!invalidPageChecksumSeen && (sum != 0x55))
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs
index f95ad9e292..8b576f71b9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs
@@ -180,7 +180,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mCM : MapperBase
{
// TODO: PokeMem
- private ByteBuffer _ram = new ByteBuffer(2048);
+ private byte[] _ram = new byte[2048];
private int _bank4K = 3; // On Start up, controller port is all 1's, so start on the last bank, flags enabled
private bool _disableRam = true;
private bool _writeMode;
@@ -188,15 +188,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private bool _funcKey;
private bool _shiftKey;
- public override void Dispose()
- {
- _ram.Dispose();
- base.Dispose();
- }
-
public override void HardReset()
{
- _ram = new ByteBuffer(2048);
+ _ram = new byte[2048];
_bank4K = 3;
_disableRam = true;
_writeMode = true;
@@ -209,7 +203,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override void SyncState(Serializer ser)
{
- ser.Sync("cartRam", ref _ram);
+ ser.Sync("cartRam", ref _ram, false);
ser.Sync("bank4k", ref _bank4K);
ser.Sync("column", ref _column);
ser.Sync("disableRam", ref _disableRam);
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs
index b60b939710..9e80033ae6 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs
@@ -17,30 +17,24 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
*/
internal class mCV : MapperBase
{
- private ByteBuffer _ram = new ByteBuffer(1024);
+ private byte[] _ram = new byte[1024];
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("aux_ram", ref _ram);
+ ser.Sync("aux_ram", ref _ram, false);
}
public override void HardReset()
{
- _ram = new ByteBuffer(1024);
+ _ram = new byte[1024];
base.HardReset();
}
- public override void Dispose()
- {
- _ram.Dispose();
- base.Dispose();
- }
-
public override byte ReadMemory(ushort addr)
{
if (addr < 0x1000)
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs
index 9bb0736075..89ed8c7749 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs
@@ -229,10 +229,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// shift register (it's the NOT of the EOR of four bits)
private readonly byte[] _randomInputBits = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 };
- private IntBuffer _counters = new IntBuffer(8);
- private ByteBuffer _tops = new ByteBuffer(8);
- private ByteBuffer _flags = new ByteBuffer(8);
- private ByteBuffer _bottoms = new ByteBuffer(8);
+ private int[] _counters = new int[8];
+ private byte[] _tops = new byte[8];
+ private byte[] _flags = new byte[8];
+ private byte[] _bottoms = new byte[8];
private bool[] _musicModes = new bool[3];
private int _bank4K;
@@ -243,23 +243,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private byte[] _dspData;
public byte[] DspData => _dspData ??= Core.Rom.Skip(8192).Take(2048).ToArray();
- public override void Dispose()
- {
- base.Dispose();
- _counters.Dispose();
- _tops.Dispose();
- _flags.Dispose();
- _bottoms.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("counters", ref _counters);
- ser.Sync("tops", ref _tops);
- ser.Sync("flags", ref _flags);
- ser.Sync("bottoms", ref _bottoms);
+ ser.Sync("counters", ref _counters, false);
+ ser.Sync("tops", ref _tops, false);
+ ser.Sync("flags", ref _flags, false);
+ ser.Sync("bottoms", ref _bottoms, false);
ser.Sync("musicMode0", ref _musicModes[0]); // Silly, but I didn't want to support bool[] in Serializer just for this one variable
ser.Sync("musicMode1", ref _musicModes[1]);
ser.Sync("musicMode2", ref _musicModes[2]);
@@ -272,10 +263,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override void HardReset()
{
- _counters = new IntBuffer(8);
- _tops = new ByteBuffer(8);
- _flags = new ByteBuffer(8);
- _bottoms = new ByteBuffer(8);
+ _counters = new int[8];
+ _tops = new byte[8];
+ _flags = new byte[8];
+ _bottoms = new byte[8];
_musicModes = new bool[3];
_bank4K = 0;
_currentRandomVal = 0;
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs
index ce7514d255..40537e32e1 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs
@@ -17,10 +17,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
throw new NotImplementedException();
}
- private IntBuffer _counters = new IntBuffer(8);
- private ByteBuffer _tops = new ByteBuffer(8);
- private ByteBuffer _flags = new ByteBuffer(8);
- private ByteBuffer _bottoms = new ByteBuffer(8);
+ private int[] _counters = new int[8];
+ private byte[] _tops = new byte[8];
+ private byte[] _flags = new byte[8];
+ private byte[] _bottoms = new byte[8];
private bool[] _musicModes = new bool[3];
private int _bank4K;
@@ -35,23 +35,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// shift register (it's the NOT of the EOR of four bits)
private readonly byte[] _randomInputBits = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 };
- public override void Dispose()
- {
- base.Dispose();
- _counters.Dispose();
- _tops.Dispose();
- _flags.Dispose();
- _bottoms.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("counters", ref _counters);
- ser.Sync("tops", ref _tops);
- ser.Sync("flags", ref _flags);
- ser.Sync("bottoms", ref _bottoms);
+ ser.Sync("counters", ref _counters, false);
+ ser.Sync("tops", ref _tops, false);
+ ser.Sync("flags", ref _flags, false);
+ ser.Sync("bottoms", ref _bottoms, false);
ser.Sync("musicMode0", ref _musicModes[0]); // Silly, but I didn't want to support bool[] in Serializer just for this one variable
ser.Sync("musicMode1", ref _musicModes[1]);
ser.Sync("musicMode2", ref _musicModes[2]);
@@ -64,10 +55,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public override void HardReset()
{
- _counters = new IntBuffer(8);
- _tops = new ByteBuffer(8);
- _flags = new ByteBuffer(8);
- _bottoms = new ByteBuffer(8);
+ _counters = new int[8];
+ _tops = new byte[8];
+ _flags = new byte[8];
+ _bottoms = new byte[8];
_musicModes = new bool[3];
_bank4K = 0;
_currentRandomVal = 0;
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs
index 82799d4f51..f1a7e7b150 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs
@@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private const int RamBank1Offset = 1024;
private int _rombank1K;
private int _rambank1Toggle;
- private ByteBuffer _ram = new ByteBuffer(2048);
+ private byte[] _ram = new byte[2048];
private bool _enableRam0;
@@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
base.SyncState(ser);
ser.Sync("toggle", ref _rombank1K);
- ser.Sync("ram", ref _ram);
+ ser.Sync("ram", ref _ram, false);
ser.Sync("EnableRam0", ref _enableRam0);
ser.Sync("rambank1_toggle", ref _rambank1Toggle);
}
@@ -49,20 +49,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
_rombank1K = 0;
_rambank1Toggle = 0;
- _ram = new ByteBuffer(2048);
+ _ram = new byte[2048];
_enableRam0 = false;
base.HardReset();
}
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
- }
-
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
private byte ReadMem(ushort addr, bool peek)
{
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs
index 4b4db6fe8d..42437c5bcf 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs
@@ -10,29 +10,23 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mEFSC : MapperBase
{
private int _bank4k;
- private ByteBuffer _ram = new ByteBuffer(128);
+ private byte[] _ram = new byte[128];
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("bank4k", ref _bank4k);
- ser.Sync("auxRam", ref _ram);
- }
-
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
+ ser.Sync("auxRam", ref _ram, false);
}
public override void HardReset()
{
_bank4k = 0;
- _ram = new ByteBuffer(128);
+ _ram = new byte[128];
base.HardReset();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs
index 624631384d..c1b13a3e1f 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs
@@ -9,29 +9,23 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mF4SC : MapperBase
{
private int _bank4k;
- private ByteBuffer _ram = new ByteBuffer(128);
+ private byte[] _ram = new byte[128];
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("toggle", ref _bank4k);
- ser.Sync("auxRam", ref _ram);
- }
-
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
+ ser.Sync("auxRam", ref _ram, false);
}
public override void HardReset()
{
_bank4k = 0;
- _ram = new ByteBuffer(128);
+ _ram = new byte[128];
base.HardReset();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs
index 0b7232dc64..ddff6acdd9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs
@@ -9,29 +9,23 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mF6SC : MapperBase
{
private int _bank4k;
- private ByteBuffer _ram = new ByteBuffer(128);
+ private byte[] _ram = new byte[128];
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("bank_4k", ref _bank4k);
- ser.Sync("auxRam", ref _ram);
- }
-
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
+ ser.Sync("auxRam", ref _ram, false);
}
public override void HardReset()
{
_bank4k = 0;
- _ram = new ByteBuffer(128);
+ _ram = new byte[128];
base.HardReset();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs
index 891c3413db..dd8fa32ac5 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs
@@ -9,16 +9,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mF8SC : MapperBase
{
private int _bank_4K;
- private ByteBuffer _ram = new ByteBuffer(128);
+ private byte[] _ram = new byte[128];
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void HardReset()
{
_bank_4K = 0;
- _ram = new ByteBuffer(128);
+ _ram = new byte[128];
base.HardReset();
}
@@ -89,13 +89,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
base.SyncState(ser);
ser.Sync("bank_4k", ref _bank_4K);
- ser.Sync("auxRam", ref _ram);
- }
-
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
+ ser.Sync("auxRam", ref _ram, false);
}
private void Address(ushort addr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs
index 805ffdf42b..8c4563a86a 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs
@@ -17,25 +17,19 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mFA : MapperBase
{
private int _toggle;
- private ByteBuffer _ram = new ByteBuffer(256);
+ private byte[] _ram = new byte[256];
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("toggle", ref _toggle);
- ser.Sync("auxRam", ref _ram);
- }
-
- public override void Dispose()
- {
- _ram.Dispose();
- base.Dispose();
+ ser.Sync("auxRam", ref _ram, false);
}
public override void HardReset()
{
_toggle = 0;
- _ram = new ByteBuffer(256);
+ _ram = new byte[256];
base.HardReset();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs
index 56015e293d..36d74b13dd 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs
@@ -11,29 +11,23 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal class mFA2 : MapperBase
{
private int _bank4k;
- private ByteBuffer _ram = new ByteBuffer(256);
+ private byte[] _ram = new byte[256];
public override bool HasCartRam => true;
- public override ByteBuffer CartRam => _ram;
+ public override byte[] CartRam => _ram;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("bank4k", ref _bank4k);
- ser.Sync("auxRam", ref _ram);
- }
-
- public override void Dispose()
- {
- base.Dispose();
- _ram.Dispose();
+ ser.Sync("auxRam", ref _ram, false);
}
public override void HardReset()
{
_bank4k = 0;
- _ram = new ByteBuffer(256);
+ _ram = new byte[256];
base.HardReset();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs
index aa796813e2..3b8e92d8c9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AVE-NINA.cs
@@ -10,18 +10,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_32k, chr_bank_mask_4k;
//state
- IntBuffer chr_banks_4k = new IntBuffer(2);
+ int[] chr_banks_4k = new int[2];
int prg_bank_32k;
- public override void Dispose()
- {
- base.Dispose();
- chr_banks_4k.Dispose();
- }
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(chr_banks_4k), ref chr_banks_4k);
+ ser.Sync(nameof(chr_banks_4k), ref chr_banks_4k, false);
ser.Sync(nameof(prg_bank_32k), ref prg_bank_32k);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
index 1d0f66675a..35ffdd48b4 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI-FCG-1.cs
@@ -42,11 +42,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
byte jump2_outer_bank; // needed to select between banks in 512K jump2 board
//regenerable state
- IntBuffer prg_banks_16k = new IntBuffer(2);
+ int[] prg_banks_16k = new int[2];
//state
int prg_reg_16k;
- ByteBuffer regs = new ByteBuffer(8);
+ byte[] regs = new byte[8];
bool irq_enabled;
ushort irq_counter;
ushort irq_latch;
@@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
ser.Sync(nameof(prg_reg_16k), ref prg_reg_16k);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(irq_counter), ref irq_counter);
ser.Sync(nameof(irq_enabled), ref irq_enabled);
ser.Sync(nameof(irq_latch), ref irq_latch);
@@ -66,13 +66,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SyncPRG();
}
- public override void Dispose()
- {
- base.Dispose();
- regs.Dispose();
- prg_banks_16k.Dispose();
- }
-
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs
index 142344184e..6c05e0351e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/BANDAI_74_161_161_32.cs
@@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr;
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -34,19 +34,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(chr), ref chr);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
void SyncPRG()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs
index 4c93fa4e7c..562a4e6e35 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Camerica.cs
@@ -12,18 +12,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bool mirror_control_enabled;
//state
- IntBuffer prg_banks_16k = new IntBuffer(2);
-
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_16k.Dispose();
- }
+ int[] prg_banks_16k = new int[2];
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
public override bool Configure(NES.EDetectionOrigin origin)
@@ -99,19 +93,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_16k;
//state
- IntBuffer prg_banks_16k = new IntBuffer(2);
+ int[] prg_banks_16k = new int[2];
int prg_block, prg_page;
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_16k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
ser.Sync(nameof(prg_block), ref prg_block);
ser.Sync(nameof(prg_page), ref prg_page);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs
index 4404117e2c..c8047f801e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/CamericaGoldenFive.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from
public sealed class CamericaGoldenFive : NES.NESBoardBase
{
- private ByteBuffer regs = new ByteBuffer(2);
+ private byte[] regs = new byte[2];
private int prg_bank_mask_16k;
@@ -26,16 +26,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("reg", ref regs);
+ ser.Sync("reg", ref regs, false);
}
public override void WritePRG(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs
index 4c9a315d3a..e808c47020 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Cony.cs
@@ -8,9 +8,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// http://problemkaputt.de/everynes.htm#mapper83cony
public class ConyA : NES.NESBoardBase
{
- private ByteBuffer prg_regs = new ByteBuffer(4);
- private ByteBuffer low = new ByteBuffer(4); // some kind of security feature?
- private ByteBuffer chr_regs = new ByteBuffer(8);
+ private byte[] prg_regs = new byte[4];
+ private byte[] low = new byte[4]; // some kind of security feature?
+ private byte[] chr_regs = new byte[8];
private int prg_bank_mask_16k, prg_bank_mask_8k, chr_bank_mask_2k;
private int IRQCount;
@@ -40,19 +40,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
- public override void Dispose()
- {
- prg_regs.Dispose();
- low.Dispose();
- chr_regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs), ref prg_regs);
- ser.Sync(nameof(chr_regs), ref chr_regs);
+ ser.Sync(nameof(prg_regs), ref prg_regs, false);
+ ser.Sync(nameof(chr_regs), ref chr_regs, false);
ser.Sync(nameof(IRQCount), ref IRQCount);
ser.Sync(nameof(IRQa), ref IRQa);
ser.Sync(nameof(bank), ref bank);
@@ -208,9 +200,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public class ConyB : NES.NESBoardBase
{
- private ByteBuffer prg_regs = new ByteBuffer(4);
- private ByteBuffer low = new ByteBuffer(4); // some kind of security feature?
- private ByteBuffer chr_regs = new ByteBuffer(8);
+ private byte[] prg_regs = new byte[4];
+ private byte[] low = new byte[4]; // some kind of security feature?
+ private byte[] chr_regs = new byte[8];
private int prg_bank_mask_16k, prg_bank_mask_8k, chr_bank_mask_2k;
private int IRQCount;
@@ -242,8 +234,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs), ref prg_regs);
- ser.Sync(nameof(chr_regs), ref chr_regs);
+ ser.Sync(nameof(prg_regs), ref prg_regs, false);
+ ser.Sync(nameof(chr_regs), ref chr_regs, false);
ser.Sync(nameof(IRQCount), ref IRQCount);
ser.Sync(nameof(IRQa), ref IRQa);
ser.Sync(nameof(bank), ref bank);
@@ -399,8 +391,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public class ConyC : NES.NESBoardBase
{
- private ByteBuffer prg_regs = new ByteBuffer(2);
- private ByteBuffer chr_regs = new ByteBuffer(8);
+ private byte[] prg_regs = new byte[2];
+ private byte[] chr_regs = new byte[8];
private int prg_bank_mask_16k;
private int IRQCount;
@@ -433,8 +425,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(chr_regs), ref chr_regs);
- ser.Sync(nameof(prg_regs), ref prg_regs);
+ ser.Sync(nameof(chr_regs), ref chr_regs, false);
+ ser.Sync(nameof(prg_regs), ref prg_regs, false);
}
public override void WritePRG(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs
index 3745af4ee0..cb8f951d39 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/ExROM.cs
@@ -29,19 +29,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int exram_mode, chr_mode, prg_mode;
int chr_reg_high;
int ab_mode;
- IntBuffer regs_a = new IntBuffer(8);
- IntBuffer regs_b = new IntBuffer(4);
- IntBuffer regs_prg = new IntBuffer(4);
- IntBuffer nt_modes = new IntBuffer(4);
+ int[] regs_a = new int[8];
+ int[] regs_b = new int[4];
+ int[] regs_prg = new int[4];
+ int[] nt_modes = new int[4];
byte nt_fill_tile, nt_fill_attrib;
int wram_bank;
byte[] EXRAM = new byte[1024];
byte multiplicand, multiplier;
MMC5Audio audio;
//regeneratable state
- IntBuffer a_banks_1k = new IntBuffer(8);
- IntBuffer b_banks_1k = new IntBuffer(8);
- IntBuffer prg_banks_8k = new IntBuffer(4);
+ int[] a_banks_1k = new int[8];
+ int[] b_banks_1k = new int[8];
+ int[] prg_banks_8k = new int[4];
byte product_low, product_high;
int last_nt_read;
bool irq_audio;
@@ -71,10 +71,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(prg_mode), ref prg_mode);
ser.Sync(nameof(chr_reg_high), ref chr_reg_high);
ser.Sync(nameof(ab_mode), ref ab_mode);
- ser.Sync(nameof(regs_a), ref regs_a);
- ser.Sync(nameof(regs_b), ref regs_b);
- ser.Sync(nameof(regs_prg), ref regs_prg);
- ser.Sync(nameof(nt_modes), ref nt_modes);
+ ser.Sync(nameof(regs_a), ref regs_a, false);
+ ser.Sync(nameof(regs_b), ref regs_b, false);
+ ser.Sync(nameof(regs_prg), ref regs_prg, false);
+ ser.Sync(nameof(nt_modes), ref nt_modes, false);
ser.Sync(nameof(nt_fill_tile), ref nt_fill_tile);
ser.Sync(nameof(nt_fill_attrib), ref nt_fill_attrib);
ser.Sync(nameof(wram_bank), ref wram_bank);
@@ -88,17 +88,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
audio.SyncState(ser);
}
- public override void Dispose()
- {
- regs_a.Dispose();
- regs_b.Dispose();
- regs_prg.Dispose();
- a_banks_1k.Dispose();
- b_banks_1k.Dispose();
- prg_banks_8k.Dispose();
- nt_modes.Dispose();
- }
-
public override bool Configure(NES.EDetectionOrigin origin)
{
//analyze board type
@@ -719,7 +708,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
audio.Clock();
}
- void SetBank(IntBuffer target, int offset, int size, int value)
+ void SetBank(int[] target, int offset, int size, int value)
{
value &= ~(size-1);
for (int i = 0; i < size; i++)
@@ -802,9 +791,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SetBank(b_banks_1k, 7, 1, regs_b[3]);
break;
}
-
-
}
-
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper017.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper017.cs
index a7b79eac34..63115f0aaf 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper017.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/FFE/Mapper017.cs
@@ -5,8 +5,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class Mapper017 : NES.NESBoardBase
{
- private ByteBuffer prg_regs_8k = new ByteBuffer(4);
- private ByteBuffer chr_regs_1k = new ByteBuffer(8);
+ private byte[] prg_regs_8k = new byte[4];
+ private byte[] chr_regs_1k = new byte[8];
private int prg_mask_8k;
private int chr_mask_1k;
@@ -98,19 +98,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
- public override void Dispose()
- {
- base.Dispose();
- prg_regs_8k.Dispose();
- chr_regs_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
- ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
+ ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k, false);
ser.Sync(nameof(irq_enable), ref irq_enable);
ser.Sync(nameof(irq_pending), ref irq_pending);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs
index 42d535df0d..b83326d7f9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/IREM_TAM_S1.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -28,18 +28,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
void SyncPRG()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs
index 2c90571c13..abee0ef033 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_G101.cs
@@ -15,23 +15,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bool oneScreenHack;
//state
- ByteBuffer prg_regs_8k = new ByteBuffer(8);
- ByteBuffer chr_regs_1k = new ByteBuffer(8);
+ byte[] prg_regs_8k = new byte[8];
+ byte[] chr_regs_1k = new byte[8];
int prg_mode, mirror_mode;
- public override void Dispose()
- {
- prg_regs_8k.Dispose();
- chr_regs_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
- ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k);
- ser.Sync(nameof(prg_mode), ref chr_regs_1k);
- ser.Sync(nameof(mirror_mode), ref chr_regs_1k);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
+ ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k, false);
+ ser.Sync(nameof(prg_mode), ref prg_mode);
+ ser.Sync(nameof(mirror_mode), ref mirror_mode);
}
public override bool Configure(NES.EDetectionOrigin origin)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs
index 3bc0c0ca84..a4f51a96fe 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Irem_H3001.cs
@@ -15,24 +15,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask, chr_bank_mask;
//state
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
- ByteBuffer chr_regs_1k = new ByteBuffer(8);
+ byte[] prg_regs_8k = new byte[4];
+ byte[] chr_regs_1k = new byte[8];
bool irq_counter_enabled, irq_asserted;
ushort irq_counter, irq_reload;
int clock_counter;
- public override void Dispose()
- {
- base.Dispose();
- prg_regs_8k.Dispose();
- chr_regs_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
- ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
+ ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k, false);
ser.Sync(nameof(irq_counter_enabled), ref irq_counter_enabled);
ser.Sync(nameof(irq_asserted), ref irq_asserted);
ser.Sync(nameof(irq_counter), ref irq_counter);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs
index 74c64a3c57..e3e09434b7 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs
@@ -23,8 +23,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int latch;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
- ByteBuffer chr_banks_8k = new ByteBuffer(1);
+ byte[] prg_banks_16k = new byte[2];
+ byte[] chr_banks_8k = new byte[1];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -56,19 +56,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ApplyMemoryMapMask(chr_bank_mask_8k, chr_banks_8k);
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- chr_banks_8k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(latch), ref latch);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
- ser.Sync(nameof(chr_banks_8k), ref chr_banks_8k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
+ ser.Sync(nameof(chr_banks_8k), ref chr_banks_8k, false);
}
public override void WritePRG(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs
index 52191278ea..4103579a6e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_JF_19.cs
@@ -20,8 +20,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int latch;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
- ByteBuffer chr_banks_8k = new ByteBuffer(1);
+ byte[] prg_banks_16k = new byte[2];
+ byte[] chr_banks_8k = new byte[1];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -53,19 +53,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ApplyMemoryMapMask(chr_bank_mask_8k, chr_banks_8k);
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- chr_banks_8k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(latch), ref latch);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
- ser.Sync(nameof(chr_banks_8k), ref chr_banks_8k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
+ ser.Sync(nameof(chr_banks_8k), ref chr_banks_8k, false);
}
public override void WritePRG(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs
index 30c09d7496..67b74c1a81 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/JALECO_SS8806.cs
@@ -6,8 +6,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
//http://wiki.nesdev.com/w/index.php/INES_Mapper_018
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
- ByteBuffer chr_banks_1k = new ByteBuffer(8);
+ byte[] prg_banks_8k = new byte[4];
+ byte[] chr_banks_1k = new byte[8];
int chr_bank_mask_1k, prg_bank_mask_8k;
int ppuclock;
int irqclock;
@@ -51,8 +51,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k, false);
ser.Sync(nameof(ppuclock), ref ppuclock);
ser.Sync(nameof(irqclock), ref irqclock);
ser.Sync(nameof(irqreload), ref irqreload);
@@ -61,13 +61,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
base.SyncState(ser);
}
- public override void Dispose()
- {
- prg_banks_8k.Dispose();
- chr_banks_1k.Dispose();
- base.Dispose();
- }
-
public override void WritePRG(int addr, byte value)
{
addr += 0x8000; //temporary
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs
index 143a67a928..3686669875 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MLT-ACTION52.cs
@@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public int chr_reg;
public int chip_offset;
public bool cheetahmen = false;
- ByteBuffer eRAM = new ByteBuffer(4);
+ byte[] eRAM = new byte[4];
int chr_bank_mask_8k, prg_bank_mask_16k, prg_bank_mask_32k;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -54,16 +54,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(chr_reg), ref chr_reg);
ser.Sync(nameof(prg_mode), ref prg_mode);
ser.Sync("chip", ref chip_offset);
- ser.Sync(nameof(eRAM), ref eRAM);
+ ser.Sync(nameof(eRAM), ref eRAM, false);
base.SyncState(ser);
}
- public override void Dispose()
- {
- eRAM.Dispose();
- base.Dispose();
- }
-
public override void WriteEXP(int addr, byte value)
{
if (addr >= 0x1800)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
index 03f15b6940..4674b6127c 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/MMC3.cs
@@ -3,20 +3,19 @@
//fceux contains a comment in mmc3.cpp:
//Code for emulating iNES mappers 4,12,44,45,47,49,52,74,114,115,116,118,119,165,205,214,215,245,249,250,254
-using System;
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
- public class MMC3 : IDisposable
+ public class MMC3
{
//state
public int reg_addr;
public bool get_chr_mode => chr_mode; // one of the pirate mappers needs this
public bool chr_mode;
public bool prg_mode;
- public ByteBuffer regs = new ByteBuffer(8);
+ public byte[] regs = new byte[8];
public byte mirror;
int a12_old;
@@ -32,8 +31,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int irq_countdown;
//volatile state
- public ByteBuffer chr_regs_1k = new ByteBuffer(8);
- public ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ public byte[] chr_regs_1k = new byte[8];
+ public byte[] prg_regs_8k = new byte[4];
//configuration
public enum EMMC3Type
@@ -52,13 +51,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
bool oldIrqType;
- public virtual void Dispose()
- {
- regs.Dispose();
- chr_regs_1k.Dispose();
- prg_regs_8k.Dispose();
- }
-
public NES.NESBoardBase.EMirrorType MirrorType
{
get
@@ -150,7 +142,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(reg_addr), ref reg_addr);
ser.Sync(nameof(chr_mode), ref chr_mode);
ser.Sync(nameof(prg_mode), ref prg_mode);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(mirror), ref mirror);
ser.Sync(nameof(a12_old), ref a12_old);
ser.Sync(nameof(irq_reload), ref irq_reload);
@@ -337,11 +329,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//configuration
protected int prg_mask, chr_mask;
- public override void Dispose()
- {
- mmc3?.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper114.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper114.cs
index 5bbe30006b..b0aae00fa8 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper114.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper114.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Mapper for Aladdin Super Game
public sealed class Mapper114 : MMC3Board_Base
{
- private ByteBuffer EXPREGS = new ByteBuffer(2);
+ private byte[] EXPREGS = new byte[2];
private int prg_mask_16;
@@ -28,16 +28,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- EXPREGS.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("expregs", ref EXPREGS);
+ ser.Sync("expregs", ref EXPREGS, false);
}
public override void WriteEXP(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs
index 802869ce8b..8fc9104fc9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper121.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from Nestopia src
public sealed class Mapper121 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(3);
+ private byte[] exRegs = new byte[3];
private readonly byte[] lut = { 0x00, 0x83, 0x42, 0x00 };
@@ -23,16 +23,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
}
public override byte ReadEXP(int addr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs
index 4b6b35f13d..f026062e25 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper123.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from FCEUX src
public sealed class Mapper123 : MMC3Board_Base
{
- private ByteBuffer EXPREGS = new ByteBuffer(8);
+ private byte[] EXPREGS = new byte[8];
private byte[] sec = { 0, 3, 1, 5, 6, 7, 2, 4 };
@@ -24,16 +24,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- EXPREGS.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("expregs", ref EXPREGS);
+ ser.Sync("expregs", ref EXPREGS, false);
}
public override void WriteEXP(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper187.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper187.cs
index 1582c41cc5..2679877c77 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper187.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper187.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from FCEUX src
public class Mapper187 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(2);
+ private byte[] exRegs = new byte[2];
private readonly byte[] prot_data = { 0x83, 0x83, 0x42, 0x00 };
@@ -23,16 +23,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("expregs", ref exRegs);
+ ser.Sync("expregs", ref exRegs, false);
}
public override void WritePRG(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs
index dfa7405530..e75f006efa 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper197.cs
@@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public class Mapper197_MMC3 : MMC3
{
//This board has 512k CHR ROM, so the ByteBuffer in the base class deosn't suffice.
- public IntBuffer chr_regs_1k_512 = new IntBuffer(8);
+ public int[] chr_regs_1k_512 = new int[8];
public Mapper197_MMC3(NES.NESBoardBase board, int num_prg_banks) : base(board, num_prg_banks)
{
@@ -59,13 +59,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(chr_regs_1k_512), ref chr_regs_1k_512);
- }
-
- public override void Dispose()
- {
- base.Dispose();
- chr_regs_1k_512.Dispose();
+ ser.Sync(nameof(chr_regs_1k_512), ref chr_regs_1k_512, false);
}
public override int Get_CHRBank_1K(int addr)
@@ -74,6 +68,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bank_1k = chr_regs_1k_512[bank_1k];
return bank_1k;
}
-
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs
index 56aaf80215..88c4a55e79 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper199.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper199 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(4);
+ private byte[] exRegs = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -26,16 +26,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
}
public override byte ReadPPU(int addr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs
index ff8961091e..89524b3e31 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper208.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper208 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(6);
+ private byte[] exRegs = new byte[6];
private readonly byte[] lut = {
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
@@ -39,16 +39,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("expregs", ref exRegs);
+ ser.Sync("expregs", ref exRegs, false);
}
public override byte ReadPRG(int addr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
index 55bccaf229..b69e430417 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper215.cs
@@ -4,9 +4,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class Mapper215 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(4);
+ private byte[] exRegs = new byte[4];
- public ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ public byte[] prg_regs_8k = new byte[4];
private bool is_mk3;
@@ -73,19 +73,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- prg_regs_8k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
ser.Sync(nameof(is_mk3), ref is_mk3);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
ser.Sync(nameof(prg_mask), ref prg_mask_8k);
ser.Sync(nameof(chr_mask), ref chr_mask_1k);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
index 2e7f1c5e6a..981a64512e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper217.cs
@@ -4,9 +4,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper217 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(4);
+ private byte[] exRegs = new byte[4];
- public ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ public byte[] prg_regs_8k = new byte[4];
private int prg_mask_8k, chr_mask_1k;
private byte[] regs_sec = { 0, 6, 3, 7, 5, 2, 4, 1 };
@@ -39,18 +39,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- prg_regs_8k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
ser.Sync(nameof(prg_mask), ref prg_mask_8k);
ser.Sync(nameof(chr_mask), ref chr_mask_1k);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs
index ce270c2098..d661ad1415 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper254.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper254 : MMC3Board_Base
{
- private ByteBuffer regs = new ByteBuffer(2);
+ private byte[] regs = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -21,16 +21,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
}
public override byte ReadWRAM(int addr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs
index 58c53216d9..0289ab376b 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/MMC3_family/Pocahontas.cs
@@ -4,9 +4,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class MapperPocahontas : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(3);
+ private byte[] exRegs = new byte[3];
- public ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ public byte[] prg_regs_8k = new byte[4];
private int prg_mask_8k, chr_mask_1k;
@@ -39,18 +39,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- prg_regs_8k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
ser.Sync(nameof(prg_mask), ref prg_mask_8k);
ser.Sync(nameof(chr_mask), ref chr_mask_1k);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs
index 679aa607e5..dc60d4da15 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper015.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_8k;
//state
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
+ byte[] prg_banks_8k = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -41,12 +41,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_8k.Dispose();
- base.Dispose();
- }
-
public override byte ReadPRG(int addr)
{
addr = ApplyMemoryMap(13, prg_banks_8k, addr);
@@ -100,7 +94,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper034.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper034.cs
index 9881e11681..1afe551e8c 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper034.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper034.cs
@@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_32k, chr_bank_mask_4k;
//state
- ByteBuffer chr = new ByteBuffer(2);
+ byte[] chr = new byte[2];
int prg;
@@ -35,12 +35,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- chr.Dispose();
- base.Dispose();
- }
-
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
@@ -83,7 +77,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
ser.Sync(nameof(prg), ref prg);
- ser.Sync(nameof(chr), ref chr);
+ ser.Sync(nameof(chr), ref chr, false);
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
index 78d737bbd3..22e3c8c9c2 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper045.cs
@@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr_bank_mask_2k;
int prg_bank_mask_8k;
int cur_reg = 0;
- ByteBuffer regs = new ByteBuffer(4);
+ byte[] regs = new byte[4];
bool lock_regs = false;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -30,15 +30,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(lock_regs), ref lock_regs);
base.SyncState(ser);
}
@@ -54,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
regs[cur_reg] = value;
IncrementCounter();
Sync45();
- }
+ }
}
private void Sync45()
@@ -78,7 +72,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
lock_regs = false;
cur_reg = 0;
- regs = new ByteBuffer(4);
+ regs = new byte[4];
base.NESSoftReset();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs
index 44fa9ea502..ef2c40980e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper069.cs
@@ -61,8 +61,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int addr_reg;
- ByteBuffer regs = new ByteBuffer(12);
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
+ byte[] regs = new byte[12];
+ byte[] prg_banks_8k = new byte[4];
int wram_bank;
bool wram_ram_selected, wram_ram_enabled;
ushort irq_counter;
@@ -74,8 +74,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
ser.Sync(nameof(addr_reg), ref addr_reg);
- ser.Sync(nameof(regs), ref regs);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
+ ser.Sync(nameof(regs), ref regs, false);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
ser.Sync(nameof(wram_bank), ref wram_bank);
ser.Sync(nameof(wram_ram_selected), ref wram_ram_selected);
ser.Sync(nameof(wram_ram_enabled), ref wram_ram_enabled);
@@ -87,13 +87,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SyncIrq();
}
- public override void Dispose()
- {
- base.Dispose();
- regs.Dispose();
- prg_banks_8k.Dispose();
- }
-
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs
index 79af148e52..67c35166b6 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper078.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr;
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -34,19 +34,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(chr), ref chr);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
ser.Sync(nameof(holydiver), ref holydiver);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs
index 87f2225bbe..3e6672f5e7 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper090.cs
@@ -5,15 +5,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper090 : NES.NESBoardBase
{
- ByteBuffer prg_regs = new ByteBuffer(4);
- IntBuffer chr_regs = new IntBuffer(8);
- IntBuffer nt_regs = new IntBuffer(4);
+ byte[] prg_regs = new byte[4];
+ int[] chr_regs = new int[8];
+ int[] nt_regs = new int[4];
- IntBuffer prg_banks = new IntBuffer(4);
- IntBuffer chr_banks = new IntBuffer(8);
- IntBuffer chr_latches = new IntBuffer(2);
+ int[] prg_banks = new int[4];
+ int[] chr_banks = new int[8];
+ int[] chr_latches = new int[2];
- ByteBuffer ram_bytes = new ByteBuffer(5);
+ byte[] ram_bytes = new byte[5];
[MapperProp]
public bool dipswitch_0;
@@ -131,14 +131,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs), ref prg_regs);
- ser.Sync(nameof(chr_regs), ref chr_regs);
- ser.Sync(nameof(chr_latches), ref chr_latches);
- ser.Sync(nameof(nt_regs), ref nt_regs);
+ ser.Sync(nameof(prg_regs), ref prg_regs, false);
+ ser.Sync(nameof(chr_regs), ref chr_regs, false);
+ ser.Sync(nameof(chr_latches), ref chr_latches, false);
+ ser.Sync(nameof(nt_regs), ref nt_regs, false);
- ser.Sync(nameof(prg_banks), ref prg_banks);
- ser.Sync(nameof(chr_banks), ref chr_banks);
- ser.Sync(nameof(ram_bytes), ref ram_bytes);
+ ser.Sync(nameof(prg_banks), ref prg_banks, false);
+ ser.Sync(nameof(chr_banks), ref chr_banks, false);
+ ser.Sync(nameof(ram_bytes), ref ram_bytes, false);
ser.Sync(nameof(dipswitch_0), ref dipswitch_0);
ser.Sync(nameof(dipswitch_1), ref dipswitch_1);
@@ -183,18 +183,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Sync();
}
- public override void Dispose()
- {
- prg_regs.Dispose();
- chr_regs.Dispose();
- chr_latches.Dispose();
- nt_regs.Dispose();
- prg_banks.Dispose();
- chr_banks.Dispose();
- ram_bytes.Dispose();
- base.Dispose();
- }
-
private void Sync()
{
SyncIRQ();
@@ -203,7 +191,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SyncNametables();
}
- private void SetBank(IntBuffer target, byte offset, byte size, int value)
+ private void SetBank(int[] target, byte offset, byte size, int value)
{
value &= ~(size - 1);
for (int i = 0; i < size; i++)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper091.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper091.cs
index 968220925f..0b07db0e6a 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper091.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper091.cs
@@ -9,8 +9,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//http://wiki.nesdev.com/w/index.php/INES_Mapper_091
*/
- ByteBuffer chr_regs_2k = new ByteBuffer(4);
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ byte[] chr_regs_2k = new byte[4];
+ byte[] prg_regs_8k = new byte[4];
int chr_bank_mask_2k, prg_bank_mask_8k;
MMC3 mmc3;
@@ -43,19 +43,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_regs_8k.Dispose();
- chr_regs_2k.Dispose();
- mmc3?.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
mmc3.SyncState(ser);
- ser.Sync("prg_regs", ref prg_regs_8k);
- ser.Sync("chr_regs", ref chr_regs_2k);
+ ser.Sync("prg_regs", ref prg_regs_8k, false);
+ ser.Sync("chr_regs", ref chr_regs_2k, false);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper106.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper106.cs
index 90e44ae3d7..9f4e707635 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper106.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper106.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper106 : NES.NESBoardBase
{
- private ByteBuffer regs = new ByteBuffer(16);
+ private byte[] regs = new byte[16];
private int prg_bank_mask_8k;
private int chr_bank_mask_1k;
@@ -34,15 +34,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(IRQa), ref IRQa);
ser.Sync(nameof(IRQCount), ref IRQCount);
base.SyncState(ser);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs
index 1062eec3e2..740516532b 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper132.cs
@@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// specs pulled from Nintendulator sources
public sealed class Mapper132 : NES.NESBoardBase
{
- private ByteBuffer reg = new ByteBuffer(4);
+ private byte[] reg = new byte[4];
//configuraton
int prg_mask, chr_mask;
@@ -39,12 +39,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- reg.Dispose();
- base.Dispose();
- }
-
public void sync(byte value)
{
prg=reg[2]>>2;
@@ -121,8 +115,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(prg), ref prg);
ser.Sync(nameof(is172), ref is172);
ser.Sync(nameof(is173), ref is173);
- ser.Sync(nameof(reg), ref reg);
+ ser.Sync(nameof(reg), ref reg, false);
}
-
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper142.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper142.cs
index 01c50279cc..1dd0b39513 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper142.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper142.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper142 : NES.NESBoardBase
{
- private ByteBuffer reg = new ByteBuffer(8);
+ private byte[] reg = new byte[8];
private byte cmd;
private int lastBank;
@@ -28,15 +28,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- reg.Dispose();
- base.Dispose();
- }
-
public override byte ReadWRAM(int addr)
{
- return ROM[(reg[4] << 13) + (addr & 0x1FFF)];
+ return ROM[(reg[4] << 13) + (addr & 0x1FFF)];
}
public override byte ReadPRG(int addr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper150.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper150.cs
index 873a70e052..44cce75b7f 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper150.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper150.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// basic on FCEUX src
public sealed class Mapper150 : NES.NESBoardBase
{
- private ByteBuffer latch = new ByteBuffer(8);
+ private byte[] latch = new byte[8];
private int cmd;
private int chr_mask;
private int prg_mask;
@@ -27,16 +27,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- latch.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(latch), ref latch);
+ ser.Sync(nameof(latch), ref latch, false);
ser.Sync(nameof(cmd), ref cmd);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper162.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper162.cs
index e1ac55fc65..d7302fd0ad 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper162.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper162.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper162 : NES.NESBoardBase
{
- private ByteBuffer reg = new ByteBuffer(8);
+ private byte[] reg = new byte[8];
private int prg_bank_mask_32k;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -26,15 +26,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- reg.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync("regs", ref reg);
+ ser.Sync("regs", ref reg, false);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs
index 1b2c828aa4..32c6850eb3 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper176.cs
@@ -9,8 +9,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int mirror;
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
- ByteBuffer chr_banks_8k = new ByteBuffer(1);
+ byte[] prg_banks_8k = new byte[4];
+ byte[] chr_banks_8k = new byte[1];
Bit sbw;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -46,13 +46,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_8k.Dispose();
- chr_banks_8k.Dispose();
- base.Dispose();
- }
-
static readonly EMirrorType[] kMirrorTypes = {EMirrorType.Vertical,EMirrorType.Horizontal,EMirrorType.OneScreenA,EMirrorType.OneScreenB};
void SyncMirror()
{
@@ -125,8 +118,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
ser.Sync(nameof(mirror), ref mirror);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_8k), ref chr_banks_8k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_8k), ref chr_banks_8k, false);
ser.Sync(nameof(sbw), ref sbw);
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper178.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper178.cs
index dc00dc4de9..7af65a6507 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper178.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper178.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_32k;
//state
- ByteBuffer prg_banks_32k = new ByteBuffer(1);
+ byte[] prg_banks_32k = new byte[1];
int reg4802;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -31,12 +31,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_32k.Dispose();
- base.Dispose();
- }
-
public override void WriteEXP(int addr, byte value)
{
switch (addr)
@@ -67,7 +61,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_32k), ref prg_banks_32k);
+ ser.Sync(nameof(prg_banks_32k), ref prg_banks_32k, false);
ser.Sync(nameof(reg4802), ref reg4802);
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper180.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper180.cs
index 1f6677ad84..a938e13329 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper180.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper180.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -28,18 +28,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
void SyncPRG()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper183.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper183.cs
index cac17c2453..96d1ccf229 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper183.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper183.cs
@@ -6,8 +6,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adpated from FCEUX src
public sealed class Mapper183 : NES.NESBoardBase
{
- private ByteBuffer prg = new ByteBuffer(4);
- private ByteBuffer chr = new ByteBuffer(8);
+ private byte[] prg = new byte[4];
+ private byte[] chr = new byte[8];
private int IRQLatch = 0;
private int IRQCount = 0;
@@ -33,18 +33,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg.Dispose();
- chr.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg), ref prg);
- ser.Sync(nameof(chr), ref chr);
+ ser.Sync(nameof(prg), ref prg, false);
+ ser.Sync(nameof(chr), ref chr, false);
}
private void SetMirroring(int mirr)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper186.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper186.cs
index 4f3df52dae..589522ae4a 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper186.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper186.cs
@@ -4,8 +4,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class Mapper186 : NES.NESBoardBase
{
- private ByteBuffer _SRAM = new ByteBuffer(3072);
- private ByteBuffer regs = new ByteBuffer(4);
+ private byte[] _SRAM = new byte[3072];
+ private byte[] regs = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -20,17 +20,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- _SRAM.Dispose();
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync("SRAM", ref _SRAM);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync("SRAM", ref _SRAM, false);
+ ser.Sync(nameof(regs), ref regs, false);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper193.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper193.cs
index e0f4e0de88..37524da9e3 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper193.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper193.cs
@@ -47,10 +47,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
*/
int prg_bank_mask_8k;
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
+ byte[] prg_banks_8k = new byte[4];
int chr_bank_mask_2k;
- ByteBuffer chr_banks_2k = new ByteBuffer(4);
+ byte[] chr_banks_2k = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -82,18 +82,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ApplyMemoryMapMask(chr_bank_mask_2k, chr_banks_2k);
}
- public override void Dispose()
- {
- prg_banks_8k.Dispose();
- chr_banks_2k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_2k), ref chr_banks_2k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_2k), ref chr_banks_2k, false);
}
public override void WriteWRAM(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs
index 67bae19969..9c761b51a5 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper220.cs
@@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Ported from FCEUX
public sealed class Mapper220 : NES.NESBoardBase
{
- private ByteBuffer reg = new ByteBuffer(8);
+ private byte[] reg = new byte[8];
private int prg_mask_2k;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -24,15 +24,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- reg.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(reg), ref reg);
+ ser.Sync(nameof(reg), ref reg, false);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper221.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper221.cs
index 0ed3601e59..f8b420dc10 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper221.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper221.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class Mapper221 : NES.NESBoardBase
{
- IntBuffer regs = new IntBuffer(2);
+ int[] regs = new int[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -23,7 +23,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs
index 23b768a9dc..d87ad661ac 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper225.cs
@@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bool prg_mode = false;
int chr_reg;
int prg_reg;
- ByteBuffer eRAM = new ByteBuffer(4);
+ byte[] eRAM = new byte[4];
int chr_bank_mask_8k, prg_bank_mask_16k, prg_bank_mask_32k;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -36,16 +36,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(prg_reg), ref prg_reg);
ser.Sync(nameof(chr_reg), ref chr_reg);
ser.Sync(nameof(prg_mode), ref prg_mode);
- ser.Sync(nameof(eRAM), ref eRAM);
+ ser.Sync(nameof(eRAM), ref eRAM, false);
base.SyncState(ser);
}
- public override void Dispose()
- {
- eRAM.Dispose();
- base.Dispose();
- }
-
public override void WritePRG(int addr, byte value)
{
addr += 0x8000;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
index baaa6995b8..a50b25d766 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper227.cs
@@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int prg;
bool vram_protected;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
//1200-in-1
//[NJXXX] Xiang Shuai Chuan Qi
@@ -36,12 +36,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override byte ReadPRG(int addr)
{
int bank_16k = addr >> 14;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper241.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper241.cs
index 6296d6ac39..9192368755 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper241.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper241.cs
@@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_32k;
//state
- ByteBuffer prg_banks_32k = new ByteBuffer(1);
+ byte[] prg_banks_32k = new byte[1];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -31,12 +31,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_32k.Dispose();
- base.Dispose();
- }
-
public override byte ReadEXP(int addr)
{
//some kind of magic number..
@@ -58,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_32k), ref prg_banks_32k);
+ ser.Sync(nameof(prg_banks_32k), ref prg_banks_32k, false);
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs
index 647575faf3..99363c7196 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper243.cs
@@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int reg_addr;
bool var_a;
- ByteBuffer regs = new ByteBuffer(8);
+ byte[] regs = new byte[8];
int chr_bank_mask_8k, prg_bank_mask_32k;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -28,16 +28,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
ser.Sync(nameof(reg_addr), ref reg_addr);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper246.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper246.cs
index 0dfb0f40e9..b4108eb02d 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper246.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper246.cs
@@ -6,10 +6,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public sealed class Mapper246 : NES.NESBoardBase
{
int prg_bank_mask_8k;
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
+ byte[] prg_banks_8k = new byte[4];
int chr_bank_mask_2k;
- ByteBuffer chr_banks_2k = new ByteBuffer(4);
+ byte[] chr_banks_2k = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -35,18 +35,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ApplyMemoryMapMask(chr_bank_mask_2k, chr_banks_2k);
}
- public override void Dispose()
- {
- prg_banks_8k.Dispose();
- chr_banks_2k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_2k), ref chr_banks_2k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_2k), ref chr_banks_2k, false);
}
public override void WriteWRAM(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs
index 24eb6033a6..bb3eb017c3 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper252.cs
@@ -6,8 +6,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from FCEUX src
public sealed class Mapper252 : NES.NESBoardBase
{
- private ByteBuffer preg = new ByteBuffer(2);
- private ByteBuffer creg = new ByteBuffer(8);
+ private byte[] preg = new byte[2];
+ private byte[] creg = new byte[8];
private int prg_bank_mask_8k, chr_bank_mask_1k;
private int IRQLatch, IRQClock, IRQCount;
@@ -33,18 +33,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- preg.Dispose();
- creg.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(preg), ref preg);
- ser.Sync(nameof(creg), ref creg);
+ ser.Sync(nameof(preg), ref preg, false);
+ ser.Sync(nameof(creg), ref creg, false);
}
public override void ClockCPU()
@@ -60,7 +53,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
IRQSignal=true;
IRQCount = IRQLatch;
- }
+ }
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs
index 79426e2bf4..1d53d77c94 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Mapper253.cs
@@ -5,9 +5,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class Mapper253 : NES.NESBoardBase
{
- private ByteBuffer prg = new ByteBuffer(2);
- private ByteBuffer chrlo = new ByteBuffer(8);
- private ByteBuffer chrhi = new ByteBuffer(8);
+ private byte[] prg = new byte[2];
+ private byte[] chrlo = new byte[8];
+ private byte[] chrhi = new byte[8];
private bool vlock;
private int IRQLatch, IRQClock, IRQCount;
private bool IRQa;
@@ -31,20 +31,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg.Dispose();
- chrlo.Dispose();
- chrhi.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync("preg", ref prg);
- ser.Sync(nameof(chrlo), ref chrlo);
- ser.Sync(nameof(chrhi), ref chrhi);
+ ser.Sync("preg", ref prg, false);
+ ser.Sync(nameof(chrlo), ref chrlo, false);
+ ser.Sync(nameof(chrhi), ref chrhi, false);
}
public override void ClockCPU()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs
index 1704390f1f..f3a8b92827 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NES-EVENT.cs
@@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_16k;
//regenerable state
- IntBuffer prg_banks_16k = new IntBuffer(2);
+ int[] prg_banks_16k = new int[2];
//state
MMC1.MMC1_SerialController scnt;
@@ -74,12 +74,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
irq_destination = 0x20000000 | (val << 25);
}
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_16k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
@@ -95,7 +89,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync(nameof(init_sequence), ref init_sequence);
ser.Sync(nameof(chip_select), ref chip_select);
ser.Sync(nameof(wram_disable), ref wram_disable);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
if (ser.IsReader) Sync();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
index 78f7450bcd..631aef7402 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/NSFBoard.cs
@@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
///
/// PRG bankswitching
///
- IntBuffer prg_banks_4k = new IntBuffer(8);
+ int[] prg_banks_4k = new int[8];
///
/// whether vectors are currently patched. they should not be patched when running init/play routines because data from the ends of banks might get used
@@ -75,16 +75,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_4k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_4k), ref prg_banks_4k);
+ ser.Sync(nameof(prg_banks_4k), ref prg_banks_4k, false);
ser.Sync(nameof(Patch_Vectors), ref Patch_Vectors);
ser.Sync(nameof(CurrentSong), ref CurrentSong);
ser.Sync(nameof(InitPending), ref InitPending);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs
index d9be399703..8d6b99a488 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot129_163.cs
@@ -21,8 +21,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr_bank_mask_1k;
//state
- IntBuffer prg_banks_8k = new IntBuffer(4);
- IntBuffer chr_banks_1k = new IntBuffer(12);
+ int[] prg_banks_8k = new int[4];
+ int[] chr_banks_1k = new int[12];
bool[] vram_enable = new bool[3];
int irq_counter;
@@ -35,18 +35,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
byte prgram_write = 0;
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_8k.Dispose();
- chr_banks_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k, false);
for (int i = 0; i < vram_enable.Length; i++)
ser.Sync("vram_enable_" + i, ref vram_enable[i]);
ser.Sync(nameof(irq_counter), ref irq_counter);
@@ -138,7 +131,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
-
public override void WritePRG(int addr, byte value)
{
addr &= 0xF800;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs
index 2e99aa0b5e..5085f21203 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Mapper112.cs
@@ -10,11 +10,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int reg_addr;
- ByteBuffer regs = new ByteBuffer(8);
+ byte[] regs = new byte[8];
//volatile state
- IntBuffer chr_regs_1k = new IntBuffer(8);
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ int[] chr_regs_1k = new int[8];
+ byte[] prg_regs_8k = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -36,19 +36,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- base.Dispose();
- regs.Dispose();
- chr_regs_1k.Dispose();
- prg_regs_8k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(reg_addr), ref reg_addr);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(chr_outer_reg), ref chr_outer_reg);
Sync();
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
index 944961677b..21cec1092b 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Namcot1xx/Namcot1xx.cs
@@ -5,21 +5,20 @@
//TODO - prg is 4 bits, chr is 6 bits
-using System;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
//also, Namcot109, Namcot118, Namcot119 chips are this exact same thing
- public class Namcot108Chip : IDisposable
+ public class Namcot108Chip
{
//state
int reg_addr;
- ByteBuffer regs = new ByteBuffer(8);
+ byte[] regs = new byte[8];
//volatile state
- ByteBuffer chr_regs_1k = new ByteBuffer(8);
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ byte[] chr_regs_1k = new byte[8];
+ byte[] prg_regs_8k = new byte[4];
NES.NESBoardBase board;
public Namcot108Chip(NES.NESBoardBase board)
@@ -29,17 +28,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Sync();
}
- public void Dispose()
- {
- regs.Dispose();
- chr_regs_1k.Dispose();
- prg_regs_8k.Dispose();
- }
-
public virtual void SyncState(Serializer ser)
{
ser.Sync(nameof(reg_addr), ref reg_addr);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
Sync();
}
@@ -112,11 +104,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
static byte[] TKO = { 0xFF, 0xBF, 0xB7, 0x97, 0x97, 0x17, 0x57, 0x4F, 0x6F, 0x6B, 0xEB, 0xA9, 0xB1, 0x90, 0x94, 0x14,
0x56, 0x4E, 0x6F, 0x6B, 0xEB, 0xA9, 0xB1, 0x90, 0xD4, 0x5C, 0x3E, 0x26, 0x87, 0x83, 0x13, 0x51};
- public override void Dispose()
- {
- mapper?.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
@@ -200,7 +187,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
base.WritePPU(addr, value);
}
-
public override void WritePRG(int addr, byte value)
{
mapper.WritePRG(addr, value);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs
index 13511e2e34..be38b262e8 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/PxROM_FxROM.cs
@@ -13,29 +13,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
byte prg_reg;
- IntBuffer prg_banks_8k = new IntBuffer(4);
- IntBuffer chr_banks_4k = new IntBuffer(4);
- IntBuffer chr_latches = new IntBuffer(2);
+ int[] prg_banks_8k = new int[4];
+ int[] chr_banks_4k = new int[4];
+ int[] chr_latches = new int[2];
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(prg_reg), ref prg_reg);
- ser.Sync(nameof(chr_banks_4k), ref chr_banks_4k);
- ser.Sync(nameof(chr_latches), ref chr_latches);
+ ser.Sync(nameof(chr_banks_4k), ref chr_banks_4k, false);
+ ser.Sync(nameof(chr_latches), ref chr_latches, false);
if (ser.IsReader)
SyncPRG();
}
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_8k.Dispose();
- chr_banks_4k.Dispose();
- chr_latches.Dispose();
- }
-
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
@@ -167,7 +159,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
addr = (bank_8k << 13) | ofs;
return ROM[addr];
}
-
-
}
}
\ No newline at end of file
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs
index 6ea2340e68..3c1d69dd01 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Subor.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Subor : NES.NESBoardBase
{
- private ByteBuffer regs = new ByteBuffer(4);
+ private byte[] regs = new byte[4];
private bool is167;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -23,16 +23,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(is167), ref is167);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs
index 29d921bb43..f49247c724 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m89.cs
@@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr;
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -32,19 +32,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(chr), ref chr);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
void SyncPRG()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m93.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m93.cs
index a0abe684c8..9cb70231fd 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m93.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft2_m93.cs
@@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -32,18 +32,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
void SyncPRG()
@@ -69,6 +63,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return ROM[addr];
}
}
-
-
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
index 7c22a49f52..b452e14c53 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft3.cs
@@ -12,8 +12,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
bool toggle;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
- ByteBuffer chr_banks_2k = new ByteBuffer(4);
+ byte[] prg_banks_16k = new byte[2];
+ byte[] chr_banks_2k = new byte[4];
int irq_counter;
bool irq_enable;
bool irq_asserted;
@@ -28,8 +28,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
base.SyncState(ser);
ser.Sync(nameof(toggle), ref toggle);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
- ser.Sync(nameof(chr_banks_2k), ref chr_banks_2k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
+ ser.Sync(nameof(chr_banks_2k), ref chr_banks_2k, false);
ser.Sync(nameof(irq_counter), ref irq_counter);
ser.Sync(nameof(irq_enable), ref irq_enable);
ser.Sync(nameof(irq_asserted), ref irq_asserted);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs
index 01ec7b9cd4..50cc60df65 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Sunsoft4.cs
@@ -13,25 +13,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask, chr_bank_mask, nt_bank_mask;
//state
- ByteBuffer chr_regs_2k = new ByteBuffer(4);
- ByteBuffer nt_regs = new ByteBuffer(2);
- ByteBuffer prg_regs_16k = new ByteBuffer(2);
+ byte[] chr_regs_2k = new byte[4];
+ byte[] nt_regs = new byte[2];
+ byte[] prg_regs_16k = new byte[2];
bool flag_m, flag_r;
- public override void Dispose()
- {
- base.Dispose();
- chr_regs_2k.Dispose();
- nt_regs.Dispose();
- prg_regs_16k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(chr_regs_2k), ref chr_regs_2k);
- ser.Sync(nameof(nt_regs), ref nt_regs);
- ser.Sync(nameof(prg_regs_16k), ref prg_regs_16k);
+ ser.Sync(nameof(chr_regs_2k), ref chr_regs_2k, false);
+ ser.Sync(nameof(nt_regs), ref nt_regs, false);
+ ser.Sync(nameof(prg_regs_16k), ref prg_regs_16k, false);
ser.Sync(nameof(flag_m), ref flag_m);
ser.Sync(nameof(flag_r), ref flag_r);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
index 2d70d28009..1545dfc299 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/SxROM.cs
@@ -45,12 +45,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SyncCHR();
}
- public void Dispose()
- {
- chr_banks_4k.Dispose();
- prg_banks_16k.Dispose();
- }
-
public void SyncState(Serializer ser)
{
scnt.SyncState(ser);
@@ -93,8 +87,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg;
//regenerable state
- readonly IntBuffer chr_banks_4k = new IntBuffer(2);
- readonly IntBuffer prg_banks_16k = new IntBuffer(2);
+ readonly int[] chr_banks_4k = new int[2];
+ readonly int[] prg_banks_16k = new int[2];
public class MMC1_SerialController
{
@@ -542,12 +536,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
SetMirrorType(mmc1.mirror);
ppuclock = pputimeout;
}
-
- public override void Dispose()
- {
- base.Dispose();
- mmc1?.Dispose();
- }
} //class SxROM
class SoROM : SuROM
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs
index 0e490a241a..8ca4085676 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TAITO_74_161_161_32.cs
@@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr;
int prg_bank_mask_16k;
byte prg_bank_16k;
- ByteBuffer prg_banks_16k = new ByteBuffer(2);
+ byte[] prg_banks_16k = new byte[2];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -31,19 +31,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- prg_banks_16k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(chr), ref chr);
ser.Sync(nameof(prg_bank_mask_16k), ref prg_bank_mask_16k);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
}
void SyncPRG()
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
index c8405c4e67..2b0aaf7298 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/TENGEN-800032.cs
@@ -11,10 +11,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr_bank_mask_1k;
//regenerable state
- IntBuffer prg_banks_8k = new IntBuffer(4);
- IntBuffer chr_banks_1k = new IntBuffer(8);
+ int[] prg_banks_8k = new int[4];
+ int[] chr_banks_1k = new int[8];
//state
- IntBuffer regs = new IntBuffer(16);
+ int[] regs = new int[16];
int address;
bool chr_1k, chr_mode, prg_mode;
//irq
@@ -28,19 +28,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int irq_countdown_2 = 0;
bool clock_scanline_irq;
-
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_8k.Dispose();
- chr_banks_1k.Dispose();
- regs.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(address), ref address);
ser.Sync(nameof(chr_1k), ref chr_1k);
ser.Sync(nameof(chr_mode), ref chr_mode);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
index 98b353770d..e82bb3042b 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_TC0190FMC.cs
@@ -68,24 +68,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
- ByteBuffer chr_regs_1k = new ByteBuffer(8);
+ byte[] prg_regs_8k = new byte[4];
+ byte[] chr_regs_1k = new byte[8];
int mirror_mode;
MMC3Variant mmc3;
- public override void Dispose()
- {
- prg_regs_8k.Dispose();
- chr_regs_1k.Dispose();
- mmc3?.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
mmc3?.SyncState(ser);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
- ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
+ ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k, false);
ser.Sync(nameof(mirror_mode), ref mirror_mode);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs
index 9ee071a0e3..bc34c2b05e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_005.cs
@@ -45,25 +45,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask, chr_bank_mask;
bool tlsrewire = false;
// state
- ByteBuffer chr_regs_1k = new ByteBuffer(8);
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
+ byte[] chr_regs_1k = new byte[8];
+ byte[] prg_regs_8k = new byte[4];
bool wramenable = false;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
+ ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k, false);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
ser.Sync(nameof(wramenable), ref wramenable);
}
- public override void Dispose()
- {
- base.Dispose();
- chr_regs_1k.Dispose();
- prg_regs_8k.Dispose();
- }
-
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_017.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_017.cs
index 74ea6c91bf..4fa16be52a 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_017.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/Taito_X1_017.cs
@@ -61,23 +61,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// config
int prg_bank_mask, chr_bank_mask;
// state
- ByteBuffer prg_regs_8k = new ByteBuffer(4);
- ByteBuffer chr_regs_1k = new ByteBuffer(8);
+ byte[] prg_regs_8k = new byte[4];
+ byte[] chr_regs_1k = new byte[8];
bool ChrMode;
bool[] wramenable = new bool[3];
- public override void Dispose()
- {
- base.Dispose();
- chr_regs_1k.Dispose();
- prg_regs_8k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
- ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
+ ser.Sync(nameof(chr_regs_1k), ref chr_regs_1k, false);
ser.Sync(nameof(ChrMode), ref ChrMode);
for (int i = 0; i < wramenable.Length; i++)
ser.Sync("wramenable_" + i, ref wramenable[i]);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs
index 185c7d2909..83f6c6c5a4 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-12-IN-1.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_BMC_12_IN_1 : NES.NESBoardBase
{
- private ByteBuffer regs = new ByteBuffer(2);
+ private byte[] regs = new byte[2];
private byte ctrl;
public override bool Configure(NES.EDetectionOrigin origin)
@@ -23,17 +23,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
ser.Sync(nameof(ctrl), ref ctrl);
base.SyncState(ser);
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void WritePRG(int addr, byte value)
{
addr += 0x8000;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs
index b7f29f10bd..d59661d68e 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-64in1-NR.cs
@@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from FCEUX src
public class UNIF_BMC_64in1_NR : NES.NESBoardBase
{
- private ByteBuffer regs = new ByteBuffer(4);
+ private byte[] regs = new byte[4];
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -25,12 +25,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- regs.Dispose();
- base.Dispose();
- }
-
public override void WriteEXP(int addr, byte value)
{
if (addr >= 0x1000 && addr <= 0x1003)
@@ -89,7 +83,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(regs), ref regs);
+ ser.Sync(nameof(regs), ref regs, false);
}
}
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs
index 104a233727..f64744bba2 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-BS-5.cs
@@ -7,8 +7,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
[MapperProp]
public int BMC_BS_5_DipSwitch;
- private IntBuffer reg_prg = new IntBuffer(4);
- private IntBuffer reg_chr = new IntBuffer(4);
+ private int[] reg_prg = new int[4];
+ private int[] reg_chr = new int[4];
private int _prgMask8k;
private int _chrMask2k;
@@ -53,8 +53,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(reg_prg), ref reg_prg);
- ser.Sync(nameof(reg_chr), ref reg_chr);
+ ser.Sync(nameof(reg_prg), ref reg_prg, false);
+ ser.Sync(nameof(reg_chr), ref reg_chr, false);
ser.Sync(nameof(BMC_BS_5_DipSwitch), ref BMC_BS_5_DipSwitch);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs
index cb8a3c6c0e..17fc25fa48 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-Ghostbusters63in1.cs
@@ -7,8 +7,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Adapted from FCEUX src
public sealed class UNIF_BMC_Ghostbusters63in1 : NES.NESBoardBase
{
- private ByteBuffer reg = new ByteBuffer(2);
- private readonly int[] banks = new [] { 0, 0, 524288, 1048576};
+ private byte[] reg = new byte[2];
+ private readonly int[] banks = { 0, 0, 524288, 1048576 };
private int bank;
[MapperProp]
@@ -31,15 +31,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- reg.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(reg), ref reg);
+ ser.Sync(nameof(reg), ref reg, false);
ser.Sync(nameof(bank), ref bank);
ser.Sync(nameof(bank), ref Ghostbusters63in1_63set);
ser.Sync(nameof(bank), ref Ghostbusters63in1_chip_22_select);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
index bc248018a0..ebaafec505 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMCFK23C.cs
@@ -4,9 +4,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_BMC_FK23C : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(8);
- private IntBuffer chr_regs_1k = new IntBuffer(8);
- public IntBuffer prg_regs_8k = new IntBuffer(4);
+ private byte[] exRegs = new byte[8];
+ private int[] chr_regs_1k = new int[8];
+ public int[] prg_regs_8k = new int[4];
[MapperProp]
public bool dip_switch;
@@ -71,19 +71,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- chr_regs_1k.Dispose();
- prg_regs_8k.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
- ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
+ ser.Sync(nameof(prg_regs_8k), ref prg_regs_8k, false);
ser.Sync(nameof(prg_mask), ref prg_mask_8k);
ser.Sync(nameof(chr_mask), ref chr_mask_1k);
ser.Sync(nameof(dip_switch), ref dip_switch);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
index 789319a818..883b9b8da9 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC_Super24in1SC03.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_BMC_Super24in1SC03 : MMC3Board_Base
{
- private ByteBuffer exRegs = new ByteBuffer(3);
+ private byte[] exRegs = new byte[3];
private readonly int[] masko8 = { 63, 31, 15, 1, 3, 0, 0, 0 };
public override bool Configure(NES.EDetectionOrigin origin)
{
@@ -25,16 +25,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- exRegs.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(exRegs), ref exRegs);
+ ser.Sync(nameof(exRegs), ref exRegs, false);
}
public override void WriteEXP(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs
index 000b579a96..09544bb559 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AX5705.cs
@@ -6,8 +6,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// Super Mario Bros. Pocker Mali (Unl)
public class UNIF_UNL_AX5705 : NES.NESBoardBase
{
- private IntBuffer prg_reg = new IntBuffer(2);
- private IntBuffer chr_reg = new IntBuffer(8);
+ private int[] prg_reg = new int[2];
+ private int[] chr_reg = new int[8];
private int _prgMask8k;
private int _chrMask1k;
@@ -33,8 +33,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_reg), ref prg_reg);
- ser.Sync(nameof(chr_reg), ref chr_reg);
+ ser.Sync(nameof(prg_reg), ref prg_reg, false);
+ ser.Sync(nameof(chr_reg), ref chr_reg, false);
}
public override void WritePRG(int addr, byte value)
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs
index 3cb2495140..b74016a515 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-LH10.cs
@@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_UNL_LH10 : NES.NESBoardBase
{
- private ByteBuffer reg = new ByteBuffer(8);
+ private byte[] reg = new byte[8];
private int cmd;
private int prg_bank_mask_8;
@@ -28,15 +28,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- reg.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
- ser.Sync(nameof(reg), ref reg);
+ ser.Sync(nameof(reg), ref reg, false);
ser.Sync(nameof(cmd), ref cmd);
base.SyncState(ser);
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs
index 12765f33e5..df9d2ed700 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-TF1201.cs
@@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private byte prg0;
private byte prg1;
private byte swap;
- private ByteBuffer chr = new ByteBuffer(8);
+ private byte[] chr = new byte[8];
private bool IRQa;
private int IRQCount;
@@ -31,19 +31,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return true;
}
- public override void Dispose()
- {
- chr.Dispose();
- base.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync(nameof(prg0), ref prg0);
ser.Sync(nameof(prg1), ref prg1);
ser.Sync(nameof(swap), ref swap);
- ser.Sync(nameof(chr), ref chr);
+ ser.Sync(nameof(chr), ref chr, false);
ser.Sync(nameof(IRQa), ref IRQa);
ser.Sync(nameof(IRQCount), ref IRQCount);
ser.Sync(nameof(IRQpre), ref IRQpre);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
index 553abc483a..373499aa97 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC1.cs
@@ -11,26 +11,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int chr_bank_mask_4k;
//state
- IntBuffer prg_banks_8k = new IntBuffer(4);
- IntBuffer chr_banks_4k = new IntBuffer(2);
+ int[] prg_banks_8k = new int[4];
+ int[] chr_banks_4k = new int[2];
int[] chr_regs_4k = new int[2];
//the VS actually does have 2 KB of nametable address space
//let's make the extra space here, instead of in the main NES to avoid confusion
byte[] CIRAM_VS = new byte[0x800];
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_8k.Dispose();
- chr_banks_4k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_4k), ref chr_banks_4k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_4k), ref chr_banks_4k, false);
if (NES.IsVS)
{
ser.Sync("VS_CIRAM", ref CIRAM_VS, false);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs
index a0a78a49cd..293a682bc4 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC2_4.cs
@@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public int[] chr_bank_reg_1k = new int[16];
bool prg_mode;
public byte[] prg_banks_8k = new byte[4];
- public IntBuffer chr_banks_1k = new IntBuffer(8);
+ public int[] chr_banks_1k = new int[8];
bool irq_mode;
bool irq_enabled, irq_pending, irq_autoen;
byte irq_reload;
@@ -86,12 +86,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// needed for 2-in-1 - Yuu Yuu + Dragonball Z [p1][!]
bool _isBMC = false;
- public override void Dispose()
- {
- base.Dispose();
- chr_banks_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs
index c93c27bef2..41ff432d83 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC3.cs
@@ -11,23 +11,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg_bank_mask_16k;
//state
- IntBuffer prg_banks_16k = new IntBuffer(2);
+ int[] prg_banks_16k = new int[2];
bool irq_mode;
bool irq_enabled, irq_pending, irq_autoen;
ushort irq_reload;
ushort irq_counter;
int irq_cycles;
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_16k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
- ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k);
+ ser.Sync(nameof(prg_banks_16k), ref prg_banks_16k, false);
ser.Sync(nameof(irq_mode), ref irq_mode);
ser.Sync(nameof(irq_enabled), ref irq_enabled);
ser.Sync(nameof(irq_pending), ref irq_pending);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
index 03de6c809b..2ace185160 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC6.cs
@@ -115,8 +115,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
int prg_bank_16k, prg_bank_8k;
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
- ByteBuffer chr_banks_1k = new ByteBuffer(8);
+ byte[] prg_banks_8k = new byte[4];
+ byte[] chr_banks_1k = new byte[8];
bool irq_mode;
bool irq_enabled, irq_pending, irq_autoen;
byte irq_reload;
@@ -127,20 +127,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bool NTROM;
int PPUBankingMode;
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_8k.Dispose();
- chr_banks_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
VRC6Sound.SyncState(ser);
ser.Sync(nameof(prg_bank_16k), ref prg_bank_16k);
ser.Sync(nameof(prg_bank_8k), ref prg_bank_8k);
- ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k);
+ ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k, false);
ser.Sync(nameof(irq_mode), ref irq_mode);
ser.Sync(nameof(irq_enabled), ref irq_enabled);
ser.Sync(nameof(irq_pending), ref irq_pending);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs
index 09df90739c..89bd575d0f 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/VRC7.cs
@@ -16,27 +16,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//state
YM2413 fm; //= new Sound.YM2413(Sound.YM2413.ChipType.VRC7);
- ByteBuffer prg_banks_8k = new ByteBuffer(4);
- ByteBuffer chr_banks_1k = new ByteBuffer(8);
+ byte[] prg_banks_8k = new byte[4];
+ byte[] chr_banks_1k = new byte[8];
bool irq_mode;
bool irq_enabled, irq_pending, irq_autoen;
byte irq_reload;
byte irq_counter;
int irq_prescaler;
- public override void Dispose()
- {
- base.Dispose();
- prg_banks_8k.Dispose();
- chr_banks_1k.Dispose();
- }
-
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
fm?.SyncState(ser);
- ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k);
- ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k);
+ ser.Sync(nameof(prg_banks_8k), ref prg_banks_8k, false);
+ ser.Sync(nameof(chr_banks_1k), ref chr_banks_1k, false);
ser.Sync(nameof(irq_mode), ref irq_mode);
ser.Sync(nameof(irq_enabled), ref irq_enabled);
ser.Sync(nameof(irq_pending), ref irq_pending);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs
index 2d37536bff..be030f11d5 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs
@@ -6,14 +6,13 @@ using System.Xml;
using BizHawk.Common;
using BizHawk.Emulation.Common;
-//TODO - consider bytebuffer for mirroring
//TODO - could stringpool the bootgod DB for a pedantic optimization
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
partial class NES
{
- public interface INESBoard : IDisposable
+ public interface INESBoard
{
//base class pre-configuration
void Create(NES nes);
@@ -118,8 +117,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
set => irq_signal = value;
}
- public virtual void Dispose() { }
-
int[] mirroring = new int[4];
protected void SetMirroring(int a, int b, int c, int d)
{
@@ -129,15 +126,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
mirroring[3] = d;
}
- protected void ApplyMemoryMapMask(int mask, ByteBuffer map)
+ protected void ApplyMemoryMapMask(int mask, byte[] map)
{
byte bmask = (byte)mask;
- for (int i = 0; i < map.Len; i++)
+ for (int i = 0; i < map.Length; i++)
map[i] &= bmask;
}
//make sure you have bank-masked the map
- protected int ApplyMemoryMap(int blockSizeBits, ByteBuffer map, int addr)
+ protected int ApplyMemoryMap(int blockSizeBits, byte[] map, int addr)
{
int bank = addr >> blockSizeBits;
int ofs = addr & ((1 << blockSizeBits) - 1);
@@ -414,7 +411,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
Buffer.BlockCopy(Board.SaveRam, 0, newboard.SaveRam, 0, Board.SaveRam.Length);
}
- Board.Dispose();
+
Board = newboard;
ppu.HasClockPPU = Board.GetType().GetMethod(nameof(INESBoard.ClockPPU)).DeclaringType != typeof(NESBoardBase);
}
@@ -492,7 +489,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
lock(INESBoardImplementors)
foreach (var type in INESBoardImplementors)
{
- using NESBoardBase board = (NESBoardBase)Activator.CreateInstance(type);
+ NESBoardBase board = (NESBoardBase)Activator.CreateInstance(type);
//unif demands that the boards set themselves up with expected legal values based on the board size
//except, i guess, for the rom/chr sizes. go figure.
//so, disable the asserts here
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
index 6d9fa22f8f..7e4d9275a7 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs
@@ -3,7 +3,6 @@
using System;
using System.Linq;
-using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.M6502;
@@ -434,9 +433,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//at least it should be, but something is off with that (start up time?) so it is 3,3,3,4,3 for now
//NTSC:
//sequence of ppu clocks per cpu clock: 3
- public ByteBuffer cpu_sequence;
- static ByteBuffer cpu_sequence_NTSC = new ByteBuffer(new byte[] { 3, 3, 3, 3, 3 });
- static ByteBuffer cpu_sequence_PAL = new ByteBuffer(new byte[] { 3, 3, 3, 4, 3 });
+ public byte[] cpu_sequence;
+ static byte[] cpu_sequence_NTSC = { 3, 3, 3, 3, 3 };
+ static byte[] cpu_sequence_PAL = { 3, 3, 3, 4, 3 };
public int cpu_deadcounter;
public int oam_dma_index;