diff options
Diffstat (limited to 'Source/Android/jni/Input/MappingCommon.cpp')
| -rw-r--r-- | Source/Android/jni/Input/MappingCommon.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/Android/jni/Input/MappingCommon.cpp b/Source/Android/jni/Input/MappingCommon.cpp index c02f1c2ae5..4e5d88ccf6 100644 --- a/Source/Android/jni/Input/MappingCommon.cpp +++ b/Source/Android/jni/Input/MappingCommon.cpp @@ -17,6 +17,7 @@ #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/MappingCommon.h" #include "jni/AndroidCommon/AndroidCommon.h" +#include "jni/Input/EmulatedController.h" namespace { @@ -28,10 +29,19 @@ constexpr auto INPUT_DETECT_MAXIMUM_TIME = std::chrono::seconds(5); extern "C" { JNIEXPORT jstring JNICALL -Java_org_dolphinemu_dolphinemu_features_input_model_MappingCommon_detectInput(JNIEnv* env, jclass) +Java_org_dolphinemu_dolphinemu_features_input_model_MappingCommon_detectInput( + JNIEnv* env, jclass, jobject j_emulated_controller, jboolean all_devices) { - const std::vector<std::string> device_strings = g_controller_interface.GetAllDeviceStrings(); - const ciface::Core::DeviceQualifier default_device{}; + ControllerEmu::EmulatedController* emulated_controller = + EmulatedControllerFromJava(env, j_emulated_controller); + + const ciface::Core::DeviceQualifier default_device = emulated_controller->GetDefaultDevice(); + + std::vector<std::string> device_strings; + if (all_devices) + device_strings = g_controller_interface.GetAllDeviceStrings(); + else + device_strings = {default_device.ToString()}; auto detections = g_controller_interface.DetectInput(device_strings, INPUT_DETECT_INITIAL_TIME, |
