Android: Fix default values for GC/Wii controller 1

This commit is contained in:
JosJuice 2020-10-20 16:54:10 +02:00
parent 0dcb6794d3
commit 115dedec63
2 changed files with 10 additions and 24 deletions

View File

@ -434,16 +434,19 @@ public final class SettingsFragmentPresenter
{
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, 0);
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, 0);
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(gcPadSetting, R.string.controller_0 + i, 0,
@ -455,16 +458,19 @@ public final class SettingsFragmentPresenter
{
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, 0);
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, 0);
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(wiimoteSetting, R.string.wiimote_4 + i, 0,

View File

@ -215,11 +215,6 @@ public final class SettingsFile
public static void readFile(final String fileName, IniFile ini, SettingsActivityView view)
{
readFile(getSettingsFile(fileName), ini, view);
if (fileName.equals(Settings.FILE_DOLPHIN))
{
addGcPadSettingsIfTheyDontExist(ini);
}
}
/**
@ -328,19 +323,4 @@ public final class SettingsFile
return new File(wiiConfigPath);
}
private static void addGcPadSettingsIfTheyDontExist(IniFile ini)
{
IniFile.Section coreSection = ini.getOrCreateSection(Settings.SECTION_INI_CORE);
for (int i = 0; i < 4; i++)
{
String key = SettingsFile.KEY_GCPAD_TYPE + i;
if (!coreSection.exists(key))
{
// Set GameCube controller 1 to enabled, all others disabled
coreSection.setInt(key, i == 0 ? 6 : 0);
}
}
}
}