ZXHawk: AutoTapeLoad has been changed to a SyncSetting - #1158

This commit is contained in:
Asnivor 2018-03-27 16:06:59 +01:00
parent 8485a52662
commit f1fbd2b64e
10 changed files with 58 additions and 64 deletions

View File

@ -39,12 +39,14 @@
this.label2 = new System.Windows.Forms.Label();
this.borderTypecomboBox1 = new System.Windows.Forms.ComboBox();
this.lblBorderInfo = new System.Windows.Forms.Label();
this.lblAutoLoadText = new System.Windows.Forms.Label();
this.autoLoadcheckBox1 = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// OkBtn
//
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OkBtn.Location = new System.Drawing.Point(247, 393);
this.OkBtn.Location = new System.Drawing.Point(247, 434);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(60, 23);
this.OkBtn.TabIndex = 3;
@ -56,7 +58,7 @@
//
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(313, 393);
this.CancelBtn.Location = new System.Drawing.Point(313, 434);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 4;
@ -144,13 +146,36 @@
this.lblBorderInfo.Text = "null";
this.lblBorderInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblAutoLoadText
//
this.lblAutoLoadText.Font = new System.Drawing.Font("Lucida Console", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAutoLoadText.Location = new System.Drawing.Point(175, 388);
this.lblAutoLoadText.Name = "lblAutoLoadText";
this.lblAutoLoadText.Size = new System.Drawing.Size(196, 30);
this.lblAutoLoadText.TabIndex = 27;
this.lblAutoLoadText.Text = "When enabled ZXHawk will attempt to control the tape device automatically when th" +
"e correct traps are detected";
this.lblAutoLoadText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// autoLoadcheckBox1
//
this.autoLoadcheckBox1.AutoSize = true;
this.autoLoadcheckBox1.Location = new System.Drawing.Point(15, 394);
this.autoLoadcheckBox1.Name = "autoLoadcheckBox1";
this.autoLoadcheckBox1.Size = new System.Drawing.Size(103, 17);
this.autoLoadcheckBox1.TabIndex = 26;
this.autoLoadcheckBox1.Text = "Auto-Load Tape";
this.autoLoadcheckBox1.UseVisualStyleBackColor = true;
//
// ZXSpectrumCoreEmulationSettings
//
this.AcceptButton = this.OkBtn;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelBtn;
this.ClientSize = new System.Drawing.Size(385, 428);
this.ClientSize = new System.Drawing.Size(385, 469);
this.Controls.Add(this.lblAutoLoadText);
this.Controls.Add(this.autoLoadcheckBox1);
this.Controls.Add(this.lblBorderInfo);
this.Controls.Add(this.label2);
this.Controls.Add(this.borderTypecomboBox1);
@ -183,5 +208,7 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox borderTypecomboBox1;
private System.Windows.Forms.Label lblBorderInfo;
private System.Windows.Forms.Label lblAutoLoadText;
private System.Windows.Forms.CheckBox autoLoadcheckBox1;
}
}

View File

@ -41,6 +41,9 @@ namespace BizHawk.Client.EmuHawk
// deterministic emulation
determEmucheckBox1.Checked = _syncSettings.DeterministicEmulation;
// autoload tape
autoLoadcheckBox1.Checked = _syncSettings.AutoLoadTape;
}
private void OkBtn_Click(object sender, EventArgs e)
@ -48,13 +51,15 @@ namespace BizHawk.Client.EmuHawk
bool changed =
_syncSettings.MachineType.ToString() != MachineSelectionComboBox.SelectedItem.ToString()
|| _syncSettings.BorderType.ToString() != borderTypecomboBox1.SelectedItem.ToString()
|| _syncSettings.DeterministicEmulation != determEmucheckBox1.Checked;
|| _syncSettings.DeterministicEmulation != determEmucheckBox1.Checked
|| _syncSettings.AutoLoadTape != autoLoadcheckBox1.Checked;
if (changed)
{
_syncSettings.MachineType = (MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString());
_syncSettings.BorderType = (ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), borderTypecomboBox1.SelectedItem.ToString());
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
_syncSettings.AutoLoadTape = autoLoadcheckBox1.Checked;
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);

