C64 - remove the SaveState.SaveWithName attribute

This commit is contained in:
adelikat 2017-05-13 12:46:19 -05:00
parent c6c0f0e19a
commit 8ae05f2d01
22 changed files with 10 additions and 137 deletions

View File

@ -26,7 +26,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
[SaveState.DoNotSave]
public string SystemId { get { return "C64"; } }
[SaveState.SaveWithName("DeterministicEmulation")]
public bool DeterministicEmulation => true;
public void ResetCounters()

View File

@ -106,12 +106,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
}
};
[SaveState.SaveWithName("Board")]
private Motherboard _board;
private int _frameCycles;
[SaveState.SaveWithName("Frame")]
private int _frame;
[SaveState.DoNotSave]

View File

@ -128,19 +128,14 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
reader.ReadByte();
}
[SaveState.SaveWithName("ExRom")]
protected bool pinExRom;
[SaveState.SaveWithName("Game")]
protected bool pinGame;
[SaveState.SaveWithName("IRQ")]
protected bool pinIRQ;
[SaveState.SaveWithName("NMI")]
protected bool pinNMI;
[SaveState.SaveWithName("Reset")]
protected bool pinReset;
[SaveState.DoNotSave]

View File

@ -9,13 +9,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[] _romA;
[SaveState.SaveWithName("RomMaskA")]
private int _romAMask;
[SaveState.DoNotSave]
private readonly int[] _romB;
[SaveState.SaveWithName("RomMaskB")]
private int _romBMask;
// standard cartridge mapper (Commodore)

View File

@ -7,11 +7,14 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
{
internal sealed class Mapper0001 : CartridgeDevice
{
[SaveState.SaveWithName("RAM")] private int[] _ram = new int[0x2000];
[SaveState.SaveWithName("RAMEnabled")] private bool _ramEnabled;
[SaveState.DoNotSave] private readonly int[] _rom = new int[0x8000];
[SaveState.SaveWithName("ROMOffset")] private int _romOffset;
[SaveState.SaveWithName("CartEnabled")] private bool _cartEnabled;
private int[] _ram = new int[0x2000];
private bool _ramEnabled;
[SaveState.DoNotSave]
private readonly int[] _rom = new int[0x8000];
private int _romOffset;
private bool _cartEnabled;
public Mapper0001(IList<int> newAddresses, IList<int> newBanks, IList<int[]> newData)
{

View File

@ -13,10 +13,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[][] _banksB = new int[0][]; // A000
[SaveState.SaveWithName("BankMask")]
private int _bankMask;
[SaveState.SaveWithName("BankNumber")]
private int _bankNumber;
[SaveState.DoNotSave]

View File

@ -17,7 +17,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private const int RESET_CAPACITOR_CYCLES = 512;
[SaveState.SaveWithName("CapacitorCycles")]
private int _capacitorCycles;
[SaveState.DoNotSave]

View File

@ -16,13 +16,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[][] _banks; // 8000
[SaveState.SaveWithName("BankMask")]
private int _bankMask;
[SaveState.SaveWithName("BankNumber")]
private int _bankNumber;
[SaveState.SaveWithName("CurrentBank")]
private int[] _currentBank;
public Mapper000F(IList<int> newAddresses, IList<int> newBanks, IList<int[]> newData)

View File

@ -13,10 +13,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[][] _bankHigh;
[SaveState.SaveWithName("BankHighSelected")]
private int[] _bankHighSelected;
[SaveState.SaveWithName("BankIndex")]
private int _bankIndex;
// Zaxxon and Super Zaxxon cartridges

View File

@ -17,16 +17,13 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[][] _banks; // 8000
[SaveState.SaveWithName("BankMask")]
private int _bankMask;
[SaveState.SaveWithName("BankNumber")]
private int _bankNumber;
[SaveState.DoNotSave]
private int[] _currentBank;
[SaveState.SaveWithName("ROMEnable")]
private bool _romEnable;
public Mapper0013(IList<int> newAddresses, IList<int> newBanks, IList<int[]> newData)

View File

@ -24,7 +24,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
// We emulate having the AM29F040 chip.
internal sealed class Mapper0020 : CartridgeDevice
{
[SaveState.SaveWithName("BankOffset")]
private int _bankOffset = 63 << 13;
[SaveState.DoNotSave]
@ -39,25 +38,17 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[] _originalMediaB; // A000
[SaveState.SaveWithName("BoardLed")]
private bool _boardLed;
[SaveState.SaveWithName("Jumper")]
private bool _jumper = false;
[SaveState.SaveWithName("StateBits")]
private int _stateBits;
[SaveState.SaveWithName("RAM")]
private int[] _ram = new int[256];
[SaveState.SaveWithName("CommandLatch55")]
private bool _commandLatch55;
[SaveState.SaveWithName("CommandLatchAA")]
private bool _commandLatchAa;
[SaveState.SaveWithName("InternalROMState")]
private int _internalRomState;
public Mapper0020(IList<int> newAddresses, IList<int> newBanks, IList<int[]> newData)

View File

@ -15,10 +15,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge
[SaveState.DoNotSave]
private readonly int[] _rom;
[SaveState.SaveWithName("RomOffset")]
private int _romOffset;
[SaveState.SaveWithName("RomEnabled")]
private bool _romEnabled;
public Mapper002B(IList<int> newAddresses, IList<int> newBanks, IList<int[]> newData)

View File

@ -10,10 +10,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette
[SaveState.DoNotSave]
public Func<bool> ReadMotor = () => true;
[SaveState.SaveWithName("Device")]
private CassettePortDevice _device;
[SaveState.SaveWithName("Connected")]
private bool _connected;
public void HardReset()

View File

@ -5,7 +5,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette
{
public class TapeDrive : CassettePortDevice
{
[SaveState.SaveWithName("Tape")]
private Tape _tape;
public override void ExecutePhase2()

View File

@ -34,100 +34,56 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
[SaveState.DoNotSave] private const int ACR_T1_CONTROL_INTERRUPT_ON_LOAD_AND_ONESHOT_PB7 = 0x80;
[SaveState.DoNotSave] private const int ACR_T1_CONTROL_CONTINUOUS_INTERRUPTS_AND_OUTPUT_ON_PB7 = 0xC0;
[SaveState.SaveWithName("PortOutputA")]
private int _pra;
[SaveState.SaveWithName("PortDirectionA")]
private int _ddra;
[SaveState.SaveWithName("PortOutputB")]
private int _prb;
[SaveState.SaveWithName("PortDirectionB")]
private int _ddrb;
[SaveState.SaveWithName("Timer1Counter")]
private int _t1C;
[SaveState.SaveWithName("Timer1Latch")]
private int _t1L;
[SaveState.SaveWithName("Timer2Counter")]
private int _t2C;
[SaveState.SaveWithName("Timer2Latch")]
private int _t2L;
[SaveState.SaveWithName("ShiftRegister")]
private int _sr;
[SaveState.SaveWithName("AuxiliaryControlRegister")]
private int _acr;
[SaveState.SaveWithName("PeripheralControlRegister")]
private int _pcr;
[SaveState.SaveWithName("InterruptFlagRegister")]
private int _ifr;
[SaveState.SaveWithName("InterruptEnableRegister")]
private int _ier;
[SaveState.SaveWithName("Port")]
private readonly IPort _port;
[SaveState.SaveWithName("PortLatchA")]
private int _paLatch;
[SaveState.SaveWithName("PortLatchB")]
private int _pbLatch;
[SaveState.SaveWithName("CA1InterruptControl")]
private int _pcrCa1IntControl;
[SaveState.SaveWithName("CA2Control")]
private int _pcrCa2Control;
[SaveState.SaveWithName("CB1InterruptControl")]
private int _pcrCb1IntControl;
[SaveState.SaveWithName("CB2Control")]
private int _pcrCb2Control;
[SaveState.SaveWithName("PortLatchEnableA")]
private bool _acrPaLatchEnable;
[SaveState.SaveWithName("PortLatchEnableB")]
private bool _acrPbLatchEnable;
[SaveState.SaveWithName("ShiftRegisterControl")]
private int _acrSrControl;
[SaveState.SaveWithName("Timer1Control")]
private int _acrT1Control;
[SaveState.SaveWithName("Timer2Control")]
private int _acrT2Control;
[SaveState.SaveWithName("PreviousCA1")]
private bool _ca1L;
[SaveState.SaveWithName("PreviousCA2")]
private bool _ca2L;
[SaveState.SaveWithName("PreviousCB1")]
private bool _cb1L;
[SaveState.SaveWithName("PreviousCB2")]
private bool _cb2L;
[SaveState.SaveWithName("PreviousPB6")]
private bool _pb6L;
[SaveState.SaveWithName("ResetCa2NextClock")]
private bool _resetCa2NextClock;
[SaveState.SaveWithName("ResetCb2NextClock")]
private bool _resetCb2NextClock;
[SaveState.SaveWithName("HandshakeCa2NextClock")]
private bool _handshakeCa2NextClock;
[SaveState.SaveWithName("HandshakeCb2NextClock")]
private bool _handshakeCb2NextClock;
[SaveState.SaveWithName("CA1")]
public bool Ca1;
[SaveState.SaveWithName("CA2")]
public bool Ca2;
[SaveState.SaveWithName("CB1")]
public bool Cb1;
[SaveState.SaveWithName("CB2")]
public bool Cb2;
[SaveState.SaveWithName("PB6")]
private bool _pb6;
[SaveState.SaveWithName("InterruptNextClock")]
private int _interruptNextClock;
[SaveState.SaveWithName("T1Loaded")]
private bool _t1CLoaded;
[SaveState.SaveWithName("T2Loaded")]
private bool _t2CLoaded;
[SaveState.SaveWithName("T1Delayed")]
private int _t1Delayed;
[SaveState.SaveWithName("T2Delayed")]
private int _t2Delayed;
public Via()

View File

@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media
[SaveState.DoNotSave] private int[][] _tracks;
[SaveState.DoNotSave] private readonly int[] _originalMedia;
[SaveState.DoNotSave] public bool Valid;
[SaveState.SaveWithName("DiskIsWriteProtected")] public bool WriteProtected;
public bool WriteProtected;
/// <summary>
/// Create a blank, unformatted disk.

View File

@ -11,13 +11,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media
[SaveState.DoNotSave] private readonly int _start;
[SaveState.DoNotSave] private readonly int _end;
[SaveState.SaveWithName("Position")]
private int _pos;
[SaveState.SaveWithName("Cycle")]
private int _cycle;
[SaveState.SaveWithName("Data")]
private bool _data;
public Tape(byte version, byte[] tapeData, int start, int end)

View File

@ -11,16 +11,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
}
public class SaveWithName : Attribute
{
public string Name { get; set; }
public SaveWithName(string name)
{
Name = name;
}
}
private static int[] GetDelta(IList<int> source, IList<int> data)
{
var length = Math.Min(source.Count, data.Count);

View File

@ -10,31 +10,18 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
{
[SaveState.DoNotSave]
private const long LEHMER_RNG_PRIME = 48271;
[SaveState.SaveWithName("DiskDensityCounter")]
private int _diskDensityCounter; // density .. 16
[SaveState.SaveWithName("DiskSupplementaryCounter")]
private int _diskSupplementaryCounter; // 0 .. 16
[SaveState.SaveWithName("DiskFluxReversalDetected")]
private bool _diskFluxReversalDetected;
[SaveState.SaveWithName("DiskBitsRemainingInDataEntry")]
private int _diskBitsLeft;
[SaveState.SaveWithName("DiskDataEntryIndex")]
private int _diskByteOffset;
[SaveState.SaveWithName("DiskDataEntry")]
private int _diskBits;
[SaveState.SaveWithName("DiskCurrentCycle")]
private int _diskCycle;
[SaveState.SaveWithName("DiskDensityConfig")]
private int _diskDensity;
[SaveState.SaveWithName("PreviousCA1")]
private bool _previousCa1;
[SaveState.SaveWithName("CountsBeforeRandomTransition")]
private int _countsBeforeRandomTransition;
[SaveState.SaveWithName("CurrentRNG")]
private int _rngCurrent;
[SaveState.SaveWithName("Clocks")]
private int _clocks;
[SaveState.SaveWithName("CpuClocks")]
private int _cpuClocks;
// Lehmer RNG

View File

@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
{
public sealed partial class Drive1541
{
[SaveState.SaveWithName("OverflowFlagDelayShiftRegister")]
private int _overflowFlagDelaySr;
private byte CpuPeek(ushort addr)

View File

@ -14,39 +14,22 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
{
public sealed partial class Drive1541 : SerialPortDevice
{
[SaveState.SaveWithName("Disk")]
private Disk _disk;
[SaveState.SaveWithName("BitHistory")]
private int _bitHistory;
[SaveState.SaveWithName("BitsRemainingInLatchedByte")]
private int _bitsRemainingInLatchedByte;
[SaveState.SaveWithName("Sync")]
private bool _sync;
[SaveState.SaveWithName("ByteReady")]
private bool _byteReady;
[SaveState.SaveWithName("DriveCpuClockNumerator")]
private int _driveCpuClockNum;
[SaveState.SaveWithName("TrackNumber")]
private int _trackNumber;
[SaveState.SaveWithName("MotorEnabled")]
private bool _motorEnabled;
[SaveState.SaveWithName("LedEnabled")]
private bool _ledEnabled;
[SaveState.SaveWithName("MotorStep")]
private int _motorStep;
[SaveState.SaveWithName("CPU")]
private readonly MOS6502X _cpu;
[SaveState.SaveWithName("RAM")]
private int[] _ram;
[SaveState.SaveWithName("VIA0")]
public readonly Via Via0;
[SaveState.SaveWithName("VIA1")]
public readonly Via Via1;
[SaveState.SaveWithName("SystemCpuClockNumerator")]
private int _cpuClockNum;
[SaveState.SaveWithName("SystemDriveCpuRatioDifference")]
private int _ratioDifference;
[SaveState.SaveWithName("DriveLightOffTime")]
private int _driveLightOffTime;
[SaveState.DoNotSave]
private int[] _trackImageData = new int[1];

View File

@ -14,10 +14,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
[SaveState.DoNotSave]
public Func<bool> ReadMasterData = () => true;
[SaveState.SaveWithName("Device")]
private SerialPortDevice _device;
[SaveState.SaveWithName("Connected")]
private bool _connected;
public void HardReset()