summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorgerman <german@thesoftwareartisans.com>2020-09-03 02:59:34 +0200
committergerman <german@thesoftwareartisans.com>2020-09-05 04:48:13 +0200
commit0774b17846fc7bd12bfe329fbaed6524d96c81cb (patch)
tree66322913f15800647404a33051d99454546eaa11 /src/core
parentconfigure_input_player: Show/hide motion buttons based on the controller (diff)
downloadyuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.tar
yuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.tar.gz
yuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.tar.bz2
yuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.tar.lz
yuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.tar.xz
yuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.tar.zst
yuzu-0774b17846fc7bd12bfe329fbaed6524d96c81cb.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frontend/input.h29
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp5
-rw-r--r--src/core/hle/service/hid/controllers/npad.h10
3 files changed, 16 insertions, 28 deletions
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h
index 6770475cf..9da0d2829 100644
--- a/src/core/frontend/input.h
+++ b/src/core/frontend/input.h
@@ -119,25 +119,7 @@ using ButtonDevice = InputDevice<bool>;
using AnalogDevice = InputDevice<std::tuple<float, float>>;
/**
- * A motion device is an input device that returns a tuple of accelerometer state vector and
- * gyroscope state vector.
- *
- * For both vectors:
- * x+ is the same direction as LEFT on D-pad.
- * y+ is normal to the touch screen, pointing outward.
- * z+ is the same direction as UP on D-pad.
- *
- * For accelerometer state vector
- * Units: g (gravitational acceleration)
- *
- * For gyroscope state vector:
- * Orientation is determined by right-hand rule.
- * Units: deg/sec
- */
-using MotionDevice = InputDevice<std::tuple<Common::Vec3<float>, Common::Vec3<float>>>;
-
-/**
- * A real motion device is an input device that returns a tuple of accelerometer state vector,
+ * A motion status is an object that returns a tuple of accelerometer state vector,
* gyroscope state vector, rotation state vector and orientation state matrix.
*
* For both vectors:
@@ -160,8 +142,13 @@ using MotionDevice = InputDevice<std::tuple<Common::Vec3<float>, Common::Vec3<fl
* y vector
* z vector
*/
-using RealMotionDevice = InputDevice<std::tuple<Common::Vec3<float>, Common::Vec3<float>,
- Common::Vec3<float>, std::array<Common::Vec3f, 3>>>;
+using MotionStatus = std::tuple<Common::Vec3<float>, Common::Vec3<float>, Common::Vec3<float>,
+ std::array<Common::Vec3f, 3>>;
+
+/**
+ * A motion device is an input device that returns a motion status object
+ */
+using MotionDevice = InputDevice<MotionStatus>;
/**
* A touch device is an input device that returns a tuple of two floats and a bool. The floats are
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 9701318b5..2e06372a4 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -251,7 +251,7 @@ void Controller_NPad::OnLoadInputDevices() {
sticks[i].begin(), Input::CreateDevice<Input::AnalogDevice>);
std::transform(players[i].motions.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
players[i].motions.begin() + Settings::NativeMotion::MOTION_HID_END,
- motions[i].begin(), Input::CreateDevice<Input::RealMotionDevice>);
+ motions[i].begin(), Input::CreateDevice<Input::MotionDevice>);
}
}
@@ -397,7 +397,8 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
std::tie(motion_devices[e].accel, motion_devices[e].gyro,
motion_devices[e].rotation, motion_devices[e].orientation) =
device->GetStatus();
- sixaxis_at_rest = sixaxis_at_rest && motion_devices[e].gyro.Length2() < 1.0f;
+ sixaxis_at_rest =
+ sixaxis_at_rest && motion_devices[e].gyro.Length2() < 0.00005f;
}
}
}
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 99d7e459a..7b07d2e8b 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -299,9 +299,9 @@ private:
struct MotionDevice {
Common::Vec3f accel;
- Common::Vec3f gyro{};
+ Common::Vec3f gyro;
Common::Vec3f rotation;
- std::array<Common::Vec3f, 3> orientation{};
+ std::array<Common::Vec3f, 3> orientation;
};
struct NPadEntry {
@@ -358,9 +358,9 @@ private:
using StickArray = std::array<
std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID>,
10>;
- using MotionArray = std::array<std::array<std::unique_ptr<Input::RealMotionDevice>,
- Settings::NativeMotion::NUM_MOTION_HID>,
- 10>;
+ using MotionArray = std::array<
+ std::array<std::unique_ptr<Input::MotionDevice>, Settings::NativeMotion::NUM_MOTION_HID>,
+ 10>;
ButtonArray buttons;
StickArray sticks;
MotionArray motions;