From c76f2313d2699146571cf81d52852e90996aa281 Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 3 Mar 2012 02:37:06 +0000 Subject: [PATCH] Updated 2600-daptor code to handle buttons from an actual 7800 Proline or BoosterGrip controller. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2402 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/emucore/EventHandler.cxx | 22 ++++++++++++---------- src/emucore/EventHandler.hxx | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 0ad14365f..f64e0a307 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -712,7 +712,7 @@ void EventHandler::poll(uInt64 time) if(button < 12) myEvent.set(SA_Key[joy.type-4][button], state); break; default: - if(button < 2) myEvent.set(SA_Button[joy.type-4][button], state); + if(button < 4) myEvent.set(SA_Button[joy.type-4][button], state); } switch(myOSystem->console().controller(Controller::Right).type()) { @@ -720,7 +720,7 @@ void EventHandler::poll(uInt64 time) if(button < 12) myEvent.set(SA_Key[joy.type-4][button], state); break; default: - if(button < 2) myEvent.set(SA_Button[joy.type-4][button], state); + if(button < 4) myEvent.set(SA_Button[joy.type-4][button], state); } } break; // 2600DAPTOR button @@ -2468,10 +2468,12 @@ const Event::Type EventHandler::SA_Axis[2][2] = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Used by the Stelladaptor to map button presses to joystick or paddles -// (driving controllers are considered the same as joysticks) -const Event::Type EventHandler::SA_Button[2][2] = { - { Event::JoystickZeroFire1, Event::JoystickZeroFire3 }, - { Event::JoystickOneFire1, Event::JoystickOneFire3 } +// (driving controllers and boostergrip are considered the same as joysticks) +const Event::Type EventHandler::SA_Button[2][4] = { + { Event::JoystickZeroFire1, Event::JoystickZeroFire3, + Event::JoystickZeroFire2, Event::JoystickZeroFire3 }, + { Event::JoystickOneFire1, Event::JoystickOneFire3, + Event::JoystickOneFire2, Event::JoystickOneFire3 } }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2481,10 +2483,10 @@ const Event::Type EventHandler::SA_Key[2][12] = { Event::KeyboardZero4, Event::KeyboardZero5, Event::KeyboardZero6, Event::KeyboardZero7, Event::KeyboardZero8, Event::KeyboardZero9, Event::KeyboardZeroStar, Event::KeyboardZero0, Event::KeyboardZeroPound }, - { Event::KeyboardOne1, Event::KeyboardOne2, Event::KeyboardOne3, - Event::KeyboardOne4, Event::KeyboardOne5, Event::KeyboardOne6, - Event::KeyboardOne7, Event::KeyboardOne8, Event::KeyboardOne9, - Event::KeyboardOneStar, Event::KeyboardOne0, Event::KeyboardOnePound } + { Event::KeyboardOne1, Event::KeyboardOne2, Event::KeyboardOne3, + Event::KeyboardOne4, Event::KeyboardOne5, Event::KeyboardOne6, + Event::KeyboardOne7, Event::KeyboardOne8, Event::KeyboardOne9, + Event::KeyboardOneStar, Event::KeyboardOne0, Event::KeyboardOnePound } }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index be5ef3b83..eb6882987 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -422,7 +422,7 @@ class EventHandler // Static lookup tables for Stelladaptor/2600-daptor axis/button support static const Event::Type SA_Axis[2][2]; - static const Event::Type SA_Button[2][2]; + static const Event::Type SA_Button[2][4]; static const Event::Type SA_Key[2][12]; // Thin wrapper holding all information about an SDL joystick in Stella.