It's like archaeology. We're the first ones to use this ancient Mayan super scope code

This commit is contained in:
nattthebear 2017-04-20 21:29:58 -04:00
parent 99d70a1c7f
commit a46acca981
4 changed files with 5 additions and 20 deletions

View File

@ -37,10 +37,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
LimitAnalogChangeSensitivity = ss.LimitAnalogChangeSensitivity LimitAnalogChangeSensitivity = ss.LimitAnalogChangeSensitivity
}; };
case ControllerType.SuperScope: case ControllerType.SuperScope:
return new SnesSuperScopeController return new SnesSuperScopeController();
{
LimitAnalogChangeSensitivity = ss.LimitAnalogChangeSensitivity
};
default: default:
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
@ -342,15 +339,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
}, },
FloatRanges = FloatRanges =
{ {
new[] { -10, 0f, 10f }, // problem: when you're in 240 line mode, the limit on Y needs to be 240.
new[] { -10f, 0f, 10f } // when you're in 224 mode, it needs to be 224. perhaps the deck needs to account for this...
new[] { 0f, 128f, 256f },
new[] { 0f, 0f, 240f }
} }
}; };
public ControllerDefinition Definition => _definition; public ControllerDefinition Definition => _definition;
public bool LimitAnalogChangeSensitivity { get; set; } = true;
public short GetState(IController controller, int index, int id) public short GetState(IController controller, int index, int id)
{ {
switch (id) switch (id)
@ -359,19 +356,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
return 0; return 0;
case 0: case 0:
var x = (int)controller.GetFloat("0X"); var x = (int)controller.GetFloat("0X");
if (LimitAnalogChangeSensitivity)
{
x = x.Clamp(-10, 10);
}
return (short)x; return (short)x;
case 1: case 1:
var y = (int)controller.GetFloat("0Y"); var y = (int)controller.GetFloat("0Y");
if (LimitAnalogChangeSensitivity)
{
y = y.Clamp(-10, 10);
}
return (short)y; return (short)y;
case 2: case 2:
return (short)(controller.IsPressed("0Trigger") ? 1 : 0); return (short)(controller.IsPressed("0Trigger") ? 1 : 0);

View File

@ -30,8 +30,6 @@ void SuperScope::enter() {
//Vcounter wrapped back to zero; update cursor coordinates for start of new frame //Vcounter wrapped back to zero; update cursor coordinates for start of new frame
int nx = interface()->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::X); int nx = interface()->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::X);
int ny = interface()->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Y); int ny = interface()->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Y);
nx += x;
ny += y;
x = max(-16, min(256 + 16, nx)); x = max(-16, min(256 + 16, nx));
y = max(-16, min(240 + 16, ny)); y = max(-16, min(240 + 16, ny));
offscreen = (x < 0 || y < 0 || x >= 256 || y >= (ppu.overscan() ? 240 : 225)); offscreen = (x < 0 || y < 0 || x >= 256 || y >= (ppu.overscan() ? 240 : 225));