mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 10:00:06 +00:00
Merge pull request #11972 from t895/fps-counter-adjustments
android: FPS counter adjustments
This commit is contained in:
commit
ca1dd1862b
@ -10,7 +10,6 @@ import android.content.DialogInterface
|
|||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
@ -155,7 +154,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.surfaceEmulation.holder.addCallback(this)
|
binding.surfaceEmulation.holder.addCallback(this)
|
||||||
binding.showFpsText.setTextColor(Color.YELLOW)
|
|
||||||
binding.doneControlConfig.setOnClickListener { stopConfiguringControls() }
|
binding.doneControlConfig.setOnClickListener { stopConfiguringControls() }
|
||||||
|
|
||||||
binding.drawerLayout.addDrawerListener(object : DrawerListener {
|
binding.drawerLayout.addDrawerListener(object : DrawerListener {
|
||||||
@ -414,12 +412,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
val FRAMETIME = 2
|
val FRAMETIME = 2
|
||||||
val SPEED = 3
|
val SPEED = 3
|
||||||
perfStatsUpdater = {
|
perfStatsUpdater = {
|
||||||
if (emulationViewModel.emulationStarted.value == true) {
|
if (emulationViewModel.emulationStarted.value) {
|
||||||
val perfStats = NativeLibrary.getPerfStats()
|
val perfStats = NativeLibrary.getPerfStats()
|
||||||
if (perfStats[FPS] > 0 && _binding != null) {
|
if (_binding != null) {
|
||||||
binding.showFpsText.text = String.format("FPS: %.1f", perfStats[FPS])
|
binding.showFpsText.text = String.format("FPS: %.1f", perfStats[FPS])
|
||||||
}
|
}
|
||||||
perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 100)
|
perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 800)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
perfStatsUpdateHandler.post(perfStatsUpdater!!)
|
perfStatsUpdateHandler.post(perfStatsUpdater!!)
|
||||||
@ -464,7 +462,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) {
|
if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) {
|
||||||
// Restrict emulation and overlays to the top of the screen
|
// Restrict emulation and overlays to the top of the screen
|
||||||
binding.emulationContainer.layoutParams.height = it.bounds.top
|
binding.emulationContainer.layoutParams.height = it.bounds.top
|
||||||
binding.overlayContainer.layoutParams.height = it.bounds.top
|
|
||||||
// Restrict input and menu drawer to the bottom of the screen
|
// Restrict input and menu drawer to the bottom of the screen
|
||||||
binding.inputContainer.layoutParams.height = it.bounds.bottom
|
binding.inputContainer.layoutParams.height = it.bounds.bottom
|
||||||
binding.inGameMenu.layoutParams.height = it.bounds.bottom
|
binding.inGameMenu.layoutParams.height = it.bounds.bottom
|
||||||
@ -478,7 +475,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
if (!isFolding) {
|
if (!isFolding) {
|
||||||
binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
binding.inputContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
binding.inputContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
isInFoldableLayout = false
|
isInFoldableLayout = false
|
||||||
updateOrientation()
|
updateOrientation()
|
||||||
@ -486,7 +482,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
binding.emulationContainer.requestLayout()
|
binding.emulationContainer.requestLayout()
|
||||||
binding.inputContainer.requestLayout()
|
binding.inputContainer.requestLayout()
|
||||||
binding.overlayContainer.requestLayout()
|
|
||||||
binding.inGameMenu.requestLayout()
|
binding.inGameMenu.requestLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,24 +707,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
v.setPadding(left, cutInsets.top, right, 0)
|
v.setPadding(left, cutInsets.top, right, 0)
|
||||||
|
|
||||||
// Ensure FPS text doesn't get cut off by rounded display corners
|
|
||||||
val sidePadding = resources.getDimensionPixelSize(R.dimen.spacing_xtralarge)
|
|
||||||
if (cutInsets.left == 0) {
|
|
||||||
binding.showFpsText.setPadding(
|
|
||||||
sidePadding,
|
|
||||||
cutInsets.top,
|
|
||||||
cutInsets.right,
|
|
||||||
cutInsets.bottom
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
binding.showFpsText.setPadding(
|
|
||||||
cutInsets.left,
|
|
||||||
cutInsets.top,
|
|
||||||
cutInsets.right,
|
|
||||||
cutInsets.bottom
|
|
||||||
)
|
|
||||||
}
|
|
||||||
windowInsets
|
windowInsets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,8 @@ bool EmulationSession::IsPaused() const {
|
|||||||
return m_is_running && m_is_paused;
|
return m_is_running && m_is_paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Core::PerfStatsResults& EmulationSession::PerfStats() const {
|
const Core::PerfStatsResults& EmulationSession::PerfStats() {
|
||||||
std::scoped_lock m_perf_stats_lock(m_perf_stats_mutex);
|
m_perf_stats = m_system.GetAndResetPerfStats();
|
||||||
return m_perf_stats;
|
return m_perf_stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,11 +383,6 @@ void EmulationSession::RunEmulation() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
// Refresh performance stats.
|
|
||||||
std::scoped_lock m_perf_stats_lock(m_perf_stats_mutex);
|
|
||||||
m_perf_stats = m_system.GetAndResetPerfStats();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
void RunEmulation();
|
void RunEmulation();
|
||||||
void ShutdownEmulation();
|
void ShutdownEmulation();
|
||||||
|
|
||||||
const Core::PerfStatsResults& PerfStats() const;
|
const Core::PerfStatsResults& PerfStats();
|
||||||
void ConfigureFilesystemProvider(const std::string& filepath);
|
void ConfigureFilesystemProvider(const std::string& filepath);
|
||||||
void InitializeSystem(bool reload);
|
void InitializeSystem(bool reload);
|
||||||
Core::SystemResultStatus InitializeEmulation(const std::string& filepath);
|
Core::SystemResultStatus InitializeEmulation(const std::string& filepath);
|
||||||
@ -80,6 +80,5 @@ private:
|
|||||||
|
|
||||||
// Synchronization
|
// Synchronization
|
||||||
std::condition_variable_any m_cv;
|
std::condition_variable_any m_cv;
|
||||||
mutable std::mutex m_perf_stats_mutex;
|
|
||||||
mutable std::mutex m_mutex;
|
mutable std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
@ -134,16 +134,18 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/overlay_container"
|
android:id="@+id/overlay_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/show_fps_text"
|
android:id="@+id/show_fps_text"
|
||||||
|
style="@style/TextAppearance.Material3.BodyMedium"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:shadowColor="@android:color/black"
|
android:paddingHorizontal="20dp"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
tools:ignore="RtlHardcoded" />
|
tools:ignore="RtlHardcoded" />
|
||||||
|
Loading…
Reference in New Issue
Block a user