From b1b1d87cfa8865737983f1540c633717bb661dab Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 2 Jun 2019 14:07:42 +0200 Subject: [PATCH] enhance Rewind/UnwindPause events --- src/common/PJoystickHandler.cxx | 2 +- src/common/PKeyboardHandler.cxx | 2 ++ src/emucore/Event.hxx | 2 +- src/emucore/EventHandler.cxx | 12 ++++++++---- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index b18c0973e..ad7016a6f 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -320,7 +320,7 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, setDefaultBtn(stick, 2, Event::CmdMenuMode); setDefaultBtn(stick, 3, Event::OptionsMenuMode); setDefaultBtn(stick, 4, Event::ExitMode); - setDefaultBtn(stick, 5, Event::Rewind); + setDefaultBtn(stick, 5, Event::RewindPause); setDefaultBtn(stick, 7, Event::ConsoleSelect); setDefaultBtn(stick, 8, Event::ConsoleReset); #endif diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index e9750169d..889c6117d 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -224,9 +224,11 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod setDefaultKey(Event::ToggleBits , KBDK_COMMA, MOD3); setDefaultKey(Event::ToggleFixedColors , KBDK_PERIOD, MOD3); + setDefaultKey(Event::RewindPause , KBDK_LEFT, KBDM_SHIFT); setDefaultKey(Event::Rewind1Menu , KBDK_LEFT, MOD3); setDefaultKey(Event::Rewind10Menu , KBDK_LEFT, KBDM_SHIFT | MOD3); setDefaultKey(Event::RewindAllMenu , KBDK_DOWN, MOD3); + setDefaultKey(Event::UnwindPause , KBDK_LEFT, KBDM_SHIFT); setDefaultKey(Event::Unwind1Menu , KBDK_RIGHT, MOD3); setDefaultKey(Event::Unwind10Menu , KBDK_RIGHT, KBDM_SHIFT | MOD3); setDefaultKey(Event::UnwindAllMenu , KBDK_UP, MOD3); diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index c95836977..0dffcafed 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -76,7 +76,7 @@ class Event ChangeState, LoadState, SaveState, TakeSnapshot, Quit, TogglePauseMode, OptionsMenuMode, CmdMenuMode, TimeMachineMode, DebuggerMode, ExitMode, Fry, VolumeDecrease, VolumeIncrease, SoundToggle, VidmodeDecrease, VidmodeIncrease, - Rewind, Unwind, + RewindPause, UnwindPause, UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown, UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir, diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index f2151d761..05c50eb86 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -639,12 +639,16 @@ void EventHandler::handleEvent(Event::Type event, bool pressed, bool repeated) myOSystem.frameBuffer().showMessage(myOSystem.state().rewindManager().loadAllStates()); return; - case Event::Rewind: + case Event::RewindPause: if (pressed) myOSystem.state().rewindStates(); + if (myState == EventHandlerState::EMULATION) + setState(EventHandlerState::PAUSE); return; - case Event::Unwind: + case Event::UnwindPause: if (pressed) myOSystem.state().unwindStates(); + if (myState == EventHandlerState::EMULATION) + setState(EventHandlerState::PAUSE); return; case Event::Rewind1Menu: @@ -1714,11 +1718,11 @@ EventHandler::ActionList EventHandler::ourEmulActionList[EMUL_ACTIONLIST_SIZE] = #endif { Event::ToggleTimeMachine, "Toggle 'Time Machine' mode", "" }, { Event::TimeMachineMode, "Toggle 'Time Machine' UI", "" }, - { Event::Rewind, "Rewind game one state", "" }, + { Event::RewindPause, "Rewind one state and enter pause mode", "" }, { Event::Rewind1Menu, "Rewind one state & enter TM UI", "" }, { Event::Rewind10Menu, "Rewind 10 states & enter TM UI", "" }, { Event::RewindAllMenu, "Rewind all states & enter TM UI", "" }, - { Event::Unwind, "Unwind game one state", "" }, + { Event::UnwindPause, "Unwind one state and enter pause mode", "" }, { Event::Unwind1Menu, "Unwind one state & enter TM UI", "" }, { Event::Unwind10Menu, "Unwind 10 states & enter TM UI", "" }, { Event::UnwindAllMenu, "Unwind all states & enter TM UI", "" },