VirtualPadNES added

This commit is contained in:
andres.delikat 2011-06-12 18:58:30 +00:00
parent f36da18f97
commit 80d4017a7f
7 changed files with 83 additions and 74 deletions

View File

@ -276,7 +276,7 @@
<Compile Include="tools\Cheats.Designer.cs"> <Compile Include="tools\Cheats.Designer.cs">
<DependentUpon>Cheats.cs</DependentUpon> <DependentUpon>Cheats.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="tools\Pad.cs"> <Compile Include="tools\VirtualPad.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="tools\HexEditor.cs"> <Compile Include="tools\HexEditor.cs">
@ -352,6 +352,9 @@
<Compile Include="tools\ToolBox.Designer.cs"> <Compile Include="tools\ToolBox.Designer.cs">
<DependentUpon>ToolBox.cs</DependentUpon> <DependentUpon>ToolBox.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="tools\VirtualPadNES.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="tools\Watch.cs" /> <Compile Include="tools\Watch.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -436,8 +439,8 @@
<DependentUpon>Cheats.cs</DependentUpon> <DependentUpon>Cheats.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="tools\Pad.resx"> <EmbeddedResource Include="tools\VirtualPad.resx">
<DependentUpon>Pad.cs</DependentUpon> <DependentUpon>VirtualPad.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="tools\HexEditor.resx"> <EmbeddedResource Include="tools\HexEditor.resx">

View File

@ -71,7 +71,7 @@
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.Pad1 = new BizHawk.MultiClient.VirtualPad(); this.Pad1 = new BizHawk.MultiClient.VirtualPadNES();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
this.toolStripContainer1.SuspendLayout(); this.toolStripContainer1.SuspendLayout();
@ -89,7 +89,7 @@
this.settingsToolStripMenuItem}); this.settingsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(844, 24); this.menuStrip1.Size = new System.Drawing.Size(789, 24);
this.menuStrip1.TabIndex = 0; this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
// //
@ -354,7 +354,7 @@
this.toolStripSeparator4}); this.toolStripSeparator4});
this.toolStrip2.Location = new System.Drawing.Point(3, 25); this.toolStrip2.Location = new System.Drawing.Point(3, 25);
this.toolStrip2.Name = "toolStrip2"; this.toolStrip2.Name = "toolStrip2";
this.toolStrip2.Size = new System.Drawing.Size(93, 25); this.toolStrip2.Size = new System.Drawing.Size(62, 25);
this.toolStrip2.TabIndex = 1; this.toolStrip2.TabIndex = 1;
// //
// StopButton // StopButton
@ -428,7 +428,7 @@
this.groupBox1.Controls.Add(this.Pad1); this.groupBox1.Controls.Add(this.Pad1);
this.groupBox1.Location = new System.Drawing.Point(373, 108); this.groupBox1.Location = new System.Drawing.Point(373, 108);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(445, 280); this.groupBox1.Size = new System.Drawing.Size(401, 197);
this.groupBox1.TabIndex = 4; this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Controllers"; this.groupBox1.Text = "Controllers";
@ -438,14 +438,14 @@
this.Pad1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.Pad1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.Pad1.Location = new System.Drawing.Point(6, 19); this.Pad1.Location = new System.Drawing.Point(6, 19);
this.Pad1.Name = "Pad1"; this.Pad1.Name = "Pad1";
this.Pad1.Size = new System.Drawing.Size(176, 80); this.Pad1.Size = new System.Drawing.Size(174, 74);
this.Pad1.TabIndex = 0; this.Pad1.TabIndex = 0;
// //
// TAStudio // TAStudio
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(844, 474); this.ClientSize = new System.Drawing.Size(789, 474);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ReadOnlyCheckBox); this.Controls.Add(this.ReadOnlyCheckBox);
this.Controls.Add(this.toolStripContainer1); this.Controls.Add(this.toolStripContainer1);
@ -516,6 +516,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private VirtualPad Pad1; private VirtualPadNES Pad1;
} }
} }

View File

