diff options
author | wwylele <wwylele@gmail.com> | 2016-12-29 20:18:36 +0100 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2016-12-29 20:18:36 +0100 |
commit | d7d40b3c56df8e31d018477a5bd2abe3a6e4e550 (patch) | |
tree | 1a512e19bc5bfb918249218a2396f747896abee9 /src/core/frontend/emu_window.cpp | |
parent | Frontend: emulate motion sensor (diff) | |
download | yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.tar yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.tar.gz yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.tar.bz2 yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.tar.lz yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.tar.xz yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.tar.zst yuzu-d7d40b3c56df8e31d018477a5bd2abe3a6e4e550.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/frontend/emu_window.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 13c7f3de2..1541cc39d 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -93,6 +93,8 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) { void EmuWindow::AccelerometerChanged(float x, float y, float z) { constexpr float coef = 512; + std::lock_guard<std::mutex> lock(accel_mutex); + // TODO(wwylele): do a time stretch as it in GyroscopeChanged // The time stretch formula should be like // stretched_vector = (raw_vector - gravity) * stretch_ratio + gravity @@ -106,6 +108,7 @@ void EmuWindow::GyroscopeChanged(float x, float y, float z) { float coef = GetGyroscopeRawToDpsCoefficient(); float stretch = FULL_FPS / Common::Profiling::GetTimingResultsAggregator()->GetAggregatedResults().fps; + std::lock_guard<std::mutex> lock(gyro_mutex); gyro_x = x * coef * stretch; gyro_y = y * coef * stretch; gyro_z = z * coef * stretch; |