allow editing gambatte/gambattelink settings without the core loaded

This commit is contained in:
CasualPokePlayer 2022-06-06 09:04:38 -07:00
parent 34d794b368
commit d0383d1e9d
7 changed files with 216 additions and 220 deletions

View File

@ -1606,8 +1606,8 @@ namespace BizHawk.Client.EmuHawk
};
}
private DialogResult OpenGambatteSettingsDialog(ISettingsAdapter settable, Gameboy gambatte)
=> GBPrefs.DoGBPrefsDialog(Config, this, Game, MovieSession, settable, gambatte);
private DialogResult OpenGambatteSettingsDialog()
=> GBPrefs.DoGBPrefsDialog(Config, this, Game, MovieSession, GetSettingsAdapterFor<Gameboy>());
private DialogResult OpenGBHawkSettingsDialog()
=> OpenGenericCoreConfigFor<GBHawk>("Gameboy Settings");
@ -1619,7 +1619,7 @@ namespace BizHawk.Client.EmuHawk
{
_ = Emulator switch
{
Gameboy gambatte => OpenGambatteSettingsDialog(GetSettingsAdapterForLoadedCore<Gameboy>(), gambatte),
Gameboy => OpenGambatteSettingsDialog(),
GBHawk => OpenGBHawkSettingsDialog(),
Sameboy => OpenSameBoySettingsDialog(),
_ => DialogResult.None
@ -1874,14 +1874,14 @@ namespace BizHawk.Client.EmuHawk
}
}
private DialogResult OpenGambatteLinkSettingsDialog(ISettingsAdapter settable, GambatteLink gambatteLink)
=> GBLPrefs.DoGBLPrefsDialog(Config, this, Game, MovieSession, settable, gambatteLink);
private DialogResult OpenGambatteLinkSettingsDialog()
=> GBLPrefs.DoGBLPrefsDialog(Config, this, Game, MovieSession, GetSettingsAdapterFor<GambatteLink>());
private void GblSettingsMenuItem_Click(object sender, EventArgs e)
{
_ = Emulator switch
{
GambatteLink gambatteLink => OpenGambatteLinkSettingsDialog(GetSettingsAdapterForLoadedCore<GambatteLink>(), gambatteLink),
GambatteLink => OpenGambatteLinkSettingsDialog(),
_ => DialogResult.None
};
}
@ -2831,22 +2831,19 @@ namespace BizHawk.Client.EmuHawk
items.Add(faustSubmenu);
// Gambatte
var gambatteSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog(GetSettingsAdapterForLoadedCore<Gameboy>(), (Gameboy) Emulator));
var gambatteSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog());
var gambatteSubmenu = CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Gambatte, gambatteSettingsItem);
gambatteSubmenu.DropDownOpened += (_, _) => gambatteSettingsItem.Enabled = Emulator is Gameboy;
items.Add(gambatteSubmenu);
if (includeDupes)
{
var gambatteSettingsItem1 = CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog(GetSettingsAdapterForLoadedCore<Gameboy>(), (Gameboy) Emulator));
var gambatteSettingsItem1 = CreateSettingsItem("Settings...", (_, _) => OpenGambatteSettingsDialog());
var gambatteSubmenu1 = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Gambatte, gambatteSettingsItem1);
gambatteSubmenu1.DropDownOpened += (_, _) => gambatteSettingsItem1.Enabled = Emulator is Gameboy;
items.Add(gambatteSubmenu1);
}
// GambatteLink
var gambatteLinkSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGambatteLinkSettingsDialog(GetSettingsAdapterForLoadedCore<GambatteLink>(), (GambatteLink) Emulator));
var gambatteLinkSettingsItem = CreateSettingsItem("Settings...", (_, _) => OpenGambatteLinkSettingsDialog());
var gambatteLinkSubmenu = CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.GambatteLink, gambatteLinkSettingsItem);
gambatteLinkSubmenu.DropDownOpened += (_, _) => gambatteLinkSettingsItem.Enabled = Emulator is GambatteLink;
items.Add(gambatteLinkSubmenu);
// GBHawk

View File

@ -28,159 +28,159 @@
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.gbPrefControl1 = new GBPrefControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.gbPrefControl2 = new GBPrefControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.gbPrefControl3 = new GBPrefControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.gbPrefControl4 = new GBPrefControl();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.gbPrefControl1 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.gbPrefControl2 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.gbPrefControl3 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.gbPrefControl4 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.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.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Location = new System.Drawing.Point(12, 12);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(517, 334);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.gbPrefControl1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(509, 308);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Player 1 Gameboy";
this.tabPage1.UseVisualStyleBackColor = true;
//
// gbPrefControl1
//
this.gbPrefControl1.ColorGameBoy = false;
this.gbPrefControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl1.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl1.Name = "gbPrefControl1";
this.gbPrefControl1.Size = new System.Drawing.Size(503, 302);
this.gbPrefControl1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.gbPrefControl2);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(509, 308);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Player 2 Gameboy";
this.tabPage2.UseVisualStyleBackColor = true;
//
// gbPrefControl2
//
this.gbPrefControl2.ColorGameBoy = false;
this.gbPrefControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl2.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl2.Name = "gbPrefControl2";
this.gbPrefControl2.Size = new System.Drawing.Size(503, 302);
this.gbPrefControl2.TabIndex = 0;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.gbPrefControl3);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(509, 308);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Player 3 Gameboy";
this.tabPage3.UseVisualStyleBackColor = true;
//
// gbPrefControl3
//
this.gbPrefControl3.ColorGameBoy = false;
this.gbPrefControl3.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl3.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl3.Name = "gbPrefControl3";
this.gbPrefControl3.Size = new System.Drawing.Size(503, 302);
this.gbPrefControl3.TabIndex = 0;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.gbPrefControl4);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(509, 308);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Player 4 Gameboy";
this.tabPage4.UseVisualStyleBackColor = true;
//
// gbPrefControl4
//
this.gbPrefControl4.ColorGameBoy = false;
this.gbPrefControl4.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl4.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl4.Name = "gbPrefControl4";
this.gbPrefControl4.Size = new System.Drawing.Size(503, 302);
this.gbPrefControl4.TabIndex = 0;
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(454, 360);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 1;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(373, 360);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
//
// GBLPrefs
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(541, 395);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.tabControl1);
this.Name = "GBLPrefs";
this.Text = "Gameboy Link Settings";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.ResumeLayout(false);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Location = new System.Drawing.Point(12, 12);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(538, 349);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.gbPrefControl1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(530, 323);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Player 1 Gameboy";
this.tabPage1.UseVisualStyleBackColor = true;
//
// gbPrefControl1
//
this.gbPrefControl1.DialogParent = null;
this.gbPrefControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl1.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl1.Name = "gbPrefControl1";
this.gbPrefControl1.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl1.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.gbPrefControl2);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(530, 323);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Player 2 Gameboy";
this.tabPage2.UseVisualStyleBackColor = true;
//
// gbPrefControl2
//
this.gbPrefControl2.DialogParent = null;
this.gbPrefControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl2.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl2.Name = "gbPrefControl2";
this.gbPrefControl2.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl2.TabIndex = 0;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.gbPrefControl3);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(530, 323);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Player 3 Gameboy";
this.tabPage3.UseVisualStyleBackColor = true;
//
// gbPrefControl3
//
this.gbPrefControl3.DialogParent = null;
this.gbPrefControl3.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl3.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl3.Name = "gbPrefControl3";
this.gbPrefControl3.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl3.TabIndex = 0;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.gbPrefControl4);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(530, 323);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Player 4 Gameboy";
this.tabPage4.UseVisualStyleBackColor = true;
//
// gbPrefControl4
//
this.gbPrefControl4.DialogParent = null;
this.gbPrefControl4.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl4.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl4.Name = "gbPrefControl4";
this.gbPrefControl4.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl4.TabIndex = 0;
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(475, 375);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 1;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(394, 375);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
//
// GBLPrefs
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(562, 410);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.tabControl1);
this.Name = "GBLPrefs";
this.Text = "Gameboy Link Settings";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.ResumeLayout(false);
}

View File

@ -48,31 +48,24 @@ namespace BizHawk.Client.EmuHawk
private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged || gbPrefControl3.SyncSettingsChanged || gbPrefControl4.SyncSettingsChanged;
/// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoGBLPrefsDialog(
Config config,
IDialogParent dialogParent,
IGameInfo game,
IMovieSession movieSession,
ISettingsAdapter settable,
GambatteLink gambatte)
ISettingsAdapter settable)
{
var s = gambatte.GetSettings();
var ss = gambatte.GetSyncSettings();
var s = settable.GetSettings() as GambatteLink.GambatteLinkSettings;
var ss = settable.GetSyncSettings() as GambatteLink.GambatteLinkSyncSettings;
using var dlg = new GBLPrefs(dialogParent.DialogController, config, game, movieSession);
dlg.PutSettings(s, ss);
dlg.gbPrefControl1.ColorGameBoy = gambatte.IsCGBMode(0);
dlg.gbPrefControl2.ColorGameBoy = gambatte.IsCGBMode(1);
dlg.gbPrefControl3.ColorGameBoy = gambatte.IsCGBMode(2);
dlg.gbPrefControl4.ColorGameBoy = gambatte.IsCGBMode(3);
var result = dialogParent.ShowDialogAsChild(dlg);
if (result == DialogResult.OK)
{
dlg.GetSettings(out s, out ss);
gambatte.PutSettings(s);
settable.PutCoreSettings(s);
if (dlg.SyncSettingsChanged)
{
settable.PutCoreSyncSettings(ss);

View File

@ -30,10 +30,11 @@
{
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.buttonDefaults = new System.Windows.Forms.Button();
this.buttonPalette = new System.Windows.Forms.Button();
this.buttonGbPalette = new System.Windows.Forms.Button();
this.cbRgbdsSyntax = new System.Windows.Forms.CheckBox();
this.checkBoxMuted = new System.Windows.Forms.CheckBox();
this.cbShowBorder = new System.Windows.Forms.CheckBox();
this.buttonGbcPalette = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// propertyGrid1
@ -44,7 +45,7 @@
this.propertyGrid1.Location = new System.Drawing.Point(3, 3);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.propertyGrid1.Size = new System.Drawing.Size(402, 368);
this.propertyGrid1.Size = new System.Drawing.Size(516, 408);
this.propertyGrid1.TabIndex = 0;
this.propertyGrid1.ToolbarVisible = false;
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PropertyGrid1_PropertyValueChanged);
@ -52,7 +53,7 @@
// buttonDefaults
//
this.buttonDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDefaults.Location = new System.Drawing.Point(330, 377);
this.buttonDefaults.Location = new System.Drawing.Point(444, 417);
this.buttonDefaults.Name = "buttonDefaults";
this.buttonDefaults.Size = new System.Drawing.Size(75, 23);
this.buttonDefaults.TabIndex = 1;
@ -60,22 +61,33 @@
this.buttonDefaults.UseVisualStyleBackColor = true;
this.buttonDefaults.Click += new System.EventHandler(this.ButtonDefaults_Click);
//
// buttonPalette
// buttonGbPalette
//
this.buttonPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonPalette.Location = new System.Drawing.Point(3, 377);
this.buttonPalette.Name = "buttonPalette";
this.buttonPalette.Size = new System.Drawing.Size(75, 23);
this.buttonPalette.TabIndex = 2;
this.buttonPalette.Text = "Palette...";
this.buttonPalette.UseVisualStyleBackColor = true;
this.buttonPalette.Click += new System.EventHandler(this.ButtonPalette_Click);
//
// cbRgbdsSyntax
//
this.cbRgbdsSyntax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonGbPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonGbPalette.Location = new System.Drawing.Point(3, 417);
this.buttonGbPalette.Name = "buttonGbPalette";
this.buttonGbPalette.Size = new System.Drawing.Size(87, 23);
this.buttonGbPalette.TabIndex = 2;
this.buttonGbPalette.Text = "GB Palette...";
this.buttonGbPalette.UseVisualStyleBackColor = true;
this.buttonGbPalette.Click += new System.EventHandler(this.ButtonGbPalette_Click);
//
// buttonGbcPalette
//
this.buttonGbcPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonGbcPalette.Location = new System.Drawing.Point(96, 417);
this.buttonGbcPalette.Name = "buttonGbcPalette";
this.buttonGbcPalette.Size = new System.Drawing.Size(87, 23);
this.buttonGbcPalette.TabIndex = 6;
this.buttonGbcPalette.Text = "GBC Palette...";
this.buttonGbcPalette.UseVisualStyleBackColor = true;
this.buttonGbcPalette.Click += new System.EventHandler(this.ButtonGbcPalette_Click);
//
// cbRgbdsSyntax
//
this.cbRgbdsSyntax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbRgbdsSyntax.AutoSize = true;
this.cbRgbdsSyntax.Location = new System.Drawing.Point(138, 381);
this.cbRgbdsSyntax.Location = new System.Drawing.Point(245, 421);
this.cbRgbdsSyntax.Name = "cbRgbdsSyntax";
this.cbRgbdsSyntax.Size = new System.Drawing.Size(99, 17);
this.cbRgbdsSyntax.TabIndex = 3;
@ -87,7 +99,7 @@
//
this.checkBoxMuted.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxMuted.AutoSize = true;
this.checkBoxMuted.Location = new System.Drawing.Point(82, 381);
this.checkBoxMuted.Location = new System.Drawing.Point(189, 421);
this.checkBoxMuted.Name = "checkBoxMuted";
this.checkBoxMuted.Size = new System.Drawing.Size(50, 17);
this.checkBoxMuted.TabIndex = 4;
@ -99,7 +111,7 @@
//
this.cbShowBorder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbShowBorder.AutoSize = true;
this.cbShowBorder.Location = new System.Drawing.Point(243, 381);
this.cbShowBorder.Location = new System.Drawing.Point(350, 421);
this.cbShowBorder.Name = "cbShowBorder";
this.cbShowBorder.Size = new System.Drawing.Size(87, 17);
this.cbShowBorder.TabIndex = 5;
@ -110,14 +122,15 @@
// GBPrefControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.buttonGbcPalette);
this.Controls.Add(this.cbRgbdsSyntax);
this.Controls.Add(this.checkBoxMuted);
this.Controls.Add(this.cbShowBorder);
this.Controls.Add(this.buttonPalette);
this.Controls.Add(this.buttonGbPalette);
this.Controls.Add(this.buttonDefaults);
this.Controls.Add(this.propertyGrid1);
this.Name = "GBPrefControl";
this.Size = new System.Drawing.Size(408, 403);
this.Size = new System.Drawing.Size(522, 443);
this.ResumeLayout(false);
this.PerformLayout();
@ -127,7 +140,8 @@
private System.Windows.Forms.PropertyGrid propertyGrid1;
private System.Windows.Forms.Button buttonDefaults;
private System.Windows.Forms.Button buttonPalette;
private System.Windows.Forms.Button buttonGbPalette;
private System.Windows.Forms.Button buttonGbcPalette;
private System.Windows.Forms.CheckBox cbRgbdsSyntax;
private System.Windows.Forms.CheckBox checkBoxMuted;
private System.Windows.Forms.CheckBox cbShowBorder;

View File

@ -19,9 +19,6 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
[Browsable(false)]
public bool ColorGameBoy { get; set; }
/// <remarks>TODO <see cref="UserControl">UserControls</see> can be <see cref="IDialogParent">IDialogParents</see> too, the modal should still be tied to the parent <see cref="Form"/> if used that way</remarks>
[Browsable(false)]
public IDialogParent DialogParent { get; set; }
@ -61,16 +58,14 @@ namespace BizHawk.Client.EmuHawk
}
}
private void ButtonPalette_Click(object sender, EventArgs e)
private void ButtonGbPalette_Click(object sender, EventArgs e)
{
if (ColorGameBoy)
{
CGBColorChooserForm.DoCGBColorChooserFormDialog(DialogParent, _s);
}
else
{
ColorChooserForm.DoColorChooserFormDialog(DialogParent, _config, _game, _s);
}
ColorChooserForm.DoColorChooserFormDialog(DialogParent, _config, _game, _s);
}
private void ButtonGbcPalette_Click(object sender, EventArgs e)
{
CGBColorChooserForm.DoCGBColorChooserFormDialog(DialogParent, _s);
}
private void PropertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)

