Use the IController indexing property less in preparation for removing it from the interface. Replaced with its more explicity counter-part .IsPressed()

This commit is contained in:
adelikat 2016-12-14 12:42:15 -06:00
parent aaed8e67d5
commit 72a59087b5
36 changed files with 332 additions and 327 deletions

View File

@ -221,7 +221,7 @@ namespace BizHawk.Client.Common
{ {
foreach (var button in source.Definition.BoolButtons) foreach (var button in source.Definition.BoolButtons)
{ {
Buttons[button] = source[button]; Buttons[button] = source.IsPressed(button);
} }
} }

View File

@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
foreach (var button in adapter.Definition.BoolButtons) foreach (var button in adapter.Definition.BoolButtons)
{ {
input[button] = adapter[button]; input[button] = adapter.IsPressed(button);
} }
foreach (var button in adapter.Definition.FloatControls) foreach (var button in adapter.Definition.FloatControls)

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.Common
continue; continue;
} }
var val = playerSource[button]; var val = playerSource.IsPressed(button);
MyBoolButtons[button] = val; MyBoolButtons[button] = val;
} }

View File

@ -48,7 +48,7 @@ namespace BizHawk.Client.Common
continue; continue;
} }
var val = playerSource[button]; var val = playerSource.IsPressed(button);
MyBoolButtons[button] = val; MyBoolButtons[button] = val;
} }
} }
@ -60,7 +60,7 @@ namespace BizHawk.Client.Common
{ {
foreach (var button in Definition.BoolButtons) foreach (var button in Definition.BoolButtons)
{ {
MyBoolButtons[button] = source[button]; MyBoolButtons[button] = source.IsPressed(button);
} }
foreach (var name in Definition.FloatControls) foreach (var name in Definition.FloatControls)

View File

@ -162,28 +162,28 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
_machine.Cpu.TraceCallback = null; _machine.Cpu.TraceCallback = null;
} }
if (Controller["Next Disk"] && !_nextPressed) if (Controller.IsPressed("Next Disk") && !_nextPressed)
{ {
_nextPressed = true; _nextPressed = true;
IncrementDisk(); IncrementDisk();
} }
else if (Controller["Previous Disk"] && !_prevPressed) else if (Controller.IsPressed("Previous Disk") && !_prevPressed)
{ {
_prevPressed = true; _prevPressed = true;
DecrementDisk(); DecrementDisk();
} }
if (!Controller["Next Disk"]) if (!Controller.IsPressed("Next Disk"))
{ {
_nextPressed = false; _nextPressed = false;
} }
if (!Controller["Previous Disk"]) if (!Controller.IsPressed("Previous Disk"))
{ {
_prevPressed = false; _prevPressed = false;
} }
_machine.BizFrameAdvance(RealButtons.Where(b => Controller[b])); _machine.BizFrameAdvance(RealButtons.Where(b => Controller.IsPressed(b)));
if (IsLagFrame) if (IsLagFrame)
{ {
LagCount++; LagCount++;

View File

@ -6,23 +6,23 @@
private readonly bool[] _keyboardPressed = new bool[64]; private readonly bool[] _keyboardPressed = new bool[64];
private static readonly string[][] JoystickMatrix = { private static readonly string[][] JoystickMatrix = {
new[] {"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button"}, new[] {"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button"},
new[] {"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button"} new[] {"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button"}
}; };
private static readonly string[][] KeyboardMatrix = { private static readonly string[][] KeyboardMatrix = {
new[] { "Key Insert/Delete", "Key Return", "Key Cursor Left/Right", "Key F7", "Key F1", "Key F3", "Key F5", "Key Cursor Up/Down" }, new[] { "Key Insert/Delete", "Key Return", "Key Cursor Left/Right", "Key F7", "Key F1", "Key F3", "Key F5", "Key Cursor Up/Down" },
new[] { "Key 3", "Key W", "Key A", "Key 4", "Key Z", "Key S", "Key E", "Key Left Shift" }, new[] { "Key 3", "Key W", "Key A", "Key 4", "Key Z", "Key S", "Key E", "Key Left Shift" },
new[] { "Key 5", "Key R", "Key D", "Key 6", "Key C", "Key F", "Key T", "Key X" }, new[] { "Key 5", "Key R", "Key D", "Key 6", "Key C", "Key F", "Key T", "Key X" },
new[] { "Key 7", "Key Y", "Key G", "Key 8", "Key B", "Key H", "Key U", "Key V" }, new[] { "Key 7", "Key Y", "Key G", "Key 8", "Key B", "Key H", "Key U", "Key V" },
new[] { "Key 9", "Key I", "Key J", "Key 0", "Key M", "Key K", "Key O", "Key N" }, new[] { "Key 9", "Key I", "Key J", "Key 0", "Key M", "Key K", "Key O", "Key N" },
new[] { "Key Plus", "Key P", "Key L", "Key Minus", "Key Period", "Key Colon", "Key At", "Key Comma" }, new[] { "Key Plus", "Key P", "Key L", "Key Minus", "Key Period", "Key Colon", "Key At", "Key Comma" },
new[] { "Key Pound", "Key Asterisk", "Key Semicolon", "Key Clear/Home", "Key Right Shift", "Key Equal", "Key Up Arrow", "Key Slash" }, new[] { "Key Pound", "Key Asterisk", "Key Semicolon", "Key Clear/Home", "Key Right Shift", "Key Equal", "Key Up Arrow", "Key Slash" },
new[] { "Key 1", "Key Left Arrow", "Key Control", "Key 2", "Key Space", "Key Commodore", "Key Q", "Key Run/Stop" } new[] { "Key 1", "Key Left Arrow", "Key Control", "Key 2", "Key Space", "Key Commodore", "Key Q", "Key Run/Stop" }
}; };
[SaveState.DoNotSave] int _pollIndex; [SaveState.DoNotSave] int _pollIndex;
private bool _restorePressed; private bool _restorePressed;
public void PollInput() public void PollInput()
{ {
@ -33,10 +33,10 @@
{ {
for (var i = 0; i < 5; i++) for (var i = 0; i < 5; i++)
{ {
_joystickPressed[_pollIndex] = Controller[JoystickMatrix[j][i]]; _joystickPressed[_pollIndex] = Controller.IsPressed(JoystickMatrix[j][i]);
_pollIndex++; _pollIndex++;
} }
} }
// scan keyboard // scan keyboard
_pollIndex = 0; _pollIndex = 0;
@ -44,11 +44,11 @@
{ {
for (var j = 0; j < 8; j++) for (var j = 0; j < 8; j++)
{ {
_keyboardPressed[_pollIndex++] = Controller[KeyboardMatrix[i][j]]; _keyboardPressed[_pollIndex++] = Controller.IsPressed(KeyboardMatrix[i][j]);
} }
} }
_restorePressed = Controller["Key Restore"]; _restorePressed = Controller.IsPressed("Key Restore");
} }
} }
} }

View File

