yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

configure_input_player: Eliminate variable shadowing

This commit is contained in:
Morph 2022-06-13 20:01:25 -04:00
parent 1c83014526
commit fe7184c2a8
1 changed files with 37 additions and 37 deletions

View File

@ -264,15 +264,16 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param,
return QObject::tr("[unknown]"); return QObject::tr("[unknown]");
} }
ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index_,
QWidget* bottom_row, QWidget* bottom_row_,
InputCommon::InputSubsystem* input_subsystem_, InputCommon::InputSubsystem* input_subsystem_,
InputProfiles* profiles_, Core::HID::HIDCore& hid_core_, InputProfiles* profiles_, Core::HID::HIDCore& hid_core_,
bool is_powered_on_, bool debug) bool is_powered_on_, bool debug_)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index), : QWidget(parent),
debug(debug), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index{player_index_}, debug{debug_},
profiles(profiles_), timeout_timer(std::make_unique<QTimer>()), is_powered_on{is_powered_on_}, input_subsystem{input_subsystem_}, profiles(profiles_),
poll_timer(std::make_unique<QTimer>()), bottom_row(bottom_row), hid_core{hid_core_} { timeout_timer(std::make_unique<QTimer>()),
poll_timer(std::make_unique<QTimer>()), bottom_row{bottom_row_}, hid_core{hid_core_} {
if (player_index == 0) { if (player_index == 0) {
auto* emulated_controller_p1 = auto* emulated_controller_p1 =
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
@ -696,39 +697,38 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
UpdateControllerEnabledButtons(); UpdateControllerEnabledButtons();
UpdateControllerButtonNames(); UpdateControllerButtonNames();
UpdateMotionButtons(); UpdateMotionButtons();
connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) {
[this, player_index](int) { UpdateControllerAvailableButtons();
UpdateControllerAvailableButtons(); UpdateControllerEnabledButtons();
UpdateControllerEnabledButtons(); UpdateControllerButtonNames();
UpdateControllerButtonNames(); UpdateMotionButtons();
UpdateMotionButtons(); const Core::HID::NpadStyleIndex type =
const Core::HID::NpadStyleIndex type = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
if (player_index == 0) { if (player_index == 0) {
auto* emulated_controller_p1 = auto* emulated_controller_p1 =
hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1); hid_core.GetEmulatedController(Core::HID::NpadIdType::Player1);
auto* emulated_controller_handheld = auto* emulated_controller_handheld =
hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld);
bool is_connected = emulated_controller->IsConnected(true); bool is_connected = emulated_controller->IsConnected(true);
emulated_controller_p1->SetNpadStyleIndex(type); emulated_controller_p1->SetNpadStyleIndex(type);
emulated_controller_handheld->SetNpadStyleIndex(type); emulated_controller_handheld->SetNpadStyleIndex(type);
if (is_connected) { if (is_connected) {
if (type == Core::HID::NpadStyleIndex::Handheld) { if (type == Core::HID::NpadStyleIndex::Handheld) {
emulated_controller_p1->Disconnect(); emulated_controller_p1->Disconnect();
emulated_controller_handheld->Connect(true); emulated_controller_handheld->Connect(true);
emulated_controller = emulated_controller_handheld; emulated_controller = emulated_controller_handheld;
} else { } else {
emulated_controller_handheld->Disconnect(); emulated_controller_handheld->Disconnect();
emulated_controller_p1->Connect(true); emulated_controller_p1->Connect(true);
emulated_controller = emulated_controller_p1; emulated_controller = emulated_controller_p1;
}
}
ui->controllerFrame->SetController(emulated_controller);
} }
emulated_controller->SetNpadStyleIndex(type); }
}); ui->controllerFrame->SetController(emulated_controller);
}
emulated_controller->SetNpadStyleIndex(type);
});
connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this, connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this,
&ConfigureInputPlayer::UpdateMappingWithDefaults); &ConfigureInputPlayer::UpdateMappingWithDefaults);