2014-01-01 03:03:10 +00:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Windows.Forms ;
using BizHawk.Client.Common ;
2014-03-05 04:08:24 +00:00
using BizHawk.Emulation.Cores.Nintendo.NES ;
2014-01-01 03:03:10 +00:00
2014-01-06 23:56:30 +00:00
namespace BizHawk.Client.EmuHawk
2014-01-01 03:03:10 +00:00
{
public partial class NESSyncSettingsForm : Form
{
DataTableDictionaryBind < string , string > DTDB ;
2014-03-05 04:08:24 +00:00
NES . NESSyncSettings SyncSettings ;
2014-01-01 03:03:10 +00:00
public NESSyncSettingsForm ( )
{
InitializeComponent ( ) ;
2015-08-07 21:15:50 +00:00
2014-10-19 01:22:47 +00:00
SyncSettings = ( ( NES ) Global . Emulator ) . GetSyncSettings ( ) ;
2014-02-06 02:06:17 +00:00
2015-08-07 21:15:50 +00:00
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 ) ;
2014-01-01 03:03:10 +00:00
}
2014-01-10 17:41:13 +00:00
private void CancelBtn_Click ( object sender , EventArgs e )
2014-01-01 03:03:10 +00:00
{
DialogResult = DialogResult . Cancel ;
Close ( ) ;
}
2014-01-10 17:41:13 +00:00
private void OkBtn_Click ( object sender , EventArgs e )
2014-01-01 03:03:10 +00:00
{
2014-03-05 04:08:24 +00:00
2014-02-06 02:06:17 +00:00
var old = SyncSettings . RegionOverride ;
2014-06-29 02:28:48 +00:00
SyncSettings . RegionOverride = ( NES . NESSyncSettings . Region )
2014-02-06 02:06:17 +00:00
Enum . Parse (
2014-06-29 02:28:48 +00:00
typeof ( NES . NESSyncSettings . Region ) ,
2015-08-07 21:15:50 +00:00
( string ) RegionComboBox . SelectedItem ) ;
2014-02-06 02:06:17 +00:00
2015-08-07 21:15:50 +00:00
bool changed = ( DTDB ! = null & & DTDB . WasModified ) | |
2014-05-16 00:53:10 +00:00
old ! = SyncSettings . RegionOverride ;
2014-03-05 04:08:24 +00:00
2014-01-01 03:03:10 +00:00
DialogResult = DialogResult . OK ;
2014-03-05 04:08:24 +00:00
if ( changed )
2014-01-06 23:56:30 +00:00
{
2014-01-01 03:03:10 +00:00
GlobalWin . MainForm . PutCoreSyncSettings ( SyncSettings ) ;
2014-01-06 23:56:30 +00:00
}
2014-01-01 03:03:10 +00:00
}
2014-01-10 17:41:13 +00:00
private void HelpBtn_Click ( object sender , EventArgs e )
2014-01-01 03:03:10 +00:00
{
2015-08-07 21:15:50 +00:00
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 ) ;
2014-01-01 03:03:10 +00:00
}
2014-03-05 04:08:24 +00:00
2014-05-16 00:24:40 +00:00
private void NESSyncSettingsForm_Load ( object sender , EventArgs e )
{
}
2014-01-01 03:03:10 +00:00
}
}