From 9e8de8d8b0f4786beb34f61d10b18d56d376b9b3 Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 26 May 2014 14:06:54 +0000 Subject: [PATCH] TI83 - palette config dialog - don't judge me on how I spend my free time! --- BizHawk.Client.Common/RomLoader.cs | 2 +- .../BizHawk.Client.EmuHawk.csproj | 9 + BizHawk.Client.EmuHawk/MainForm.Designer.cs | 40 ++-- BizHawk.Client.EmuHawk/MainForm.Events.cs | 12 ++ .../config/TI83/TI83PaletteConfig.Designer.cs | 145 +++++++++++++ .../config/TI83/TI83PaletteConfig.cs | 96 +++++++++ .../config/TI83/TI83PaletteConfig.resx | 196 ++++++++++++++++++ BizHawk.Emulation.Cores/Calculator/TI83.cs | 72 +++++-- 8 files changed, 536 insertions(+), 36 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.Designer.cs create mode 100644 BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs create mode 100644 BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.resx diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index 892a97859f..94c48a8ac3 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -337,7 +337,7 @@ namespace BizHawk.Client.Common nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", GetCoreSyncSettings()); break; case "TI83": - nextEmulator = new TI83(nextComm, game, rom.RomData); + nextEmulator = new TI83(nextComm, game, rom.RomData, GetCoreSettings()); break; case "NES": if (!Global.Config.NES_InQuickNES || forceAccurateCore) diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 7593cabbdd..4553b09627 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -408,6 +408,12 @@ SoundConfig.cs + + Form + + + TI83PaletteConfig.cs + Component @@ -1088,6 +1094,9 @@ SNESOptions.cs + + TI83PaletteConfig.cs + InputConfigBase.cs diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index ee96447814..34b314d77c 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -232,10 +232,10 @@ this.SMSFix3DGameDisplayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ShowClippedRegionsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.HighlightActiveDisplayRegionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator24 = new System.Windows.Forms.ToolStripSeparator(); this.SMSGraphicsSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.GGGameGenieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator24 = new System.Windows.Forms.ToolStripSeparator(); this.SMSVDPViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.GGGameGenieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.TI83SubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.KeypadMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); @@ -356,6 +356,7 @@ this.ClearSRAMContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator(); this.ShowMenuContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.paletteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainformMenu.SuspendLayout(); this.MainStatusBar.SuspendLayout(); this.MainFormContextMenu.SuspendLayout(); @@ -387,7 +388,7 @@ this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.MainformMenu.Location = new System.Drawing.Point(0, 0); this.MainformMenu.Name = "MainformMenu"; - this.MainformMenu.Size = new System.Drawing.Size(470, 42); + this.MainformMenu.Size = new System.Drawing.Size(470, 61); this.MainformMenu.TabIndex = 0; this.MainformMenu.Text = "menuStrip1"; this.MainformMenu.MenuActivate += new System.EventHandler(this.MainformMenu_MenuActivate); @@ -2099,11 +2100,6 @@ this.HighlightActiveDisplayRegionMenuItem.Text = "&Highlight Active Display Region"; this.HighlightActiveDisplayRegionMenuItem.Click += new System.EventHandler(this.HighlightActiveDisplayRegionMenuItem_Click); // - // toolStripSeparator24 - // - this.toolStripSeparator24.Name = "toolStripSeparator24"; - this.toolStripSeparator24.Size = new System.Drawing.Size(238, 6); - // // SMSGraphicsSettingsMenuItem // this.SMSGraphicsSettingsMenuItem.Name = "SMSGraphicsSettingsMenuItem"; @@ -2111,12 +2107,10 @@ this.SMSGraphicsSettingsMenuItem.Text = "&Graphics Settings..."; this.SMSGraphicsSettingsMenuItem.Click += new System.EventHandler(this.SMSGraphicsSettingsMenuItem_Click); // - // GGGameGenieMenuItem + // toolStripSeparator24 // - this.GGGameGenieMenuItem.Name = "GGGameGenieMenuItem"; - this.GGGameGenieMenuItem.Size = new System.Drawing.Size(241, 22); - this.GGGameGenieMenuItem.Text = "&Game Genie Encoder/Decoder"; - this.GGGameGenieMenuItem.Click += new System.EventHandler(this.GGGameGenieMenuItem_Click); + this.toolStripSeparator24.Name = "toolStripSeparator24"; + this.toolStripSeparator24.Size = new System.Drawing.Size(238, 6); // // SMSVDPViewerToolStripMenuItem // @@ -2125,13 +2119,21 @@ this.SMSVDPViewerToolStripMenuItem.Text = "&VDP Viewer"; this.SMSVDPViewerToolStripMenuItem.Click += new System.EventHandler(this.SmsVdpViewerMenuItem_Click); // + // GGGameGenieMenuItem + // + this.GGGameGenieMenuItem.Name = "GGGameGenieMenuItem"; + this.GGGameGenieMenuItem.Size = new System.Drawing.Size(241, 22); + this.GGGameGenieMenuItem.Text = "&Game Genie Encoder/Decoder"; + this.GGGameGenieMenuItem.Click += new System.EventHandler(this.GGGameGenieMenuItem_Click); + // // TI83SubMenu // this.TI83SubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.KeypadMenuItem, + this.LoadTIFileMenuItem, this.toolStripSeparator13, this.AutoloadKeypadMenuItem, - this.LoadTIFileMenuItem}); + this.paletteToolStripMenuItem}); this.TI83SubMenu.Name = "TI83SubMenu"; this.TI83SubMenu.Size = new System.Drawing.Size(41, 19); this.TI83SubMenu.Text = "TI83"; @@ -2163,7 +2165,7 @@ // this.LoadTIFileMenuItem.Name = "LoadTIFileMenuItem"; this.LoadTIFileMenuItem.Size = new System.Drawing.Size(165, 22); - this.LoadTIFileMenuItem.Text = "Load TI File"; + this.LoadTIFileMenuItem.Text = "Load TI File..."; this.LoadTIFileMenuItem.Click += new System.EventHandler(this.LoadTIFileMenuItem_Click); // // AtariSubMenu @@ -3113,6 +3115,13 @@ this.ShowMenuContextMenuItem.Text = "Show Menu"; this.ShowMenuContextMenuItem.Click += new System.EventHandler(this.ShowMenuContextMenuItem_Click); // + // paletteToolStripMenuItem + // + this.paletteToolStripMenuItem.Name = "paletteToolStripMenuItem"; + this.paletteToolStripMenuItem.Size = new System.Drawing.Size(165, 22); + this.paletteToolStripMenuItem.Text = "Palette..."; + this.paletteToolStripMenuItem.Click += new System.EventHandler(this.paletteToolStripMenuItem_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F); @@ -3480,6 +3489,7 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator22; private System.Windows.Forms.ToolStripSeparator toolStripSeparator23; private System.Windows.Forms.ToolStripMenuItem N64CircularAnalogRangeMenuItem; + private System.Windows.Forms.ToolStripMenuItem paletteToolStripMenuItem; } } diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 0c2f06cdef..b749c5c1b9 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1414,6 +1414,18 @@ namespace BizHawk.Client.EmuHawk } } + private void paletteToolStripMenuItem_Click(object sender, EventArgs e) + { + if (new TI83PaletteConfig().ShowDialog() == DialogResult.OK) + { + GlobalWin.OSD.AddMessage("Palette settings saved"); + } + else + { + GlobalWin.OSD.AddMessage("Palette config aborted"); + } + } + #endregion #region Atari diff --git a/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.Designer.cs b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.Designer.cs new file mode 100644 index 0000000000..304a187349 --- /dev/null +++ b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.Designer.cs @@ -0,0 +1,145 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class TI83PaletteConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TI83PaletteConfig)); + this.CancelBtn = new System.Windows.Forms.Button(); + this.OkBtn = new System.Windows.Forms.Button(); + this.BackgroundPanel = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.ForeGroundPanel = new System.Windows.Forms.Panel(); + this.DefaultsBtn = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // CancelBtn + // + this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.CancelBtn.Location = new System.Drawing.Point(165, 112); + this.CancelBtn.Name = "CancelBtn"; + this.CancelBtn.Size = new System.Drawing.Size(60, 23); + this.CancelBtn.TabIndex = 0; + this.CancelBtn.Text = "&Cancel"; + this.CancelBtn.UseVisualStyleBackColor = true; + this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); + // + // OkBtn + // + this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.OkBtn.Location = new System.Drawing.Point(99, 112); + this.OkBtn.Name = "OkBtn"; + this.OkBtn.Size = new System.Drawing.Size(60, 23); + this.OkBtn.TabIndex = 1; + this.OkBtn.Text = "&Ok"; + this.OkBtn.UseVisualStyleBackColor = true; + this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click); + // + // BackgroundPanel + // + this.BackgroundPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.BackgroundPanel.Location = new System.Drawing.Point(12, 12); + this.BackgroundPanel.Name = "BackgroundPanel"; + this.BackgroundPanel.Size = new System.Drawing.Size(40, 32); + this.BackgroundPanel.TabIndex = 2; + this.BackgroundPanel.Click += new System.EventHandler(this.BackgroundPanel_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(58, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(65, 13); + this.label1.TabIndex = 13; + this.label1.Text = "Background"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(58, 60); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(61, 13); + this.label2.TabIndex = 15; + this.label2.Text = "Foreground"; + // + // ForeGroundPanel + // + this.ForeGroundPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.ForeGroundPanel.Location = new System.Drawing.Point(12, 50); + this.ForeGroundPanel.Name = "ForeGroundPanel"; + this.ForeGroundPanel.Size = new System.Drawing.Size(40, 32); + this.ForeGroundPanel.TabIndex = 14; + this.ForeGroundPanel.Click += new System.EventHandler(this.ForeGroundPanel_Click); + // + // DefaultsBtn + // + this.DefaultsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.DefaultsBtn.Location = new System.Drawing.Point(165, 12); + this.DefaultsBtn.Name = "DefaultsBtn"; + this.DefaultsBtn.Size = new System.Drawing.Size(60, 23); + this.DefaultsBtn.TabIndex = 16; + this.DefaultsBtn.Text = "&Defaults"; + this.DefaultsBtn.UseVisualStyleBackColor = true; + this.DefaultsBtn.Click += new System.EventHandler(this.DefaultsBtn_Click); + // + // TI83PaletteConfig + // + this.AcceptButton = this.OkBtn; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.CancelBtn; + this.ClientSize = new System.Drawing.Size(237, 147); + this.Controls.Add(this.DefaultsBtn); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.ForeGroundPanel); + this.Controls.Add(this.BackgroundPanel); + this.Controls.Add(this.OkBtn); + this.Controls.Add(this.CancelBtn); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "TI83PaletteConfig"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Palette Config"; + this.Load += new System.EventHandler(this.TI83PaletteConfig_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button CancelBtn; + private System.Windows.Forms.Button OkBtn; + private System.Windows.Forms.Panel BackgroundPanel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Panel ForeGroundPanel; + private System.Windows.Forms.Button DefaultsBtn; + } +} \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs new file mode 100644 index 0000000000..96f1f2b193 --- /dev/null +++ b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +using BizHawk.Client.Common; +using BizHawk.Emulation.Cores.Calculators; + +namespace BizHawk.Client.EmuHawk +{ + public partial class TI83PaletteConfig : Form + { + public TI83PaletteConfig() + { + InitializeComponent(); + } + + private void TI83PaletteConfig_Load(object sender, EventArgs e) + { + var s = (TI83.TI83Settings)Global.Emulator.GetSettings(); + BackgroundPanel.BackColor = Color.FromArgb((int)s.BGColor); + ForeGroundPanel.BackColor = Color.FromArgb((int)s.ForeColor); + } + + private void OkBtn_Click(object sender, EventArgs e) + { + var s = (TI83.TI83Settings)Global.Emulator.GetSettings(); + s.BGColor = (uint)BackgroundPanel.BackColor.ToArgb(); + s.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb(); + + Global.Emulator.PutSettings(s); + + DialogResult = DialogResult.OK; + Close(); + } + + private void CancelBtn_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void BackgroundPanel_Click(object sender, EventArgs e) + { + // custom colors are ints, not Color structs? + // and they don't work right unless the alpha bits are set to 0 + // and the rgb order is switched + int customColor = BackgroundPanel.BackColor.R | BackgroundPanel.BackColor.G << 8 | BackgroundPanel.BackColor.B << 16; + + var dlg = new ColorDialog + { + AllowFullOpen = true, + AnyColor = true, + Color = BackgroundPanel.BackColor, + CustomColors = new int[] { customColor } + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + BackgroundPanel.BackColor = dlg.Color; + } + } + + private void ForeGroundPanel_Click(object sender, EventArgs e) + { + // custom colors are ints, not Color structs? + // and they don't work right unless the alpha bits are set to 0 + // and the rgb order is switched + int customColor = ForeGroundPanel.BackColor.R | ForeGroundPanel.BackColor.G << 8 | ForeGroundPanel.BackColor.B << 16; + + var dlg = new ColorDialog + { + AllowFullOpen = true, + AnyColor = true, + Color = ForeGroundPanel.BackColor, + CustomColors = new int[] { customColor } + }; + + if (dlg.ShowDialog() == DialogResult.OK) + { + ForeGroundPanel.BackColor = dlg.Color; + } + } + + private void DefaultsBtn_Click(object sender, EventArgs e) + { + var s = TI83.TI83Settings.GetDefaults(); + BackgroundPanel.BackColor = Color.FromArgb((int)s.BGColor); + ForeGroundPanel.BackColor = Color.FromArgb((int)s.ForeColor); + } + } +} diff --git a/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.resx b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.resx new file mode 100644 index 0000000000..cda693680c --- /dev/null +++ b/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.resx @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIAGBgAAAEACADIBgAAJgAAABgYAAABACAAiAkAAO4GAAAoAAAAGAAAADAAAAABAAgAAAAAAKAC + AAAAAAAAAAAAAAABAAAAAAAA1pI+ANqaQQD47N4AAAAAANulXADTm1oA461VAOe5ZADtyoAA0ow6ABol + 8gD68uoA7sdtANaaTwDitGwA+OnVANOUSwD67McA9ufMAMF1LgDuxWIA7MFdAPbq3QDCejEAxnw0AMaA + OgDquVEA7c+bALJiJwD568MA9uXHAPTixwDz4ccA3a1tAN6uaQDv0IQA8NGNAOvJjQDlwIsAyYQ+AMeB + PADBcy0A2Y0UAPfq2wD46tkA892kAOrGiQDHgDgA4J4nAOzLkADz38AA89/BAOzLjwD148gA79SlAPrv + 4wDqz6cA9eLAAO7GZADv1rEA57FCAO7IbwDtvloA9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+ AAAAAAAAAAAAAAAAAADpvWa54rRs//HQeP/uxmT/7MFZ/+q5Uf/otEb/5q49/+OnNf/ioSz/35sj/92V + G//bkBf/2Y0U/9mNFP/Sii//36FGqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADrwGm56MN+//jp + wP/25LL/9Nyb//LSg//uyGz/7L5V/+q4S//nsUL/5as5/+OkL//gnif/3pgf/9ySGf/Ylzn/4KRHuQAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADsw2y47MuH//rsx//67MX/+evD//jnvf/35bj/9uOy//Pd + pP/y15T/8NOM/+/QhP/uzXv/79CE/+3Pgf/jrVX/4qdKxgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AADux2257s2E//rsx//67Mf/+uzH//rsx//568P/+OnA//fnuv/247X/9eGv//Tfqv/z3aT/8tmd//DW + l//lsln/46tK0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADtvlq29uXH/+7GZv/uxmT/7sZk/+7G + ZP/uxmT/7sZk/+7FYv/twmD/7cJg/+zBXf/svlz/675Z/+q6V//qwnr/5a1NqwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA7b5aiO7Ib//uyG//7sdt/+7Hbf/ux23/7sVq/+3Daf/swmb/7MBj/+u+ + YP/qvF3/6rlZ/+m2Vv/ps1G2AAAAAAAAAAAAAAAAAAAAAAAAAADwAB8A4AAPAOAADwDgAA8A4AAPAOAA + DwDgAA8A4AAPAOAADwDgAA8A4AAPAOAADwDgAA8A4AAPAOAADwDgAA8A4AAPAOAADwDgAA8A4AAPAOAA + DwDgAA8A4AAPAPAAHwA= + + + \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index cb0fcf17b4..7132117643 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -345,8 +345,10 @@ namespace BizHawk.Emulation.Cores.Calculators } } - public TI83(CoreComm comm, GameInfo game, byte[] rom) + public TI83(CoreComm comm, GameInfo game, byte[] rom, object Settings) { + PutSettings(Settings ?? TI83Settings.GetDefaults()); + CoreComm = comm; cpu.ReadMemory = ReadMemory; cpu.WriteMemory = WriteMemory; @@ -406,13 +408,18 @@ namespace BizHawk.Emulation.Cores.Calculators int bufbit = offset & 7; int bit = ((emu.vram[bufbyte] >> (7 - bufbit)) & 1); if (bit == 0) - unchecked { pixels[i++] = (int)0xFFFFFFFF; } + { + unchecked { pixels[i++] = (int)emu.Settings.BGColor; } + } else - pixels[i++] = 0; + { + pixels[i++] = (int)emu.Settings.ForeColor; + } } return pixels; } + public int VirtualWidth { get { return 96; } } public int VirtualHeight { get { return 64; } } public int BufferWidth { get { return 96; } } @@ -604,11 +611,10 @@ namespace BizHawk.Emulation.Cores.Calculators public class Link { - //Emulates TI linking software. - //See http://www.ticalc.org/archives/files/fileinfo/294/29418.html for documentation - - //Note: Each hardware read/write to the link port calls tthe update method. + // Emulates TI linking software. + // See http://www.ticalc.org/archives/files/fileinfo/294/29418.html for documentation + // Note: Each hardware read/write to the link port calls tthe update method. readonly TI83 Parent; private FileStream CurrentFile; @@ -861,7 +867,7 @@ namespace BizHawk.Emulation.Cores.Calculators Parent.LinkActive = false; CurrentData.Clear(); - //Prepare to receive the Aknowledgement response from the calculator. + // Prepare to receive the Aknowledgement response from the calculator. BytesToSend = 8; CurrentStatus = Status.PrepareSend; NextStep = SendVariableData; @@ -869,7 +875,7 @@ namespace BizHawk.Emulation.Cores.Calculators private void SendVariableData() { - //Check to see if out of memory first. + // Check to see if out of memory first. CurrentData.Dequeue(); CurrentData.Dequeue(); CurrentData.Dequeue(); @@ -913,7 +919,7 @@ namespace BizHawk.Emulation.Cores.Calculators Parent.LinkActive = false; CurrentData.Clear(); - //Prepare to receive the Aknowledgement response from the calculator. + // Prepare to receive the Aknowledgement response from the calculator. BytesToSend = 4; CurrentStatus = Status.PrepareSend; NextStep = EndTransmission; @@ -923,14 +929,14 @@ namespace BizHawk.Emulation.Cores.Calculators { CurrentData.Clear(); - //Send the end transmission command. + // Send the end transmission command. CurrentData.Enqueue(0x03); CurrentData.Enqueue(0x92); CurrentData.Enqueue(0x00); CurrentData.Enqueue(0x00); CurrentStatus = Status.PrepareReceive; - NextStep = FinalizeFile; + NextStep = FinalizeFile; Parent.LinkActive = true; } @@ -940,7 +946,7 @@ namespace BizHawk.Emulation.Cores.Calculators Parent.LinkActive = false; CurrentData.Clear(); - //Prepare to receive the Aknowledgement response from the calculator. + // Prepare to receive the Aknowledgement response from the calculator. BytesToSend = 3; CurrentStatus = Status.PrepareSend; NextStep = EndOutOfMemory; @@ -950,22 +956,20 @@ namespace BizHawk.Emulation.Cores.Calculators { CurrentData.Clear(); - //Send the end transmission command. + // Send the end transmission command. CurrentData.Enqueue(0x03); CurrentData.Enqueue(0x56); CurrentData.Enqueue(0x01); CurrentData.Enqueue(0x00); CurrentStatus = Status.PrepareReceive; - NextStep = FinalizeFile; + NextStep = FinalizeFile; Parent.LinkActive = true; } - //adelikat: This isn't used (yet?) and causes a warning. Did you really mean to override finalize? if so it should be protected virtual, else rename this - //Envian: I didn't notice there was a naming conflict. Fixed it since this method is necessary for the file upload proccess. private void FinalizeFile() { - //Resets the link software, and checks to see if there is an additional file to send. + // Resets the link software, and checks to see if there is an additional file to send. CurrentData.Clear(); Parent.LinkActive = false; NextStep = null; @@ -973,9 +977,37 @@ namespace BizHawk.Emulation.Cores.Calculators } } - public object GetSettings() { return null; } + public class TI83Settings + { + public uint BGColor = 0xFFFFFFFF; + public uint ForeColor = 0; + + public static TI83Settings GetDefaults() + { + return new TI83Settings + { + BGColor = 0xFFFFFFFF, + ForeColor = 0 + }; + } + + public TI83Settings Clone() + { + return (TI83Settings)MemberwiseClone(); + } + } + + TI83Settings Settings; + + public object GetSettings() { return Settings.Clone(); } + + public bool PutSettings(object o) + { + Settings = (TI83Settings)o; + return false; + } + public object GetSyncSettings() { return null; } - public bool PutSettings(object o) { return false; } public bool PutSyncSettings(object o) { return false; } public Dictionary GetCpuFlagsAndRegisters()