Skip to content

Commit 186bb7f

Browse files
committed
Added two more TouchButtons for O3DS, changed Config layout, and other minor changes
*N3DS has 2 fewer buttons than standard XInput, but O3DS has 4 fewer so I added two more TouchButtons. These show up as green and yellow circles on the touch screen. *Config Menu now has a two column layout -reordered xinput dropdowns -removed (position) from ABXY in xinput dropdowns -changed "Select" to "Back" in xinput dropdowns -TouchButton preview circles are thicker -Added Clear Image button that removes the overlay image from the touchscreen -Renamed the "connect" button to better reflect that it enables/disables the frame timer -Touchscreen and ConfigWindow will now align with the main window -Touchscreen moves when the main window moves -ConfigWindow can be hidden with the button that shows it
1 parent 8963a57 commit 186bb7f

8 files changed

Lines changed: 209 additions & 61 deletions

File tree

configwindow.cpp

Lines changed: 137 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ ConfigWindow::ConfigWindow(QWidget *parent, TouchScreen *ts) : QDialog(parent)
77
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
88
this->setWindowTitle(tr("InputRedirectionClient-Qt - Button Config"));
99

10-
layout = new QVBoxLayout(this);
11-
1210
comboBoxA = populateItems(variantToButton(settings.value("ButtonA", QGamepadManager::ButtonA)));
1311
comboBoxB = populateItems(variantToButton(settings.value("ButtonB", QGamepadManager::ButtonB)));
1412
comboBoxX = populateItems(variantToButton(settings.value("ButtonX", QGamepadManager::ButtonX)));
@@ -28,6 +26,8 @@ ConfigWindow::ConfigWindow(QWidget *parent, TouchScreen *ts) : QDialog(parent)
2826
comboBoxPowerLong = populateItems(variantToButton(settings.value("ButtonPowerLong", QGamepadManager::ButtonInvalid)));
2927
comboBoxTouch1 = populateItems(variantToButton(settings.value("ButtonT1", QGamepadManager::ButtonInvalid)));
3028
comboBoxTouch2 = populateItems(variantToButton(settings.value("ButtonT2", QGamepadManager::ButtonInvalid)));
29+
comboBoxTouch3 = populateItems(variantToButton(settings.value("ButtonT3", QGamepadManager::ButtonInvalid)));
30+
comboBoxTouch4 = populateItems(variantToButton(settings.value("ButtonT4", QGamepadManager::ButtonInvalid)));
3131

3232
touchButton1XEdit = new QLineEdit(this);
3333
touchButton1XEdit->setClearButtonEnabled(true);
@@ -43,51 +43,109 @@ ConfigWindow::ConfigWindow(QWidget *parent, TouchScreen *ts) : QDialog(parent)
4343
touchButton2YEdit->setClearButtonEnabled(true);
4444
touchButton2YEdit->setText(settings.value("touchButton2Y", "0").toString());
4545

46+
touchButton3XEdit = new QLineEdit(this);
47+
touchButton3XEdit->setClearButtonEnabled(true);
48+
touchButton3XEdit->setText(settings.value("touchButton3X", "0").toString());
49+
touchButton3YEdit = new QLineEdit(this);
50+
touchButton3YEdit->setClearButtonEnabled(true);
51+
touchButton3YEdit->setText(settings.value("touchButton3Y", "0").toString());
52+
53+
touchButton4XEdit = new QLineEdit(this);
54+
touchButton4XEdit->setClearButtonEnabled(true);
55+
touchButton4XEdit->setText(settings.value("touchButton4X", "0").toString());
56+
touchButton4YEdit = new QLineEdit(this);
57+
touchButton4YEdit->setClearButtonEnabled(true);
58+
touchButton4YEdit->setText(settings.value("touchButton4Y", "0").toString());
59+
4660
invertYCheckbox = new QCheckBox(this);
4761
invertYCppCheckbox = new QCheckBox(this);
4862
swapSticksCheckbox = new QCheckBox(this);
4963
mhCameraCheckbox = new QCheckBox(this);
5064
rsSmashCheckbox = new QCheckBox(this);
5165

52-
formLayout = new QFormLayout;
53-
54-
formLayout->addRow(tr("A Button"), comboBoxA);
55-
formLayout->addRow(tr("B Button"), comboBoxB);
56-
formLayout->addRow(tr("X Button"), comboBoxX);
57-
formLayout->addRow(tr("Y Button"), comboBoxY);
58-
formLayout->addRow(tr("DPad-Up"), comboBoxUp);
59-
formLayout->addRow(tr("DPad-Down"), comboBoxDown);
60-
formLayout->addRow(tr("DPad-Left"), comboBoxLeft);
61-
formLayout->addRow(tr("DPad-Right"), comboBoxRight);
62-
formLayout->addRow(tr("L Button"), comboBoxL);
63-
formLayout->addRow(tr("R Button"), comboBoxR);
64-
formLayout->addRow(tr("Select"), comboBoxSelect);
65-
formLayout->addRow(tr("Start"), comboBoxStart);
66-
formLayout->addRow(tr("Home"), comboBoxHome);
67-
formLayout->addRow(tr("Power"), comboBoxPower);
68-
formLayout->addRow(tr("Power-Long"), comboBoxPowerLong);
69-
formLayout->addRow(tr("ZL Button"), comboBoxZL);
70-
formLayout->addRow(tr("ZR Button"), comboBoxZR);
71-
72-
formLayout->addRow(tr("Touch Button 1"), comboBoxTouch1);
73-
formLayout->addRow(tr("Touch Button X"), touchButton1XEdit);
74-
formLayout->addRow(tr("Touch Button Y"), touchButton1YEdit);
75-
formLayout->addRow(tr("Touch Button 2"), comboBoxTouch2);
76-
formLayout->addRow(tr("Touch Button X"), touchButton2XEdit);
77-
formLayout->addRow(tr("Touch Button Y"), touchButton2YEdit);
78-
79-
formLayout->addRow(tr("&Invert Y axis"), invertYCheckbox);
80-
formLayout->addRow(tr("&Invert Cpp Y "), invertYCppCheckbox);
81-
formLayout->addRow(tr("&Swap Sticks"), swapSticksCheckbox);
82-
formLayout->addRow(tr("RightStick &DPad"), mhCameraCheckbox);
83-
formLayout->addRow(tr("RightStick &Smash"), rsSmashCheckbox);
84-
8566
saveButton = new QPushButton(tr("&SAVE"), this);
8667
closeButton = new QPushButton(tr("&CANCEL"), this);
8768

