Fix auto save state when state file does not already exist #16084
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Context
The PR that went in last week to fix auto save states for Netplay broke saving the auto state when the file did not already exist. This is because the (new) auto save state function differs slightly with the (regular) save state function. The regular function checks if the path is valid, but only to load the existing save state into memory for undo purposes. Since we call the auto save state function from either core unload or quit, we shouldn't need to care about the undo stack.
The auto function currently only works if the state exists (since path would be "valid"), so if the auto state file does not already exist on disk, then it will fail the
path_is_valid()
check and not create a new file.Fix
The fix here is to simply remove the
path_is_valid()
check. Since the regular function only checked if a file already exists for purposes of undo, the auto function can simply always (attempt to) write the state data.Related Issues
#16080
Related Pull Requests
#16061
Reviewers
[If possible @mention all the people that should review your pull request]