diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.java
index 5a5793f530..5f6275ffcd 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/controlleremu/EmulatedController.java
@@ -31,6 +31,10 @@ public class EmulatedController
public native void updateSingleControlReference(ControlReference controlReference);
+ public native void loadDefaultSettings();
+
+ public native void clearSettings();
+
public static native EmulatedController getGcPad(int controllerIndex);
public static native EmulatedController getWiimote(int controllerIndex);
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
index e2199d2922..8d9a34c252 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
@@ -1213,6 +1213,13 @@ public final class SettingsFragmentPresenter
mView.setMappingAllDevices(newValue);
}
}, R.string.input_device_all_devices, R.string.input_device_all_devices_description));
+
+ sl.add(new RunRunnable(mContext, R.string.input_reset_to_default,
+ R.string.input_reset_to_default_description, R.string.input_reset_warning, 0, true,
+ () -> loadDefaultControllerSettings(controller)));
+
+ sl.add(new RunRunnable(mContext, R.string.input_clear, R.string.input_clear_description,
+ R.string.input_reset_warning, 0, true, () -> clearControllerSettings(controller)));
}
/**
@@ -1280,6 +1287,18 @@ public final class SettingsFragmentPresenter
}
}
+ private void loadDefaultControllerSettings(EmulatedController controller)
+ {
+ controller.loadDefaultSettings();
+ mView.getAdapter().notifyAllSettingsChanged();
+ }
+
+ private void clearControllerSettings(EmulatedController controller)
+ {
+ controller.clearSettings();
+ mView.getAdapter().notifyAllSettingsChanged();
+ }
+
private static int getLogVerbosityEntries()
{
// Value obtained from LogLevel in Common/Logging/Log.h
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index ff41d8a631..16252e6b84 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -30,6 +30,11 @@
Device
Create Mappings for Other Devices
Detects inputs from all devices, not just the selected device.
+ Default
+ Reset settings for this controller to the default.
+ Clear
+ Clear settings for this controller.
+ Are you sure? Your current controller settings will be deleted.
Input Binding
Press or move an input to bind it to %1$s.
diff --git a/Source/Android/jni/Input/EmulatedController.cpp b/Source/Android/jni/Input/EmulatedController.cpp
index ba9e454dae..fb38471738 100644
--- a/Source/Android/jni/Input/EmulatedController.cpp
+++ b/Source/Android/jni/Input/EmulatedController.cpp
@@ -3,6 +3,7 @@
#include
+#include "Common/IniFile.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
@@ -71,6 +72,29 @@ Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedContro
g_controller_interface, ControlReferenceFromJava(env, control_reference));
}
+JNIEXPORT void JNICALL
+Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_loadDefaultSettings(
+ JNIEnv* env, jobject obj)
+{
+ ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
+
+ controller->LoadDefaults(g_controller_interface);
+ controller->UpdateReferences(g_controller_interface);
+}
+
+JNIEXPORT void JNICALL
+Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_clearSettings(
+ JNIEnv* env, jobject obj)
+{
+ ControllerEmu::EmulatedController* controller = EmulatedControllerFromJava(env, obj);
+
+ // Loading an empty IniFile section clears everything.
+ IniFile::Section section;
+
+ controller->LoadConfig(§ion);
+ controller->UpdateReferences(g_controller_interface);
+}
+
JNIEXPORT jobject JNICALL
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_EmulatedController_getGcPad(
JNIEnv* env, jclass, jint controller_index)