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); }
public NesControllerSettings() { InitializeComponent(); SyncSettings = ((NES)Global.Emulator).GetSyncSettings(); // TODO: use combobox extension and add descriptions to enum values comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().ToArray()); comboBoxNESL.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray()); comboBoxNESR.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray()); comboBoxFamicom.SelectedItem = SyncSettings.Controls.FamicomExpPort; comboBoxNESL.SelectedItem = SyncSettings.Controls.NesLeftPort; comboBoxNESR.SelectedItem = SyncSettings.Controls.NesRightPort; checkBoxFamicom.Checked = SyncSettings.Controls.Famicom; }
public static void Populate(NES.INESBoard board, NES.NESSyncSettings settings) { var fields = board.GetType().GetFields(); foreach (var field in fields) { var attrib = field.GetCustomAttributes(typeof(MapperPropAttribute), false).OfType <MapperPropAttribute>().SingleOrDefault(); if (attrib == null) { continue; } string Name = attrib.Name ?? field.Name; if (!settings.BoardProperties.ContainsKey(Name)) { settings.BoardProperties.Add(Name, (string)Convert.ChangeType(field.GetValue(board), typeof(string))); } } }
public NESSyncSettingsForm() { InitializeComponent(); 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); }