docs/save-state-version-mismatch-tickets.md
Priority: High (next release)
Labels: save-states, core-version, high-priority, agent-work
Epic: Save state compatibility across core updates
When emulator cores are updated, save states may become incompatible. Recent PicoDrive updates have caused 32X save states to fail loading, and "Reset Game" does not work when a bad save state is loaded. Core and core version are already tracked in Realm, SwiftData, JSON serialized files, and CloudKit records, but the UI does not consistently check or warn users before loading.
Labels: save-states, core-version, high-priority, agent-work
Introduce a unified flow to check save states against the current core version before load, present clear UI when there is a version mismatch, and allow users to load anyway with an explicit warning that the save may be broken or buggy.
| Path | File(s) | Current Behavior |
|---|---|---|
| In-emulator Save States menu | PVSaveStatesViewController, PVEmulatorViewController+Saves | Version check exists in loadSaveState; shows warning but still loads |
| ContinuesManagementView | ContinuesMagementView.swift, SaveStateRowView | No version check; onLoadSave goes to parent |
| RetroSaveStatesStore | RetroSaveStatesBrowserView.swift | openSaveState → SceneCoordinator.launchSaveState; no version check |
| TVMediaMainView | TVMediaMainView.swift | Same as RetroSaveStatesStore |
| RetroGameLibraryView | RetroGameLibraryView.swift | Same store |
| GameLaunchingViewController | GameLaunchingViewController.swift | openSaveState loads directly; no version check |
| Deep link / App open | ProvenanceApp.swift, PVRootViewController | openSaveStateID → launch flow; no version check |
PVSaveState: createdWithCoreVersion ✅SaveState_Data: createdWithCoreVersion ✅coreVersion in schema ✅SaveState: No createdWithCoreVersion in protocol/struct — needs addition for JSON round-tripcreatedWithCoreVersion — needs addition for UI checkscreatedWithCoreVersion to Save State View ModelsLabels: save-states, core-version, agent-work
Ensure createdWithCoreVersion (and optionally coreIdentifier) flows from Realm/SwiftData into all view models and DTOs used by save-state UIs.
SaveStateRowViewModel includes createdWithCoreVersion: String? and coreIdentifier: String?RetroSaveStateItem includes createdWithCoreVersion: String? and coreIdentifier: String?RealmSaveStateDriver and RetroSaveStatesStore.mapSaveState populate these fieldsPVPrimitives.SaveState and SaveStateInfoProvider include createdWithCoreVersion for JSON/CloudKit parityPVUI (SaveStateRowViewModel, RealmSaveStateDriver, RetroSaveStatesBrowserView)PVPrimitives (SaveState)PVLibrary (CloudKit schema already has it)Labels: save-states, core-version, agent-work
Create a shared service or helper that compares createdWithCoreVersion with the current core’s projectVersion and presents a consistent alert/sheet before load.
SaveStateVersionChecker or similar, with checkAndWarnIfMismatch(saveState:core:onLoad:onCancel:) async -> BoolPVSaveState.createdWithCoreVersion vs PVCore.projectVersionRetroAlertState or equivalent with "Load Anyway" / "Cancel"createdWithCoreVersion (treat as unknown, optional warning)PVUI (new helper, SceneCoordinator, RetroAlertState)Labels: save-states, core-version, agent-work
Wire the centralized version check into every path that can load a save state.
launchSaveState: Covered by SceneCoordinator integrationopenSaveStateID: Covered by SceneCoordinator integrationPVUI (SceneCoordinator, ContinuesManagementView, PVEmulatorViewController+Saves, GameLaunchingViewController)Labels: save-states, reset, picodrive, agent-work
Investigate why "Reset Game" does not work when a save state fails to load or is incompatible. In theory, reset should boot the game without patching save memory.
resetEmulation flow: RetroMenuView → core.resetEmulation() → PVLibRetroCore.resetEmulation / PicoDrive retro_reset()resetEmulation calls retro_reset() (libretro API)PVUI (RetroMenuView, emulator flow)Cores/PicoDrive (PVPicoDriveBridge — do not modify upstream libpicodrive)PVCoreBridgeRetro (PVLibRetroCore)Labels: save-states, core-version, research, agent-work
Explore whether save states can be "ported" to newer core versions, either via core-provided conversion or app-side transformers.
load parameter in MDFNSS_StateAction)StateAction; some cores may support backward compatibilityLabels: save-states, docs, wiki, agent-work
Add or link to wiki content about save state version mismatches and best practices.
provenance-emu/wiki (e.g. save-states/version-mismatches.md)PVHelp, WikiConstants)Provenance-EMU/wiki (https://github.com/Provenance-EMU/wiki)https://raw.githubusercontent.com/Provenance-EMU/wiki/master/swift build passes for affected modulesswiftlint reports no new violationsPVEmulatorViewController+Saves.loadSaveState (lines 111–121): Existing version check; shows presentWarning but still proceedsPVSaveState.createdWithCoreVersion, SaveState_Data.createdWithCoreVersion, CloudKit coreVersionRetroSaveStatesStore.openSaveState → SceneCoordinator.launchSaveState → launchSaveStateWithValidationretro_reset() in resetEmulation; loadSaveFile for battery saves on ROM load