Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/retired64/sm64coopdx_launcher/llms.txt

Use this file to discover all available pages before exploring further.

Building coopdx-rs from source gives you full control over the binary — debug symbols for development, or a size-optimized release binary for distribution. The project uses a standard Cargo workspace with no custom build scripts; the only external requirement beyond Rust itself is the SDL2 family of system libraries.

Prerequisites

Before building, make sure you have the following installed on your system.
coopdx-rs targets Rust edition 2024, which requires Rust 1.85 or later. Earlier toolchain versions will fail to compile. Run rustup update stable to update if needed.
Rust toolchain — Install via rustup.rs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
SDL2 development libraries — The launcher links against SDL2, SDL2_image, SDL2_mixer, and SDL2_ttf at compile time. Install the *-dev packages for your distribution:
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
All four SDL2 libraries are required. A partial installation — for example, missing SDL2_ttf — will cause a linker error during cargo build.

Build commands

Clone the repository and build with Cargo as usual. There are no code-generation steps or extra setup targets.
# Debug build (fast compilation, unoptimized, with debug symbols)
cargo build

# Release build (optimized, stripped, LTO — see profile details below)
cargo build --release
# Output binary: target/release/sm64coopdx-launcher
During development, use the debug build for faster iteration. Switch to --release when packaging or measuring performance — the size and speed difference is substantial due to the opt-level = "z" and LTO settings.

Release profile settings

The [profile.release] section in Cargo.toml is tuned for a small, fast distribution binary:
[profile.release]
opt-level = "z"      # Optimize for binary size
lto = true           # Link-time optimization (cross-crate inlining)
strip = true         # Strip debug symbols from the output binary
codegen-units = 1    # Single codegen unit for maximum optimization
SettingValueEffect
opt-level"z"Minimizes binary size, accepting slightly slower code than "3"
ltotrueEnables full link-time optimization across all crates
striptrueRemoves debug symbols; the output binary contains no DWARF data
codegen-units1Forces a single compilation unit, allowing maximum inlining and dead-code elimination
strip = true means target/release/sm64coopdx-launcher cannot be used with rust-gdb or rust-lldb directly. If you need to debug a release build, temporarily set strip = false and opt-level = 1.

Testing and linting

The project ships with a unit test suite covering the gamepad input mapping and other pure functions:
# Run the full test suite (122 unit tests)
cargo test

# Run Clippy lints
cargo clippy
The gamepad tests in gp_tests (joy_a_is_confirm, hat_up_is_nav_up, etc.) require no SDL2 context and run instantly. They validate the same joy_button_to_action and hat_to_action pure functions that the real event loop dispatches through, so passing tests mean the gamepad input paths are correct.

Dependencies

All dependencies are declared in Cargo.toml. No vendoring or patching is required; cargo build fetches them from crates.io automatically.
CrateVersionPurpose
sdl20.38Window, renderer, input, audio — core runtime
serde + serde_json1Config serialization (profiles, mod database)
reqwest0.12 (blocking)HTTP downloads in the mod Download Browser
zip2ZIP extraction for downloaded mod archives
ctrlc3Graceful Ctrl+C shutdown signal handling
dirs5XDG directory resolution (~/.local/share, ~/.config)
toml0.8Parsing launcher.toml configuration files
log + env_logger0.4 / 0.11Structured logging (set RUST_LOG=debug to enable)
md50.7ROM file validation (checks the US SM64 baserom MD5)
The sdl2 crate is built with four features: image, mixer, ttf, and unsafe_textures. The unsafe_textures feature makes Texture 'static by removing phantom lifetime parameters. This eliminates borrow-checker conflicts between Canvas and Texture during rendering and is the standard production pattern for SDL2 Rust applications — it carries no additional unsafety beyond the underlying C FFI that the crate wraps.

Build docs developers (and LLMs) love