Some virtual pad progress, virtual pad dumps input into movie file when recording, currently doesn't feed it to the core though (lol). Virtualpad object set up for a nes controller

This commit is contained in:
andres.delikat 2011-06-12 14:42:50 +00:00
parent 368faf64f4
commit 59173e4e44
4 changed files with 629 additions and 554 deletions

View File

@ -1162,7 +1162,8 @@ namespace BizHawk.MultiClient
UnpauseEmulator(); UnpauseEmulator();
} }
} }
wasPressed = Global.ActiveController.GetControllersAsMnemonic();
wasPressed = (TAStudio1.Enabled) ? TAStudio1.GetMnemonic() : Global.ActiveController.GetControllersAsMnemonic();
PressFrameAdvance = false; PressFrameAdvance = false;
} }
else else
@ -1236,7 +1237,9 @@ namespace BizHawk.MultiClient
Global.ActiveController.MovieMode = false; Global.ActiveController.MovieMode = false;
} }
else else
{
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1); Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
}
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.FINISHED) if (UserMovie.GetMovieMode() == MOVIEMODE.FINISHED)

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,10 @@ namespace BizHawk.MultiClient
{ {
public class VirtualPad : Panel public class VirtualPad : Panel
{ {
public enum ControllerType { NES, SMS, PCE }
Point[] NESPoints = new Point[8];
public ControllerType Controller;
public CheckBox PU; public CheckBox PU;
public CheckBox PD; public CheckBox PD;
public CheckBox PL; public CheckBox PL;
@ -18,9 +22,23 @@ namespace BizHawk.MultiClient
public CheckBox B2; public CheckBox B2;
public CheckBox B3; public CheckBox B3;
public CheckBox B4; public CheckBox B4;
public CheckBox B5;
public CheckBox B6;
public CheckBox B7;
public CheckBox B8;
public VirtualPad() public VirtualPad()
{ {
Controller = ControllerType.NES; //Default
NESPoints[0] = new Point(14, 2);
NESPoints[1] = new Point(14, 46);
NESPoints[2] = new Point(2, 24);
NESPoints[3] = new Point(24, 24);
NESPoints[4] = new Point(52, 24);
NESPoints[5] = new Point(74, 24);
NESPoints[6] = new Point(122, 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);
@ -35,7 +53,7 @@ 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 = new System.Drawing.Point(14, 2); this.PU.Location = NESPoints[0];
this.PU.TabIndex = 1; this.PU.TabIndex = 1;
this.PU.UseVisualStyleBackColor = true; ; this.PU.UseVisualStyleBackColor = true; ;
@ -44,7 +62,7 @@ namespace BizHawk.MultiClient
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 = new System.Drawing.Point(14, 46); this.PD.Location = NESPoints[1];
this.PD.TabIndex = 4; this.PD.TabIndex = 4;
this.PD.UseVisualStyleBackColor = true; this.PD.UseVisualStyleBackColor = true;
@ -53,7 +71,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 = new System.Drawing.Point(24, 24); this.PR.Location = NESPoints[3];
this.PR.TabIndex = 3; this.PR.TabIndex = 3;
this.PR.UseVisualStyleBackColor = true; this.PR.UseVisualStyleBackColor = true;
@ -62,14 +80,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 = new System.Drawing.Point(2, 24); this.PL.Location = NESPoints[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 = new System.Drawing.Point(52, 24); this.B1.Location = NESPoints[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;
@ -78,7 +96,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 = new System.Drawing.Point(74, 24); this.B2.Location = NESPoints[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;
@ -87,7 +105,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 = new System.Drawing.Point(122, 24); this.B3.Location = NESPoints[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;
@ -96,7 +114,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 = new System.Drawing.Point(146, 24); this.B4.Location = NESPoints[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;
@ -142,5 +160,45 @@ namespace BizHawk.MultiClient
{ {
} }
public 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
input.Append(PR.Checked ? "R" : ".");
input.Append(PL.Checked ? "L" : ".");
input.Append(PD.Checked ? "D" : ".");
input.Append(PU.Checked ? "U" : ".");
input.Append(B2.Checked ? "S" : ".");
input.Append(B1.Checked ? "s" : ".");
input.Append(B3.Checked ? "B" : ".");
input.Append(B4.Checked ? "A" : ".");
input.Append("|");
return input.ToString();
}
private string GetMnemonicPCE()
{
return "";
}
private string GetMnemonicSMS()
{
return "";
}
} }
} }

View File

@ -13,6 +13,8 @@ namespace BizHawk.MultiClient
{ {
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight; int defaultHeight;
public bool Engaged; //When engaged the Client will listen to TAStudio for input
public TAStudio() public TAStudio()
{ {
@ -28,6 +30,14 @@ namespace BizHawk.MultiClient
DisplayList(); DisplayList();
} }
public string GetMnemonic()
{
StringBuilder str = new StringBuilder("");
str.Append(Pad1.GetMnemonic());
//Loop through active controllers and append string data
return str.ToString();
}
private void TASView_QueryItemBkColor(int index, int column, ref Color color) private void TASView_QueryItemBkColor(int index, int column, ref Color color)
{ {
if (index == Global.Emulator.Frame) if (index == Global.Emulator.Frame)
@ -51,6 +61,12 @@ namespace BizHawk.MultiClient
private void TAStudio_Load(object sender, EventArgs e) private void TAStudio_Load(object sender, EventArgs e)
{ {
//TODO: don't engage until new/open project
//
Engaged = true;
Global.RenderPanel.AddMessage("TAStudio engaged");
//
LoadConfigSettings(); LoadConfigSettings();
ReadOnlyCheckBox.Checked = Global.MainForm.ReadOnly; ReadOnlyCheckBox.Checked = Global.MainForm.ReadOnly;
DisplayList(); DisplayList();
@ -170,10 +186,5 @@ namespace BizHawk.MultiClient
if (Global.MainForm.ReadOnly) if (Global.MainForm.ReadOnly)
return; return;
} }
private void Pad1_Paint(object sender, PaintEventArgs e)
{
}
} }
} }