NES config - Fix crash when palette path is null, hook up NES palette path config in path config dialog, dialog fix ups
This commit is contained in:
parent
f052b0bd71
commit
f52c4610e8
|
@ -29,6 +29,7 @@
|
|||
public string PathNESSaveRAM = ".\\SaveRAM";
|
||||
public string PathNESScreenshots = ".\\Screenshots";
|
||||
public string PathNESCheats = ".\\Cheats";
|
||||
public string PathNESPalette = ".\\Palettes";
|
||||
|
||||
public string BaseSMS = ".\\SMS";
|
||||
public string PathSMSROMs = ".";
|
||||
|
|
|
@ -764,7 +764,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
NES nes = new NES();
|
||||
nextEmulator = nes;
|
||||
if (Global.Config.NESAutoLoadPalette && HawkFile.ExistsAt(Global.Config.NESPaletteFile))
|
||||
if (Global.Config.NESAutoLoadPalette && Global.Config.NESPaletteFile.Length > 0 && HawkFile.ExistsAt(Global.Config.NESPaletteFile))
|
||||
{
|
||||
nes.SetPalette(NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(Global.Config.NESPaletteFile)));
|
||||
}
|
||||
|
|
|
@ -39,14 +39,14 @@
|
|||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.ClipLeftAndRightCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.ChangeBGColor = new System.Windows.Forms.Button();
|
||||
this.BackGroundColorNumber = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.BackgroundColorPanel = new System.Windows.Forms.Panel();
|
||||
this.DispBackground = new System.Windows.Forms.CheckBox();
|
||||
this.DispSprites = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.BackGroundColorNumber = new System.Windows.Forms.TextBox();
|
||||
this.ChangeBGColor = new System.Windows.Forms.Button();
|
||||
this.BGColorDialog = new System.Windows.Forms.ColorDialog();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
|
@ -60,7 +60,7 @@
|
|||
this.OK.Location = new System.Drawing.Point(213, 403);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.OK.TabIndex = 0;
|
||||
this.OK.TabIndex = 40;
|
||||
this.OK.Text = "&Ok";
|
||||
this.OK.UseVisualStyleBackColor = true;
|
||||
this.OK.Click += new System.EventHandler(this.OK_Click);
|
||||
|
@ -72,7 +72,7 @@
|
|||
this.Cancel.Location = new System.Drawing.Point(294, 403);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.TabIndex = 1;
|
||||
this.Cancel.TabIndex = 45;
|
||||
this.Cancel.Text = "&Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -82,7 +82,7 @@
|
|||
this.AllowMoreSprites.Location = new System.Drawing.Point(9, 19);
|
||||
this.AllowMoreSprites.Name = "AllowMoreSprites";
|
||||
this.AllowMoreSprites.Size = new System.Drawing.Size(203, 17);
|
||||
this.AllowMoreSprites.TabIndex = 2;
|
||||
this.AllowMoreSprites.TabIndex = 15;
|
||||
this.AllowMoreSprites.Text = "Allow more than 8 sprites per scanline";
|
||||
this.AllowMoreSprites.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -109,7 +109,7 @@
|
|||
this.AutoLoadPalette.Location = new System.Drawing.Point(6, 73);
|
||||
this.AutoLoadPalette.Name = "AutoLoadPalette";
|
||||
this.AutoLoadPalette.Size = new System.Drawing.Size(135, 17);
|
||||
this.AutoLoadPalette.TabIndex = 3;
|
||||
this.AutoLoadPalette.TabIndex = 10;
|
||||
this.AutoLoadPalette.Text = "Load this file on startup";
|
||||
this.AutoLoadPalette.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -137,7 +137,7 @@
|
|||
this.BrowsePalette.Location = new System.Drawing.Point(271, 44);
|
||||
this.BrowsePalette.Name = "BrowsePalette";
|
||||
this.BrowsePalette.Size = new System.Drawing.Size(75, 23);
|
||||
this.BrowsePalette.TabIndex = 0;
|
||||
this.BrowsePalette.TabIndex = 5;
|
||||
this.BrowsePalette.Text = "&Browse...";
|
||||
this.BrowsePalette.UseVisualStyleBackColor = true;
|
||||
this.BrowsePalette.Click += new System.EventHandler(this.BrowsePalette_Click);
|
||||
|
@ -160,7 +160,7 @@
|
|||
this.ClipLeftAndRightCheckBox.Location = new System.Drawing.Point(9, 42);
|
||||
this.ClipLeftAndRightCheckBox.Name = "ClipLeftAndRightCheckBox";
|
||||
this.ClipLeftAndRightCheckBox.Size = new System.Drawing.Size(186, 17);
|
||||
this.ClipLeftAndRightCheckBox.TabIndex = 3;
|
||||
this.ClipLeftAndRightCheckBox.TabIndex = 20;
|
||||
this.ClipLeftAndRightCheckBox.Text = "Clip Left and Right Sides (8 pixels)";
|
||||
this.ClipLeftAndRightCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -182,6 +182,43 @@
|
|||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Background and Sprites";
|
||||
//
|
||||
// ChangeBGColor
|
||||
//
|
||||
this.ChangeBGColor.Location = new System.Drawing.Point(136, 98);
|
||||
this.ChangeBGColor.Name = "ChangeBGColor";
|
||||
this.ChangeBGColor.Size = new System.Drawing.Size(52, 23);
|
||||
this.ChangeBGColor.TabIndex = 35;
|
||||
this.ChangeBGColor.Text = "Change";
|
||||
this.ChangeBGColor.UseVisualStyleBackColor = true;
|
||||
this.ChangeBGColor.Click += new System.EventHandler(this.ChangeBGColor_Click);
|
||||
//
|
||||
// BackGroundColorNumber
|
||||
//
|
||||
this.BackGroundColorNumber.Location = new System.Drawing.Point(62, 100);
|
||||
this.BackGroundColorNumber.MaxLength = 8;
|
||||
this.BackGroundColorNumber.Name = "BackGroundColorNumber";
|
||||
this.BackGroundColorNumber.ReadOnly = true;
|
||||
this.BackGroundColorNumber.Size = new System.Drawing.Size(59, 20);
|
||||
this.BackGroundColorNumber.TabIndex = 5;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(43, 102);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(18, 13);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "0x";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 79);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(246, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Background color when Backgrounds are disabled";
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.BackgroundColorPanel);
|
||||
|
@ -201,60 +238,27 @@
|
|||
// DispBackground
|
||||
//
|
||||
this.DispBackground.AutoSize = true;
|
||||
this.DispBackground.Checked = true;
|
||||
this.DispBackground.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispBackground.Location = new System.Drawing.Point(9, 42);
|
||||
this.DispBackground.Name = "DispBackground";
|
||||
this.DispBackground.Size = new System.Drawing.Size(121, 17);
|
||||
this.DispBackground.TabIndex = 1;
|
||||
this.DispBackground.TabIndex = 30;
|
||||
this.DispBackground.Text = "Display Background";
|
||||
this.DispBackground.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispSprites
|
||||
//
|
||||
this.DispSprites.AutoSize = true;
|
||||
this.DispSprites.Checked = true;
|
||||
this.DispSprites.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispSprites.Location = new System.Drawing.Point(9, 19);
|
||||
this.DispSprites.Name = "DispSprites";
|
||||
this.DispSprites.Size = new System.Drawing.Size(95, 17);
|
||||
this.DispSprites.TabIndex = 0;
|
||||
this.DispSprites.TabIndex = 25;
|
||||
this.DispSprites.Text = "Display Sprites";
|
||||
this.DispSprites.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 79);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(246, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Background color when Backgrounds are disabled";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(43, 102);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(18, 13);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "0x";
|
||||
//
|
||||
// BackGroundColorNumber
|
||||
//
|
||||
this.BackGroundColorNumber.Location = new System.Drawing.Point(62, 100);
|
||||
this.BackGroundColorNumber.MaxLength = 8;
|
||||
this.BackGroundColorNumber.Name = "BackGroundColorNumber";
|
||||
this.BackGroundColorNumber.ReadOnly = true;
|
||||
this.BackGroundColorNumber.Size = new System.Drawing.Size(59, 20);
|
||||
this.BackGroundColorNumber.TabIndex = 5;
|
||||
//
|
||||
// ChangeBGColor
|
||||
//
|
||||
this.ChangeBGColor.Location = new System.Drawing.Point(136, 98);
|
||||
this.ChangeBGColor.Name = "ChangeBGColor";
|
||||
this.ChangeBGColor.Size = new System.Drawing.Size(52, 23);
|
||||
this.ChangeBGColor.TabIndex = 6;
|
||||
this.ChangeBGColor.Text = "Change";
|
||||
this.ChangeBGColor.UseVisualStyleBackColor = true;
|
||||
this.ChangeBGColor.Click += new System.EventHandler(this.ChangeBGColor_Click);
|
||||
//
|
||||
// NESGraphicsConfig
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
|
@ -270,6 +274,7 @@
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "NESGraphicsConfig";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "NES Graphics Settings";
|
||||
this.Load += new System.EventHandler(this.NESGraphicsConfig_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
|
|
|
@ -14,9 +14,6 @@ namespace BizHawk.MultiClient
|
|||
public partial class NESGraphicsConfig : Form
|
||||
{
|
||||
//TODO:
|
||||
//Add restriction on for load event for nes
|
||||
//Add restriction on Main form menu item for nes
|
||||
//Add palette config in NES path config
|
||||
//Hook up allow > 8 scan lines
|
||||
//Hook up Clip L+R Sides
|
||||
//Hook up Disp Background
|
||||
|
@ -24,7 +21,6 @@ namespace BizHawk.MultiClient
|
|||
//Hook up BG color
|
||||
//Allow selection of palette file from archive
|
||||
//Hotkeys for BG & Sprite display toggle
|
||||
//allow null in box
|
||||
//select all on enter event for palette config
|
||||
//NTSC fileter settings? Hue, Tint (This should probably be a multiclient thing, not a nes specific thing?)
|
||||
//Color panel isn't loading color on load
|
||||
|
@ -53,7 +49,7 @@ namespace BizHawk.MultiClient
|
|||
private void BrowsePalette_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.InitialDirectory = PathManager.GetPlatformBase("NES");
|
||||
ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESPalette, "NES");
|
||||
ofd.Filter = "Palette Files (.pal)|*.PAL|All Files (*.*)|*.*";
|
||||
ofd.RestoreDirectory = true;
|
||||
|
||||
|
@ -66,23 +62,33 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
string path = PathManager.MakeAbsolutePath(PalettePath.Text, "NES");
|
||||
palette = new HawkFile(PalettePath.Text);
|
||||
|
||||
if (palette != null && palette.Exists)
|
||||
if (PalettePath.Text.Length > 0)
|
||||
{
|
||||
if (Global.Config.NESPaletteFile != palette.Name)
|
||||
string path = PathManager.MakeAbsolutePath(PalettePath.Text, "NES");
|
||||
palette = new HawkFile(PalettePath.Text);
|
||||
|
||||
if (palette != null && palette.Exists)
|
||||
{
|
||||
Global.Config.NESPaletteFile = palette.Name;
|
||||
nes.SetPalette(NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name)));
|
||||
Global.RenderPanel.AddMessage("Palette file loaded: " + palette.Name);
|
||||
if (Global.Config.NESPaletteFile != palette.Name)
|
||||
{
|
||||
Global.Config.NESPaletteFile = palette.Name;
|
||||
nes.SetPalette(NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name)));
|
||||
Global.RenderPanel.AddMessage("Palette file loaded: " + palette.Name);
|
||||
}
|
||||
}
|
||||
Global.Config.NESAllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
||||
Global.Config.NESClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
||||
Global.Config.NESAutoLoadPalette = AutoLoadPalette.Checked;
|
||||
Global.Config.NESDispSprites = DispSprites.Checked;
|
||||
Global.Config.NESDispBackground = DispBackground.Checked;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.NESPaletteFile = "";
|
||||
nes.SetPalette(NES.Palettes.FCEUX_Standard);
|
||||
Global.RenderPanel.AddMessage("Standard Palette set");
|
||||
}
|
||||
|
||||
Global.Config.NESAllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
||||
Global.Config.NESClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
||||
Global.Config.NESAutoLoadPalette = AutoLoadPalette.Checked;
|
||||
Global.Config.NESDispSprites = DispSprites.Checked;
|
||||
Global.Config.NESDispBackground = DispBackground.Checked;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -54,6 +54,7 @@ namespace BizHawk.MultiClient
|
|||
NESSaveRAMBox.Text = Global.Config.PathNESSaveRAM;
|
||||
NESScreenshotsBox.Text = Global.Config.PathNESScreenshots;
|
||||
NESCheatsBox.Text = Global.Config.PathNESCheats;
|
||||
NESPaletteBox.Text = Global.Config.PathNESPalette;
|
||||
|
||||
Sega8BaseBox.Text = Global.Config.BaseSMS;
|
||||
Sega8ROMsBox.Text = Global.Config.PathSMSROMs;
|
||||
|
@ -121,6 +122,7 @@ namespace BizHawk.MultiClient
|
|||
Global.Config.PathNESSaveRAM = NESSaveRAMBox.Text;
|
||||
Global.Config.PathNESScreenshots = NESScreenshotsBox.Text;
|
||||
Global.Config.PathNESCheats = NESCheatsBox.Text;
|
||||
Global.Config.PathNESPalette = NESPaletteBox.Text;
|
||||
|
||||
Global.Config.BaseSMS = Sega8BaseBox.Text;
|
||||
Global.Config.PathSMSROMs = Sega8ROMsBox.Text;
|
||||
|
@ -537,5 +539,10 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
BrowseFolder(SGCheatsBox, SGCheatsDescription.Text, "SG");
|
||||
}
|
||||
|
||||
private void NESBrowsePalette_Click(object sender, EventArgs e)
|
||||
{
|
||||
BrowseFolder(NESPaletteBox, NESPaletteDescription.Text, "NES");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue