diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index 601aae4f01..467147d2d3 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -452,7 +452,7 @@ namespace BizHawk.Client.Common public int PCEBGViewerRefreshRate = 16; // Coleco Settings - public bool ColecoSkipBiosIntro = false; + //public bool ColecoSkipBiosIntro = false; //GB Debugger settings public bool AutoloadGBDebugger = false; diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 9f6d03acf0..7fae791f99 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -13,6 +13,7 @@ using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.SNES; using BizHawk.Emulation.Cores.PCEngine; using BizHawk.Emulation.Cores.Sega.MasterSystem; +using BizHawk.Emulation.Cores.ColecoVision; namespace BizHawk.Client.EmuHawk { @@ -1600,13 +1601,15 @@ namespace BizHawk.Client.EmuHawk private void ColecoSubMenu_DropDownOpened(object sender, EventArgs e) { - ColecoSkipBiosMenuItem.Checked = Global.Config.ColecoSkipBiosIntro; + var ss = (ColecoVision.ColecoSyncSettings)Global.Emulator.GetSyncSettings(); + ColecoSkipBiosMenuItem.Checked = ss.SkipBiosIntro; } private void ColecoSkipBiosMenuItem_Click(object sender, EventArgs e) { - Global.Config.ColecoSkipBiosIntro ^= true; - FlagNeedsReboot(); + var ss = (ColecoVision.ColecoSyncSettings)Global.Emulator.GetSyncSettings(); + ss.SkipBiosIntro ^= true; + PutCoreSyncSettings(ss); } #endregion diff --git a/BizHawk.Client.EmuHawk/MainForm.Movie.cs b/BizHawk.Client.EmuHawk/MainForm.Movie.cs index 5d7a57334c..de56db97dc 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Movie.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Movie.cs @@ -32,10 +32,31 @@ namespace BizHawk.Client.EmuHawk if (!record) { Global.MovieSession.Movie.Load(); - SetSyncDependentSettings(); } - LoadRom(GlobalWin.MainForm.CurrentlyOpenRom, true, !record); + try + { + // movie 1.0 hack: restore sync settings for the only core that fully supported them in movie 1.0 + if (!record && Global.Emulator.SystemId == "Coleco") + { + string str = Global.MovieSession.Movie.Header[HeaderKeys.SKIPBIOS]; + if (!String.IsNullOrWhiteSpace(str)) + { + __SyncSettingsHack = new Emulation.Cores.ColecoVision.ColecoVision.ColecoSyncSettings + { + SkipBiosIntro = str.ToLower() == "true" + }; + } + } + + // load the rom in any case + LoadRom(GlobalWin.MainForm.CurrentlyOpenRom, true, !record); + } + finally + { + // ensure subsequent calls to LoadRom won't get the settings object created here + __SyncSettingsHack = null; + } if (!fromTastudio) { @@ -143,27 +164,5 @@ namespace BizHawk.Client.EmuHawk Global.MovieSession.StopMovie(saveChanges); SetMainformMovieInfo(); } - - //On movie load, these need to be set based on the contents of the movie file - public void SetSyncDependentSettings() - { - switch (Global.Emulator.SystemId) - { - case "Coleco": - string str = Global.MovieSession.Movie.Header[HeaderKeys.SKIPBIOS]; - if (!String.IsNullOrWhiteSpace(str)) - { - if (str.ToLower() == "true") - { - Global.Config.ColecoSkipBiosIntro = true; - } - else - { - Global.Config.ColecoSkipBiosIntro = false; - } - } - break; - } - } } } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 64e9a8531d..481b88a1b8 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2040,6 +2040,19 @@ namespace BizHawk.Client.EmuHawk LoadRom(file.FullName); } + object __SyncSettingsHack = null; + + object GetCoreSyncSettings() + where T : IEmulator + { + // if movie 2.0 was finished, this is where you'd decide whether to get a settings object + // from a config file or from the movie file + + // since all we have right now is movie 1.0, we get silly hacks instead + + return __SyncSettingsHack ?? Global.Config.GetCoreSyncSettings(); + } + /// /// send core settings to emu, setting reboot flag if needed /// @@ -3062,7 +3075,7 @@ namespace BizHawk.Client.EmuHawk case "GEN": { var genesis = new GPGX( - nextComm, null, disc, "GEN", Global.Config.GetCoreSyncSettings()); + nextComm, null, disc, "GEN", GetCoreSyncSettings()); nextEmulator = genesis; } break; @@ -3149,7 +3162,7 @@ namespace BizHawk.Client.EmuHawk var gbl = new GambatteLink(nextComm, L, XMLG.Assets["LeftRom"], R, XMLG.Assets["RightRom"], Global.Config.GetCoreSettings(), - Global.Config.GetCoreSyncSettings()); + GetCoreSyncSettings()); nextEmulator = gbl; // other stuff todo @@ -3198,12 +3211,12 @@ namespace BizHawk.Client.EmuHawk case "SMS": case "SG": case "GG": - nextEmulator = new SMS(nextComm, game, rom.RomData, Global.Config.GetCoreSettings(), Global.Config.GetCoreSyncSettings()); + nextEmulator = new SMS(nextComm, game, rom.RomData, Global.Config.GetCoreSettings(), GetCoreSyncSettings()); break; case "A26": nextEmulator = new Atari2600(nextComm, game, rom.FileData, Global.Config.GetCoreSettings(), - Global.Config.GetCoreSyncSettings()); + GetCoreSyncSettings()); break; case "PCE": case "PCECD": @@ -3213,7 +3226,7 @@ namespace BizHawk.Client.EmuHawk case "GEN": { // nextEmulator = new Genesis(nextComm, game, rom.RomData); - nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", Global.Config.GetCoreSyncSettings()); + nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", GetCoreSyncSettings()); break; } case "TI83": @@ -3234,7 +3247,7 @@ namespace BizHawk.Client.EmuHawk { var gb = new Gameboy(nextComm, game, rom.FileData, Global.Config.GetCoreSettings(), - Global.Config.GetCoreSyncSettings()); + GetCoreSyncSettings()); nextEmulator = gb; } else @@ -3259,7 +3272,7 @@ namespace BizHawk.Client.EmuHawk break; case "Coleco": { - var c = new ColecoVision(nextComm, game, rom.RomData, Global.Config.ColecoSkipBiosIntro); + var c = new ColecoVision(nextComm, game, rom.RomData, GetCoreSyncSettings()); nextEmulator = c; } break; diff --git a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index fa8b8184fd..957ae9c50a 100644 --- a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -159,7 +159,8 @@ namespace BizHawk.Client.EmuHawk } else if (Global.Emulator is ColecoVision) { - _movieToRecord.Header[HeaderKeys.SKIPBIOS] = Global.Config.ColecoSkipBiosIntro.ToString(); + var s = (ColecoVision.ColecoSyncSettings)Global.Emulator.GetSyncSettings(); + _movieToRecord.Header[HeaderKeys.SKIPBIOS] = s.SkipBiosIntro.ToString(); } else if (Global.Emulator is N64) { @@ -223,7 +224,7 @@ namespace BizHawk.Client.EmuHawk sfd.Filter = filter; var result = sfd.ShowHawkDialog(); - if (result == DialogResult.OK + if (result == DialogResult.OK && !String.IsNullOrWhiteSpace(sfd.FileName)) { RecordBox.Text = filename; diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs index 197d8a798c..66b53522de 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs @@ -23,9 +23,11 @@ namespace BizHawk.Emulation.Cores.ColecoVision public SN76489 PSG; public byte[] Ram = new byte[1024]; - public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, bool skipbios) + public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, object SyncSettings) { CoreComm = comm; + this.SyncSettings = (ColecoSyncSettings)SyncSettings ?? new ColecoSyncSettings(); + bool skipbios = this.SyncSettings.SkipBiosIntro; Cpu = new Z80A(); Cpu.ReadMemory = ReadMemory; @@ -40,6 +42,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision string biosPath = CoreComm.CoreFileProvider.GetFirmwarePath("Coleco", "Bios", true, "Coleco BIOS file is required."); BiosRom = File.ReadAllBytes(biosPath); + // gamedb can overwrite the syncsettings; this is ok if (game["NoSkip"]) skipbios = false; LoadRom(rom, skipbios); @@ -291,8 +294,25 @@ namespace BizHawk.Emulation.Cores.ColecoVision public void EndAsyncSound() { } public object GetSettings() { return null; } - public object GetSyncSettings() { return null; } + public object GetSyncSettings() { return SyncSettings; } public bool PutSettings(object o) { return false; } - public bool PutSyncSettings(object o) { return false; } + public bool PutSyncSettings(object o) + { + var n = (ColecoSyncSettings)o; + bool ret = n.SkipBiosIntro != SyncSettings.SkipBiosIntro; + SyncSettings = n; + return ret; + } + + ColecoSyncSettings SyncSettings; + + public class ColecoSyncSettings + { + public bool SkipBiosIntro = false; + public ColecoSyncSettings Clone() + { + return (ColecoSyncSettings)MemberwiseClone(); + } + } } } \ No newline at end of file