diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IStatable.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IStatable.cs index 96c8e9ab8f..9dbc705b47 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IStatable.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IStatable.cs @@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 ser.Sync("IsLagFrame", ref _isLagFrame); ser.Sync("LagCount", ref _lagCount); ser.BeginSection("Board"); - SaveState.SyncObject(ser, _board); + _board.SyncState(ser); ser.EndSection(); ser.EndSection(); } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs index 4a71ee6aa7..9553bec6c2 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs @@ -282,7 +282,38 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 public void SyncState(Serializer ser) { - SaveState.SyncObject(ser, this); + ser.BeginSection("Cia0"); + Cia0.SyncState(ser); + ser.EndSection(); + + ser.BeginSection("Cia1"); SaveState.SyncObject(ser, Cia1); ser.EndSection(); + ser.BeginSection("ColorRam"); SaveState.SyncObject(ser, ColorRam); ser.EndSection(); + ser.BeginSection("Cpu"); SaveState.SyncObject(ser, Cpu); ser.EndSection(); + ser.BeginSection("KernalRom"); SaveState.SyncObject(ser, KernalRom); ser.EndSection(); + ser.BeginSection("Pla"); SaveState.SyncObject(ser, Pla); ser.EndSection(); + ser.BeginSection("Ram"); SaveState.SyncObject(ser, Ram); ser.EndSection(); + ser.BeginSection("Sid"); SaveState.SyncObject(ser, Sid); ser.EndSection(); + ser.BeginSection("Vic"); SaveState.SyncObject(ser, Vic); ser.EndSection(); + ser.BeginSection("CartPort"); SaveState.SyncObject(ser, CartPort); ser.EndSection(); // TODO: only if cart + ser.BeginSection("Cassette"); SaveState.SyncObject(ser, Cassette); ser.EndSection(); + + ser.BeginSection("Serial"); SaveState.SyncObject(ser, Serial); ser.EndSection(); + ser.BeginSection("TapeDrive"); SaveState.SyncObject(ser, TapeDrive); ser.EndSection(); // TODO: only if tape + ser.BeginSection("User"); SaveState.SyncObject(ser, User); ser.EndSection(); + ser.BeginSection("DiskDrive"); SaveState.SyncObject(ser, DiskDrive); ser.EndSection(); // TODO: only if disk + + ser.Sync("Bus", ref Bus); + ser.Sync("InputRead", ref InputRead); + ser.Sync("Irq", ref Irq); + ser.Sync("Nmi", ref Nmi); + + ser.Sync("_lastReadVicAddress", ref _lastReadVicAddress); + ser.Sync("_lastReadVicData", ref _lastReadVicData); + ser.Sync("_vicBank", ref _vicBank); + + ser.Sync("_joystickPressed", ref _joystickPressed, useNull: false); + ser.Sync("_keyboardPressed", ref _keyboardPressed, useNull: false); + ser.Sync("_restorePressed", ref _restorePressed); } } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs index 6d27551858..d5715e6cd9 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs @@ -2,8 +2,8 @@ { public sealed partial class Motherboard { - private readonly bool[] _joystickPressed = new bool[10]; - private readonly bool[] _keyboardPressed = new bool[64]; + private bool[] _joystickPressed = new bool[10]; + private bool[] _keyboardPressed = new bool[64]; private static readonly string[][] JoystickMatrix = { new[] {"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button"}, diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs index 52b471b75a..6d241d8a57 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs @@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 { get { - return SaveState.InspectProperties(this); + return SaveState.InspectProperties(_board.Cia0); if (_board.CartPort.IsConnected) { return _board.CartPort.CartridgeType; diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip23128.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip23128.cs index 92f85c7544..a5107f90e5 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip23128.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip23128.cs @@ -36,10 +36,5 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS { return _rom[addr & 0x3FFF]; } - - public void SyncState(Serializer ser) - { - SaveState.SyncObject(ser, this); - } } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Cia.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Cia.cs index ca3ce43892..b443de15ba 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Cia.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Cia.cs @@ -502,7 +502,56 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS public void SyncState(Serializer ser) { - SaveState.SyncObject(ser, this); + ser.Sync("DelayedInterrupts", ref DelayedInterrupts); + ser.Sync("_pra", ref _pra); + ser.Sync("_prb", ref _prb); + ser.Sync("_ddra", ref _ddra); + ser.Sync("_ddrb", ref _ddrb); + ser.Sync("_ta", ref _ta); + ser.Sync("_tb", ref _tb); + ser.Sync("_latcha", ref _latcha); + ser.Sync("_latchb", ref _latchb); + ser.Sync("_tod10Ths", ref _tod10Ths); + ser.Sync("_todSec", ref _todSec); + ser.Sync("_todMin", ref _todMin); + ser.Sync("_todHr", ref _todHr); + ser.Sync("_latch10Ths", ref _latch10Ths); + ser.Sync("_latchSec", ref _latchSec); + ser.Sync("_latchMin", ref _latchMin); + ser.Sync("_latchHr", ref _latchHr); + ser.Sync("_alm10Ths", ref _alm10Ths); + ser.Sync("_almSec", ref _almSec); + ser.Sync("_almMin", ref _almMin); + ser.Sync("_almHr", ref _almHr); + ser.Sync("_sdr", ref _sdr); + ser.Sync("_icr", ref _icr); + ser.Sync("_cra", ref _cra); + ser.Sync("_crb", ref _crb); + ser.Sync("_intMask", ref _intMask); + ser.Sync("_todLatch", ref _todLatch); + ser.Sync("_taCntPhi2", ref _taCntPhi2); + ser.Sync("_taCntCnt", ref _taCntCnt); + ser.Sync("_tbCntPhi2", ref _tbCntPhi2); + ser.Sync("_tbCntTa", ref _tbCntTa); + ser.Sync("_tbCntCnt", ref _tbCntCnt); + ser.Sync("_taIrqNextCycle", ref _taIrqNextCycle); + ser.Sync("_taPrb6NegativeNextCycle", ref _taPrb6NegativeNextCycle); + ser.Sync("_tbIrqNextCycle", ref _tbIrqNextCycle); + ser.Sync("_tbPrb7NegativeNextCycle", ref _tbPrb7NegativeNextCycle); + ser.Sync("_hasNewCra", ref _hasNewCra); + ser.Sync("_hasNewCrb", ref _hasNewCrb); + ser.SyncEnum("_taState", ref _taState); + ser.SyncEnum("_tbState", ref _tbState); + ser.Sync("_newCra", ref _newCra); + ser.Sync("_newCrb", ref _newCrb); + ser.Sync("_flagLatch", ref _flagLatch); + + ser.BeginSection("Port"); + _port.SyncState(ser); + ser.EndSection(); + + ser.Sync("_todCounter", ref _todCounter); + //SaveState.SyncObject(ser, this); } } }