Add missing C API bindings for MaaFramework#22
Merged
Conversation
Co-authored-by: MistEO <18511905+MistEO@users.noreply.github.com>
Co-authored-by: MistEO <18511905+MistEO@users.noreply.github.com>
Co-authored-by: MistEO <18511905+MistEO@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix gaps in CS binding for C interfaces
Add missing C API bindings for MaaFramework
Jan 13, 2026
There was a problem hiding this comment.
Pull request overview
This PR synchronizes C# bindings with the MaaFramework C API, adding missing controller APIs, gamepad support, and fixing the custom controller callback struct layout.
Changes:
- Added extended controller methods (
Click/SwipeV2) with contact and pressure parameters - Added gamepad controller support with three new enums (
GamepadType,GamepadButton,GamepadTouch) - Fixed custom controller callback struct by adding missing
Connectedcallback and removingRequestResolution
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/MaaFramework.Binding/IMaaController.cs |
Added overloaded Click/Swipe methods with contact and pressure parameters, and GetResolution method |
src/MaaFramework.Binding/Enums/Controllers/GamepadType.cs |
New enum for virtual gamepad types (Xbox360, DualShock4) |
src/MaaFramework.Binding/Enums/Controllers/GamepadTouch.cs |
New enum for gamepad analog input mapping (sticks and triggers) |
src/MaaFramework.Binding/Enums/Controllers/GamepadButton.cs |
New flags enum for gamepad button codes with Xbox and DualShock 4 aliases |
src/MaaFramework.Binding/Custom/IMaaCustomController.cs |
Added Connected() method, removed RequestResolution() method to match C API |
src/MaaFramework.Binding.UnitTests/Test_Custom.cs |
Updated test implementation to include Connected() method, removed RequestResolution() |
src/MaaFramework.Binding.Native/MaaController/MaaGamepadController.cs |
New wrapper class for MaaGamepadControllerCreate with ViGEm-based virtual gamepad support |
src/MaaFramework.Binding.Native/MaaController.cs |
Implemented new Click/Swipe V2 and GetResolution methods |
src/MaaFramework.Binding.Native/Interop/Framework/MaaDef.cs |
Added type aliases for gamepad types |
src/MaaFramework.Binding.Native/Interop/Framework/Instance/MaaCustomController.cs |
Fixed struct layout by adding Connected callback between Connect and RequestUuid |
src/MaaFramework.Binding.Native/Interop/Framework/Instance/MaaController.cs |
Added P/Invoke declarations for new controller APIs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
moomiji
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs C# bindings with MaaFramework C headers from
include/. Adds missing controller APIs, gamepad support, and fixes custom controller struct layout.Controller API Additions
MaaControllerPostClickV2/MaaControllerPostSwipeV2- Extended variants with contact and pressure paramsMaaControllerGetResolution- Raw device resolution getterMaaGamepadControllerCreate- Virtual gamepad controller (ViGEm-based)Gamepad Enums
GamepadType- Xbox360, DualShock4GamepadButton- XUSB button flags with DS4 aliasesGamepadTouch- Analog stick/trigger contact mappingCustom Controller Fix
Fixed
MaaCustomControllerCallbacksstruct layout - added missingConnectedcallback betweenConnectandRequestUuid. RemovedRequestResolutionfrom interface (not in C API).Usage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
maaxyz.github.io/usr/bin/dotnet dotnet build --no-restore(dns block)/usr/bin/dotnet dotnet restore(dns block)/usr/bin/dotnet dotnet restore --ignore-failed-sources(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.