N64 - add mnemonics (input display, movie recording). Don't know if it works, don't have a game handy to test

This commit is contained in:
adelikat 2013-05-03 19:22:43 +00:00
parent f6aedc5a55
commit e9d8e2eb21
2 changed files with 81 additions and 5 deletions

View File

@ -175,6 +175,14 @@ namespace BizHawk.MultiClient
{"Key1", "1"}, {"Key2", "2"}, {"Key3", "3"}, {"Key4", "4"}, {"Key5", "5"}, {"Key6", "6"},
{"Key7", "7"}, {"Key8", "8"}, {"Key9", "9"}, {"Star", "*"}, {"Key0", "0"}, {"Pound", "#"}
}
},
{
"Nintento 64 Controller", new Dictionary<string, string>()
{
{"DPad U", "U"}, {"DPad D", "D"}, {"DPad L", "L"}, {"DPad R", "R"},
{"A", "A"}, {"B", "B"}, {"Z", "Z"}, {"Start", "S"},
{"C Up", "u"}, {"C Down", "d"}, {"C Left", "l"}, {"C Right", "r"}
}
}
};
@ -189,14 +197,15 @@ namespace BizHawk.MultiClient
{"SNES Controller", new Dictionary<string, string> {{"Power", "P"}, {"Reset", "r"}}},
{"PC Engine Controller", new Dictionary<string, string> {}},
{"SMS Controller", new Dictionary<string, string> {{"Pause", "p"}, {"Reset", "r"}}},
{"TI83 Controller", new Dictionary<string, string> {}}
{"TI83 Controller", new Dictionary<string, string> {}},
{"Nintento 64 Controller", new Dictionary<string, string> {{"Pause", "p"}, {"Reset", "r"}}},
};
public static readonly Dictionary<string, int> PLAYERS = new Dictionary<string, int>
{
{"Gameboy Controller", 1}, {"GBA Controller", 1}, {"Genesis 3-Button Controller", 2}, {"NES Controller", 4},
{"SNES Controller", 4}, {"PC Engine Controller", 5}, {"SMS Controller", 2}, {"TI83 Controller", 1}, {"Atari 2600 Basic Controller", 2}, {"Atari 7800 ProLine Joystick Controller", 2},
{"ColecoVision Basic Controller", 2}, {"Commodore 64 Controller", 2}
{"ColecoVision Basic Controller", 2}, {"Commodore 64 Controller", 2}, {"Nintento 64 Controller", 4}
};
// just experimenting with different possibly more painful ways to handle mnemonics

View File

@ -445,6 +445,8 @@ namespace BizHawk.MultiClient
return "|.....|.....|..................................................................|";
case "GBA":
return "|.|..........|";
case "N64":
return "|.|............|............|............|............|";
}
}
}
@ -559,6 +561,35 @@ namespace BizHawk.MultiClient
return input.ToString();
}
private string GetN64ControllersAsMnemonic()
{
StringBuilder input = new StringBuilder("|");
if (IsBasePressed("Power"))
{
input.Append('P');
}
else if (IsBasePressed("Reset"))
{
input.Append('r');
}
else
{
input.Append('.');
}
input.Append('|');
for (int player = 1; player <= Global.PLAYERS[ControlType]; player++)
{
foreach (string button in Global.BUTTONS[ControlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? Global.BUTTONS[ControlType][button] : ".");
}
input.Append('|');
}
return input.ToString();
}
public string GetControllersAsMnemonic()
{
if (ControlType == "Null Controller")
@ -583,11 +614,11 @@ namespace BizHawk.MultiClient
}
else if (ControlType == "Dual Gameboy Controller")
{
return GetDualGameBoyControllerAsMnemonic();
return GetDualGameBoyControllerAsMnemonic();
}
else if (ControlType == "Nintento 64 Controller")
{
return ""; // TODO
return GetN64ControllersAsMnemonic();
}
else if (ControlType == "Saturn Controller")
{
@ -908,6 +939,42 @@ namespace BizHawk.MultiClient
}
}
private void SetN64ControllersAsMnemonic(string mnemonic)
{
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);
}
for (int player = 1; player <= Global.PLAYERS[ControlType]; player++)
{
int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1);
if (mnemonic.Length < srcindex + 3 + Global.BUTTONS[ControlType].Count - 1)
{
return;
}
int start = 3;
foreach (string button in Global.BUTTONS[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
}
}
}
private void SetAtari7800AsMnemonic(string mnemonic)
{
MnemonicChecker c = new MnemonicChecker(mnemonic);
@ -1027,7 +1094,7 @@ namespace BizHawk.MultiClient
}
else if (ControlType == "Nintento 64 Controller")
{
// TODO
SetN64ControllersAsMnemonic(mnemonic);
return;
}
else if (ControlType == "Saturn Controller")