summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Charles Lombardo2023-11-03 23:57:57 -0400
committerGravatar Charles Lombardo2023-11-04 00:04:20 -0400
commit9543adf072a7d116e49b2d54359cd7e5b374e594 (patch)
treeca7465eb01f169d609221466451b5b0132e9b495 /src
parentMerge pull request #11954 from t895/log-hardware (diff)
downloadyuzu-9543adf072a7d116e49b2d54359cd7e5b374e594.tar.gz
yuzu-9543adf072a7d116e49b2d54359cd7e5b374e594.tar.xz
yuzu-9543adf072a7d116e49b2d54359cd7e5b374e594.zip
android: Always update FPS counter
Diffstat (limited to '')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt6
-rw-r--r--src/android/app/src/main/jni/native.cpp9
-rw-r--r--src/android/app/src/main/jni/native.h3
3 files changed, 6 insertions, 12 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
index c456c0592..77f2cdf65 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
@@ -414,12 +414,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
414 val FRAMETIME = 2 414 val FRAMETIME = 2
415 val SPEED = 3 415 val SPEED = 3
416 perfStatsUpdater = { 416 perfStatsUpdater = {
417 if (emulationViewModel.emulationStarted.value == true) { 417 if (emulationViewModel.emulationStarted.value) {
418 val perfStats = NativeLibrary.getPerfStats() 418 val perfStats = NativeLibrary.getPerfStats()
419 if (perfStats[FPS] > 0 && _binding != null) { 419 if (_binding != null) {
420 binding.showFpsText.text = String.format("FPS: %.1f", perfStats[FPS]) 420 binding.showFpsText.text = String.format("FPS: %.1f", perfStats[FPS])
421 } 421 }
422 perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 100) 422 perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 800)
423 } 423 }
424 } 424 }
425 perfStatsUpdateHandler.post(perfStatsUpdater!!) 425 perfStatsUpdateHandler.post(perfStatsUpdater!!)
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index 294e41045..2b1c6374d 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -199,8 +199,8 @@ bool EmulationSession::IsPaused() const {
199 return m_is_running && m_is_paused; 199 return m_is_running && m_is_paused;
200} 200}
201 201
202const Core::PerfStatsResults& EmulationSession::PerfStats() const { 202const Core::PerfStatsResults& EmulationSession::PerfStats() {
203 std::scoped_lock m_perf_stats_lock(m_perf_stats_mutex); 203 m_perf_stats = m_system.GetAndResetPerfStats();
204 return m_perf_stats; 204 return m_perf_stats;
205} 205}
206 206
@@ -381,11 +381,6 @@ void EmulationSession::RunEmulation() {
381 break; 381 break;
382 } 382 }
383 } 383 }
384 {
385 // Refresh performance stats.
386 std::scoped_lock m_perf_stats_lock(m_perf_stats_mutex);
387 m_perf_stats = m_system.GetAndResetPerfStats();
388 }
389 } 384 }
390} 385}
391 386
diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h
index 0aa2b085b..9f915b160 100644
--- a/src/android/app/src/main/jni/native.h
+++ b/src/android/app/src/main/jni/native.h
@@ -41,7 +41,7 @@ public:
41 void RunEmulation(); 41 void RunEmulation();
42 void ShutdownEmulation(); 42 void ShutdownEmulation();
43 43
44 const Core::PerfStatsResults& PerfStats() const; 44 const Core::PerfStatsResults& PerfStats();
45 void ConfigureFilesystemProvider(const std::string& filepath); 45 void ConfigureFilesystemProvider(const std::string& filepath);
46 void InitializeSystem(); 46 void InitializeSystem();
47 Core::SystemResultStatus InitializeEmulation(const std::string& filepath); 47 Core::SystemResultStatus InitializeEmulation(const std::string& filepath);
@@ -80,6 +80,5 @@ private:
80 80
81 // Synchronization 81 // Synchronization
82 std::condition_variable_any m_cv; 82 std::condition_variable_any m_cv;
83 mutable std::mutex m_perf_stats_mutex;
84 mutable std::mutex m_mutex; 83 mutable std::mutex m_mutex;
85}; 84};