Fixed bug in BoosterGrip controller handling; the functionality

for analog pins 4 and 9 was swapped.

Renamed various 'Fire' button events to prevent the above problem
from happening again.

In BoosterGrip games, the right mouse button now sends the 'booster'
event, allowing one to play Omega Race fully with the mouse.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2405 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-03-04 19:20:29 +00:00
parent a799541267
commit 2ff4226e67
10 changed files with 54 additions and 50 deletions

View File

@ -22,6 +22,10 @@
* Added ability to dynamically swap the port order of Stelladaptor/ * Added ability to dynamically swap the port order of Stelladaptor/
2600-daptor devices with the 'Control-1' key combo. 2600-daptor devices with the 'Control-1' key combo.
* Fixed bug in BoosterGrip controller emulation; the functionality
of the booster and trigger buttons was reversed. Related to this,
renamed these actions in the Event Mapping dialog to be more clear.
* Updated included PNG library to latest stable version. * Updated included PNG library to latest stable version.
-Have fun! -Have fun!

View File

@ -31,9 +31,9 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system)
myDownEvent = Event::JoystickZeroDown; myDownEvent = Event::JoystickZeroDown;
myLeftEvent = Event::JoystickZeroLeft; myLeftEvent = Event::JoystickZeroLeft;
myRightEvent = Event::JoystickZeroRight; myRightEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire1; myFireEvent = Event::JoystickZeroFire;
myTriggerEvent = Event::JoystickZeroFire2; myTriggerEvent = Event::JoystickZeroFire5;
myBoosterEvent = Event::JoystickZeroFire3; myBoosterEvent = Event::JoystickZeroFire9;
myXAxisValue = Event::SALeftAxis0Value; myXAxisValue = Event::SALeftAxis0Value;
myYAxisValue = Event::SALeftAxis1Value; myYAxisValue = Event::SALeftAxis1Value;
} }
@ -43,9 +43,9 @@ BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system)
myDownEvent = Event::JoystickOneDown; myDownEvent = Event::JoystickOneDown;
myLeftEvent = Event::JoystickOneLeft; myLeftEvent = Event::JoystickOneLeft;
myRightEvent = Event::JoystickOneRight; myRightEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire1; myFireEvent = Event::JoystickOneFire;
myTriggerEvent = Event::JoystickOneFire2; myTriggerEvent = Event::JoystickOneFire5;
myBoosterEvent = Event::JoystickOneFire3; myBoosterEvent = Event::JoystickOneFire9;
myXAxisValue = Event::SARightAxis0Value; myXAxisValue = Event::SARightAxis0Value;
myYAxisValue = Event::SARightAxis1Value; myYAxisValue = Event::SARightAxis1Value;
} }
@ -68,9 +68,9 @@ void BoosterGrip::update()
// The CBS Booster-grip has two more buttons on it. These buttons are // The CBS Booster-grip has two more buttons on it. These buttons are
// connected to the inputs usually used by paddles. // connected to the inputs usually used by paddles.
myAnalogPinValue[Five] = (myEvent.get(myBoosterEvent) != 0) ? myAnalogPinValue[Five] = (myEvent.get(myTriggerEvent) != 0) ?
minimumResistance : maximumResistance; minimumResistance : maximumResistance;
myAnalogPinValue[Nine] = (myEvent.get(myTriggerEvent) != 0) ? myAnalogPinValue[Nine] = (myEvent.get(myBoosterEvent) != 0) ?
minimumResistance : maximumResistance; minimumResistance : maximumResistance;
// Axis events (usually generated by the Stelladaptor) // Axis events (usually generated by the Stelladaptor)
@ -121,9 +121,10 @@ void BoosterGrip::update()
} }
} }
// Get mouse button state // Get mouse button state
if(myEvent.get(Event::MouseButtonLeftValue) || if(myEvent.get(Event::MouseButtonLeftValue))
myEvent.get(Event::MouseButtonRightValue))
myDigitalPinState[Six] = false; myDigitalPinState[Six] = false;
if(myEvent.get(Event::MouseButtonRightValue))
myAnalogPinValue[Nine] = minimumResistance;
} }
} }

View File

@ -34,7 +34,7 @@ Driving::Driving(Jack jack, const Event& event, const System& system)
{ {
myCCWEvent = Event::JoystickZeroLeft; myCCWEvent = Event::JoystickZeroLeft;
myCWEvent = Event::JoystickZeroRight; myCWEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire1; myFireEvent = Event::JoystickZeroFire;
myXAxisValue = Event::SALeftAxis0Value; myXAxisValue = Event::SALeftAxis0Value;
myYAxisValue = Event::SALeftAxis1Value; myYAxisValue = Event::SALeftAxis1Value;
} }
@ -42,7 +42,7 @@ Driving::Driving(Jack jack, const Event& event, const System& system)
{ {
myCCWEvent = Event::JoystickOneLeft; myCCWEvent = Event::JoystickOneLeft;
myCWEvent = Event::JoystickOneRight; myCWEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire1; myFireEvent = Event::JoystickOneFire;
myXAxisValue = Event::SARightAxis0Value; myXAxisValue = Event::SARightAxis0Value;
myYAxisValue = Event::SARightAxis1Value; myYAxisValue = Event::SARightAxis1Value;
} }

View File

@ -45,9 +45,9 @@ class Event
ConsoleSelect, ConsoleReset, ConsoleSelect, ConsoleReset,
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight, JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight,
JoystickZeroFire1, JoystickZeroFire2, JoystickZeroFire3, JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9,
JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight, JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight,
JoystickOneFire1, JoystickOneFire2, JoystickOneFire3, JoystickOneFire, JoystickOneFire5, JoystickOneFire9,
PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog, PaddleZeroFire, PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog, PaddleZeroFire,
PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog, PaddleOneFire, PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog, PaddleOneFire,

View File

