2013-07-14 22:18:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
using BizHawk.Client.Common;
|
|
|
|
|
|
2013-07-14 22:18:22 +00:00
|
|
|
|
namespace BizHawk.MultiClient
|
|
|
|
|
{
|
|
|
|
|
public partial class VirtualPadSaturn : UserControl, IVirtualPad
|
|
|
|
|
{
|
|
|
|
|
public string Controller = "P1";
|
|
|
|
|
|
|
|
|
|
public VirtualPadSaturn()
|
|
|
|
|
{
|
|
|
|
|
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.UserPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.DoubleBuffer, true);
|
|
|
|
|
BorderStyle = BorderStyle.Fixed3D;
|
|
|
|
|
Paint += VirtualPad_Paint;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void VirtualPadSaturn_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void VirtualPad_Paint(object sender, PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
|
|
|
{
|
|
|
|
|
if (keyData == Keys.Up)
|
|
|
|
|
{
|
|
|
|
|
//TODO: move to next logical key
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
else if (keyData == Keys.Down)
|
|
|
|
|
{
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
else if (keyData == Keys.Left)
|
|
|
|
|
{
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
else if (keyData == Keys.Right)
|
|
|
|
|
{
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
else if (keyData == Keys.Tab)
|
|
|
|
|
{
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetMnemonic()
|
|
|
|
|
{
|
|
|
|
|
StringBuilder input = new StringBuilder("");
|
|
|
|
|
input.Append(PU.Checked ? "U" : ".");
|
|
|
|
|
input.Append(PD.Checked ? "D" : ".");
|
|
|
|
|
input.Append(PL.Checked ? "L" : ".");
|
|
|
|
|
input.Append(PR.Checked ? "R" : ".");
|
|
|
|
|
|
|
|
|
|
input.Append(BStart.Checked ? "S" : ".");
|
|
|
|
|
input.Append(BX.Checked ? "X" : ".");
|
|
|
|
|
input.Append(BY.Checked ? "Y" : ".");
|
|
|
|
|
input.Append(BZ.Checked ? "Z" : ".");
|
|
|
|
|
input.Append(BA.Checked ? "A" : ".");
|
|
|
|
|
input.Append(BB.Checked ? "B" : ".");
|
|
|
|
|
input.Append(BC.Checked ? "C" : ".");
|
|
|
|
|
|
|
|
|
|
input.Append(BL.Checked ? "L" : ".");
|
|
|
|
|
input.Append(BR.Checked ? "R" : ".");
|
|
|
|
|
|
|
|
|
|
input.Append("|");
|
|
|
|
|
return input.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Clear()
|
|
|
|
|
{
|
2013-10-20 18:02:43 +00:00
|
|
|
|
if (Global.Emulator.SystemId != "SAT") return;
|
2013-07-14 22:18:22 +00:00
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);
|
|
|
|
|
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false);
|
|
|
|
|
if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false);
|
|
|
|
|
if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
if (BStart.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", false);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
if (BX.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " X", false);
|
|
|
|
|
if (BY.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Y", false);
|
|
|
|
|
if (BZ.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Z", false);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
if (BA.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", false);
|
|
|
|
|
if (BB.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", false);
|
|
|
|
|
if (BC.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " C", false);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
|
2013-10-25 00:57:23 +00:00
|
|
|
|
if (BL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", false);
|
|
|
|
|
if (BR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", false);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
|
|
|
|
|
PU.Checked = false;
|
|
|
|
|
PD.Checked = false;
|
|
|
|
|
PL.Checked = false;
|
|
|
|
|
PR.Checked = false;
|
|
|
|
|
|
|
|
|
|
BX.Checked = false;
|
|
|
|
|
BY.Checked = false;
|
|
|
|
|
BZ.Checked = false;
|
|
|
|
|
|
|
|
|
|
BA.Checked = false;
|
|
|
|
|
BB.Checked = false;
|
|
|
|
|
BC.Checked = false;
|
|
|
|
|
|
|
|
|
|
BL.Checked = false;
|
|
|
|
|
BR.Checked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetButtons(string buttons)
|
|
|
|
|
{
|
|
|
|
|
if (buttons.Length < 13) return;
|
|
|
|
|
|
|
|
|
|
if (buttons[0] == '.') PU.Checked = false; else PU.Checked = true;
|
|
|
|
|
if (buttons[1] == '.') PD.Checked = false; else PD.Checked = true;
|
|
|
|
|
if (buttons[2] == '.') PL.Checked = false; else PL.Checked = true;
|
|
|
|
|
if (buttons[3] == '.') PR.Checked = false; else PR.Checked = true;
|
|
|
|
|
if (buttons[4] == '.') BStart.Checked = false; else BStart.Checked = true;
|
|
|
|
|
if (buttons[5] == '.') BX.Checked = false; else BX.Checked = true;
|
|
|
|
|
if (buttons[6] == '.') BY.Checked = false; else BY.Checked = true;
|
|
|
|
|
if (buttons[7] == '.') BZ.Checked = false; else BZ.Checked = true;
|
|
|
|
|
if (buttons[8] == '.') BA.Checked = false; else BA.Checked = true;
|
|
|
|
|
if (buttons[9] == '.') BB.Checked = false; else BB.Checked = true;
|
|
|
|
|
if (buttons[10] == '.') BC.Checked = false; else BC.Checked = true;
|
|
|
|
|
if (buttons[11] == '.') BL.Checked = false; else BL.Checked = true;
|
|
|
|
|
if (buttons[12] == '.') BR.Checked = false; else BR.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Buttons_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-10-20 18:02:43 +00:00
|
|
|
|
if (Global.Emulator.SystemId != "SAT")
|
2013-07-14 22:18:22 +00:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (sender == PU)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == PD)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == PL)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == PR)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BStart)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", BStart.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BX)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " X", BX.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BY)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Y", BY.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BZ)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Z", BZ.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BA)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", BA.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BB)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", BB.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BC)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " C", BC.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BL)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", BL.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
else if (sender == BR)
|
|
|
|
|
{
|
2013-10-25 00:57:23 +00:00
|
|
|
|
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", BR.Checked);
|
2013-07-14 22:18:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|