diff --git a/src/common/Version.hxx b/src/common/Version.hxx index 45dbb0c9f..c0ac916af 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "4.2_pre" +#define STELLA_VERSION "4.2_beta1" #define STELLA_BUILD atoi("$Rev$" + 6) #endif diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 8c6813570..79554c7a2 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -1778,7 +1778,7 @@ void EventHandler::takeSnapshot(uInt32 number) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::setMouseControllerMode(const string& enable) { - if(&myOSystem.console()) + if(myOSystem.hasConsole()) { delete myMouseControl; myMouseControl = NULL; @@ -1851,7 +1851,7 @@ void EventHandler::leaveMenuMode() bool EventHandler::enterDebugMode() { #ifdef DEBUGGER_SUPPORT - if(myState == S_DEBUGGER || !(&myOSystem.console())) + if(myState == S_DEBUGGER || !myOSystem.hasConsole()) return false; // Make sure debugger starts in a consistent state @@ -1955,15 +1955,10 @@ void EventHandler::setEventState(State state) // Inform various subsystems about the new state myOSystem.stateChanged(myState); - if(&myOSystem.frameBuffer()) - { - myOSystem.frameBuffer().stateChanged(myState); - myOSystem.frameBuffer().setCursorState(); - } - if(&myOSystem.console()) - { + myOSystem.frameBuffer().stateChanged(myState); + myOSystem.frameBuffer().setCursorState(); + if(myOSystem.hasConsole()) myOSystem.console().stateChanged(myState); - } // Always clear any pending events when changing states myEvent.clear(); diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 58015f351..a09438dac 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -439,7 +439,7 @@ class EventHandler void saveMapping(); const StellaJoystick* joy(int id) const { - return id < mySticks.size() ? mySticks[id] : NULL; + return id < (int)mySticks.size() ? mySticks[id] : NULL; } private: diff --git a/src/emucore/EventJoyHandler.cxx b/src/emucore/EventJoyHandler.cxx index 7d9025a50..00e2b1183 100644 --- a/src/emucore/EventJoyHandler.cxx +++ b/src/emucore/EventJoyHandler.cxx @@ -360,7 +360,7 @@ int EventHandler::JoystickHandler::remove(int index) // Sticks that are removed must have initially been added // So we use the 'active' joystick list to access them - if(index >= 0 && index < mySticks.size() && mySticks[index] != NULL) + if(index >= 0 && index < (int)mySticks.size() && mySticks[index] != NULL) { StellaJoystick* stick = mySticks[index]; diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 9103ee4cf..2d2093683 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -81,46 +81,48 @@ class OSystem public: /** - Get the event handler of the system + Get the event handler of the system. @return The event handler */ EventHandler& eventHandler() const { return *myEventHandler; } /** - Get the frame buffer of the system + Get the frame buffer of the system. @return The frame buffer */ FrameBuffer& frameBuffer() const { return *myFrameBuffer; } /** - Get the sound object of the system + Get the sound object of the system. @return The sound object */ Sound& sound() const { return *mySound; } /** - Get the settings object of the system + Get the settings object of the system. @return The settings object */ Settings& settings() const { return *mySettings; } /** - Get the set of game properties for the system + Get the set of game properties for the system. @return The properties set object */ PropertiesSet& propSet() const { return *myPropSet; } /** - Get the console of the system. + Get the console of the system. The console won't always exist, + so we should test if it's available. @return The console object */ Console& console() const { return *myConsole; } + bool hasConsole() const { return myConsole != NULL; } /** Get the serial port of the system. diff --git a/src/emucore/StateManager.cxx b/src/emucore/StateManager.cxx index 917ec9bff..d53c461e1 100644 --- a/src/emucore/StateManager.cxx +++ b/src/emucore/StateManager.cxx @@ -168,7 +168,7 @@ void StateManager::update() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void StateManager::loadState(int slot) { - if(&myOSystem->console()) + if(myOSystem->hasConsole()) { if(slot < 0) slot = myCurrentSlot; @@ -212,7 +212,7 @@ void StateManager::loadState(int slot) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void StateManager::saveState(int slot) { - if(&myOSystem->console()) + if(myOSystem->hasConsole()) { if(slot < 0) slot = myCurrentSlot; @@ -270,7 +270,7 @@ void StateManager::changeState() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool StateManager::loadState(Serializer& in) { - if(&myOSystem->console()) + if(myOSystem->hasConsole()) { // Make sure the file can be opened for reading if(in.isValid()) @@ -290,7 +290,7 @@ bool StateManager::saveState(Serializer& out) { try { - if(&myOSystem->console()) + if(myOSystem->hasConsole()) { // Make sure the file can be opened for writing if(out.isValid()) diff --git a/src/gui/AudioDialog.cxx b/src/gui/AudioDialog.cxx index 7a5ced8d5..3c0056b68 100644 --- a/src/gui/AudioDialog.cxx +++ b/src/gui/AudioDialog.cxx @@ -166,7 +166,7 @@ void AudioDialog::saveConfig() // Only force a re-initialization when necessary, since it can // be a time-consuming operation - if(&instance().console()) + if(instance().hasConsole()) instance().console().initializeAudio(); } diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index b6dfa5d64..357f79d5a 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -379,13 +379,13 @@ void GameInfoDialog::loadConfig() myPropertiesLoaded = false; myDefaultsSelected = false; - if(&instance().console()) + if(instance().hasConsole()) { myGameProperties = instance().console().properties(); myPropertiesLoaded = true; loadView(); } - else if(&instance().launcher()) + else { const string& md5 = instance().launcher().selectedRomMD5(); if(md5 != "") @@ -506,7 +506,7 @@ void GameInfoDialog::saveConfig() instance().propSet().insert(myGameProperties); // In any event, inform the Console and save the properties - if(&instance().console()) + if(instance().hasConsole()) instance().console().setProperties(myGameProperties); instance().propSet().save(instance().propertiesFile()); } diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 70c38202a..86cd810fe 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -416,7 +416,7 @@ void VideoDialog::saveConfig() // Framerate int i = myFrameRate->getValue(); instance().settings().setValue("framerate", i); - if(&instance().console()) + if(instance().hasConsole()) { // Make sure auto-frame calculation is only enabled when necessary instance().console().tia().enableAutoFrame(i <= 0); @@ -428,7 +428,7 @@ void VideoDialog::saveConfig() // PAL color-loss effect instance().settings().setValue("colorloss", myColorLoss->getState()); - if(&instance().console()) + if(instance().hasConsole()) instance().console().toggleColorLoss(myColorLoss->getState()); // Fullscreen stretch setting