@ -1575,18 +1575,18 @@ void EventHandler::setDefaultKeymap(Event::Type event, EventMode mode)
SET_DEFAULT_KEY(KBDK_DOWN, mode, Event::JoystickZeroDown, event); SET_DEFAULT_KEY(KBDK_DOWN, mode, Event::JoystickZeroDown, event);
SET_DEFAULT_KEY(KBDK_LEFT, mode, Event::JoystickZeroLeft, event); SET_DEFAULT_KEY(KBDK_LEFT, mode, Event::JoystickZeroLeft, event);
SET_DEFAULT_KEY(KBDK_RIGHT, mode, Event::JoystickZeroRight, event); SET_DEFAULT_KEY(KBDK_RIGHT, mode, Event::JoystickZeroRight, event);
SET_DEFAULT_KEY(KBDK_SPACE, mode, Event::JoystickZeroFire1, event); SET_DEFAULT_KEY(KBDK_SPACE, mode, Event::JoystickZeroFire, event);
SET_DEFAULT_KEY(KBDK_LCTRL, mode, Event::JoystickZeroFire1, event); SET_DEFAULT_KEY(KBDK_LCTRL, mode, Event::JoystickZeroFire, event);
SET_DEFAULT_KEY(KBDK_4, mode, Event::JoystickZeroFire2, event); SET_DEFAULT_KEY(KBDK_4, mode, Event::JoystickZeroFire5, event);
SET_DEFAULT_KEY(KBDK_5, mode, Event::JoystickZeroFire3, event); SET_DEFAULT_KEY(KBDK_5, mode, Event::JoystickZeroFire9, event);
SET_DEFAULT_KEY(KBDK_y, mode, Event::JoystickOneUp, event); SET_DEFAULT_KEY(KBDK_y, mode, Event::JoystickOneUp, event);
SET_DEFAULT_KEY(KBDK_h, mode, Event::JoystickOneDown, event); SET_DEFAULT_KEY(KBDK_h, mode, Event::JoystickOneDown, event);
SET_DEFAULT_KEY(KBDK_g, mode, Event::JoystickOneLeft, event); SET_DEFAULT_KEY(KBDK_g, mode, Event::JoystickOneLeft, event);
SET_DEFAULT_KEY(KBDK_j, mode, Event::JoystickOneRight, event); SET_DEFAULT_KEY(KBDK_j, mode, Event::JoystickOneRight, event);
SET_DEFAULT_KEY(KBDK_f, mode, Event::JoystickOneFire1, event); SET_DEFAULT_KEY(KBDK_f, mode, Event::JoystickOneFire, event);
SET_DEFAULT_KEY(KBDK_6, mode, Event::JoystickOneFire2, event); SET_DEFAULT_KEY(KBDK_6, mode, Event::JoystickOneFire5, event);
SET_DEFAULT_KEY(KBDK_7, mode, Event::JoystickOneFire3, event); SET_DEFAULT_KEY(KBDK_7, mode, Event::JoystickOneFire9, event);
SET_DEFAULT_KEY(KBDK_F1, mode, Event::ConsoleSelect, event); SET_DEFAULT_KEY(KBDK_F1, mode, Event::ConsoleSelect, event);
@ -2361,17 +2361,17 @@ EventHandler::ActionList EventHandler::ourEmulActionList[kEmulActionListSize] =
{ Event::JoystickZeroDown, "P0 Joystick Down", 0, true }, { Event::JoystickZeroDown, "P0 Joystick Down", 0, true },
{ Event::JoystickZeroLeft, "P0 Joystick Left", 0, true }, { Event::JoystickZeroLeft, "P0 Joystick Left", 0, true },
{ Event::JoystickZeroRight, "P0 Joystick Right", 0, true }, { Event::JoystickZeroRight, "P0 Joystick Right", 0, true },
{ Event::JoystickZeroFire1, "P0 Joystick Fire", 0, true }, { Event::JoystickZeroFire, "P0 Joystick Fire", 0, true },
{ Event::JoystickZeroFire2, "P0 BoosterGrip Trigger", 0, true }, { Event::JoystickZeroFire5, "P0 Booster Top Trigger", 0, true },
{ Event::JoystickZeroFire3, "P0 BoosterGrip Booster", 0, true }, { Event::JoystickZeroFire9, "P0 Booster Handle Grip", 0, true },
{ Event::JoystickOneUp, "P1 Joystick Up", 0, true }, { Event::JoystickOneUp, "P1 Joystick Up", 0, true },
{ Event::JoystickOneDown, "P1 Joystick Down", 0, true }, { Event::JoystickOneDown, "P1 Joystick Down", 0, true },
{ Event::JoystickOneLeft, "P1 Joystick Left", 0, true }, { Event::JoystickOneLeft, "P1 Joystick Left", 0, true },
{ Event::JoystickOneRight, "P1 Joystick Right", 0, true }, { Event::JoystickOneRight, "P1 Joystick Right", 0, true },
{ Event::JoystickOneFire1, "P1 Joystick Fire", 0, true }, { Event::JoystickOneFire, "P1 Joystick Fire", 0, true },
{ Event::JoystickOneFire2, "P1 BoosterGrip Trigger", 0, true }, { Event::JoystickOneFire5, "P1 Booster Top Trigger", 0, true },
{ Event::JoystickOneFire3, "P1 BoosterGrip Booster", 0, true }, { Event::JoystickOneFire9, "P1 Booster Handle Grip", 0, true },
{ Event::PaddleZeroAnalog, "Paddle 0 Analog", 0, true }, { Event::PaddleZeroAnalog, "Paddle 0 Analog", 0, true },
{ Event::PaddleZeroDecrease, "Paddle 0 Decrease", 0, true }, { Event::PaddleZeroDecrease, "Paddle 0 Decrease", 0, true },
@ -2470,10 +2470,10 @@ const Event::Type EventHandler::SA_Axis[2][2] = {
// Used by the Stelladaptor to map button presses to joystick or paddles // Used by the Stelladaptor to map button presses to joystick or paddles
// (driving controllers and boostergrip are considered the same as joysticks) // (driving controllers and boostergrip are considered the same as joysticks)
const Event::Type EventHandler::SA_Button[2][4] = { const Event::Type EventHandler::SA_Button[2][4] = {
{ Event::JoystickZeroFire1, Event::JoystickZeroFire3, { Event::JoystickZeroFire, Event::JoystickZeroFire9,
Event::JoystickZeroFire2, Event::JoystickZeroFire3 }, Event::JoystickZeroFire5, Event::JoystickZeroFire9 },
{ Event::JoystickOneFire1, Event::JoystickOneFire3, { Event::JoystickOneFire, Event::JoystickOneFire9,
Event::JoystickOneFire2, Event::JoystickOneFire3 } Event::JoystickOneFire5, Event::JoystickOneFire9 }
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -31,8 +31,8 @@ Genesis::Genesis(Jack jack, const Event& event, const System& system)
myDownEvent = Event::JoystickZeroDown; myDownEvent = Event::JoystickZeroDown;
myLeftEvent = Event::JoystickZeroLeft; myLeftEvent = Event::JoystickZeroLeft;
myRightEvent = Event::JoystickZeroRight; myRightEvent = Event::JoystickZeroRight;
myFire1Event = Event::JoystickZeroFire1; myFire1Event = Event::JoystickZeroFire;
myFire2Event = Event::JoystickZeroFire3; myFire2Event = Event::JoystickZeroFire5;
} }
else else
{ {
@ -40,8 +40,8 @@ Genesis::Genesis(Jack jack, const Event& event, const System& system)
myDownEvent = Event::JoystickOneDown; myDownEvent = Event::JoystickOneDown;
myLeftEvent = Event::JoystickOneLeft; myLeftEvent = Event::JoystickOneLeft;
myRightEvent = Event::JoystickOneRight; myRightEvent = Event::JoystickOneRight;
myFire1Event = Event::JoystickOneFire1; myFire1Event = Event::JoystickOneFire;
myFire2Event = Event::JoystickOneFire3; myFire2Event = Event::JoystickOneFire5;
} }
// Analog pin 9 is not connected to this controller at all // Analog pin 9 is not connected to this controller at all

View File

@ -28,8 +28,7 @@
The standard Sega Genesis controller works with the 2600 console for The standard Sega Genesis controller works with the 2600 console for
joystick directions and some of the buttons. Button 'B' corresponds to joystick directions and some of the buttons. Button 'B' corresponds to
the normal fire button (joy0fire), while button 'C' is read through the normal fire button (joy0fire), while button 'C' is read through
INPT1 (analog pin 5), which is normally mapped to the BoosterGrip INPT1 (analog pin 5).
booster button.
@author Stephen Anthony @author Stephen Anthony
*/ */

View File

@ -31,7 +31,7 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system)
myDownEvent = Event::JoystickZeroDown; myDownEvent = Event::JoystickZeroDown;
myLeftEvent = Event::JoystickZeroLeft; myLeftEvent = Event::JoystickZeroLeft;
myRightEvent = Event::JoystickZeroRight; myRightEvent = Event::JoystickZeroRight;
myFireEvent = Event::JoystickZeroFire1; myFireEvent = Event::JoystickZeroFire;
myXAxisValue = Event::SALeftAxis0Value; myXAxisValue = Event::SALeftAxis0Value;
myYAxisValue = Event::SALeftAxis1Value; myYAxisValue = Event::SALeftAxis1Value;
} }
@ -41,7 +41,7 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system)
myDownEvent = Event::JoystickOneDown; myDownEvent = Event::JoystickOneDown;
myLeftEvent = Event::JoystickOneLeft; myLeftEvent = Event::JoystickOneLeft;
myRightEvent = Event::JoystickOneRight; myRightEvent = Event::JoystickOneRight;
myFireEvent = Event::JoystickOneFire1; myFireEvent = Event::JoystickOneFire;
myXAxisValue = Event::SARightAxis0Value; myXAxisValue = Event::SARightAxis0Value;
myYAxisValue = Event::SARightAxis1Value; myYAxisValue = Event::SARightAxis1Value;
} }

