2

I want to override my controller inputs. Like swapping controller button actions for example. My approach was creating a custom controller using OpenVR, but then I cannot retrieve my controller inputs and feed them to the controller I created.

I know that I can get controller inputs, just to read. But how do I override them, is it possible? Any help will be appreciated. Thanks.

Aimkiller
  • 263
  • 1
  • 5
  • 13
  • if you only need to swap inputs, why not just change the bindings for your current controller? less work and better performance – Oleg Vorobiov Sep 13 '21 at 19:00
  • @okawo well what I need is to swap controls on fly, doing so I'd be able to decouple the motion direction of player from the headset. Normally in-game, we move to the direction we look. I want to move to the direction I direct using my driver. I just need to add some offset to the joystick on the fly – Aimkiller Sep 20 '21 at 17:33
  • 1
    ohhhhhhhhh, you should add a clarification for that in the question btw, and its doable but it will be way harder and will most likely add delay if you want to do it using your own wrapper driver, there is another way to do tho. i'll post an answer detailing both soon – Oleg Vorobiov Sep 21 '21 at 20:08
  • @okawo I'm looking forward to it. Hope you will post it soon. – Aimkiller Sep 25 '21 at 15:56
  • 1
    sorry for the delay, real life strikes again xd – Oleg Vorobiov Sep 30 '21 at 11:07

1 Answers1

2

The hard way

Making your own wrapper driver, its not gonna be easy, openvr driver API is mostly undocumented(and barely functional on Linux...) and very confusing

It is possible though, if i understand your question correctly, you want to achieve something like the DecaMove(which can be used with a phone now if i understand the info from their website correctly)

Now onto how... You'll need to make your own driver that captures the inputs of your headset's driver and modify it, start here and read most of the driver related wiki, you'll need it, read through openvr_driver.h (code comments in it is the latest docs it has)

Then read through the only official driver example openvr has... Can be found here, use it as a reference, but never base your driver on it!

That's about it when it comes to documentation, some tips:

  • Try looking at device update events, those might have the tracking/input data you need to intercept
  • Don't touch your HMD, don't even try to make a wrapper device for your HMD! Display components are undocumented, and it can be really hard to make then work correctly
  • Enable "activateMultipleDrivers" in steamvr.vrsettings in your Steam config, otherwise you wont be able to launch Steamvr with both your driver and your headset's driver

I wish you good luck if you end up choosing to make your own driver

The easy way

As mentioned above, DecaMove can be used with a phone instead now, refer to their website for more info

(I also wanted to recommend openvr input emulator, but after looking at their code i realized how old it is, and it also seems abandoned... so yeah, don't use it)

Oleg Vorobiov
  • 482
  • 5
  • 14
  • I also found out that openvr input emulator does use of hooks to get things done. So I guess I will have to go with hardway. Ah, no DecaMove mobile one is not an option for me :) Thank you very much! – Aimkiller Oct 02 '21 at 16:34
  • 1
    @Aimkiller good luck :) – Oleg Vorobiov Oct 03 '21 at 15:37