2018-01-27 06:35:02 -07:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2018-07-06 16:40:15 -06:00
|
|
|
#include "DolphinQt/TAS/GCTASInputWindow.h"
|
2018-01-27 06:35:02 -07:00
|
|
|
|
|
|
|
#include <QCheckBox>
|
2019-03-25 18:18:11 -06:00
|
|
|
#include <QGridLayout>
|
2018-01-27 06:35:02 -07:00
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QHBoxLayout>
|
2019-03-25 18:18:11 -06:00
|
|
|
#include <QSpacerItem>
|
2018-01-31 04:35:09 -07:00
|
|
|
#include <QSpinBox>
|
2018-01-27 06:35:02 -07:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2018-02-06 04:10:28 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2018-05-27 19:48:04 -06:00
|
|
|
|
2018-02-06 04:10:28 -07:00
|
|
|
#include "InputCommon/GCPadStatus.h"
|
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : TASInputWindow(parent)
|
2018-01-27 06:35:02 -07:00
|
|
|
{
|
2018-01-31 04:35:09 -07:00
|
|
|
setWindowTitle(tr("GameCube TAS Input %1").arg(num + 1));
|
2018-05-04 18:29:16 -06:00
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
m_main_stick_box = CreateStickInputs(tr("Main Stick"), m_x_main_stick_value, m_y_main_stick_value,
|
|
|
|
255, 255, Qt::Key_F, Qt::Key_G);
|
|
|
|
m_c_stick_box = CreateStickInputs(tr("C Stick"), m_x_c_stick_value, m_y_c_stick_value, 255, 255,
|
|
|
|
Qt::Key_H, Qt::Key_J);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
|
|
|
auto* top_layout = new QHBoxLayout;
|
2018-07-06 23:51:34 -06:00
|
|
|
top_layout->addWidget(m_main_stick_box);
|
|
|
|
top_layout->addWidget(m_c_stick_box);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
m_triggers_box = new QGroupBox(tr("Triggers"));
|
2018-01-27 06:35:02 -07:00
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
auto* l_trigger_layout =
|
|
|
|
CreateSliderValuePairLayout(tr("Left"), m_l_trigger_value, 255, Qt::Key_N, m_triggers_box);
|
|
|
|
auto* r_trigger_layout =
|
|
|
|
CreateSliderValuePairLayout(tr("Right"), m_r_trigger_value, 255, Qt::Key_M, m_triggers_box);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
2018-01-31 04:35:09 -07:00
|
|
|
auto* triggers_layout = new QVBoxLayout;
|
|
|
|
triggers_layout->addLayout(l_trigger_layout);
|
|
|
|
triggers_layout->addLayout(r_trigger_layout);
|
2018-07-06 23:51:34 -06:00
|
|
|
m_triggers_box->setLayout(triggers_layout);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
|
|
|
m_a_button = new QCheckBox(QStringLiteral("&A"));
|
|
|
|
m_b_button = new QCheckBox(QStringLiteral("&B"));
|
|
|
|
m_x_button = new QCheckBox(QStringLiteral("&X"));
|
|
|
|
m_y_button = new QCheckBox(QStringLiteral("&Y"));
|
|
|
|
m_z_button = new QCheckBox(QStringLiteral("&Z"));
|
|
|
|
m_l_button = new QCheckBox(QStringLiteral("&L"));
|
|
|
|
m_r_button = new QCheckBox(QStringLiteral("&R"));
|
|
|
|
m_start_button = new QCheckBox(QStringLiteral("&START"));
|
|
|
|
m_left_button = new QCheckBox(QStringLiteral("L&eft"));
|
|
|
|
m_up_button = new QCheckBox(QStringLiteral("&Up"));
|
|
|
|
m_down_button = new QCheckBox(QStringLiteral("&Down"));
|
|
|
|
m_right_button = new QCheckBox(QStringLiteral("R&ight"));
|
|
|
|
|
2019-03-25 18:18:11 -06:00
|
|
|
auto* buttons_layout = new QGridLayout;
|
|
|
|
buttons_layout->addWidget(m_a_button, 0, 0);
|
|
|
|
buttons_layout->addWidget(m_b_button, 0, 1);
|
|
|
|
buttons_layout->addWidget(m_x_button, 0, 2);
|
|
|
|
buttons_layout->addWidget(m_y_button, 0, 3);
|
|
|
|
buttons_layout->addWidget(m_z_button, 0, 4);
|
|
|
|
buttons_layout->addWidget(m_l_button, 0, 5);
|
|
|
|
buttons_layout->addWidget(m_r_button, 0, 6);
|
|
|
|
|
|
|
|
buttons_layout->addWidget(m_start_button, 1, 0);
|
|
|
|
buttons_layout->addWidget(m_left_button, 1, 1);
|
|
|
|
buttons_layout->addWidget(m_up_button, 1, 2);
|
|
|
|
buttons_layout->addWidget(m_down_button, 1, 3);
|
|
|
|
buttons_layout->addWidget(m_right_button, 1, 4);
|
|
|
|
|
|
|
|
buttons_layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding), 0, 7);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
m_buttons_box = new QGroupBox(tr("Buttons"));
|
|
|
|
m_buttons_box->setLayout(buttons_layout);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
|
|
|
auto* layout = new QVBoxLayout;
|
|
|
|
layout->addLayout(top_layout);
|
2018-07-06 23:51:34 -06:00
|
|
|
layout->addWidget(m_triggers_box);
|
|
|
|
layout->addWidget(m_buttons_box);
|
|
|
|
layout->addWidget(m_use_controller);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
|
|
|
setLayout(layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GCTASInputWindow::GetValues(GCPadStatus* pad)
|
|
|
|
{
|
|
|
|
if (!isVisible())
|
|
|
|
return;
|
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
GetButton<u16>(m_a_button, pad->button, PAD_BUTTON_A);
|
|
|
|
GetButton<u16>(m_b_button, pad->button, PAD_BUTTON_B);
|
|
|
|
GetButton<u16>(m_x_button, pad->button, PAD_BUTTON_X);
|
|
|
|
GetButton<u16>(m_y_button, pad->button, PAD_BUTTON_Y);
|
|
|
|
GetButton<u16>(m_z_button, pad->button, PAD_TRIGGER_Z);
|
|
|
|
GetButton<u16>(m_l_button, pad->button, PAD_TRIGGER_L);
|
|
|
|
GetButton<u16>(m_r_button, pad->button, PAD_TRIGGER_R);
|
|
|
|
GetButton<u16>(m_left_button, pad->button, PAD_BUTTON_LEFT);
|
|
|
|
GetButton<u16>(m_up_button, pad->button, PAD_BUTTON_UP);
|
|
|
|
GetButton<u16>(m_down_button, pad->button, PAD_BUTTON_DOWN);
|
|
|
|
GetButton<u16>(m_right_button, pad->button, PAD_BUTTON_RIGHT);
|
|
|
|
GetButton<u16>(m_start_button, pad->button, PAD_BUTTON_START);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
|
|
|
if (m_a_button->isChecked())
|
|
|
|
pad->analogA = 0xFF;
|
|
|
|
else
|
|
|
|
pad->analogA = 0x00;
|
|
|
|
|
|
|
|
if (m_b_button->isChecked())
|
|
|
|
pad->analogB = 0xFF;
|
|
|
|
else
|
|
|
|
pad->analogB = 0x00;
|
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
GetSpinBoxU8(m_l_trigger_value, pad->triggerLeft);
|
|
|
|
GetSpinBoxU8(m_r_trigger_value, pad->triggerRight);
|
|
|
|
|
|
|
|
GetSpinBoxU8(m_x_main_stick_value, pad->stickX);
|
|
|
|
GetSpinBoxU8(m_y_main_stick_value, pad->stickY);
|
2018-01-27 06:35:02 -07:00
|
|
|
|
2018-07-06 23:51:34 -06:00
|
|
|
GetSpinBoxU8(m_x_c_stick_value, pad->substickX);
|
|
|
|
GetSpinBoxU8(m_y_c_stick_value, pad->substickY);
|
2018-01-27 06:35:02 -07:00
|
|
|
}
|