Android: Require user to enable savestate menus
With the nature of android updates invalidating save states, it's best to hide these options unless enabled by the user. The option to use savestates can now be enabled via the General settings menu.
This commit is contained in:
parent
58b0a284a8
commit
e52be87bf1
|
@ -33,6 +33,9 @@ import com.squareup.picasso.Picasso;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||||
|
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||||
import org.dolphinemu.dolphinemu.fragments.EmulationFragment;
|
import org.dolphinemu.dolphinemu.fragments.EmulationFragment;
|
||||||
import org.dolphinemu.dolphinemu.fragments.MenuFragment;
|
import org.dolphinemu.dolphinemu.fragments.MenuFragment;
|
||||||
import org.dolphinemu.dolphinemu.fragments.SaveLoadStateFragment;
|
import org.dolphinemu.dolphinemu.fragments.SaveLoadStateFragment;
|
||||||
|
@ -65,6 +68,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
private SharedPreferences mPreferences;
|
private SharedPreferences mPreferences;
|
||||||
private ControllerMappingHelper mControllerMappingHelper;
|
private ControllerMappingHelper mControllerMappingHelper;
|
||||||
|
|
||||||
|
private Settings mSettings;
|
||||||
|
|
||||||
// So that MainActivity knows which view to invalidate before the return animation.
|
// So that MainActivity knows which view to invalidate before the return animation.
|
||||||
private int mPosition;
|
private int mPosition;
|
||||||
|
|
||||||
|
@ -212,6 +217,8 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
mPlatform = gameToEmulate.getIntExtra(EXTRA_PLATFORM, 0);
|
mPlatform = gameToEmulate.getIntExtra(EXTRA_PLATFORM, 0);
|
||||||
mScreenPath = gameToEmulate.getStringExtra(EXTRA_SCREEN_PATH);
|
mScreenPath = gameToEmulate.getStringExtra(EXTRA_SCREEN_PATH);
|
||||||
mPosition = gameToEmulate.getIntExtra(EXTRA_GRID_POSITION, -1);
|
mPosition = gameToEmulate.getIntExtra(EXTRA_GRID_POSITION, -1);
|
||||||
|
mSettings = new Settings();
|
||||||
|
mSettings.loadSettings(null);
|
||||||
activityRecreated = false;
|
activityRecreated = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -476,6 +483,17 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
getMenuInflater().inflate(R.menu.menu_emulation_wii, menu);
|
getMenuInflater().inflate(R.menu.menu_emulation_wii, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BooleanSetting enableSaveStates =
|
||||||
|
(BooleanSetting) mSettings.getSection(Settings.SECTION_INI_CORE)
|
||||||
|
.getSetting(SettingsFile.KEY_ENABLE_SAVE_STATES);
|
||||||
|
if (enableSaveStates != null && enableSaveStates.getValue())
|
||||||
|
{
|
||||||
|
menu.findItem(R.id.menu_quicksave).setVisible(true);
|
||||||
|
menu.findItem(R.id.menu_quickload).setVisible(true);
|
||||||
|
menu.findItem(R.id.menu_emulation_save_root).setVisible(true);
|
||||||
|
menu.findItem(R.id.menu_emulation_load_root).setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Populate the checkbox value for joystick center on touch
|
// Populate the checkbox value for joystick center on touch
|
||||||
menu.findItem(R.id.menu_emulation_joystick_rel_center)
|
menu.findItem(R.id.menu_emulation_joystick_rel_center)
|
||||||
.setChecked(mPreferences.getBoolean("joystickRelCenter", true));
|
.setChecked(mPreferences.getBoolean("joystickRelCenter", true));
|
||||||
|
@ -929,4 +947,9 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
{
|
{
|
||||||
return activityRecreated;
|
return activityRecreated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Settings getSettings()
|
||||||
|
{
|
||||||
|
return mSettings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,7 @@ public final class SettingsFragmentPresenter
|
||||||
Setting speedLimit = null;
|
Setting speedLimit = null;
|
||||||
Setting audioStretch = null;
|
Setting audioStretch = null;
|
||||||
Setting analytics = null;
|
Setting analytics = null;
|
||||||
|
Setting enableSaveState;
|
||||||
|
|
||||||
SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
|
SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
|
||||||
SettingSection analyticsSection = mSettings.getSection(Settings.SECTION_ANALYTICS);
|
SettingSection analyticsSection = mSettings.getSection(Settings.SECTION_ANALYTICS);
|
||||||
|
@ -221,6 +222,7 @@ public final class SettingsFragmentPresenter
|
||||||
speedLimit = coreSection.getSetting(SettingsFile.KEY_SPEED_LIMIT);
|
speedLimit = coreSection.getSetting(SettingsFile.KEY_SPEED_LIMIT);
|
||||||
audioStretch = coreSection.getSetting(SettingsFile.KEY_AUDIO_STRETCH);
|
audioStretch = coreSection.getSetting(SettingsFile.KEY_AUDIO_STRETCH);
|
||||||
analytics = analyticsSection.getSetting(SettingsFile.KEY_ANALYTICS_ENABLED);
|
analytics = analyticsSection.getSetting(SettingsFile.KEY_ANALYTICS_ENABLED);
|
||||||
|
enableSaveState = coreSection.getSetting(SettingsFile.KEY_ENABLE_SAVE_STATES);
|
||||||
|
|
||||||
// TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying.
|
// TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying.
|
||||||
// The proper solution would be to have one emuCoresEntries and one emuCoresValues
|
// The proper solution would be to have one emuCoresEntries and one emuCoresValues
|
||||||
|
@ -257,6 +259,9 @@ public final class SettingsFragmentPresenter
|
||||||
R.string.speed_limit, 0, 200, "%", 100, speedLimit));
|
R.string.speed_limit, 0, 200, "%", 100, speedLimit));
|
||||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_AUDIO_STRETCH, Settings.SECTION_INI_CORE,
|
sl.add(new CheckBoxSetting(SettingsFile.KEY_AUDIO_STRETCH, Settings.SECTION_INI_CORE,
|
||||||
R.string.audio_stretch, R.string.audio_stretch_description, false, audioStretch));
|
R.string.audio_stretch, R.string.audio_stretch_description, false, audioStretch));
|
||||||
|
sl.add(new CheckBoxSetting(SettingsFile.KEY_ENABLE_SAVE_STATES, Settings.SECTION_INI_CORE,
|
||||||
|
R.string.enable_save_states, R.string.enable_save_states_description, false,
|
||||||
|
enableSaveState));
|
||||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS,
|
sl.add(new CheckBoxSetting(SettingsFile.KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS,
|
||||||
R.string.analytics, 0, false, analytics));
|
R.string.analytics, 0, false, analytics));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ public final class SettingsFile
|
||||||
public static final String KEY_OVERRIDE_GAME_CUBE_LANGUAGE = "OverrideGCLang";
|
public static final String KEY_OVERRIDE_GAME_CUBE_LANGUAGE = "OverrideGCLang";
|
||||||
public static final String KEY_SLOT_A_DEVICE = "SlotA";
|
public static final String KEY_SLOT_A_DEVICE = "SlotA";
|
||||||
public static final String KEY_SLOT_B_DEVICE = "SlotB";
|
public static final String KEY_SLOT_B_DEVICE = "SlotB";
|
||||||
|
public static final String KEY_ENABLE_SAVE_STATES = "EnableSaveStates";
|
||||||
|
|
||||||
public static final String KEY_ANALYTICS_ENABLED = "Enabled";
|
public static final String KEY_ANALYTICS_ENABLED = "Enabled";
|
||||||
public static final String KEY_ANALYTICS_PERMISSION_ASKED = "PermissionAsked";
|
public static final String KEY_ANALYTICS_PERMISSION_ASKED = "PermissionAsked";
|
||||||
|
|
|
@ -13,6 +13,9 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
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.features.settings.utils.SettingsFile;
|
||||||
|
|
||||||
public final class MenuFragment extends Fragment implements View.OnClickListener
|
public final class MenuFragment extends Fragment implements View.OnClickListener
|
||||||
{
|
{
|
||||||
|
@ -53,6 +56,20 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
|
||||||
View rootView = inflater.inflate(R.layout.fragment_ingame_menu, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_ingame_menu, container, false);
|
||||||
|
|
||||||
LinearLayout options = (LinearLayout) rootView.findViewById(R.id.layout_options);
|
LinearLayout options = (LinearLayout) rootView.findViewById(R.id.layout_options);
|
||||||
|
|
||||||
|
BooleanSetting enableSaveStates =
|
||||||
|
(BooleanSetting) ((EmulationActivity) getActivity()).getSettings()
|
||||||
|
.getSection(Settings.SECTION_INI_CORE)
|
||||||
|
.getSetting(SettingsFile.KEY_ENABLE_SAVE_STATES);
|
||||||
|
|
||||||
|
if (enableSaveStates != null && enableSaveStates.getValue())
|
||||||
|
{
|
||||||
|
options.findViewById(R.id.menu_quicksave).setVisibility(View.VISIBLE);
|
||||||
|
options.findViewById(R.id.menu_quickload).setVisibility(View.VISIBLE);
|
||||||
|
options.findViewById(R.id.menu_emulation_save_root).setVisibility(View.VISIBLE);
|
||||||
|
options.findViewById(R.id.menu_emulation_load_root).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
for (int childIndex = 0; childIndex < options.getChildCount(); childIndex++)
|
for (int childIndex = 0; childIndex < options.getChildCount(); childIndex++)
|
||||||
{
|
{
|
||||||
Button button = (Button) options.getChildAt(childIndex);
|
Button button = (Button) options.getChildAt(childIndex);
|
||||||
|
|
|
@ -35,22 +35,26 @@
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_quicksave"
|
android:id="@+id/menu_quicksave"
|
||||||
android:text="@string/emulation_quicksave"
|
android:text="@string/emulation_quicksave"
|
||||||
style="@style/InGameMenuOption"/>
|
style="@style/InGameMenuOption"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_quickload"
|
android:id="@+id/menu_quickload"
|
||||||
android:text="@string/emulation_quickload"
|
android:text="@string/emulation_quickload"
|
||||||
style="@style/InGameMenuOption"/>
|
style="@style/InGameMenuOption"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_emulation_save_root"
|
android:id="@+id/menu_emulation_save_root"
|
||||||
android:text="@string/emulation_savestate"
|
android:text="@string/emulation_savestate"
|
||||||
style="@style/InGameMenuOption"/>
|
style="@style/InGameMenuOption"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_emulation_load_root"
|
android:id="@+id/menu_emulation_load_root"
|
||||||
android:text="@string/emulation_loadstate"
|
android:text="@string/emulation_loadstate"
|
||||||
style="@style/InGameMenuOption"/>
|
style="@style/InGameMenuOption"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_refresh_wiimotes"
|
android:id="@+id/menu_refresh_wiimotes"
|
||||||
|
|
|
@ -13,19 +13,22 @@
|
||||||
android:id="@+id/menu_quicksave"
|
android:id="@+id/menu_quicksave"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:icon="@drawable/ic_quicksave"
|
android:icon="@drawable/ic_quicksave"
|
||||||
android:title="@string/emulation_quicksave"/>
|
android:title="@string/emulation_quicksave"
|
||||||
|
android:visible="false"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_quickload"
|
android:id="@+id/menu_quickload"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:icon="@drawable/ic_quickload"
|
android:icon="@drawable/ic_quickload"
|
||||||
android:title="@string/emulation_quickload"/>
|
android:title="@string/emulation_quickload"
|
||||||
|
android:visible="false"/>
|
||||||
|
|
||||||
<!-- Save State Slots -->
|
<!-- Save State Slots -->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_save_root"
|
android:id="@+id/menu_emulation_save_root"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/emulation_savestate">
|
android:title="@string/emulation_savestate"
|
||||||
|
android:visible="false">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_save_1"
|
android:id="@+id/menu_emulation_save_1"
|
||||||
|
@ -53,7 +56,8 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_load_root"
|
android:id="@+id/menu_emulation_load_root"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/emulation_loadstate">
|
android:title="@string/emulation_loadstate"
|
||||||
|
android:visible="false">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_load_1"
|
android:id="@+id/menu_emulation_load_1"
|
||||||
|
|
|
@ -13,19 +13,22 @@
|
||||||
android:id="@+id/menu_quicksave"
|
android:id="@+id/menu_quicksave"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:icon="@drawable/ic_quicksave"
|
android:icon="@drawable/ic_quicksave"
|
||||||
android:title="@string/emulation_quicksave"/>
|
android:title="@string/emulation_quicksave"
|
||||||
|
android:visible="false"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_quickload"
|
android:id="@+id/menu_quickload"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:icon="@drawable/ic_quickload"
|
android:icon="@drawable/ic_quickload"
|
||||||
android:title="@string/emulation_quickload"/>
|
android:title="@string/emulation_quickload"
|
||||||
|
android:visible="false"/>
|
||||||
|
|
||||||
<!-- Save State Slots -->
|
<!-- Save State Slots -->
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_save_root"
|
android:id="@+id/menu_emulation_save_root"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/emulation_savestate">
|
android:title="@string/emulation_savestate"
|
||||||
|
android:visible="false">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_save_1"
|
android:id="@+id/menu_emulation_save_1"
|
||||||
|
@ -53,7 +56,8 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_load_root"
|
android:id="@+id/menu_emulation_load_root"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"
|
||||||
android:title="@string/emulation_loadstate">
|
android:title="@string/emulation_loadstate"
|
||||||
|
android:visible="false">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_emulation_load_1"
|
android:id="@+id/menu_emulation_load_1"
|
||||||
|
|
|
@ -135,6 +135,8 @@
|
||||||
<string name="wiimote_speaker_description">Enable sound output through the speaker on a real Wiimote (DolphinBar required).</string>
|
<string name="wiimote_speaker_description">Enable sound output through the speaker on a real Wiimote (DolphinBar required).</string>
|
||||||
<string name="audio_stretch">Audio Stretching</string>
|
<string name="audio_stretch">Audio Stretching</string>
|
||||||
<string name="audio_stretch_description">Stretches audio to reduce stuttering. Increases latency.</string>
|
<string name="audio_stretch_description">Stretches audio to reduce stuttering. Increases latency.</string>
|
||||||
|
<string name="enable_save_states">Enable Savestates</string>
|
||||||
|
<string name="enable_save_states_description">WARNING: Savestates may not be compatible with future versions of Dolphin and can make it impossible to create normal saves in some cases. Never use savestates as the only way of saving your progress.</string>
|
||||||
<string name="analytics">Enable usage statistics reporting</string>
|
<string name="analytics">Enable usage statistics reporting</string>
|
||||||
<string name="analytics_desc">If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings.</string>
|
<string name="analytics_desc">If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings.</string>
|
||||||
<string name="gametdb_thanks">Thanks to GameTDB.com for providing GameCube and Wii covers!</string>
|
<string name="gametdb_thanks">Thanks to GameTDB.com for providing GameCube and Wii covers!</string>
|
||||||
|
|
Loading…
Reference in New Issue