Take power-on state into account during autodetection.

This commit is contained in:
Christian Speckner 2019-08-20 23:40:41 +02:00
parent d105a833b6
commit 09bd0f817e
3 changed files with 21 additions and 21 deletions

View File

@ -198,6 +198,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& 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();

View File

@ -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
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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;
}