Can ViGEm help with improving keyboard inputs for PC PS4 Remote Play?



  • Originally posted by metafurionx


    I want to map some keys in my PC keyboard to trigger simple buttons like triangle and square in PS4 Remote Play for PC, just like Enter and Esc do it for x and circle.
    From what I googled and tested, I learned that "vJoy can map keyboard to xbox360ce", "ViGEm can map xbox360ce to DualShock 4" and that a "DualShock 4 gives full input for PS4 Remote Play".
    How can I bring that together?



  • Originally posted by evilC


    Hi,
    I am writing an app that should be able to do this for you.

    This app can read keyboard, and create a virtual DS4 controller using ViGEm - no need to do keyboard -> xbox -> ds4, you can just do keyboard -> ds4

    Download is here: https://github.com/Snoothy/UCR/releases

    Please read the wiki, you need to install ViGEm and Interception drivers for this to work.

    If you have any questions, please join the Discord channel linked in the wiki and we will help you out.



  • Originally posted by metafurionx


    @evilC#182 Very nice!! Your app is perfect already for what I need, if it wasn't for the up and left commands stuck. I can't navigate a menu or move a character with it holding the up and left buttons. If you could fix just that you'd earn a big fan. 😄

    But let me see if I did it right:
    I installed Interception, then ViGEm, then ran UCR 0.1.1 Alpha:
    https://github.com/Snoothy/UCR/wiki/Core_Interception
    https://github.com/nefarius/ViGEm/wiki/Driver-Installation
    https://github.com/Snoothy/UCR/releases
    I went to Devices > Manage device groups;
    Input groups > Add group > named "Keyboard";
    Core_Interception > Generic USB K/B (1st one) > Add;
    Output groups > Add group > named "DualShock 4";
    Core_ViGEm > ViGEm DS4 Controller 1 > Add;
    Back to main window > Profile > New > named "Keyboard to DualShock 4";
    Edit > Profile > Manage device groups > selected the groups I created for input and output;
    Then I repeated the process: Plugins > Add Plugin... > name a title, choose "Button to Button" > "Click to Bind" for both Input and Output.
    My settings were X->Triangle, Z->Square, D->R1, S->L1, F->R2, A->L2, W->LS and E->RS.
    Then I went to Profile > Activate.

    Everything works, but then, after any first input, up and left get pressed forever, without me even touching them.
    I don't set the DPad controls because PS4 Remote Play has them already, but I found an issue in it too. When I try to bind a DPad for the Button Output, any of them are set to "DPad, Up".



  • Originally posted by metafurionx


    Meanwhile, I was actually able to run PS4 Remote Play with full keyboard control "on" Windows!
    I used this emulator: https://github.com/champgm/ShockEmu (had to be this branch, the main one's abandoned)
    Since that's only for OS X, I ran a Virtual Machine for it. Set network as Bridge for PS4 Remote Play to work and that's it.
    The only downside is the slower control response because it's in a VM. I might try a hackintosh later.

    I'd still love a Windows solution, though. 🙂



  • Originally posted by evilC


    So you are only using UCR to bind buttons, but when you press a button, the vigem axes get stuck at top left?

    I think I can see why that might happen, I am guessing the axis values initialize to 0, which is left/up.
    In this instance, I am not sure if it is a ViGEm issue or a UCR issue. In reality, ViGEm targets should probably initialize in a "centered" state?



  • Originally posted by evilC


    OK, we just had a little look and the ViGEm C# wrapper does indeed seem to initialize the axes to 0.
    Nefarius is aware, a fix will be forthcoming.

    In the meantime, it will *probably* work if you remap the axes as well. You may not need the remapping, but mapping them (Use an AxisToAxis or a ButtonToAxis plugin) should force them to be centered.



  • Originally posted by metafurionx


    @evilC#187 Yes, it works! What I did:

    Profile > Edit;
    Plugins > Add Plugin... > Button to Axis > I chose a button for "Button Input low" and "LX" for "Button Output";
    Plugins > Add Plugin... > Button to Axis > Same button for "Button Input low" and "LY" for "Button Output";

    Now I start the emulation and just need to press that button once to make the stuck movement stop!
    Thank you so much, you guys are amazing! 💯😄



  • Originally posted by evilC


    Great!

    As it happens, UCR currently uses a slightly different version of the ViGEm C# API (I added some extra stuff in), and the bug in ViGEm is in the file I modified anyway, so I tried recompiling it with a fix.
    The replacement file is here
    Try replacing the old file in Providers\Core\_ViGEm with that one.



  • Originally posted by metafurionx


    @evilC#189 Alright, file replaced, no more need for the Axis fix. Thank you very much! Really appreciated!
    (Btw, did you see my PM about Interception? Couldn't find a way to PM you here, so I did it through AHK Forum.)



  • Originally posted by evilC


    I had missed it. Responded.
    FYI, the best place to catch me for a chat is in one of the Discord channels I hang out in - either Nefarius' one (See link at top) or the HidWizards one: https://discord.gg/MmnhQYQ