C64 - implement rerecording/input display for the 2 controllers (no keyboard yet)

This commit is contained in:
adelikat 2012-11-18 17:43:02 +00:00
parent 12844bbd7f
commit 5df1cd532e
2 changed files with 42 additions and 6 deletions

View File

@ -109,6 +109,12 @@ namespace BizHawk.MultiClient
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Button", "B"}
}
},
{
"Commodore 64 Controller", new Dictionary<string,string>()
{
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Button", "B"}
}
},
{
"ColecoVision Basic Controller", new Dictionary<string, string>()
{
@ -136,7 +142,7 @@ namespace BizHawk.MultiClient
{"Gameboy 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},
{"ColecoVision Basic Controller", 2}
{"ColecoVision Basic Controller", 2}, {"Commodore 64 Controller", 2}
};
/// <summary>

View File

@ -360,6 +360,8 @@ namespace BizHawk.MultiClient
return "|.|........|........|........|........|........|";
case "Coleco":
return "|..................|..................|";
case "C64":
return "|.....|.....|..................................................................|";
}
}
@ -386,7 +388,6 @@ namespace BizHawk.MultiClient
{
foreach (string button in Global.BUTTONS[ControlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? Global.BUTTONS[ControlType][button] : ".");
}
input.Append("|");
@ -397,7 +398,18 @@ namespace BizHawk.MultiClient
private string GetC64ControllersAsMnemonic()
{
return ""; //TODO
StringBuilder input = new StringBuilder("|");
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()
@ -713,9 +725,27 @@ namespace BizHawk.MultiClient
}
private void SetSNESControllersAsMnemonic()
private void SetC64ControllersAsMnemonic(string mnemonic)
{
//TODO
MnemonicChecker c = new MnemonicChecker(mnemonic);
MyBoolButtons.Clear();
for (int player = 1; player <= Global.PLAYERS[ControlType]; player++)
{
int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1);
if (mnemonic.Length < srcindex + 1 + Global.BUTTONS[ControlType].Count - 1)
{
return;
}
int start = 1;
foreach (string button in Global.BUTTONS[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
}
}
}
/// <summary>
@ -734,7 +764,7 @@ namespace BizHawk.MultiClient
}
else if (ControlType == "Commodore 64 Controller")
{
SetSNESControllersAsMnemonic();
SetC64ControllersAsMnemonic(mnemonic);
return;
}