Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11641 from JosJuice/android-remove-old-config
Android: Remove support for the old config system
  • Loading branch information
lioncash committed Mar 14, 2023
2 parents e83b6e1 + 0833401 commit 4281606
Show file tree
Hide file tree
Showing 69 changed files with 387 additions and 579 deletions.
Expand Up @@ -400,7 +400,7 @@ protected void onResume()
WindowManager.LayoutParams attributes = getWindow().getAttributes();

attributes.layoutInDisplayCutoutMode =
BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA.getBoolean(mSettings) ?
BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA.getBoolean() ?
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES :
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;

Expand All @@ -423,7 +423,7 @@ protected void onPause()
protected void onStop()
{
super.onStop();
mSettings.saveSettings(null, null);
mSettings.saveSettings(null);
}

public void onTitleChanged()
Expand All @@ -437,7 +437,7 @@ public void onTitleChanged()

setTitle(NativeLibrary.GetCurrentTitleDescription());

mEmulationFragment.refreshInputOverlay(mSettings);
mEmulationFragment.refreshInputOverlay();
}

@Override
Expand Down Expand Up @@ -521,7 +521,7 @@ private void enableFullscreenImmersive()

private void updateOrientation()
{
setRequestedOrientation(IntSetting.MAIN_EMULATION_ORIENTATION.getInt(mSettings));
setRequestedOrientation(IntSetting.MAIN_EMULATION_ORIENTATION.getInt());
}

private boolean closeSubmenu()
Expand Down Expand Up @@ -589,11 +589,11 @@ public void showOverlayControlsMenu(@NonNull View anchor)

// Populate the switch value for joystick center on touch
menu.findItem(R.id.menu_emulation_joystick_rel_center)
.setChecked(BooleanSetting.MAIN_JOYSTICK_REL_CENTER.getBoolean(mSettings));
.setChecked(BooleanSetting.MAIN_JOYSTICK_REL_CENTER.getBoolean());
if (wii)
{
menu.findItem(R.id.menu_emulation_ir_recenter)
.setChecked(BooleanSetting.MAIN_IR_ALWAYS_RECENTER.getBoolean(mSettings));
.setChecked(BooleanSetting.MAIN_IR_ALWAYS_RECENTER.getBoolean());
}

popup.setOnMenuItemClickListener(this::onOptionsItemSelected);
Expand Down Expand Up @@ -794,7 +794,7 @@ private void toggleJoystickRelCenter(boolean state)
private void toggleRecenter(boolean state)
{
BooleanSetting.MAIN_IR_ALWAYS_RECENTER.setBoolean(mSettings, state);
mEmulationFragment.refreshOverlayPointer(mSettings);
mEmulationFragment.refreshOverlayPointer();
}

private void editControlsPlacement()
Expand Down Expand Up @@ -831,7 +831,7 @@ private void toggleControls()
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this)
.setTitle(R.string.emulation_toggle_controls);

int currentController = InputOverlay.getConfiguredControllerType(mSettings);
int currentController = InputOverlay.getConfiguredControllerType();

