NES controller 2 implemented with some bugs
This commit is contained in:
parent
d1212176a0
commit
e250355024
|
@ -169,7 +169,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
new ControllerDefinition
|
||||
{
|
||||
Name = "NES Controls",
|
||||
BoolButtons = { "A","B","Select","Start","Left","Up","Down","Right", "Reset" }
|
||||
BoolButtons = { "P1 A","P1 B","P1 Select","P1 Start","P1 Left","P1 Up","P1 Down","P1 Right", "Reset",
|
||||
"P2 A", "P2 B", "P2 Select", "P2 Start", "P2 Up", "P2 Down", "P2 Left", "P2 Right"}
|
||||
};
|
||||
|
||||
public ControllerDefinition ControllerDefinition { get { return NESController; } }
|
||||
|
@ -203,7 +204,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
void Strobe()
|
||||
{
|
||||
value = 0;
|
||||
foreach (string str in new string[] { "Right", "Left", "Down", "Up", "Start", "Select", "B", "A" })
|
||||
foreach (string str in new string[] { "P" + (player + 1).ToString() + " Right", "P" + (player + 1).ToString() + " Left",
|
||||
"P" + (player + 1).ToString() + " Down", "P" + (player + 1).ToString() + " Up", "P" + (player + 1).ToString() + " Start",
|
||||
"P" + (player + 1).ToString() + " Select", "P" + (player + 1).ToString() + " B", "P" + (player + 1).ToString() + " A" })
|
||||
{
|
||||
value <<= 1;
|
||||
value |= nes.Controller.IsPressed(str) ? 1 : 0;
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace BizHawk.MultiClient
|
|||
return;
|
||||
string[] controlbindings = controlString.Split(',');
|
||||
foreach (string control in controlbindings)
|
||||
bindings[button].Add(control.Trim());
|
||||
bindings[button].Add(control.Trim());
|
||||
}
|
||||
|
||||
public ControllerDefinition Type
|
||||
|
@ -106,13 +106,22 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public bool IsPressedActually(string button)
|
||||
{
|
||||
bool sticky = stickyButtons[button];
|
||||
try
|
||||
{
|
||||
bool sticky = stickyButtons[button];
|
||||
|
||||
foreach (var control in bindings[button])
|
||||
if (Input.IsPressed(control))
|
||||
return sticky ? false : true;
|
||||
foreach (var control in bindings[button])
|
||||
if (Input.IsPressed(control))
|
||||
return sticky ? false : true;
|
||||
|
||||
return sticky ? true : false;
|
||||
return sticky ? true : false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
int x = 0;
|
||||
x++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public float GetFloat(string name)
|
||||
|
@ -202,17 +211,20 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (type.Name == "NES Controls")
|
||||
{
|
||||
input.Append(IsPressed("Reset") ? "r" : ".");
|
||||
input.Append("|");
|
||||
input.Append(IsPressed("Right") ? "R" : ".");
|
||||
input.Append(IsPressed("Left") ? "L" : ".");
|
||||
input.Append(IsPressed("Down") ? "D" : ".");
|
||||
input.Append(IsPressed("Up") ? "U" : ".");
|
||||
input.Append(IsPressed("Start") ? "S" : ".");
|
||||
input.Append(IsPressed("Select") ? "s" : ".");
|
||||
input.Append(IsPressed("B") ? "B" : ".");
|
||||
input.Append(IsPressed("A") ? "A" : ".");
|
||||
input.Append("|");
|
||||
input.Append(IsPressed("Reset") ? "r" : ".");
|
||||
input.Append("|");
|
||||
for (int player = 1; player <= 2; player++)
|
||||
{
|
||||
input.Append(IsPressed("P" + player.ToString() + " Right") ? "R" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " Left") ? "L" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " Down") ? "D" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " Up") ? "U" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " Start") ? "S" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " Select") ? "s" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " B") ? "B" : ".");
|
||||
input.Append(IsPressed("P" + player.ToString() + " A") ? "A" : ".");
|
||||
input.Append("|");
|
||||
}
|
||||
return input.ToString();
|
||||
}
|
||||
|
||||
|
@ -353,14 +365,24 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (mnemonic.Length < 10) return;
|
||||
//if (mnemonic[1] != '.' && mnemonic[1] != '0') programmaticallyPressedButtons.Add("Reset");
|
||||
if (mnemonic[3] != '.') programmaticallyPressedButtons.Add("Right");
|
||||
if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("Left");
|
||||
if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("Down");
|
||||
if (mnemonic[6] != '.') programmaticallyPressedButtons.Add("Up");
|
||||
if (mnemonic[7] != '.') programmaticallyPressedButtons.Add("Start");
|
||||
if (mnemonic[8] != '.') programmaticallyPressedButtons.Add("Select");
|
||||
if (mnemonic[9] != '.') programmaticallyPressedButtons.Add("B");
|
||||
if (mnemonic[10] != '.') programmaticallyPressedButtons.Add("A");
|
||||
if (mnemonic[3] != '.') programmaticallyPressedButtons.Add("P1 Right");
|
||||
if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("P1 Left");
|
||||
if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("P1 Down");
|
||||
if (mnemonic[6] != '.') programmaticallyPressedButtons.Add("P1 Up");
|
||||
if (mnemonic[7] != '.') programmaticallyPressedButtons.Add("P1 Start");
|
||||
if (mnemonic[8] != '.') programmaticallyPressedButtons.Add("P1 Select");
|
||||
if (mnemonic[9] != '.') programmaticallyPressedButtons.Add("P1 B");
|
||||
if (mnemonic[10] != '.') programmaticallyPressedButtons.Add("P1 A");
|
||||
|
||||
if (mnemonic.Length < 20) return;
|
||||
if (mnemonic[12] != '.') programmaticallyPressedButtons.Add("P2 Right");
|
||||
if (mnemonic[13] != '.') programmaticallyPressedButtons.Add("P2 Left");
|
||||
if (mnemonic[14] != '.') programmaticallyPressedButtons.Add("P2 Down");
|
||||
if (mnemonic[15] != '.') programmaticallyPressedButtons.Add("P2 Up");
|
||||
if (mnemonic[16] != '.') programmaticallyPressedButtons.Add("P2 Start");
|
||||
if (mnemonic[17] != '.') programmaticallyPressedButtons.Add("P2 Select");
|
||||
if (mnemonic[18] != '.') programmaticallyPressedButtons.Add("P2 B");
|
||||
if (mnemonic[19] != '.') programmaticallyPressedButtons.Add("P2 A");
|
||||
}
|
||||
|
||||
if (type.Name == "TI83 Controls")
|
||||
|
|
|
@ -489,16 +489,16 @@ namespace BizHawk.MultiClient
|
|||
|
||||
var nesControls = new Controller(NES.NESController);
|
||||
nesControls.BindMulti("Reset", Global.Config.NESReset);
|
||||
for (int i = 0; i < 1 /*TODO*/; i++)
|
||||
for (int i = 0; i < 2 /*TODO*/; i++)
|
||||
{
|
||||
nesControls.BindMulti("Up", Global.Config.NESController[i].Up);
|
||||
nesControls.BindMulti("Down", Global.Config.NESController[i].Down);
|
||||
nesControls.BindMulti("Left", Global.Config.NESController[i].Left);
|
||||
nesControls.BindMulti("Right", Global.Config.NESController[i].Right);
|
||||
nesControls.BindMulti("A", Global.Config.NESController[i].A);
|
||||
nesControls.BindMulti("B", Global.Config.NESController[i].B);
|
||||
nesControls.BindMulti("Select", Global.Config.NESController[i].Select);
|
||||
nesControls.BindMulti("Start", Global.Config.NESController[i].Start);
|
||||
nesControls.BindMulti("P" + (i + 1) + " Up", Global.Config.NESController[i].Up);
|
||||
nesControls.BindMulti("P" + (i + 1) + " Down", Global.Config.NESController[i].Down);
|
||||
nesControls.BindMulti("P" + (i + 1) + " Left", Global.Config.NESController[i].Left);
|
||||
nesControls.BindMulti("P" + (i + 1) + " Right", Global.Config.NESController[i].Right);
|
||||
nesControls.BindMulti("P" + (i + 1) + " A", Global.Config.NESController[i].A);
|
||||
nesControls.BindMulti("P" + (i + 1) + " B", Global.Config.NESController[i].B);
|
||||
nesControls.BindMulti("P" + (i + 1) + " Select", Global.Config.NESController[i].Select);
|
||||
nesControls.BindMulti("P" + (i + 1) + " Start", Global.Config.NESController[i].Start);
|
||||
}
|
||||
Global.NESControls = nesControls;
|
||||
|
||||
|
|
Loading…
Reference in New Issue