mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-19 02:36:27 +01:00
Android: Split Wii Remote settings into submenus
Too much stuff on one screen otherwise. This split matches DolphinQt.
This commit is contained in:
parent
0dd8bbbbbb
commit
e7530a1cb9
@ -38,7 +38,19 @@ public enum MenuTag
|
|||||||
WIIMOTE_EXTENSION_1("wiimote_extension", 0),
|
WIIMOTE_EXTENSION_1("wiimote_extension", 0),
|
||||||
WIIMOTE_EXTENSION_2("wiimote_extension", 1),
|
WIIMOTE_EXTENSION_2("wiimote_extension", 1),
|
||||||
WIIMOTE_EXTENSION_3("wiimote_extension", 2),
|
WIIMOTE_EXTENSION_3("wiimote_extension", 2),
|
||||||
WIIMOTE_EXTENSION_4("wiimote_extension", 3);
|
WIIMOTE_EXTENSION_4("wiimote_extension", 3),
|
||||||
|
WIIMOTE_GENERAL_1("wiimote_general", 0),
|
||||||
|
WIIMOTE_GENERAL_2("wiimote_general", 1),
|
||||||
|
WIIMOTE_GENERAL_3("wiimote_general", 2),
|
||||||
|
WIIMOTE_GENERAL_4("wiimote_general", 3),
|
||||||
|
WIIMOTE_MOTION_SIMULATION_1("wiimote_motion_simulation", 0),
|
||||||
|
WIIMOTE_MOTION_SIMULATION_2("wiimote_motion_simulation", 1),
|
||||||
|
WIIMOTE_MOTION_SIMULATION_3("wiimote_motion_simulation", 2),
|
||||||
|
WIIMOTE_MOTION_SIMULATION_4("wiimote_motion_simulation", 3),
|
||||||
|
WIIMOTE_MOTION_INPUT_1("wiimote_motion_input", 0),
|
||||||
|
WIIMOTE_MOTION_INPUT_2("wiimote_motion_input", 1),
|
||||||
|
WIIMOTE_MOTION_INPUT_3("wiimote_motion_input", 2),
|
||||||
|
WIIMOTE_MOTION_INPUT_4("wiimote_motion_input", 3);
|
||||||
|
|
||||||
private String tag;
|
private String tag;
|
||||||
private int subType = -1;
|
private int subType = -1;
|
||||||
@ -112,6 +124,21 @@ public enum MenuTag
|
|||||||
return getMenuTag("wiimote_extension", subtype);
|
return getMenuTag("wiimote_extension", subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MenuTag getWiimoteGeneralMenuTag(int subtype)
|
||||||
|
{
|
||||||
|
return getMenuTag("wiimote_general", subtype);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MenuTag getWiimoteMotionSimulationMenuTag(int subtype)
|
||||||
|
{
|
||||||
|
return getMenuTag("wiimote_motion_simulation", subtype);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MenuTag getWiimoteMotionInputMenuTag(int subtype)
|
||||||
|
{
|
||||||
|
return getMenuTag("wiimote_motion_input", subtype);
|
||||||
|
}
|
||||||
|
|
||||||
private static MenuTag getMenuTag(String tag, int subtype)
|
private static MenuTag getMenuTag(String tag, int subtype)
|
||||||
{
|
{
|
||||||
for (MenuTag menuTag : MenuTag.values())
|
for (MenuTag menuTag : MenuTag.values())
|
||||||
|
@ -75,6 +75,18 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
|||||||
titles.put(MenuTag.WIIMOTE_EXTENSION_2, R.string.wiimote_extension_1);
|
titles.put(MenuTag.WIIMOTE_EXTENSION_2, R.string.wiimote_extension_1);
|
||||||
titles.put(MenuTag.WIIMOTE_EXTENSION_3, R.string.wiimote_extension_2);
|
titles.put(MenuTag.WIIMOTE_EXTENSION_3, R.string.wiimote_extension_2);
|
||||||
titles.put(MenuTag.WIIMOTE_EXTENSION_4, R.string.wiimote_extension_3);
|
titles.put(MenuTag.WIIMOTE_EXTENSION_4, R.string.wiimote_extension_3);
|
||||||
|
titles.put(MenuTag.WIIMOTE_GENERAL_1, R.string.wiimote_general);
|
||||||
|
titles.put(MenuTag.WIIMOTE_GENERAL_2, R.string.wiimote_general);
|
||||||
|
titles.put(MenuTag.WIIMOTE_GENERAL_3, R.string.wiimote_general);
|
||||||
|
titles.put(MenuTag.WIIMOTE_GENERAL_4, R.string.wiimote_general);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_SIMULATION_1, R.string.wiimote_motion_simulation);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_SIMULATION_2, R.string.wiimote_motion_simulation);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_SIMULATION_3, R.string.wiimote_motion_simulation);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_SIMULATION_4, R.string.wiimote_motion_simulation);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_INPUT_1, R.string.wiimote_motion_input);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_INPUT_2, R.string.wiimote_motion_input);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_INPUT_3, R.string.wiimote_motion_input);
|
||||||
|
titles.put(MenuTag.WIIMOTE_MOTION_INPUT_4, R.string.wiimote_motion_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FragmentSettingsBinding mBinding;
|
private FragmentSettingsBinding mBinding;
|
||||||
|
@ -10,6 +10,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.collection.ArraySet;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
@ -56,8 +57,11 @@ import org.dolphinemu.dolphinemu.utils.ThreadUtil;
|
|||||||
import org.dolphinemu.dolphinemu.utils.WiiUtils;
|
import org.dolphinemu.dolphinemu.utils.WiiUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public final class SettingsFragmentPresenter
|
public final class SettingsFragmentPresenter
|
||||||
{
|
{
|
||||||
@ -248,6 +252,27 @@ public final class SettingsFragmentPresenter
|
|||||||
addExtensionTypeSettings(sl, mControllerNumber, mControllerType);
|
addExtensionTypeSettings(sl, mControllerNumber, mControllerType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WIIMOTE_GENERAL_1:
|
||||||
|
case WIIMOTE_GENERAL_2:
|
||||||
|
case WIIMOTE_GENERAL_3:
|
||||||
|
case WIIMOTE_GENERAL_4:
|
||||||
|
addWiimoteGeneralSubSettings(sl, mControllerNumber);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WIIMOTE_MOTION_SIMULATION_1:
|
||||||
|
case WIIMOTE_MOTION_SIMULATION_2:
|
||||||
|
case WIIMOTE_MOTION_SIMULATION_3:
|
||||||
|
case WIIMOTE_MOTION_SIMULATION_4:
|
||||||
|
addWiimoteMotionSimulationSubSettings(sl, mControllerNumber);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WIIMOTE_MOTION_INPUT_1:
|
||||||
|
case WIIMOTE_MOTION_INPUT_2:
|
||||||
|
case WIIMOTE_MOTION_INPUT_3:
|
||||||
|
case WIIMOTE_MOTION_INPUT_4:
|
||||||
|
addWiimoteMotionInputSubSettings(sl, mControllerNumber);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unimplemented menu");
|
throw new UnsupportedOperationException("Unimplemented menu");
|
||||||
}
|
}
|
||||||
@ -1081,7 +1106,7 @@ public final class SettingsFragmentPresenter
|
|||||||
{
|
{
|
||||||
if (gcPadType == 6) // Emulated
|
if (gcPadType == 6) // Emulated
|
||||||
{
|
{
|
||||||
addControllerSettings(sl, EmulatedController.getGcPad(gcPadNumber));
|
addControllerSettings(sl, EmulatedController.getGcPad(gcPadNumber), null);
|
||||||
}
|
}
|
||||||
else if (gcPadType == 12) // Adapter
|
else if (gcPadType == 12) // Adapter
|
||||||
{
|
{
|
||||||
@ -1094,22 +1119,61 @@ public final class SettingsFragmentPresenter
|
|||||||
|
|
||||||
private void addWiimoteSubSettings(ArrayList<SettingsItem> sl, int wiimoteNumber)
|
private void addWiimoteSubSettings(ArrayList<SettingsItem> sl, int wiimoteNumber)
|
||||||
{
|
{
|
||||||
addControllerSettings(sl, EmulatedController.getWiimote(wiimoteNumber));
|
sl.add(new HeaderSetting(mContext, R.string.wiimote, 0));
|
||||||
|
sl.add(new SubmenuSetting(mContext, R.string.wiimote_general,
|
||||||
|
MenuTag.getWiimoteGeneralMenuTag(wiimoteNumber)));
|
||||||
|
sl.add(new SubmenuSetting(mContext, R.string.wiimote_motion_simulation,
|
||||||
|
MenuTag.getWiimoteMotionSimulationMenuTag(wiimoteNumber)));
|
||||||
|
sl.add(new SubmenuSetting(mContext, R.string.wiimote_motion_input,
|
||||||
|
MenuTag.getWiimoteMotionInputMenuTag(wiimoteNumber)));
|
||||||
|
|
||||||
|
addControllerSettings(sl, EmulatedController.getWiimote(wiimoteNumber),
|
||||||
|
Collections.singleton(ControlGroup.TYPE_ATTACHMENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addExtensionTypeSettings(ArrayList<SettingsItem> sl, int wiimoteNumber,
|
private void addExtensionTypeSettings(ArrayList<SettingsItem> sl, int wiimoteNumber,
|
||||||
int extensionType)
|
int extensionType)
|
||||||
{
|
{
|
||||||
addControllerSettings(sl,
|
addControllerSettings(sl,
|
||||||
EmulatedController.getWiimoteAttachment(wiimoteNumber, extensionType));
|
EmulatedController.getWiimoteAttachment(wiimoteNumber, extensionType), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addControllerSettings(ArrayList<SettingsItem> sl, EmulatedController controller)
|
private void addWiimoteGeneralSubSettings(ArrayList<SettingsItem> sl, int wiimoteNumber)
|
||||||
|
{
|
||||||
|
addControllerSettings(sl, EmulatedController.getWiimote(wiimoteNumber),
|
||||||
|
new ArraySet<>(Arrays.asList(ControlGroup.TYPE_BUTTONS, ControlGroup.TYPE_OTHER)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWiimoteMotionSimulationSubSettings(ArrayList<SettingsItem> sl, int wiimoteNumber)
|
||||||
|
{
|
||||||
|
addControllerSettings(sl, EmulatedController.getWiimote(wiimoteNumber),
|
||||||
|
new ArraySet<>(Arrays.asList(ControlGroup.TYPE_FORCE, ControlGroup.TYPE_TILT,
|
||||||
|
ControlGroup.TYPE_CURSOR, ControlGroup.TYPE_SHAKE)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWiimoteMotionInputSubSettings(ArrayList<SettingsItem> sl, int wiimoteNumber)
|
||||||
|
{
|
||||||
|
addControllerSettings(sl, EmulatedController.getWiimote(wiimoteNumber),
|
||||||
|
new ArraySet<>(Arrays.asList(ControlGroup.TYPE_IMU_ACCELEROMETER,
|
||||||
|
ControlGroup.TYPE_IMU_GYROSCOPE, ControlGroup.TYPE_IMU_CURSOR)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sl The list to place controller settings into.
|
||||||
|
* @param controller The controller to add settings for.
|
||||||
|
* @param groupTypeFilter If this is non-null, only groups whose types match this are considered.
|
||||||
|
*/
|
||||||
|
private void addControllerSettings(ArrayList<SettingsItem> sl, EmulatedController controller,
|
||||||
|
Set<Integer> groupTypeFilter)
|
||||||
{
|
{
|
||||||
int groupCount = controller.getGroupCount();
|
int groupCount = controller.getGroupCount();
|
||||||
for (int i = 0; i < groupCount; i++)
|
for (int i = 0; i < groupCount; i++)
|
||||||
{
|
{
|
||||||
ControlGroup group = controller.getGroup(i);
|
ControlGroup group = controller.getGroup(i);
|
||||||
|
int groupType = group.getGroupType();
|
||||||
|
if (groupTypeFilter != null && !groupTypeFilter.contains(groupType))
|
||||||
|
continue;
|
||||||
|
|
||||||
sl.add(new HeaderSetting(group.getUiName(), ""));
|
sl.add(new HeaderSetting(group.getUiName(), ""));
|
||||||
|
|
||||||
int controlCount = group.getControlCount();
|
int controlCount = group.getControlCount();
|
||||||
@ -1118,7 +1182,7 @@ public final class SettingsFragmentPresenter
|
|||||||
sl.add(new InputMappingControlSetting(group.getControl(j), controller));
|
sl.add(new InputMappingControlSetting(group.getControl(j), controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group.getGroupType() == ControlGroup.TYPE_ATTACHMENTS)
|
if (groupType == ControlGroup.TYPE_ATTACHMENTS)
|
||||||
{
|
{
|
||||||
NumericSetting attachmentSetting = group.getAttachmentSetting();
|
NumericSetting attachmentSetting = group.getAttachmentSetting();
|
||||||
sl.add(new SingleChoiceSetting(mContext, new InputMappingIntSetting(attachmentSetting),
|
sl.add(new SingleChoiceSetting(mContext, new InputMappingIntSetting(attachmentSetting),
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
<string name="wiimote_extension_2">Wii Remote Extension 3</string>
|
<string name="wiimote_extension_2">Wii Remote Extension 3</string>
|
||||||
<string name="wiimote_extension_3">Wii Remote Extension 4</string>
|
<string name="wiimote_extension_3">Wii Remote Extension 4</string>
|
||||||
|
|
||||||
|
<string name="wiimote">Wii Remote</string>
|
||||||
|
<string name="wiimote_general">General and Options</string>
|
||||||
|
<string name="wiimote_motion_simulation">Motion Simulation</string>
|
||||||
|
<string name="wiimote_motion_input">Motion Input</string>
|
||||||
<string name="wiimote_extensions">Extension</string>
|
<string name="wiimote_extensions">Extension</string>
|
||||||
|
|
||||||
<string name="input_binding">Input Binding</string>
|
<string name="input_binding">Input Binding</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user