More 'using enum' in places where it seems appropriate.

This commit is contained in:
Stephen Anthony 2024-05-12 18:24:55 -02:30
parent bff2fdd817
commit cd1095b0b6
13 changed files with 170 additions and 303 deletions

View File

@ -65,6 +65,7 @@ class FSNodeFactory
default: default:
return nullptr; return nullptr;
} }
return nullptr;
} }
private: private:

View File

@ -65,18 +65,11 @@ string CartridgeBUSInfoWidget::describeBUSVersion(CartridgeBUS::BUSSubtype subty
{ {
switch(subtype) switch(subtype)
{ {
case CartridgeBUS::BUSSubtype::BUS0: using enum CartridgeBUS::BUSSubtype;
return "BUS (v0)"; case BUS0: return "BUS (v0)";
case BUS1: return "BUS (v1)";
case CartridgeBUS::BUSSubtype::BUS1: case BUS2: return "BUS (v2)";
return "BUS (v1)"; case BUS3: return "BUS (v3)";
default: throw runtime_error("unreachable");
case CartridgeBUS::BUSSubtype::BUS2:
return "BUS (v2)";
case CartridgeBUS::BUSSubtype::BUS3:
return "BUS (v3)";
default:
throw runtime_error("unreachable");
} }
} }

View File

@ -61,19 +61,11 @@ string CartridgeCDFInfoWidget::describeCDFVersion(CartridgeCDF::CDFSubtype subty
{ {
switch(subtype) switch(subtype)
{ {
case CartridgeCDF::CDFSubtype::CDF0: using enum CartridgeCDF::CDFSubtype;
return "CDF (v0)"; case CDF0: return "CDF (v0)";
case CDF1: return "CDF (v1)";
case CartridgeCDF::CDFSubtype::CDF1: case CDFJ: return "CDFJ";
return "CDF (v1)"; case CDFJplus: return "CDFJ+";
default: throw runtime_error("unreachable");
case CartridgeCDF::CDFSubtype::CDFJ:
return "CDFJ";
case CartridgeCDF::CDFSubtype::CDFJplus:
return "CDFJ+";
default:
throw runtime_error("unreachable");
} }
} }

View File

@ -517,20 +517,12 @@ string CartridgeCDFWidget::describeCDFVersion(CartridgeCDF::CDFSubtype subtype)
{ {
switch(subtype) switch(subtype)
{ {
case CartridgeCDF::CDFSubtype::CDF0: using enum CartridgeCDF::CDFSubtype;
return "CDF (v0)"; case CDF0: return "CDF (v0)";
case CDF1: return "CDF (v1)";
case CartridgeCDF::CDFSubtype::CDF1: case CDFJ: return "CDFJ";
return "CDF (v1)"; case CDFJplus: return "CDFJ+";
default: throw runtime_error("unreachable");
case CartridgeCDF::CDFSubtype::CDFJ:
return "CDFJ";
case CartridgeCDF::CDFSubtype::CDFJplus:
return "CDFJ+";
default:
throw runtime_error("unreachable");
} }
} }

View File

@ -63,15 +63,16 @@ void DelayQueueWidget::loadConfig() {
const int delay = delayQueueIterator->delay(); const int delay = delayQueueIterator->delay();
switch (address) { switch (address) {
case TIA::DummyRegisters::shuffleP0: using enum TIA::DummyRegisters;
case shuffleP0:
ss << delay << " clk, shuffle GRP0"; ss << delay << " clk, shuffle GRP0";
break; break;
case TIA::DummyRegisters::shuffleP1: case shuffleP1:
ss << delay << " clk, shuffle GRP1"; ss << delay << " clk, shuffle GRP1";
break; break;
case TIA::DummyRegisters::shuffleBL: case shuffleBL:
ss << delay << " clk, shuffle ENABL"; ss << delay << " clk, shuffle ENABL";
break; break;

View File

@ -54,24 +54,25 @@ void QuadTariWidget::addController(GuiObject* boss, int x, int y,
x += second ? _fontWidth * 10 : 0; x += second ? _fontWidth * 10 : 0;
switch(controller.type()) switch(controller.type())
{ {
case Controller::Type::Joystick: using enum Controller::Type;
case Joystick:
x += _fontWidth * 2; x += _fontWidth * 2;
widget = new JoystickWidget(boss, _font, x, y, controller, true); widget = new JoystickWidget(boss, _font, x, y, controller, true);
break; break;
case Controller::Type::Driving: case Driving:
widget = new DrivingWidget(boss, _font, x, y, controller, true); widget = new DrivingWidget(boss, _font, x, y, controller, true);
break; break;
case Controller::Type::Paddles: case Paddles:
widget = new PaddleWidget(boss, _font, x, y, controller, true, second); widget = new PaddleWidget(boss, _font, x, y, controller, true, second);
break; break;
case Controller::Type::AtariVox: case AtariVox:
widget = new AtariVoxWidget(boss, _font, x, y, controller, true); widget = new AtariVoxWidget(boss, _font, x, y, controller, true);
break; break;
case Controller::Type::SaveKey: case SaveKey:
widget = new SaveKeyWidget(boss, _font, x, y, controller, true); widget = new SaveKeyWidget(boss, _font, x, y, controller, true);
break; break;

View File

@ -559,37 +559,24 @@ RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& font,
{ {
switch(controller.type()) switch(controller.type())
{ {
case Controller::Type::AmigaMouse: using enum Controller::Type;
return new AmigaMouseWidget(boss, font, x, y, controller); case AmigaMouse: return new AmigaMouseWidget(boss, font, x, y, controller);
case Controller::Type::AtariMouse: case AtariMouse: return new AtariMouseWidget(boss, font, x, y, controller);
return new AtariMouseWidget(boss, font, x, y, controller); case AtariVox: return new AtariVoxWidget(boss, font, x, y, controller);
case Controller::Type::AtariVox: case BoosterGrip: return new BoosterWidget(boss, font, x, y, controller);
return new AtariVoxWidget(boss, font, x, y, controller); case Driving: return new DrivingWidget(boss, font, x, y, controller);
case Controller::Type::BoosterGrip: case Genesis: return new GenesisWidget(boss, font, x, y, controller);
return new BoosterWidget(boss, font, x, y, controller); case Joy2BPlus: return new Joy2BPlusWidget(boss, font, x, y, controller);
case Controller::Type::Driving: case Joystick: return new JoystickWidget(boss, font, x, y, controller);
return new DrivingWidget(boss, font, x, y, controller); case Keyboard: return new KeyboardWidget(boss, font, x, y, controller);
case Controller::Type::Genesis: // case KidVid: // TODO - implement this
return new GenesisWidget(boss, font, x, y, controller); // case MindLink: // TODO - implement this
case Controller::Type::Joy2BPlus: // case Lightgun: // TODO - implement this
return new Joy2BPlusWidget(boss, font, x, y, controller); case QuadTari: return new QuadTariWidget(boss, font, x, y, controller);
case Controller::Type::Joystick: case Paddles: return new PaddleWidget(boss, font, x, y, controller);
return new JoystickWidget(boss, font, x, y, controller); case SaveKey: return new SaveKeyWidget(boss, font, x, y, controller);
case Controller::Type::Keyboard: case TrakBall: return new TrakBallWidget(boss, font, x, y, controller);
return new KeyboardWidget(boss, font, x, y, controller); default: return new NullControlWidget(boss, font, x, y, controller);
// case Controller::Type::KidVid: // TODO - implement this
// case Controller::Type::MindLink: // TODO - implement this
// case Controller::Type::Lightgun: // TODO - implement this
case Controller::Type::QuadTari:
return new QuadTariWidget(boss, font, x, y, controller);
case Controller::Type::Paddles:
return new PaddleWidget(boss, font, x, y, controller);
case Controller::Type::SaveKey:
return new SaveKeyWidget(boss, font, x, y, controller);
case Controller::Type::TrakBall:
return new TrakBallWidget(boss, font, x, y, controller);
default:
return new NullControlWidget(boss, font, x, y, controller);
} }
} }

View File

@ -42,20 +42,12 @@ namespace {
Thumbulator::ConfigureFor thumulatorConfiguration(CartridgeCDF::CDFSubtype subtype) Thumbulator::ConfigureFor thumulatorConfiguration(CartridgeCDF::CDFSubtype subtype)
{ {
switch (subtype) { switch (subtype) {
case CartridgeCDF::CDFSubtype::CDF0: using enum CartridgeCDF::CDFSubtype;
return Thumbulator::ConfigureFor::CDF; case CDF0: return Thumbulator::ConfigureFor::CDF;
case CDF1: return Thumbulator::ConfigureFor::CDF1;
case CartridgeCDF::CDFSubtype::CDF1: case CDFJ: return Thumbulator::ConfigureFor::CDFJ;
return Thumbulator::ConfigureFor::CDF1; case CDFJplus: return Thumbulator::ConfigureFor::CDFJplus;
default: throw runtime_error("unreachable");
case CartridgeCDF::CDFSubtype::CDFJ:
return Thumbulator::ConfigureFor::CDFJ;
case CartridgeCDF::CDFSubtype::CDFJplus:
return Thumbulator::ConfigureFor::CDFJplus;
default:
throw runtime_error("unreachable");
} }
} }
} // namespace } // namespace
@ -886,14 +878,14 @@ uInt32 CartridgeCDF::romSize() const
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartDebugWidget* CartridgeCDF::debugWidget(GuiObject* boss, const GUI::Font& lfont, CartDebugWidget* CartridgeCDF::debugWidget(GuiObject* boss,
const GUI::Font& nfont, int x, int y, int w, int h) const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h)
{ {
return new CartridgeCDFWidget(boss, lfont, nfont, x, y, w, h, *this); return new CartridgeCDFWidget(boss, lfont, nfont, x, y, w, h, *this);
} }
CartDebugWidget* CartridgeCDF::infoWidget(GuiObject* boss, const GUI::Font& lfont, CartDebugWidget* CartridgeCDF::infoWidget(GuiObject* boss,
const GUI::Font& nfont, int x, int y, int w, int h) const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h)
{ {
return new CartridgeCDFInfoWidget(boss, lfont, nfont, x, y, w, h, *this); return new CartridgeCDFInfoWidget(boss, lfont, nfont, x, y, w, h, *this);
} }

View File

@ -109,49 +109,50 @@ unique_ptr<Cartridge> CartCreator::create(const FSNode& file,
int numMultiRoms = 0; int numMultiRoms = 0;
switch(type) switch(type)
{ {
case Bankswitch::Type::_2IN1: using enum Bankswitch::Type;
case _2IN1:
numMultiRoms = 2; numMultiRoms = 2;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 2 * 2_KB || size == 2 * 4_KB || size == 2 * 8_KB || size == 2 * 16_KB || size == 2 * 32_KB); validMultiSize = (size == 2 * 2_KB || size == 2 * 4_KB || size == 2 * 8_KB || size == 2 * 16_KB || size == 2 * 32_KB);
break; break;
case Bankswitch::Type::_4IN1: case _4IN1:
numMultiRoms = 4; numMultiRoms = 4;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 4 * 2_KB || size == 4 * 4_KB || size == 4 * 8_KB || size == 4 * 16_KB); validMultiSize = (size == 4 * 2_KB || size == 4 * 4_KB || size == 4 * 8_KB || size == 4 * 16_KB);
break; break;
case Bankswitch::Type::_8IN1: case _8IN1:
numMultiRoms = 8; numMultiRoms = 8;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 8 * 2_KB || size == 8 * 4_KB || size == 8 * 8_KB); validMultiSize = (size == 8 * 2_KB || size == 8 * 4_KB || size == 8 * 8_KB);
break; break;
case Bankswitch::Type::_16IN1: case _16IN1:
numMultiRoms = 16; numMultiRoms = 16;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 16 * 2_KB || size == 16 * 4_KB || size == 16 * 8_KB); validMultiSize = (size == 16 * 2_KB || size == 16 * 4_KB || size == 16 * 8_KB);
break; break;
case Bankswitch::Type::_32IN1: case _32IN1:
numMultiRoms = 32; numMultiRoms = 32;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 32 * 2_KB || size == 32 * 4_KB); validMultiSize = (size == 32 * 2_KB || size == 32 * 4_KB);
break; break;
case Bankswitch::Type::_64IN1: case _64IN1:
numMultiRoms = 64; numMultiRoms = 64;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 64 * 2_KB || size == 64 * 4_KB); validMultiSize = (size == 64 * 2_KB || size == 64 * 4_KB);
break; break;
case Bankswitch::Type::_128IN1: case _128IN1:
numMultiRoms = 128; numMultiRoms = 128;
// Make sure we have a valid sized image // Make sure we have a valid sized image
validMultiSize = (size == 128 * 2_KB || size == 128 * 4_KB); validMultiSize = (size == 128 * 2_KB || size == 128 * 4_KB);
break; break;
case Bankswitch::Type::_MVC: case _MVC:
cartridge = make_unique<CartridgeMVC>(file.getPath(), size, md5, settings); cartridge = make_unique<CartridgeMVC>(file.getPath(), size, md5, settings);
break; break;
@ -231,100 +232,54 @@ CartCreator::createFromImage(const ByteBuffer& image, size_t size,
// We should know the cart's type by now so let's create it // We should know the cart's type by now so let's create it
switch(type) switch(type)
{ {
case Bankswitch::Type::_03E0: using enum Bankswitch::Type;
return make_unique<Cartridge03E0>(image, size, md5, settings); case _03E0: return make_unique<Cartridge03E0>(image, size, md5, settings);
case Bankswitch::Type::_0840: case _0840: return make_unique<Cartridge0840>(image, size, md5, settings);
return make_unique<Cartridge0840>(image, size, md5, settings); case _0FA0: return make_unique<Cartridge0FA0>(image, size, md5, settings);
case Bankswitch::Type::_0FA0: case _2K: return make_unique<Cartridge2K>(image, size, md5, settings);
return make_unique<Cartridge0FA0>(image, size, md5, settings); case _3E: return make_unique<Cartridge3E>(image, size, md5, settings);
case Bankswitch::Type::_2K: case _3EX: return make_unique<Cartridge3EX>(image, size, md5, settings);
return make_unique<Cartridge2K>(image, size, md5, settings); case _3EP: return make_unique<Cartridge3EPlus>(image, size, md5, settings);
case Bankswitch::Type::_3E: case _3F: return make_unique<Cartridge3F>(image, size, md5, settings);
return make_unique<Cartridge3E>(image, size, md5, settings); case _4A50: return make_unique<Cartridge4A50>(image, size, md5, settings);
case Bankswitch::Type::_3EX: case _4K: return make_unique<Cartridge4K>(image, size, md5, settings);
return make_unique<Cartridge3EX>(image, size, md5, settings); case _4KSC: return make_unique<Cartridge4KSC>(image, size, md5, settings);
case Bankswitch::Type::_3EP: case _AR: return make_unique<CartridgeAR>(image, size, md5, settings);
return make_unique<Cartridge3EPlus>(image, size, md5, settings); case _BF: return make_unique<CartridgeBF>(image, size, md5, settings);
case Bankswitch::Type::_3F: case _BFSC: return make_unique<CartridgeBFSC>(image, size, md5, settings);
return make_unique<Cartridge3F>(image, size, md5, settings); case _BUS: return make_unique<CartridgeBUS>(image, size, md5, settings);
case Bankswitch::Type::_4A50: case _CDF: return make_unique<CartridgeCDF>(image, size, md5, settings);
return make_unique<Cartridge4A50>(image, size, md5, settings); case _CM: return make_unique<CartridgeCM>(image, size, md5, settings);
case Bankswitch::Type::_4K: case _CTY: return make_unique<CartridgeCTY>(image, size, md5, settings);
return make_unique<Cartridge4K>(image, size, md5, settings); case _CV: return make_unique<CartridgeCV>(image, size, md5, settings);
case Bankswitch::Type::_4KSC: case _DF: return make_unique<CartridgeDF>(image, size, md5, settings);
return make_unique<Cartridge4KSC>(image, size, md5, settings); case _DFSC: return make_unique<CartridgeDFSC>(image, size, md5, settings);
case Bankswitch::Type::_AR: case _DPC: return make_unique<CartridgeDPC>(image, size, md5, settings);
return make_unique<CartridgeAR>(image, size, md5, settings); case _DPCP: return make_unique<CartridgeDPCPlus>(image, size, md5, settings);
case Bankswitch::Type::_BF: case _E0: return make_unique<CartridgeE0>(image, size, md5, settings);
return make_unique<CartridgeBF>(image, size, md5, settings); case _E7: return make_unique<CartridgeE7>(image, size, md5, settings);
case Bankswitch::Type::_BFSC: case _EF: return make_unique<CartridgeEF>(image, size, md5, settings);
return make_unique<CartridgeBFSC>(image, size, md5, settings); case _EFSC: return make_unique<CartridgeEFSC>(image, size, md5, settings);
case Bankswitch::Type::_BUS: case _F0: return make_unique<CartridgeF0>(image, size, md5, settings);
return make_unique<CartridgeBUS>(image, size, md5, settings); case _F4: return make_unique<CartridgeF4>(image, size, md5, settings);
case Bankswitch::Type::_CDF: case _F4SC: return make_unique<CartridgeF4SC>(image, size, md5, settings);
return make_unique<CartridgeCDF>(image, size, md5, settings); case _F6: return make_unique<CartridgeF6>(image, size, md5, settings);
case Bankswitch::Type::_CM: case _F6SC: return make_unique<CartridgeF6SC>(image, size, md5, settings);
return make_unique<CartridgeCM>(image, size, md5, settings); case _F8: return make_unique<CartridgeF8>(image, size, md5, settings);
case Bankswitch::Type::_CTY: case _F8SC: return make_unique<CartridgeF8SC>(image, size, md5, settings);
return make_unique<CartridgeCTY>(image, size, md5, settings); case _FA: return make_unique<CartridgeFA>(image, size, md5, settings);
case Bankswitch::Type::_CV: case _FA2: return make_unique<CartridgeFA2>(image, size, md5, settings);
return make_unique<CartridgeCV>(image, size, md5, settings); case _FC: return make_unique<CartridgeFC>(image, size, md5, settings);
case Bankswitch::Type::_DF: case _FE: return make_unique<CartridgeFE>(image, size, md5, settings, size);
return make_unique<CartridgeDF>(image, size, md5, settings); case _GL: return make_unique<CartridgeGL>(image, size, md5, settings);
case Bankswitch::Type::_DFSC: case _MDM: return make_unique<CartridgeMDM>(image, size, md5, settings);
return make_unique<CartridgeDFSC>(image, size, md5, settings); case _UA: return make_unique<CartridgeUA>(image, size, md5, settings);
case Bankswitch::Type::_DPC: case _UASW: return make_unique<CartridgeUA>(image, size, md5, settings, true);
return make_unique<CartridgeDPC>(image, size, md5, settings); case _SB: return make_unique<CartridgeSB>(image, size, md5, settings);
case Bankswitch::Type::_DPCP: case _TVBOY:return make_unique<CartridgeTVBoy>(image, size, md5, settings);
return make_unique<CartridgeDPCPlus>(image, size, md5, settings); case _WD: [[fallthrough]];
case Bankswitch::Type::_E0: case _WDSW: return make_unique<CartridgeWD>(image, size, md5, settings);
return make_unique<CartridgeE0>(image, size, md5, settings); case _X07: return make_unique<CartridgeX07>(image, size, md5, settings);
case Bankswitch::Type::_E7: default: return nullptr; // The remaining types have already been handled
return make_unique<CartridgeE7>(image, size, md5, settings);
case Bankswitch::Type::_EF:
return make_unique<CartridgeEF>(image, size, md5, settings);
case Bankswitch::Type::_EFSC:
return make_unique<CartridgeEFSC>(image, size, md5, settings);
case Bankswitch::Type::_F0:
return make_unique<CartridgeF0>(image, size, md5, settings);
case Bankswitch::Type::_F4:
return make_unique<CartridgeF4>(image, size, md5, settings);
case Bankswitch::Type::_F4SC:
return make_unique<CartridgeF4SC>(image, size, md5, settings);
case Bankswitch::Type::_F6:
return make_unique<CartridgeF6>(image, size, md5, settings);
case Bankswitch::Type::_F6SC:
return make_unique<CartridgeF6SC>(image, size, md5, settings);
case Bankswitch::Type::_F8:
return make_unique<CartridgeF8>(image, size, md5, settings);
case Bankswitch::Type::_F8SC:
return make_unique<CartridgeF8SC>(image, size, md5, settings);
case Bankswitch::Type::_FA:
return make_unique<CartridgeFA>(image, size, md5, settings);
case Bankswitch::Type::_FA2:
return make_unique<CartridgeFA2>(image, size, md5, settings);
case Bankswitch::Type::_FC:
return make_unique<CartridgeFC>(image, size, md5, settings);
case Bankswitch::Type::_FE:
return make_unique<CartridgeFE>(image, size, md5, settings, size);
case Bankswitch::Type::_GL:
return make_unique<CartridgeGL>(image, size, md5, settings);
case Bankswitch::Type::_MDM:
return make_unique<CartridgeMDM>(image, size, md5, settings);
case Bankswitch::Type::_UA:
return make_unique<CartridgeUA>(image, size, md5, settings);
case Bankswitch::Type::_UASW:
return make_unique<CartridgeUA>(image, size, md5, settings, true);
case Bankswitch::Type::_SB:
return make_unique<CartridgeSB>(image, size, md5, settings);
case Bankswitch::Type::_TVBOY:
return make_unique<CartridgeTVBoy>(image, size, md5, settings);
case Bankswitch::Type::_WD:
case Bankswitch::Type::_WDSW:
return make_unique<CartridgeWD>(image, size, md5, settings);
case Bankswitch::Type::_X07:
return make_unique<CartridgeX07>(image, size, md5, settings);
default:
return nullptr; // The remaining types have already been handled
} }
} }

View File

@ -2262,47 +2262,21 @@ StringList EventHandler::getActionList(Event::Group group)
{ {
switch(group) switch(group)
{ {
case Event::Group::Menu: using enum Event::Group;
return getActionList(EventMode::kMenuMode); case Menu: return getActionList(EventMode::kMenuMode);
case Emulation: return getActionList(EventMode::kEmulationMode);
case Event::Group::Emulation: case Misc: return getActionList(MiscEvents);
return getActionList(EventMode::kEmulationMode); case AudioVideo: return getActionList(AudioVideoEvents);
case States: return getActionList(StateEvents);
case Event::Group::Misc: case Console: return getActionList(ConsoleEvents);
return getActionList(MiscEvents); case Joystick: return getActionList(JoystickEvents);
case Paddles: return getActionList(PaddlesEvents);
case Event::Group::AudioVideo: case Keyboard: return getActionList(KeyboardEvents);
return getActionList(AudioVideoEvents); case Driving: return getActionList(DrivingEvents);
case Devices: return getActionList(DevicesEvents);
case Event::Group::States: case Debug: return getActionList(DebugEvents);
return getActionList(StateEvents); case Combo: return getActionList(ComboEvents);
default: return {}; // ToDo
case Event::Group::Console:
return getActionList(ConsoleEvents);
case Event::Group::Joystick:
return getActionList(JoystickEvents);
case Event::Group::Paddles:
return getActionList(PaddlesEvents);
case Event::Group::Keyboard:
return getActionList(KeyboardEvents);
case Event::Group::Driving:
return getActionList(DrivingEvents);
case Event::Group::Devices:
return getActionList(DevicesEvents);
case Event::Group::Debug:
return getActionList(DebugEvents);
case Event::Group::Combo:
return getActionList(ComboEvents);
default:
return {}; // ToDo
} }
} }
@ -2438,47 +2412,21 @@ int EventHandler::getActionListIndex(int idx, Event::Group group)
{ {
switch(group) switch(group)
{ {
case Event::Group::Menu: using enum Event::Group;
return idx; case Menu: return idx;
case Emulation: return idx;
case Event::Group::Emulation: case Misc: return getEmulActionListIndex(idx, MiscEvents);
return idx; case AudioVideo: return getEmulActionListIndex(idx, AudioVideoEvents);
case States: return getEmulActionListIndex(idx, StateEvents);
case Event::Group::Misc: case Console: return getEmulActionListIndex(idx, ConsoleEvents);
return getEmulActionListIndex(idx, MiscEvents); case Joystick: return getEmulActionListIndex(idx, JoystickEvents);
case Paddles: return getEmulActionListIndex(idx, PaddlesEvents);
case Event::Group::AudioVideo: case Keyboard: return getEmulActionListIndex(idx, KeyboardEvents);
return getEmulActionListIndex(idx, AudioVideoEvents); case Driving: return getEmulActionListIndex(idx, DrivingEvents);
case Devices: return getEmulActionListIndex(idx, DevicesEvents);
case Event::Group::States: case Debug: return getEmulActionListIndex(idx, DebugEvents);
return getEmulActionListIndex(idx, StateEvents); case Combo: return getEmulActionListIndex(idx, ComboEvents);
default: return -1;
case Event::Group::Console:
return getEmulActionListIndex(idx, ConsoleEvents);
case Event::Group::Joystick:
return getEmulActionListIndex(idx, JoystickEvents);
case Event::Group::Paddles:
return getEmulActionListIndex(idx, PaddlesEvents);
case Event::Group::Keyboard:
return getEmulActionListIndex(idx, KeyboardEvents);
case Event::Group::Driving:
return getEmulActionListIndex(idx, DrivingEvents);
case Event::Group::Devices:
return getEmulActionListIndex(idx, DevicesEvents);
case Event::Group::Debug:
return getEmulActionListIndex(idx, DebugEvents);
case Event::Group::Combo:
return getEmulActionListIndex(idx, ComboEvents);
default:
return -1;
} }
} }

View File

@ -914,10 +914,11 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
// Handle the dispatch result // Handle the dispatch result
switch (dispatchResult.getStatus()) { switch (dispatchResult.getStatus()) {
case DispatchResult::Status::ok: using enum DispatchResult::Status;
case ok:
break; break;
case DispatchResult::Status::debugger: case debugger:
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myDebugger->start( myDebugger->start(
dispatchResult.getMessage(), dispatchResult.getMessage(),
@ -929,7 +930,7 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
break; break;
case DispatchResult::Status::fatal: case fatal:
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myDebugger->startWithFatalError(dispatchResult.getMessage()); myDebugger->startWithFatalError(dispatchResult.getMessage());
#else #else

View File

@ -429,11 +429,12 @@ void TIA::bindToControllers()
updateEmulation(); updateEmulation();
switch (pin) { switch (pin) {
case Controller::AnalogPin::Five: using enum Controller::AnalogPin;
case Five:
updateAnalogReadout(1); updateAnalogReadout(1);
break; break;
case Controller::AnalogPin::Nine: case Nine:
updateAnalogReadout(0); updateAnalogReadout(0);
break; break;
@ -448,11 +449,12 @@ void TIA::bindToControllers()
updateEmulation(); updateEmulation();
switch (pin) { switch (pin) {
case Controller::AnalogPin::Five: using enum Controller::AnalogPin;
case Five:
updateAnalogReadout(3); updateAnalogReadout(3);
break; break;
case Controller::AnalogPin::Nine: case Nine:
updateAnalogReadout(2); updateAnalogReadout(2);
break; break;

View File

@ -80,13 +80,14 @@ static void update_input()
GET_BITMASK(pad) GET_BITMASK(pad)
switch(input_type[0]) switch(input_type[0])
{ {
case Controller::Type::Driving: using enum Controller::Type;
case Driving:
MASK_EVENT(Event::LeftDrivingCCW, pad, RETRO_DEVICE_ID_JOYPAD_LEFT); MASK_EVENT(Event::LeftDrivingCCW, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
MASK_EVENT(Event::LeftDrivingCW, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT); MASK_EVENT(Event::LeftDrivingCW, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
MASK_EVENT(Event::LeftDrivingFire, pad, RETRO_DEVICE_ID_JOYPAD_B); MASK_EVENT(Event::LeftDrivingFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
break; break;
case Controller::Type::Paddles: case Paddles:
MASK_EVENT(Event::LeftPaddleAIncrease, pad, RETRO_DEVICE_ID_JOYPAD_LEFT); MASK_EVENT(Event::LeftPaddleAIncrease, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
MASK_EVENT(Event::LeftPaddleADecrease, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT); MASK_EVENT(Event::LeftPaddleADecrease, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
MASK_EVENT(Event::LeftPaddleAFire, pad, RETRO_DEVICE_ID_JOYPAD_B); MASK_EVENT(Event::LeftPaddleAFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
@ -100,7 +101,7 @@ static void update_input()
EVENT(Event::LeftPaddleBAnalog, input_state_cb(pad, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X)); EVENT(Event::LeftPaddleBAnalog, input_state_cb(pad, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X));
break; break;
case Controller::Type::Lightgun: case Lightgun:
{ {
// scale from -0x8000..0x7fff to image rect // scale from -0x8000..0x7fff to image rect
const Common::Rect& rect = stella.getImageRect(); const Common::Rect& rect = stella.getImageRect();
@ -114,14 +115,14 @@ static void update_input()
break; break;
} }
case Controller::Type::Joy2BPlus: case Joy2BPlus:
case Controller::Type::BoosterGrip: case BoosterGrip:
MASK_EVENT(Event::LeftJoystickFire9, pad, RETRO_DEVICE_ID_JOYPAD_Y); MASK_EVENT(Event::LeftJoystickFire9, pad, RETRO_DEVICE_ID_JOYPAD_Y);
[[fallthrough]]; [[fallthrough]];
case Controller::Type::Genesis: case Genesis:
MASK_EVENT(Event::LeftJoystickFire5, pad, RETRO_DEVICE_ID_JOYPAD_A); MASK_EVENT(Event::LeftJoystickFire5, pad, RETRO_DEVICE_ID_JOYPAD_A);
[[fallthrough]]; [[fallthrough]];
case Controller::Type::Joystick: case Joystick:
default: default:
MASK_EVENT(Event::LeftJoystickLeft, pad, RETRO_DEVICE_ID_JOYPAD_LEFT); MASK_EVENT(Event::LeftJoystickLeft, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
MASK_EVENT(Event::LeftJoystickRight, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT); MASK_EVENT(Event::LeftJoystickRight, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
@ -135,13 +136,14 @@ static void update_input()
switch(input_type[1]) switch(input_type[1])
{ {
case Controller::Type::Driving: using enum Controller::Type;
case Driving:
MASK_EVENT(Event::RightDrivingCCW, pad, RETRO_DEVICE_ID_JOYPAD_LEFT); MASK_EVENT(Event::RightDrivingCCW, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
MASK_EVENT(Event::RightDrivingCW, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT); MASK_EVENT(Event::RightDrivingCW, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
MASK_EVENT(Event::RightDrivingFire, pad, RETRO_DEVICE_ID_JOYPAD_B); MASK_EVENT(Event::RightDrivingFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
break; break;
case Controller::Type::Paddles: case Paddles:
MASK_EVENT(Event::RightPaddleAIncrease, pad, RETRO_DEVICE_ID_JOYPAD_LEFT); MASK_EVENT(Event::RightPaddleAIncrease, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
MASK_EVENT(Event::RightPaddleADecrease, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT); MASK_EVENT(Event::RightPaddleADecrease, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);
MASK_EVENT(Event::RightPaddleAFire, pad, RETRO_DEVICE_ID_JOYPAD_B); MASK_EVENT(Event::RightPaddleAFire, pad, RETRO_DEVICE_ID_JOYPAD_B);
@ -155,14 +157,14 @@ static void update_input()
EVENT(Event::RightPaddleBAnalog, input_state_cb(pad, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X)); EVENT(Event::RightPaddleBAnalog, input_state_cb(pad, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X));
break; break;
case Controller::Type::Joy2BPlus: case Joy2BPlus:
case Controller::Type::BoosterGrip: case BoosterGrip:
MASK_EVENT(Event::RightJoystickFire9, pad, RETRO_DEVICE_ID_JOYPAD_Y); MASK_EVENT(Event::RightJoystickFire9, pad, RETRO_DEVICE_ID_JOYPAD_Y);
[[fallthrough]]; [[fallthrough]];
case Controller::Type::Genesis: case Genesis:
MASK_EVENT(Event::RightJoystickFire5, pad, RETRO_DEVICE_ID_JOYPAD_A); MASK_EVENT(Event::RightJoystickFire5, pad, RETRO_DEVICE_ID_JOYPAD_A);
[[fallthrough]]; [[fallthrough]];
case Controller::Type::Joystick: case Joystick:
default: default:
MASK_EVENT(Event::RightJoystickLeft, pad, RETRO_DEVICE_ID_JOYPAD_LEFT); MASK_EVENT(Event::RightJoystickLeft, pad, RETRO_DEVICE_ID_JOYPAD_LEFT);
MASK_EVENT(Event::RightJoystickRight, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT); MASK_EVENT(Event::RightJoystickRight, pad, RETRO_DEVICE_ID_JOYPAD_RIGHT);