summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2022-11-28 15:56:38 +0100
committerLioncash <mathew1800@gmail.com>2022-11-28 16:00:42 +0100
commit780ae922658c2f49501bcb33759d32e6ae7e219c (patch)
tree4a9d8fa58a1f7930f0874e227a966215a9b0da48
parentcommon/input: Add helpers functions for creating input and output devices (diff)
downloadyuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.tar
yuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.tar.gz
yuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.tar.bz2
yuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.tar.lz
yuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.tar.xz
yuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.tar.zst
yuzu-780ae922658c2f49501bcb33759d32e6ae7e219c.zip
-rw-r--r--src/core/hid/emulated_controller.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index b3188f256..c96d9eef3 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <algorithm>
+
#include "common/thread.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/input_converter.h"
@@ -144,29 +146,23 @@ void EmulatedController::LoadDevices() {
LoadTASParams();
- std::transform(button_params.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
- button_params.begin() + Settings::NativeButton::BUTTON_NS_END,
- button_devices.begin(), Common::Input::CreateInputDevice);
- std::transform(stick_params.begin() + Settings::NativeAnalog::STICK_HID_BEGIN,
- stick_params.begin() + Settings::NativeAnalog::STICK_HID_END,
- stick_devices.begin(), Common::Input::CreateInputDevice);
- std::transform(motion_params.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
- motion_params.begin() + Settings::NativeMotion::MOTION_HID_END,
- motion_devices.begin(), Common::Input::CreateInputDevice);
- std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(),
- Common::Input::CreateInputDevice);
- std::transform(battery_params.begin(), battery_params.end(), battery_devices.begin(),
- Common::Input::CreateInputDevice);
+ std::ranges::transform(button_params, button_devices.begin(), Common::Input::CreateInputDevice);
+ std::ranges::transform(stick_params, stick_devices.begin(), Common::Input::CreateInputDevice);
+ std::ranges::transform(motion_params, motion_devices.begin(), Common::Input::CreateInputDevice);
+ std::ranges::transform(trigger_params, trigger_devices.begin(),
+ Common::Input::CreateInputDevice);
+ std::ranges::transform(battery_params, battery_devices.begin(),
+ Common::Input::CreateInputDevice);
camera_devices = Common::Input::CreateInputDevice(camera_params);
nfc_devices = Common::Input::CreateInputDevice(nfc_params);
- std::transform(output_params.begin(), output_params.end(), output_devices.begin(),
- Common::Input::CreateOutputDevice);
+ std::ranges::transform(output_params, output_devices.begin(),
+ Common::Input::CreateOutputDevice);
// Initialize TAS devices
- std::transform(tas_button_params.begin(), tas_button_params.end(), tas_button_devices.begin(),
- Common::Input::CreateInputDevice);
- std::transform(tas_stick_params.begin(), tas_stick_params.end(), tas_stick_devices.begin(),
- Common::Input::CreateInputDevice);
+ std::ranges::transform(tas_button_params, tas_button_devices.begin(),
+ Common::Input::CreateInputDevice);
+ std::ranges::transform(tas_stick_params, tas_stick_devices.begin(),
+ Common::Input::CreateInputDevice);
}
void EmulatedController::LoadTASParams() {