CvJoyInterface - A new, class based vJoy library

Post your working scripts, libraries and tools
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

CvJoyInterface - A new, class based vJoy library

24 Dec 2014, 13:49

I have used and maintained Axlar's vJoy interface for many years now in my projects, and it has stood the test of time well, but I felt that it was a little difficult to use for less experienced coders, polluted the global namespace too much etc, and had a number of other niggles, so I thought I would re-write it.

CvJoyInterface is designed to make it easy for anyone to operate virtual sticks - for example, in it's simplest use-case, you do not even need to Acquire() the stick, CvJoyInterface will do it automatically for you:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Github Page (Download)
matt
Posts: 2
Joined: 09 May 2016, 13:50

Re: CvJoyInterface - A new, class based vJoy library

10 May 2016, 09:01

Hey there, I don't know if this is the place to discuss about it but I just found your library and can't thank you enough for your work. It allowed me to finally work out a solution to get throttle control on keyboard in GTA V, through AHK, vjoy and x360ce — sounds cumbersome, but it actually works very well thanks to CvJoyInterface. So, thanks alot for this! I am surprised that there is no answer to this thread by the way.
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

10 May 2016, 12:55

Yep, this is the right place :)

I think that the main reason there are so few replies is that people wanting to use AHK to control vJoy tend to use one of my GUI applications that achieves the same result without them needing to learn how to code in AHK.

See the UCR thread.

By the way, there is a new version of vJoy coming that is able to create virtual XBox controllers. Dunno if that will simplify your tool chain any, but maybe not.
What are you using for input, a real XBox controller? The new XBox version of vJoy will probably only help when you are not using a physical XBox controller.
matt
Posts: 2
Joined: 09 May 2016, 13:50

Re: CvJoyInterface - A new, class based vJoy library

11 May 2016, 14:24

Well, I don't really know how to code in AHK either, but with a bit of searching and experiments I managed to get what I needed. I'll have a look at UCR, maybe it will be more interesting that what I currently have, thanks for the link!

I use both the keyboard and a 360 controller when playing, so yeah, the xinput version of vjoy won't be helpful to me, but I can see it gathering lots of interest.
kjyek
Posts: 7
Joined: 01 Jun 2016, 19:56

Re: CvJoyInterface - A new, class based vJoy library

01 Jun 2016, 22:17

How do I do something as simple as with vJoy? I can't figure it out.
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

02 Jun 2016, 05:33

You cannot use syntax like that to control joysticks, that is why I wrote this library.

To make a operate vjoy button 5, download CvJoyInterface.ahk, and put this ahk script in the same folder as it.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

kjyek
Posts: 7
Joined: 01 Jun 2016, 19:56

Re: CvJoyInterface - A new, class based vJoy library

02 Jun 2016, 10:09

Thanks man. The issue was my script wasn't in the same directory as CvJoyinterface.ahk :facepalm:
I didn't think that necessary since I have it in /lib folder.
kjyek
Posts: 7
Joined: 01 Jun 2016, 19:56

Re: CvJoyInterface - A new, class based vJoy library

02 Jun 2016, 10:37

Couple questions if you don't mind.
Can this be used to temporarily block POV input or is BlockInput still necessary?
I know the syntax here is wrong, but what would your vJoy implementation be for something like this?:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

02 Jun 2016, 16:08

Thanks man. The issue was my script wasn't in the same directory as CvJoyinterface.ahk

If you have CvJoyInterface.ahk in the lib folder, then replace #include CvJoyInterface.ahk with #include <CvJoyInterface>

Can this be used to temporarily block POV input or is BlockInput still necessary?

Using AHK, you cannot *in any way* alter how applications see a physical joystick, like you can for keyboard and mouse.
BlockInput has absolutely no effect on joysticks.

If you want to remap stuff without having to learn to code, see my UCR app. That has a GUI that will allow you to remap stuff to a vJoy stick.
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

12 Sep 2016, 15:08

Some news regarding AHK and vJoy support.

I just pushed a fix for this library - the ResetPovs() method of a device class was pointing at ResetButtons.

