From 0215cda99110dabd19a3a8077ae78fbcb17fbb74 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Mon, 19 Aug 2019 09:33:21 +0200 Subject: [PATCH] pretty hacked and ugly fix for #501 --- src/emucore/Console.cxx | 6 +++++- src/emucore/EventHandler.cxx | 9 ++++++--- src/emucore/EventHandler.hxx | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 3d65f698c..e00a381f1 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -239,7 +239,11 @@ void Console::autodetectFrameLayout(bool reset) FrameLayoutDetector frameLayoutDetector; myTIA->setFrameManager(&frameLayoutDetector); - if (reset) mySystem->reset(true); + if(reset) + { + mySystem->reset(true); + myOSystem.eventHandler().handleConsoleStartupEvents(myRiot); + } for(int i = 0; i < 60; ++i) myTIA->update(); diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 716925cb5..e82475825 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -35,7 +35,6 @@ #include "RewindManager.hxx" #include "TimerManager.hxx" #include "Switches.hxx" -#include "M6532.hxx" #include "MouseControl.hxx" #include "PNGLibrary.hxx" #include "TIASurface.hxx" @@ -907,7 +906,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandler::handleConsoleStartupEvents() +void EventHandler::handleConsoleStartupEvents(const std::unique_ptr& riot) { bool update = false; if(myOSystem.settings().getBool("holdreset")) @@ -948,7 +947,11 @@ void EventHandler::handleConsoleStartupEvents() handleEvent(Event::JoystickOneFire); if(update) - myOSystem.console().riot().update(); + if(riot != nullptr) + // TJ: This is ugly! + riot->update(); + else + myOSystem.console().riot().update(); #ifdef DEBUGGER_SUPPORT if(myOSystem.settings().getBool("debug")) diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index daf267cc8..a3ce1f29f 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -34,6 +34,7 @@ class PhysicalJoystick; #include "PJoystickHandler.hxx" #include "Variant.hxx" #include "bspf.hxx" +#include "M6532.hxx" /** This class takes care of event remapping and dispatching for the @@ -147,7 +148,7 @@ class EventHandler Handle events that must be processed each time a new console is created. Typically, these are events set by commandline arguments. */ - void handleConsoleStartupEvents(); + void handleConsoleStartupEvents(const std::unique_ptr& riot = nullptr); bool frying() const { return myFryingFlag; }