diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs index 7b0a3d09ec..b1f19e30a1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi.cs @@ -142,7 +142,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public delegate void snes_video_refresh_t(int* data, int width, int height); public delegate void snes_input_poll_t(); - public delegate ushort snes_input_state_t(int port, int device, int index, int id); + public delegate short snes_input_state_t(int port, int device, int index, int id); public delegate void snes_input_notify_t(int index); public delegate void snes_audio_sample_t(ushort left, ushort right); public delegate void snes_scanlineStart_t(int line); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_SIG.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_SIG.cs index ff901e1ff3..7e0d27497e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_SIG.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesApi_SIG.cs @@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES int index = comm->index; int id = (int)comm->id; if (input_state != null) - comm->value = input_state(port, device, index, id); + comm->value = (uint)input_state(port, device, index, id); break; } case eMessage.eMessage_SIG_input_notify: diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs index 6c075dab4d..9205c375db 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesControllerDeck.cs @@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES } } - public ushort CoreInputState(IController controller, int port, int device, int index, int id) + public short CoreInputState(IController controller, int port, int device, int index, int id) { return _ports[port].GetState(_mergers[port].UnMerge(controller), index, id); } @@ -76,7 +76,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// libsnes specific value, sometimes multitap number /// libsnes specific value, sometimes button number /// - ushort GetState(IController controller, int index, int id); + short GetState(IController controller, int index, int id); ControllerDefinition Definition { get; } @@ -122,7 +122,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES ["0X"] = 8, ["0A"] = 9, - + ["0L"] = 10, ["0R"] = 11 }; @@ -137,13 +137,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public ControllerDefinition Definition { get; } = _definition; - public ushort GetState(IController controller, int index, int id) + public short GetState(IController controller, int index, int id) { if (id >= 12) { return 0; } - return (ushort)(controller.IsPressed(Buttons[id]) ? 1 : 0); + return (short)(controller.IsPressed(Buttons[id]) ? 1 : 0); } } @@ -203,13 +203,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public ControllerDefinition Definition { get; } = _definition; - public ushort GetState(IController controller, int index, int id) + public short GetState(IController controller, int index, int id) { if (id >= 12) { return 0; } - return (ushort)(controller.IsPressed(index + Buttons[id]) ? 1 : 0); + return (short)(controller.IsPressed(index + Buttons[id]) ? 1 : 0); } } @@ -224,9 +224,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public ControllerDefinition Definition { get; } = _definition; - public ushort GetState(IController controller, int index, int id) + public short GetState(IController controller, int index, int id) { - return (ushort)(controller.IsPressed("0B" + (index << 4 & 16 | id)) ? 1 : 0); + return (short)(controller.IsPressed("0B" + (index << 4 & 16 | id)) ? 1 : 0); } } @@ -238,7 +238,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES public ControllerDefinition Definition { get; } = _definition; - public ushort GetState(IController controller, int index, int id) + public short GetState(IController controller, int index, int id) { return 0; } @@ -255,38 +255,34 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES "0Left", "0Right" }, - FloatControls = // should be in [0..700000] + FloatControls = { "0X", "0Y" }, FloatRanges = { - // what is the center point supposed to be here? - new[] { -127f, 0.0f, 128f }, - new[] { -127f, 0.0f, 128f }, - new[] { -127f, 0.0f, 128f }, - new[] { -127f, 0.0f, 128f } + new[] { -127f, 0f, 127f }, + new[] { -127f, 0f, 127f } } }; public ControllerDefinition Definition => _definition; - public ushort GetState(IController controller, int index, int id) + public short GetState(IController controller, int index, int id) { switch (id) { default: return 0; case 0: - return (ushort)controller.GetFloat("0X"); + return (short)controller.GetFloat("0X"); case 1: - return (ushort)controller.GetFloat("0Y"); + return (short)controller.GetFloat("0Y"); case 2: - return (ushort)(controller.IsPressed("0Left") ? 1 : 0); + return (short)(controller.IsPressed("0Left") ? 1 : 0); case 3: - return (ushort)(controller.IsPressed("0Right") ? 1 : 0); - + return (short)(controller.IsPressed("0Right") ? 1 : 0); } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 22100f5f12..0dca98f6ea 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -507,7 +507,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// meaningless for most controllers. for multitap, 0-3 for which multitap controller /// button ID enum; in the case of a regular controller, this corresponds to shift register position /// for regular controllers, one bit D0 of button status. for other controls, varying ranges depending on id - ushort snes_input_state(int port, int device, int index, int id) + short snes_input_state(int port, int device, int index, int id) { return _controllerDeck.CoreInputState(Controller, port, device, index, id); }