mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Android: Don't require Settings object for reading a setting
Made unnecessary by the previous commit.
This commit is contained in:
parent
68fd133057
commit
58fc347f8d
@ -400,7 +400,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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;
|
||||
|
||||
@ -437,7 +437,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
setTitle(NativeLibrary.GetCurrentTitleDescription());
|
||||
|
||||
mEmulationFragment.refreshInputOverlay(mSettings);
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -521,7 +521,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
private void updateOrientation()
|
||||
{
|
||||
setRequestedOrientation(IntSetting.MAIN_EMULATION_ORIENTATION.getInt(mSettings));
|
||||
setRequestedOrientation(IntSetting.MAIN_EMULATION_ORIENTATION.getInt());
|
||||
}
|
||||
|
||||
private boolean closeSubmenu()
|
||||
@ -589,11 +589,11 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
// 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);
|
||||
@ -794,7 +794,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
private void toggleRecenter(boolean state)
|
||||
{
|
||||
BooleanSetting.MAIN_IR_ALWAYS_RECENTER.setBoolean(mSettings, state);
|
||||
mEmulationFragment.refreshOverlayPointer(mSettings);
|
||||
mEmulationFragment.refreshOverlayPointer();
|
||||
}
|
||||
|
||||
private void editControlsPlacement()
|
||||
@ -831,7 +831,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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)
|
||||
{
|
||||
@ -840,7 +840,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
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
|
||||
@ -854,7 +854,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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
|
||||
@ -868,7 +868,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
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)
|
||||
{
|
||||
@ -887,15 +887,15 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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;
|
||||
@ -914,7 +914,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
(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();
|
||||
}
|
||||
|
||||
@ -925,7 +925,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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) + "%"));
|
||||
@ -935,7 +935,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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) + "%"));
|
||||
@ -948,13 +948,13 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
{
|
||||
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();
|
||||
}
|
||||
@ -962,7 +962,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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);
|
||||
@ -992,7 +992,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
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++)
|
||||
@ -1013,7 +1013,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
.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))
|
||||
@ -1025,11 +1025,11 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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();
|
||||
}
|
||||
|
||||
@ -1065,7 +1065,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
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();
|
||||
}
|
||||
@ -1160,7 +1160,7 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
|
||||
|
||||
public void initInputPointer()
|
||||
{
|
||||
mEmulationFragment.initInputPointer(mSettings);
|
||||
mEmulationFragment.initInputPointer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -16,19 +18,19 @@ public class ControlGroupEnabledSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
@ -40,7 +42,7 @@ public class ControlGroupEnabledSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
public boolean delete(@NonNull Settings settings)
|
||||
{
|
||||
boolean newValue = mControlGroup.getDefaultEnabledValue() != ControlGroup.DEFAULT_ENABLED_NO;
|
||||
mControlGroup.setEnabled(newValue);
|
||||
|
@ -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;
|
||||
@ -16,19 +18,19 @@ public class InputMappingBooleanSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
@ -40,7 +42,7 @@ public class InputMappingBooleanSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
public boolean delete(@NonNull Settings settings)
|
||||
{
|
||||
mNumericSetting.setBooleanValue(mNumericSetting.getBooleanDefaultValue());
|
||||
return true;
|
||||
|
@ -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;
|
||||
@ -17,19 +19,19 @@ public class InputMappingDoubleSetting implements AbstractFloatSetting
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
@ -41,7 +43,7 @@ public class InputMappingDoubleSetting implements AbstractFloatSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
public boolean delete(@NonNull Settings settings)
|
||||
{
|
||||
mNumericSetting.setDoubleValue(mNumericSetting.getDoubleDefaultValue());
|
||||
return true;
|
||||
|
@ -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.AbstractIntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
@ -16,19 +18,19 @@ public class InputMappingIntSetting implements AbstractIntSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(Settings settings)
|
||||
public int getInt()
|
||||
{
|
||||
return mNumericSetting.getIntValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInt(Settings settings, int newValue)
|
||||
public void setInt(@NonNull Settings settings, int newValue)
|
||||
{
|
||||
mNumericSetting.setIntValue(newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -40,7 +42,7 @@ public class InputMappingIntSetting implements AbstractIntSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
public boolean delete(@NonNull Settings settings)
|
||||
{
|
||||
mNumericSetting.setIntValue(mNumericSetting.getIntDefaultValue());
|
||||
return true;
|
||||
|
@ -24,13 +24,13 @@ public class InputDeviceSetting extends StringSingleChoiceSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectedChoice(Settings settings)
|
||||
public String getSelectedChoice()
|
||||
{
|
||||
return mController.getDefaultDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectedValue(Settings settings)
|
||||
public String getSelectedValue()
|
||||
{
|
||||
return mController.getDefaultDevice();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
public interface AbstractBooleanSetting extends AbstractSetting
|
||||
{
|
||||
boolean getBoolean(@NonNull Settings settings);
|
||||
boolean getBoolean();
|
||||
|
||||
void setBoolean(@NonNull Settings settings, boolean newValue);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
public interface AbstractFloatSetting extends AbstractSetting
|
||||
{
|
||||
float getFloat(@NonNull Settings settings);
|
||||
float getFloat();
|
||||
|
||||
void setFloat(@NonNull Settings settings, float newValue);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
public interface AbstractIntSetting extends AbstractSetting
|
||||
{
|
||||
int getInt(@NonNull Settings settings);
|
||||
int getInt();
|
||||
|
||||
void setInt(@NonNull Settings settings, int newValue);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
public interface AbstractSetting
|
||||
{
|
||||
boolean isOverridden(@NonNull Settings settings);
|
||||
boolean isOverridden();
|
||||
|
||||
boolean isRuntimeEditable();
|
||||
|
||||
|
@ -7,7 +7,7 @@ import androidx.annotation.NonNull;
|
||||
public interface AbstractStringSetting extends AbstractSetting
|
||||
{
|
||||
@NonNull
|
||||
String getString(@NonNull Settings settings);
|
||||
String getString();
|
||||
|
||||
void setString(@NonNull Settings settings, @NonNull String newValue);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class AdHocBooleanSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
@ -43,7 +43,7 @@ public class AdHocBooleanSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(@NonNull Settings settings)
|
||||
public boolean getBoolean()
|
||||
{
|
||||
return NativeConfig.getBoolean(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class AdHocStringSetting implements AbstractStringSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
@ -43,7 +43,7 @@ public class AdHocStringSetting implements AbstractStringSetting
|
||||
}
|
||||
|
||||
@NonNull @Override
|
||||
public String getString(@NonNull Settings settings)
|
||||
public String getString()
|
||||
{
|
||||
return NativeConfig.getString(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public enum BooleanSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
@ -329,7 +329,7 @@ public enum BooleanSetting implements AbstractBooleanSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(@NonNull Settings settings)
|
||||
public boolean getBoolean()
|
||||
{
|
||||
return NativeConfig.getBoolean(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public enum FloatSetting implements AbstractFloatSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
@ -49,7 +49,7 @@ public enum FloatSetting implements AbstractFloatSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(@NonNull Settings settings)
|
||||
public float getFloat()
|
||||
{
|
||||
return NativeConfig.getFloat(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public enum IntSetting implements AbstractIntSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
@ -154,7 +154,7 @@ public enum IntSetting implements AbstractIntSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(@NonNull Settings settings)
|
||||
public int getInt()
|
||||
{
|
||||
return NativeConfig.getInt(NativeConfig.LAYER_ACTIVE, mFile, mSection, mKey, mDefaultValue);
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ class ScaledIntSetting(
|
||||
private val scale: Int,
|
||||
private val setting: AbstractIntSetting
|
||||
) : AbstractIntSetting {
|
||||
override fun isOverridden(settings: Settings): Boolean {
|
||||
return setting.isOverridden(settings)
|
||||
override fun isOverridden(): Boolean {
|
||||
return setting.isOverridden()
|
||||
}
|
||||
|
||||
override fun isRuntimeEditable(): Boolean {
|
||||
@ -18,8 +18,8 @@ class ScaledIntSetting(
|
||||
return setting.delete(settings)
|
||||
}
|
||||
|
||||
override fun getInt(settings: Settings): Int {
|
||||
return setting.getInt(settings) / scale
|
||||
override fun getInt(): Int {
|
||||
return setting.getInt() / scale
|
||||
}
|
||||
|
||||
override fun setInt(settings: Settings, newValue: Int) {
|
||||
|
@ -95,7 +95,7 @@ public class Settings implements Closeable
|
||||
NativeConfig.loadGameInis(mGameId, mRevision);
|
||||
}
|
||||
|
||||
mLoadedRecursiveIsoPathsValue = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBoolean(this);
|
||||
mLoadedRecursiveIsoPathsValue = BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBoolean();
|
||||
}
|
||||
|
||||
public void loadSettings(SettingsActivityView view, String gameId, int revision, boolean isWii)
|
||||
@ -119,7 +119,7 @@ public class Settings implements Closeable
|
||||
NativeLibrary.ReloadLoggerConfig();
|
||||
NativeLibrary.UpdateGCAdapterScanThread();
|
||||
|
||||
if (mLoadedRecursiveIsoPathsValue != BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBoolean(this))
|
||||
if (mLoadedRecursiveIsoPathsValue != BooleanSetting.MAIN_RECURSIVE_ISO_PATHS.getBoolean())
|
||||
{
|
||||
// Refresh game library
|
||||
GameFileCacheManager.startRescan();
|
||||
|
@ -65,7 +65,7 @@ public enum StringSetting implements AbstractStringSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return NativeConfig.isOverridden(mFile, mSection, mKey);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public enum StringSetting implements AbstractStringSetting
|
||||
}
|
||||
|
||||
@NonNull @Override
|
||||
public String getString(@NonNull Settings settings)
|
||||
public String getString()
|
||||
{
|
||||
if (!NativeConfig.isSettingSaveable(mFile, mSection, mKey))
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ class DateTimeChoiceSetting(
|
||||
setting.setString(settings, selection)
|
||||
}
|
||||
|
||||
fun getSelectedValue(settings: Settings): String {
|
||||
return setting.getString(settings)
|
||||
fun getSelectedValue(): String {
|
||||
return setting.getString()
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ public final class FilePicker extends SettingsItem
|
||||
mDefaultPathRelativeToUserDirectory = defaultPathRelativeToUserDirectory;
|
||||
}
|
||||
|
||||
public String getSelectedValue(Settings settings)
|
||||
public String getSelectedValue()
|
||||
{
|
||||
return mSetting.getString(settings);
|
||||
return mSetting.getString();
|
||||
}
|
||||
|
||||
public void setSelectedValue(Settings settings, String selection)
|
||||
|
@ -26,9 +26,9 @@ public class FloatSliderSetting extends SliderSetting
|
||||
mSetting = setting;
|
||||
}
|
||||
|
||||
public int getSelectedValue(Settings settings)
|
||||
public int getSelectedValue()
|
||||
{
|
||||
return Math.round(mSetting.getFloat(settings));
|
||||
return Math.round(mSetting.getFloat());
|
||||
}
|
||||
|
||||
public void setSelectedValue(Settings settings, float selection)
|
||||
|
@ -43,9 +43,9 @@ public class InputStringSetting extends SettingsItem
|
||||
this(context, setting, titleId, descriptionId, choicesId, valuesId, null);
|
||||
}
|
||||
|
||||
public String getSelectedValue(Settings settings)
|
||||
public String getSelectedValue()
|
||||
{
|
||||
return mSetting.getString(settings);
|
||||
return mSetting.getString();
|
||||
}
|
||||
|
||||
public MenuTag getMenuTag()
|
||||
|
@ -19,9 +19,9 @@ public final class IntSliderSetting extends SliderSetting
|
||||
mSetting = setting;
|
||||
}
|
||||
|
||||
public int getSelectedValue(Settings settings)
|
||||
public int getSelectedValue()
|
||||
{
|
||||
return mSetting.getInt(settings);
|
||||
return mSetting.getInt();
|
||||
}
|
||||
|
||||
public void setSelectedValue(Settings settings, int selection)
|
||||
|
@ -17,9 +17,9 @@ public final class InvertedSwitchSetting extends SwitchSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked(Settings settings)
|
||||
public boolean isChecked()
|
||||
{
|
||||
return !mSetting.getBoolean(settings);
|
||||
return !mSetting.getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,9 +17,9 @@ public final class PercentSliderSetting extends FloatSliderSetting
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectedValue(Settings settings)
|
||||
public int getSelectedValue()
|
||||
{
|
||||
return Math.round(mSetting.getFloat(settings) * 100);
|
||||
return Math.round(mSetting.getFloat() * 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,10 +75,10 @@ public abstract class SettingsItem
|
||||
|
||||
protected abstract AbstractSetting getSetting();
|
||||
|
||||
public boolean isOverridden(Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
AbstractSetting setting = getSetting();
|
||||
return setting != null && setting.isOverridden(settings);
|
||||
return setting != null && setting.isOverridden();
|
||||
}
|
||||
|
||||
public boolean isEditable()
|
||||
|
@ -43,9 +43,9 @@ public final class SingleChoiceSetting extends SettingsItem
|
||||
return mValuesId;
|
||||
}
|
||||
|
||||
public int getSelectedValue(Settings settings)
|
||||
public int getSelectedValue()
|
||||
{
|
||||
return mSetting.getInt(settings);
|
||||
return mSetting.getInt();
|
||||
}
|
||||
|
||||
public MenuTag getMenuTag()
|
||||
|
@ -60,9 +60,9 @@ public final class SingleChoiceSettingDynamicDescriptions extends SettingsItem
|
||||
return mDescriptionValuesId;
|
||||
}
|
||||
|
||||
public int getSelectedValue(Settings settings)
|
||||
public int getSelectedValue()
|
||||
{
|
||||
return mSetting.getInt(settings);
|
||||
return mSetting.getInt();
|
||||
}
|
||||
|
||||
public MenuTag getMenuTag()
|
||||
|
@ -31,7 +31,7 @@ public abstract class SliderSetting extends SettingsItem
|
||||
mUnits = units;
|
||||
}
|
||||
|
||||
public abstract int getSelectedValue(Settings settings);
|
||||
public abstract int getSelectedValue();
|
||||
|
||||
public int getMin()
|
||||
{
|
||||
|
@ -94,19 +94,19 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getSelectedChoice(Settings settings)
|
||||
public String getSelectedChoice()
|
||||
{
|
||||
return getChoiceAt(getSelectedValueIndex(settings));
|
||||
return getChoiceAt(getSelectedValueIndex());
|
||||
}
|
||||
|
||||
public String getSelectedValue(Settings settings)
|
||||
public String getSelectedValue()
|
||||
{
|
||||
return mSetting.getString(settings);
|
||||
return mSetting.getString();
|
||||
}
|
||||
|
||||
public int getSelectedValueIndex(Settings settings)
|
||||
public int getSelectedValueIndex()
|
||||
{
|
||||
String selectedValue = getSelectedValue(settings);
|
||||
String selectedValue = getSelectedValue();
|
||||
for (int i = 0; i < mValues.length; i++)
|
||||
{
|
||||
if (mValues[i].equals(selectedValue))
|
||||
|
@ -26,9 +26,9 @@ public class SwitchSetting extends SettingsItem
|
||||
mSetting = setting;
|
||||
}
|
||||
|
||||
public boolean isChecked(Settings settings)
|
||||
public boolean isChecked()
|
||||
{
|
||||
return mSetting.getBoolean(settings);
|
||||
return mSetting.getBoolean();
|
||||
}
|
||||
|
||||
public void setChecked(Settings settings, boolean checked)
|
||||
|
@ -217,7 +217,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
|
||||
DialogInputStringBinding binding = DialogInputStringBinding.inflate(inflater);
|
||||
TextInputEditText input = binding.input;
|
||||
input.setText(item.getSelectedValue(getSettings()));
|
||||
input.setText(item.getSelectedValue());
|
||||
|
||||
mDialog = new MaterialAlertDialogBuilder(mView.getActivity())
|
||||
.setView(binding.getRoot())
|
||||
@ -226,7 +226,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
String editTextInput = input.getText().toString();
|
||||
|
||||
if (!item.getSelectedValue(mView.getSettings()).equals(editTextInput))
|
||||
if (!item.getSelectedValue().equals(editTextInput))
|
||||
{
|
||||
notifyItemChanged(position);
|
||||
mView.onSettingChanged();
|
||||
@ -272,7 +272,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
mDialog = new MaterialAlertDialogBuilder(mView.getActivity())
|
||||
.setTitle(item.getName())
|
||||
.setSingleChoiceItems(item.getChoices(), item.getSelectedValueIndex(getSettings()),
|
||||
.setSingleChoiceItems(item.getChoices(), item.getSelectedValueIndex(),
|
||||
this)
|
||||
.show();
|
||||
}
|
||||
@ -296,7 +296,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
mClickedItem = item;
|
||||
mClickedPosition = position;
|
||||
mSeekbarProgress = item.getSelectedValue(getSettings());
|
||||
mSeekbarProgress = item.getSelectedValue();
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(mView.getActivity());
|
||||
DialogSliderBinding binding = DialogSliderBinding.inflate(inflater);
|
||||
@ -430,8 +430,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI,
|
||||
filePicker.getSelectedValue(mView.getSettings()));
|
||||
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, filePicker.getSelectedValue());
|
||||
}
|
||||
|
||||
mView.getActivity().startActivityForResult(intent, filePicker.getRequestType());
|
||||
@ -441,7 +440,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
mClickedItem = item;
|
||||
mClickedPosition = position;
|
||||
long storedTime = Long.decode(item.getSelectedValue(mView.getSettings())) * 1000;
|
||||
long storedTime = Long.decode(item.getSelectedValue()) * 1000;
|
||||
|
||||
// Helper to extract hour and minute from epoch time
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@ -481,7 +480,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
epochTime += (long) timePicker.getHour() * 60 * 60;
|
||||
epochTime += (long) timePicker.getMinute() * 60;
|
||||
String rtcString = "0x" + Long.toHexString(epochTime);
|
||||
if (!item.getSelectedValue(mView.getSettings()).equals(rtcString))
|
||||
if (!item.getSelectedValue().equals(rtcString))
|
||||
{
|
||||
notifyItemChanged(mClickedPosition);
|
||||
mView.onSettingChanged();
|
||||
@ -498,7 +497,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
FilePicker filePicker = (FilePicker) mClickedItem;
|
||||
|
||||
if (!filePicker.getSelectedValue(mView.getSettings()).equals(selectedFile))
|
||||
if (!filePicker.getSelectedValue().equals(selectedFile))
|
||||
{
|
||||
notifyItemChanged(mClickedPosition);
|
||||
mView.onSettingChanged();
|
||||
@ -543,7 +542,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
SingleChoiceSetting scSetting = (SingleChoiceSetting) mClickedItem;
|
||||
|
||||
int value = getValueForSingleChoiceSelection(scSetting, which);
|
||||
if (scSetting.getSelectedValue(getSettings()) != value)
|
||||
if (scSetting.getSelectedValue() != value)
|
||||
mView.onSettingChanged();
|
||||
|
||||
scSetting.setSelectedValue(getSettings(), value);
|
||||
@ -556,7 +555,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
(SingleChoiceSettingDynamicDescriptions) mClickedItem;
|
||||
|
||||
int value = getValueForSingleChoiceDynamicDescriptionsSelection(scSetting, which);
|
||||
if (scSetting.getSelectedValue(getSettings()) != value)
|
||||
if (scSetting.getSelectedValue() != value)
|
||||
mView.onSettingChanged();
|
||||
|
||||
scSetting.setSelectedValue(getSettings(), value);
|
||||
@ -567,7 +566,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
{
|
||||
StringSingleChoiceSetting scSetting = (StringSingleChoiceSetting) mClickedItem;
|
||||
String value = scSetting.getValueAt(which);
|
||||
if (!scSetting.getSelectedValue(getSettings()).equals(value))
|
||||
if (!scSetting.getSelectedValue().equals(value))
|
||||
mView.onSettingChanged();
|
||||
|
||||
scSetting.setSelectedValue(getSettings(), value);
|
||||
@ -577,7 +576,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
else if (mClickedItem instanceof IntSliderSetting)
|
||||
{
|
||||
IntSliderSetting sliderSetting = (IntSliderSetting) mClickedItem;
|
||||
if (sliderSetting.getSelectedValue(getSettings()) != mSeekbarProgress)
|
||||
if (sliderSetting.getSelectedValue() != mSeekbarProgress)
|
||||
mView.onSettingChanged();
|
||||
|
||||
sliderSetting.setSelectedValue(getSettings(), mSeekbarProgress);
|
||||
@ -587,7 +586,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
else if (mClickedItem instanceof FloatSliderSetting)
|
||||
{
|
||||
FloatSliderSetting sliderSetting = (FloatSliderSetting) mClickedItem;
|
||||
if (sliderSetting.getSelectedValue(getSettings()) != mSeekbarProgress)
|
||||
if (sliderSetting.getSelectedValue() != mSeekbarProgress)
|
||||
mView.onSettingChanged();
|
||||
|
||||
sliderSetting.setSelectedValue(getSettings(), mSeekbarProgress);
|
||||
@ -637,7 +636,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
|
||||
private int getSelectionForSingleChoiceValue(SingleChoiceSetting item)
|
||||
{
|
||||
int value = item.getSelectedValue(getSettings());
|
||||
int value = item.getSelectedValue();
|
||||
int valuesId = item.getValuesId();
|
||||
|
||||
if (valuesId > 0)
|
||||
@ -679,7 +678,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||
private int getSelectionForSingleChoiceDynamicDescriptionsValue(
|
||||
SingleChoiceSettingDynamicDescriptions item)
|
||||
{
|
||||
int value = item.getSelectedValue(getSettings());
|
||||
int value = item.getSelectedValue();
|
||||
int valuesId = item.getValuesId();
|
||||
|
||||
if (valuesId > 0)
|
||||
|
@ -368,9 +368,9 @@ public final class SettingsFragmentPresenter
|
||||
AbstractIntSetting appTheme = new AbstractIntSetting()
|
||||
{
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return IntSetting.MAIN_INTERFACE_THEME.isOverridden(settings);
|
||||
return IntSetting.MAIN_INTERFACE_THEME.isOverridden();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -388,9 +388,9 @@ public final class SettingsFragmentPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(@NonNull Settings settings)
|
||||
public int getInt()
|
||||
{
|
||||
return IntSetting.MAIN_INTERFACE_THEME.getInt(settings);
|
||||
return IntSetting.MAIN_INTERFACE_THEME.getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -416,9 +416,9 @@ public final class SettingsFragmentPresenter
|
||||
AbstractIntSetting themeMode = new AbstractIntSetting()
|
||||
{
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return IntSetting.MAIN_INTERFACE_THEME_MODE.isOverridden(settings);
|
||||
return IntSetting.MAIN_INTERFACE_THEME_MODE.isOverridden();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -436,9 +436,9 @@ public final class SettingsFragmentPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(@NonNull Settings settings)
|
||||
public int getInt()
|
||||
{
|
||||
return IntSetting.MAIN_INTERFACE_THEME_MODE.getInt(settings);
|
||||
return IntSetting.MAIN_INTERFACE_THEME_MODE.getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -455,9 +455,9 @@ public final class SettingsFragmentPresenter
|
||||
AbstractBooleanSetting blackBackgrounds = new AbstractBooleanSetting()
|
||||
{
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.isOverridden(settings);
|
||||
return BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.isOverridden();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -474,9 +474,9 @@ public final class SettingsFragmentPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(@NonNull Settings settings)
|
||||
public boolean getBoolean()
|
||||
{
|
||||
return BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.getBoolean(settings);
|
||||
return BooleanSetting.MAIN_USE_BLACK_BACKGROUNDS.getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -500,15 +500,15 @@ public final class SettingsFragmentPresenter
|
||||
AbstractIntSetting dspEmulationEngine = new AbstractIntSetting()
|
||||
{
|
||||
@Override
|
||||
public int getInt(@NonNull Settings settings)
|
||||
public int getInt()
|
||||
{
|
||||
if (BooleanSetting.MAIN_DSP_HLE.getBoolean(settings))
|
||||
if (BooleanSetting.MAIN_DSP_HLE.getBoolean())
|
||||
{
|
||||
return DSP_HLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean jit = BooleanSetting.MAIN_DSP_JIT.getBoolean(settings);
|
||||
boolean jit = BooleanSetting.MAIN_DSP_JIT.getBoolean();
|
||||
return jit ? DSP_LLE_RECOMPILER : DSP_LLE_INTERPRETER;
|
||||
}
|
||||
}
|
||||
@ -536,10 +536,10 @@ public final class SettingsFragmentPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return BooleanSetting.MAIN_DSP_HLE.isOverridden(settings) ||
|
||||
BooleanSetting.MAIN_DSP_JIT.isOverridden(settings);
|
||||
return BooleanSetting.MAIN_DSP_HLE.isOverridden() ||
|
||||
BooleanSetting.MAIN_DSP_JIT.isOverridden();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -681,15 +681,15 @@ public final class SettingsFragmentPresenter
|
||||
AbstractIntSetting synchronizeGpuThread = new AbstractIntSetting()
|
||||
{
|
||||
@Override
|
||||
public int getInt(@NonNull Settings settings)
|
||||
public int getInt()
|
||||
{
|
||||
if (BooleanSetting.MAIN_SYNC_GPU.getBoolean(settings))
|
||||
if (BooleanSetting.MAIN_SYNC_GPU.getBoolean())
|
||||
{
|
||||
return SYNC_GPU_ALWAYS;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean syncOnSkipIdle = BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.getBoolean(settings);
|
||||
boolean syncOnSkipIdle = BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.getBoolean();
|
||||
return syncOnSkipIdle ? SYNC_GPU_ON_IDLE_SKIP : SYNC_GPU_NEVER;
|
||||
}
|
||||
}
|
||||
@ -717,10 +717,10 @@ public final class SettingsFragmentPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridden(@NonNull Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.isOverridden(settings) ||
|
||||
BooleanSetting.MAIN_SYNC_GPU.isOverridden(settings);
|
||||
return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.isOverridden() ||
|
||||
BooleanSetting.MAIN_SYNC_GPU.isOverridden();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -879,7 +879,7 @@ public final class SettingsFragmentPresenter
|
||||
R.string.texture_filtering, R.string.texture_filtering_description,
|
||||
R.array.textureFilteringEntries, R.array.textureFilteringValues));
|
||||
|
||||
int stereoModeValue = IntSetting.GFX_STEREO_MODE.getInt(mSettings);
|
||||
int stereoModeValue = IntSetting.GFX_STEREO_MODE.getInt();
|
||||
final int anaglyphMode = 3;
|
||||
String[] shaderList = stereoModeValue == anaglyphMode ?
|
||||
PostProcessing.getAnaglyphShaderList() : PostProcessing.getShaderList();
|
||||
@ -1216,7 +1216,7 @@ public final class SettingsFragmentPresenter
|
||||
sl.add(new SwitchSetting(mContext, new AbstractBooleanSetting()
|
||||
{
|
||||
@Override
|
||||
public boolean isOverridden(Settings settings)
|
||||
public boolean isOverridden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1228,20 +1228,20 @@ public final class SettingsFragmentPresenter
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(Settings settings)
|
||||
public boolean delete(@NonNull Settings settings)
|
||||
{
|
||||
mView.setMappingAllDevices(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(Settings settings)
|
||||
public boolean getBoolean()
|
||||
{
|
||||
return mView.isMappingAllDevices();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(Settings settings, boolean newValue)
|
||||
public void setBoolean(@NonNull Settings settings, boolean newValue)
|
||||
{
|
||||
mView.setMappingAllDevices(newValue);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class DateTimeSettingViewHolder(
|
||||
|
||||
override fun bind(item: SettingsItem) {
|
||||
mItem = item as DateTimeChoiceSetting
|
||||
val inputTime = mItem!!.getSelectedValue(adapter.settings)
|
||||
val inputTime = mItem!!.getSelectedValue()
|
||||
binding.textSettingName.text = item.getName()
|
||||
|
||||
if (!TextUtils.isEmpty(inputTime)) {
|
||||
|
@ -35,7 +35,7 @@ public final class FilePickerViewHolder extends SettingViewHolder
|
||||
mFilePicker = (FilePicker) item;
|
||||
mItem = item;
|
||||
|
||||
String path = mFilePicker.getSelectedValue(getAdapter().getSettings());
|
||||
String path = mFilePicker.getSelectedValue();
|
||||
|
||||
if (FileBrowserHelper.isPathEmptyOrValid(path))
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public final class InputStringSettingViewHolder extends SettingViewHolder
|
||||
{
|
||||
mInputString = (InputStringSetting) item;
|
||||
|
||||
String inputString = mInputString.getSelectedValue(getAdapter().getSettings());
|
||||
String inputString = mInputString.getSelectedValue();
|
||||
|
||||
mBinding.textSettingName.setText(item.getName());
|
||||
|
||||
|
@ -41,7 +41,7 @@ public abstract class SettingViewHolder extends RecyclerView.ViewHolder
|
||||
|
||||
protected void setStyle(TextView textView, SettingsItem settingsItem)
|
||||
{
|
||||
boolean overridden = settingsItem.isOverridden(mAdapter.getSettings());
|
||||
boolean overridden = settingsItem.isOverridden();
|
||||
textView.setTypeface(null, overridden ? Typeface.BOLD : Typeface.NORMAL);
|
||||
|
||||
if (!settingsItem.isEditable())
|
||||
|
@ -18,7 +18,7 @@ import org.dolphinemu.dolphinemu.features.settings.model.view.StringSingleChoice
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||
{
|
||||
@ -39,9 +39,6 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||
|
||||
mBinding.textSettingName.setText(item.getName());
|
||||
|
||||
SettingsAdapter adapter = getAdapter();
|
||||
Settings settings = adapter.getSettings();
|
||||
|
||||
if (!TextUtils.isEmpty(item.getDescription()))
|
||||
{
|
||||
mBinding.textSettingDescription.setText(item.getDescription());
|
||||
@ -49,7 +46,7 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||
else if (item instanceof SingleChoiceSetting)
|
||||
{
|
||||
SingleChoiceSetting setting = (SingleChoiceSetting) item;
|
||||
int selected = setting.getSelectedValue(settings);
|
||||
int selected = setting.getSelectedValue();
|
||||
Resources resMgr = mBinding.textSettingDescription.getContext().getResources();
|
||||
String[] choices = resMgr.getStringArray(setting.getChoicesId());
|
||||
int[] values = resMgr.getIntArray(setting.getValuesId());
|
||||
@ -64,14 +61,14 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||
else if (item instanceof StringSingleChoiceSetting)
|
||||
{
|
||||
StringSingleChoiceSetting setting = (StringSingleChoiceSetting) item;
|
||||
String choice = setting.getSelectedChoice(settings);
|
||||
String choice = setting.getSelectedChoice();
|
||||
mBinding.textSettingDescription.setText(choice);
|
||||
}
|
||||
else if (item instanceof SingleChoiceSettingDynamicDescriptions)
|
||||
{
|
||||
SingleChoiceSettingDynamicDescriptions setting =
|
||||
(SingleChoiceSettingDynamicDescriptions) item;
|
||||
int selected = setting.getSelectedValue(settings);
|
||||
int selected = setting.getSelectedValue();
|
||||
Resources resMgr = mBinding.textSettingDescription.getContext().getResources();
|
||||
String[] choices = resMgr.getStringArray(setting.getDescriptionChoicesId());
|
||||
int[] values = resMgr.getIntArray(setting.getDescriptionValuesId());
|
||||
@ -85,7 +82,7 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||
}
|
||||
|
||||
MenuTag menuTag = null;
|
||||
Function<Settings, Integer> getSelectedValue = null;
|
||||
Supplier<Integer> getSelectedValue = null;
|
||||
if (item instanceof SingleChoiceSetting)
|
||||
{
|
||||
SingleChoiceSetting setting = (SingleChoiceSetting) item;
|
||||
@ -99,15 +96,14 @@ public final class SingleChoiceViewHolder extends SettingViewHolder
|
||||
getSelectedValue = setting::getSelectedValueIndex;
|
||||
}
|
||||
|
||||
if (menuTag != null &&
|
||||
adapter.hasMenuTagActionForValue(menuTag, getSelectedValue.apply(settings)))
|
||||
if (menuTag != null && getAdapter().hasMenuTagActionForValue(menuTag, getSelectedValue.get()))
|
||||
{
|
||||
mBinding.buttonMoreSettings.setVisibility(View.VISIBLE);
|
||||
|
||||
final MenuTag finalMenuTag = menuTag;
|
||||
final Function<Settings, Integer> finalGetSelectedValue = getSelectedValue;
|
||||
final Supplier<Integer> finalGetSelectedValue = getSelectedValue;
|
||||
mBinding.buttonMoreSettings.setOnClickListener((view) ->
|
||||
adapter.onMenuTagAction(finalMenuTag, finalGetSelectedValue.apply(settings)));
|
||||
getAdapter().onMenuTagAction(finalMenuTag, finalGetSelectedValue.get()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -44,9 +44,8 @@ public final class SliderViewHolder extends SettingViewHolder
|
||||
}
|
||||
else
|
||||
{
|
||||
mBinding.textSettingDescription.setText(mContext
|
||||
.getString(R.string.slider_setting_value,
|
||||
mItem.getSelectedValue(getAdapter().getSettings()), mItem.getUnits()));
|
||||
mBinding.textSettingDescription.setText(mContext.getString(R.string.slider_setting_value,
|
||||
mItem.getSelectedValue(), mItem.getUnits()));
|
||||
}
|
||||
|
||||
setStyle(mBinding.textSettingName, mItem);
|
||||
|
@ -38,7 +38,7 @@ public final class SwitchSettingViewHolder extends SettingViewHolder
|
||||
mBinding.textSettingName.setText(item.getName());
|
||||
mBinding.textSettingDescription.setText(item.getDescription());
|
||||
|
||||
mBinding.settingSwitch.setChecked(mItem.isChecked(getAdapter().getSettings()));
|
||||
mBinding.settingSwitch.setChecked(mItem.isChecked());
|
||||
mBinding.settingSwitch.setEnabled(mItem.isEditable());
|
||||
|
||||
// Check for IPL to make sure user can skip.
|
||||
@ -56,14 +56,7 @@ public final class SwitchSettingViewHolder extends SettingViewHolder
|
||||
}
|
||||
}
|
||||
|
||||
if (mItem.isChecked(getAdapter().getSettings()))
|
||||
{
|
||||
mBinding.settingSwitch.setEnabled(iplExists);
|
||||
}
|
||||
else
|
||||
{
|
||||
mBinding.settingSwitch.setEnabled(true);
|
||||
}
|
||||
mBinding.settingSwitch.setEnabled(iplExists || !mItem.isChecked());
|
||||
}
|
||||
|
||||
mBinding.settingSwitch.setOnCheckedChangeListener((buttonView, isChecked) ->
|
||||
@ -95,7 +88,7 @@ public final class SwitchSettingViewHolder extends SettingViewHolder
|
||||
|
||||
if (mItem.getSetting() == BooleanSetting.MAIN_SKIP_IPL && !iplExists)
|
||||
{
|
||||
if (mItem.isChecked(getAdapter().getSettings()))
|
||||
if (mItem.isChecked())
|
||||
{
|
||||
showIplNotAvailableError();
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
||||
{
|
||||
int overlayX = mInputOverlay.getLeft();
|
||||
int overlayY = mInputOverlay.getTop();
|
||||
mInputOverlay.setSurfacePosition(activity.getSettings(), new Rect(
|
||||
mInputOverlay.setSurfacePosition(new Rect(
|
||||
surfaceView.getLeft() - overlayX, surfaceView.getTop() - overlayY,
|
||||
surfaceView.getRight() - overlayX, surfaceView.getBottom() - overlayY));
|
||||
});
|
||||
@ -135,7 +135,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
||||
super.onResume();
|
||||
|
||||
if (mInputOverlay != null && NativeLibrary.IsGameMetadataValid())
|
||||
mInputOverlay.refreshControls(activity.getSettings());
|
||||
mInputOverlay.refreshControls();
|
||||
|
||||
run(activity.isActivityRecreated());
|
||||
}
|
||||
@ -171,34 +171,34 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
||||
public void toggleInputOverlayVisibility(Settings settings)
|
||||
{
|
||||
BooleanSetting.MAIN_SHOW_INPUT_OVERLAY
|
||||
.setBoolean(settings, !BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBoolean(settings));
|
||||
.setBoolean(settings, !BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBoolean());
|
||||
|
||||
if (mInputOverlay != null)
|
||||
mInputOverlay.refreshControls(settings);
|
||||
mInputOverlay.refreshControls();
|
||||
}
|
||||
|
||||
public void initInputPointer(Settings settings)
|
||||
public void initInputPointer()
|
||||
{
|
||||
if (mInputOverlay != null)
|
||||
mInputOverlay.initTouchPointer(settings);
|
||||
mInputOverlay.initTouchPointer();
|
||||
}
|
||||
|
||||
public void refreshInputOverlay(Settings settings)
|
||||
public void refreshInputOverlay()
|
||||
{
|
||||
if (mInputOverlay != null)
|
||||
mInputOverlay.refreshControls(settings);
|
||||
mInputOverlay.refreshControls();
|
||||
}
|
||||
|
||||
public void refreshOverlayPointer(Settings settings)
|
||||
public void refreshOverlayPointer()
|
||||
{
|
||||
if (mInputOverlay != null)
|
||||
mInputOverlay.refreshOverlayPointer(settings);
|
||||
mInputOverlay.refreshOverlayPointer();
|
||||
}
|
||||
|
||||
public void resetInputOverlay(Settings settings)
|
||||
public void resetInputOverlay()
|
||||
{
|
||||
if (mInputOverlay != null)
|
||||
mInputOverlay.resetButtonPlacement(settings);
|
||||
mInputOverlay.resetButtonPlacement();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,6 @@ import org.dolphinemu.dolphinemu.features.input.model.controlleremu.EmulatedCont
|
||||
import org.dolphinemu.dolphinemu.features.input.model.controlleremu.NumericSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.IntSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -145,13 +144,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
requestFocus();
|
||||
}
|
||||
|
||||
public void setSurfacePosition(Settings settings, Rect rect)
|
||||
public void setSurfacePosition(Rect rect)
|
||||
{
|
||||
mSurfacePosition = rect;
|
||||
initTouchPointer(settings);
|
||||
initTouchPointer();
|
||||
}
|
||||
|
||||
public void initTouchPointer(Settings settings)
|
||||
public void initTouchPointer()
|
||||
{
|
||||
// Check if we have all the data we need yet
|
||||
boolean aspectRatioAvailable = NativeLibrary.IsRunningAndStarted();
|
||||
@ -164,7 +163,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
|
||||
int doubleTapButton = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getIntGlobal();
|
||||
|
||||
if (getConfiguredControllerType(settings) != InputOverlay.OVERLAY_WIIMOTE_CLASSIC &&
|
||||
if (getConfiguredControllerType() != InputOverlay.OVERLAY_WIIMOTE_CLASSIC &&
|
||||
doubleTapButton == ButtonType.CLASSIC_BUTTON_A)
|
||||
{
|
||||
doubleTapButton = ButtonType.WIIMOTE_BUTTON_A;
|
||||
@ -792,7 +791,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshControls(Settings settings)
|
||||
public void refreshControls()
|
||||
{
|
||||
unregisterControllers();
|
||||
|
||||
@ -805,11 +804,11 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ?
|
||||
"-Portrait" : "";
|
||||
|
||||
mControllerType = getConfiguredControllerType(settings);
|
||||
mControllerType = getConfiguredControllerType();
|
||||
|
||||
IntSetting controllerSetting = NativeLibrary.IsEmulatingWii() ?
|
||||
IntSetting.MAIN_OVERLAY_WII_CONTROLLER : IntSetting.MAIN_OVERLAY_GC_CONTROLLER;
|
||||
int controllerIndex = controllerSetting.getInt(settings);
|
||||
int controllerIndex = controllerSetting.getInt();
|
||||
|
||||
if (BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBooleanGlobal())
|
||||
{
|
||||
@ -817,7 +816,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
switch (mControllerType)
|
||||
{
|
||||
case OVERLAY_GAMECUBE:
|
||||
if (IntSetting.getSettingForSIDevice(controllerIndex).getInt(settings) ==
|
||||
if (IntSetting.getSettingForSIDevice(controllerIndex).getInt() ==
|
||||
DISABLED_GAMECUBE_CONTROLLER && mIsFirstRun)
|
||||
{
|
||||
Toast.makeText(getContext(), R.string.disabled_gc_overlay_notice, Toast.LENGTH_SHORT)
|
||||
@ -866,21 +865,21 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void refreshOverlayPointer(Settings settings)
|
||||
public void refreshOverlayPointer()
|
||||
{
|
||||
if (overlayPointer != null)
|
||||
{
|
||||
overlayPointer.setMode(IntSetting.MAIN_IR_MODE.getInt(settings));
|
||||
overlayPointer.setRecenter(BooleanSetting.MAIN_IR_ALWAYS_RECENTER.getBoolean(settings));
|
||||
overlayPointer.setMode(IntSetting.MAIN_IR_MODE.getInt());
|
||||
overlayPointer.setRecenter(BooleanSetting.MAIN_IR_ALWAYS_RECENTER.getBoolean());
|
||||
}
|
||||
}
|
||||
|
||||
public void resetButtonPlacement(Settings settings)
|
||||
public void resetButtonPlacement()
|
||||
{
|
||||
boolean isLandscape =
|
||||
getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
|
||||
final int controller = getConfiguredControllerType(settings);
|
||||
final int controller = getConfiguredControllerType();
|
||||
if (controller == OVERLAY_GAMECUBE)
|
||||
{
|
||||
if (isLandscape)
|
||||
@ -908,26 +907,26 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
wiiOnlyPortraitDefaultOverlay();
|
||||
}
|
||||
}
|
||||
refreshControls(settings);
|
||||
refreshControls();
|
||||
}
|
||||
|
||||
public static int getConfiguredControllerType(Settings settings)
|
||||
public static int getConfiguredControllerType()
|
||||
{
|
||||
IntSetting controllerSetting = NativeLibrary.IsEmulatingWii() ?
|
||||
IntSetting.MAIN_OVERLAY_WII_CONTROLLER : IntSetting.MAIN_OVERLAY_GC_CONTROLLER;
|
||||
int controllerIndex = controllerSetting.getInt(settings);
|
||||
int controllerIndex = controllerSetting.getInt();
|
||||
|
||||
if (controllerIndex >= 0 && controllerIndex < 4)
|
||||
{
|
||||
// GameCube controller
|
||||
if (IntSetting.getSettingForSIDevice(controllerIndex).getInt(settings) == 6)
|
||||
if (IntSetting.getSettingForSIDevice(controllerIndex).getInt() == 6)
|
||||
return OVERLAY_GAMECUBE;
|
||||
}
|
||||
else if (controllerIndex >= 4 && controllerIndex < 8)
|
||||
{
|
||||
// Wii Remote
|
||||
int wiimoteIndex = controllerIndex - 4;
|
||||
if (IntSetting.getSettingForWiimoteSource(wiimoteIndex).getInt(settings) == 1)
|
||||
if (IntSetting.getSettingForWiimoteSource(wiimoteIndex).getInt() == 1)
|
||||
{
|
||||
int attachmentIndex = EmulatedController.getSelectedWiimoteAttachment(wiimoteIndex);
|
||||
switch (attachmentIndex)
|
||||
@ -939,7 +938,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
||||
}
|
||||
|
||||
NumericSetting sidewaysSetting = EmulatedController.getSidewaysWiimoteSetting(wiimoteIndex);
|
||||
boolean sideways = new InputMappingBooleanSetting(sidewaysSetting).getBoolean(settings);
|
||||
boolean sideways = new InputMappingBooleanSetting(sidewaysSetting).getBoolean();
|
||||
|
||||
return sideways ? OVERLAY_WIIMOTE_SIDEWAYS : OVERLAY_WIIMOTE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user