New to the forums? Click here to read the "How To" Guide.

Developer? Click here to go to the Developer Forums.

Playing Beat Saber on a DK2 (Oculus Injector preview)

kojackkojack Posts: 5,925 Volunteer Moderator
edited January 12 in General
Since my Pistol Whip with an Xbox controller video wasn't exactly popular (8 views on youtube and a copyright claim), I decided to push things further.

Using Oculus Injector, I made the thumbsticks on an xbox controller aim the sabers in Beat Saber, playing on a DK2. It's HARD to play like this, but I just wanted to see if it was possible. :)
Beat Saber thought it had Touch controllers even though I was playing on a DK2 because Oculus Injector fakes them as existing. Also my DK2 camera wasn't working, so my head was in the floor, but Oculus Injector's height adjust mode put the headset back where it should be.
(I would have done it on my DK1, but I don't think it works on this runtime. The DK2 barely works)

Sadly v13 PTC has broken all functionality in Oculus Injector, so it might actually not make it to release. Debugging this stuff is more painful than typical programming.




Comments

  • OmegaM4NOmegaM4N Posts: 632
    Neo
    Your thumbs are going to be massive in a few weeks. lol
  • WildtWildt Posts: 2,142 Valuable Player
    If you want some downloads then why not make that IPD value injector for CV1's with a broken sensor as I suggested some months ago? ;)
    PCVR: CV1 || 4 sensors || TPcast wireless adapter || MamutVR Gun stock V3
    PSVR: PS4 Pro || Move Controllers || Aim controller
    WMR: HP Reverb
  • kojackkojack Posts: 5,925 Volunteer Moderator
    Wildt said:
    If you want some downloads then why not make that IPD value injector for CV1's with a broken sensor as I suggested some months ago? ;)



  • kojackkojack Posts: 5,925 Volunteer Moderator
    Hmm, might be trickier than I thought.
    I added IPD forcing, but the function hooking isn't working.

    Back in runtime 1.17, a major change happened. Eyes used to be defined relative to the HMD as just positions (vector3). But in 1.17 and above, eyes became full poses (vector3 position and quaternion orientation). This would allow Oculus to do Pimax style canted screens. Doing this would break the API, so some functions have two versions. For example, there's ovr_GetEyePoses (old style) and ovr_GetEyePoses2 (new style). Which one is used by a game depends on which SDK version they compiled against (pre or post 1.17).
    So that complicates things a little.

    I need to hook into two runtime functions for IPD: ovr_CalcEyePoses and ovr_GetEyePoses. The latter is hooking ok, but is never called in the programs I tested. The former is giving an error I've never seen, the hooking library I'm using can't handle it. (apparently it starts with a conditional far jump, which EasyHook doesn't like).
    So, umm, working on it.

    I did just play Audica with an xbox controller. Oh god my neck, hitting those disco ball things is so much worse than pistol whipping people in pistol whip. :)

    I also started to add headset reorientation (so you can use VR lying down). But then I realised I'd forgotten one important thing: messing with headset orientation conflicts with Timewarp. There's no way to disable Timewarp.
    But back when I did my motion rig cancellation tests, I was able to trick Timewarp into not being a problem. I guess I need to do that again (manipulate the layers submitted to render).


  • kojackkojack Posts: 5,925 Volunteer Moderator
    Got it. I've now got IPD overriding working. It's strange playing Pistol Whip with 0 or 100mm IPD. :)
    In theory it should fix CV1's with a broken IPD sensor if you make the value match what the slider is set to.

    For the technically curious, turns out ovr_CalcEyePoses and ovr_GetEyePoses (both version of each) don't exist in the runtime library (the one I can hook), they are just in the static ovr library (which I can't hook, that doesn't work on static libs). But there's ovr_GetRenderDesc and ovr_GetRenderDesc2 which do exist in the runtime library and they set the eye positions. So intercepting calls to them lets me move the player's eyes, effectively controlling IPD.

    Any other ideas for little but useful things?
    (Sadly things like changing home button behaviour can't be done, that's at a lower level. So for example I could swap every aspect of left and right hands, but not the home button)

    I have been thinking of trying to inject new render layers, which would let me do VR overlays.

  • kojackkojack Posts: 5,925 Volunteer Moderator
    edited January 11
    I've partially got reorientation working. The rotation part is good, I just laid down on the floor and reoriented pistol whip so it thought I was facing forwards. But positions are all off and movement is in the wrong coordinate system.
    It would be fine for 3DOF experiences, but for 6DOF I need to rotate and recentre the entire coordinate system for head and hands.
    But I've had enough quaternion maths for tonight.

  • WildtWildt Posts: 2,142 Valuable Player
    LINK! :wink:
    PCVR: CV1 || 4 sensors || TPcast wireless adapter || MamutVR Gun stock V3
    PSVR: PS4 Pro || Move Controllers || Aim controller
    WMR: HP Reverb
  • DaftnDirectDaftnDirect Posts: 5,396 Volunteer Moderator
    Great, the second-hand value of my DK2 just went up.
    Intel 5820K [email protected], Titan X (Maxwell), 16GB Corsair Vengeance DDR4, ASRock X99 Taichi, Samsung 500Gb 960 Evo M.2, Corsair H100i v2 Cooler, Inateck KTU3FR-4P USB 3 card, Windows 10 Pro v1903 (18363.592)
  • kojackkojack Posts: 5,925 Volunteer Moderator
    I found the problem with v13PTC.
    One of the things I'm doing is watching for when the app loads the oculus runtime library. I could inject my code at any point (even while the game has been running for a while), but that might mean I miss functions I want to intercept but are only called once early on. So I want to hook before the game gets to use any of the runtime's functions.

    Some games (pistol whip, beat saber, audica, actually it might be unity based ones, not sure) actually load the runtime more than once. Pistol Whip loads it 3 times. Audica loads it twice. (Interestingly, Audica loads the HmxAudioPlugin.dll 75 times, which seems a little extreme, but hey, it works I guess)

    What I was doing is hooking on the first library load, then skipping later loads. On v12, that's fine. But on v13PTC, hooking the first load results in none of my stuff working, but hooking any of the later ones works. Things like Oculus Medium (not Unity) and Oculus Monitor (not Unity) only load the runtime once, and they worked on v12 and v13PTC. I think for some games the first load is being unloaded, so any hooks are lost.
    So now I uninstall hooks and reinstall them on every runtime load, and everything is now working correctly on v13PTC.

    Hmm, maybe I shouldn't give away my secrets. :)

    Yay, guess I won't terminate the project. Crap, that means I have to write a readme for it. I hate documentation.



  • WildtWildt Posts: 2,142 Valuable Player
    Much appreciated - good work! 
    PCVR: CV1 || 4 sensors || TPcast wireless adapter || MamutVR Gun stock V3
    PSVR: PS4 Pro || Move Controllers || Aim controller
    WMR: HP Reverb
  • kojackkojack Posts: 5,925 Volunteer Moderator
    If I can get head reorientation working better, I think that should be enough for an alpha release.

    There's other stuff I'd like to add, but that can wait. One thing I'd like is real time changes to settings. At the moment you need to quit the game to change stuff. For most features that's fine, but things like height offset would benefit from real time changes.

Sign In or Register to comment.