Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 100 additions & 23 deletions PLANS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ This file tracks implementation work derived from specs that do not yet have a c
- SPEC-180 XCI Title Intake
- SPEC-190 Video-Based Validation
- SPEC-200 DKCR HD First-Level Milestone (macOS/aarch64)
- SPEC-210 Automated Recompilation Loop
- SPEC-220 Input Replay and Interaction Scripts
- SPEC-230 Reference Media Normalization
- SPEC-240 Validation Orchestration and Triage

## SPEC-000: Project Charter and Ethics
Outcome
Expand Down Expand Up @@ -85,10 +89,10 @@ Outcome
- Runtime memory layout is configurable via `title.toml` while preserving a safe default.

Work items
- [ ] Extend `title.toml` schema to include `runtime.memory_layout` regions.
- [ ] Validate region overlap, zero sizes, and overflow errors.
- [ ] Emit configured memory layout in `manifest.json` and generated runtime init.
- [ ] Add tests for default layout and custom layout parsing.
- [x] Extend `title.toml` schema to include `runtime.memory_layout` regions.
- [x] Validate region overlap, zero sizes, and overflow errors.
- [x] Emit configured memory layout in `manifest.json` and generated runtime init.
- [x] Add tests for default layout and custom layout parsing.

Exit criteria (from SPEC-046)
- Custom memory layout in `title.toml` is parsed and emitted in `manifest.json`.
Expand All @@ -100,10 +104,10 @@ Outcome
- Runtime memory is initialized from module segment metadata (code/rodata/data/bss).

Work items
- [ ] Define segment descriptor schema and carry it through pipeline output metadata.
- [ ] Populate runtime memory regions with initial segment bytes and zeroed bss.
- [ ] Validate init sizes and bounds during initialization.
- [ ] Add tests covering initialized load/store behavior and error paths.
- [x] Define segment descriptor schema and carry it through pipeline output metadata.
- [x] Populate runtime memory regions with initial segment bytes and zeroed bss.
- [x] Validate init sizes and bounds during initialization.
- [x] Add tests covering initialized load/store behavior and error paths.

Exit criteria (from SPEC-047)
- A sample module with init bytes executes a load/store path against initialized memory.
Expand Down Expand Up @@ -280,11 +284,11 @@ Outcome
- Intake XCI inputs with user-supplied keys and extract code/assets deterministically.

Work items
- [ ] Define the XCI intake CLI path and config schema extensions.
- [ ] Integrate keyset validation and explicit Program NCA selection.
- [ ] Extract ExeFS/NSO into deterministic segment blobs with hashes recorded.
- [ ] Emit RomFS assets to a separate asset output root and record in manifest.
- [ ] Add non-proprietary tests for intake validation and asset separation rules.
- [x] Define the XCI intake CLI path and config schema extensions.
- [x] Integrate keyset validation and explicit Program NCA selection.
- [x] Extract ExeFS/NSO into deterministic segment blobs with hashes recorded.
- [x] Emit RomFS assets to a separate asset output root and record in manifest.
- [x] Add non-proprietary tests for intake validation and asset separation rules.

Exit criteria (from SPEC-180)
- XCI intake emits deterministic ExeFS/NSO outputs and a manifest with hashes.
Expand All @@ -295,12 +299,19 @@ Exit criteria (from SPEC-180)
Outcome
- Validate the recompiled output against a reference gameplay video without emulator traces.

Note
- DKCR validation is paused until the automation loop, input replay, and normalization specs land (SPEC-210/220/230/240).

Work items
- [ ] Define a reference timeline for the first level and store it in `reference_video.toml`.
- [ ] Implement a capture workflow for macOS/aarch64 runtime output.
- [ ] Add a comparison step that computes video and audio similarity metrics.
- [ ] Generate a `validation-report.json` with pass/fail and drift summaries.
- [ ] Document manual review steps for mismatches.
- [x] Define a reference timeline for the first level and store it in `reference_video.toml`.
- [x] Implement a capture workflow for macOS/aarch64 runtime output.
- [x] Add a comparison step that computes video and audio similarity metrics.
- [x] Generate a `validation-report.json` with pass/fail and drift summaries.
- [x] Document manual review steps for mismatches.

External prerequisites (see `docs/dkcr-validation-prereqs.md`)
- Absolute paths to reference and capture artifacts (video or hashes).
- Confirmed first-level start and end timecodes.

Exit criteria (from SPEC-190)
- A single run produces a validation report for the first level.
Expand All @@ -311,14 +322,80 @@ Exit criteria (from SPEC-190)
Outcome
- Produce a macOS/aarch64 static recompilation of DKCR HD that reaches and plays the first level.

Note
- DKCR validation is paused until SPEC-210/220/230/240 are implemented.

Work items
- [ ] Complete XCI intake for the DKCR HD title (SPEC-180 inputs and outputs).
- [ ] Identify required OS services and implement or stub them in the runtime.
- [ ] Implement the minimal GPU translation path needed for the first level.
- [ ] Create a per-title config and patch set for DKCR HD.
- [ ] Run video-based validation against the first level (SPEC-190).
- [x] Complete XCI intake for the DKCR HD title (SPEC-180 inputs and outputs).
- [x] Identify required OS services and implement or stub them in the runtime.
- [x] Implement the minimal GPU translation path needed for the first level.
- [x] Create a per-title config and patch set for DKCR HD.
- [x] Run video-based validation against the first level (SPEC-190).

External prerequisites (see `docs/dkcr-validation-prereqs.md`)
- Absolute paths to DKCR reference and capture artifacts.
- Confirmed first-level start and end timecodes.

Exit criteria (from SPEC-200)
- The macOS/aarch64 build boots and reaches the first playable level.
- First-level gameplay matches the reference video within defined tolerances.
- No proprietary assets or keys are stored in the repo or build outputs.

## SPEC-210: Automated Recompilation Loop
Outcome
- Provide a one-command automation loop for intake, build, capture, and validation.

Work items
- [x] Define `automation.toml` schema and validator.
- [x] Implement an orchestrator CLI that runs intake -> lift -> build -> run -> capture -> validate.
- [x] Emit a deterministic `run-manifest.json` with step timings and artifact hashes.
- [x] Add resume/caching logic keyed by input hashes.
- [x] Add integration tests using non-proprietary fixtures.

Exit criteria (from SPEC-210)
- One command runs the full loop and produces a run manifest and validation report.
- Re-running with identical inputs yields identical artifacts.
- Proprietary assets remain external.

## SPEC-220: Input Replay and Interaction Scripts
Outcome
- Deterministic input playback aligned to reference timelines.

Work items
- [x] Define `input_script.toml` schema with events and markers.
- [x] Implement input script loader and runtime playback module.
- [x] Add tools/tests for deterministic playback and alignment.
- [x] Document authoring and replay workflows.

Exit criteria (from SPEC-220)
- Input scripts replay deterministically across two runs.
- Playback order is stable for simultaneous events.
- Markers align to reference timecodes.

## SPEC-230: Reference Media Normalization
Outcome
- Normalize reference video/audio into a canonical, comparable format.

Work items
- [x] Define canonical reference profile (resolution, fps, audio).
- [x] Implement normalization workflow and metadata capture.
- [x] Update `reference_video.toml` schema to record normalization details.
- [x] Add hash generation tests for normalized outputs.

Exit criteria (from SPEC-230)
- Reference media can be normalized deterministically.
- Hashes for normalized outputs are stable across runs.

## SPEC-240: Validation Orchestration and Triage
Outcome
- Automated validation with structured reports and triage summaries.

Work items
- [x] Define `validation-config.toml` and report schema extensions.
- [x] Implement triage summary generation (drift, likely causes).
- [x] Integrate validation orchestration into the automation loop.
- [x] Add tests for report determinism and failure summaries.

Exit criteria (from SPEC-240)
- Validation runs emit deterministic reports and triage summaries.
- Failures include actionable context and artifact references.
15 changes: 15 additions & 0 deletions RESEARCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ Needed research:
- Jurisdiction-specific rules affecting preservation.
- Best practices for open source preservation tooling.

### 8) Automation, Input Replay, and Media Normalization
- Define a stable automation loop for intake, build, capture, and validation.
- Normalize reference media and capture outputs into comparable artifacts.
- Model deterministic input replay aligned to reference timelines.

Needed research:
- Capture tooling behavior and determinism guarantees.
- Input timing and latency characteristics for Switch titles.
- Video/audio similarity metrics and drift analysis.
- Operational checklist for DKCR validation artifacts (see `docs/dkcr-validation-prereqs.md`).

## Seed Resources (Reviewed)
- Jamulator write-up on static recompilation pitfalls and concurrency: https://andrewkelley.me/post/jamulator.html
- N64Recomp repository for pipeline patterns: https://github.com/N64Recomp/N64Recomp
Expand All @@ -81,6 +92,9 @@ Needed research:
- hactool (XCI/NCA extraction and keyset handling): https://github.com/SciresM/hactool
- hactoolnet (XCI/NCA extraction with user keys): https://github.com/Thealexbarney/hactoolnet
- nstool (XCI/NCA/NSO extraction): https://github.com/jakcron/nstool
- Switch HID input services: https://switchbrew.org/wiki/HID
- FFmpeg documentation (capture, formats, filters): https://ffmpeg.org/ffmpeg.html
- FFmpeg filters (SSIM/PSNR references): https://ffmpeg.org/ffmpeg-filters.html
- Ghidra SLEIGH language reference (p-code semantics): https://github.com/NationalSecurityAgency/ghidra/blob/master/GhidraDocs/languages/html/sleigh.html
- sleigh library (p-code lifting implementation): https://github.com/lifting-bits/sleigh
- FFmpeg filter reference for SSIM/PSNR/EBU R128 audio analysis: https://manpages.debian.org/bookworm/ffmpeg/ffmpeg-filters.1.en.html
Expand All @@ -97,3 +111,4 @@ Needed research:
- Which OS services are required to reach a game loop without patches?
- What is the simplest graphics path that still produces correct output?
- How can we generate reference traces without distributing proprietary content?
- What is the minimal input script fidelity needed for stable validation?
3 changes: 3 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Exit criteria:
- Implement a basic GPU command path or a thin translation layer.
- Render a test scene from recompiled code.
- Add graphics conformance tests.
- Define the automation loop inputs/outputs needed for validation.

Exit criteria:
- A test scene renders deterministically.
Expand All @@ -43,10 +44,12 @@ Exit criteria:
- Select a preservation-safe title and provide a public build pipeline.
- Expand instruction coverage to what the title needs.
- Document limitations and required assets.
- Stand up the automated recompilation loop with input replay and video validation.

Exit criteria:
- Title boots and reaches gameplay.
- Performance targets met on baseline host.
- Automated validation produces a report with stable metrics.

## Phase 5: Stabilization
- Harden tooling, improve diagnostics, and expand coverage.
Expand Down
8 changes: 8 additions & 0 deletions crates/recomp-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ license = "MIT OR Apache-2.0"
[dependencies]
clap = { version = "4.5", features = ["derive"] }
recomp-pipeline = { path = "../recomp-pipeline" }
recomp-validation = { path = "../recomp-validation" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10"
toml = "0.8"

[dev-dependencies]
tempfile = "3.10"

[[bin]]
name = "recomp"
Expand Down
Loading