This is a part of the VirtualGamePad project.
The source is available at https://github.com/kitswas/VirtualGamePad-PC.
History of the server's development
- The server was orginally writen in C++.
- Then I rewrote it in Rust with windows-rs for Rust's memory safety and the newer Gamepad injection Windows support.
- Windows.UI.Input.Preview.Injection, as the name says, is in preview and is buggy. (Read unusable)
I, unfortunately, didn't know the source of the problems and decided to rewrite the app according to the Microsoft recommended way for Windows Apps (C# with WinUI 3 and the Windows App SDK).
This is also when I figured that a GUI is worth the effort.
- Finally, due to the aforementioned reasons, this was created in C++ with the Win32 API and Qt6 for the UI.
How it works
- A socket connection is established between the client and the server.
- The server uses the SendInput() function to synthesize keystrokes, mouse motions, and button clicks depending on the input from the client.
It has the following implications:
- The virtual gamepad is not limited to games. You can use the virtual gamepad to control any application on the computer.
- Games that use DirectInput or XInput do not recognize input from the virtual gamepad as gamepad input but as keyboard and mouse input. If required, the controls have to be remapped in the game.
- The buttons on the virtual gamepad are mapped to the keyboard keys and mouse actions using the maps at src/networking/executor.hpp.
Note: The right analog thumbstick is mapped to the mouse, not the arrow keys.
User defined maps are partially supported.
Build Instructions
Prerequisites
Cloning and Building
Clone the repository and submodules.
git clone --recurse-submodules https://github.com/kitswas/VirtualGamePad-PC.git
Open the project (open the CMakeLists.txt file in the project root) in Qt Creator and build it.
Code Formatting
This project uses clang-format for code formatting.
It includes a PowerShell script to format the code. Run
from the project root to format the code.
Note: This script requires clang-format to be installed and available in the PATH.
Generating Documentation
This project uses Doxygen to generate documentation.
If Doxygen is available on your system,
You can generate the documentation by running the following command:
This repository has automated workflow via Github Actions.
Documentation is auto-generated and deployed to Github Pages.
Disable Actions on your own copy or delete the workflows folder if you do not want to be billed. This is not my responsiblity.