IR widget is now a rectangle
This commit is contained in:
parent
d07e212cef
commit
a8d482d8e1
|
@ -109,6 +109,7 @@ set(SRCS
|
|||
TAS/WiiTASInputWindow.cpp
|
||||
TAS/Shared.cpp
|
||||
TAS/StickWidget.cpp
|
||||
TAS/IRWidget.cpp
|
||||
)
|
||||
|
||||
list(APPEND LIBS core uicommon)
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
<QtMoc Include="TAS\GCTASInputWindow.h" />
|
||||
<QtMoc Include="TAS\WiiTASInputWindow.h" />
|
||||
<QtMoc Include="TAS\StickWidget.h" />
|
||||
<QtMoc Include="TAS\IRWidget.h" />
|
||||
<QtMoc Include="Debugger\BreakpointWidget.h" />
|
||||
<QtMoc Include="Debugger\NewBreakpointDialog.h" />
|
||||
<QtMoc Include="Debugger\RegisterWidget.h" />
|
||||
|
@ -138,6 +139,7 @@
|
|||
<ClCompile Include="$(QtMocOutPrefix)GCTASInputWindow.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)WiiTASInputWindow.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)StickWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)IRWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)FilesystemWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)WindowActivationEventFilter.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)GameList.cpp" />
|
||||
|
@ -230,6 +232,7 @@
|
|||
<ClCompile Include="TAS\GCTASInputWindow.cpp" />
|
||||
<ClCompile Include="TAS\WiiTASInputWindow.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" />
|
||||
|
|
|
@ -1099,7 +1099,7 @@ void MainWindow::OnExportRecording()
|
|||
|
||||
void MainWindow::ShowTASInput()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < num_gc_controllers; i++)
|
||||
{
|
||||
if (SConfig::GetInstance().m_SIDevice[i] != SerialInterface::SIDEVICE_NONE &&
|
||||
SConfig::GetInstance().m_SIDevice[i] != SerialInterface::SIDEVICE_GC_GBA)
|
||||
|
@ -1110,7 +1110,7 @@ void MainWindow::ShowTASInput()
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < num_wii_controllers; i++)
|
||||
{
|
||||
if (g_wiimote_sources[i] == WIIMOTE_SRC_EMU &&
|
||||
(!Core::IsRunning() || SConfig::GetInstance().bWii))
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/TAS/GCTASInputWindow.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "DolphinQt2/TAS/Shared.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
|
@ -13,6 +10,10 @@
|
|||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "DolphinQt2/TAS/Shared.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("GameCube TAS Input %1").arg(num + 1));
|
||||
|
@ -29,8 +30,8 @@ GCTASInputWindow::GCTASInputWindow(QWidget* parent, int num) : QDialog(parent)
|
|||
|
||||
auto* l_trigger_layout = CreateSliderValuePairLayout(this, tr("Left (ALT+N)"), m_l_trigger_value,
|
||||
255, Qt::Key_N, triggers_box);
|
||||
auto* r_trigger_layout = CreateSliderValuePairLayout(
|
||||
this, tr("Right (ALT+M)"), m_r_trigger_value, 255, Qt::Key_M, triggers_box);
|
||||
auto* r_trigger_layout = CreateSliderValuePairLayout(this, tr("Right (ALT+M)"), m_r_trigger_value,
|
||||
255, Qt::Key_M, triggers_box);
|
||||
|
||||
auto* triggers_layout = new QVBoxLayout;
|
||||
triggers_layout->addLayout(l_trigger_layout);
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/TAS/IRWidget.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
IRWidget::IRWidget(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
setMouseTracking(false);
|
||||
}
|
||||
|
||||
void IRWidget::SetX(u16 x)
|
||||
{
|
||||
m_x = std::min(max_x, x);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void IRWidget::SetY(u16 y)
|
||||
{
|
||||
m_y = std::min(max_y, y);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void IRWidget::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
painter.setBrush(Qt::white);
|
||||
painter.drawRect(0, 0, width() - 1, height() - 1);
|
||||
|
||||
painter.drawLine(0, height() / 2, width(), height() / 2);
|
||||
painter.drawLine(width() / 2, 0, width() / 2, height());
|
||||
|
||||
// convert from value space to widget space
|
||||
u16 x = width() - (m_x * width()) / max_x;
|
||||
u16 y = (m_y * height()) / max_y;
|
||||
|
||||
painter.drawLine(width() / 2, height() / 2, x, y);
|
||||
|
||||
painter.setBrush(Qt::blue);
|
||||
int wh_avg = (width() + height()) / 2;
|
||||
int radius = wh_avg / 30;
|
||||
painter.drawEllipse(x - radius, y - radius, radius * 2, radius * 2);
|
||||
}
|
||||
|
||||
void IRWidget::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
handleMouseEvent(event);
|
||||
}
|
||||
|
||||
void IRWidget::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
handleMouseEvent(event);
|
||||
}
|
||||
|
||||
void IRWidget::handleMouseEvent(QMouseEvent* event)
|
||||
{
|
||||
// convert from widget space to value space
|
||||
int new_x = max_x - (event->x() * max_x) / width();
|
||||
int new_y = (event->y() * max_y) / height();
|
||||
|
||||
m_x = std::max(0, std::min(static_cast<int>(max_x), new_x));
|
||||
m_y = std::max(0, std::min(static_cast<int>(max_y), new_y));
|
||||
|
||||
emit ChangedX(m_x);
|
||||
emit ChangedY(m_y);
|
||||
update();
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class IRWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit IRWidget(QWidget* parent);
|
||||
|
||||
signals:
|
||||
void ChangedX(u16 x);
|
||||
void ChangedY(u16 y);
|
||||
|
||||
public slots:
|
||||
void SetX(u16 x);
|
||||
void SetY(u16 y);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void handleMouseEvent(QMouseEvent* event);
|
||||
|
||||
public:
|
||||
static constexpr u16 max_x = 1023;
|
||||
static constexpr u16 max_y = 767;
|
||||
|
||||
private:
|
||||
u16 m_x = 0;
|
||||
u16 m_y = 0;
|
||||
};
|
|
@ -3,10 +3,6 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/TAS/Shared.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "DolphinQt2/QtUtils/AspectRatioWidget.h"
|
||||
#include "DolphinQt2/TAS/StickWidget.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
|
@ -16,6 +12,11 @@
|
|||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "DolphinQt2/QtUtils/AspectRatioWidget.h"
|
||||
#include "DolphinQt2/TAS/StickWidget.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value, QSpinBox*& y_value,
|
||||
u16 max_x, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key)
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value,
|
|||
|
||||
auto* y_layout = new QVBoxLayout;
|
||||
y_value = CreateSliderValuePair(window, y_layout, max_y, y_shortcut_key, Qt::Vertical, box);
|
||||
(y_value)->setMaximumWidth(60);
|
||||
y_value->setMaximumWidth(60);
|
||||
|
||||
auto* visual = new StickWidget(window, max_x, max_y);
|
||||
window->connect(x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
|
||||
|
@ -36,8 +37,8 @@ QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value,
|
|||
window->connect(visual, &StickWidget::ChangedX, x_value, &QSpinBox::setValue);
|
||||
window->connect(visual, &StickWidget::ChangedY, y_value, &QSpinBox::setValue);
|
||||
|
||||
(x_value)->setValue(max_x / 2);
|
||||
(y_value)->setValue(max_y / 2);
|
||||
x_value->setValue(max_x / 2);
|
||||
y_value->setValue(max_y / 2);
|
||||
|
||||
auto* visual_ar = new AspectRatioWidget(visual, max_x, max_y);
|
||||
|
||||
|
@ -52,16 +53,17 @@ QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value,
|
|||
|
||||
return box;
|
||||
}
|
||||
|
||||
QBoxLayout* CreateSliderValuePairLayout(QDialog* window, QString name, QSpinBox*& value, u16 max,
|
||||
Qt::Key shortcut_key, QWidget* shortcut_widget)
|
||||
Qt::Key shortcut_key, QWidget* shortcut_widget, bool invert)
|
||||
{
|
||||
auto* label = new QLabel(name);
|
||||
|
||||
QBoxLayout* layout = new QHBoxLayout;
|
||||
layout->addWidget(label);
|
||||
|
||||
value =
|
||||
CreateSliderValuePair(window, layout, max, shortcut_key, Qt::Horizontal, shortcut_widget);
|
||||
value = CreateSliderValuePair(window, layout, max, shortcut_key, Qt::Horizontal, shortcut_widget,
|
||||
invert);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
@ -69,7 +71,7 @@ QBoxLayout* CreateSliderValuePairLayout(QDialog* window, QString name, QSpinBox*
|
|||
// The shortcut_widget argument needs to specify the container widget that will be hidden/shown.
|
||||
// This is done to avoid ambigous shortcuts
|
||||
QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, Qt::Key shortcut_key,
|
||||
Qt::Orientation orientation, QWidget* shortcut_widget)
|
||||
Qt::Orientation orientation, QWidget* shortcut_widget, bool invert)
|
||||
{
|
||||
auto* value = new QSpinBox();
|
||||
value->setRange(0, 99999);
|
||||
|
@ -81,6 +83,7 @@ QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, Qt
|
|||
auto* slider = new QSlider(orientation);
|
||||
slider->setRange(0, max);
|
||||
slider->setFocusPolicy(Qt::ClickFocus);
|
||||
slider->setInvertedAppearance(invert);
|
||||
|
||||
window->connect(slider, &QSlider::valueChanged, value, &QSpinBox::setValue);
|
||||
window->connect(value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), slider,
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class QDialog;
|
||||
class QString;
|
||||
class QSpinBox;
|
||||
|
@ -19,6 +19,8 @@ struct GCPadStatus;
|
|||
QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value, QSpinBox*& y_value,
|
||||
u16 max_x, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key);
|
||||
QBoxLayout* CreateSliderValuePairLayout(QDialog* window, QString name, QSpinBox*& value, u16 max,
|
||||
Qt::Key shortcut_key, QWidget* shortcut_widget);
|
||||
Qt::Key shortcut_key, QWidget* shortcut_widget,
|
||||
bool invert = false);
|
||||
QSpinBox* CreateSliderValuePair(QDialog* window, QBoxLayout* layout, u16 max, Qt::Key shortcut_key,
|
||||
Qt::Orientation orientation, QWidget* shortcut_widget);
|
||||
Qt::Orientation orientation, QWidget* shortcut_widget,
|
||||
bool invert = false);
|
||||
|
|
|
@ -3,14 +3,16 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/TAS/StickWidget.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include <algorithm>
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
StickWidget::StickWidget(QWidget* parent, u16 max_x, u16 max_y) : QWidget(parent), m_max_x(max_x), m_max_y(max_y)
|
||||
StickWidget::StickWidget(QWidget* parent, u16 max_x, u16 max_y)
|
||||
: QWidget(parent), m_max_x(max_x), m_max_y(max_y)
|
||||
{
|
||||
setMouseTracking(false);
|
||||
}
|
||||
|
|
|
@ -3,14 +3,6 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/TAS/WiiTASInputWindow.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Classic.h"
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Nunchuk.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "DolphinQt2/TAS/Shared.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
|
@ -18,10 +10,54 @@
|
|||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Classic.h"
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Nunchuk.h"
|
||||
#include "Core/HW/WiimoteEmu/Encryption.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "DolphinQt2/QtUtils/AspectRatioWidget.h"
|
||||
#include "DolphinQt2/TAS/IRWidget.h"
|
||||
#include "DolphinQt2/TAS/Shared.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : QDialog(parent), m_num(num)
|
||||
{
|
||||
m_ir_box = CreateStickInputs(this, tr("IR (ALT+F/G)"), m_ir_x_value, m_ir_y_value, 1023, 767,
|
||||
Qt::Key_F, Qt::Key_G);
|
||||
m_ir_box = new QGroupBox(tr("IR (ALT+F/G)"));
|
||||
|
||||
auto* x_layout = new QHBoxLayout;
|
||||
m_ir_x_value = CreateSliderValuePair(this, x_layout, IRWidget::max_x, Qt::Key_F, Qt::Horizontal,
|
||||
m_ir_box, true);
|
||||
|
||||
auto* y_layout = new QVBoxLayout;
|
||||
m_ir_y_value = CreateSliderValuePair(this, y_layout, IRWidget::max_y, Qt::Key_G, Qt::Vertical,
|
||||
m_ir_box, true);
|
||||
m_ir_y_value->setMaximumWidth(60);
|
||||
|
||||
auto* visual = new IRWidget(this);
|
||||
connect(m_ir_x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
|
||||
&IRWidget::SetX);
|
||||
connect(m_ir_y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
|
||||
&IRWidget::SetY);
|
||||
connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue);
|
||||
connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue);
|
||||
|
||||
m_ir_x_value->setValue(IRWidget::max_x / 2);
|
||||
m_ir_y_value->setValue(IRWidget::max_y / 2);
|
||||
|
||||
auto* visual_ar = new AspectRatioWidget(visual, IRWidget::max_x, IRWidget::max_y);
|
||||
|
||||
auto* visual_layout = new QHBoxLayout;
|
||||
visual_layout->addWidget(visual_ar);
|
||||
visual_layout->addLayout(y_layout);
|
||||
|
||||
auto* ir_layout = new QVBoxLayout;
|
||||
ir_layout->addLayout(x_layout);
|
||||
ir_layout->addLayout(visual_layout);
|
||||
m_ir_box->setLayout(ir_layout);
|
||||
|
||||
m_nunchuk_stick_box =
|
||||
CreateStickInputs(this, tr("Nunchuk Stick (ALT+X/Y)"), m_nunchuk_stick_x_value,
|
||||
m_nunchuk_stick_y_value, 255, 255, Qt::Key_X, Qt::Key_Y);
|
||||
|
@ -258,7 +294,8 @@ void WiiTASInputWindow::UpdateExt(u8 ext)
|
|||
}
|
||||
}
|
||||
|
||||
template <typename ux> static void SetButton(QCheckBox* check_box, ux* buttons, ux mask)
|
||||
template <typename UX>
|
||||
static void SetButton(QCheckBox* check_box, UX* buttons, UX mask)
|
||||
{
|
||||
if (check_box->isChecked())
|
||||
*buttons |= mask;
|
||||
|
@ -267,7 +304,7 @@ template <typename ux> static void SetButton(QCheckBox* check_box, ux* buttons,
|
|||
}
|
||||
|
||||
void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rptf, int ext,
|
||||
const wiimote_key key)
|
||||
wiimote_key key)
|
||||
{
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
@ -281,7 +318,7 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
|
||||
if (m_remote_buttons_box->isVisible() && buttons_data)
|
||||
{
|
||||
u16* buttons = &((wm_buttons*)buttons_data)->hex;
|
||||
u16* buttons = &(reinterpret_cast<wm_buttons*>(buttons_data))->hex;
|
||||
SetButton<u16>(m_a_button, buttons, WiimoteEmu::Wiimote::BUTTON_A);
|
||||
SetButton<u16>(m_b_button, buttons, WiimoteEmu::Wiimote::BUTTON_B);
|
||||
SetButton<u16>(m_1_button, buttons, WiimoteEmu::Wiimote::BUTTON_ONE);
|
||||
|
@ -297,8 +334,8 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
|
||||
if (m_remote_orientation_box->isVisible() && accel_data && buttons_data)
|
||||
{
|
||||
wm_accel& accel = *(wm_accel*)accel_data;
|
||||
wm_buttons& buttons = *(wm_buttons*)buttons_data;
|
||||
wm_accel& accel = *reinterpret_cast<wm_accel*>(accel_data);
|
||||
wm_buttons& buttons = *reinterpret_cast<wm_buttons*>(buttons_data);
|
||||
|
||||
accel.x = m_remote_orientation_x_value->value() >> 2;
|
||||
accel.y = m_remote_orientation_y_value->value() >> 2;
|
||||
|
@ -328,7 +365,7 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
if (mode == 1)
|
||||
{
|
||||
memset(ir_data, 0xFF, sizeof(wm_ir_basic) * 2);
|
||||
wm_ir_basic* const ir_basic = (wm_ir_basic*)ir_data;
|
||||
wm_ir_basic* const ir_basic = reinterpret_cast<wm_ir_basic*>(ir_data);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (x[i * 2] < 1024 && y < 768)
|
||||
|
@ -354,7 +391,7 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
// TODO: this code doesnt work, resulting in no IR TAS inputs in e.g. wii sports menu when no
|
||||
// remote extension is used
|
||||
memset(ir_data, 0xFF, sizeof(wm_ir_extended) * 4);
|
||||
wm_ir_extended* const ir_extended = (wm_ir_extended*)ir_data;
|
||||
wm_ir_extended* const ir_extended = reinterpret_cast<wm_ir_extended*>(ir_data);
|
||||
for (size_t i = 0; i < x.size(); ++i)
|
||||
{
|
||||
if (x[i] < 1024 && y < 768)
|
||||
|
@ -373,7 +410,7 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
|
||||
if (ext_data && m_nunchuk_stick_box->isVisible())
|
||||
{
|
||||
wm_nc& nunchuk = *(wm_nc*)ext_data;
|
||||
wm_nc& nunchuk = *reinterpret_cast<wm_nc*>(ext_data);
|
||||
nunchuk.jx = m_nunchuk_stick_x_value->value();
|
||||
nunchuk.jy = m_nunchuk_stick_y_value->value();
|
||||
|
||||
|
@ -388,13 +425,13 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
SetButton<u8>(m_z_button, &nunchuk.bt.hex, WiimoteEmu::Nunchuk::BUTTON_Z);
|
||||
nunchuk.bt.hex ^= 0x3;
|
||||
|
||||
WiimoteEncrypt(&key, (u8*)&nunchuk, 0, sizeof(wm_nc));
|
||||
WiimoteEncrypt(&key, reinterpret_cast<u8*>(&nunchuk), 0, sizeof(wm_nc));
|
||||
}
|
||||
|
||||
if (m_classic_left_stick_box->isVisible())
|
||||
{
|
||||
wm_classic_extension& cc = *(wm_classic_extension*)ext_data;
|
||||
WiimoteDecrypt(&key, (u8*)&cc, 0, sizeof(wm_classic_extension));
|
||||
wm_classic_extension& cc = *reinterpret_cast<wm_classic_extension*>(ext_data);
|
||||
WiimoteDecrypt(&key, reinterpret_cast<u8*>(&cc), 0, sizeof(wm_classic_extension));
|
||||
cc.bt.hex = 0;
|
||||
|
||||
SetButton<u16>(m_classic_a_button, &cc.bt.hex, WiimoteEmu::Classic::BUTTON_A);
|
||||
|
@ -426,6 +463,6 @@ void WiiTASInputWindow::GetValues(u8* report_data, WiimoteEmu::ReportFeatures rp
|
|||
cc.lt1 = m_left_trigger_value->value() & 0x7;
|
||||
cc.lt2 = (m_left_trigger_value->value() >> 3) & 0x3;
|
||||
|
||||
WiimoteEncrypt(&key, (u8*)&cc, 0, sizeof(wm_classic_extension));
|
||||
WiimoteEncrypt(&key, reinterpret_cast<u8*>(&cc), 0, sizeof(wm_classic_extension));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,22 @@
|
|||
#include <QDialog>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
struct ReportFeatures;
|
||||
}
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QGroupBox;
|
||||
class QSpinBox;
|
||||
struct wiimote_key;
|
||||
|
||||
class WiiTASInputWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WiiTASInputWindow(QWidget* parent, int num);
|
||||
void GetValues(u8* input_data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
|
||||
void GetValues(u8* input_data, WiimoteEmu::ReportFeatures rptf, int ext, wiimote_key key);
|
||||
|
||||
private:
|
||||
void UpdateExt(u8 ext);
|
||||
|
|
Loading…
Reference in New Issue