diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java index a0130b1aa..7c89f39b2 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/EmulationActivity.java @@ -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()); diff --git a/android/app/src/main/res/values/arrays.xml b/android/app/src/main/res/values/arrays.xml index d8940d7f5..d57a996cc 100644 --- a/android/app/src/main/res/values/arrays.xml +++ b/android/app/src/main/res/values/arrays.xml @@ -128,8 +128,9 @@ PerGameTitle - Quick Load - Quick Save + Load State + Save State + Save State Slot Toggle Speed Limiter More Options Quit @@ -140,7 +141,19 @@ Change Disc Change Touchscreen Controller Settings - Quit + + + Quick Slot + Game Slot 1 + Game Slot 2 + Game Slot 3 + Game Slot 4 + Game Slot 5 + Game Slot 6 + Game Slot 7 + Game Slot 8 + Game Slot 9 + Game Slot 10 None (Double Speed)