Support lynx .mcm importing, however it appears there are sync differences in the lynx cores
This commit is contained in:
parent
a806aa15e3
commit
adf07367ad
|
@ -1262,6 +1262,7 @@ namespace BizHawk.Client.Common
|
||||||
hf.Unbind();
|
hf.Unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Header[HeaderKeys.PLATFORM] = platform;
|
m.Header[HeaderKeys.PLATFORM] = platform;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1306,7 @@ namespace BizHawk.Client.Common
|
||||||
// 074 5-byte Console indicator (pce, ngp, pcfx, wswan)
|
// 074 5-byte Console indicator (pce, ngp, pcfx, wswan)
|
||||||
string platform = NullTerminated(r.ReadStringFixedAscii(5));
|
string platform = NullTerminated(r.ReadStringFixedAscii(5));
|
||||||
Dictionary<string, Dictionary<string, object>> platforms = new Dictionary<string, Dictionary<string, object>>
|
Dictionary<string, Dictionary<string, object>> platforms = new Dictionary<string, Dictionary<string, object>>
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Normally, NES receives from 5 input ports, where the first 4 have a length of 1 byte, and the last has
|
Normally, NES receives from 5 input ports, where the first 4 have a length of 1 byte, and the last has
|
||||||
|
@ -1324,6 +1325,13 @@ namespace BizHawk.Client.Common
|
||||||
{"name", "PC Engine"}, {"ports", 5}, {"bytesPerPort", 2},
|
{"name", "PC Engine"}, {"ports", 5}, {"bytesPerPort", 2},
|
||||||
{"buttons", new[] { "B1", "B2", "Select", "Run", "Up", "Right", "Down", "Left" }}
|
{"buttons", new[] { "B1", "B2", "Select", "Run", "Up", "Right", "Down", "Left" }}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lynx", new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "name", "Lynx" }, { "ports", 2 }, { "bytesPerPort", 1 },
|
||||||
|
{ "buttons", new[] { "A", "B", "Up", "Down", "Left", "Right" }}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!platforms.ContainsKey(platform))
|
if (!platforms.ContainsKey(platform))
|
||||||
|
@ -1334,7 +1342,10 @@ namespace BizHawk.Client.Common
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
string name = (string)platforms[platform]["name"];
|
string name = (string)platforms[platform]["name"];
|
||||||
m.Header[HeaderKeys.PLATFORM] = name;
|
|
||||||
|
string systemID = name.ToUpper(); // Hack
|
||||||
|
|
||||||
|
m.Header[HeaderKeys.PLATFORM] = systemID;
|
||||||
// 079 32-byte Author name
|
// 079 32-byte Author name
|
||||||
string author = NullTerminated(r.ReadStringFixedAscii(32));
|
string author = NullTerminated(r.ReadStringFixedAscii(32));
|
||||||
m.Header[HeaderKeys.AUTHOR] = author;
|
m.Header[HeaderKeys.AUTHOR] = author;
|
||||||
|
@ -1369,7 +1380,8 @@ namespace BizHawk.Client.Common
|
||||||
ushort controllerState = r.ReadByte();
|
ushort controllerState = r.ReadByte();
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] = (((controllerState >> button) & 0x1) != 0);
|
string prefix = platform == "lynx" ? "" : ("P" + player + " "); // hack
|
||||||
|
controllers[prefix + buttons[button]] = (((controllerState >> button) & 0x1) != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.ReadByte();
|
r.ReadByte();
|
||||||
|
|
|
@ -79,6 +79,12 @@ namespace BizHawk.Client.Common
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ControlType == "Lynx Controller")
|
||||||
|
{
|
||||||
|
SetLynxControllersAsMnemonic(mnemonic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ControlType == "SNES Controller")
|
if (ControlType == "SNES Controller")
|
||||||
{
|
{
|
||||||
SetSNESControllersAsMnemonic(mnemonic);
|
SetSNESControllersAsMnemonic(mnemonic);
|
||||||
|
@ -404,6 +410,38 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetLynxControllersAsMnemonic(string mnemonic)
|
||||||
|
{
|
||||||
|
var c = new MnemonicChecker(mnemonic);
|
||||||
|
MyBoolButtons.Clear();
|
||||||
|
|
||||||
|
if (mnemonic.Length < 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mnemonic[1] == 'P')
|
||||||
|
{
|
||||||
|
Force("Power", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int player = 1; player <= BkmMnemonicConstants.PLAYERS[ControlType]; player++)
|
||||||
|
{
|
||||||
|
int srcindex = (player - 1) * (BkmMnemonicConstants.BUTTONS[ControlType].Count + 1);
|
||||||
|
|
||||||
|
if (mnemonic.Length < srcindex + 3 + BkmMnemonicConstants.BUTTONS[ControlType].Count - 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = 3;
|
||||||
|
foreach (var button in BkmMnemonicConstants.BUTTONS[ControlType].Keys)
|
||||||
|
{
|
||||||
|
Force(button, c[srcindex + start++]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SetN64ControllersAsMnemonic(string mnemonic)
|
private void SetN64ControllersAsMnemonic(string mnemonic)
|
||||||
{
|
{
|
||||||
MnemonicChecker c = new MnemonicChecker(mnemonic);
|
MnemonicChecker c = new MnemonicChecker(mnemonic);
|
||||||
|
|
|
@ -22,6 +22,11 @@ namespace BizHawk.Client.Common
|
||||||
return "|.|";
|
return "|.|";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_controlType == "Lynx Controller")
|
||||||
|
{
|
||||||
|
return GetLynxControllersAsMnemonic();
|
||||||
|
}
|
||||||
|
|
||||||
if (_controlType == "Atari 7800 ProLine Joystick Controller")
|
if (_controlType == "Atari 7800 ProLine Joystick Controller")
|
||||||
{
|
{
|
||||||
return GetA78ControllersAsMnemonic();
|
return GetA78ControllersAsMnemonic();
|
||||||
|
@ -415,6 +420,25 @@ namespace BizHawk.Client.Common
|
||||||
return input.ToString();
|
return input.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetLynxControllersAsMnemonic()
|
||||||
|
{
|
||||||
|
var input = new StringBuilder("|");
|
||||||
|
input.Append(IsBasePressed("Power") ? 'P' : '.');
|
||||||
|
input.Append('|');
|
||||||
|
|
||||||
|
for (int player = 1; player <= BkmMnemonicConstants.PLAYERS[_controlType]; player++)
|
||||||
|
{
|
||||||
|
foreach (var button in BkmMnemonicConstants.BUTTONS[_controlType].Keys)
|
||||||
|
{
|
||||||
|
input.Append(IsBasePressed(button) ? BkmMnemonicConstants.BUTTONS[_controlType][button] : ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
input.Append('|');
|
||||||
|
}
|
||||||
|
|
||||||
|
return input.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
private string GetN64ControllersAsMnemonic()
|
private string GetN64ControllersAsMnemonic()
|
||||||
{
|
{
|
||||||
var input = new StringBuilder("|");
|
var input = new StringBuilder("|");
|
||||||
|
|
|
@ -10,8 +10,13 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
"Gameboy Controller", new Dictionary<string, string>
|
"Gameboy Controller", new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"},
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"}, {"A", "A"}
|
||||||
{"A", "A"}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Lynx Controller", new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"}, {"A", "A"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -165,7 +170,7 @@ namespace BizHawk.Client.Common
|
||||||
{"Gameboy Controller", 1}, {"GBA Controller", 1}, {"Genesis 3-Button Controller", 2}, {"GPGX Genesis Controller", 2}, {"NES Controller", 4},
|
{"Gameboy Controller", 1}, {"GBA Controller", 1}, {"Genesis 3-Button Controller", 2}, {"GPGX Genesis 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},
|
{"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}, {"Nintento 64 Controller", 4}, {"Saturn Controller", 2},
|
{"ColecoVision Basic Controller", 2}, {"Commodore 64 Controller", 2}, {"Nintento 64 Controller", 4}, {"Saturn Controller", 2},
|
||||||
{"GPGX 3-Button Controller", 2}
|
{"GPGX 3-Button Controller", 2}, { "Lynx Controller", 1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
// just experimenting with different possibly more painful ways to handle mnemonics
|
// just experimenting with different possibly more painful ways to handle mnemonics
|
||||||
|
|
Loading…
Reference in New Issue