Skip to content

Preserve numeric variable identity across cold checkpoint restore - #8

Merged
xxxsen merged 2 commits into
retrom/ge8294c9070a4from
fix/checkpoint-variable-identity
Oct 8, 2026
Merged

xxxsen merged 2 commits into
retrom/ge8294c9070a4from
fix/checkpoint-variable-identity

Conversation

@xxxsen

@xxxsen xxxsen commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

GameMaker checkpoint serialization used variable names as identity. Compiled variables with the same empty name collapsed on restore, and runtime-created instance variables lost their bindings; a fresh Undertale restore consequently lost the player name.

Store global and instance slots by numeric VM ID, replacing the cold VM's name map and allocation cursor before restoring values. Preserve undefined slots and independent scopes. Allocation now fails explicitly before signed overflow, including compiled-ID initialization; an exhausted cursor retains existing lookups. The current BSCP v2 contract is updated directly with no historical reader or protocol generation change.

Native coverage exercises VM_create, Runner_create, and Runner_restoreStateJson with synthetic room-creation bytecode, a different cold allocation order, room transition, and legal instance reconstruction. Late failure in the second instance checks normal teardown and subsequent retry under ASAN/leak detection. The complete entry path also exposed and fixes two empty-event UB cases without changing zero-event room behavior. Helper tests retain malformed-input and cell-bound coverage.

Validation at d8e52eb9f0b5df27f74b7c732bc07ac32e34c409: source contract, 11 Web host tests, native checkpoint regression, ASAN/UBSAN with leak detection and halt-on-error, lazy-content and gamepad tests, and protocol gate against original base db3a882975c0420389fae503ea387e2cce830336 pass. CI also passes full/metadata Web builds and candidate validation. Isolated red reproducers confirm the allocator overflow and both empty-event sanitizer findings without the fixes.

Actual R21 Retrom product regression passes on this candidate: normal import/review/publication, new 702,880-byte public save, cookie-only fresh-browser restoration with player name B preserved in MENU and STAT, retained room/position, natural unpaused execution, standard direction/confirm input, and normal exit/cleanup. Original images were independently reviewed. Proof SHA-256: c0ec731789feea06dbe12757e5f19c489a27dedc808921d400eb86b4a88fdabe. Formal release assets still need integration verification in the final paired runtime. Tracks retrom-project/retrom-runtime#116.

@xxxsen
xxxsen marked this pull request as ready for review October 8, 2026 18:40
@xxxsen
xxxsen merged commit 24b281e into retrom/ge8294c9070a4 Oct 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant