pce sound debugger: auto config

This commit is contained in:
goyuken 2014-12-28 17:22:58 +00:00
parent 87c064c6ac
commit 4d78052961
4 changed files with 10 additions and 120 deletions
BizHawk.Client.Common/config
BizHawk.Client.EmuHawk

View File

@ -420,10 +420,6 @@ namespace BizHawk.Client.Common
public int SNESGraphicsUserBackdropColor = -1;
*/
// PCE Sound Debugger settings
public ToolDialogSettings PceSoundDebuggerSettings = new ToolDialogSettings();
public bool PceSoundDebuggerAutoload = false;
#region Cheats Dialog
public ToolDialogSettings CheatsSettings = new ToolDialogSettings();

View File

@ -397,11 +397,6 @@ namespace BizHawk.Client.EmuHawk
OpenLuaConsole();
}
if (Global.Config.PceSoundDebuggerAutoload)
{
GlobalWin.Tools.Load<PCESoundDebugger>();
}
if (Global.Config.DisplayStatusBar == false)
{
MainStatusBar.Visible = false;

View File

@ -80,15 +80,9 @@
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.SoundMenuStrip = new MenuStripEx();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TopMostMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SoundMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// btnExport
@ -254,54 +248,13 @@
//
// SoundMenuStrip
//
this.SoundMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.OptionsSubMenu});
this.SoundMenuStrip.ClickThrough = true;
this.SoundMenuStrip.Location = new System.Drawing.Point(0, 0);
this.SoundMenuStrip.Name = "SoundMenuStrip";
this.SoundMenuStrip.Size = new System.Drawing.Size(787, 24);
this.SoundMenuStrip.TabIndex = 4;
this.SoundMenuStrip.Text = "menuStrip1";
//
// OptionsSubMenu
//
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.AutoloadMenuItem,
this.SaveWindowPositionMenuItem,
this.TopMostMenuItem,
this.FloatingWindowMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.OptionsSubMenu.Text = "&Options";
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
//
// AutoloadMenuItem
//
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
this.AutoloadMenuItem.Text = "&Autoload";
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
//
// SaveWindowPositionMenuItem
//
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
this.SaveWindowPositionMenuItem.Text = "Save Window Position";
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
//
// TopMostMenuItem
//
this.TopMostMenuItem.Name = "TopMostMenuItem";
this.TopMostMenuItem.Size = new System.Drawing.Size(191, 22);
this.TopMostMenuItem.Text = "Always on Top";
this.TopMostMenuItem.Click += new System.EventHandler(this.TopMostMenuItem_Click);
//
// FloatingWindowMenuItem
//
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
this.FloatingWindowMenuItem.Text = "Floating Window";
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
//
// PCESoundDebugger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -316,12 +269,9 @@
this.Name = "PCESoundDebugger";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Sound Debugger";
this.Load += new System.EventHandler(this.PCESoundDebugger_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.SoundMenuStrip.ResumeLayout(false);
this.SoundMenuStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -344,10 +294,5 @@
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader1;
private MenuStripEx SoundMenuStrip;
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
private System.Windows.Forms.ToolStripMenuItem TopMostMenuItem;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
}
}

View File

@ -19,7 +19,7 @@ using ICSharpCode.SharpZipLib.Zip;
namespace BizHawk.Client.EmuHawk
{
public partial class PCESoundDebugger : Form, IToolForm
public partial class PCESoundDebugger : Form, IToolFormAutoConfig
{
[RequiredService]
private PCEngine _pce { get; set; }
@ -39,24 +39,22 @@ namespace BizHawk.Client.EmuHawk
{
for (int i = 0; i < lvChEn.Items.Count; i++)
lvChEn.Items[i].Checked = true;
RefreshFloatingWindowControl();
base.OnShown(e);
}
public void UpdateValues()
{
foreach(var entry in PSGEntries)
foreach (var entry in PSGEntries)
{
entry.wasactive = entry.active;
entry.active = false;
}
bool sync = false;
lvPsgWaveforms.BeginUpdate();
lvChannels.BeginUpdate();
for(int i=0;i<6;i++)
for (int i = 0; i < 6; i++)
{
var ch = _pce.PSG.Channels[i];
@ -117,7 +115,7 @@ namespace BizHawk.Client.EmuHawk
{
PSGEntry entry = PSGEntryTable[md5];
entry.active = true;
//are we playing the same sample as before?
if (LastSamples[i] == entry) { }
else
@ -185,13 +183,13 @@ namespace BizHawk.Client.EmuHawk
0x52, 0x49, 0x46, 0x46, 0x24, 0x04, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20,
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xE0, 0x2E, 0x00, 0x00, 0xC0, 0x5D, 0x00, 0x00,
0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x04, 0x00, 0x00,
} ;
};
private void btnExport_Click(object sender, EventArgs e)
{
string tmpf = Path.GetTempFileName() + ".zip";
using (var stream = new FileStream(tmpf,FileMode.Create,FileAccess.Write,FileShare.Read))
using (var stream = new FileStream(tmpf, FileMode.Create, FileAccess.Write, FileShare.Read))
{
var zip = new ZipOutputStream(stream)
{
@ -212,7 +210,7 @@ namespace BizHawk.Client.EmuHawk
bw.Flush();
ms.Position = 0x2C;
for (int i = 0; i < 32; i++)
for(int j=0;j<16;j++)
for (int j = 0; j < 16; j++)
bw.Write(entry.waveform[i]);
bw.Flush();
var buf = ms.GetBuffer();
@ -254,7 +252,7 @@ namespace BizHawk.Client.EmuHawk
private void lvPsgWaveforms_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F2 && lvPsgWaveforms.SelectedItems.Count>0)
if (e.KeyCode == Keys.F2 && lvPsgWaveforms.SelectedItems.Count > 0)
{
lvPsgWaveforms.SelectedItems[0].BeginEdit();
}
@ -274,7 +272,6 @@ namespace BizHawk.Client.EmuHawk
private void lvChEn_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
}
private void lvChEn_ItemChecked(object sender, ItemCheckedEventArgs e)
@ -282,48 +279,5 @@ namespace BizHawk.Client.EmuHawk
for (int i = 0; i < 6; i++)
_pce.PSG.UserMute[i] = !lvChEn.Items[i].Checked;
}
private void PCESoundDebugger_Load(object sender, EventArgs e)
{
TopMost = Global.Config.PceSoundDebuggerSettings.TopMost;
if (Global.Config.PceSoundDebuggerSettings.UseWindowPosition)
{
Location = Global.Config.PceSoundDebuggerSettings.WindowPosition;
}
}
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
AutoloadMenuItem.Checked = Global.Config.PceSoundDebuggerAutoload;
SaveWindowPositionMenuItem.Checked = Global.Config.PceSoundDebuggerSettings.SaveWindowPosition;
TopMostMenuItem.Checked = Global.Config.PceSoundDebuggerSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.PceSoundDebuggerSettings.FloatingWindow;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceSoundDebuggerAutoload ^= true;
}
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceSoundDebuggerSettings.SaveWindowPosition ^= true;
}
private void TopMostMenuItem_Click(object sender, EventArgs e)
{
TopMost = Global.Config.PceSoundDebuggerSettings.TopMost ^= true;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceSoundDebuggerSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.PceSoundDebuggerSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
}
}