Merge pull request #7949 from spycrab/turbo_btn
Qt/TAS: Implement turbo mode
This commit is contained in:
commit
923151e3e3
|
@ -111,7 +111,7 @@ add_executable(dolphin-emu
|
|||
QtUtils/WinIconHelper.cpp
|
||||
QtUtils/WrapInScrollArea.cpp
|
||||
QtUtils/AspectRatioWidget.cpp
|
||||
ResourcePackManager.cpp
|
||||
ResourcePackManager.cpp
|
||||
Settings/AdvancedPane.cpp
|
||||
Settings/AudioPane.cpp
|
||||
Settings/GameCubePane.cpp
|
||||
|
@ -122,6 +122,7 @@ add_executable(dolphin-emu
|
|||
Settings/USBDeviceAddToWhitelistDialog.cpp
|
||||
TAS/GCTASInputWindow.cpp
|
||||
TAS/WiiTASInputWindow.cpp
|
||||
TAS/TASCheckBox.cpp
|
||||
TAS/TASInputWindow.cpp
|
||||
TAS/StickWidget.cpp
|
||||
TAS/IRWidget.cpp
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<QtMoc Include="FIFO\FIFOPlayerWindow.h" />
|
||||
<QtMoc Include="TAS\GCTASInputWindow.h" />
|
||||
<QtMoc Include="TAS\WiiTASInputWindow.h" />
|
||||
<QtMoc Include="TAS\TASCheckBox.h" />
|
||||
<QtMoc Include="TAS\TASInputWindow.h" />
|
||||
<QtMoc Include="TAS\StickWidget.h" />
|
||||
<QtMoc Include="TAS\IRWidget.h" />
|
||||
|
@ -263,6 +264,7 @@
|
|||
<ClCompile Include="$(QtMocOutPrefix)SettingsWindow.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)SoftwareRendererWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)StickWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)TASCheckBox.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)TASInputWindow.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)ToolBar.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)USBDeviceAddToWhitelistDialog.cpp" />
|
||||
|
@ -342,6 +344,7 @@
|
|||
<ClCompile Include="ResourcePackManager.cpp" />
|
||||
<ClCompile Include="TAS\GCTASInputWindow.cpp" />
|
||||
<ClCompile Include="TAS\WiiTASInputWindow.cpp" />
|
||||
<ClCompile Include="TAS\TASCheckBox.cpp" />
|
||||
<ClCompile Include="TAS\TASInputWindow.cpp" />
|
||||
<ClCompile Include="TAS\StickWidget.cpp" />
|
||||
<ClCompile Include="TAS\IRWidget.cpp" />
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include "DolphinQt/TAS/TASCheckBox.h"
|
||||
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : TASInputWindow(parent)
|
||||
|
@ -41,18 +43,18 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : TASInputWindow(pa
|
|||
triggers_layout->addLayout(r_trigger_layout);
|
||||
m_triggers_box->setLayout(triggers_layout);
|
||||
|
||||
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"));
|
||||
m_a_button = new TASCheckBox(QStringLiteral("&A"));
|
||||
m_b_button = new TASCheckBox(QStringLiteral("&B"));
|
||||
m_x_button = new TASCheckBox(QStringLiteral("&X"));
|
||||
m_y_button = new TASCheckBox(QStringLiteral("&Y"));
|
||||
m_z_button = new TASCheckBox(QStringLiteral("&Z"));
|
||||
m_l_button = new TASCheckBox(QStringLiteral("&L"));
|
||||
m_r_button = new TASCheckBox(QStringLiteral("&R"));
|
||||
m_start_button = new TASCheckBox(QStringLiteral("&START"));
|
||||
m_left_button = new TASCheckBox(QStringLiteral("L&eft"));
|
||||
m_up_button = new TASCheckBox(QStringLiteral("&Up"));
|
||||
m_down_button = new TASCheckBox(QStringLiteral("&Down"));
|
||||
m_right_button = new TASCheckBox(QStringLiteral("R&ight"));
|
||||
|
||||
auto* buttons_layout = new QGridLayout;
|
||||
buttons_layout->addWidget(m_a_button, 0, 0);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#include "DolphinQt/TAS/TASInputWindow.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
class QSpinBox;
|
||||
class TASCheckBox;
|
||||
struct GCPadStatus;
|
||||
|
||||
class GCTASInputWindow : public TASInputWindow
|
||||
|
@ -19,18 +19,18 @@ public:
|
|||
void GetValues(GCPadStatus* pad);
|
||||
|
||||
private:
|
||||
QCheckBox* m_a_button;
|
||||
QCheckBox* m_b_button;
|
||||
QCheckBox* m_x_button;
|
||||
QCheckBox* m_y_button;
|
||||
QCheckBox* m_z_button;
|
||||
QCheckBox* m_l_button;
|
||||
QCheckBox* m_r_button;
|
||||
QCheckBox* m_start_button;
|
||||
QCheckBox* m_left_button;
|
||||
QCheckBox* m_up_button;
|
||||
QCheckBox* m_down_button;
|
||||
QCheckBox* m_right_button;
|
||||
TASCheckBox* m_a_button;
|
||||
TASCheckBox* m_b_button;
|
||||
TASCheckBox* m_x_button;
|
||||
TASCheckBox* m_y_button;
|
||||
TASCheckBox* m_z_button;
|
||||
TASCheckBox* m_l_button;
|
||||
TASCheckBox* m_r_button;
|
||||
TASCheckBox* m_start_button;
|
||||
TASCheckBox* m_left_button;
|
||||
TASCheckBox* m_up_button;
|
||||
TASCheckBox* m_down_button;
|
||||
TASCheckBox* m_right_button;
|
||||
QSpinBox* m_l_trigger_value;
|
||||
QSpinBox* m_r_trigger_value;
|
||||
QSpinBox* m_x_main_stick_value;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt/TAS/TASCheckBox.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "Core/Movie.h"
|
||||
|
||||
TASCheckBox::TASCheckBox(const QString& text) : QCheckBox(text)
|
||||
{
|
||||
setTristate(true);
|
||||
}
|
||||
|
||||
bool TASCheckBox::GetValue()
|
||||
{
|
||||
if (checkState() == Qt::PartiallyChecked)
|
||||
return Movie::GetCurrentFrame() % 2 == static_cast<u64>(m_trigger_on_odd);
|
||||
|
||||
return isChecked();
|
||||
}
|
||||
|
||||
void TASCheckBox::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() != Qt::RightButton)
|
||||
{
|
||||
setChecked(!isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkState() == Qt::PartiallyChecked)
|
||||
{
|
||||
setCheckState(Qt::Unchecked);
|
||||
return;
|
||||
}
|
||||
|
||||
m_trigger_on_odd = Movie::GetCurrentFrame() % 2 == 0;
|
||||
setCheckState(Qt::PartiallyChecked);
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
class TASCheckBox : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TASCheckBox(const QString& text);
|
||||
|
||||
bool GetValue();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
bool m_trigger_on_odd;
|
||||
};
|
|
@ -18,6 +18,7 @@
|
|||
#include "DolphinQt/QtUtils/AspectRatioWidget.h"
|
||||
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
||||
#include "DolphinQt/TAS/StickWidget.h"
|
||||
#include "DolphinQt/TAS/TASCheckBox.h"
|
||||
#include "DolphinQt/TAS/TASInputWindow.h"
|
||||
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
@ -130,7 +131,7 @@ QSpinBox* TASInputWindow::CreateSliderValuePair(QBoxLayout* layout, u16 max,
|
|||
}
|
||||
|
||||
template <typename UX>
|
||||
void TASInputWindow::GetButton(QCheckBox* checkbox, UX& buttons, UX mask)
|
||||
void TASInputWindow::GetButton(TASCheckBox* checkbox, UX& buttons, UX mask)
|
||||
{
|
||||
const bool pressed = (buttons & mask) != 0;
|
||||
if (m_use_controller->isChecked())
|
||||
|
@ -147,13 +148,13 @@ void TASInputWindow::GetButton(QCheckBox* checkbox, UX& buttons, UX mask)
|
|||
}
|
||||
}
|
||||
|
||||
if (checkbox->isChecked())
|
||||
if (checkbox->GetValue())
|
||||
buttons |= mask;
|
||||
else
|
||||
buttons &= ~mask;
|
||||
}
|
||||
template void TASInputWindow::GetButton<u8>(QCheckBox* button, u8& pad, u8 mask);
|
||||
template void TASInputWindow::GetButton<u16>(QCheckBox* button, u16& pad, u16 mask);
|
||||
template void TASInputWindow::GetButton<u8>(TASCheckBox* button, u8& pad, u8 mask);
|
||||
template void TASInputWindow::GetButton<u16>(TASCheckBox* button, u16& pad, u16 mask);
|
||||
|
||||
void TASInputWindow::GetSpinBoxU8(QSpinBox* spin, u8& controller_value)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ class QDialog;
|
|||
class QGroupBox;
|
||||
class QSpinBox;
|
||||
class QString;
|
||||
class TASCheckBox;
|
||||
|
||||
class TASInputWindow : public QDialog
|
||||
{
|
||||
|
@ -32,13 +33,13 @@ protected:
|
|||
Qt::Orientation orientation, QWidget* shortcut_widget,
|
||||
bool invert = false);
|
||||
template <typename UX>
|
||||
void GetButton(QCheckBox* button, UX& pad, UX mask);
|
||||
void GetButton(TASCheckBox* button, UX& pad, UX mask);
|
||||
void GetSpinBoxU8(QSpinBox* spin, u8& controller_value);
|
||||
void GetSpinBoxU16(QSpinBox* spin, u16& controller_value);
|
||||
QCheckBox* m_use_controller;
|
||||
|
||||
private:
|
||||
std::map<QCheckBox*, bool> m_checkbox_set_by_controller;
|
||||
std::map<TASCheckBox*, bool> m_checkbox_set_by_controller;
|
||||
std::map<QSpinBox*, u8> m_spinbox_most_recent_values_u8;
|
||||
std::map<QSpinBox*, u8> m_spinbox_most_recent_values_u16;
|
||||
};
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "DolphinQt/QtUtils/AspectRatioWidget.h"
|
||||
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
||||
#include "DolphinQt/TAS/IRWidget.h"
|
||||
#include "DolphinQt/TAS/TASCheckBox.h"
|
||||
#include "DolphinQt/TAS/WiiTASInputWindow.h"
|
||||
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
@ -161,19 +162,19 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
|
|||
triggers_layout->addLayout(r_trigger_layout);
|
||||
m_triggers_box->setLayout(triggers_layout);
|
||||
|
||||
m_a_button = new QCheckBox(QStringLiteral("&A"));
|
||||
m_b_button = new QCheckBox(QStringLiteral("&B"));
|
||||
m_1_button = new QCheckBox(QStringLiteral("&1"));
|
||||
m_2_button = new QCheckBox(QStringLiteral("&2"));
|
||||
m_plus_button = new QCheckBox(QStringLiteral("&+"));
|
||||
m_minus_button = new QCheckBox(QStringLiteral("&-"));
|
||||
m_home_button = new QCheckBox(QStringLiteral("&HOME"));
|
||||
m_left_button = new QCheckBox(QStringLiteral("&Left"));
|
||||
m_up_button = new QCheckBox(QStringLiteral("&Up"));
|
||||
m_down_button = new QCheckBox(QStringLiteral("&Down"));
|
||||
m_right_button = new QCheckBox(QStringLiteral("&Right"));
|
||||
m_c_button = new QCheckBox(QStringLiteral("&C"));
|
||||
m_z_button = new QCheckBox(QStringLiteral("&Z"));
|
||||
m_a_button = new TASCheckBox(QStringLiteral("&A"));
|
||||
m_b_button = new TASCheckBox(QStringLiteral("&B"));
|
||||
m_1_button = new TASCheckBox(QStringLiteral("&1"));
|
||||
m_2_button = new TASCheckBox(QStringLiteral("&2"));
|
||||
m_plus_button = new TASCheckBox(QStringLiteral("&+"));
|
||||
m_minus_button = new TASCheckBox(QStringLiteral("&-"));
|
||||
m_home_button = new TASCheckBox(QStringLiteral("&HOME"));
|
||||
m_left_button = new TASCheckBox(QStringLiteral("&Left"));
|
||||
m_up_button = new TASCheckBox(QStringLiteral("&Up"));
|
||||
m_down_button = new TASCheckBox(QStringLiteral("&Down"));
|
||||
m_right_button = new TASCheckBox(QStringLiteral("&Right"));
|
||||
m_c_button = new TASCheckBox(QStringLiteral("&C"));
|
||||
m_z_button = new TASCheckBox(QStringLiteral("&Z"));
|
||||
|
||||
auto* buttons_layout = new QGridLayout;
|
||||
buttons_layout->addWidget(m_a_button, 0, 0);
|
||||
|
@ -202,21 +203,21 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
|
|||
m_nunchuk_buttons_box = new QGroupBox(tr("Nunchuk Buttons"));
|
||||
m_nunchuk_buttons_box->setLayout(nunchuk_buttons_layout);
|
||||
|
||||
m_classic_a_button = new QCheckBox(QStringLiteral("&A"));
|
||||
m_classic_b_button = new QCheckBox(QStringLiteral("&B"));
|
||||
m_classic_x_button = new QCheckBox(QStringLiteral("&X"));
|
||||
m_classic_y_button = new QCheckBox(QStringLiteral("&Y"));
|
||||
m_classic_l_button = new QCheckBox(QStringLiteral("&L"));
|
||||
m_classic_r_button = new QCheckBox(QStringLiteral("&R"));
|
||||
m_classic_zl_button = new QCheckBox(QStringLiteral("&ZL"));
|
||||
m_classic_zr_button = new QCheckBox(QStringLiteral("ZR"));
|
||||
m_classic_plus_button = new QCheckBox(QStringLiteral("&+"));
|
||||
m_classic_minus_button = new QCheckBox(QStringLiteral("&-"));
|
||||
m_classic_home_button = new QCheckBox(QStringLiteral("&HOME"));
|
||||
m_classic_left_button = new QCheckBox(QStringLiteral("L&eft"));
|
||||
m_classic_up_button = new QCheckBox(QStringLiteral("&Up"));
|
||||
m_classic_down_button = new QCheckBox(QStringLiteral("&Down"));
|
||||
m_classic_right_button = new QCheckBox(QStringLiteral("R&ight"));
|
||||
m_classic_a_button = new TASCheckBox(QStringLiteral("&A"));
|
||||
m_classic_b_button = new TASCheckBox(QStringLiteral("&B"));
|
||||
m_classic_x_button = new TASCheckBox(QStringLiteral("&X"));
|
||||
m_classic_y_button = new TASCheckBox(QStringLiteral("&Y"));
|
||||
m_classic_l_button = new TASCheckBox(QStringLiteral("&L"));
|
||||
m_classic_r_button = new TASCheckBox(QStringLiteral("&R"));
|
||||
m_classic_zl_button = new TASCheckBox(QStringLiteral("&ZL"));
|
||||
m_classic_zr_button = new TASCheckBox(QStringLiteral("ZR"));
|
||||
m_classic_plus_button = new TASCheckBox(QStringLiteral("&+"));
|
||||
m_classic_minus_button = new TASCheckBox(QStringLiteral("&-"));
|
||||
m_classic_home_button = new TASCheckBox(QStringLiteral("&HOME"));
|
||||
m_classic_left_button = new TASCheckBox(QStringLiteral("L&eft"));
|
||||
m_classic_up_button = new TASCheckBox(QStringLiteral("&Up"));
|
||||
m_classic_down_button = new TASCheckBox(QStringLiteral("&Down"));
|
||||
m_classic_right_button = new TASCheckBox(QStringLiteral("R&ight"));
|
||||
|
||||
auto* classic_buttons_layout = new QGridLayout;
|
||||
classic_buttons_layout->addWidget(m_classic_a_button, 0, 0);
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace WiimoteEmu
|
|||
class EncryptionKey;
|
||||
}
|
||||
|
||||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
class QSpinBox;
|
||||
class TASCheckBox;
|
||||
|
||||
class WiiTASInputWindow : public TASInputWindow
|
||||
{
|
||||
|
@ -31,34 +31,34 @@ public:
|
|||
private:
|
||||
void UpdateExt(u8 ext);
|
||||
int m_num;
|
||||
QCheckBox* m_a_button;
|
||||
QCheckBox* m_b_button;
|
||||
QCheckBox* m_1_button;
|
||||
QCheckBox* m_2_button;
|
||||
QCheckBox* m_plus_button;
|
||||
QCheckBox* m_minus_button;
|
||||
QCheckBox* m_home_button;
|
||||
QCheckBox* m_left_button;
|
||||
QCheckBox* m_up_button;
|
||||
QCheckBox* m_down_button;
|
||||
QCheckBox* m_right_button;
|
||||
QCheckBox* m_c_button;
|
||||
QCheckBox* m_z_button;
|
||||
QCheckBox* m_classic_a_button;
|
||||
QCheckBox* m_classic_b_button;
|
||||
QCheckBox* m_classic_x_button;
|
||||
QCheckBox* m_classic_y_button;
|
||||
QCheckBox* m_classic_plus_button;
|
||||
QCheckBox* m_classic_minus_button;
|
||||
QCheckBox* m_classic_l_button;
|
||||
QCheckBox* m_classic_r_button;
|
||||
QCheckBox* m_classic_zl_button;
|
||||
QCheckBox* m_classic_zr_button;
|
||||
QCheckBox* m_classic_home_button;
|
||||
QCheckBox* m_classic_left_button;
|
||||
QCheckBox* m_classic_up_button;
|
||||
QCheckBox* m_classic_down_button;
|
||||
QCheckBox* m_classic_right_button;
|
||||
TASCheckBox* m_a_button;
|
||||
TASCheckBox* m_b_button;
|
||||
TASCheckBox* m_1_button;
|
||||
TASCheckBox* m_2_button;
|
||||
TASCheckBox* m_plus_button;
|
||||
TASCheckBox* m_minus_button;
|
||||
TASCheckBox* m_home_button;
|
||||
TASCheckBox* m_left_button;
|
||||
TASCheckBox* m_up_button;
|
||||
TASCheckBox* m_down_button;
|
||||
TASCheckBox* m_right_button;
|
||||
TASCheckBox* m_c_button;
|
||||
TASCheckBox* m_z_button;
|
||||
TASCheckBox* m_classic_a_button;
|
||||
TASCheckBox* m_classic_b_button;
|
||||
TASCheckBox* m_classic_x_button;
|
||||
TASCheckBox* m_classic_y_button;
|
||||
TASCheckBox* m_classic_plus_button;
|
||||
TASCheckBox* m_classic_minus_button;
|
||||
TASCheckBox* m_classic_l_button;
|
||||
TASCheckBox* m_classic_r_button;
|
||||
TASCheckBox* m_classic_zl_button;
|
||||
TASCheckBox* m_classic_zr_button;
|
||||
TASCheckBox* m_classic_home_button;
|
||||
TASCheckBox* m_classic_left_button;
|
||||
TASCheckBox* m_classic_up_button;
|
||||
TASCheckBox* m_classic_down_button;
|
||||
TASCheckBox* m_classic_right_button;
|
||||
QSpinBox* m_remote_orientation_x_value;
|
||||
QSpinBox* m_remote_orientation_y_value;
|
||||
QSpinBox* m_remote_orientation_z_value;
|
||||
|
|
Loading…
Reference in New Issue