diff options
Diffstat (limited to '')
4 files changed, 58 insertions, 57 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 8d6289d8e..95a9b8614 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -455,7 +455,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) { emit HandheldStateChanged(GetControllerTypeFromIndex(index) == - Core::HID::NpadType::Handheld); + Core::HID::NpadStyleIndex::Handheld); }); } @@ -482,7 +482,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i UpdateControllerEnabledButtons(); UpdateControllerButtonNames(); UpdateMotionButtons(); - const Core::HID::NpadType type = + const Core::HID::NpadStyleIndex type = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (player_index == 0) { @@ -492,10 +492,10 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); bool is_connected = emulated_controller->IsConnected(true); - emulated_controller_p1->SetNpadType(type); - emulated_controller_hanheld->SetNpadType(type); + emulated_controller_p1->SetNpadStyleIndex(type); + emulated_controller_hanheld->SetNpadStyleIndex(type); if (is_connected) { - if (type == Core::HID::NpadType::Handheld) { + if (type == Core::HID::NpadStyleIndex::Handheld) { emulated_controller_p1->Disconnect(); emulated_controller_hanheld->Connect(); emulated_controller = emulated_controller_hanheld; @@ -507,7 +507,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i } ui->controllerFrame->SetController(emulated_controller); } - emulated_controller->SetNpadType(type); + emulated_controller->SetNpadStyleIndex(type); }); connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this, @@ -607,7 +607,8 @@ void ConfigureInputPlayer::LoadConfiguration() { return; } - const int comboBoxIndex = GetIndexFromControllerType(emulated_controller->GetNpadType(true)); + const int comboBoxIndex = + GetIndexFromControllerType(emulated_controller->GetNpadStyleIndex(true)); ui->comboControllerType->setCurrentIndex(comboBoxIndex); ui->groupConnectedController->setChecked(emulated_controller->IsConnected(true)); } @@ -810,37 +811,37 @@ void ConfigureInputPlayer::SetConnectableControllers() { if (enable_all || npad_style_set.fullkey == 1) { index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), - Core::HID::NpadType::ProController); + Core::HID::NpadStyleIndex::ProController); ui->comboControllerType->addItem(tr("Pro Controller")); } if (enable_all || npad_style_set.joycon_dual == 1) { index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), - Core::HID::NpadType::JoyconDual); + Core::HID::NpadStyleIndex::JoyconDual); ui->comboControllerType->addItem(tr("Dual Joycons")); } if (enable_all || npad_style_set.joycon_left == 1) { index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), - Core::HID::NpadType::JoyconLeft); + Core::HID::NpadStyleIndex::JoyconLeft); ui->comboControllerType->addItem(tr("Left Joycon")); } if (enable_all || npad_style_set.joycon_right == 1) { index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), - Core::HID::NpadType::JoyconRight); + Core::HID::NpadStyleIndex::JoyconRight); ui->comboControllerType->addItem(tr("Right Joycon")); } if (player_index == 0 && (enable_all || npad_style_set.handheld == 1)) { index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), - Core::HID::NpadType::Handheld); + Core::HID::NpadStyleIndex::Handheld); ui->comboControllerType->addItem(tr("Handheld")); } if (enable_all || npad_style_set.gamecube == 1) { index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), - Core::HID::NpadType::GameCube); + Core::HID::NpadStyleIndex::GameCube); ui->comboControllerType->addItem(tr("GameCube Controller")); } }; @@ -853,19 +854,19 @@ void ConfigureInputPlayer::SetConnectableControllers() { add_controllers(false, system.HIDCore().GetSupportedStyleTag()); } -Core::HID::NpadType ConfigureInputPlayer::GetControllerTypeFromIndex(int index) const { +Core::HID::NpadStyleIndex ConfigureInputPlayer::GetControllerTypeFromIndex(int index) const { const auto it = std::find_if(index_controller_type_pairs.begin(), index_controller_type_pairs.end(), [index](const auto& pair) { return pair.first == index; }); if (it == index_controller_type_pairs.end()) { - return Core::HID::NpadType::ProController; + return Core::HID::NpadStyleIndex::ProController; } return it->second; } -int ConfigureInputPlayer::GetIndexFromControllerType(Core::HID::NpadType type) const { +int ConfigureInputPlayer::GetIndexFromControllerType(Core::HID::NpadStyleIndex type) const { const auto it = std::find_if(index_controller_type_pairs.begin(), index_controller_type_pairs.end(), [type](const auto& pair) { return pair.second == type; }); @@ -888,7 +889,7 @@ void ConfigureInputPlayer::UpdateInputDevices() { void ConfigureInputPlayer::UpdateControllerAvailableButtons() { auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (debug) { - layout = Core::HID::NpadType::ProController; + layout = Core::HID::NpadStyleIndex::ProController; } // List of all the widgets that will be hidden by any of the following layouts that need @@ -913,15 +914,15 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { std::vector<QWidget*> layout_hidden; switch (layout) { - case Core::HID::NpadType::ProController: - case Core::HID::NpadType::JoyconDual: - case Core::HID::NpadType::Handheld: + case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::JoyconDual: + case Core::HID::NpadStyleIndex::Handheld: layout_hidden = { ui->buttonShoulderButtonsSLSR, ui->horizontalSpacerShoulderButtonsWidget2, }; break; - case Core::HID::NpadType::JoyconLeft: + case Core::HID::NpadStyleIndex::JoyconLeft: layout_hidden = { ui->horizontalSpacerShoulderButtonsWidget2, ui->buttonShoulderButtonsRight, @@ -929,7 +930,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { ui->bottomRight, }; break; - case Core::HID::NpadType::JoyconRight: + case Core::HID::NpadStyleIndex::JoyconRight: layout_hidden = { ui->horizontalSpacerShoulderButtonsWidget, ui->buttonShoulderButtonsLeft, @@ -937,7 +938,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { ui->bottomLeft, }; break; - case Core::HID::NpadType::GameCube: + case Core::HID::NpadStyleIndex::GameCube: layout_hidden = { ui->buttonShoulderButtonsSLSR, ui->horizontalSpacerShoulderButtonsWidget2, @@ -957,7 +958,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { void ConfigureInputPlayer::UpdateControllerEnabledButtons() { auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (debug) { - layout = Core::HID::NpadType::ProController; + layout = Core::HID::NpadStyleIndex::ProController; } // List of all the widgets that will be disabled by any of the following layouts that need @@ -974,13 +975,13 @@ void ConfigureInputPlayer::UpdateControllerEnabledButtons() { std::vector<QWidget*> layout_disable; switch (layout) { - case Core::HID::NpadType::ProController: - case Core::HID::NpadType::JoyconDual: - case Core::HID::NpadType::Handheld: - case Core::HID::NpadType::JoyconLeft: - case Core::HID::NpadType::JoyconRight: + case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::JoyconDual: + case Core::HID::NpadStyleIndex::Handheld: + case Core::HID::NpadStyleIndex::JoyconLeft: + case Core::HID::NpadStyleIndex::JoyconRight: break; - case Core::HID::NpadType::GameCube: + case Core::HID::NpadStyleIndex::GameCube: layout_disable = { ui->buttonHome, ui->buttonLStickPressedGroup, @@ -1007,24 +1008,24 @@ void ConfigureInputPlayer::UpdateMotionButtons() { // Show/hide the "Motion 1/2" groupboxes depending on the currently selected controller. switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) { - case Core::HID::NpadType::ProController: - case Core::HID::NpadType::JoyconLeft: - case Core::HID::NpadType::Handheld: + case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::JoyconLeft: + case Core::HID::NpadStyleIndex::Handheld: // Show "Motion 1" and hide "Motion 2". ui->buttonMotionLeftGroup->show(); ui->buttonMotionRightGroup->hide(); break; - case Core::HID::NpadType::JoyconRight: + case Core::HID::NpadStyleIndex::JoyconRight: // Show "Motion 2" and hide "Motion 1". ui->buttonMotionLeftGroup->hide(); ui->buttonMotionRightGroup->show(); break; - case Core::HID::NpadType::GameCube: + case Core::HID::NpadStyleIndex::GameCube: // Hide both "Motion 1/2". ui->buttonMotionLeftGroup->hide(); ui->buttonMotionRightGroup->hide(); break; - case Core::HID::NpadType::JoyconDual: + case Core::HID::NpadStyleIndex::JoyconDual: default: // Show both "Motion 1/2". ui->buttonMotionLeftGroup->show(); @@ -1036,15 +1037,15 @@ void ConfigureInputPlayer::UpdateMotionButtons() { void ConfigureInputPlayer::UpdateControllerButtonNames() { auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (debug) { - layout = Core::HID::NpadType::ProController; + layout = Core::HID::NpadStyleIndex::ProController; } switch (layout) { - case Core::HID::NpadType::ProController: - case Core::HID::NpadType::JoyconDual: - case Core::HID::NpadType::Handheld: - case Core::HID::NpadType::JoyconLeft: - case Core::HID::NpadType::JoyconRight: + case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::JoyconDual: + case Core::HID::NpadStyleIndex::Handheld: + case Core::HID::NpadStyleIndex::JoyconLeft: + case Core::HID::NpadStyleIndex::JoyconRight: ui->buttonMiscButtonsPlusGroup->setTitle(tr("Plus")); ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("ZL")); ui->buttonShoulderButtonsZRGroup->setTitle(tr("ZR")); @@ -1052,7 +1053,7 @@ void ConfigureInputPlayer::UpdateControllerButtonNames() { ui->LStick->setTitle(tr("Left Stick")); ui->RStick->setTitle(tr("Right Stick")); break; - case Core::HID::NpadType::GameCube: + case Core::HID::NpadStyleIndex::GameCube: ui->buttonMiscButtonsPlusGroup->setTitle(tr("Start / Pause")); ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("L")); ui->buttonShoulderButtonsZRGroup->setTitle(tr("R")); diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index 02d6920f1..7bff4b196 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h @@ -51,7 +51,7 @@ class System; namespace Core::HID { class EmulatedController; -enum class NpadType : u8; +enum class NpadStyleIndex : u8; } // namespace Core::HID class ConfigureInputPlayer : public QWidget { @@ -134,10 +134,10 @@ private: void SetConnectableControllers(); /// Gets the Controller Type for a given controller combobox index. - Core::HID::NpadType GetControllerTypeFromIndex(int index) const; + Core::HID::NpadStyleIndex GetControllerTypeFromIndex(int index) const; /// Gets the controller combobox index for a given Controller Type. - int GetIndexFromControllerType(Core::HID::NpadType type) const; + int GetIndexFromControllerType(Core::HID::NpadStyleIndex type) const; /// Update the available input devices. void UpdateInputDevices(); @@ -182,7 +182,7 @@ private: std::unique_ptr<QTimer> poll_timer; /// Stores a pair of "Connected Controllers" combobox index and Controller Type enum. - std::vector<std::pair<int, Core::HID::NpadType>> index_controller_type_pairs; + std::vector<std::pair<int, Core::HID::NpadStyleIndex>> index_controller_type_pairs; static constexpr int PLAYER_COUNT = 8; std::array<QCheckBox*, PLAYER_COUNT> player_connected_checkbox; diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index 7e71a0f58..e63c25e70 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp @@ -147,7 +147,7 @@ void PlayerControlPreview::ControllerUpdate(Core::HID::ControllerTriggerType typ needs_redraw = true; break; case Core::HID::ControllerTriggerType::Type: - controller_type = controller->GetNpadType(true); + controller_type = controller->GetNpadStyleIndex(true); needs_redraw = true; break; case Core::HID::ControllerTriggerType::Color: @@ -221,22 +221,22 @@ void PlayerControlPreview::paintEvent(QPaintEvent* event) { const QPointF center = rect().center(); switch (controller_type) { - case Core::HID::NpadType::Handheld: + case Core::HID::NpadStyleIndex::Handheld: DrawHandheldController(p, center); break; - case Core::HID::NpadType::JoyconDual: + case Core::HID::NpadStyleIndex::JoyconDual: DrawDualController(p, center); break; - case Core::HID::NpadType::JoyconLeft: + case Core::HID::NpadStyleIndex::JoyconLeft: DrawLeftController(p, center); break; - case Core::HID::NpadType::JoyconRight: + case Core::HID::NpadStyleIndex::JoyconRight: DrawRightController(p, center); break; - case Core::HID::NpadType::GameCube: + case Core::HID::NpadStyleIndex::GameCube: DrawGCController(p, center); break; - case Core::HID::NpadType::ProController: + case Core::HID::NpadStyleIndex::ProController: default: DrawProController(p, center); break; @@ -2394,7 +2394,7 @@ void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center, void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right) { using namespace Settings::NativeAnalog; - if (controller_type != Core::HID::NpadType::JoyconLeft) { + if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) { DrawJoystickProperties(p, center_right, stick_values[RStick].x.properties); p.setPen(colors.indicator); p.setBrush(colors.indicator); @@ -2404,7 +2404,7 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPo DrawJoystickDot(p, center_right, stick_values[RStick], false); } - if (controller_type != Core::HID::NpadType::JoyconRight) { + if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) { DrawJoystickProperties(p, center_left, stick_values[LStick].x.properties); p.setPen(colors.indicator); p.setBrush(colors.indicator); diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h index acc53a9e3..ee217f3c9 100644 --- a/src/yuzu/configuration/configure_input_player_widget.h +++ b/src/yuzu/configuration/configure_input_player_widget.h @@ -203,7 +203,7 @@ private: bool is_controller_set{}; bool is_connected{}; bool needs_redraw{}; - Core::HID::NpadType controller_type; + Core::HID::NpadStyleIndex controller_type; bool mapping_active{}; int blink_counter{}; |