misc cleanups in NES config files
This commit is contained in:
parent
07cd535530
commit
735249a841
|
@ -1610,7 +1610,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (Emulator is NES && ((NES)Emulator).IsVS)
|
if (Emulator is NES && ((NES)Emulator).IsVS)
|
||||||
{
|
{
|
||||||
new NESVSSettings().ShowHawkDialog();
|
new NesVsSettings().ShowHawkDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -905,7 +905,7 @@
|
||||||
this.RiceAnisotropicFiltering_TB.Size = new System.Drawing.Size(121, 25);
|
this.RiceAnisotropicFiltering_TB.Size = new System.Drawing.Size(121, 25);
|
||||||
this.RiceAnisotropicFiltering_TB.TabIndex = 13;
|
this.RiceAnisotropicFiltering_TB.TabIndex = 13;
|
||||||
this.toolTip1.SetToolTip(this.RiceAnisotropicFiltering_TB, resources.GetString("RiceAnisotropicFiltering_TB.ToolTip"));
|
this.toolTip1.SetToolTip(this.RiceAnisotropicFiltering_TB, resources.GetString("RiceAnisotropicFiltering_TB.ToolTip"));
|
||||||
this.RiceAnisotropicFiltering_TB.Scroll += new System.EventHandler(this.RiceAnisotropicFiltering_TB_Scroll_1);
|
this.RiceAnisotropicFiltering_TB.Scroll += new System.EventHandler(this.RiceAnisotropicFiltering_Tb_Scroll_1);
|
||||||
//
|
//
|
||||||
// label6
|
// label6
|
||||||
//
|
//
|
||||||
|
@ -1839,7 +1839,7 @@
|
||||||
this.RiceUseDefaultHacks_CB.TabIndex = 1;
|
this.RiceUseDefaultHacks_CB.TabIndex = 1;
|
||||||
this.RiceUseDefaultHacks_CB.Text = "Use defaults for current game";
|
this.RiceUseDefaultHacks_CB.Text = "Use defaults for current game";
|
||||||
this.RiceUseDefaultHacks_CB.UseVisualStyleBackColor = true;
|
this.RiceUseDefaultHacks_CB.UseVisualStyleBackColor = true;
|
||||||
this.RiceUseDefaultHacks_CB.CheckedChanged += new System.EventHandler(this.RiceUseDefaultHacks_CB_CheckedChanged);
|
this.RiceUseDefaultHacks_CB.CheckedChanged += new System.EventHandler(this.RiceUseDefaultHacks_Cb_CheckedChanged);
|
||||||
//
|
//
|
||||||
// Glide64TabPage
|
// Glide64TabPage
|
||||||
//
|
//
|
||||||
|
@ -4548,7 +4548,7 @@
|
||||||
this.SaveButton.TabIndex = 100;
|
this.SaveButton.TabIndex = 100;
|
||||||
this.SaveButton.Text = "Save";
|
this.SaveButton.Text = "Save";
|
||||||
this.SaveButton.UseVisualStyleBackColor = true;
|
this.SaveButton.UseVisualStyleBackColor = true;
|
||||||
this.SaveButton.Click += new System.EventHandler(this.button1_Click);
|
this.SaveButton.Click += new System.EventHandler(this.Button1_Click);
|
||||||
//
|
//
|
||||||
// CancelBT
|
// CancelBT
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
|
@ -9,29 +6,32 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public class DataTableDictionaryBind<TKey, TValue>
|
public class DataTableDictionaryBind<TKey, TValue>
|
||||||
{
|
{
|
||||||
public DataTable Table { get; private set; }
|
public DataTable Table { get; private set; }
|
||||||
public IDictionary<TKey, TValue> Dictionary { get; private set; }
|
|
||||||
|
private IDictionary<TKey, TValue> Dictionary { get; }
|
||||||
|
|
||||||
public bool WasModified { get; private set; }
|
public bool WasModified { get; private set; }
|
||||||
|
|
||||||
public DataTableDictionaryBind(IDictionary<TKey, TValue> Dictionary)
|
public DataTableDictionaryBind(IDictionary<TKey, TValue> dictionary)
|
||||||
{
|
{
|
||||||
this.Dictionary = Dictionary;
|
Dictionary = dictionary;
|
||||||
CreateTable();
|
CreateTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateTable()
|
private void CreateTable()
|
||||||
{
|
{
|
||||||
Table = new DataTable();
|
Table = new DataTable();
|
||||||
Table.Columns.Add("Key", typeof(TKey));
|
Table.Columns.Add("Key", typeof(TKey));
|
||||||
Table.Columns.Add("Value", typeof(TValue));
|
Table.Columns.Add("Value", typeof(TValue));
|
||||||
foreach (var kvp in Dictionary)
|
foreach (var kvp in Dictionary)
|
||||||
|
{
|
||||||
Table.Rows.Add(kvp.Key, kvp.Value);
|
Table.Rows.Add(kvp.Key, kvp.Value);
|
||||||
|
}
|
||||||
|
|
||||||
Table.RowChanged += new DataRowChangeEventHandler(Table_RowChanged);
|
Table.RowChanged += Table_RowChanged;
|
||||||
WasModified = false;
|
WasModified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table_RowChanged(object sender, DataRowChangeEventArgs e)
|
private void Table_RowChanged(object sender, DataRowChangeEventArgs e)
|
||||||
{
|
{
|
||||||
var key = (TKey)e.Row[0];
|
var key = (TKey)e.Row[0];
|
||||||
var value = (TValue)e.Row[1];
|
var value = (TValue)e.Row[1];
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
this.OK.TabIndex = 70;
|
this.OK.TabIndex = 70;
|
||||||
this.OK.Text = "&OK";
|
this.OK.Text = "&OK";
|
||||||
this.OK.UseVisualStyleBackColor = true;
|
this.OK.UseVisualStyleBackColor = true;
|
||||||
this.OK.Click += new System.EventHandler(this.OK_Click);
|
this.OK.Click += new System.EventHandler(this.Ok_Click);
|
||||||
//
|
//
|
||||||
// Cancel
|
// Cancel
|
||||||
//
|
//
|
||||||
|
@ -252,7 +252,7 @@
|
||||||
this.btnAreaFull.TabIndex = 40;
|
this.btnAreaFull.TabIndex = 40;
|
||||||
this.btnAreaFull.Text = "Full [0,239]";
|
this.btnAreaFull.Text = "Full [0,239]";
|
||||||
this.btnAreaFull.UseVisualStyleBackColor = true;
|
this.btnAreaFull.UseVisualStyleBackColor = true;
|
||||||
this.btnAreaFull.Click += new System.EventHandler(this.btnAreaFull_Click);
|
this.btnAreaFull.Click += new System.EventHandler(this.BtnAreaFull_Click);
|
||||||
//
|
//
|
||||||
// btnAreaStandard
|
// btnAreaStandard
|
||||||
//
|
//
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
this.btnAreaStandard.TabIndex = 35;
|
this.btnAreaStandard.TabIndex = 35;
|
||||||
this.btnAreaStandard.Text = "Standard [8,231]";
|
this.btnAreaStandard.Text = "Standard [8,231]";
|
||||||
this.btnAreaStandard.UseVisualStyleBackColor = true;
|
this.btnAreaStandard.UseVisualStyleBackColor = true;
|
||||||
this.btnAreaStandard.Click += new System.EventHandler(this.btnAreaStandard_Click);
|
this.btnAreaStandard.Click += new System.EventHandler(this.BtnAreaStandard_Click);
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
|
|
|
@ -14,10 +14,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// Allow selection of palette file from archive
|
// Allow selection of palette file from archive
|
||||||
// Hotkeys for BG & Sprite display toggle
|
// Hotkeys for BG & Sprite display toggle
|
||||||
// NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?)
|
// NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?)
|
||||||
|
private NES _nes;
|
||||||
private NES nes;
|
private NES.NESSettings _settings;
|
||||||
private NES.NESSettings settings;
|
private Bitmap _bmp;
|
||||||
Bitmap bmp;
|
|
||||||
|
|
||||||
public NESGraphicsConfig()
|
public NESGraphicsConfig()
|
||||||
{
|
{
|
||||||
|
@ -26,23 +25,23 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void NESGraphicsConfig_Load(object sender, EventArgs e)
|
private void NESGraphicsConfig_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
nes = Global.Emulator as NES;
|
_nes = (NES)Global.Emulator;
|
||||||
settings = (NES.NESSettings)nes.GetSettings();
|
_settings = _nes.GetSettings();
|
||||||
LoadStuff();
|
LoadStuff();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadStuff()
|
private void LoadStuff()
|
||||||
{
|
{
|
||||||
NTSC_FirstLineNumeric.Value = settings.NTSC_TopLine;
|
NTSC_FirstLineNumeric.Value = _settings.NTSC_TopLine;
|
||||||
NTSC_LastLineNumeric.Value = settings.NTSC_BottomLine;
|
NTSC_LastLineNumeric.Value = _settings.NTSC_BottomLine;
|
||||||
PAL_FirstLineNumeric.Value = settings.PAL_TopLine;
|
PAL_FirstLineNumeric.Value = _settings.PAL_TopLine;
|
||||||
PAL_LastLineNumeric.Value = settings.PAL_BottomLine;
|
PAL_LastLineNumeric.Value = _settings.PAL_BottomLine;
|
||||||
AllowMoreSprites.Checked = settings.AllowMoreThanEightSprites;
|
AllowMoreSprites.Checked = _settings.AllowMoreThanEightSprites;
|
||||||
ClipLeftAndRightCheckBox.Checked = settings.ClipLeftAndRight;
|
ClipLeftAndRightCheckBox.Checked = _settings.ClipLeftAndRight;
|
||||||
DispSprites.Checked = settings.DispSprites;
|
DispSprites.Checked = _settings.DispSprites;
|
||||||
DispBackground.Checked = settings.DispBackground;
|
DispBackground.Checked = _settings.DispBackground;
|
||||||
BGColorDialog.Color = Color.FromArgb(unchecked(settings.BackgroundColor | (int)0xFF000000));
|
BGColorDialog.Color = Color.FromArgb(unchecked(_settings.BackgroundColor | (int)0xFF000000));
|
||||||
checkUseBackdropColor.Checked = (settings.BackgroundColor & 0xFF000000) != 0;
|
checkUseBackdropColor.Checked = (_settings.BackgroundColor & 0xFF000000) != 0;
|
||||||
SetColorBox();
|
SetColorBox();
|
||||||
SetPaletteImage();
|
SetPaletteImage();
|
||||||
}
|
}
|
||||||
|
@ -74,19 +73,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int w = pictureBoxPalette.Size.Width;
|
int w = pictureBoxPalette.Size.Width;
|
||||||
int h = pictureBoxPalette.Size.Height;
|
int h = pictureBoxPalette.Size.Height;
|
||||||
|
|
||||||
bmp = new Bitmap(w, h);
|
_bmp = new Bitmap(w, h);
|
||||||
for (int j = 0; j < h; j++)
|
for (int j = 0; j < h; j++)
|
||||||
{
|
{
|
||||||
int cy = j * 4 / h;
|
int cy = j * 4 / h;
|
||||||
for (int i = 0; i < w; i++)
|
for (int i = 0; i < w; i++)
|
||||||
{
|
{
|
||||||
int cx = i * 16 / w;
|
int cx = i * 16 / w;
|
||||||
int cindex = cy * 16 + cx;
|
int cindex = (cy * 16) + cx;
|
||||||
Color col = Color.FromArgb(0xff, pal[cindex, 0], pal[cindex, 1], pal[cindex, 2]);
|
Color col = Color.FromArgb(0xff, pal[cindex, 0], pal[cindex, 1], pal[cindex, 2]);
|
||||||
bmp.SetPixel(i, j, col);
|
_bmp.SetPixel(i, j, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pictureBoxPalette.Image = bmp;
|
|
||||||
|
pictureBoxPalette.Image = _bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[,] ResolvePalette(bool showmsg = false)
|
private byte[,] ResolvePalette(bool showmsg = false)
|
||||||
|
@ -95,56 +95,65 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (PalettePath.Text.Length > 0)
|
if (PalettePath.Text.Length > 0)
|
||||||
{
|
{
|
||||||
HawkFile palette = new HawkFile(PalettePath.Text);
|
var palette = new HawkFile(PalettePath.Text);
|
||||||
|
|
||||||
if (palette != null && palette.Exists)
|
if (palette.Exists)
|
||||||
{
|
{
|
||||||
var data = Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
|
var data = Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
|
||||||
if (showmsg) GlobalWin.OSD.AddMessage("Palette file loaded: " + palette.Name);
|
if (showmsg)
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage("Palette file loaded: " + palette.Name);
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return settings.Palette;
|
return _settings.Palette;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // no filename: interpret this as "reset to default"
|
else // no filename: interpret this as "reset to default"
|
||||||
{
|
{
|
||||||
if (showmsg) GlobalWin.OSD.AddMessage("Standard Palette set");
|
if (showmsg)
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage("Standard Palette set");
|
||||||
|
}
|
||||||
|
|
||||||
return (byte[,])Palettes.QuickNESPalette.Clone();
|
return (byte[,])Palettes.QuickNESPalette.Clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // checkbox unchecked: we're reusing whatever palette was set
|
else // checkbox unchecked: we're reusing whatever palette was set
|
||||||
{
|
{
|
||||||
return settings.Palette;
|
return _settings.Palette;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Ok_Click(object sender, EventArgs e)
|
||||||
private void OK_Click(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
settings.Palette = ResolvePalette(true);
|
_settings.Palette = ResolvePalette(true);
|
||||||
|
|
||||||
settings.NTSC_TopLine = (int)NTSC_FirstLineNumeric.Value;
|
_settings.NTSC_TopLine = (int)NTSC_FirstLineNumeric.Value;
|
||||||
settings.NTSC_BottomLine = (int)NTSC_LastLineNumeric.Value;
|
_settings.NTSC_BottomLine = (int)NTSC_LastLineNumeric.Value;
|
||||||
settings.PAL_TopLine = (int)PAL_FirstLineNumeric.Value;
|
_settings.PAL_TopLine = (int)PAL_FirstLineNumeric.Value;
|
||||||
settings.PAL_BottomLine = (int)PAL_LastLineNumeric.Value;
|
_settings.PAL_BottomLine = (int)PAL_LastLineNumeric.Value;
|
||||||
settings.AllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
_settings.AllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
||||||
settings.ClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
_settings.ClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
||||||
settings.DispSprites = DispSprites.Checked;
|
_settings.DispSprites = DispSprites.Checked;
|
||||||
settings.DispBackground = DispBackground.Checked;
|
_settings.DispBackground = DispBackground.Checked;
|
||||||
settings.BackgroundColor = BGColorDialog.Color.ToArgb();
|
_settings.BackgroundColor = BGColorDialog.Color.ToArgb();
|
||||||
if (!checkUseBackdropColor.Checked)
|
if (!checkUseBackdropColor.Checked)
|
||||||
settings.BackgroundColor &= 0x00FFFFFF;
|
{
|
||||||
|
_settings.BackgroundColor &= 0x00FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
nes.PutSettings(settings);
|
_nes.PutSettings(_settings);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetColorBox()
|
private void SetColorBox()
|
||||||
{
|
{
|
||||||
int color = BGColorDialog.Color.ToArgb();
|
int color = BGColorDialog.Color.ToArgb();
|
||||||
BackGroundColorNumber.Text = String.Format("{0:X8}", color).Substring(2,6);
|
BackGroundColorNumber.Text = $"{color:X8}".Substring(2, 6);
|
||||||
BackgroundColorPanel.BackColor = BGColorDialog.Color;
|
BackgroundColorPanel.BackColor = BGColorDialog.Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,13 +170,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnAreaStandard_Click(object sender, EventArgs e)
|
private void BtnAreaStandard_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NTSC_FirstLineNumeric.Value = 8;
|
NTSC_FirstLineNumeric.Value = 8;
|
||||||
NTSC_LastLineNumeric.Value = 231;
|
NTSC_LastLineNumeric.Value = 231;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnAreaFull_Click(object sender, EventArgs e)
|
private void BtnAreaFull_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NTSC_FirstLineNumeric.Value = 0;
|
NTSC_FirstLineNumeric.Value = 0;
|
||||||
NTSC_LastLineNumeric.Value = 239;
|
NTSC_LastLineNumeric.Value = 239;
|
||||||
|
@ -180,7 +189,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void RestoreDefaultsButton_Click(object sender, EventArgs e)
|
private void RestoreDefaultsButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
settings = new NES.NESSettings();
|
_settings = new NES.NESSettings();
|
||||||
LoadStuff();
|
LoadStuff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
this.OK.TabIndex = 0;
|
this.OK.TabIndex = 0;
|
||||||
this.OK.Text = "&OK";
|
this.OK.Text = "&OK";
|
||||||
this.OK.UseVisualStyleBackColor = true;
|
this.OK.UseVisualStyleBackColor = true;
|
||||||
this.OK.Click += new System.EventHandler(this.OK_Click);
|
this.OK.Click += new System.EventHandler(this.Ok_Click);
|
||||||
//
|
//
|
||||||
// Cancel
|
// Cancel
|
||||||
//
|
//
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
this.trackBar1.Name = "trackBar1";
|
this.trackBar1.Name = "trackBar1";
|
||||||
this.trackBar1.Size = new System.Drawing.Size(104, 45);
|
this.trackBar1.Size = new System.Drawing.Size(104, 45);
|
||||||
this.trackBar1.TabIndex = 2;
|
this.trackBar1.TabIndex = 2;
|
||||||
this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
|
this.trackBar1.ValueChanged += new System.EventHandler(this.TrackBar1_ValueChanged);
|
||||||
//
|
//
|
||||||
// trackBar2
|
// trackBar2
|
||||||
//
|
//
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
this.trackBar2.Name = "trackBar2";
|
this.trackBar2.Name = "trackBar2";
|
||||||
this.trackBar2.Size = new System.Drawing.Size(104, 45);
|
this.trackBar2.Size = new System.Drawing.Size(104, 45);
|
||||||
this.trackBar2.TabIndex = 3;
|
this.trackBar2.TabIndex = 3;
|
||||||
this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged);
|
this.trackBar2.ValueChanged += new System.EventHandler(this.TrackBar2_ValueChanged);
|
||||||
//
|
//
|
||||||
// trackBar3
|
// trackBar3
|
||||||
//
|
//
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
this.trackBar3.Name = "trackBar3";
|
this.trackBar3.Name = "trackBar3";
|
||||||
this.trackBar3.Size = new System.Drawing.Size(104, 45);
|
this.trackBar3.Size = new System.Drawing.Size(104, 45);
|
||||||
this.trackBar3.TabIndex = 4;
|
this.trackBar3.TabIndex = 4;
|
||||||
this.trackBar3.ValueChanged += new System.EventHandler(this.trackBar3_ValueChanged);
|
this.trackBar3.ValueChanged += new System.EventHandler(this.TrackBar3_ValueChanged);
|
||||||
//
|
//
|
||||||
// trackBar4
|
// trackBar4
|
||||||
//
|
//
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
this.trackBar4.Name = "trackBar4";
|
this.trackBar4.Name = "trackBar4";
|
||||||
this.trackBar4.Size = new System.Drawing.Size(104, 45);
|
this.trackBar4.Size = new System.Drawing.Size(104, 45);
|
||||||
this.trackBar4.TabIndex = 5;
|
this.trackBar4.TabIndex = 5;
|
||||||
this.trackBar4.ValueChanged += new System.EventHandler(this.trackBar4_ValueChanged);
|
this.trackBar4.ValueChanged += new System.EventHandler(this.TrackBar4_ValueChanged);
|
||||||
//
|
//
|
||||||
// trackBar5
|
// trackBar5
|
||||||
//
|
//
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
this.trackBar5.Name = "trackBar5";
|
this.trackBar5.Name = "trackBar5";
|
||||||
this.trackBar5.Size = new System.Drawing.Size(104, 45);
|
this.trackBar5.Size = new System.Drawing.Size(104, 45);
|
||||||
this.trackBar5.TabIndex = 6;
|
this.trackBar5.TabIndex = 6;
|
||||||
this.trackBar5.ValueChanged += new System.EventHandler(this.trackBar5_ValueChanged);
|
this.trackBar5.ValueChanged += new System.EventHandler(this.TrackBar5_ValueChanged);
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using BizHawk.Client.Common;
|
|
||||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
|
@ -10,13 +9,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public partial class NESSoundConfig : Form, IToolForm
|
public partial class NESSoundConfig : Form, IToolForm
|
||||||
{
|
{
|
||||||
[RequiredService]
|
[RequiredService]
|
||||||
private NES _nes { get; set; }
|
private NES NES { get; set; }
|
||||||
|
|
||||||
private NES.NESSettings _oldSettings;
|
private NES.NESSettings _oldSettings;
|
||||||
private NES.NESSettings _settings;
|
private NES.NESSettings _settings;
|
||||||
|
|
||||||
public bool AskSaveChanges() { return true; }
|
public bool AskSaveChanges() { return true; }
|
||||||
public bool UpdateBefore { get { return false; } }
|
public bool UpdateBefore => false;
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public NESSoundConfig()
|
public NESSoundConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
// get baseline maxes from a default config object
|
// get baseline maxes from a default config object
|
||||||
var d = new NES.NESSettings();
|
var d = new NES.NESSettings();
|
||||||
trackBar1.Maximum = d.Square1;
|
trackBar1.Maximum = d.Square1;
|
||||||
|
@ -46,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void NESSoundConfig_Load(object sender, EventArgs e)
|
private void NESSoundConfig_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_oldSettings = _nes.GetSettings();
|
_oldSettings = NES.GetSettings();
|
||||||
_settings = _oldSettings.Clone();
|
_settings = _oldSettings.Clone();
|
||||||
|
|
||||||
trackBar1.Value = _settings.Square1;
|
trackBar1.Value = _settings.Square1;
|
||||||
|
@ -56,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
trackBar5.Value = _settings.DMC;
|
trackBar5.Value = _settings.DMC;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OK_Click(object sender, EventArgs e)
|
private void Ok_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -64,43 +65,43 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void Cancel_Click(object sender, EventArgs e)
|
private void Cancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// restore previous value
|
// restore previous value
|
||||||
_nes.PutSettings(_oldSettings);
|
NES.PutSettings(_oldSettings);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBar1_ValueChanged(object sender, EventArgs e)
|
private void TrackBar1_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
label6.Text = trackBar1.Value.ToString();
|
label6.Text = trackBar1.Value.ToString();
|
||||||
_settings.Square1 = trackBar1.Value;
|
_settings.Square1 = trackBar1.Value;
|
||||||
_nes.PutSettings(_settings);
|
NES.PutSettings(_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBar2_ValueChanged(object sender, EventArgs e)
|
private void TrackBar2_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
label7.Text = trackBar2.Value.ToString();
|
label7.Text = trackBar2.Value.ToString();
|
||||||
_settings.Square2 = trackBar2.Value;
|
_settings.Square2 = trackBar2.Value;
|
||||||
_nes.PutSettings(_settings);
|
NES.PutSettings(_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBar3_ValueChanged(object sender, EventArgs e)
|
private void TrackBar3_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
label8.Text = trackBar3.Value.ToString();
|
label8.Text = trackBar3.Value.ToString();
|
||||||
_settings.Triangle = trackBar3.Value;
|
_settings.Triangle = trackBar3.Value;
|
||||||
_nes.PutSettings(_settings);
|
NES.PutSettings(_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBar4_ValueChanged(object sender, EventArgs e)
|
private void TrackBar4_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
label9.Text = trackBar4.Value.ToString();
|
label9.Text = trackBar4.Value.ToString();
|
||||||
_settings.Noise = trackBar4.Value;
|
_settings.Noise = trackBar4.Value;
|
||||||
_nes.PutSettings(_settings);
|
NES.PutSettings(_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBar5_ValueChanged(object sender, EventArgs e)
|
private void TrackBar5_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
label10.Text = trackBar5.Value.ToString();
|
label10.Text = trackBar5.Value.ToString();
|
||||||
_settings.DMC = trackBar5.Value;
|
_settings.DMC = trackBar5.Value;
|
||||||
_nes.PutSettings(_settings);
|
NES.PutSettings(_settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,30 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||||
using BizHawk.Common.NumberExtensions;
|
using BizHawk.Common.NumberExtensions;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class NESSyncSettingsForm : Form
|
public partial class NESSyncSettingsForm : Form
|
||||||
{
|
{
|
||||||
DataTableDictionaryBind<string, string> DTDB;
|
private readonly DataTableDictionaryBind<string, string> _dataTableDictionary;
|
||||||
NES.NESSyncSettings SyncSettings;
|
private readonly NES.NESSyncSettings _syncSettings;
|
||||||
|
|
||||||
public NESSyncSettingsForm()
|
public NESSyncSettingsForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
SyncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
_syncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||||
|
|
||||||
if ((Global.Emulator as NES).HasMapperProperties)
|
if (((NES)Global.Emulator).HasMapperProperties)
|
||||||
{
|
{
|
||||||
|
_dataTableDictionary = new DataTableDictionaryBind<string, string>(_syncSettings.BoardProperties);
|
||||||
DTDB = new DataTableDictionaryBind<string, string>(SyncSettings.BoardProperties);
|
dataGridView1.DataSource = _dataTableDictionary.Table;
|
||||||
dataGridView1.DataSource = DTDB.Table;
|
|
||||||
InfoLabel.Visible = false;
|
InfoLabel.Visible = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -38,12 +36,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionComboBox.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region)));
|
RegionComboBox.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region)));
|
||||||
RegionComboBox.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), SyncSettings.RegionOverride);
|
RegionComboBox.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), _syncSettings.RegionOverride);
|
||||||
|
|
||||||
if (SyncSettings.InitialWRamStatePattern != null && SyncSettings.InitialWRamStatePattern.Any())
|
if (_syncSettings.InitialWRamStatePattern != null && _syncSettings.InitialWRamStatePattern.Any())
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
foreach (var b in SyncSettings.InitialWRamStatePattern)
|
foreach (var b in _syncSettings.InitialWRamStatePattern)
|
||||||
{
|
{
|
||||||
sb.Append(b.ToHexString(2));
|
sb.Append(b.ToHexString(2));
|
||||||
}
|
}
|
||||||
|
@ -60,35 +58,34 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void OkBtn_Click(object sender, EventArgs e)
|
private void OkBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var old = _syncSettings.RegionOverride;
|
||||||
var old = SyncSettings.RegionOverride;
|
_syncSettings.RegionOverride = (NES.NESSyncSettings.Region)
|
||||||
SyncSettings.RegionOverride = (NES.NESSyncSettings.Region)
|
|
||||||
Enum.Parse(
|
Enum.Parse(
|
||||||
typeof(NES.NESSyncSettings.Region),
|
typeof(NES.NESSyncSettings.Region),
|
||||||
(string)RegionComboBox.SelectedItem);
|
(string)RegionComboBox.SelectedItem);
|
||||||
|
|
||||||
List<byte> oldRam = SyncSettings.InitialWRamStatePattern != null ? SyncSettings.InitialWRamStatePattern.ToList() : new List<byte>();
|
List<byte> oldRam = _syncSettings.InitialWRamStatePattern?.ToList() ?? new List<byte>();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(RamPatternOverrideBox.Text))
|
if (!string.IsNullOrWhiteSpace(RamPatternOverrideBox.Text))
|
||||||
{
|
{
|
||||||
SyncSettings.InitialWRamStatePattern = Enumerable.Range(0, RamPatternOverrideBox.Text.Length)
|
_syncSettings.InitialWRamStatePattern = Enumerable.Range(0, RamPatternOverrideBox.Text.Length)
|
||||||
.Where(x => x % 2 == 0)
|
.Where(x => x % 2 == 0)
|
||||||
.Select(x => Convert.ToByte(RamPatternOverrideBox.Text.Substring(x, 2), 16))
|
.Select(x => Convert.ToByte(RamPatternOverrideBox.Text.Substring(x, 2), 16))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SyncSettings.InitialWRamStatePattern = null;
|
_syncSettings.InitialWRamStatePattern = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = (DTDB != null && DTDB.WasModified) ||
|
bool changed = (_dataTableDictionary != null && _dataTableDictionary.WasModified) ||
|
||||||
old != SyncSettings.RegionOverride ||
|
old != _syncSettings.RegionOverride ||
|
||||||
!(oldRam.SequenceEqual(SyncSettings.InitialWRamStatePattern ?? new List<byte>()));
|
!(oldRam.SequenceEqual(_syncSettings.InitialWRamStatePattern ?? new List<byte>()));
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.PutCoreSyncSettings(SyncSettings);
|
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
partial class NESVSSettings
|
partial class NesVsSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@ -161,11 +161,11 @@
|
||||||
this.Controls.Add(this.Dipswitch1CheckBox);
|
this.Controls.Add(this.Dipswitch1CheckBox);
|
||||||
this.Controls.Add(this.CancelBtn);
|
this.Controls.Add(this.CancelBtn);
|
||||||
this.Controls.Add(this.OkBtn);
|
this.Controls.Add(this.OkBtn);
|
||||||
this.Name = "NESVSSettings";
|
this.Name = "NesVsSettings";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "NES VS Settings";
|
this.Text = "NES VS Settings";
|
||||||
this.Load += new System.EventHandler(this.NESVSSettings_Load);
|
this.Load += new System.EventHandler(this.NesVsSettings_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,19 @@ using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class NESVSSettings : Form
|
public partial class NesVsSettings : Form
|
||||||
{
|
{
|
||||||
private NES.NESSyncSettings _settings;
|
private NES.NESSyncSettings _settings;
|
||||||
private NES _nes;
|
private NES _nes;
|
||||||
|
|
||||||
public NESVSSettings()
|
public NesVsSettings()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NESVSSettings_Load(object sender, EventArgs e)
|
private void NesVsSettings_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_nes = Global.Emulator as NES;
|
_nes = (NES)Global.Emulator;
|
||||||
_settings = _nes.GetSyncSettings();
|
_settings = _nes.GetSyncSettings();
|
||||||
|
|
||||||
Dipswitch1CheckBox.Checked = _settings.VSDipswitches.Dip_Switch_1;
|
Dipswitch1CheckBox.Checked = _settings.VSDipswitches.Dip_Switch_1;
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
this.checkBoxFamicom.TabIndex = 4;
|
this.checkBoxFamicom.TabIndex = 4;
|
||||||
this.checkBoxFamicom.Text = "Famicom";
|
this.checkBoxFamicom.Text = "Famicom";
|
||||||
this.checkBoxFamicom.UseVisualStyleBackColor = true;
|
this.checkBoxFamicom.UseVisualStyleBackColor = true;
|
||||||
this.checkBoxFamicom.CheckedChanged += new System.EventHandler(this.checkBoxFamicom_CheckedChanged);
|
this.checkBoxFamicom.CheckedChanged += new System.EventHandler(this.CheckBoxFamicom_CheckedChanged);
|
||||||
//
|
//
|
||||||
// label5
|
// label5
|
||||||
//
|
//
|
||||||
|
@ -149,7 +149,6 @@
|
||||||
this.Name = "NesControllerSettings";
|
this.Name = "NesControllerSettings";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "NES Controller Settings";
|
this.Text = "NES Controller Settings";
|
||||||
this.Load += new System.EventHandler(this.NesControllerSettings_Load);
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
|
@ -14,30 +9,25 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class NesControllerSettings : Form
|
public partial class NesControllerSettings : Form
|
||||||
{
|
{
|
||||||
NES.NESSyncSettings SyncSettings;
|
private readonly NES.NESSyncSettings _syncSettings;
|
||||||
|
|
||||||
public NesControllerSettings()
|
public NesControllerSettings()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SyncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
_syncSettings = ((NES)Global.Emulator).GetSyncSettings();
|
||||||
|
|
||||||
// TODO: use combobox extension and add descriptions to enum values
|
// TODO: use combobox extension and add descriptions to enum values
|
||||||
comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().ToArray());
|
comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().ToArray());
|
||||||
comboBoxNESL.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray());
|
comboBoxNESL.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray());
|
||||||
comboBoxNESR.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray());
|
comboBoxNESR.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray());
|
||||||
|
|
||||||
comboBoxFamicom.SelectedItem = SyncSettings.Controls.FamicomExpPort;
|
comboBoxFamicom.SelectedItem = _syncSettings.Controls.FamicomExpPort;
|
||||||
comboBoxNESL.SelectedItem = SyncSettings.Controls.NesLeftPort;
|
comboBoxNESL.SelectedItem = _syncSettings.Controls.NesLeftPort;
|
||||||
comboBoxNESR.SelectedItem = SyncSettings.Controls.NesRightPort;
|
comboBoxNESR.SelectedItem = _syncSettings.Controls.NesRightPort;
|
||||||
checkBoxFamicom.Checked = SyncSettings.Controls.Famicom;
|
checkBoxFamicom.Checked = _syncSettings.Controls.Famicom;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NesControllerSettings_Load(object sender, EventArgs e)
|
private void CheckBoxFamicom_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkBoxFamicom_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
comboBoxFamicom.Enabled = checkBoxFamicom.Checked;
|
comboBoxFamicom.Enabled = checkBoxFamicom.Checked;
|
||||||
comboBoxNESL.Enabled = !checkBoxFamicom.Checked;
|
comboBoxNESL.Enabled = !checkBoxFamicom.Checked;
|
||||||
|
@ -54,16 +44,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
NesRightPort = (string)comboBoxNESR.SelectedItem
|
NesRightPort = (string)comboBoxNESR.SelectedItem
|
||||||
};
|
};
|
||||||
|
|
||||||
bool changed = NESControlSettings.NeedsReboot(ctrls, SyncSettings.Controls);
|
bool changed = NESControlSettings.NeedsReboot(ctrls, _syncSettings.Controls);
|
||||||
|
|
||||||
SyncSettings.Controls = ctrls;
|
_syncSettings.Controls = ctrls;
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.PutCoreSyncSettings(SyncSettings);
|
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||||
// redundant -- MainForm.PutCoreSyncSettings() flags reboot when it is needed
|
|
||||||
// GlobalWin.MainForm.FlagNeedsReboot();
|
|
||||||
// GlobalWin.OSD.AddMessage("Controller settings saved but a core reboot is required");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
this.buttonOK.TabIndex = 2;
|
this.buttonOK.TabIndex = 2;
|
||||||
this.buttonOK.Text = "OK";
|
this.buttonOK.Text = "OK";
|
||||||
this.buttonOK.UseVisualStyleBackColor = true;
|
this.buttonOK.UseVisualStyleBackColor = true;
|
||||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
this.buttonOK.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
this.buttonPal.TabIndex = 4;
|
this.buttonPal.TabIndex = 4;
|
||||||
this.buttonPal.Text = "Browse...";
|
this.buttonPal.Text = "Browse...";
|
||||||
this.buttonPal.UseVisualStyleBackColor = true;
|
this.buttonPal.UseVisualStyleBackColor = true;
|
||||||
this.buttonPal.Click += new System.EventHandler(this.buttonPal_Click);
|
this.buttonPal.Click += new System.EventHandler(this.ButtonPal_Click);
|
||||||
//
|
//
|
||||||
// buttonPalReset
|
// buttonPalReset
|
||||||
//
|
//
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
this.buttonPalReset.TabIndex = 5;
|
this.buttonPalReset.TabIndex = 5;
|
||||||
this.buttonPalReset.Text = "Reset to QuickNES Default";
|
this.buttonPalReset.Text = "Reset to QuickNES Default";
|
||||||
this.buttonPalReset.UseVisualStyleBackColor = true;
|
this.buttonPalReset.UseVisualStyleBackColor = true;
|
||||||
this.buttonPalReset.Click += new System.EventHandler(this.buttonPalReset_Click);
|
this.buttonPalReset.Click += new System.EventHandler(this.ButtonPalReset_Click);
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
|
||||||
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
|
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
|
@ -15,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class QuickNesConfig : Form
|
public partial class QuickNesConfig : Form
|
||||||
{
|
{
|
||||||
private QuickNES.QuickNESSettings Settings;
|
private QuickNES.QuickNESSettings _settings;
|
||||||
|
|
||||||
public QuickNesConfig()
|
public QuickNesConfig()
|
||||||
{
|
{
|
||||||
|
@ -24,17 +19,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void QuickNesConfig_Load(object sender, EventArgs e)
|
private void QuickNesConfig_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Settings = ((QuickNES)Global.Emulator).GetSettings();
|
_settings = ((QuickNES)Global.Emulator).GetSettings();
|
||||||
propertyGrid1.SelectedObject = Settings;
|
propertyGrid1.SelectedObject = _settings;
|
||||||
SetPaletteImage();
|
SetPaletteImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPaletteImage()
|
private void SetPaletteImage()
|
||||||
{
|
{
|
||||||
int w = pictureBox1.Size.Width;
|
int w = pictureBox1.Size.Width;
|
||||||
int h = pictureBox1.Size.Height;
|
int h = pictureBox1.Size.Height;
|
||||||
var bmp = new Bitmap(w, h);
|
var bmp = new Bitmap(w, h);
|
||||||
var pal = Settings.Palette;
|
var pal = _settings.Palette;
|
||||||
|
|
||||||
for (int j = 0; j < h; j++)
|
for (int j = 0; j < h; j++)
|
||||||
{
|
{
|
||||||
|
@ -46,15 +41,21 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int cx = ix / 7;
|
int cx = ix / 7;
|
||||||
if (iy % 3 == 2)
|
if (iy % 3 == 2)
|
||||||
{
|
{
|
||||||
cx += 64 * (ix % 7 + 1);
|
cx += 64 * ((ix % 7) + 1);
|
||||||
}
|
}
|
||||||
int cindex = cy * 16 + cx;
|
|
||||||
Color col = Color.FromArgb(0xff, pal[cindex * 3], pal[cindex * 3 + 1], pal[cindex * 3 + 2]);
|
int cindex = (cy * 16) + cx;
|
||||||
|
Color col = Color.FromArgb(
|
||||||
|
0xff,
|
||||||
|
pal[cindex * 3],
|
||||||
|
pal[(cindex * 3) + 1],
|
||||||
|
pal[(cindex * 3) + 2]);
|
||||||
|
|
||||||
bmp.SetPixel(i, j, col);
|
bmp.SetPixel(i, j, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pictureBox1.Image != null) pictureBox1.Image.Dispose();
|
pictureBox1.Image?.Dispose();
|
||||||
pictureBox1.Image = bmp;
|
pictureBox1.Image = bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,12 +68,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
pictureBox1.Image.Dispose();
|
pictureBox1.Image.Dispose();
|
||||||
pictureBox1.Image = null;
|
pictureBox1.Image = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonPal_Click(object sender, EventArgs e)
|
private void ButtonPal_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog ofd = new OpenFileDialog
|
var ofd = new OpenFileDialog
|
||||||
{
|
{
|
||||||
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Palettes"].Path, "NES"),
|
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries["NES", "Palettes"].Path, "NES"),
|
||||||
Filter = "Palette Files (.pal)|*.PAL|All Files (*.*)|*.*",
|
Filter = "Palette Files (.pal)|*.PAL|All Files (*.*)|*.*",
|
||||||
|
@ -84,26 +84,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HawkFile palette = new HawkFile(ofd.FileName);
|
|
||||||
|
|
||||||
if (palette != null && palette.Exists)
|
var palette = new HawkFile(ofd.FileName);
|
||||||
|
|
||||||
|
if (palette.Exists)
|
||||||
{
|
{
|
||||||
var data = Emulation.Cores.Nintendo.NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
|
var data = Emulation.Cores.Nintendo.NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
|
||||||
Settings.SetNesHawkPalette(data);
|
_settings.SetNesHawkPalette(data);
|
||||||
SetPaletteImage();
|
SetPaletteImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonOK_Click(object sender, EventArgs e)
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.PutCoreSettings(Settings);
|
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonPalReset_Click(object sender, EventArgs e)
|
private void ButtonPalReset_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Settings.SetDefaultColors();
|
_settings.SetDefaultColors();
|
||||||
SetPaletteImage();
|
SetPaletteImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue