CvJoyInterface - A new, class based vJoy library

Post your working scripts, libraries and tools
User avatar
evilC
Posts: 3138
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: 3138
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: 3138
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: 3138
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: 3138
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.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 6 guests