SNIClient: Fixed root cause of crashes of hardware for ALttP Collect. #2132
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.
Please format your title with what portion of the project this pull request is
targeting and what it's changing.
ex. "MyGame4: implement new game" or "Docs: add new guide for customizing MyGame3"
What is this fixing or adding?
As it turns out, SD2SNES / FXPAK Pro has a limit as to how many bytes can be written in a single command packet. Exceed this limit, and the hardware will crash. That limit is 512 bytes. This limit not only includes that data to be written, but ALSO the 65816 assembler code required to write that data to ram. As a result, a full release of all locations in the game exceeds this buffer, and on older versions of the Super Nintendo Interface, caused crashes on real hardware. Even 512 bytes of data to write is too much as that leaves no room for the data writing code. (which super nintendo interface deals with itself.)
The fix is to split large writes into 256 byte buffers.
How was this tested?
Do a release on a Link to the Past slot that has item non-local. Tested both with and without this code in place. The tests without the fix crashed or closed the snes connection as expected. The fix resulted in everything showing as collected in the tracker, other than the forbidden things.
If this makes graphical changes, please attach screenshots.