Update the ISaveRam interface for clarity. #4437
Draft
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.
ISaveRam can no longer return null for SaveRam, which used to indicate that the current game has no SaveRam. Instead, cores conditionally provide the ISaveRam service. There is also a behavior change in the frontend, as it no longer silently modifies the .SaveRam file before passing it to the core. This could result in some previously-working saves not working anymore (bad dumps, perhaps?) but should not affect any .SaveRam files generated by EmuHawk.
Several cores have unusual implementations here and should be reviewed by someone who knows more of how they work:
mGBA does not know a game's save type (and as a result actual savedata size) on startup. Gambatte might be the same, Idk.
Multiple other cores also use an API to get SRAM data/size from external code and so might also have mistakes. I've made them unregister the ISaveRam service if
CloneSaveRam
would return null at the end of the constructor.My original implementation of this, that adds a property
SupportsSaveRam
to theISaveRam
interface instead of making cores conditionally provide the service, can be found in mysram
branch.Check if completed: