diff --git a/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.cs index 7bd14de42d..862699e97d 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.cs @@ -56,8 +56,10 @@ namespace BizHawk ser.Sync("IsLag", ref _islag); tia.SyncState(ser); m6532.SyncState(ser); + ser.BeginSection("Mapper"); mapper.SyncState(ser); ser.EndSection(); + ser.EndSection(); } public ControllerDefinition ControllerDefinition { get { return Atari2600ControllerDefinition; } } diff --git a/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs b/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs index d58f4814f4..4b498d445b 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs @@ -230,9 +230,11 @@ namespace BizHawk.Emulation.Consoles.Atari public void SyncState(Serializer ser) { + ser.BeginSection("M6532"); ser.Sync("ddra", ref ddra); ser.Sync("ddrb", ref ddrb); timer.SyncState(ser); + ser.EndSection(); } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs index 82675cc35c..b82d691ca6 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs @@ -92,6 +92,7 @@ namespace BizHawk.Emulation.Consoles.Atari public void SyncState(Serializer ser) { + ser.BeginSection("Missile"); ser.Sync("enabled", ref enabled); ser.Sync("resetToPlayer", ref resetToPlayer); ser.Sync("hPosCnt", ref hPosCnt); @@ -99,6 +100,7 @@ namespace BizHawk.Emulation.Consoles.Atari ser.Sync("number", ref number); ser.Sync("HM", ref HM); ser.Sync("collisions", ref collisions); + ser.EndSection(); } } @@ -291,6 +293,7 @@ namespace BizHawk.Emulation.Consoles.Atari public void SyncState(Serializer ser) { + ser.BeginSection("Ball"); ser.Sync("enabled", ref enabled); ser.Sync("denabled", ref denabled); ser.Sync("delay", ref delay); @@ -298,6 +301,7 @@ namespace BizHawk.Emulation.Consoles.Atari ser.Sync("HM", ref HM); ser.Sync("hPosCnt", ref hPosCnt); ser.Sync("collisions", ref collisions); + ser.EndSection(); } }; @@ -312,12 +316,14 @@ namespace BizHawk.Emulation.Consoles.Atari public bool priority; public void SyncState(Serializer ser) { + ser.BeginSection("PlayField"); ser.Sync("grp", ref grp); ser.Sync("pfColor", ref pfColor); ser.Sync("bkColor", ref bkColor); ser.Sync("reflect", ref reflect); ser.Sync("score", ref score); ser.Sync("priority", ref priority); + ser.EndSection(); } }; @@ -346,6 +352,7 @@ namespace BizHawk.Emulation.Consoles.Atari public void SyncState(Serializer ser) { + ser.BeginSection("HMove"); ser.Sync("hmoveEnabled", ref hmoveEnabled); ser.Sync("hmoveJustStarted", ref hmoveJustStarted); ser.Sync("lateHBlankReset", ref lateHBlankReset); @@ -362,6 +369,7 @@ namespace BizHawk.Emulation.Consoles.Atari ser.Sync("missile0Cnt", ref missile0Cnt); ser.Sync("missile1Cnt", ref missile1Cnt); ser.Sync("ballCnt", ref ballCnt); + ser.EndSection(); } }; @@ -1359,13 +1367,19 @@ namespace BizHawk.Emulation.Consoles.Atari public void SyncState(Serializer ser) { + ser.BeginSection("TIA"); ball.SyncState(ser); hmove.SyncState(ser); ser.Sync("hsyncCnt", ref hsyncCnt); + ser.BeginSection("Player0"); player0.SyncState(ser); + ser.EndSection(); + ser.BeginSection("Player1"); player1.SyncState(ser); + ser.EndSection(); playField.SyncState(ser); //ser.Sync("scanline", ref scanline); + ser.EndSection(); } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Util.cs b/BizHawk.Emulation/Util.cs index 5c11997892..cc97ad68a7 100644 --- a/BizHawk.Emulation/Util.cs +++ b/BizHawk.Emulation/Util.cs @@ -813,7 +813,10 @@ namespace BizHawk ss.Push(curs); var news = new Section(); news.Name = name; - curs[name] = news; + if (!curs.ContainsKey(name)) + curs[name] = news; + else + throw new Exception(string.Format("Duplicate key \"{0}\" in serializer savestate!", name)); curs = news; } else