Updated NuGet package



  • Hi

    Wanted to play around with ViGEm again in Visual Studio, using C# to create virtual controllers.

    Used to have it working with both PS4 and XBOX360, but now I can't seem to get 360 working properly. It spawns the controllers, and PS4 works fine, but it doesn't register any button presses/axis movement with 360.

    The code below creates one PS4 controller and one 360 controller, and then just holds down the 4 buttons. Buttons are held down correctly for the PS4, but not for the 360.

    I'm using the new installer for the Bus driver, and the latest client available in NuGet (1.15.16)

    I'm guessing there's been recent updates in the driver that require the latest ViGEmClient and .NET bindings, however only older ones are available through NuGet.

    Is it possible to have the NuGet package updated?

    Either that, or I'm stupid and have missed something simple...

    using System;
    using System.Threading;
    using Nefarius.ViGEm.Client;
    using Nefarius.ViGEm.Client.Targets;
    using Nefarius.ViGEm.Client.Targets.Xbox360;
    using Nefarius.ViGEm.Client.Targets.DualShock4;
    
    class Program
    {
        static ViGEmClient myViGEmClient = new ViGEmClient();
        static Xbox360Controller my360Controller = new Xbox360Controller(myViGEmClient);
        static DualShock4Controller myPS4Controller = new DualShock4Controller(myViGEmClient);
    
        static void Main(string[] args)
        {
            my360Controller.Connect();
            myPS4Controller.Connect();
    
            while (true)
            {
                Xbox360Report my360Report = new Xbox360Report();
    
                my360Report.SetButtonState(Xbox360Buttons.A, true);
                my360Report.SetButtonState(Xbox360Buttons.B, true);
                my360Report.SetButtonState(Xbox360Buttons.X, true);
                my360Report.SetButtonState(Xbox360Buttons.Y, true);
    
                DualShock4Report myPS4Report = new DualShock4Report();
    
                myPS4Report.SetButtonState(DualShock4Buttons.Cross, true);
                myPS4Report.SetButtonState(DualShock4Buttons.Circle, true);
                myPS4Report.SetButtonState(DualShock4Buttons.Square, true);
                myPS4Report.SetButtonState(DualShock4Buttons.Triangle, true);
    
                my360Controller.SendReport(my360Report);
                myPS4Controller.SendReport(myPS4Report);
    
                Thread.Sleep(20);
            }
        }
    }
    


  • Yeah that one's on me, I'm not getting the new branch finished... It's a major improvement but the DS4 stuff ain't yet done. The "official" NuGet is indeed horribly outdated and the api doesn't make much sense.



  • Thanks for the reply.

    Any chance of getting a hold of one that's currently working?

    Am happy to wait though if it's a bother



  • Ob absolutely!

    I've worked on getting it done this week actually. Until all tests are done I'll push it and make it officially replace the old crap.

    In the meantime you can use an additional NuGet feed from AppVeyor, that will always give you the latest greatest build: https://ci.appveyor.com/nuget/vigem-net-ci

    Cheers



  • Thanks

    I think I have grasped how to use the new version, but still no button presses are showing up

    Any ideas?

    using System;
    using System.Threading;
    using Nefarius.ViGEm.Client;
    
    namespace ConsoleApp4
    {
        class Program
        {
            static ViGEmClient client = new ViGEmClient();
            static IVirtualGamepad virtualGamepad = client.CreateXbox360Controller();
            static void Main(string[] args)
            {
                virtualGamepad.Connect();
    
                while (true)
                {
                    virtualGamepad.SetButtonState(2, true);
                    virtualGamepad.SubmitReport();
                    Thread.Sleep(50);
                }
            }
        }
    }
    


  • Think I have it working.

    The problem with my code was that I kept sending the same information with nothing changing (button states as true repeatedly that never went false or the same axis position). It seemed to ignore everything.

    As soon as I started changing at least one value now and again in the loop, everything sprung to life.

    Not sure if its a bug. Probably not, as you'd never have repeated presses of the same bottom without releases in between.

    Thanks



  • I'm sure you're already aware, but calling the Connect() method on a Dual Shock controller instance crashes, whereas 360 works

    Thanks again



  • I wasn't aware since I only recently ported that and did literally no testing yet. Will investigate then 😅



  • @nefarius Thanks for all of your help. Let me know if you'd like me to test anything.



  • I can't reproduce it with the most recent build from AppVeyor, you sure you're using the new API?

    Cheers


Log in to reply