diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx index 2c0d86765..21345bb99 100644 --- a/src/common/RewindManager.cxx +++ b/src/common/RewindManager.cxx @@ -227,7 +227,7 @@ uInt32 RewindManager::unwindState(uInt32 numStates) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RewindManager::compressStates() { - uInt64 currentCycles = myOSystem.console().tia().cycles(); +// uInt64 currentCycles = myOSystem.console().tia().cycles(); double expectedCycles = myInterval * myFactor * (1 + myFactor); double maxError = 1; uInt32 idx = myStateList.size() - 2; @@ -302,7 +302,7 @@ string RewindManager::getUnitString(Int64 cycles) stringstream result; Int32 i; - cycles = abs(cycles); + cycles = std::abs(cycles); for(i = 0; i < NUM_UNITS - 1; ++i) { diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index f9ec7aa44..10342f8da 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -22,6 +22,7 @@ #include "Version.hxx" #include "OSystem.hxx" #include "FrameBuffer.hxx" +#include "EventHandler.hxx" #include "FSNode.hxx" #include "Settings.hxx" #include "DebuggerDialog.hxx" diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 900f064d8..762ec381b 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -20,6 +20,7 @@ class OSystem; class Console; +class EventHandler; class TiaInfoWidget; class TiaOutputWidget; class TiaZoomWidget; diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 898282016..9ede2a856 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -19,6 +19,7 @@ #include "Dialog.hxx" #include "Font.hxx" #include "Debugger.hxx" +#include "EventHandler.hxx" #include "FrameBuffer.hxx" #include "FBSurface.hxx" #include "DataGridWidget.hxx" diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index d856d1c70..b69b7fe93 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -19,6 +19,7 @@ #include "Widget.hxx" #include "Dialog.hxx" #include "Settings.hxx" +#include "EventHandler.hxx" #include "TabWidget.hxx" #include "TiaInfoWidget.hxx" #include "TiaOutputWidget.hxx" diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index e20c28841..5c8a0c8fc 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -20,6 +20,7 @@ #include "DiStella.hxx" #include "PackedBitArray.hxx" #include "Widget.hxx" +#include "EventHandler.hxx" #include "FBSurface.hxx" #include "Font.hxx" #include "ScrollBarWidget.hxx" diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index f4777e590..c884dfdd1 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -16,6 +16,7 @@ //============================================================================ #include "OSystem.hxx" +#include "EventHandler.hxx" #include "Widget.hxx" #include "ToggleWidget.hxx" diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 91fc08741..0f326c468 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -1008,11 +1008,11 @@ void Console::attachDebugger(Debugger& dbg) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Console::stateChanged(EventHandler::State state) +void Console::stateChanged(EventHandlerState state) { // For now, only the CompuMate cares about state changes if(myCMHandler) - myCMHandler->enableKeyHandling(state == EventHandler::S_EMULATE); + myCMHandler->enableKeyHandling(state == EventHandlerState::EMULATION); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index 26e4e8b59..695f5aefc 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -34,6 +34,7 @@ class Debugger; #include "TIATypes.hxx" #include "FrameBuffer.hxx" #include "Serializable.hxx" +#include "EventHandlerConstants.hxx" #include "NTSCFilter.hxx" #include "frame-manager/AbstractFrameManager.hxx" @@ -184,7 +185,7 @@ class Console : public Serializable /** Informs the Console of a change in EventHandler state. */ - void stateChanged(EventHandler::State state); + void stateChanged(EventHandlerState state); public: /** diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index f2f9c73f7..6b3161d1a 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -29,6 +29,7 @@ #include "TIASurface.hxx" #include "FSNode.hxx" #include "Launcher.hxx" +#include "TimeMachine.hxx" #include "Menu.hxx" #include "OSystem.hxx" #include "Joystick.hxx" @@ -60,7 +61,7 @@ EventHandler::EventHandler(OSystem& osystem) : myOSystem(osystem), myOverlay(nullptr), - myState(S_NONE), + myState(EventHandlerState::NONE), myAllowAllDirectionsFlag(false), myFryingFlag(false), myUseCtrlKeyFlag(true), @@ -124,7 +125,7 @@ void EventHandler::initialize() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::reset(State state) +void EventHandler::reset(EventHandlerState state) { setEventState(state); myOSystem.state().reset(); @@ -213,7 +214,7 @@ void EventHandler::poll(uInt64 time) // Update controllers and console switches, and in general all other things // related to emulation - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) { myOSystem.console().riot().update(); @@ -294,31 +295,31 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state) myOSystem.frameBuffer().toggleFullscreen(); } // state rewinding must work in pause mode too - else if(myState == S_EMULATE || myState == S_PAUSE) + else if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE) { switch(key) { case KBDK_LEFT: // Alt-left(-shift) rewinds 1(10) states myOSystem.frameBuffer().setPauseDelay(); - setEventState(S_PAUSE); + setEventState(EventHandlerState::PAUSE); myOSystem.state().rewindState((kbdShift(mod) && state) ? 10 : 1); break; case KBDK_RIGHT: // Alt-right(-shift) unwinds 1(10) states myOSystem.frameBuffer().setPauseDelay(); - setEventState(S_PAUSE); + setEventState(EventHandlerState::PAUSE); myOSystem.state().unwindState((kbdShift(mod) && state) ? 10 : 1); break; case KBDK_DOWN: // Alt-down rewinds to start of list myOSystem.frameBuffer().setPauseDelay(); - setEventState(S_PAUSE); + setEventState(EventHandlerState::PAUSE); myOSystem.state().rewindState(1000); break; case KBDK_UP: // Alt-up rewinds to end of list myOSystem.frameBuffer().setPauseDelay(); - setEventState(S_PAUSE); + setEventState(EventHandlerState::PAUSE); myOSystem.state().unwindState(1000); break; @@ -328,7 +329,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state) } } // These only work when in emulation mode - if(!handled && myState == S_EMULATE) + if(!handled && myState == EventHandlerState::EMULATION) { handled = true; switch(key) @@ -538,7 +539,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state) handleEvent(Event::Quit, 1); } // These only work when in emulation mode - else if(myState == S_EMULATE) + else if(myState == EventHandlerState::EMULATION) { switch(key) { @@ -622,11 +623,11 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state) // Otherwise, let the event handler deal with it switch(myState) { - case S_EMULATE: + case EventHandlerState::EMULATION: handleEvent(myKeyTable[key][kEmulationMode], state); break; - case S_PAUSE: + case EventHandlerState::PAUSE: switch(myKeyTable[key][kEmulationMode]) { case Event::TakeSnapshot: @@ -650,7 +651,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state) void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel, int button) { // Determine which mode we're in, then send the event to the appropriate place - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) { if(!mySkipMouseMotion) { @@ -667,7 +668,7 @@ void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel, int void EventHandler::handleMouseButtonEvent(MouseButton b, int x, int y) { // Determine which mode we're in, then send the event to the appropriate place - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) { switch(b) { @@ -706,7 +707,7 @@ void EventHandler::handleJoyEvent(int stick, int button, uInt8 state) return; // Determine which mode we're in, then send the event to the appropriate place - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) handleEvent(joy->btnTable[button][kEmulationMode], state); else if(myOverlay) myOverlay->handleJoyEvent(stick, button, state); @@ -726,7 +727,7 @@ void EventHandler::handleJoyEvent(int stick, int button, uInt8 state) // The 'type-4' here refers to the fact that 'StellaJoystick::JT_2600DAPTOR_LEFT' // and 'StellaJoystick::JT_2600DAPTOR_RIGHT' are at index 4 and 5 in the JoyType // enum; subtracting four gives us Controller 0 and 1 - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) { switch(myOSystem.console().leftController().type()) { @@ -761,7 +762,7 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value) switch(joy->type) { case StellaJoystick::JT_REGULAR: - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) { // Every axis event has two associated values, negative and positive Event::Type eventAxisNeg = joy->axisTable[axis][0][kEmulationMode]; @@ -867,7 +868,7 @@ void EventHandler::handleJoyHatEvent(int stick, int hat, int value) // Preprocess all hat events, converting to Stella JoyHat type // Generate multiple equivalent hat events representing combined direction // when we get a diagonal hat event - if(myState == S_EMULATE) + if(myState == EventHandlerState::EMULATION) { handleEvent(joy->hatTable[hat][int(JoyHat::UP)][kEmulationMode], value & EVENT_HATUP_M); @@ -913,7 +914,7 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int) break; #if 0 case EVENT_WINDOW_MINIMIZED: - if(myState == S_EMULATE) enterMenuMode(S_MENU); + if(myState == EventHandlerState::EMULATION) enterMenuMode(EventHandlerState::OPTIONSMENU); break; #endif default: // handle other events as testing requires @@ -1001,8 +1002,8 @@ void EventHandler::handleEvent(Event::Type event, int state) return; case Event::LauncherMode: - if((myState == S_EMULATE || myState == S_CMDMENU || - myState == S_DEBUGGER) && state) + if((myState == EventHandlerState::EMULATION || myState == EventHandlerState::CMDMENU || + myState == EventHandlerState::DEBUGGER) && state) { // Go back to the launcher, or immediately quit if(myOSystem.settings().getBool("exitlauncher") || @@ -1218,34 +1219,34 @@ bool EventHandler::eventStateChange(Event::Type type) switch(type) { case Event::PauseMode: - if(myState == S_EMULATE) - setEventState(S_PAUSE); - else if(myState == S_PAUSE) - setEventState(S_EMULATE); + if(myState == EventHandlerState::EMULATION) + setEventState(EventHandlerState::PAUSE); + else if(myState == EventHandlerState::PAUSE) + setEventState(EventHandlerState::EMULATION); else handled = false; break; case Event::MenuMode: - if(myState == S_EMULATE) - enterMenuMode(S_MENU); + if(myState == EventHandlerState::EMULATION) + enterMenuMode(EventHandlerState::OPTIONSMENU); else handled = false; break; case Event::CmdMenuMode: - if(myState == S_EMULATE) - enterMenuMode(S_CMDMENU); - else if(myState == S_CMDMENU) + if(myState == EventHandlerState::EMULATION) + enterMenuMode(EventHandlerState::CMDMENU); + else if(myState == EventHandlerState::CMDMENU) leaveMenuMode(); else handled = false; break; case Event::DebuggerMode: - if(myState == S_EMULATE || myState == S_PAUSE) + if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE) enterDebugMode(); - else if(myState == S_DEBUGGER) + else if(myState == EventHandlerState::DEBUGGER) leaveDebugMode(); else handled = false; @@ -2068,7 +2069,7 @@ void EventHandler::setContinuousSnapshots(uInt32 interval) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::enterMenuMode(State state) +void EventHandler::enterMenuMode(EventHandlerState state) { setEventState(state); myOverlay->reStack(); @@ -2078,7 +2079,7 @@ void EventHandler::enterMenuMode(State state) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::leaveMenuMode() { - setEventState(S_EMULATE); + setEventState(EventHandlerState::EMULATION); myOSystem.sound().mute(false); } @@ -2086,7 +2087,7 @@ void EventHandler::leaveMenuMode() bool EventHandler::enterDebugMode() { #ifdef DEBUGGER_SUPPORT - if(myState == S_DEBUGGER || !myOSystem.hasConsole()) + if(myState == EventHandlerState::DEBUGGER || !myOSystem.hasConsole()) return false; // Make sure debugger starts in a consistent state @@ -2094,13 +2095,13 @@ bool EventHandler::enterDebugMode() // mode, since it takes care of locking the debugger state, which will // probably be modified below myOSystem.debugger().setStartState(); - setEventState(S_DEBUGGER); + setEventState(EventHandlerState::DEBUGGER); FBInitStatus fbstatus = myOSystem.createFrameBuffer(); if(fbstatus != FBInitStatus::Success) { myOSystem.debugger().setQuitState(); - setEventState(S_EMULATE); + setEventState(EventHandlerState::EMULATION); if(fbstatus == FBInitStatus::FailTooLarge) myOSystem.frameBuffer().showMessage("Debugger window too large for screen", MessagePosition::BottomCenter, true); @@ -2121,20 +2122,20 @@ void EventHandler::leaveDebugMode() { #ifdef DEBUGGER_SUPPORT // paranoia: this should never happen: - if(myState != S_DEBUGGER) + if(myState != EventHandlerState::DEBUGGER) return; // Make sure debugger quits in a consistent state myOSystem.debugger().setQuitState(); - setEventState(S_EMULATE); + setEventState(EventHandlerState::EMULATION); myOSystem.createFrameBuffer(); myOSystem.sound().mute(false); #endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::setEventState(State state) +void EventHandler::setEventState(EventHandlerState state) { myState = state; @@ -2146,7 +2147,7 @@ void EventHandler::setEventState(State state) // keyboard acts as one large joystick with many (single) buttons switch(myState) { - case S_EMULATE: + case EventHandlerState::EMULATION: myOverlay = nullptr; myOSystem.sound().mute(false); enableTextEvents(false); @@ -2154,36 +2155,41 @@ void EventHandler::setEventState(State state) myUseCtrlKeyFlag = false; break; - case S_PAUSE: + case EventHandlerState::PAUSE: myOverlay = nullptr; myOSystem.sound().mute(true); enableTextEvents(false); break; - case S_MENU: + case EventHandlerState::OPTIONSMENU: myOverlay = &myOSystem.menu(); enableTextEvents(true); break; - case S_CMDMENU: + case EventHandlerState::CMDMENU: myOverlay = &myOSystem.commandMenu(); enableTextEvents(true); break; - case S_LAUNCHER: + case EventHandlerState::TIMEMACHINE: + myOverlay = &myOSystem.timeMachine(); + enableTextEvents(true); + break; + + case EventHandlerState::LAUNCHER: myOverlay = &myOSystem.launcher(); enableTextEvents(true); myEvent.clear(); break; #ifdef DEBUGGER_SUPPORT - case S_DEBUGGER: + case EventHandlerState::DEBUGGER: myOverlay = &myOSystem.debugger(); enableTextEvents(true); break; #endif - default: + case EventHandlerState::NONE: myOverlay = nullptr; break; } diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 13dd55c36..a20620479 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -56,17 +56,6 @@ class EventHandler EventHandler(OSystem& osystem); virtual ~EventHandler(); - // Enumeration representing the different states of operation - enum State { - S_NONE, - S_EMULATE, - S_PAUSE, - S_LAUNCHER, - S_MENU, - S_CMDMENU, - S_DEBUGGER - }; - /** Returns the event object associated with this handler class. @@ -109,16 +98,16 @@ class EventHandler /** Returns the current state of the EventHandler - @return The State type + @return The EventHandlerState type */ - State state() const { return myState; } + EventHandlerState state() const { return myState; } /** Resets the state machine of the EventHandler to the defaults @param state The current state to set */ - void reset(State state); + void reset(EventHandlerState state); /** This method indicates that the system should terminate. @@ -131,7 +120,7 @@ class EventHandler @param enable Whether to use the mouse to emulate controllers Currently, this will be one of the following values: - 'always', 'analog', 'never' + 'always', 'analog', 'never' */ void setMouseControllerMode(const string& enable); @@ -163,7 +152,7 @@ class EventHandler return (mod & KBDM_SHIFT); } - void enterMenuMode(State state); + void enterMenuMode(EventHandlerState state); void leaveMenuMode(); bool enterDebugMode(); void leaveDebugMode(); @@ -519,7 +508,7 @@ class EventHandler */ bool eventIsAnalog(Event::Type event) const; - void setEventState(State state); + void setEventState(EventHandlerState state); private: // Structure used for action menu items @@ -547,7 +536,7 @@ class EventHandler Event::Type myComboTable[kComboSize][kEventsPerCombo]; // Indicates the current state of the system (ie, which mode is current) - State myState; + EventHandlerState myState; // Indicates whether the joystick emulates 'impossible' directions bool myAllowAllDirectionsFlag; diff --git a/src/emucore/EventHandlerConstants.hxx b/src/emucore/EventHandlerConstants.hxx index fee58c5f2..7b799a33b 100644 --- a/src/emucore/EventHandlerConstants.hxx +++ b/src/emucore/EventHandlerConstants.hxx @@ -18,6 +18,18 @@ #ifndef EVENTHANDLER_CONSTANTS_HXX #define EVENTHANDLER_CONSTANTS_HXX +// Enumeration representing the different states of operation +enum class EventHandlerState { + NONE, + EMULATION, + TIMEMACHINE, + PAUSE, + LAUNCHER, + OPTIONSMENU, + CMDMENU, + DEBUGGER +}; + enum class MouseButton { LBUTTONDOWN, LBUTTONUP, diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index ff0b12097..5045fbb8d 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -17,7 +17,6 @@ #include "bspf.hxx" -#include "CommandMenu.hxx" #include "Console.hxx" #include "EventHandler.hxx" #include "Event.hxx" @@ -28,6 +27,8 @@ #include "ConsoleFont.hxx" #include "Launcher.hxx" #include "Menu.hxx" +#include "CommandMenu.hxx" +#include "TimeMachine.hxx" #include "OSystem.hxx" #include "Settings.hxx" #include "TIA.hxx" @@ -205,8 +206,8 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, myScreenSize = mode.screen; // Inform TIA surface about new mode - if(myOSystem.eventHandler().state() != EventHandler::S_LAUNCHER && - myOSystem.eventHandler().state() != EventHandler::S_DEBUGGER) + if(myOSystem.eventHandler().state() != EventHandlerState::LAUNCHER && + myOSystem.eventHandler().state() != EventHandlerState::DEBUGGER) myTIASurface->initialize(myOSystem.console(), mode); // Did we get the requested fullscreen state? @@ -262,14 +263,14 @@ void FrameBuffer::update() invalidate(); switch(myOSystem.eventHandler().state()) { - case EventHandler::S_EMULATE: + case EventHandlerState::EMULATION: { // Run the console for one frame // Note that the debugger can cause a breakpoint to occur, which changes // the EventHandler state 'behind our back' - we need to check for that myOSystem.console().tia().update(); #ifdef DEBUGGER_SUPPORT - if(myOSystem.eventHandler().state() != EventHandler::S_EMULATE) break; + if(myOSystem.eventHandler().state() != EventHandlerState::EMULATION) break; #endif if(myOSystem.eventHandler().frying()) myOSystem.console().fry(); @@ -295,10 +296,10 @@ void FrameBuffer::update() myStatsMsg.surface->render(); } myPausedCount = 0; - break; // S_EMULATE + break; // EventHandlerState::EMULATION } - case EventHandler::S_PAUSE: + case EventHandlerState::PAUSE: { myTIASurface->render(); @@ -308,38 +309,45 @@ void FrameBuffer::update() myPausedCount = uInt32(7 * myOSystem.frameRate()); showMessage("Paused", MessagePosition::MiddleCenter); } - break; // S_PAUSE + break; // EventHandlerState::PAUSE } - case EventHandler::S_MENU: + case EventHandlerState::OPTIONSMENU: { myTIASurface->render(); myOSystem.menu().draw(true); - break; // S_MENU + break; // EventHandlerState::OPTIONSMENU } - case EventHandler::S_CMDMENU: + case EventHandlerState::CMDMENU: { myTIASurface->render(); myOSystem.commandMenu().draw(true); - break; // S_CMDMENU + break; // EventHandlerState::CMDMENU } - case EventHandler::S_LAUNCHER: + case EventHandlerState::TIMEMACHINE: + { + myTIASurface->render(); + myOSystem.timeMachine().draw(true); + break; // EventHandlerState::TIMEMACHINE + } + + case EventHandlerState::LAUNCHER: { myOSystem.launcher().draw(true); - break; // S_LAUNCHER + break; // EventHandlerState::LAUNCHER } #ifdef DEBUGGER_SUPPORT - case EventHandler::S_DEBUGGER: + case EventHandlerState::DEBUGGER: { myOSystem.debugger().draw(true); - break; // S_DEBUGGER + break; // EventHandlerState::DEBUGGER } #endif - default: + case EventHandlerState::NONE: return; } @@ -528,7 +536,7 @@ void FrameBuffer::setPalette(const uInt32* raw_palette) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBuffer::stateChanged(EventHandler::State state) +void FrameBuffer::stateChanged(EventHandlerState state) { // Make sure any onscreen messages are removed myMsg.enabled = false; @@ -545,8 +553,8 @@ void FrameBuffer::setFullscreen(bool enable) myScreenSize = mode.screen; // Inform TIA surface about new mode - if(myOSystem.eventHandler().state() != EventHandler::S_LAUNCHER && - myOSystem.eventHandler().state() != EventHandler::S_DEBUGGER) + if(myOSystem.eventHandler().state() != EventHandlerState::LAUNCHER && + myOSystem.eventHandler().state() != EventHandlerState::DEBUGGER) myTIASurface->initialize(myOSystem.console(), mode); // Did we get the requested fullscreen state? @@ -566,9 +574,9 @@ void FrameBuffer::toggleFullscreen() bool FrameBuffer::changeWindowedVidMode(int direction) { #ifdef WINDOWED_SUPPORT - EventHandler::State state = myOSystem.eventHandler().state(); - bool tiaMode = (state != EventHandler::S_DEBUGGER && - state != EventHandler::S_LAUNCHER); + EventHandlerState state = myOSystem.eventHandler().state(); + bool tiaMode = (state != EventHandlerState::DEBUGGER && + state != EventHandlerState::LAUNCHER); // Ignore any attempts to change video size while in invalid modes if(!tiaMode || fullScreen()) @@ -605,7 +613,7 @@ void FrameBuffer::setCursorState() // Always grab mouse in emulation (if enabled) and emulating a controller // that always uses the mouse bool emulation = - myOSystem.eventHandler().state() == EventHandler::S_EMULATE; + myOSystem.eventHandler().state() == EventHandlerState::EMULATION; bool analog = myOSystem.hasConsole() ? (myOSystem.eventHandler().controllerIsAnalog(Controller::Left) || myOSystem.eventHandler().controllerIsAnalog(Controller::Right)) : false; @@ -669,9 +677,9 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) // Check if zooming is allowed for this state (currently only allowed // for TIA screens) - EventHandler::State state = myOSystem.eventHandler().state(); - bool tiaMode = (state != EventHandler::S_DEBUGGER && - state != EventHandler::S_LAUNCHER); + EventHandlerState state = myOSystem.eventHandler().state(); + bool tiaMode = (state != EventHandlerState::DEBUGGER && + state != EventHandlerState::LAUNCHER); // TIA mode allows zooming at integral factors in windowed modes, // and also non-integral factors in fullscreen mode @@ -730,7 +738,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen) { - EventHandler::State state = myOSystem.eventHandler().state(); + EventHandlerState state = myOSystem.eventHandler().state(); if(fullscreen) { @@ -748,7 +756,7 @@ const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen) // Now select the best resolution depending on the state // UI modes (launcher and debugger) have only one supported resolution // so the 'current' one is the only valid one - if(state == EventHandler::S_DEBUGGER || state == EventHandler::S_LAUNCHER) + if(state == EventHandlerState::DEBUGGER || state == EventHandlerState::LAUNCHER) myCurrentModeList->setZoom(1); else myCurrentModeList->setZoom(myZoomMode); diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 0c8758608..9dabf2c80 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -30,11 +30,11 @@ namespace GUI { class Font; } -#include "EventHandler.hxx" #include "Rect.hxx" #include "Variant.hxx" #include "TIAConstants.hxx" #include "FrameBufferConstants.hxx" +#include "EventHandlerConstants.hxx" #include "bspf.hxx" // Contains all relevant info for the dimensions of a video screen @@ -261,7 +261,7 @@ class FrameBuffer /** Informs the Framebuffer of a change in EventHandler state. */ - void stateChanged(EventHandler::State state); + void stateChanged(EventHandlerState state); ////////////////////////////////////////////////////////////////////// // The following methods are system-specific and can/must be diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 2d7bd1fac..f473dd5af 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -47,7 +47,7 @@ #include "Menu.hxx" #include "CommandMenu.hxx" #include "Launcher.hxx" -#include "Rewinder.hxx" +#include "TimeMachine.hxx" #include "PNGLibrary.hxx" #include "Widget.hxx" #include "Console.hxx" @@ -140,8 +140,8 @@ bool OSystem::create() // Create menu and launcher GUI objects myMenu = make_unique