Repository navigation
Preserve GB/GBC LCD-off bootstrap state for multiplayer rollback - #7
Merged
Merged
Conversation
…ltiplayer-lcd-state
This was referenced Oct 1, 2026
deviankim
added a commit
that referenced
this pull request
Oct 1, 2026
# Conflicts: # packages/romdevtools/scripts/patches/gambatte-multiplayer-state.patch
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.
GB/GBC rollback from the pre-world bootstrap was not deterministic while the LCD was off. Gambatte reconstructed the native blit deadline, reset the blank-LCD phase, and retained dormant sprite entries from a later frame. With the original M1 payload, restoring the fixture changes the first subsequent CPU frame and its causal digest.
Preserve the blit deadline and blank-LCD phase in deterministic snapshots, restore captured sprite attributes/words, and retain current/next sprite cursors when the native loader skips them. This covers LCD-off bootstrap and inactive LCD-on fetch phases. Disabled STAT mode-0 deadlines are normalized only where the loader ignores them; active deadlines remain causal. The deterministic envelope grows from 64 to 80 bytes, with schema
0x47420102; old deterministic envelopes are rejected. Ordinary disk states retain their format and behavior.Self-review of the M2 whole-bundle checkpoint undo path exposed a second actual defect: restoring an active frame after the boot-off state could inherit a
0xffsprite cursor rather than captured0, becauseloadSpriteListskips reconstruction during vblank/right-edge phases. The follow-up preserves both cursors in those phases only in deterministic mode. No app-side state byte filter is used.Regression cartridges restore differently aged LCD-off boot checkpoints after playing ahead. They also restore active states through the LCD-off checkpoint at five distinct boundaries. Every restoration compares native registers, RAM, pixels, audio and causal digest for 40 subsequent frames. Mutations of active STAT/timing fields and rejected schema/flags/envelopes remain covered. The browser harness runs the same bootstrap and active-restore checks.
Tracks https://github.com/ssk-play/chiptoy/issues/96. Merged M1 #6 (
5c728f95) has been brought in with a merge commit. This is a lower-core prerequisite for ssk-play/romdev-browser#16, not a claim that the M2 physical-phone performance gate passes.Validation after self-review:
ROMDEV_BUILD_CWD=packages/romdevtools build-image/build-wasm.sh build-gambatte.sh.Reproducible payload:
3a51e4c878814b5063c287862fb39d4a84b18b35.07df23fa; payload pin:3a51e4c8.4e984c92353f45f0076401dfd63d4c874c4854141a936873f5ce91c5e26846cb.91d051dfe7829213fab17b698cb597d7443b44a4f25acbead05b784409c792d9.Dev deployment:
550e9118-9bce-4d5a-af84-5b34006232f6.22201ca, https://github.com/ssk-play/chiptoy/pull/104, based on currentfeat/multiplayer-fastpath-server(c8d6d3a). Existing rooms/ICE/SFU migrations and routes are retained; valid signed-out ICE/SFU requests return 401 rather than 404.External procedure:
PASS · GB, GBC and NES rollback checks. The report must identify source3a51e4c8..., GB/GBC schema1195507970, and bothLCD-off bootstrap and resume (4 checkpoints × 40 frames)andactive restore through LCD-off (5 checkpoints × 40 frames).The current deployment supersedes the old
m1-lcd-41a1c156deployment; use the new URL/version above. No merge or production deployment has been performed.Review follow-up (
45b35010): the patch now documents why the saved blit deadline fits u32:CPU::runForrebases at bit 31 throughMemory::resetCounters, including the blit event; the disabled sentinel is0xfffffffful. This is a comment-only change. The published payload and external harness above remain unchanged. Validation: multiplayer-core and legacy disk-state tests 24/24,git diff --check, and applying the revised patch with the build recipe’sgit apply --recountflags to the pinned native sources. No new deployment. Future dev deployments will include the currentorigin/feat/multiplayer-cable-uihead to preserve checkpoint and cable routes.