Skip to content

feat: Add host auto-discovery and xemu setup improvements#178

Merged
ReenigneArcher merged 2 commits intomasterfrom
dev
Apr 19, 2026
Merged

feat: Add host auto-discovery and xemu setup improvements#178
ReenigneArcher merged 2 commits intomasterfrom
dev

Conversation

@ReenigneArcher
Copy link
Copy Markdown
Member

@ReenigneArcher ReenigneArcher commented Apr 19, 2026

Description

Introduce network host auto-discovery and integrate it into the UI and state flow. Adds src/network/host_discovery.{h,cpp} implementing mDNS/DNS-SD discovery, plus unit tests and a test handler for scripted results. Add merge_discovered_host() to client state to merge or append discovered hosts and prefer resolved HTTP ports when pairing. Wire discovery tasks into the shell (start/finish/reset logic, threading, timeouts) and update UI copy to explain automatic discovery. Update setup-xemu.sh to preserve existing .local/xemu files by default (with --force to overwrite), copy files without clobbering, and report reuse; add helper functions and support-asset checks. Add lwIP mDNS sources to the NXDK build via CMake to support discovery. Unit tests added/updated for client_state, host discovery, and shell view behavior.

I cannot test if this actually works at the moment because xemu cannot discover a host of the NAT interface and my physical Xbox is not network connected at the moment. Will fix forward if there are issues.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

❌ Patch coverage is 85.98131% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.41%. Comparing base (828e766) to head (cc94c0d).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/app/client_state.cpp 79.41% 1 Missing and 6 partials ⚠️
src/network/host_discovery.cpp 91.42% 0 Missing and 6 partials ⚠️
src/ui/shell_view.cpp 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #178      +/-   ##
==========================================
+ Coverage   61.82%   62.41%   +0.58%     
==========================================
  Files          30       32       +2     
  Lines        4794     4898     +104     
  Branches     2140     2185      +45     
==========================================
+ Hits         2964     3057      +93     
  Misses        910      910              
- Partials      920      931      +11     
Flag Coverage Δ
Linux 62.64% <90.00%> (+0.63%) ⬆️
macOS 50.00% <70.09%> (+0.51%) ⬆️

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 97.50% <ø> (ø)
src/network/host_discovery.h 100.00% <100.00%> (ø)
src/ui/shell_view.cpp 60.12% <0.00%> (ø)
src/network/host_discovery.cpp 91.42% <91.42%> (ø)
src/app/client_state.cpp 68.08% <79.41%> (+0.26%) ⬆️

... and 1 file with indirect coverage changes


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 828e766...cc94c0d. Read the comment docs.

Introduce network host auto-discovery and integrate it into the UI and state flow. Adds src/network/host_discovery.{h,cpp} implementing mDNS/DNS-SD discovery (with an xemu 10.0.2.2 direct gateway probe fallback), plus unit tests and a test handler for scripted results. Add merge_discovered_host() to client state to merge or append discovered hosts and prefer resolved HTTP ports when pairing. Wire discovery tasks into the shell (start/finish/reset logic, threading, timeouts) and update UI copy to explain automatic discovery. Update setup-xemu.sh to preserve existing .local/xemu files by default (with --force to overwrite), copy files without clobbering, and report reuse; add helper functions and support-asset checks. Add lwIP mDNS sources to the NXDK build via CMake to support discovery. Unit tests added/updated for client_state, host discovery, and shell view behavior.
@ReenigneArcher ReenigneArcher force-pushed the dev branch 2 times, most recently from a5fe109 to 0971dcc Compare April 19, 2026 03:46
Remove the xemu 10.0.2.2 direct gateway probing fallback and related HostDiscoveryMethod machinery; simplify mDNS-only discovery flow and update runtime/UI messaging. Add helper functions to normalize, sort and expose discovery behavior for host-native unit tests (trim_host_discovery_text, first_host_discovery_label, append_mdns_discovered_host, sort_discovered_hosts). Replace ad-hoc host sorting with a reusable comparator and sort helper, and make netif flag updates safer using std::byte and std::to_integer. Update tests to use new testing helpers and constant test addresses/ports. Also small docs tweak in README and include <cstddef> where needed.
@sonarqubecloud
Copy link
Copy Markdown

@ReenigneArcher ReenigneArcher merged commit dfa40d1 into master Apr 19, 2026
17 checks passed
@ReenigneArcher ReenigneArcher deleted the dev branch April 19, 2026 12:46
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.

1 participant