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

View File

@ -28,159 +28,159 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.gbPrefControl1 = new GBPrefControl(); this.gbPrefControl1 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.gbPrefControl2 = new GBPrefControl(); this.gbPrefControl2 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.gbPrefControl3 = new GBPrefControl(); this.gbPrefControl3 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.gbPrefControl4 = new GBPrefControl(); this.gbPrefControl4 = new BizHawk.Client.EmuHawk.GBPrefControl();
this.buttonCancel = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button(); this.buttonOK = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout(); this.tabPage4.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tabControl1 // tabControl1
// //
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 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.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4); this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Location = new System.Drawing.Point(12, 12); this.tabControl1.Location = new System.Drawing.Point(12, 12);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(517, 334); this.tabControl1.Size = new System.Drawing.Size(538, 349);
this.tabControl1.TabIndex = 0; this.tabControl1.TabIndex = 0;
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.gbPrefControl1); this.tabPage1.Controls.Add(this.gbPrefControl1);
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(509, 308); this.tabPage1.Size = new System.Drawing.Size(530, 323);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Player 1 Gameboy"; this.tabPage1.Text = "Player 1 Gameboy";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// gbPrefControl1 // gbPrefControl1
// //
this.gbPrefControl1.ColorGameBoy = false; this.gbPrefControl1.DialogParent = null;
this.gbPrefControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.gbPrefControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl1.Location = new System.Drawing.Point(3, 3); this.gbPrefControl1.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl1.Name = "gbPrefControl1"; this.gbPrefControl1.Name = "gbPrefControl1";
this.gbPrefControl1.Size = new System.Drawing.Size(503, 302); this.gbPrefControl1.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl1.TabIndex = 0; this.gbPrefControl1.TabIndex = 0;
// //
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.gbPrefControl2); this.tabPage2.Controls.Add(this.gbPrefControl2);
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(509, 308); this.tabPage2.Size = new System.Drawing.Size(530, 323);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Player 2 Gameboy"; this.tabPage2.Text = "Player 2 Gameboy";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
// gbPrefControl2 // gbPrefControl2
// //
this.gbPrefControl2.ColorGameBoy = false; this.gbPrefControl2.DialogParent = null;
this.gbPrefControl2.Dock = System.Windows.Forms.DockStyle.Fill; this.gbPrefControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl2.Location = new System.Drawing.Point(3, 3); this.gbPrefControl2.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl2.Name = "gbPrefControl2"; this.gbPrefControl2.Name = "gbPrefControl2";
this.gbPrefControl2.Size = new System.Drawing.Size(503, 302); this.gbPrefControl2.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl2.TabIndex = 0; this.gbPrefControl2.TabIndex = 0;
// //
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.gbPrefControl3); this.tabPage3.Controls.Add(this.gbPrefControl3);
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3); this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(509, 308); this.tabPage3.Size = new System.Drawing.Size(530, 323);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Player 3 Gameboy"; this.tabPage3.Text = "Player 3 Gameboy";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// gbPrefControl3 // gbPrefControl3
// //
this.gbPrefControl3.ColorGameBoy = false; this.gbPrefControl3.DialogParent = null;
this.gbPrefControl3.Dock = System.Windows.Forms.DockStyle.Fill; this.gbPrefControl3.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl3.Location = new System.Drawing.Point(3, 3); this.gbPrefControl3.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl3.Name = "gbPrefControl3"; this.gbPrefControl3.Name = "gbPrefControl3";
this.gbPrefControl3.Size = new System.Drawing.Size(503, 302); this.gbPrefControl3.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl3.TabIndex = 0; this.gbPrefControl3.TabIndex = 0;
// //
// tabPage4 // tabPage4
// //
this.tabPage4.Controls.Add(this.gbPrefControl4); this.tabPage4.Controls.Add(this.gbPrefControl4);
this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4"; this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3); this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(509, 308); this.tabPage4.Size = new System.Drawing.Size(530, 323);
this.tabPage4.TabIndex = 3; this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Player 4 Gameboy"; this.tabPage4.Text = "Player 4 Gameboy";
this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.UseVisualStyleBackColor = true;
// //
// gbPrefControl4 // gbPrefControl4
// //
this.gbPrefControl4.ColorGameBoy = false; this.gbPrefControl4.DialogParent = null;
this.gbPrefControl4.Dock = System.Windows.Forms.DockStyle.Fill; this.gbPrefControl4.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPrefControl4.Location = new System.Drawing.Point(3, 3); this.gbPrefControl4.Location = new System.Drawing.Point(3, 3);
this.gbPrefControl4.Name = "gbPrefControl4"; this.gbPrefControl4.Name = "gbPrefControl4";
this.gbPrefControl4.Size = new System.Drawing.Size(503, 302); this.gbPrefControl4.Size = new System.Drawing.Size(524, 317);
this.gbPrefControl4.TabIndex = 0; this.gbPrefControl4.TabIndex = 0;
// //
// buttonCancel // buttonCancel
// //
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(454, 360); this.buttonCancel.Location = new System.Drawing.Point(475, 375);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 1; this.buttonCancel.TabIndex = 1;
this.buttonCancel.Text = "Cancel"; this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.UseVisualStyleBackColor = true;
// //
// buttonOK // buttonOK
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(373, 360); this.buttonOK.Location = new System.Drawing.Point(394, 375);
this.buttonOK.Name = "buttonOK"; this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2; this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK"; this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.UseVisualStyleBackColor = true;
// //
// GBLPrefs // GBLPrefs
// //
this.AcceptButton = this.buttonOK; this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel; this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(541, 395); this.ClientSize = new System.Drawing.Size(562, 410);
this.Controls.Add(this.buttonOK); this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
this.Name = "GBLPrefs"; this.Name = "GBLPrefs";
this.Text = "Gameboy Link Settings"; this.Text = "Gameboy Link Settings";
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false); this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false); this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false); this.tabPage4.ResumeLayout(false);
this.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; private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged || gbPrefControl3.SyncSettingsChanged || gbPrefControl4.SyncSettingsChanged;
/// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoGBLPrefsDialog( public static DialogResult DoGBLPrefsDialog(
Config config, Config config,
IDialogParent dialogParent, IDialogParent dialogParent,
IGameInfo game, IGameInfo game,
IMovieSession movieSession, IMovieSession movieSession,
ISettingsAdapter settable, ISettingsAdapter settable)
GambatteLink gambatte)
{ {
var s = gambatte.GetSettings(); var s = settable.GetSettings() as GambatteLink.GambatteLinkSettings;
var ss = gambatte.GetSyncSettings(); var ss = settable.GetSyncSettings() as GambatteLink.GambatteLinkSyncSettings;
using var dlg = new GBLPrefs(dialogParent.DialogController, config, game, movieSession); using var dlg = new GBLPrefs(dialogParent.DialogController, config, game, movieSession);
dlg.PutSettings(s, ss); 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); var result = dialogParent.ShowDialogAsChild(dlg);
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
dlg.GetSettings(out s, out ss); dlg.GetSettings(out s, out ss);
gambatte.PutSettings(s); settable.PutCoreSettings(s);
if (dlg.SyncSettingsChanged) if (dlg.SyncSettingsChanged)
{ {
settable.PutCoreSyncSettings(ss); settable.PutCoreSyncSettings(ss);

View File

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

View File

@ -19,9 +19,6 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent(); 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> /// <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)] [Browsable(false)]
public IDialogParent DialogParent { get; set; } 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) ColorChooserForm.DoColorChooserFormDialog(DialogParent, _config, _game, _s);
{ }
CGBColorChooserForm.DoCGBColorChooserFormDialog(DialogParent, _s);
} private void ButtonGbcPalette_Click(object sender, EventArgs e)
else {
{ CGBColorChooserForm.DoCGBColorChooserFormDialog(DialogParent, _s);
ColorChooserForm.DoColorChooserFormDialog(DialogParent, _config, _game, _s);
}
} }
private void PropertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) 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.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.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.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 1; 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.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.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.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 2; 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) 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.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.gbPrefControl1.ColorGameBoy = false; this.gbPrefControl1.DialogParent = null;
this.gbPrefControl1.Location = new System.Drawing.Point(12, 12); this.gbPrefControl1.Location = new System.Drawing.Point(12, 12);
this.gbPrefControl1.Name = "gbPrefControl1"; 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; this.gbPrefControl1.TabIndex = 0;
// //
// GBPrefs // GBPrefs
@ -72,7 +72,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel; 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.buttonCancel);
this.Controls.Add(this.buttonOK); this.Controls.Add(this.buttonOK);
this.Controls.Add(this.gbPrefControl1); this.Controls.Add(this.gbPrefControl1);

View File

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