mirror of https://github.com/stella-emu/stella.git
remove SA specific events
This commit is contained in:
parent
4334d00d6d
commit
ee47db85c1
|
@ -697,7 +697,6 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i
|
||||||
if (Event::isAnalog(j->joyMap.get(mode, button, axis, JoyDir::ANALOG)))
|
if (Event::isAnalog(j->joyMap.get(mode, button, axis, JoyDir::ANALOG)))
|
||||||
j->joyMap.erase(mode, button, axis, JoyDir::ANALOG);
|
j->joyMap.erase(mode, button, axis, JoyDir::ANALOG);
|
||||||
|
|
||||||
|
|
||||||
j->joyMap.add(event, mode, button, axis, convertAxisValue(value));
|
j->joyMap.add(event, mode, button, axis, convertAxisValue(value));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -733,61 +732,45 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
||||||
// Stelladaptors handle axis differently than regular joysticks
|
// Stelladaptors handle axis differently than regular joysticks
|
||||||
switch (j->type)
|
switch (j->type)
|
||||||
{
|
{
|
||||||
case PhysicalJoystick::JT_REGULAR:
|
case PhysicalJoystick::JT_NONE:
|
||||||
case PhysicalJoystick::JT_STELLADAPTOR_LEFT:
|
break;
|
||||||
case PhysicalJoystick::JT_2600DAPTOR_LEFT:
|
default:
|
||||||
case PhysicalJoystick::JT_STELLADAPTOR_RIGHT:
|
|
||||||
case PhysicalJoystick::JT_2600DAPTOR_RIGHT:
|
|
||||||
if (myHandler.state() == EventHandlerState::EMULATION)
|
if (myHandler.state() == EventHandlerState::EMULATION)
|
||||||
{
|
{
|
||||||
Event::Type eventAxisAnalog = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG);
|
Event::Type eventAxisAnalog = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG);
|
||||||
|
|
||||||
// Check for analog events, which are handled differently
|
// Check for analog events, which are handled differently
|
||||||
// We'll pass them off as Stelladaptor events, and let the controllers
|
if (Event::isAnalog(eventAxisAnalog))
|
||||||
// handle it
|
|
||||||
switch (eventAxisAnalog)
|
|
||||||
{
|
{
|
||||||
case Event::PaddleZeroAnalog:
|
myHandler.handleEvent(eventAxisAnalog, value);
|
||||||
myEvent.set(Event::SALeftAxis0Value, value);
|
}
|
||||||
break;
|
else
|
||||||
case Event::PaddleOneAnalog:
|
{
|
||||||
myEvent.set(Event::SALeftAxis1Value, value);
|
// Otherwise, we know the event is digital
|
||||||
break;
|
// Every axis event has two associated values, negative and positive
|
||||||
case Event::PaddleTwoAnalog:
|
Event::Type eventAxisNeg = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::NEG);
|
||||||
myEvent.set(Event::SARightAxis0Value, value);
|
Event::Type eventAxisPos = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::POS);
|
||||||
break;
|
|
||||||
case Event::PaddleThreeAnalog:
|
if (value > Joystick::deadzone())
|
||||||
myEvent.set(Event::SARightAxis1Value, value);
|
myHandler.handleEvent(eventAxisPos);
|
||||||
break;
|
else if (value < -Joystick::deadzone())
|
||||||
default:
|
myHandler.handleEvent(eventAxisNeg);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Otherwise, we know the event is digital
|
// Treat any deadzone value as zero
|
||||||
// Every axis event has two associated values, negative and positive
|
value = 0;
|
||||||
Event::Type eventAxisNeg = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::NEG);
|
|
||||||
Event::Type eventAxisPos = j->joyMap.get(kEmulationMode, button, JoyAxis(axis), JoyDir::POS);
|
|
||||||
|
|
||||||
if (value > Joystick::deadzone())
|
// Now filter out consecutive, similar values
|
||||||
myHandler.handleEvent(eventAxisPos);
|
// (only pass on the event if the state has changed)
|
||||||
else if (value < -Joystick::deadzone())
|
if (j->axisLastValue[axis] != value)
|
||||||
myHandler.handleEvent(eventAxisNeg);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// Treat any deadzone value as zero
|
// Turn off both events, since we don't know exactly which one
|
||||||
value = 0;
|
// was previously activated.
|
||||||
|
myHandler.handleEvent(eventAxisNeg, false);
|
||||||
// Now filter out consecutive, similar values
|
myHandler.handleEvent(eventAxisPos, false);
|
||||||
// (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;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
j->axisLastValue[axis] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (myHandler.hasOverlay())
|
else if (myHandler.hasOverlay())
|
||||||
|
@ -828,9 +811,9 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value)
|
||||||
case PhysicalJoystick::JT_2600DAPTOR_RIGHT:
|
case PhysicalJoystick::JT_2600DAPTOR_RIGHT:
|
||||||
if (axis < NUM_JOY_AXIS)
|
if (axis < NUM_JOY_AXIS)
|
||||||
myEvent.set(SA_Axis[int(Controller::Jack::Right)][axis], value);
|
myEvent.set(SA_Axis[int(Controller::Jack::Right)][axis], value);
|
||||||
break; // axis on right controller (1)*/
|
break; // axis on right controller (1)
|
||||||
default:
|
default:
|
||||||
break;
|
break;*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -987,8 +970,8 @@ ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
/*// Used by the Stelladaptor to send absolute axis values
|
/*// Used by the Stelladaptor to send absolute axis values
|
||||||
const Event::Type PhysicalJoystickHandler::SA_Axis[NUM_PORTS][NUM_JOY_AXIS] = {
|
const Event::Type PhysicalJoystickHandler::SA_Axis[NUM_PORTS][NUM_JOY_AXIS] = {
|
||||||
{ Event::SALeftAxis0Value, Event::SALeftAxis1Value },
|
{ Event::PaddleZeroAnalog, Event::PaddleOneAnalog },
|
||||||
{ Event::SARightAxis0Value, Event::SARightAxis1Value }
|
{ Event::PaddleTwoAnalog, Event::PaddleThreeAnalog }
|
||||||
};
|
};
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -32,8 +32,8 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system)
|
||||||
myFireEvent = Event::JoystickZeroFire;
|
myFireEvent = Event::JoystickZeroFire;
|
||||||
myTriggerEvent = Event::JoystickZeroFire5;
|
myTriggerEvent = Event::JoystickZeroFire5;
|
||||||
myBoosterEvent = Event::JoystickZeroFire9;
|
myBoosterEvent = Event::JoystickZeroFire9;
|
||||||
myXAxisValue = Event::SALeftAxis0Value;
|
myXAxisValue = Event::PaddleZeroAnalog;
|
||||||
myYAxisValue = Event::SALeftAxis1Value;
|
myYAxisValue = Event::PaddleOneAnalog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -44,8 +44,8 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system)
|
||||||
myFireEvent = Event::JoystickOneFire;
|
myFireEvent = Event::JoystickOneFire;
|
||||||
myTriggerEvent = Event::JoystickOneFire5;
|
myTriggerEvent = Event::JoystickOneFire5;
|
||||||
myBoosterEvent = Event::JoystickOneFire9;
|
myBoosterEvent = Event::JoystickOneFire9;
|
||||||
myXAxisValue = Event::SARightAxis0Value;
|
myXAxisValue = Event::PaddleTwoAnalog;
|
||||||
myYAxisValue = Event::SARightAxis1Value;
|
myYAxisValue = Event::PaddleThreeAnalog;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPin(AnalogPin::Five, MAX_RESISTANCE);
|
setPin(AnalogPin::Five, MAX_RESISTANCE);
|
||||||
|
|
|
@ -35,16 +35,16 @@ Driving::Driving(Jack jack, const Event& event, const System& system)
|
||||||
myCCWEvent = Event::JoystickZeroLeft;
|
myCCWEvent = Event::JoystickZeroLeft;
|
||||||
myCWEvent = Event::JoystickZeroRight;
|
myCWEvent = Event::JoystickZeroRight;
|
||||||
myFireEvent = Event::JoystickZeroFire;
|
myFireEvent = Event::JoystickZeroFire;
|
||||||
myXAxisValue = Event::SALeftAxis0Value;
|
myXAxisValue = Event::PaddleZeroAnalog;
|
||||||
myYAxisValue = Event::SALeftAxis1Value;
|
myYAxisValue = Event::PaddleOneAnalog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myCCWEvent = Event::JoystickOneLeft;
|
myCCWEvent = Event::JoystickOneLeft;
|
||||||
myCWEvent = Event::JoystickOneRight;
|
myCWEvent = Event::JoystickOneRight;
|
||||||
myFireEvent = Event::JoystickOneFire;
|
myFireEvent = Event::JoystickOneFire;
|
||||||
myXAxisValue = Event::SARightAxis0Value;
|
myXAxisValue = Event::PaddleTwoAnalog;
|
||||||
myYAxisValue = Event::SARightAxis1Value;
|
myYAxisValue = Event::PaddleThreeAnalog;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Digital pins 3 and 4 are not connected
|
// Digital pins 3 and 4 are not connected
|
||||||
|
|
|
@ -68,9 +68,6 @@ class Event
|
||||||
Combo1, Combo2, Combo3, Combo4, Combo5, Combo6, Combo7, Combo8,
|
Combo1, Combo2, Combo3, Combo4, Combo5, Combo6, Combo7, Combo8,
|
||||||
Combo9, Combo10, Combo11, Combo12, Combo13, Combo14, Combo15, Combo16,
|
Combo9, Combo10, Combo11, Combo12, Combo13, Combo14, Combo15, Combo16,
|
||||||
|
|
||||||
SALeftAxis0Value, SALeftAxis1Value,
|
|
||||||
SARightAxis0Value, SARightAxis1Value,
|
|
||||||
|
|
||||||
MouseAxisXValue, MouseAxisYValue,
|
MouseAxisXValue, MouseAxisYValue,
|
||||||
MouseButtonLeftValue, MouseButtonRightValue,
|
MouseButtonLeftValue, MouseButtonRightValue,
|
||||||
|
|
||||||
|
|
|
@ -331,10 +331,12 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::handleEvent(Event::Type event, bool pressed, bool repeated)
|
void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
||||||
{
|
{
|
||||||
// Take care of special events that aren't part of the emulation core
|
// Take care of special events that aren't part of the emulation core
|
||||||
// or need to be preprocessed before passing them on
|
// or need to be preprocessed before passing them on
|
||||||
|
bool pressed = (value != 0);
|
||||||
|
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -896,7 +898,7 @@ void EventHandler::handleEvent(Event::Type event, bool pressed, bool repeated)
|
||||||
|
|
||||||
// Otherwise, pass it to the emulation core
|
// Otherwise, pass it to the emulation core
|
||||||
if (!repeated)
|
if (!repeated)
|
||||||
myEvent.set(event, pressed);
|
myEvent.set(event, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -141,7 +141,7 @@ class EventHandler
|
||||||
@param pressed Pressed (true) or released (false)
|
@param pressed Pressed (true) or released (false)
|
||||||
@param repeated Repeated key (true) or first press/release (false)
|
@param repeated Repeated key (true) or first press/release (false)
|
||||||
*/
|
*/
|
||||||
void handleEvent(Event::Type type, bool pressed = true, bool repeated = false);
|
void handleEvent(Event::Type type, Int32 value = 1, bool repeated = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle events that must be processed each time a new console is
|
Handle events that must be processed each time a new console is
|
||||||
|
|
|
@ -30,8 +30,8 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system)
|
||||||
myLeftEvent = Event::JoystickZeroLeft;
|
myLeftEvent = Event::JoystickZeroLeft;
|
||||||
myRightEvent = Event::JoystickZeroRight;
|
myRightEvent = Event::JoystickZeroRight;
|
||||||
myFireEvent = Event::JoystickZeroFire;
|
myFireEvent = Event::JoystickZeroFire;
|
||||||
myXAxisValue = Event::SALeftAxis0Value;
|
myXAxisValue = Event::PaddleZeroAnalog;
|
||||||
myYAxisValue = Event::SALeftAxis1Value;
|
myYAxisValue = Event::PaddleOneAnalog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -40,8 +40,8 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system)
|
||||||
myLeftEvent = Event::JoystickOneLeft;
|
myLeftEvent = Event::JoystickOneLeft;
|
||||||
myRightEvent = Event::JoystickOneRight;
|
myRightEvent = Event::JoystickOneRight;
|
||||||
myFireEvent = Event::JoystickOneFire;
|
myFireEvent = Event::JoystickOneFire;
|
||||||
myXAxisValue = Event::SARightAxis0Value;
|
myXAxisValue = Event::PaddleTwoAnalog;
|
||||||
myYAxisValue = Event::SARightAxis1Value;
|
myYAxisValue = Event::PaddleThreeAnalog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
|
||||||
if(!swappaddle) // First paddle is 0, second is 1
|
if(!swappaddle) // First paddle is 0, second is 1
|
||||||
{
|
{
|
||||||
// These aren't affected by changes in axis orientation
|
// These aren't affected by changes in axis orientation
|
||||||
myP0AxisValue = Event::SALeftAxis0Value;
|
myP0AxisValue = Event::PaddleZeroAnalog;
|
||||||
myP1AxisValue = Event::SALeftAxis1Value;
|
myP1AxisValue = Event::PaddleOneAnalog;
|
||||||
myP0FireEvent1 = Event::PaddleZeroFire;
|
myP0FireEvent1 = Event::PaddleZeroFire;
|
||||||
myP0FireEvent2 = Event::JoystickZeroFire;
|
myP0FireEvent2 = Event::JoystickZeroFire;
|
||||||
myP1FireEvent1 = Event::PaddleOneFire;
|
myP1FireEvent1 = Event::PaddleOneFire;
|
||||||
|
@ -89,8 +89,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
|
||||||
else // First paddle is 1, second is 0
|
else // First paddle is 1, second is 0
|
||||||
{
|
{
|
||||||
// These aren't affected by changes in axis orientation
|
// These aren't affected by changes in axis orientation
|
||||||
myP0AxisValue = Event::SALeftAxis1Value;
|
myP0AxisValue = Event::PaddleOneAnalog;
|
||||||
myP1AxisValue = Event::SALeftAxis0Value;
|
myP1AxisValue = Event::PaddleZeroAnalog;
|
||||||
myP0FireEvent1 = Event::PaddleOneFire;
|
myP0FireEvent1 = Event::PaddleOneFire;
|
||||||
myP0FireEvent2 = Event::JoystickZeroFire9;
|
myP0FireEvent2 = Event::JoystickZeroFire9;
|
||||||
myP1FireEvent1 = Event::PaddleZeroFire;
|
myP1FireEvent1 = Event::PaddleZeroFire;
|
||||||
|
@ -128,8 +128,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
|
||||||
if(!swappaddle) // First paddle is 2, second is 3
|
if(!swappaddle) // First paddle is 2, second is 3
|
||||||
{
|
{
|
||||||
// These aren't affected by changes in axis orientation
|
// These aren't affected by changes in axis orientation
|
||||||
myP0AxisValue = Event::SARightAxis0Value;
|
myP0AxisValue = Event::PaddleTwoAnalog;
|
||||||
myP1AxisValue = Event::SARightAxis1Value;
|
myP1AxisValue = Event::PaddleThreeAnalog;
|
||||||
myP0FireEvent1 = Event::PaddleTwoFire;
|
myP0FireEvent1 = Event::PaddleTwoFire;
|
||||||
myP0FireEvent2 = Event::JoystickOneFire;
|
myP0FireEvent2 = Event::JoystickOneFire;
|
||||||
myP1FireEvent1 = Event::PaddleThreeFire;
|
myP1FireEvent1 = Event::PaddleThreeFire;
|
||||||
|
@ -164,8 +164,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
|
||||||
else // First paddle is 3, second is 2
|
else // First paddle is 3, second is 2
|
||||||
{
|
{
|
||||||
// These aren't affected by changes in axis orientation
|
// These aren't affected by changes in axis orientation
|
||||||
myP0AxisValue = Event::SARightAxis1Value;
|
myP0AxisValue = Event::PaddleThreeAnalog;
|
||||||
myP1AxisValue = Event::SARightAxis0Value;
|
myP1AxisValue = Event::PaddleTwoAnalog;
|
||||||
myP0FireEvent1 = Event::PaddleThreeFire;
|
myP0FireEvent1 = Event::PaddleThreeFire;
|
||||||
myP0FireEvent2 = Event::JoystickOneFire9;
|
myP0FireEvent2 = Event::JoystickOneFire9;
|
||||||
myP1FireEvent1 = Event::PaddleTwoFire;
|
myP1FireEvent1 = Event::PaddleTwoFire;
|
||||||
|
|
Loading…
Reference in New Issue