@ -12,6 +12,7 @@ namespace BizHawk.MultiClient
public partial class TAStudio : Form public partial class TAStudio : Form
{ {
//TODO: //TODO:
//Crash when closing TASStudio
//Right-click - Go to current frame //Right-click - Go to current frame
//Clicking a frame should go there //Clicking a frame should go there
@ -36,9 +37,8 @@ namespace BizHawk.MultiClient
public string GetMnemonic() public string GetMnemonic()
{ {
StringBuilder str = new StringBuilder(""); StringBuilder str = new StringBuilder("|0|"); //TODO: Control Command virtual pad
str.Append(Pad1.GetMnemonic()); str.Append(Pad1.GetMnemonic());
//Loop through active controllers and append string data
return str.ToString(); return str.ToString();
} }

View File

@ -145,6 +145,9 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>324, 17</value> <value>324, 17</value>
</metadata> </metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>324, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>416, 17</value> <value>416, 17</value>
</metadata> </metadata>

View File

@ -0,0 +1,44 @@
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 VirtualPad : Panel
{
public Point[] ButtonPoints = new Point[8];
public CheckBox PU;
public CheckBox PD;
public CheckBox PL;
public CheckBox PR;
public CheckBox B1;
public CheckBox B2;
public CheckBox B3;
public CheckBox B4;
public CheckBox B5;
public CheckBox B6;
public CheckBox B7;
public CheckBox B8;
public VirtualPad()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
this.BorderStyle = BorderStyle.Fixed3D;
this.Size = new Size(174, 74);
}
public virtual string GetMnemonic()
{
return "......|";
}
}
}

View File

@ -8,43 +8,26 @@ using System.Globalization;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
public class VirtualPad : Panel public class VirtualPadNES : VirtualPad
{ {
public enum ControllerType { NES, SMS, PCE }
Point[] NESPoints = new Point[8];
public ControllerType Controller;
public CheckBox PU; public VirtualPadNES()
public CheckBox PD;
public CheckBox PL;
public CheckBox PR;
public CheckBox B1;
public CheckBox B2;
public CheckBox B3;
public CheckBox B4;
public CheckBox B5;
public CheckBox B6;
public CheckBox B7;
public CheckBox B8;
public VirtualPad()
{ {
Controller = ControllerType.NES; //Default ButtonPoints[0] = new Point(14, 2);
NESPoints[0] = new Point(14, 2); ButtonPoints[1] = new Point(14, 46);
NESPoints[1] = new Point(14, 46); ButtonPoints[2] = new Point(2, 24);
NESPoints[2] = new Point(2, 24); ButtonPoints[3] = new Point(24, 24);
NESPoints[3] = new Point(24, 24); ButtonPoints[4] = new Point(52, 24);
NESPoints[4] = new Point(52, 24); ButtonPoints[5] = new Point(74, 24);
NESPoints[5] = new Point(74, 24); ButtonPoints[6] = new Point(122, 24);
NESPoints[6] = new Point(122, 24); ButtonPoints[7] = new Point(146, 24);
NESPoints[7] = new Point(146, 24);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.DoubleBuffer, true);
this.BorderStyle = BorderStyle.Fixed3D; this.BorderStyle = BorderStyle.Fixed3D;
this.Paint += new System.Windows.Forms.PaintEventHandler(this.VirtualPad_Paint); this.Paint += new System.Windows.Forms.PaintEventHandler(this.VirtualPad_Paint);
this.Size = new Size(174, 164); this.Size = new Size(174, 74);
Point n = new Point(this.Size); Point n = new Point(this.Size);
@ -53,16 +36,16 @@ namespace BizHawk.MultiClient
this.PU.AutoSize = true; this.PU.AutoSize = true;
this.PU.Image = global::BizHawk.MultiClient.Properties.Resources.BlueUp; this.PU.Image = global::BizHawk.MultiClient.Properties.Resources.BlueUp;
this.PU.ImageAlign = System.Drawing.ContentAlignment.BottomRight; this.PU.ImageAlign = System.Drawing.ContentAlignment.BottomRight;
this.PU.Location = NESPoints[0]; this.PU.Location = ButtonPoints[0];
this.PU.TabIndex = 1; this.PU.TabIndex = 1;
this.PU.UseVisualStyleBackColor = true; ; this.PU.UseVisualStyleBackColor = true;
this.PD = new CheckBox(); this.PD = new CheckBox();
this.PD.Appearance = System.Windows.Forms.Appearance.Button; this.PD.Appearance = System.Windows.Forms.Appearance.Button;
this.PD.AutoSize = true; this.PD.AutoSize = true;
this.PD.Image = global::BizHawk.MultiClient.Properties.Resources.BlueDown; this.PD.Image = global::BizHawk.MultiClient.Properties.Resources.BlueDown;
this.PD.ImageAlign = System.Drawing.ContentAlignment.BottomRight; this.PD.ImageAlign = System.Drawing.ContentAlignment.BottomRight;
this.PD.Location = NESPoints[1]; this.PD.Location = ButtonPoints[1];
this.PD.TabIndex = 4; this.PD.TabIndex = 4;
this.PD.UseVisualStyleBackColor = true; this.PD.UseVisualStyleBackColor = true;
@ -71,7 +54,7 @@ namespace BizHawk.MultiClient
this.PR.AutoSize = true; this.PR.AutoSize = true;
this.PR.Image = global::BizHawk.MultiClient.Properties.Resources.Forward; this.PR.Image = global::BizHawk.MultiClient.Properties.Resources.Forward;
this.PR.ImageAlign = System.Drawing.ContentAlignment.BottomRight; this.PR.ImageAlign = System.Drawing.ContentAlignment.BottomRight;
this.PR.Location = NESPoints[3]; this.PR.Location = ButtonPoints[3];
this.PR.TabIndex = 3; this.PR.TabIndex = 3;
this.PR.UseVisualStyleBackColor = true; this.PR.UseVisualStyleBackColor = true;
@ -80,14 +63,14 @@ namespace BizHawk.MultiClient
this.PL.AutoSize = true; this.PL.AutoSize = true;
this.PL.Image = global::BizHawk.MultiClient.Properties.Resources.Back; this.PL.Image = global::BizHawk.MultiClient.Properties.Resources.Back;
this.PL.ImageAlign = System.Drawing.ContentAlignment.BottomRight; this.PL.ImageAlign = System.Drawing.ContentAlignment.BottomRight;
this.PL.Location = NESPoints[2]; this.PL.Location = ButtonPoints[2];
this.PL.TabIndex = 2; this.PL.TabIndex = 2;
this.PL.UseVisualStyleBackColor = true; this.PL.UseVisualStyleBackColor = true;
this.B1 = new CheckBox(); this.B1 = new CheckBox();
this.B1.Appearance = System.Windows.Forms.Appearance.Button; this.B1.Appearance = System.Windows.Forms.Appearance.Button;
this.B1.AutoSize = true; this.B1.AutoSize = true;
this.B1.Location = NESPoints[4]; this.B1.Location = ButtonPoints[4];
this.B1.TabIndex = 5; this.B1.TabIndex = 5;
this.B1.Text = "s"; this.B1.Text = "s";
this.B1.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -96,7 +79,7 @@ namespace BizHawk.MultiClient
this.B2 = new CheckBox(); this.B2 = new CheckBox();
this.B2.Appearance = System.Windows.Forms.Appearance.Button; this.B2.Appearance = System.Windows.Forms.Appearance.Button;
this.B2.AutoSize = true; this.B2.AutoSize = true;
this.B2.Location = NESPoints[5]; this.B2.Location = ButtonPoints[5];
this.B2.TabIndex = 6; this.B2.TabIndex = 6;
this.B2.Text = "S"; this.B2.Text = "S";
this.B2.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B2.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -105,7 +88,7 @@ namespace BizHawk.MultiClient
this.B3 = new CheckBox(); this.B3 = new CheckBox();
this.B3.Appearance = System.Windows.Forms.Appearance.Button; this.B3.Appearance = System.Windows.Forms.Appearance.Button;
this.B3.AutoSize = true; this.B3.AutoSize = true;
this.B3.Location = NESPoints[6]; this.B3.Location = ButtonPoints[6];
this.B3.TabIndex = 7; this.B3.TabIndex = 7;
this.B3.Text = "B"; this.B3.Text = "B";
this.B3.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B3.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -114,7 +97,7 @@ namespace BizHawk.MultiClient
this.B4 = new CheckBox(); this.B4 = new CheckBox();
this.B4.Appearance = System.Windows.Forms.Appearance.Button; this.B4.Appearance = System.Windows.Forms.Appearance.Button;
this.B4.AutoSize = true; this.B4.AutoSize = true;
this.B4.Location = NESPoints[7]; this.B4.Location = ButtonPoints[7];
this.B4.TabIndex = 8; this.B4.TabIndex = 8;
this.B4.Text = "A"; this.B4.Text = "A";
this.B4.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.B4.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
@ -161,21 +144,7 @@ namespace BizHawk.MultiClient
} }
public string GetMnemonic() public override string GetMnemonic()
{
switch (Controller)
{
default:
case ControllerType.NES:
return GetMnemonicNES();
case ControllerType.PCE:
return GetMnemonicPCE();
case ControllerType.SMS:
return GetMnemonicSMS();
}
}
public string GetMnemonicNES()
{ {
StringBuilder input = new StringBuilder("|0|"); //TODO: Reset button StringBuilder input = new StringBuilder("|0|"); //TODO: Reset button
input.Append(PR.Checked ? "R" : "."); input.Append(PR.Checked ? "R" : ".");
@ -190,15 +159,5 @@ namespace BizHawk.MultiClient
input.Append("|"); input.Append("|");
return input.ToString(); return input.ToString();
} }
private string GetMnemonicPCE()
{
return "";
}
private string GetMnemonicSMS()
{
return "";
}
} }
} }