Skip to content

[game] Validate a save before giving up the running session - #325

Open
Eldbury wants to merge 1 commit into
modawan:masterfrom
Eldbury:fix/validate-save-before-retire
Open

[game] Validate a save before giving up the running session#325
Eldbury wants to merge 1 commit into
modawan:masterfrom
Eldbury:fix/validate-save-before-retire

Conversation

@Eldbury

@Eldbury Eldbury commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Game::loadGame reset the running game before the selected save had been validated. If opening the save failed, the current session was already gone and the game could be left without a playable runtime.

The selected save is now validated before the running session is retired. If validation fails, the current session remains intact. If loading fails after that commit point, the game returns to the main menu rather than leaving a partially restored runtime.

Validation

Adds K1/K2 coverage for failed-load preservation, successful replacement and post-commit failure handling.

Full suite passes. Live K1/K2 smoke confirms a rejected save leaves the current session playable and a valid save still loads normally.

Loading a save reset the game first and resolved the save afterwards, so
any failure along the way left nothing behind: the previous session had
already been dismantled, the replacement never arrived, and the engine
went on running with nothing to draw. The load screen reported the error
onto a black window.

Resolve and validate the candidate first, reading it through the
unpublished session rather than the director, which still answers for the
save that is currently loaded. Records the loader treats as mandatory are
proven while the old session is still authoritative, so a save that
cannot be loaded now leaves the player where they were instead of
stranding them. The decoded records are carried into restoration rather
than parsed again once the candidate is published.

The old runtime and the old mounts retire together, and only then does
the candidate become authoritative, so no runtime ever observes the other
session's resources. onGameLoad keeps its slot overload as the atomic
wrapper over prepareGameLoad and commitGameLoad.

Module activation and the module load itself stay fallible after that
point and cannot be proven in advance without performing them. Those
failures are terminal, and now end on a deliberate screen: retiring alone
left Screen::None, which is the black window this started with.

Retail corroborates the ordering - CServerExoAppInternal::LoadGame reads
the party table and globals before the running module is replaced - but
its recovered form performs no validation and no rollback, and the load
is dispatched fire-and-forget, so corrupt-save behaviour is not
recoverable from it. This is a transactional correction, not a claim of
vanilla parity.
@Eldbury
Eldbury force-pushed the fix/validate-save-before-retire branch from ae8f163 to df1048e Compare August 25, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant