mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
Saves: honour contextGame when listing, not just when launching
Long-press -> Load save state opened the Save Manager but nothing could be loaded from it. load() already fell back to contextGame; the LISTING did not. It read currentGame alone, which is null when nothing is booted — so every entry came back canUseWithActiveGame = false, which is what greys out Load, and the serial filter also stopped applying so the screen showed every game's saves at once rather than the one that was long-pressed. contextGame was added for exactly this case and the launch path already used it. The read here had simply never been updated, because until now the only way into this screen was from a running game or the drawer. importSaveStateToNextFreeSlot deliberately still requires currentGame: it resolves destination paths through NativeApp.getGamePathSlot, which answers for the running VM, so a context game would give it nowhere to write.
This commit is contained in:
@@ -147,7 +147,14 @@ class SaveManagerViewModel(application: Application) : AndroidViewModel(applicat
|
||||
)
|
||||
|
||||
private fun readSaves(): ReadResult {
|
||||
val active = MainActivityRuntime.currentGame.value
|
||||
// ★ contextGame is the fallback, not an afterthought.
|
||||
//
|
||||
// Reached from the library's long-press menu nothing is booted, so currentGame is null —
|
||||
// and with it null every entry came back canUseWithActiveGame = false, which greys out
|
||||
// Load. The list also stopped filtering, so it showed every game's saves at once.
|
||||
// contextGame is set for exactly this case and load() already honours it; the read here
|
||||
// simply had not caught up.
|
||||
val active = MainActivityRuntime.currentGame.value ?: MainActivityRuntime.contextGame.value
|
||||
val activeSerial = active?.serial.orEmpty()
|
||||
val activePaths = (0 until SLOT_COUNT).mapNotNull { slot ->
|
||||
runCatching { NativeApp.getGamePathSlot(slot) }
|
||||
|
||||
Reference in New Issue
Block a user