How strikerx3/ymir works
Main components
• Core Library (libs/ymir-core)
– Submodules:
• System & Scheduler (sys, core)
• Hardware Emulation (hw/*: SH2, SCU, SCSP, VDP, SMPC, M68K, CD Block, Cartridge)
• Media Loader & Filesystem (media/loader, iso, CHD, etc.)
• State Management (state/*)
• Utility & Serialization (util, serdes)
• Database (db: game_db, rom_cart_db, IPL DB)
• Front-end Applications (apps/)
– ymdasm (CLI disassembler)
– ymir-sandbox (headless sandbox harness)
– ymir-sdl3 (SDL3-based GUI emulator)
• UI Layer (windows, views, widgets, events)
• Input System (SDL3 back-end, binding, context)
• Audio System (SCSP output)
• Profile & Settings manager
• Save-state & Rewind feature (via serdes)
• Build & Packaging
– CMake scripts (CMakelists.txt, cmake/)
– Packaging modules (YmirConfig, installers)
• Tests
– Unit tests targeting libs/ymir-core (under tests/ymir-core-tests)
Relationships & data flow
• The front-end apps link against the core library.
• User input → SDL3 Input subsystem → Event queue → Core API (e.g., SMPC peripheral callbacks).
• Core Scheduler drives simulated hardware modules; these modules update System State.
• Media Loader feeds raw game data into the core (disc images, ISO, CHD).
• Core exposes frame buffers and audio buffers back to the front-end, which then renders via SDL3.
• Save-state and rewind use serialization (cereal) on the core’s state objects.
• The tests invoke core APIs directly to validate emulation correctness.
Architectural patterns & principles
• Layered modular design: “libs/ymir-core” is a purely computational layer, “apps” are presentation layers.
• Dependency inversion: front-ends depend on abstracted core APIs.
• Single-responsibility: each hardware component lives in its own namespace/subdirectory.
• Event-driven UI: separates GUI rendering, input, and emulation callbacks.
• Plugin-like media loaders: loader_bin_cue, loader_iso, loader_chd implement a common loader interface.
Technologies & frameworks
• C++17/20
• CMake build system
• SDL3 (for GUI, input, audio)
• cereal (for serialization of save-state)
• Doxygen (docs)
• GitHub Actions (CI, release workflows)
• MAME CHD, ISO, BIN+CUE, IMG+CCD, MDF+MDS support
• Use clear labels:
– Core modules in blue
– Front-ends (CLI tools, GUI) in green
– Media loaders in orange
– Tests/CI in purple
– Rectangles for modules
– Core library (blue)
– Front-end apps (green)
– Build & packaging (gray)
– Tests/CI (purple)