diff --git a/src/debugger/gui/KeyboardWidget.cxx b/src/debugger/gui/KeyboardWidget.cxx index 61ee42692..e0ca3ba05 100644 --- a/src/debugger/gui/KeyboardWidget.cxx +++ b/src/debugger/gui/KeyboardWidget.cxx @@ -54,7 +54,7 @@ KeyboardWidget::KeyboardWidget(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void KeyboardWidget::loadConfig() { - Event& event = instance().eventHandler().event(); + const Event& event = instance().eventHandler().event(); for(int i = 0; i < 12; ++i) myBox[i]->setState(event.get(myEvent[i])); } diff --git a/src/emucore/AmigaMouse.hxx b/src/emucore/AmigaMouse.hxx index 0e042b294..09615a216 100644 --- a/src/emucore/AmigaMouse.hxx +++ b/src/emucore/AmigaMouse.hxx @@ -30,7 +30,7 @@ class AmigaMouse : public PointingDevice @param event The event object to use for events @param system The system using this controller */ - AmigaMouse(Jack jack, Event& event, const System& system) + AmigaMouse(Jack jack, const Event& event, const System& system) : PointingDevice(jack, event, system, Controller::AmigaMouse, trackballSensitivity) { } virtual ~AmigaMouse() = default; diff --git a/src/emucore/AtariMouse.hxx b/src/emucore/AtariMouse.hxx index 9081855fd..0ad879afc 100644 --- a/src/emucore/AtariMouse.hxx +++ b/src/emucore/AtariMouse.hxx @@ -30,7 +30,7 @@ class AtariMouse : public PointingDevice @param event The event object to use for events @param system The system using this controller */ - AtariMouse(Jack jack, Event& event, const System& system) + AtariMouse(Jack jack, const Event& event, const System& system) : PointingDevice(jack, event, system, Controller::AtariMouse, trackballSensitivity) { } virtual ~AtariMouse() = default; diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx index 9e0773c46..5cdf285cb 100644 --- a/src/emucore/AtariVox.cxx +++ b/src/emucore/AtariVox.cxx @@ -20,7 +20,7 @@ #include "AtariVox.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -AtariVox::AtariVox(Jack jack, Event& event, const System& system, +AtariVox::AtariVox(Jack jack, const Event& event, const System& system, const SerialPort& port, const string& portname, const string& eepromfile) : SaveKey(jack, event, system, eepromfile, Controller::AtariVox), diff --git a/src/emucore/AtariVox.hxx b/src/emucore/AtariVox.hxx index 8707fb848..cec2c72aa 100644 --- a/src/emucore/AtariVox.hxx +++ b/src/emucore/AtariVox.hxx @@ -45,7 +45,7 @@ class AtariVox : public SaveKey @param portname Name of the port used for reading and writing @param eepromfile The file containing the EEPROM data */ - AtariVox(Jack jack, Event& event, const System& system, + AtariVox(Jack jack, const Event& event, const System& system, const SerialPort& port, const string& portname, const string& eepromfile); virtual ~AtariVox() = default; diff --git a/src/emucore/Booster.cxx b/src/emucore/Booster.cxx index 0a9922c83..e09859ae1 100644 --- a/src/emucore/Booster.cxx +++ b/src/emucore/Booster.cxx @@ -19,7 +19,7 @@ #include "Booster.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BoosterGrip::BoosterGrip(Jack jack, Event& event, const System& system) +BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::BoosterGrip), myControlID(-1) { diff --git a/src/emucore/Booster.hxx b/src/emucore/Booster.hxx index c5799bc5a..a89c94fff 100644 --- a/src/emucore/Booster.hxx +++ b/src/emucore/Booster.hxx @@ -38,7 +38,7 @@ class BoosterGrip : public Controller @param event The event object to use for events @param system The system using this controller */ - BoosterGrip(Jack jack, Event& event, const System& system); + BoosterGrip(Jack jack, const Event& event, const System& system); virtual ~BoosterGrip() = default; public: diff --git a/src/emucore/CompuMate.cxx b/src/emucore/CompuMate.cxx index a53315f5a..42c385105 100644 --- a/src/emucore/CompuMate.cxx +++ b/src/emucore/CompuMate.cxx @@ -20,7 +20,7 @@ #include "CompuMate.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CompuMate::CompuMate(const Console& console, Event& event, +CompuMate::CompuMate(const Console& console, const Event& event, const System& system) : myConsole(console), myColumn(0), diff --git a/src/emucore/CompuMate.hxx b/src/emucore/CompuMate.hxx index 87f1fef13..01d7c95ba 100644 --- a/src/emucore/CompuMate.hxx +++ b/src/emucore/CompuMate.hxx @@ -50,7 +50,7 @@ class CompuMate @param event The event object to use for events @param system The system using this controller */ - CompuMate(const Console& console, Event& event, const System& system); + CompuMate(const Console& console, const Event& event, const System& system); virtual ~CompuMate() = default; // Controllers are deleted outside this class /** @@ -98,7 +98,7 @@ class CompuMate @param event The event object to use for events @param system The system using this controller */ - CMControl(class CompuMate& handler, Controller::Jack jack, Event& event, + CMControl(class CompuMate& handler, Controller::Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::CompuMate), myHandler(handler) { } diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index 4c9fa25ee..a8ab18785 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -372,7 +372,7 @@ class Console : public Serializable OSystem& myOSystem; // Reference to the event object to use - Event& myEvent; + const Event& myEvent; // Properties for the game Properties myProperties; diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx index a7a91679a..c522b3947 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -21,7 +21,7 @@ #include "Control.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Controller(Jack jack, Event& event, const System& system, +Controller::Controller(Jack jack, const Event& event, const System& system, Type type) : myJack(jack), myEvent(event), diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 2e0461d32..45a6bdd7c 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -108,7 +108,7 @@ class Controller : public Serializable @param system The system using this controller @param type The type for this controller */ - Controller(Jack jack, Event& event, const System& system, + Controller(Jack jack, const Event& event, const System& system, Type type); virtual ~Controller() = default; @@ -275,7 +275,7 @@ class Controller : public Serializable const Jack myJack; /// Reference to the event object this controller uses - Event& myEvent; + const Event& myEvent; /// Pointer to the System object (used for timing purposes) const System& mySystem; diff --git a/src/emucore/Driving.cxx b/src/emucore/Driving.cxx index be24c2f85..e209b723f 100644 --- a/src/emucore/Driving.cxx +++ b/src/emucore/Driving.cxx @@ -21,7 +21,7 @@ #include "Driving.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Driving::Driving(Jack jack, Event& event, const System& system) +Driving::Driving(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::Driving), myCounter(0), myGrayIndex(0), diff --git a/src/emucore/Driving.hxx b/src/emucore/Driving.hxx index 41b7343c1..0925cef25 100644 --- a/src/emucore/Driving.hxx +++ b/src/emucore/Driving.hxx @@ -37,7 +37,7 @@ class Driving : public Controller @param event The event object to use for events @param system The system using this controller */ - Driving(Jack jack, Event& event, const System& system); + Driving(Jack jack, const Event& event, const System& system); virtual ~Driving() = default; public: diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index 582881a35..75c40a3ea 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -24,7 +24,7 @@ #include "StellaKeys.hxx" /** - @author Bradford W. Mott, Stephen Anthony + @author Stephen Anthony, Christian Speckner */ class Event { @@ -89,9 +89,10 @@ class Event : myKeyTable(keyTable), myMutex(mutex), myIsEnabled(true) - {} + { + } - bool operator[](int type) { + bool operator[](int type) const { if (!myIsEnabled) return false; std::lock_guard lock(myMutex); @@ -122,7 +123,7 @@ class Event /** Get the value associated with the event of the specified type. */ - Int32 get(Type type) { + Int32 get(Type type) const { std::lock_guard lock(myMutex); return myValues[type]; @@ -154,7 +155,7 @@ class Event /** Get the keytable associated with this event. */ - KeyTable getKeys() { return KeyTable(myKeyTable, myMutex); } + KeyTable getKeys() const { return KeyTable(myKeyTable, myMutex); } /** Set the value associated with the event of the specified type. @@ -189,7 +190,7 @@ class Event // Array of keyboard key states bool myKeyTable[KBDK_LAST]; - std::mutex myMutex; + mutable std::mutex myMutex; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index e8344bc53..a6d32ce98 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -63,7 +63,7 @@ class EventHandler @return The event object */ - Event& event() { return myEvent; } + const Event& event() const { return myEvent; } /** Initialize state of this eventhandler. diff --git a/src/emucore/Genesis.cxx b/src/emucore/Genesis.cxx index 7085228ae..74de86906 100644 --- a/src/emucore/Genesis.cxx +++ b/src/emucore/Genesis.cxx @@ -19,7 +19,7 @@ #include "Genesis.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Genesis::Genesis(Jack jack, Event& event, const System& system) +Genesis::Genesis(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::Genesis), myControlID(-1) { diff --git a/src/emucore/Genesis.hxx b/src/emucore/Genesis.hxx index 323fb124c..c94783358 100644 --- a/src/emucore/Genesis.hxx +++ b/src/emucore/Genesis.hxx @@ -40,7 +40,7 @@ class Genesis : public Controller @param event The event object to use for events @param system The system using this controller */ - Genesis(Jack jack, Event& event, const System& system); + Genesis(Jack jack, const Event& event, const System& system); virtual ~Genesis() = default; public: diff --git a/src/emucore/Joystick.cxx b/src/emucore/Joystick.cxx index 134228162..ccfaa1faf 100644 --- a/src/emucore/Joystick.cxx +++ b/src/emucore/Joystick.cxx @@ -19,7 +19,7 @@ #include "Joystick.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Joystick::Joystick(Jack jack, Event& event, const System& system) +Joystick::Joystick(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::Joystick), myControlID(-1) { diff --git a/src/emucore/Joystick.hxx b/src/emucore/Joystick.hxx index f3c1b1129..228ed9109 100644 --- a/src/emucore/Joystick.hxx +++ b/src/emucore/Joystick.hxx @@ -37,7 +37,7 @@ class Joystick : public Controller @param event The event object to use for events @param system The system using this controller */ - Joystick(Jack jack, Event& event, const System& system); + Joystick(Jack jack, const Event& event, const System& system); virtual ~Joystick() = default; public: diff --git a/src/emucore/Keyboard.cxx b/src/emucore/Keyboard.cxx index 301165efe..996053d32 100644 --- a/src/emucore/Keyboard.cxx +++ b/src/emucore/Keyboard.cxx @@ -19,7 +19,7 @@ #include "Keyboard.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Keyboard::Keyboard(Jack jack, Event& event, const System& system) +Keyboard::Keyboard(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::Keyboard) { if(myJack == Left) diff --git a/src/emucore/Keyboard.hxx b/src/emucore/Keyboard.hxx index 46c10cbc8..aa5ca23f7 100644 --- a/src/emucore/Keyboard.hxx +++ b/src/emucore/Keyboard.hxx @@ -37,7 +37,7 @@ class Keyboard : public Controller @param event The event object to use for events @param system The system using this controller */ - Keyboard(Jack jack, Event& event, const System& system); + Keyboard(Jack jack, const Event& event, const System& system); virtual ~Keyboard() = default; public: diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx index fd5b713de..2d44259c8 100644 --- a/src/emucore/KidVid.cxx +++ b/src/emucore/KidVid.cxx @@ -21,7 +21,7 @@ #include "KidVid.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -KidVid::KidVid(Jack jack, Event& event, const System& system, +KidVid::KidVid(Jack jack, const Event& event, const System& system, const string& rommd5) : Controller(jack, event, system, Controller::KidVid), myEnabled(myJack == Right), diff --git a/src/emucore/KidVid.hxx b/src/emucore/KidVid.hxx index ce26b7373..8365a3d15 100644 --- a/src/emucore/KidVid.hxx +++ b/src/emucore/KidVid.hxx @@ -47,7 +47,7 @@ class KidVid : public Controller @param system The system using this controller @param md5sum The md5 of the ROM using this controller */ - KidVid(Jack jack, Event& event, const System& system, + KidVid(Jack jack, const Event& event, const System& system, const string& md5sum); virtual ~KidVid(); diff --git a/src/emucore/MindLink.cxx b/src/emucore/MindLink.cxx index b715a1aa9..f2b13d9af 100644 --- a/src/emucore/MindLink.cxx +++ b/src/emucore/MindLink.cxx @@ -19,7 +19,7 @@ #include "MindLink.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MindLink::MindLink(Jack jack, Event& event, const System& system) +MindLink::MindLink(Jack jack, const Event& event, const System& system) : Controller(jack, event, system, Controller::MindLink), myMindlinkPos(0x2800), myMindlinkShift(1), diff --git a/src/emucore/MindLink.hxx b/src/emucore/MindLink.hxx index c43fb20a3..15c7c96ba 100644 --- a/src/emucore/MindLink.hxx +++ b/src/emucore/MindLink.hxx @@ -47,7 +47,7 @@ class MindLink : public Controller @param event The event object to use for events @param system The system using this controller */ - MindLink(Jack jack, Event& event, const System& system); + MindLink(Jack jack, const Event& event, const System& system); virtual ~MindLink() = default; public: diff --git a/src/emucore/Paddles.cxx b/src/emucore/Paddles.cxx index 8511d696d..f6bca2b46 100644 --- a/src/emucore/Paddles.cxx +++ b/src/emucore/Paddles.cxx @@ -19,7 +19,7 @@ #include "Paddles.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Paddles::Paddles(Jack jack, Event& event, const System& system, +Paddles::Paddles(Jack jack, const Event& event, const System& system, bool swappaddle, bool swapaxis, bool swapdir) : Controller(jack, event, system, Controller::Paddles), myMPaddleID(-1), diff --git a/src/emucore/Paddles.hxx b/src/emucore/Paddles.hxx index 7ea3c6cbe..4a206a5d7 100644 --- a/src/emucore/Paddles.hxx +++ b/src/emucore/Paddles.hxx @@ -43,7 +43,7 @@ class Paddles : public Controller causes movement (lesser axis values cause paddle resistance to decrease instead of increase) */ - Paddles(Jack jack, Event& event, const System& system, + Paddles(Jack jack, const Event& event, const System& system, bool swappaddle, bool swapaxis, bool swapdir); virtual ~Paddles() = default; diff --git a/src/emucore/PointingDevice.cxx b/src/emucore/PointingDevice.cxx index 327ae96fa..346e06b5a 100644 --- a/src/emucore/PointingDevice.cxx +++ b/src/emucore/PointingDevice.cxx @@ -23,7 +23,7 @@ #include "PointingDevice.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PointingDevice::PointingDevice(Jack jack, Event& event, +PointingDevice::PointingDevice(Jack jack, const Event& event, const System& system, Controller::Type type, float sensitivity) : Controller(jack, event, system, type), diff --git a/src/emucore/PointingDevice.hxx b/src/emucore/PointingDevice.hxx index 8cedc26f4..8ff501c11 100644 --- a/src/emucore/PointingDevice.hxx +++ b/src/emucore/PointingDevice.hxx @@ -35,7 +35,7 @@ class PointingDevice : public Controller friend class PointingDeviceWidget; public: - PointingDevice(Jack jack, Event& event, + PointingDevice(Jack jack, const Event& event, const System& system, Controller::Type type, float sensitivity); virtual ~PointingDevice() = default; diff --git a/src/emucore/SaveKey.cxx b/src/emucore/SaveKey.cxx index 4a0359fa5..0e0acde8e 100644 --- a/src/emucore/SaveKey.cxx +++ b/src/emucore/SaveKey.cxx @@ -20,7 +20,7 @@ #include "SaveKey.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SaveKey::SaveKey(Jack jack, Event& event, const System& system, +SaveKey::SaveKey(Jack jack, const Event& event, const System& system, const string& eepromfile, Type type) : Controller(jack, event, system, type) { @@ -30,7 +30,7 @@ SaveKey::SaveKey(Jack jack, Event& event, const System& system, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SaveKey::SaveKey(Jack jack, Event& event, const System& system, +SaveKey::SaveKey(Jack jack, const Event& event, const System& system, const string& eepromfile) : SaveKey(jack, event, system, eepromfile, Controller::SaveKey) { diff --git a/src/emucore/SaveKey.hxx b/src/emucore/SaveKey.hxx index 0415e7e9f..ab98c8029 100644 --- a/src/emucore/SaveKey.hxx +++ b/src/emucore/SaveKey.hxx @@ -42,7 +42,7 @@ class SaveKey : public Controller @param system The system using this controller @param eepromfile The file containing the EEPROM data */ - SaveKey(Jack jack, Event& event, const System& system, + SaveKey(Jack jack, const Event& event, const System& system, const string& eepromfile); virtual ~SaveKey(); @@ -51,7 +51,7 @@ class SaveKey : public Controller Delegating constructor currently used by both this class and classes that inherit from SaveKey (currently, AtariVox) */ - SaveKey(Jack jack, Event& event, const System& system, + SaveKey(Jack jack, const Event& event, const System& system, const string& eepromfile, Type type); public: diff --git a/src/emucore/Switches.cxx b/src/emucore/Switches.cxx index f8dabd93b..28f90c47e 100644 --- a/src/emucore/Switches.cxx +++ b/src/emucore/Switches.cxx @@ -21,7 +21,7 @@ #include "Switches.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Switches::Switches(Event& event, const Properties& properties, +Switches::Switches(const Event& event, const Properties& properties, const Settings& settings) : myEvent(event), mySwitches(0xFF), diff --git a/src/emucore/Switches.hxx b/src/emucore/Switches.hxx index 4ba261061..b18a7bde2 100644 --- a/src/emucore/Switches.hxx +++ b/src/emucore/Switches.hxx @@ -46,7 +46,7 @@ class Switches : public Serializable @param props The ROM properties to use for the currently enabled ROM @param settings The settings used by the system */ - Switches(Event& event, const Properties& props, const Settings& settings); + Switches(const Event& event, const Properties& props, const Settings& settings); virtual ~Switches() = default; public: @@ -124,7 +124,7 @@ class Switches : public Serializable private: // Reference to the event object to use - Event& myEvent; + const Event& myEvent; // State of the console switches uInt8 mySwitches; diff --git a/src/emucore/TrakBall.hxx b/src/emucore/TrakBall.hxx index ea7123358..038b9f2c3 100644 --- a/src/emucore/TrakBall.hxx +++ b/src/emucore/TrakBall.hxx @@ -30,7 +30,7 @@ class TrakBall : public PointingDevice @param event The event object to use for events @param system The system using this controller */ - TrakBall(Jack jack, Event& event, const System& system) + TrakBall(Jack jack, const Event& event, const System& system) : PointingDevice(jack, event, system, Controller::TrakBall, trackballSensitivity) { } virtual ~TrakBall() = default;