diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs index bbdc0ebaef..51d3d0be4f 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs @@ -319,7 +319,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 ser.EndSection(); } - ser.BeginSection("Cassette"); SaveState.SyncObject(ser, Cassette); ser.EndSection(); + ser.BeginSection("Cassette"); + Cassette.SyncState(ser); + ser.EndSection(); ser.BeginSection("Serial"); SaveState.SyncObject(ser, Serial); ser.EndSection(); ser.BeginSection("TapeDrive"); SaveState.SyncObject(ser, TapeDrive); ser.EndSection(); // TODO: only if tape diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePort.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePort.cs index cad21ecf08..06f3cd257a 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePort.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePort.cs @@ -12,6 +12,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette [SaveState.SaveWithName("Device")] private CassettePortDevice _device; + [SaveState.SaveWithName("Connected")] private bool _connected; @@ -43,7 +44,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette public void SyncState(Serializer ser) { - SaveState.SyncObject(ser, this); + ser.Sync("Connected", ref _connected); + if (_device != null) + { + _device.SyncState(ser); + } } public void Connect(CassettePortDevice device) diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePortDevice.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePortDevice.cs index 82ad869c45..a2d64f8d7e 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePortDevice.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/CassettePortDevice.cs @@ -28,9 +28,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette return true; } - public virtual void SyncState(Serializer ser) - { - SaveState.SyncObject(ser, this); - } + public abstract void SyncState(Serializer ser); } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/TapeDrive.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/TapeDrive.cs index b5b8dbeb93..3a8b057e1d 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/TapeDrive.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Cassette/TapeDrive.cs @@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette public override void SyncState(Serializer ser) { - SaveState.SyncObject(ser, this); + _tape.SyncState(ser); } public void Insert(Tape tape) diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Tape.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Tape.cs index 91872074b9..186ed2c8d1 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Tape.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/Media/Tape.cs @@ -13,8 +13,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media [SaveState.SaveWithName("Position")] private int _pos; + [SaveState.SaveWithName("Cycle")] private int _cycle; + [SaveState.SaveWithName("Data")] private bool _data; @@ -97,7 +99,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media public void SyncState(Serializer ser) { - SaveState.SyncObject(ser, this); + ser.Sync("Position", ref _pos); + ser.Sync("Cycle", ref _cycle); + ser.Sync("Data", ref _data); } } }