Added Min/Max ranges for N64.

Added the option to add more controllers.
This commit is contained in:
xmikecampx7 2014-04-27 17:38:30 +00:00
parent c4a4ca069d
commit b5c0be3f7f
5 changed files with 608 additions and 476 deletions

View File

@ -52,8 +52,8 @@ namespace BizHawk.Client.EmuHawk
private int GFXToReal(int val)
{
int ret = (val * 2);
if (ret > 127) ret = 127;
if (ret < -128) ret = -128;
if (ret > Max) ret = Max;
if (ret < Min) ret = Min;
return ret;
}
@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
Refresh();
}
public static int Max = 127;
public static int Min = -127;
public static int Max;
public static int Min;
}
}

View File

@ -45,6 +45,7 @@
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.StickyBox = new System.Windows.Forms.CheckBox();
this.ClearButton = new System.Windows.Forms.Button();
this.addPlayerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@ -67,12 +68,12 @@
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ClearMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(102, 26);
this.contextMenuStrip1.Size = new System.Drawing.Size(100, 26);
//
// ClearMenuItem
//
this.ClearMenuItem.Name = "ClearMenuItem";
this.ClearMenuItem.Size = new System.Drawing.Size(101, 22);
this.ClearMenuItem.Size = new System.Drawing.Size(99, 22);
this.ClearMenuItem.Text = "&Clear";
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
@ -80,7 +81,8 @@
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.OptionsSubMenu});
this.OptionsSubMenu,
this.addPlayerToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(452, 24);
@ -99,60 +101,60 @@
this.toolStripSeparator1,
this.ExitMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.OptionsSubMenu.Size = new System.Drawing.Size(56, 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(199, 22);
this.AutoloadMenuItem.Size = new System.Drawing.Size(192, 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(199, 22);
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(192, 22);
this.SaveWindowPositionMenuItem.Text = "&Save Window Position";
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
//
// AlwaysOnTopMenuItem
//
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(199, 22);
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(192, 22);
this.AlwaysOnTopMenuItem.Text = "Always On Top";
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
//
// FloatingWindowMenuItem
//
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(199, 22);
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(192, 22);
this.FloatingWindowMenuItem.Text = "Floating Window";
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(196, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(189, 6);
//
// RestoreDefaultSettingsMenuItem
//
this.RestoreDefaultSettingsMenuItem.Name = "RestoreDefaultSettingsMenuItem";
this.RestoreDefaultSettingsMenuItem.Size = new System.Drawing.Size(199, 22);
this.RestoreDefaultSettingsMenuItem.Size = new System.Drawing.Size(192, 22);
this.RestoreDefaultSettingsMenuItem.Text = "Restore Default Settings";
this.RestoreDefaultSettingsMenuItem.Click += new System.EventHandler(this.RestoreDefaultSettingsMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(196, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(189, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(199, 22);
this.ExitMenuItem.Size = new System.Drawing.Size(192, 22);
this.ExitMenuItem.Text = "E&xit";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
@ -181,6 +183,13 @@
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
// addPlayerToolStripMenuItem
//
this.addPlayerToolStripMenuItem.Name = "addPlayerToolStripMenuItem";
this.addPlayerToolStripMenuItem.Size = new System.Drawing.Size(93, 20);
this.addPlayerToolStripMenuItem.Text = "Add Controllers";
this.addPlayerToolStripMenuItem.Click += new System.EventHandler(this.addPlayerToolStripMenuItem_Click);
//
// VirtualPadForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -222,5 +231,6 @@
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.Button ClearButton;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
private System.Windows.Forms.ToolStripMenuItem addPlayerToolStripMenuItem;
}
}

View File

@ -168,46 +168,33 @@ namespace BizHawk.Client.EmuHawk
{
case "A26":
ControllerBox.Controls.Add(new VirtualPadA26 { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadA26 { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadA26Control { Location = new Point(8, 109) });
break;
case "A78":
ControllerBox.Controls.Add(new VirtualPadA78 { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadA78 { Location = new Point(150, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadA78Control { Location = new Point(8, 125) });
break;
case "NES":
ControllerBox.Controls.Add(new VirtualPadNES { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadNES { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadNESControl { Location = new Point(8, 109) });
break;
case "N64":
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(208, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(408, 19), Controller = "P3" });
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(608, 19), Controller = "P4" });
ControllerBox.Controls.Add(new VirtualPadN64Control { Location = new Point(8, 350) });
break;
case "SMS":
case "SG":
case "GG":
ControllerBox.Controls.Add(new VirtualPadSMS { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadSMS { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadSMSControl { Location = new Point(8, 109) });
break;
case "PCE":
case "PCECD":
case "SGX":
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(8, 109), Controller = "P3" });
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(188, 109), Controller = "P4" });
break;
case "SNES":
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(8, 95), Controller = "P3" });
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(188, 95), Controller = "P4" });
ControllerBox.Controls.Add(new VirtualPadSNESControl { Location = new Point(8, 170) });
break;
case "GB":
@ -220,23 +207,18 @@ namespace BizHawk.Client.EmuHawk
break;
case "GEN":
ControllerBox.Controls.Add(new VirtualPadGen6Button { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadGen6Button { Location = new Point(195, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadNESControl { Location = new Point(8, 105) });
break;
case "Coleco":
var coleco1 = new VirtualPadColeco { Location = new Point(8, 19), Controller = "P1" };
var coleco2 = new VirtualPadColeco { Location = new Point(130, 19), Controller = "P2" };
ControllerBox.Controls.Add(coleco1);
ControllerBox.Controls.Add(coleco2);
break;
case "C64":
ControllerBox.Controls.Add(new VirtualPadC64Keyboard { Location = new Point(8, 19) });
ControllerBox.Controls.Add(new VirtualPadA26 { Location = new Point(8, 159), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadA26 { Location = new Point(218, 159), Controller = "P2" });
break;
case "SAT":
ControllerBox.Controls.Add(new VirtualPadSaturn { Location = new Point(8, 19), Controller = "P1" });
ControllerBox.Controls.Add(new VirtualPadSaturn { Location = new Point(213, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadSaturnControl { Location = new Point(8, 125) });
break;
}
@ -344,6 +326,65 @@ namespace BizHawk.Client.EmuHawk
#endregion
private void addPlayerToolStripMenuItem_Click(object sender, EventArgs e)
{
switch (Global.Emulator.SystemId)
{
case "A26":
ControllerBox.Controls.Add(new VirtualPadA26 { Location = new Point(188, 19), Controller = "P2" });
break;
case "A78":
ControllerBox.Controls.Add(new VirtualPadA78 { Location = new Point(150, 19), Controller = "P2" });
break;
case "NES":
ControllerBox.Controls.Add(new VirtualPadNES { Location = new Point(188, 19), Controller = "P2" });
break;
case "N64":
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(208, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(408, 19), Controller = "P3" });
ControllerBox.Controls.Add(new VirtualPadN64 { Location = new Point(608, 19), Controller = "P4" });
break;
case "SMS":
case "SG":
case "GG":
ControllerBox.Controls.Add(new VirtualPadSMS { Location = new Point(188, 19), Controller = "P2" });
break;
case "PCE":
case "PCECD":
case "SGX":
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(8, 109), Controller = "P3" });
ControllerBox.Controls.Add(new VirtualPadPCE { Location = new Point(188, 109), Controller = "P4" });
break;
case "SNES":
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(188, 19), Controller = "P2" });
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(8, 95), Controller = "P3" });
ControllerBox.Controls.Add(new VirtualPadSNES { Location = new Point(188, 95), Controller = "P4" });
break;
case "GB":
case "GBC":
ControllerBox.Controls.Add(new VirtualPadGB { Location = new Point(8, 19), Controller = string.Empty });
ControllerBox.Controls.Add(new VirtualPadGBControl { Location = new Point(8, 109) });
break;
case "GBA":
ControllerBox.Controls.Add(new VirtualPadGBA { Location = new Point(8, 19), Controller = string.Empty });
break;
case "GEN":
ControllerBox.Controls.Add(new VirtualPadGen6Button { Location = new Point(195, 19), Controller = "P2" });
break;
case "Coleco":
var coleco2 = new VirtualPadColeco { Location = new Point(130, 19), Controller = "P2" };
ControllerBox.Controls.Add(coleco2);
break;
case "C64":
ControllerBox.Controls.Add(new VirtualPadA26 { Location = new Point(218, 159), Controller = "P2" });
break;
case "SAT":
ControllerBox.Controls.Add(new VirtualPadSaturn { Location = new Point(213, 19), Controller = "P2" });
break;
}
}
#endregion
}
}

