diff --git a/README.md b/README.md
index 7c4a63df5..53b80b052 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
yuzu emulator early access
=============
-This is the source code for early-access 3286.
+This is the source code for early-access 3287.
## Legal Notice
diff --git a/dist/yuzu.ico b/dist/yuzu.ico
index df3be8464..7c998a5c5 100755
Binary files a/dist/yuzu.ico and b/dist/yuzu.ico differ
diff --git a/dist/yuzu.svg b/dist/yuzu.svg
index 93171d1bf..98ded2d8f 100755
--- a/dist/yuzu.svg
+++ b/dist/yuzu.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/common/input.h b/src/common/input.h
index 1580ade16..3f5040760 100755
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -51,6 +51,8 @@ enum class PollingMode {
NFC,
// Enable infrared camera polling
IR,
+ // Enable ring controller polling
+ Ring,
};
enum class CameraFormat {
@@ -62,21 +64,22 @@ enum class CameraFormat {
None,
};
-// Vibration reply from the controller
-enum class VibrationError {
- None,
+// Different results that can happen from a device request
+enum class DriverResult {
+ Success,
+ WrongReply,
+ Timeout,
+ UnsupportedControllerType,
+ HandleInUse,
+ ErrorReadingData,
+ ErrorWritingData,
+ NoDeviceDetected,
+ InvalidHandle,
NotSupported,
Disabled,
Unknown,
};
-// Polling mode reply from the controller
-enum class PollingError {
- None,
- NotSupported,
- Unknown,
-};
-
// Nfc reply from the controller
enum class NfcState {
Success,
@@ -90,13 +93,6 @@ enum class NfcState {
Unknown,
};
-// Ir camera reply from the controller
-enum class CameraError {
- None,
- NotSupported,
- Unknown,
-};
-
// Hint for amplification curve to be used
enum class VibrationAmplificationType {
Linear,
@@ -190,6 +186,8 @@ struct TouchStatus {
struct BodyColorStatus {
u32 body{};
u32 buttons{};
+ u32 left_grip{};
+ u32 right_grip{};
};
// HD rumble data
@@ -228,17 +226,31 @@ enum class ButtonNames {
Engine,
// This will display the button by value instead of the button name
Value,
+
+ // Joycon button names
ButtonLeft,
ButtonRight,
ButtonDown,
ButtonUp,
- TriggerZ,
- TriggerR,
- TriggerL,
ButtonA,
ButtonB,
ButtonX,
ButtonY,
+ ButtonPlus,
+ ButtonMinus,
+ ButtonHome,
+ ButtonCapture,
+ ButtonStickL,
+ ButtonStickR,
+ TriggerL,
+ TriggerZL,
+ TriggerSL,
+ TriggerR,
+ TriggerZR,
+ TriggerSR,
+
+ // GC button names
+ TriggerZ,
ButtonStart,
// DS4 button names
@@ -319,22 +331,24 @@ class OutputDevice {
public:
virtual ~OutputDevice() = default;
- virtual void SetLED([[maybe_unused]] const LedStatus& led_status) {}
+ virtual DriverResult SetLED([[maybe_unused]] const LedStatus& led_status) {
+ return DriverResult::NotSupported;
+ }
- virtual VibrationError SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) {
- return VibrationError::NotSupported;
+ virtual DriverResult SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) {
+ return DriverResult::NotSupported;
}
virtual bool IsVibrationEnabled() {
return false;
}
- virtual PollingError SetPollingMode([[maybe_unused]] PollingMode polling_mode) {
- return PollingError::NotSupported;
+ virtual DriverResult SetPollingMode([[maybe_unused]] PollingMode polling_mode) {
+ return DriverResult::NotSupported;
}
- virtual CameraError SetCameraFormat([[maybe_unused]] CameraFormat camera_format) {
- return CameraError::NotSupported;
+ virtual DriverResult SetCameraFormat([[maybe_unused]] CameraFormat camera_format) {
+ return DriverResult::NotSupported;
}
virtual NfcState SupportsNfc() const {
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index d11d7620e..f85dc83b8 100755
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -185,6 +185,7 @@ void RestoreGlobalState(bool is_powered_on) {
// Renderer
values.fsr_sharpening_slider.SetGlobal(true);
values.renderer_backend.SetGlobal(true);
+ values.renderer_force_max_clock.SetGlobal(true);
values.vulkan_device.SetGlobal(true);
values.aspect_ratio.SetGlobal(true);
values.max_anisotropy.SetGlobal(true);
@@ -200,6 +201,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.use_asynchronous_shaders.SetGlobal(true);
values.use_fast_gpu_time.SetGlobal(true);
values.use_pessimistic_flushes.SetGlobal(true);
+ values.use_vulkan_driver_pipeline_cache.SetGlobal(true);
values.bg_red.SetGlobal(true);
values.bg_green.SetGlobal(true);
values.bg_blue.SetGlobal(true);
diff --git a/src/common/settings.h b/src/common/settings.h
index 7e1469975..536c31d16 100755
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -415,6 +415,7 @@ struct Values {
// Renderer
SwitchableSetting renderer_backend{
RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Null, "backend"};
+ SwitchableSetting renderer_force_max_clock{true, "force_max_clock"};
Setting renderer_debug{false, "debug"};
Setting renderer_shader_feedback{false, "shader_feedback"};
Setting enable_nsight_aftermath{false, "nsight_aftermath"};
@@ -451,6 +452,8 @@ struct Values {
SwitchableSetting use_asynchronous_shaders{false, "use_asynchronous_shaders"};
SwitchableSetting use_fast_gpu_time{true, "use_fast_gpu_time"};
SwitchableSetting use_pessimistic_flushes{false, "use_pessimistic_flushes"};
+ SwitchableSetting use_vulkan_driver_pipeline_cache{true,
+ "use_vulkan_driver_pipeline_cache"};
SwitchableSetting bg_red{0, "bg_red"};
SwitchableSetting bg_green{0, "bg_green"};
@@ -477,6 +480,7 @@ struct Values {
Setting enable_raw_input{false, "enable_raw_input"};
Setting controller_navigation{true, "controller_navigation"};
+ Setting enable_joycon_driver{true, "enable_joycon_driver"};
SwitchableSetting vibration_enabled{true, "vibration_enabled"};
SwitchableSetting enable_accurate_vibrations{false, "enable_accurate_vibrations"};
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index b847fd4d9..b9e897f3b 100755
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -30,7 +30,7 @@ std::string ToUpper(std::string str) {
return str;
}
-std::string StringFromBuffer(const std::vector& data) {
+std::string StringFromBuffer(std::span data) {
return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
}
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 2ba7cadb9..e03bde0a5 100755
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -5,6 +5,7 @@
#pragma once
#include
+#include
#include
#include
#include "common/common_types.h"
@@ -17,7 +18,7 @@ namespace Common {
/// Make a string uppercase
[[nodiscard]] std::string ToUpper(std::string str);
-[[nodiscard]] std::string StringFromBuffer(const std::vector& data);
+[[nodiscard]] std::string StringFromBuffer(std::span data);
[[nodiscard]] std::string StripSpaces(const std::string& s);
[[nodiscard]] std::string StripQuotes(const std::string& s);
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index d469f9453..305ba9551 100755
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -93,6 +93,7 @@ void EmulatedController::ReloadFromSettings() {
motion_params[index] = Common::ParamPackage(player.motions[index]);
}
+ controller.color_values = {};
controller.colors_state.fullkey = {
.body = GetNpadColor(player.body_color_left),
.button = GetNpadColor(player.button_color_left),
@@ -106,6 +107,8 @@ void EmulatedController::ReloadFromSettings() {
.button = GetNpadColor(player.button_color_right),
};
+ ring_params[0] = Common::ParamPackage(Settings::values.ringcon_analogs);
+
// Other or debug controller should always be a pro controller
if (npad_id_type != NpadIdType::Other) {
SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
@@ -132,18 +135,28 @@ void EmulatedController::LoadDevices() {
trigger_params[LeftIndex] = button_params[Settings::NativeButton::ZL];
trigger_params[RightIndex] = button_params[Settings::NativeButton::ZR];
+ color_params[LeftIndex] = left_joycon;
+ color_params[RightIndex] = right_joycon;
+ color_params[LeftIndex].Set("color", true);
+ color_params[RightIndex].Set("color", true);
+
battery_params[LeftIndex] = left_joycon;
battery_params[RightIndex] = right_joycon;
battery_params[LeftIndex].Set("battery", true);
battery_params[RightIndex].Set("battery", true);
- camera_params = Common::ParamPackage{"engine:camera,camera:1"};
- nfc_params = Common::ParamPackage{"engine:virtual_amiibo,nfc:1"};
+ camera_params[0] = right_joycon;
+ camera_params[0].Set("camera", true);
+ camera_params[1] = Common::ParamPackage{"engine:camera,camera:1"};
+ ring_params[1] = Common::ParamPackage{"engine:joycon,axis_x:100,axis_y:101"};
+ nfc_params[0] = Common::ParamPackage{"engine:virtual_amiibo,nfc:1"};
+ nfc_params[1] = right_joycon;
+ nfc_params[1].Set("nfc", true);
output_params[LeftIndex] = left_joycon;
output_params[RightIndex] = right_joycon;
- output_params[2] = camera_params;
- output_params[3] = nfc_params;
+ output_params[2] = camera_params[1];
+ output_params[3] = nfc_params[0];
output_params[LeftIndex].Set("output", true);
output_params[RightIndex].Set("output", true);
output_params[2].Set("output", true);
@@ -159,8 +172,11 @@ void EmulatedController::LoadDevices() {
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::ranges::transform(color_params, color_devices.begin(), Common::Input::CreateInputDevice);
+ std::ranges::transform(camera_params, camera_devices.begin(), Common::Input::CreateInputDevice);
+ std::ranges::transform(ring_params, ring_analog_devices.begin(),
+ Common::Input::CreateInputDevice);
+ std::ranges::transform(nfc_params, nfc_devices.begin(), Common::Input::CreateInputDevice);
std::ranges::transform(output_params, output_devices.begin(),
Common::Input::CreateOutputDevice);
@@ -322,6 +338,19 @@ void EmulatedController::ReloadInput() {
battery_devices[index]->ForceUpdate();
}
+ for (std::size_t index = 0; index < color_devices.size(); ++index) {
+ if (!color_devices[index]) {
+ continue;
+ }
+ color_devices[index]->SetCallback({
+ .on_change =
+ [this, index](const Common::Input::CallbackStatus& callback) {
+ SetColors(callback, index);
+ },
+ });
+ color_devices[index]->ForceUpdate();
+ }
+
for (std::size_t index = 0; index < motion_devices.size(); ++index) {
if (!motion_devices[index]) {
continue;
@@ -335,22 +364,37 @@ void EmulatedController::ReloadInput() {
motion_devices[index]->ForceUpdate();
}
- if (camera_devices) {
- camera_devices->SetCallback({
+ for (std::size_t index = 0; index < camera_devices.size(); ++index) {
+ if (!camera_devices[index]) {
+ continue;
+ }
+ camera_devices[index]->SetCallback({
.on_change =
[this](const Common::Input::CallbackStatus& callback) { SetCamera(callback); },
});
- camera_devices->ForceUpdate();
+ camera_devices[index]->ForceUpdate();
}
- if (nfc_devices) {
- if (npad_id_type == NpadIdType::Handheld || npad_id_type == NpadIdType::Player1) {
- nfc_devices->SetCallback({
- .on_change =
- [this](const Common::Input::CallbackStatus& callback) { SetNfc(callback); },
- });
- nfc_devices->ForceUpdate();
+ for (std::size_t index = 0; index < ring_analog_devices.size(); ++index) {
+ if (!ring_analog_devices[index]) {
+ continue;
}
+ ring_analog_devices[index]->SetCallback({
+ .on_change =
+ [this](const Common::Input::CallbackStatus& callback) { SetRingAnalog(callback); },
+ });
+ ring_analog_devices[index]->ForceUpdate();
+ }
+
+ for (std::size_t index = 0; index < nfc_devices.size(); ++index) {
+ if (!nfc_devices[index]) {
+ continue;
+ }
+ nfc_devices[index]->SetCallback({
+ .on_change =
+ [this](const Common::Input::CallbackStatus& callback) { SetNfc(callback); },
+ });
+ nfc_devices[index]->ForceUpdate();
}
// Register TAS devices. No need to force update
@@ -420,6 +464,9 @@ void EmulatedController::UnloadInput() {
for (auto& battery : battery_devices) {
battery.reset();
}
+ for (auto& color : color_devices) {
+ color.reset();
+ }
for (auto& output : output_devices) {
output.reset();
}
@@ -435,8 +482,15 @@ void EmulatedController::UnloadInput() {
for (auto& stick : virtual_stick_devices) {
stick.reset();
}
- camera_devices.reset();
- nfc_devices.reset();
+ for (auto& camera : camera_devices) {
+ camera.reset();
+ }
+ for (auto& ring : ring_analog_devices) {
+ ring.reset();
+ }
+ for (auto& nfc : nfc_devices) {
+ nfc.reset();
+ }
}
void EmulatedController::EnableConfiguration() {
@@ -448,6 +502,11 @@ void EmulatedController::EnableConfiguration() {
void EmulatedController::DisableConfiguration() {
is_configuring = false;
+ // Get Joycon colors before turning on the controller
+ for (const auto& color_device : color_devices) {
+ color_device->ForceUpdate();
+ }
+
// Apply temporary npad type to the real controller
if (tmp_npad_type != npad_type) {
if (is_connected) {
@@ -501,6 +560,9 @@ void EmulatedController::SaveCurrentConfig() {
for (std::size_t index = 0; index < player.motions.size(); ++index) {
player.motions[index] = motion_params[index].Serialize();
}
+ if (npad_id_type == NpadIdType::Player1) {
+ Settings::values.ringcon_analogs = ring_params[0].Serialize();
+ }
}
void EmulatedController::RestoreConfig() {
@@ -915,6 +977,58 @@ void EmulatedController::SetMotion(const Common::Input::CallbackStatus& callback
TriggerOnChange(ControllerTriggerType::Motion, true);
}
+void EmulatedController::SetColors(const Common::Input::CallbackStatus& callback,
+ std::size_t index) {
+ if (index >= controller.color_values.size()) {
+ return;
+ }
+ std::unique_lock lock{mutex};
+ controller.color_values[index] = TransformToColor(callback);
+
+ if (is_configuring) {
+ lock.unlock();
+ TriggerOnChange(ControllerTriggerType::Color, false);
+ return;
+ }
+
+ if (controller.color_values[index].body == 0) {
+ return;
+ }
+
+ controller.colors_state.fullkey = {
+ .body = GetNpadColor(controller.color_values[index].body),
+ .button = GetNpadColor(controller.color_values[index].buttons),
+ };
+ if (npad_type == NpadStyleIndex::ProController) {
+ controller.colors_state.left = {
+ .body = GetNpadColor(controller.color_values[index].left_grip),
+ .button = GetNpadColor(controller.color_values[index].buttons),
+ };
+ controller.colors_state.right = {
+ .body = GetNpadColor(controller.color_values[index].right_grip),
+ .button = GetNpadColor(controller.color_values[index].buttons),
+ };
+ } else {
+ switch (index) {
+ case LeftIndex:
+ controller.colors_state.left = {
+ .body = GetNpadColor(controller.color_values[index].body),
+ .button = GetNpadColor(controller.color_values[index].buttons),
+ };
+ break;
+ case RightIndex:
+ controller.colors_state.right = {
+ .body = GetNpadColor(controller.color_values[index].body),
+ .button = GetNpadColor(controller.color_values[index].buttons),
+ };
+ break;
+ }
+ }
+
+ lock.unlock();
+ TriggerOnChange(ControllerTriggerType::Color, true);
+}
+
void EmulatedController::SetBattery(const Common::Input::CallbackStatus& callback,
std::size_t index) {
if (index >= controller.battery_values.size()) {
@@ -1005,6 +1119,24 @@ void EmulatedController::SetCamera(const Common::Input::CallbackStatus& callback
TriggerOnChange(ControllerTriggerType::IrSensor, true);
}
+void EmulatedController::SetRingAnalog(const Common::Input::CallbackStatus& callback) {
+ std::unique_lock lock{mutex};
+ const auto force_value = TransformToStick(callback);
+
+ controller.ring_analog_value = force_value.x;
+
+ if (is_configuring) {
+ lock.unlock();
+ TriggerOnChange(ControllerTriggerType::RingController, false);
+ return;
+ }
+
+ controller.ring_analog_state.force = force_value.x.value;
+
+ lock.unlock();
+ TriggerOnChange(ControllerTriggerType::RingController, true);
+}
+
void EmulatedController::SetNfc(const Common::Input::CallbackStatus& callback) {
std::unique_lock lock{mutex};
controller.nfc_values = TransformToNfc(callback);
@@ -1053,7 +1185,7 @@ bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue v
.type = type,
};
return output_devices[device_index]->SetVibration(status) ==
- Common::Input::VibrationError::None;
+ Common::Input::DriverResult::Success;
}
bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
@@ -1075,7 +1207,8 @@ bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
return output_devices[device_index]->IsVibrationEnabled();
}
-bool EmulatedController::SetPollingMode(Common::Input::PollingMode polling_mode) {
+Common::Input::DriverResult EmulatedController::SetPollingMode(
+ Common::Input::PollingMode polling_mode) {
LOG_INFO(Service_HID, "Set polling mode {}", polling_mode);
auto& output_device = output_devices[static_cast(DeviceIndex::Right)];
auto& nfc_output_device = output_devices[3];
@@ -1083,8 +1216,11 @@ bool EmulatedController::SetPollingMode(Common::Input::PollingMode polling_mode)
const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
const auto mapped_nfc_result = output_device->SetPollingMode(polling_mode);
- return virtual_nfc_result == Common::Input::PollingError::None ||
- mapped_nfc_result == Common::Input::PollingError::None;
+ if (virtual_nfc_result == Common::Input::DriverResult::Success) {
+ return virtual_nfc_result;
+ }
+
+ return mapped_nfc_result;
}
bool EmulatedController::SetCameraFormat(
@@ -1095,13 +1231,22 @@ bool EmulatedController::SetCameraFormat(
auto& camera_output_device = output_devices[2];
if (right_output_device->SetCameraFormat(static_cast(
- camera_format)) == Common::Input::CameraError::None) {
+ camera_format)) == Common::Input::DriverResult::Success) {
return true;
}
// Fallback to Qt camera if native device doesn't have support
return camera_output_device->SetCameraFormat(static_cast(
- camera_format)) == Common::Input::CameraError::None;
+ camera_format)) == Common::Input::DriverResult::Success;
+}
+
+Common::ParamPackage EmulatedController::GetRingParam() const {
+ return ring_params[0];
+}
+
+void EmulatedController::SetRingParam(Common::ParamPackage param) {
+ ring_params[0] = std::move(param);
+ ReloadInput();
}
bool EmulatedController::HasNfc() const {
@@ -1395,6 +1540,10 @@ CameraValues EmulatedController::GetCameraValues() const {
return controller.camera_values;
}
+RingAnalogValue EmulatedController::GetRingSensorValues() const {
+ return controller.ring_analog_value;
+}
+
HomeButtonState EmulatedController::GetHomeButtons() const {
std::scoped_lock lock{mutex};
if (is_configuring) {
@@ -1488,6 +1637,10 @@ const CameraState& EmulatedController::GetCamera() const {
return controller.camera_state;
}
+RingSensorForce EmulatedController::GetRingSensorForce() const {
+ return controller.ring_analog_state;
+}
+
const NfcState& EmulatedController::GetNfc() const {
std::scoped_lock lock{mutex};
return controller.nfc_state;
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index 883e84115..65f2d40a8 100755
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -35,19 +35,27 @@ using ControllerMotionDevices =
std::array, Settings::NativeMotion::NumMotions>;
using TriggerDevices =
std::array, Settings::NativeTrigger::NumTriggers>;
+using ColorDevices =
+ std::array, max_emulated_controllers>;
using BatteryDevices =
std::array, max_emulated_controllers>;
-using CameraDevices = std::unique_ptr;
-using NfcDevices = std::unique_ptr;
+using CameraDevices =
+ std::array, max_emulated_controllers>;
+using RingAnalogDevices =
+ std::array, max_emulated_controllers>;
+using NfcDevices =
+ std::array, max_emulated_controllers>;
using OutputDevices = std::array, output_devices_size>;
using ButtonParams = std::array;
using StickParams = std::array;
using ControllerMotionParams = std::array;
using TriggerParams = std::array;
+using ColorParams = std::array;
using BatteryParams = std::array;
-using CameraParams = Common::ParamPackage;
-using NfcParams = Common::ParamPackage;
+using CameraParams = std::array;
+using RingAnalogParams = std::array;
+using NfcParams = std::array;
using OutputParams = std::array;
using ButtonValues = std::array;
@@ -58,6 +66,7 @@ using ControllerMotionValues = std::array;
using BatteryValues = std::array;
using CameraValues = Common::Input::CameraStatus;
+using RingAnalogValue = Common::Input::AnalogStatus;
using NfcValues = Common::Input::NfcStatus;
using VibrationValues = std::array;
@@ -84,6 +93,10 @@ struct CameraState {
std::size_t sample{};
};
+struct RingSensorForce {
+ f32 force;
+};
+
struct NfcState {
Common::Input::NfcState state{};
std::vector data{};
@@ -116,6 +129,7 @@ struct ControllerStatus {
BatteryValues battery_values{};
VibrationValues vibration_values{};
CameraValues camera_values{};
+ RingAnalogValue ring_analog_value{};
NfcValues nfc_values{};
// Data for HID serices
@@ -129,6 +143,7 @@ struct ControllerStatus {
ControllerColors colors_state{};
BatteryLevelState battery_state{};
CameraState camera_state{};
+ RingSensorForce ring_analog_state{};
NfcState nfc_state{};
};
@@ -141,6 +156,7 @@ enum class ControllerTriggerType {
Battery,
Vibration,
IrSensor,
+ RingController,
Nfc,
Connected,
Disconnected,
@@ -294,6 +310,9 @@ public:
/// Returns the latest camera status from the controller with parameters
CameraValues GetCameraValues() const;
+ /// Returns the latest status of analog input from the ring sensor with parameters
+ RingAnalogValue GetRingSensorValues() const;
+
/// Returns the latest status of button input for the hid::HomeButton service
HomeButtonState GetHomeButtons() const;
@@ -324,6 +343,9 @@ public:
/// Returns the latest camera status from the controller
const CameraState& GetCamera() const;
+ /// Returns the latest ringcon force sensor value
+ RingSensorForce GetRingSensorForce() const;
+
/// Returns the latest ntag status from the controller
const NfcState& GetNfc() const;
@@ -342,9 +364,9 @@ public:
/**
* Sets the desired data to be polled from a controller
* @param polling_mode type of input desired buttons, gyro, nfc, ir, etc.
- * @return true if SetPollingMode was successfull
+ * @return driver result from this command
*/
- bool SetPollingMode(Common::Input::PollingMode polling_mode);
+ Common::Input::DriverResult SetPollingMode(Common::Input::PollingMode polling_mode);
/**
* Sets the desired camera format to be polled from a controller
@@ -353,6 +375,15 @@ public:
*/
bool SetCameraFormat(Core::IrSensor::ImageTransferProcessorFormat camera_format);
+ // Returns the current mapped ring device
+ Common::ParamPackage GetRingParam() const;
+
+ /**
+ * Updates the current mapped ring device
+ * @param param ParamPackage with ring sensor data to be mapped
+ */
+ void SetRingParam(Common::ParamPackage param);
+
/// Returns true if the device has nfc support
bool HasNfc() const;
@@ -432,10 +463,17 @@ private:
*/
void SetMotion(const Common::Input::CallbackStatus& callback, std::size_t index);
+ /**
+ * Updates the color status of the controller
+ * @param callback A CallbackStatus containing the color status
+ * @param index color ID of the to be updated
+ */
+ void SetColors(const Common::Input::CallbackStatus& callback, std::size_t index);
+
/**
* Updates the battery status of the controller
* @param callback A CallbackStatus containing the battery status
- * @param index Button ID of the to be updated
+ * @param index battery ID of the to be updated
*/
void SetBattery(const Common::Input::CallbackStatus& callback, std::size_t index);
@@ -445,6 +483,12 @@ private:
*/
void SetCamera(const Common::Input::CallbackStatus& callback);
+ /**
+ * Updates the ring analog sensor status of the ring controller
+ * @param callback A CallbackStatus containing the force status
+ */
+ void SetRingAnalog(const Common::Input::CallbackStatus& callback);
+
/**
* Updates the nfc status of the controller
* @param callback A CallbackStatus containing the nfc status
@@ -484,7 +528,9 @@ private:
ControllerMotionParams motion_params;
TriggerParams trigger_params;
BatteryParams battery_params;
+ ColorParams color_params;
CameraParams camera_params;
+ RingAnalogParams ring_params;
NfcParams nfc_params;
OutputParams output_params;
@@ -493,7 +539,9 @@ private:
ControllerMotionDevices motion_devices;
TriggerDevices trigger_devices;
BatteryDevices battery_devices;
+ ColorDevices color_devices;
CameraDevices camera_devices;
+ RingAnalogDevices ring_analog_devices;
NfcDevices nfc_devices;
OutputDevices output_devices;
diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp
index 6c9cdcb31..50994a249 100755
--- a/src/core/hid/emulated_devices.cpp
+++ b/src/core/hid/emulated_devices.cpp
@@ -14,7 +14,6 @@ EmulatedDevices::EmulatedDevices() = default;
EmulatedDevices::~EmulatedDevices() = default;
void EmulatedDevices::ReloadFromSettings() {
- ring_params = Common::ParamPackage(Settings::values.ringcon_analogs);
ReloadInput();
}
@@ -66,8 +65,6 @@ void EmulatedDevices::ReloadInput() {
key_index++;
}
- ring_analog_device = Common::Input::CreateInputDevice(ring_params);
-
for (std::size_t index = 0; index < mouse_button_devices.size(); ++index) {
if (!mouse_button_devices[index]) {
continue;
@@ -122,13 +119,6 @@ void EmulatedDevices::ReloadInput() {
},
});
}
-
- if (ring_analog_device) {
- ring_analog_device->SetCallback({
- .on_change =
- [this](const Common::Input::CallbackStatus& callback) { SetRingAnalog(callback); },
- });
- }
}
void EmulatedDevices::UnloadInput() {
@@ -145,7 +135,6 @@ void EmulatedDevices::UnloadInput() {
for (auto& button : keyboard_modifier_devices) {
button.reset();
}
- ring_analog_device.reset();
}
void EmulatedDevices::EnableConfiguration() {
@@ -165,7 +154,6 @@ void EmulatedDevices::SaveCurrentConfig() {
if (!is_configuring) {
return;
}
- Settings::values.ringcon_analogs = ring_params.Serialize();
}
void EmulatedDevices::RestoreConfig() {
@@ -175,15 +163,6 @@ void EmulatedDevices::RestoreConfig() {
ReloadFromSettings();
}
-Common::ParamPackage EmulatedDevices::GetRingParam() const {
- return ring_params;
-}
-
-void EmulatedDevices::SetRingParam(Common::ParamPackage param) {
- ring_params = std::move(param);
- ReloadInput();
-}
-
void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& callback,
std::size_t index) {
if (index >= device_status.keyboard_values.size()) {
@@ -430,23 +409,6 @@ void EmulatedDevices::SetMouseStick(const Common::Input::CallbackStatus& callbac
TriggerOnChange(DeviceTriggerType::Mouse);
}
-void EmulatedDevices::SetRingAnalog(const Common::Input::CallbackStatus& callback) {
- std::lock_guard lock{mutex};
- const auto force_value = TransformToStick(callback);
-
- device_status.ring_analog_value = force_value.x;
-
- if (is_configuring) {
- device_status.ring_analog_value = {};
- TriggerOnChange(DeviceTriggerType::RingController);
- return;
- }
-
- device_status.ring_analog_state.force = force_value.x.value;
-
- TriggerOnChange(DeviceTriggerType::RingController);
-}
-
KeyboardValues EmulatedDevices::GetKeyboardValues() const {
std::scoped_lock lock{mutex};
return device_status.keyboard_values;
@@ -462,10 +424,6 @@ MouseButtonValues EmulatedDevices::GetMouseButtonsValues() const {
return device_status.mouse_button_values;
}
-RingAnalogValue EmulatedDevices::GetRingSensorValues() const {
- return device_status.ring_analog_value;
-}
-
KeyboardKey EmulatedDevices::GetKeyboard() const {
std::scoped_lock lock{mutex};
return device_status.keyboard_state;
@@ -491,10 +449,6 @@ AnalogStickState EmulatedDevices::GetMouseWheel() const {
return device_status.mouse_wheel_state;
}
-RingSensorForce EmulatedDevices::GetRingSensorForce() const {
- return device_status.ring_analog_state;
-}
-
void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) {
std::scoped_lock lock{callback_mutex};
for (const auto& poller_pair : callback_list) {
diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h
index 8e776b707..850c6c622 100755
--- a/src/core/hid/emulated_devices.h
+++ b/src/core/hid/emulated_devices.h
@@ -26,11 +26,9 @@ using MouseButtonDevices = std::array,
Settings::NativeMouseWheel::NumMouseWheels>;
using MouseStickDevice = std::unique_ptr;
-using RingAnalogDevice = std::unique_ptr;
using MouseButtonParams =
std::array;
-using RingAnalogParams = Common::ParamPackage;
using KeyboardValues =
std::array;
@@ -41,17 +39,12 @@ using MouseButtonValues =
using MouseAnalogValues =
std::array;
using MouseStickValue = Common::Input::TouchStatus;
-using RingAnalogValue = Common::Input::AnalogStatus;
struct MousePosition {
f32 x;
f32 y;
};
-struct RingSensorForce {
- f32 force;
-};
-
struct DeviceStatus {
// Data from input_common
KeyboardValues keyboard_values{};
@@ -59,7 +52,6 @@ struct DeviceStatus {
MouseButtonValues mouse_button_values{};
MouseAnalogValues mouse_analog_values{};
MouseStickValue mouse_stick_value{};
- RingAnalogValue ring_analog_value{};
// Data for HID serices
KeyboardKey keyboard_state{};
@@ -67,7 +59,6 @@ struct DeviceStatus {
MouseButton mouse_button_state{};
MousePosition mouse_position_state{};
AnalogStickState mouse_wheel_state{};
- RingSensorForce ring_analog_state{};
};
enum class DeviceTriggerType {
@@ -138,9 +129,6 @@ public:
/// Returns the latest status of button input from the mouse with parameters
MouseButtonValues GetMouseButtonsValues() const;
- /// Returns the latest status of analog input from the ring sensor with parameters
- RingAnalogValue GetRingSensorValues() const;
-
/// Returns the latest status of button input from the keyboard
KeyboardKey GetKeyboard() const;
@@ -156,9 +144,6 @@ public:
/// Returns the latest mouse wheel change
AnalogStickState GetMouseWheel() const;
- /// Returns the latest ringcon force sensor value
- RingSensorForce GetRingSensorForce() const;
-
/**
* Adds a callback to the list of events
* @param update_callback InterfaceUpdateCallback that will be triggered
@@ -224,14 +209,11 @@ private:
bool is_configuring{false};
- RingAnalogParams ring_params;
-
KeyboardDevices keyboard_devices;
KeyboardModifierDevices keyboard_modifier_devices;
MouseButtonDevices mouse_button_devices;
MouseAnalogDevices mouse_analog_devices;
MouseStickDevice mouse_stick_device;
- RingAnalogDevice ring_analog_device;
mutable std::mutex mutex;
mutable std::mutex callback_mutex;
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp
index 64d0c72ce..13df8788a 100755
--- a/src/core/hid/input_converter.cpp
+++ b/src/core/hid/input_converter.cpp
@@ -304,6 +304,18 @@ Common::Input::NfcStatus TransformToNfc(const Common::Input::CallbackStatus& cal
return nfc;
}
+Common::Input::BodyColorStatus TransformToColor(const Common::Input::CallbackStatus& callback) {
+ switch (callback.type) {
+ case Common::Input::InputType::Color:
+ return callback.color_status;
+ break;
+ default:
+ LOG_ERROR(Input, "Conversion from type {} to color not implemented", callback.type);
+ return {};
+ break;
+ }
+}
+
void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value) {
const auto& properties = analog.properties;
float& raw_value = analog.raw_value;
diff --git a/src/core/hid/input_converter.h b/src/core/hid/input_converter.h
index e0b0e72b9..5750d1a12 100755
--- a/src/core/hid/input_converter.h
+++ b/src/core/hid/input_converter.h
@@ -88,10 +88,18 @@ Common::Input::CameraStatus TransformToCamera(const Common::Input::CallbackStatu
* Converts raw input data into a valid nfc status.
*
* @param callback Supported callbacks: Nfc.
- * @return A valid CameraObject object.
+ * @return A valid data tag vector.
*/
Common::Input::NfcStatus TransformToNfc(const Common::Input::CallbackStatus& callback);
+/**
+ * Converts raw input data into a valid color status.
+ *
+ * @param callback Supported callbacks: Color.
+ * @return A valid Color object.
+ */
+Common::Input::BodyColorStatus TransformToColor(const Common::Input::CallbackStatus& callback);
+
/**
* Converts raw analog data into a valid analog value
* @param analog An analog object containing raw data and properties
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index b2879a24d..20c051364 100755
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -11,6 +11,7 @@
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/logging/log.h"
+#include "common/scratch_buffer.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/k_auto_object.h"
@@ -325,7 +326,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa
return ResultSuccess;
}
-std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
+std::vector HLERequestContext::ReadBufferCopy(std::size_t buffer_index) const {
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
BufferDescriptorA()[buffer_index].Size()};
if (is_buffer_a) {
@@ -345,6 +346,33 @@ std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
}
}
+std::span HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
+ static thread_local std::array, 2> read_buffer_a;
+ static thread_local std::array, 2> read_buffer_x;
+
+ const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
+ BufferDescriptorA()[buffer_index].Size()};
+ if (is_buffer_a) {
+ ASSERT_OR_EXECUTE_MSG(
+ BufferDescriptorA().size() > buffer_index, { return {}; },
+ "BufferDescriptorA invalid buffer_index {}", buffer_index);
+ auto& read_buffer = read_buffer_a[buffer_index];
+ read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size());
+ memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(),
+ read_buffer.size());
+ return read_buffer;
+ } else {
+ ASSERT_OR_EXECUTE_MSG(
+ BufferDescriptorX().size() > buffer_index, { return {}; },
+ "BufferDescriptorX invalid buffer_index {}", buffer_index);
+ auto& read_buffer = read_buffer_x[buffer_index];
+ read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size());
+ memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(),
+ read_buffer.size());
+ return read_buffer;
+ }
+}
+
std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size,
std::size_t buffer_index) const {
if (size == 0) {
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 1715c0924..8eeeee4e1 100755
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -270,8 +271,11 @@ public:
return domain_message_header.has_value();
}
- /// Helper function to read a buffer using the appropriate buffer descriptor
- [[nodiscard]] std::vector ReadBuffer(std::size_t buffer_index = 0) const;
+ /// Helper function to get a span of a buffer using the appropriate buffer descriptor
+ [[nodiscard]] std::span ReadBuffer(std::size_t buffer_index = 0) const;
+
+ /// Helper function to read a copy of a buffer using the appropriate buffer descriptor
+ [[nodiscard]] std::vector ReadBufferCopy(std::size_t buffer_index = 0) const;
/// Helper function to write a buffer using the appropriate buffer descriptor
std::size_t WriteBuffer(const void* buffer, std::size_t size,
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 294e7692b..d6f46e3c5 100755
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1124,7 +1124,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 offset{rp.Pop()};
- const std::vector data{ctx.ReadBuffer()};
+ const auto data{ctx.ReadBuffer()};
const std::size_t size{std::min(data.size(), backing.GetSize() - offset)};
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 539240842..a0d67412e 100755
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -112,7 +112,7 @@ private:
void RequestUpdate(Kernel::HLERequestContext& ctx) {
LOG_TRACE(Service_Audio, "called");
- std::vector input{ctx.ReadBuffer(0)};
+ const auto input{ctx.ReadBuffer(0)};
// These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
// checking size 0. Performance size is 0 for most games.
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index 4508ea821..5953f1c4a 100755
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -93,7 +93,7 @@ private:
ctx.WriteBuffer(samples);
}
- bool DecodeOpusData(u32& consumed, u32& sample_count, const std::vector& input,
+ bool DecodeOpusData(u32& consumed, u32& sample_count, std::span input,
std::vector& output, u64* out_performance_time) const {
const auto start_time = std::chrono::steady_clock::now();
const std::size_t raw_output_sz = output.size() * sizeof(opus_int16);
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
index c62f53b3d..1447688b4 100755
--- a/src/core/hle/service/es/es.cpp
+++ b/src/core/hle/service/es/es.cpp
@@ -122,7 +122,7 @@ private:
void ImportTicket(Kernel::HLERequestContext& ctx) {
const auto ticket = ctx.ReadBuffer();
- const auto cert = ctx.ReadBuffer(1);
+ [[maybe_unused]] const auto cert = ctx.ReadBuffer(1);
if (ticket.size() < sizeof(Core::Crypto::Ticket)) {
LOG_ERROR(Service_ETicket, "The input buffer is not large enough!");
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 779072def..34af9fd94 100755
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -190,7 +190,7 @@ private:
return;
}
- const std::vector data = ctx.ReadBuffer();
+ const auto data = ctx.ReadBuffer();
ASSERT_MSG(
static_cast(data.size()) <= length,
@@ -401,11 +401,8 @@ public:
}
void RenameFile(Kernel::HLERequestContext& ctx) {
- std::vector buffer = ctx.ReadBuffer(0);
- const std::string src_name = Common::StringFromBuffer(buffer);
-
- buffer = ctx.ReadBuffer(1);
- const std::string dst_name = Common::StringFromBuffer(buffer);
+ const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0));
+ const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1));
LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name);
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index 03bd04f1a..a33de8166 100755
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -228,7 +228,8 @@ private:
return;
}
- control = ctx.ReadBuffer();
+ // TODO: Can this be a span?
+ control = ctx.ReadBufferCopy();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 14a1c853b..1ef3d757a 100755
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -272,6 +272,8 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
}
break;
case Core::HID::NpadStyleIndex::JoyconLeft:
+ shared_memory->fullkey_color.attribute = ColorAttribute::Ok;
+ shared_memory->fullkey_color.fullkey = body_colors.left;
shared_memory->joycon_color.attribute = ColorAttribute::Ok;
shared_memory->joycon_color.left = body_colors.left;
shared_memory->battery_level_dual = battery_level.left.battery_level;
@@ -285,6 +287,8 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
shared_memory->sixaxis_left_properties.is_newly_assigned.Assign(1);
break;
case Core::HID::NpadStyleIndex::JoyconRight:
+ shared_memory->fullkey_color.attribute = ColorAttribute::Ok;
+ shared_memory->fullkey_color.fullkey = body_colors.right;
shared_memory->joycon_color.attribute = ColorAttribute::Ok;
shared_memory->joycon_color.right = body_colors.right;
shared_memory->battery_level_right = battery_level.right.battery_level;
@@ -332,6 +336,8 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
controller.is_connected = true;
controller.device->Connect();
+ controller.device->SetLedPattern();
+ controller.device->SetPollingMode(Common::Input::PollingMode::Active);
SignalStyleSetChangedEvent(npad_id);
WriteEmptyEntry(controller.shared_memory);
}
@@ -737,11 +743,12 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
return hid_core.GetSupportedStyleTag();
}
-void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) {
+void Controller_NPad::SetSupportedNpadIdTypes(std::span data) {
+ const auto length = data.size();
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
supported_npad_id_types.clear();
supported_npad_id_types.resize(length / sizeof(u32));
- std::memcpy(supported_npad_id_types.data(), data, length);
+ std::memcpy(supported_npad_id_types.data(), data.data(), length);
}
void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index cfcc27222..968d671ac 100755
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include "common/bit_field.h"
#include "common/common_types.h"
@@ -95,7 +96,7 @@ public:
void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set);
Core::HID::NpadStyleTag GetSupportedStyleSet() const;
- void SetSupportedNpadIdTypes(u8* data, std::size_t length);
+ void SetSupportedNpadIdTypes(std::span data);
void GetSupportedNpadIdTypes(u32* data, std::size_t max_length);
std::size_t GetSupportedNpadIdTypesSize() const;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 224d9f86a..1944ae64f 100755
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -1026,7 +1026,7 @@ void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
const auto applet_resource_user_id{rp.Pop()};
applet_resource->GetController(HidController::NPad)
- .SetSupportedNpadIdTypes(ctx.ReadBuffer().data(), ctx.GetReadBufferSize());
+ .SetSupportedNpadIdTypes(ctx.ReadBuffer());
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
@@ -2104,7 +2104,7 @@ void Hid::WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx) {
const auto connection_handle{rp.PopRaw()};
const auto unknown{rp.Pop()};
- const auto buffer = ctx.ReadBuffer();
+ [[maybe_unused]] const auto buffer = ctx.ReadBuffer();
LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}",
connection_handle.npad_id, unknown);
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp
index 8833f8bed..35badd632 100755
--- a/src/core/hle/service/hid/hidbus.cpp
+++ b/src/core/hle/service/hid/hidbus.cpp
@@ -297,13 +297,13 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) {
const auto parameters{rp.PopRaw()};
- LOG_INFO(Service_HID,
- "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
- "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
- parameters.enable, parameters.bus_handle.abstracted_pad_id,
- parameters.bus_handle.bus_type, parameters.bus_handle.internal_index,
- parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
- parameters.applet_resource_user_id);
+ LOG_DEBUG(Service_HID,
+ "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
+ "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
+ parameters.enable, parameters.bus_handle.abstracted_pad_id,
+ parameters.bus_handle.bus_type, parameters.bus_handle.internal_index,
+ parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
+ parameters.applet_resource_user_id);
const auto device_index = GetDeviceIndexFromHandle(parameters.bus_handle);
@@ -326,11 +326,11 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto bus_handle_{rp.PopRaw()};
- LOG_INFO(Service_HID,
- "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
- "is_valid={}",
- bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
- bus_handle_.player_number, bus_handle_.is_valid);
+ LOG_DEBUG(Service_HID,
+ "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
+ "is_valid={}",
+ bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
+ bus_handle_.player_number, bus_handle_.is_valid);
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.h b/src/core/hle/service/hid/hidbus/hidbus_base.h
index ff5c56c9a..9258b73d6 100755
--- a/src/core/hle/service/hid/hidbus/hidbus_base.h
+++ b/src/core/hle/service/hid/hidbus/hidbus_base.h
@@ -4,6 +4,7 @@
#pragma once
#include
+#include
#include "common/common_types.h"
#include "core/hle/result.h"
@@ -150,7 +151,7 @@ public:
}
// Assigns a command from data
- virtual bool SetCommand(const std::vector& data) {
+ virtual bool SetCommand(std::span data) {
return {};
}
diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp
index 61d288e49..7422fb40c 100755
--- a/src/core/hle/service/hid/hidbus/ringcon.cpp
+++ b/src/core/hle/service/hid/hidbus/ringcon.cpp
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hid/emulated_devices.h"
+#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
@@ -12,16 +12,18 @@ namespace Service::HID {
RingController::RingController(Core::HID::HIDCore& hid_core_,
KernelHelpers::ServiceContext& service_context_)
: HidbusBase(service_context_) {
- input = hid_core_.GetEmulatedDevices();
+ input = hid_core_.GetEmulatedController(Core::HID::NpadIdType::Player1);
}
RingController::~RingController() = default;
void RingController::OnInit() {
+ input->SetPollingMode(Common::Input::PollingMode::Ring);
return;
}
void RingController::OnRelease() {
+ input->SetPollingMode(Common::Input::PollingMode::Active);
return;
};
@@ -112,7 +114,7 @@ std::vector RingController::GetReply() const {
}
}
-bool RingController::SetCommand(const std::vector& data) {
+bool RingController::SetCommand(std::span data) {
if (data.size() < 4) {
LOG_ERROR(Service_HID, "Command size not supported {}", data.size());
command = RingConCommands::Error;
diff --git a/src/core/hle/service/hid/hidbus/ringcon.h b/src/core/hle/service/hid/hidbus/ringcon.h
index 22629a19c..1a7b477af 100755
--- a/src/core/hle/service/hid/hidbus/ringcon.h
+++ b/src/core/hle/service/hid/hidbus/ringcon.h
@@ -4,12 +4,13 @@
#pragma once
#include
+#include
#include "common/common_types.h"
#include "core/hle/service/hid/hidbus/hidbus_base.h"
namespace Core::HID {
-class EmulatedDevices;
+class EmulatedController;
} // namespace Core::HID
namespace Service::HID {
@@ -31,7 +32,7 @@ public:
u8 GetDeviceId() const override;
// Assigns a command from data
- bool SetCommand(const std::vector& data) override;
+ bool SetCommand(std::span data) override;
// Returns a reply from a command
std::vector GetReply() const override;
@@ -248,6 +249,6 @@ private:
.zero = {.value = idle_value, .crc = 225},
};
- Core::HID::EmulatedDevices* input;
+ Core::HID::EmulatedController* input;
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/hidbus/starlink.cpp b/src/core/hle/service/hid/hidbus/starlink.cpp
index 6d1d01629..3d74eaafd 100755
--- a/src/core/hle/service/hid/hidbus/starlink.cpp
+++ b/src/core/hle/service/hid/hidbus/starlink.cpp
@@ -42,7 +42,7 @@ std::vector Starlink::GetReply() const {
return {};
}
-bool Starlink::SetCommand(const std::vector& data) {
+bool Starlink::SetCommand(std::span data) {
LOG_ERROR(Service_HID, "Command not implemented");
return false;
}
diff --git a/src/core/hle/service/hid/hidbus/starlink.h b/src/core/hle/service/hid/hidbus/starlink.h
index 9be7d54c1..bbde84384 100755
--- a/src/core/hle/service/hid/hidbus/starlink.h
+++ b/src/core/hle/service/hid/hidbus/starlink.h
@@ -29,7 +29,7 @@ public:
u8 GetDeviceId() const override;
// Assigns a command from data
- bool SetCommand(const std::vector& data) override;
+ bool SetCommand(std::span data) override;
// Returns a reply from a command
std::vector GetReply() const override;
diff --git a/src/core/hle/service/hid/hidbus/stubbed.cpp b/src/core/hle/service/hid/hidbus/stubbed.cpp
index 7489d50cb..c4215443c 100755
--- a/src/core/hle/service/hid/hidbus/stubbed.cpp
+++ b/src/core/hle/service/hid/hidbus/stubbed.cpp
@@ -43,7 +43,7 @@ std::vector HidbusStubbed::GetReply() const {
return {};
}
-bool HidbusStubbed::SetCommand(const std::vector& data) {
+bool HidbusStubbed::SetCommand(std::span data) {
LOG_ERROR(Service_HID, "Command not implemented");
return false;
}
diff --git a/src/core/hle/service/hid/hidbus/stubbed.h b/src/core/hle/service/hid/hidbus/stubbed.h
index 0130707a9..0772bc6ee 100755
--- a/src/core/hle/service/hid/hidbus/stubbed.h
+++ b/src/core/hle/service/hid/hidbus/stubbed.h
@@ -29,7 +29,7 @@ public:
u8 GetDeviceId() const override;
// Assigns a command from data
- bool SetCommand(const std::vector& data) override;
+ bool SetCommand(std::span data) override;
// Returns a reply from a command
std::vector GetReply() const override;
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index f3f1cca61..01e3f63fc 100755
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -108,6 +108,7 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
auto result = IsIrCameraHandleValid(parameters.camera_handle);
if (result.IsSuccess()) {
// TODO: Stop Image processor
+ npad_device->SetPollingMode(Common::Input::PollingMode::Active);
result = ResultSuccess;
}
@@ -139,6 +140,7 @@ void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor(parameters.camera_handle, device);
auto& image_transfer_processor = GetProcessor(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -170,6 +172,7 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
auto& image_transfer_processor =
GetProcessor(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -219,6 +222,7 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
GetProcessor(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -294,6 +298,7 @@ void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
auto& image_transfer_processor =
GetProcessor(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -343,6 +348,7 @@ void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor(camera_handle, device);
auto& image_transfer_processor = GetProcessor(camera_handle);
image_transfer_processor.SetConfig(processor_config);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -453,6 +459,7 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
GetProcessor(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -479,6 +486,7 @@ void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor(camera_handle, device);
auto& image_transfer_processor = GetProcessor(camera_handle);
image_transfer_processor.SetConfig(processor_config);
+ npad_device->SetPollingMode(Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -504,6 +512,7 @@ void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
auto result = IsIrCameraHandleValid(parameters.camera_handle);
if (result.IsSuccess()) {
// TODO: Stop image processor async
+ npad_device->SetPollingMode(Common::Input::PollingMode::Active);
result = ResultSuccess;
}
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index a6369d52a..ec162fd31 100755
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -62,7 +62,7 @@ public:
const auto parameters{rp.PopRaw()};
// Optional input/output buffers
- std::vector input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector()};
+ const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span()};
std::vector output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
// Function call prototype:
@@ -132,7 +132,7 @@ public:
const auto command{rp.PopRaw()};
// Optional input/output buffers
- std::vector input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector()};
+ const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span()};
std::vector output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
// Function call prototype:
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp
index a5ff82944..edd170132 100755
--- a/src/core/hle/service/ldn/ldn.cpp
+++ b/src/core/hle/service/ldn/ldn.cpp
@@ -427,7 +427,7 @@ public:
}
void SetAdvertiseData(Kernel::HLERequestContext& ctx) {
- std::vector read_buffer = ctx.ReadBuffer();
+ const auto read_buffer = ctx.ReadBuffer();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(lan_discovery.SetAdvertiseData(read_buffer));
@@ -479,7 +479,7 @@ public:
parameters.security_config.passphrase_size,
parameters.security_config.security_mode, parameters.local_communication_version);
- const std::vector read_buffer = ctx.ReadBuffer();
+ const auto read_buffer = ctx.ReadBuffer();
if (read_buffer.size() != sizeof(NetworkInfo)) {
LOG_ERROR(Frontend, "NetworkInfo doesn't match read_buffer size!");
IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp
index 78578f723..c9815edbc 100755
--- a/src/core/hle/service/nfc/nfc_device.cpp
+++ b/src/core/hle/service/nfc/nfc_device.cpp
@@ -130,7 +130,8 @@ Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) {
return WrongDeviceState;
}
- if (!npad_device->SetPollingMode(Common::Input::PollingMode::NFC)) {
+ if (npad_device->SetPollingMode(Common::Input::PollingMode::NFC) !=
+ Common::Input::DriverResult::Success) {
LOG_ERROR(Service_NFC, "Nfc not supported");
return NfcDisabled;
}
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp
index 517ed0564..8aff01dff 100755
--- a/src/core/hle/service/nfp/nfp_device.cpp
+++ b/src/core/hle/service/nfp/nfp_device.cpp
@@ -152,7 +152,8 @@ Result NfpDevice::StartDetection(TagProtocol allowed_protocol) {
return WrongDeviceState;
}
- if (!npad_device->SetPollingMode(Common::Input::PollingMode::NFC)) {
+ if (npad_device->SetPollingMode(Common::Input::PollingMode::NFC) !=
+ Common::Input::DriverResult::Success) {
LOG_ERROR(Service_NFP, "Nfc not supported");
return NfcDisabled;
}
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h
index 4020821b3..607d303d7 100755
--- a/src/core/hle/service/nvdrv/devices/nvdevice.h
+++ b/src/core/hle/service/nvdrv/devices/nvdevice.h
@@ -3,7 +3,9 @@
#pragma once
+#include
#include
+
#include "common/common_types.h"
#include "core/hle/service/nvdrv/nvdata.h"
@@ -31,7 +33,7 @@ public:
* @param output A buffer where the output data will be written to.
* @returns The result code of the ioctl.
*/
- virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+ virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) = 0;
/**
@@ -42,8 +44,8 @@ public:
* @param output A buffer where the output data will be written to.
* @returns The result code of the ioctl.
*/
- virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) = 0;
+ virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) = 0;
/**
* Handles an ioctl3 request.
@@ -53,7 +55,7 @@ public:
* @param inline_output A buffer where the inlined output data will be written to.
* @returns The result code of the ioctl.
*/
- virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+ virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span input,
std::vector& output, std::vector& inline_output) = 0;
/**
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
index 6ddd40e85..0b4bb7bcb 100755
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
@@ -17,19 +17,19 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system_, NvCore::Container& core)
: nvdevice{system_}, container{core}, nvmap{core.GetNvMapFile()} {}
nvdisp_disp0::~nvdisp_disp0() = default;
-NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) {
+NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, std::span input,
std::vector& output, std::vector& inline_output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
index e420efb4f..7e09e3331 100755
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
@@ -25,12 +25,12 @@ public:
explicit nvdisp_disp0(Core::System& system_, NvCore::Container& core);
~nvdisp_disp0() override;
- NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+ NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) override;
- NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) override;
- NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
- std::vector& output, std::vector& inline_output) override;
+ NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) override;
+ NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span input, std::vector& output,
+ std::vector& inline_output) override;
void OnOpen(DeviceFD fd) override;
void OnClose(DeviceFD fd) override;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 72a4d18eb..ad4fab423 100755
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -27,7 +27,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system_, Module& module_, NvCore::Con
nvhost_as_gpu::~nvhost_as_gpu() = default;
-NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) {
switch (command.group) {
case 'A':
@@ -60,13 +60,13 @@ NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector
return NvResult::NotImplemented;
}
-NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) {
+NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span input,
+ std::span inline_input, std::vector& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
return NvResult::NotImplemented;
}
-NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
+NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span input,
std::vector& output, std::vector& inline_output) {
switch (command.group) {
case 'A':
@@ -87,7 +87,7 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector
void nvhost_as_gpu::OnOpen(DeviceFD fd) {}
void nvhost_as_gpu::OnClose(DeviceFD fd) {}
-NvResult nvhost_as_gpu::AllocAsEx(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::AllocAsEx(std::span input, std::vector& output) {
IoctlAllocAsEx params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -141,7 +141,7 @@ NvResult nvhost_as_gpu::AllocAsEx(const std::vector& input, std::vector&
return NvResult::Success;
}
-NvResult nvhost_as_gpu::AllocateSpace(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::AllocateSpace(std::span input, std::vector& output) {
IoctlAllocSpace params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -220,7 +220,7 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) {
mapping_map.erase(offset);
}
-NvResult nvhost_as_gpu::FreeSpace(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::FreeSpace(std::span input, std::vector& output) {
IoctlFreeSpace params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -266,7 +266,7 @@ NvResult nvhost_as_gpu::FreeSpace(const std::vector& input, std::vector&
return NvResult::Success;
}
-NvResult nvhost_as_gpu::Remap(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::Remap(std::span input, std::vector& output) {
const auto num_entries = input.size() / sizeof(IoctlRemapEntry);
LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", num_entries);
@@ -320,7 +320,7 @@ NvResult nvhost_as_gpu::Remap(const std::vector& input, std::vector& out
return NvResult::Success;
}
-NvResult nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::MapBufferEx(std::span input, std::vector& output) {
IoctlMapBufferEx params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -424,7 +424,7 @@ NvResult nvhost_as_gpu::MapBufferEx(const std::vector& input, std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::UnmapBuffer(std::span input, std::vector& output) {
IoctlUnmapBuffer params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -463,7 +463,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(const std::vector& input, std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::BindChannel(std::span input, std::vector& output) {
IoctlBindChannel params{};
std::memcpy(¶ms, input.data(), input.size());
LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd);
@@ -492,7 +492,7 @@ void nvhost_as_gpu::GetVARegionsImpl(IoctlGetVaRegions& params) {
};
}
-NvResult nvhost_as_gpu::GetVARegions(const std::vector& input, std::vector& output) {
+NvResult nvhost_as_gpu::GetVARegions(std::span input, std::vector& output) {
IoctlGetVaRegions params{};
std::memcpy(¶ms, input.data(), input.size());
@@ -511,7 +511,7 @@ NvResult nvhost_as_gpu::GetVARegions(const std::vector& input, std::vector& input, std::vector& output,
+NvResult nvhost_as_gpu::GetVARegions(std::span input, std::vector& output,
std::vector& inline_output) {
IoctlGetVaRegions params{};
std::memcpy(¶ms, input.data(), input.size());
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
index 57b6a1f76..dcfc02419 100755
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
@@ -47,12 +47,12 @@ public:
explicit nvhost_as_gpu(Core::System& system_, Module& module, NvCore::Container& core);
~nvhost_as_gpu() override;
- NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input,
+ NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span input,
std::vector& output) override;
- NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector& input,
- const std::vector& inline_input, std::vector& output) override;
- NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector& input,
- std::vector& output, std::vector