mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Android: Add Default and Clear actions for controllers
This commit is contained in:
parent
ea3200d4ba
commit
8b78f73e80
@ -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);
|
||||
|
@ -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
|
||||
|
@ -30,6 +30,11 @@
|
||||
<string name="input_device">Device</string>
|
||||
<string name="input_device_all_devices">Create Mappings for Other Devices</string>
|
||||
<string name="input_device_all_devices_description">Detects inputs from all devices, not just the selected device.</string>
|
||||
<string name="input_reset_to_default">Default</string>
|
||||
<string name="input_reset_to_default_description">Reset settings for this controller to the default.</string>
|
||||
<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="input_binding">Input Binding</string>
|
||||
<string name="input_binding_description">Press or move an input to bind it to %1$s.</string>
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#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)
|
||||
|
Loading…
Reference in New Issue
Block a user