diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractLegacySetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractLegacySetting.java deleted file mode 100644 index 94925b89f0..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractLegacySetting.java +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.model; - -import androidx.annotation.NonNull; - -public class AbstractLegacySetting implements AbstractSetting -{ - protected final String mFile; - protected final String mSection; - protected final String mKey; - - public AbstractLegacySetting(String file, String section, String key) - { - mFile = file; - mSection = section; - mKey = key; - } - - @Override - public boolean isOverridden(@NonNull Settings settings) - { - return settings.isGameSpecific() && settings.getSection(mFile, mSection).exists(mKey); - } - - @Override - public boolean isRuntimeEditable() - { - return false; - } - - @Override - public boolean delete(@NonNull Settings settings) - { - return settings.getSection(mFile, mSection).delete(mKey); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyStringSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyStringSetting.java deleted file mode 100644 index f73c747216..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/LegacyStringSetting.java +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -package org.dolphinemu.dolphinemu.features.settings.model; - -import androidx.annotation.NonNull; - -public class LegacyStringSetting extends AbstractLegacySetting implements AbstractStringSetting -{ - private final String mDefaultValue; - - public LegacyStringSetting(String file, String section, String key, String defaultValue) - { - super(file, section, key); - mDefaultValue = defaultValue; - } - - @NonNull @Override - public String getString(@NonNull Settings settings) - { - return settings.getSection(mFile, mSection).getString(mKey, mDefaultValue); - } - - @Override - public void setString(@NonNull Settings settings, @NonNull String newValue) - { - settings.getSection(mFile, mSection).setString(mKey, newValue); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java index fb5e16965b..6b9cf5226c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java @@ -26,6 +26,7 @@ public class Settings implements Closeable public static final String FILE_GFX = "GFX"; public static final String FILE_LOGGER = "Logger"; public static final String FILE_WIIMOTE = "WiimoteNew"; + public static final String FILE_GAME_SETTINGS_ONLY = "GameSettingsOnly"; public static final String SECTION_INI_ANDROID = "Android"; public static final String SECTION_INI_ANDROID_OVERLAY_BUTTONS = "AndroidOverlayButtons"; 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 cd39f8c10f..19b3178ac0 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 @@ -29,10 +29,10 @@ import org.dolphinemu.dolphinemu.features.input.ui.ProfileDialogPresenter; import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.AbstractIntSetting; import org.dolphinemu.dolphinemu.features.settings.model.AdHocBooleanSetting; +import org.dolphinemu.dolphinemu.features.settings.model.AdHocStringSetting; 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.LegacyStringSetting; import org.dolphinemu.dolphinemu.features.settings.model.PostProcessing; import org.dolphinemu.dolphinemu.features.settings.model.ScaledIntSetting; import org.dolphinemu.dolphinemu.features.settings.model.Settings; @@ -1198,7 +1198,7 @@ public final class SettingsFragmentPresenter String[] profiles = new ProfileDialogPresenter(mMenuTag).getProfileNames(false); String profileKey = profileString + "Profile" + controllerNumber; sl.add(new StringSingleChoiceSetting(mContext, - new LegacyStringSetting("", "Controls", profileKey, ""), + new AdHocStringSetting(Settings.FILE_GAME_SETTINGS_ONLY, "Controls", profileKey, ""), R.string.input_profile, 0, profiles, profiles, R.string.input_profiles_empty)); } diff --git a/Source/Android/jni/Config/NativeConfig.cpp b/Source/Android/jni/Config/NativeConfig.cpp index f707e91f5b..3c67eb3af4 100644 --- a/Source/Android/jni/Config/NativeConfig.cpp +++ b/Source/Android/jni/Config/NativeConfig.cpp @@ -43,6 +43,10 @@ static Config::Location GetLocation(JNIEnv* env, jstring file, jstring section, { system = Config::System::WiiPad; } + else if (decoded_file == "GameSettingsOnly") + { + system = Config::System::GameSettingsOnly; + } else { ASSERT(false); diff --git a/Source/Core/Common/Config/Config.cpp b/Source/Core/Common/Config/Config.cpp index 67b21ea33b..4a55ab5b7b 100644 --- a/Source/Core/Common/Config/Config.cpp +++ b/Source/Core/Common/Config/Config.cpp @@ -159,7 +159,8 @@ static const std::map system_to_name = { {System::SYSCONF, "SYSCONF"}, {System::DualShockUDPClient, "DualShockUDPClient"}, {System::FreeLook, "FreeLook"}, - {System::Session, "Session"}}; + {System::Session, "Session"}, + {System::GameSettingsOnly, "GameSettingsOnly"}}; const std::string& GetSystemName(System system) { diff --git a/Source/Core/Common/Config/Enums.h b/Source/Core/Common/Config/Enums.h index 8f224e50d6..1f6d0a1966 100644 --- a/Source/Core/Common/Config/Enums.h +++ b/Source/Core/Common/Config/Enums.h @@ -33,6 +33,7 @@ enum class System DualShockUDPClient, FreeLook, Session, + GameSettingsOnly, }; constexpr std::array SEARCH_ORDER{{ diff --git a/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp index 7b9d1c2782..acce10521b 100644 --- a/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp @@ -159,6 +159,9 @@ public: if (location.system == Config::System::Session) continue; + if (location.system == Config::System::GameSettingsOnly) + continue; + auto ini = inis.find(location.system); if (ini == inis.end()) { diff --git a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp index 62fe3e5968..7b6466b20f 100644 --- a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp @@ -104,6 +104,7 @@ static const INIToSectionMap& GetINIToSectionMap() {"Video_Stereoscopy", {Config::System::GFX, "Stereoscopy"}}, {"Video_Hacks", {Config::System::GFX, "Hacks"}}, {"Video", {Config::System::GFX, "GameSpecific"}}, + {"Controls", {Config::System::GameSettingsOnly, "Controls"}}, }; return ini_to_section; } diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index 01e278d576..d7746baa41 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -18,7 +18,8 @@ bool IsSettingSaveable(const Config::Location& config_location) { for (Config::System system : {Config::System::SYSCONF, Config::System::GFX, Config::System::DualShockUDPClient, - Config::System::Logger, Config::System::FreeLook, Config::System::Main}) + Config::System::Logger, Config::System::FreeLook, Config::System::Main, + Config::System::GameSettingsOnly}) { if (config_location.system == system) return true;