NesSyncSettingsForm - pass dependencies in and support SubNesHawk
This commit is contained in:
parent
e6ac894955
commit
8cc02b8956
|
@ -1523,7 +1523,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Emulator is NES nes && nes.IsVS;
|
||||
|
||||
NESSoundChannelsMenuItem.Enabled = GlobalWin.Tools.IsAvailable<NESSoundConfig>();
|
||||
MovieSettingsMenuItem.Enabled = Emulator is NES && !Global.MovieSession.Movie.IsActive;
|
||||
MovieSettingsMenuItem.Enabled = (Emulator is NES || Emulator is SubNESHawk)
|
||||
&& !Global.MovieSession.Movie.IsActive;
|
||||
|
||||
NesControllerSettingsMenuItem.Enabled = GlobalWin.Tools.IsAvailable<NesControllerSettings>()
|
||||
&& !Global.MovieSession.Movie.IsActive;
|
||||
|
@ -1671,8 +1672,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void MovieSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dlg = new NESSyncSettingsForm();
|
||||
dlg.ShowDialog(this);
|
||||
if (Emulator is NES nes)
|
||||
{
|
||||
using var dlg = new NESSyncSettingsForm(this, nes.GetSyncSettings().Clone(), nes.HasMapperProperties);
|
||||
dlg.ShowDialog(this);
|
||||
}
|
||||
else if (Emulator is SubNESHawk sub)
|
||||
{
|
||||
using var dlg = new NESSyncSettingsForm(this, sub.GetSyncSettings().Clone(), sub.HasMapperProperties);
|
||||
dlg.ShowDialog(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BarcodeReaderMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -3,24 +3,26 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class NESSyncSettingsForm : Form
|
||||
{
|
||||
private readonly MainForm _mainForm;
|
||||
private readonly DataTableDictionaryBind<string, string> _dataTableDictionary;
|
||||
private readonly NES.NESSyncSettings _syncSettings;
|
||||
|
||||
public NESSyncSettingsForm()
|
||||
public NESSyncSettingsForm(
|
||||
MainForm mainForm,
|
||||
NES.NESSyncSettings syncSettings,
|
||||
bool hasMapperProperties)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_syncSettings = syncSettings;
|
||||
InitializeComponent();
|
||||
|
||||
_syncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||
|
||||
if (((NES)Global.Emulator).HasMapperProperties)
|
||||
if (hasMapperProperties)
|
||||
{
|
||||
_dataTableDictionary = new DataTableDictionaryBind<string, string>(_syncSettings.BoardProperties);
|
||||
dataGridView1.DataSource = _dataTableDictionary.Table;
|
||||
|
@ -84,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
DialogResult = DialogResult.OK;
|
||||
if (changed)
|
||||
{
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
_mainForm.PutCoreSyncSettings(_syncSettings);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
|
||||
using System.Linq;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
|
@ -69,9 +69,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
|||
|
||||
public int _frame = 0;
|
||||
|
||||
public bool IsFDS
|
||||
public bool IsFDS => subnes.Board is FDS;
|
||||
|
||||
public bool HasMapperProperties
|
||||
{
|
||||
get { return subnes.Board is FDS; }
|
||||
get
|
||||
{
|
||||
var fields = subnes.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;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ITraceable _tracer;
|
||||
|
|
Loading…
Reference in New Issue