From 2fd217730f70a070d666e8ee50ba1b6006c78d13 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Mon, 25 Sep 2023 19:00:33 +0200 Subject: [PATCH] early-access version 3896 --- README.md | 2 +- .../org/yuzu/yuzu_emu/overlay/InputOverlay.kt | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 23639ca49..25dbf66ef 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3895. +This is the source code for early-access 3896. ## Legal Notice diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt index c055c2e35..a13faf3c7 100755 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt @@ -352,7 +352,7 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : } private fun addOverlayControls(layout: String) { - val windowSize = getSafeScreenSize(context) + val windowSize = getSafeScreenSize(context, Pair(measuredWidth, measuredHeight)) if (preferences.getBoolean(Settings.PREF_BUTTON_A, true)) { overlayButtons.add( initializeOverlayButton( @@ -593,7 +593,7 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : } private fun saveControlPosition(prefId: String, x: Int, y: Int, layout: String) { - val windowSize = getSafeScreenSize(context) + val windowSize = getSafeScreenSize(context, Pair(measuredWidth, measuredHeight)) val min = windowSize.first val max = windowSize.second PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext).edit() @@ -968,14 +968,17 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : * @return A pair of points, the first being the top left corner of the safe area, * the second being the bottom right corner of the safe area */ - private fun getSafeScreenSize(context: Context): Pair { + private fun getSafeScreenSize( + context: Context, + screenSize: Pair + ): Pair { // Get screen size val windowMetrics = WindowMetricsCalculator.getOrCreate() .computeCurrentWindowMetrics(context as Activity) - var maxY = windowMetrics.bounds.height().toFloat() - var maxX = windowMetrics.bounds.width().toFloat() - var minY = 0 + var maxX = screenSize.first.toFloat() + var maxY = screenSize.second.toFloat() var minX = 0 + var minY = 0 // If we have API access, calculate the safe area to draw the overlay var cutoutLeft = 0