diff --git a/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs index 9f21571986..00dca805df 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs @@ -83,45 +83,33 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64 if (CoreComm.InputCallback != null) CoreComm.InputCallback(); IsLagFrame = false; - sbyte x = 0; - sbyte y = 0; - /* - if (Controller["P1 DPad R"]) x = 80; - if (Controller["P1 DPad L"]) x = -80; - if (Controller["P1 DPad D"]) y = -80; - if (Controller["P1 DPad U"]) y = 80; - */ - - float X_Axis = Controller.GetFloat("P1 X Axis"); - float Y_Axis = Controller.GetFloat("P1 Y Axis"); - // Analog stick right = +X // Analog stick up = +Y - x = (sbyte)X_Axis; - y = (sbyte)Y_Axis; - - api.set_buttons(0, ReadController(1), x, y); + for (int i = 0; i < 4; i++) + { + api.set_buttons(i, ReadController(i+1), (sbyte)Controller.GetFloat("P" + (i+1) + " X Axis"), (sbyte)Controller.GetFloat("P" + (i+1) + " Y Axis")); + } } public int ReadController(int num) { int buttons = 0; - if (Controller["P1 DPad R"]) buttons |= (1 << 0); - if (Controller["P1 DPad L"]) buttons |= (1 << 1); - if (Controller["P1 DPad D"]) buttons |= (1 << 2); - if (Controller["P1 DPad U"]) buttons |= (1 << 3); - if (Controller["P1 Start"]) buttons |= (1 << 4); - if (Controller["P1 Z"]) buttons |= (1 << 5); - if (Controller["P1 B"]) buttons |= (1 << 6); - if (Controller["P1 A"]) buttons |= (1 << 7); - if (Controller["P1 C Right"]) buttons |= (1 << 8); - if (Controller["P1 C Left"]) buttons |= (1 << 9); - if (Controller["P1 C Down"]) buttons |= (1 << 10); - if (Controller["P1 C Up"]) buttons |= (1 << 11); - if (Controller["P1 R"]) buttons |= (1 << 12); - if (Controller["P1 L"]) buttons |= (1 << 13); + if (Controller["P" + num + " DPad R"]) buttons |= (1 << 0); + if (Controller["P" + num + " DPad L"]) buttons |= (1 << 1); + if (Controller["P" + num + " DPad D"]) buttons |= (1 << 2); + if (Controller["P" + num + " DPad U"]) buttons |= (1 << 3); + if (Controller["P" + num + " Start"]) buttons |= (1 << 4); + if (Controller["P" + num + " Z"]) buttons |= (1 << 5); + if (Controller["P" + num + " B"]) buttons |= (1 << 6); + if (Controller["P" + num + " A"]) buttons |= (1 << 7); + if (Controller["P" + num + " C Right"]) buttons |= (1 << 8); + if (Controller["P" + num + " C Left"]) buttons |= (1 << 9); + if (Controller["P" + num + " C Down"]) buttons |= (1 << 10); + if (Controller["P" + num + " C Up"]) buttons |= (1 << 11); + if (Controller["P" + num + " R"]) buttons |= (1 << 12); + if (Controller["P" + num + " L"]) buttons |= (1 << 13); return buttons; } diff --git a/BizHawk.MultiClient/output/dll/mupen64plus-input-bkm.dll b/BizHawk.MultiClient/output/dll/mupen64plus-input-bkm.dll index 266255aa8a..bd88f202b8 100644 Binary files a/BizHawk.MultiClient/output/dll/mupen64plus-input-bkm.dll and b/BizHawk.MultiClient/output/dll/mupen64plus-input-bkm.dll differ diff --git a/libmupen64plus/mupen64plus-input-bkm/plugin.c b/libmupen64plus/mupen64plus-input-bkm/plugin.c index c54db479ad..d10a545661 100644 --- a/libmupen64plus/mupen64plus-input-bkm/plugin.c +++ b/libmupen64plus/mupen64plus-input-bkm/plugin.c @@ -388,16 +388,13 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo) int i; memset( controller, 0, sizeof( SController ) * 4 ); - for (i = 0; i < 4; i++) - controller[i].control = ControlInfo.Controls + i; - for( i = 0; i < 4; i++ ) { - controller[i].control->Plugin = PLUGIN_MEMPAK; + controller[i].control = ControlInfo.Controls + i; + controller[i].control->Plugin = PLUGIN_MEMPAK; + controller[i].control->Present = 1; } - controller[0].control->Present = 1; - DebugMessage(M64MSG_INFO, "%s version %i.%i.%i initialized.", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION)); }