mirror of https://github.com/stella-emu/stella.git
Fixed wrong display of swapped controllers in debugger
This commit is contained in:
parent
9f97184d9b
commit
cd189050ec
|
@ -24,8 +24,7 @@ BoosterWidget::BoosterWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
const string& label = isLeftPort() ? "Left (Booster)" : "Right (Booster)";
|
||||||
const string& label = leftport ? "Left (Booster)" : "Right (Booster)";
|
|
||||||
|
|
||||||
const int fontHeight = font.getFontHeight();
|
const int fontHeight = font.getFontHeight();
|
||||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Booster)");
|
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Booster)");
|
||||||
|
|
|
@ -24,6 +24,7 @@ class ButtonWidget;
|
||||||
#include "Widget.hxx"
|
#include "Widget.hxx"
|
||||||
#include "Command.hxx"
|
#include "Command.hxx"
|
||||||
|
|
||||||
|
|
||||||
class ControllerWidget : public Widget, public CommandSender
|
class ControllerWidget : public Widget, public CommandSender
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -44,6 +45,19 @@ class ControllerWidget : public Widget, public CommandSender
|
||||||
protected:
|
protected:
|
||||||
Controller& myController;
|
Controller& myController;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isLeftPort()
|
||||||
|
{
|
||||||
|
bool swappedPorts = instance().console().properties().get(Console_SwapPorts) == "YES";
|
||||||
|
|
||||||
|
return (myController.jack() == Controller::Left) ^ swappedPorts;
|
||||||
|
}
|
||||||
|
|
||||||
|
string getHeader()
|
||||||
|
{
|
||||||
|
return (isLeftPort() ? "Left (" : "Right (") + myController.name() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
: ControllerWidget(boss, font, x, y, controller),
|
: ControllerWidget(boss, font, x, y, controller),
|
||||||
myGrayIndex(0)
|
myGrayIndex(0)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
const string& label = getHeader();
|
||||||
const string& label = leftport ? "Left (Driving)" : "Right (Driving)";
|
|
||||||
|
|
||||||
const int fontHeight = font.getFontHeight(),
|
const int fontHeight = font.getFontHeight(),
|
||||||
bwidth = font.getStringWidth("Gray code +") + 10,
|
bwidth = font.getStringWidth("Gray code +") + 10,
|
||||||
|
|
|
@ -33,10 +33,8 @@ void FlashWidget::init(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
const int lineHeight = font.getLineHeight();
|
const int lineHeight = font.getLineHeight();
|
||||||
int xpos = x, ypos = y;
|
int xpos = x, ypos = y;
|
||||||
|
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
new StaticTextWidget(boss, font, xpos, ypos + 2, getHeader());
|
||||||
new StaticTextWidget(boss, font, xpos, ypos + 2,
|
|
||||||
(leftport ? "Left (" : "Right (") + myController.name() + ")");
|
|
||||||
|
|
||||||
ypos += lineHeight + 6;
|
ypos += lineHeight + 6;
|
||||||
|
|
||||||
new StaticTextWidget(boss, ifont, xpos, ypos, "Pages/Ranges used:");
|
new StaticTextWidget(boss, ifont, xpos, ypos, "Pages/Ranges used:");
|
||||||
|
|
|
@ -24,8 +24,7 @@ GenesisWidget::GenesisWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
const string& label = getHeader();
|
||||||
const string& label = leftport ? "Left (Genesis)" : "Right (Genesis)";
|
|
||||||
|
|
||||||
const int fontHeight = font.getFontHeight();
|
const int fontHeight = font.getFontHeight();
|
||||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis)");
|
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis)");
|
||||||
|
|
|
@ -24,9 +24,7 @@ JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
const string& label = getHeader();
|
||||||
const string& label = leftport ? "Left (Joystick)" : "Right (Joystick)";
|
|
||||||
|
|
||||||
const int fontHeight = font.getFontHeight();
|
const int fontHeight = font.getFontHeight();
|
||||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)");
|
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)");
|
||||||
StaticTextWidget* t;
|
StaticTextWidget* t;
|
||||||
|
|
|
@ -24,7 +24,7 @@ KeyboardWidget::KeyboardWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
bool leftport = isLeftPort();
|
||||||
const string& label = leftport ? "Left (Keyboard)" : "Right (Keyboard)";
|
const string& label = leftport ? "Left (Keyboard)" : "Right (Keyboard)";
|
||||||
|
|
||||||
const int fontHeight = font.getFontHeight();
|
const int fontHeight = font.getFontHeight();
|
||||||
|
|
|
@ -29,10 +29,8 @@ class NullControlWidget : public ControllerWidget
|
||||||
Controller& controller)
|
Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = controller.jack() == Controller::Left;
|
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << (leftport ? "Left (" : "Right (")
|
buf << getHeader();
|
||||||
<< controller.name() << "):";
|
|
||||||
const int fontHeight = font.getFontHeight(),
|
const int fontHeight = font.getFontHeight(),
|
||||||
lineHeight = font.getLineHeight(),
|
lineHeight = font.getLineHeight(),
|
||||||
lwidth = std::max(font.getStringWidth(buf.str()),
|
lwidth = std::max(font.getStringWidth(buf.str()),
|
||||||
|
|
|
@ -25,8 +25,8 @@ PaddleWidget::PaddleWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
bool leftport = isLeftPort();
|
||||||
const string& label = leftport ? "Left (Paddles)" : "Right (Paddles)";
|
const string& label = getHeader();
|
||||||
|
|
||||||
const int fontWidth = font.getMaxCharWidth(),
|
const int fontWidth = font.getMaxCharWidth(),
|
||||||
fontHeight = font.getFontHeight(),
|
fontHeight = font.getFontHeight(),
|
||||||
|
|
|
@ -23,7 +23,6 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller)
|
||||||
{
|
{
|
||||||
bool leftport = controller.jack() == Controller::Left;
|
|
||||||
int ypos = y;
|
int ypos = y;
|
||||||
int xLeft = x + 10;
|
int xLeft = x + 10;
|
||||||
int xMid = xLeft + 30;
|
int xMid = xLeft + 30;
|
||||||
|
@ -31,7 +30,7 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
|
||||||
int xValue = xLeft + 87;
|
int xValue = xLeft + 87;
|
||||||
StaticTextWidget* t;
|
StaticTextWidget* t;
|
||||||
|
|
||||||
t = new StaticTextWidget(boss, font, x, y + 2, (leftport ? "Left (" : "Right (") + myController.name() + ")");
|
t = new StaticTextWidget(boss, font, x, y + 2, getHeader());
|
||||||
ypos += t->getHeight() + 8;
|
ypos += t->getHeight() + 8;
|
||||||
|
|
||||||
// add gray code and up widgets
|
// add gray code and up widgets
|
||||||
|
|
|
@ -88,8 +88,7 @@ class AtariVox : public SaveKey
|
||||||
string about() const override { return Controller::about() + myAboutString; }
|
string about() const override { return Controller::about() + myAboutString; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clockDataIn(bool value);
|
void clockDataIn(bool value);
|
||||||
void shiftIn(bool value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Instance of an real serial port on the system
|
// Instance of an real serial port on the system
|
||||||
|
|
Loading…
Reference in New Issue