diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx index bae54de10..d4fe4a075 100644 --- a/src/common/EventHandlerSDL2.cxx +++ b/src/common/EventHandlerSDL2.cxx @@ -41,7 +41,7 @@ void EventHandlerSDL2::enableTextEvents(bool enable) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* EventHandlerSDL2::nameForKey(StellaKey key) +const char* EventHandlerSDL2::nameForKey(StellaKey key) const { return SDL_GetScancodeName(SDL_Scancode(key)); } diff --git a/src/common/EventHandlerSDL2.hxx b/src/common/EventHandlerSDL2.hxx index 0416d0ccb..ae52bbe51 100644 --- a/src/common/EventHandlerSDL2.hxx +++ b/src/common/EventHandlerSDL2.hxx @@ -53,7 +53,7 @@ class EventHandlerSDL2 : public EventHandler /** Returns the human-readable name for a StellaKey. */ - const char* nameForKey(StellaKey key); + const char* nameForKey(StellaKey key) const; /** Collects and dispatches any pending SDL2 events. diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index 1ef1fd164..f8b702b38 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -96,7 +96,7 @@ class Cartridge : public Device */ void lockBank() { myBankLocked = true; } void unlockBank() { myBankLocked = false; } - bool bankLocked() { return myBankLocked; } + bool bankLocked() const { return myBankLocked; } /** Get the default startup bank for a cart. This is the bank where diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index ed88a831f..6663d8813 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -346,7 +346,7 @@ class Console : public Serializable Cartridge& myCart; // 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 e09193f98..c03960acc 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -174,18 +174,6 @@ bool Controller::load(Serializer& in) return true; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string Controller::name() const -{ - return myName; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string Controller::about() const -{ - return name() + " in " + (myJack == Left ? "left port" : "right port"); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const Int32 Controller::maximumResistance = 0x7FFFFFFF; diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index c6d6c120b..fefcb6fce 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -101,8 +101,8 @@ class Controller : public Serializable @param jack The jack the controller is plugged into @param event The event object to use for events - @param type The type for this controller @param system The system using this controller + @param type The type for this controller */ Controller(Jack jack, const Event& event, const System& system, Type type); @@ -201,12 +201,13 @@ class Controller : public Serializable /** Returns the name of this controller. */ - virtual string name() const; + virtual string name() const { return myName; } /** Returns more detailed information about this controller. */ - virtual string about() const; + virtual string about() const + { return name() + " in " + (myJack == Left ? "left port" : "right port"); } /** The following two functions are used by the debugger to set diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index a09438dac..01eedd04e 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -109,7 +109,7 @@ class EventHandler @return The event object */ - Event& event() { return myEvent; } + const Event& event() const { return myEvent; } /** Initialize state of this eventhandler. @@ -347,7 +347,7 @@ class EventHandler /** Returns the human-readable name for a StellaKey. */ - virtual const char* nameForKey(StellaKey key) { return EmptyString.c_str(); } + virtual const char* nameForKey(StellaKey key) const { return EmptyString.c_str(); } /** Collects and dispatches any pending events. @@ -371,7 +371,7 @@ class EventHandler }; void handleSystemEvent(SystemEvent e, int data1 = 0, int data2 = 0); - // An abstraction of joystick in Stella. + // An abstraction of a joystick in Stella. // A StellaJoystick holds its own event mapping information, space for // which is dynamically allocated based on the actual number of buttons, // axes, etc that the device contains. @@ -415,7 +415,7 @@ class EventHandler int* axisLastValue; private: - void getValues(const string& list, IntArray& map); + void getValues(const string& list, IntArray& map) const; friend ostream& operator<<(ostream& os, const StellaJoystick& s) { os << " ID: " << s.ID << ", name: " << s.name << ", numaxis: " << s.numAxes @@ -465,7 +465,7 @@ class EventHandler Common::Array mySticks; void setStickDefaultMapping(int stick, Event::Type type, EventMode mode); - void printDatabase(); + void printDatabase() const; }; /** diff --git a/src/emucore/EventJoyHandler.cxx b/src/emucore/EventJoyHandler.cxx index 00e2b1183..fec2c892c 100644 --- a/src/emucore/EventJoyHandler.cxx +++ b/src/emucore/EventJoyHandler.cxx @@ -208,7 +208,7 @@ void EventHandler::StellaJoystick::eraseEvent(Event::Type event, EventMode mode) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::StellaJoystick::getValues(const string& list, IntArray& map) +void EventHandler::StellaJoystick::getValues(const string& list, IntArray& map) const { map.clear(); istringstream buf(list); @@ -266,7 +266,7 @@ EventHandler::JoystickHandler::~JoystickHandler() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::JoystickHandler::printDatabase() +void EventHandler::JoystickHandler::printDatabase() const { cerr << "---------------------------------------------------------" << endl << "joy database:" << endl; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 7d686018b..c7fd9c118 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -721,7 +721,7 @@ void FrameBuffer::toggleGrabMouse() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight, - uInt32 screenWidth, uInt32 screenHeight) + uInt32 screenWidth, uInt32 screenHeight) const { uInt32 multiplier = 1; for(;;) diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index e7a5121f5..8b45d2713 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -454,13 +454,7 @@ class FrameBuffer still fit in the given screen dimensions. */ uInt32 maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight, - uInt32 screenWidth, uInt32 screenHeight); - - /** - Determine all supported (windowed) TIA zoom levels for the current - framebuffer. This will take into account any aspect ratio correction. - */ - void setTIAZoomLevels(uInt32 basewidth, uInt32 baseheight); + uInt32 screenWidth, uInt32 screenHeight) const; /** Set all possible video modes (both windowed and fullscreen) available for diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index a1b0c618d..4695884d7 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -99,7 +99,7 @@ MT24LC256::~MT24LC256() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool MT24LC256::readSDA() +bool MT24LC256::readSDA() const { return jpee_mdat && jpee_sdat; } diff --git a/src/emucore/MT24LC256.hxx b/src/emucore/MT24LC256.hxx index cb82b98b4..ea40e35e4 100644 --- a/src/emucore/MT24LC256.hxx +++ b/src/emucore/MT24LC256.hxx @@ -51,7 +51,7 @@ class MT24LC256 public: /** Read boolean data from the SDA line */ - bool readSDA(); + bool readSDA() const; /** Write boolean data to the SDA and SCL lines */ void writeSDA(bool state); diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 2d2093683..612ab1cce 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -341,7 +341,7 @@ class OSystem Answers whether the ROM launcher was actually successfully used at some point since the app started. - @return True on success, otherwise false + @return True if launcher was ever used, otherwise false */ bool launcherUsed() const { return myLauncherUsed; } diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx index 229231198..f9301623a 100644 --- a/src/emucore/Serializer.cxx +++ b/src/emucore/Serializer.cxx @@ -99,7 +99,7 @@ Serializer::~Serializer() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Serializer::isValid() +bool Serializer::isValid() const { return myStream != NULL; } @@ -113,7 +113,7 @@ void Serializer::reset() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 Serializer::getByte() +uInt8 Serializer::getByte() const { char buf; myStream->read(&buf, 1); @@ -122,13 +122,13 @@ uInt8 Serializer::getByte() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::getByteArray(uInt8* array, uInt32 size) +void Serializer::getByteArray(uInt8* array, uInt32 size) const { myStream->read((char*)array, size); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt16 Serializer::getShort() +uInt16 Serializer::getShort() const { uInt16 val = 0; myStream->read((char*)&val, sizeof(uInt16)); @@ -137,13 +137,13 @@ uInt16 Serializer::getShort() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::getShortArray(uInt16* array, uInt32 size) +void Serializer::getShortArray(uInt16* array, uInt32 size) const { myStream->read((char*)array, sizeof(uInt16)*size); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 Serializer::getInt() +uInt32 Serializer::getInt() const { uInt32 val = 0; myStream->read((char*)&val, sizeof(uInt32)); @@ -152,13 +152,13 @@ uInt32 Serializer::getInt() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Serializer::getIntArray(uInt32* array, uInt32 size) +void Serializer::getIntArray(uInt32* array, uInt32 size) const { myStream->read((char*)array, sizeof(uInt32)*size); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string Serializer::getString() +string Serializer::getString() const { int len = getInt(); string str; @@ -169,7 +169,7 @@ string Serializer::getString() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Serializer::getBool() +bool Serializer::getBool() const { return getByte() == TruePattern; } diff --git a/src/emucore/Serializer.hxx b/src/emucore/Serializer.hxx index 6a0243e01..969b2ab28 100644 --- a/src/emucore/Serializer.hxx +++ b/src/emucore/Serializer.hxx @@ -66,7 +66,7 @@ class Serializer Answers whether the serializer is currently initialized for reading and writing. */ - bool isValid(); + bool isValid() const; /** Resets the read/write location to the beginning of the stream. @@ -78,7 +78,7 @@ class Serializer @result The byte value which has been read from the stream. */ - uInt8 getByte(); + uInt8 getByte() const; /** Reads a byte array (unsigned 8-bit) from the current input stream. @@ -86,15 +86,14 @@ class Serializer @param array The location to store the bytes read @param size The size of the array (number of bytes to read) */ - void getByteArray(uInt8* array, uInt32 size); - + void getByteArray(uInt8* array, uInt32 size) const; /** Reads a short value (unsigned 16-bit) from the current input stream. @result The short value which has been read from the stream. */ - uInt16 getShort(); + uInt16 getShort() const; /** Reads a short array (unsigned 16-bit) from the current input stream. @@ -102,14 +101,14 @@ class Serializer @param array The location to store the shorts read @param size The size of the array (number of shorts to read) */ - void getShortArray(uInt16* array, uInt32 size); + void getShortArray(uInt16* array, uInt32 size) const; /** Reads an int value (unsigned 32-bit) from the current input stream. @result The int value which has been read from the stream. */ - uInt32 getInt(); + uInt32 getInt() const; /** Reads an integer array (unsigned 32-bit) from the current input stream. @@ -117,21 +116,21 @@ class Serializer @param array The location to store the integers read @param size The size of the array (number of integers to read) */ - void getIntArray(uInt32* array, uInt32 size); + void getIntArray(uInt32* array, uInt32 size) const; /** Reads a string from the current input stream. @result The string which has been read from the stream. */ - string getString(); + string getString() const; /** Reads a boolean value from the current input stream. @result The boolean value which has been read from the stream. */ - bool getBool(); + bool getBool() const; /** Writes an byte value (unsigned 8-bit) to the current output stream. diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 9ef16ebcc..9bf591ac9 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -330,7 +330,7 @@ void Settings::validate() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Settings::usage() +void Settings::usage() const { cout << endl << "Stella version " << STELLA_VERSION << endl diff --git a/src/emucore/Settings.hxx b/src/emucore/Settings.hxx index c2b73b4d6..21b62f245 100644 --- a/src/emucore/Settings.hxx +++ b/src/emucore/Settings.hxx @@ -64,7 +64,7 @@ class Settings /** This method should be called to display usage information. */ - void usage(); + void usage() const; /** Get the value assigned to the specified key. diff --git a/src/emucore/StateManager.cxx b/src/emucore/StateManager.cxx index d53c461e1..02d07c970 100644 --- a/src/emucore/StateManager.cxx +++ b/src/emucore/StateManager.cxx @@ -42,12 +42,6 @@ StateManager::StateManager(OSystem* osystem) reset(); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool StateManager::isActive() -{ - return myActiveMode != kOffMode; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool StateManager::toggleRecordMode() { diff --git a/src/emucore/StateManager.hxx b/src/emucore/StateManager.hxx index 668c7addc..7c1aae054 100644 --- a/src/emucore/StateManager.hxx +++ b/src/emucore/StateManager.hxx @@ -44,7 +44,7 @@ class StateManager /** Answers whether the manager is in record or playback mode */ - bool isActive(); + bool isActive() const { return myActiveMode != kOffMode; } bool toggleRecordMode(); bool toggleRewindMode(); diff --git a/src/emucore/System.hxx b/src/emucore/System.hxx index b04386055..ca44afcb2 100644 --- a/src/emucore/System.hxx +++ b/src/emucore/System.hxx @@ -146,7 +146,7 @@ class System : public Serializable @return The null device associated with the system */ - NullDevice& nullDevice() { return myNullDevice; } + const NullDevice& nullDevice() const { return myNullDevice; } /** Get the total number of pages available in the system. diff --git a/src/emucore/TIA.hxx b/src/emucore/TIA.hxx index 7b1d67ed6..ec4b31266 100644 --- a/src/emucore/TIA.hxx +++ b/src/emucore/TIA.hxx @@ -220,7 +220,7 @@ class TIA : public Device Answers whether this TIA runs at NTSC or PAL scanrates, based on how many frames of out the total count are PAL frames. */ - bool isPAL() + bool isPAL() const { return float(myPALFrameCounter) / myFrameCounter >= (25.0/60.0); } /**