From 99d2db0cdc06a6bcf3ed9e7700c229b41e29b350 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 13 May 2017 11:31:52 -0500 Subject: [PATCH] C64 - refactor UserPort and nested class to not use SyncObject --- .../Computers/Commodore64/C64.Motherboard.cs | 4 +++- .../Computers/Commodore64/User/UserPort.cs | 3 ++- .../Computers/Commodore64/User/UserPortDevice.cs | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs index 30bd0210e8..4120c9ef9e 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Motherboard.cs @@ -334,7 +334,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 ser.EndSection(); } - ser.BeginSection("User"); SaveState.SyncObject(ser, User); ser.EndSection(); + ser.BeginSection("User"); + User.SyncState(ser); + ser.EndSection(); if (DiskDrive != null) // TODO: a disk object is already in a nested class, is it the same reference? do we need this? { diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPort.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPort.cs index 1eb11afc2d..268ede9a47 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPort.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPort.cs @@ -69,7 +69,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.User public void SyncState(Serializer ser) { - SaveState.SyncObject(ser, this); + ser.Sync("_connected", ref _connected); + _device?.SyncState(ser); } } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPortDevice.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPortDevice.cs index 108e4d2674..c47b13d504 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPortDevice.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/User/UserPortDevice.cs @@ -41,9 +41,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.User return true; } - public void SyncState(Serializer ser) - { - SaveState.SyncObject(ser, this); - } + public abstract void SyncState(Serializer ser); } }