diff options
| author | 2023-03-21 00:34:39 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:05:44 -0700 | |
| commit | d3c3b697555e25235f39c142ae1e188dd5a354d6 (patch) | |
| tree | ce73b7b4b4aaef3b6b0a15c02989d738c5e1397e /src/android/app | |
| parent | Use yuzu as category instead of citra (diff) | |
| download | yuzu-d3c3b697555e25235f39c142ae1e188dd5a354d6.tar.gz yuzu-d3c3b697555e25235f39c142ae1e188dd5a354d6.tar.xz yuzu-d3c3b697555e25235f39c142ae1e188dd5a354d6.zip | |
android: Inset input overlay based on system cutouts
Diffstat (limited to 'src/android/app')
5 files changed, 94 insertions, 59 deletions
diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle index 7539c27f6..c62177e6d 100644 --- a/src/android/app/build.gradle +++ b/src/android/app/build.gradle | |||
| @@ -138,6 +138,7 @@ dependencies { | |||
| 138 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" | 138 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" |
| 139 | implementation "io.coil-kt:coil:2.2.2" | 139 | implementation "io.coil-kt:coil:2.2.2" |
| 140 | implementation 'androidx.core:core-splashscreen:1.0.0' | 140 | implementation 'androidx.core:core-splashscreen:1.0.0' |
| 141 | implementation 'androidx.window:window:1.0.0' | ||
| 141 | 142 | ||
| 142 | // Allows FRP-style asynchronous operations in Android. | 143 | // Allows FRP-style asynchronous operations in Android. |
| 143 | implementation 'io.reactivex:rxandroid:1.2.1' | 144 | implementation 'io.reactivex:rxandroid:1.2.1' |
diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index c37559b47..349dd5050 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml | |||
| @@ -54,7 +54,7 @@ | |||
| 54 | android:resizeableActivity="false" | 54 | android:resizeableActivity="false" |
| 55 | android:theme="@style/Theme.Yuzu.Main" | 55 | android:theme="@style/Theme.Yuzu.Main" |
| 56 | android:launchMode="singleTop" | 56 | android:launchMode="singleTop" |
| 57 | android:screenOrientation="landscape"/> | 57 | android:screenOrientation="userLandscape" /> |
| 58 | 58 | ||
| 59 | <service android:name="org.yuzu.yuzu_emu.utils.ForegroundService"/> | 59 | <service android:name="org.yuzu.yuzu_emu.utils.ForegroundService"/> |
| 60 | 60 | ||
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 c02d35f5d..0889b6f7f 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 | |||
| @@ -153,7 +153,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram | |||
| 153 | preferences.edit() | 153 | preferences.edit() |
| 154 | .putInt(Settings.PREF_CONTROL_SCALE, 50) | 154 | .putInt(Settings.PREF_CONTROL_SCALE, 50) |
| 155 | .apply() | 155 | .apply() |
| 156 | binding.surfaceInputOverlay.resetButtonPlacement() | 156 | binding.surfaceInputOverlay.post { binding.surfaceInputOverlay.resetButtonPlacement() } |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | private fun updateShowFpsOverlay() { | 159 | private fun updateShowFpsOverlay() { |
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 8df9b7bad..acd4a1fe2 100644 --- 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 | |||
| @@ -18,14 +18,16 @@ import android.hardware.Sensor | |||
| 18 | import android.hardware.SensorEvent | 18 | import android.hardware.SensorEvent |
| 19 | import android.hardware.SensorEventListener | 19 | import android.hardware.SensorEventListener |
| 20 | import android.hardware.SensorManager | 20 | import android.hardware.SensorManager |
| 21 | import android.os.Build | ||
| 21 | import android.util.AttributeSet | 22 | import android.util.AttributeSet |
| 22 | import android.util.DisplayMetrics | ||
| 23 | import android.view.MotionEvent | 23 | import android.view.MotionEvent |
| 24 | import android.view.SurfaceView | 24 | import android.view.SurfaceView |
| 25 | import android.view.View | 25 | import android.view.View |
| 26 | import android.view.View.OnTouchListener | 26 | import android.view.View.OnTouchListener |
| 27 | import android.view.WindowInsets | ||
| 27 | import androidx.core.content.ContextCompat | 28 | import androidx.core.content.ContextCompat |
| 28 | import androidx.preference.PreferenceManager | 29 | import androidx.preference.PreferenceManager |
| 30 | import androidx.window.layout.WindowMetricsCalculator | ||
| 29 | import org.yuzu.yuzu_emu.NativeLibrary | 31 | import org.yuzu.yuzu_emu.NativeLibrary |
| 30 | import org.yuzu.yuzu_emu.NativeLibrary.ButtonType | 32 | import org.yuzu.yuzu_emu.NativeLibrary.ButtonType |
| 31 | import org.yuzu.yuzu_emu.NativeLibrary.StickType | 33 | import org.yuzu.yuzu_emu.NativeLibrary.StickType |
| @@ -34,7 +36,6 @@ import org.yuzu.yuzu_emu.YuzuApplication | |||
| 34 | import org.yuzu.yuzu_emu.features.settings.model.Settings | 36 | import org.yuzu.yuzu_emu.features.settings.model.Settings |
| 35 | import org.yuzu.yuzu_emu.utils.EmulationMenuSettings | 37 | import org.yuzu.yuzu_emu.utils.EmulationMenuSettings |
| 36 | 38 | ||
| 37 | |||
| 38 | /** | 39 | /** |
| 39 | * Draws the interactive input overlay on top of the | 40 | * Draws the interactive input overlay on top of the |
| 40 | * [SurfaceView] that is rendering emulation. | 41 | * [SurfaceView] that is rendering emulation. |
| @@ -51,7 +52,22 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : SurfaceView(context | |||
| 51 | private val accel = FloatArray(3) | 52 | private val accel = FloatArray(3) |
| 52 | private var motionTimestamp: Long = 0 | 53 | private var motionTimestamp: Long = 0 |
| 53 | 54 | ||
| 54 | init { | 55 | private lateinit var windowInsets: WindowInsets |
| 56 | |||
| 57 | private fun setMotionSensorListener(context: Context) { | ||
| 58 | val sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager | ||
| 59 | val gyroSensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) | ||
| 60 | val accelSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) | ||
| 61 | |||
| 62 | sensorManager.registerListener(this, gyroSensor, SensorManager.SENSOR_DELAY_GAME) | ||
| 63 | sensorManager.registerListener(this, accelSensor, SensorManager.SENSOR_DELAY_GAME) | ||
| 64 | } | ||
| 65 | |||
| 66 | override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { | ||
| 67 | super.onLayout(changed, left, top, right, bottom) | ||
| 68 | |||
| 69 | windowInsets = rootWindowInsets | ||
| 70 | |||
| 55 | if (!preferences.getBoolean(Settings.PREF_OVERLAY_INIT, false)) { | 71 | if (!preferences.getBoolean(Settings.PREF_OVERLAY_INIT, false)) { |
| 56 | defaultOverlay() | 72 | defaultOverlay() |
| 57 | } | 73 | } |
| @@ -72,18 +88,6 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : SurfaceView(context | |||
| 72 | requestFocus() | 88 | requestFocus() |
| 73 | } | 89 | } |
| 74 | 90 | ||
| 75 | private fun setMotionSensorListener(context: Context) { | ||
| 76 | val sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager | ||
| 77 | val gyroSensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) | ||
| 78 | val accelSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) | ||
| 79 | if (gyroSensor != null) { | ||
| 80 | sensorManager.registerListener(this, gyroSensor, SensorManager.SENSOR_DELAY_GAME) | ||
| 81 | } | ||
| 82 | if (accelSensor != null) { | ||
| 83 | sensorManager.registerListener(this, accelSensor, SensorManager.SENSOR_DELAY_GAME) | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | override fun draw(canvas: Canvas) { | 91 | override fun draw(canvas: Canvas) { |
| 88 | super.draw(canvas) | 92 | super.draw(canvas) |
| 89 | for (button in overlayButtons) { | 93 | for (button in overlayButtons) { |
| @@ -483,141 +487,169 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : SurfaceView(context | |||
| 483 | 487 | ||
| 484 | private fun defaultOverlayLandscape() { | 488 | private fun defaultOverlayLandscape() { |
| 485 | // Get screen size | 489 | // Get screen size |
| 486 | val display = (context as Activity).windowManager.defaultDisplay | 490 | val windowMetrics = |
| 487 | val outMetrics = DisplayMetrics() | 491 | WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(context as Activity) |
| 488 | display.getRealMetrics(outMetrics) | 492 | var maxY = windowMetrics.bounds.height().toFloat() |
| 489 | var maxX = outMetrics.heightPixels.toFloat() | 493 | var maxX = windowMetrics.bounds.width().toFloat() |
| 490 | var maxY = outMetrics.widthPixels.toFloat() | 494 | var minY = 0 |
| 491 | // Height and width changes depending on orientation. Use the larger value for height. | 495 | var minX = 0 |
| 492 | if (maxY > maxX) { | 496 | |
| 493 | val tmp = maxX | 497 | // If we have API access, calculate the safe area to draw the overlay |
| 494 | maxX = maxY | 498 | var cutoutLeft = 0 |
| 495 | maxY = tmp | 499 | var cutoutBottom = 0 |
| 496 | } | 500 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { |
| 497 | val res = resources | 501 | val insets = windowInsets.displayCutout!! |
| 502 | maxY = | ||
| 503 | if (insets.boundingRectTop.bottom != 0) insets.boundingRectTop.bottom.toFloat() else maxY | ||
| 504 | maxX = | ||
| 505 | if (insets.boundingRectRight.left != 0) insets.boundingRectRight.left.toFloat() else maxX | ||
| 506 | minX = insets.boundingRectLeft.right - insets.boundingRectLeft.left | ||
| 507 | minY = insets.boundingRectBottom.top - insets.boundingRectBottom.bottom | ||
| 508 | |||
| 509 | cutoutLeft = insets.boundingRectRight.right - insets.boundingRectRight.left | ||
| 510 | cutoutBottom = insets.boundingRectTop.top - insets.boundingRectTop.bottom | ||
| 511 | } | ||
| 512 | |||
| 513 | // This makes sure that if we have an inset on one side of the screen, we mirror it on | ||
| 514 | // the other side. Since removing space from one of the max values messes with the scale, | ||
| 515 | // we also have to account for it using our min values. | ||
| 516 | if (maxX.toInt() != windowMetrics.bounds.width()) minX += cutoutLeft | ||
| 517 | if (maxY.toInt() != windowMetrics.bounds.height()) minY += cutoutBottom | ||
| 518 | if (minX > 0 && maxX.toInt() == windowMetrics.bounds.width()) { | ||
| 519 | maxX -= (minX * 2) | ||
| 520 | } else if (minX > 0) { | ||
| 521 | maxX -= minX | ||
| 522 | } | ||
| 523 | if (minY > 0 && maxY.toInt() == windowMetrics.bounds.height()) { | ||
| 524 | maxY -= (minY * 2) | ||
| 525 | } else if (minY > 0) { | ||
| 526 | maxY -= minY | ||
| 527 | } | ||
| 498 | 528 | ||
| 499 | // Each value is a percent from max X/Y stored as an int. Have to bring that value down | 529 | // Each value is a percent from max X/Y stored as an int. Have to bring that value down |
| 500 | // to a decimal before multiplying by MAX X/Y. | 530 | // to a decimal before multiplying by MAX X/Y. |
| 501 | preferences.edit() | 531 | preferences.edit() |
| 502 | .putFloat( | 532 | .putFloat( |
| 503 | ButtonType.BUTTON_A.toString() + "-X", | 533 | ButtonType.BUTTON_A.toString() + "-X", |
| 504 | res.getInteger(R.integer.SWITCH_BUTTON_A_X).toFloat() / 1000 * maxX | 534 | resources.getInteger(R.integer.SWITCH_BUTTON_A_X).toFloat() / 1000 * maxX + minX |
| 505 | ) | 535 | ) |
| 506 | .putFloat( | 536 | .putFloat( |
| 507 | ButtonType.BUTTON_A.toString() + "-Y", | 537 | ButtonType.BUTTON_A.toString() + "-Y", |
| 508 | res.getInteger(R.integer.SWITCH_BUTTON_A_Y).toFloat() / 1000 * maxY | 538 | resources.getInteger(R.integer.SWITCH_BUTTON_A_Y).toFloat() / 1000 * maxY + minY |
| 509 | ) | 539 | ) |
| 510 | .putFloat( | 540 | .putFloat( |
| 511 | ButtonType.BUTTON_B.toString() + "-X", | 541 | ButtonType.BUTTON_B.toString() + "-X", |
| 512 | res.getInteger(R.integer.SWITCH_BUTTON_B_X).toFloat() / 1000 * maxX | 542 | resources.getInteger(R.integer.SWITCH_BUTTON_B_X).toFloat() / 1000 * maxX + minX |
| 513 | ) | 543 | ) |
| 514 | .putFloat( | 544 | .putFloat( |
| 515 | ButtonType.BUTTON_B.toString() + "-Y", | 545 | ButtonType.BUTTON_B.toString() + "-Y", |
| 516 | res.getInteger(R.integer.SWITCH_BUTTON_B_Y).toFloat() / 1000 * maxY | 546 | resources.getInteger(R.integer.SWITCH_BUTTON_B_Y).toFloat() / 1000 * maxY + minY |
| 517 | ) | 547 | ) |
| 518 | .putFloat( | 548 | .putFloat( |
| 519 | ButtonType.BUTTON_X.toString() + "-X", | 549 | ButtonType.BUTTON_X.toString() + "-X", |
| 520 | res.getInteger(R.integer.SWITCH_BUTTON_X_X).toFloat() / 1000 * maxX | 550 | resources.getInteger(R.integer.SWITCH_BUTTON_X_X).toFloat() / 1000 * maxX + minX |
| 521 | ) | 551 | ) |
| 522 | .putFloat( | 552 | .putFloat( |
| 523 | ButtonType.BUTTON_X.toString() + "-Y", | 553 | ButtonType.BUTTON_X.toString() + "-Y", |
| 524 | res.getInteger(R.integer.SWITCH_BUTTON_X_Y).toFloat() / 1000 * maxY | 554 | resources.getInteger(R.integer.SWITCH_BUTTON_X_Y).toFloat() / 1000 * maxY + minY |
| 525 | ) | 555 | ) |
| 526 | .putFloat( | 556 | .putFloat( |
| 527 | ButtonType.BUTTON_Y.toString() + "-X", | 557 | ButtonType.BUTTON_Y.toString() + "-X", |
| 528 | res.getInteger(R.integer.SWITCH_BUTTON_Y_X).toFloat() / 1000 * maxX | 558 | resources.getInteger(R.integer.SWITCH_BUTTON_Y_X).toFloat() / 1000 * maxX + minX |
| 529 | ) | 559 | ) |
| 530 | .putFloat( | 560 | .putFloat( |
| 531 | ButtonType.BUTTON_Y.toString() + "-Y", | 561 | ButtonType.BUTTON_Y.toString() + "-Y", |
| 532 | res.getInteger(R.integer.SWITCH_BUTTON_Y_Y).toFloat() / 1000 * maxY | 562 | resources.getInteger(R.integer.SWITCH_BUTTON_Y_Y).toFloat() / 1000 * maxY + minY |
| 533 | ) | 563 | ) |
| 534 | .putFloat( | 564 | .putFloat( |
| 535 | ButtonType.TRIGGER_ZL.toString() + "-X", | 565 | ButtonType.TRIGGER_ZL.toString() + "-X", |
| 536 | res.getInteger(R.integer.SWITCH_TRIGGER_ZL_X).toFloat() / 1000 * maxX | 566 | resources.getInteger(R.integer.SWITCH_TRIGGER_ZL_X).toFloat() / 1000 * maxX + minX |
| 537 | ) | 567 | ) |
| 538 | .putFloat( | 568 | .putFloat( |
| 539 | ButtonType.TRIGGER_ZL.toString() + "-Y", | 569 | ButtonType.TRIGGER_ZL.toString() + "-Y", |
| 540 | res.getInteger(R.integer.SWITCH_TRIGGER_ZL_Y).toFloat() / 1000 * maxY | 570 | resources.getInteger(R.integer.SWITCH_TRIGGER_ZL_Y).toFloat() / 1000 * maxY + minY |
| 541 | ) | 571 | ) |
| 542 | .putFloat( | 572 | .putFloat( |
| 543 | ButtonType.TRIGGER_ZR.toString() + "-X", | 573 | ButtonType.TRIGGER_ZR.toString() + "-X", |
| 544 | res.getInteger(R.integer.SWITCH_TRIGGER_ZR_X).toFloat() / 1000 * maxX | 574 | resources.getInteger(R.integer.SWITCH_TRIGGER_ZR_X).toFloat() / 1000 * maxX + minX |
| 545 | ) | 575 | ) |
| 546 | .putFloat( | 576 | .putFloat( |
| 547 | ButtonType.TRIGGER_ZR.toString() + "-Y", | 577 | ButtonType.TRIGGER_ZR.toString() + "-Y", |
| 548 | res.getInteger(R.integer.SWITCH_TRIGGER_ZR_Y).toFloat() / 1000 * maxY | 578 | resources.getInteger(R.integer.SWITCH_TRIGGER_ZR_Y).toFloat() / 1000 * maxY + minY |
| 549 | ) | 579 | ) |
| 550 | .putFloat( | 580 | .putFloat( |
| 551 | ButtonType.DPAD_UP.toString() + "-X", | 581 | ButtonType.DPAD_UP.toString() + "-X", |
| 552 | res.getInteger(R.integer.SWITCH_BUTTON_DPAD_X).toFloat() / 1000 * maxX | 582 | resources.getInteger(R.integer.SWITCH_BUTTON_DPAD_X).toFloat() / 1000 * maxX + minX |
| 553 | ) | 583 | ) |
| 554 | .putFloat( | 584 | .putFloat( |
| 555 | ButtonType.DPAD_UP.toString() + "-Y", | 585 | ButtonType.DPAD_UP.toString() + "-Y", |
| 556 | res.getInteger(R.integer.SWITCH_BUTTON_DPAD_Y).toFloat() / 1000 * maxY | 586 | resources.getInteger(R.integer.SWITCH_BUTTON_DPAD_Y).toFloat() / 1000 * maxY + minY |
| 557 | ) | 587 | ) |
| 558 | .putFloat( | 588 | .putFloat( |
| 559 | ButtonType.TRIGGER_L.toString() + "-X", | 589 | ButtonType.TRIGGER_L.toString() + "-X", |
| 560 | res.getInteger(R.integer.SWITCH_TRIGGER_L_X).toFloat() / 1000 * maxX | 590 | resources.getInteger(R.integer.SWITCH_TRIGGER_L_X).toFloat() / 1000 * maxX + minX |
| 561 | ) | 591 | ) |
| 562 | .putFloat( | 592 | .putFloat( |
| 563 | ButtonType.TRIGGER_L.toString() + "-Y", | 593 | ButtonType.TRIGGER_L.toString() + "-Y", |
| 564 | res.getInteger(R.integer.SWITCH_TRIGGER_L_Y).toFloat() / 1000 * maxY | 594 | resources.getInteger(R.integer.SWITCH_TRIGGER_L_Y).toFloat() / 1000 * maxY + minY |
| 565 | ) | 595 | ) |
| 566 | .putFloat( | 596 | .putFloat( |
| 567 | ButtonType.TRIGGER_R.toString() + "-X", | 597 | ButtonType.TRIGGER_R.toString() + "-X", |
| 568 | res.getInteger(R.integer.SWITCH_TRIGGER_R_X).toFloat() / 1000 * maxX | 598 | resources.getInteger(R.integer.SWITCH_TRIGGER_R_X).toFloat() / 1000 * maxX + minX |
| 569 | ) | 599 | ) |
| 570 | .putFloat( | 600 | .putFloat( |
| 571 | ButtonType.TRIGGER_R.toString() + "-Y", | 601 | ButtonType.TRIGGER_R.toString() + "-Y", |
| 572 | res.getInteger(R.integer.SWITCH_TRIGGER_R_Y).toFloat() / 1000 * maxY | 602 | resources.getInteger(R.integer.SWITCH_TRIGGER_R_Y).toFloat() / 1000 * maxY + minY |
| 573 | ) | 603 | ) |
| 574 | .putFloat( | 604 | .putFloat( |
| 575 | ButtonType.BUTTON_PLUS.toString() + "-X", | 605 | ButtonType.BUTTON_PLUS.toString() + "-X", |
| 576 | res.getInteger(R.integer.SWITCH_BUTTON_PLUS_X).toFloat() / 1000 * maxX | 606 | resources.getInteger(R.integer.SWITCH_BUTTON_PLUS_X).toFloat() / 1000 * maxX + minX |
| 577 | ) | 607 | ) |
| 578 | .putFloat( | 608 | .putFloat( |
| 579 | ButtonType.BUTTON_PLUS.toString() + "-Y", | 609 | ButtonType.BUTTON_PLUS.toString() + "-Y", |
| 580 | res.getInteger(R.integer.SWITCH_BUTTON_PLUS_Y).toFloat() / 1000 * maxY | 610 | resources.getInteger(R.integer.SWITCH_BUTTON_PLUS_Y).toFloat() / 1000 * maxY + minY |
| 581 | ) | 611 | ) |
| 582 | .putFloat( | 612 | .putFloat( |
| 583 | ButtonType.BUTTON_MINUS.toString() + "-X", | 613 | ButtonType.BUTTON_MINUS.toString() + "-X", |
| 584 | res.getInteger(R.integer.SWITCH_BUTTON_MINUS_X).toFloat() / 1000 * maxX | 614 | resources.getInteger(R.integer.SWITCH_BUTTON_MINUS_X).toFloat() / 1000 * maxX + minX |
| 585 | ) | 615 | ) |
| 586 | .putFloat( | 616 | .putFloat( |
| 587 | ButtonType.BUTTON_MINUS.toString() + "-Y", | 617 | ButtonType.BUTTON_MINUS.toString() + "-Y", |
| 588 | res.getInteger(R.integer.SWITCH_BUTTON_MINUS_Y).toFloat() / 1000 * maxY | 618 | resources.getInteger(R.integer.SWITCH_BUTTON_MINUS_Y).toFloat() / 1000 * maxY + minY |
| 589 | ) | 619 | ) |
| 590 | .putFloat( | 620 | .putFloat( |
| 591 | ButtonType.BUTTON_HOME.toString() + "-X", | 621 | ButtonType.BUTTON_HOME.toString() + "-X", |
| 592 | res.getInteger(R.integer.SWITCH_BUTTON_HOME_X).toFloat() / 1000 * maxX | 622 | resources.getInteger(R.integer.SWITCH_BUTTON_HOME_X).toFloat() / 1000 * maxX + minX |
| 593 | ) | 623 | ) |
| 594 | .putFloat( | 624 | .putFloat( |
| 595 | ButtonType.BUTTON_HOME.toString() + "-Y", | 625 | ButtonType.BUTTON_HOME.toString() + "-Y", |
| 596 | res.getInteger(R.integer.SWITCH_BUTTON_HOME_Y).toFloat() / 1000 * maxY | 626 | resources.getInteger(R.integer.SWITCH_BUTTON_HOME_Y).toFloat() / 1000 * maxY + minY |
| 597 | ) | 627 | ) |
| 598 | .putFloat( | 628 | .putFloat( |
| 599 | ButtonType.BUTTON_CAPTURE.toString() + "-X", | 629 | ButtonType.BUTTON_CAPTURE.toString() + "-X", |
| 600 | res.getInteger(R.integer.SWITCH_BUTTON_CAPTURE_X).toFloat() / 1000 * maxX | 630 | resources.getInteger(R.integer.SWITCH_BUTTON_CAPTURE_X) |
| 631 | .toFloat() / 1000 * maxX + minX | ||
| 601 | ) | 632 | ) |
| 602 | .putFloat( | 633 | .putFloat( |
| 603 | ButtonType.BUTTON_CAPTURE.toString() + "-Y", | 634 | ButtonType.BUTTON_CAPTURE.toString() + "-Y", |
| 604 | res.getInteger(R.integer.SWITCH_BUTTON_CAPTURE_Y).toFloat() / 1000 * maxY | 635 | resources.getInteger(R.integer.SWITCH_BUTTON_CAPTURE_Y) |
| 636 | .toFloat() / 1000 * maxY + minY | ||
| 605 | ) | 637 | ) |
| 606 | .putFloat( | 638 | .putFloat( |
| 607 | ButtonType.STICK_R.toString() + "-X", | 639 | ButtonType.STICK_R.toString() + "-X", |
| 608 | res.getInteger(R.integer.SWITCH_STICK_R_X).toFloat() / 1000 * maxX | 640 | resources.getInteger(R.integer.SWITCH_STICK_R_X).toFloat() / 1000 * maxX + minX |
| 609 | ) | 641 | ) |
| 610 | .putFloat( | 642 | .putFloat( |
| 611 | ButtonType.STICK_R.toString() + "-Y", | 643 | ButtonType.STICK_R.toString() + "-Y", |
| 612 | res.getInteger(R.integer.SWITCH_STICK_R_Y).toFloat() / 1000 * maxY | 644 | resources.getInteger(R.integer.SWITCH_STICK_R_Y).toFloat() / 1000 * maxY + minY |
| 613 | ) | 645 | ) |
| 614 | .putFloat( | 646 | .putFloat( |
| 615 | ButtonType.STICK_L.toString() + "-X", | 647 | ButtonType.STICK_L.toString() + "-X", |
| 616 | res.getInteger(R.integer.SWITCH_STICK_L_X).toFloat() / 1000 * maxX | 648 | resources.getInteger(R.integer.SWITCH_STICK_L_X).toFloat() / 1000 * maxX + minX |
| 617 | ) | 649 | ) |
| 618 | .putFloat( | 650 | .putFloat( |
| 619 | ButtonType.STICK_L.toString() + "-Y", | 651 | ButtonType.STICK_L.toString() + "-Y", |
| 620 | res.getInteger(R.integer.SWITCH_STICK_L_Y).toFloat() / 1000 * maxY | 652 | resources.getInteger(R.integer.SWITCH_STICK_L_Y).toFloat() / 1000 * maxY + minY |
| 621 | ) | 653 | ) |
| 622 | .commit() | 654 | .commit() |
| 623 | // We want to commit right away, otherwise the overlay could load before this is saved. | 655 | // We want to commit right away, otherwise the overlay could load before this is saved. |
diff --git a/src/android/app/src/main/res/values/themes.xml b/src/android/app/src/main/res/values/themes.xml index b2ed1d4b9..dfad059b6 100644 --- a/src/android/app/src/main/res/values/themes.xml +++ b/src/android/app/src/main/res/values/themes.xml | |||
| @@ -40,6 +40,8 @@ | |||
| 40 | <item name="android:navigationBarColor">@android:color/transparent</item> | 40 | <item name="android:navigationBarColor">@android:color/transparent</item> |
| 41 | 41 | ||
| 42 | <item name="sliderStyle">@style/YuzuSlider</item> | 42 | <item name="sliderStyle">@style/YuzuSlider</item> |
| 43 | |||
| 44 | <item name="android:windowLayoutInDisplayCutoutMode">default</item> | ||
| 43 | </style> | 45 | </style> |
| 44 | 46 | ||
| 45 | <!-- Trick for API >= 29 specific changes --> | 47 | <!-- Trick for API >= 29 specific changes --> |