View File

@ -32,8 +32,6 @@
this.OkBtn = new System.Windows.Forms.Button();
this.CancelBtn = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.autoLoadcheckBox1 = new System.Windows.Forms.CheckBox();
this.lblAutoLoadText = new System.Windows.Forms.Label();
this.lblOSDVerbinfo = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.osdMessageVerbositycomboBox1 = new System.Windows.Forms.ComboBox();
@ -42,7 +40,7 @@
// OkBtn
//
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OkBtn.Location = new System.Drawing.Point(247, 145);
this.OkBtn.Location = new System.Drawing.Point(247, 142);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(60, 23);
this.OkBtn.TabIndex = 3;
@ -54,7 +52,7 @@
//
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(313, 145);
this.CancelBtn.Location = new System.Drawing.Point(313, 142);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 4;
@ -71,27 +69,6 @@
this.label1.TabIndex = 17;
this.label1.Text = "ZX Spectrum Misc Non-Sync Settings";
//
// autoLoadcheckBox1
//
this.autoLoadcheckBox1.AutoSize = true;
this.autoLoadcheckBox1.Location = new System.Drawing.Point(15, 52);
this.autoLoadcheckBox1.Name = "autoLoadcheckBox1";
this.autoLoadcheckBox1.Size = new System.Drawing.Size(103, 17);
this.autoLoadcheckBox1.TabIndex = 21;
this.autoLoadcheckBox1.Text = "Auto-Load Tape";
this.autoLoadcheckBox1.UseVisualStyleBackColor = true;
//
// lblAutoLoadText
//
this.lblAutoLoadText.Font = new System.Drawing.Font("Lucida Console", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAutoLoadText.Location = new System.Drawing.Point(175, 46);
this.lblAutoLoadText.Name = "lblAutoLoadText";
this.lblAutoLoadText.Size = new System.Drawing.Size(196, 30);
this.lblAutoLoadText.TabIndex = 25;
this.lblAutoLoadText.Text = "When enabled ZXHawk will attempt to control the tape device automatically when th" +
"e correct traps are detected";
this.lblAutoLoadText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblOSDVerbinfo
//
this.lblOSDVerbinfo.Font = new System.Drawing.Font("Lucida Console", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -129,12 +106,10 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelBtn;
this.ClientSize = new System.Drawing.Size(385, 180);
this.ClientSize = new System.Drawing.Size(385, 177);
this.Controls.Add(this.lblOSDVerbinfo);
this.Controls.Add(this.label4);
this.Controls.Add(this.osdMessageVerbositycomboBox1);
this.Controls.Add(this.lblAutoLoadText);
this.Controls.Add(this.autoLoadcheckBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.OkBtn);
@ -153,8 +128,6 @@
private System.Windows.Forms.Button OkBtn;
private System.Windows.Forms.Button CancelBtn;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox autoLoadcheckBox1;
private System.Windows.Forms.Label lblAutoLoadText;
private System.Windows.Forms.Label lblOSDVerbinfo;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox osdMessageVerbositycomboBox1;

View File

@ -21,8 +21,7 @@ namespace BizHawk.Client.EmuHawk
{
_settings = ((ZXSpectrum)Global.Emulator).GetSettings().Clone();
// autoload tape
autoLoadcheckBox1.Checked = _settings.AutoLoadTape;
// OSD Message Verbosity
var osdTypes = Enum.GetNames(typeof(ZXSpectrum.OSDVerbosity));
@ -36,13 +35,11 @@ namespace BizHawk.Client.EmuHawk
private void OkBtn_Click(object sender, EventArgs e)
{
bool changed =
_settings.AutoLoadTape != autoLoadcheckBox1.Checked
|| _settings.OSDMessageVerbosity.ToString() != osdMessageVerbositycomboBox1.SelectedItem.ToString();
bool changed =
_settings.OSDMessageVerbosity.ToString() != osdMessageVerbositycomboBox1.SelectedItem.ToString();
if (changed)
{
_settings.AutoLoadTape = autoLoadcheckBox1.Checked;
_settings.OSDMessageVerbosity = (ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString());
GlobalWin.MainForm.PutCoreSettings(_settings);

View File

@ -24,9 +24,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <summary>
/// Default constructor
/// </summary>
public DatacorderDevice()
public DatacorderDevice(bool autoplay)
{
_autoPlay = autoplay;
}
/// <summary>
@ -40,8 +40,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_buzzer = machine.TapeBuzzer;
}
#endregion
#region State Information
@ -129,12 +127,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// 'load' mode and auto-play the tape if neccesary
/// </summary>
private bool _autoPlay;
public bool AutoPlay
{
get { return _machine.Spectrum.Settings.AutoLoadTape; }
set { _autoPlay = value; MonitorReset(); }
}
#endregion
@ -428,7 +420,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// process the cycles based on the waitEdge
while (cycles >= _waitEdge)
while (cycles >= _waitEdge)
{
// decrement cycles
cycles -= _waitEdge;
@ -723,7 +715,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
_monitorCount++;
if (_monitorCount >= 16 && _machine.Spectrum.Settings.AutoLoadTape)
if (_monitorCount >= 16 && _autoPlay)
{
if (!_tapeIsPlaying)
{
@ -749,7 +741,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (!_tapeIsPlaying)
return;
if (!_machine.Spectrum.Settings.AutoLoadTape)
if (!_autoPlay)
return;
Stop();
@ -761,7 +753,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (_tapeIsPlaying)
return;
if (!_machine.Spectrum.Settings.AutoLoadTape)
if (!_autoPlay)
return;
Play();
@ -772,7 +764,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
private void MonitorFrame()
{
if (_tapeIsPlaying && _machine.Spectrum.Settings.AutoLoadTape)
if (_tapeIsPlaying && _autoPlay)
{
_monitorTimeOut--;

View File

@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
InitJoysticks(joysticks);
TapeDevice = new DatacorderDevice();
TapeDevice = new DatacorderDevice(spectrum.SyncSettings.AutoLoadTape);
TapeDevice.Init(this);
InitializeMedia(files);

View File

@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
InitJoysticks(joysticks);
TapeDevice = new DatacorderDevice();
TapeDevice = new DatacorderDevice(spectrum.SyncSettings.AutoLoadTape);
TapeDevice.Init(this);
InitializeMedia(files);

View File

@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
InitJoysticks(joysticks);
TapeDevice = new DatacorderDevice();
TapeDevice = new DatacorderDevice(spectrum.SyncSettings.AutoLoadTape);
TapeDevice.Init(this);
InitializeMedia(files);

View File

@ -33,7 +33,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
InitJoysticks(joysticks);
TapeDevice = new DatacorderDevice();
TapeDevice = new DatacorderDevice(spectrum.SyncSettings.AutoLoadTape);
TapeDevice.Init(this);
InitializeMedia(files);

View File

@ -54,11 +54,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
public class ZXSpectrumSettings
{
[DisplayName("Auto-load/stop tape")]
[Description("Auto or manual tape operation. Auto will attempt to detect CPU tape traps and automatically Stop/Start the tape")]
[DefaultValue(true)]
public bool AutoLoadTape { get; set; }
[DisplayName("AY-3-8912 Panning Config")]
[Description("Set the PSG panning configuration.\nThe chip has 3 audio channels that can be outputed in different configurations")]
[DefaultValue(AYChip.AYPanConfig.ABC)]
@ -133,6 +128,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
[DefaultValue(JoystickType.SinclairRIGHT)]
public JoystickType JoystickType3 { get; set; }
[DisplayName("Auto-load/stop tape")]
[Description("Auto or manual tape operation. Auto will attempt to detect CPU tape traps and automatically Stop/Start the tape")]
[DefaultValue(true)]
public bool AutoLoadTape { get; set; }
public ZXSpectrumSyncSettings Clone()
{