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() // Events which relate to switches()
case Event::ConsoleColor: case Event::ConsoleColor:
if(pressed && !repeated) if(pressed && !repeated && !checkUI())
{ {
myEvent.set(Event::ConsoleBlackWhite, 0); myEvent.set(Event::ConsoleBlackWhite, 0);
myEvent.set(Event::ConsoleColor, 1); myEvent.set(Event::ConsoleColor, 1);
@ -1663,7 +1663,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
} }
return; return;
case Event::ConsoleBlackWhite: case Event::ConsoleBlackWhite:
if(pressed && !repeated) if(pressed && !repeated && !checkUI())
{ {
myEvent.set(Event::ConsoleBlackWhite, 1); myEvent.set(Event::ConsoleBlackWhite, 1);
myEvent.set(Event::ConsoleColor, 0); myEvent.set(Event::ConsoleColor, 0);
@ -1672,7 +1672,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
} }
return; return;
case Event::ConsoleColorToggle: case Event::ConsoleColorToggle:
if(pressed && !repeated) if(pressed && !repeated && !checkUI())
{ {
if(myOSystem.console().switches().tvColor()) 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__) #if defined(__clang__)
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#elif defined(__GNUC__) || defined(__GNUG__) #elif defined(__GNUC__) || defined(__GNUG__)

View File

@ -481,6 +481,13 @@ class EventHandler
static int getEmulActionListIndex(int idx, const Event::EventSet& events); static int getEmulActionListIndex(int idx, const Event::EventSet& events);
static int getActionListIndex(int idx, Event::Group group); 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: private:
// Structure used for action menu items // Structure used for action menu items
struct ActionList { struct ActionList {

View File

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