From 1ee718332a18dd3f2f6b50ddbfbc236cdab2fb7b Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 3 Mar 2020 11:27:15 +0100 Subject: [PATCH] allow remapping of fire button for trackball and light gun games --- src/emucore/Lightgun.cxx | 10 +++++++--- src/emucore/PointingDevice.cxx | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/emucore/Lightgun.cxx b/src/emucore/Lightgun.cxx index 65f44cce6..1c6c82ba7 100644 --- a/src/emucore/Lightgun.cxx +++ b/src/emucore/Lightgun.cxx @@ -115,7 +115,11 @@ bool Lightgun::read(DigitalPin pin) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Lightgun::update() { - // we allow left and right mouse buttons for fire button - setPin(DigitalPin::One, myEvent.get(Event::MouseButtonLeftValue) - || myEvent.get(Event::MouseButtonRightValue)); + // Digital events (from keyboard or joystick hats & buttons) + setPin(DigitalPin::One, myEvent.get(Event::JoystickZeroFire) == 0); + + // We allow left and right mouse buttons for fire button + if(myEvent.get(Event::MouseButtonLeftValue) || + myEvent.get(Event::MouseButtonRightValue)) + setPin(DigitalPin::One, false); } diff --git a/src/emucore/PointingDevice.cxx b/src/emucore/PointingDevice.cxx index 0ee561c31..1a2c781b4 100644 --- a/src/emucore/PointingDevice.cxx +++ b/src/emucore/PointingDevice.cxx @@ -86,9 +86,13 @@ void PointingDevice::update() updateDirection(-myEvent.get(Event::MouseAxisYMove), myVCounterRemainder, myTrackBallDown, myTrackBallLinesV, myScanCountV, myFirstScanOffsetV); - // Get mouse button state - setPin(DigitalPin::Six, (myEvent.get(Event::MouseButtonLeftValue) == 0) && - (myEvent.get(Event::MouseButtonRightValue) == 0)); + // Digital events (from keyboard or joystick hats & buttons) + setPin(DigitalPin::Six, myEvent.get(Event::JoystickZeroFire) == 0); + + // We allow left and right mouse buttons for fire button + if(myEvent.get(Event::MouseButtonLeftValue) || + myEvent.get(Event::MouseButtonRightValue)) + setPin(DigitalPin::Six, false); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -