# Matching native emulator source

This companion uses the unchanged prepared emulator sources and historical patches
from source-kit-final-20260921.zip (SHA-256 3c9ace59959df491a5859860b299867b17fcc1dd75fc68808e4678463b1978c2).
It replaces the host and records the production native compile/link commands.
No ROM, reconstructed game source, firmware, states or extracted game assets are included.

Extract that baseline ZIP into a clean directory, then run:

    python apply-native.py PATH_TO_BASELINE_KIT --output-kit NEW_NATIVE_KIT
    python NEW_NATIVE_KIT/rebuild_source_kit.py NEW_NATIVE_KIT/recipe.json --emsdk PATH_TO_EMSDK --output-dir NEW_BUILD

The original rebuild script validates every source and installed SDK input, builds
all 167 translation units, and requires these exact production artifacts:

- sfc.js: 62684bcd5f75ada4f35dd05afd3a4aa26401be6f6327671811d1e55edf7b1888
- sfc.wasm: af67c2c08c27f70d8f7c232189b33f066c71f17e395f0c78969173e1a77e0cd5

Use the pinned Windows Emscripten 6.0.9 SDK and its existing runtime-source companion.
The ROM identity is a compile-time hash; the game itself is supplied only at runtime.
provenance/native-build.py records the local cached-object workflow, while recipe.json
is the standalone source rebuild. Baseline provenance remains historical; its older
host and artifact identities are superseded by this native recipe and provenance.
The prepared core already contains the verified original hardening patches: do not
regenerate it using a newer patch from a different checkout.

The production core reused older objects whose assertions contain their original
Windows source filenames. This recipe supersedes the baseline /mesen-s filename
maps with a deterministic map to the recorded production source origin. That
origin is only an assertion-string value: no such directory or private workspace
is needed, and compiler inputs still come entirely from this delivered kit.
The exact map and superseded flags are recorded in native-build-inputs.json.
recipe.json also records expectedObjectSha256 for all 166 reused objects. The
original rebuild script ignores that diagnostic metadata and verifies full final
artifact hashes. Source bytes and the verified original patches are unchanged.
