mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-29 10:12:46 +01:00
Merge pull request #3607 from FearlessTobi/input-kms
yuzu/configuration: Fix input profiles and a wrong assert
This commit is contained in:
commit
8adf66f9fd
3 changed files with 21 additions and 18 deletions
|
@ -541,18 +541,19 @@ void ConfigureInputPlayer::HandleClick(
|
||||||
button->setText(tr("[press key]"));
|
button->setText(tr("[press key]"));
|
||||||
button->setFocus();
|
button->setFocus();
|
||||||
|
|
||||||
const auto iter = std::find(button_map.begin(), button_map.end(), button);
|
// Keyboard keys can only be used as button devices
|
||||||
ASSERT(iter != button_map.end());
|
want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button;
|
||||||
const auto index = std::distance(button_map.begin(), iter);
|
if (want_keyboard_keys) {
|
||||||
ASSERT(index < Settings::NativeButton::NumButtons && index >= 0);
|
const auto iter = std::find(button_map.begin(), button_map.end(), button);
|
||||||
|
ASSERT(iter != button_map.end());
|
||||||
|
const auto index = std::distance(button_map.begin(), iter);
|
||||||
|
ASSERT(index < Settings::NativeButton::NumButtons && index >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
input_setter = new_input_setter;
|
input_setter = new_input_setter;
|
||||||
|
|
||||||
device_pollers = InputCommon::Polling::GetPollers(type);
|
device_pollers = InputCommon::Polling::GetPollers(type);
|
||||||
|
|
||||||
// Keyboard keys can only be used as button devices
|
|
||||||
want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button;
|
|
||||||
|
|
||||||
for (auto& poller : device_pollers) {
|
for (auto& poller : device_pollers) {
|
||||||
poller->Start();
|
poller->Start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ void CallConfigureDialog(ConfigureInputSimple* caller, Args&&... args) {
|
||||||
// - Open any dialogs
|
// - Open any dialogs
|
||||||
// - Block in any way
|
// - Block in any way
|
||||||
|
|
||||||
|
constexpr std::size_t PLAYER_0_INDEX = 0;
|
||||||
constexpr std::size_t HANDHELD_INDEX = 8;
|
constexpr std::size_t HANDHELD_INDEX = 8;
|
||||||
|
|
||||||
void HandheldOnProfileSelect() {
|
void HandheldOnProfileSelect() {
|
||||||
|
@ -53,8 +54,8 @@ void HandheldOnProfileSelect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DualJoyconsDockedOnProfileSelect() {
|
void DualJoyconsDockedOnProfileSelect() {
|
||||||
Settings::values.players[0].connected = true;
|
Settings::values.players[PLAYER_0_INDEX].connected = true;
|
||||||
Settings::values.players[0].type = Settings::ControllerType::DualJoycon;
|
Settings::values.players[PLAYER_0_INDEX].type = Settings::ControllerType::DualJoycon;
|
||||||
|
|
||||||
for (std::size_t player = 1; player <= HANDHELD_INDEX; ++player) {
|
for (std::size_t player = 1; player <= HANDHELD_INDEX; ++player) {
|
||||||
Settings::values.players[player].connected = false;
|
Settings::values.players[player].connected = false;
|
||||||
|
@ -64,7 +65,7 @@ void DualJoyconsDockedOnProfileSelect() {
|
||||||
Settings::values.keyboard_enabled = false;
|
Settings::values.keyboard_enabled = false;
|
||||||
Settings::values.mouse_enabled = false;
|
Settings::values.mouse_enabled = false;
|
||||||
Settings::values.debug_pad_enabled = false;
|
Settings::values.debug_pad_enabled = false;
|
||||||
Settings::values.touchscreen.enabled = false;
|
Settings::values.touchscreen.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name, OnProfileSelect (called when selected in drop down), OnConfigure (called when configure
|
// Name, OnProfileSelect (called when selected in drop down), OnConfigure (called when configure
|
||||||
|
@ -78,7 +79,7 @@ constexpr std::array<InputProfile, 3> INPUT_PROFILES{{
|
||||||
}},
|
}},
|
||||||
{QT_TR_NOOP("Single Player - Dual Joycons - Docked"), DualJoyconsDockedOnProfileSelect,
|
{QT_TR_NOOP("Single Player - Dual Joycons - Docked"), DualJoyconsDockedOnProfileSelect,
|
||||||
[](ConfigureInputSimple* caller) {
|
[](ConfigureInputSimple* caller) {
|
||||||
CallConfigureDialog<ConfigureInputPlayer>(caller, 1, false);
|
CallConfigureDialog<ConfigureInputPlayer>(caller, PLAYER_0_INDEX, false);
|
||||||
}},
|
}},
|
||||||
{QT_TR_NOOP("Custom"), [] {}, CallConfigureDialog<ConfigureInput>},
|
{QT_TR_NOOP("Custom"), [] {}, CallConfigureDialog<ConfigureInput>},
|
||||||
}};
|
}};
|
||||||
|
|
|
@ -184,18 +184,19 @@ void ConfigureMouseAdvanced::HandleClick(
|
||||||
button->setText(tr("[press key]"));
|
button->setText(tr("[press key]"));
|
||||||
button->setFocus();
|
button->setFocus();
|
||||||
|
|
||||||
const auto iter = std::find(button_map.begin(), button_map.end(), button);
|
// Keyboard keys can only be used as button devices
|
||||||
ASSERT(iter != button_map.end());
|
want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button;
|
||||||
const auto index = std::distance(button_map.begin(), iter);
|
if (want_keyboard_keys) {
|
||||||
ASSERT(index < Settings::NativeButton::NumButtons && index >= 0);
|
const auto iter = std::find(button_map.begin(), button_map.end(), button);
|
||||||
|
ASSERT(iter != button_map.end());
|
||||||
|
const auto index = std::distance(button_map.begin(), iter);
|
||||||
|
ASSERT(index < Settings::NativeButton::NumButtons && index >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
input_setter = new_input_setter;
|
input_setter = new_input_setter;
|
||||||
|
|
||||||
device_pollers = InputCommon::Polling::GetPollers(type);
|
device_pollers = InputCommon::Polling::GetPollers(type);
|
||||||
|
|
||||||
// Keyboard keys can only be used as button devices
|
|
||||||
want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button;
|
|
||||||
|
|
||||||
for (auto& poller : device_pollers) {
|
for (auto& poller : device_pollers) {
|
||||||
poller->Start();
|
poller->Start();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue