mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Android: Add extension selection
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package org.dolphinemu.dolphinemu.features.input.model;
|
||||
|
||||
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
public class InputMappingIntSetting implements AbstractIntSetting
|
||||
{
|
||||
private final NumericSetting mNumericSetting;
|
||||
|
||||
public InputMappingIntSetting(NumericSetting numericSetting)
|
||||
{
|
||||
mNumericSetting = numericSetting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(Settings settings)
|
||||
{
|
||||
return mNumericSetting.getIntValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInt(Settings settings, int newValue)
|
||||
{
|
||||
mNumericSetting.setIntValue(newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuntimeEditable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
{
|
||||
mNumericSetting.setIntValue(mNumericSetting.getIntDefaultValue());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -12,6 +12,21 @@ import androidx.annotation.Keep;
|
||||
*/
|
||||
public class ControlGroup
|
||||
{
|
||||
public static final int TYPE_OTHER = 0;
|
||||
public static final int TYPE_STICK = 1;
|
||||
public static final int TYPE_MIXED_TRIGGERS = 2;
|
||||
public static final int TYPE_BUTTONS = 3;
|
||||
public static final int TYPE_FORCE = 4;
|
||||
public static final int TYPE_ATTACHMENTS = 5;
|
||||
public static final int TYPE_TILT = 6;
|
||||
public static final int TYPE_CURSOR = 7;
|
||||
public static final int TYPE_TRIGGERS = 8;
|
||||
public static final int TYPE_SLIDER = 9;
|
||||
public static final int TYPE_SHAKE = 10;
|
||||
public static final int TYPE_IMU_ACCELEROMETER = 11;
|
||||
public static final int TYPE_IMU_GYROSCOPE = 12;
|
||||
public static final int TYPE_IMU_CURSOR = 13;
|
||||
|
||||
@Keep
|
||||
private final long mPointer;
|
||||
|
||||
@ -23,6 +38,8 @@ public class ControlGroup
|
||||
|
||||
public native String getUiName();
|
||||
|
||||
public native int getGroupType();
|
||||
|
||||
public native int getControlCount();
|
||||
|
||||
public native Control getControl(int i);
|
||||
@ -30,4 +47,10 @@ public class ControlGroup
|
||||
public native int getNumericSettingCount();
|
||||
|
||||
public native NumericSetting getNumericSetting(int i);
|
||||
|
||||
/**
|
||||
* If getGroupType returns TYPE_ATTACHMENTS, this returns the attachment selection setting.
|
||||
* Otherwise, undefined behavior!
|
||||
*/
|
||||
public native NumericSetting getAttachmentSetting();
|
||||
}
|
||||
|
@ -47,6 +47,21 @@ public class NumericSetting
|
||||
|
||||
public native ControlReference getControlReference();
|
||||
|
||||
/**
|
||||
* If the type is TYPE_INT, gets the current value. Otherwise, undefined behavior!
|
||||
*/
|
||||
public native int getIntValue();
|
||||
|
||||
/**
|
||||
* If the type is TYPE_INT, sets the current value. Otherwise, undefined behavior!
|
||||
*/
|
||||
public native void setIntValue(int value);
|
||||
|
||||
/**
|
||||
* If the type is TYPE_INT, gets the default value. Otherwise, undefined behavior!
|
||||
*/
|
||||
public native int getIntDefaultValue();
|
||||
|
||||
/**
|
||||
* If the type is TYPE_DOUBLE, gets the current value. Otherwise, undefined behavior!
|
||||
*/
|
||||
|
@ -16,6 +16,7 @@ import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.UserDataActivity;
|
||||
import org.dolphinemu.dolphinemu.features.input.model.InputMappingBooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.input.model.InputMappingDoubleSetting;
|
||||
import org.dolphinemu.dolphinemu.features.input.model.InputMappingIntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.ControlGroup;
|
||||
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.EmulatedController;
|
||||
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting;
|
||||
@ -1117,6 +1118,15 @@ public final class SettingsFragmentPresenter
|
||||
sl.add(new InputMappingControlSetting(group.getControl(j), controller));
|
||||
}
|
||||
|
||||
if (group.getGroupType() == ControlGroup.TYPE_ATTACHMENTS)
|
||||
{
|
||||
NumericSetting attachmentSetting = group.getAttachmentSetting();
|
||||
sl.add(new SingleChoiceSetting(mContext, new InputMappingIntSetting(attachmentSetting),
|
||||
R.string.wiimote_extensions, 0, R.array.wiimoteExtensionsEntries,
|
||||
R.array.wiimoteExtensionsValues,
|
||||
MenuTag.getWiimoteExtensionMenuTag(mControllerNumber)));
|
||||
}
|
||||
|
||||
int numericSettingCount = group.getNumericSettingCount();
|
||||
for (int j = 0; j < numericSettingCount; j++)
|
||||
{
|
||||
|
@ -210,14 +210,14 @@
|
||||
<item>@string/extension_drums</item>
|
||||
<item>@string/extension_turntable</item>
|
||||
</string-array>
|
||||
<string-array name="wiimoteExtensionsValues">
|
||||
<item>None</item>
|
||||
<item>Nunchuk</item>
|
||||
<item>Classic</item>
|
||||
<item>Guitar</item>
|
||||
<item>Drums</item>
|
||||
<item>Turntable</item>
|
||||
</string-array>
|
||||
<integer-array name="wiimoteExtensionsValues">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Texture Cache Accuracy Preference -->
|
||||
<string-array name="textureCacheAccuracyEntries">
|
||||
|
Reference in New Issue
Block a user