coleco to new settings system
This commit is contained in:
parent
433a0f7925
commit
cff6a517f5
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2040,6 +2040,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadRom(file.FullName);
|
||||
}
|
||||
|
||||
object __SyncSettingsHack = null;
|
||||
|
||||
object GetCoreSyncSettings<T>()
|
||||
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<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// send core settings to emu, setting reboot flag if needed
|
||||
/// </summary>
|
||||
|
@ -3062,7 +3075,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
case "GEN":
|
||||
{
|
||||
var genesis = new GPGX(
|
||||
nextComm, null, disc, "GEN", Global.Config.GetCoreSyncSettings<GPGX>());
|
||||
nextComm, null, disc, "GEN", GetCoreSyncSettings<GPGX>());
|
||||
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<GambatteLink>(),
|
||||
Global.Config.GetCoreSyncSettings<GambatteLink>());
|
||||
GetCoreSyncSettings<GambatteLink>());
|
||||
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<SMS>(), Global.Config.GetCoreSyncSettings<SMS>());
|
||||
nextEmulator = new SMS(nextComm, game, rom.RomData, Global.Config.GetCoreSettings<SMS>(), GetCoreSyncSettings<SMS>());
|
||||
break;
|
||||
case "A26":
|
||||
nextEmulator = new Atari2600(nextComm, game, rom.FileData,
|
||||
Global.Config.GetCoreSettings<Atari2600>(),
|
||||
Global.Config.GetCoreSyncSettings<Atari2600>());
|
||||
GetCoreSyncSettings<Atari2600>());
|
||||
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<GPGX>());
|
||||
nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", GetCoreSyncSettings<GPGX>());
|
||||
break;
|
||||
}
|
||||
case "TI83":
|
||||
|
@ -3234,7 +3247,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var gb = new Gameboy(nextComm, game, rom.FileData,
|
||||
Global.Config.GetCoreSettings<Gameboy>(),
|
||||
Global.Config.GetCoreSyncSettings<Gameboy>());
|
||||
GetCoreSyncSettings<Gameboy>());
|
||||
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<ColecoVision>());
|
||||
nextEmulator = c;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue