diff options
Diffstat (limited to 'src/core/frontend/emu_window.cpp')
-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; |