How proconsule/nxmp works
Project Type & Purpose
• NXMP is a native C++ video‐player application for the Nintendo Switch, built atop the MPV playback engine.
• It supports local and networked sources (HTTP, FTP, SFTP, Samba, NFS, Enigma2), hardware decoding via Tegra X1/Deko3D, playlist management, and UI via ImGui.
High-Level Layers & Main Components
a. Presentation / UI Layer
• ImGui front-end (source/UI/*, include/UIHelpers.h)
• Input & navigation (touchcontrols, mapping of Switch buttons)
• Popups, menus, file browsers, video OSD
b. Application Logic
• Playback controller (main.cpp, utils.cpp)
• Media probing (source/mediaprobe)
• Playlist management (source/playlist)
• Settings & configuration (iniparser + config.ini)
• Localization (source/i18n + langs/*.json)
• Updater (source/updater)
• Logger & stats (source/logger, source/stats)
c. Data Access / I/O Layer
• Local file systems (source/localfs/*, USB support)
• MTP (source/curldownloader + mtpclass)
• Remote file systems: Enigma2, HTTPDir, UPNP (source/remotefs/…)
• Network shares: Samba, NFS (via libs/libsmb2, libs/libnfs)
• SQLite database for caching (source/database)
d. Playback & Rendering
• libmpv wrapper (source/libmpv)
• Hardware‐accelerated decode backends (source/backends/native-deko3d)
• Generic rendering abstraction (source/backends/nxmp-render)
• Shader assets in romfs/shaders
e. External Dependencies & Libraries
• ImGui (libs/imgui, libs/imgui_toggle)
• libnfs, libsmb2 for network FS
• simpleini, sqlite3, iniparser for config/DB
• libusbhsfs for USB support
• MPV, FFmpeg hints for HW decode
Interactions & Data Flow
• On startup, the Config module reads config.ini via iniparser → Settings are passed to UI, file modules, playback engine.
• UI Layer issues commands (open folder, play file, add network source) → calls Application Logic.
• Playback Controller invokes libmpv wrapper, passing URI.
• libmpv uses appropriate FS/Network module to fetch data.
• Data flows through decode backend (Deko3D) into render abstraction → display via ImGui surface.
• Logger & Stats record events, errors, performance metrics.
• Updater connects to GitHub (via HTTPDir/curldownloader) for version checks.
Architectural Patterns & Design Principles
• Layered architecture: clear separation between UI, business logic, data access, hardware/rendering.
• Plugin-style backends: each remote FS and render backend implements a common interface.
• Single Responsibility: each folder under source/* focuses on one domain (e.g., networkshareclass, mediaprobe).
• Configuration-driven initialization: iniparser central for extensibility.
• Resource separation: romfs holds shaders and static assets; libs folder contains external projects.
Final Recommendations
• Drill down into each layer to show modular subcomponents.
• Review with engineers responsible for each module to ensure accuracy of interfaces and data flows.