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
|
@ -227,15 +227,14 @@ void Controller::ConfigurationComplete() {
|
||||||
// If enable_single_mode is enabled, player_count is 1 regardless of any other parameters.
|
// If enable_single_mode is enabled, player_count is 1 regardless of any other parameters.
|
||||||
// Otherwise, only count connected players from P1-P8.
|
// Otherwise, only count connected players from P1-P8.
|
||||||
result_info.player_count =
|
result_info.player_count =
|
||||||
is_single_mode ? 1
|
is_single_mode
|
||||||
: static_cast<s8>(std::count_if(
|
? 1
|
||||||
players.begin(), players.end() - 2,
|
: static_cast<s8>(std::count_if(players.begin(), players.end() - 2,
|
||||||
[](Settings::PlayerInput player) { return player.connected; }));
|
[](const auto& player) { return player.connected; }));
|
||||||
|
|
||||||
result_info.selected_id = HID::Controller_NPad::IndexToNPad(
|
result_info.selected_id = HID::Controller_NPad::IndexToNPad(std::distance(
|
||||||
std::distance(players.begin(),
|
players.begin(), std::find_if(players.begin(), players.end(),
|
||||||
std::find_if(players.begin(), players.end(),
|
[](const auto& player) { return player.connected; })));
|
||||||
[](Settings::PlayerInput player) { return player.connected; })));
|
|
||||||
|
|
||||||
result_info.result = 0;
|
result_info.result = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue