From c57519c54f7b525f2e44688bb6379b446702523c Mon Sep 17 00:00:00 2001
From: adelikat <adelikat@tasvideos.org>
Date: Sat, 10 Oct 2015 12:20:59 -0400
Subject: [PATCH] C64 - add a c64 menu with a settings menu and dialog

---
 BizHawk.Client.EmuHawk/MainForm.Designer.cs   | 20 +++++++++++++++++++
 BizHawk.Client.EmuHawk/MainForm.Events.cs     |  9 +++++++++
 BizHawk.Client.EmuHawk/MainForm.cs            |  4 ++++
 .../config/GenericCoreConfig.Designer.cs      |  3 +++
 .../Computers/Commodore64/C64.ISettable.cs    | 12 ++++++-----
 .../Computers/Commodore64/C64.cs              |  2 +-
 6 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs
index cdff502530..b348c2cc33 100644
--- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs
@@ -330,6 +330,8 @@
 			this.ForumsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
 			this.FeaturesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
 			this.AboutMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+			this.C64SubMenu = new System.Windows.Forms.ToolStripMenuItem();
+			this.C64SettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
 			this.MainStatusBar = new StatusStripEx();
 			this.DumpStatusButton = new System.Windows.Forms.ToolStripDropDownButton();
 			this.EmuStatus = new System.Windows.Forms.ToolStripStatusLabel();
@@ -433,6 +435,7 @@
             this.GenesisSubMenu,
             this.wonderSwanToolStripMenuItem,
             this.AppleSubMenu,
+            this.C64SubMenu,
             this.HelpSubMenu});
 			this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
 			this.MainformMenu.Location = new System.Drawing.Point(0, 0);
@@ -2926,6 +2929,21 @@
 			this.AboutMenuItem.Text = "&About";
 			this.AboutMenuItem.Click += new System.EventHandler(this.AboutMenuItem_Click);
 			// 
+			// C64SubMenu
+			// 
+			this.C64SubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.C64SettingsMenuItem});
+			this.C64SubMenu.Name = "C64SubMenu";
+			this.C64SubMenu.Size = new System.Drawing.Size(39, 19);
+			this.C64SubMenu.Text = "&C64";
+			// 
+			// C64SettingsMenuItem
+			// 
+			this.C64SettingsMenuItem.Name = "C64SettingsMenuItem";
+			this.C64SettingsMenuItem.Size = new System.Drawing.Size(152, 22);
+			this.C64SettingsMenuItem.Text = "&Settings...";
+			this.C64SettingsMenuItem.Click += new System.EventHandler(this.C64SettingsMenuItem_Click);
+			// 
 			// MainStatusBar
 			// 
 			this.MainStatusBar.ClickThrough = true;
@@ -3973,6 +3991,8 @@
 		private System.Windows.Forms.ToolStripMenuItem Speed400MenuItem;
 		private System.Windows.Forms.ToolStripMenuItem BasicBotMenuItem;
 		private System.Windows.Forms.ToolStripMenuItem DisplayMessagesMenuItem;
+		private System.Windows.Forms.ToolStripMenuItem C64SubMenu;
+		private System.Windows.Forms.ToolStripMenuItem C64SettingsMenuItem;
 	}
 }
 
diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs
index 39adb03adf..60cd748d54 100644
--- a/BizHawk.Client.EmuHawk/MainForm.Events.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs
@@ -2063,6 +2063,15 @@ namespace BizHawk.Client.EmuHawk
 
 		#endregion
 
+		#region C64
+
+		private void C64SettingsMenuItem_Click(object sender, EventArgs e)
+		{
+			GenericCoreConfig.DoDialog(this, "C64 Settings");
+		}
+
+		#endregion
+
 		#region Help
 
 		private void OnlineHelpMenuItem_Click(object sender, EventArgs e)
diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs
index 6d63a1b68b..19af808367 100644
--- a/BizHawk.Client.EmuHawk/MainForm.cs
+++ b/BizHawk.Client.EmuHawk/MainForm.cs
@@ -1595,6 +1595,7 @@ namespace BizHawk.Client.EmuHawk
 			GenesisSubMenu.Visible = false;
 			wonderSwanToolStripMenuItem.Visible = false;
 			AppleSubMenu.Visible = false;
+			C64SubMenu.Visible = false;
 
 			switch (system)
 			{
@@ -1675,6 +1676,9 @@ namespace BizHawk.Client.EmuHawk
 				case "AppleII":
 					AppleSubMenu.Visible = true;
 					break;
+				case "C64":
+					C64SubMenu.Visible = true;
+					break;
 			}
 		}
 
diff --git a/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs b/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs
index 359cc23605..0232504ff4 100644
--- a/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs
+++ b/BizHawk.Client.EmuHawk/config/GenericCoreConfig.Designer.cs
@@ -67,6 +67,7 @@
 			// 
 			// propertyGrid1
 			// 
+			this.propertyGrid1.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
 			this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
 			this.propertyGrid1.Location = new System.Drawing.Point(3, 3);
 			this.propertyGrid1.Name = "propertyGrid1";
@@ -88,6 +89,7 @@
 			// 
 			// propertyGrid2
 			// 
+			this.propertyGrid2.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
 			this.propertyGrid2.Dock = System.Windows.Forms.DockStyle.Fill;
 			this.propertyGrid2.Location = new System.Drawing.Point(3, 3);
 			this.propertyGrid2.Name = "propertyGrid2";
@@ -143,6 +145,7 @@
 			this.Controls.Add(this.tabControl1);
 			this.Name = "GenericCoreConfig";
 			this.ShowIcon = false;
+			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
 			this.Text = "GenericCoreConfig";
 			this.Load += new System.EventHandler(this.GenericCoreConfig_Load);
 			this.tabControl1.ResumeLayout(false);
diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.ISettable.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.ISettable.cs
index a19d5ebc69..b6e382a294 100644
--- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.ISettable.cs
+++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.ISettable.cs
@@ -9,11 +9,13 @@ using System.Drawing;
 
 namespace BizHawk.Emulation.Cores.Computers.Commodore64
 {
-	public partial class C64 : ISettable<C64.C64Settings, C64.C64SyncSettings>
+	// adelikat: changing settings to default object untl there are actually settings, as the ui depends on it to know if there are any settings avaialable
+	public partial class C64 : ISettable<object, C64.C64SyncSettings>
 	{
-		public C64Settings GetSettings()
+		public object /*C64Settings*/ GetSettings()
 		{
-			return Settings.Clone();
+			//return Settings.Clone();
+			return null;
 		}
 
 		public C64SyncSettings GetSyncSettings()
@@ -21,9 +23,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
 			return SyncSettings.Clone();
 		}
 
-		public bool PutSettings(C64Settings o)
+		public bool PutSettings(object /*C64Settings*/ o)
 		{
-			Settings = o;
+			//Settings = o;
 			return false;
 		}
 
diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
index cfbfac420e..2294bb131f 100644
--- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
+++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
@@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
 		isReleased: false
 		)]
 	[ServiceNotApplicable(typeof(ISettable<,>))]
-	sealed public partial class C64 : IEmulator, IStatable, IInputPollable, IDriveLight, IDebuggable, IDisassemblable, IRegionable, ISettable<C64.C64Settings, C64.C64SyncSettings>
+	sealed public partial class C64 : IEmulator, IStatable, IInputPollable, IDriveLight, IDebuggable, IDisassemblable, IRegionable, ISettable<object, C64.C64SyncSettings>
 	{
 		// framework
 		public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension, object Settings, object SyncSettings)