Changed ComboHelper.kt to use Native Button ints, removed rest of initial implementation traces

This commit is contained in:
ADAS2024 2026-04-15 14:47:26 -04:00
parent f905a1656e
commit 65b2332a89
7 changed files with 27 additions and 32 deletions

View file

@ -920,7 +920,6 @@ object NativeLibrary {
const val BUTTON_GPIO14 = 782
const val BUTTON_SWAP = 800
const val BUTTON_TURBO = 801
const val BUTTON_COMBO = 802
}
/**

View file

@ -4,6 +4,8 @@
package org.citra.citra_emu.features.settings.model
import org.citra.citra_emu.NativeLibrary
enum class IntListSetting(
override val key: String,
override val section: String,
@ -12,7 +14,17 @@ enum class IntListSetting(
) : AbstractListSetting<Int> {
LAYOUTS_TO_CYCLE("layouts_to_cycle", Settings.SECTION_LAYOUT, listOf(0, 1, 2, 3, 4, 5), canBeEmpty = false),
COMBO_KEYS("combo_keys", Settings.SECTION_CONTROLS, listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), canBeEmpty = true);
COMBO_KEYS("combo_keys", Settings.SECTION_CONTROLS, listOf
(NativeLibrary.ButtonType.BUTTON_A,
NativeLibrary.ButtonType.BUTTON_B,
NativeLibrary.ButtonType.BUTTON_X,
NativeLibrary.ButtonType.BUTTON_Y,
NativeLibrary.ButtonType.TRIGGER_L,
NativeLibrary.ButtonType.TRIGGER_R,
NativeLibrary.ButtonType.BUTTON_ZL,
NativeLibrary.ButtonType.BUTTON_ZR,
NativeLibrary.ButtonType.BUTTON_START,
NativeLibrary.ButtonType.BUTTON_SELECT), canBeEmpty = true);
private var backingList: List<Int> = defaultValue
private var lastValidList : List<Int> = defaultValue

View file

@ -523,7 +523,6 @@ class InputBindingSetting(
NativeLibrary.ButtonType.BUTTON_SELECT -> Settings.KEY_BUTTON_SELECT
NativeLibrary.ButtonType.BUTTON_START -> Settings.KEY_BUTTON_START
NativeLibrary.ButtonType.BUTTON_HOME -> Settings.KEY_BUTTON_HOME
NativeLibrary.ButtonType.BUTTON_COMBO -> Settings.KEY_BUTTON_COMBO
NativeLibrary.ButtonType.DPAD_UP -> Settings.KEY_BUTTON_UP
NativeLibrary.ButtonType.DPAD_DOWN -> Settings.KEY_BUTTON_DOWN
NativeLibrary.ButtonType.DPAD_LEFT -> Settings.KEY_BUTTON_LEFT

View file

@ -48,6 +48,5 @@ abstract class SettingsItem(
const val TYPE_STRING_INPUT = 9
const val TYPE_FLOAT_INPUT = 10
const val TYPE_MULTI_CHOICE = 11
const val TYPE_STRING_MULTI_CHOICE = 12
}
}

View file

@ -66,6 +66,7 @@ import org.citra.citra_emu.databinding.FragmentEmulationBinding
import org.citra.citra_emu.display.PortraitScreenLayout
import org.citra.citra_emu.display.ScreenAdjustmentUtil
import org.citra.citra_emu.display.ScreenLayout
import org.citra.citra_emu.features.hotkeys.Hotkey
import org.citra.citra_emu.features.settings.model.BooleanSetting
import org.citra.citra_emu.features.settings.model.IntSetting
import org.citra.citra_emu.features.settings.model.Settings
@ -809,7 +810,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
}
R.id.menu_emulation_adjust_scale_button_combo -> {
showAdjustScaleDialog("controlScale-" + NativeLibrary.ButtonType.BUTTON_COMBO)
showAdjustScaleDialog("controlScale-" + Hotkey.COMBO_KEY.button)
true
}

View file

@ -8,26 +8,10 @@ import org.citra.citra_emu.NativeLibrary
import org.citra.citra_emu.features.settings.model.IntListSetting
object ComboHelper {
fun getButton(button: Int): Int {
when (button) {
0 -> return NativeLibrary.ButtonType.BUTTON_A
1 -> return NativeLibrary.ButtonType.BUTTON_B
2 -> return NativeLibrary.ButtonType.BUTTON_X
3 -> return NativeLibrary.ButtonType.BUTTON_Y
4 -> return NativeLibrary.ButtonType.TRIGGER_L
5 -> return NativeLibrary.ButtonType.TRIGGER_R
6 -> return NativeLibrary.ButtonType.BUTTON_ZL
7 -> return NativeLibrary.ButtonType.BUTTON_ZR
8 -> return NativeLibrary.ButtonType.BUTTON_START
9 -> return NativeLibrary.ButtonType.BUTTON_SELECT
}
return -1
}
fun comboActivate(buttonStatus: Int) {
val comboArray = IntListSetting.COMBO_KEYS.list
Log.info("Combo Array: $comboArray")
for (selectedButton in comboArray) {
val nativeButton = getButton(selectedButton)
for (nativeButton in comboArray) {
Log.info("Native Button: $nativeButton")
if (nativeButton == -1)
{

View file

@ -197,17 +197,18 @@
<item>@string/button_select</item>
</string-array>
<!-- Ints refer to button values in NativeLibrary -->
<integer-array name="comboOptionValues">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>700</item>
<item>701</item>
<item>702</item>
<item>703</item>
<item>773</item>
<item>774</item>
<item>707</item>
<item>708</item>
<item>704</item>
<item>705</item>
</integer-array>