mirror of https://github.com/stella-emu/stella.git
did some code cleanup
This commit is contained in:
parent
756b6ff207
commit
71aeb846f2
|
@ -750,74 +750,6 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
||||||
|
|
||||||
default: // PhysicalJoystick::Type::REGULAR
|
default: // PhysicalJoystick::Type::REGULAR
|
||||||
handleRegularAxisEvent(j, stick, axis, value);
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,6 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system,
|
||||||
myRightEvent = Event::JoystickTwoRight;
|
myRightEvent = Event::JoystickTwoRight;
|
||||||
myFireEvent = Event::JoystickTwoFire;
|
myFireEvent = Event::JoystickTwoFire;
|
||||||
}
|
}
|
||||||
//myXAxisValue = Event::SALeftAxis0Value;
|
|
||||||
//myYAxisValue = Event::SALeftAxis1Value;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -67,8 +65,6 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system,
|
||||||
myRightEvent = Event::JoystickThreeRight;
|
myRightEvent = Event::JoystickThreeRight;
|
||||||
myFireEvent = Event::JoystickThreeFire;
|
myFireEvent = Event::JoystickThreeFire;
|
||||||
}
|
}
|
||||||
//myXAxisValue = Event::SARightAxis0Value;
|
|
||||||
//myYAxisValue = Event::SARightAxis1Value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +74,6 @@ void Joystick::update()
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
|
||||||
updateDigitalAxes();
|
updateDigitalAxes();
|
||||||
//updateStelladaptorAxes();
|
|
||||||
updateMouseAxes();
|
updateMouseAxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,33 +108,6 @@ void Joystick::updateDigitalAxes()
|
||||||
setPin(DigitalPin::Four, myEvent.get(myRightEvent) == 0);
|
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()
|
void Joystick::updateMouseAxes()
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,6 @@ class Joystick : public Controller
|
||||||
// Pre-compute the events we care about based on given port
|
// Pre-compute the events we care about based on given port
|
||||||
// This will eliminate test for left or right port in update()
|
// This will eliminate test for left or right port in update()
|
||||||
Event::Type myUpEvent, myDownEvent, myLeftEvent, myRightEvent;
|
Event::Type myUpEvent, myDownEvent, myLeftEvent, myRightEvent;
|
||||||
//myXAxisValue, myYAxisValue;
|
|
||||||
|
|
||||||
// Controller to emulate in normal mouse axis mode
|
// Controller to emulate in normal mouse axis mode
|
||||||
int myControlID{-1};
|
int myControlID{-1};
|
||||||
|
@ -133,12 +132,6 @@ class Joystick : public Controller
|
||||||
*/
|
*/
|
||||||
void updateDigitalAxes();
|
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.
|
Update the axes pin states according to mouse events currently set.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue