forked from ShuriZma/suyu
core/hid/emulated_controller: Use ranges version of transform
Makes the transform calls much nicer to read.
This commit is contained in:
parent
2ec7d0b5fd
commit
780ae92265
|
@ -1,6 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "core/hid/emulated_controller.h"
|
#include "core/hid/emulated_controller.h"
|
||||||
#include "core/hid/input_converter.h"
|
#include "core/hid/input_converter.h"
|
||||||
|
@ -144,29 +146,23 @@ void EmulatedController::LoadDevices() {
|
||||||
|
|
||||||
LoadTASParams();
|
LoadTASParams();
|
||||||
|
|
||||||
std::transform(button_params.begin() + Settings::NativeButton::BUTTON_HID_BEGIN,
|
std::ranges::transform(button_params, button_devices.begin(), Common::Input::CreateInputDevice);
|
||||||
button_params.begin() + Settings::NativeButton::BUTTON_NS_END,
|
std::ranges::transform(stick_params, stick_devices.begin(), Common::Input::CreateInputDevice);
|
||||||
button_devices.begin(), Common::Input::CreateInputDevice);
|
std::ranges::transform(motion_params, motion_devices.begin(), Common::Input::CreateInputDevice);
|
||||||
std::transform(stick_params.begin() + Settings::NativeAnalog::STICK_HID_BEGIN,
|
std::ranges::transform(trigger_params, trigger_devices.begin(),
|
||||||
stick_params.begin() + Settings::NativeAnalog::STICK_HID_END,
|
Common::Input::CreateInputDevice);
|
||||||
stick_devices.begin(), Common::Input::CreateInputDevice);
|
std::ranges::transform(battery_params, battery_devices.begin(),
|
||||||
std::transform(motion_params.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
|
Common::Input::CreateInputDevice);
|
||||||
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);
|
|
||||||
camera_devices = Common::Input::CreateInputDevice(camera_params);
|
camera_devices = Common::Input::CreateInputDevice(camera_params);
|
||||||
nfc_devices = Common::Input::CreateInputDevice(nfc_params);
|
nfc_devices = Common::Input::CreateInputDevice(nfc_params);
|
||||||
std::transform(output_params.begin(), output_params.end(), output_devices.begin(),
|
std::ranges::transform(output_params, output_devices.begin(),
|
||||||
Common::Input::CreateOutputDevice);
|
Common::Input::CreateOutputDevice);
|
||||||
|
|
||||||
// Initialize TAS devices
|
// Initialize TAS devices
|
||||||
std::transform(tas_button_params.begin(), tas_button_params.end(), tas_button_devices.begin(),
|
std::ranges::transform(tas_button_params, tas_button_devices.begin(),
|
||||||
Common::Input::CreateInputDevice);
|
Common::Input::CreateInputDevice);
|
||||||
std::transform(tas_stick_params.begin(), tas_stick_params.end(), tas_stick_devices.begin(),
|
std::ranges::transform(tas_stick_params, tas_stick_devices.begin(),
|
||||||
Common::Input::CreateInputDevice);
|
Common::Input::CreateInputDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::LoadTASParams() {
|
void EmulatedController::LoadTASParams() {
|
||||||
|
|
Loading…
Reference in New Issue