Use ViGEm to create XBox 360 controller in C#



  • Hey all, I want to do the same sort of thing as lemmingDev.

    I cloned the ViGEm.NET project but can't get it to properly build. I run build.cmd and get this error:

    Could not find a part of the path 'C:\Users\myuser\Downloads\testwii\ViGEm.NET\build\bin\Release\bin\release\x64\ViGEmClient.dll'.

    Any ideas?



  • @craigrs84 Hey there! Thanks for the interest in building the project. I encourage you to jump into the discord for further support. Forums are slow and tedious while Discord is a lot more handy to help with. https://discord.vigem.org/



  • How do i add the missing xbox360 buttons? only these buttons are in the class:
    Up = 1,
    Down = 2,
    Left = 4,
    Right = 8,
    Start = 16,
    Back = 32,
    LeftThumb = 64,
    RightThumb = 128,
    LeftShoulder = 256,
    RightShoulder = 512,
    Guide = 1024,
    A = 4096,
    B = 8192,
    X = 16384,
    Y = 32768



  • @pejman Missing? Which class? Which branch?



  • namespace Nefarius.ViGEm.Client.Targets.Xbox360
    {
    [Flags]
    public enum Xbox360Buttons : ushort
    {
    Up = 1,
    Down = 2,
    Left = 4,
    Right = 8,
    Start = 16,
    Back = 32,
    LeftThumb = 64,
    RightThumb = 128,
    LeftShoulder = 256,
    RightShoulder = 512,
    Guide = 1024,
    A = 4096,
    B = 8192,
    X = 16384,
    Y = 32768
    }
    }

    i'm talking about the buttons when you hard press the joy sticks or 'up/right', 'up/left', and the rest of it.



  • You didn't mention the branch name so I'm guessing you're talking about outdated/legacy master.

    You mean L3 and R3? They are literally there; LeftThumb and RightThumb.

    6c4d9c51-5644-40ec-bd42-a54f022729db-image.png

    And please format code sections for better readability, thanks 😄



  • That is right, LeftThumb and RightThumb was the ones i was looking for, thanks for your response, i noticed combining buttons of directional pad also creates the up/left or up/right and so on. thank you again.



  • @pejman nice, btw. new API coming up is way less confusing so stick around!



  • Another question, does your driver support shock feedback?



  • Yes. Both X360 and DS4.



  • Can you send a sample code for that? I would appreciate it.



  • @pejman you simply subscribe to the FeedbackReceived event.



  • Thanks a lot, I found out about it in one of the posts, I just cannot find the Scale method for calculating the byte value for the Dualshock PS one.

    this one is the one you wrote for Xbox which does not work for PS and I cannot find the right formula for it =(

    private static short Scale(byte value, bool invert)
    {
    int intValue = (value - 0x80);
    if (intValue == -128) intValue = -127;

            var wtfValue = intValue * 258.00787401574803149606299212599f; // what the fuck?
    
            return (short)(invert ? -wtfValue : wtfValue);
    

    }


Log in to reply