shauleiz / vGen

General API to virtual Joysticks (Including vXbox)
14 stars 3 forks source link

vGen does not "PlugIn" xbox device, but "vXboxInterface" #6

Open Cleric-K opened 6 years ago

Cleric-K commented 6 years ago

Hi, I was trying to get vGen (the C# wrapper) running for vXbox devices but with no luck. Then I tried your vXboxInterface Test.exe and it works - the windows "USB plugged in" sound is heard. The SCPUser.exe app show everything fine.

But nothing happens when using vGen. I see that vGen uses the XOutput lib, while vXboxInterface seems to interface directly with the virtual bus, but I haven't dug deeper. If I pinvoke vXboxInterface.dll it works. Here's some example code:

class My {
    [DllImport("vXboxInterface.dll")]
    static extern bool isVBusExists();

    [DllImport("vXboxInterface.dll")]
    static extern bool PlugIn(uint idx);

    public static void Main() {
        var vg = new vGenInterfaceWrap.vGen();

        // vGen Test
        Console.WriteLine("vGen.isVBusExist(): " + vg.isVBusExist());
        Byte nSlots = 0;
        vg.GetNumEmptyBusSlots(ref nSlots);
        Console.WriteLine("vGen.GetNumEmptyBusSlots(): " + nSlots);
        Console.WriteLine("vGen.PlugIn(): " + vg.PlugIn(1));

        //vXbox Test
        Console.WriteLine("vXbox.isVBusExist(): " + isVBusExists());
        Console.WriteLine("vXbox.PlugIn(): " + PlugIn(1));

        Console.ReadKey();
    }
}

The output is:

vGen.isVBusExist(): 0
vGen.GetNumEmptyBusSlots(): 4
vGen.PlugIn(): 3221225861
vXbox.isVBusExist(): True
vXbox.PlugIn(): True

The vGen.PlugIn() fails, but vXbox.PlugIn() is ok - the "usb plugged in" sound is heard and I can see the device in SCPUser.exe.

I'm testing on Win 7 64bit, but using 32-bit C# app and dlls.

Do you have any ideas why this happens?

keemnine9 commented 5 years ago

how would i put this code in

Cleric-K commented 5 years ago

Can you explain more? What do you want to do?