From 9c19309a03b3c4096e8648c99ef48935c03c075c Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 22 Jul 2020 21:59:30 +0200 Subject: [PATCH] Android: Allow editing settings during emulation --- .../activities/EmulationActivity.java | 15 +++++++++- .../settings/model/AbstractLegacySetting.java | 6 ++++ .../settings/model/AbstractSetting.java | 2 ++ .../settings/model/AdHocBooleanSetting.java | 6 ++++ .../settings/model/BooleanSetting.java | 27 ++++++++++++++++++ .../features/settings/model/FloatSetting.java | 6 ++++ .../features/settings/model/IntSetting.java | 26 +++++++++++++++++ .../features/settings/model/Settings.java | 15 ++++++++-- .../settings/model/StringSetting.java | 23 +++++++++++++++ .../settings/model/view/SettingsItem.java | 10 +++++++ .../ui/SettingsFragmentPresenter.java | 7 +++++ .../viewholder/CheckBoxSettingViewHolder.java | 6 ++++ .../ui/viewholder/FilePickerViewHolder.java | 6 ++++ .../InputBindingSettingViewHolder.java | 6 ++++ .../viewholder/RumbleBindingViewHolder.java | 6 ++++ .../ui/viewholder/SettingViewHolder.java | 14 ++++++++++ .../ui/viewholder/SingleChoiceViewHolder.java | 6 ++++ .../ui/viewholder/SliderViewHolder.java | 6 ++++ .../dolphinemu/fragments/MenuFragment.java | 28 +++++++++++++------ .../main/res/layout/fragment_ingame_menu.xml | 10 +++++++ .../app/src/main/res/values/strings.xml | 1 + 21 files changed, 219 insertions(+), 13 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 145bf36119..6c70839b40 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -34,6 +34,8 @@ import androidx.fragment.app.FragmentManager; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.features.settings.model.Settings; +import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag; +import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity; import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile; import org.dolphinemu.dolphinemu.fragments.EmulationFragment; import org.dolphinemu.dolphinemu.fragments.MenuFragment; @@ -101,7 +103,8 @@ public final class EmulationActivity extends AppCompatActivity MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC, MENU_ACTION_RESET_OVERLAY, MENU_SET_IR_SENSITIVITY, MENU_ACTION_CHOOSE_DOUBLETAP, MENU_ACTION_SCREEN_ORIENTATION, MENU_ACTION_MOTION_CONTROLS, MENU_ACTION_PAUSE_EMULATION, - MENU_ACTION_UNPAUSE_EMULATION, MENU_ACTION_OVERLAY_CONTROLS}) + MENU_ACTION_UNPAUSE_EMULATION, MENU_ACTION_OVERLAY_CONTROLS, MENU_ACTION_SETTINGS_CORE, + MENU_ACTION_SETTINGS_GRAPHICS}) public @interface MenuAction { } @@ -140,6 +143,8 @@ public final class EmulationActivity extends AppCompatActivity public static final int MENU_ACTION_PAUSE_EMULATION = 31; public static final int MENU_ACTION_UNPAUSE_EMULATION = 32; public static final int MENU_ACTION_OVERLAY_CONTROLS = 33; + public static final int MENU_ACTION_SETTINGS_CORE = 34; + public static final int MENU_ACTION_SETTINGS_GRAPHICS = 35; private static SparseIntArray buttonsActionsMap = new SparseIntArray(); @@ -648,6 +653,14 @@ public final class EmulationActivity extends AppCompatActivity showMotionControlsOptions(); return; + case MENU_ACTION_SETTINGS_CORE: + SettingsActivity.launch(this, MenuTag.CONFIG); + return; + + case MENU_ACTION_SETTINGS_GRAPHICS: + SettingsActivity.launch(this, MenuTag.GRAPHICS); + return; + case MENU_ACTION_EXIT: mEmulationFragment.stopEmulation(); finish(); 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 index bd766ab58a..2075a668f0 100644 --- 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 @@ -19,6 +19,12 @@ public class AbstractLegacySetting implements AbstractSetting return settings.isGameSpecific() && settings.getSection(mFile, mSection).exists(mKey); } + @Override + public boolean isRuntimeEditable() + { + return false; + } + @Override public boolean delete(Settings settings) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractSetting.java index 732c348d98..e9ed2443d0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AbstractSetting.java @@ -4,5 +4,7 @@ public interface AbstractSetting { boolean isOverridden(Settings settings); + boolean isRuntimeEditable(); + boolean delete(Settings settings); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java index 99db56bf65..9eecf8407f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/AdHocBooleanSetting.java @@ -26,6 +26,12 @@ public class AdHocBooleanSetting implements AbstractBooleanSetting return NativeConfig.isOverridden(mFile, mSection, mKey); } + @Override + public boolean isRuntimeEditable() + { + return true; + } + @Override public boolean delete(Settings settings) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java index 2cad72a672..29269e40d3 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.java @@ -1,5 +1,9 @@ package org.dolphinemu.dolphinemu.features.settings.model; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + public enum BooleanSetting implements AbstractBooleanSetting { // These entries have the same names and order as in C++, just for consistency. @@ -94,6 +98,17 @@ public enum BooleanSetting implements AbstractBooleanSetting MAIN_JIT_REGISTER_CACHE_OFF(Settings.FILE_DOLPHIN, Settings.SECTION_DEBUG, "JitRegisterCacheOff", false); + private static final BooleanSetting[] NOT_RUNTIME_EDITABLE_ARRAY = new BooleanSetting[]{ + MAIN_DSP_HLE, + MAIN_CPU_THREAD, + MAIN_OVERRIDE_REGION_SETTINGS, + MAIN_WII_SD_CARD, // Can actually be changed, but specific code is required + MAIN_DSP_JIT + }; + + private static final Set NOT_RUNTIME_EDITABLE = + new HashSet<>(Arrays.asList(NOT_RUNTIME_EDITABLE_ARRAY)); + private final String mFile; private final String mSection; private final String mKey; @@ -116,6 +131,18 @@ public enum BooleanSetting implements AbstractBooleanSetting return NativeConfig.isOverridden(mFile, mSection, mKey); } + @Override + public boolean isRuntimeEditable() + { + for (BooleanSetting setting : NOT_RUNTIME_EDITABLE) + { + if (setting == this) + return false; + } + + return NativeConfig.isSettingSaveable(mFile, mSection, mKey); + } + @Override public boolean delete(Settings settings) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/FloatSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/FloatSetting.java index c71c2cd1c4..8dc2e2841f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/FloatSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/FloatSetting.java @@ -29,6 +29,12 @@ public enum FloatSetting implements AbstractFloatSetting return NativeConfig.isOverridden(mFile, mSection, mKey); } + @Override + public boolean isRuntimeEditable() + { + return NativeConfig.isSettingSaveable(mFile, mSection, mKey); + } + @Override public boolean delete(Settings settings) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java index df8e00997b..7fc265d38f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/IntSetting.java @@ -2,6 +2,10 @@ package org.dolphinemu.dolphinemu.features.settings.model; import org.dolphinemu.dolphinemu.NativeLibrary; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + public enum IntSetting implements AbstractIntSetting { // These entries have the same names and order as in C++, just for consistency. @@ -34,6 +38,16 @@ public enum IntSetting implements AbstractIntSetting LOGGER_VERBOSITY(Settings.FILE_LOGGER, Settings.SECTION_LOGGER_OPTIONS, "Verbosity", 1); + 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 + }; + + private static final Set NOT_RUNTIME_EDITABLE = + new HashSet<>(Arrays.asList(NOT_RUNTIME_EDITABLE_ARRAY)); + private final String mFile; private final String mSection; private final String mKey; @@ -56,6 +70,18 @@ public enum IntSetting implements AbstractIntSetting return NativeConfig.isOverridden(mFile, mSection, mKey); } + @Override + public boolean isRuntimeEditable() + { + for (IntSetting setting : NOT_RUNTIME_EDITABLE) + { + if (setting == this) + return false; + } + + return NativeConfig.isSettingSaveable(mFile, mSection, mKey); + } + @Override public boolean delete(Settings settings) { 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 6e414dca8a..5d650371c4 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 @@ -105,6 +105,10 @@ public class Settings implements Closeable } else { + // Loading game INIs while the core is running will mess with the game INIs loaded by the core + if (NativeLibrary.IsRunning()) + throw new IllegalStateException("Attempted to load game INI while emulating"); + NativeConfig.loadGameInis(mGameId, mRevision); loadCustomGameSettings(mGameId, view); } @@ -155,9 +159,14 @@ public class Settings implements Closeable NativeConfig.save(NativeConfig.LAYER_BASE_OR_CURRENT); - // Notify the native code of the changes - NativeLibrary.ReloadConfig(); - NativeLibrary.ReloadWiimoteConfig(); + if (!NativeLibrary.IsRunning()) + { + // Notify the native code of the changes to legacy settings + NativeLibrary.ReloadConfig(); + NativeLibrary.ReloadWiimoteConfig(); + } + + // LogManager does use the new config system, but doesn't pick up on changes automatically NativeLibrary.ReloadLoggerConfig(); NativeLibrary.UpdateGCAdapterScanThread(); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java index bfc71bf3df..272e2b02cd 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/StringSetting.java @@ -2,6 +2,10 @@ package org.dolphinemu.dolphinemu.features.settings.model; import org.dolphinemu.dolphinemu.NativeLibrary; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + public enum StringSetting implements AbstractStringSetting { // These entries have the same names and order as in C++, just for consistency. @@ -20,6 +24,13 @@ public enum StringSetting implements AbstractStringSetting GFX_ENHANCE_POST_SHADER(Settings.FILE_GFX, Settings.SECTION_GFX_ENHANCEMENTS, "PostProcessingShader", ""); + private static final StringSetting[] NOT_RUNTIME_EDITABLE_ARRAY = new StringSetting[]{ + MAIN_GFX_BACKEND, + }; + + private static final Set NOT_RUNTIME_EDITABLE = + new HashSet<>(Arrays.asList(NOT_RUNTIME_EDITABLE_ARRAY)); + private final String mFile; private final String mSection; private final String mKey; @@ -42,6 +53,18 @@ public enum StringSetting implements AbstractStringSetting return NativeConfig.isOverridden(mFile, mSection, mKey); } + @Override + public boolean isRuntimeEditable() + { + for (StringSetting setting : NOT_RUNTIME_EDITABLE) + { + if (setting == this) + return false; + } + + return NativeConfig.isSettingSaveable(mFile, mSection, mKey); + } + @Override public boolean delete(Settings settings) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java index f455066a94..2e154d69d3 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.java @@ -1,5 +1,6 @@ package org.dolphinemu.dolphinemu.features.settings.model.view; +import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; import org.dolphinemu.dolphinemu.features.settings.model.Settings; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; @@ -67,4 +68,13 @@ public abstract class SettingsItem AbstractSetting setting = getSetting(); return setting != null && setting.isOverridden(settings); } + + public boolean isEditable() + { + if (!NativeLibrary.IsRunning()) + return true; + + AbstractSetting setting = getSetting(); + return setting != null && setting.isRuntimeEditable(); + } } 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 d2fa34cee2..ceb8cc577e 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 @@ -300,6 +300,13 @@ public final class SettingsFragmentPresenter BooleanSetting.MAIN_DSP_JIT.isOverridden(settings); } + @Override + public boolean isRuntimeEditable() + { + return BooleanSetting.MAIN_DSP_HLE.isRuntimeEditable() && + BooleanSetting.MAIN_DSP_JIT.isRuntimeEditable(); + } + @Override public boolean delete(Settings settings) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java index 2b3c7fe38c..07206a04fa 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java @@ -66,6 +66,12 @@ public final class CheckBoxSettingViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + mCheckbox.toggle(); getAdapter().onBooleanClick(mItem, getAdapterPosition(), mCheckbox.isChecked()); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java index 88e5700d51..67266d8c64 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java @@ -52,6 +52,12 @@ public final class FilePickerViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + if (mFilePicker.getRequestType() == MainPresenter.REQUEST_DIRECTORY) { getAdapter().onFilePickerDirectoryClick(mItem); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java index 5cccd85c49..7dda7b3630 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java @@ -51,6 +51,12 @@ public final class InputBindingSettingViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + getAdapter().onInputBindingClick(mItem, getAdapterPosition()); setStyle(mTextSettingName, mItem); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java index 5f08cc685f..3968e0c078 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java @@ -51,6 +51,12 @@ public class RumbleBindingViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + getAdapter().onInputBindingClick(mItem, getAdapterPosition()); setStyle(mTextSettingName, mItem); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SettingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SettingViewHolder.java index 839e6fa2e1..c23a3a270b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SettingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SettingViewHolder.java @@ -1,11 +1,16 @@ package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; + +import android.graphics.Paint; import android.graphics.Typeface; import android.view.View; import android.widget.TextView; +import android.widget.Toast; import androidx.recyclerview.widget.RecyclerView; +import org.dolphinemu.dolphinemu.DolphinApplication; +import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; @@ -34,6 +39,15 @@ public abstract class SettingViewHolder extends RecyclerView.ViewHolder { boolean overridden = settingsItem.isOverridden(mAdapter.getSettings()); textView.setTypeface(null, overridden ? Typeface.BOLD : Typeface.NORMAL); + + if (!settingsItem.isEditable()) + textView.setPaintFlags(textView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); + } + + protected static void showNotRuntimeEditableError() + { + Toast.makeText(DolphinApplication.getAppContext(), R.string.setting_not_runtime_editable, + Toast.LENGTH_SHORT).show(); } /** diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java index 154b858093..a8f869cba9 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SingleChoiceViewHolder.java @@ -87,6 +87,12 @@ public final class SingleChoiceViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + int position = getAdapterPosition(); if (mItem instanceof SingleChoiceSetting) { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.java index bde659b07c..6a7d9a0fa3 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/SliderViewHolder.java @@ -56,6 +56,12 @@ public final class SliderViewHolder extends SettingViewHolder @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + getAdapter().onSliderClick(mItem, getAdapterPosition()); setStyle(mTextSettingName, mItem); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/MenuFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/MenuFragment.java index 2328f5c0dc..f468240c4d 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/MenuFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/MenuFragment.java @@ -50,6 +50,9 @@ public final class MenuFragment extends Fragment implements View.OnClickListener .append(R.id.menu_screen_orientation, EmulationActivity.MENU_ACTION_SCREEN_ORIENTATION); buttonsActionsMap.append(R.id.menu_change_disc, EmulationActivity.MENU_ACTION_CHANGE_DISC); buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT); + buttonsActionsMap.append(R.id.menu_settings_core, EmulationActivity.MENU_ACTION_SETTINGS_CORE); + buttonsActionsMap.append(R.id.menu_settings_graphics, + EmulationActivity.MENU_ACTION_SETTINGS_GRAPHICS); } public static MenuFragment newInstance(String title) @@ -83,15 +86,6 @@ public final class MenuFragment extends Fragment implements View.OnClickListener updatePauseUnpauseVisibility(); - Settings settings = ((EmulationActivity) getActivity()).getSettings(); - if (BooleanSetting.MAIN_ENABLE_SAVESTATES.getBoolean(settings)) - { - options.findViewById(R.id.menu_quicksave).setVisibility(View.VISIBLE); - options.findViewById(R.id.menu_quickload).setVisibility(View.VISIBLE); - options.findViewById(R.id.menu_emulation_save_root).setVisibility(View.VISIBLE); - options.findViewById(R.id.menu_emulation_load_root).setVisibility(View.VISIBLE); - } - PackageManager packageManager = requireActivity().getPackageManager(); if (!packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) @@ -146,6 +140,22 @@ public final class MenuFragment extends Fragment implements View.OnClickListener return rootView; } + @Override + public void onResume() + { + super.onResume(); + + LinearLayout options = requireView().findViewById(R.id.layout_options); + + Settings settings = ((EmulationActivity) requireActivity()).getSettings(); + boolean savestatesEnabled = BooleanSetting.MAIN_ENABLE_SAVESTATES.getBoolean(settings); + int savestateVisibility = savestatesEnabled ? View.VISIBLE : View.GONE; + options.findViewById(R.id.menu_quicksave).setVisibility(savestateVisibility); + options.findViewById(R.id.menu_quickload).setVisibility(savestateVisibility); + options.findViewById(R.id.menu_emulation_save_root).setVisibility(savestateVisibility); + options.findViewById(R.id.menu_emulation_load_root).setVisibility(savestateVisibility); + } + private void updatePauseUnpauseVisibility() { boolean paused = EmulationActivity.getHasUserPausedEmulation(); diff --git a/Source/Android/app/src/main/res/layout/fragment_ingame_menu.xml b/Source/Android/app/src/main/res/layout/fragment_ingame_menu.xml index 54295f0eac..e97ae923d7 100644 --- a/Source/Android/app/src/main/res/layout/fragment_ingame_menu.xml +++ b/Source/Android/app/src/main/res/layout/fragment_ingame_menu.xml @@ -30,6 +30,16 @@ android:layout_height="wrap_content" android:orientation="vertical"> +