diff --git a/src/debugger/gui/CartTVBoyWidget.cxx b/src/debugger/gui/CartTVBoyWidget.cxx index 43fff60f7..5012642ba 100644 --- a/src/debugger/gui/CartTVBoyWidget.cxx +++ b/src/debugger/gui/CartTVBoyWidget.cxx @@ -16,13 +16,15 @@ //============================================================================ #include "CartTVBoy.hxx" +#include "PopUpWidget.hxx" #include "CartTVBoyWidget.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeTVBoyWidget::CartridgeTVBoyWidget( GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h, CartridgeTVBoy& cart) - : CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart) + : CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart), + myCartTVBoy(cart) { initialize(); } @@ -33,9 +35,45 @@ string CartridgeTVBoyWidget::description() ostringstream info; info << "TV Boy, " << myCart.romBankCount() << " 4K banks\n" - << "Hotspots are from $" << Common::Base::HEX2 << 0x1800 << " to $" - << Common::Base::HEX2 << (0x1800 + myCart.romBankCount() - 1) << "\n"; - info << "Startup bank = #" << std::dec << myCart.startBank(); + << "Hotspots are from $" << Common::Base::HEX2 << 0xf800 << " to $" + << Common::Base::HEX2 << (0xf800 + myCart.romBankCount() - 1) << "\n"; + info << CartridgeEnhancedWidget::description(); return info.str(); } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeTVBoyWidget::bankSelect(int& ypos) +{ + CartridgeEnhancedWidget::bankSelect(ypos); + int xpos = myBankWidgets[0]->getRight() + _font.getMaxCharWidth() * 4; + ypos = myBankWidgets[0]->getTop(); + + myBankLocked = new CheckboxWidget(_boss, _font, xpos, ypos + 1, + "Bankswitching is locked", + kBankLocked); + myBankLocked->setTarget(this); + addFocusWidget(myBankLocked); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeTVBoyWidget::loadConfig() +{ + myBankWidgets[0]->setEnabled(!myCartTVBoy.myBankingDisabled); + myBankLocked->setState(myCartTVBoy.myBankingDisabled); + + CartridgeEnhancedWidget::loadConfig(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeTVBoyWidget::handleCommand(CommandSender* sender, + int cmd, int data, int id) +{ + if(cmd == kBankLocked) + { + myCartTVBoy.myBankingDisabled = myBankLocked->getState(); + myBankWidgets[0]->setEnabled(!myCartTVBoy.myBankingDisabled); + } + else + CartridgeEnhancedWidget::handleCommand(sender, cmd, data, id); +} diff --git a/src/debugger/gui/CartTVBoyWidget.hxx b/src/debugger/gui/CartTVBoyWidget.hxx index 7303750a7..e1c2780e6 100644 --- a/src/debugger/gui/CartTVBoyWidget.hxx +++ b/src/debugger/gui/CartTVBoyWidget.hxx @@ -19,30 +19,44 @@ #define CARTRIDGETVBOY_WIDGET_HXX class CartridgeTVBoy; +class CheckboxWidget; #include "CartEnhancedWidget.hxx" class CartridgeTVBoyWidget : public CartridgeEnhancedWidget { -public: - CartridgeTVBoyWidget(GuiObject* boss, const GUI::Font& lfont, - const GUI::Font& nfont, - int x, int y, int w, int h, - CartridgeTVBoy& cart); - virtual ~CartridgeTVBoyWidget() = default; + public: + CartridgeTVBoyWidget(GuiObject* boss, const GUI::Font& lfont, + const GUI::Font& nfont, + int x, int y, int w, int h, + CartridgeTVBoy& cart); + virtual ~CartridgeTVBoyWidget() = default; -private: - string manufacturer() override { return "Akor"; } + private: + string manufacturer() override { return "Akor"; } - string description() override; + string description() override; -private: - // Following constructors and assignment operators not supported - CartridgeTVBoyWidget() = delete; - CartridgeTVBoyWidget(const CartridgeTVBoyWidget&) = delete; - CartridgeTVBoyWidget(CartridgeTVBoyWidget&&) = delete; - CartridgeTVBoyWidget& operator=(const CartridgeTVBoyWidget&) = delete; - CartridgeTVBoyWidget& operator=(CartridgeTVBoyWidget&&) = delete; + void bankSelect(int& ypos) override; + + CartridgeTVBoy& myCartTVBoy; + CheckboxWidget* myBankLocked{nullptr}; + + enum { + kBankLocked = 'bkLO' + }; + + private: + void loadConfig() override; + void handleCommand(CommandSender* sender, int cmd, int data, int id) override; + + private: + // Following constructors and assignment operators not supported + CartridgeTVBoyWidget() = delete; + CartridgeTVBoyWidget(const CartridgeTVBoyWidget&) = delete; + CartridgeTVBoyWidget(CartridgeTVBoyWidget&&) = delete; + CartridgeTVBoyWidget& operator=(const CartridgeTVBoyWidget&) = delete; + CartridgeTVBoyWidget& operator=(CartridgeTVBoyWidget&&) = delete; }; #endif diff --git a/src/emucore/CartTVBoy.hxx b/src/emucore/CartTVBoy.hxx index 584029a5a..90072a08d 100644 --- a/src/emucore/CartTVBoy.hxx +++ b/src/emucore/CartTVBoy.hxx @@ -34,7 +34,7 @@ */ class CartridgeTVBoy : public CartridgeEnhanced { - friend class CartridgeMDMWidget; + friend class CartridgeTVBoyWidget; public: /**