For older versions of vJoy read the following article.

What is a feeder

Let's assume you want to control an application such as a flight-simulator from the mouse. In this case the flight-simulator is the user-application. vJoy can translate the mouse coordinates (and wheel and buttons) into joystick positions, hence controlling the user-application. However, vJoy is a general-purpose driver. It was not design for mouse-to-joystick translation. You will have to write a simple feeder software to bridge the gap between the mouse and vJoy. The feeder will read the mouse data and feed vJoy driver with these data.

Which Feeder

Write a feeder that is compatible with the version of vJoy driver you deploy. For vJoy 2.0.0 and up write a feeder based on the latest SDK. The SDK contains sources and a ReadMe file that explains how to write and deploy a feeder.

A feeder can be written in C,C++ or C# - Examples written in C and C# are included in the SDK package.

For further information please refer to this document.

 

Example 1: vJoyClient

Slightly missleading name for a feeder.

This is a simple command-line demo feeder that constantly feed a vJoy device with data. Most of the code is dedicated to preparing the position data.

The code is part of the SDK. Take the most recent zip file.

Lets take a look at file vJoyClient.cpp:

  1. Get the ID (iInterface) of the target virtual device:

     

    if (argc>1 && wcslen(argv[1])) 
       sscanf_s((char *)(argv[1]),"%d", &iInterface);
  2. Acquire the target – you must do it before starting to feed target

    AcquireVJD(iInterface)

    Check if a continuous POV Hat switch is installed

  3. ContinuousPOV 	= (BOOL)GetVJDContPovNumber(iInterface);

    Start an endless while loop. In it the feeder creates position data and send in to the target device:

    1. Fill-in the data packet with the target ID.

    2. Sleep for 20 miliSec

    3. Fill-in the data packet with axes position data and with button values.

    4. According to the type of POV Hat switch, fill-in the position data.

    5. Feed the virtual device and test the results. If failed then wait for the user's response to re-acquire the target device.

        if  (!UpdateVJD(iInterface, pPositionMessage))
         {
          _tprintf("Feeding vJoy device number %d failed - try to enable device then press enter\n", iInterface);
          getchar();      
          AcquireVJD(iInterface);    
         }

Example 2: vJoyDemo

This application demonstrates most elements of a feeder including detection of the installed Driver, the installed devices and their respective configuration.

The code resides in the vJoy code tree under Apps.

vJoyDemo can become handy when testing vJoy driver and getting information about the installed devices.vJoyDemo: Device with a Continuous POV Hat Switch

The above figure informs us that vJoy device driver version 2.0.0 is installed

There are two vJoy devices installed on the system: #1 & #4

Currently, device #1 was selected to be fed with data.

Device #1 configuration includes:

  • All eight axes: X, Y & Z.
  • Fifteen buttons, none of them is pressed
  • two continuous POV Hat switches. Number 1  set to 11179

 

 


The above figure informs us that vJoy device driver version 2.0.0 is installed

There are two vJoy devices installed on the system: #1 & #4

Currently, device #4 was selected to be fed with data.

Device #4 configuration includes:

  • All eight axes are set.
  • Eight buttons, Button 8 is pressed
  • One 4-direction POV Hat set to East.

 


vJoyDemo is useful in conjunction with utility Game Controller (joy.cpl) – vJoyDemo feeds vJoy with data while the Game Controller should reflect the same data.



Note that there are some minor difficulties in this process:

  1. Window vJoy Device Properties should be in the focus in order to display correct values.
  2. vJoyDemo interface always display 8 axes, 32 buttons and up tp 4 POV hat switches. It reflects the actual configuration of vJoy by greying-out the controls that are not set.
  3. There are two POV Hat switch modes:
    1. Discrete mode in which it feeds vJoy with one of the values Neutral(-1), North(0), East(1), South(2) and West(3). This mode is shown above.
    2. Continuous mode in which it feeds vJoy with one of the values between -1 to 35900. See below:


Note that this application is not meant to be distributed as-is to the end-user. In some cases, it requires installation of additional software packages.

Additional software packages

vJoyConf was developed under VS 2008 and MS Forms. On some machines, they will not run unless additional software packages are installed. These packages are free.

If you start one of these applications and get a message similar to the following:

You probably need to install Microsoft Visual C++ 2008 Redistribution package.

Then, if get a message similar to the following:

You will need to setup the Microsoft .NET Framework 2.0.