feat: initial implementation#160
Merged
ReenigneArcher merged 35 commits intomasterfrom Apr 18, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #160 +/- ##
==========================================
+ Coverage 61.40% 61.82% +0.42%
==========================================
Files 2 30 +28
Lines 57 4794 +4737
Branches 13 2140 +2127
==========================================
+ Hits 35 2964 +2929
- Misses 17 910 +893
- Partials 5 920 +915
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
3d105cb to
afa99a2
Compare
2edc2b0 to
cf77c81
Compare
Refactor add-host keypad handling and improve controller navigation/UI behavior. - Replace ad-hoc keypad button list with fixed character arrays and AddHostKeypadLayout; add helper to get selected keypad character and robust wrapping navigation across rows. - Add GamepadAxisDirection enum and mapping for axis directions to UI commands; support left-stick navigation with hysteresis and held-repeat timing. - Rework SDL event loop to use a short wait timeout, process events, and poll controller navigation when idle; add per-direction hold state and repeat/seeding logic; avoid jitter and require neutral stick when non-navigation commands occur. - Introduce KeypadModalLayoutCache to cache modal text measurements and reduce redraws; optimize modal rendering and drawing conditions for keypad modal. - Update shell view text and modal footer actions to reflect new controls and improve help messaging. - Simplify host_pairing: remove legacy JSON parsing helpers and SHA-1 legacy support, force SHA-256 pairing digest, and adjust digest/key derivation APIs; return an explicit error when applist is not XML. - Minor input and UI tweaks (constants, thresholds, repeat timings) and corresponding unit test updates. These changes improve controller UX (left-stick support, repeat behavior), simplify keypad logic, and remove legacy pairing code paths.
Add an IDE run configuration (.run/docs.run.xml) to open the generated docs HTML. Replace the old loading.png with three new screenshots under docs/images/screenshots and update README to show the new images and clarify that streaming does not work yet and 1080i does not work in Xemu. Also tidy the TODO checklist by marking docs via doxygen done and removing the duplicate entry.
Add test-output/ to .gitignore and delete generated test logs under test-output/logging (long-lines.log, moonlight.log, reset.log). These are ephemeral test artifacts and should not be tracked in the repository.
Stop tracking the binary vegur-regular.ttf and instead copy it from the nxdk samples during the CMake xbox asset sync. Remove the committed font file from the repo. Update CI and docs: drop mingw-w64-x86_64-make from the workflow and remove the failing OpenSSL debug-logs step, and adjust README to use mingw-w64-x86_64-cmake (plus minor formatting).
Introduce a lightweight activeHost snapshot and hostsLoaded flag to allow unloading the hosts page while preserving host-specific screens. Add utilities to remember/restore selected host, unload per-screen state, and route lookups via find_loaded_host_by_endpoint. Implement a thread-safe HostProbeResultQueue and refactor host probing to spawn per-host worker threads that publish results into the queue; the main loop now drains and reap workers, updating host reachability and persisting metadata changes. Extend host-record serialization to include cached host metadata and app-list entries (with percent-encoding/decoding and parsing helpers) so app lists, artwork cache keys, and related flags are persisted. Update persistence and shell logic to merge activeHost into saved hosts when saving, lazily load hosts for the hosts screen, release page resources on screen changes, and adjust related client_state/shell behavior. Tests updated to reflect the new unload/load semantics and probe behavior.
Introduce persistent TOML-backed app settings and expand logging features. - Add third-party tomlplusplus submodule and include it in the Xbox build. - Implement settings storage (src/app/settings_storage.*) to load/save moonlight.toml (logging and UI keys), with parsing, validation, warnings and cleanup hints. - Add AppSettings types and load/save APIs (settings_storage.h). - Add storage_paths helper for default storage locations and platform error utilities. - Enhance logging subsystem: - Add global logger proxy (global_logger.*) and startup debug support. - Add source-location support and richer formatting in logger; include optional file/line in entries. - Add runtime file sink type and ability to set file sink, per-sink minimum levels, debugger-console minimum level, and startup debug flag. - Change default in-memory/file logging levels handling and improve sink dispatching. - Update client_state to use new settings, add detailed UI menu item descriptions, track settingsDirty/settingsChanged, expose xemu console logging level, and restructure create_initial_state to explicit member initialization. - Update run-xemu.sh to add environment flags controlling xemu serial stdio and to include serial device args conditionally. - Update CMake includes for tomlplusplus and adjust logging/log_file storage path resolution to use new storage helpers. - Add startup debug logger files and tests for settings/logging components; add third-party/tomlplusplus submodule. These changes add user-configurable TOML settings, improve observability during startup and runtime, and enable mirrored logging to xemu's serial console.
Remove separate global_logger and startup_debug modules and move their functionality into logger.{h,cpp}. Introduces process-wide logger management and convenience logging APIs (set_global_logger, log/trace/debug/info/warn/error, set_minimum_level, set_file_sink, set_file_minimum_level, set_debugger_console_minimum_level, set_startup_debug_enabled, snapshot, format_startup_console_line, startup console enable/print helpers). Replace uses of logging::logger proxy and StartupConsoleStyle with the new logging::* free functions and LogLevel-based startup console functions across main, splash, startup, ui and tests. Add internal g_globalLogger and startup-console state, and NXDK-aware startup console printing. Update includes to use logger.h and tidy up related tests.
Break up large command and app-list functions into focused helper routines. Extracted modal helpers (close_modal_and_mark_closed, per-modal handlers, handle_modal_activation) and host/app action helpers (request_host_pairing, delete_selected_host, collect_deleted_host_cover_art_keys). Reworked apply_app_list_result into smaller pieces (find_app_list_result_host, merge_host_app_records, apply_unpaired_app_list_failure, apply_cached_app_list_failure, restore_selected_app_after_refresh) and tightened null/update checks. Also modularized UI command handling (overlay, add-host keypad, settings, hosts, apps) to improve readability and maintainability with no intended behavioral changes.
Group related ClientState fields into nested substructures (hosts, apps, shell, settings, persistence, navigation, requests) and update all usages accordingly. Moves host list into hosts.items and renames numerous fields (e.g. activeHost -> hosts.active, activeScreen -> shell.activeScreen, statusMessage -> shell.statusMessage, hostsDirty -> hosts.dirty, logViewer* and savedFiles into settings.*, pairingResetEndpoints into hosts.pairingResetEndpoints). Also adapts AppUpdate fields to new namespaces (navigation/requests/persistence) and updates related logic and tests to match the new layout.
Integrate nanosvg to rasterize SVG assets to requested pixel bounds and make asset texture caching size-aware. Adds helpers: build_asset_texture_cache_key, calculate_fitted_dimensions and load_svg_surface_from_asset; load_texture_from_asset now optionally rasterizes SVGs when max dimensions are provided. The asset cache keys include raster dimensions and failed-key tracking was updated accordingly; load_cached_asset_texture and render_asset_icon were updated to pass requested bounds. Removed the dedicated titleLogoTexture field and its load/destroy calls in favor of rendering the logo via the asset cache. Also updates several SVG icon assets with revised vector art.
2c7bd74 to
aebf7e4
Compare
Make the pairing flow expose generated PINs immediately by setting PairingStage to pin_ready and updating status text. Remove the pre-check that aborted background pairing when reachability wasn't confirmed and use app::effective_host_port for pairing attempts. Update shell UI messaging accordingly. Adjust and extend unit tests to match the new behavior and add coverage for input mappings, host pairing parsing/validation, address resolution, and runtime network status handling.
Introduce a HostPairingHttpTestHandler and associated request/response structs to allow tests to script and intercept host-pairing HTTP/TLS exchanges. Add global test handler (g_host_pairing_http_test_handler) and set/clear functions, and wire the handler into host_pairing's transport path to short-circuit real network calls when present. Refinement: improve pairing failure message construction to preserve meaningful details. Add comprehensive unit tests and test helpers (scripted exchanges, crypto helpers, scoped handler) to validate pairing, server-info, app-list and asset flows. Also include necessary <functional> and OpenSSL utilities for the new tests.
Delete two documentation files that are no longer needed: docs/sunshine-pairing-research.md and docs/working-client-plan.md. These removals clean up outdated design notes and planning artifacts from the repository.
Add and expand unit tests across the codebase to improve coverage and validate edge cases. Highlights: - Add many new tests in tests/unit/app/* to cover connection test handling, pairing validation and flow, host/app context actions, settings placeholder activation, confirmation modal behavior, saved files and status clearing; also adjust path literals to raw string form for Windows paths. - Add tests in tests/unit/host_records_test.cpp to validate display name restrictions, percent-encoding of cached app fields, matching endpoints against resolved http/https ports, port parsing, and stable enum string names. - Extend settings storage tests to cover missing files, mixed-case logging values, cleanup of unknown/legacy keys, and parse/type error warnings. - Add logging tests for reading unterminated log files, runtime file sink path accessor, formatting helpers, additional sink minimum-level behavior, zero-capacity fallback, and startup console helpers; also introduce write_raw_text_file helper. - Add a new tests/unit/platform/filesystem_utils_test.cpp covering path joining, parent/file name helpers, directory creation, file size checks, and prefix comparisons (platform-specific behavior). - Extend startup tests (client identity, cover art cache, saved files) to trim trailing newlines, warn on missing cert/key, save/load nested cover art, build cache keys, list nested cover-art files, and validate delete behavior for empty paths. - Update UI shell view tests for rendering saved file sizes, app badges, port keypad display, pair-host reachability messages, and overlay fallback text; adjust expectations where extra body lines are present. Also add small test helpers (write_text_file / write_raw_text_file) and minor test adjustments to reflect expected UI/content changes. These changes are focused on tests only and do not modify production logic.
Replace the global test handler with a function-scoped static (host_pairing_http_test_handler) and update callers to use it, avoiding the previous global g_host_pairing_http_test_handler. Convert test utilities and data paths to use std::byte-based buffers and helper converters for OpenSSL interop (openssl_bytes), update hex encoding/decoding to use std::from_chars, and add helpers (filled_bytes, sequential_bytes). Consolidate repeated scripted pairing request logic into handle_short_challenge_pairing_request and handle_successful_pairing_request handlers and add make_host_pairing_http_test_handler to simplify test setup. Also change a couple of test helpers to accept std::string_view for content and adjust scripts/run-xemu.sh to assign then export APPDATA/LOCALAPPDATA in separate steps.
Replace unsafe reinterpret_cast helpers with explicit conversion functions between std::byte and unsigned char for OpenSSL calls, and update functions (sha256_digest, aes_128_ecb_encrypt, sign_sha256_hex) to use those conversions. Simplify hex encoding/decoding to avoid C-style arrays and from_chars pointer issues. Introduce SuccessfulPairingScriptContext to bundle pairing test parameters and update handle_successful_pairing_request and its test usage accordingly. Also use an if-init statement for the HostPairingHttpTestHandler lookup in host_pairing.cpp for clearer scoping. These changes improve safety, clarity, and correctness of the tests and OpenSSL interactions.
Improve GetOpenSSL.cmake by normalizing variable names and adding shell helper functions: _moonlight_shell_quote and _moonlight_join_shell_command to safely quote and join arguments for shell/MSYS2 use. _moonlight_to_msys_path was adjusted to use the new normalized variable names. Rename the common-dependencies macro to MOONLIGHT_PREPARE_COMMON_DEPENDENCIES (and update its invocation in xbox-build.cmake) to standardize naming and clarify intent.
Split and reorganize MSYS2 detection logic in cmake/msys2.cmake into smaller helper functions. Centralized caching of MOONLIGHT_MSYS2_ROOT via _moonlight_set_detected_msys2_root and added helpers to build candidate lists (_moonlight_get_configured_msys2_root_candidates, _moonlight_get_default_msys2_root_candidates), to try candidate roots (_moonlight_try_msys2_root_candidates), to probe from given tool paths (_moonlight_try_msys2_root_from_tools), to probe PATH for common tools (_moonlight_try_msys2_root_from_path_tools), and to check hinted installation roots (_moonlight_try_hinted_msys2_root). The main moonlight_detect_windows_msys2_root was rewritten to orchestrate these helpers and keep behavior while cleaning up responsibility and removing duplicated cache writes. Also minor formatting change in tests/CMakeLists.txt to wrap the fatal error message across lines for readability.
cc39917 to
e25ea15
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Phase 1 of implementation
TODO:
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage