Android: Allow changing controller settings during emulation

This commit is contained in:
JosJuice 2022-04-23 23:49:18 +02:00
parent c2779aef06
commit 32cb41007b
5 changed files with 19 additions and 10 deletions

View File

@ -50,6 +50,12 @@ public class InputDeviceSetting extends StringSingleChoiceSetting
mValues = devices; mValues = devices;
} }
@Override
public boolean isEditable()
{
return true;
}
@Override @Override
public boolean canClear() public boolean canClear()
{ {

View File

@ -48,6 +48,12 @@ public final class InputMappingControlSetting extends SettingsItem
return null; return null;
} }
@Override
public boolean isEditable()
{
return true;
}
public EmulatedController getController() public EmulatedController getController()
{ {
return mController; return mController;

View File

@ -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.config, MenuTag.CONFIG));
sl.add(new SubmenuSetting(mContext, R.string.graphics_settings, MenuTag.GRAPHICS)); 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)); sl.add(new SubmenuSetting(mContext, R.string.wiimote_settings, MenuTag.WIIMOTE));
if (mSettings.isWii())
{
sl.add(new SubmenuSetting(mContext, R.string.wiimote_settings, MenuTag.WIIMOTE));
}
} }
sl.add(new HeaderSetting(mContext, R.string.setting_clear_info, 0)); sl.add(new HeaderSetting(mContext, R.string.setting_clear_info, 0));

View File

@ -133,6 +133,10 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
public void onResume() public void onResume()
{ {
super.onResume(); super.onResume();
if (mInputOverlay != null && NativeLibrary.IsGameMetadataValid())
mInputOverlay.refreshControls();
run(activity.isActivityRecreated()); run(activity.isActivityRecreated());
} }

View File

@ -131,10 +131,6 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
if (!mPreferences.getBoolean("OverlayInitV3", false)) if (!mPreferences.getBoolean("OverlayInitV3", false))
defaultOverlay(); defaultOverlay();
// Load the controls if we can. If not, EmulationActivity has to do it later.
if (NativeLibrary.IsGameMetadataValid())
refreshControls();
// Set the on touch listener. // Set the on touch listener.
setOnTouchListener(this); setOnTouchListener(this);