5.5 KiB
Native port status and reference checks
Reproducible reference
The private .reference/pokecrystal checkout is pinned to 7a7881d0d62e0ddbd82dcf10e7116807487ac651. With RGBDS 1.0.3, its crystal11 build is byte-identical to the supplied English US/Europe revision 1.1 ROM. npm run check:reference verifies the files, commit and every address in src/game/rom/profile.ts against generated symbols.
To recreate the private reference:
git clone https://github.com/pret/pokecrystal.git .reference/pokecrystal
git -C .reference/pokecrystal checkout 7a7881d0d62e0ddbd82dcf10e7116807487ac651
make -C .reference/pokecrystal crystal11 -j4
npm run check:reference
Install RGBDS 1.0.3 separately. No script downloads a game ROM. CRYSTAL_ROM_PATH optionally selects another local location; checks otherwise use Pokemon - Crystal Version (UE) (V1.1) [C][!].gbc at the root.
The reference checkout, rebuilt ROM, extracted graphics, saves and gameplay screenshots must stay local and ignored. The shipping profile contains addresses and format constants, not game content.
Routine map
These paths refer to the pinned PRET source.
| Native module | PRET reference | Evidence and limits |
|---|---|---|
game/rom/lz.ts |
home/decompress.asm |
All LZ command types have unit vectors; six tilesets match original ASM execution byte-for-byte. |
game/rom/assets.ts maps/events |
data/maps/maps.asm, data/maps/attributes.asm, macros/scripts/maps.asm |
Six-map dimensions, events, destinations, navigation and return warps checked with the actual ROM. Connections are decoded but traversal is disabled. |
| Tiles/palettes | home/map.asm, engine/gfx/color.asm, engine/tilesets/mapgroup_roofs.asm |
Graphics match rebuilt reference bytes. Day/night palettes and roofs supported; terrain animation/dynamic tiles and other special palettes pending. |
| Sprites/rendering | data/sprites/sprites.asm, data/sprites/facings.asm |
Chris/Kris and standard NPC graphics/facings decoded. Dynamic Pokémon icons and room decorations pending. |
game/world/world.ts |
engine/overworld/player_movement.asm, data/collision/collision_permissions.asm |
Walking, walls, visible objects and ordinary local warps. Not complete frame-by-frame parity; forced movement, ledges and surfing are refused. |
| Event interpreter | macros/scripts/events.asm, engine/overworld/scripting.asm, engine/events/std_scripts.asm |
Bounded calls/jumps/conditions, flags, initial sprite variables and basic text interactions. Unknown commands abort; no assembly fallback. |
| Text interpreter | macros/scripts/text.asm, constants/charmap.asm |
Literal/far text, line/paragraph controls and player substitution. Dynamic RAM/ASM text is unsupported. |
Supported event opcodes are explicit in the interpreter switch. Audio commands and delays consume their operands, but sound sequencing and presentation timing are pending; those opcodes do not imply complete audiovisual behavior.
Actual emulator comparison
tests/reference-parity.spec.ts loads the user's ROM into the reference emulator and places a small original test trampoline in emulated WRAM. It calls the ROM's FarDecompress routine at $0b40, then sets a return sentinel. Every output byte is compared with the native decoder for six supported map tilesets. This executes the original routine rather than comparing two copies of our code.
That establishes decompression parity for those inputs. It does not prove complete gameplay, rendering, battles, audio, timing or physical-device parity. Extend controlled comparisons as each subsystem is translated.
Validation
npm test
npm run test:e2e
npm run check:reference
npm run check:vendor
npm run build
npm run check:release
npm run build:reference
User-ROM tests skip when the file is absent, including public CI. Synthetic tests still run. Comparing with rebuilt graphics also needs the private PRET build. Do not report skipped private checks as CI passes.
Native production is dist/; the optional reference output is dist-reference/. Release checks reject emulator dependencies, binary game files and embedded binary assets in the native output. Source review is still required when adding assets or data.
Next slice
Expand automatic scenes/callbacks and native party/inventory models to implement the opening through starter selection. Add the first battle loop with Route 29 and the Mystery Egg quest. Keep this story milestone separate from exploration saves until initialization and migration are defined.