Combine preset data for efficiency #232
Merged
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.
It's an optimization we don't need quite yet, but I'd like to get ahead of it.
mm2 wanted a spazer variant of the mapo presets, and I didn't really want a full copy of those presets (even though we did have room for them). With this optimization, instead of using about a half of bank more preset data, we freed up about two banks of preset data.
The original preset data format is still supported. Whenever you make changes to preset data, you must run the build_presets script to create the combined files. The script is separate because it does take a bit to run; about seven seconds for my computer. I think making a fully optimal combined data set would be an NP complete problem, so the script does take some shortcuts and best guesses. Preset logic was also adjusted to support presets spanning more than two banks, which happens because the combined data is interleaved.
Performance-wise on the SNES it's probably negligible; if anything it might be faster since the combined data can cut out jumps. Previously the last preset was built on top of each and every preset above it, but the combined logic allows for some skips.
There are some other changes in the PR, like a possible fix for the audio popping issue. I'll post more about that in discord.