mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-10-31 20:37:52 +00:00
controller: Avoid unnecessary copies in ConfigurationComplete()
Avoids unnecessary 1072 byte copies when querying info about controllers.
This commit is contained in:
parent
3415890dd5
commit
97dd67ad1c
1 changed files with 7 additions and 8 deletions
|
@ -227,15 +227,14 @@ void Controller::ConfigurationComplete() {
|
|||
// If enable_single_mode is enabled, player_count is 1 regardless of any other parameters.
|
||||
// Otherwise, only count connected players from P1-P8.
|
||||
result_info.player_count =
|
||||
is_single_mode ? 1
|
||||
: static_cast<s8>(std::count_if(
|
||||
players.begin(), players.end() - 2,
|
||||
[](Settings::PlayerInput player) { return player.connected; }));
|
||||
is_single_mode
|
||||
? 1
|
||||
: static_cast<s8>(std::count_if(players.begin(), players.end() - 2,
|
||||
[](const auto& player) { return player.connected; }));
|
||||
|
||||
result_info.selected_id = HID::Controller_NPad::IndexToNPad(
|
||||
std::distance(players.begin(),
|
||||
std::find_if(players.begin(), players.end(),
|
||||
[](Settings::PlayerInput player) { return player.connected; })));
|
||||
result_info.selected_id = HID::Controller_NPad::IndexToNPad(std::distance(
|
||||
players.begin(), std::find_if(players.begin(), players.end(),
|
||||
[](const auto& player) { return player.connected; })));
|
||||
|
||||
result_info.result = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue