Android: Convert SharedPreferences to INI Settings (simple cases)
This commit is contained in:
parent
96cb27842a
commit
cc5802ba04
|
@ -114,7 +114,7 @@ public final class NativeLibrary
|
|||
public static final int NUNCHUK_SWING_UP = 208;
|
||||
public static final int NUNCHUK_SWING_DOWN = 209;
|
||||
public static final int NUNCHUK_SWING_LEFT = 210;
|
||||
public static final int NUNCHUK_SWING_RIGHT = 221;
|
||||
public static final int NUNCHUK_SWING_RIGHT = 211;
|
||||
public static final int NUNCHUK_SWING_FORWARD = 212;
|
||||
public static final int NUNCHUK_SWING_BACKWARD = 213;
|
||||
public static final int NUNCHUK_TILT = 214;
|
||||
|
|
|
@ -33,6 +33,8 @@ import androidx.fragment.app.FragmentManager;
|
|||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
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 org.dolphinemu.dolphinemu.features.settings.ui.MenuTag;
|
||||
import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivity;
|
||||
|
@ -149,7 +151,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
public static final int MENU_ACTION_SETTINGS_CORE = 34;
|
||||
public static final int MENU_ACTION_SETTINGS_GRAPHICS = 35;
|
||||
|
||||
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
private static final SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -248,7 +250,6 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
|
||||
editor.remove("wiiController");
|
||||
editor.remove("motionControlsEnabled");
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
@ -324,6 +325,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
if (!isChangingConfigurations())
|
||||
{
|
||||
mSettings.saveSettings(null, null);
|
||||
mEmulationFragment.saveTemporaryState();
|
||||
}
|
||||
outState.putStringArray(EXTRA_SELECTED_GAMES, mPaths);
|
||||
|
@ -359,7 +361,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
super.onResume();
|
||||
|
||||
if (!sIsGameCubeGame && mPreferences.getInt("motionControlsEnabled", 0) != 2)
|
||||
if (!sIsGameCubeGame && IntSetting.MAIN_MOTION_CONTROLS.getInt(mSettings) != 2)
|
||||
mMotionListener.enable();
|
||||
}
|
||||
|
||||
|
@ -481,9 +483,9 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
// Populate the checkbox value for joystick center on touch
|
||||
menu.findItem(R.id.menu_emulation_joystick_rel_center)
|
||||
.setChecked(mPreferences.getBoolean("joystickRelCenter", true));
|
||||
.setChecked(BooleanSetting.MAIN_JOYSTICK_REL_CENTER.getBoolean(mSettings));
|
||||
menu.findItem(R.id.menu_emulation_rumble)
|
||||
.setChecked(mPreferences.getBoolean("phoneRumble", true));
|
||||
.setChecked(BooleanSetting.MAIN_PHONE_RUMBLE.getBoolean(mSettings));
|
||||
|
||||
popup.setOnMenuItemClickListener(this::onOptionsItemSelected);
|
||||
|
||||
|
@ -693,16 +695,12 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
private void toggleJoystickRelCenter(boolean state)
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("joystickRelCenter", state);
|
||||
editor.commit();
|
||||
BooleanSetting.MAIN_JOYSTICK_REL_CENTER.setBoolean(mSettings, state);
|
||||
}
|
||||
|
||||
private void toggleRumble(boolean state)
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putBoolean("phoneRumble", state);
|
||||
editor.apply();
|
||||
BooleanSetting.MAIN_PHONE_RUMBLE.setBoolean(mSettings, state);
|
||||
Rumble.setPhoneVibrator(state, this);
|
||||
}
|
||||
|
||||
|
@ -748,71 +746,74 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
private void toggleControls()
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
boolean[] enabledButtons = new boolean[14];
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
|
||||
builder.setTitle(R.string.emulation_toggle_controls);
|
||||
if (sIsGameCubeGame || mPreferences.getInt("wiiController", 3) == 0)
|
||||
{
|
||||
for (int i = 0; i < enabledButtons.length; i++)
|
||||
boolean[] gcEnabledButtons = new boolean[11];
|
||||
String gcSettingBase = "MAIN_BUTTON_TOGGLE_GC_";
|
||||
|
||||
for (int i = 0; i < gcEnabledButtons.length; i++)
|
||||
{
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleGc" + i, true);
|
||||
gcEnabledButtons[i] = BooleanSetting.valueOf(gcSettingBase + i).getBoolean(mSettings);
|
||||
}
|
||||
builder.setMultiChoiceItems(R.array.gcpadButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleGc" + indexSelected, isChecked));
|
||||
builder.setMultiChoiceItems(R.array.gcpadButtons, gcEnabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> BooleanSetting
|
||||
.valueOf(gcSettingBase + indexSelected).setBoolean(mSettings, isChecked));
|
||||
}
|
||||
else if (mPreferences.getInt("wiiController", 3) == 4)
|
||||
{
|
||||
for (int i = 0; i < enabledButtons.length; i++)
|
||||
boolean[] wiiClassicEnabledButtons = new boolean[14];
|
||||
String classicSettingBase = "MAIN_BUTTON_TOGGLE_CLASSIC_";
|
||||
|
||||
for (int i = 0; i < wiiClassicEnabledButtons.length; i++)
|
||||
{
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleClassic" + i, true);
|
||||
wiiClassicEnabledButtons[i] =
|
||||
BooleanSetting.valueOf(classicSettingBase + i).getBoolean(mSettings);
|
||||
}
|
||||
builder.setMultiChoiceItems(R.array.classicButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleClassic" + indexSelected, isChecked));
|
||||
builder.setMultiChoiceItems(R.array.classicButtons, wiiClassicEnabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> BooleanSetting
|
||||
.valueOf(classicSettingBase + indexSelected)
|
||||
.setBoolean(mSettings, isChecked));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < enabledButtons.length; i++)
|
||||
boolean[] wiiEnabledButtons = new boolean[11];
|
||||
String wiiSettingBase = "MAIN_BUTTON_TOGGLE_WII_";
|
||||
|
||||
for (int i = 0; i < wiiEnabledButtons.length; i++)
|
||||
{
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleWii" + i, true);
|
||||
wiiEnabledButtons[i] = BooleanSetting.valueOf(wiiSettingBase + i).getBoolean(mSettings);
|
||||
}
|
||||
if (mPreferences.getInt("wiiController", 3) == 3)
|
||||
{
|
||||
builder.setMultiChoiceItems(R.array.nunchukButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
builder.setMultiChoiceItems(R.array.nunchukButtons, wiiEnabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> BooleanSetting
|
||||
.valueOf(wiiSettingBase + indexSelected).setBoolean(mSettings, isChecked));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.setMultiChoiceItems(R.array.wiimoteButtons, enabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> editor
|
||||
.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
builder.setMultiChoiceItems(R.array.wiimoteButtons, wiiEnabledButtons,
|
||||
(dialog, indexSelected, isChecked) -> BooleanSetting
|
||||
.valueOf(wiiSettingBase + indexSelected).setBoolean(mSettings, isChecked));
|
||||
}
|
||||
}
|
||||
builder.setNeutralButton(R.string.emulation_toggle_all,
|
||||
(dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility());
|
||||
(dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility(mSettings));
|
||||
builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
|
||||
{
|
||||
editor.apply();
|
||||
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
});
|
||||
mEmulationFragment.refreshInputOverlay());
|
||||
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public void chooseDoubleTapButton()
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
|
||||
|
||||
int currentController =
|
||||
mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUK);
|
||||
|
||||
int currentValue = mPreferences.getInt("doubleTapButton",
|
||||
InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(InputOverlayPointer.DOUBLE_TAP_A));
|
||||
int currentValue = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getInt(mSettings);
|
||||
|
||||
int buttonList = currentController == InputOverlay.OVERLAY_WIIMOTE_CLASSIC ?
|
||||
R.array.doubleTapWithClassic : R.array.doubleTap;
|
||||
|
@ -823,14 +824,12 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
currentValue = InputOverlay.OVERLAY_WIIMOTE;
|
||||
}
|
||||
|
||||
builder.setSingleChoiceItems(buttonList, currentValue, (DialogInterface dialog, int which) ->
|
||||
editor.putInt("doubleTapButton", InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(which)));
|
||||
builder.setSingleChoiceItems(buttonList, currentValue,
|
||||
(DialogInterface dialog, int which) -> IntSetting.MAIN_DOUBLE_TAP_BUTTON
|
||||
.setInt(mSettings, InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(which)));
|
||||
|
||||
builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
|
||||
{
|
||||
editor.commit();
|
||||
mEmulationFragment.initInputPointer();
|
||||
});
|
||||
mEmulationFragment.initInputPointer());
|
||||
|
||||
builder.show();
|
||||
}
|
||||
|
@ -845,7 +844,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
final TextView units = view.findViewById(R.id.text_units);
|
||||
|
||||
seekbar.setMax(150);
|
||||
seekbar.setProgress(mPreferences.getInt("controlScale", 50));
|
||||
seekbar.setProgress(IntSetting.MAIN_CONTROL_SCALE.getInt(mSettings));
|
||||
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
||||
{
|
||||
public void onStartTrackingTouch(SeekBar seekBar)
|
||||
|
@ -872,10 +871,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
builder.setView(view);
|
||||
builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
|
||||
{
|
||||
SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putInt("controlScale", seekbar.getProgress());
|
||||
editor.apply();
|
||||
|
||||
IntSetting.MAIN_CONTROL_SCALE.setInt(mSettings, seekbar.getProgress());
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
});
|
||||
|
||||
|
@ -913,14 +909,13 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
private void showMotionControlsOptions()
|
||||
{
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
|
||||
builder.setTitle(R.string.emulation_motion_controls);
|
||||
builder.setSingleChoiceItems(R.array.motionControlsEntries,
|
||||
mPreferences.getInt("motionControlsEnabled", 1),
|
||||
IntSetting.MAIN_MOTION_CONTROLS.getInt(mSettings),
|
||||
(dialog, indexSelected) ->
|
||||
{
|
||||
editor.putInt("motionControlsEnabled", indexSelected);
|
||||
IntSetting.MAIN_MOTION_CONTROLS.setInt(mSettings, indexSelected);
|
||||
|
||||
if (indexSelected != 2)
|
||||
mMotionListener.enable();
|
||||
|
@ -934,7 +929,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
NativeLibrary.ReloadWiimoteConfig();
|
||||
});
|
||||
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> editor.apply());
|
||||
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> dialogInterface.dismiss());
|
||||
|
||||
builder.show();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,86 @@ public enum BooleanSetting implements AbstractBooleanSetting
|
|||
MAIN_USE_GAME_COVERS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_GENERAL,
|
||||
"UseGameCovers", true),
|
||||
|
||||
MAIN_PHONE_RUMBLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"PhoneRumble", true),
|
||||
MAIN_SHOW_INPUT_OVERLAY(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ShowInputOverlay", true),
|
||||
|
||||
MAIN_BUTTON_TOGGLE_GC_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCButtonA", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCButtonB", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCButtonX", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCButtonY", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_4(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCButtonZ", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_5(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCButtonStart", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_6(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCTriggerL", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_7(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCTriggerR", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_8(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCDPad", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_9(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCStickMain", true),
|
||||
MAIN_BUTTON_TOGGLE_GC_10(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleGCStickC", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonA", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonB", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonX", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonY", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_4(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonPlus", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_5(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonMinus", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_6(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonHome", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_7(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicTriggerL", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_8(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicTriggerR", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_9(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonZL", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_10(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicButtonZR", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_11(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicDPad", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_12(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicStickLeft", true),
|
||||
MAIN_BUTTON_TOGGLE_CLASSIC_13(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleClassicStickRight", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_0(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButtonA", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_1(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButtonB", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_2(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButton1", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_3(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButton2", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_4(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButtonPlus", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_5(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButtonMinus", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_6(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteButtonHome", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_7(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleWiimoteDPad", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_8(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleNunchukC", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_9(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleNunchukZ", true),
|
||||
MAIN_BUTTON_TOGGLE_WII_10(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ButtonToggleNunchukStick", true),
|
||||
MAIN_JOYSTICK_REL_CENTER(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"JoystickRelCenter", true),
|
||||
|
||||
SYSCONF_SCREENSAVER(Settings.FILE_SYSCONF, "IPL", "SSV", false),
|
||||
SYSCONF_WIDESCREEN(Settings.FILE_SYSCONF, "IPL", "AR", true),
|
||||
SYSCONF_PAL60(Settings.FILE_SYSCONF, "IPL", "E60", true),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.features.settings.model;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.overlay.InputOverlayPointer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -19,6 +20,13 @@ public enum IntSetting implements AbstractIntSetting
|
|||
MAIN_AUDIO_VOLUME(Settings.FILE_DOLPHIN, Settings.SECTION_INI_DSP, "Volume", 100),
|
||||
|
||||
MAIN_LAST_PLATFORM_TAB(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID, "LastPlatformTab", 0),
|
||||
MAIN_MOTION_CONTROLS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID, "MotionControls", 1),
|
||||
|
||||
MAIN_CONTROL_SCALE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"ControlScale", 50),
|
||||
MAIN_DOUBLE_TAP_BUTTON(Settings.FILE_DOLPHIN, Settings.SECTION_INI_ANDROID,
|
||||
"DoubleTapButton",
|
||||
InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(InputOverlayPointer.DOUBLE_TAP_A)),
|
||||
|
||||
SYSCONF_LANGUAGE(Settings.FILE_SYSCONF, "IPL", "LNG", 0x01),
|
||||
SYSCONF_SOUND_MODE(Settings.FILE_SYSCONF, "IPL", "SND", 0x01),
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
|
@ -18,6 +16,8 @@ import androidx.fragment.app.Fragment;
|
|||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.overlay.InputOverlay;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
|
@ -27,8 +27,6 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||
{
|
||||
private static final String KEY_GAMEPATHS = "gamepaths";
|
||||
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
private InputOverlay mInputOverlay;
|
||||
|
||||
private EmulationState mEmulationState;
|
||||
|
@ -72,8 +70,6 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||
// So this fragment doesn't restart on configuration changes; i.e. rotation.
|
||||
setRetainInstance(true);
|
||||
|
||||
mPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
|
||||
String[] gamePaths = getArguments().getStringArray(KEY_GAMEPATHS);
|
||||
mEmulationState = new EmulationState(gamePaths, getTemporaryStateFilePath());
|
||||
}
|
||||
|
@ -124,20 +120,10 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||
super.onDetach();
|
||||
}
|
||||
|
||||
public void toggleInputOverlayVisibility()
|
||||
public void toggleInputOverlayVisibility(Settings settings)
|
||||
{
|
||||
SharedPreferences.Editor editor = mPreferences.edit();
|
||||
|
||||
// If the overlay is currently set to INVISIBLE
|
||||
if (!mPreferences.getBoolean("showInputOverlay", false))
|
||||
{
|
||||
editor.putBoolean("showInputOverlay", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
editor.putBoolean("showInputOverlay", false);
|
||||
}
|
||||
editor.commit();
|
||||
BooleanSetting.MAIN_SHOW_INPUT_OVERLAY
|
||||
.setBoolean(settings, !BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBoolean(settings));
|
||||
mInputOverlay.refreshControls();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.dolphinemu.dolphinemu.NativeLibrary.ButtonState;
|
|||
import org.dolphinemu.dolphinemu.NativeLibrary.ButtonType;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
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 org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.utils.IniFile;
|
||||
|
@ -67,7 +69,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
private InputOverlayDrawableDpad mDpadBeingConfigured;
|
||||
private InputOverlayDrawableJoystick mJoystickBeingConfigured;
|
||||
|
||||
private SharedPreferences mPreferences;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
// Buttons that have special positions in Wiimote only
|
||||
private static final ArrayList<Integer> WIIMOTE_H_BUTTONS = new ArrayList<>();
|
||||
|
@ -152,8 +154,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
|
||||
if (!EmulationActivity.isGameCubeGame())
|
||||
{
|
||||
int doubleTapButton = mPreferences.getInt("doubleTapButton",
|
||||
InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(InputOverlayPointer.DOUBLE_TAP_A));
|
||||
int doubleTapButton = IntSetting.MAIN_DOUBLE_TAP_BUTTON.getIntGlobal();
|
||||
|
||||
if (mPreferences.getInt("wiiController", OVERLAY_WIIMOTE_NUNCHUK) !=
|
||||
InputOverlay.OVERLAY_WIIMOTE_CLASSIC &&
|
||||
|
@ -493,47 +494,47 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
|
||||
private void addGameCubeOverlayControls(String orientation)
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleGc0", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_0.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_a,
|
||||
R.drawable.gcpad_a_pressed, ButtonType.BUTTON_A, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc1", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_1.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_b,
|
||||
R.drawable.gcpad_b_pressed, ButtonType.BUTTON_B, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc2", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_2.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_x,
|
||||
R.drawable.gcpad_x_pressed, ButtonType.BUTTON_X, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc3", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_3.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_y,
|
||||
R.drawable.gcpad_y_pressed, ButtonType.BUTTON_Y, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc4", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_4.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_z,
|
||||
R.drawable.gcpad_z_pressed, ButtonType.BUTTON_Z, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc5", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_5.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_start,
|
||||
R.drawable.gcpad_start_pressed, ButtonType.BUTTON_START, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc6", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_6.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_l,
|
||||
R.drawable.gcpad_l_pressed, ButtonType.TRIGGER_L, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc7", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_7.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.gcpad_r,
|
||||
R.drawable.gcpad_r_pressed, ButtonType.TRIGGER_R, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc8", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_8.getBooleanGlobal())
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
|
@ -541,13 +542,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
ButtonType.BUTTON_UP, ButtonType.BUTTON_DOWN,
|
||||
ButtonType.BUTTON_LEFT, ButtonType.BUTTON_RIGHT, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc9", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_9.getBooleanGlobal())
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed, ButtonType.STICK_MAIN,
|
||||
orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleGc10", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_GC_10.getBooleanGlobal())
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcpad_c, R.drawable.gcpad_c_pressed, ButtonType.STICK_C, orientation));
|
||||
|
@ -556,42 +557,42 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
|
||||
private void addWiimoteOverlayControls(String orientation)
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleWii0", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_0.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_a,
|
||||
R.drawable.wiimote_a_pressed, ButtonType.WIIMOTE_BUTTON_A, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii1", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_1.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_b,
|
||||
R.drawable.wiimote_b_pressed, ButtonType.WIIMOTE_BUTTON_B, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii2", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_2.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_one,
|
||||
R.drawable.wiimote_one_pressed, ButtonType.WIIMOTE_BUTTON_1, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii3", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_3.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_two,
|
||||
R.drawable.wiimote_two_pressed, ButtonType.WIIMOTE_BUTTON_2, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii4", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_4.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus,
|
||||
R.drawable.wiimote_plus_pressed, ButtonType.WIIMOTE_BUTTON_PLUS, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii5", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_5.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus,
|
||||
R.drawable.wiimote_minus_pressed, ButtonType.WIIMOTE_BUTTON_MINUS, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii6", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_6.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home,
|
||||
R.drawable.wiimote_home_pressed, ButtonType.WIIMOTE_BUTTON_HOME, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii7", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_7.getBooleanGlobal())
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
|
@ -603,17 +604,17 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
|
||||
private void addNunchukOverlayControls(String orientation)
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleWii8", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_8.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_c,
|
||||
R.drawable.nunchuk_c_pressed, ButtonType.NUNCHUK_BUTTON_C, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii9", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_9.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.nunchuk_z,
|
||||
R.drawable.nunchuk_z_pressed, ButtonType.NUNCHUK_BUTTON_Z, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleWii10", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_WII_10.getBooleanGlobal())
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
|
||||
|
@ -623,62 +624,62 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
|
||||
private void addClassicOverlayControls(String orientation)
|
||||
{
|
||||
if (mPreferences.getBoolean("buttonToggleClassic0", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_0.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_a,
|
||||
R.drawable.classic_a_pressed, ButtonType.CLASSIC_BUTTON_A, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic1", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_1.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_b,
|
||||
R.drawable.classic_b_pressed, ButtonType.CLASSIC_BUTTON_B, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic2", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_2.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_x,
|
||||
R.drawable.classic_x_pressed, ButtonType.CLASSIC_BUTTON_X, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic3", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_3.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_y,
|
||||
R.drawable.classic_y_pressed, ButtonType.CLASSIC_BUTTON_Y, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic4", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_4.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_plus,
|
||||
R.drawable.wiimote_plus_pressed, ButtonType.CLASSIC_BUTTON_PLUS, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic5", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_5.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_minus,
|
||||
R.drawable.wiimote_minus_pressed, ButtonType.CLASSIC_BUTTON_MINUS, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic6", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_6.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.wiimote_home,
|
||||
R.drawable.wiimote_home_pressed, ButtonType.CLASSIC_BUTTON_HOME, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic7", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_7.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_l,
|
||||
R.drawable.classic_l_pressed, ButtonType.CLASSIC_TRIGGER_L, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic8", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_8.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_r,
|
||||
R.drawable.classic_r_pressed, ButtonType.CLASSIC_TRIGGER_R, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic9", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_9.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zl,
|
||||
R.drawable.classic_zl_pressed, ButtonType.CLASSIC_BUTTON_ZL, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic10", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_10.getBooleanGlobal())
|
||||
{
|
||||
overlayButtons.add(initializeOverlayButton(getContext(), R.drawable.classic_zr,
|
||||
R.drawable.classic_zr_pressed, ButtonType.CLASSIC_BUTTON_ZR, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic11", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_11.getBooleanGlobal())
|
||||
{
|
||||
overlayDpads.add(initializeOverlayDpad(getContext(), R.drawable.gcwii_dpad,
|
||||
R.drawable.gcwii_dpad_pressed_one_direction,
|
||||
|
@ -686,13 +687,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
ButtonType.CLASSIC_DPAD_UP, ButtonType.CLASSIC_DPAD_DOWN,
|
||||
ButtonType.CLASSIC_DPAD_LEFT, ButtonType.CLASSIC_DPAD_RIGHT, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic12", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_12.getBooleanGlobal())
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
|
||||
ButtonType.CLASSIC_STICK_LEFT, orientation));
|
||||
}
|
||||
if (mPreferences.getBoolean("buttonToggleClassic13", true))
|
||||
if (BooleanSetting.MAIN_BUTTON_TOGGLE_CLASSIC_13.getBooleanGlobal())
|
||||
{
|
||||
overlayJoysticks.add(initializeOverlayJoystick(getContext(), R.drawable.gcwii_joystick_range,
|
||||
R.drawable.gcwii_joystick, R.drawable.gcwii_joystick_pressed,
|
||||
|
@ -711,7 +712,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ?
|
||||
"-Portrait" : "";
|
||||
|
||||
if (mPreferences.getBoolean("showInputOverlay", true))
|
||||
if (BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBooleanGlobal())
|
||||
{
|
||||
// Add all the enabled overlay items back to the HashSet.
|
||||
if (EmulationActivity.isGameCubeGame())
|
||||
|
@ -928,7 +929,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
break;
|
||||
}
|
||||
|
||||
scale *= (sPrefs.getInt("controlScale", 50) + 50);
|
||||
scale *= (IntSetting.MAIN_CONTROL_SCALE.getIntGlobal() + 50);
|
||||
scale /= 100;
|
||||
|
||||
// Initialize the InputOverlayDrawableButton.
|
||||
|
@ -1006,7 +1007,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
break;
|
||||
}
|
||||
|
||||
scale *= (sPrefs.getInt("controlScale", 50) + 50);
|
||||
scale *= (IntSetting.MAIN_CONTROL_SCALE.getIntGlobal() + 50);
|
||||
scale /= 100;
|
||||
|
||||
// Initialize the InputOverlayDrawableDpad.
|
||||
|
@ -1063,7 +1064,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
|
||||
// Decide scale based on user preference
|
||||
float scale = 0.275f;
|
||||
scale *= (sPrefs.getInt("controlScale", 50) + 50);
|
||||
scale *= (IntSetting.MAIN_CONTROL_SCALE.getIntGlobal() + 50);
|
||||
scale /= 100;
|
||||
|
||||
// Initialize the InputOverlayDrawableJoystick.
|
||||
|
@ -1096,10 +1097,9 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
Rect innerRect = new Rect(0, 0, (int) (outerSize / innerScale), (int) (outerSize / innerScale));
|
||||
|
||||
// Send the drawableId to the joystick so it can be referenced when saving control position.
|
||||
final InputOverlayDrawableJoystick overlayDrawable
|
||||
= new InputOverlayDrawableJoystick(res, bitmapOuter,
|
||||
bitmapInnerDefault, bitmapInnerPressed,
|
||||
outerRect, innerRect, joystick, sPrefs);
|
||||
final InputOverlayDrawableJoystick overlayDrawable =
|
||||
new InputOverlayDrawableJoystick(res, bitmapOuter, bitmapInnerDefault,
|
||||
bitmapInnerPressed, outerRect, innerRect, joystick);
|
||||
|
||||
// Need to set the image's position
|
||||
overlayDrawable.setPosition(drawableX, drawableY);
|
||||
|
@ -1236,7 +1236,6 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
|
|||
sPrefsEditor.commit();
|
||||
}
|
||||
|
||||
|
||||
private void gcPortraitDefaultOverlay()
|
||||
{
|
||||
SharedPreferences.Editor sPrefsEditor = mPreferences.edit();
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
package org.dolphinemu.dolphinemu.overlay;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -15,6 +14,7 @@ import android.graphics.drawable.BitmapDrawable;
|
|||
import android.view.MotionEvent;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
|
||||
|
||||
/**
|
||||
* Custom {@link BitmapDrawable} that is capable
|
||||
|
@ -22,22 +22,20 @@ import org.dolphinemu.dolphinemu.NativeLibrary;
|
|||
*/
|
||||
public final class InputOverlayDrawableJoystick
|
||||
{
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
private final int[] axisIDs = {0, 0, 0, 0};
|
||||
private final float[] axises = {0f, 0f};
|
||||
private int trackId = -1;
|
||||
private int mJoystickType;
|
||||
private final int mJoystickType;
|
||||
private int mControlPositionX, mControlPositionY;
|
||||
private int mPreviousTouchX, mPreviousTouchY;
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
private final int mWidth;
|
||||
private final int mHeight;
|
||||
private Rect mVirtBounds;
|
||||
private Rect mOrigBounds;
|
||||
private BitmapDrawable mOuterBitmap;
|
||||
private BitmapDrawable mDefaultStateInnerBitmap;
|
||||
private BitmapDrawable mPressedStateInnerBitmap;
|
||||
private BitmapDrawable mBoundsBoxBitmap;
|
||||
private final BitmapDrawable mOuterBitmap;
|
||||
private final BitmapDrawable mDefaultStateInnerBitmap;
|
||||
private final BitmapDrawable mPressedStateInnerBitmap;
|
||||
private final BitmapDrawable mBoundsBoxBitmap;
|
||||
private boolean mPressedState = false;
|
||||
|
||||
/**
|
||||
|
@ -51,9 +49,8 @@ public final class InputOverlayDrawableJoystick
|
|||
* @param rectInner {@link Rect} which represents the inner joystick bounds.
|
||||
* @param joystick Identifier for which joystick this is.
|
||||
*/
|
||||
public InputOverlayDrawableJoystick(Resources res, Bitmap bitmapOuter,
|
||||
Bitmap bitmapInnerDefault, Bitmap bitmapInnerPressed,
|
||||
Rect rectOuter, Rect rectInner, int joystick, SharedPreferences prefsHandle)
|
||||
public InputOverlayDrawableJoystick(Resources res, Bitmap bitmapOuter, Bitmap bitmapInnerDefault,
|
||||
Bitmap bitmapInnerPressed, Rect rectOuter, Rect rectInner, int joystick)
|
||||
{
|
||||
axisIDs[0] = joystick + 1;
|
||||
axisIDs[1] = joystick + 2;
|
||||
|
@ -61,7 +58,6 @@ public final class InputOverlayDrawableJoystick
|
|||
axisIDs[3] = joystick + 4;
|
||||
mJoystickType = joystick;
|
||||
|
||||
mPreferences = prefsHandle;
|
||||
mOuterBitmap = new BitmapDrawable(res, bitmapOuter);
|
||||
mDefaultStateInnerBitmap = new BitmapDrawable(res, bitmapInnerDefault);
|
||||
mPressedStateInnerBitmap = new BitmapDrawable(res, bitmapInnerPressed);
|
||||
|
@ -98,7 +94,7 @@ public final class InputOverlayDrawableJoystick
|
|||
|
||||
public boolean TrackEvent(MotionEvent event)
|
||||
{
|
||||
boolean reCenter = mPreferences.getBoolean("joystickRelCenter", true);
|
||||
boolean reCenter = BooleanSetting.MAIN_JOYSTICK_REL_CENTER.getBooleanGlobal();
|
||||
int pointerIndex = event.getActionIndex();
|
||||
boolean pressed = false;
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ import android.content.Context;
|
|||
import android.os.Build;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.SparseArray;
|
||||
import android.view.InputDevice;
|
||||
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.AdHocStringSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class Rumble
|
|||
{
|
||||
clear();
|
||||
|
||||
if (PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("phoneRumble", true))
|
||||
if (BooleanSetting.MAIN_PHONE_RUMBLE.getBooleanGlobal())
|
||||
{
|
||||
setPhoneVibrator(true, activity);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue