early-access version 1916
This commit is contained in:
@@ -6,10 +6,13 @@
|
||||
#include <QLayout>
|
||||
#include <QString>
|
||||
#include "common/settings.h"
|
||||
#include "input_common/main.h"
|
||||
#include "input_common/tas/tas_input.h"
|
||||
#include "yuzu/configuration/configure_input_player_widget.h"
|
||||
#include "yuzu/debugger/controller.h"
|
||||
|
||||
ControllerDialog::ControllerDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) {
|
||||
ControllerDialog::ControllerDialog(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_)
|
||||
: QWidget(parent, Qt::Dialog), input_subsystem{input_subsystem_} {
|
||||
setObjectName(QStringLiteral("Controller"));
|
||||
setWindowTitle(tr("Controller P1"));
|
||||
resize(500, 350);
|
||||
@@ -38,6 +41,9 @@ void ControllerDialog::refreshConfiguration() {
|
||||
constexpr std::size_t player = 0;
|
||||
widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
|
||||
widget->SetControllerType(players[player].controller_type);
|
||||
ControllerCallback callback{[this](ControllerInput input) { InputController(input); }};
|
||||
widget->SetCallBack(callback);
|
||||
widget->repaint();
|
||||
widget->SetConnectedStatus(players[player].connected);
|
||||
}
|
||||
|
||||
@@ -67,3 +73,13 @@ void ControllerDialog::hideEvent(QHideEvent* ev) {
|
||||
widget->SetConnectedStatus(false);
|
||||
QWidget::hideEvent(ev);
|
||||
}
|
||||
|
||||
void ControllerDialog::InputController(ControllerInput input) {
|
||||
u32 buttons = 0;
|
||||
int index = 0;
|
||||
for (bool btn : input.button_values) {
|
||||
buttons |= (btn ? 1U : 0U) << index;
|
||||
index++;
|
||||
}
|
||||
input_subsystem->GetTas()->RecordInput(buttons, input.axis_values);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user