Post by SS on Jan 10, 2019 14:05:41 GMT
I am writing a feeder for virtual xBox Controller using vGen. But somehow, isControllerPluggedIn function and PlugIn function is never working. I had used the test application in vXboxInterface and that was correctly plugging in virtual xBox controllers. But that is c++ only library so I moved to vGen to use c#. Below is the stripped down version of code that is not working properly. Am I doing something wrong?
static public vGen joystick;
static public uint id = 1;
private static byte Led = 0xFF;
public MainWindow()
{
InitializeComponent();
joystick = new vGen();
if (joystick.isVBusExist() != 0)
{
Debug.WriteLine("vBus for xBox controller not enabled...");
}
else
Debug.WriteLine("vBus found...");
//Check for avaiable devices
bool findid = false;
for (id = 1; id <= 4; id++)
{
//Not Working
joystick.isControllerPluggedIn(id,ref findid);
Debug.WriteLine("Device ID : " + id + " ( "+ findid.ToString() + " )");
if (findid == false)
break;
}
if (findid == true)
Debug.WriteLine("No available vJoy Device found \t Cannot continue");
// Not Working
joystick.PlugIn(id);
joystick.isControllerOwned(id, ref findid);
if (findid != true)
Debug.WriteLine("Failed to acquire vJoy device");
else
{
joystick.GetLedNumber(id, ref Led);
Debug.WriteLine("Acquired :: vXbox ID : " + id.ToString() + "\n" + "\tLED number : " + Led.ToString());
}
}
static public vGen joystick;
static public uint id = 1;
private static byte Led = 0xFF;
public MainWindow()
{
InitializeComponent();
joystick = new vGen();
if (joystick.isVBusExist() != 0)
{
Debug.WriteLine("vBus for xBox controller not enabled...");
}
else
Debug.WriteLine("vBus found...");
//Check for avaiable devices
bool findid = false;
for (id = 1; id <= 4; id++)
{
//Not Working
joystick.isControllerPluggedIn(id,ref findid);
Debug.WriteLine("Device ID : " + id + " ( "+ findid.ToString() + " )");
if (findid == false)
break;
}
if (findid == true)
Debug.WriteLine("No available vJoy Device found \t Cannot continue");
// Not Working
joystick.PlugIn(id);
joystick.isControllerOwned(id, ref findid);
if (findid != true)
Debug.WriteLine("Failed to acquire vJoy device");
else
{
joystick.GetLedNumber(id, ref Led);
Debug.WriteLine("Acquired :: vXbox ID : " + id.ToString() + "\n" + "\tLED number : " + Led.ToString());
}
}