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 c91bbbe1ab..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 @@ -36,6 +36,9 @@ class EmulatedController private constructor(private val pointer: Long) { @JvmStatic external fun getGcPad(controllerIndex: Int): EmulatedController + @JvmStatic + external fun getGcKeyboard(controllerIndex: Int): EmulatedController + @JvmStatic external fun getWiimote(controllerIndex: Int): EmulatedController 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 c7261c88f8..d2eefd41f4 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 @@ -2071,34 +2071,49 @@ class SettingsFragmentPresenter( } private fun addGcPadSubSettings(sl: ArrayList, 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, gcPad, 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 + ) ) - ) + } } } 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/gcpad_disabled @string/gcpad_emulated + @string/gcpad_keyboard + @string/gcpad_steering_wheel + @string/gcpad_dance_mat + @string/gcpad_taru_konga @string/gcpad_gc_adapter 0 6 + 7 + 8 + 9 + 10 12 diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index a81cb58a59..0e980af855 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 @@ Clear Clear settings for this controller. Are you sure? Your current controller settings will be deleted. + "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\". 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. Input Binding @@ -772,13 +773,17 @@ It can efficiently compress both junk data and encrypted Wii data. Unknown - Disabled - Emulated + None + Standard Controller + Keyboard Controller + Steering Wheel + Dance Mat + DK Bongos GameCube Adapter - Disabled - Emulated + None + Emulated Wii Remote Real Wii Remote (DolphinBar required) diff --git a/Source/Android/jni/Input/EmulatedController.cpp b/Source/Android/jni/Input/EmulatedController.cpp index 25f5bf2a1a..c1dfd7ce5d 100644 --- a/Source/Android/jni/Input/EmulatedController.cpp +++ b/Source/Android/jni/Input/EmulatedController.cpp @@ -5,6 +5,7 @@ #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Core/HW/GCKeyboard.h" #include "Core/HW/GCPad.h" #include "Core/HW/Wiimote.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" @@ -138,6 +139,13 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro return EmulatedControllerToJava(env, Pad::GetConfig()->GetController(controller_index)); } +JNIEXPORT jobject JNICALL +Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getGcKeyboard( + JNIEnv* env, jclass, jint controller_index) +{ + return EmulatedControllerToJava(env, Keyboard::GetConfig()->GetController(controller_index)); +} + JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getWiimote( JNIEnv* env, jclass, jint controller_index)