Skip to content

feat: initial implementation#160

Draft
ReenigneArcher wants to merge 11 commits intomasterfrom
feat/initial-implementation
Draft

feat: initial implementation#160
ReenigneArcher wants to merge 11 commits intomasterfrom
feat/initial-implementation

Conversation

@ReenigneArcher
Copy link
Copy Markdown
Member

Description

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

Introduce client-side UI and state management plus extensive build and platform adjustments for Xbox/nxdk.

Key changes:
- Add app UI/state implementation (src/app/*), pairing, host records, networking, startup, logging, input navigation, streaming overlay, and many UI components.
- Add compatibility shims for OpenSSL and moonlight-common-c, plus new FindNXDK_SDL2_TTF CMake module and font/logo assets.
- Add many unit tests covering app, input, logging, network, startup and UI components (tests/unit/*).
- Update CMake build: enable export of compile commands, add xbox mingw64 CMake presets, register SDL2_TTF, include libxboxrt, and pass compat header into moonlight-common-c build.
- Revise GetOpenSSL: pin OpenSSL to 1.1.1w, add platform-aware configure/build logic for HOST vs XBOX, set configure options and env vars, and link host system libs when appropriate.
- Small cmake/source tweaks: exclude shell_screen from host tests, export compile commands for child builds, and link NXDK::Net into ws2_32 target.
- Enhance run-xemu scripts to support network mode and TAP interface, to propagate XEMU-related environment paths, and to include network args when launching xemu.
- Update .gitmodules to track OpenSSL OpenSSL_1_1_1-stable branch and update third-party/openssl submodule reference.

These changes add core UI/state functionality and platform-specific build/tooling to support building and running on Xbox (nxdk) and improve host-side OpenSSL vendoring. Some new files are large and introduce the initial app logic and tests.
Provide NXDK-specific compatibility for OpenSSL and sockets: add src/_nxdk_compat (openssl_compat.h, poll_compat.cpp, stat_compat.cpp), remove legacy openssl compat files, and wire them into CMake (include dirs, build/install commands, and source list changes). Refactor host_pairing to be cross-platform (NXDK vs Winsock): unify socket error handling, non-blocking connect helper, timeouts, TLS connect error reporting, serverinfo path construction with uniqueId, and ensure socket initialization works on NXDK. Minor UI text cleanups and include stat_compat.cpp in the final executable. Also update third-party submodule pins for moonlight-common-c and nxdk.
Introduce the first M0 client shell and supporting infrastructure: structured in-memory logging (logger + log_file), controller/keyboard input mapping, retained menu model, host records and pairing flow scaffolding, saved files and cover art cache, startup memory/video utilities, and UI state management (client_state). Adds grid/modal navigation, add-host keypad, apps view, log viewer, and many unit tests and icon assets. Also includes various refactors and helpers for host/app selection, scrolling, and menu rebuilding to enable further work on pairing, streaming and Xbox runtime integration.
Record and handle data cleanup when hosts are deleted: add pairingResetEndpoints to ClientState and new AppUpdate fields to request host-delete cleanup and carry deleted host metadata (address, port, paired flag, cover art keys). Implement helpers to remember/clear deleted host pairing and to check host_requires_manual_pairing, and clear these records when a host is successfully re-paired.

Add startup APIs to delete persisted client identity and cached cover art (delete_client_identity, delete_cover_art) with basic error reporting. Wire a delete_host_data_if_requested flow that removes cached cover art, clears texture cache, and resets the shared client identity if no paired hosts remain, updating status messages accordingly.

Improve settings/menu synchronization (sync_selected_settings_category_from_menu, rebuild_settings_detail_menu) and adjust UI rendering for the menu/options/detail layout and visuals. Simplify SVG asset handling and texture creation (use SDL scale hint for quality), and swap footer action icons for Exit in the view model.

Update many SVG icon assets to remove text parameters (nanosvg limitation) and tweak visuals, add xbe/assets README, and extend unit tests to cover host deletion/pairing cleanup, client identity deletion, and cover art deletion. Also mark several README features as completed.
Add verbose startup debug logging and encoder diagnostics, and harden video mode selection and UI layout for widescreen/HD scenarios.

- main.cpp: introduce debug_print_* helpers, log XVideoGetEncoderSettings, XVideoSetMode result, SDL initialization/window creation, and startup task lifecycle for easier diagnostics.
- splash: always apply aspect correction when framebuffer vs display aspect differs; add calculate_display_width() to compute logical UI width based on effective display aspect (header and implementation), and adjust logo scaling logic.
- ui/shell_screen: query encoder settings, compute logical screen width via calculate_display_width, apply horizontal SDL renderer scaling to render square-pixel UI, and restore scale after presenting.
- startup/video_mode: prefer 720p progressive over 1080i interlaced when both are available; add helper is_1080i and update selection logic.
- tests: add unit tests for the 4:3 correction on HD modes, calculate_display_width behavior, and preferring 720p over 1080i.
- scripts/README: note widescreen tool in README and update run-xemu.sh to set display.ui aspect_ratio = 'native' in generated config.

These changes improve widescreen support, ensure UI layout uses a logical square-pixel width, prefer progressive HD modes for clarity, and make startup video/debug issues easier to diagnose.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 59.02240% with 1006 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.06%. Comparing base (4adef88) to head (e0c4603).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/app/client_state.cpp 55.68% 310 Missing and 162 partials ⚠️
src/ui/shell_view.cpp 55.74% 74 Missing and 107 partials ⚠️
src/startup/client_identity_storage.cpp 48.42% 32 Missing and 17 partials ⚠️
src/app/host_records.cpp 71.68% 24 Missing and 23 partials ⚠️
src/startup/saved_files.cpp 61.73% 19 Missing and 25 partials ⚠️
src/logging/log_file.cpp 43.83% 28 Missing and 13 partials ⚠️
src/startup/cover_art_cache.cpp 58.22% 21 Missing and 12 partials ⚠️
src/platform/filesystem_utils.cpp 60.60% 12 Missing and 14 partials ⚠️
src/input/navigation_input.cpp 55.55% 22 Missing and 2 partials ⚠️
src/startup/host_storage.cpp 52.17% 14 Missing and 8 partials ⚠️
... and 9 more

❗ There is a different number of reports uploaded between BASE (4adef88) and HEAD (e0c4603). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (4adef88) HEAD (e0c4603)
Windows 1 0
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #160       +/-   ##
===========================================
- Coverage   61.40%   46.06%   -15.35%     
===========================================
  Files           2       26       +24     
  Lines          57     4036     +3979     
  Branches       13     1936     +1923     
===========================================
+ Hits           35     1859     +1824     
- Misses         15     1567     +1552     
- Partials        7      610      +603     
Flag Coverage Δ
Linux 46.18% <59.96%> (-15.22%) ⬇️
Windows ?
macOS 36.99% <46.09%> (-24.41%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/app/client_state.h 100.00% <100.00%> (ø)
src/logging/logger.h 100.00% <100.00%> (ø)
src/network/host_pairing.cpp 24.60% <ø> (ø)
src/splash/splash_layout.cpp 92.85% <100.00%> (ø)
src/startup/saved_files.h 100.00% <100.00%> (ø)
src/streaming/stats_overlay.cpp 100.00% <100.00%> (ø)
src/ui/menu_model.h 100.00% <100.00%> (ø)
src/app/host_records.h 50.00% <50.00%> (ø)
src/network/host_pairing.h 0.00% <0.00%> (ø)
src/network/runtime_network.h 0.00% <0.00%> (ø)
... and 16 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4adef88...e0c4603. Read the comment docs.

@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch 2 times, most recently from f8d5ab8 to 9f8a64a Compare April 6, 2026 23:41
Remove the imported ws2_32 target and all NXDK::ws2_32 link usages from CMake (FindNXDK.cmake, xbox-build.cmake, GetOpenSSL.cmake) and link against NXDK::Net instead. Update OpenSSL target linkage to omit ws2_32 on HOST Windows builds. Add lwIP/socket compatibility helpers to src/_nxdk_compat/openssl_compat.h: include lwip/opt.h, sys/time.h and string.h, declare lwip_select, provide defaults for LWIP_SOCKET_OFFSET and FD_SETSIZE (based on MEMP_NUM_NETCONN), and define fd_set plus FD_* macros and a select macro that maps to lwip_select. These changes remove the dependency on WinSock symbols and provide a minimal fd_set/select shim for lwIP on NXDK.
@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch 4 times, most recently from 2ef36ea to 2f58f07 Compare April 7, 2026 02:14
Introduce platform::filesystem utilities and centralize dependency preparation.

- Add src/platform/filesystem_utils.{h,cpp} to provide cross-platform path operations, directory creation, file size checks and prefix checks.
- Replace duplicated path and directory helper code in logging, startup (client_identity_storage, cover_art_cache, host_storage, saved_files) with platform:: APIs and use platform::join_path for consistent path handling.
- Make saved_files and host_pairing more portable: add POSIX directory enumeration and socket handling fallbacks, unify SOCKET handling and non-blocking configuration.
- Improve OpenSSL vendored build: add msys2 support, shell-quoting helpers and platform-specific configure/build commands in cmake/modules/GetOpenSSL.cmake; expose provider/platform info and link ws2_32 for Windows host builds when needed.
- Add cmake/moonlight-dependencies.cmake to prepare common third-party dependencies (moonlight-common-c, OpenSSL, enet) and use it from top-level CMakeLists and xbox-build.cmake.
- Tests: add tests/support/filesystem_test_utils.h and update tests to use it; require prepared Moonlight dependency targets in tests/CMakeLists and link Moonlight::OpenSSL (add ws2_32 on Windows), and add dependency on moonlight-common-c for test target.

These changes reduce duplicated filesystem/platform code, improve portability across Windows/Unix/NXDK, and centralize dependency configuration for builds and tests.
@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch 5 times, most recently from 6e04711 to 806469f Compare April 7, 2026 03:42
Make Windows/Mingw builds more reliable and surface better logs. CI: install mingw-w64-x86_64-cmake for MinGW CMake support and expand failure debug step to print OpenSSL configure/build logs for host and Xbox builds. build.sh: collect CMake configure args into an array, require a CMake with MinGW Makefiles on Windows, and set the MinGW generator and toolchain file. cmake/modules/GetOpenSSL.cmake: introduce a deterministic external target name, clear Make-related env vars, pass MAKEFLAGS/MFLAGS/GNUMAKEFLAGS/MAKELEVEL and enforce single-job (-j1) builds for Windows/MSYS to avoid parallel build issues; properly map compiler/AR/RANLIB into MSYS2 shell commands; use the new external target name in ExternalProject_Add and add_dependencies; and emit the OpenSSL external target in status messages. cmake/moonlight-dependencies.cmake: conditionally wire moonlight-common-c to the OpenSSL external target when defined and present. These changes improve reproducibility and Windows build stability.
@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch from 806469f to fca1ab5 Compare April 7, 2026 12:19
Add Doxygen-style comments across many public headers to document structs, functions, parameters and return values. Updated .github/copilot-instructions.md to require/mention Doxygen documentation. Files touched include openssl_compat.h, client_state.h, host_records.h, pairing_flow.h, log_file.h, logger.h, host_pairing.h, runtime_network.h, client_identity_storage.h, cover_art_cache.h, host_storage.h, saved_files.h, stats_overlay.h, menu_model.h, shell_view.h and a small SVG asset tweak. These comments improve API clarity and help enforce build-time documentation checks.
@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch 2 times, most recently from 3d105cb to afa99a2 Compare April 7, 2026 17:19
@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch 4 times, most recently from d15ae79 to 33d944e Compare April 7, 2026 21:01
@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch 2 times, most recently from 783f866 to e0c4603 Compare April 7, 2026 23:04
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
146 New issues
146 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ReenigneArcher ReenigneArcher force-pushed the feat/initial-implementation branch from e0c4603 to c8ad2df Compare April 7, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants