forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save migration #3081
Closed
Closed
Save migration #3081
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Amazing stuff, buddy :O |
Ready for review. |
As mentioned in the Discord server, this PR is up for adoption as I will not continue working on it. I'll leave the branch up on my repo if anyone wishes to continue it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements @tustin2121's save migrations (https://github.com/pret/pokeemerald/wiki/How-to-Support-Savefile-Backwards-Compatibility) into RHH alongside a python script (run through makefile shenanigans) that will automatically compare versions and take care of the migration code. Big thanks to @PokemonSanFran for their extensive testing!
Description
This PR consists of two major components: the changes to the codebase and the addition of a make_release folder in tools.
Codebase changes
Makefile
includes a setup formake release
. This does NOT automatically initiate a compile at the moment (both because I didn't know how to make it do so and because I'm not sure if it's a good idea).include/config.h
now also includesRHH_EXPANSION_VERSION
. This allows us to declare internal versions that allow for save migration whenever we push save block changes that make_release can not automatically take care of such as things requiring lookup tables for reordered species names.include/constants/global.h
contains a commented out include forversioning.h
. Make_release will uncomment this and automatically generate said file.include/save.h
up tosrc/main_menu.c
include defines and functions made by Tustin.src/save.c
contains a combination of Tustin magic and extra changes to work with make_release. The define SAVE_VERSION does not exist until make_release is run, which effectively dumies out all the save migration code until a first version is defined. This makes the entirety of the save migration optional for the user (until we start enforcing it through expansion-based save block changes, that is).Make_release
The vast majority of the new files in the make_release folder are the python libraries cxxheaderparser and pcpp. I opted to include these as raw files so users don't need to bother with pip and the only prerequisite is having python3 installed.
The vast majority of the magic happens in the python script
make_release.py
. I did my best to provide some sort of documentation inside, but it is fairly spaghetti. I would support someone with more coding experiencerewriting/cleaning this up later, but for now it should do the job.Testing
psf has tested the system considerably, adding fields, removing fields, changing the size of arrays etc. While we have not been able to confirm black on white that everything works through saveblock dumping (please see this PR's discussion on Discord), everything in game appears to migrate just fine with zero side effects.
Discord contact info
bassoonian (Jasper)