๐ฎ Gamepad-Core Host Bridge
August 24, 2026 ยท View on GitHub
Gamepad-Core Host Bridge is a native C++ library that exposes the functionality of Gamepad-Core through a high-level, C-compatible API. The current project version is 1.0.6.
Live Tests โข Features โข API Lifecycle โข API References โข Quick Testing โข JavaScript, TypeScript & WebAssembly โข Build โข Structure โข Contributing โข License
โจ Features
- Device Registry Integration: Support for host applications or external game engines.
- Platform Bridge Callbacks: Efficient device detection and I/O operations.
- Handle Management: Support for creating and invalidating device handles natively within the platform.
- Advanced Forwarding: Seamless forwarding of input, output, and audio-haptics operations.
- C-Compatible Entry Points: Exported endpoints optimized for managed language integrations.
- Direct Debugging: Configurable log callbacks for real-time host debugging.
โ๏ธ Native API Lifecycle
The host application should implement the following lifecycle and update loop steps:
- Initialize the Bridge: Set up platform bridge callbacks by calling
GCH_InitializePlatformBridge. - Register Policies: Define allocation, dispatch, and disconnection callbacks via
GCH_InitializeDeviceRegistryPolicy. - Discover Devices: Continuously poll for new hardware by calling
GCH_DiscoverDevicesfrom within the update loop. - Update Controllers: Refresh the state of each connected controller using
GCH_UpdateInput. - Retrieve Data: Access input states and hardware information via
GCH_GetInputStateandGCH_GetDeviceDescriptor.
Callbacks & Shutdown
- Logging: Bridge logs can be redirected by configuring a function callback via
GCH_SetLogCallback. - Version Checking: Retrieve the compiled library version with
GCH_GetVersion. - Safe Shutdown: Upon termination, the host application must call
GCH_Shutdownto safely destroy the platform instance and clear callback pointers.
๐งช Live Tests
Try the WebAssembly build directly in your browser:
Open Gamepad-Core Live Tests โ
Connect a supported gamepad and test the native C++ bridge running through WASM.
Test quickly with a C# implementation or create an implementation for your preferred language. The C-compatible API is designed to integrate seamlessly with any language that supports FFI (Foreign Function Interface), including Python, Rust, Go, Java, and more.
๐ฅ Precompiled Binaries (Windows x64)
For quick integration without building from source, download the precompiled GamepadCoreHost.dll binary directly from the releases page. This shared library is ready to use with any compatible host application or game engine that supports C-compatible FFI (Foreign Function Interface).
๐ Client Implementation
Check out the companion command-line application that consumes this API:
- Gamepad-Client (C#) - Console application example consuming this
Quick Start:
dotnet build .\G-Client-Sharp\G-Client-Sharp.csproj
Running without arguments prints the default DLL location and command-line help:
dotnet run --project .\G-Client-Sharp\G-Client-Sharp.csproj
Start device monitoring with the default DLL path and display the native API descriptor information:
dotnet run --project .\G-Client-Sharp\G-Client-Sharp.csproj -- --info
Pass a different native DLL path with --dll (or -d):
dotnet run --project .\G-Client-Sharp\G-Client-Sharp.csproj -- `
--dll "C:\path\to\GamepadCoreHost.dll"
The DLL must match the process architecture. Use an x64 DLL with the x64 .NET process.
Check out the companion command-line application that consumes this API:
- Gamepad-Client (Python) - Python Console application example consuming this
Use the configured default DLL path:
python main.py
Provide a DLL path explicitly:
python main.py --dll "C:\path\to\GamepadCoreHost.dll"
Continuously discover devices and process inputs:
python main.py --loop
Useful options:
-d, --dll PATH Path to GamepadCoreHost.dll
-l, --loop Run continuous discovery and input polling
-i, --interval TIME Loop interval in seconds
--info Display native API structure details
๐ JavaScript, TypeScript & WebAssembly
The C-compatible API can also be consumed from JavaScript and TypeScript through WebAssembly, compiled with Emscripten. This makes Gamepad-Core Host available to browser applications, Node.js tools, and other JavaScript runtimes that support WebAssembly.
The WebAssembly build generates GamepadCoreHost.js and GamepadCoreHost.wasm.
For JavaScript callback binding, it exports addFunction/removeFunction and
supports callback-table pointers through:
GCH_InitializePlatformBridgeWasmGCH_InitializeDeviceRegistryPolicyWasm
Download the precompiled WebAssembly package:
TypeScript integrations can use the generated JavaScript module together with custom type declarations for the exported native functions and callback signatures.
๐ API References
The following functions are exported by the native bridge:
| Function | Return type |
|---|---|
GCH_DiscoverDevices(float DeltaTime) | void |
GCH_UpdateInput(int DeviceId, float DeltaTime) | void |
GCH_UpdateOutput(int ControllerId) | void |
GCH_GetInputState(int DeviceId, FInputContext* OutInputState) | bool |
GCH_GetDeviceDescriptor(int DeviceId, GamepadDeviceDescriptor* OutDescriptor) | bool |
GCH_DeviceIsConnected(int ControllerId) | bool |
GCH_GetDeviceType(int ControllerId) | int |
GCH_GetConnectionType(int ControllerId) | int |
GCH_BatteryLevelDevice(int ControllerId) | float |
GCH_Lightbar(int ControllerId, std::uint8_t R, std::uint8_t G, std::uint8_t B) | void |
GCH_PlayerLed(int ControllerId, int Led, std::uint8_t Brightness) | void |
GCH_ResetLights(int ControllerId) | void |
GCH_ResetGyroOrientation(int ControllerId) | void |
GCH_EnableGyroscopeValues(int ControllerId, bool EnableGyroscope) | void |
GCH_EnableTouch(int ControllerId, bool EnableTouch) | void |
GCH_CustomTrigger(int ControllerId, const std::uint8_t* HexBytes, int ByteCount, int Hand) | bool |
GCH_StopTrigger(int ControllerId, int Hand) | void |
GCH_SetVibration(int ControllerId, std::uint8_t LeftRumble, std::uint8_t RightRumble) | void |
The int parameters used for device type, connection type, LED, and trigger hand correspond to the enum values defined by the native Gamepad-Core/Dualsense-Multiplatform library.
GCH_DualSenseSettings allows you to configure advanced settings exclusive to the DualSense controller, including
audio control (microphone, headset, speaker), volumes, vibration modes, and force reduction on adaptive triggers.
GCH_DualSenseSettings(int ControllerId, std::uint8_t bIsMic, std::uint8_t bIsHeadset, std::uint8_t bIsSpeaker, std::uint8_t MicVolume, std::uint8_t AudioVolume, std::uint8_t RumbleMode, std::uint8_t RumbleReduce, std::uint8_t TriggerReduce)
๐ ๏ธ Building
Initialization & Build:
If you want to build your custom version, you can start with this example project and consult the available methods at https://github.com/rafaelvaloto/Dualsense-Multiplatform.
Requirements:
- CMake 3.20 or newer.
- A C++20 compatible compiler.
- The
3rdParty/Gamepad-Coresubmodule included in the project setup.
Initialize the submodule and configure the project by running:
git submodule update --init
cmake -S . -B build -DGCL_DEBUG=OFF
cmake --build build
Note: Set
GCL_DEBUG=ONto enable Gamepad-Core host logging. The build process will generate theGamepadCoreHostshared library.
To build the WebAssembly module for JavaScript and TypeScript, configure CMake with the Emscripten toolchain:
cmake -S . -B build-wasm -DGCL_DEBUG=OFF -DCMAKE_TOOLCHAIN_FILE=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
cmake --build build-wasm
๐ Project Structure
Source/Publicโ Public bridge policies and adapters.Source/Privateโ Internal bridge implementations.3rdParty/Gamepad-Coreโ The core dependency submodule.
๐ค Contributing
All suggestions and collaborations are welcome! Feel free to open issues, submit pull requests, or share your ideas to help improve this project.
๐ License
This project utilizes the Gamepad-Core (Dualsense-Multiplatform) library.
Copyright (c) 2026 valoto.games. All rights reserved.