1

I've been creating a program to play games on a computer, but the controls are on my phone. But, I didn't know how to simulate the joystick, so I searched online.

In this website, someone said that I need to make my own device driver to simulate it, but in this website (Solution 2), it says that you could do it using Joystick Notification Messages. I looked it up, but it seems like it only supports C++, not C#.

This previous website (Solution 1) also stated that you could do it by faking an rs232 serial port, however I do not know what that means, nor do I have the tools to do it.

I used Unity for the program, so I figured, if I made a post on Unity Forum, I would get an answer. Turns out, I didn't get an answer. (link to my thread on the forum)

Is there any way to simulate the joystick of a PS4 controller using C#, preferably without external programs and device drivers, or am I stuck using vJoy or ViGEm?

Thanks in advance!

NOT_A_ROBOT
  • 113
  • 1
  • 15
  • You must have though of this yourself, or might be useless, but just in case. You can code yourself a function that returns values from -1 to 1 in the different axis accumulating the number of button inputs. You have x and y values in the joystick turn both axis, where (0, 0) is the idle joystick position. You can handle those two static values from -1 to 1 handled with the up, down, left, right arrows for example. – rustyBucketBay Nov 06 '20 at 06:44
  • Oh, and I also forgot to mention that I have no access to the source code of the game I was playing, so I can't modify how it works. The only way is to simulate PS4 joystick inputs. – NOT_A_ROBOT Nov 06 '20 at 11:48

1 Answers1

1

I ended up using ViGEm, which is compatible with C#. ViGEm is a gamepad emulation program for C# that supports XBOX 360 and PS4 controllers.
The reason I use ViGEm instead of vJoy is because ViGEm has simpler instructions and a forum.

NOT_A_ROBOT
  • 113
  • 1
  • 15