Skip to content

Harden Emerald 3DS runtime and builder workflows - #300

Merged
ZallaxDev merged 7 commits into
ZallaxDev:integrationfrom
mkrieger95:hardening/crc-asset-warmup
Nov 21, 2026
Merged

ZallaxDev merged 7 commits into
ZallaxDev:integrationfrom
mkrieger95:hardening/crc-asset-warmup

Conversation

@mkrieger95

@mkrieger95 mkrieger95 commented Nov 20, 2026 •

Copy link
Copy Markdown

Runtime and saves

  • Use a read-only CRC table to remove a first-use race while keeping the existing checksum format and fast lookup path.
  • Let the asset warm-up finish its current read on stop. Retain the thread handle on a join timeout, block overlapping restarts, and retry the join before closing the data backend.
  • Validate data-pack layout consistently in the Python writer and native reader. Add checks for builder recipes, ROM ZIP handling, and staged asset paths.
  • Use a shared write path for native saves and add recoverable SD-card updates to the desktop installer.

Developer and player builds

  • Fix incremental voxel build dependencies, including the grouped building and window-light outputs. Invalidate local generator caches when their inputs change and remove stale copied bootstrap files.
  • Extract portable vertex packing and bounds calculation so the renderer's binary layout and rounding can be tested on a host.
  • Add desktop and web player-build timings and an offline benchmark that accepts a local ROM and release payload.

The Pillow migration is tracked in #294. Both PRs touch the buildings Make rule, which will need a small reconciliation when the second PR is merged.

Validation

  • Local builder suite passed with 278 tests run and two skipped. Release audit and Python compilation passed.
  • Native pack, CRC, asset-worker, settings shutdown, flash write, vertex packing, and incremental voxel dependency checks passed.
  • Three synthetic desktop player builds produced byte-identical packs. Real-ROM player timings and physical 3DS verification are pending.

@mkrieger95 mkrieger95 changed the title Fix pack CRC initialization and asset warm-up shutdown Harden Emerald 3DS runtime and builder workflows Nov 20, 2026
@mkrieger95
mkrieger95 marked this pull request as ready for review November 21, 2026 00:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T00:36:35.231749Z 130de15 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ZallaxDev

Copy link
Copy Markdown
Owner

Thanks for the hardening work, @mkrieger95! We built 130de15 and the runtime side looks good: the read-only CRC table matches the previous implementation entry for entry, and in Azahar an existing save loaded, survived map transitions (Slateport Battle Tent ↔ Slateport City), saved at a new position and reloaded correctly after a restart.

One change is needed in the desktop installer before merging. We interrupted an SD update after the first file had been replaced and removed the remaining staged file. Two retries with complete source files then failed, because _recover_install (builder/emerald3ds_builder/install.py, around lines 292–302 and 315–323) only accepts the staged file or the destination and stops before _install can use the new sources, so the journal keeps blocking every run. Could you add a safe repair path (e.g. re-staging the pending file from a source whose SHA-256 matches the journal) and regression tests for a missing and a corrupted staged file, checking that saves and their backups stay intact?

Also, now that #294 is merged, this conflicts with it in 3ds_port/full.mk (buildings.bin/windowlights.bin rule). Please keep your grouped &: rule and its dependencies and add #294's scripts/voxel_image.py prerequisite, rather than taking one side wholesale.

If fixing the installer would hold up the rest, feel free to split it into its own PR so the runtime changes can go in first. Thanks!

@mkrieger95

Copy link
Copy Markdown
Author

Thanks for testing this in Azahar @ZallaxDev and catching the installer retry issue!

I pushed both fixes in 2608075. The installer now rebuilds a missing or corrupted staged file only if the replacement matches the SHA-256 recorded in the journal. The regression tests cover both cases and verify that a mismatched source leaves the card untouched and that a successful retry preserves the saves and existing backups. All 44 installer tests passed locally.

I also resolved the #294 conflict by keeping the grouped buildings.bin and windowlights.bin rule and adding the voxel_image.py prerequisite. Ready for another look.

@ZallaxDev

Copy link
Copy Markdown
Owner

Thanks for the quick follow-up, @mkrieger95! We reproduced the old retry failure on 130de15 and verified that 2608075 recovers with both a missing and a corrupted staged file: a mismatched source leaves the SD files untouched, and a successful retry preserves saves and existing backups. Editing voxel_image.py now rebuilds both grouped outputs in a single Make run, and the builder suite and a build on current integration pass. Merging — great work!

@ZallaxDev
ZallaxDev merged commit 0def45c into ZallaxDev:integration Nov 21, 2026
6 checks passed
ZallaxDev added a commit that referenced this pull request Nov 21, 2026
- public_sync: an integration commit is held when each file has what it adds; changelog credits beside the pull requests' own entries
- Changelog: public pull requests #190 #209 #262-#300, by their authors
- public_sync: dev takes integration's ported pull requests as their own commits; a conflict or unported pull requests are problems, not a line
- Public export: the benchmark, profiling and macOS builder test tools (#293, #295, #300)
- Public export: upstream.lock's Python 3.15.2 and Pillow 13.0.0 (#288, #289)
- Harden Emerald 3DS runtime and builder workflows (#300)
- Replace deprecated Pillow pixel reads in voxel tools (#294)
- Add opt-in macOS standalone builder support (#295)
- Locales: move the Japanese span in main_menu.c past the main menu card (#298)
- Fly map: choose the destination with the +Control Pad (#267)
- Bottom screen: a tap on the map that slides a little still goes on with a message (#281)
- Summary: give the trainer memo room for a third line (#269)
- Summary: show Pokémon status icons (#270)
- Main menu: the saved game's trainer card on the top screen (#284)
- Restore Japanese naming marks and full touchscreen rows (#275)
- Speed up voxel generation to shorten development builds (#293)
- Release: ship bottom/menu_top.bin with the engine files (#280)
- Bag: planting a berry opens it in the bottom screen's window (#283)
- Frontier Pass map: the picture half as big again, filling its plate (#282)
- CI: support Ubuntu 26.04 with non-PIE sanitizer fixtures (#290)
- Startup: the data pack errors and the START hint in French and Italian (#209)
- Installation: step-by-step builder for Linux and macOS (#190)
- Bottom screen: reuse unchanged wild-list snapshots (#273)
- Upgrade release builds to Pillow 13.0.0 (#289)
- Naming screen: a tab turns straight to its page (#287)
- ci: upgrade GitHub Actions to latest tested releases (#292)
- Generate map event IDs for standalone voxel host tests (#277)
- Tests: update the voxel draft chunk fixture (#262)
- Harden native string formatting and numeric input parsing (#279)
- Build releases with Python 3.15.2 (#288)
- Visible wild: roll the IVs right after the personality (PID/IV legality) (#266)
- CI: use the release toolchain for 3DS builds (#286)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mkrieger95 added a commit to mkrieger95/emerald-3ds that referenced this pull request Nov 21, 2026
…xel rules

Keep ZallaxDev#294 image_pixels() in parallel room preparation and retain its
original owner/variant calculations. Integrate ZallaxDev#300's atomic grouped
buildings/windowlights rule, temporary output, and all dependencies,
while wiring generator and scene-check worker counts. Preserve lazy
multiprocessing imports for browser generation.
mkrieger95 added a commit to mkrieger95/emerald-3ds that referenced this pull request Nov 21, 2026
Preserve every newly merged upstream file and change (including
ZallaxDev#294 and ZallaxDev#300) while carrying forward ZallaxDev#296's five-file voxel
optimization and reconciled Pillow/Make changes.
DannyM90 added a commit to DannyM90/emerald-3ds that referenced this pull request Nov 21, 2026
…axDev#300 and the dev sync

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PjZs53yVtumpNLmM8AycET

# Conflicts:
#	3ds_port/src/3ds_extras.c
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.

2 participants