CommonLibVR
BSVRInterface.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef SKYRIMVR
4 
5 # include "RE/B/BSTEvent.h"
6 # include "RE/N/NiNode.h"
7 # include "RE/N/NiSmartPointer.h"
8 # include "RE/N/NiTransform.h"
9 # include "openvr.h"
10 
11 namespace RE
12 {
13  struct VROverlayChange;
14  struct VRDeviceConnectionChange;
15  struct VRResetHMDHeight;
16 
17  class BSVRInterface :
18  public BSTEventSource<VROverlayChange>, // 08
19  public BSTEventSource<VRDeviceConnectionChange>, // 60
20  public BSTEventSource<VRResetHMDHeight> // B8
21  {
22  public:
23  inline static constexpr auto RTTI = RTTI_BSVRInterface;
24 
25  enum class HMDDeviceType : std::uint32_t
26  {
27  kLighthouse, // used for sDriverVive:VR?
28  kOculus, // used for sDriverOculus:VR?
29  kHolographics // used for sDriverWindowsMR:VR?
30  };
31 
32  enum Hand : std::uint32_t
33  {
34  kLeft,
35  kRight,
36  kTotal
37  };
38 
39  struct Unk118
40  {
41 # pragma pack(push, 4)
42  struct PoseTransform
43  {
44  // Status based on openvr's ETrackingResult. Calibrated/uninitialized = kNotRunning
45  enum class TrackingStatus : std::uint32_t
46  {
47  kNotRunning,
48  kRunningOk,
49  kOutOfRange
50  };
51 
52  TrackingStatus poseStatus; // 00
53  NiTransform renderPoseTransform; // 04
54  NiTransform gamePoseTransform; // 38
55  };
56  static_assert(sizeof(PoseTransform) == 0x6C);
57 # pragma pack(pop)
58 
59  // members
60  Unk118* unk00; // 00
61  Unk118* unk08; // 08
62  Unk118* unk10; // 10
63  std::uint8_t unk18; // 18
64  bool unk19; // 19
65  std::uint16_t unk1A; // 18
66  std::uint32_t poseIndex; // 1C
67  PoseTransform* poseTransform; // 20
68  std::uint64_t unk28; // 28
69  std::uint64_t unk30; // 30
70  std::uint64_t unk38; // 38
71  std::uint64_t unk40; // 40
72  std::uint64_t unk48; // 48
73  std::uint64_t unk50; // 50
74  NiTransform unk58; // 58
75  };
76  static_assert(sizeof(Unk118) == 0x90);
77 
78  struct Unk190
79  {
80  // members
81  std::uint64_t unk00; // 00
82  std::uint64_t unk08; // 08
83  std::uint64_t unk10; // 10
84  std::uint64_t unk18; // 18
85  vr::IVROverlay* ivrOverlay; // 20
86  std::uint64_t unk28; // 28
87  std::uint64_t unk30; // 30
88  std::uint64_t unk38; // 38
89  std::uint64_t unk40; // 40
90  std::uint64_t unk48; // 48
91  std::uint64_t unk50; // 50
92  std::uint64_t unk58; // 58
93  std::uint64_t unk60; // 60
94  };
95  static_assert(sizeof(Unk190) == 0x68);
96 
97  // add
98  virtual void InitializeVR(); // 00
99  virtual void ShutdownVR(); // 01
100  virtual void PostPresentHandoff(); // 02
101  virtual void Submit(void* a_directXTextureHandle); // 03
102  virtual void SubmitForEye(vr::EVREye, void* a_directXTextureHandle); // 04
103  virtual void SetTrackingSpaceAsStanding(); // 05
104  virtual void SetTrackingSpaceAsSeated(); // 06
105  virtual void Unk_07(void); // 07
106  virtual void GetProjectionRaw(vr::EVREye eEye, float* pfLeft, float* pfRight, float* pfTop, float* pfBottom); // 08
107  virtual NiTransform* GetEyeToHeadTransform(NiTransform& a_out, bool getRightEye); // 09
108  virtual NiTransform* Unk_0A(NiTransform& a_out, bool getRightController, bool a_unk1); // 0A
109  virtual void Unk_0B(void); // 0B - Processes events?
110  virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForHMD(); // 0C
111  virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForHand(bool getRightHand); // 0D
112  virtual void TriggerHapticPulse(bool doRightController, float duration); // 0E
113  virtual void Unk_0F(void); // 0F
114  virtual void Unk_10(void); // 10
115  virtual void Unk_11(void); // 11
116  virtual void Unk_12(void); // 12
117  virtual void Unk_13(void); // 13
118  virtual RE::NiPointer<NiNode>* GetControllerNode(RE::NiPointer<NiNode>& a_out, Hand a_hand); // 14
119  virtual void Unk_15(void); // 15
120  virtual HMDDeviceType GetHMDDeviceType(); // 16
121  virtual RE::NiPointer<NiNode>* CreateControllerNode(RE::NiPointer<NiNode>& a_out, Hand a_hand); // 17
122 
123  // members
124  std::uint8_t unk110; // 110
125  Unk118* unk118; // 118 - Possibily a data structure for storing pose data?
126  std::uint64_t unk120; // 120
127  NiTransform renderTransform; // 128 - Headset pose render transform
128  NiTransform gameTransform; // 15C - Headset pose game transform
129  Unk190* unk190; // 190
130  std::uint64_t unk198; // 198
131  std::uint64_t unk1A0; // 1A0
132  std::uint64_t unk1A8; // 1A8
133  vr::IVROverlay* ivrOverlay; // 1B0
134  std::uint64_t unk1B8; // 1B8
135  std::uint64_t unk1C0; // 1C0
136  std::uint64_t unk1C8; // 1C8
137  std::uint64_t unk1D0; // 1D0
138  std::uint64_t unk1D8; // 1D8
139  std::uint64_t unk1E0; // 1E0
140  std::uint64_t unk1E8; // 1E8
141  std::uint64_t unk1F0; // 1F0
142  vr::VROverlayHandle_t unk1F8; // 1F8 - current overlay handle? Used in 2D overlay menus like JournalMenu
143  bool isHeadsetTrackingOk; // 200 - Headset is active and skyrim is receiving tracking data
144  private:
145  KEEP_FOR_RE()
146  };
147  static_assert(sizeof(BSVRInterface) == 0x208);
148 }
149 #endif
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: NiSmartPointer.h:9
Definition: AbsorbEffect.h:6
constexpr REL::Offset RTTI_BSVRInterface(0x01F5FB80)