enhanced color switches

enhanced Stella version information
This commit is contained in:
thrust26 2023-11-04 17:37:29 +01:00
parent 341c6d860c
commit ece9d507d5
3 changed files with 55 additions and 17 deletions

View File

@ -1654,7 +1654,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
////////////////////////////////////////////////////////////////////////
// Events which relate to switches()
case Event::ConsoleColor:
if(pressed && !repeated)
if(pressed && !repeated && !checkUI())
{
myEvent.set(Event::ConsoleBlackWhite, 0);
myEvent.set(Event::ConsoleColor, 1);
@ -1663,7 +1663,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
}
return;
case Event::ConsoleBlackWhite:
if(pressed && !repeated)
if(pressed && !repeated && !checkUI())
{
myEvent.set(Event::ConsoleBlackWhite, 1);
myEvent.set(Event::ConsoleColor, 0);
@ -1672,7 +1672,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
}
return;
case Event::ConsoleColorToggle:
if(pressed && !repeated)
if(pressed && !repeated && !checkUI())
{
if(myOSystem.console().switches().tvColor())
{
@ -2822,6 +2822,30 @@ void EventHandler::exitEmulation(bool checkLauncher)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EventHandler::checkUI()
{
// Special entries to the UI
if(myEvent.get(Event::LeftJoystickFire) || myEvent.get(Event::RightJoystickFire))
{
if(myEvent.get(Event::LeftJoystickRight) || myEvent.get(Event::RightJoystickRight))
changeStateByEvent(Event::OptionsMenuMode);
else if(myEvent.get(Event::LeftJoystickLeft) || myEvent.get(Event::RightJoystickLeft))
changeStateByEvent(Event::TogglePauseMode);
else if(myEvent.get(Event::LeftJoystickUp) || myEvent.get(Event::RightJoystickUp))
{
myOSystem.createLauncher();
setState(EventHandlerState::LAUNCHER);
}
else if(myEvent.get(Event::LeftJoystickDown) || myEvent.get(Event::RightJoystickDown))
changeStateByEvent(Event::DebuggerMode);
else
changeStateByEvent(Event::CmdMenuMode);
return true;
}
return false;
}
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#elif defined(__GNUC__) || defined(__GNUG__)

View File

@ -481,6 +481,13 @@ class EventHandler
static int getEmulActionListIndex(int idx, const Event::EventSet& events);
static int getActionListIndex(int idx, Event::Group group);
/**
Check if UI shall be entered.
@return Whether the UI is entered or not
*/
bool checkUI();
private:
// Structure used for action menu items
struct ActionList {

View File

@ -530,22 +530,29 @@ string OSystem::createConsole(const FSNode& rom, string_view md5sum, bool newrom
myEventHandler->handleConsoleStartupEvents();
myConsole->riot().update();
#ifdef DEBUGGER_SUPPORT
if(mySettings->getBool("debug"))
myEventHandler->enterDebugMode();
#endif
#ifdef DEBUGGER_SUPPORT
if(mySettings->getBool("debug"))
myEventHandler->enterDebugMode();
#endif
if(!showmessage &&
settings().getBool(devSettings ? "dev.detectedinfo" : "plr.detectedinfo"))
{
ostringstream msg;
if(!showmessage)
if(settings().getBool(devSettings ? "dev.detectedinfo" : "plr.detectedinfo"))
{
ostringstream msg;
msg << myConsole->leftController().name() << "/" << myConsole->rightController().name()
<< " - " << myConsole->cartridge().detectedType()
<< (myConsole->cartridge().isPlusROM() ? " PlusROM " : "")
<< " - " << myConsole->getFormatString();
myFrameBuffer->showTextMessage(msg.str());
}
msg << myConsole->leftController().name() << "/" << myConsole->rightController().name()
<< " - " << myConsole->cartridge().detectedType()
<< (myConsole->cartridge().isPlusROM() ? " PlusROM " : "")
<< " - " << myConsole->getFormatString();
myFrameBuffer->showTextMessage(msg.str());
}
else if(!myLauncherUsed)
{
ostringstream msg;
msg << "Stella " << STELLA_VERSION;
myFrameBuffer->showTextMessage(msg.str());
}
// Check for first PlusROM start
if(myConsole->cartridge().isPlusROM())
{