summaryrefslogtreecommitdiff
path: root/src/core/frontend/emu_window.cpp
diff options
context:
space:
mode:
authorGravatar wwylele2017-08-07 00:04:06 +0300
committerGravatar wwylele2017-08-11 11:05:08 +0300
commit188194908c2785bd1e03485941b9148777cdddd7 (patch)
treeab6cd04195f5e18bd1e7dd21a7c2896066827a6f /src/core/frontend/emu_window.cpp
parentHID: use MotionDevice for Accelerometer and Gyroscope (diff)
downloadyuzu-188194908c2785bd1e03485941b9148777cdddd7.tar.gz
yuzu-188194908c2785bd1e03485941b9148777cdddd7.tar.xz
yuzu-188194908c2785bd1e03485941b9148777cdddd7.zip
move MotionEmu from core/frontend to input_common as a InputDevice
Diffstat (limited to 'src/core/frontend/emu_window.cpp')
-rw-r--r--src/core/frontend/emu_window.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 4f7d54a33..60b20d4e2 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -62,29 +62,6 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
62 TouchPressed(framebuffer_x, framebuffer_y); 62 TouchPressed(framebuffer_x, framebuffer_y);
63} 63}
64 64
65void EmuWindow::AccelerometerChanged(float x, float y, float z) {
66 constexpr float coef = 512;
67
68 std::lock_guard<std::mutex> lock(accel_mutex);
69
70 // TODO(wwylele): do a time stretch as it in GyroscopeChanged
71 // The time stretch formula should be like
72 // stretched_vector = (raw_vector - gravity) * stretch_ratio + gravity
73 accel_x = static_cast<s16>(x * coef);
74 accel_y = static_cast<s16>(y * coef);
75 accel_z = static_cast<s16>(z * coef);
76}
77
78void EmuWindow::GyroscopeChanged(float x, float y, float z) {
79 constexpr float FULL_FPS = 60;
80 float coef = GetGyroscopeRawToDpsCoefficient();
81 float stretch = Core::System::GetInstance().perf_stats.GetLastFrameTimeScale();
82 std::lock_guard<std::mutex> lock(gyro_mutex);
83 gyro_x = static_cast<s16>(x * coef * stretch);
84 gyro_y = static_cast<s16>(y * coef * stretch);
85 gyro_z = static_cast<s16>(z * coef * stretch);
86}
87
88void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { 65void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
89 Layout::FramebufferLayout layout; 66 Layout::FramebufferLayout layout;
90 if (Settings::values.custom_layout == true) { 67 if (Settings::values.custom_layout == true) {