added QuadTari debugging widget (joysticks only)

added mapping for 2nd QuadTari joysticks
This commit is contained in:
Thomas Jentzsch 2020-09-02 10:08:58 +02:00
parent 5e72e980c9
commit c244cea9fa
14 changed files with 195 additions and 131 deletions

View File

@ -4221,9 +4221,10 @@ Ms Pac-Man (Stella extended codes):
<tr><td>SaveKey</td><td>A 32K EEPROM for saving high scores, etc. (the EEPROM portion of an AtariVox).</td></tr>
<tr><td>Genesis </td><td>Sega Genesis controller, which can be used similar to a BoosterGrip, giving an extra button.</td></tr>
<tr><td>CompuMate &#185</td><td>Spectravideo CompuMate (if either left or right is set, CompuMate is used for both).</td></tr>
<tr><td>Lightgun</td><td>Atari XG-1 compatible Light Gun</td></tr>
<tr><td>Lightgun</td><td>Atari XG-1 compatible Light Gun</td></tr>
<tr><td>Mindlink &#185</td><td>Mindlink controller.</td></tr>
<tr><td>KidVid &#185</td><td>KidVid controller, limitted suport (8, 9 and 0 start the games).</td></tr>
<tr><td>KidVid &#185</td><td>KidVid controller, limited support (8, 9 and 0 start the games).</td></tr>
<tr><td>QuadTari</td><td>QuadTari controller, limited support (joysticks only).</td></tr>
</table></td>
</tr>

View File

@ -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);

View File

@ -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:

View File

@ -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);
}

View File

@ -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

View File

@ -929,6 +929,7 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
break;
case Controller::Type::QuadTari:
// TODO: support multiple controller types
controller = make_unique<QuadTari>(port, myEvent, *mySystem);
break;

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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:

View File

@ -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<Joystick>(Jack::Left, event, system);
mySecondController = make_unique<Joystick>(Jack::Right, event, system); // TODO: use P2 mapping
case Controller::Type::Joystick:
myFirstController = make_unique<Joystick>(myJack, event, system);
break;
default:
// TODO
break;
}
else
switch(secondType)
{
myFirstController = make_unique<Joystick>(Jack::Right, event, system);
mySecondController = make_unique<Joystick>(Jack::Left, event, system); // TODO: use P3 mapping
case Controller::Type::Joystick:
mySecondController = make_unique<Joystick>(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);
}

View File

@ -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;

View File

@ -702,6 +702,7 @@
<ClCompile Include="..\debugger\gui\PointingDeviceWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\debugger\gui\QuadTariWidget.cxx" />
<ClCompile Include="..\debugger\gui\RiotRamWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
@ -1721,6 +1722,7 @@
<ClInclude Include="..\debugger\gui\PointingDeviceWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\debugger\gui\QuadTariWidget.hxx" />
<ClInclude Include="..\debugger\gui\RiotRamWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>

View File

@ -1020,6 +1020,9 @@
<ClCompile Include="..\emucore\QuadTari.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\debugger\gui\QuadTariWidget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\bspf.hxx">
@ -2096,6 +2099,9 @@
<ClInclude Include="..\emucore\QuadTari.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\debugger\gui\QuadTariWidget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="stella.ico">