From 32cb41007bedf94573ebae92495bbbb179d3113c Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 23 Apr 2022 23:49:18 +0200 Subject: [PATCH] Android: Allow changing controller settings during emulation --- .../features/input/model/view/InputDeviceSetting.java | 6 ++++++ .../input/model/view/InputMappingControlSetting.java | 6 ++++++ .../features/settings/ui/SettingsFragmentPresenter.java | 9 +++------ .../dolphinemu/fragments/EmulationFragment.java | 4 ++++ .../org/dolphinemu/dolphinemu/overlay/InputOverlay.java | 4 ---- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.java index 2462e867d3..e27d0f57ae 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputDeviceSetting.java @@ -50,6 +50,12 @@ public class InputDeviceSetting extends StringSingleChoiceSetting mValues = devices; } + @Override + public boolean isEditable() + { + return true; + } + @Override public boolean canClear() { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java index 1e8bb1e6d3..86379bf5a6 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/view/InputMappingControlSetting.java @@ -48,6 +48,12 @@ public final class InputMappingControlSetting extends SettingsItem return null; } + @Override + public boolean isEditable() + { + return true; + } + public EmulatedController getController() { return mController; 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 20d4111b98..cd39f8c10f 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 @@ -293,13 +293,10 @@ public final class SettingsFragmentPresenter sl.add(new SubmenuSetting(mContext, R.string.config, MenuTag.CONFIG)); sl.add(new SubmenuSetting(mContext, R.string.graphics_settings, MenuTag.GRAPHICS)); - if (!NativeLibrary.IsRunning()) + sl.add(new SubmenuSetting(mContext, R.string.gcpad_settings, MenuTag.GCPAD_TYPE)); + if (mSettings.isWii()) { - sl.add(new SubmenuSetting(mContext, R.string.gcpad_settings, MenuTag.GCPAD_TYPE)); - if (mSettings.isWii()) - { - sl.add(new SubmenuSetting(mContext, R.string.wiimote_settings, MenuTag.WIIMOTE)); - } + sl.add(new SubmenuSetting(mContext, R.string.wiimote_settings, MenuTag.WIIMOTE)); } sl.add(new HeaderSetting(mContext, R.string.setting_clear_info, 0)); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java index 142aca0641..c356969136 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java @@ -133,6 +133,10 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C public void onResume() { super.onResume(); + + if (mInputOverlay != null && NativeLibrary.IsGameMetadataValid()) + mInputOverlay.refreshControls(); + run(activity.isActivityRecreated()); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java index 7d949befed..0a961ac16f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java @@ -131,10 +131,6 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener if (!mPreferences.getBoolean("OverlayInitV3", false)) defaultOverlay(); - // Load the controls if we can. If not, EmulationActivity has to do it later. - if (NativeLibrary.IsGameMetadataValid()) - refreshControls(); - // Set the on touch listener. setOnTouchListener(this);