Skip to content

Architecture

XiONDiGiTaL edited this page Nov 23, 2026 · 2 revisions

Architecture

EmblemWeave has two layers that share a format parser and nothing else:

  1. The launcher (apps/emblemweave, Rust + egui): finds and validates your data, drives the build, manages saves, mods, cheats and settings.
  2. The engine (engine/fefw-recomp, C++ + Vulkan): the recompiler, the lifted game code and the runtime that executes it.

The launcher is not the runtime. Redirecting Build or Play to the experimental Rust runtime is not supported.

The two paths in the repository

Path What it is State
engine/fefw-recomp The production engine: AArch64 lifter, C++ emitter, runtime, NVN-on-Vulkan, XAudio2 audio, saves Playable; the release uses it
crates/ew-* EmblemWeave's own Rust recompiler and research runtime Research path; runs the frame loop but does not render the game's draws yet

The release's Build the game and Play always target engine/fefw-recomp.

The pipeline

your game data (folder, .nsp, .nx, .nup, .xci)
      │  validate modules and build ID
      ▼
ExeFS ──► unpack main (ZBIC) ──► fefw-recomp lifter
      │                          decode AArch64, recover functions, emit C++
      ▼
generated C++ per module ──► clang-cl + lld-link ──► fefw.exe
      │
      ▼
fefw.exe: module mapping, console SDK start-up, kernel/service HLE,
          NVN on Vulkan, XAudio2 audio, RomFS, save data ──► the game runs
Piece Responsibility
engine/fefw-recomp/recomp Lifter, C++ emitter, module build definitions, hook-site format
engine/fefw-recomp/runtime Scheduler, kernel objects, services, RomFS/saves, NVN/Vulkan, audio, input, in-game menu, diagnostics
engine/fefw-recomp/game-build CMake configuration, fefw.exe build, runtime checks
apps/emblemweave Dump validation, build orchestration, toolchain/CPU target, settings, saves, mods, cheats
crates/ Format parsing, reference interpreter, experimental runtime and tooling

The runtime

  • Memory: guest arenas are reserved and committed through a small host interface; .text is not writable.
  • Threads: console threads are host threads with console priorities and affinities; the runtime's locks are short.
  • Services: nn::os, nn::fs, nn::mem, nn::vi, nn::hid, nn::audio, nn::oe, nn::account, nn::time, nn::aoc and friends are served natively. An unimplemented call stops with its name rather than silently doing nothing.
  • Graphics: NVN commands are replayed onto Vulkan; shaders are translated to SPIR-V; textures are uploaded from the game's tiled storage; presentation goes through SDL3 and a swapchain.
  • Audio: XAudio2 on Windows; Opus and the game's audio renderer feed it.
  • Files: RomFS is read-only; save data lives in a writable folder; paths cannot leave their mount.

The launcher

Organised by responsibility:

  • config: versioned, atomic settings with recovery from a damaged file;
  • theme: palettes, type and spacing tokens;
  • widgets: shared liquid-glass components;
  • gamedata: detection and validation;
  • toolchain: Visual Studio through vswhere, the MSVC toolset and SDK through vcvars, LLVM, CMake, Ninja, and a one-file compile-and-link probe;
  • jobs: background work with staged progress and cancellation;
  • pages/: one module per page.

Long operations never run on the interface thread.

Verification layers (Rust research path)

Layer Compares Catches
tools/verify_cfg.sh Interpreter vs compiled C, whole functions Emitter mistakes
tools/verify_simd.sh Interpreter vs compiled C, every vector encoding on edge-case inputs Vector-unit mistakes
tools/oracle_lockstep.py Interpreter vs Unicorn, one instruction at a time from a real snapshot Decoder mistakes

The production engine has its own checks and build-time validation; the launcher's build reports missing shaders and toolchain mismatches instead of producing a silently incomplete build.

Platform boundary

The production engine is Windows-first: Win32 threads, files, memory, XAudio2 and Media Foundation, and MSVC-lifted static libraries. A platform interface (nxrt/platform.h, with win32 and posix backends) is being built so the kernel can ask for memory, threads, synchronisation, time and files without including <windows.h>.

On Linux the platform layer builds and passes its self-test, and the launcher links and opens; the engine does not build there yet. See Linux and Steam Deck.

Directory layout

apps/emblemweave/     launcher
assets/branding/      logo
crates/ew-format/     containers and assets
crates/ew-lift/       decoder, interpreter, C emitter
crates/ew-boot/       dispatcher, module image, host services
crates/ew-gfx/        experimental Vulkan device/presenter
crates/ew-runtime/    guest memory, HLE registry
engine/fefw-recomp/   production engine
docs/                 status, architecture, graphics, legal, changelog
tools/                decode, verification and release scripts

More

Clone this wiki locally