NES & SMS controls VirtualPads (Reset/Pause/Power/Etc)
This commit is contained in:
parent
1cef6ac3be
commit
e4ba668d31
|
@ -391,12 +391,18 @@
|
|||
<Compile Include="tools\VirtualPadNES.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPadNESControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPadPCE.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPadSMS.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPadSMSControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\Watch.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -61,12 +61,14 @@ namespace BizHawk.MultiClient
|
|||
case "NES":
|
||||
Pads[0].SetButtons(str.Substring(3, 8));
|
||||
Pads[1].SetButtons(str.Substring(12, 8));
|
||||
Pads[2].SetButtons(str[1].ToString());
|
||||
break;
|
||||
case "SMS":
|
||||
case "GG":
|
||||
case "SG":
|
||||
Pads[0].SetButtons(str.Substring(0, 6));
|
||||
Pads[0].SetButtons(str.Substring(7, 6));
|
||||
Pads[1].SetButtons(str.Substring(7, 6));
|
||||
Pads[2].SetButtons(str.Substring(14, 2));
|
||||
break;
|
||||
case "PCE":
|
||||
case "SGX":
|
||||
|
@ -145,6 +147,10 @@ namespace BizHawk.MultiClient
|
|||
Pads.Add(nespad2);
|
||||
ControllerBox.Controls.Add(Pads[0]);
|
||||
ControllerBox.Controls.Add(Pads[1]);
|
||||
VirtualPadNESControl controlpad1 = new VirtualPadNESControl();
|
||||
controlpad1.Location = new Point(8, 109);
|
||||
Pads.Add(controlpad1);
|
||||
ControllerBox.Controls.Add(Pads[2]);
|
||||
break;
|
||||
case "SMS":
|
||||
case "SG": //TODO: correct sys ID???
|
||||
|
@ -159,6 +165,10 @@ namespace BizHawk.MultiClient
|
|||
Pads.Add(smspad2);
|
||||
ControllerBox.Controls.Add(Pads[0]);
|
||||
ControllerBox.Controls.Add(Pads[1]);
|
||||
VirtualPadSMSControl controlpad2 = new VirtualPadSMSControl();
|
||||
controlpad2.Location = new Point(8, 109);
|
||||
Pads.Add(controlpad2);
|
||||
ControllerBox.Controls.Add(Pads[2]);
|
||||
break;
|
||||
case "PCE":
|
||||
VirtualPadPCE pcepad1 = new VirtualPadPCE();
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public class VirtualPadNESControl : VirtualPad
|
||||
{
|
||||
|
||||
public VirtualPadNESControl()
|
||||
{
|
||||
ButtonPoints[0] = new Point(2, 2);
|
||||
ButtonPoints[1] = new Point(56, 2);
|
||||
|
||||
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.BorderStyle = BorderStyle.Fixed3D;
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.VirtualPad_Paint);
|
||||
this.Size = new Size(108, 34);
|
||||
|
||||
Point n = new Point(this.Size);
|
||||
|
||||
|
||||
this.B1 = new CheckBox();
|
||||
this.B1.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.B1.AutoSize = true;
|
||||
this.B1.Location = ButtonPoints[0];
|
||||
this.B1.TabIndex = 5;
|
||||
this.B1.Text = "Power";
|
||||
this.B1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
this.B1.UseVisualStyleBackColor = true;
|
||||
this.B1.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged);
|
||||
this.B1.Enabled = false; //Until a hard reset is emulated by NESHawk
|
||||
this.B1.ForeColor = Color.Red;
|
||||
|
||||
this.B2 = new CheckBox();
|
||||
this.B2.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.B2.AutoSize = true;
|
||||
this.B2.Location = ButtonPoints[1];
|
||||
this.B2.TabIndex = 6;
|
||||
this.B2.Text = "Reset";
|
||||
this.B2.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
this.B2.UseVisualStyleBackColor = true;
|
||||
this.B2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged);
|
||||
this.B2.ForeColor = Color.Red;
|
||||
|
||||
this.Controls.Add(this.B1);
|
||||
this.Controls.Add(this.B2);
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.Up)
|
||||
{
|
||||
//TODO: move to next logical key
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Down)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Left)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Right)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Tab)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void VirtualPad_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string GetMnemonic()
|
||||
{
|
||||
StringBuilder input = new StringBuilder("");
|
||||
input.Append(B2.Checked ? "1" : ".");
|
||||
input.Append("|");
|
||||
return input.ToString();
|
||||
}
|
||||
|
||||
public override void SetButtons(string buttons)
|
||||
{
|
||||
if (buttons.Length < 1) return;
|
||||
if (buttons[0] == '.') B2.Checked = false; else B2.Checked = true;
|
||||
}
|
||||
|
||||
private void Buttons_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Emulator.SystemId != "NES") return;
|
||||
else if (sender == B2)
|
||||
Global.StickyXORAdapter.SetSticky("Reset", B2.Checked);
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
if (Global.Emulator.SystemId != "NES") return;
|
||||
|
||||
B1.Checked = false;
|
||||
B2.Checked = false;
|
||||
|
||||
Global.StickyXORAdapter.SetSticky("Reset", false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public class VirtualPadSMSControl : VirtualPad
|
||||
{
|
||||
|
||||
public VirtualPadSMSControl()
|
||||
{
|
||||
ButtonPoints[0] = new Point(2, 2);
|
||||
ButtonPoints[1] = new Point(56, 2);
|
||||
|
||||
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.BorderStyle = BorderStyle.Fixed3D;
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.VirtualPad_Paint);
|
||||
this.Size = new Size(108, 34);
|
||||
|
||||
Point n = new Point(this.Size);
|
||||
|
||||
|
||||
this.B1 = new CheckBox();
|
||||
this.B1.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.B1.AutoSize = true;
|
||||
this.B1.Location = ButtonPoints[0];
|
||||
this.B1.TabIndex = 5;
|
||||
this.B1.Text = "Pause";
|
||||
this.B1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
this.B1.UseVisualStyleBackColor = true;
|
||||
this.B1.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged);
|
||||
this.B1.ForeColor = Color.Red;
|
||||
|
||||
this.B2 = new CheckBox();
|
||||
this.B2.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.B2.AutoSize = true;
|
||||
this.B2.Location = ButtonPoints[1];
|
||||
this.B2.TabIndex = 6;
|
||||
this.B2.Text = "Reset";
|
||||
this.B2.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
this.B2.UseVisualStyleBackColor = true;
|
||||
this.B2.CheckedChanged += new System.EventHandler(this.Buttons_CheckedChanged);
|
||||
this.B2.ForeColor = Color.Red;
|
||||
|
||||
this.Controls.Add(this.B1);
|
||||
this.Controls.Add(this.B2);
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.Up)
|
||||
{
|
||||
//TODO: move to next logical key
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Down)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Left)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Right)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
else if (keyData == Keys.Tab)
|
||||
{
|
||||
this.Refresh();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void VirtualPad_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string GetMnemonic()
|
||||
{
|
||||
StringBuilder input = new StringBuilder("");
|
||||
input.Append(B1.Checked ? "P" : ".");
|
||||
input.Append(B2.Checked ? "R" : ".");
|
||||
input.Append("|");
|
||||
return input.ToString();
|
||||
}
|
||||
|
||||
public override void SetButtons(string buttons)
|
||||
{
|
||||
if (buttons.Length < 2) return;
|
||||
if (buttons[0] == '.') B1.Checked = false; else B1.Checked = true;
|
||||
if (buttons[1] == '.') B2.Checked = false; else B2.Checked = true;
|
||||
}
|
||||
|
||||
private void Buttons_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Emulator.SystemId != "SMS") return;
|
||||
else if (sender == B1)
|
||||
Global.StickyXORAdapter.SetSticky("Pause", B1.Checked);
|
||||
else if (sender == B2)
|
||||
Global.StickyXORAdapter.SetSticky("Reset", B2.Checked);
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
if (Global.Emulator.SystemId != "SMS") return;
|
||||
|
||||
B1.Checked = false;
|
||||
B2.Checked = false;
|
||||
Global.StickyXORAdapter.SetSticky("Pause", false);
|
||||
Global.StickyXORAdapter.SetSticky("Reset", false);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue