Skip to content
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

SNIClient: Fixed root cause of crashes of hardware for ALttP Collect. #2132

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

CaitSith2
Copy link
Member

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.

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.  Even then, I have scaled back to 256 bytes at a time for a margin of safety.
@CaitSith2 CaitSith2 merged commit 944fe6c into main Aug 29, 2023
@CaitSith2 CaitSith2 deleted the Fix_alttp_collect_for_hardware branch August 29, 2023 13:07
@ThePhar ThePhar added is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. affects: core Issues/PRs that touch core and may need additional validation. labels Oct 16, 2023
FlySniper pushed a commit to FlySniper/Archipelago that referenced this pull request Nov 14, 2023
)

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.  Even then, I have scaled back to 256 bytes at a time for a margin of safety.
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 2024
)

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.  Even then, I have scaled back to 256 bytes at a time for a margin of safety.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants