-Finished my simplification of InputAdapters for everything but TI-83 (I don't remember how to test it). Saved 183 lines from the last revision, and this number is probably going to grow tremendously after TI-83 is handled.
-Inadvertently fixed the seemingly broken Genesis 3-Button Controller mnemonics...the controllers weren't responding at all before. I guess refactoring and working with simplified code IS worth it. <_< --That said, this is still really broken: ---Mnemonics don't show up while recording. ---Input goes past the frame length, and it's never labeled finished. ---Doesn't seem to sync at all. ---This exception: --------------------------- Oh, no, a terrible thing happened! System.Exception: unhandled opcode at pc=013648 at BizHawk.Emulation.CPUs.M68000.MC68000.ExecuteCycles(Int32 cycles) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\CPUs\68000\MC68000.cs:line 147 at BizHawk.Emulation.Consoles.Sega.Genesis.FrameAdvance(Boolean render) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\Consoles\Sega\Genesis\Genesis.cs:line 106 at BizHawk.MultiClient.MainForm.StepRunLoop_Core() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 1676 at BizHawk.MultiClient.MainForm.ProgramRunLoop() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 346 at BizHawk.MultiClient.Program.Main(String[] args) in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\Program.cs:line 47 --------------------------- System.Exception: unhandled opcode at pc=013648 at BizHawk.Emulation.CPUs.M68000.MC68000.ExecuteCycles(Int32 cycles) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\CPUs\68000\MC68000.cs:line 147 at BizHawk.Emulation.Consoles.Sega.Genesis.FrameAdvance(Boolean render) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\Consoles\Sega\Genesis\Genesis.cs:line 106 at BizHawk.MultiClient.MainForm.StepRunLoop_Core() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 1676 at BizHawk.MultiClient.MainForm.ProgramRunLoop() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 346 at BizHawk.MultiClient.Program.Main(String[] args) in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\Program.cs:line 47 --------------------------- OK --------------------------- --I don't think I broke anything...if anything, I fixed it slightly so that input is at least recognized in some way. --Question: Is Genesis going to be properly supported by release time? If so, I might hold off a Genesis TAS until this is done. I hate Gens. -Moved BUTTONS, COMMANDS, and new variable PLAYERS, which indicates how many players are for a given system, to Global.cs. --If there's a better place for this, please let me know. --That said, if there are places in the code that refer to the mnemonics of button names of a given system, we should definitely apply these variables for easier modification. Please let me know where these places might be. -Fixed ImportText(). It now only reads as many controllers as the given system supports. TODO: -Merge the TI-83 stuff. -Mnemonic header. -Comment! -Fix the TI-83 mnemonics with the IRCs blessings. -Port the new mnemonics to the wiki. -Fix the importers. --I don't think ImportMMV handles the Pause and Reset commands (Or buttons, I don't even know) covert.
This commit is contained in:
parent
1c1b61507d
commit
fcd8822a6b
|
@ -1,4 +1,5 @@
|
||||||
using BizHawk.DiscSystem;
|
using BizHawk.DiscSystem;
|
||||||
|
using System.Collections.Generic;
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
using SlimDX.DirectSound;
|
using SlimDX.DirectSound;
|
||||||
|
|
||||||
|
@ -31,6 +32,72 @@ namespace BizHawk.MultiClient
|
||||||
public static AutofireController AutofireGBControls;
|
public static AutofireController AutofireGBControls;
|
||||||
public static AutofireController AutofireGenControls;
|
public static AutofireController AutofireGenControls;
|
||||||
|
|
||||||
|
public static readonly Dictionary<string, Dictionary<string, string>> BUTTONS = new Dictionary<string, Dictionary<string, string>>()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"Gameboy Controller", new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"},
|
||||||
|
{"A", "A"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Genesis 3-Button Controller", new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Start", "S"}, {"A", "A"}, {"B", "B"},
|
||||||
|
{"C", "C"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"NES Controller", new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Start", "S"}, {"B", "B"},
|
||||||
|
{"A", "A"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"PC Engine Controller", new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"Select", "s"}, {"Run", "r"}, {"B2", "2"},
|
||||||
|
{"B1", "1"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SMS Controller", new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{"Up", "U"}, {"Down", "D"}, {"Left", "L"}, {"Right", "R"}, {"B1", "1"}, {"B2", "2"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"TI83 Controller", 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 static readonly Dictionary<string, Dictionary<string, string>> COMMANDS = new Dictionary<string, Dictionary<string, string>>()
|
||||||
|
{
|
||||||
|
{"Gameboy Controller", new Dictionary<string, string>() {}},
|
||||||
|
{"Genesis 3-Button Controller", new Dictionary<string, string>() {}},
|
||||||
|
{"NES Controller", new Dictionary<string, string>() {{"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>() {}}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static readonly Dictionary<string, int> PLAYERS = new Dictionary<string, int>()
|
||||||
|
{
|
||||||
|
{"Gameboy Controller", 1}, {"Genesis 3-Button Controller", 2}, {"NES Controller", 4},
|
||||||
|
{"PC Engine Controller", 5}, {"SMS Controller", 2}, {"TI83 Controller", 1}
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// whether vsync is force-disabled by use of fast forward
|
/// whether vsync is force-disabled by use of fast forward
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -45,22 +112,20 @@ namespace BizHawk.MultiClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter();
|
public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter();
|
||||||
|
|
||||||
|
|
||||||
public static MovieSession MovieSession = new MovieSession();
|
public static MovieSession MovieSession = new MovieSession();
|
||||||
|
|
||||||
|
|
||||||
//dont take my word for it, since the final word is actually in RewireInputChain, but here is a guide...
|
//dont take my word for it, since the final word is actually in RewireInputChain, but here is a guide...
|
||||||
//user -> Input -> ActiveController -> UDLR -> StickyXORPlayerInputAdapter -> TurboAdapter(TBD) -> Lua(?TBD?) -> ..
|
//user -> Input -> ActiveController -> UDLR -> StickyXORPlayerInputAdapter -> TurboAdapter(TBD) -> Lua(?TBD?) -> ..
|
||||||
//.. -> MultitrackRewiringControllerAdapter -> MovieInputSourceAdapter -> (MovieSession) -> MovieOutputAdapter -> ControllerOutput(1) -> Game
|
//.. -> MultitrackRewiringControllerAdapter -> MovieInputSourceAdapter -> (MovieSession) -> MovieOutputAdapter -> ControllerOutput(1) -> Game
|
||||||
//(1)->Input Display
|
//(1)->Input Display
|
||||||
|
|
||||||
//the original source controller, bound to the user, sort of the "input" port for the chain, i think
|
//the original source controller, bound to the user, sort of the "input" port for the chain, i think
|
||||||
public static Controller ActiveController;
|
public static Controller ActiveController;
|
||||||
|
|
||||||
//rapid fire version on the user controller, has its own key bindings and is OR'ed against ActiveController
|
//rapid fire version on the user controller, has its own key bindings and is OR'ed against ActiveController
|
||||||
public static AutofireController AutoFireController;
|
public static AutofireController AutoFireController;
|
||||||
|
|
||||||
//the "output" port for the controller chain.
|
//the "output" port for the controller chain.
|
||||||
public static CopyControllerAdapter ControllerOutput = new CopyControllerAdapter();
|
public static CopyControllerAdapter ControllerOutput = new CopyControllerAdapter();
|
||||||
|
|
||||||
//input state which has been destined for game controller inputs are coalesced here
|
//input state which has been destined for game controller inputs are coalesced here
|
||||||
|
@ -98,8 +163,6 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public static DiscHopper DiscHopper = new DiscHopper();
|
public static DiscHopper DiscHopper = new DiscHopper();
|
||||||
|
|
||||||
|
|
||||||
public static CoreAccessor PsxCoreLibrary = new CoreAccessor(new Win32LibAccessor("PsxHawk.Core.dll"));
|
public static CoreAccessor PsxCoreLibrary = new CoreAccessor(new Win32LibAccessor("PsxHawk.Core.dll"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,65 +18,6 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
return Pressed.Contains(button);
|
return Pressed.Contains(button);
|
||||||
}
|
}
|
||||||
public Dictionary<string, Dictionary<string, string>> BUTTONS = new Dictionary<string, Dictionary<string, string>>()
|
|
||||||
{
|
|
||||||
{
|
|
||||||
"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>
|
/// <summary>
|
||||||
/// call this once per frame to do the timekeeping for the hold and release
|
/// call this once per frame to do the timekeeping for the hold and release
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -233,92 +174,41 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
StringBuilder input = new StringBuilder("|");
|
StringBuilder input = new StringBuilder("|");
|
||||||
|
|
||||||
if (ControlType == "Genesis 3-Button Controller")
|
if (ControlType == "Genesis 3-Button Controller" || ControlType == "SMS Controller" || ControlType == "Gameboy Controller" || ControlType == "PC Engine Controller" || ControlType == "NES Controller")
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("Up") ? "U" : ".");
|
if (ControlType == "Gameboy Controller")
|
||||||
input.Append(IsBasePressed("Down") ? "D" : ".");
|
{
|
||||||
input.Append(IsBasePressed("Left") ? "L" : ".");
|
input.Append(".|"); //TODO: reset goes here
|
||||||
input.Append(IsBasePressed("Right") ? "R" : ".");
|
}
|
||||||
input.Append(IsBasePressed("Start") ? "S" : ".");
|
if (ControlType == "NES Controller")
|
||||||
input.Append(IsBasePressed("A") ? "A" : ".");
|
{
|
||||||
input.Append(IsBasePressed("B") ? "B" : ".");
|
input.Append(IsBasePressed("Reset") ? Global.COMMANDS[ControlType]["Reset"] :
|
||||||
input.Append(IsBasePressed("C") ? "C" : ".");
|
Global.Emulator.IsLagFrame ? "l" : ".");
|
||||||
input.Append("|");
|
}
|
||||||
return input.ToString();
|
if (ControlType == "PC Engine Controller")
|
||||||
}
|
{
|
||||||
|
input.Append("."); //TODO: some kind of command key, since reset isn't used (adelikat: unimplmented command was
|
||||||
if (ControlType == "SMS Controller")
|
}
|
||||||
{
|
if (ControlType != "SMS Controller")
|
||||||
input.Append(IsBasePressed("P1 Up") ? "U" : ".");
|
|
||||||
input.Append(IsBasePressed("P1 Down") ? "D" : ".");
|
|
||||||
input.Append(IsBasePressed("P1 Left") ? "L" : ".");
|
|
||||||
input.Append(IsBasePressed("P1 Right") ? "R" : ".");
|
|
||||||
input.Append(IsBasePressed("P1 B1") ? "1" : ".");
|
|
||||||
input.Append(IsBasePressed("P1 B2") ? "2" : ".");
|
|
||||||
input.Append("|");
|
|
||||||
input.Append(IsBasePressed("P2 Up") ? "U" : ".");
|
|
||||||
input.Append(IsBasePressed("P2 Down") ? "D" : ".");
|
|
||||||
input.Append(IsBasePressed("P2 Left") ? "L" : ".");
|
|
||||||
input.Append(IsBasePressed("P2 Right") ? "R" : ".");
|
|
||||||
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("|");
|
|
||||||
return input.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlType == "PC Engine Controller")
|
|
||||||
{
|
|
||||||
input.Append("."); //TODO: some kind of command key, since reset isn't used (adelikat: unimplmented command was
|
|
||||||
input.Append("|");
|
|
||||||
for (int player = 1; player <= 5; player++)
|
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Up") ? "U" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Down") ? "D" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Left") ? "L" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Right") ? "R" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Select") ? "S" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Run") ? "r" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " B2") ? "2" : ".");
|
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " B1") ? "1" : ".");
|
|
||||||
input.Append("|");
|
input.Append("|");
|
||||||
}
|
}
|
||||||
return input.ToString();
|
for (int player = 1; player <= Global.PLAYERS[ControlType]; player++)
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlType == "Gameboy Controller")
|
|
||||||
{
|
|
||||||
input.Append(".|"); //TODO: reset goes here
|
|
||||||
input.Append(IsBasePressed("Up") ? "U" : ".");
|
|
||||||
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("|");
|
|
||||||
|
|
||||||
return input.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlType == "NES Controller")
|
|
||||||
{
|
|
||||||
input.Append(IsBasePressed("Reset") ? "r" :
|
|
||||||
Global.Emulator.IsLagFrame ? "l" : ".");
|
|
||||||
input.Append("|");
|
|
||||||
for (int player = 1; player <= 4; player++)
|
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Up") ? "U" : ".");
|
foreach (string button in Global.BUTTONS[ControlType].Keys)
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Down") ? "D" : ".");
|
{
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Left") ? "L" : ".");
|
input.Append(
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Right") ? "R" : ".");
|
IsBasePressed("P" + player.ToString() + " " + button
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Select") ? "s" : ".");
|
) ? Global.BUTTONS[ControlType][button] : ".");
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " Start") ? "S" : ".");
|
}
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " B") ? "B" : ".");
|
input.Append("|");
|
||||||
input.Append(IsBasePressed("P" + player.ToString() + " A") ? "A" : ".");
|
}
|
||||||
|
if (ControlType == "SMS Controller")
|
||||||
|
{
|
||||||
|
foreach (string command in Global.COMMANDS[ControlType].Keys)
|
||||||
|
{
|
||||||
|
input.Append(IsBasePressed(command) ? Global.COMMANDS[ControlType][command] : ".");
|
||||||
|
}
|
||||||
input.Append("|");
|
input.Append("|");
|
||||||
}
|
}
|
||||||
return input.ToString();
|
return input.ToString();
|
||||||
|
@ -542,115 +432,42 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
MyBoolButtons.Clear();
|
MyBoolButtons.Clear();
|
||||||
|
|
||||||
if (ControlType == "Genesis 3-Button Controller")
|
if (ControlType == "SMS Controller" || ControlType == "Gameboy Controller" || ControlType == "PC Engine Controller" || ControlType == "NES Controller")
|
||||||
{
|
{
|
||||||
Force("Up", c[1]);
|
int start = 3;
|
||||||
Force("Down", c[2]);
|
if (ControlType == "NES Controller")
|
||||||
Force("Left", c[3]);
|
|
||||||
Force("Right", c[4]);
|
|
||||||
Force("Start", c[5]);
|
|
||||||
Force("A", c[6]);
|
|
||||||
Force("B", c[7]);
|
|
||||||
Force("C", c[8]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlType == "SMS Controller")
|
|
||||||
{
|
|
||||||
Force("P1 Up", c[1]);
|
|
||||||
Force("P1 Down", c[2]);
|
|
||||||
Force("P1 Left", c[3]);
|
|
||||||
Force("P1 Right", c[4]);
|
|
||||||
Force("P1 B1", c[5]);
|
|
||||||
Force("P1 B2", c[6]);
|
|
||||||
|
|
||||||
Force("P2 Up", c[8]);
|
|
||||||
Force("P2 Down", c[9]);
|
|
||||||
Force("P2 Left", c[10]);
|
|
||||||
Force("P2 Right", c[11]);
|
|
||||||
Force("P2 B1", c[12]);
|
|
||||||
Force("P2 B2", c[13]);
|
|
||||||
|
|
||||||
Force("Pause", c[15]);
|
|
||||||
Force("Reset", c[16]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlType == "PC Engine Controller")
|
|
||||||
{
|
|
||||||
for (int i = 1; i <= 5; i++)
|
|
||||||
{
|
{
|
||||||
int srcindex = (i - 1) * 9;
|
if (mnemonic.Length < 2) return;
|
||||||
if (mnemonic.Length <= srcindex + 9)
|
Force("Reset", mnemonic[1] != '.' && mnemonic[1] != '0' && mnemonic[1] != 'l');
|
||||||
|
}
|
||||||
|
if (ControlType == "SMS Controller")
|
||||||
|
{
|
||||||
|
start = 1;
|
||||||
|
}
|
||||||
|
for (int player = 1; player <= Global.PLAYERS[ControlType]; player++)
|
||||||
|
{
|
||||||
|
int srcindex = (player - 1) * (Global.BUTTONS[ControlType].Count + 1);
|
||||||
|
int ctr = start;
|
||||||
|
if (mnemonic.Length < srcindex + ctr + Global.BUTTONS[ControlType].Count - 1)
|
||||||
{
|
{
|
||||||
Force("P" + i + " Up", false);
|
return;
|
||||||
Force("P" + i + " Down", false);
|
|
||||||
Force("P" + i + " Left", false);
|
|
||||||
Force("P" + i + " Right", false);
|
|
||||||
Force("P" + i + " Select", false);
|
|
||||||
Force("P" + i + " Run", false);
|
|
||||||
Force("P" + i + " B2", false);
|
|
||||||
Force("P" + i + " B1", false);
|
|
||||||
}
|
}
|
||||||
else
|
foreach (string button in Global.BUTTONS[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + i + " Up", c[srcindex + 3]);
|
Force("P" + player + " " + button, c[srcindex + ctr++]);
|
||||||
Force("P" + i + " Down", c[srcindex + 4]);
|
|
||||||
Force("P" + i + " Left", c[srcindex + 5]);
|
|
||||||
Force("P" + i + " Right", c[srcindex + 6]);
|
|
||||||
Force("P" + i + " Select", c[srcindex + 7]);
|
|
||||||
Force("P" + i + " Run", c[srcindex + 8]);
|
|
||||||
Force("P" + i + " B2", c[srcindex + 9]);
|
|
||||||
Force("P" + i + " B1", c[srcindex + 10]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (ControlType == "SMS Controller")
|
||||||
|
|
||||||
if (ControlType == "NES Controller")
|
|
||||||
{
|
|
||||||
if (mnemonic.Length < 2) return;
|
|
||||||
Force("Reset", mnemonic[1] != '.' && mnemonic[1] != '0' && mnemonic[1] != 'l');
|
|
||||||
for (int i = 1; i <= 4; i++)
|
|
||||||
{
|
{
|
||||||
int srcindex = (i - 1) * 9;
|
int srcindex = Global.PLAYERS[ControlType] * (Global.BUTTONS[ControlType].Count + 1);
|
||||||
if (mnemonic.Length <= srcindex + 9)
|
int ctr = start;
|
||||||
|
foreach (string command in Global.COMMANDS[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + i + " Up", false);
|
Force(command, c[srcindex + ctr++]);
|
||||||
Force("P" + i + " Down", false);
|
|
||||||
Force("P" + i + " Left", false);
|
|
||||||
Force("P" + i + " Right", false);
|
|
||||||
Force("P" + i + " Select", false);
|
|
||||||
Force("P" + i + " Start", false);
|
|
||||||
Force("P" + i + " B", false);
|
|
||||||
Force("P" + i + " A", false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Force("P" + i + " Up", c[srcindex + 3]);
|
|
||||||
Force("P" + i + " Down", c[srcindex + 4]);
|
|
||||||
Force("P" + i + " Left", c[srcindex + 5]);
|
|
||||||
Force("P" + i + " Right", c[srcindex + 6]);
|
|
||||||
Force("P" + i + " Select", c[srcindex + 7]);
|
|
||||||
Force("P" + i + " Start", c[srcindex + 8]);
|
|
||||||
Force("P" + i + " B", c[srcindex + 9]);
|
|
||||||
Force("P" + i + " A", c[srcindex + 10]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ControlType == "Gameboy Controller")
|
|
||||||
{
|
|
||||||
if (mnemonic.Length < 10) return;
|
|
||||||
//if (mnemonic[1] != '.' && mnemonic[1] != '0') programmaticallyPressedButtons.Add("Reset");
|
|
||||||
int ctr = 3;
|
|
||||||
Force("P1 Up", 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++]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlType == "TI83 Controls")
|
if (ControlType == "TI83 Controls")
|
||||||
{
|
{
|
||||||
if (mnemonic.Length < 50) return;
|
if (mnemonic.Length < 50) return;
|
||||||
|
|
|
@ -160,21 +160,19 @@ namespace BizHawk.MultiClient
|
||||||
// Split up the sections of the frame.
|
// Split up the sections of the frame.
|
||||||
string[] sections = str.Split('|');
|
string[] sections = str.Split('|');
|
||||||
string[] buttons = {};
|
string[] buttons = {};
|
||||||
string console = "";
|
SimpleController controllers = new SimpleController();
|
||||||
|
controllers.Type = new ControllerDefinition();
|
||||||
switch (emulator)
|
switch (emulator)
|
||||||
{
|
{
|
||||||
case "FCEUX":
|
case "FCEUX":
|
||||||
buttons = new string[8] {"Right", "Left", "Down", "Up", "Start", "Select", "B", "A"};
|
buttons = new string[8] {"Right", "Left", "Down", "Up", "Start", "Select", "B", "A"};
|
||||||
console = "NES";
|
controllers.Type.Name = "NES Controller";
|
||||||
break;
|
break;
|
||||||
case "Mednafen/PCEjin":
|
case "Mednafen/PCEjin":
|
||||||
buttons = new string[8] {"Up", "Down", "Left", "Right", "B1", "B2", "Run", "Select"};
|
buttons = new string[8] {"Up", "Down", "Left", "Right", "B1", "B2", "Run", "Select"};
|
||||||
console = "PC Engine";
|
controllers.Type.Name = "PC Engine Controller";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SimpleController controllers = new SimpleController();
|
|
||||||
controllers.Type = new ControllerDefinition();
|
|
||||||
controllers.Type.Name = console + " Controller";
|
|
||||||
if (warning == "" && sections[1].Length != 0 && emulator == "FCEUX")
|
if (warning == "" && sections[1].Length != 0 && emulator == "FCEUX")
|
||||||
{
|
{
|
||||||
switch (sections[1][0])
|
switch (sections[1][0])
|
||||||
|
@ -205,14 +203,18 @@ namespace BizHawk.MultiClient
|
||||||
warning = "Unable to import " + warning + " command on line " + line;
|
warning = "Unable to import " + warning + " command on line " + line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int player = 2; player < sections.Length; player++)
|
for (int section = 2; section < sections.Length - 1; section++)
|
||||||
{
|
{
|
||||||
if (sections[player].Length == buttons.Length)
|
int player = section - 1;
|
||||||
|
if (
|
||||||
|
sections[section].Length == buttons.Length &&
|
||||||
|
player <= Global.PLAYERS[controllers.Type.Name]
|
||||||
|
)
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + (player - 1).ToString() + " " + buttons[button]] = (
|
controllers["P" + (player).ToString() + " " + buttons[button]] = (
|
||||||
sections[player][button] != '.'
|
sections[section][button] != '.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue