Verify free ranges and merge them together when possible #318
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.
As of creating the PR, I haven't tested this yet.
One of the TODOs in the code for deallocating areas of the ROM was found to be useful to implement for the Mother 2 prototype version of CoilSnake, since it was easy to add ranges of free space that accidentally overlapped. This PR deals with that and also makes it possible to merge adjacent blocks of free space in the same bank, ensuring both greater correctness (when new tables/free ranges are added to CoilSnake) and greater potential for space efficiency (by making it possible for an insertion into the ROM to span multiple adjacent deallocated ranges).
I had some concerns about including code specific to EarthBound/HiROM SNES games in a
commonfolder, but CoilSnake has been EB-specific for a while, and the logic should work for any future expansion chip accelerated hacks people may decide to make, too (there are some boards for the SA-1 and Super-FX/GSU chips that appear to work similar to HiROM in how they lay out memory, if I'm reading Ares's SNES game board database correctly).