if (currentController == InputOverlay.OVERLAY_GAMECUBE)
{
Expand All @@ -840,7 +840,7 @@ private void toggleControls()

for (int i = 0; i < gcEnabledButtons.length; i++)
{
gcEnabledButtons[i] = BooleanSetting.valueOf(gcSettingBase + i).getBoolean(mSettings);
gcEnabledButtons[i] = BooleanSetting.valueOf(gcSettingBase + i).getBoolean();
}
builder.setMultiChoiceItems(R.array.gcpadButtons, gcEnabledButtons,
(dialog, indexSelected, isChecked) -> BooleanSetting
Expand All @@ -854,7 +854,7 @@ else if (currentController == InputOverlay.OVERLAY_WIIMOTE_CLASSIC)
for (int i = 0; i < wiiClassicEnabledButtons.length; i++)
{
wiiClassicEnabledButtons[i] =
BooleanSetting.valueOf(classicSettingBase + i).getBoolean(mSettings);
BooleanSetting.valueOf(classicSettingBase + i).getBoolean();
}
builder.setMultiChoiceItems(R.array.classicButtons, wiiClassicEnabledButtons,
(dialog, indexSelected, isChecked) -> BooleanSetting
Expand All @@ -868,7 +868,7 @@ else if (currentController == InputOverlay.OVERLAY_WIIMOTE_CLASSIC)

for (int i = 0; i < wiiEnabledButtons.length; i++)
{
wiiEnabledButtons[i] = BooleanSetting.valueOf(wiiSettingBase + i).getBoolean(mSettings);
wiiEnabledButtons[i] = BooleanSetting.valueOf(wiiSettingBase + i).getBoolean();
}
if (currentController == InputOverlay.OVERLAY_WIIMOTE_NUNCHUK)
{
Expand All @@ -887,15 +887,15 @@ else if (currentController == InputOverlay.OVERLAY_WIIMOTE_CLASSIC)
builder.setNeutralButton(R.string.emulation_toggle_all,
(dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility(mSettings))
.setPositiveButton(R.string.ok, (dialogInterface, i) ->
mEmulationFragment.refreshInputOverlay(mSettings))
mEmulationFragment.refreshInputOverlay())
.show();
}

public void chooseDoubleTapButton()
{
int currentValue = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getInt(mSettings);
int currentValue = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getInt();

int buttonList = InputOverlay.getConfiguredControllerType(mSettings) ==
int buttonList = InputOverlay.getConfiguredControllerType() ==
InputOverlay.OVERLAY_WIIMOTE_CLASSIC ? R.array.doubleTapWithClassic : R.array.doubleTap;

int checkedItem = -1;
Expand All @@ -914,7 +914,7 @@ public void chooseDoubleTapButton()
(DialogInterface dialog, int which) -> IntSetting.MAIN_DOUBLE_TAP_BUTTON.setInt(
mSettings, InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(which)))
.setPositiveButton(R.string.ok,
(dialogInterface, i) -> mEmulationFragment.initInputPointer(mSettings))
(dialogInterface, i) -> mEmulationFragment.initInputPointer())
.show();
}

Expand All @@ -925,7 +925,7 @@ private void adjustScale()
final Slider scaleSlider = dialogBinding.inputScaleSlider;
final TextView scaleValue = dialogBinding.inputScaleValue;
scaleSlider.setValueTo(150);
scaleSlider.setValue(IntSetting.MAIN_CONTROL_SCALE.getInt(mSettings));
scaleSlider.setValue(IntSetting.MAIN_CONTROL_SCALE.getInt());
scaleSlider.setStepSize(1);
scaleSlider.addOnChangeListener(
(slider, progress, fromUser) -> scaleValue.setText(((int) progress + 50) + "%"));
Expand All @@ -935,7 +935,7 @@ private void adjustScale()
final Slider sliderOpacity = dialogBinding.inputOpacitySlider;
final TextView valueOpacity = dialogBinding.inputOpacityValue;
sliderOpacity.setValueTo(100);
sliderOpacity.setValue(IntSetting.MAIN_CONTROL_OPACITY.getInt(mSettings));
sliderOpacity.setValue(IntSetting.MAIN_CONTROL_OPACITY.getInt());
sliderOpacity.setStepSize(1);
sliderOpacity.addOnChangeListener(
(slider, progress, fromUser) -> valueOpacity.setText(((int) progress) + "%"));
Expand All @@ -948,21 +948,21 @@ private void adjustScale()
{
IntSetting.MAIN_CONTROL_SCALE.setInt(mSettings, (int) scaleSlider.getValue());
IntSetting.MAIN_CONTROL_OPACITY.setInt(mSettings, (int) sliderOpacity.getValue());
mEmulationFragment.refreshInputOverlay(mSettings);
mEmulationFragment.refreshInputOverlay();
})
.setNeutralButton(R.string.default_values, (dialog, which) ->
{
IntSetting.MAIN_CONTROL_SCALE.delete(mSettings);
IntSetting.MAIN_CONTROL_OPACITY.delete(mSettings);
mEmulationFragment.refreshInputOverlay(mSettings);
mEmulationFragment.refreshInputOverlay();
})
.show();
}

private void addControllerIfNotNone(List<CharSequence> entries, List<Integer> values,
IntSetting controller, int entry, int value)
{
if (controller.getInt(mSettings) != 0)
if (controller.getInt() != 0)
{
entries.add(getString(entry));
values.add(value);
Expand Down Expand Up @@ -992,7 +992,7 @@ private void chooseController()

IntSetting controllerSetting = NativeLibrary.IsEmulatingWii() ?
IntSetting.MAIN_OVERLAY_WII_CONTROLLER : IntSetting.MAIN_OVERLAY_GC_CONTROLLER;
int currentValue = controllerSetting.getInt(mSettings);
int currentValue = controllerSetting.getInt();

int checkedItem = -1;
for (int i = 0; i < values.size(); i++)
Expand All @@ -1013,7 +1013,7 @@ private void chooseController()
.setPositiveButton(R.string.ok, (dialogInterface, i) ->
{
editor.apply();
mEmulationFragment.refreshInputOverlay(mSettings);
mEmulationFragment.refreshInputOverlay();
})
.setNeutralButton(R.string.emulation_more_controller_settings,
(dialogInterface, i) -> SettingsActivity.launch(this, MenuTag.SETTINGS))
Expand All @@ -1025,11 +1025,11 @@ private void setIRMode()
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.emulation_ir_mode)
.setSingleChoiceItems(R.array.irModeEntries,
IntSetting.MAIN_IR_MODE.getInt(mSettings),
IntSetting.MAIN_IR_MODE.getInt(),
(dialog, indexSelected) ->
IntSetting.MAIN_IR_MODE.setInt(mSettings, indexSelected))
.setPositiveButton(R.string.ok, (dialogInterface, i) ->
mEmulationFragment.refreshOverlayPointer(mSettings))
mEmulationFragment.refreshOverlayPointer())
.show();
}

Expand Down Expand Up @@ -1065,7 +1065,7 @@ private void resetOverlay()
new MaterialAlertDialogBuilder(this)
.setTitle(getString(R.string.emulation_touch_overlay_reset))
.setPositiveButton(R.string.yes,
(dialogInterface, i) -> mEmulationFragment.resetInputOverlay(mSettings))
(dialogInterface, i) -> mEmulationFragment.resetInputOverlay())
.setNegativeButton(R.string.cancel, null)
.show();
}
Expand Down Expand Up @@ -1160,7 +1160,7 @@ public Settings getSettings()

public void initInputPointer()
{
mEmulationFragment.initInputPointer(mSettings);
mEmulationFragment.initInputPointer();
}

@Override
Expand Down
Expand Up @@ -59,7 +59,7 @@ class GameAdapter(private val mActivity: FragmentActivity) : RecyclerView.Adapte
val gameFile = mGameFiles[position]

holder.apply {
if (BooleanSetting.MAIN_SHOW_GAME_TITLES.booleanGlobal) {
if (BooleanSetting.MAIN_SHOW_GAME_TITLES.boolean) {
binding.textGameTitle.text = gameFile.title
binding.textGameTitle.visibility = View.VISIBLE
binding.textGameTitleInner.visibility = View.GONE
Expand Down
Expand Up @@ -92,7 +92,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState)
{
settings.loadSettings();
StringSetting.MAIN_DEFAULT_ISO.setString(settings, path);
settings.saveSettings(null, getContext());
settings.saveSettings(getContext());
}
});
}
Expand Down
Expand Up @@ -160,7 +160,7 @@ class CheatsActivity : AppCompatActivity(), PanelSlideListener {

fun loadGameSpecificSettings(): Settings {
val settings = Settings()
settings.loadSettings(null, gameId, revision, isWii)
settings.loadSettings(gameId, revision, isWii)
return settings
}

Expand Down
Expand Up @@ -42,8 +42,8 @@ abstract class SettingDisabledWarningFragment(
override fun onResume() {
super.onResume()
val activity = requireActivity() as CheatsActivity
activity.loadGameSpecificSettings().use { settings ->
val cheatsEnabled = setting.getBoolean(settings)
activity.loadGameSpecificSettings().use {
val cheatsEnabled = setting.getBoolean()
requireView().visibility = if (cheatsEnabled) View.GONE else View.VISIBLE
}
}
Expand Down
Expand Up @@ -2,6 +2,8 @@

package org.dolphinemu.dolphinemu.features.input.model;

import androidx.annotation.NonNull;

import org.dolphinemu.dolphinemu.features.input.model.controlleremu.ControlGroup;
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
Expand All @@ -16,19 +18,19 @@ public ControlGroupEnabledSetting(ControlGroup controlGroup)
}

@Override
public boolean getBoolean(Settings settings)
public boolean getBoolean()
{
return mControlGroup.getEnabled();
}

@Override
public void setBoolean(Settings settings, boolean newValue)
public void setBoolean(@NonNull Settings settings, boolean newValue)
{
mControlGroup.setEnabled(newValue);
}

@Override
public boolean isOverridden(Settings settings)
public boolean isOverridden()
{
return false;
}
Expand All @@ -40,7 +42,7 @@ public boolean isRuntimeEditable()
}

@Override
public boolean delete(Settings settings)
public boolean delete(@NonNull Settings settings)
{
boolean newValue = mControlGroup.getDefaultEnabledValue() != ControlGroup.DEFAULT_ENABLED_NO;
mControlGroup.setEnabled(newValue);
Expand Down
Expand Up @@ -2,6 +2,8 @@

package org.dolphinemu.dolphinemu.features.input.model;

import androidx.annotation.NonNull;

import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting;
import org.dolphinemu.dolphinemu.features.settings.model.AbstractBooleanSetting;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
Expand All @@ -16,19 +18,19 @@ public InputMappingBooleanSetting(NumericSetting numericSetting)
}

@Override
public boolean getBoolean(Settings settings)
public boolean getBoolean()
{
return mNumericSetting.getBooleanValue();
}

@Override
public void setBoolean(Settings settings, boolean newValue)
public void setBoolean(@NonNull Settings settings, boolean newValue)
{
mNumericSetting.setBooleanValue(newValue);
}

@Override
public boolean isOverridden(Settings settings)
public boolean isOverridden()
{
return false;
}
Expand All @@ -40,7 +42,7 @@ public boolean isRuntimeEditable()
}

@Override
public boolean delete(Settings settings)
public boolean delete(@NonNull Settings settings)
{
mNumericSetting.setBooleanValue(mNumericSetting.getBooleanDefaultValue());
return true;
Expand Down
Expand Up @@ -2,6 +2,8 @@

package org.dolphinemu.dolphinemu.features.input.model;

import androidx.annotation.NonNull;

import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting;
import org.dolphinemu.dolphinemu.features.settings.model.AbstractFloatSetting;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
Expand All @@ -17,19 +19,19 @@ public InputMappingDoubleSetting(NumericSetting numericSetting)
}

@Override
public float getFloat(Settings settings)
public float getFloat()
{
return (float) mNumericSetting.getDoubleValue();
}

@Override
public void setFloat(Settings settings, float newValue)
public void setFloat(@NonNull Settings settings, float newValue)
{
mNumericSetting.setDoubleValue(newValue);
}

@Override
public boolean isOverridden(Settings settings)
public boolean isOverridden()
{
return false;
}
Expand All @@ -41,7 +43,7 @@ public boolean isRuntimeEditable()
}

@Override
public boolean delete(Settings settings)
public boolean delete(@NonNull Settings settings)
{
mNumericSetting.setDoubleValue(mNumericSetting.getDoubleDefaultValue());
return true;
Expand Down

0 comments on commit 4281606

Please sign in to comment.