diff --git a/docs/index.html b/docs/index.html index 65e416468..53f587dce 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4221,9 +4221,10 @@ Ms Pac-Man (Stella extended codes): SaveKeyA 32K EEPROM for saving high scores, etc. (the EEPROM portion of an AtariVox). Genesis Sega Genesis controller, which can be used similar to a BoosterGrip, giving an extra button. CompuMate ¹Spectravideo CompuMate (if either left or right is set, CompuMate is used for both). - LightgunAtari XG-1 compatible Light Gun + LightgunAtari XG-1 compatible Light Gun Mindlink ¹Mindlink controller. - KidVid ¹KidVid controller, limitted suport (8, 9 and 0 start the games). + KidVid ¹KidVid controller, limited support (8, 9 and 0 start the games). + QuadTariQuadTari controller, limited support (joysticks only). diff --git a/src/debugger/gui/JoystickWidget.cxx b/src/debugger/gui/JoystickWidget.cxx index dc3b2c85d..6e9ad18dc 100644 --- a/src/debugger/gui/JoystickWidget.cxx +++ b/src/debugger/gui/JoystickWidget.cxx @@ -19,17 +19,23 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, Controller& controller) + int x, int y, Controller& controller, + bool embedded) : ControllerWidget(boss, font, x, y, controller) { - const string& label = getHeader(); - const int fontHeight = font.getFontHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)"); - StaticTextWidget* t; + int xpos = x, ypos = y; - t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, - fontHeight, label, TextAlign::Left); - xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 20; + if(!embedded) + { + const string& label = getHeader(); + const int fontHeight = font.getFontHeight(); + int lwidth = font.getStringWidth("Right (Joystick)"); + StaticTextWidget* t; + + t = new StaticTextWidget(boss, font, xpos, ypos + 2, lwidth, + fontHeight, label, TextAlign::Left); + xpos += t->getWidth() / 2 - 5; ypos += t->getHeight() + 20; + } myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", CheckboxWidget::kCheckActionCmd); myPins[kJUp]->setID(kJUp); @@ -55,7 +61,7 @@ JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font, myPins[kJRight]->setTarget(this); xpos -= (myPins[kJUp]->getWidth() + 5) * 2; - ypos = 30 + (myPins[kJUp]->getHeight() + 10) * 3; + ypos = myPins[kJDown]->getBottom() + font.getFontHeight() * 0.5 - 1; myPins[kJFire] = new CheckboxWidget(boss, font, xpos, ypos, "Fire", CheckboxWidget::kCheckActionCmd); myPins[kJFire]->setID(kJFire); diff --git a/src/debugger/gui/JoystickWidget.hxx b/src/debugger/gui/JoystickWidget.hxx index 1c1143b7f..1804dd2a6 100644 --- a/src/debugger/gui/JoystickWidget.hxx +++ b/src/debugger/gui/JoystickWidget.hxx @@ -25,7 +25,7 @@ class JoystickWidget : public ControllerWidget { public: JoystickWidget(GuiObject* boss, const GUI::Font& font, int x, int y, - Controller& controller); + Controller& controller, bool embedded = false); ~JoystickWidget() override = default; private: diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 43514e072..e1b5bf415 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -39,6 +39,7 @@ #include "AmigaMouseWidget.hxx" #include "AtariMouseWidget.hxx" #include "TrakBallWidget.hxx" +#include "QuadTariWidget.hxx" #include "RiotWidget.hxx" @@ -480,12 +481,15 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& return new KeyboardWidget(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::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); + case Controller::Type::QuadTari: + return new QuadTariWidget(boss, font, x, y, controller); default: return new NullControlWidget(boss, font, x, y, controller); } diff --git a/src/debugger/gui/module.mk b/src/debugger/gui/module.mk index d992ae85a..cda7666e9 100644 --- a/src/debugger/gui/module.mk +++ b/src/debugger/gui/module.mk @@ -1,89 +1,90 @@ MODULE := src/debugger/gui MODULE_OBJS := \ - src/debugger/gui/AmigaMouseWidget.o \ - src/debugger/gui/AtariMouseWidget.o \ - src/debugger/gui/AtariVoxWidget.o \ - src/debugger/gui/AudioWidget.o \ - src/debugger/gui/BoosterWidget.o \ - src/debugger/gui/Cart0840Widget.o \ - src/debugger/gui/Cart2KWidget.o \ - src/debugger/gui/Cart3EPlusWidget.o \ - src/debugger/gui/Cart3EWidget.o \ - src/debugger/gui/Cart3FWidget.o \ - src/debugger/gui/Cart4A50Widget.o \ - src/debugger/gui/Cart4KSCWidget.o \ - src/debugger/gui/Cart4KWidget.o \ - src/debugger/gui/CartARWidget.o \ - src/debugger/gui/CartBFSCWidget.o \ - src/debugger/gui/CartBFWidget.o \ - src/debugger/gui/CartBUSWidget.o \ - src/debugger/gui/CartCDFWidget.o \ - src/debugger/gui/CartCDFInfoWidget.o \ - src/debugger/gui/CartCMWidget.o \ - src/debugger/gui/CartCTYWidget.o \ - src/debugger/gui/CartCVWidget.o \ - src/debugger/gui/CartDFSCWidget.o \ - src/debugger/gui/CartDFWidget.o \ - src/debugger/gui/CartDPCPlusWidget.o \ - src/debugger/gui/CartDPCWidget.o \ - src/debugger/gui/CartE0Widget.o \ - src/debugger/gui/CartEnhancedWidget.o \ - src/debugger/gui/CartMNetworkWidget.o \ - src/debugger/gui/CartE7Widget.o \ - src/debugger/gui/CartE78KWidget.o \ - src/debugger/gui/CartEFSCWidget.o \ - src/debugger/gui/CartEFWidget.o \ - src/debugger/gui/CartF0Widget.o \ - src/debugger/gui/CartF4SCWidget.o \ - src/debugger/gui/CartF4Widget.o \ - src/debugger/gui/CartF6SCWidget.o \ - src/debugger/gui/CartF6Widget.o \ - src/debugger/gui/CartF8SCWidget.o \ - src/debugger/gui/CartF8Widget.o \ - src/debugger/gui/CartFA2Widget.o \ - src/debugger/gui/CartFAWidget.o \ - src/debugger/gui/CartFCWidget.o \ - src/debugger/gui/CartFEWidget.o \ - src/debugger/gui/CartMDMWidget.o \ - src/debugger/gui/CartRamWidget.o \ - src/debugger/gui/CartSBWidget.o \ - src/debugger/gui/CartTVBoyWidget.o \ - src/debugger/gui/CartUAWidget.o \ - src/debugger/gui/CartWDWidget.o \ - src/debugger/gui/CartX07Widget.o \ - src/debugger/gui/CartDebugWidget.o \ - src/debugger/gui/CpuWidget.o \ - src/debugger/gui/DataGridOpsWidget.o \ - src/debugger/gui/DataGridWidget.o \ - src/debugger/gui/DebuggerDialog.o \ - src/debugger/gui/DelayQueueWidget.o \ - src/debugger/gui/DrivingWidget.o \ - src/debugger/gui/FlashWidget.o \ - src/debugger/gui/GenesisWidget.o \ - src/debugger/gui/JoystickWidget.o \ - src/debugger/gui/KeyboardWidget.o \ - src/debugger/gui/PaddleWidget.o \ - src/debugger/gui/PointingDeviceWidget.o \ - src/debugger/gui/PromptWidget.o \ - src/debugger/gui/RamWidget.o \ - src/debugger/gui/RiotRamWidget.o \ - src/debugger/gui/RiotWidget.o \ - src/debugger/gui/RomListSettings.o \ - src/debugger/gui/RomListWidget.o \ - src/debugger/gui/RomWidget.o \ - src/debugger/gui/SaveKeyWidget.o \ - src/debugger/gui/TiaInfoWidget.o \ - src/debugger/gui/TiaOutputWidget.o \ - src/debugger/gui/TiaWidget.o \ - src/debugger/gui/TiaZoomWidget.o \ - src/debugger/gui/ToggleBitWidget.o \ - src/debugger/gui/TogglePixelWidget.o \ - src/debugger/gui/ToggleWidget.o \ - src/debugger/gui/TrakBallWidget.o + src/debugger/gui/AmigaMouseWidget.o \ + src/debugger/gui/AtariMouseWidget.o \ + src/debugger/gui/AtariVoxWidget.o \ + src/debugger/gui/AudioWidget.o \ + src/debugger/gui/BoosterWidget.o \ + src/debugger/gui/Cart0840Widget.o \ + src/debugger/gui/Cart2KWidget.o \ + src/debugger/gui/Cart3EPlusWidget.o \ + src/debugger/gui/Cart3EWidget.o \ + src/debugger/gui/Cart3FWidget.o \ + src/debugger/gui/Cart4A50Widget.o \ + src/debugger/gui/Cart4KSCWidget.o \ + src/debugger/gui/Cart4KWidget.o \ + src/debugger/gui/CartARWidget.o \ + src/debugger/gui/CartBFSCWidget.o \ + src/debugger/gui/CartBFWidget.o \ + src/debugger/gui/CartBUSWidget.o \ + src/debugger/gui/CartCDFWidget.o \ + src/debugger/gui/CartCDFInfoWidget.o \ + src/debugger/gui/CartCMWidget.o \ + src/debugger/gui/CartCTYWidget.o \ + src/debugger/gui/CartCVWidget.o \ + src/debugger/gui/CartDFSCWidget.o \ + src/debugger/gui/CartDFWidget.o \ + src/debugger/gui/CartDPCPlusWidget.o \ + src/debugger/gui/CartDPCWidget.o \ + src/debugger/gui/CartE0Widget.o \ + src/debugger/gui/CartEnhancedWidget.o \ + src/debugger/gui/CartMNetworkWidget.o \ + src/debugger/gui/CartE7Widget.o \ + src/debugger/gui/CartE78KWidget.o \ + src/debugger/gui/CartEFSCWidget.o \ + src/debugger/gui/CartEFWidget.o \ + src/debugger/gui/CartF0Widget.o \ + src/debugger/gui/CartF4SCWidget.o \ + src/debugger/gui/CartF4Widget.o \ + src/debugger/gui/CartF6SCWidget.o \ + src/debugger/gui/CartF6Widget.o \ + src/debugger/gui/CartF8SCWidget.o \ + src/debugger/gui/CartF8Widget.o \ + src/debugger/gui/CartFA2Widget.o \ + src/debugger/gui/CartFAWidget.o \ + src/debugger/gui/CartFCWidget.o \ + src/debugger/gui/CartFEWidget.o \ + src/debugger/gui/CartMDMWidget.o \ + src/debugger/gui/CartRamWidget.o \ + src/debugger/gui/CartSBWidget.o \ + src/debugger/gui/CartTVBoyWidget.o \ + src/debugger/gui/CartUAWidget.o \ + src/debugger/gui/CartWDWidget.o \ + src/debugger/gui/CartX07Widget.o \ + src/debugger/gui/CartDebugWidget.o \ + src/debugger/gui/CpuWidget.o \ + src/debugger/gui/DataGridOpsWidget.o \ + src/debugger/gui/DataGridWidget.o \ + src/debugger/gui/DebuggerDialog.o \ + src/debugger/gui/DelayQueueWidget.o \ + src/debugger/gui/DrivingWidget.o \ + src/debugger/gui/FlashWidget.o \ + src/debugger/gui/GenesisWidget.o \ + src/debugger/gui/JoystickWidget.o \ + src/debugger/gui/KeyboardWidget.o \ + src/debugger/gui/PaddleWidget.o \ + src/debugger/gui/PointingDeviceWidget.o \ + src/debugger/gui/PromptWidget.o \ + src/debugger/gui/QuadTariWidget.o \ + src/debugger/gui/RamWidget.o \ + src/debugger/gui/RiotRamWidget.o \ + src/debugger/gui/RiotWidget.o \ + src/debugger/gui/RomListSettings.o \ + src/debugger/gui/RomListWidget.o \ + src/debugger/gui/RomWidget.o \ + src/debugger/gui/SaveKeyWidget.o \ + src/debugger/gui/TiaInfoWidget.o \ + src/debugger/gui/TiaOutputWidget.o \ + src/debugger/gui/TiaWidget.o \ + src/debugger/gui/TiaZoomWidget.o \ + src/debugger/gui/ToggleBitWidget.o \ + src/debugger/gui/TogglePixelWidget.o \ + src/debugger/gui/ToggleWidget.o \ + src/debugger/gui/TrakBallWidget.o MODULE_DIRS += \ - src/debugger/gui + src/debugger/gui # Include common rules include $(srcdir)/common.rules diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 98bb7e98c..39ec0f0a8 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -929,6 +929,7 @@ unique_ptr Console::getControllerPort(const Controller::Type type, break; case Controller::Type::QuadTari: + // TODO: support multiple controller types controller = make_unique(port, myEvent, *mySystem); break; diff --git a/src/emucore/ControllerDetector.cxx b/src/emucore/ControllerDetector.cxx index 2e21d8586..3552e0296 100644 --- a/src/emucore/ControllerDetector.cxx +++ b/src/emucore/ControllerDetector.cxx @@ -63,9 +63,7 @@ Controller::Type ControllerDetector::autodetectPort( if(isProbablySaveKey(image, size, port)) type = Controller::Type::SaveKey; else if(isProbablyQuadTari(image, size, port)) - { type = Controller::Type::QuadTari; - } else if(usesJoystickButton(image, size, port)) { if(isProbablyTrakBall(image, size)) @@ -694,7 +692,6 @@ bool ControllerDetector::isProbablyLightGun(const ByteBuffer& image, size_t size if (searchForBytes(image, size, signature[i], SIG_SIZE)) return true; } - return false; } @@ -714,4 +711,5 @@ bool ControllerDetector::isProbablyQuadTari(const ByteBuffer& image, size_t size return searchForBytes(image, size, signature, 5); } + return false; } diff --git a/src/emucore/ControllerDetector.hxx b/src/emucore/ControllerDetector.hxx index be24ae09d..1e21b447f 100644 --- a/src/emucore/ControllerDetector.hxx +++ b/src/emucore/ControllerDetector.hxx @@ -121,6 +121,9 @@ class ControllerDetector static bool isProbablyLightGun(const ByteBuffer& image, size_t size, Controller::Jack port); + // Returns true if a QuadTari code pattern is found. + static bool isProbablyQuadTari(const ByteBuffer& image, size_t size, + Controller::Jack port); private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Joystick.cxx b/src/emucore/Joystick.cxx index ea0d71300..7f62335f9 100644 --- a/src/emucore/Joystick.cxx +++ b/src/emucore/Joystick.cxx @@ -19,26 +19,48 @@ #include "Joystick.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Joystick::Joystick(Jack jack, const Event& event, const System& system) +Joystick::Joystick(Jack jack, const Event& event, const System& system, bool altmap) : Controller(jack, event, system, Controller::Type::Joystick) { if(myJack == Jack::Left) { - myUpEvent = Event::JoystickZeroUp; - myDownEvent = Event::JoystickZeroDown; - myLeftEvent = Event::JoystickZeroLeft; - myRightEvent = Event::JoystickZeroRight; - myFireEvent = Event::JoystickZeroFire; + if(!altmap) + { + myUpEvent = Event::JoystickZeroUp; + myDownEvent = Event::JoystickZeroDown; + myLeftEvent = Event::JoystickZeroLeft; + myRightEvent = Event::JoystickZeroRight; + myFireEvent = Event::JoystickZeroFire; + } + else + { + myUpEvent = Event::JoystickTwoUp; + myDownEvent = Event::JoystickTwoDown; + myLeftEvent = Event::JoystickTwoLeft; + myRightEvent = Event::JoystickTwoRight; + myFireEvent = Event::JoystickTwoFire; + } myXAxisValue = Event::PaddleZeroAnalog; myYAxisValue = Event::PaddleOneAnalog; } else { - myUpEvent = Event::JoystickOneUp; - myDownEvent = Event::JoystickOneDown; - myLeftEvent = Event::JoystickOneLeft; - myRightEvent = Event::JoystickOneRight; - myFireEvent = Event::JoystickOneFire; + if(!altmap) + { + myUpEvent = Event::JoystickOneUp; + myDownEvent = Event::JoystickOneDown; + myLeftEvent = Event::JoystickOneLeft; + myRightEvent = Event::JoystickOneRight; + myFireEvent = Event::JoystickOneFire; + } + else + { + myUpEvent = Event::JoystickThreeUp; + myDownEvent = Event::JoystickThreeDown; + myLeftEvent = Event::JoystickThreeLeft; + myRightEvent = Event::JoystickThreeRight; + myFireEvent = Event::JoystickThreeFire; + } myXAxisValue = Event::PaddleTwoAnalog; myYAxisValue = Event::PaddleThreeAnalog; } diff --git a/src/emucore/Joystick.hxx b/src/emucore/Joystick.hxx index 99675c51e..ec652e98b 100644 --- a/src/emucore/Joystick.hxx +++ b/src/emucore/Joystick.hxx @@ -33,11 +33,12 @@ class Joystick : public Controller /** Create a new joystick controller plugged into the specified jack - @param jack The jack the controller is plugged into - @param event The event object to use for events - @param system The system using this controller + @param jack The jack the controller is plugged into + @param event The event object to use for events + @param system The system using this controller + @param altmap If true, use alternative mapping */ - Joystick(Jack jack, const Event& event, const System& system); + Joystick(Jack jack, const Event& event, const System& system, bool altmap = false); ~Joystick() override = default; public: diff --git a/src/emucore/QuadTari.cxx b/src/emucore/QuadTari.cxx index c75c28f76..ca7d3b81f 100644 --- a/src/emucore/QuadTari.cxx +++ b/src/emucore/QuadTari.cxx @@ -23,20 +23,32 @@ #include "QuadTari.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -QuadTari::QuadTari(Jack jack, const Event& event, const System& system) +QuadTari::QuadTari(Jack jack, const Event& event, const System& system, + const Controller::Type firstType, const Controller::Type secondType) : Controller(jack, event, system, Controller::Type::QuadTari) { // TODO: support multiple controller types - if(myJack == Jack::Left) + switch(firstType) { - myFirstController = make_unique(Jack::Left, event, system); - mySecondController = make_unique(Jack::Right, event, system); // TODO: use P2 mapping + case Controller::Type::Joystick: + myFirstController = make_unique(myJack, event, system); + break; + + default: + // TODO + break; } - else + switch(secondType) { - myFirstController = make_unique(Jack::Right, event, system); - mySecondController = make_unique(Jack::Left, event, system); // TODO: use P3 mapping + case Controller::Type::Joystick: + mySecondController = make_unique(myJack, event, system, true); // use alternative mapping + break; + + default: + // TODO + break; } + // QuadTari auto detection setting setPin(AnalogPin::Five, MIN_RESISTANCE); setPin(AnalogPin::Nine, MAX_RESISTANCE); @@ -80,8 +92,11 @@ bool QuadTari::isAnalog() const bool QuadTari::setMouseControl( Controller::Type xtype, int xid, Controller::Type ytype, int yid) { - // Use mouse for first controller only (TODO: support multiple controller types) - myFirstController->setMouseControl(Controller::Type::Joystick, xid, Controller::Type::Joystick, yid); - - return true; + // Use mouse for first controller only + if(xtype == Controller::Type::QuadTari && ytype == Controller::Type::QuadTari) + return myFirstController->setMouseControl(myFirstController->type(), xid, + myFirstController->type(), yid); + else + // required for creating the MouseControl mode list + return myFirstController->setMouseControl(xtype, xid, ytype, yid); } diff --git a/src/emucore/QuadTari.hxx b/src/emucore/QuadTari.hxx index 215ee0796..3d5d0bfb6 100644 --- a/src/emucore/QuadTari.hxx +++ b/src/emucore/QuadTari.hxx @@ -18,8 +18,8 @@ #ifndef QUADTARI_HXX #define QUADTARI_HXX -#include "Control.hxx" -#include "Event.hxx" +class Controller; +class Event; /** The QuadTari controller. @@ -28,16 +28,20 @@ */ class QuadTari: public Controller { + friend class QuadTariWidget; public: /** - Create a QuadTari controller plugged into - the specified jack + Create a QuadTari controller plugged into the specified jack - @param jack The jack the controller is plugged into - @param event The event object to use for events - @param system The system using this controller + @param jack The jack the controller is plugged into + @param event The event object to use for events + @param system The system using this controller + @param firstType The type of the first, plugged-in controller + @param secondType The type of the second, plugged-in controller */ - QuadTari(Jack jack, const Event& event, const System& system); + QuadTari(Jack jack, const Event& event, const System& system, + const Controller::Type firstType = Controller::Type::Joystick, + const Controller::Type secondType = Controller::Type::Joystick); ~QuadTari() override = default; public: @@ -62,7 +66,7 @@ class QuadTari: public Controller /** Answers whether the controller is intrinsically an analog controller. - TODO: Depends on the attached controllers. + Depends on the attached controllers. */ bool isAnalog() const override; diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 71c5d6f30..261ac76b9 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -702,6 +702,7 @@ true + true @@ -1721,6 +1722,7 @@ true + true diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters index be6cc8424..6be678998 100644 --- a/src/windows/Stella.vcxproj.filters +++ b/src/windows/Stella.vcxproj.filters @@ -1020,6 +1020,9 @@ Source Files\emucore + + Source Files\debugger + @@ -2096,6 +2099,9 @@ Header Files\emucore + + Header Files\debugger +