From 71aeb846f26424e369144968372b17ade77c23ea Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 21 Feb 2021 21:56:53 +0100 Subject: [PATCH] did some code cleanup --- src/common/PJoystickHandler.cxx | 68 --------------------------------- src/emucore/Joystick.cxx | 32 ---------------- src/emucore/Joystick.hxx | 7 ---- 3 files changed, 107 deletions(-) diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index 77ac5b6a5..7d2cda5f1 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -750,74 +750,6 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value) default: // PhysicalJoystick::Type::REGULAR handleRegularAxisEvent(j, stick, axis, value); - #if 0 - // if(myHandler.state() == EventHandlerState::EMULATION) - // { - // Event::Type eventAxisAnalog; - - // // Check for analog events, which are handled differently - // // A value change lower than ~90% indicates analog input - // if((abs(j->axisLastValue[axis] - value) < 30000) - // && (eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG)) != Event::Type::NoType) - // { - // myHandler.handleEvent(eventAxisAnalog, value); - // } - // else - // { - // // Otherwise, we assume the event is digital - // // Every axis event has two associated values, negative and positive - // Event::Type eventAxisNeg = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::NEG); - // Event::Type eventAxisPos = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::POS); - - // if(value > Joystick::deadzone()) - // myHandler.handleEvent(eventAxisPos); - // else if(value < -Joystick::deadzone()) - // myHandler.handleEvent(eventAxisNeg); - // else - // { - // // Treat any deadzone value as zero - // value = 0; - - // // Now filter out consecutive, similar values - // // (only pass on the event if the state has changed) - // if(j->axisLastValue[axis] != value) - // { - // // Turn off both events, since we don't know exactly which one - // // was previously activated. - // myHandler.handleEvent(eventAxisNeg, false); - // myHandler.handleEvent(eventAxisPos, false); - // } - // } - // } - // j->axisLastValue[axis] = value; - // } - // #ifdef GUI_SUPPORT - // else if(myHandler.hasOverlay()) - // { - // // A value change lower than Joystick::deadzone indicates analog input which is ignored - // if((abs(j->axisLastValue[axis] - value) > Joystick::deadzone())) - // { - // // First, clamp the values to simulate digital input - // // (the only thing that the underlying code understands) - // if(value > Joystick::deadzone()) - // value = 32000; - // else if(value < -Joystick::deadzone()) - // value = -32000; - // else - // value = 0; - - // // Now filter out consecutive, similar values - // // (only pass on the event if the state has changed) - // if(value != j->axisLastValue[axis]) - // { - // myHandler.overlay().handleJoyAxisEvent(stick, JoyAxis(axis), convertAxisValue(value), button); - - // } - // } - // j->axisLastValue[axis] = value; - // } - // #endif - #endif } } } diff --git a/src/emucore/Joystick.cxx b/src/emucore/Joystick.cxx index 1c18045b9..047953dd8 100644 --- a/src/emucore/Joystick.cxx +++ b/src/emucore/Joystick.cxx @@ -46,8 +46,6 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system, myRightEvent = Event::JoystickTwoRight; myFireEvent = Event::JoystickTwoFire; } - //myXAxisValue = Event::SALeftAxis0Value; - //myYAxisValue = Event::SALeftAxis1Value; } else { @@ -67,8 +65,6 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system, myRightEvent = Event::JoystickThreeRight; myFireEvent = Event::JoystickThreeFire; } - //myXAxisValue = Event::SARightAxis0Value; - //myYAxisValue = Event::SARightAxis1Value; } } @@ -78,7 +74,6 @@ void Joystick::update() updateButtons(); updateDigitalAxes(); - //updateStelladaptorAxes(); updateMouseAxes(); } @@ -113,33 +108,6 @@ void Joystick::updateDigitalAxes() setPin(DigitalPin::Four, myEvent.get(myRightEvent) == 0); } -//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//void Joystick::updateStelladaptorAxes() -//{ -// #define SA_Threshold 4096 -// // Axis events (usually generated by the Stelladaptor) -// int xaxis = myEvent.get(myXAxisValue); -// int yaxis = myEvent.get(myYAxisValue); -// if(xaxis > 16384 - SA_Threshold) -// { -// setPin(DigitalPin::Four, false); -// // Stelladaptor sends "half moved right" for L+R pushed together -// if(xaxis < 16384 + SA_Threshold) -// setPin(DigitalPin::Three, false); -// } -// else if(xaxis < -16384) -// setPin(DigitalPin::Three, false); -// if(yaxis > 16384 - SA_Threshold) -// { -// setPin(DigitalPin::Two, false); -// // Stelladaptor sends "half moved down" for U+D pushed together -// if(yaxis < 16384 + SA_Threshold) -// setPin(DigitalPin::One, false); -// } -// else if(yaxis < -16384) -// setPin(DigitalPin::One, false); -//} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Joystick::updateMouseAxes() { diff --git a/src/emucore/Joystick.hxx b/src/emucore/Joystick.hxx index 05157ef32..fa43960d3 100644 --- a/src/emucore/Joystick.hxx +++ b/src/emucore/Joystick.hxx @@ -119,7 +119,6 @@ class Joystick : public Controller // Pre-compute the events we care about based on given port // This will eliminate test for left or right port in update() Event::Type myUpEvent, myDownEvent, myLeftEvent, myRightEvent; - //myXAxisValue, myYAxisValue; // Controller to emulate in normal mouse axis mode int myControlID{-1}; @@ -133,12 +132,6 @@ class Joystick : public Controller */ void updateDigitalAxes(); - ///** - // Update the axes pin states according to the Stelladaptor axes value - // events currently set. - //*/ - //void updateStelladaptorAxes(); - /** Update the axes pin states according to mouse events currently set. */