-Genesis, Gameboy mnemonics switched around.

-Made other commands lowercase.
-Added more mnemonics to the table.
-Added a command table. The writing of headers, as currently inconsistent, will probably be done manually, but it will still reference the table for easy modification.

TODO:
-Create a mnemonic header using the tables (Format now seemingly agreed upon is "Mnemonic |UDLRsSBA|").
-Generate button handling using the table, sandwiching this simplified code with the command handlers.
-Fix the TI-83 mnemonics (It has at least two redundancies: 1 and 2).
-Port mnemonics table to wiki page.
-Convert the remainder of the importers, working or not, from the string building method to the mnemonic generating one.
-Start working on more importers!
This commit is contained in:
brandman211 2012-02-20 05:54:31 +00:00
parent cc4b2c324c
commit 1c1b61507d
1 changed files with 72 additions and 18 deletions

View File

@ -18,10 +18,64 @@ namespace BizHawk.MultiClient
{
return Pressed.Contains(button);
}
public Dictionary<string, string[]> MNEMONICS = new Dictionary<string, string[]>()
public Dictionary<string, Dictionary<string, string>> BUTTONS = new Dictionary<string, Dictionary<string, string>>()
{
{"NES", new string[8] {"Up", "Down", "Left", "Right", "Select", "Start", "B", "A"}},
{"PC Engine", new string[8] {"Up", "Down", "Left", "Right", "Select", "Start", "2", "1"}}
{
"Gameboy", new Dictionary<string, string>()
{
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"},
{"A", "A"}
}
},
{
"Genesis 3-Button", new Dictionary<string, string>()
{
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Start", "S"}, {"A", "A"}, {"B", "B"},
{"C", "C"}
}
},
{
"NES", new Dictionary<string, string>()
{
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"},
{"A", "A"}
}
},
{
"PC Engine", new Dictionary<string, string>()
{
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Run", "r"}, {"B2", "2"},
{"B1", "1"}
}
},
{
"SMS", new Dictionary<string, string>()
{
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"B1", "1"}, {"B2", "2"}
}
},
{
"TI83", new Dictionary<string, string>()
{
{"0", "0"}, {"1", "1"}, {"2", "2"}, {"3", "3"}, {"4", "4"}, {"5", "5"}, {"6", "6"}, {"7", "7"},
{"8", "8"}, {"9", "9"}, {"DOT", "`"}, {"ON", "O"}, {"ENTER", "="}, {"UP", "U"}, {"DOWN", "D"},
{"LEFT", "L"}, {"RIGHT", "R"}, {"PLUS", "+"}, {"MINUS", "_"}, {"MULTIPLY", "*"}, {"DIVIDE", "/"},
{"CLEAR", "c"}, {"EXP", "^"}, {"DASH", "-"}, {"PARAOPEN", "("}, {"PARACLOSE", ")"}, {"TAN", "T"},
{"VARS", "V"}, {"COS", "C"}, {"PRGM", "P"}, {"STAT", "s"}, {"MATRIX", "m"}, {"X", "X"}, {"STO", ">"},
{"LN", "n"}, {"LOG", "L"}, {"SQUARED", "2"}, {"NEG1", "1"}, {"MATH", "H"}, {"ALPHA", "A"},
{"GRAPH", "G"}, {"TRACE", "t"}, {"ZOOM", "Z"}, {"WINDOW", "W"}, {"Y", "Y"}, {"2ND", "&"}, {"MODE", "O"},
{"DEL", "D"}, {"COMMA", ","}, {"SIN", "S"}
}
}
};
public Dictionary<string, Dictionary<string, string>> COMMANDS = new Dictionary<string, Dictionary<string, string>>()
{
{"Gameboy", new Dictionary<string, string>() {}},
{"Genesis 3-Button", new Dictionary<string, string>() {}},
{"NES", new Dictionary<string, string>() {{"Reset", "r"}}},
{"PC Engine", new Dictionary<string, string>() {}},
{"SMS", new Dictionary<string, string>() {{"Pause", "p"}, {"Reset", "r"}}},
{"TI83", new Dictionary<string, string>() {}}
};
/// <summary>
/// call this once per frame to do the timekeeping for the hold and release
@ -185,10 +239,10 @@ namespace BizHawk.MultiClient
input.Append(IsBasePressed("Down") ? "D" : ".");
input.Append(IsBasePressed("Left") ? "L" : ".");
input.Append(IsBasePressed("Right") ? "R" : ".");
input.Append(IsBasePressed("Start") ? "S" : ".");
input.Append(IsBasePressed("A") ? "A" : ".");
input.Append(IsBasePressed("B") ? "B" : ".");
input.Append(IsBasePressed("C") ? "C" : ".");
input.Append(IsBasePressed("Start") ? "T" : ".");
input.Append("|");
return input.ToString();
}
@ -209,8 +263,8 @@ namespace BizHawk.MultiClient
input.Append(IsBasePressed("P2 B1") ? "1" : ".");
input.Append(IsBasePressed("P2 B2") ? "2" : ".");
input.Append("|");
input.Append(IsBasePressed("Pause") ? "P" : ".");
input.Append(IsBasePressed("Reset") ? "R" : ".");
input.Append(IsBasePressed("Pause") ? "p" : ".");
input.Append(IsBasePressed("Reset") ? "r" : ".");
input.Append("|");
return input.ToString();
}
@ -237,12 +291,12 @@ namespace BizHawk.MultiClient
if (ControlType == "Gameboy Controller")
{
input.Append(".|"); //TODO: reset goes here
input.Append(IsBasePressed("Right") ? "R" : ".");
input.Append(IsBasePressed("Left") ? "L" : ".");
input.Append(IsBasePressed("Down") ? "D" : ".");
input.Append(IsBasePressed("Up") ? "U" : ".");
input.Append(IsBasePressed("Start") ? "S" : ".");
input.Append(IsBasePressed("Down") ? "D" : ".");
input.Append(IsBasePressed("Left") ? "L" : ".");
input.Append(IsBasePressed("Right") ? "R" : ".");
input.Append(IsBasePressed("Select") ? "s" : ".");
input.Append(IsBasePressed("Start") ? "S" : ".");
input.Append(IsBasePressed("B") ? "B" : ".");
input.Append(IsBasePressed("A") ? "A" : ".");
input.Append("|");
@ -494,10 +548,10 @@ namespace BizHawk.MultiClient
Force("Down", c[2]);
Force("Left", c[3]);
Force("Right", c[4]);
Force("A", c[5]);
Force("B", c[6]);
Force("C", c[7]);
Force("Start", c[8]);
Force("Start", c[5]);
Force("A", c[6]);
Force("B", c[7]);
Force("C", c[8]);
}
if (ControlType == "SMS Controller")
@ -587,12 +641,12 @@ namespace BizHawk.MultiClient
if (mnemonic.Length < 10) return;
//if (mnemonic[1] != '.' && mnemonic[1] != '0') programmaticallyPressedButtons.Add("Reset");
int ctr = 3;
Force("P1 Right", c[ctr++]);
Force("P1 Left", c[ctr++]);
Force("P1 Down", c[ctr++]);
Force("P1 Up", c[ctr++]);
Force("P1 Start", c[ctr++]);
Force("P1 Down", c[ctr++]);
Force("P1 Left", c[ctr++]);
Force("P1 Right", c[ctr++]);
Force("P1 Select", c[ctr++]);
Force("P1 Start", c[ctr++]);
Force("P1 B", c[ctr++]);
Force("P1 A", c[ctr++]);
}