View File

@ -37,7 +37,7 @@
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(280, 363);
this.buttonOK.Location = new System.Drawing.Point(378, 386);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 1;
@ -48,7 +48,7 @@
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(361, 363);
this.buttonCancel.Location = new System.Drawing.Point(459, 386);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 2;
@ -60,10 +60,10 @@
this.gbPrefControl1.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.gbPrefControl1.ColorGameBoy = false;
this.gbPrefControl1.DialogParent = null;
this.gbPrefControl1.Location = new System.Drawing.Point(12, 12);
this.gbPrefControl1.Name = "gbPrefControl1";
this.gbPrefControl1.Size = new System.Drawing.Size(424, 345);
this.gbPrefControl1.Size = new System.Drawing.Size(522, 368);
this.gbPrefControl1.TabIndex = 0;
//
// GBPrefs
@ -72,7 +72,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(448, 398);
this.ClientSize = new System.Drawing.Size(546, 421);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.gbPrefControl1);

View File

@ -17,26 +17,23 @@ namespace BizHawk.Client.EmuHawk
Icon = Properties.Resources.GambatteIcon;
}
/// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoGBPrefsDialog(
Config config,
IDialogParent dialogParent,
IGameInfo game,
IMovieSession movieSession,
ISettingsAdapter settable,
Gameboy gb)
ISettingsAdapter settable)
{
var s = gb.GetSettings();
var ss = gb.GetSyncSettings();
var s = settable.GetSettings() as Gameboy.GambatteSettings;
var ss = settable.GetSyncSettings() as Gameboy.GambatteSyncSettings;
using var dlg = new GBPrefs(dialogParent.DialogController);
dlg.gbPrefControl1.PutSettings(config, game, movieSession, s, ss);
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode() || gb.IsSgb;
var result = dialogParent.ShowDialogAsChild(dlg);
if (result.IsOk())
{
dlg.gbPrefControl1.GetSettings(out s, out ss);
gb.PutSettings(s);
settable.PutCoreSettings(s);
if (dlg.gbPrefControl1.SyncSettingsChanged)
{
settable.PutCoreSyncSettings(ss);