View File

@ -563,7 +563,7 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
if(mySettings->getBool("holdselect")) if(mySettings->getBool("holdselect"))
myEventHandler->handleEvent(Event::ConsoleSelect, 1); myEventHandler->handleEvent(Event::ConsoleSelect, 1);
if(mySettings->getBool("holdbutton0")) if(mySettings->getBool("holdbutton0"))
myEventHandler->handleEvent(Event::JoystickZeroFire1, 1); myEventHandler->handleEvent(Event::JoystickZeroFire, 1);
return true; return true;
} }
@ -930,9 +930,9 @@ void OSystem::setDefaultJoymap(Event::Type event, EventMode mode)
SET_DEFAULT_AXIS(Event::JoystickOneDown, mode, 1, 1, 1, event); SET_DEFAULT_AXIS(Event::JoystickOneDown, mode, 1, 1, 1, event);
// Left joystick (assume joystick zero, button zero) // Left joystick (assume joystick zero, button zero)
SET_DEFAULT_BTN(Event::JoystickZeroFire1, mode, 0, 0, event); SET_DEFAULT_BTN(Event::JoystickZeroFire, mode, 0, 0, event);
// Right joystick (assume joystick one, button zero) // Right joystick (assume joystick one, button zero)
SET_DEFAULT_BTN(Event::JoystickOneFire1, mode, 1, 0, event); SET_DEFAULT_BTN(Event::JoystickOneFire, mode, 1, 0, event);
// Left joystick left/right directions (assume joystick zero and hat 0) // Left joystick left/right directions (assume joystick zero and hat 0)
SET_DEFAULT_HAT(Event::JoystickZeroLeft, mode, 0, 0, EVENT_HATLEFT, event); SET_DEFAULT_HAT(Event::JoystickZeroLeft, mode, 0, 0, EVENT_HATLEFT, event);

View File

@ -52,9 +52,9 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
myP0AxisValue = Event::SALeftAxis0Value; myP0AxisValue = Event::SALeftAxis0Value;
myP1AxisValue = Event::SALeftAxis1Value; myP1AxisValue = Event::SALeftAxis1Value;
myP0FireEvent1 = Event::PaddleZeroFire; myP0FireEvent1 = Event::PaddleZeroFire;
myP0FireEvent2 = Event::JoystickZeroFire1; myP0FireEvent2 = Event::JoystickZeroFire;
myP1FireEvent1 = Event::PaddleOneFire; myP1FireEvent1 = Event::PaddleOneFire;
myP1FireEvent2 = Event::JoystickZeroFire3; myP1FireEvent2 = Event::JoystickZeroFire9;
// Direction of movement is swapped // Direction of movement is swapped
// That is, moving in a certain direction on an axis can // That is, moving in a certain direction on an axis can
@ -88,9 +88,9 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
myP0AxisValue = Event::SALeftAxis1Value; myP0AxisValue = Event::SALeftAxis1Value;
myP1AxisValue = Event::SALeftAxis0Value; myP1AxisValue = Event::SALeftAxis0Value;
myP0FireEvent1 = Event::PaddleOneFire; myP0FireEvent1 = Event::PaddleOneFire;
myP0FireEvent2 = Event::JoystickZeroFire3; myP0FireEvent2 = Event::JoystickZeroFire9;
myP1FireEvent1 = Event::PaddleZeroFire; myP1FireEvent1 = Event::PaddleZeroFire;
myP1FireEvent2 = Event::JoystickZeroFire1; myP1FireEvent2 = Event::JoystickZeroFire;
// Direction of movement is swapped // Direction of movement is swapped
// That is, moving in a certain direction on an axis can // That is, moving in a certain direction on an axis can
@ -127,9 +127,9 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
myP0AxisValue = Event::SARightAxis0Value; myP0AxisValue = Event::SARightAxis0Value;
myP1AxisValue = Event::SARightAxis1Value; myP1AxisValue = Event::SARightAxis1Value;
myP0FireEvent1 = Event::PaddleTwoFire; myP0FireEvent1 = Event::PaddleTwoFire;
myP0FireEvent2 = Event::JoystickOneFire1; myP0FireEvent2 = Event::JoystickOneFire;
myP1FireEvent1 = Event::PaddleThreeFire; myP1FireEvent1 = Event::PaddleThreeFire;
myP1FireEvent2 = Event::JoystickOneFire3; myP1FireEvent2 = Event::JoystickOneFire9;
// Direction of movement is swapped // Direction of movement is swapped
// That is, moving in a certain direction on an axis can // That is, moving in a certain direction on an axis can
@ -163,9 +163,9 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
myP0AxisValue = Event::SARightAxis1Value; myP0AxisValue = Event::SARightAxis1Value;
myP1AxisValue = Event::SARightAxis0Value; myP1AxisValue = Event::SARightAxis0Value;
myP0FireEvent1 = Event::PaddleThreeFire; myP0FireEvent1 = Event::PaddleThreeFire;
myP0FireEvent2 = Event::JoystickOneFire3; myP0FireEvent2 = Event::JoystickOneFire9;
myP1FireEvent1 = Event::PaddleTwoFire; myP1FireEvent1 = Event::PaddleTwoFire;
myP1FireEvent2 = Event::JoystickOneFire1; myP1FireEvent2 = Event::JoystickOneFire;
// Direction of movement is swapped // Direction of movement is swapped
// That is, moving in a certain direction on an axis can // That is, moving in a certain direction on an axis can