Fix save states not saving or loading properly

This was happening because the emulator was being resumed while the state was being saved/loaded, which corrupted the final emulator state
This commit is contained in:
Rafael Caetano 2023-11-05 21:47:57 +00:00
parent 4b67d6c3be
commit bebaa6632c

View File

@ -730,14 +730,21 @@ class EmulatorActivity : AppCompatActivity() {
var dialog: AlertDialog? = null
var adapter: SaveStateListAdapter? = null
adapter = SaveStateListAdapter(slots, picasso, dateFormatter, timeFormatter, {
dialog?.cancel()
onSlotPicked(it)
}) {
viewModel.deleteSaveStateSlot(it)?.let { newSlots ->
adapter?.updateSaveStateSlots(newSlots)
}
}
adapter = SaveStateListAdapter(
slots = slots,
picasso = picasso,
dateFormat = dateFormatter,
timeFormat = timeFormatter,
onSlotSelected = {
dialog?.dismiss()
onSlotPicked(it)
},
onDeletedSlot = {
viewModel.deleteSaveStateSlot(it)?.let { newSlots ->
adapter?.updateSaveStateSlots(newSlots)
}
},
)
activeOverlays.addActiveOverlay(EmulatorOverlay.SAVE_STATES_DIALOG)
dialog = AlertDialog.Builder(this)