forked from ShuriZma/suyu
1
0
Fork 0

applets/controller: Modify heuristic to account for certain games

Now left and right joycons have the same priority (meaning both needs to be supported by the game).

Explanation of the new heuristic:
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.
This commit is contained in:
Morph 2020-08-27 23:38:26 -04:00
parent 6597b3817c
commit 371226448a
1 changed files with 12 additions and 7 deletions

View File

@ -44,19 +44,24 @@ 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(
npad.MapSettingsTypeToNPad(Settings::ControllerType::ProController), index); npad.MapSettingsTypeToNPad(Settings::ControllerType::ProController), index);
} else if (parameters.allow_dual_joycons) { } else if (parameters.allow_dual_joycons) {
npad.AddNewControllerAt( npad.AddNewControllerAt(
npad.MapSettingsTypeToNPad(Settings::ControllerType::DualJoyconDetached), index); npad.MapSettingsTypeToNPad(Settings::ControllerType::DualJoyconDetached), index);
} else if (parameters.allow_left_joycon) { } else if (parameters.allow_left_joycon && parameters.allow_right_joycon) {
npad.AddNewControllerAt( // Assign left joycons to even player indices and right joycons to odd player indices.
npad.MapSettingsTypeToNPad(Settings::ControllerType::LeftJoycon), index); // We do this since Captain Toad Treasure Tracker expects a left joycon for Player 1 and
} else if (parameters.allow_right_joycon) { // a right Joycon for Player 2 in 2 Player Assist mode.
npad.AddNewControllerAt( if (index % 2 == 0) {
npad.MapSettingsTypeToNPad(Settings::ControllerType::RightJoycon), index); npad.AddNewControllerAt(
npad.MapSettingsTypeToNPad(Settings::ControllerType::LeftJoycon), index);
} else {
npad.AddNewControllerAt(
npad.MapSettingsTypeToNPad(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) { !Settings::values.use_docked_mode) {
// We should *never* reach here under any normal circumstances. // We should *never* reach here under any normal circumstances.