clean up the NESSyncSettingsForm
This commit is contained in:
parent
551acd8c9e
commit
d662d9a700
File diff suppressed because it is too large
Load Diff
|
@ -31,19 +31,20 @@
|
|||
this.OkBtn = new System.Windows.Forms.Button();
|
||||
this.CancelBtn = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.RegionComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.HelpBtn = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.BoardPropertiesGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.InfoLabel = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.BoardPropertiesGroupBox.SuspendLayout();
|
||||
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(221, 341);
|
||||
this.OkBtn.Location = new System.Drawing.Point(221, 354);
|
||||
this.OkBtn.Name = "OkBtn";
|
||||
this.OkBtn.Size = new System.Drawing.Size(67, 23);
|
||||
this.OkBtn.TabIndex = 0;
|
||||
|
@ -55,7 +56,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(294, 341);
|
||||
this.CancelBtn.Location = new System.Drawing.Point(294, 354);
|
||||
this.CancelBtn.Name = "CancelBtn";
|
||||
this.CancelBtn.Size = new System.Drawing.Size(67, 23);
|
||||
this.CancelBtn.TabIndex = 1;
|
||||
|
@ -75,23 +76,23 @@
|
|||
this.dataGridView1.Size = new System.Drawing.Size(333, 203);
|
||||
this.dataGridView1.TabIndex = 9;
|
||||
//
|
||||
// comboBox1
|
||||
// RegionComboBox
|
||||
//
|
||||
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(12, 26);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(235, 21);
|
||||
this.comboBox1.TabIndex = 11;
|
||||
this.RegionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.RegionComboBox.FormattingEnabled = true;
|
||||
this.RegionComboBox.Location = new System.Drawing.Point(12, 26);
|
||||
this.RegionComboBox.Name = "RegionComboBox";
|
||||
this.RegionComboBox.Size = new System.Drawing.Size(124, 21);
|
||||
this.RegionComboBox.TabIndex = 11;
|
||||
//
|
||||
// HelpBtn
|
||||
//
|
||||
this.HelpBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.HelpBtn.Location = new System.Drawing.Point(12, 67);
|
||||
this.HelpBtn.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Help;
|
||||
this.HelpBtn.Location = new System.Drawing.Point(12, 87);
|
||||
this.HelpBtn.Name = "HelpBtn";
|
||||
this.HelpBtn.Size = new System.Drawing.Size(23, 23);
|
||||
this.HelpBtn.TabIndex = 10;
|
||||
this.HelpBtn.Text = "?";
|
||||
this.HelpBtn.UseVisualStyleBackColor = true;
|
||||
this.HelpBtn.Click += new System.EventHandler(this.HelpBtn_Click);
|
||||
//
|
||||
|
@ -104,49 +105,60 @@
|
|||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "Region Override:";
|
||||
//
|
||||
// groupBox1
|
||||
// BoardPropertiesGroupBox
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
this.BoardPropertiesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.dataGridView1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 96);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(349, 228);
|
||||
this.groupBox1.TabIndex = 13;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Board Properties";
|
||||
this.BoardPropertiesGroupBox.Controls.Add(this.dataGridView1);
|
||||
this.BoardPropertiesGroupBox.Location = new System.Drawing.Point(12, 113);
|
||||
this.BoardPropertiesGroupBox.Name = "BoardPropertiesGroupBox";
|
||||
this.BoardPropertiesGroupBox.Size = new System.Drawing.Size(349, 228);
|
||||
this.BoardPropertiesGroupBox.TabIndex = 13;
|
||||
this.BoardPropertiesGroupBox.TabStop = false;
|
||||
this.BoardPropertiesGroupBox.Text = "Custom Board Properties";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 50);
|
||||
this.label1.Location = new System.Drawing.Point(12, 53);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(362, 13);
|
||||
this.label1.TabIndex = 14;
|
||||
this.label1.Text = "Region Override will be ignored when playing Famicom Disk System games.";
|
||||
//
|
||||
// InfoLabel
|
||||
//
|
||||
this.InfoLabel.AutoSize = true;
|
||||
this.InfoLabel.Location = new System.Drawing.Point(40, 92);
|
||||
this.InfoLabel.Name = "InfoLabel";
|
||||
this.InfoLabel.Size = new System.Drawing.Size(213, 13);
|
||||
this.InfoLabel.TabIndex = 15;
|
||||
this.InfoLabel.Text = "The current board has no custom properties";
|
||||
//
|
||||
// NESSyncSettingsForm
|
||||
//
|
||||
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(373, 376);
|
||||
this.ClientSize = new System.Drawing.Size(373, 389);
|
||||
this.Controls.Add(this.InfoLabel);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.BoardPropertiesGroupBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.RegionComboBox);
|
||||
this.Controls.Add(this.HelpBtn);
|
||||
this.Controls.Add(this.CancelBtn);
|
||||
this.Controls.Add(this.OkBtn);
|
||||
this.MinimumSize = new System.Drawing.Size(210, 150);
|
||||
this.Name = "NESSyncSettingsForm";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "NES Movie Settings";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "NES Advanced Settings";
|
||||
this.Load += new System.EventHandler(this.NESSyncSettingsForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.BoardPropertiesGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -157,10 +169,11 @@
|
|||
private System.Windows.Forms.Button OkBtn;
|
||||
private System.Windows.Forms.Button CancelBtn;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.ComboBox RegionComboBox;
|
||||
private System.Windows.Forms.Button HelpBtn;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
internal System.Windows.Forms.GroupBox BoardPropertiesGroupBox;
|
||||
private System.Windows.Forms.Label InfoLabel;
|
||||
}
|
||||
}
|
|
@ -19,13 +19,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
public NESSyncSettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
SyncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||
DTDB = new DataTableDictionaryBind<string, string>(SyncSettings.BoardProperties);
|
||||
dataGridView1.DataSource = DTDB.Table;
|
||||
|
||||
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBox1.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region)));
|
||||
comboBox1.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), SyncSettings.RegionOverride);
|
||||
SyncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||
|
||||
if ((Global.Emulator as NES).HasMapperProperties)
|
||||
{
|
||||
|
||||
DTDB = new DataTableDictionaryBind<string, string>(SyncSettings.BoardProperties);
|
||||
dataGridView1.DataSource = DTDB.Table;
|
||||
InfoLabel.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BoardPropertiesGroupBox.Enabled = false;
|
||||
dataGridView1.DataSource = null;
|
||||
dataGridView1.Enabled = false;
|
||||
InfoLabel.Visible = true;
|
||||
}
|
||||
|
||||
RegionComboBox.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region)));
|
||||
RegionComboBox.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), SyncSettings.RegionOverride);
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -41,9 +54,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
SyncSettings.RegionOverride = (NES.NESSyncSettings.Region)
|
||||
Enum.Parse(
|
||||
typeof(NES.NESSyncSettings.Region),
|
||||
(string)comboBox1.SelectedItem);
|
||||
(string)RegionComboBox.SelectedItem);
|
||||
|
||||
bool changed = DTDB.WasModified ||
|
||||
bool changed = (DTDB != null && DTDB.WasModified) ||
|
||||
old != SyncSettings.RegionOverride;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
|
@ -55,7 +68,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void HelpBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Board Properties are special per-mapper system settings. They are only useful to advanced users creating Tool Assisted Superplays. No support will be provided if you break something with them.", "Help");
|
||||
MessageBox.Show(
|
||||
this,
|
||||
"Board Properties are special per-mapper system settings. They are only useful to advanced users creating Tool Assisted Superplays. No support will be provided if you break something with them.",
|
||||
"Help",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void NESSyncSettingsForm_Load(object sender, EventArgs e)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
|
@ -90,6 +91,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
Console.WriteLine("[{0:d5}:{1:d3}:{2:d3}] {3}", Frame, ppu.ppur.status.sl, ppu.ppur.status.cycle, string.Format(format, args));
|
||||
}
|
||||
|
||||
public bool HasMapperProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
var fields = Board.GetType().GetFields();
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var attrib = field.GetCustomAttributes(typeof(MapperPropAttribute), false).OfType<MapperPropAttribute>().SingleOrDefault();
|
||||
if (attrib != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
NESWatch GetWatch(NESWatch.EDomain domain, int address)
|
||||
{
|
||||
if (domain == NESWatch.EDomain.Sysbus)
|
||||
|
|
Loading…
Reference in New Issue