# RomM Companion for NextUI A dedicated **NextUI `.pak`** fork of RomM Companion built in Rust for Linux handhelds running [LoveRetro/NextUI](https://github.com/LoveRetro/NextUI) — including the **TrimUI Brick (`tg5040`)**, **TrimUI Smart Pro (`tg5040`)**, and **TrimUI Smart Pro S (`tg5050`)**. ## Features - **Native NextUI D-Pad Menu** (`launch.sh` using `minui-list` & `minui-presenter`) - **Phone / PC Web Setup Server** (`http://:8765`) — pair your handheld with **RomM 5.1.0** from your phone without typing URLs or tokens on a D-pad! - **NextUI SD Card Auto-Discovery** - Automatically scans `/Roms/* ()/` and `/Saves//` - Maps NextUI tags (`GB`, `GBC`, `GBA`, `FC`, `SFC`, `N64`, `NDS`, `PS`, `PSP`, `MD`, `SMS`, `GG`, `DC`, `PCE`, `NGP`, `WSC`, `FBN`, etc.) to RomM platform slugs - Supports **both** NextUI save formats: - MinUI double-extension style (`Game.gba.sav`, `Game.gba.state0`) - RetroArch style (`Game.srm`, `Game.state.0`) - Zips folder-per-game saves (such as `/Saves/PSP/PSP/SAVEDATA/*`) automatically - **RomM 5.1.0 Two-Way Save Sync & Save States** - Uses `/api/sync/negotiate`, `/api/saves`, `/api/saves/{id}/downloaded`, `/api/sync/sessions/{id}/complete`, and `/api/states` - Creates timestamped backups on your SD card (`/.userdata/shared/romm-companion/backups/`) before overwriting any local save - Resolve conflicts either directly on the handheld or from your phone - **On-Device ROM Downloader** - Browse your RomM platforms & ROMs on the handheld and download directly into the matching `/Roms/ ()/` folder! ## Building the `.pak` for TrimUI (`tg5040` / `tg5050`) Both `tg5040` and `tg5050` use **ARM64 (`aarch64`) Linux**, so a single static `aarch64-unknown-linux-musl` binary works on all of them: ```bash # Recommended on macOS: install zig + cargo-zigbuild once brew install zig export PATH="$HOME/.cargo/bin:$PATH" cargo install cargo-zigbuild # Build the ready-to-copy Pak ./build-pak.sh ``` Copy `dist/RomM Companion.pak/` to your NextUI SD card: - **TrimUI Brick / TrimUI Smart Pro**: `/Tools/tg5040/RomM Companion.pak/` - **TrimUI Smart Pro S**: `/Tools/tg5050/RomM Companion.pak/` > Note: NextUI includes `minui-list` and `minui-presenter` (or you can place their `tg5040`/`tg5050` binaries inside `RomM Companion.pak/bin/`). If `minui-list` is absent, `launch.sh` falls back to running an immediate sync. ## Local Testing on macOS / Linux ```bash export PATH="$HOME/.cargo/bin:$PATH" cargo test # Test the phone/PC web setup UI locally against a mock SD card folder: SDCARD_PATH=/tmp/mock-nextui cargo run -- web-setup --port 8765 ```