Skip to content

Nx86-emu/Nx86

Repository files navigation

Nx86

Nx86 is a GUI-first Nintendo Switch emulator and AArch64-to-x86_64-v4 native binary translation system.

The project is built around Continuous Dynamic Compilation: compile before play, profile runtime fallbacks, promote discoveries, and rebuild toward higher Native Coverage. The first product target is Linux on desktop x86_64-v4 hardware with a Vulkan graphics backend.

Current Prototype Target

Phase 0 through Phase 70 define the current prototype:

  • Linux x86_64-v4 target
  • Rust monorepo
  • egui desktop shell
  • first-launch wizard
  • menu-bar + status-bar desktop layout with a Library centerpiece, Compile and Settings screens, and developer-mode-gated Tests, Scheduler, and Inspector views
  • persistent app settings
  • SQLite title database foundation with placeholder title entries
  • JSON-line worker IPC smoke path
  • synthetic ARM64 test file loading and display
  • guest CPU state and expected register comparison
  • narrow AArch64 decoder for MOV/ADD/SUB/logical/loads/stores/B/B.cond/SVC
  • tiny interpreter for synthetic integer programs, with guest memory
  • synthetic framebuffer drawing demo rendered in the GUI
  • NxIR intermediate representation, verifier, and AArch64 lifter
  • NxIR evaluator used as a differential oracle against the interpreter
  • lazy NZCV flags with conditional branches and a dead-flag pass
  • internal x86_64 assembler with labels, stack-frame helpers, and dumps
  • Linux x86_64 executable-memory manager for trusted generated code
  • narrow NxIR-to-native x86_64 integer lowering with register allocation and spills
  • persistent .nxo native block objects with managed cache integrity checks
  • multi-block native dispatch through unconditional guest branches
  • emergency single-block JIT fallback with cache insertion and typed events
  • versioned per-title runtime profiles for JIT, branch, helper, and slowmem events
  • 64 GiB VMM skeleton with software page mapping and debug dumps
  • internal Vulkan boundary crate prepared for future ash work
  • native block chaining, fastmem/slowmem observability, memory mirroring, and self-modifying-code invalidation hooks
  • atomics, barrier semantics, guest threading, scheduler replay, and optional fiber/task scheduling for synthetic workloads
  • scalar FP and basic NEON/vector support, including packed x86_64-v4 vector lowering for the current v.2d surface
  • profile-guided hot/cold layout and expanded Native Coverage metrics
  • simple .nxhb.toml homebrew module loading, title persistence, entrypoint/stack setup, and minimal svc #0 exit handling

Phases 45 through 70 extend that base with:

  • HLE service skeleton, guest IPC, input runtime, and audio runtime foundations
  • Vulkan backend skeleton, shader translation/AOT, pipeline cache integration, and graphics profile feedback
  • title behavior patches, GSO, official title profiles, profile sanitizer, verified profile repository support, and the compatibility database
  • commercial title import scanning that records metadata and refuses compilation (the legal boundary as code), keyless title metadata/media, and commercial boot experiments over synthetic stand-ins
  • large-title bring-up: scheduled guest threads, dynamic heap growth, draw submission and present services, frame IPC reporting
  • the open-world-class synthetic research target (SPEC Phase 63, sized for TOTK-scale titles: seeded workload generator, cross-thread exclusive monitors, million-step interpretation, native conditional branches, budgeted multi-round profile-guided rebuilds)
  • the "I Paid For My Computer" Maximum optimization tier (superblock fusion, AOT GSO speculation, inlined checked memory, extended register allocation, huge cache mode) with honest integer-count measurement
  • the auto-parallelization prototype (exact dependency analysis, per-title opt-in, safe synthetic splits, rollback, frame timing warnings)
  • Pure AOT folders: manifest + checksums + legal.txt, bundled runtime service table, warmed shader cache, title-specific folders with baked compatibility patches, and a pure-native launcher (no JIT, no interpreter)
  • backend feature-level targets (x86_64-v4, x86_64-v3, baseline x86_64) with runtime host detection and reduced vector register strategies

The prototype does not import or run commercial Switch software. Native x86_64 code generation remains limited to the current synthetic decoder/lifter surface, and the homebrew path uses an Nx86-owned descriptor format rather than encrypted platform containers. Real NRO/NSO containers, full graphics/ audio/input runtimes, and commercial title startup remain later phases, as described in SPEC.md. The remaining roadmap phases (71 Windows, 72 D3D12, 73 ARM64 host research) are designed and parked in 71-73-todo.md.

Build

cargo build --workspace

Run

cargo run -p nx86-app

The GUI shell is intended to be run on Linux. Other platforms are not supported targets for this phase.

Worker Smoke

cargo run -p nx86-app -- --worker compiler-smoke
cargo run -p nx86-app -- --worker runtime-smoke
cargo run -p nx86-app -- --worker rebuild-profile
cargo run -p nx86-app -- --worker runtime-boot
cargo run -p nx86-app -- --worker runtime-frame
cargo run -p nx86-app -- --worker open-world-research # NX86_OPENWORLD_SCALE=full for research scale
cargo run -p nx86-app -- --worker pure-aot        # export + boot launch + pure-native launch

Worker modes emit versioned JSON-line IPC events; every worker is also launchable from the Compile screen in the GUI shell.

Checks

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --all-targets

Legal Boundary

Nx86 must not ship or request copyrighted game dumps, proprietary firmware, console keys, proprietary SDK code, shared saves, copyrighted binary blobs, or personal user data. Local user-provided content remains the user's responsibility.

Specification

SPEC.md is authoritative for project direction, terminology, roadmap, platform strategy, and legal boundaries. OPTIMIZATION.md is a companion draft roadmap for second-stage compiler optimization work, scoped under and subordinate to SPEC.md.

Releases

Used by

Contributors

Languages