How xtremethn/lift works
1. What this repo is
Lift is a Rust/GTK4/libadwaita desktop application that ports NXLoader. Its purpose is to help a user send ROMs to a Nintendo Switch over USB or wireless. The architecture is centered around a GUI frontend plus transfer backends.
2. Top-level application boundary
src/main.rs and src/application.rs likely form the startup layer: initialize GTK/libadwaita, load resources, wire application actions, and present the main window. The app is packaged as a desktop app with a GNOME-style UI and system integration artifacts in data/.
3. UI subsystem
The src/ui/ tree contains the whole interface:
- window.rs / window.blp: main shell and navigation
- home_page.rs, roms_page/, settings.rs, rom.rs: feature pages and per-ROM UI
- circular_progress_paintable.rs: custom progress rendering for transfers
The .blp files indicate GTK Blueprint templates; the UI is mostly declarative with Rust code-behind.
4. State and model layer
src/rom_data.rs, src/config.rs.in, src/utils.rs, and src/finder.rs are the non-UI support layer:
- ROM metadata and selection state
- persistent configuration/settings
- utility functions shared across subsystems
- ROM discovery / file picking / search logic
This is the data bridge between the UI and the transfer backends.
5. Transfer workflow
The most important flow is:
user selects a ROM in the UI → app resolves ROM data → backend opens a transfer session → progress/status is reported back to the UI.
The progress indicator and separate ROM pages suggest transfers are long-running and asynchronous, with UI updates driven by backend state.
6. USB backend
src/usb/ is the USB transport subsystem. It is split into:
- manager/: device access abstraction
- manager/gudev.rs: native Linux device discovery
- manager/portal.rs: Flatpak/portal-based USB access
- async_protocol.rs: async data exchange protocol
- daemon.rs: transfer-side service/process coordination
src/usb/mod.rs ties these pieces together. This is the key boundary for local device I/O.
7. USB access modes and packaging impact
The README and file tree show an architectural split between native Linux and Flatpak:
- Native builds can use libgudev and libusb
- Flatpak builds use desktop portals for USB permission/access
This matters because USB device enumeration and permission handling are abstracted behind the manager layer, not scattered through the UI.
8. Wireless / remote subsystem
src/remote/ provides the non-USB transfer path:
- server.rs
- reader.rs
- mod.rs
The presence of both “server” and “reader” implies a self-contained protocol implementation for wireless sessions, separate from USB. In the architecture diagram this should appear as a peer transport backend alongside USB.
9. ROMs page sub-flow
src/ui/roms_page/ is a feature cluster with dedicated submodules:
- page.rs: page orchestration
- usb.rs: USB-specific ROM transfer UI
- net.rs: network/wireless transfer UI
This is a good place to draw a boundary between selection/browsing and transport execution: the page decides which backend path the user is using.
10. Resources, styling, and desktop integration
src/lift.gresource.xml, src/style.css, and the files under data/ show standard GNOME app packaging:
- compiled UI/resources bundled into the binary
- CSS styling for the widgets
- desktop entry, appstream metadata, GSettings schema, and a systemd/DBus-style service file
These are supporting infrastructure, not core logic, but they explain how the app is distributed and configured.
11. Build and localization
The project uses Cargo plus Meson integration, with Nix support via flake.nix. po/ contains translations, so the UI is localized. For an architecture diagram, these are outer build/deployment concerns rather than runtime subsystems.
12. How to draw the main runtime boundaries
A clear diagram would show:
- GTK app shell at the center
- UI pages on top
- state/model layer beneath UI
- two transport backends: USB and wireless/remote
- within USB, a split between device discovery/access and async protocol/daemon
- external dependencies: system USB stack / gudev / libusb / portal / GNOME desktop services
This captures the repo’s real separation of concerns: UI, model/state, and transport are distinct layers.
Main entry points: page.rs ROMs · usb/mod.rs USB · application.rs App · remote/mod.rs Remote
Components 26
Runtime
Application startup and the main GTK/libadwaita shell.
UI
Declarative pages and code-behind for the desktop interface.
- Window · Top-level application window and navigation container.
src/ui/window.rs - Home · Landing page and primary app overview.
src/ui/home_page.rs - ROMs · ROM browsing and transfer page controller.
src/ui/roms_page/page.rs - USB Transfer · USB-specific transfer UI and controls.
src/ui/roms_page/usb.rs - Net Transfer · Wireless transfer UI and controls.
src/ui/roms_page/net.rs - ROM Card · Per-ROM presentation and actions.
src/ui/rom.rs - Settings · Application settings page.
src/ui/settings.rs - Progress · Custom circular progress rendering for transfers.
src/ui/circular_progress_paintable.rs
State & Model
Shared data, configuration, and discovery logic.
USB Backend
USB transport, device access, and session coordination.
- USB · USB transport subsystem entry point.
src/usb/mod.rs - Device Manager · Abstracts device discovery and access.
src/usb/manager/mod.rs - gudev · Native Linux device discovery backend.
src/usb/manager/gudev.rs - Portal · Portal-based USB access for sandboxed builds.
src/usb/manager/portal.rs - Async Proto · Async USB data exchange protocol.
src/usb/async_protocol.rs - Daemon · Transfer-side service and process coordination.
src/usb/daemon.rs
Wireless Backend
Network/remote transfer path for non-USB sessions.
Packaging & Resources
Desktop integration, bundled resources, and styling.
- Resources · Compiled UI resources and app assets.
src/lift.gresource.xml - Style · Global widget styling.
src/style.css - Desktop Data · Desktop entry, schema, metainfo, and service packaging.
data/meson.build
Connections 31
- Main → App: starts · Entry point initializes the application object.
- App → Window: presents · Application creates and shows the main window.
- Window → Home: contains · Main shell hosts the home page.
- Window → ROMs: contains · Main shell hosts the ROM browsing and transfer page.
- Window → Settings: contains · Main shell opens settings.
- ROMs → ROM Card: uses · ROM page renders individual ROM items.
- ROMs → USB Transfer: routes · Selects the USB transfer path when needed.
- ROMs → Net Transfer: routes · Selects the wireless transfer path when needed.
- ROMs → ROM Data: consumes · Page reads selected ROM metadata and state.
- ROMs → Finder: discovers · Search and file picking feed ROM selection.
- ROM Card → Progress: shows · Per-ROM UI displays transfer progress.
- Settings → Config: edits · Settings page reads and updates persistent configuration.
- Home → ROM Data: summarizes · Home page surfaces ROM-related state.
- USB Transfer → USB: starts · USB transfer UI initiates backend transfers.
- Net Transfer → Remote: starts · Wireless transfer UI initiates remote sessions.
- USB → Device Manager: uses · USB transport relies on device access abstraction.
- Device Manager → gudev: native · Native Linux discovery backend.
- Device Manager → Portal: sandboxed · Flatpak/portal access path.
- USB → Async Proto: speaks · Transfers use an async protocol layer.
- USB → Daemon: coordinates · Backend coordinates with the transfer daemon.
- Remote → Server: serves · Wireless backend exposes a session server.
- Remote → Reader: parses · Wireless backend reads incoming stream data.
- App → Resources: loads · Application loads bundled UI resources.
- App → Style: applies · Application applies global styling.
- App → Desktop Data: integrates · Packaging metadata supports desktop and service integration.
- ROMs → USB: reports · USB transfer progress and status flow back to the UI.
- ROMs → Remote: reports · Wireless transfer progress and status flow back to the UI.
- Utils → Finder: supports · Shared helpers assist discovery and selection.
- Utils → USB: supports · Shared helpers are reused by transfer code.
- Utils → Remote: supports · Shared helpers are reused by wireless code.
- Config → Device Manager: influences · Settings affect transport access mode and behavior.