summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt5
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ControllerMappingHelper.kt70
2 files changed, 0 insertions, 75 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
index e96a2059b..7464647c4 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
@@ -45,7 +45,6 @@ import org.yuzu.yuzu_emu.features.settings.model.IntSetting
import org.yuzu.yuzu_emu.features.settings.model.Settings
import org.yuzu.yuzu_emu.model.EmulationViewModel
import org.yuzu.yuzu_emu.model.Game
-import org.yuzu.yuzu_emu.utils.ControllerMappingHelper
import org.yuzu.yuzu_emu.utils.ForegroundService
import org.yuzu.yuzu_emu.utils.InputHandler
import org.yuzu.yuzu_emu.utils.MemoryUtil
@@ -57,8 +56,6 @@ import kotlin.math.roundToInt
class EmulationActivity : AppCompatActivity(), SensorEventListener {
private lateinit var binding: ActivityEmulationBinding
- private var controllerMappingHelper: ControllerMappingHelper? = null
-
var isActivityRecreated = false
private lateinit var nfcReader: NfcReader
private lateinit var inputHandler: InputHandler
@@ -95,8 +92,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
isActivityRecreated = savedInstanceState != null
- controllerMappingHelper = ControllerMappingHelper()
-
// Set these options now so that the SurfaceView the game renders into is the right size.
enableFullscreenImmersive()
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ControllerMappingHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ControllerMappingHelper.kt
deleted file mode 100644
index eeefcdf20..000000000
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ControllerMappingHelper.kt
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-package org.yuzu.yuzu_emu.utils
-
-import android.view.InputDevice
-import android.view.KeyEvent
-import android.view.MotionEvent
-
-/**
- * Some controllers have incorrect mappings. This class has special-case fixes for them.
- */
-class ControllerMappingHelper {
- /**
- * Some controllers report extra button presses that can be ignored.
- */
- fun shouldKeyBeIgnored(inputDevice: InputDevice, keyCode: Int): Boolean {
- return if (isDualShock4(inputDevice)) {
- // The two analog triggers generate analog motion events as well as a keycode.
- // We always prefer to use the analog values, so throw away the button press
- keyCode == KeyEvent.KEYCODE_BUTTON_L2 || keyCode == KeyEvent.KEYCODE_BUTTON_R2
- } else {
- false
- }
- }
-
- /**
- * Scale an axis to be zero-centered with a proper range.
- */
- fun scaleAxis(inputDevice: InputDevice, axis: Int, value: Float): Float {
- if (isDualShock4(inputDevice)) {
- // Android doesn't have correct mappings for this controller's triggers. It reports them
- // as RX & RY, centered at -1.0, and with a range of [-1.0, 1.0]
- // Scale them to properly zero-centered with a range of [0.0, 1.0].
- if (axis == MotionEvent.AXIS_RX || axis == MotionEvent.AXIS_RY) {
- return (value + 1) / 2.0f
- }
- } else if (isXboxOneWireless(inputDevice)) {
- // Same as the DualShock 4, the mappings are missing.
- if (axis == MotionEvent.AXIS_Z || axis == MotionEvent.AXIS_RZ) {
- return (value + 1) / 2.0f
- }
- if (axis == MotionEvent.AXIS_GENERIC_1) {
- // This axis is stuck at ~.5. Ignore it.
- return 0.0f
- }
- } else if (isMogaPro2Hid(inputDevice)) {
- // This controller has a broken axis that reports a constant value. Ignore it.
- if (axis == MotionEvent.AXIS_GENERIC_1) {
- return 0.0f
- }
- }
- return value
- }
-
- // Sony DualShock 4 controller
- private fun isDualShock4(inputDevice: InputDevice): Boolean {
- return inputDevice.vendorId == 0x54c && inputDevice.productId == 0x9cc
- }
-
- // Microsoft Xbox One controller
- private fun isXboxOneWireless(inputDevice: InputDevice): Boolean {
- return inputDevice.vendorId == 0x45e && inputDevice.productId == 0x2e0
- }
-
- // Moga Pro 2 HID
- private fun isMogaPro2Hid(inputDevice: InputDevice): Boolean {
- return inputDevice.vendorId == 0x20d6 && inputDevice.productId == 0x6271
- }
-}