I have a beta build of the new vGen API which supports normal vJoy AND virtual XBox controllers through one API, and additionally all axis ranges are the same as AHK (0->100). Not sure on timescales yet, but seeing as I will be implementing this in UCR ASAP, and UCR uses CvJoyInterface, I would expect there to be an updated version of this lib just as soon as I can get the damned vGen API working properly on x86.

Also, I have just found some bugs in vJoy:

It appears that the first time you issue a command to set the position of a Button, POV, or Axes, all buttons, povs and axes get set to 0, then your command is executed.
Therefore, all buttons, axes and povs other than the first one you operate will be set to 0. (0 for POV Hats is "Up")
The Init values you can set using registry keys cannot work around this.
I would imagine we will have a fix very soon.

I am also seeing a crash with x86 AHK if I do not issue a vJoyEnabled() call before Acquire()
CvJoyInterface always does this anyway, so we did not notice it before. However, vJoyEnabled() was removed from the vGen API, and I have not been able to get that to work on x86, so I guess my problems with vGen are as a result of this.
keung
Posts: 3
Joined: 18 Jul 2017, 12:22

Re: CvJoyInterface - A new, class based vJoy library

18 Jul 2017, 12:40

Hey evilC!

I was planning to macro a few button presses in a loop while streaming from Xbox One to the Xbox App on Windows 10, but quickly found out it's not that simple. After a few hours of research I managed to emulate joystick button inputs using vJoy and your interface. However, it seems that the Xbox App does not recognize the vJoy device as an Xbox controller and the inputs are ignored.

Right now, I'm kind of stuck. What I need to do is position my crosshair in game (via the streaming capability) using an X360 controller, then use AHK to continuously send the button presses. I know how to script that, but I have no clue how to set it up properly. Do you have any idea?
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

18 Jul 2017, 13:31

This version of the library only supports DirectInput sticks, not XInput. It was written before vJoy supported XBox devices.
I have a new version in the works that will support vXBox, but it is not ready yet.
https://github.com/evilC/vGen/blob/mast ... xample.ahk
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

18 Jul 2017, 13:58

I just added support for buttons and POVs to the new version, so the basics are working.
You must have the SCPVBus installed, which is required for vJoy's vXBox functionality to work.
I have included everything you should need in the attached ZIP. Just run the install.bat in the SCPVBus folder as admin, then the example AHK scripts should be functional.
This is using a new technique (Most of the work is done in vGenBasicWrapper.dll, which is C#), so you would be doing me a favor by testing it out for me, as I don't have much feedback yet as to whether it works for everyone.
Attachments
vGenBasicWrapper.zip
(1.81 MiB) Downloaded 8 times
keung
Posts: 3
Joined: 18 Jul 2017, 12:22

Re: CvJoyInterface - A new, class based vJoy library

18 Jul 2017, 23:02

Alright, just experimented with it. I ran install.bat as admin, although for some reason it didn't seem to do anything, but running the command manually worked wonders (no idea why). I do see the bus in device manager now. I then ran your Example.ahk and tabbed into the Xbox App while streaming, but nothing happened. Also tried Simplest Example.ahk (modified it a little bit to trigger on F8 keypress and alsotried swapping between vGen.vJoy and vGen.vXbox), but still no response. I had a look in the Monitor vJoy application, and it wasn't picking up on anything, but I suppose it is a different interface(?)

I also noticed that when I start streaming without a controller plugged in, the App says it can't find a valid controller.
User avatar
evilC
Posts: 3370
Joined: 27 Feb 2014, 12:30

Re: CvJoyInterface - A new, class based vJoy library

19 Jul 2017, 05:25

Example.ahk should move the controller around.
I use this web page to test vXBox - when you load up the page, press a button on a controller to activate the page, else it does nothing.
You should see both vJoy and vXBox going thru the same motions (X axis moves up and down, buttons 1-4 cycle)
If absolutely zero happens, it sounds like it maybe is not loading the DLL properly.
I have a Discord channel here, feel free to drop in and we will see if we can get it working.
keung
Posts: 3
Joined: 18 Jul 2017, 12:22

Re: CvJoyInterface - A new, class based vJoy library

20 Jul 2017, 19:28

I'll hop onto discord sometime during the weekend :)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: arcticir and 12 guests