summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid/controllers
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2022-05-22 00:10:20 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2022-05-27 17:22:36 +0200
commit240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e (patch)
treea2d814d9be7ca3c2547399090f451dbc3694d56b /src/core/hle/service/hid/controllers
parentservice: hid: Implement EnableSixAxisSensorUnalteredPassthrough and IsSixAxisSensorUnalteredPassthroughEnabled (diff)
downloadyuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.tar
yuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.tar.gz
yuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.tar.bz2
yuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.tar.lz
yuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.tar.xz
yuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.tar.zst
yuzu-240f59a4c8319ec5f0c0e5fd34e8f9c5a458751e.zip
Diffstat (limited to 'src/core/hle/service/hid/controllers')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp32
-rw-r--r--src/core/hle/service/hid/controllers/npad.h8
2 files changed, 39 insertions, 1 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index c9909ad5a..9ce25c641 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -66,7 +66,7 @@ ResultCode Controller_NPad::VerifyValidSixAxisSensorHandle(
if (!device_index) {
return NpadDeviceIndexOutOfRange;
}
- // This doesn't get validaded on nnsdk
+ // This doesn't get validated on nnsdk
const bool npad_type = device_handle.npad_type < Core::HID::NpadStyleIndex::MaxNpadType;
if (!npad_type) {
return NpadInvalidHandle;
@@ -1100,6 +1100,36 @@ ResultCode Controller_NPad::IsSixAxisSensorUnalteredPassthroughEnabled(
return ResultSuccess;
}
+ResultCode Controller_NPad::LoadSixAxisSensorCalibrationParameter(
+ const Core::HID::SixAxisSensorHandle& sixaxis_handle,
+ Core::HID::SixAxisSensorCalibrationParameter& calibration) const {
+ const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
+ if (is_valid.IsError()) {
+ LOG_ERROR(Service_HID, "Invalid handle, error_code={}", is_valid.raw);
+ return is_valid;
+ }
+
+ // TODO: Request this data to the controller. On error return 0xd8ca
+ const auto& sixaxis = GetSixaxisState(sixaxis_handle);
+ calibration = sixaxis.calibration;
+ return ResultSuccess;
+}
+
+ResultCode Controller_NPad::GetSixAxisSensorIcInformation(
+ const Core::HID::SixAxisSensorHandle& sixaxis_handle,
+ Core::HID::SixAxisSensorIcInformation& ic_information) const {
+ const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
+ if (is_valid.IsError()) {
+ LOG_ERROR(Service_HID, "Invalid handle, error_code={}", is_valid.raw);
+ return is_valid;
+ }
+
+ // TODO: Request this data to the controller. On error return 0xd8ca
+ const auto& sixaxis = GetSixaxisState(sixaxis_handle);
+ ic_information = sixaxis.ic_information;
+ return ResultSuccess;
+}
+
ResultCode Controller_NPad::SetSixAxisEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
bool sixaxis_status) {
const auto is_valid = VerifyValidSixAxisSensorHandle(sixaxis_handle);
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 951f46425..2e2e1d07f 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -155,6 +155,12 @@ public:
const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool is_enabled);
ResultCode IsSixAxisSensorUnalteredPassthroughEnabled(
const Core::HID::SixAxisSensorHandle& sixaxis_handle, bool& is_enabled) const;
+ ResultCode LoadSixAxisSensorCalibrationParameter(
+ const Core::HID::SixAxisSensorHandle& sixaxis_handle,
+ Core::HID::SixAxisSensorCalibrationParameter& calibration) const;
+ ResultCode GetSixAxisSensorIcInformation(
+ const Core::HID::SixAxisSensorHandle& sixaxis_handle,
+ Core::HID::SixAxisSensorIcInformation& ic_information) const;
ResultCode SetSixAxisEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
bool sixaxis_status);
ResultCode IsSixAxisSensorFusionEnabled(const Core::HID::SixAxisSensorHandle& sixaxis_handle,
@@ -474,6 +480,8 @@ private:
bool is_fusion_enabled{true};
bool unaltered_passtrough{false};
Core::HID::SixAxisSensorFusionParameters fusion{};
+ Core::HID::SixAxisSensorCalibrationParameter calibration{};
+ Core::HID::SixAxisSensorIcInformation ic_information{};
GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};
};