core/hid: Rename NpadType to NpadStyleIndex

This commit is contained in:
german77
2021-11-04 12:08:54 -06:00
committed by Narr the Reg
parent 84c58666a4
commit 5d0f3540c4
15 changed files with 228 additions and 215 deletions

View File

@ -28,31 +28,31 @@
namespace {
void UpdateController(Core::HID::EmulatedController* controller,
Core::HID::NpadType controller_type, bool connected) {
Core::HID::NpadStyleIndex controller_type, bool connected) {
if (controller->IsConnected()) {
controller->Disconnect();
}
controller->SetNpadType(controller_type);
controller->SetNpadStyleIndex(controller_type);
if (connected) {
controller->Connect();
}
}
// Returns true if the given controller type is compatible with the given parameters.
bool IsControllerCompatible(Core::HID::NpadType controller_type,
bool IsControllerCompatible(Core::HID::NpadStyleIndex controller_type,
Core::Frontend::ControllerParameters parameters) {
switch (controller_type) {
case Core::HID::NpadType::ProController:
case Core::HID::NpadStyleIndex::ProController:
return parameters.allow_pro_controller;
case Core::HID::NpadType::JoyconDual:
case Core::HID::NpadStyleIndex::JoyconDual:
return parameters.allow_dual_joycons;
case Core::HID::NpadType::JoyconLeft:
case Core::HID::NpadStyleIndex::JoyconLeft:
return parameters.allow_left_joycon;
case Core::HID::NpadType::JoyconRight:
case Core::HID::NpadStyleIndex::JoyconRight:
return parameters.allow_right_joycon;
case Core::HID::NpadType::Handheld:
case Core::HID::NpadStyleIndex::Handheld:
return parameters.enable_single_mode && parameters.allow_handheld;
case Core::HID::NpadType::GameCube:
case Core::HID::NpadStyleIndex::GameCube:
return parameters.allow_gamecube_controller;
default:
return false;
@ -183,7 +183,7 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
connect(emulated_controllers[i], qOverload<int>(&QComboBox::currentIndexChanged),
[this, i](int index) {
UpdateDockedState(GetControllerTypeFromIndex(index, i) ==
Core::HID::NpadType::Handheld);
Core::HID::NpadStyleIndex::Handheld);
});
}
}
@ -243,7 +243,7 @@ void QtControllerSelectorDialog::LoadConfiguration() {
player_groupboxes[index]->setChecked(connected);
connected_controller_checkboxes[index]->setChecked(connected);
emulated_controllers[index]->setCurrentIndex(
GetIndexFromControllerType(controller->GetNpadType(), index));
GetIndexFromControllerType(controller->GetNpadStyleIndex(), index));
}
UpdateDockedState(handheld->IsConnected());
@ -402,32 +402,33 @@ void QtControllerSelectorDialog::SetEmulatedControllers(std::size_t player_index
emulated_controllers[player_index]->clear();
pairs.emplace_back(emulated_controllers[player_index]->count(),
Core::HID::NpadType::ProController);
Core::HID::NpadStyleIndex::ProController);
emulated_controllers[player_index]->addItem(tr("Pro Controller"));
pairs.emplace_back(emulated_controllers[player_index]->count(),
Core::HID::NpadType::JoyconDual);
Core::HID::NpadStyleIndex::JoyconDual);
emulated_controllers[player_index]->addItem(tr("Dual Joycons"));
pairs.emplace_back(emulated_controllers[player_index]->count(),
Core::HID::NpadType::JoyconLeft);
Core::HID::NpadStyleIndex::JoyconLeft);
emulated_controllers[player_index]->addItem(tr("Left Joycon"));
pairs.emplace_back(emulated_controllers[player_index]->count(),
Core::HID::NpadType::JoyconRight);
Core::HID::NpadStyleIndex::JoyconRight);
emulated_controllers[player_index]->addItem(tr("Right Joycon"));
if (player_index == 0) {
pairs.emplace_back(emulated_controllers[player_index]->count(),
Core::HID::NpadType::Handheld);
Core::HID::NpadStyleIndex::Handheld);
emulated_controllers[player_index]->addItem(tr("Handheld"));
}
pairs.emplace_back(emulated_controllers[player_index]->count(), Core::HID::NpadType::GameCube);
pairs.emplace_back(emulated_controllers[player_index]->count(),
Core::HID::NpadStyleIndex::GameCube);
emulated_controllers[player_index]->addItem(tr("GameCube Controller"));
}
Core::HID::NpadType QtControllerSelectorDialog::GetControllerTypeFromIndex(
Core::HID::NpadStyleIndex QtControllerSelectorDialog::GetControllerTypeFromIndex(
int index, std::size_t player_index) const {
const auto& pairs = index_controller_type_pairs[player_index];
@ -435,13 +436,13 @@ Core::HID::NpadType QtControllerSelectorDialog::GetControllerTypeFromIndex(
[index](const auto& pair) { return pair.first == index; });
if (it == pairs.end()) {
return Core::HID::NpadType::ProController;
return Core::HID::NpadStyleIndex::ProController;
}
return it->second;
}
int QtControllerSelectorDialog::GetIndexFromControllerType(Core::HID::NpadType type,
int QtControllerSelectorDialog::GetIndexFromControllerType(Core::HID::NpadStyleIndex type,
std::size_t player_index) const {
const auto& pairs = index_controller_type_pairs[player_index];
@ -465,16 +466,16 @@ void QtControllerSelectorDialog::UpdateControllerIcon(std::size_t player_index)
const QString stylesheet = [this, player_index] {
switch (GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(),
player_index)) {
case Core::HID::NpadType::ProController:
case Core::HID::NpadType::GameCube:
case Core::HID::NpadStyleIndex::ProController:
case Core::HID::NpadStyleIndex::GameCube:
return QStringLiteral("image: url(:/controller/applet_pro_controller%0); ");
case Core::HID::NpadType::JoyconDual:
case Core::HID::NpadStyleIndex::JoyconDual:
return QStringLiteral("image: url(:/controller/applet_dual_joycon%0); ");
case Core::HID::NpadType::JoyconLeft:
case Core::HID::NpadStyleIndex::JoyconLeft:
return QStringLiteral("image: url(:/controller/applet_joycon_left%0); ");
case Core::HID::NpadType::JoyconRight:
case Core::HID::NpadStyleIndex::JoyconRight:
return QStringLiteral("image: url(:/controller/applet_joycon_right%0); ");
case Core::HID::NpadType::Handheld:
case Core::HID::NpadStyleIndex::Handheld:
return QStringLiteral("image: url(:/controller/applet_handheld%0); ");
default:
return QString{};
@ -507,9 +508,9 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
const auto controller_type = GetControllerTypeFromIndex(
emulated_controllers[player_index]->currentIndex(), player_index);
const auto player_connected = player_groupboxes[player_index]->isChecked() &&
controller_type != Core::HID::NpadType::Handheld;
controller_type != Core::HID::NpadStyleIndex::Handheld;
if (controller->GetNpadType() == controller_type &&
if (controller->GetNpadStyleIndex() == controller_type &&
controller->IsConnected() == player_connected) {
// Set vibration devices in the event that the input device has changed.
ConfigureVibration::SetVibrationDevices(player_index);
@ -523,10 +524,10 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
// Handheld
if (player_index == 0) {
if (controller_type == Core::HID::NpadType::Handheld) {
if (controller_type == Core::HID::NpadStyleIndex::Handheld) {
auto* handheld =
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
UpdateController(handheld, Core::HID::NpadType::Handheld,
UpdateController(handheld, Core::HID::NpadStyleIndex::Handheld,
player_groupboxes[player_index]->isChecked());
}
}
@ -537,7 +538,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) {
if (!player_groupboxes[player_index]->isChecked() ||
GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(),
player_index) == Core::HID::NpadType::Handheld) {
player_index) == Core::HID::NpadStyleIndex::Handheld) {
led_patterns_boxes[player_index][0]->setChecked(false);
led_patterns_boxes[player_index][1]->setChecked(false);
led_patterns_boxes[player_index][2]->setChecked(false);
@ -632,7 +633,7 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() {
for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) {
auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index);
// Disconnect any unsupported players here and disable or hide them if applicable.
UpdateController(controller, controller->GetNpadType(), false);
UpdateController(controller, controller->GetNpadStyleIndex(), false);
// Hide the player widgets when max_supported_controllers is less than or equal to 4.
if (max_supported_players <= 4) {
player_widgets[index]->hide();

View File

@ -32,7 +32,7 @@ class System;
}
namespace Core::HID {
enum class NpadType : u8;
enum class NpadStyleIndex : u8;
}
class QtControllerSelectorDialog final : public QDialog {
@ -74,10 +74,10 @@ private:
void SetEmulatedControllers(std::size_t player_index);
// Gets the Controller Type for a given controller combobox index per player.
Core::HID::NpadType GetControllerTypeFromIndex(int index, std::size_t player_index) const;
Core::HID::NpadStyleIndex GetControllerTypeFromIndex(int index, std::size_t player_index) const;
// Gets the controller combobox index for a given Controller Type per player.
int GetIndexFromControllerType(Core::HID::NpadType type, std::size_t player_index) const;
int GetIndexFromControllerType(Core::HID::NpadStyleIndex type, std::size_t player_index) const;
// Updates the controller icons per player.
void UpdateControllerIcon(std::size_t player_index);
@ -139,7 +139,7 @@ private:
std::array<QComboBox*, NUM_PLAYERS> emulated_controllers;
/// Pairs of emulated controller index and Controller Type enum per player.
std::array<std::vector<std::pair<int, Core::HID::NpadType>>, NUM_PLAYERS>
std::array<std::vector<std::pair<int, Core::HID::NpadStyleIndex>>, NUM_PLAYERS>
index_controller_type_pairs;
// Labels representing the number of connected controllers

View File

@ -801,7 +801,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
const auto* player_1 = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
const auto controller_type =
handheld->IsConnected() ? handheld->GetNpadType() : player_1->GetNpadType();
handheld->IsConnected() ? handheld->GetNpadStyleIndex() : player_1->GetNpadStyleIndex();
const QString theme = [] {
if (QIcon::themeName().contains(QStringLiteral("dark")) ||
@ -813,8 +813,8 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
}();
switch (controller_type) {
case Core::HID::NpadType::ProController:
case Core::HID::NpadType::GameCube:
case Core::HID::NpadStyleIndex::ProController:
case Core::HID::NpadStyleIndex::GameCube:
ui->icon_controller->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme));
ui->icon_controller_shift->setStyleSheet(
@ -822,7 +822,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
ui->icon_controller_num->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme));
break;
case Core::HID::NpadType::JoyconDual:
case Core::HID::NpadStyleIndex::JoyconDual:
ui->icon_controller->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_dual_joycon%1.png);").arg(theme));
ui->icon_controller_shift->setStyleSheet(
@ -830,7 +830,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
ui->icon_controller_num->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_dual_joycon%1.png);").arg(theme));
break;
case Core::HID::NpadType::JoyconLeft:
case Core::HID::NpadStyleIndex::JoyconLeft:
ui->icon_controller->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_single_joycon_left%1.png);")
.arg(theme));
@ -841,7 +841,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
QStringLiteral("image: url(:/overlay/controller_single_joycon_left%1.png);")
.arg(theme));
break;
case Core::HID::NpadType::JoyconRight:
case Core::HID::NpadStyleIndex::JoyconRight:
ui->icon_controller->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_single_joycon_right%1.png);")
.arg(theme));
@ -852,7 +852,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
QStringLiteral("image: url(:/overlay/controller_single_joycon_right%1.png);")
.arg(theme));
break;
case Core::HID::NpadType::Handheld:
case Core::HID::NpadStyleIndex::Handheld:
ui->icon_controller->setStyleSheet(
QStringLiteral("image: url(:/overlay/controller_handheld%1.png);").arg(theme));
ui->icon_controller_shift->setStyleSheet(

View File

@ -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"));

View File

@ -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;

View File

@ -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);

View File

@ -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{};

View File

@ -841,7 +841,7 @@ void GMainWindow::InitializeWidgets() {
tr("Handheld controller can't be used on docked mode. Pro "
"controller will be selected."));
handheld->Disconnect();
player_1->SetNpadType(Core::HID::NpadType::ProController);
player_1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
player_1->Connect();
}