Android: Get rid of LegacyIntSetting

The only settings that were using LegacyIntSetting are now in the new
config system, so there's no reason to have LegacyIntSetting anymore.
This commit is contained in:
JosJuice 2022-02-18 21:58:05 +01:00
parent 0c78167404
commit 1b76171a27
6 changed files with 35 additions and 84 deletions

View File

@ -21,6 +21,10 @@ public enum IntSetting implements AbstractIntSetting
MAIN_SLOT_A(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotA", 8),
MAIN_SLOT_B(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SlotB", 255),
MAIN_FALLBACK_REGION(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "FallbackRegion", 2),
MAIN_SI_DEVICE_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice0", 6),
MAIN_SI_DEVICE_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice1", 0),
MAIN_SI_DEVICE_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice2", 0),
MAIN_SI_DEVICE_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SIDevice3", 0),
MAIN_AUDIO_VOLUME(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "Volume", 100),
@ -60,13 +64,23 @@ public enum IntSetting implements AbstractIntSetting
GFX_STEREO_CONVERGENCE_PERCENTAGE(Settings.FILE_GFX, Settings.SECTION_STEREOSCOPY,
"StereoConvergencePercentage", 100),
LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1);
LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1),
WIIMOTE_1_SOURCE(Settings.FILE_WIIMOTE, "Wiimote1", "Source", 1),
WIIMOTE_2_SOURCE(Settings.FILE_WIIMOTE, "Wiimote2", "Source", 0),
WIIMOTE_3_SOURCE(Settings.FILE_WIIMOTE, "Wiimote3", "Source", 0),
WIIMOTE_4_SOURCE(Settings.FILE_WIIMOTE, "Wiimote4", "Source", 0),
WIIMOTE_BB_SOURCE(Settings.FILE_WIIMOTE, "BalanceBoard", "Source", 0);
private static final IntSetting[] NOT_RUNTIME_EDITABLE_ARRAY = new IntSetting[]{
MAIN_CPU_CORE,
MAIN_GC_LANGUAGE,
MAIN_SLOT_A, // Can actually be changed, but specific code is required
MAIN_SLOT_B, // Can actually be changed, but specific code is required
MAIN_SI_DEVICE_0, // Can actually be changed, but specific code is required
MAIN_SI_DEVICE_1, // Can actually be changed, but specific code is required
MAIN_SI_DEVICE_2, // Can actually be changed, but specific code is required
MAIN_SI_DEVICE_3, // Can actually be changed, but specific code is required
};
private static final Set<IntSetting> NOT_RUNTIME_EDITABLE =

View File

@ -1,26 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.settings.model;
public class LegacyIntSetting extends AbstractLegacySetting implements AbstractIntSetting
{
private final int mDefaultValue;
public LegacyIntSetting(String file, String section, String key, int defaultValue)
{
super(file, section, key);
mDefaultValue = defaultValue;
}
@Override
public int getInt(Settings settings)
{
return settings.getSection(mFile, mSection).getInt(mKey, mDefaultValue);
}
@Override
public void setInt(Settings settings, int newValue)
{
settings.getSection(mFile, mSection).setInt(mKey, newValue);
}
}

View File

@ -17,7 +17,6 @@ import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
import org.dolphinemu.dolphinemu.features.settings.model.FloatSetting;
import org.dolphinemu.dolphinemu.features.settings.model.IntSetting;
import org.dolphinemu.dolphinemu.features.settings.model.LegacyBooleanSetting;
import org.dolphinemu.dolphinemu.features.settings.model.LegacyIntSetting;
import org.dolphinemu.dolphinemu.features.settings.model.LegacyStringSetting;
import org.dolphinemu.dolphinemu.features.settings.model.PostProcessing;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
@ -555,51 +554,26 @@ public final class SettingsFragmentPresenter
private void addGcPadSettings(ArrayList<SettingsItem> sl)
{
for (int i = 0; i < 4; i++)
{
// GameCube controller 1 is set to Emulated by default, all others disabled
int defaultValue = i == 0 ? 6 : 0;
LegacyIntSetting gcPadSetting;
if (mGameID.equals(""))
{
gcPadSetting = new LegacyIntSetting(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE,
SettingsFile.KEY_GCPAD_TYPE + i, defaultValue);
}
else
{
gcPadSetting = new LegacyIntSetting(Settings.GAME_SETTINGS_PLACEHOLDER_FILE_NAME,
Settings.SECTION_CONTROLS, SettingsFile.KEY_GCPAD_G_TYPE + i, defaultValue);
}
// TODO: This controller_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order.
sl.add(new SingleChoiceSetting(mContext, gcPadSetting, R.string.controller_0 + i, 0,
R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(i)));
}
sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_0, R.string.controller_0, 0,
R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(0)));
sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_1, R.string.controller_1, 0,
R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(1)));
sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_2, R.string.controller_2, 0,
R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(2)));
sl.add(new SingleChoiceSetting(mContext, IntSetting.MAIN_SI_DEVICE_3, R.string.controller_3, 0,
R.array.gcpadTypeEntries, R.array.gcpadTypeValues, MenuTag.getGCPadMenuTag(3)));
}
private void addWiimoteSettings(ArrayList<SettingsItem> sl)
{
for (int i = 0; i < 4; i++)
{
// Wii Remote 1 is set to Emulated by default, all others disabled
int defaultValue = i == 0 ? 1 : 0;
LegacyIntSetting wiimoteSetting;
if (mGameID.equals(""))
{
wiimoteSetting = new LegacyIntSetting(Settings.FILE_WIIMOTE,
Settings.SECTION_WIIMOTE + (i + 1), SettingsFile.KEY_WIIMOTE_TYPE, defaultValue);
}
else
{
wiimoteSetting = new LegacyIntSetting(Settings.GAME_SETTINGS_PLACEHOLDER_FILE_NAME,
Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIMOTE_G_TYPE + i, defaultValue);
}
// TODO: This wiimote_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order.
sl.add(new SingleChoiceSetting(mContext, wiimoteSetting, R.string.wiimote_4 + i, 0,
R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues,
MenuTag.getWiimoteMenuTag(i + 4)));
}
sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_1_SOURCE, R.string.wiimote_4, 0,
R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(4)));
sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_2_SOURCE, R.string.wiimote_5, 0,
R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(5)));
sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_3_SOURCE, R.string.wiimote_6, 0,
R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(6)));
sl.add(new SingleChoiceSetting(mContext, IntSetting.WIIMOTE_4_SOURCE, R.string.wiimote_7, 0,
R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, MenuTag.getWiimoteMenuTag(7)));
}
private void addGraphicsSettings(ArrayList<SettingsItem> sl)

View File

@ -20,9 +20,7 @@ public final class SettingsFile
public static final String KEY_ISO_PATH_BASE = "ISOPath";
public static final String KEY_ISO_PATHS = "ISOPaths";
public static final String KEY_GCPAD_TYPE = "SIDevice";
public static final String KEY_GCPAD_PLAYER_1 = "SIDevice0";
public static final String KEY_GCPAD_G_TYPE = "PadType";
public static final String KEY_GCBIND_A = "InputA_";
public static final String KEY_GCBIND_B = "InputB_";
@ -50,11 +48,9 @@ public final class SettingsFile
public static final String KEY_EMU_RUMBLE = "EmuRumble";
public static final String KEY_WIIMOTE_TYPE = "Source";
public static final String KEY_WIIMOTE_EXTENSION = "Extension";
// Controller keys for game specific settings
public static final String KEY_WIIMOTE_G_TYPE = "WiimoteSource";
public static final String KEY_WIIMOTE_PROFILE = "WiimoteProfile";
public static final String KEY_WIIBIND_A = "WiimoteA_";

View File

@ -6,13 +6,10 @@
<string name="host">app</string>
<string name="scheme">dolphinemu</string>
<!-- WARNING Do not move these controller entries AT ALL COSTS! They are indexed with ints, and an assumption
is made that they are placed together so that we can access them sequentially in a loop. -->
<string name="controller_0">GameCube Controller 1</string>
<string name="controller_1">GameCube Controller 2</string>
<string name="controller_2">GameCube Controller 3</string>
<string name="controller_3">GameCube Controller 4</string>
<!-- END WARNING -->
<string name="controller_control">Control Stick</string>
<string name="controller_c">C Stick</string>
@ -22,23 +19,15 @@
<string name="analog_radius">Analog Radius (High value = High sensitivity)</string>
<string name="analog_threshold">Analog Threshold (Low value = High sensitivity)</string>
<!-- WARNING Do not move these controller entries AT ALL COSTS! They are indexed with ints, and an assumption
is made that they are placed together so that we can access them sequentially in a loop.
Wiimotes start at 4 since they are mapped to padID's 4-7 in the native code.-->
<string name="wiimote_4">Wii Remote 1</string>
<string name="wiimote_5">Wii Remote 2</string>
<string name="wiimote_6">Wii Remote 3</string>
<string name="wiimote_7">Wii Remote 4</string>
<!-- END WARNING -->
<!-- WARNING Do not move these controller entries AT ALL COSTS! They are indexed with ints, and an assumption
is made that they are placed together so that we can access them sequentially in a loop.
Wiimotes start at 4 since they are mapped to padID's 4-7 in the native code.-->
<string name="wiimote_extension_4">Wii Remote Extension 1</string>
<string name="wiimote_extension_5">Wii Remote Extension 2</string>
<string name="wiimote_extension_6">Wii Remote Extension 3</string>
<string name="wiimote_extension_7">Wii Remote Extension 4</string>
<!-- END WARNING -->
<string name="wiimote_extensions">Extension</string>
<string name="wiimote_extensions_description">Choose and bind the Wii Remote extension.</string>

View File

@ -38,6 +38,10 @@ static Config::Location GetLocation(JNIEnv* env, jstring file, jstring section,
{
system = Config::System::Logger;
}
else if (decoded_file == "WiimoteNew")
{
system = Config::System::WiiPad;
}
else
{
ASSERT(false);