diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 3d65f698c..58eef7d20 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -198,6 +198,7 @@ Console::Console(OSystem& osystem, unique_ptr& cart, // Reset the system to its power-on state mySystem->reset(); + myRiot->update(); // Finally, add remaining info about the console myConsoleInfo.CartName = myProperties.get(PropType::Cart_Name); @@ -239,7 +240,10 @@ void Console::autodetectFrameLayout(bool reset) FrameLayoutDetector frameLayoutDetector; myTIA->setFrameManager(&frameLayoutDetector); - if (reset) mySystem->reset(true); + if (reset) { + mySystem->reset(true); + myRiot->update(); + } for(int i = 0; i < 60; ++i) myTIA->update(); @@ -279,7 +283,10 @@ void Console::autodetectYStart(bool reset) ystartDetector.setLayout(myDisplayFormat == "PAL" ? FrameLayout::pal : FrameLayout::ntsc); myTIA->setFrameManager(&ystartDetector); - if (reset) mySystem->reset(true); + if (reset) { + mySystem->reset(true); + myRiot->update(); + } for (int i = 0; i < 80; i++) myTIA->update(); diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 716925cb5..df9a41edb 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -909,20 +909,14 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::handleConsoleStartupEvents() { - bool update = false; if(myOSystem.settings().getBool("holdreset")) - { handleEvent(Event::ConsoleReset); - update = true; - } + if(myOSystem.settings().getBool("holdselect")) - { handleEvent(Event::ConsoleSelect); - update = true; - } const string& holdjoy0 = myOSystem.settings().getString("holdjoy0"); - update = update || holdjoy0 != ""; + if(BSPF::containsIgnoreCase(holdjoy0, "U")) handleEvent(Event::JoystickZeroUp); if(BSPF::containsIgnoreCase(holdjoy0, "D")) @@ -935,7 +929,6 @@ void EventHandler::handleConsoleStartupEvents() handleEvent(Event::JoystickZeroFire); const string& holdjoy1 = myOSystem.settings().getString("holdjoy1"); - update = update || holdjoy1 != ""; if(BSPF::containsIgnoreCase(holdjoy1, "U")) handleEvent(Event::JoystickOneUp); if(BSPF::containsIgnoreCase(holdjoy1, "D")) @@ -946,14 +939,6 @@ void EventHandler::handleConsoleStartupEvents() handleEvent(Event::JoystickOneRight); if(BSPF::containsIgnoreCase(holdjoy1, "F")) handleEvent(Event::JoystickOneFire); - - if(update) - myOSystem.console().riot().update(); - -#ifdef DEBUGGER_SUPPORT - if(myOSystem.settings().getBool("debug")) - enterDebugMode(); -#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index ca3547bae..046613a73 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -64,6 +64,7 @@ #include "AudioSettings.hxx" #include "repository/KeyValueRepositoryNoop.hxx" #include "repository/KeyValueRepositoryConfigfile.hxx" +#include "M6532.hxx" #include "OSystem.hxx" @@ -377,6 +378,9 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum, // Create an instance of the 2600 game console ostringstream buf; + + myEventHandler->handleConsoleStartupEvents(); + try { closeConsole(); @@ -425,9 +429,13 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum, myFrameBuffer->setCursorState(); - // Also check if certain virtual buttons should be held down - // These must be checked each time a new console is being created myEventHandler->handleConsoleStartupEvents(); + myConsole->riot().update(); + + #ifdef DEBUGGER_SUPPORT + if(mySettings->getBool("debug")) + myEventHandler->enterDebugMode(); + #endif } return EmptyString; }