View File

@ -32,6 +32,8 @@
this.ManualY = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.CD = new BizHawk.Client.EmuHawk.VirtualPadButton();
this.CR = new BizHawk.Client.EmuHawk.VirtualPadButton();
this.CL = new BizHawk.Client.EmuHawk.VirtualPadButton();
@ -49,6 +51,8 @@
this.AnalogControl1 = new BizHawk.Client.EmuHawk.AnalogControlPanel();
((System.ComponentModel.ISupportInitialize)(this.ManualX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ManualY)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout();
//
// ManualX
@ -60,7 +64,7 @@
0,
0});
this.ManualX.Minimum = new decimal(new int[] {
128,
127,
0,
0,
-2147483648});
@ -79,7 +83,7 @@
0,
0});
this.ManualY.Minimum = new decimal(new int[] {
128,
127,
0,
0,
-2147483648});
@ -108,6 +112,56 @@
this.label2.TabIndex = 23;
this.label2.Text = "Y";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(4, 269);
this.numericUpDown1.Maximum = new decimal(new int[] {
127,
0,
0,
0});
this.numericUpDown1.Minimum = new decimal(new int[] {
127,
0,
0,
-2147483648});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(55, 20);
this.numericUpDown1.TabIndex = 24;
this.numericUpDown1.TabStop = false;
this.numericUpDown1.Value = new decimal(new int[] {
127,
0,
0,
0});
this.numericUpDown1.Visible = false;
this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(4, 292);
this.numericUpDown2.Maximum = new decimal(new int[] {
127,
0,
0,
0});
this.numericUpDown2.Minimum = new decimal(new int[] {
127,
0,
0,
-2147483648});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(55, 20);
this.numericUpDown2.TabIndex = 25;
this.numericUpDown2.TabStop = false;
this.numericUpDown2.Value = new decimal(new int[] {
127,
0,
0,
-2147483648});
this.numericUpDown2.Visible = false;
this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
//
// CD
//
this.CD.Appearance = System.Windows.Forms.Appearance.Button;
@ -305,6 +359,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.ManualY);
@ -329,6 +385,8 @@
this.Load += new System.EventHandler(this.UserControl1_Load);
((System.ComponentModel.ISupportInitialize)(this.ManualX)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ManualY)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -355,5 +413,7 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown ManualX;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.NumericUpDown numericUpDown2;
}
}

View File

@ -26,6 +26,11 @@ namespace BizHawk.Client.EmuHawk
private void UserControl1_Load(object sender, EventArgs e)
{
if (Controller == "P1")
{
numericUpDown1.Visible = true;
numericUpDown2.Visible = true;
}
PU.ControllerButton = Controller + " Up";
PD.ControllerButton = Controller + " Down";
PL.ControllerButton = Controller + " Left";
@ -219,5 +224,21 @@ namespace BizHawk.Client.EmuHawk
AnalogControl1.Y = y;
AnalogControl1.Refresh();
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
AnalogControlPanel.Max = (int)numericUpDown1.Value;
ManualX.Maximum = (int)numericUpDown1.Value;
ManualY.Maximum = (int)numericUpDown1.Value;
AnalogControl1.Refresh();
}
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
{
AnalogControlPanel.Min = (int)numericUpDown2.Value;
ManualX.Minimum = (int)numericUpDown2.Value;
ManualY.Minimum = (int)numericUpDown2.Value;
AnalogControl1.Refresh();
}
}
}