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;
}
@Override
public boolean isEditable()
{
return true;
}
@Override
public boolean canClear()
{

View File

@ -48,6 +48,12 @@ public final class InputMappingControlSetting extends SettingsItem
return null;
}
@Override
public boolean isEditable()
{
return true;
}
public EmulatedController getController()
{
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.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));

View File

@ -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());
}

View File

@ -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);