88-
layout->addLayout(formLayout);
89-
layout->addWidget(saveButton);
90-
layout->addWidget(closeButton);
69+
layout = new QGridLayout(this);
70+
71+
layout->addWidget(new QLabel("Y Button"), 0, 0);
72+
layout->addWidget(comboBoxY, 0, 1);
73+
layout->addWidget(new QLabel("X Button"), 0, 2);
74+
layout->addWidget(comboBoxX, 0, 3);
75+
layout->addWidget(new QLabel("B Button"), 1, 0);
76+
layout->addWidget(comboBoxB, 1, 1);
77+
layout->addWidget(new QLabel("A Button"), 1, 2);
78+
layout->addWidget(comboBoxA, 1, 3);
79+
80+
layout->addWidget(new QLabel("DPad-Down"), 2, 0);
81+
layout->addWidget(comboBoxDown, 2, 1);
82+
layout->addWidget(new QLabel("DPad-Up"), 2, 2);
83+
layout->addWidget(comboBoxUp, 2, 3);
84+
layout->addWidget(new QLabel("DPad-Left"), 3, 0);
85+
layout->addWidget(comboBoxLeft, 3, 1);
86+
layout->addWidget(new QLabel("DPad-Right"), 3, 2);
87+
layout->addWidget(comboBoxRight, 3, 3);
88+
89+
layout->addWidget(new QLabel("L Button"), 4, 0);
90+
layout->addWidget(comboBoxL, 4, 1);
91+
layout->addWidget(new QLabel("R Button"), 4, 2);
92+
layout->addWidget(comboBoxR, 4, 3);
93+
layout->addWidget(new QLabel("ZL Button"), 5, 0);
94+
layout->addWidget(comboBoxZL, 5, 1);
95+
layout->addWidget(new QLabel("ZR Button"), 5, 2);
96+
layout->addWidget(comboBoxZR, 5, 3);
97+
98+
layout->addWidget(new QLabel("Select"), 6, 0);
99+
layout->addWidget(comboBoxSelect, 6, 1);
100+
layout->addWidget(new QLabel("Start"), 6, 2);
101+
layout->addWidget(comboBoxStart, 6, 3);
102+
103+
layout->addWidget(new QLabel("Power Button"), 7, 0);
104+
layout->addWidget(comboBoxPower, 7, 1);
105+
layout->addWidget(new QLabel("Power-Long"), 7, 2);
106+
layout->addWidget(comboBoxPowerLong, 7, 3);
107+
layout->addWidget(new QLabel("Home Button"), 8, 0, 1, 2);
108+
layout->addWidget(comboBoxHome, 8, 1, 1, 2);
109+
110+
layout->addWidget(new QLabel("Invert Y axis"), 17, 0);
111+
layout->addWidget(invertYCheckbox, 17, 1);
112+
layout->addWidget(new QLabel("Invert CPP Y"), 17, 2);
113+
layout->addWidget(invertYCppCheckbox, 17, 3);
114+
layout->addWidget(new QLabel("Swap CPads"), 18, 2);
115+
layout->addWidget(swapSticksCheckbox, 18, 3);
116+
117+
layout->addWidget(new QLabel("RS as DPad"), 19, 0);
118+
layout->addWidget(mhCameraCheckbox, 19, 1);
119+
layout->addWidget(new QLabel("RS as Smash"), 19, 2);
120+
layout->addWidget(rsSmashCheckbox, 19, 3);
121+
122+
layout->addWidget(new QLabel("Touch R"), 9, 0, 1, 2);
123+
layout->addWidget(comboBoxTouch1, 9, 1, 1, 2);
124+
layout->addWidget(new QLabel("X"), 10, 0);
125+
layout->addWidget(touchButton1XEdit, 10, 1);
126+
layout->addWidget(new QLabel("Y"), 10, 2);
127+
layout->addWidget(touchButton1YEdit, 10, 3);
128+
layout->addWidget(new QLabel("Touch B"), 11, 0, 1, 2);
129+
layout->addWidget(comboBoxTouch2, 11, 1, 1, 2);
130+
layout->addWidget(new QLabel("X"), 12, 0);
131+
layout->addWidget(touchButton2XEdit, 12, 1);
132+
layout->addWidget(new QLabel("Y"), 12, 2);
133+
layout->addWidget(touchButton2YEdit, 12, 3);
134+
layout->addWidget(new QLabel("Touch G"), 13, 0, 1, 2);
135+
layout->addWidget(comboBoxTouch3, 13, 1, 1, 2);
136+
layout->addWidget(new QLabel("X"), 14, 0);
137+
layout->addWidget(touchButton3XEdit, 14, 1);
138+
layout->addWidget(new QLabel("Y"), 14, 2);
139+
layout->addWidget(touchButton3YEdit, 14, 3);
140+
layout->addWidget(new QLabel("Touch Y"), 15, 0, 1, 2);
141+
layout->addWidget(comboBoxTouch4, 15, 1, 1, 2);
142+
layout->addWidget(new QLabel("X"), 16, 0);
143+
layout->addWidget(touchButton4XEdit, 16, 1);
144+
layout->addWidget(new QLabel("Y"), 16, 2);
145+
layout->addWidget(touchButton4YEdit, 16, 3);
146+
147+
layout->addWidget(saveButton, 20, 0, 1, 2);
148+
layout->addWidget(closeButton, 20, 2, 1, 2);
91149

92150
connect(touchButton1XEdit, &QLineEdit::textChanged, this,
93151
[ts](const QString &text)
@@ -113,6 +171,30 @@ ConfigWindow::ConfigWindow(QWidget *parent, TouchScreen *ts) : QDialog(parent)
113171
touchButton2Y = text.toUInt();
114172
settings.setValue("touchButton2Y", text);
115173
});
174+
connect(touchButton3XEdit, &QLineEdit::textChanged, this,
175+
[ts](const QString &text)
176+
{
177+
touchButton3X = text.toUInt();
178+
settings.setValue("touchButton3X", text);
179+
});
180+
connect(touchButton3YEdit, &QLineEdit::textChanged, this,
181+
[ts](const QString &text)
182+
{
183+
touchButton3Y = text.toUInt();
184+
settings.setValue("touchButton3Y", text);
185+
});
186+
connect(touchButton4XEdit, &QLineEdit::textChanged, this,
187+
[ts](const QString &text)
188+
{
189+
touchButton4X = text.toUInt();
190+
settings.setValue("touchButton4X", text);
191+
});
192+
connect(touchButton4YEdit, &QLineEdit::textChanged, this,
193+
[ts](const QString &text)
194+
{
195+
touchButton4Y = text.toUInt();
196+
settings.setValue("touchButton4Y", text);
197+
});
116198

117199
connect(invertYCheckbox, &QCheckBox::stateChanged, this,
118200
[](int state)
@@ -266,6 +348,13 @@ ConfigWindow::ConfigWindow(QWidget *parent, TouchScreen *ts) : QDialog(parent)
266348
QGamepadManager::GamepadButton t2 = variantToButton(currentData(comboBoxTouch2));
267349
touchButton2 = t2;
268350
settings.setValue("ButtonT2", t2);
351+
QGamepadManager::GamepadButton t3 = variantToButton(currentData(comboBoxTouch3));
352+
touchButton3 = t3;
353+
settings.setValue("ButtonT3", t3);
354+
QGamepadManager::GamepadButton t4 = variantToButton(currentData(comboBoxTouch4));
355+
touchButton4 = t4;
356+
settings.setValue("ButtonT4", t4);
357+
269358
ts->updatePixmap();
270359

271360
});
@@ -285,20 +374,20 @@ ConfigWindow::ConfigWindow(QWidget *parent, TouchScreen *ts) : QDialog(parent)
285374
QComboBox* ConfigWindow::populateItems(QGamepadManager::GamepadButton button)
286375
{
287376
QComboBox *comboBox = new QComboBox();
288-
comboBox->addItem("A (bottom)", QGamepadManager::ButtonA);
289-
comboBox->addItem("B (right)", QGamepadManager::ButtonB);
290-
comboBox->addItem("X (left)", QGamepadManager::ButtonX);
291-
comboBox->addItem("Y (top)", QGamepadManager::ButtonY);
292-
comboBox->addItem("Right", QGamepadManager::ButtonRight);
293-
comboBox->addItem("Left", QGamepadManager::ButtonLeft);
377+
comboBox->addItem("A", QGamepadManager::ButtonA);
378+
comboBox->addItem("B", QGamepadManager::ButtonB);
379+
comboBox->addItem("X", QGamepadManager::ButtonX);
380+
comboBox->addItem("Y", QGamepadManager::ButtonY);
294381
comboBox->addItem("Up", QGamepadManager::ButtonUp);
295382
comboBox->addItem("Down", QGamepadManager::ButtonDown);
296-
comboBox->addItem("RB", QGamepadManager::ButtonR1);
383+
comboBox->addItem("Right", QGamepadManager::ButtonRight);
384+
comboBox->addItem("Left", QGamepadManager::ButtonLeft);
297385
comboBox->addItem("LB", QGamepadManager::ButtonL1);
298-
comboBox->addItem("Select", QGamepadManager::ButtonSelect);
299-
comboBox->addItem("Start", QGamepadManager::ButtonStart);
300-
comboBox->addItem("RT", QGamepadManager::ButtonR2);
386+
comboBox->addItem("RB", QGamepadManager::ButtonR1);
301387
comboBox->addItem("LT", QGamepadManager::ButtonL2);
388+
comboBox->addItem("RT", QGamepadManager::ButtonR2);
389+
comboBox->addItem("Start", QGamepadManager::ButtonStart);
390+
comboBox->addItem("Back", QGamepadManager::ButtonSelect);
302391
comboBox->addItem("L3", QGamepadManager::ButtonL3);
303392
comboBox->addItem("R3", QGamepadManager::ButtonR3);
304393
comboBox->addItem("Guide", QGamepadManager::ButtonGuide);

configwindow.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
class ConfigWindow : public QDialog
99
{
1010
private:
11-
QVBoxLayout *layout;
12-
QFormLayout *formLayout;
11+
QGridLayout *layout;
1312
QComboBox *comboBoxA, *comboBoxB, *comboBoxX, *comboBoxY, *comboBoxL, *comboBoxR,
1413
*comboBoxUp, *comboBoxDown, *comboBoxLeft, *comboBoxRight, *comboBoxStart, *comboBoxSelect,
15-
*comboBoxZL, *comboBoxZR, *comboBoxHome, *comboBoxPower, *comboBoxPowerLong, *comboBoxTouch1, *comboBoxTouch2;
16-
QLineEdit *touchButton1XEdit, *touchButton1YEdit,
17-
*touchButton2XEdit, *touchButton2YEdit;
14+
*comboBoxZL, *comboBoxZR, *comboBoxHome, *comboBoxPower, *comboBoxPowerLong,
15+
*comboBoxTouch1, *comboBoxTouch2, *comboBoxTouch3, *comboBoxTouch4;
16+
QLineEdit *touchButton1XEdit, *touchButton1YEdit, *touchButton3XEdit, *touchButton3YEdit,
17+
*touchButton2XEdit, *touchButton2YEdit, *touchButton4XEdit, *touchButton4YEdit;
1818
QPushButton *saveButton, *closeButton;
1919
QCheckBox *invertYCheckbox, *invertYCppCheckbox, *swapSticksCheckbox, *mhCameraCheckbox, *rsSmashCheckbox;
2020

global.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ QGamepadManager::GamepadButton powerLongButton = variantToButton(settings.value(
2929

3030
QGamepadManager::GamepadButton touchButton1 = variantToButton(settings.value("ButtonT1", QGamepadManager::ButtonInvalid));
3131
QGamepadManager::GamepadButton touchButton2 = variantToButton(settings.value("ButtonT2", QGamepadManager::ButtonInvalid));
32+
QGamepadManager::GamepadButton touchButton3 = variantToButton(settings.value("ButtonT3", QGamepadManager::ButtonInvalid));
33+
QGamepadManager::GamepadButton touchButton4 = variantToButton(settings.value("ButtonT4", QGamepadManager::ButtonInvalid));
3234
int touchButton1X = settings.value("touchButton1X", 0).toInt();
3335
int touchButton1Y = settings.value("touchButton1Y", 0).toInt();
3436
int touchButton2X = settings.value("touchButton2X", 0).toInt();
3537
int touchButton2Y = settings.value("touchButton2Y", 0).toInt();
38+
int touchButton3X = settings.value("touchButton3X", 0).toInt();
39+
int touchButton3Y = settings.value("touchButton3Y", 0).toInt();
40+
int touchButton4X = settings.value("touchButton4X", 0).toInt();
41+
int touchButton4Y = settings.value("touchButton4Y", 0).toInt();
3642

3743
QGamepadManager::GamepadButton hidButtonsAB[2]={
3844
variantToButton(settings.value("ButtonA", QGamepadManager::ButtonA)),

global.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ extern QGamepadManager::GamepadButton powerLongButton;
6363

6464
extern QGamepadManager::GamepadButton touchButton1;
6565
extern QGamepadManager::GamepadButton touchButton2;
66+
extern QGamepadManager::GamepadButton touchButton3;
67+
extern QGamepadManager::GamepadButton touchButton4;
6668
extern int touchButton1X, touchButton1Y, touchButton2X, touchButton2Y;
69+
extern int touchButton3X, touchButton3Y, touchButton4X, touchButton4Y;
6770

6871
extern QGamepadManager::GamepadButton hidButtonsAB[2];
6972
extern QGamepadManager::GamepadButton hidButtonsMiddle[8];

gpmanager.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ GamepadMonitor::GamepadMonitor(QObject *parent) : QObject(parent)
3232
touchScreenPressed = true;
3333
touchScreenPosition = QPoint(touchButton2X, touchButton2Y)*tsRatio;
3434
}
35+
if (button == touchButton3)
36+
{
37+
touchScreenPressed = true;
38+
touchScreenPosition = QPoint(touchButton3X, touchButton3Y)*tsRatio;
39+
}
40+
if (button == touchButton4)
41+
{
42+
touchScreenPressed = true;
43+
touchScreenPosition = QPoint(touchButton4X, touchButton4Y)*tsRatio;
44+
}
3545

3646
sendFrame();
3747
});
@@ -55,7 +65,8 @@ GamepadMonitor::GamepadMonitor(QObject *parent) : QObject(parent)
5565
interfaceButtons &= ~4;
5666
}
5767

58-
if ((button == touchButton1) || (button == touchButton2))
68+
if ((button == touchButton1) || (button == touchButton2)
69+
|| (button == touchButton3) || (button == touchButton4))
5970
{
6071
touchScreenPressed = false;
6172
}

0 commit comments

Comments
 (0)