From 115dedec637ec0219c4f7bd0db779ef4d83b20f7 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 20 Oct 2020 16:54:10 +0200 Subject: [PATCH] Android: Fix default values for GC/Wii controller 1 --- .../ui/SettingsFragmentPresenter.java | 14 +++++++++---- .../features/settings/utils/SettingsFile.java | 20 ------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index 534ef8b9f3..f778d3919d 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -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, diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java index b058c6cd3f..e65805fd95 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java @@ -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); - } - } - } }