This should have fixed genesis mnemonics to be 2 player

This commit is contained in:
adelikat 2014-01-03 02:29:42 +00:00
parent b445a7adf1
commit a519ae025f
2 changed files with 51 additions and 5 deletions

View File

@ -330,9 +330,28 @@ namespace BizHawk.Client.Common
{
var input = new StringBuilder("|");
foreach (var button in MnemonicConstants.BUTTONS[_controlType].Keys)
if (IsBasePressed("Power"))
{
input.Append(IsBasePressed(button) ? MnemonicConstants.BUTTONS[_controlType][button] : ".");
input.Append(MnemonicConstants.COMMANDS[_controlType]["Power"]);
}
else if (IsBasePressed("Reset"))
{
input.Append(MnemonicConstants.COMMANDS[_controlType]["Reset"]);
}
else
{
input.Append('.');
}
input.Append("|");
for (int player = 1; player <= MnemonicConstants.PLAYERS[_controlType]; player++)
{
foreach (var button in MnemonicConstants.BUTTONS[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? MnemonicConstants.BUTTONS[_controlType][button] : ".");
}
input.Append("|");
}
input.Append("|");

View File

@ -148,6 +148,7 @@ namespace BizHawk.Client.Common
{"Gameboy Controller", new Dictionary<string, string> {{"Power", "P"}}},
{"GBA Controller", new Dictionary<string, string> {{"Power", "P"}}},
{"Genesis 3-Button Controller", new Dictionary<string, string> {{"Reset", "r"}}},
{"GPGX Genesis Controller", new Dictionary<string, string> {{"Power", "P"}, {"Reset", "r"}}},
{"NES Controller", new Dictionary<string, string> {{"Reset", "r"}, {"Power", "P"}, {"FDS Eject", "E"}, {"FDS Insert 0", "0"}, {"FDS Insert 1", "1"}, {"VS Coin 1", "c"}, {"VS Coin 2", "C"}}},
{"SNES Controller", new Dictionary<string, string> {{"Power", "P"}, {"Reset", "r"}}},
{"PC Engine Controller", new Dictionary<string, string>()},
@ -303,14 +304,40 @@ namespace BizHawk.Client.Common
{
MnemonicChecker c = new MnemonicChecker(mnemonic);
MyBoolButtons.Clear();
if (mnemonic.Length < 2)
{
return;
}
if (mnemonic[1] == 'P')
{
Force("Power", true);
}
else if (mnemonic[1] != '.' && mnemonic[1] != '0')
{
Force("Reset", true);
}
if (mnemonic.Length < 9)
{
return;
}
int start = 1;
foreach (string button in MnemonicConstants.BUTTONS[ControlType].Keys)
for (int player = 1; player <= MnemonicConstants.PLAYERS[ControlType]; player++)
{
Force(button, c[start++]);
int srcindex = (player - 1) * (MnemonicConstants.BUTTONS[ControlType].Count + 1);
if (mnemonic.Length < srcindex + 3 + MnemonicConstants.BUTTONS[ControlType].Count - 1)
{
return;
}
int start = 3;
foreach (string button in MnemonicConstants.BUTTONS[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
}
}
}