mirror of https://github.com/stella-emu/stella.git
added QuadTari debugging widget (joysticks only)
added mapping for 2nd QuadTari joysticks
This commit is contained in:
parent
5e72e980c9
commit
c244cea9fa
|
@ -4223,7 +4223,8 @@ Ms Pac-Man (Stella extended codes):
|
|||
<tr><td>CompuMate ¹</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>Mindlink ¹</td><td>Mindlink controller.</td></tr>
|
||||
<tr><td>KidVid ¹</td><td>KidVid controller, limitted suport (8, 9 and 0 start the games).</td></tr>
|
||||
<tr><td>KidVid ¹</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>
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
int xpos = x, ypos = y;
|
||||
|
||||
if(!embedded)
|
||||
{
|
||||
const string& label = getHeader();
|
||||
const int fontHeight = font.getFontHeight();
|
||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)");
|
||||
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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ MODULE_OBJS := \
|
|||
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 \
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,9 @@ class Joystick : public 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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 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;
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue