Skip to content

Converts mouse/touchpad/tablet/android/keyboard input to vJoy output, created using vjoyinterface and winapi32. Useful for games like Assetto Corsa, Live For Speed, Rfactor. Requires installed version of VJoy 2.1.8+.

License

Notifications You must be signed in to change notification settings

xCuri0/MouseToVJoy

 
 

Repository files navigation

MouseToVJoy

Use mouse/touchpad/android/keyboard input in games as a input device using vJoy.

Assetto Corsa using MouseToVjoy with Android touchpad

Features

  • Steering center multiplier
  • H-Shifter emulation
  • Scroll wheel throttle
  • Shifter using scroll wheel
  • Mouse locking and cursor hiding
  • Force Feedback
  • Below 1ms low latency
  • Content Manager integration
  • Handbrake key
  • Mouse center key
  • Smooth key attack/release/gamma
  • Keyboard input
  • Precision touchpad input
  • Android touchpad app input (supporting volume keys)
  • Drawing tablet input

Guide

  • Install Microsoft Visual C++ Redistrutable 2015-19 x86 if not already installed
  • Install vJoy 2.1.9 on Windows 10. If you have Windows 7/8.1 download vJoy 2.1.8
  • Open Configure vJoy and set Number of Buttons to 32 on vJoy Device 1
  • Download latest from releases on GitHub https://github.com/xCuri0/MouseToVJoy/releases. If you have vJoy 2.1.8 download the -Win7 zip
  • Extract downloaded zip file, configure if needed and run MouseToVjoy.exe
  • Configure game to use the vJoy device
  • You can use the preset input configuration file for Assetto Corsa which can be downloaded here and placed in cfg/controllers/presets
  • If game is not receiving input but vJoy Monitor is run MouseToVjoy as administrator

Configuration

Content Manager integration

Copy all files in MouseToVjoy folder to Documents\Assetto Corsa and change Settings > Content Manager > Drive > AC-related events to

Android touchpad setup

You can use an Android device as a touchpad if your computer doesn't have one. Download MouseToVjoy APK from here and install. The app uses USB tethering to communicate so you will be prompted to enable it. To prevent computer from using internet through phone set Interface Metric to 75 on the USB Tethering network.

Use keycode.info to get keycodes. Keycodes for mouse are left click = 1, right click = 2 and middle click = 4.

config.txt

Value Description Example
Sensitivity The main sensitivity multiplier.
Raw data from mouse is multiplied by this value and then added to X axis.
6.0
AttackTimeThrottle Throttle value when pressed.
When throttle is pressed, every 2 ms value is added to Y axis.
The greater the steaper slope of attack.
200
ReleaseTimeThrottle Throttle value when released.
When throttle is released, every 2 ms value is subtracted from Y axis.
The greater the steaper slope of release.
100
AttackTimeBrake Brake value when pressed.
When brake is pressed, every 2 ms value is added to Z axis.
The greater the steeper slope of attack.
200
ReleaseTimeBrake Brake value when released.
When brake is released, every 2 ms value is subtracted from Z axis.
The greater the steeper slope of release.
100
AttackTimeClutch Clutch value when pressed.
When clutch is pressed, every 2 ms value is added to RX axis.
The greater the steeper slope of attack.
200
ReleaseTimeClutch Clutch value when released.
When clutch is released, every 2 ms value is subtracted from RX axis.
The greater the steeper slope of release.
100
AccelerationThrottle Add linear acceleration on throttle axis.
0 to disable, greater then 0 to enable.
1.01
AccelerationBrake Add linear acceleration on brake axis.
0 to disable, greater then 0 to enable.
1.01
AccelerationClutch Add linear acceleration on clutch axis.
0 to disable, greater then 0 to enable.
1.01
ThrottleKey Keycode responsible for throttle control.
Works only when UseMouse is equal to 0.
87
= W
BrakeKey Key responsible for brake control.
Works only when UseMouse is equal to 0.
83
= S
ClutchKey Key responsible for clutch control. 67
= C
GearShiftUpKey Key responsible for gear shift up. 65
= A
GearShiftDownKey Key responsible for gear shift down. 68
= D
HandBrakeKey Key responsible for handbrake. 68
= Space
MouseLockKey Key responsible for locking mouse. 80
= P
MouseCenterKey Key responsible for centering steering axis. 79
= O
ForceFeedbackKey When this key is held down enable force feedback
Requires ForceFeedback = 1
Use 0 to disable and always use force feedback if it's enabled
78
= N
UseMouse Use mouse buttons as throttle and brake. 0
UseCenterReduction Reduce mouse sensitivity when closer to center of axis. 1
UseForceFeedback Use force feedback. 0
RequireLocked Requires the mouse to be locked. 1
MouseHook Use a global mouse hook to prevent mouse movement/clicking while locked.
Doesn't always work properly so disabled by default
0
UseWheelAsShifter Use mouse wheel as a sequential shifter.
Mouse wheel up for next gear and mouse wheel down for lower gear.
1
UseWheelAsThrottle Number of steps to use for mouse wheel as throttle.
0 to disable
10
WheelThrottleMiddle Number of steps to use for mouse wheel as throttle when middle button held.
0 to Disable.
30
CenterMultiplier How much center reduction to use.
Greater then 1 to make center less sensitive while making ends more sensitive.
Lesser then 1 to make center more sensitive while making ends less sensitive.
1.20
RequireClutch Percentage of clutch in required for H-Shifter to shift.
Max value 100
0
VJoyID VJoy device ID to use 1
DisableKeys Disable keyboard when touchpad active 1
Touchpad Use precision touchpad as touchpad (Z and RX axis).
Requires precision touchpad drivers which can usually be installed if your laptop didn't come with them.
1
TouchpadApp Use MouseToVjoy app on an Android device connected over USB as touchpad (Z and RX axis).
0 to disable, 1 to enable and 2 to open background picker in touchpad app
0
TouchpadTablet Use drawing tablet as touchpad (Z and RX axis) 1
TouchpadXInvert Invert the touchpad X axis. 0
TouchpadYInvert Invert the touchpad Y axis. 1
TouchpadXPercent Percentage of touchpad X axis to use such as 100 for full and 50 for half. 65
TouchpadYPercent Percentage of touchpad y axis to use such as 100 for full and 50 for half. 70
TouchpadXStartPercent Percentage of touchpad X axis to start at. 30
TouchpadYStartPercent Percentage of touchpad Y axis to start at. 25
TouchpadAxisDisable Disable a touchpad axis.
0 = none, 1 = rx, 2 = z
0
TouchpadButtonsH Number of horizontal touchpad buttons. 4
TouchpadButtonsV Number of vertical touchpad buttons. 3
TouchpadButtons List of touchpad buttons to enable. Seperate with commas and make sure there are no spaces
0 to disable and 1 to enable all.
Use VjoyMonitor with TouchpadButtons = 1 to find the buttons you need enabled and then put them seperated by commas.
13,14

Release History

  • 1.91
    • FIX: Throttle not pressing fully
    • FIX: Acceleration curve
    • FIX: Android protocol issues
    • ADD: RequireClutch
  • 1.90
    • ADD: Content Manager integration
    • ADD: Drawing tablet support
    • ADD: MouseHook
    • ADD: WheelThrottleMiddle
    • ADD: TouchpadAxisDisable
    • ADD: DisableKeys
    • ADD: Optimizations for reduced CPU usage and latency
    • ADD: Use Android app volume keys
    • ADD: Set vJoy device ID
    • ADD: Improved default config.txt
    • FIX: Keyboard attack/release/acceleration
    • FIX: H-Shifter lag
    • FIX: Crash when file error
    • FIX: Setting cursor to blank
    • FIX: Variable initialization
    • FIX: Possible app version mismatch
    • TODO: Test Precision Touchpad support. It was last tested with 1.85
    • TODO: Test Windows 7 and 8.1
  • 1.89
    • FIX: Paddle shift doubleclicking
    • FIX: Touchpad getting stuck when unlock
    • FIX: Broken input while touchpad reconnecting
  • 1.88
    • ADD: Multiple performance improvements and bug fixes
    • ADD: Check if vJoy device has enough available buttons
    • FIX: Android touchpad not holding down
    • FIX: Acceleration when set to 0
  • 1.87
    • ADD: Zero input latency from new event based system
    • ADD: Use Android device as touchpad
    • ADD: Touchpad buttons
    • FIX: Improved touchpad splitting
    • FIX: Broken input on some computers
    • FIX: Broken touchpad start percent
    • BUG: Keyboard Attack/Release
    • BUG: Precision touchpad
  • 1.86
    • ADD: RequireLocked
    • ADD: ForceFeedbackKey
    • FIX: Cursor hiding
    • FIX: Starting multiple instances
    • ADD: Reduced CPU usage to near zero
  • 1.85
    • ADD: Using two fingers on touchpad
    • ADD: Require ALT for mouse lock key
    • ADD: TouchpadXStartPercent and TouchpadYStartPercent
    • ADD: TouchpadXPercent and TouchpadYPercent
    • FIX: Touchpad interference with mouse
  • 1.84
    • FIX: High latency
    • ADD: Option to use touchpad as Z and RX axis
  • 1.83
    • FIX: Scroll wheel issues.
    • ADD: Use Wheel As Throttle. Set UseWheelAsThrottle to the number of steps to use (0 to disable).
    • ADD: When using scroll wheel as shifter put gear in neutral by holding middle. You can change gears in this mode and when you release it will shift to it.
  • 1.82
    • FIX: Keyboard filtering.
    • ADD: H-Shifter emulation.
    • ADD: Assetto Corsa configuration .ini (put in cfg\controllers\presets).
  • 1.81
    • FIX: Buggy mouse lock key.
    • FIX: Cursor not restored on exit.
  • 1.8
    • ADD: 1000hz polling.
    • ADD: Set high priority.
    • ADD: Filter Assetto Corsa keyboard shortcuts.
    • ADD: Improved mouse locking.
    • ADD: Allow acceleration to be fully disabled.
    • ADD: Updated vJoy.
    • FIX: Cleaned source code.
  • 1.7
    • ADD: Support for 'ForceFeedback' on Assetto Corsa.
    • ADD: Use Wheel as Shifter.
  • 1.68
    • FIX: ForceFeedback not working.
  • 1.67
    • FIX: Issue with center reduction not working.
  • 1.66
    • FIX: Issue with self moving steering wheel.
  • 1.65
    • FIX: ForceFeedback not working.
  • 1.64
    • ADD: Command line support, '-noconsole' to launch without console.
    • FIX: Code structure, made it more pleasant to read.
  • 1.63
    • ADD: Force Feedback Working for Periodic Force.
  • 1.62
    • ADD: Ability to use mouse buttons on other functions than breake and throttle.
  • 1.61
    • FIX: UseMouse Not Working (Thanks nonical)
  • 1.6
    • ADD: Force Feedback Working only for Constant Force
  • 1.5
    • ADD: 3 Configurable buttons.
  • 1.41
    • FIX: Sensitivity Center Reduction not working.
  • 1.4
    • ADD: Sensitivity Center Reduction.
  • 1.3
    • ADD: Center Mouse Steering Axis.
  • 1.21
    • FIX: Typo in Breaking logic.
  • 1.2
    • ADD: Acceleration options.
  • 1.1
    • ADD: Configurable buttons.
  • 1.0
    • First working release.

Latency

Mouse click to shift button latency (50ms interval * 100) measured using this

Windows 10 20H2, i5-3470 and vJoy 2.1.9: 0.77ms

Meta

Sebastian Waluśsebastian.walus@op.pl

xCuri0 - zkqri0@gmail.com

Contributing

  1. Fork it (https://github.com/xCuri0/MouseToVJoy/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Built With

Acknowledgments

  • Sebastian Waluś for the orignal MouseToVJoy
  • Hat tip to anyone who's code was used

About

Converts mouse/touchpad/tablet/android/keyboard input to vJoy output, created using vjoyinterface and winapi32. Useful for games like Assetto Corsa, Live For Speed, Rfactor. Requires installed version of VJoy 2.1.8+.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 90.6%
  • C 9.4%