Permalink
Browse files

Merge pull request #7203 from rukai/use_tas_checkbox

Add "Enable Controller Input" Checkbox on TAS dialogs
  • Loading branch information...
spycrab committed Jul 8, 2018
2 parents 7b986c1 + b94262e commit 8c97fb7cd4b165bc871c727faa249251b2ce8b5f
@@ -63,7 +63,7 @@ add_executable(dolphin-emu
Config/Mapping/MappingCommon.cpp
Config/Mapping/MappingIndicator.cpp
Config/Mapping/MappingNumeric.cpp
Config/Mapping/MappingRadio.cpp
Config/Mapping/MappingRadio.cpp
Config/Mapping/MappingWidget.cpp
Config/Mapping/MappingWindow.cpp
Config/Mapping/WiimoteEmuExtension.cpp
@@ -113,7 +113,7 @@ add_executable(dolphin-emu
Settings/USBDeviceAddToWhitelistDialog.cpp
TAS/GCTASInputWindow.cpp
TAS/WiiTASInputWindow.cpp
TAS/Shared.cpp
TAS/TASInputWindow.cpp
TAS/StickWidget.cpp
TAS/IRWidget.cpp
Updater.cpp
@@ -110,6 +110,7 @@
<QtMoc Include="FIFO\FIFOPlayerWindow.h" />
<QtMoc Include="TAS\GCTASInputWindow.h" />
<QtMoc Include="TAS\WiiTASInputWindow.h" />
<QtMoc Include="TAS\TASInputWindow.h" />
<QtMoc Include="TAS\StickWidget.h" />
<QtMoc Include="TAS\IRWidget.h" />
<QtMoc Include="Debugger\BreakpointWidget.h" />
@@ -246,6 +247,7 @@
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)SoftwareRendererWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)StickWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)TASInputWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ToolBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)USBDeviceAddToWhitelistDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Updater.cpp" />
@@ -318,9 +320,9 @@
<ClCompile Include="QtUtils\WinIconHelper.cpp" />
<ClCompile Include="TAS\GCTASInputWindow.cpp" />
<ClCompile Include="TAS\WiiTASInputWindow.cpp" />
<ClCompile Include="TAS\TASInputWindow.cpp" />
<ClCompile Include="TAS\StickWidget.cpp" />
<ClCompile Include="TAS\IRWidget.cpp" />
<ClCompile Include="TAS\Shared.cpp" />
<ClCompile Include="Debugger\BreakpointWidget.cpp" />
<ClCompile Include="Debugger\NewBreakpointDialog.cpp" />
<ClCompile Include="Debugger\RegisterColumn.cpp" />
@@ -377,7 +379,6 @@
<ClInclude Include="QtUtils\RunOnObject.h" />
<ClInclude Include="QtUtils\WinIconHelper.h" />
<ClInclude Include="Resources.h" />
<ClInclude Include="TAS\Shared.h" />
<ClInclude Include="Translation.h" />
<ClInclude Include="WiiUpdate.h" />
</ItemGroup>
@@ -12,35 +12,32 @@
#include "Common/CommonTypes.h"
#include "DolphinQt/TAS/Shared.h"
#include "InputCommon/GCPadStatus.h"
GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent)
GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : TASInputWindow(parent)
{
setWindowTitle(tr("GameCube TAS Input %1").arg(num + 1));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
auto* main_stick_box = CreateStickInputs(this, tr("Main Stick"), m_x_main_stick_value,
m_y_main_stick_value, 255, 255, Qt::Key_F, Qt::Key_G);
auto* c_stick_box = CreateStickInputs(this, tr("C Stick"), m_x_c_stick_value, m_y_c_stick_value,
255, 255, Qt::Key_H, Qt::Key_J);
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);
auto* top_layout = new QHBoxLayout;
top_layout->addWidget(main_stick_box);
top_layout->addWidget(c_stick_box);
top_layout->addWidget(m_main_stick_box);
top_layout->addWidget(m_c_stick_box);
auto* triggers_box = new QGroupBox(tr("Triggers"));
m_triggers_box = new QGroupBox(tr("Triggers"));
auto* l_trigger_layout = CreateSliderValuePairLayout(this, tr("Left"), m_l_trigger_value, 255,
Qt::Key_N, triggers_box);
auto* r_trigger_layout = CreateSliderValuePairLayout(this, tr("Right"), m_r_trigger_value, 255,
Qt::Key_M, triggers_box);
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);
auto* triggers_layout = new QVBoxLayout;
triggers_layout->addLayout(l_trigger_layout);
triggers_layout->addLayout(r_trigger_layout);
triggers_box->setLayout(triggers_layout);
m_triggers_box->setLayout(triggers_layout);
m_a_button = new QCheckBox(QStringLiteral("&A"));
m_b_button = new QCheckBox(QStringLiteral("&B"));
@@ -76,42 +73,35 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent)
buttons_layout->addLayout(buttons_layout1);
buttons_layout->addLayout(buttons_layout2);
auto* buttons_box = new QGroupBox(tr("Buttons"));
buttons_box->setLayout(buttons_layout);
m_buttons_box = new QGroupBox(tr("Buttons"));
m_buttons_box->setLayout(buttons_layout);
auto* layout = new QVBoxLayout;
layout->addLayout(top_layout);
layout->addWidget(triggers_box);
layout->addWidget(buttons_box);
layout->addWidget(m_triggers_box);
layout->addWidget(m_buttons_box);
layout->addWidget(m_use_controller);
setLayout(layout);
}
static void SetButton(QCheckBox* button, GCPadStatus* pad, u16 mask)
{
if (button->isChecked())
pad->button |= mask;
else
pad->button &= ~mask;
}
void GCTASInputWindow::GetValues(GCPadStatus* pad)
{
if (!isVisible())
return;
SetButton(m_a_button, pad, PAD_BUTTON_A);
SetButton(m_b_button, pad, PAD_BUTTON_B);
SetButton(m_x_button, pad, PAD_BUTTON_X);
SetButton(m_y_button, pad, PAD_BUTTON_Y);
SetButton(m_z_button, pad, PAD_TRIGGER_Z);
SetButton(m_l_button, pad, PAD_TRIGGER_L);
SetButton(m_r_button, pad, PAD_TRIGGER_R);
SetButton(m_left_button, pad, PAD_BUTTON_LEFT);
SetButton(m_up_button, pad, PAD_BUTTON_UP);
SetButton(m_down_button, pad, PAD_BUTTON_DOWN);
SetButton(m_right_button, pad, PAD_BUTTON_RIGHT);
SetButton(m_start_button, pad, PAD_BUTTON_START);
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);
if (m_a_button->isChecked())
pad->analogA = 0xFF;
@@ -123,11 +113,12 @@ void GCTASInputWindow::GetValues(GCPadStatus* pad)
else
pad->analogB = 0x00;
pad->triggerLeft = m_l_trigger_value->value();
pad->triggerRight = m_r_trigger_value->value();
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);
pad->stickX = m_x_main_stick_value->value();
pad->stickY = m_y_main_stick_value->value();
pad->substickX = m_x_c_stick_value->value();
pad->substickY = m_y_c_stick_value->value();
GetSpinBoxU8(m_x_c_stick_value, pad->substickX);
GetSpinBoxU8(m_y_c_stick_value, pad->substickY);
}
@@ -4,15 +4,14 @@
#pragma once
#include <QDialog>
#include "Common/CommonTypes.h"
#include "DolphinQt/TAS/TASInputWindow.h"
class QCheckBox;
class QGroupBox;
class QSpinBox;
struct GCPadStatus;
class GCTASInputWindow : public QDialog
class GCTASInputWindow : public TASInputWindow
{
Q_OBJECT
public:
@@ -38,4 +37,8 @@ class GCTASInputWindow : public QDialog
QSpinBox* m_y_main_stick_value;
QSpinBox* m_x_c_stick_value;
QSpinBox* m_y_c_stick_value;
QGroupBox* m_main_stick_box;
QGroupBox* m_c_stick_box;
QGroupBox* m_triggers_box;
QGroupBox* m_buttons_box;
};

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 8c97fb7

Please sign in to comment.