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)
|
||||
: ControllerWidget(boss, font, x, y, controller)
|
||||
{
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
const string& label = leftport ? "Left (Booster)" : "Right (Booster)";
|
||||
const string& label = isLeftPort() ? "Left (Booster)" : "Right (Booster)";
|
||||
|
||||
const int fontHeight = font.getFontHeight();
|
||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Booster)");
|
||||
|
|
|
@ -24,6 +24,7 @@ class ButtonWidget;
|
|||
#include "Widget.hxx"
|
||||
#include "Command.hxx"
|
||||
|
||||
|
||||
class ControllerWidget : public Widget, public CommandSender
|
||||
{
|
||||
public:
|
||||
|
@ -44,6 +45,19 @@ class ControllerWidget : public Widget, public CommandSender
|
|||
protected:
|
||||
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:
|
||||
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),
|
||||
myGrayIndex(0)
|
||||
{
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
const string& label = leftport ? "Left (Driving)" : "Right (Driving)";
|
||||
const string& label = getHeader();
|
||||
|
||||
const int fontHeight = font.getFontHeight(),
|
||||
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();
|
||||
int xpos = x, ypos = y;
|
||||
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
new StaticTextWidget(boss, font, xpos, ypos + 2,
|
||||
(leftport ? "Left (" : "Right (") + myController.name() + ")");
|
||||
|
||||
new StaticTextWidget(boss, font, xpos, ypos + 2, getHeader());
|
||||
|
||||
ypos += lineHeight + 6;
|
||||
|
||||
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)
|
||||
: ControllerWidget(boss, font, x, y, controller)
|
||||
{
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
const string& label = leftport ? "Left (Genesis)" : "Right (Genesis)";
|
||||
const string& label = getHeader();
|
||||
|
||||
const int fontHeight = font.getFontHeight();
|
||||
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)
|
||||
: ControllerWidget(boss, font, x, y, controller)
|
||||
{
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
const string& label = leftport ? "Left (Joystick)" : "Right (Joystick)";
|
||||
|
||||
const string& label = getHeader();
|
||||
const int fontHeight = font.getFontHeight();
|
||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)");
|
||||
StaticTextWidget* t;
|
||||
|
|
|
@ -24,7 +24,7 @@ KeyboardWidget::KeyboardWidget(GuiObject* boss, const GUI::Font& font,
|
|||
int x, int y, Controller& 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 int fontHeight = font.getFontHeight();
|
||||
|
|
|
@ -29,10 +29,8 @@ class NullControlWidget : public ControllerWidget
|
|||
Controller& controller)
|
||||
: ControllerWidget(boss, font, x, y, controller)
|
||||
{
|
||||
bool leftport = controller.jack() == Controller::Left;
|
||||
ostringstream buf;
|
||||
buf << (leftport ? "Left (" : "Right (")
|
||||
<< controller.name() << "):";
|
||||
buf << getHeader();
|
||||
const int fontHeight = font.getFontHeight(),
|
||||
lineHeight = font.getLineHeight(),
|
||||
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)
|
||||
: ControllerWidget(boss, font, x, y, controller)
|
||||
{
|
||||
bool leftport = myController.jack() == Controller::Left;
|
||||
const string& label = leftport ? "Left (Paddles)" : "Right (Paddles)";
|
||||
bool leftport = isLeftPort();
|
||||
const string& label = getHeader();
|
||||
|
||||
const int fontWidth = font.getMaxCharWidth(),
|
||||
fontHeight = font.getFontHeight(),
|
||||
|
|
|
@ -23,7 +23,6 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
|
|||
int x, int y, Controller& controller)
|
||||
: ControllerWidget(boss, font, x, y, controller)
|
||||
{
|
||||
bool leftport = controller.jack() == Controller::Left;
|
||||
int ypos = y;
|
||||
int xLeft = x + 10;
|
||||
int xMid = xLeft + 30;
|
||||
|
@ -31,7 +30,7 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
|
|||
int xValue = xLeft + 87;
|
||||
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;
|
||||
|
||||
// add gray code and up widgets
|
||||
|
|
|
@ -88,8 +88,7 @@ class AtariVox : public SaveKey
|
|||
string about() const override { return Controller::about() + myAboutString; }
|
||||
|
||||
private:
|
||||
void clockDataIn(bool value);
|
||||
void shiftIn(bool value);
|
||||
void clockDataIn(bool value);
|
||||
|
||||
private:
|
||||
// Instance of an real serial port on the system
|
||||
|
|
Loading…
Reference in New Issue