@ -392,27 +392,27 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_frame++; _frame++;
_islag = true; _islag = true;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
{ {
HardReset(); HardReset();
} }
if (Controller["Toggle Left Difficulty"] && !_leftDifficultySwitchHeld) if (Controller.IsPressed("Toggle Left Difficulty") && !_leftDifficultySwitchHeld)
{ {
_leftDifficultySwitchPressed ^= true; _leftDifficultySwitchPressed ^= true;
_leftDifficultySwitchHeld = true; _leftDifficultySwitchHeld = true;
} }
else if (!Controller["Toggle Left Difficulty"]) else if (!Controller.IsPressed("Toggle Left Difficulty"))
{ {
_leftDifficultySwitchHeld = false; _leftDifficultySwitchHeld = false;
} }
if (Controller["Toggle Right Difficulty"] && !_rightDifficultySwitchHeld) if (Controller.IsPressed("Toggle Right Difficulty") && !_rightDifficultySwitchHeld)
{ {
_rightDifficultySwitchPressed ^= true; _rightDifficultySwitchPressed ^= true;
_rightDifficultySwitchHeld = true; _rightDifficultySwitchHeld = true;
} }
else if (!Controller["Toggle Right Difficulty"]) else if (!Controller.IsPressed("Toggle Right Difficulty"))
{ {
_rightDifficultySwitchHeld = false; _rightDifficultySwitchHeld = false;
} }
@ -453,11 +453,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
InputCallbacks.Call(); InputCallbacks.Call();
byte value = 0xFF; byte value = 0xFF;
if (Controller["P1 Up"]) { value &= 0xEF; } if (Controller.IsPressed("P1 Up")) { value &= 0xEF; }
if (Controller["P1 Down"]) { value &= 0xDF; } if (Controller.IsPressed("P1 Down")) { value &= 0xDF; }
if (Controller["P1 Left"]) { value &= 0xBF; } if (Controller.IsPressed("P1 Left")) { value &= 0xBF; }
if (Controller["P1 Right"]) { value &= 0x7F; } if (Controller.IsPressed("P1 Right")) { value &= 0x7F; }
if (Controller["P1 Button"]) { value &= 0xF7; } if (Controller.IsPressed("P1 Button")) { value &= 0xF7; }
if (!peek) if (!peek)
{ {
@ -472,11 +472,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
InputCallbacks.Call(); InputCallbacks.Call();
byte value = 0xFF; byte value = 0xFF;
if (Controller["P2 Up"]) { value &= 0xEF; } if (Controller.IsPressed("P2 Up")) { value &= 0xEF; }
if (Controller["P2 Down"]) { value &= 0xDF; } if (Controller.IsPressed("P2 Down")) { value &= 0xDF; }
if (Controller["P2 Left"]) { value &= 0xBF; } if (Controller.IsPressed("P2 Left")) { value &= 0xBF; }
if (Controller["P2 Right"]) { value &= 0x7F; } if (Controller.IsPressed("P2 Right")) { value &= 0x7F; }
if (Controller["P2 Button"]) { value &= 0xF7; } if (Controller.IsPressed("P2 Button")) { value &= 0xF7; }
if (!peek) if (!peek)
{ {
@ -489,8 +489,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
internal byte ReadConsoleSwitches(bool peek) internal byte ReadConsoleSwitches(bool peek)
{ {
byte value = 0xFF; byte value = 0xFF;
bool select = Controller["Select"]; bool select = Controller.IsPressed("Select");
bool reset = Controller["Reset"]; bool reset = Controller.IsPressed("Reset");
if (reset) { value &= 0xFE; } if (reset) { value &= 0xFE; }
if (select) { value &= 0xFD; } if (select) { value &= 0xFD; }

View File

@ -92,7 +92,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
{ {
_frame++; _frame++;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
{ {
// it seems that theMachine.Reset() doesn't clear ram, etc // it seems that theMachine.Reset() doesn't clear ram, etc
// this should leave hsram intact but clear most other things // this should leave hsram intact but clear most other things

View File

@ -216,32 +216,32 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
static void ConvertConsoleButtons(IController c, InputState s) static void ConvertConsoleButtons(IController c, InputState s)
{ {
s.RaiseInput(0, MachineInput.Reset, c["Reset"]); s.RaiseInput(0, MachineInput.Reset, c.IsPressed("Reset"));
s.RaiseInput(0, MachineInput.Select, c["Select"]); s.RaiseInput(0, MachineInput.Select, c.IsPressed("Select"));
s.RaiseInput(0, MachineInput.Color, c["BW"]); s.RaiseInput(0, MachineInput.Color, c.IsPressed("BW"));
if (c["Toggle Left Difficulty"]) { s.RaiseInput(0, MachineInput.LeftDifficulty, c["Toggle Left Difficulty"]); } if (c.IsPressed("Toggle Left Difficulty")) { s.RaiseInput(0, MachineInput.LeftDifficulty, c.IsPressed("Toggle Left Difficulty")); }
if (c["Toggle Right Difficulty"]) { s.RaiseInput(0, MachineInput.RightDifficulty, c["Toggle Right Difficulty"]); } if (c.IsPressed("Toggle Right Difficulty")) { s.RaiseInput(0, MachineInput.RightDifficulty, c.IsPressed("Toggle Right Difficulty")); }
} }
static void ConvertConsoleButtons7800(IController c, InputState s) static void ConvertConsoleButtons7800(IController c, InputState s)
{ {
s.RaiseInput(0, MachineInput.Reset, c["Reset"]); s.RaiseInput(0, MachineInput.Reset, c.IsPressed("Reset"));
s.RaiseInput(0, MachineInput.Select, c["Select"]); s.RaiseInput(0, MachineInput.Select, c.IsPressed("Select"));
s.RaiseInput(0, MachineInput.Color, c["Pause"]); s.RaiseInput(0, MachineInput.Color, c.IsPressed("Pause"));
if (c["Toggle Left Difficulty"]) { s.RaiseInput(0, MachineInput.LeftDifficulty, c["Toggle Left Difficulty"]); } if (c.IsPressed("Toggle Left Difficulty")) { s.RaiseInput(0, MachineInput.LeftDifficulty, c.IsPressed("Toggle Left Difficulty")); }
if (c["Toggle Right Difficulty"]) { s.RaiseInput(0, MachineInput.RightDifficulty, c["Toggle Right Difficulty"]); } if (c.IsPressed("Toggle Right Difficulty")) { s.RaiseInput(0, MachineInput.RightDifficulty, c.IsPressed("Toggle Right Difficulty")); }
} }
static void ConvertDirections(IController c, InputState s, int p) static void ConvertDirections(IController c, InputState s, int p)
{ {
string ps = string.Format("P{0} ", p + 1); string ps = string.Format("P{0} ", p + 1);
s.RaiseInput(p, MachineInput.Up, c[ps + "Up"]); s.RaiseInput(p, MachineInput.Up, c.IsPressed(ps + "Up"));
s.RaiseInput(p, MachineInput.Down, c[ps + "Down"]); s.RaiseInput(p, MachineInput.Down, c.IsPressed(ps + "Down"));
s.RaiseInput(p, MachineInput.Left, c[ps + "Left"]); s.RaiseInput(p, MachineInput.Left, c.IsPressed(ps + "Left"));
s.RaiseInput(p, MachineInput.Right, c[ps + "Right"]); s.RaiseInput(p, MachineInput.Right, c.IsPressed(ps + "Right"));
} }
static void ConvertTrigger(IController c, InputState s, int p) static void ConvertTrigger(IController c, InputState s, int p)
{ {
string ps = string.Format("P{0} ", p + 1); string ps = string.Format("P{0} ", p + 1);
s.RaiseInput(p, MachineInput.Fire, c[ps + "Trigger"]); s.RaiseInput(p, MachineInput.Fire, c.IsPressed(ps + "Trigger"));
} }
static void ConvertJoystick(IController c, InputState s) static void ConvertJoystick(IController c, InputState s)
@ -271,18 +271,18 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
string ps = string.Format("P{0} ", i + 1); string ps = string.Format("P{0} ", i + 1);
s.RaiseInput(i, MachineInput.NumPad1, c[ps + "Keypad1"]); s.RaiseInput(i, MachineInput.NumPad1, c.IsPressed(ps + "Keypad1"));
s.RaiseInput(i, MachineInput.NumPad2, c[ps + "Keypad2"]); s.RaiseInput(i, MachineInput.NumPad2, c.IsPressed(ps + "Keypad2"));
s.RaiseInput(i, MachineInput.NumPad3, c[ps + "Keypad3"]); s.RaiseInput(i, MachineInput.NumPad3, c.IsPressed(ps + "Keypad3"));
s.RaiseInput(i, MachineInput.NumPad4, c[ps + "Keypad4"]); s.RaiseInput(i, MachineInput.NumPad4, c.IsPressed(ps + "Keypad4"));
s.RaiseInput(i, MachineInput.NumPad5, c[ps + "Keypad5"]); s.RaiseInput(i, MachineInput.NumPad5, c.IsPressed(ps + "Keypad5"));
s.RaiseInput(i, MachineInput.NumPad6, c[ps + "Keypad6"]); s.RaiseInput(i, MachineInput.NumPad6, c.IsPressed(ps + "Keypad6"));
s.RaiseInput(i, MachineInput.NumPad7, c[ps + "Keypad7"]); s.RaiseInput(i, MachineInput.NumPad7, c.IsPressed(ps + "Keypad7"));
s.RaiseInput(i, MachineInput.NumPad8, c[ps + "Keypad8"]); s.RaiseInput(i, MachineInput.NumPad8, c.IsPressed(ps + "Keypad8"));
s.RaiseInput(i, MachineInput.NumPad9, c[ps + "Keypad9"]); s.RaiseInput(i, MachineInput.NumPad9, c.IsPressed(ps + "Keypad9"));
s.RaiseInput(i, MachineInput.NumPadMult, c[ps + "KeypadA"]); s.RaiseInput(i, MachineInput.NumPadMult, c.IsPressed(ps + "KeypadA"));
s.RaiseInput(i, MachineInput.NumPad0, c[ps + "Keypad0"]); s.RaiseInput(i, MachineInput.NumPad0, c.IsPressed(ps + "Keypad0"));
s.RaiseInput(i, MachineInput.NumPadHash, c[ps + "KeypadP"]); s.RaiseInput(i, MachineInput.NumPadHash, c.IsPressed(ps + "KeypadP"));
} }
} }
static MachineInput[] drvlut = new[] static MachineInput[] drvlut = new[]
@ -308,12 +308,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
ConvertDirections(c, s, 0); ConvertDirections(c, s, 0);
ConvertDirections(c, s, 1); ConvertDirections(c, s, 1);
// weird mapping is intentional // weird mapping is intentional
s.RaiseInput(0, MachineInput.Fire, c["P1 Trigger"]); s.RaiseInput(0, MachineInput.Fire, c.IsPressed("P1 Trigger"));
s.RaiseInput(0, MachineInput.Fire2, c["P1 Trigger 2"]); s.RaiseInput(0, MachineInput.Fire2, c.IsPressed("P1 Trigger 2"));
s.RaiseInput(1, MachineInput.Fire2, c["P1 Trigger 3"]); s.RaiseInput(1, MachineInput.Fire2, c.IsPressed("P1 Trigger 3"));
s.RaiseInput(1, MachineInput.Fire, c["P2 Trigger"]); s.RaiseInput(1, MachineInput.Fire, c.IsPressed("P2 Trigger"));
s.RaiseInput(2, MachineInput.Fire2, c["P2 Trigger 2"]); s.RaiseInput(2, MachineInput.Fire2, c.IsPressed("P2 Trigger 2"));
s.RaiseInput(3, MachineInput.Fire2, c["P2 Trigger 3"]); s.RaiseInput(3, MachineInput.Fire2, c.IsPressed("P2 Trigger 3"));
} }
static void ConvertProLineJoystick(IController c, InputState s) static void ConvertProLineJoystick(IController c, InputState s)
{ {
@ -321,10 +321,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
ConvertConsoleButtons7800(c, s); ConvertConsoleButtons7800(c, s);
ConvertDirections(c, s, 0); ConvertDirections(c, s, 0);
ConvertDirections(c, s, 1); ConvertDirections(c, s, 1);
s.RaiseInput(0, MachineInput.Fire, c["P1 Trigger"]); s.RaiseInput(0, MachineInput.Fire, c.IsPressed("P1 Trigger"));
s.RaiseInput(0, MachineInput.Fire2, c["P1 Trigger 2"]); s.RaiseInput(0, MachineInput.Fire2, c.IsPressed("P1 Trigger 2"));
s.RaiseInput(1, MachineInput.Fire, c["P2 Trigger"]); s.RaiseInput(1, MachineInput.Fire, c.IsPressed("P2 Trigger"));
s.RaiseInput(1, MachineInput.Fire2, c["P2 Trigger 2"]); s.RaiseInput(1, MachineInput.Fire2, c.IsPressed("P2 Trigger 2"));
} }
static void ConvertLightgun(IController c, InputState s) static void ConvertLightgun(IController c, InputState s)
{ {

View File

@ -128,8 +128,10 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
public void FrameAdvance(bool render, bool rendersound = true) public void FrameAdvance(bool render, bool rendersound = true)
{ {
Frame++; Frame++;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
{
LibLynx.Reset(Core); LibLynx.Reset(Core);
}
int samples = soundbuff.Length; int samples = soundbuff.Length;
IsLagFrame = LibLynx.Advance(Core, GetButtons(), videobuff, soundbuff, ref samples); IsLagFrame = LibLynx.Advance(Core, GetButtons(), videobuff, soundbuff, ref samples);
@ -178,15 +180,15 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
LibLynx.Buttons GetButtons() LibLynx.Buttons GetButtons()
{ {
LibLynx.Buttons ret = 0; LibLynx.Buttons ret = 0;
if (Controller["A"]) ret |= LibLynx.Buttons.A; if (Controller.IsPressed("A")) ret |= LibLynx.Buttons.A;
if (Controller["B"]) ret |= LibLynx.Buttons.B; if (Controller.IsPressed("B")) ret |= LibLynx.Buttons.B;
if (Controller["Up"]) ret |= LibLynx.Buttons.Up; if (Controller.IsPressed("Up")) ret |= LibLynx.Buttons.Up;
if (Controller["Down"]) ret |= LibLynx.Buttons.Down; if (Controller.IsPressed("Down")) ret |= LibLynx.Buttons.Down;
if (Controller["Left"]) ret |= LibLynx.Buttons.Left; if (Controller.IsPressed("Left")) ret |= LibLynx.Buttons.Left;
if (Controller["Right"]) ret |= LibLynx.Buttons.Right; if (Controller.IsPressed("Right")) ret |= LibLynx.Buttons.Right;
if (Controller["Pause"]) ret |= LibLynx.Buttons.Pause; if (Controller.IsPressed("Pause")) ret |= LibLynx.Buttons.Pause;
if (Controller["Option 1"]) ret |= LibLynx.Buttons.Option_1; if (Controller.IsPressed("Option 1")) ret |= LibLynx.Buttons.Option_1;
if (Controller["Option 2"]) ret |= LibLynx.Buttons.Option_2; if (Controller.IsPressed("Option 2")) ret |= LibLynx.Buttons.Option_2;
return ret; return ret;
} }

View File

@ -34,11 +34,11 @@ namespace BizHawk.Emulation.Cores.ColecoVision
if (InputPortSelection == InputPortMode.Left) if (InputPortSelection == InputPortMode.Left)
{ {
byte retval = 0x7F; byte retval = 0x7F;
if (Controller["P1 Up"]) retval &= 0xFE; if (Controller.IsPressed("P1 Up")) retval &= 0xFE;
if (Controller["P1 Right"]) retval &= 0xFD; if (Controller.IsPressed("P1 Right")) retval &= 0xFD;
if (Controller["P1 Down"]) retval &= 0xFB; if (Controller.IsPressed("P1 Down")) retval &= 0xFB;
if (Controller["P1 Left"]) retval &= 0xF7; if (Controller.IsPressed("P1 Left")) retval &= 0xF7;
if (Controller["P1 L"]) retval &= 0x3F; if (Controller.IsPressed("P1 L")) retval &= 0x3F;
return retval; return retval;
} }
@ -47,22 +47,22 @@ namespace BizHawk.Emulation.Cores.ColecoVision
byte retval = 0; byte retval = 0;
// 0x00; // 0x00;
if (Controller["P1 Key 8"]) retval = 0x01; if (Controller.IsPressed("P1 Key 8")) retval = 0x01;
if (Controller["P1 Key 4"]) retval = 0x02; if (Controller.IsPressed("P1 Key 4")) retval = 0x02;
if (Controller["P1 Key 5"]) retval = 0x03; if (Controller.IsPressed("P1 Key 5")) retval = 0x03;
// 0x04; // 0x04;
if (Controller["P1 Key 7"]) retval = 0x05; if (Controller.IsPressed("P1 Key 7")) retval = 0x05;
if (Controller["P1 Pound"]) retval = 0x06; if (Controller.IsPressed("P1 Pound")) retval = 0x06;
if (Controller["P1 Key 2"]) retval = 0x07; if (Controller.IsPressed("P1 Key 2")) retval = 0x07;
// 0x08; // 0x08;
if (Controller["P1 Star"]) retval = 0x09; if (Controller.IsPressed("P1 Star")) retval = 0x09;
if (Controller["P1 Key 0"]) retval = 0x0A; if (Controller.IsPressed("P1 Key 0")) retval = 0x0A;
if (Controller["P1 Key 9"]) retval = 0x0B; if (Controller.IsPressed("P1 Key 9")) retval = 0x0B;
if (Controller["P1 Key 3"]) retval = 0x0C; if (Controller.IsPressed("P1 Key 3")) retval = 0x0C;
if (Controller["P1 Key 1"]) retval = 0x0D; if (Controller.IsPressed("P1 Key 1")) retval = 0x0D;
if (Controller["P1 Key 6"]) retval = 0x0E; if (Controller.IsPressed("P1 Key 6")) retval = 0x0E;
if (Controller["P1 R"] == false) retval |= 0x40; if (Controller.IsPressed("P1 R") == false) retval |= 0x40;
retval |= 0x30; // always set these bits retval |= 0x30; // always set these bits
return retval; return retval;
} }
@ -78,11 +78,11 @@ namespace BizHawk.Emulation.Cores.ColecoVision
if (InputPortSelection == InputPortMode.Left) if (InputPortSelection == InputPortMode.Left)
{ {
byte retval = 0x7F; byte retval = 0x7F;
if (Controller["P2 Up"]) retval &= 0xFE; if (Controller.IsPressed("P2 Up")) retval &= 0xFE;
if (Controller["P2 Right"]) retval &= 0xFD; if (Controller.IsPressed("P2 Right")) retval &= 0xFD;
if (Controller["P2 Down"]) retval &= 0xFB; if (Controller.IsPressed("P2 Down")) retval &= 0xFB;
if (Controller["P2 Left"]) retval &= 0xF7; if (Controller.IsPressed("P2 Left")) retval &= 0xF7;
if (Controller["P2 L"]) retval &= 0x3F; if (Controller.IsPressed("P2 L")) retval &= 0x3F;
return retval; return retval;
} }
@ -91,22 +91,22 @@ namespace BizHawk.Emulation.Cores.ColecoVision
byte retval = 0; byte retval = 0;
// 0x00; // 0x00;
if (Controller["P2 Key8"]) retval = 0x01; if (Controller.IsPressed("P2 Key8")) retval = 0x01;
if (Controller["P2 Key4"]) retval = 0x02; if (Controller.IsPressed("P2 Key4")) retval = 0x02;
if (Controller["P2 Key5"]) retval = 0x03; if (Controller.IsPressed("P2 Key5")) retval = 0x03;
// 0x04; // 0x04;
if (Controller["P2 Key7"]) retval = 0x05; if (Controller.IsPressed("P2 Key7")) retval = 0x05;
if (Controller["P2 Pound"]) retval = 0x06; if (Controller.IsPressed("P2 Pound")) retval = 0x06;
if (Controller["P2 Key2"]) retval = 0x07; if (Controller.IsPressed("P2 Key2")) retval = 0x07;
// 0x08; // 0x08;
if (Controller["P2 Star"]) retval = 0x09; if (Controller.IsPressed("P2 Star")) retval = 0x09;
if (Controller["P2 Key0"]) retval = 0x0A; if (Controller.IsPressed("P2 Key0")) retval = 0x0A;
if (Controller["P2 Key9"]) retval = 0x0B; if (Controller.IsPressed("P2 Key9")) retval = 0x0B;
if (Controller["P2 Key3"]) retval = 0x0C; if (Controller.IsPressed("P2 Key3")) retval = 0x0C;
if (Controller["P2 Key1"]) retval = 0x0D; if (Controller.IsPressed("P2 Key1")) retval = 0x0D;
if (Controller["P2 Key6"]) retval = 0x0E; if (Controller.IsPressed("P2 Key6")) retval = 0x0E;
if (Controller["P2 R"] == false) retval |= 0x40; if (Controller.IsPressed("P2 R") == false) retval |= 0x40;
retval |= 0x30; // always set these bits retval |= 0x30; // always set these bits
return retval; return retval;
} }

View File

@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public void FrameAdvance(bool render, bool rendersound = true) public void FrameAdvance(bool render, bool rendersound = true)
{ {
Frame++; Frame++;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
{ {
LibmGBA.BizReset(_core); LibmGBA.BizReset(_core);
//BizReset caused memorydomain pointers to change. //BizReset caused memorydomain pointers to change.

View File

@ -90,7 +90,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
Frame++; Frame++;
IsLagFrame = true; IsLagFrame = true;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
LibMeteor.libmeteor_hardreset(); LibMeteor.libmeteor_hardreset();
// due to the design of the tracing api, we have to poll whether it's active each frame // due to the design of the tracing api, we have to poll whether it's active each frame
LibMeteor.libmeteor_settracecallback(Tracer.Enabled ? tracecallback : null); LibMeteor.libmeteor_settracecallback(Tracer.Enabled ? tracecallback : null);
@ -143,16 +143,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
// libmeteor bitflips everything itself, so 0 == off, 1 == on // libmeteor bitflips everything itself, so 0 == off, 1 == on
IsLagFrame = false; IsLagFrame = false;
LibMeteor.Buttons ret = 0; LibMeteor.Buttons ret = 0;
if (Controller["Up"]) ret |= LibMeteor.Buttons.BTN_UP; if (Controller.IsPressed("Up")) ret |= LibMeteor.Buttons.BTN_UP;
if (Controller["Down"]) ret |= LibMeteor.Buttons.BTN_DOWN; if (Controller.IsPressed("Down")) ret |= LibMeteor.Buttons.BTN_DOWN;
if (Controller["Left"]) ret |= LibMeteor.Buttons.BTN_LEFT; if (Controller.IsPressed("Left")) ret |= LibMeteor.Buttons.BTN_LEFT;
if (Controller["Right"]) ret |= LibMeteor.Buttons.BTN_RIGHT; if (Controller.IsPressed("Right")) ret |= LibMeteor.Buttons.BTN_RIGHT;
if (Controller["Select"]) ret |= LibMeteor.Buttons.BTN_SELECT; if (Controller.IsPressed("Select")) ret |= LibMeteor.Buttons.BTN_SELECT;
if (Controller["Start"]) ret |= LibMeteor.Buttons.BTN_START; if (Controller.IsPressed("Start")) ret |= LibMeteor.Buttons.BTN_START;
if (Controller["B"]) ret |= LibMeteor.Buttons.BTN_B; if (Controller.IsPressed("B")) ret |= LibMeteor.Buttons.BTN_B;
if (Controller["A"]) ret |= LibMeteor.Buttons.BTN_A; if (Controller.IsPressed("A")) ret |= LibMeteor.Buttons.BTN_A;
if (Controller["L"]) ret |= LibMeteor.Buttons.BTN_L; if (Controller.IsPressed("L")) ret |= LibMeteor.Buttons.BTN_L;
if (Controller["R"]) ret |= LibMeteor.Buttons.BTN_R; if (Controller.IsPressed("R")) ret |= LibMeteor.Buttons.BTN_R;
return ret; return ret;
} }

View File

@ -100,7 +100,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{ {
Frame++; Frame++;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
LibVBANext.Reset(Core); LibVBANext.Reset(Core);
SyncTraceCallback(); SyncTraceCallback();
@ -212,8 +212,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
LibVBANext.Buttons ret = 0; LibVBANext.Buttons ret = 0;
foreach (string s in Enum.GetNames(typeof(LibVBANext.Buttons))) foreach (string s in Enum.GetNames(typeof(LibVBANext.Buttons)))
{ {
if (c[s]) if (c.IsPressed(s))
{
ret |= (LibVBANext.Buttons)Enum.Parse(typeof(LibVBANext.Buttons), s); ret |= (LibVBANext.Buttons)Enum.Parse(typeof(LibVBANext.Buttons), s);
}
} }
return ret; return ret;
} }

View File

@ -267,27 +267,27 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
// update our local copy of the controller data // update our local copy of the controller data
CurrentButtons = 0; CurrentButtons = 0;
if (Controller["Up"]) if (Controller.IsPressed("Up"))
CurrentButtons |= LibGambatte.Buttons.UP; CurrentButtons |= LibGambatte.Buttons.UP;
if (Controller["Down"]) if (Controller.IsPressed("Down"))
CurrentButtons |= LibGambatte.Buttons.DOWN; CurrentButtons |= LibGambatte.Buttons.DOWN;
if (Controller["Left"]) if (Controller.IsPressed("Left"))
CurrentButtons |= LibGambatte.Buttons.LEFT; CurrentButtons |= LibGambatte.Buttons.LEFT;
if (Controller["Right"]) if (Controller.IsPressed("Right"))
CurrentButtons |= LibGambatte.Buttons.RIGHT; CurrentButtons |= LibGambatte.Buttons.RIGHT;
if (Controller["A"]) if (Controller.IsPressed("A"))
CurrentButtons |= LibGambatte.Buttons.A; CurrentButtons |= LibGambatte.Buttons.A;
if (Controller["B"]) if (Controller.IsPressed("B"))
CurrentButtons |= LibGambatte.Buttons.B; CurrentButtons |= LibGambatte.Buttons.B;
if (Controller["Select"]) if (Controller.IsPressed("Select"))
CurrentButtons |= LibGambatte.Buttons.SELECT; CurrentButtons |= LibGambatte.Buttons.SELECT;
if (Controller["Start"]) if (Controller.IsPressed("Start"))
CurrentButtons |= LibGambatte.Buttons.START; CurrentButtons |= LibGambatte.Buttons.START;
// the controller callback will set this to false if it actually gets called during the frame // the controller callback will set this to false if it actually gets called during the frame
IsLagFrame = true; IsLagFrame = true;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
LibGambatte.gambatte_reset(GambatteState, GetCurrentTime()); LibGambatte.gambatte_reset(GambatteState, GetCurrentTime());
if (Tracer.Enabled) if (Tracer.Enabled)

View File

@ -104,7 +104,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
foreach (var s in DualGbController.BoolButtons) foreach (var s in DualGbController.BoolButtons)
{ {
if (Controller[s]) if (Controller.IsPressed(s))
{ {
if (s.Contains("P1 ")) if (s.Contains("P1 "))
LCont.Set(s.Replace("P1 ", "")); LCont.Set(s.Replace("P1 ", ""));
@ -112,7 +112,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
RCont.Set(s.Replace("P2 ", "")); RCont.Set(s.Replace("P2 ", ""));
} }
} }
bool cablediscosignal_new = Controller["Toggle Cable"]; bool cablediscosignal_new = Controller.IsPressed("Toggle Cable");
if (cablediscosignal_new && !cablediscosignal) if (cablediscosignal_new && !cablediscosignal)
{ {
cableconnected ^= true; cableconnected ^= true;

View File

@ -240,12 +240,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
_audioProvider.RenderSound = rendersound; _audioProvider.RenderSound = rendersound;
if (Controller["Reset"]) if (Controller.IsPressed("Reset"))
{ {
api.soft_reset(); api.soft_reset();
} }
if (Controller["Power"]) if (Controller.IsPressed("Power"))
{ {
api.hard_reset(); api.hard_reset();
} }

View File

@ -134,20 +134,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
{ {
int buttons = 0; int buttons = 0;
if (Controller["P" + num + " DPad R"]) buttons |= (1 << 0); if (Controller.IsPressed("P" + num + " DPad R")) buttons |= (1 << 0);
if (Controller["P" + num + " DPad L"]) buttons |= (1 << 1); if (Controller.IsPressed("P" + num + " DPad L")) buttons |= (1 << 1);
if (Controller["P" + num + " DPad D"]) buttons |= (1 << 2); if (Controller.IsPressed("P" + num + " DPad D")) buttons |= (1 << 2);
if (Controller["P" + num + " DPad U"]) buttons |= (1 << 3); if (Controller.IsPressed("P" + num + " DPad U")) buttons |= (1 << 3);
if (Controller["P" + num + " Start"]) buttons |= (1 << 4); if (Controller.IsPressed("P" + num + " Start")) buttons |= (1 << 4);
if (Controller["P" + num + " Z"]) buttons |= (1 << 5); if (Controller.IsPressed("P" + num + " Z")) buttons |= (1 << 5);
if (Controller["P" + num + " B"]) buttons |= (1 << 6); if (Controller.IsPressed("P" + num + " B")) buttons |= (1 << 6);
if (Controller["P" + num + " A"]) buttons |= (1 << 7); if (Controller.IsPressed("P" + num + " A")) buttons |= (1 << 7);
if (Controller["P" + num + " C Right"]) buttons |= (1 << 8); if (Controller.IsPressed("P" + num + " C Right")) buttons |= (1 << 8);
if (Controller["P" + num + " C Left"]) buttons |= (1 << 9); if (Controller.IsPressed("P" + num + " C Left")) buttons |= (1 << 9);
if (Controller["P" + num + " C Down"]) buttons |= (1 << 10); if (Controller.IsPressed("P" + num + " C Down")) buttons |= (1 << 10);
if (Controller["P" + num + " C Up"]) buttons |= (1 << 11); if (Controller.IsPressed("P" + num + " C Up")) buttons |= (1 << 11);
if (Controller["P" + num + " R"]) buttons |= (1 << 12); if (Controller.IsPressed("P" + num + " R")) buttons |= (1 << 12);
if (Controller["P" + num + " L"]) buttons |= (1 << 13); if (Controller.IsPressed("P" + num + " L")) buttons |= (1 << 13);
return buttons; return buttons;
} }

View File

@ -317,32 +317,32 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//if (resetSignal) //if (resetSignal)
//Controller.UnpressButton("Reset"); TODO fix this //Controller.UnpressButton("Reset"); TODO fix this
resetSignal = Controller["Reset"]; resetSignal = Controller.IsPressed("Reset");
hardResetSignal = Controller["Power"]; hardResetSignal = Controller.IsPressed("Power");
if (Board is FDS) if (Board is FDS)
{ {
var b = Board as FDS; var b = Board as FDS;
if (Controller["FDS Eject"]) if (Controller.IsPressed("FDS Eject"))
b.Eject(); b.Eject();
for (int i = 0; i < b.NumSides; i++) for (int i = 0; i < b.NumSides; i++)
if (Controller["FDS Insert " + i]) if (Controller.IsPressed("FDS Insert " + i))
b.InsertSide(i); b.InsertSide(i);
} }
if (_isVS) if (_isVS)
{ {
if (controller["Service Switch"]) if (controller.IsPressed("Service Switch"))
VS_service = 1; VS_service = 1;
else else
VS_service = 0; VS_service = 0;
if (controller["Insert Coin P1"]) if (controller.IsPressed("Insert Coin P1"))
VS_coin_inserted |= 1; VS_coin_inserted |= 1;
else else
VS_coin_inserted &= 2; VS_coin_inserted &= 2;
if (controller["Insert Coin P2"]) if (controller.IsPressed("Insert Coin P2"))
VS_coin_inserted |= 2; VS_coin_inserted |= 2;
else else
VS_coin_inserted &= 1; VS_coin_inserted &= 1;

View File

@ -413,7 +413,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public byte Read(IController c) public byte Read(IController c)
{ {
byte ret = c["0Fire"] ? (byte)0x08 : (byte)0x00; byte ret = c.IsPressed("0Fire") ? (byte)0x08 : (byte)0x00;
if (resetting) if (resetting)
return ret; return ret;
@ -572,7 +572,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public byte Read(IController c) public byte Read(IController c)
{ {
byte ret = 0; byte ret = 0;
if (c["0Fire"]) if (c.IsPressed("0Fire"))
ret |= 0x10; ret |= 0x10;
if (!PPUCallback((int)c.GetFloat("0Zapper X"), (int)c.GetFloat("0Zapper Y"))) if (!PPUCallback((int)c.GetFloat("0Zapper X"), (int)c.GetFloat("0Zapper Y")))
ret |= 0x08; ret |= 0x08;
@ -620,7 +620,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
void Latch(IController c) void Latch(IController c)
{ {
byte ret = 0; byte ret = 0;
if (c["0Fire"]) if (c.IsPressed("0Fire"))
ret |= 0x80; ret |= 0x80;
if (PPUCallback((int)c.GetFloat("0Zapper X"), (int)c.GetFloat("0Zapper Y"))) if (PPUCallback((int)c.GetFloat("0Zapper X"), (int)c.GetFloat("0Zapper Y")))
ret |= 0x40; ret |= 0x40;
@ -712,7 +712,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
byte ret = 0; byte ret = 0;
ret |= (byte)(Player1.Read(Player1U.UnMerge(c)) & 1); ret |= (byte)(Player1.Read(Player1U.UnMerge(c)) & 1);
ret |= (byte)(Player3.ReadA(Player3U.UnMerge(c)) & 2); ret |= (byte)(Player3.ReadA(Player3U.UnMerge(c)) & 2);
if (c["P2 Microphone"]) if (c.IsPressed("P2 Microphone"))
ret |= 4; ret |= 4;
return ret; return ret;
} }
@ -774,7 +774,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public byte ReadA(IController c) public byte ReadA(IController c)
{ {
return c["0Fire"] ? (byte)0x02 : (byte)0x00; return c.IsPressed("0Fire") ? (byte)0x02 : (byte)0x00;
} }
public byte ReadB(IController c) public byte ReadB(IController c)
@ -927,10 +927,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
byte ret = 0; byte ret = 0;
if (c[Buttons[idx]]) ret |= 16; if (c.IsPressed(Buttons[idx])) ret |= 16;
if (c[Buttons[idx + 1]]) ret |= 8; if (c.IsPressed(Buttons[idx + 1])) ret |= 8;
if (c[Buttons[idx + 2]]) ret |= 4; if (c.IsPressed(Buttons[idx + 2])) ret |= 4;
if (c[Buttons[idx + 3]]) ret |= 2; if (c.IsPressed(Buttons[idx + 3])) ret |= 2;
// nothing is clocked here // nothing is clocked here
return ret; return ret;
@ -1040,9 +1040,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
x &= 255; x &= 255;
y &= 255; y &= 255;
latchedvalue = x << 10 | y << 2; latchedvalue = x << 10 | y << 2;
if (c["0Touch"]) if (c.IsPressed("0Touch"))
latchedvalue |= 2; latchedvalue |= 2;
if (c["0Click"]) if (c.IsPressed("0Click"))
latchedvalue |= 1; latchedvalue |= 1;
} }
if (s.OUT0 > s.OUT0old) // L->H: reset shift if (s.OUT0 > s.OUT0old) // L->H: reset shift
@ -1118,7 +1118,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
if (values.Length > i) if (values.Length > i)
{ {
if (values[i] != null && c[values[i]]) if (values[i] != null && c.IsPressed(values[i]))
ret |= 1 << i; ret |= 1 << i;
} }
else else

View File

@ -165,7 +165,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
int ret = 0; int ret = 0;
foreach (var b in buttons) foreach (var b in buttons)
{ {
if (Controller[b.Name]) if (Controller.IsPressed(b.Name))
ret |= b.Mask; ret |= b.Mask;
} }
return ret; return ret;
@ -190,9 +190,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
CheckDisposed(); CheckDisposed();
using (FP.Save()) using (FP.Save())
{ {
if (Controller["Power"]) if (Controller.IsPressed("Power"))
QN.qn_reset(Context, true); QN.qn_reset(Context, true);
if (Controller["Reset"]) if (Controller.IsPressed("Reset"))
QN.qn_reset(Context, false); QN.qn_reset(Context, false);
int j1, j2; int j1, j2;

View File

@ -532,7 +532,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
default: return 0; default: return 0;
} }
return (ushort)(Controller[key] ? 1 : 0); return (ushort)(Controller.IsPressed(key) ? 1 : 0);
} }
return 0; return 0;
@ -672,10 +672,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
else else
api.QUERY_set_audio_sample(soundcb); api.QUERY_set_audio_sample(soundcb);
bool resetSignal = Controller["Reset"]; bool resetSignal = Controller.IsPressed("Reset");
if (resetSignal) api.CMD_reset(); if (resetSignal) api.CMD_reset();
bool powerSignal = Controller["Power"]; bool powerSignal = Controller.IsPressed("Power");
if (powerSignal) api.CMD_power(); if (powerSignal) api.CMD_power();
//too many messages //too many messages

View File

@ -70,18 +70,18 @@ namespace BizHawk.Emulation.Cores.PCEngine
_lagged = false; _lagged = false;
if (SEL == false) // return buttons if (SEL == false) // return buttons
{ {
if (Controller["P" + player + " B1"]) value &= 0xFE; if (Controller.IsPressed("P" + player + " B1")) value &= 0xFE;
if (Controller["P" + player + " B2"]) value &= 0xFD; if (Controller.IsPressed("P" + player + " B2")) value &= 0xFD;
if (Controller["P" + player + " Select"]) value &= 0xFB; if (Controller.IsPressed("P" + player + " Select")) value &= 0xFB;
if (Controller["P" + player + " Run"]) value &= 0xF7; if (Controller.IsPressed("P" + player + " Run")) value &= 0xF7;
} }
else else
{ {
//return directions //return directions
if (Controller["P" + player + " Up"]) value &= 0xFE; if (Controller.IsPressed("P" + player + " Up")) value &= 0xFE;
if (Controller["P" + player + " Right"]) value &= 0xFD; if (Controller.IsPressed("P" + player + " Right")) value &= 0xFD;
if (Controller["P" + player + " Down"]) value &= 0xFB; if (Controller.IsPressed("P" + player + " Down")) value &= 0xFB;
if (Controller["P" + player + " Left"]) value &= 0xF7; if (Controller.IsPressed("P" + player + " Left")) value &= 0xF7;
} }
} }

View File

@ -112,19 +112,19 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
data &= 0xC0; data &= 0xC0;
if ((data & 0x40) != 0) // TH high if ((data & 0x40) != 0) // TH high
{ {
if (Controller["P1 Up"] == false) data |= 0x01; if (Controller.IsPressed("P1 Up") == false) data |= 0x01;
if (Controller["P1 Down"] == false) data |= 0x02; if (Controller.IsPressed("P1 Down") == false) data |= 0x02;
if (Controller["P1 Left"] == false) data |= 0x04; if (Controller.IsPressed("P1 Left") == false) data |= 0x04;
if (Controller["P1 Right"] == false) data |= 0x08; if (Controller.IsPressed("P1 Right") == false) data |= 0x08;
if (Controller["P1 B"] == false) data |= 0x10; if (Controller.IsPressed("P1 B") == false) data |= 0x10;
if (Controller["P1 C"] == false) data |= 0x20; if (Controller.IsPressed("P1 C") == false) data |= 0x20;
} }
else else
{ // TH low { // TH low
if (Controller["P1 Up"] == false) data |= 0x01; if (Controller.IsPressed("P1 Up") == false) data |= 0x01;
if (Controller["P1 Down"] == false) data |= 0x02; if (Controller.IsPressed("P1 Down") == false) data |= 0x02;
if (Controller["P1 A"] == false) data |= 0x10; if (Controller.IsPressed("P1 A") == false) data |= 0x10;
if (Controller["P1 Start"] == false) data |= 0x20; if (Controller.IsPressed("P1 Start") == false) data |= 0x20;
} }
} }

View File

@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (IsGameGear == false) if (IsGameGear == false)
{ {
Cpu.NonMaskableInterrupt = Controller["Pause"]; Cpu.NonMaskableInterrupt = Controller.IsPressed("Pause");
} }
if (IsGame3D && Settings.Fix3D) if (IsGame3D && Settings.Fix3D)

View File

@ -31,15 +31,15 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
_lagged = false; _lagged = false;
byte value = 0xFF; byte value = 0xFF;
if (Controller["P1 Up"]) value &= 0xFE; if (Controller.IsPressed("P1 Up")) value &= 0xFE;
if (Controller["P1 Down"]) value &= 0xFD; if (Controller.IsPressed("P1 Down")) value &= 0xFD;
if (Controller["P1 Left"]) value &= 0xFB; if (Controller.IsPressed("P1 Left")) value &= 0xFB;
if (Controller["P1 Right"]) value &= 0xF7; if (Controller.IsPressed("P1 Right")) value &= 0xF7;
if (Controller["P1 B1"]) value &= 0xEF; if (Controller.IsPressed("P1 B1")) value &= 0xEF;
if (Controller["P1 B2"]) value &= 0xDF; if (Controller.IsPressed("P1 B2")) value &= 0xDF;
if (Controller["P2 Up"]) value &= 0xBF; if (Controller.IsPressed("P2 Up")) value &= 0xBF;
if (Controller["P2 Down"]) value &= 0x7F; if (Controller.IsPressed("P2 Down")) value &= 0x7F;
return value; return value;
} }
@ -50,12 +50,12 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
_lagged = false; _lagged = false;
byte value = 0xFF; byte value = 0xFF;
if (Controller["P2 Left"]) value &= 0xFE; if (Controller.IsPressed("P2 Left")) value &= 0xFE;
if (Controller["P2 Right"]) value &= 0xFD; if (Controller.IsPressed("P2 Right")) value &= 0xFD;
if (Controller["P2 B1"]) value &= 0xFB; if (Controller.IsPressed("P2 B1")) value &= 0xFB;
if (Controller["P2 B2"]) value &= 0xF7; if (Controller.IsPressed("P2 B2")) value &= 0xF7;
if (Controller["Reset"]) value &= 0xEF; if (Controller.IsPressed("Reset")) value &= 0xEF;
if ((Port3F & 0x0F) == 5) if ((Port3F & 0x0F) == 5)
{ {
@ -83,8 +83,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
} }
byte value = 0xFF; byte value = 0xFF;
if ((Controller["Pause"] && !IsGameGear) || if ((Controller.IsPressed("Pause") && !IsGameGear) ||
(Controller["P1 Start"] && IsGameGear)) (Controller.IsPressed("P1 Start") && IsGameGear))
{ {
value ^= 0x80; value ^= 0x80;
} }

View File

@ -22,10 +22,10 @@
} }
if (address == 0xA000) if (address == 0xA000)
{ {
if (Controller["P1 Left"]) xCoord++; if (Controller.IsPressed("P1 Left")) xCoord++;
if (Controller["P1 Right"]) xCoord++; if (Controller.IsPressed("P1 Right")) xCoord++;
if (Controller["P1 Up"]) yCoord--; if (Controller.IsPressed("P1 Up")) yCoord--;
if (Controller["P1 Down"]) yCoord++; if (Controller.IsPressed("P1 Down")) yCoord++;
return 0; return 0;
//if (!Controller["P1 B1"]) return 0; //if (!Controller["P1 B1"]) return 0;

View File

@ -214,64 +214,64 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
LibYabause.Buttons1 p21 = (LibYabause.Buttons1)0xff; LibYabause.Buttons1 p21 = (LibYabause.Buttons1)0xff;
LibYabause.Buttons2 p22 = (LibYabause.Buttons2)0xff; LibYabause.Buttons2 p22 = (LibYabause.Buttons2)0xff;
if (Controller["P1 A"]) if (Controller.IsPressed("P1 A"))
p11 &= ~LibYabause.Buttons1.A; p11 &= ~LibYabause.Buttons1.A;
if (Controller["P1 B"]) if (Controller.IsPressed("P1 B"))
p11 &= ~LibYabause.Buttons1.B; p11 &= ~LibYabause.Buttons1.B;
if (Controller["P1 C"]) if (Controller.IsPressed("P1 C"))
p11 &= ~LibYabause.Buttons1.C; p11 &= ~LibYabause.Buttons1.C;
if (Controller["P1 Start"]) if (Controller.IsPressed("P1 Start"))
p11 &= ~LibYabause.Buttons1.S; p11 &= ~LibYabause.Buttons1.S;
if (Controller["P1 Left"]) if (Controller.IsPressed("P1 Left"))
p11 &= ~LibYabause.Buttons1.L; p11 &= ~LibYabause.Buttons1.L;
if (Controller["P1 Right"]) if (Controller.IsPressed("P1 Right"))
p11 &= ~LibYabause.Buttons1.R; p11 &= ~LibYabause.Buttons1.R;
if (Controller["P1 Up"]) if (Controller.IsPressed("P1 Up"))
p11 &= ~LibYabause.Buttons1.U; p11 &= ~LibYabause.Buttons1.U;
if (Controller["P1 Down"]) if (Controller.IsPressed("P1 Down"))
p11 &= ~LibYabause.Buttons1.D; p11 &= ~LibYabause.Buttons1.D;
if (Controller["P1 L"]) if (Controller.IsPressed("P1 L"))
p12 &= ~LibYabause.Buttons2.L; p12 &= ~LibYabause.Buttons2.L;
if (Controller["P1 R"]) if (Controller.IsPressed("P1 R"))
p12 &= ~LibYabause.Buttons2.R; p12 &= ~LibYabause.Buttons2.R;
if (Controller["P1 X"]) if (Controller.IsPressed("P1 X"))
p12 &= ~LibYabause.Buttons2.X; p12 &= ~LibYabause.Buttons2.X;
if (Controller["P1 Y"]) if (Controller.IsPressed("P1 Y"))
p12 &= ~LibYabause.Buttons2.Y; p12 &= ~LibYabause.Buttons2.Y;
if (Controller["P1 Z"]) if (Controller.IsPressed("P1 Z"))
p12 &= ~LibYabause.Buttons2.Z; p12 &= ~LibYabause.Buttons2.Z;
if (Controller["P2 A"]) if (Controller.IsPressed("P2 A"))
p21 &= ~LibYabause.Buttons1.A; p21 &= ~LibYabause.Buttons1.A;
if (Controller["P2 B"]) if (Controller.IsPressed("P2 B"))
p21 &= ~LibYabause.Buttons1.B; p21 &= ~LibYabause.Buttons1.B;
if (Controller["P2 C"]) if (Controller.IsPressed("P2 C"))
p21 &= ~LibYabause.Buttons1.C; p21 &= ~LibYabause.Buttons1.C;
if (Controller["P2 Start"]) if (Controller.IsPressed("P2 Start"))
p21 &= ~LibYabause.Buttons1.S; p21 &= ~LibYabause.Buttons1.S;
if (Controller["P2 Left"]) if (Controller.IsPressed("P2 Left"))
p21 &= ~LibYabause.Buttons1.L; p21 &= ~LibYabause.Buttons1.L;
if (Controller["P2 Right"]) if (Controller.IsPressed("P2 Right"))
p21 &= ~LibYabause.Buttons1.R; p21 &= ~LibYabause.Buttons1.R;
if (Controller["P2 Up"]) if (Controller.IsPressed("P2 Up"))
p21 &= ~LibYabause.Buttons1.U; p21 &= ~LibYabause.Buttons1.U;
if (Controller["P2 Down"]) if (Controller.IsPressed("P2 Down"))
p21 &= ~LibYabause.Buttons1.D; p21 &= ~LibYabause.Buttons1.D;
if (Controller["P2 L"]) if (Controller.IsPressed("P2 L"))
p22 &= ~LibYabause.Buttons2.L; p22 &= ~LibYabause.Buttons2.L;
if (Controller["P2 R"]) if (Controller.IsPressed("P2 R"))
p22 &= ~LibYabause.Buttons2.R; p22 &= ~LibYabause.Buttons2.R;
if (Controller["P2 X"]) if (Controller.IsPressed("P2 X"))
p22 &= ~LibYabause.Buttons2.X; p22 &= ~LibYabause.Buttons2.X;
if (Controller["P2 Y"]) if (Controller.IsPressed("P2 Y"))
p22 &= ~LibYabause.Buttons2.Y; p22 &= ~LibYabause.Buttons2.Y;
if (Controller["P2 Z"]) if (Controller.IsPressed("P2 Z"))
p22 &= ~LibYabause.Buttons2.Z; p22 &= ~LibYabause.Buttons2.Z;
if (Controller["Reset"]) if (Controller.IsPressed("Reset"))
LibYabause.libyabause_softreset(); LibYabause.libyabause_softreset();
if (Controller["Power"]) if (Controller.IsPressed("Power"))
LibYabause.libyabause_hardreset(); LibYabause.libyabause_hardreset();
LibYabause.libyabause_setpads(p11, p12, p21, p22); LibYabause.libyabause_setpads(p11, p12, p21, p22);

View File

@ -14,9 +14,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
// TODO: use render and rendersound // TODO: use render and rendersound
public void FrameAdvance(bool render, bool rendersound = true) public void FrameAdvance(bool render, bool rendersound = true)
{ {
if (Controller["Reset"]) if (Controller.IsPressed("Reset"))
LibGPGX.gpgx_reset(false); LibGPGX.gpgx_reset(false);
if (Controller["Power"]) if (Controller.IsPressed("Power"))
LibGPGX.gpgx_reset(true); LibGPGX.gpgx_reset(true);
// do we really have to get each time? nothing has changed // do we really have to get each time? nothing has changed

View File

@ -14,9 +14,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
// TODO: use render and rendersound // TODO: use render and rendersound
public void FrameAdvance(bool render, bool rendersound = true) public void FrameAdvance(bool render, bool rendersound = true)
{ {
if (Controller["Reset"]) if (Controller.IsPressed("Reset"))
Core.gpgx_reset(false); Core.gpgx_reset(false);
if (Controller["Power"]) if (Controller.IsPressed("Power"))
Core.gpgx_reset(true); Core.gpgx_reset(true);
// this shouldn't be needed, as nothing has changed // this shouldn't be needed, as nothing has changed

View File

@ -112,20 +112,20 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
{ {
PPSSPPDll.Buttons b = 0; PPSSPPDll.Buttons b = 0;
var c = Controller; var c = Controller;
if (c["Up"]) b |= PPSSPPDll.Buttons.UP; if (c.IsPressed("Up")) b |= PPSSPPDll.Buttons.UP;
if (c["Down"]) b |= PPSSPPDll.Buttons.DOWN; if (c.IsPressed("Down")) b |= PPSSPPDll.Buttons.DOWN;
if (c["Left"]) b |= PPSSPPDll.Buttons.LEFT; if (c.IsPressed("Left")) b |= PPSSPPDll.Buttons.LEFT;
if (c["Right"]) b |= PPSSPPDll.Buttons.RIGHT; if (c.IsPressed("Right")) b |= PPSSPPDll.Buttons.RIGHT;
if (c["Select"]) b |= PPSSPPDll.Buttons.SELECT; if (c.IsPressed("Select")) b |= PPSSPPDll.Buttons.SELECT;
if (c["Start"]) b |= PPSSPPDll.Buttons.START; if (c.IsPressed("Start")) b |= PPSSPPDll.Buttons.START;
if (c["L"]) b |= PPSSPPDll.Buttons.LBUMPER; if (c.IsPressed("L")) b |= PPSSPPDll.Buttons.LBUMPER;
if (c["R"]) b |= PPSSPPDll.Buttons.RBUMPER; if (c.IsPressed("R")) b |= PPSSPPDll.Buttons.RBUMPER;
if (c["Square"]) b |= PPSSPPDll.Buttons.A; if (c.IsPressed("Square")) b |= PPSSPPDll.Buttons.A;
if (c["Triangle"]) b |= PPSSPPDll.Buttons.B; if (c.IsPressed("Triangle")) b |= PPSSPPDll.Buttons.B;
if (c["Circle"]) b |= PPSSPPDll.Buttons.X; if (c.IsPressed("Circle")) b |= PPSSPPDll.Buttons.X;
if (c["Cross"]) b |= PPSSPPDll.Buttons.Y; if (c.IsPressed("Cross")) b |= PPSSPPDll.Buttons.Y;
if (c["Menu"]) b |= PPSSPPDll.Buttons.MENU; if (c.IsPressed("Menu")) b |= PPSSPPDll.Buttons.MENU;
if (c["Back"]) b |= PPSSPPDll.Buttons.BACK; if (c.IsPressed("Back")) b |= PPSSPPDll.Buttons.BACK;
input.SetButtons(b); input.SetButtons(b);

View File

@ -435,27 +435,27 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
uint buttons = 0; uint buttons = 0;
string pstring = "P" + fioCfg.PlayerAssignments[slot] + " "; string pstring = "P" + fioCfg.PlayerAssignments[slot] + " ";
if (Controller[pstring + "Select"]) buttons |= 1; if (Controller.IsPressed(pstring + "Select")) buttons |= 1;
if (Controller[pstring + "Start"]) buttons |= 8; if (Controller.IsPressed(pstring + "Start")) buttons |= 8;
if (Controller[pstring + "Up"]) buttons |= 16; if (Controller.IsPressed(pstring + "Up")) buttons |= 16;
if (Controller[pstring + "Right"]) buttons |= 32; if (Controller.IsPressed(pstring + "Right")) buttons |= 32;
if (Controller[pstring + "Down"]) buttons |= 64; if (Controller.IsPressed(pstring + "Down")) buttons |= 64;
if (Controller[pstring + "Left"]) buttons |= 128; if (Controller.IsPressed(pstring + "Left")) buttons |= 128;
if (Controller[pstring + "L2"]) buttons |= 256; if (Controller.IsPressed(pstring + "L2")) buttons |= 256;
if (Controller[pstring + "R2"]) buttons |= 512; if (Controller.IsPressed(pstring + "R2")) buttons |= 512;
if (Controller[pstring + "L1"]) buttons |= 1024; if (Controller.IsPressed(pstring + "L1")) buttons |= 1024;
if (Controller[pstring + "R1"]) buttons |= 2048; if (Controller.IsPressed(pstring + "R1")) buttons |= 2048;
if (Controller[pstring + "Triangle"]) buttons |= 4096; if (Controller.IsPressed(pstring + "Triangle")) buttons |= 4096;
if (Controller[pstring + "Circle"]) buttons |= 8192; if (Controller.IsPressed(pstring + "Circle")) buttons |= 8192;
if (Controller[pstring + "Cross"]) buttons |= 16384; if (Controller.IsPressed(pstring + "Cross")) buttons |= 16384;
if (Controller[pstring + "Square"]) buttons |= 32768; if (Controller.IsPressed(pstring + "Square")) buttons |= 32768;
byte left_x = 0, left_y = 0, right_x = 0, right_y = 0; byte left_x = 0, left_y = 0, right_x = 0, right_y = 0;
if (fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.DualShock || fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.DualAnalog) if (fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.DualShock || fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.DualAnalog)
{ {
if (Controller[pstring + "L3"]) buttons |= 2; if (Controller.IsPressed(pstring + "L3")) buttons |= 2;
if (Controller[pstring + "R3"]) buttons |= 4; if (Controller.IsPressed(pstring + "R3")) buttons |= 4;
if (Controller[pstring + "MODE"]) buttons |= 65536; if (Controller.IsPressed(pstring + "MODE")) buttons |= 65536;
left_x = (byte)Controller.GetFloat(pstring + "LStick X"); left_x = (byte)Controller.GetFloat(pstring + "LStick X");
left_y = (byte)Controller.GetFloat(pstring + "LStick Y"); left_y = (byte)Controller.GetFloat(pstring + "LStick Y");
@ -612,7 +612,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
//if tray open is requested, and valid, apply it //if tray open is requested, and valid, apply it
//in the first frame, go ahead and open it up so we have a chance to put a disc in it //in the first frame, go ahead and open it up so we have a chance to put a disc in it
if (Controller["Open"] && !CurrentTrayOpen || Frame == 0) if (Controller.IsPressed("Open") && !CurrentTrayOpen || Frame == 0)
{ {
OctoshockDll.shock_OpenTray(psx); OctoshockDll.shock_OpenTray(psx);
CurrentTrayOpen = true; CurrentTrayOpen = true;
@ -648,14 +648,14 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
} }
//if tray close is requested, and valid, apply it. //if tray close is requested, and valid, apply it.
if (Controller["Close"] && CurrentTrayOpen) if (Controller.IsPressed("Close") && CurrentTrayOpen)
{ {
OctoshockDll.shock_CloseTray(psx); OctoshockDll.shock_CloseTray(psx);
CurrentTrayOpen = false; CurrentTrayOpen = false;
} }
//if frame is 0 and user has made no preference, close the tray //if frame is 0 and user has made no preference, close the tray
if (!Controller["Close"] && !Controller["Open"] && Frame == 0 && CurrentTrayOpen) if (!Controller.IsPressed("Close") && !Controller.IsPressed("Open") && Frame == 0 && CurrentTrayOpen)
{ {
OctoshockDll.shock_CloseTray(psx); OctoshockDll.shock_CloseTray(psx);
CurrentTrayOpen = false; CurrentTrayOpen = false;
@ -700,7 +700,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
OctoshockDll.shock_SetTraceCallback(psx, IntPtr.Zero, null); OctoshockDll.shock_SetTraceCallback(psx, IntPtr.Zero, null);
//apply soft reset if needed //apply soft reset if needed
if (Controller["Reset"]) if (Controller.IsPressed("Reset"))
OctoshockDll.shock_SoftReset(psx); OctoshockDll.shock_SoftReset(psx);
//------------------------ //------------------------

View File

@ -47,31 +47,32 @@ namespace BizHawk.Emulation.Cores.WonderSwan
BizSwan.Buttons GetButtons() BizSwan.Buttons GetButtons()
{ {
BizSwan.Buttons ret = 0; BizSwan.Buttons ret = 0;
if (Controller["P1 X1"]) ret |= BizSwan.Buttons.X1; if (Controller.IsPressed("P1 X1")) ret |= BizSwan.Buttons.X1;
if (Controller["P1 X2"]) ret |= BizSwan.Buttons.X2; if (Controller.IsPressed("P1 X2")) ret |= BizSwan.Buttons.X2;
if (Controller["P1 X3"]) ret |= BizSwan.Buttons.X3; if (Controller.IsPressed("P1 X3")) ret |= BizSwan.Buttons.X3;
if (Controller["P1 X4"]) ret |= BizSwan.Buttons.X4; if (Controller.IsPressed("P1 X4")) ret |= BizSwan.Buttons.X4;
if (Controller["P1 Y1"]) ret |= BizSwan.Buttons.Y1; if (Controller.IsPressed("P1 Y1")) ret |= BizSwan.Buttons.Y1;
if (Controller["P1 Y2"]) ret |= BizSwan.Buttons.Y2; if (Controller.IsPressed("P1 Y2")) ret |= BizSwan.Buttons.Y2;
if (Controller["P1 Y3"]) ret |= BizSwan.Buttons.Y3; if (Controller.IsPressed("P1 Y3")) ret |= BizSwan.Buttons.Y3;
if (Controller["P1 Y4"]) ret |= BizSwan.Buttons.Y4; if (Controller.IsPressed("P1 Y4")) ret |= BizSwan.Buttons.Y4;
if (Controller["P1 Start"]) ret |= BizSwan.Buttons.Start; if (Controller.IsPressed("P1 Start")) ret |= BizSwan.Buttons.Start;
if (Controller["P1 B"]) ret |= BizSwan.Buttons.B; if (Controller.IsPressed("P1 B")) ret |= BizSwan.Buttons.B;
if (Controller["P1 A"]) ret |= BizSwan.Buttons.A; if (Controller.IsPressed("P1 A")) ret |= BizSwan.Buttons.A;
if (Controller["P2 X1"]) ret |= BizSwan.Buttons.R_X1; if (Controller.IsPressed("P2 X1")) ret |= BizSwan.Buttons.R_X1;
if (Controller["P2 X2"]) ret |= BizSwan.Buttons.R_X2; if (Controller.IsPressed("P2 X2")) ret |= BizSwan.Buttons.R_X2;
if (Controller["P2 X3"]) ret |= BizSwan.Buttons.R_X3; if (Controller.IsPressed("P2 X3")) ret |= BizSwan.Buttons.R_X3;
if (Controller["P2 X4"]) ret |= BizSwan.Buttons.R_X4; if (Controller.IsPressed("P2 X4")) ret |= BizSwan.Buttons.R_X4;
if (Controller["P2 Y1"]) ret |= BizSwan.Buttons.R_Y1; if (Controller.IsPressed("P2 Y1")) ret |= BizSwan.Buttons.R_Y1;
if (Controller["P2 Y2"]) ret |= BizSwan.Buttons.R_Y2; if (Controller.IsPressed("P2 Y2")) ret |= BizSwan.Buttons.R_Y2;
if (Controller["P2 Y3"]) ret |= BizSwan.Buttons.R_Y3; if (Controller.IsPressed("P2 Y3")) ret |= BizSwan.Buttons.R_Y3;
if (Controller["P2 Y4"]) ret |= BizSwan.Buttons.R_Y4; if (Controller.IsPressed("P2 Y4")) ret |= BizSwan.Buttons.R_Y4;
if (Controller["P2 Start"]) ret |= BizSwan.Buttons.R_Start; if (Controller.IsPressed("P2 Start")) ret |= BizSwan.Buttons.R_Start;
if (Controller["P2 B"]) ret |= BizSwan.Buttons.R_B; if (Controller.IsPressed("P2 B")) ret |= BizSwan.Buttons.R_B;
if (Controller["P2 A"]) ret |= BizSwan.Buttons.R_A; if (Controller.IsPressed("P2 A")) ret |= BizSwan.Buttons.R_A;
if (Controller.IsPressed("Rotate")) ret |= BizSwan.Buttons.Rotate;
if (Controller["Rotate"]) ret |= BizSwan.Buttons.Rotate;
return ret; return ret;
} }

View File

@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
Frame++; Frame++;
IsLagFrame = true; IsLagFrame = true;
if (Controller["Power"]) if (Controller.IsPressed("Power"))
BizSwan.bizswan_reset(Core); BizSwan.bizswan_reset(Core);
bool rotate = false; bool rotate = false;

View File

@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Cores
{ {
case LibRetro.RETRO_DEVICE_ID_POINTER.X: return (short)Controller.GetFloat("Pointer X"); case LibRetro.RETRO_DEVICE_ID_POINTER.X: return (short)Controller.GetFloat("Pointer X");
case LibRetro.RETRO_DEVICE_ID_POINTER.Y: return (short)Controller.GetFloat("Pointer Y"); case LibRetro.RETRO_DEVICE_ID_POINTER.Y: return (short)Controller.GetFloat("Pointer Y");
case LibRetro.RETRO_DEVICE_ID_POINTER.PRESSED: return (short)(Controller["Pointer Pressed"] ? 1 : 0); case LibRetro.RETRO_DEVICE_ID_POINTER.PRESSED: return (short)(Controller.IsPressed("Pointer Pressed") ? 1 : 0);
} }
return 0; return 0;
} }
@ -184,7 +184,7 @@ namespace BizHawk.Emulation.Cores
case LibRetro.RETRO_KEY.UNDO: button = "Undo"; break; case LibRetro.RETRO_KEY.UNDO: button = "Undo"; break;
} }
return (short)(Controller["Key " + button] ? 1 : 0); return (short)(Controller.IsPressed("Key " + button) ? 1 : 0);
} }
case LibRetro.RETRO_DEVICE.JOYPAD: case LibRetro.RETRO_DEVICE.JOYPAD:

View File

@ -258,7 +258,7 @@ namespace BizHawk.Emulation.Cores
private bool GetButton(uint pnum, string type, string button) private bool GetButton(uint pnum, string type, string button)
{ {
string key = string.Format("P{0} {1} {2}", pnum, type, button); string key = string.Format("P{0} {1} {2}", pnum, type, button);
bool b = Controller[key]; bool b = Controller.IsPressed(key);
if (b == true) if (b == true)
{ {
return true; //debugging placeholder return true; //debugging placeholder