mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Android: Add multiple save slots
This commit is contained in:
parent
a1453ee8a5
commit
de3696be4c
|
@ -43,6 +43,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
private boolean mApplySettingsOnSurfaceRestored = false;
|
||||
private String mGameTitle = null;
|
||||
private EmulationSurfaceView mContentView;
|
||||
private int mSaveStateSlot = 0;
|
||||
|
||||
private boolean getBooleanSetting(String key, boolean defaultValue) {
|
||||
return mPreferences.getBoolean(key, defaultValue);
|
||||
|
@ -269,25 +270,28 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
|
||||
private void showMenu() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
if (mGameTitle != null && !mGameTitle.isEmpty())
|
||||
builder.setTitle(mGameTitle);
|
||||
|
||||
builder.setItems(R.array.emulation_menu, (dialogInterface, i) -> {
|
||||
switch (i)
|
||||
{
|
||||
case 0: // Quick Load
|
||||
{
|
||||
AndroidHostInterface.getInstance().loadState(false, 0);
|
||||
AndroidHostInterface.getInstance().loadState(false, mSaveStateSlot);
|
||||
return;
|
||||
}
|
||||
|
||||
case 1: // Quick Save
|
||||
{
|
||||
AndroidHostInterface.getInstance().saveState(false, 0);
|
||||
AndroidHostInterface.getInstance().saveState(false, mSaveStateSlot);
|
||||
return;
|
||||
}
|
||||
|
||||
case 2: // Toggle Speed Limiter
|
||||
case 2: // Save State Slot
|
||||
{
|
||||
showSaveStateSlotMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
case 3: // Toggle Speed Limiter
|
||||
{
|
||||
boolean newSetting = !getBooleanSetting("Main/SpeedLimiterEnabled", true);
|
||||
setBooleanSetting("Main/SpeedLimiterEnabled", newSetting);
|
||||
|
@ -295,13 +299,13 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
return;
|
||||
}
|
||||
|
||||
case 3: // More Options
|
||||
case 4: // More Options
|
||||
{
|
||||
showMoreMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
case 4: // Quit
|
||||
case 5: // Quit
|
||||
{
|
||||
mStopRequested = true;
|
||||
finish();
|
||||
|
@ -313,6 +317,16 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
builder.create().show();
|
||||
}
|
||||
|
||||
private void showSaveStateSlotMenu() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setSingleChoiceItems(R.array.emulation_save_state_slot_menu, mSaveStateSlot, (dialogInterface, i) -> {
|
||||
mSaveStateSlot = i;
|
||||
dialogInterface.dismiss();
|
||||
});
|
||||
builder.setOnDismissListener(dialogInterface -> enableFullscreenImmersive());
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
private void showMoreMenu() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
if (mGameTitle != null && !mGameTitle.isEmpty())
|
||||
|
@ -351,12 +365,6 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
|||
startActivityForResult(intent, REQUEST_CODE_SETTINGS);
|
||||
return;
|
||||
}
|
||||
|
||||
case 5: // Quit
|
||||
{
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setOnDismissListener(dialogInterface -> enableFullscreenImmersive());
|
||||
|
|
|
@ -128,8 +128,9 @@
|
|||
<item>PerGameTitle</item>
|
||||
</string-array>
|
||||
<string-array name="emulation_menu">
|
||||
<item>Quick Load</item>
|
||||
<item>Quick Save</item>
|
||||
<item>Load State</item>
|
||||
<item>Save State</item>
|
||||
<item>Save State Slot</item>
|
||||
<item>Toggle Speed Limiter</item>
|
||||
<item>More Options</item>
|
||||
<item>Quit</item>
|
||||
|
@ -140,7 +141,19 @@
|
|||
<item>Change Disc</item>
|
||||
<item>Change Touchscreen Controller</item>
|
||||
<item>Settings</item>
|
||||
<item>Quit</item>
|
||||
</string-array>
|
||||
<string-array name="emulation_save_state_slot_menu">
|
||||
<item>Quick Slot</item>
|
||||
<item>Game Slot 1</item>
|
||||
<item>Game Slot 2</item>
|
||||
<item>Game Slot 3</item>
|
||||
<item>Game Slot 4</item>
|
||||
<item>Game Slot 5</item>
|
||||
<item>Game Slot 6</item>
|
||||
<item>Game Slot 7</item>
|
||||
<item>Game Slot 8</item>
|
||||
<item>Game Slot 9</item>
|
||||
<item>Game Slot 10</item>
|
||||
</string-array>
|
||||
<string-array name="settings_cdrom_read_speedup_entries">
|
||||
<item>None (Double Speed)</item>
|
||||
|
|
Loading…
Reference in a new issue