Repository navigation
Add music data variable to fix sound queue glitches - #298
Merged
Merged
Conversation
This file contains hidden or 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
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.
Recently I fixed a sound glitch/crash, but I traded it for a worse issue. The worse issue is, during door transition when game checks if we need a music change, it trusts 07F3 and assumes there will not be another music change in the queue. This is a reasonable assumption by the vanilla game, but it breaks with savestates.
The way it worked before, 07F3 ended up the same as the queued music, so vanilla logic worked (vanilla believed it would need to change the music again) but loading state a second time could crash because load state would trust 07F3, even though in this corner case (back-to-back loads) 07F3 would be the same as the queued music instead of the real music data.
To fix both issues, we need a new value 07F1 which is always the actual music data. 07F3 can go back to working as it did before, and 07F1 is what we can use during loadstate so we always know what data the APU actually has loaded.