diff --git a/Changes.txt b/Changes.txt index 9e0803d21..479bac355 100644 --- a/Changes.txt +++ b/Changes.txt @@ -20,7 +20,9 @@ device. * 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 (useful if you + have only one 2600-daptor and want to use it as a left port + normally, but as a right port for Star Raiders, etc). * Fixed bug in BoosterGrip controller emulation; the functionality of the booster and trigger buttons was reversed. Related to this, diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 84b6b461c..225237d5d 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -276,6 +276,19 @@ void EventHandler::mapStelladaptors(const string& saport) } } myOSystem->settings().setString("saport", saport); + + // We're potentially swapping out an input device behind the back of + // the Event system, so we make sure all Stelladaptor-generated events + // are reset + for(int i = 0; i < 2; ++i) + { + for(int j = 0; j < 2; ++j) + myEvent.set(SA_Axis[i][j], 0); + for(int j = 0; j < 4; ++j) + myEvent.set(SA_Button[i][j], 0); + for(int j = 0; j < 12; ++j) + myEvent.set(SA_Key[i][j], 0); + } #endif }