diff options
| author | Mai <mai.iam2048@gmail.com> | 2023-11-28 19:21:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 19:21:29 +0100 |
| commit | ac53766058ad38546b4d8128b4635edabbb5c793 (patch) | |
| tree | 223ca227a4857f08935fb0601a955fb36b68ec1f /Source/Android/app/src/main | |
| parent | bfc6bca5832d7c2e4ea39b356de775935d432687 (diff) | |
| parent | d811c12196b7692695ff2b864ea7ea348247d641 (diff) | |
Merge pull request #12215 from JosJuice/android-si-devices
Android: Add more GameCube controller types
Diffstat (limited to 'Source/Android/app/src/main')
5 files changed, 68 insertions, 36 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt index 348e75b6a0..e84dd201a5 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.kt @@ -30,11 +30,16 @@ class EmulatedController private constructor(private val pointer: Long) { external fun saveProfile(path: String) + external fun getProfileName(): String + companion object { @JvmStatic external fun getGcPad(controllerIndex: Int): EmulatedController @JvmStatic + external fun getGcKeyboard(controllerIndex: Int): EmulatedController + + @JvmStatic external fun getWiimote(controllerIndex: Int): EmulatedController @JvmStatic diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt index 624441aa73..2896c815fe 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/ui/ProfileDialogPresenter.kt @@ -100,15 +100,14 @@ class ProfileDialogPresenter { .show() } - private val profileDirectoryName: String - get() = if (menuTag.isGCPadMenu) "GCPad" else if (menuTag.isWiimoteMenu) "Wiimote" else throw UnsupportedOperationException() - - private fun getProfileDirectoryPath(stock: Boolean): String = - if (stock) { + private fun getProfileDirectoryPath(stock: Boolean): String { + val profileDirectoryName = menuTag.correspondingEmulatedController.getProfileName() + return if (stock) { "${DirectoryInitialization.getSysDirectory()}/Profiles/$profileDirectoryName/" } else { "${DirectoryInitialization.getUserDirectory()}/Config/Profiles/$profileDirectoryName/" } + } private fun getProfilePath(profileName: String, stock: Boolean): String = getProfileDirectoryPath(stock) + profileName + EXTENSION diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt index b85a3999cc..b1e1271f89 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt @@ -2079,34 +2079,49 @@ class SettingsFragmentPresenter( } private fun addGcPadSubSettings(sl: ArrayList<SettingsItem>, gcPadNumber: Int, gcPadType: Int) { - if (gcPadType == 6) { - // Emulated - val gcPad = EmulatedController.getGcPad(gcPadNumber) + when (gcPadType) { + 6, 8, 9, 10 -> { + // Emulated + val gcPad = EmulatedController.getGcPad(gcPadNumber) - if (!TextUtils.isEmpty(gameId)) { - addControllerPerGameSettings(sl, "Pad", gcPadNumber) - } else { - addControllerMetaSettings(sl, gcPad) - addControllerMappingSettings(sl, gcPad, null) + if (!TextUtils.isEmpty(gameId)) { + addControllerPerGameSettings(sl, gcPad, gcPadNumber) + } else { + addControllerMetaSettings(sl, gcPad) + addControllerMappingSettings(sl, gcPad, null) + } } - } else if (gcPadType == 12) { - // Adapter - sl.add( - SwitchSetting( - context, - BooleanSetting.getSettingForAdapterRumble(gcPadNumber), - R.string.gc_adapter_rumble, - R.string.gc_adapter_rumble_description + 7 -> { + // Emulated keyboard controller + val gcKeyboard = EmulatedController.getGcKeyboard(gcPadNumber) + + if (!TextUtils.isEmpty(gameId)) { + addControllerPerGameSettings(sl, gcKeyboard, gcPadNumber) + } else { + sl.add(HeaderSetting(context, R.string.keyboard_controller_warning, 0)) + addControllerMetaSettings(sl, gcKeyboard) + addControllerMappingSettings(sl, gcKeyboard, null) + } + } + 12 -> { + // Adapter + sl.add( + SwitchSetting( + context, + BooleanSetting.getSettingForAdapterRumble(gcPadNumber), + R.string.gc_adapter_rumble, + R.string.gc_adapter_rumble_description + ) ) - ) - sl.add( - SwitchSetting( - context, - BooleanSetting.getSettingForSimulateKonga(gcPadNumber), - R.string.gc_adapter_bongos, - R.string.gc_adapter_bongos_description + sl.add( + SwitchSetting( + context, + BooleanSetting.getSettingForSimulateKonga(gcPadNumber), + R.string.gc_adapter_bongos, + R.string.gc_adapter_bongos_description + ) ) - ) + } } } @@ -2114,7 +2129,7 @@ class SettingsFragmentPresenter( val wiimote = EmulatedController.getWiimote(wiimoteNumber) if (!TextUtils.isEmpty(gameId)) { - addControllerPerGameSettings(sl, "Wiimote", wiimoteNumber) + addControllerPerGameSettings(sl, wiimote, wiimoteNumber) } else { addControllerMetaSettings(sl, wiimote) @@ -2210,11 +2225,11 @@ class SettingsFragmentPresenter( */ private fun addControllerPerGameSettings( sl: ArrayList<SettingsItem>, - profileString: String, + controller: EmulatedController, controllerNumber: Int ) { val profiles = ProfileDialogPresenter(menuTag).getProfileNames(false) - val profileKey = profileString + "Profile" + (controllerNumber + 1) + val profileKey = controller.getProfileName() + "Profile" + (controllerNumber + 1) sl.add( StringSingleChoiceSetting( context, diff --git a/Source/Android/app/src/main/res/values/arrays.xml b/Source/Android/app/src/main/res/values/arrays.xml index 212bcb3d2b..2f8adeb60c 100644 --- a/Source/Android/app/src/main/res/values/arrays.xml +++ b/Source/Android/app/src/main/res/values/arrays.xml @@ -367,11 +367,19 @@ <string-array name="gcpadTypeEntries"> <item>@string/gcpad_disabled</item> <item>@string/gcpad_emulated</item> + <item>@string/gcpad_keyboard</item> + <item>@string/gcpad_steering_wheel</item> + <item>@string/gcpad_dance_mat</item> + <item>@string/gcpad_taru_konga</item> <item>@string/gcpad_gc_adapter</item> </string-array> <integer-array name="gcpadTypeValues"> <item>0</item> <item>6</item> + <item>7</item> + <item>8</item> + <item>9</item> + <item>10</item> <item>12</item> </integer-array> diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 044c1ad65d..9575ec0eb2 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -47,6 +47,7 @@ <string name="input_clear">Clear</string> <string name="input_clear_description">Clear settings for this controller.</string> <string name="input_reset_warning">Are you sure? Your current controller settings will be deleted.</string> + <string name="keyboard_controller_warning">"You are configuring a \"Keyboard Controller\". This device is exclusively for \"Phantasy Star Online Episode I & II\". If you are unsure, turn back now and configure a \"Standard Controller\".</string> <string name="old_controller_settings">Your controller settings are from an old version of Dolphin and won\'t work in this version. Press \"Default\" to start over with new settings.</string> <string name="input_binding">Input Binding</string> @@ -773,13 +774,17 @@ It can efficiently compress both junk data and encrypted Wii data. <string name="country_unknown">Unknown</string> <!-- GameCube Gamepad Types --> - <string name="gcpad_disabled">Disabled</string> - <string name="gcpad_emulated">Emulated</string> + <string name="gcpad_disabled">None</string> + <string name="gcpad_emulated">Standard Controller</string> + <string name="gcpad_keyboard">Keyboard Controller</string> + <string name="gcpad_steering_wheel">Steering Wheel</string> + <string name="gcpad_dance_mat">Dance Mat</string> + <string name="gcpad_taru_konga">DK Bongos</string> <string name="gcpad_gc_adapter">GameCube Adapter</string> <!-- Wiimote Types --> - <string name="wiimote_disabled">Disabled</string> - <string name="wiimote_emulated">Emulated</string> + <string name="wiimote_disabled">None</string> + <string name="wiimote_emulated">Emulated Wii Remote</string> <string name="wiimote_real">Real Wii Remote (DolphinBar required)</string> <!-- Gamepad Controls --> |
