mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 10:51:50 -05:00
core/hid: Rename NpadType to NpadStyleIndex
This commit is contained in:
parent
84c58666a4
commit
5d0f3540c4
15 changed files with 228 additions and 215 deletions
|
@ -44,26 +44,26 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb
|
|||
// Connect controllers based on the following priority list from highest to lowest priority:
|
||||
// Pro Controller -> Dual Joycons -> Left Joycon/Right Joycon -> Handheld
|
||||
if (parameters.allow_pro_controller) {
|
||||
controller->SetNpadType(Core::HID::NpadType::ProController);
|
||||
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
|
||||
controller->Connect();
|
||||
} else if (parameters.allow_dual_joycons) {
|
||||
controller->SetNpadType(Core::HID::NpadType::JoyconDual);
|
||||
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconDual);
|
||||
controller->Connect();
|
||||
} else if (parameters.allow_left_joycon && parameters.allow_right_joycon) {
|
||||
// Assign left joycons to even player indices and right joycons to odd player indices.
|
||||
// We do this since Captain Toad Treasure Tracker expects a left joycon for Player 1 and
|
||||
// a right Joycon for Player 2 in 2 Player Assist mode.
|
||||
if (index % 2 == 0) {
|
||||
controller->SetNpadType(Core::HID::NpadType::JoyconLeft);
|
||||
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconLeft);
|
||||
controller->Connect();
|
||||
} else {
|
||||
controller->SetNpadType(Core::HID::NpadType::JoyconRight);
|
||||
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconRight);
|
||||
controller->Connect();
|
||||
}
|
||||
} else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld &&
|
||||
!Settings::values.use_docked_mode.GetValue()) {
|
||||
// We should *never* reach here under any normal circumstances.
|
||||
controller->SetNpadType(Core::HID::NpadType::Handheld);
|
||||
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld);
|
||||
controller->Connect();
|
||||
} else {
|
||||
UNREACHABLE_MSG("Unable to add a new controller based on the given parameters!");
|
||||
|
|
|
@ -13,38 +13,38 @@ EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(
|
|||
|
||||
EmulatedController::~EmulatedController() = default;
|
||||
|
||||
NpadType EmulatedController::MapSettingsTypeToNPad(Settings::ControllerType type) {
|
||||
NpadStyleIndex EmulatedController::MapSettingsTypeToNPad(Settings::ControllerType type) {
|
||||
switch (type) {
|
||||
case Settings::ControllerType::ProController:
|
||||
return NpadType::ProController;
|
||||
return NpadStyleIndex::ProController;
|
||||
case Settings::ControllerType::DualJoyconDetached:
|
||||
return NpadType::JoyconDual;
|
||||
return NpadStyleIndex::JoyconDual;
|
||||
case Settings::ControllerType::LeftJoycon:
|
||||
return NpadType::JoyconLeft;
|
||||
return NpadStyleIndex::JoyconLeft;
|
||||
case Settings::ControllerType::RightJoycon:
|
||||
return NpadType::JoyconRight;
|
||||
return NpadStyleIndex::JoyconRight;
|
||||
case Settings::ControllerType::Handheld:
|
||||
return NpadType::Handheld;
|
||||
return NpadStyleIndex::Handheld;
|
||||
case Settings::ControllerType::GameCube:
|
||||
return NpadType::GameCube;
|
||||
return NpadStyleIndex::GameCube;
|
||||
default:
|
||||
return NpadType::ProController;
|
||||
return NpadStyleIndex::ProController;
|
||||
}
|
||||
}
|
||||
|
||||
Settings::ControllerType EmulatedController::MapNPadToSettingsType(NpadType type) {
|
||||
Settings::ControllerType EmulatedController::MapNPadToSettingsType(NpadStyleIndex type) {
|
||||
switch (type) {
|
||||
case NpadType::ProController:
|
||||
case NpadStyleIndex::ProController:
|
||||
return Settings::ControllerType::ProController;
|
||||
case NpadType::JoyconDual:
|
||||
case NpadStyleIndex::JoyconDual:
|
||||
return Settings::ControllerType::DualJoyconDetached;
|
||||
case NpadType::JoyconLeft:
|
||||
case NpadStyleIndex::JoyconLeft:
|
||||
return Settings::ControllerType::LeftJoycon;
|
||||
case NpadType::JoyconRight:
|
||||
case NpadStyleIndex::JoyconRight:
|
||||
return Settings::ControllerType::RightJoycon;
|
||||
case NpadType::Handheld:
|
||||
case NpadStyleIndex::Handheld:
|
||||
return Settings::ControllerType::Handheld;
|
||||
case NpadType::GameCube:
|
||||
case NpadStyleIndex::GameCube:
|
||||
return Settings::ControllerType::GameCube;
|
||||
default:
|
||||
return Settings::ControllerType::ProController;
|
||||
|
@ -79,9 +79,9 @@ void EmulatedController::ReloadFromSettings() {
|
|||
|
||||
// Other or debug controller should always be a pro controller
|
||||
if (npad_id_type != NpadIdType::Other) {
|
||||
SetNpadType(MapSettingsTypeToNPad(player.controller_type));
|
||||
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
|
||||
} else {
|
||||
SetNpadType(NpadType::ProController);
|
||||
SetNpadStyleIndex(NpadStyleIndex::ProController);
|
||||
}
|
||||
|
||||
if (player.connected) {
|
||||
|
@ -306,7 +306,7 @@ void EmulatedController::DisableConfiguration() {
|
|||
if (is_connected) {
|
||||
Disconnect();
|
||||
}
|
||||
SetNpadType(tmp_npad_type);
|
||||
SetNpadStyleIndex(tmp_npad_type);
|
||||
}
|
||||
|
||||
// Apply temporary connected status to the real controller
|
||||
|
@ -569,10 +569,10 @@ void EmulatedController::SetButton(Common::Input::CallbackStatus callback, std::
|
|||
}
|
||||
}
|
||||
if (!is_connected) {
|
||||
if (npad_id_type == NpadIdType::Player1 && npad_type != NpadType::Handheld) {
|
||||
if (npad_id_type == NpadIdType::Player1 && npad_type != NpadStyleIndex::Handheld) {
|
||||
Connect();
|
||||
}
|
||||
if (npad_id_type == NpadIdType::Handheld && npad_type == NpadType::Handheld) {
|
||||
if (npad_id_type == NpadIdType::Handheld && npad_type == NpadStyleIndex::Handheld) {
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
|
@ -896,14 +896,14 @@ NpadIdType EmulatedController::GetNpadIdType() const {
|
|||
return npad_id_type;
|
||||
}
|
||||
|
||||
NpadType EmulatedController::GetNpadType(bool get_temporary_value) const {
|
||||
NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const {
|
||||
if (get_temporary_value) {
|
||||
return tmp_npad_type;
|
||||
}
|
||||
return npad_type;
|
||||
}
|
||||
|
||||
void EmulatedController::SetNpadType(NpadType npad_type_) {
|
||||
void EmulatedController::SetNpadStyleIndex(NpadStyleIndex npad_type_) {
|
||||
{
|
||||
std::lock_guard lock{mutex};
|
||||
|
||||
|
|
|
@ -142,23 +142,23 @@ public:
|
|||
YUZU_NON_MOVEABLE(EmulatedController);
|
||||
|
||||
/// Converts the controller type from settings to npad type
|
||||
static NpadType MapSettingsTypeToNPad(Settings::ControllerType type);
|
||||
static NpadStyleIndex MapSettingsTypeToNPad(Settings::ControllerType type);
|
||||
|
||||
/// Converts npad type to the equivalent of controller type from settings
|
||||
static Settings::ControllerType MapNPadToSettingsType(NpadType type);
|
||||
static Settings::ControllerType MapNPadToSettingsType(NpadStyleIndex type);
|
||||
|
||||
/// Gets the NpadIdType for this controller
|
||||
NpadIdType GetNpadIdType() const;
|
||||
|
||||
/// Sets the NpadType for this controller
|
||||
void SetNpadType(NpadType npad_type_);
|
||||
/// Sets the NpadStyleIndex for this controller
|
||||
void SetNpadStyleIndex(NpadStyleIndex npad_type_);
|
||||
|
||||
/**
|
||||
* Gets the NpadType for this controller
|
||||
* Gets the NpadStyleIndex for this controller
|
||||
* @param If true tmp_npad_type will be returned
|
||||
* @return NpadType set on the controller
|
||||
* @return NpadStyleIndex set on the controller
|
||||
*/
|
||||
NpadType GetNpadType(bool get_temporary_value = false) const;
|
||||
NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const;
|
||||
|
||||
/// Sets the connected status to true
|
||||
void Connect();
|
||||
|
@ -351,14 +351,14 @@ private:
|
|||
void TriggerOnChange(ControllerTriggerType type, bool is_service_update);
|
||||
|
||||
NpadIdType npad_id_type;
|
||||
NpadType npad_type{NpadType::None};
|
||||
NpadStyleIndex npad_type{NpadStyleIndex::None};
|
||||
bool is_connected{false};
|
||||
bool is_configuring{false};
|
||||
f32 motion_sensitivity{0.01f};
|
||||
bool force_update_motion{false};
|
||||
|
||||
// Temporary values to avoid doing changes while the controller is on configuration mode
|
||||
NpadType tmp_npad_type{NpadType::None};
|
||||
NpadStyleIndex tmp_npad_type{NpadStyleIndex::None};
|
||||
bool tmp_is_connected{false};
|
||||
|
||||
ButtonParams button_params;
|
||||
|
|
|
@ -84,8 +84,8 @@ constexpr NpadIdType IndexToNpadIdType(size_t index) {
|
|||
}
|
||||
}
|
||||
|
||||
// This is nn::hid::NpadType
|
||||
enum class NpadType : u8 {
|
||||
// This is nn::hid::NpadStyleIndex
|
||||
enum class NpadStyleIndex : u8 {
|
||||
None = 0,
|
||||
ProController = 3,
|
||||
Handheld = 4,
|
||||
|
@ -94,7 +94,14 @@ enum class NpadType : u8 {
|
|||
JoyconRight = 7,
|
||||
GameCube = 8,
|
||||
Pokeball = 9,
|
||||
MaxNpadType = 10,
|
||||
NES = 10,
|
||||
HandheldNES = 11,
|
||||
SNES = 12,
|
||||
N64 = 13,
|
||||
SegaGenesis = 14,
|
||||
SystemExt = 32,
|
||||
System = 33,
|
||||
MaxNpadType = 34,
|
||||
};
|
||||
|
||||
// This is nn::hid::NpadStyleTag
|
||||
|
|
|
@ -93,7 +93,7 @@ bool Controller_NPad::IsNpadIdValid(u32 npad_id) {
|
|||
|
||||
bool Controller_NPad::IsDeviceHandleValid(const DeviceHandle& device_handle) {
|
||||
return IsNpadIdValid(device_handle.npad_id) &&
|
||||
device_handle.npad_type < Core::HID::NpadType::MaxNpadType &&
|
||||
device_handle.npad_type < Core::HID::NpadStyleIndex::MaxNpadType &&
|
||||
device_handle.device_index < DeviceIndex::MaxDeviceIndex;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ void Controller_NPad::ControllerUpdate(Core::HID::ControllerTriggerType type,
|
|||
|
||||
auto& controller = controller_data[controller_idx];
|
||||
const auto is_connected = controller.device->IsConnected();
|
||||
const auto npad_type = controller.device->GetNpadType();
|
||||
const auto npad_type = controller.device->GetNpadStyleIndex();
|
||||
switch (type) {
|
||||
case Core::HID::ControllerTriggerType::Connected:
|
||||
case Core::HID::ControllerTriggerType::Disconnected:
|
||||
|
@ -161,9 +161,9 @@ void Controller_NPad::ControllerUpdate(Core::HID::ControllerTriggerType type,
|
|||
|
||||
void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
||||
auto& controller = controller_data[controller_idx];
|
||||
const auto controller_type = controller.device->GetNpadType();
|
||||
const auto controller_type = controller.device->GetNpadStyleIndex();
|
||||
auto& shared_memory = controller.shared_memory_entry;
|
||||
if (controller_type == Core::HID::NpadType::None) {
|
||||
if (controller_type == Core::HID::NpadStyleIndex::None) {
|
||||
controller.styleset_changed_event->GetWritableEvent().Signal();
|
||||
return;
|
||||
}
|
||||
|
@ -171,10 +171,10 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
|||
shared_memory.device_type.raw = 0;
|
||||
shared_memory.system_properties.raw = 0;
|
||||
switch (controller_type) {
|
||||
case Core::HID::NpadType::None:
|
||||
case Core::HID::NpadStyleIndex::None:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
case Core::HID::NpadType::ProController:
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
shared_memory.style_set.fullkey.Assign(1);
|
||||
shared_memory.device_type.fullkey.Assign(1);
|
||||
shared_memory.system_properties.is_vertical.Assign(1);
|
||||
|
@ -183,7 +183,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
|||
shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
|
||||
shared_memory.applet_footer.type = AppletFooterUiType::SwitchProController;
|
||||
break;
|
||||
case Core::HID::NpadType::Handheld:
|
||||
case Core::HID::NpadStyleIndex::Handheld:
|
||||
shared_memory.style_set.handheld.Assign(1);
|
||||
shared_memory.device_type.handheld_left.Assign(1);
|
||||
shared_memory.device_type.handheld_right.Assign(1);
|
||||
|
@ -193,7 +193,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
|||
shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual;
|
||||
shared_memory.applet_footer.type = AppletFooterUiType::HandheldJoyConLeftJoyConRight;
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconDual:
|
||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||
shared_memory.style_set.joycon_dual.Assign(1);
|
||||
shared_memory.device_type.joycon_left.Assign(1);
|
||||
shared_memory.device_type.joycon_right.Assign(1);
|
||||
|
@ -203,7 +203,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
|||
shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual;
|
||||
shared_memory.applet_footer.type = AppletFooterUiType::JoyDual;
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconLeft:
|
||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||
shared_memory.style_set.joycon_left.Assign(1);
|
||||
shared_memory.device_type.joycon_left.Assign(1);
|
||||
shared_memory.system_properties.is_horizontal.Assign(1);
|
||||
|
@ -211,7 +211,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
|||
shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
|
||||
shared_memory.applet_footer.type = AppletFooterUiType::JoyLeftHorizontal;
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconRight:
|
||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||
shared_memory.style_set.joycon_right.Assign(1);
|
||||
shared_memory.device_type.joycon_right.Assign(1);
|
||||
shared_memory.system_properties.is_horizontal.Assign(1);
|
||||
|
@ -219,14 +219,14 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
|
|||
shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
|
||||
shared_memory.applet_footer.type = AppletFooterUiType::JoyRightHorizontal;
|
||||
break;
|
||||
case Core::HID::NpadType::GameCube:
|
||||
case Core::HID::NpadStyleIndex::GameCube:
|
||||
shared_memory.style_set.gamecube.Assign(1);
|
||||
// The GC Controller behaves like a wired Pro Controller
|
||||
shared_memory.device_type.fullkey.Assign(1);
|
||||
shared_memory.system_properties.is_vertical.Assign(1);
|
||||
shared_memory.system_properties.use_plus.Assign(1);
|
||||
break;
|
||||
case Core::HID::NpadType::Pokeball:
|
||||
case Core::HID::NpadStyleIndex::Pokeball:
|
||||
shared_memory.style_set.palma.Assign(1);
|
||||
shared_memory.device_type.palma.Assign(1);
|
||||
shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
|
||||
|
@ -307,7 +307,7 @@ void Controller_NPad::OnInit() {
|
|||
const auto& device = controller.device;
|
||||
if (device->IsConnected()) {
|
||||
const std::size_t index = Core::HID::NpadIdTypeToIndex(device->GetNpadIdType());
|
||||
AddNewControllerAt(device->GetNpadType(), index);
|
||||
AddNewControllerAt(device->GetNpadStyleIndex(), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
|
|||
std::lock_guard lock{mutex};
|
||||
const auto controller_idx = NPadIdToIndex(npad_id);
|
||||
auto& controller = controller_data[controller_idx];
|
||||
const auto controller_type = controller.device->GetNpadType();
|
||||
const auto controller_type = controller.device->GetNpadStyleIndex();
|
||||
if (!controller.device->IsConnected()) {
|
||||
return;
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
|
|||
|
||||
using btn = Core::HID::NpadButton;
|
||||
pad_entry.npad_buttons.raw = btn::None;
|
||||
if (controller_type != Core::HID::NpadType::JoyconLeft) {
|
||||
if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) {
|
||||
constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R |
|
||||
btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp |
|
||||
btn::StickRRight | btn::StickRDown;
|
||||
|
@ -367,7 +367,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
|
|||
pad_entry.r_stick = stick_state.right;
|
||||
}
|
||||
|
||||
if (controller_type != Core::HID::NpadType::JoyconRight) {
|
||||
if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) {
|
||||
constexpr btn left_button_mask =
|
||||
btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL |
|
||||
btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown;
|
||||
|
@ -375,17 +375,17 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
|
|||
pad_entry.l_stick = stick_state.left;
|
||||
}
|
||||
|
||||
if (controller_type == Core::HID::NpadType::JoyconLeft) {
|
||||
if (controller_type == Core::HID::NpadStyleIndex::JoyconLeft) {
|
||||
pad_entry.npad_buttons.left_sl.Assign(button_state.left_sl);
|
||||
pad_entry.npad_buttons.left_sr.Assign(button_state.left_sr);
|
||||
}
|
||||
|
||||
if (controller_type == Core::HID::NpadType::JoyconRight) {
|
||||
if (controller_type == Core::HID::NpadStyleIndex::JoyconRight) {
|
||||
pad_entry.npad_buttons.right_sl.Assign(button_state.right_sl);
|
||||
pad_entry.npad_buttons.right_sr.Assign(button_state.right_sr);
|
||||
}
|
||||
|
||||
if (controller_type == Core::HID::NpadType::GameCube) {
|
||||
if (controller_type == Core::HID::NpadStyleIndex::GameCube) {
|
||||
const auto& trigger_state = controller.device->GetTriggers();
|
||||
trigger_entry.l_analog = trigger_state.left;
|
||||
trigger_entry.r_analog = trigger_state.right;
|
||||
|
@ -406,9 +406,10 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
auto& controller = controller_data[i];
|
||||
auto& npad = controller.shared_memory_entry;
|
||||
|
||||
const auto& controller_type = controller.device->GetNpadType();
|
||||
const auto& controller_type = controller.device->GetNpadStyleIndex();
|
||||
|
||||
if (controller_type == Core::HID::NpadType::None || !controller.device->IsConnected()) {
|
||||
if (controller_type == Core::HID::NpadStyleIndex::None ||
|
||||
!controller.device->IsConnected()) {
|
||||
// Refresh shared memory
|
||||
std::memcpy(data + NPAD_OFFSET + (i * sizeof(NpadInternalState)),
|
||||
&controller.shared_memory_entry, sizeof(NpadInternalState));
|
||||
|
@ -426,10 +427,10 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
libnx_state.connection_status.raw = 0;
|
||||
libnx_state.connection_status.is_connected.Assign(1);
|
||||
switch (controller_type) {
|
||||
case Core::HID::NpadType::None:
|
||||
case Core::HID::NpadStyleIndex::None:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
case Core::HID::NpadType::ProController:
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.connection_status.is_wired.Assign(1);
|
||||
|
@ -439,7 +440,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
npad.fullkey_lifo.ReadCurrentEntry().state.sampling_number + 1;
|
||||
npad.fullkey_lifo.WriteNextEntry(pad_state);
|
||||
break;
|
||||
case Core::HID::NpadType::Handheld:
|
||||
case Core::HID::NpadStyleIndex::Handheld:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.connection_status.is_wired.Assign(1);
|
||||
|
@ -457,7 +458,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
npad.handheld_lifo.ReadCurrentEntry().state.sampling_number + 1;
|
||||
npad.handheld_lifo.WriteNextEntry(pad_state);
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconDual:
|
||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.connection_status.is_left_connected.Assign(1);
|
||||
|
@ -469,7 +470,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
npad.joy_dual_lifo.ReadCurrentEntry().state.sampling_number + 1;
|
||||
npad.joy_dual_lifo.WriteNextEntry(pad_state);
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconLeft:
|
||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.connection_status.is_left_connected.Assign(1);
|
||||
|
@ -479,7 +480,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
npad.joy_left_lifo.ReadCurrentEntry().state.sampling_number + 1;
|
||||
npad.joy_left_lifo.WriteNextEntry(pad_state);
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconRight:
|
||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.connection_status.is_right_connected.Assign(1);
|
||||
|
@ -489,7 +490,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
npad.joy_right_lifo.ReadCurrentEntry().state.sampling_number + 1;
|
||||
npad.joy_right_lifo.WriteNextEntry(pad_state);
|
||||
break;
|
||||
case Core::HID::NpadType::GameCube:
|
||||
case Core::HID::NpadStyleIndex::GameCube:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.connection_status.is_wired.Assign(1);
|
||||
|
@ -502,7 +503,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
|||
npad.fullkey_lifo.WriteNextEntry(pad_state);
|
||||
npad.gc_trigger_lifo.WriteNextEntry(trigger_state);
|
||||
break;
|
||||
case Core::HID::NpadType::Pokeball:
|
||||
case Core::HID::NpadStyleIndex::Pokeball:
|
||||
pad_state.connection_status.raw = 0;
|
||||
pad_state.connection_status.is_connected.Assign(1);
|
||||
pad_state.sampling_number =
|
||||
|
@ -534,9 +535,10 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
|||
for (std::size_t i = 0; i < controller_data.size(); ++i) {
|
||||
auto& controller = controller_data[i];
|
||||
|
||||
const auto& controller_type = controller.device->GetNpadType();
|
||||
const auto& controller_type = controller.device->GetNpadStyleIndex();
|
||||
|
||||
if (controller_type == Core::HID::NpadType::None || !controller.device->IsConnected()) {
|
||||
if (controller_type == Core::HID::NpadStyleIndex::None ||
|
||||
!controller.device->IsConnected()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -557,10 +559,10 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
|||
}
|
||||
|
||||
switch (controller_type) {
|
||||
case Core::HID::NpadType::None:
|
||||
case Core::HID::NpadStyleIndex::None:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
case Core::HID::NpadType::ProController:
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
sixaxis_fullkey_state.attribute.raw = 0;
|
||||
if (sixaxis_sensors_enabled) {
|
||||
sixaxis_fullkey_state.attribute.is_connected.Assign(1);
|
||||
|
@ -570,7 +572,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
|||
sixaxis_fullkey_state.orientation = motion_state[0].orientation;
|
||||
}
|
||||
break;
|
||||
case Core::HID::NpadType::Handheld:
|
||||
case Core::HID::NpadStyleIndex::Handheld:
|
||||
sixaxis_handheld_state.attribute.raw = 0;
|
||||
if (sixaxis_sensors_enabled) {
|
||||
sixaxis_handheld_state.attribute.is_connected.Assign(1);
|
||||
|
@ -580,7 +582,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
|||
sixaxis_handheld_state.orientation = motion_state[0].orientation;
|
||||
}
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconDual:
|
||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||
sixaxis_dual_left_state.attribute.raw = 0;
|
||||
sixaxis_dual_right_state.attribute.raw = 0;
|
||||
if (sixaxis_sensors_enabled) {
|
||||
|
@ -600,7 +602,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
|||
sixaxis_dual_right_state.orientation = motion_state[1].orientation;
|
||||
}
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconLeft:
|
||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||
sixaxis_left_lifo_state.attribute.raw = 0;
|
||||
if (sixaxis_sensors_enabled) {
|
||||
sixaxis_left_lifo_state.attribute.is_connected.Assign(1);
|
||||
|
@ -610,7 +612,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
|||
sixaxis_left_lifo_state.orientation = motion_state[0].orientation;
|
||||
}
|
||||
break;
|
||||
case Core::HID::NpadType::JoyconRight:
|
||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||
sixaxis_right_lifo_state.attribute.raw = 0;
|
||||
if (sixaxis_sensors_enabled) {
|
||||
sixaxis_right_lifo_state.attribute.is_connected.Assign(1);
|
||||
|
@ -779,11 +781,11 @@ void Controller_NPad::VibrateController(const DeviceHandle& vibration_device_han
|
|||
}
|
||||
|
||||
// Some games try to send mismatched parameters in the device handle, block these.
|
||||
if ((controller.device->GetNpadType() == Core::HID::NpadType::JoyconLeft &&
|
||||
(vibration_device_handle.npad_type == Core::HID::NpadType::JoyconRight ||
|
||||
if ((controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
|
||||
(vibration_device_handle.npad_type == Core::HID::NpadStyleIndex::JoyconRight ||
|
||||
vibration_device_handle.device_index == DeviceIndex::Right)) ||
|
||||
(controller.device->GetNpadType() == Core::HID::NpadType::JoyconRight &&
|
||||
(vibration_device_handle.npad_type == Core::HID::NpadType::JoyconLeft ||
|
||||
(controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight &&
|
||||
(vibration_device_handle.npad_type == Core::HID::NpadStyleIndex::JoyconLeft ||
|
||||
vibration_device_handle.device_index == DeviceIndex::Left))) {
|
||||
return;
|
||||
}
|
||||
|
@ -876,11 +878,12 @@ void Controller_NPad::SignalStyleSetChangedEvent(u32 npad_id) const {
|
|||
controller.styleset_changed_event->GetWritableEvent().Signal();
|
||||
}
|
||||
|
||||
void Controller_NPad::AddNewControllerAt(Core::HID::NpadType controller, std::size_t npad_index) {
|
||||
void Controller_NPad::AddNewControllerAt(Core::HID::NpadStyleIndex controller,
|
||||
std::size_t npad_index) {
|
||||
UpdateControllerAt(controller, npad_index, true);
|
||||
}
|
||||
|
||||
void Controller_NPad::UpdateControllerAt(Core::HID::NpadType type, std::size_t npad_index,
|
||||
void Controller_NPad::UpdateControllerAt(Core::HID::NpadStyleIndex type, std::size_t npad_index,
|
||||
bool connected) {
|
||||
auto& controller = controller_data[npad_index];
|
||||
if (!connected) {
|
||||
|
@ -888,7 +891,7 @@ void Controller_NPad::UpdateControllerAt(Core::HID::NpadType type, std::size_t n
|
|||
return;
|
||||
}
|
||||
|
||||
controller.device->SetNpadType(type);
|
||||
controller.device->SetNpadStyleIndex(type);
|
||||
InitNewlyAddedController(npad_index);
|
||||
}
|
||||
|
||||
|
@ -971,13 +974,13 @@ void Controller_NPad::MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2) {
|
|||
|
||||
// If the controllers at both npad indices form a pair of left and right joycons, merge them.
|
||||
// Otherwise, do nothing.
|
||||
if ((controller_1->GetNpadType() == Core::HID::NpadType::JoyconLeft &&
|
||||
controller_2->GetNpadType() == Core::HID::NpadType::JoyconRight) ||
|
||||
(controller_2->GetNpadType() == Core::HID::NpadType::JoyconLeft &&
|
||||
controller_1->GetNpadType() == Core::HID::NpadType::JoyconRight)) {
|
||||
if ((controller_1->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
|
||||
controller_2->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight) ||
|
||||
(controller_2->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
|
||||
controller_1->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight)) {
|
||||
// Disconnect the joycon at the second id and connect the dual joycon at the first index.
|
||||
DisconnectNpad(npad_id_2);
|
||||
AddNewControllerAt(Core::HID::NpadType::JoyconDual, npad_index_1);
|
||||
AddNewControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_index_1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1000,8 +1003,8 @@ bool Controller_NPad::SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2) {
|
|||
const auto npad_index_2 = NPadIdToIndex(npad_id_2);
|
||||
const auto& controller_1 = controller_data[npad_index_1].device;
|
||||
const auto& controller_2 = controller_data[npad_index_2].device;
|
||||
const auto type_index_1 = controller_1->GetNpadType();
|
||||
const auto type_index_2 = controller_2->GetNpadType();
|
||||
const auto type_index_1 = controller_1->GetNpadStyleIndex();
|
||||
const auto type_index_2 = controller_2->GetNpadStyleIndex();
|
||||
|
||||
if (!IsControllerSupported(type_index_1) || !IsControllerSupported(type_index_2)) {
|
||||
return false;
|
||||
|
@ -1039,9 +1042,9 @@ void Controller_NPad::SetAnalogStickUseCenterClamp(bool use_center_clamp) {
|
|||
void Controller_NPad::ClearAllConnectedControllers() {
|
||||
for (auto& controller : controller_data) {
|
||||
if (controller.device->IsConnected() &&
|
||||
controller.device->GetNpadType() != Core::HID::NpadType::None) {
|
||||
controller.device->SetNpadType(Core::HID::NpadType::None);
|
||||
controller.device->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::None) {
|
||||
controller.device->Disconnect();
|
||||
controller.device->SetNpadStyleIndex(Core::HID::NpadStyleIndex::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1054,7 +1057,7 @@ void Controller_NPad::DisconnectAllConnectedControllers() {
|
|||
|
||||
void Controller_NPad::ConnectAllDisconnectedControllers() {
|
||||
for (auto& controller : controller_data) {
|
||||
if (controller.device->GetNpadType() != Core::HID::NpadType::None &&
|
||||
if (controller.device->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::None &&
|
||||
!controller.device->IsConnected()) {
|
||||
controller.device->Connect();
|
||||
}
|
||||
|
@ -1063,8 +1066,8 @@ void Controller_NPad::ConnectAllDisconnectedControllers() {
|
|||
|
||||
void Controller_NPad::ClearAllControllers() {
|
||||
for (auto& controller : controller_data) {
|
||||
controller.device->SetNpadType(Core::HID::NpadType::None);
|
||||
controller.device->Disconnect();
|
||||
controller.device->SetNpadStyleIndex(Core::HID::NpadStyleIndex::None);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1072,8 +1075,8 @@ u32 Controller_NPad::GetAndResetPressState() {
|
|||
return press_state.exchange(0);
|
||||
}
|
||||
|
||||
bool Controller_NPad::IsControllerSupported(Core::HID::NpadType controller) const {
|
||||
if (controller == Core::HID::NpadType::Handheld) {
|
||||
bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller) const {
|
||||
if (controller == Core::HID::NpadStyleIndex::Handheld) {
|
||||
const bool support_handheld =
|
||||
std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(),
|
||||
NPAD_HANDHELD) != supported_npad_id_types.end();
|
||||
|
@ -1093,17 +1096,17 @@ bool Controller_NPad::IsControllerSupported(Core::HID::NpadType controller) cons
|
|||
[](u32 npad_id) { return npad_id <= MAX_NPAD_ID; })) {
|
||||
Core::HID::NpadStyleTag style = GetSupportedStyleSet();
|
||||
switch (controller) {
|
||||
case Core::HID::NpadType::ProController:
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
return style.fullkey;
|
||||
case Core::HID::NpadType::JoyconDual:
|
||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||
return style.joycon_dual;
|
||||
case Core::HID::NpadType::JoyconLeft:
|
||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||
return style.joycon_left;
|
||||
case Core::HID::NpadType::JoyconRight:
|
||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||
return style.joycon_right;
|
||||
case Core::HID::NpadType::GameCube:
|
||||
case Core::HID::NpadStyleIndex::GameCube:
|
||||
return style.gamecube;
|
||||
case Core::HID::NpadType::Pokeball:
|
||||
case Core::HID::NpadStyleIndex::Pokeball:
|
||||
return style.palma;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
};
|
||||
|
||||
struct DeviceHandle {
|
||||
Core::HID::NpadType npad_type;
|
||||
Core::HID::NpadStyleIndex npad_type;
|
||||
u8 npad_id;
|
||||
DeviceIndex device_index;
|
||||
INSERT_PADDING_BYTES_NOINIT(1);
|
||||
|
@ -160,9 +160,10 @@ public:
|
|||
void SignalStyleSetChangedEvent(u32 npad_id) const;
|
||||
|
||||
// Adds a new controller at an index.
|
||||
void AddNewControllerAt(Core::HID::NpadType controller, std::size_t npad_index);
|
||||
void AddNewControllerAt(Core::HID::NpadStyleIndex controller, std::size_t npad_index);
|
||||
// Adds a new controller at an index with connection status.
|
||||
void UpdateControllerAt(Core::HID::NpadType controller, std::size_t npad_index, bool connected);
|
||||
void UpdateControllerAt(Core::HID::NpadStyleIndex controller, std::size_t npad_index,
|
||||
bool connected);
|
||||
|
||||
void DisconnectNpad(u32 npad_id);
|
||||
void DisconnectNpadAtIndex(std::size_t index);
|
||||
|
@ -496,7 +497,7 @@ private:
|
|||
std::array<VibrationData, 2> vibration{};
|
||||
bool unintended_home_button_input_protection{};
|
||||
bool is_connected{};
|
||||
Core::HID::NpadType npad_type{Core::HID::NpadType::None};
|
||||
Core::HID::NpadStyleIndex npad_type{Core::HID::NpadStyleIndex::None};
|
||||
|
||||
// Current pad state
|
||||
NPadGenericState npad_pad_state{};
|
||||
|
@ -513,7 +514,7 @@ private:
|
|||
|
||||
void ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx);
|
||||
void InitNewlyAddedController(std::size_t controller_idx);
|
||||
bool IsControllerSupported(Core::HID::NpadType controller) const;
|
||||
bool IsControllerSupported(Core::HID::NpadStyleIndex controller) const;
|
||||
void RequestPadStateUpdate(u32 npad_id);
|
||||
void WriteEmptyEntry(NpadInternalState& npad);
|
||||
|
||||
|
|
|
@ -1131,18 +1131,18 @@ void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
|
|||
Core::HID::VibrationDeviceInfo vibration_device_info;
|
||||
|
||||
switch (vibration_device_handle.npad_type) {
|
||||
case Core::HID::NpadType::ProController:
|
||||
case Core::HID::NpadType::Handheld:
|
||||
case Core::HID::NpadType::JoyconDual:
|
||||
case Core::HID::NpadType::JoyconLeft:
|
||||
case Core::HID::NpadType::JoyconRight:
|
||||
case Core::HID::NpadStyleIndex::ProController:
|
||||
case Core::HID::NpadStyleIndex::Handheld:
|
||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||
default:
|
||||
vibration_device_info.type = Core::HID::VibrationDeviceType::LinearResonantActuator;
|
||||
break;
|
||||
case Core::HID::NpadType::GameCube:
|
||||
case Core::HID::NpadStyleIndex::GameCube:
|
||||
vibration_device_info.type = Core::HID::VibrationDeviceType::GcErm;
|
||||
break;
|
||||
case Core::HID::NpadType::Pokeball:
|
||||
case Core::HID::NpadStyleIndex::Pokeball:
|
||||
vibration_device_info.type = Core::HID::VibrationDeviceType::Unknown;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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{};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue