diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index 19f2eb6ceb..4a40de741c 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -671,12 +671,12 @@ namespace BizHawk.Client.Common //TI 83 settings //GB settings - public bool GB_ForceDMG = false; - public bool GB_GBACGB = false; - public bool GB_MulticartCompat = false; - public string GB_PaletteFile = ""; + //public bool GB_ForceDMG = false; + //public bool GB_GBACGB = false; + //public bool GB_MulticartCompat = false; + //public string GB_PaletteFile = ""; public bool GB_AsSGB = false; - public GBColors.ColorType CGBColors = GBColors.ColorType.gambatte; + //public GBColors.ColorType CGBColors = GBColors.ColorType.gambatte; //Dual Gb diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index b7a7f881b8..c77604533c 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1498,28 +1498,33 @@ namespace BizHawk.Client.EmuHawk private void GBSubMenu_DropDownOpened(object sender, EventArgs e) { - GBForceDMGMenuItem.Checked = Global.Config.GB_ForceDMG; - GBAInCGBModeMenuItem.Checked = Global.Config.GB_GBACGB; - GBMulticartCompatibilityMenuItem.Checked = Global.Config.GB_MulticartCompat; + var s = (Gameboy.GambatteSyncSettings)Global.Emulator.GetSyncSettings(); + + GBForceDMGMenuItem.Checked = s.ForceDMG; + GBAInCGBModeMenuItem.Checked = s.GBACGB; + GBMulticartCompatibilityMenuItem.Checked = s.MulticartCompat; LoadGBInSGBMenuItem.Checked = Global.Config.GB_AsSGB; } private void GBForceDMGMenuItem_Click(object sender, EventArgs e) { - Global.Config.GB_ForceDMG ^= true; - FlagNeedsReboot(); + var s = (Gameboy.GambatteSyncSettings)Global.Emulator.GetSyncSettings(); + s.ForceDMG ^= true; + PutCoreSyncSettings(s); } private void GBAInCGBModeMenuItem_Click(object sender, EventArgs e) { - Global.Config.GB_GBACGB ^= true; - FlagNeedsReboot(); + var s = (Gameboy.GambatteSyncSettings)Global.Emulator.GetSyncSettings(); + s.GBACGB ^= true; + PutCoreSyncSettings(s); } private void GBMulticartCompatibilityMenuItem_Click(object sender, EventArgs e) { - Global.Config.GB_MulticartCompat ^= true; - FlagNeedsReboot(); + var s = (Gameboy.GambatteSyncSettings)Global.Emulator.GetSyncSettings(); + s.MulticartCompat ^= true; + PutCoreSyncSettings(s); } private void GBPaletteConfigMenuItem_Click(object sender, EventArgs e) @@ -1528,16 +1533,9 @@ namespace BizHawk.Client.EmuHawk { var gb = Global.Emulator as Gameboy; if (gb.IsCGBMode()) - { - if (CGBColorChooserForm.DoCGBColorChooserFormDialog(this)) - { - gb.SetCGBColors(Global.Config.CGBColors); - } - } + CGBColorChooserForm.DoCGBColorChooserFormDialog(this); else - { - ColorChooserForm.DoColorChooserFormDialog(gb.ChangeDMGColors, this); - } + ColorChooserForm.DoColorChooserFormDialog(this); } } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index e67d718ad5..b80ed063db 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2118,6 +2118,23 @@ namespace BizHawk.Client.EmuHawk FlagNeedsReboot(); } + /// + /// send core sync settings to emu, setting reboot flag if needed + /// + /// + private void PutCoreSyncSettings(object o) + { + if (Global.MovieSession.Movie.IsActive) + { + GlobalWin.OSD.AddMessage("Attempt to change sync-relevant setings while recording BLOCKED."); + } + else + { + if (Global.Emulator.PutSyncSettings(o)) + FlagNeedsReboot(); + } + } + private void SaveConfig() { if (Global.Config.SaveWindowPosition) @@ -3239,37 +3256,9 @@ namespace BizHawk.Client.EmuHawk var L = Database.GetGameInfo(XMLG.Assets["LeftRom"], "left.gb"); var R = Database.GetGameInfo(XMLG.Assets["RightRom"], "right.gb"); - if (Global.Config.GB_ForceDMG) - { - L.AddOption("ForceDMG"); - } - - if (Global.Config.GB_GBACGB) - { - L.AddOption("GBACGB"); - } - - if (Global.Config.GB_MulticartCompat) - { - L.AddOption("MulitcartCompat"); - } - - if (Global.Config.GB_ForceDMG) - { - R.AddOption("ForceDMG"); - } - - if (Global.Config.GB_GBACGB) - { - R.AddOption("GBACGB"); - } - - if (Global.Config.GB_MulticartCompat) - { - R.AddOption("MulitcartCompat"); - } - - var gbl = new GambatteLink(nextComm, L, XMLG.Assets["LeftRom"], R, XMLG.Assets["RightRom"]); + var gbl = new GambatteLink(nextComm, L, XMLG.Assets["LeftRom"], R, XMLG.Assets["RightRom"], + Global.Config.GetCoreSettings(), + Global.Config.GetCoreSyncSettings()); nextEmulator = gbl; // other stuff todo @@ -3385,42 +3374,10 @@ namespace BizHawk.Client.EmuHawk case "GBC": if (!Global.Config.GB_AsSGB) { - if (Global.Config.GB_ForceDMG) - { - game.AddOption("ForceDMG"); - } - - if (Global.Config.GB_GBACGB) - { - game.AddOption("GBACGB"); - } - - if (Global.Config.GB_MulticartCompat) - { - game.AddOption("MulitcartCompat"); - } - - var gb = new Gameboy(nextComm, game, rom.FileData); + var gb = new Gameboy(nextComm, game, rom.FileData, + Global.Config.GetCoreSettings(), + Global.Config.GetCoreSyncSettings()); nextEmulator = gb; - if (gb.IsCGBMode()) - { - gb.SetCGBColors(Global.Config.CGBColors); - } - else - { - try - { - using (var f = new StreamReader(Global.Config.GB_PaletteFile)) - { - int[] colors = ColorChooserForm.LoadPalFile(f); - if (colors != null) - { - gb.ChangeDMGColors(colors); - } - } - } - catch { } - } } else { @@ -3711,7 +3668,9 @@ namespace BizHawk.Client.EmuHawk // save settings object Type t = Global.Emulator.GetType(); Global.Config.PutCoreSettings(Global.Emulator.GetSettings(), t); - Global.Config.PutCoreSyncSettings(Global.Emulator.GetSyncSettings(), t); + // don't trample config with loaded-from-movie settings + if (!Global.MovieSession.Movie.IsActive) + Global.Config.PutCoreSyncSettings(Global.Emulator.GetSyncSettings(), t); } Global.Emulator.Dispose(); diff --git a/BizHawk.Client.EmuHawk/config/GB/CGBColorChooserForm.cs b/BizHawk.Client.EmuHawk/config/GB/CGBColorChooserForm.cs index 3e2ccc259b..f4c483fad2 100644 --- a/BizHawk.Client.EmuHawk/config/GB/CGBColorChooserForm.cs +++ b/BizHawk.Client.EmuHawk/config/GB/CGBColorChooserForm.cs @@ -13,7 +13,7 @@ namespace BizHawk.Client.EmuHawk { InitializeComponent(); bmpView1.ChangeBitmapSize(bmpView1.Size); - type = Global.Config.CGBColors; + type = ((Gameboy.GambatteSettings)Global.Emulator.GetSettings()).CGBColors; switch (type) { case GBColors.ColorType.gambatte: radioButton1.Checked = true; break; @@ -71,18 +71,17 @@ namespace BizHawk.Client.EmuHawk RefreshType(); } - public static bool DoCGBColorChooserFormDialog(IWin32Window parent) + public static void DoCGBColorChooserFormDialog(IWin32Window parent) { using (var dlg = new CGBColorChooserForm()) { var result = dlg.ShowDialog(parent); if (result == DialogResult.OK) { - Global.Config.CGBColors = dlg.type; - return true; + var s = (Gameboy.GambatteSettings)Global.Emulator.GetSettings(); + s.CGBColors = dlg.type; + Global.Emulator.PutSettings(s); } - else - return false; } } diff --git a/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.Designer.cs b/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.Designer.cs index 25be225e07..26afca7ffa 100644 --- a/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.Designer.cs @@ -28,327 +28,302 @@ /// private void InitializeComponent() { - this.panel1 = new System.Windows.Forms.Panel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.panel3 = new System.Windows.Forms.Panel(); - this.panel4 = new System.Windows.Forms.Panel(); - this.panel5 = new System.Windows.Forms.Panel(); - this.panel6 = new System.Windows.Forms.Panel(); - this.panel7 = new System.Windows.Forms.Panel(); - this.panel8 = new System.Windows.Forms.Panel(); - this.panel9 = new System.Windows.Forms.Panel(); - this.panel10 = new System.Windows.Forms.Panel(); - this.panel11 = new System.Windows.Forms.Panel(); - this.panel12 = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.OK = new System.Windows.Forms.Button(); - this.Cancel = new System.Windows.Forms.Button(); - this.buttonInterpolateBG = new System.Windows.Forms.Button(); - this.buttonInterpolateSP1 = new System.Windows.Forms.Button(); - this.buttonInterpolateSP2 = new System.Windows.Forms.Button(); - this.buttonLoad = new System.Windows.Forms.Button(); - this.buttonSave = new System.Windows.Forms.Button(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.DefaultButton = new System.Windows.Forms.Button(); - this.DefaultButtonCGB = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel1.Location = new System.Drawing.Point(42, 18); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(40, 32); - this.panel1.TabIndex = 0; - this.panel1.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel2 - // - this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel2.Location = new System.Drawing.Point(88, 18); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(40, 32); - this.panel2.TabIndex = 1; - this.panel2.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel3 - // - this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel3.Location = new System.Drawing.Point(134, 18); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(40, 32); - this.panel3.TabIndex = 2; - this.panel3.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel4 - // - this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel4.Location = new System.Drawing.Point(180, 18); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(40, 32); - this.panel4.TabIndex = 3; - this.panel4.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel5 - // - this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel5.Location = new System.Drawing.Point(42, 56); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(40, 32); - this.panel5.TabIndex = 4; - this.panel5.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel6 - // - this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel6.Location = new System.Drawing.Point(88, 56); - this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(40, 32); - this.panel6.TabIndex = 5; - this.panel6.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel7 - // - this.panel7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel7.Location = new System.Drawing.Point(134, 56); - this.panel7.Name = "panel7"; - this.panel7.Size = new System.Drawing.Size(40, 32); - this.panel7.TabIndex = 6; - this.panel7.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel8 - // - this.panel8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel8.Location = new System.Drawing.Point(180, 56); - this.panel8.Name = "panel8"; - this.panel8.Size = new System.Drawing.Size(40, 32); - this.panel8.TabIndex = 7; - this.panel8.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel9 - // - this.panel9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel9.Location = new System.Drawing.Point(42, 94); - this.panel9.Name = "panel9"; - this.panel9.Size = new System.Drawing.Size(40, 32); - this.panel9.TabIndex = 8; - this.panel9.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel10 - // - this.panel10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel10.Location = new System.Drawing.Point(88, 94); - this.panel10.Name = "panel10"; - this.panel10.Size = new System.Drawing.Size(40, 32); - this.panel10.TabIndex = 9; - this.panel10.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel11 - // - this.panel11.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel11.Location = new System.Drawing.Point(134, 94); - this.panel11.Name = "panel11"; - this.panel11.Size = new System.Drawing.Size(40, 32); - this.panel11.TabIndex = 10; - this.panel11.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // panel12 - // - this.panel12.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel12.Location = new System.Drawing.Point(180, 94); - this.panel12.Name = "panel12"; - this.panel12.Size = new System.Drawing.Size(40, 32); - this.panel12.TabIndex = 11; - this.panel12.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(14, 27); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(22, 13); - this.label1.TabIndex = 12; - this.label1.Text = "BG"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(9, 66); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(27, 13); - this.label2.TabIndex = 13; - this.label2.Text = "SP1"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(9, 103); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(27, 13); - this.label3.TabIndex = 14; - this.label3.Text = "SP2"; - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OK.Location = new System.Drawing.Point(143, 221); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 22; - this.OK.Text = "&OK"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.OK_Click); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(224, 221); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 23); - this.Cancel.TabIndex = 23; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - // - // buttonInterpolateBG - // - this.buttonInterpolateBG.Location = new System.Drawing.Point(226, 22); - this.buttonInterpolateBG.Name = "buttonInterpolateBG"; - this.buttonInterpolateBG.Size = new System.Drawing.Size(75, 23); - this.buttonInterpolateBG.TabIndex = 25; - this.buttonInterpolateBG.Text = "Interpolate"; - this.buttonInterpolateBG.UseVisualStyleBackColor = true; - this.buttonInterpolateBG.Click += new System.EventHandler(this.button3_Click); - // - // buttonInterpolateSP1 - // - this.buttonInterpolateSP1.Location = new System.Drawing.Point(226, 61); - this.buttonInterpolateSP1.Name = "buttonInterpolateSP1"; - this.buttonInterpolateSP1.Size = new System.Drawing.Size(75, 23); - this.buttonInterpolateSP1.TabIndex = 26; - this.buttonInterpolateSP1.Text = "Interpolate"; - this.buttonInterpolateSP1.UseVisualStyleBackColor = true; - this.buttonInterpolateSP1.Click += new System.EventHandler(this.button4_Click); - // - // buttonInterpolateSP2 - // - this.buttonInterpolateSP2.Location = new System.Drawing.Point(226, 98); - this.buttonInterpolateSP2.Name = "buttonInterpolateSP2"; - this.buttonInterpolateSP2.Size = new System.Drawing.Size(75, 23); - this.buttonInterpolateSP2.TabIndex = 27; - this.buttonInterpolateSP2.Text = "Interpolate"; - this.buttonInterpolateSP2.UseVisualStyleBackColor = true; - this.buttonInterpolateSP2.Click += new System.EventHandler(this.button5_Click); - // - // buttonLoad - // - this.buttonLoad.Location = new System.Drawing.Point(17, 137); - this.buttonLoad.Name = "buttonLoad"; - this.buttonLoad.Size = new System.Drawing.Size(60, 23); - this.buttonLoad.TabIndex = 28; - this.buttonLoad.Text = "&Load..."; - this.buttonLoad.UseVisualStyleBackColor = true; - this.buttonLoad.Click += new System.EventHandler(this.button6_Click); - // - // buttonSave - // - this.buttonSave.Location = new System.Drawing.Point(83, 137); - this.buttonSave.Name = "buttonSave"; - this.buttonSave.Size = new System.Drawing.Size(60, 23); - this.buttonSave.TabIndex = 29; - this.buttonSave.Text = "&Save..."; - this.buttonSave.UseVisualStyleBackColor = true; - this.buttonSave.Click += new System.EventHandler(this.button7_Click); - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.BackColor = System.Drawing.SystemColors.Control; - this.textBox1.Location = new System.Drawing.Point(17, 195); - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(282, 20); - this.textBox1.TabIndex = 30; - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(14, 179); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(95, 13); - this.label4.TabIndex = 31; - this.label4.Text = "Current palette file:"; - // - // DefaultButton - // - this.DefaultButton.Location = new System.Drawing.Point(149, 137); - this.DefaultButton.Name = "DefaultButton"; - this.DefaultButton.Size = new System.Drawing.Size(60, 23); - this.DefaultButton.TabIndex = 32; - this.DefaultButton.Text = "&Default"; - this.DefaultButton.UseVisualStyleBackColor = true; - this.DefaultButton.Click += new System.EventHandler(this.DefaultButton_Click); - // - // DefaultButtonCGB - // - this.DefaultButtonCGB.Location = new System.Drawing.Point(215, 137); - this.DefaultButtonCGB.Name = "DefaultButtonCGB"; - this.DefaultButtonCGB.Size = new System.Drawing.Size(75, 23); - this.DefaultButtonCGB.TabIndex = 33; - this.DefaultButtonCGB.Text = "Default &CGB"; - this.DefaultButtonCGB.UseVisualStyleBackColor = true; - this.DefaultButtonCGB.Click += new System.EventHandler(this.DefaultButtonCGB_Click); - // - // ColorChooserForm - // - this.AcceptButton = this.OK; - this.AllowDrop = true; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(313, 254); - this.Controls.Add(this.DefaultButtonCGB); - this.Controls.Add(this.DefaultButton); - this.Controls.Add(this.label4); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.buttonSave); - this.Controls.Add(this.buttonLoad); - this.Controls.Add(this.buttonInterpolateSP2); - this.Controls.Add(this.buttonInterpolateSP1); - this.Controls.Add(this.buttonInterpolateBG); - this.Controls.Add(this.Cancel); - this.Controls.Add(this.OK); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.panel12); - this.Controls.Add(this.panel11); - this.Controls.Add(this.panel10); - this.Controls.Add(this.panel9); - this.Controls.Add(this.panel8); - this.Controls.Add(this.panel7); - this.Controls.Add(this.panel6); - this.Controls.Add(this.panel5); - this.Controls.Add(this.panel4); - this.Controls.Add(this.panel3); - this.Controls.Add(this.panel2); - this.Controls.Add(this.panel1); - this.MinimumSize = new System.Drawing.Size(310, 264); - this.Name = "ColorChooserForm"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Gameboy Palette Config"; - this.Load += new System.EventHandler(this.ColorChooserForm_Load); - this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ColorChooserForm_DragDrop); - this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ColorChooserForm_DragEnter); - this.ResumeLayout(false); - this.PerformLayout(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.panel4 = new System.Windows.Forms.Panel(); + this.panel5 = new System.Windows.Forms.Panel(); + this.panel6 = new System.Windows.Forms.Panel(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel8 = new System.Windows.Forms.Panel(); + this.panel9 = new System.Windows.Forms.Panel(); + this.panel10 = new System.Windows.Forms.Panel(); + this.panel11 = new System.Windows.Forms.Panel(); + this.panel12 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.OK = new System.Windows.Forms.Button(); + this.Cancel = new System.Windows.Forms.Button(); + this.buttonInterpolateBG = new System.Windows.Forms.Button(); + this.buttonInterpolateSP1 = new System.Windows.Forms.Button(); + this.buttonInterpolateSP2 = new System.Windows.Forms.Button(); + this.buttonLoad = new System.Windows.Forms.Button(); + this.buttonSave = new System.Windows.Forms.Button(); + this.DefaultButton = new System.Windows.Forms.Button(); + this.DefaultButtonCGB = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel1.Location = new System.Drawing.Point(42, 18); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(40, 32); + this.panel1.TabIndex = 0; + this.panel1.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel2 + // + this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel2.Location = new System.Drawing.Point(88, 18); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(40, 32); + this.panel2.TabIndex = 1; + this.panel2.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel3 + // + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel3.Location = new System.Drawing.Point(134, 18); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(40, 32); + this.panel3.TabIndex = 2; + this.panel3.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel4 + // + this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel4.Location = new System.Drawing.Point(180, 18); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(40, 32); + this.panel4.TabIndex = 3; + this.panel4.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel5 + // + this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel5.Location = new System.Drawing.Point(42, 56); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(40, 32); + this.panel5.TabIndex = 4; + this.panel5.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel6 + // + this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel6.Location = new System.Drawing.Point(88, 56); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(40, 32); + this.panel6.TabIndex = 5; + this.panel6.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel7 + // + this.panel7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel7.Location = new System.Drawing.Point(134, 56); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(40, 32); + this.panel7.TabIndex = 6; + this.panel7.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel8 + // + this.panel8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel8.Location = new System.Drawing.Point(180, 56); + this.panel8.Name = "panel8"; + this.panel8.Size = new System.Drawing.Size(40, 32); + this.panel8.TabIndex = 7; + this.panel8.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel9 + // + this.panel9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel9.Location = new System.Drawing.Point(42, 94); + this.panel9.Name = "panel9"; + this.panel9.Size = new System.Drawing.Size(40, 32); + this.panel9.TabIndex = 8; + this.panel9.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel10 + // + this.panel10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel10.Location = new System.Drawing.Point(88, 94); + this.panel10.Name = "panel10"; + this.panel10.Size = new System.Drawing.Size(40, 32); + this.panel10.TabIndex = 9; + this.panel10.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel11 + // + this.panel11.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel11.Location = new System.Drawing.Point(134, 94); + this.panel11.Name = "panel11"; + this.panel11.Size = new System.Drawing.Size(40, 32); + this.panel11.TabIndex = 10; + this.panel11.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // panel12 + // + this.panel12.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel12.Location = new System.Drawing.Point(180, 94); + this.panel12.Name = "panel12"; + this.panel12.Size = new System.Drawing.Size(40, 32); + this.panel12.TabIndex = 11; + this.panel12.DoubleClick += new System.EventHandler(this.panel12_DoubleClick); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(14, 27); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(22, 13); + this.label1.TabIndex = 12; + this.label1.Text = "BG"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 66); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(27, 13); + this.label2.TabIndex = 13; + this.label2.Text = "SP1"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(9, 103); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(27, 13); + this.label3.TabIndex = 14; + this.label3.Text = "SP2"; + // + // OK + // + this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.OK.Location = new System.Drawing.Point(143, 221); + this.OK.Name = "OK"; + this.OK.Size = new System.Drawing.Size(75, 23); + this.OK.TabIndex = 22; + this.OK.Text = "&OK"; + this.OK.UseVisualStyleBackColor = true; + this.OK.Click += new System.EventHandler(this.OK_Click); + // + // Cancel + // + this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Cancel.Location = new System.Drawing.Point(224, 221); + this.Cancel.Name = "Cancel"; + this.Cancel.Size = new System.Drawing.Size(75, 23); + this.Cancel.TabIndex = 23; + this.Cancel.Text = "&Cancel"; + this.Cancel.UseVisualStyleBackColor = true; + // + // buttonInterpolateBG + // + this.buttonInterpolateBG.Location = new System.Drawing.Point(226, 22); + this.buttonInterpolateBG.Name = "buttonInterpolateBG"; + this.buttonInterpolateBG.Size = new System.Drawing.Size(75, 23); + this.buttonInterpolateBG.TabIndex = 25; + this.buttonInterpolateBG.Text = "Interpolate"; + this.buttonInterpolateBG.UseVisualStyleBackColor = true; + this.buttonInterpolateBG.Click += new System.EventHandler(this.button3_Click); + // + // buttonInterpolateSP1 + // + this.buttonInterpolateSP1.Location = new System.Drawing.Point(226, 61); + this.buttonInterpolateSP1.Name = "buttonInterpolateSP1"; + this.buttonInterpolateSP1.Size = new System.Drawing.Size(75, 23); + this.buttonInterpolateSP1.TabIndex = 26; + this.buttonInterpolateSP1.Text = "Interpolate"; + this.buttonInterpolateSP1.UseVisualStyleBackColor = true; + this.buttonInterpolateSP1.Click += new System.EventHandler(this.button4_Click); + // + // buttonInterpolateSP2 + // + this.buttonInterpolateSP2.Location = new System.Drawing.Point(226, 98); + this.buttonInterpolateSP2.Name = "buttonInterpolateSP2"; + this.buttonInterpolateSP2.Size = new System.Drawing.Size(75, 23); + this.buttonInterpolateSP2.TabIndex = 27; + this.buttonInterpolateSP2.Text = "Interpolate"; + this.buttonInterpolateSP2.UseVisualStyleBackColor = true; + this.buttonInterpolateSP2.Click += new System.EventHandler(this.button5_Click); + // + // buttonLoad + // + this.buttonLoad.Location = new System.Drawing.Point(17, 137); + this.buttonLoad.Name = "buttonLoad"; + this.buttonLoad.Size = new System.Drawing.Size(60, 23); + this.buttonLoad.TabIndex = 28; + this.buttonLoad.Text = "&Load..."; + this.buttonLoad.UseVisualStyleBackColor = true; + this.buttonLoad.Click += new System.EventHandler(this.button6_Click); + // + // buttonSave + // + this.buttonSave.Location = new System.Drawing.Point(83, 137); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(60, 23); + this.buttonSave.TabIndex = 29; + this.buttonSave.Text = "&Save..."; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.button7_Click); + // + // DefaultButton + // + this.DefaultButton.Location = new System.Drawing.Point(149, 137); + this.DefaultButton.Name = "DefaultButton"; + this.DefaultButton.Size = new System.Drawing.Size(60, 23); + this.DefaultButton.TabIndex = 32; + this.DefaultButton.Text = "&Default"; + this.DefaultButton.UseVisualStyleBackColor = true; + this.DefaultButton.Click += new System.EventHandler(this.DefaultButton_Click); + // + // DefaultButtonCGB + // + this.DefaultButtonCGB.Location = new System.Drawing.Point(215, 137); + this.DefaultButtonCGB.Name = "DefaultButtonCGB"; + this.DefaultButtonCGB.Size = new System.Drawing.Size(75, 23); + this.DefaultButtonCGB.TabIndex = 33; + this.DefaultButtonCGB.Text = "Default &CGB"; + this.DefaultButtonCGB.UseVisualStyleBackColor = true; + this.DefaultButtonCGB.Click += new System.EventHandler(this.DefaultButtonCGB_Click); + // + // ColorChooserForm + // + this.AcceptButton = this.OK; + this.AllowDrop = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.Cancel; + this.ClientSize = new System.Drawing.Size(313, 254); + this.Controls.Add(this.DefaultButtonCGB); + this.Controls.Add(this.DefaultButton); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.buttonLoad); + this.Controls.Add(this.buttonInterpolateSP2); + this.Controls.Add(this.buttonInterpolateSP1); + this.Controls.Add(this.buttonInterpolateBG); + this.Controls.Add(this.Cancel); + this.Controls.Add(this.OK); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.panel12); + this.Controls.Add(this.panel11); + this.Controls.Add(this.panel10); + this.Controls.Add(this.panel9); + this.Controls.Add(this.panel8); + this.Controls.Add(this.panel7); + this.Controls.Add(this.panel6); + this.Controls.Add(this.panel5); + this.Controls.Add(this.panel4); + this.Controls.Add(this.panel3); + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel1); + this.MinimumSize = new System.Drawing.Size(310, 264); + this.Name = "ColorChooserForm"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Gameboy Palette Config"; + this.Load += new System.EventHandler(this.ColorChooserForm_Load); + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ColorChooserForm_DragDrop); + this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ColorChooserForm_DragEnter); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -376,8 +351,6 @@ private System.Windows.Forms.Button buttonInterpolateSP2; private System.Windows.Forms.Button buttonLoad; private System.Windows.Forms.Button buttonSave; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Label label4; private System.Windows.Forms.Button DefaultButton; private System.Windows.Forms.Button DefaultButtonCGB; } diff --git a/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs b/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs index dbf5d74ab7..28944cbbe8 100644 --- a/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs +++ b/BizHawk.Client.EmuHawk/config/GB/ColorChooserForm.cs @@ -5,6 +5,7 @@ using System.Windows.Forms; using System.IO; using BizHawk.Client.Common; +using BizHawk.Emulation.Cores.Nintendo.Gameboy; namespace BizHawk.Client.EmuHawk { @@ -17,11 +18,6 @@ namespace BizHawk.Client.EmuHawk private readonly Color[] colors = new Color[12]; - /// - /// the most recently loaded or saved palette file - /// - string currentfile; - /// /// gambatte's default dmg colors /// @@ -42,8 +38,6 @@ namespace BizHawk.Client.EmuHawk 10798341, 8956165, 1922333, 337157 }; - - private void RefreshAllBackdrops() { panel1.BackColor = colors[0]; @@ -151,7 +145,6 @@ namespace BizHawk.Client.EmuHawk { colors[i] = dlg.Color; sender.BackColor = colors[i]; - label4.Text = "Current palette file (modified):"; } } } @@ -232,39 +225,26 @@ namespace BizHawk.Client.EmuHawk { colors[i] = Color.FromArgb(255, Color.FromArgb(_colors[i])); } - RefreshAllBackdrops(); } - public static bool DoColorChooserFormDialog(Action ColorUpdater, IWin32Window parent) + public static void DoColorChooserFormDialog(IWin32Window parent) { using (var dlg = new ColorChooserForm()) { - //if (colors != null) - // dlg.SetAllColors(colors); + var s = (Gameboy.GambatteSettings)Global.Emulator.GetSettings(); - dlg.SetAllColors(DefaultDMGColors); - dlg.textBox1.Text = "(none)"; - dlg.currentfile = ""; - - if (!string.IsNullOrEmpty(Global.Config.GB_PaletteFile)) - { - dlg.LoadColorFile(Global.Config.GB_PaletteFile, false); - } + dlg.SetAllColors(s.GBPalette); var result = dlg.ShowDialog(parent); - if (result != DialogResult.OK) - { - return false; - } - else + if (result == DialogResult.OK) { int[] colorints = new int[12]; for (int i = 0; i < 12; i++) colorints[i] = dlg.colors[i].ToArgb(); - ColorUpdater(colorints); - Global.Config.GB_PaletteFile = dlg.currentfile; - return true; + + s.GBPalette = colorints; + Global.Emulator.PutSettings(s); } } } @@ -280,9 +260,6 @@ namespace BizHawk.Client.EmuHawk throw new Exception(); SetAllColors(newcolors); - textBox1.Text = Path.GetFileName(filename); - currentfile = filename; - label4.Text = "Current palette file:"; } } catch @@ -303,9 +280,6 @@ namespace BizHawk.Client.EmuHawk // clear alpha because gambatte color files don't usually contain it savecolors[i] = colors[i].ToArgb() & 0xffffff; SavePalFile(f, savecolors); - currentfile = filename; - label4.Text = "Current palette file:"; - textBox1.Text = Path.GetFileName(filename); } } catch @@ -323,12 +297,8 @@ namespace BizHawk.Client.EmuHawk ofd.RestoreDirectory = true; var result = ofd.ShowDialog(this); - if (result != DialogResult.OK) - { - return; - } - - LoadColorFile(ofd.FileName, true); + if (result == DialogResult.OK) + LoadColorFile(ofd.FileName, true); } } @@ -356,25 +326,14 @@ namespace BizHawk.Client.EmuHawk { using (var sfd = new SaveFileDialog()) { - if (!String.IsNullOrWhiteSpace(currentfile)) - { - sfd.InitialDirectory = Path.GetDirectoryName(currentfile); - sfd.FileName = Path.GetFileName(currentfile); - } - else - { - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB"); - sfd.FileName = Global.Game.Name + ".pal"; - } + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["GB", "Palettes"].Path, "GB"); + sfd.FileName = Global.Game.Name + ".pal"; + sfd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*"; sfd.RestoreDirectory = true; var result = sfd.ShowDialog(this); - if (result != DialogResult.OK) - { - return; - } - - SaveColorFile(sfd.FileName); + if (result == DialogResult.OK) + SaveColorFile(sfd.FileName); } } @@ -384,15 +343,11 @@ namespace BizHawk.Client.EmuHawk private void DefaultButton_Click(object sender, EventArgs e) { - textBox1.Text = "(none)"; - currentfile = ""; SetAllColors(DefaultDMGColors); } private void DefaultButtonCGB_Click(object sender, EventArgs e) { - textBox1.Text = "(none)"; - currentfile = ""; SetAllColors(DefaultCGBColors); } diff --git a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index 9d77540187..fa8b8184fd 100644 --- a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -127,8 +127,12 @@ namespace BizHawk.Client.EmuHawk if (Global.Emulator is Gameboy) { - _movieToRecord.Header[HeaderKeys.GB_FORCEDMG] = Global.Config.GB_ForceDMG.ToString(); - _movieToRecord.Header[HeaderKeys.GB_GBA_IN_CGB] = Global.Config.GB_GBACGB.ToString(); + // probably won't fix any of this in movie 1.0?? (movie 2.0 only??) + // FIXME: the multicartcompat is in the syncsettings object. is that supposed to go here? + // FIXME: these are never read back and given to the core, anywhere + var s = (Gameboy.GambatteSyncSettings)Global.Emulator.GetSyncSettings(); + _movieToRecord.Header[HeaderKeys.GB_FORCEDMG] = s.ForceDMG.ToString(); + _movieToRecord.Header[HeaderKeys.GB_GBA_IN_CGB] = s.GBACGB.ToString(); } if (Global.Emulator is LibsnesCore) diff --git a/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs index 8d515009d0..e8c99b5da9 100644 --- a/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs @@ -118,6 +118,7 @@ namespace BizHawk.Emulation.Common public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } public class NullSound : ISoundProvider diff --git a/BizHawk.Emulation.Common/Interfaces/IEmulator.cs b/BizHawk.Emulation.Common/Interfaces/IEmulator.cs index b5088e86ed..3f4fe977b5 100644 --- a/BizHawk.Emulation.Common/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation.Common/Interfaces/IEmulator.cs @@ -165,6 +165,12 @@ namespace BizHawk.Emulation.Common /// true if a core reboot will be required to implement these bool PutSettings(object o); + /// + /// changes the movie-sync relevant settings. THIS SHOULD NEVER BE CALLED WHILE RECORDING + /// + /// an object of the same type as the return for GetSyncSettings + /// true if a core reboot will be required to implement these + bool PutSyncSettings(object o); } public enum DisplayType { NTSC, PAL, DENDY } diff --git a/BizHawk.Emulation.Common/LibRetroEmulator.cs b/BizHawk.Emulation.Common/LibRetroEmulator.cs index 8a7ebca8c1..2fa975d7fa 100644 --- a/BizHawk.Emulation.Common/LibRetroEmulator.cs +++ b/BizHawk.Emulation.Common/LibRetroEmulator.cs @@ -552,5 +552,6 @@ namespace BizHawk.Emulation.Common public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index 4be72391f9..12deb24cee 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -1040,6 +1040,7 @@ namespace BizHawk.Emulation.Cores.Calculators public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs index 9ae6d80605..1f326669e2 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs @@ -175,5 +175,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs index 8e65565c20..dea2f1826a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs @@ -134,6 +134,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs index d87d76debc..8c1229d158 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs @@ -429,5 +429,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800 public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs index e3094130fb..197d8a798c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs @@ -293,5 +293,6 @@ namespace BizHawk.Emulation.Cores.ColecoVision public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs index af84559172..52dfdf5fee 100644 --- a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs @@ -207,5 +207,6 @@ namespace BizHawk.Emulation.Cores.Intellivision public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs index d8d3296605..c95656c22c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs @@ -557,5 +557,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index 8cb6d703e9..ca203c8dda 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy return fn; } - public Gameboy(CoreComm comm, GameInfo game, byte[] romdata) + public Gameboy(CoreComm comm, GameInfo game, byte[] romdata, object Settings, object SyncSettings) { CoreComm = comm; @@ -64,22 +64,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy try { + this.SyncSettings = (GambatteSyncSettings)SyncSettings ?? GambatteSyncSettings.GetDefaults(); + LibGambatte.LoadFlags flags = 0; - if (game["ForceDMG"]) + if (this.SyncSettings.ForceDMG) flags |= LibGambatte.LoadFlags.FORCE_DMG; - if (game["GBACGB"]) + if (this.SyncSettings.GBACGB) flags |= LibGambatte.LoadFlags.GBA_CGB; - if (game["MulitcartCompat"]) + if (this.SyncSettings.MulticartCompat) flags |= LibGambatte.LoadFlags.MULTICART_COMPAT; - if (LibGambatte.gambatte_load(GambatteState, romdata, (uint)romdata.Length, GetCurrentTime(), flags) != 0) throw new Exception("gambatte_load() returned non-zero (is this not a gb or gbc rom?)"); // set real default colors (before anyone mucks with them at all) - ChangeDMGColors(new int[] { 10798341, 8956165, 1922333, 337157, 10798341, 8956165, 1922333, 337157, 10798341, 8956165, 1922333, 337157 }); - SetCGBColors(GBColors.ColorType.gambatte); + PutSettings(Settings ?? GambatteSettings.GetDefaults()); InitSound(); @@ -891,8 +891,68 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy } #endregion - public object GetSettings() { return null; } - public object GetSyncSettings() { return null; } - public bool PutSettings(object o) { return false; } + GambatteSettings Settings; + GambatteSyncSettings SyncSettings; + + public object GetSettings() { return Settings.Clone(); } + public object GetSyncSettings() { return SyncSettings.Clone(); } + public bool PutSettings(object o) + { + Settings = (GambatteSettings)o; + if (IsCGBMode()) + SetCGBColors(Settings.CGBColors); + else + ChangeDMGColors(Settings.GBPalette); + return false; + } + + public bool PutSyncSettings(object o) + { + SyncSettings = (GambatteSyncSettings)o; + return true; + } + + public class GambatteSettings + { + public int[] GBPalette; + public GBColors.ColorType CGBColors; + + public static GambatteSettings GetDefaults() + { + var ret = new GambatteSettings(); + ret.GBPalette = new[] + { + 10798341, 8956165, 1922333, 337157, + 10798341, 8956165, 1922333, 337157, + 10798341, 8956165, 1922333, 337157 + }; + ret.CGBColors = GBColors.ColorType.gambatte; + return ret; + } + + public GambatteSettings Clone() + { + var ret = (GambatteSettings)MemberwiseClone(); + ret.GBPalette = (int[])GBPalette.Clone(); + return ret; + } + } + + public class GambatteSyncSettings + { + public bool ForceDMG = false; + public bool GBACGB = false; + public bool MulticartCompat = false; + + public static GambatteSyncSettings GetDefaults() + { + return new GambatteSyncSettings(); + } + + public GambatteSyncSettings Clone() + { + return (GambatteSyncSettings)MemberwiseClone(); + } + } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs index c2905a11b9..dfef1daa3d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -35,11 +35,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy LibsnesCore.SnesSaveController LCont = new LibsnesCore.SnesSaveController(Gameboy.GbController); LibsnesCore.SnesSaveController RCont = new LibsnesCore.SnesSaveController(Gameboy.GbController); - public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom) + public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings) { + GambatteLinkSettings _Settings = (GambatteLinkSettings)Settings ?? GambatteLinkSettings.GetDefaults(); + GambatteLinkSyncSettings _SyncSettings = (GambatteLinkSyncSettings)SyncSettings ?? GambatteLinkSyncSettings.GetDefaults(); + CoreComm = comm; - L = new Gameboy(new CoreComm(comm.ShowMessage), leftinfo, leftrom); - R = new Gameboy(new CoreComm(comm.ShowMessage), rightinfo, rightrom); + L = new Gameboy(new CoreComm(comm.ShowMessage), leftinfo, leftrom, _Settings.L, _SyncSettings.L); + R = new Gameboy(new CoreComm(comm.ShowMessage), rightinfo, rightrom, _Settings.R, _SyncSettings.R); // connect link cable LibGambatte.gambatte_linkstatus(L.GambatteState, 259); @@ -418,8 +421,79 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy #endregion - public object GetSettings() { return null; } - public object GetSyncSettings() { return null; } - public bool PutSettings(object o) { return false; } + public object GetSettings() + { + return new GambatteLinkSettings + { + L = (Gameboy.GambatteSettings)L.GetSettings(), + R = (Gameboy.GambatteSettings)R.GetSettings() + }; + } + public object GetSyncSettings() + { + return new GambatteLinkSyncSettings + { + L = (Gameboy.GambatteSyncSettings)L.GetSyncSettings(), + R = (Gameboy.GambatteSyncSettings)R.GetSyncSettings() + }; + } + public bool PutSettings(object o) + { + var s = (GambatteLinkSettings)o; + return L.PutSettings(s.L) || R.PutSettings(s.R); + } + public bool PutSyncSettings(object o) + { + var s = (GambatteLinkSyncSettings)o; + return L.PutSyncSettings(s.L) || R.PutSyncSettings(s.R); + } + + public class GambatteLinkSettings + { + public Gameboy.GambatteSettings L; + public Gameboy.GambatteSettings R; + + public static GambatteLinkSettings GetDefaults() + { + return new GambatteLinkSettings + { + L = Gameboy.GambatteSettings.GetDefaults(), + R = Gameboy.GambatteSettings.GetDefaults() + }; + } + + public GambatteLinkSettings Clone() + { + return new GambatteLinkSettings + { + L = L.Clone(), + R = R.Clone() + }; + } + } + public class GambatteLinkSyncSettings + { + public Gameboy.GambatteSyncSettings L; + public Gameboy.GambatteSyncSettings R; + + public static GambatteLinkSyncSettings GetDefaults() + { + return new GambatteLinkSyncSettings + { + L = Gameboy.GambatteSyncSettings.GetDefaults(), + R = Gameboy.GambatteSyncSettings.GetDefaults() + }; + } + + public GambatteLinkSyncSettings Clone() + { + return new GambatteLinkSyncSettings + { + L = L.Clone(), + R = R.Clone() + }; + } + } + } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/LibGambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/LibGambatte.cs index 9cc47166ed..cffd2462b4 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/LibGambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/LibGambatte.cs @@ -103,7 +103,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy /// set cgb palette lookup /// /// opaque state pointer - /// uint32[32768], input color (r,g,b) is at lut[r | g << 5 | b << 10] + /// uint32[32768], input color (r,g,b) is at lut[r | g << 5 | b << 10] [DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void gambatte_setcgbpalette(IntPtr core, int[] lut); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs index f61ba3fc0c..221db469df 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs @@ -438,5 +438,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs index 9094eaf3c9..7bf07e14bb 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs @@ -902,6 +902,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES return false; } + public bool PutSyncSettings(object o) { return false; } public class NESSettings { @@ -926,7 +927,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public NESSettings Clone() { - return (NESSettings)MemberwiseClone(); + var ret = (NESSettings)MemberwiseClone(); + ret.Palette = (int[,])ret.Palette.Clone(); + return ret; } public NESSettings() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 116f1ae14b..7cb93e852f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -1049,5 +1049,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index 67880fe2cf..02ace73a60 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -644,6 +644,7 @@ namespace BizHawk.Emulation.Cores.PCEngine Settings = n; return ret; } + public bool PutSyncSettings(object o) { return false; } public class PCESettings { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs index 4eced56453..a552733de7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs @@ -483,5 +483,6 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } -} \ No newline at end of file +} diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 874ee2ae97..842e1b8b57 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -466,5 +466,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs index 89c07a5c06..9010e3608c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs @@ -635,5 +635,6 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index f8b48487fe..62bf6d74c5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -628,5 +628,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs index 6d249fdc4f..e04b0e68ca 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs @@ -215,5 +215,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSP public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index af6ef2dda6..afea0ee4a5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -285,6 +285,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSX public object GetSettings() { return null; } public object GetSyncSettings() { return null; } public bool PutSettings(object o) { return false; } + public bool PutSyncSettings(object o) { return false; } } - }