|
| 1 | +# Controller2Mouse |
| 2 | + |
| 3 | +A Windows application that maps Xbox controller inputs to mouse movements and actions, allowing you to control your cursor with a gamepad. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Mouse Movement**: Use the right analog stick to move the cursor |
| 8 | +- **Scroll Control**: Use LT/RT triggers to scroll up/down |
| 9 | +- **Mouse Buttons**: |
| 10 | + - Left Stick Press → Right Click |
| 11 | + - Right Stick Press → Left Click |
| 12 | + - Both Sticks Press → Middle Click |
| 13 | +- **Virtual Keyboard**: Press both thumbsticks simultaneously to open the on-screen keyboard |
| 14 | +- **Auto-Detection**: Automatically detects and connects to available controllers |
| 15 | +- **Multi-language Support**: English, 简体中文,繁體中文,日本語 |
| 16 | +- **Modern UI**: Clean, transparent window design with Windows 11 styling |
| 17 | + |
| 18 | +## Requirements |
| 19 | + |
| 20 | +- Windows 10 version 19041.0 or higher |
| 21 | +- .NET 11.0 Runtime |
| 22 | +- Xbox controller (or compatible DirectInput controller) |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +### Download Pre-built Release |
| 27 | +Download the latest release from the [Releases](../../releases) page. The application is published as a self-contained single-file executable, so no additional dependencies are needed. |
| 28 | + |
| 29 | +### Build from Source |
| 30 | + |
| 31 | +```bash |
| 32 | +# Clone the repository |
| 33 | +git clone <repository-url> |
| 34 | +cd Controller2Mouse |
| 35 | + |
| 36 | +# Build the project |
| 37 | +dotnet build -c Release |
| 38 | + |
| 39 | +# Publish as single-file executable |
| 40 | +dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true |
| 41 | +``` |
| 42 | + |
| 43 | +The published executable will be in `bin/Release/net11.0-windows10.0.26100.0/win-x64/publish/`. |
| 44 | + |
| 45 | +## Usage |
| 46 | + |
| 47 | +1. Launch `Controller2Mouse.exe` |
| 48 | +2. Connect your Xbox controller via USB or Bluetooth |
| 49 | +3. The application will automatically detect the controller |
| 50 | +4. Click "Start Mapping" to begin controlling the mouse |
| 51 | +5. Click "Stop Mapping" or close the application to exit |
| 52 | + |
| 53 | +## Controls |
| 54 | + |
| 55 | +| Controller Input | Mouse Action | |
| 56 | +|------------------|--------------| |
| 57 | +| Right Stick | Move Cursor | |
| 58 | +| LT Trigger | Scroll Up | |
| 59 | +| RT Trigger | Scroll Down | |
| 60 | +| LT + RT | Middle Click | |
| 61 | +| Left Stick Press | Right Click | |
| 62 | +| Right Stick Press | Left Click | |
| 63 | +| Both Thumbsticks Press | Open Virtual Keyboard | |
| 64 | + |
| 65 | +## Configuration |
| 66 | + |
| 67 | +Advanced users can modify the following constants in [`ControllerToMouseMapper.cs`](Controller2Mouse/ControllerToMouseMapper.cs): |
| 68 | + |
| 69 | +- `Deadzone`: Controller stick deadzone threshold (default: 2500) |
| 70 | +- `SensitivityX`: Horizontal mouse sensitivity (default: 0.0005f) |
| 71 | +- `SensitivityY`: Vertical mouse sensitivity (default: 0.0005f) |
| 72 | +- `ScrollSensitivity`: Scroll wheel sensitivity (default: 0.1f) |
| 73 | + |
| 74 | +## Technology Stack |
| 75 | + |
| 76 | +- **Framework**: .NET 11.0 with WPF |
| 77 | +- **Input Library**: SharpDX.XInput 4.2.0 |
| 78 | +- **Platform**: Windows 10/11 |
| 79 | + |
| 80 | +## Development |
| 81 | + |
| 82 | +### Project Structure |
| 83 | + |
| 84 | +``` |
| 85 | +Controller2Mouse/ |
| 86 | +├── App.xaml # Application entry point |
| 87 | +├── MainWindow.xaml # Main UI window |
| 88 | +├── ControllerToMouseMapper.cs # Core controller-to-mouse mapping logic |
| 89 | +├── MouseSimulator.cs # Windows SendInput API wrapper |
| 90 | +├── Languages/ # Localization resources |
| 91 | +│ ├── en-US.xaml |
| 92 | +│ ├── zh-CN.xaml |
| 93 | +│ ├── zh-TW.xaml |
| 94 | +│ └── ja-JP.xaml |
| 95 | +└── Controller2Mouse.ico # Application icon |
| 96 | +``` |
| 97 | + |
| 98 | +### Building |
| 99 | + |
| 100 | +```bash |
| 101 | +# Debug build |
| 102 | +dotnet build |
| 103 | + |
| 104 | +# Release build |
| 105 | +dotnet build -c Release |
| 106 | + |
| 107 | +# Run the application |
| 108 | +dotnet run |
| 109 | +``` |
| 110 | + |
| 111 | +## Troubleshooting |
| 112 | + |
| 113 | +**Controller not detected:** |
| 114 | +- Ensure the controller is properly connected |
| 115 | +- Try pressing any button to wake up the controller |
| 116 | +- Check Device Manager for controller drivers |
| 117 | + |
| 118 | +**Cursor movement too fast/slow:** |
| 119 | +- Adjust `SensitivityX` and `SensitivityY` values in the source code |
| 120 | +- Rebuild the application after changes |
| 121 | + |
| 122 | +**Application won't start:** |
| 123 | +- Ensure .NET 11.0 Runtime is installed |
| 124 | +- Check Windows Event Viewer for error details |
| 125 | + |
| 126 | +## License |
| 127 | + |
| 128 | +This project is provided as-is for educational and personal use. |
| 129 | + |
| 130 | +## Acknowledgments |
| 131 | + |
| 132 | +- Built with [SharpDX](https://github.com/sharpdx/SharpDX) for XInput support |
| 133 | +- Uses Windows SendInput API for mouse simulation |
0 commit comments