core/frontend: Update applets

This commit is contained in:
german77 2021-09-20 20:46:17 -05:00 committed by Narr the Reg
parent dd62a0187d
commit 510c7d2953
2 changed files with 15 additions and 10 deletions

View file

@ -49,26 +49,31 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb
// Connect controllers based on the following priority list from highest to lowest priority: // Connect controllers based on the following priority list from highest to lowest priority:
// Pro Controller -> Dual Joycons -> Left Joycon/Right Joycon -> Handheld // Pro Controller -> Dual Joycons -> Left Joycon/Right Joycon -> Handheld
if (parameters.allow_pro_controller) { if (parameters.allow_pro_controller) {
npad.AddNewControllerAt( npad.AddNewControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(
npad.MapSettingsTypeToNPad(Settings::ControllerType::ProController), index); Settings::ControllerType::ProController),
index);
} else if (parameters.allow_dual_joycons) { } else if (parameters.allow_dual_joycons) {
npad.AddNewControllerAt( npad.AddNewControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(
npad.MapSettingsTypeToNPad(Settings::ControllerType::DualJoyconDetached), index); Settings::ControllerType::DualJoyconDetached),
index);
} else if (parameters.allow_left_joycon && parameters.allow_right_joycon) { } else if (parameters.allow_left_joycon && parameters.allow_right_joycon) {
// Assign left joycons to even player indices and right joycons to odd player indices. // 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 // 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. // a right Joycon for Player 2 in 2 Player Assist mode.
if (index % 2 == 0) { if (index % 2 == 0) {
npad.AddNewControllerAt( npad.AddNewControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(
npad.MapSettingsTypeToNPad(Settings::ControllerType::LeftJoycon), index); Settings::ControllerType::LeftJoycon),
index);
} else { } else {
npad.AddNewControllerAt( npad.AddNewControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(
npad.MapSettingsTypeToNPad(Settings::ControllerType::RightJoycon), index); Settings::ControllerType::RightJoycon),
index);
} }
} else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld &&
!Settings::values.use_docked_mode.GetValue()) { !Settings::values.use_docked_mode.GetValue()) {
// We should *never* reach here under any normal circumstances. // We should *never* reach here under any normal circumstances.
npad.AddNewControllerAt(npad.MapSettingsTypeToNPad(Settings::ControllerType::Handheld), npad.AddNewControllerAt(Core::HID::EmulatedController::MapSettingsTypeToNPad(
Settings::ControllerType::Handheld),
index); index);
} else { } else {
UNREACHABLE_MSG("Unable to add a new controller based on the given parameters!"); UNREACHABLE_MSG("Unable to add a new controller based on the given parameters!");

View file

@ -25,7 +25,7 @@ namespace Service::AM::Applets {
static Core::Frontend::ControllerParameters ConvertToFrontendParameters( static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text, ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text,
std::vector<IdentificationColor> identification_colors, std::vector<ExplainText> text) { std::vector<IdentificationColor> identification_colors, std::vector<ExplainText> text) {
HID::Controller_NPad::NpadStyleSet npad_style_set; Core::HID::NpadStyleTag npad_style_set;
npad_style_set.raw = private_arg.style_set; npad_style_set.raw = private_arg.style_set;
return { return {