Skip to content

Sync upstream main (2026-10-30) - #11

Merged
deviankim merged 441 commits into
browser-environmentfrom
sync/upstream-2026-10-30
Oct 29, 2026
Merged

deviankim merged 441 commits into
browser-environmentfrom
sync/upstream-2026-10-30

Conversation

@deviankim

Copy link
Copy Markdown

Merges monteslu/romdev main (436 commits, up to 3bc339e romdevtools 0.151.1) into the fork, and re-applies the node,web,worker glue recipe (monteslu#15).

  • All fork changes are kept: GB/GBC ROM banks (sdasgb 32-bit addresses), the NES chr-ram-wram preset, multiplayer core state, world observation and browser payloads.
  • Workspace pins follow upstream's package versions; scripts/check-pins.mjs runs before npm ci.
  • Browser payloads (gambatte, fceumm, cc65, mcpp, sdcc) were rebuilt with this branch's recipes and pinned as browser-payloads-6f59c4b0d7a7. cc65's tracked share/ stays upstream's scrubbed copy.
  • multiplayer-core, r57-gb-rom-banks, r58-nes-wram-preset and world-observation pass locally (33/33).

AGENTS.md and the N64 decomp guide described running the registered
project's own host toolchain. The compile path now runs IDO, asm-processor
and the mips-linux-gnu binutils as WASM from the recipe romdev reads out of
the project's Makefile; say so, and say what happens to a build step with no
WASM/JS equivalent.
…aceful abort, UPSTREAM/DEFAULT_WEIGHTS_FILE exports, toolchain dependency
…ds, WASM cpp/IDO/binutils), no Python checkout or host tools
… operations and trace commands under node --test
…ize SVG through graphviz WASM

Drops the package's own pycparser copy for romdev-pycparser (also used by
romdev-permuter); the 430 upstream e2e cases stay byte-identical.
SVG rendering uses @viz-js/viz (graphviz compiled to WASM) instead of host
graphviz, with tests for the dot and SVG output. Documents why the .m2c
context pickle cache is not reproduced (it never changes output).
monteslu and others added 27 commits October 11, 2026 00:56
libgba's LGPL-with-exceptions text comes from its 0.5.4 release. libtonc's
release has no licence file; the author confirmed MIT to the gbadev-org fork,
which added the text shipped here. The package licence field now points at
the README, which lists every component.
The upload loop keeps the new port 0 value as the last echo as soon as it
sees a change, then echoes the index before storing the byte, so the S-CPU
can send the next byte while the boot ROM stores this one. An 8 KB upload
from a tight S-CPU loop takes 16 frames instead of 19 (Nintendo's boot ROM,
measured the same way from outside: 12). Same size, same handover state.
snes9x and bsnes rebuilt; the unit test values read from snes9x are re-read
from the rebuilt core (the same procedure reproduces the previous values on
the previous core); binary manifest updated.
# Conflicts:
#	NOTICE
#	packages/romdev-core-bsnes/README.md
#	packages/romdev-platform-snes/README.md
#	packages/romdevtools/NOTICE
CHANGELOG notes the SNES chip-data and boot-timing changes, the GBA licence
files and the path-free rebuilds.
snes9x's and ares's assert strings carried the build directory. The core is
rebuilt with -ffile-prefix-map; the binary manifest follows.
…s learn the machine's hardware thread count, a dying cart thread stops the cart with its reason). In 0.150.0; the 16 wasmcart host tests pass (89 checks).
…game's names

The upstream tools compile in the game's stage, boss and character names,
its short title (module, package and crate names, project file paths, env
var names, messages) and the disc's volume identifiers. romdev now builds
them from a rewritten copy of the pinned source instead of the tree itself:

- scripts/src/decomp-go-wasip1/gen-source.mjs copies the two Go modules to
  build/ as psxdecomp/psx-assets and psxdecomp/psx-disk, renames the game
  package, and turns every string naming the project into a run-time value
  from projectid.go, which reads the project's own tools/<name>-assets/go.mod
  in the working directory. It also carries the WASI changes the -overlay
  did, drops the stage/boss/character tables (romdev_names.go derives kinds
  from overlay codes and reads the console-port lists from config/saturn/),
  and makes `make` copy the volume identifiers from the original image
  (romdev_pvd.go). Every rewrite checks the exact source shape and the
  build fails if the name is left in code or in a built binary.
- scripts/src/psx-str/gen-source.mjs copies the string encoder crate as
  psx_str: neutral messages, and the define and temp file name its `cc`
  wrapper uses are derived from the project's tools/<name>_str directory.

Verified on a real project tree at the pinned commit, old binaries against
new: extract-assets output identical; build-assets identical apart from
layers.h declaration order, which the unmodified build also varies run to
run; objdiff-gen units and category ids identical for us, pspeu and hd;
psx-disk make images byte-identical; psx-str process output identical on
40 project sources. Derived overlay kinds and ids match the upstream table
for all 191 overlays, and the console-port lists match. Go tests: 12
packages pass. psx-str unit tests pass as WASM. Name scan: psx-assets 125
stage/boss/character hits and about 1429 short-title hits before, 0 after;
psx-disk 221 before, 0 after; psx-str 5 before, 0 after.
<project>-disk and <project>-assets map to the shipped Go tools when the
project has that Go package under tools/, <project>_str maps to psx-str, and
the asset wrapper script is recognised by its content alone.
romdev's SPC700 boot ROM now samples ports 0-3 and answers on port 0 on the
same SPC700 cycles as the console's boot ROM, matched from outside only: an
emulator's S-CPU side wrote the ports at every cycle offset and the cycles of
each sample and echo were measured (byte loop: port 0 every 11 cycles, echo 10
after, 25 a byte, 31 at the index wrap; first byte of a block: a 7-cycle wait;
kicks echoed 31 cycles after the byte loop sees them, 30 after the $CC loop;
ports 2-3 and 0-1 read as word pairs; entry 12 cycles after the echo). Still 64
bytes with the reset vector; same handover state.

4000 randomized upload scripts (single bytes, 256+ byte blocks, several blocks,
start right after the kick, restarts through $FFC0, out-of-protocol port 0
values) give identical port traces, ARAM and handover registers on both boot
ROMs in the recompiler's snes9x SMP; a 65816 cart logging the H/V counters at
3708 echoes matches the console boot ROM's log on the snes9x and bsnes cores.

The snes9x reference values the slower loop had changed are back to their
original values (S-DSP ARAM, word access, SPC7110 counts, APU speedup counts
and samples). snes9x and bsnes rebuilt; binary manifest updated. The 0.150.0
changelog no longer lists a boot timing change.
…; drop vasm

vasm's licence allows non-commercial use and redistribution of the unmodified
archive only, and romdev shipped a modified WASM build of it. Genesis assembly
(build({platform:'genesis'}) for .s sources, assembleSnippet cpu:'68k', the
recompiler's m68k target) now runs the m68k-elf GNU as already shipped in
romdev-toolchain-m68k-gcc.

src/toolchains/m68k-asm/ reads Motorola syntax (org blocks in any order,
dc/dcb/ds, equ/set/=, rs/offset, rept with REPTN, macros with \1..\9 \0 \@ \#
NARG and mexit, conditional assembly, include/incdir/incbin, .local and 1$
labels, equr/reg, cnop/align/even), preprocesses it, and emits GNU as source:
one section per org block placed by a generated linker script, labels kept
relocatable where GNU as can relax against them and written as
base+(label-section_start) where it cannot. A peephole layer and label-address
layout passes keep the classic encoding choices (moveq/addq/lea forms,
register-form add/sub/cmp/and/or, shortest branches, short absolute addresses
for labels below $8000, constant branch targets), so existing sources build to
the same bytes: the 35 golden cases, the shipped example and snippets, a
1000-line user game and a 3MB disassembly are byte-identical to the vasm
builds. Diagnostics are mapped back to file:line (through includes and macros)
and parsed as stage "m68k-as"; the build result now carries a label map.

romdev-toolchain-vasm is removed (package, build script, version pin, NOTICE
row, manifest entry). CHANGELOG 0.150.0 lists the user-visible differences.
…e scopes, dc.s/dc.d, constant jsr/jmp targets); note Genesis assembly in the m68k-gcc package docs and BUILD_MAP
… the only gba toolchain platform({op:'list'}) showed)
…and the schema refused a third ("expected array to have <=2 items"). test/input-four-ports.test.js
…st frame submitted

A bare event-loop turn between frames did not wait for the GPU, and a
buffer map is answered only once the work before it has finished, so a
cart whose frame took longer than a turn read its map results a varying
number of frames late: cartwheel's fx_pipeline sample read particle counts
dozens of frames stale on romdev while native and Chromium read them a
frame later. Each frame of a burst now waits for the device queue's
submitted work, then takes the turn. test/wasmcart-webgpu.test.js: a
90-frame burst of fixtures/fxstats.wasc (that sample) reads the same counts
as 90 one-frame steps with the GPU idle between them.
…WebGPU cart frees its memory (each load kept about 240 MB)
…tch) and one runtime-generated module up to 256 MiB (was 4 MiB)
…he wasmcart guide), and the playtest window sends Guide and the back paddles to a wasmcart cart as their own buttons (Guide pressed Select)
romdev-core-host documents a bytes-only browser path, but the glue it would
load could not run there: the 2D libretro cores and every tool linked with
EM_CLI_FLAGS were built with -s ENVIRONMENT=node, so emcc hard-codes
ENVIRONMENT_IS_NODE=true and the glue's first act is `await import("module")`.
In a page or Web Worker that throws "Failed to resolve module specifier
'module'" before the wasm is instantiated, although these cores and tools use
nothing but MEMFS. The GPU cores already link with node,web.

EM_CLI_FLAGS (sdcc/sdas*/sdld, mcpp, rgbds, cc65, asar, dasm, sjasm, tcc816,
wla-dx) and the 14 2D core recipes (bsnes included) now use
-s ENVIRONMENT=node,web,worker. Under Node the runtime check still picks node.
The flag only changes the JS glue: mcpp linked both ways gives a
byte-identical .wasm, and the rebuilt gambatte, fceumm, fake08, geargrafx,
gpgx, handy, mgba, prosystem, snes9x, stella2014, vice, dasm, tcc816 and
wla-dx .wasm files are byte-identical to the published ones.

verify-wasm.mjs now refuses to publish those glue files if they come out
node-only again. NODERAWFS builds, the GPU cores, the gcc-family wraps and
rizin/decompiler are unchanged.
Workspace package versions, the romdevtools pins and package-lock.json now
match upstream exactly. The fork's own builds of fceumm, gambatte, host, sdcc
and cc65 come from the content-addressed release in browser-payloads.json, so
they no longer carry fork-only version numbers that npm cannot resolve.

Conflicts resolved by keeping both sides: upstream's trace exports and the
fork's observe/deterministic/state exports in the fceumm and gambatte
recipes, upstream's beforeSettle hook with the fork's deterministic guard in
LibretroHost, and tr_enabled alongside observe_enabled in romdev_debug.c. The
fork's extra source resets in the core recipes now run after upstream's
require_git_toplevel guard.
# Conflicts:
#	scripts/verify-wasm.mjs
A pin that drifts from its package's in-tree version made npm ci fail with
ETARGET (npm went to the registry for a version never published), so the
workspace-contract test that names the cause never ran. scripts/check-pins.mjs
does the same check with no dependencies and runs before the install in both
workflows.

lint.yml now lints the JavaScript changed since the merge base with
monteslu/romdev main. The 112 errors left on main are all in upstream's own
files; fixing them here would spread the fork's diff over files it does not
otherwise touch.
@deviankim
deviankim merged commit 54c8a40 into browser-environment Oct 29, 2026
2 checks passed
@deviankim
deviankim deleted the sync/upstream-2026-10-30 branch October 29, 2026 23:50
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