Skip to content

feat: windows implementation#19

Merged
ReenigneArcher merged 12 commits into
masterfrom
feat/windows-implementation
Jun 21, 2026
Merged

feat: windows implementation#19
ReenigneArcher merged 12 commits into
masterfrom
feat/windows-implementation

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

Windows implementation.

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

@read-the-docs-community

read-the-docs-community Bot commented Jun 20, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.77528% with 90 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.50%. Comparing base (798ad90) to head (ef9ad23).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/windows/windows_backend.cpp 73.60% 89 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #19      +/-   ##
==========================================
- Coverage   87.05%   86.50%   -0.56%     
==========================================
  Files          10       12       +2     
  Lines        3152     3586     +434     
  Branches     1109     1230     +121     
==========================================
+ Hits         2744     3102     +358     
- Misses        250      375     +125     
+ Partials      158      109      -49     
Flag Coverage Δ
Linux-Clang 70.36% <98.85%> (+0.90%) ⬆️
Linux-GCC 82.03% <100.00%> (+0.59%) ⬆️
Windows-MSVC 85.32% <80.26%> (+<0.01%) ⬆️
Windows-MinGW-UCRT64 77.07% <77.71%> (+1.49%) ⬆️
macOS 69.47% <98.85%> (+1.74%) ⬆️

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

Files with missing lines Coverage Δ
src/platform/windows/control_protocol.hpp 100.00% <100.00%> (ø)
src/platform/windows/windows_backend.cpp 73.60% <73.60%> (ø)

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

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

@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch 3 times, most recently from 3312431 to f919c1f Compare June 20, 2026 23:41
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch 4 times, most recently from 8f275cf to 24ed49a Compare June 21, 2026 00:51
Refine Windows packaging and driver build integration:

- cmake/packaging/windows.cmake: configure CPack for driver component when building driver and set CPACK_INSTALL_CMAKE_PROJECTS for driver installs.
- cmake/packaging/windows_wix.cmake: point CPACK_WIX_EXTENSIONS to the full WixToolset.UI extension DLL path and remove use of a separate patch file.
- Remove wix_resources/patch.xml and the FeatureRef from libvirtualhid-driver-installer.wxs.
- src/platform/windows/driver/CMakeLists.txt: normalize and deduplicate WDK root paths, search for UM import libraries (ntdll) and expose LIBVIRTUALHID_NTDLL_LIBRARY; update error messages; link ntdll; restructure custom targets to prepare/stamp the INF and then generate the driver catalog with proper dependencies and working directories.
- src/platform/windows/driver/libvirtualhid.inf.in: add SourceDisksNames/Files and DiskName entry so the INF lists source disk information.
- src/platform/windows/windows_backend.cpp: replace getenv usage with GetEnvironmentVariableA for robust environment variable reading and remove unused <cstdlib> include.

These changes improve robustness when locating WDK components, produce correct installer inputs, and make INF/catalog generation deterministic in the build.
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch 2 times, most recently from 4461727 to 98df18a Compare June 21, 2026 01:15
Refactor WiX packaging CMake: add WIX_BUILD_DIRECTORY and set a comment about UI extension versioning, always run dotnet tool install for WiX and fail on install errors, and add installation of the WixToolset.Util extension with error handling. Replace a hardcoded extension DLL path with logical extension names in CPACK_WIX_EXTENSIONS and emit the cpack package directory for debugging. These changes make extension installation more robust and simplify extension referencing for packaging.
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch 3 times, most recently from 44c2a75 to 2dc8581 Compare June 21, 2026 02:10
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch from 2dc8581 to db8e222 Compare June 21, 2026 02:16
Add CI steps for MSVC on pull requests to configure, build, sign, install and uninstall a Windows test driver package, enabling driver packaging and validation in PR builds. Update unit tests: enhance RuntimeTest to exercise gamepad creation, submit and close behavior when backend is available; adjust Windows protocol tests to use string_view and protocol structs, add coverage for unknown enum values, and rewrite copy helpers to use bounded buffers and verify truncation/zero-fill behavior. Also update includes accordingly.
Introduce test hooks and a fake control-channel for the Windows backend to allow unit testing without an installed driver. Refactor WindowsControlChannel into an abstract interface and provide a Win32 implementation; add FakeWindowsControlChannel, supporting state, helpers (enqueue/read/wait) and test-only APIs that exercise lifecycle and failure cases. Add a test-only header (windows_backend_test_hooks.hpp) and unit tests (tests/unit/test_windows_backend.cpp), and include the test source on Windows in tests/CMakeLists.txt. Enable LIBVIRTUALHID_ENABLE_TEST_HOOKS when BUILD_TESTS in src/CMakeLists.txt so tests can compile the hooks, and make a minor PowerShell formatting tweak in .github/workflows/ci.yml.
Encapsulate FakeWindowsControlChannelState into a class with thread-safe accessors and operations (create_gamepad, destroy_device, submit_input_report, output event queueing and counters). Update FakeWindowsControlChannel to delegate behavior to the new state methods. Tighten create_gamepad API to accept a const reference and use a local copy for device IO. Add windows_backend_fake_channel_utilities() and WindowsBackendUtilityResult to exercise environment-variable handling, error formatting, context start/stop, and timeout branches; include new unit test verifying these utilities. Also add a missing <string> include in the test hooks header.
Change enqueue_output_event to take LvhWindowsOutputReportEvent by const reference instead of by value to avoid an unnecessary copy when pushing to the output_events_ vector. This is a non-functional refactor that reduces allocation/copy overhead and slightly improves performance.
@ReenigneArcher ReenigneArcher marked this pull request as ready for review June 21, 2026 14:24
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch from e27d3c2 to 099c517 Compare June 21, 2026 17:07
Expose HID gamepads via the Windows VHF (Virtual HID Framework).

Updates README to mark VHF visibility items done and document VHF behavior. CMakeLists: discover VHF headers/libraries, add VHF include/library to the UMDF target, set NTDDI_VERSION, and print VHF status. INF: add registry entry to attach the VHF lower filter. libvirtualhid_umdf.cpp: integrate VHF (include vhf.h), create/manage VHF child devices per create requests, initialize a VHF I/O target, start/delete VHF devices, handle VHF async write reports by queuing/output-report events, buffer pending output reads, and perform cleanup on device removal. Overall this enables published HID gamepads to be visible to DirectInput, SDL/HIDAPI, Windows.Gaming.Input and browser Gamepad APIs.
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch from 099c517 to 30ecbd9 Compare June 21, 2026 17:15
Remove in-tree test hooks and the LIBVIRTUALHID_ENABLE_TEST_HOOKS build define, and relocate Windows backend test-only code into the test fixtures. Changes: removed the test-hook compile definition from src/CMakeLists.txt and removed the guarded test hooks from src/platform/windows/windows_backend.cpp; renamed header into tests/fixtures/include/fixtures/windows_backend_test_hooks.hpp; added tests/fixtures/windows_backend_test_hooks.cpp (defines test hook implementations and includes the backend implementation under a test-only macro); updated tests/CMakeLists.txt to compile the new fixture source and adjusted test include in tests/unit/test_windows_backend.cpp. This keeps test-only hooks out of the production library build and centralizes test fixtures in the tests tree.
@ReenigneArcher ReenigneArcher force-pushed the feat/windows-implementation branch from 6c49cf3 to a62fa9a Compare June 21, 2026 18:30
Add a new "CMake Consumption" section describing how to consume libvirtualhid via an installed package (CMAKE_PREFIX_PATH), add_subdirectory (vendored checkout), and FetchContent, and document the exported CMake target libvirtualhid::libvirtualhid. Clarifies that tests/examples/docs and the Windows driver package are opt-in and notes Linux consumers still need backend dev packages (libevdev, pkg-config). Also marks several roadmap checklist items as completed: unified API surface, CMake/FetchContent support, deferring language bindings, and decision on signed Windows driver packages.
@ReenigneArcher ReenigneArcher merged commit e6ea46c into master Jun 21, 2026
24 of 25 checks passed
@ReenigneArcher ReenigneArcher deleted the feat/windows-implementation branch June 21, 2026 18:50
@sonarqubecloud

Copy link
Copy Markdown

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