NES add sound volume settings to config object
This commit is contained in:
parent
0347fc5eef
commit
f992672051
|
@ -600,17 +600,17 @@ namespace BizHawk.Client.Common
|
||||||
public int Analog_SmallChange = 1;
|
public int Analog_SmallChange = 1;
|
||||||
|
|
||||||
// NES Sound settings
|
// NES Sound settings
|
||||||
public int NESSquare1 = 376;
|
//public int NESSquare1 = 376;
|
||||||
public int NESSquare2 = 376;
|
//public int NESSquare2 = 376;
|
||||||
public int NESTriangle = 426;
|
//public int NESTriangle = 426;
|
||||||
public int NESNoise = 247;
|
//public int NESNoise = 247;
|
||||||
public int NESDMC = 167;
|
//public int NESDMC = 167;
|
||||||
|
|
||||||
public const int NESSquare1Max = 376;
|
//public const int NESSquare1Max = 376;
|
||||||
public const int NESSquare2Max = 376;
|
//public const int NESSquare2Max = 376;
|
||||||
public const int NESTriangleMax = 426;
|
//public const int NESTriangleMax = 426;
|
||||||
public const int NESNoiseMax = 247;
|
//public const int NESNoiseMax = 247;
|
||||||
public const int NESDMCMax = 167;
|
//public const int NESDMCMax = 167;
|
||||||
|
|
||||||
public struct AnalogBind
|
public struct AnalogBind
|
||||||
{
|
{
|
||||||
|
|
|
@ -814,19 +814,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
LogWindowAsConsoleMenuItem.Enabled = true;
|
LogWindowAsConsoleMenuItem.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNesSoundChannels()
|
|
||||||
{
|
|
||||||
var nes = Global.Emulator as NES;
|
|
||||||
if (nes != null)
|
|
||||||
{
|
|
||||||
nes.SetSquare1(Global.Config.NESSquare1);
|
|
||||||
nes.SetSquare2(Global.Config.NESSquare2);
|
|
||||||
nes.SetTriangle(Global.Config.NESTriangle);
|
|
||||||
nes.SetNoise(Global.Config.NESNoise);
|
|
||||||
nes.SetDMC(Global.Config.NESDMC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClickSpeedItem(int num)
|
public void ClickSpeedItem(int num)
|
||||||
{
|
{
|
||||||
if ((ModifierKeys & Keys.Control) != 0)
|
if ((ModifierKeys & Keys.Control) != 0)
|
||||||
|
@ -3571,7 +3558,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.Game.Status = nes.RomStatus;
|
Global.Game.Status = nes.RomStatus;
|
||||||
SetNesSoundChannels();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text = DisplayNameForSystem(game.System) + " - " + game.Name;
|
Text = DisplayNameForSystem(game.System) + " - " + game.Name;
|
||||||
|
|
|
@ -2,25 +2,27 @@
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
|
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class NESSoundConfig : Form, IToolForm
|
public partial class NESSoundConfig : Form, IToolForm
|
||||||
{
|
{
|
||||||
private int sq1, sq2, tr, no, dmc = 0;
|
private NES.NESSettings oldsettings;
|
||||||
|
private NES.NESSettings settings;
|
||||||
|
|
||||||
public bool AskSave() { return true; }
|
public bool AskSave() { return true; }
|
||||||
public bool UpdateBefore { get { return false; } }
|
public bool UpdateBefore { get { return false; } }
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
if (!(Global.Emulator is NESDebugger))
|
if (!(Global.Emulator is NES))
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
if (!(Global.Emulator is NESDebugger))
|
if (!(Global.Emulator is NES))
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -29,26 +31,25 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public NESSoundConfig()
|
public NESSoundConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
trackBar1.Maximum = Config.NESSquare1Max;
|
// get baseline maxes from a default config object
|
||||||
trackBar2.Maximum = Config.NESSquare2Max;
|
var d = new NES.NESSettings();
|
||||||
trackBar3.Maximum = Config.NESTriangleMax;
|
trackBar1.Maximum = d.Square1;
|
||||||
trackBar4.Maximum = Config.NESNoiseMax;
|
trackBar2.Maximum = d.Square2;
|
||||||
trackBar5.Maximum = Config.NESDMCMax;
|
trackBar3.Maximum = d.Triangle;
|
||||||
|
trackBar4.Maximum = d.Noise;
|
||||||
|
trackBar5.Maximum = d.DMC;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NESSoundConfig_Load(object sender, EventArgs e)
|
private void NESSoundConfig_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
trackBar1.Value = Global.Config.NESSquare1;
|
oldsettings = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||||
trackBar2.Value = Global.Config.NESSquare2;
|
settings = oldsettings.Clone();
|
||||||
trackBar3.Value = Global.Config.NESTriangle;
|
|
||||||
trackBar4.Value = Global.Config.NESNoise;
|
trackBar1.Value = settings.Square1;
|
||||||
trackBar5.Value = Global.Config.NESDMC;
|
trackBar2.Value = settings.Square2;
|
||||||
//save value for cancel
|
trackBar3.Value = settings.Triangle;
|
||||||
sq1 = Global.Config.NESSquare1;
|
trackBar4.Value = settings.Noise;
|
||||||
sq2 = Global.Config.NESSquare2;
|
trackBar5.Value = settings.DMC;
|
||||||
tr = Global.Config.NESTriangle;
|
|
||||||
no = Global.Config.NESNoise;
|
|
||||||
dmc = Global.Config.NESDMC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OK_Click(object sender, EventArgs e)
|
private void OK_Click(object sender, EventArgs e)
|
||||||
|
@ -59,49 +60,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
|
||||||
//restore value
|
Global.Emulator.PutSettings(oldsettings);
|
||||||
Global.Config.NESSquare1 = sq1;
|
|
||||||
Global.Config.NESSquare2 = sq2;
|
|
||||||
Global.Config.NESTriangle = tr;
|
|
||||||
Global.Config.NESNoise = no;
|
|
||||||
Global.Config.NESDMC = dmc;
|
|
||||||
GlobalWin.MainForm.SetNesSoundChannels();
|
|
||||||
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();
|
||||||
Global.Config.NESSquare1 = trackBar1.Value;
|
settings.Square1 = trackBar1.Value;
|
||||||
GlobalWin.MainForm.SetNesSoundChannels();
|
Global.Emulator.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();
|
||||||
Global.Config.NESSquare2 = trackBar2.Value;
|
settings.Square2 = trackBar2.Value;
|
||||||
GlobalWin.MainForm.SetNesSoundChannels();
|
Global.Emulator.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();
|
||||||
Global.Config.NESTriangle = trackBar3.Value;
|
settings.Triangle = trackBar3.Value;
|
||||||
GlobalWin.MainForm.SetNesSoundChannels();
|
Global.Emulator.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();
|
||||||
Global.Config.NESNoise = trackBar4.Value;
|
settings.Noise = trackBar4.Value;
|
||||||
GlobalWin.MainForm.SetNesSoundChannels();
|
Global.Emulator.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();
|
||||||
Global.Config.NESDMC = trackBar5.Value;
|
settings.DMC = trackBar5.Value;
|
||||||
GlobalWin.MainForm.SetNesSoundChannels();
|
Global.Emulator.PutSettings(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -893,6 +893,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
CoreComm.ScreenLogicalOffsetY = DisplayType == DisplayType.NTSC ? Settings.NTSC_TopLine : Settings.PAL_TopLine;
|
CoreComm.ScreenLogicalOffsetY = DisplayType == DisplayType.NTSC ? Settings.NTSC_TopLine : Settings.PAL_TopLine;
|
||||||
|
|
||||||
SetPalette(Settings.Palette);
|
SetPalette(Settings.Palette);
|
||||||
|
|
||||||
|
apu.Square1V = Settings.Square1;
|
||||||
|
apu.Square2V = Settings.Square2;
|
||||||
|
apu.TriangleV = Settings.Triangle;
|
||||||
|
apu.NoiseV = Settings.Noise;
|
||||||
|
apu.DMCV = Settings.DMC;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,6 +918,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
public int[,] Palette;
|
public int[,] Palette;
|
||||||
|
|
||||||
|
public int Square1 = 376;
|
||||||
|
public int Square2 = 376;
|
||||||
|
public int Triangle = 426;
|
||||||
|
public int Noise = 247;
|
||||||
|
public int DMC = 167;
|
||||||
|
|
||||||
public NESSettings Clone()
|
public NESSettings Clone()
|
||||||
{
|
{
|
||||||
return (NESSettings)MemberwiseClone();
|
return (NESSettings)MemberwiseClone();
|
||||||
|
|
Loading…
Reference in New Issue