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 dialog: AlertDialog? = null
var adapter: SaveStateListAdapter? = null var adapter: SaveStateListAdapter? = null
adapter = SaveStateListAdapter(slots, picasso, dateFormatter, timeFormatter, { adapter = SaveStateListAdapter(
dialog?.cancel() slots = slots,
onSlotPicked(it) picasso = picasso,
}) { dateFormat = dateFormatter,
viewModel.deleteSaveStateSlot(it)?.let { newSlots -> timeFormat = timeFormatter,
adapter?.updateSaveStateSlots(newSlots) onSlotSelected = {
} dialog?.dismiss()
} onSlotPicked(it)
},
onDeletedSlot = {
viewModel.deleteSaveStateSlot(it)?.let { newSlots ->
adapter?.updateSaveStateSlots(newSlots)
}
},
)
activeOverlays.addActiveOverlay(EmulatorOverlay.SAVE_STATES_DIALOG) activeOverlays.addActiveOverlay(EmulatorOverlay.SAVE_STATES_DIALOG)
dialog = AlertDialog.Builder(this) dialog = AlertDialog.Builder(this)