From d73660fc305f08b5f459718e300b45e7dc8743bb Mon Sep 17 00:00:00 2001 From: Parapets Date: Wed, 30 Oct 2024 19:47:45 +0000 Subject: [PATCH] Small VR update --- cmake/sourcelist.cmake | 9 + include/RE/A/AIProcess.h | 2 +- include/RE/A/Actor.h | 11 +- include/RE/B/BSInputDeviceManager.h | 4 + include/RE/B/BSOpenVR.h | 53 +++ include/RE/B/BSVRInterface.h | 50 +++ include/RE/C/ControlMap.h | 9 + include/RE/C/CraftingMenu.h | 9 +- include/RE/C/CreationClubMenu.h | 4 +- include/RE/C/CursorMenu.h | 6 +- include/RE/D/DirectionHandler.h | 6 +- include/RE/F/FavoritesHandler.h | 6 +- include/RE/F/FavoritesMenu.h | 6 +- include/RE/I/IMenu.h | 29 +- include/RE/I/InputDevices.h | 20 + include/RE/I/InputEvent.h | 6 +- include/RE/I/InterfaceStrings.h | 127 +++--- include/RE/J/JournalMenu.h | 4 +- include/RE/L/LocalMapMenu.h | 8 +- include/RE/L/LockpickingMenu.h | 8 +- include/RE/M/MapLookHandler.h | 6 +- include/RE/M/MapMoveHandler.h | 4 +- include/RE/M/MapZoomHandler.h | 4 +- include/RE/M/MenuControls.h | 17 +- include/RE/M/MenuEventHandler.h | 18 +- include/RE/M/MenuOpenHandler.h | 6 +- include/RE/M/MistMenu.h | 8 +- include/RE/M/ModManagerMenu.h | 4 +- include/RE/R/RaceSexMenu.h | 8 +- include/RE/S/StatsMenu.h | 6 +- include/RE/Skyrim.h | 2 + include/RE/T/TESObjectREFR.h | 67 ++-- include/RE/U/UserEvents.h | 41 +- include/RE/V/VrWandTouchpadPositionEvent.h | 9 +- include/REL/Relocation.h | 14 +- include/SKSE/Impl/PCH.h | 1 + include/vr/COpenVRContext.h | 37 ++ include/vr/Hmd.h | 60 +++ include/vr/IVROverlay.h | 253 ++++++++++++ include/vr/OpenVR.h | 7 + include/vr/OpenVRTypes.h | 96 +++++ include/vr/Properties.h | 189 +++++++++ include/vr/VREvent.h | 424 +++++++++++++++++++++ src/RE/A/AIProcess.cpp | 4 +- src/RE/I/IMenu.cpp | 20 + src/RE/M/MenuEventHandler.cpp | 25 +- 46 files changed, 1532 insertions(+), 175 deletions(-) create mode 100644 include/RE/B/BSOpenVR.h create mode 100644 include/RE/B/BSVRInterface.h create mode 100644 include/vr/COpenVRContext.h create mode 100644 include/vr/Hmd.h create mode 100644 include/vr/IVROverlay.h create mode 100644 include/vr/OpenVR.h create mode 100644 include/vr/OpenVRTypes.h create mode 100644 include/vr/Properties.h create mode 100644 include/vr/VREvent.h diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 5cc7139a9..420063d24 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -246,6 +246,7 @@ set(SOURCES include/RE/B/BSNavmeshInfoMap.h include/RE/B/BSNiAllocator.h include/RE/B/BSNiNode.h + include/RE/B/BSOpenVR.h include/RE/B/BSPCGamepadDeviceDelegate.h include/RE/B/BSPCGamepadDeviceHandler.h include/RE/B/BSPathingCell.h @@ -305,6 +306,7 @@ set(SOURCES include/RE/B/BSTriShape.h include/RE/B/BSUIMessageData.h include/RE/B/BSUIScaleformData.h + include/RE/B/BSVRInterface.h include/RE/B/BSVirtualKeyboardDevice.h include/RE/B/BSVisit.h include/RE/B/BSVolumetricLightingRenderData.h @@ -1349,6 +1351,13 @@ set(SOURCES include/SKSE/Trampoline.h include/SKSE/Translation.h include/SKSE/Version.h + include/vr/COpenVRContext.h + include/vr/Hmd.h + include/vr/IVROverlay.h + include/vr/OpenVR.h + include/vr/OpenVRTypes.h + include/vr/Properties.h + include/vr/VREvent.h src/RE/A/AIFormulas.cpp src/RE/A/AIProcess.cpp src/RE/A/ActiveEffect.cpp diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index 96d3c7a02..e2842fbf2 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -138,7 +138,7 @@ namespace RE }; static_assert(sizeof(Data0B8) == 0x38); - void ClearFurniture(); + void ClearFurniture(RE::Actor* a_actor); float GetCachedHeight() const; bhkCharacterController* GetCharController(); ActorHandle GetCommandingActor() const; diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 479f42c11..00d0c7657 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -340,10 +340,13 @@ namespace RE BSSimpleList* GetActiveEffectList() override; // 007 // add - virtual void Unk_A2(void); // 0A2 - virtual void PlayPickUpSound(TESBoundObject* a_object, bool a_pickup, bool a_use); // 0A3 - virtual float GetHeading(bool a_ignoreRaceSettings) const; // 0A4 - virtual void SetAvoidanceDisabled(bool a_set); // 0A5 - { return; } + virtual void Unk_A2(void); // 0A2 + virtual void PlayPickUpSound(TESBoundObject* a_object, bool a_pickup, bool a_use); // 0A3 + virtual float GetHeading(bool a_ignoreRaceSettings) const; // 0A4 + virtual void SetAvoidanceDisabled(bool a_set); // 0A5 - { return; } +#ifdef SKYRIMVR + virtual void UnkVR_A7(void); // 0A7 +#endif virtual void DrawWeaponMagicHands(bool a_draw); // 0A6 virtual void Unk_A7(void); // 0A7 virtual void Unk_A8(void); // 0A8 diff --git a/include/RE/B/BSInputDeviceManager.h b/include/RE/B/BSInputDeviceManager.h index c26760f2f..d2cabc648 100644 --- a/include/RE/B/BSInputDeviceManager.h +++ b/include/RE/B/BSInputDeviceManager.h @@ -49,5 +49,9 @@ namespace RE std::uint32_t unkE4; // E4 std::uint64_t unkE8; // E8 }; +#ifndef SKYRIMVR static_assert(sizeof(BSInputDeviceManager) == 0xF0); +#else + static_assert(sizeof(BSInputDeviceManager) == 0x120); +#endif } diff --git a/include/RE/B/BSOpenVR.h b/include/RE/B/BSOpenVR.h new file mode 100644 index 000000000..5802f1923 --- /dev/null +++ b/include/RE/B/BSOpenVR.h @@ -0,0 +1,53 @@ +#pragma once + +#include "RE/B/BSVRInterface.h" + +#ifdef SKYRIMVR +namespace RE +{ + class BSOpenVR : public BSVRInterface + { + public: + struct Data238 + { + std::uint64_t unk00; // 00 + std::uint64_t unk08; // 08 + std::uint64_t unk10; // 10 + std::uint64_t unk18; // 18 + std::uint64_t unk20; // 20 + std::uint64_t unk28; // 28 + std::uint64_t unk30; // 30 + std::uint64_t unk38; // 38 + }; + static_assert(sizeof(Data238) == 0x40); + + [[nodiscard]] static BSOpenVR* GetSingleton() + { + static REL::Relocation singleton{ REL::Offset(0x2FEB9B0) }; + return *singleton; + } + + // members + std::uint64_t unk208; // 208 + void* unk210; // 210 + std::uint64_t unk218; // 218 + void* unk220; // 220 + std::uint64_t unk228; // 228 + std::uint64_t unk230; // 230 + Data238 unk238[4]; // 238 + std::uint64_t unk338; // 338 + std::uint64_t unk340; // 340 + std::uint64_t unk348; // 348 + std::uint64_t unk350; // 350 + std::uint64_t unk358; // 358 + std::uint64_t unk360; // 360 + std::uint64_t unk368; // 368 + std::uint64_t unk370; // 370 + std::uint64_t unk378; // 378 + std::uint64_t unk380; // 380 + std::uint64_t unk388[2]; // 388 + std::uint64_t unk398; // 398 + }; + static_assert(sizeof(BSOpenVR) == 0x3A0); +} +#endif diff --git a/include/RE/B/BSVRInterface.h b/include/RE/B/BSVRInterface.h new file mode 100644 index 000000000..2824ecfea --- /dev/null +++ b/include/RE/B/BSVRInterface.h @@ -0,0 +1,50 @@ +#pragma once + +#include "RE/B/BSTEvent.h" +#include "vr/COpenVRContext.h" +#include "vr/OpenVRTypes.h" + +#ifdef SKYRIMVR + +namespace RE +{ + struct VROverlayChange; + struct VRDeviceConnectionChange; + struct VRResetHMDHeight; + + class BSVRInterface : public BSTEventSource, // 00 + public BSTEventSource, // 58 + public BSTEventSource // B0 + { + public: + [[nodiscard]] vr::IVROverlay* VROverlay() + { + static REL::Relocation get{ REL::Offset(0x8A0110) }; + return get(moduleContext); + } + + // members + std::uint64_t unk108; // 108 + std::uint64_t unk110; // 118 + std::uint64_t unk118; // 118 + std::uint64_t unk120; // 120 + std::uint64_t unk128; // 128 + std::uint64_t unk130; // 130 + std::uint64_t unk138; // 138 + std::uint64_t unk140; // 140 + std::uint64_t unk148; // 148 + std::uint64_t unk150; // 150 + std::uint64_t unk158; // 158 + std::uint64_t unk160; // 160 + std::uint64_t unk168; // 168 + std::uint64_t unk170; // 170 + std::uint64_t unk178; // 178 + std::uint64_t unk180; // 180 + std::uint64_t unk188; // 188 + vr::COpenVRContext moduleContext; // 190 + vr::VROverlayHandle_t currentOverlay; // 1F8 + std::uint64_t unk200; // 200 + }; + static_assert(sizeof(BSVRInterface) == 0x208); +} +#endif diff --git a/include/RE/C/ControlMap.h b/include/RE/C/ControlMap.h index 7d467bbfd..3ec6cc672 100644 --- a/include/RE/C/ControlMap.h +++ b/include/RE/C/ControlMap.h @@ -47,7 +47,11 @@ namespace RE // members BSTArray deviceMappings[INPUT_DEVICES::kTotal]; // 00 }; +#if !defined(SKYRIMVR) static_assert(sizeof(InputContext) == 0x60); +#else + static_assert(sizeof(InputContext) == 0xF0); +#endif struct LinkedMapping { @@ -97,5 +101,10 @@ namespace RE std::uint8_t pad12B; // 12B stl::enumeration gamePadMapType; // 12C }; +#if !defined(SKYRIMVR) static_assert(sizeof(ControlMap) == 0x130); +#else + static_assert(offsetof(ControlMap, textEntryCount) == 0x140); + static_assert(sizeof(ControlMap) == 0x148); +#endif } diff --git a/include/RE/C/CraftingMenu.h b/include/RE/C/CraftingMenu.h index 765ab142d..6201b9f4d 100644 --- a/include/RE/C/CraftingMenu.h +++ b/include/RE/C/CraftingMenu.h @@ -1,6 +1,7 @@ #pragma once #include "RE/I/IMenu.h" +#include "RE/M/MenuEventHandler.h" namespace RE { @@ -12,7 +13,11 @@ namespace RE // menuDepth = 0 // flags = kUsesMenuContext | kDisablePauseMenu | kUpdateUsesCursor | kInventoryItemMenu | kDontHideCursorWhenTopmost // context = kItemMenu - class CraftingMenu : public IMenu + class CraftingMenu : public IMenu // 00 +#ifdef SKYRIMVR + , + public MenuEventHandler // 40 +#endif { public: inline static constexpr auto RTTI = RTTI_CraftingMenu; @@ -31,6 +36,6 @@ namespace RE #ifndef SKYRIMVR static_assert(sizeof(CraftingMenu) == 0x38); #else - //static_assert(sizeof(CraftingMenu) == 0x58); + static_assert(sizeof(CraftingMenu) == 0x58); #endif } diff --git a/include/RE/C/CreationClubMenu.h b/include/RE/C/CreationClubMenu.h index 03e10fd5d..b145755c4 100644 --- a/include/RE/C/CreationClubMenu.h +++ b/include/RE/C/CreationClubMenu.h @@ -31,8 +31,8 @@ namespace RE void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // override (GFxFunctionHandler) void Call(Params& a_params) override; // 01 diff --git a/include/RE/C/CursorMenu.h b/include/RE/C/CursorMenu.h index b548ba66a..a8088f698 100644 --- a/include/RE/C/CursorMenu.h +++ b/include/RE/C/CursorMenu.h @@ -22,9 +22,9 @@ namespace RE UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessMouseMove(MouseMoveEvent* a_event) override; // 04 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const MouseMoveEvent* a_event) override; // 04 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 }; #ifndef SKYRIMVR static_assert(sizeof(CursorMenu) == 0x40); diff --git a/include/RE/D/DirectionHandler.h b/include/RE/D/DirectionHandler.h index ca7efe468..7edf0c11f 100644 --- a/include/RE/D/DirectionHandler.h +++ b/include/RE/D/DirectionHandler.h @@ -12,9 +12,9 @@ namespace RE virtual ~DirectionHandler(); // 00 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // members std::uint32_t unk10; // 10 diff --git a/include/RE/F/FavoritesHandler.h b/include/RE/F/FavoritesHandler.h index 320dcd992..bcaeef577 100644 --- a/include/RE/F/FavoritesHandler.h +++ b/include/RE/F/FavoritesHandler.h @@ -12,9 +12,9 @@ namespace RE ~FavoritesHandler() override; // 00 // add - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessKinect(KinectEvent* a_event) override; // 02 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const KinectEvent* a_event) override; // 02 }; static_assert(sizeof(FavoritesHandler) == 0x10); } diff --git a/include/RE/F/FavoritesMenu.h b/include/RE/F/FavoritesMenu.h index 787c171b7..454957e26 100644 --- a/include/RE/F/FavoritesMenu.h +++ b/include/RE/F/FavoritesMenu.h @@ -35,9 +35,9 @@ namespace RE UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessKinect(KinectEvent* a_event) override; // 02 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const KinectEvent* a_event) override; // 02 // members GFxValue root; // 40 - "Menu_mc" diff --git a/include/RE/I/IMenu.h b/include/RE/I/IMenu.h index 38f51180b..21195fd82 100644 --- a/include/RE/I/IMenu.h +++ b/include/RE/I/IMenu.h @@ -1,5 +1,6 @@ #pragma once +#include "RE/B/BSString.h" #include "RE/F/FxDelegate.h" #include "RE/F/FxDelegateHandler.h" #include "RE/G/GFxMovieView.h" @@ -59,7 +60,14 @@ namespace RE using Context = UserEvents::INPUT_CONTEXT_ID; using Flag = UI_MENU_FLAGS; - ~IMenu() override = default; // 00 +#ifdef SKYRIMVR + IMenu() : + depthPriority(4), + inputContext(static_cast(22)) + {} +#endif + + ~IMenu() override; // 00 // override (FxDelegateHandler) void Accept(CallbackProcessor* a_processor) override; // 01 - { return; } @@ -72,8 +80,15 @@ namespace RE virtual void PostDisplay(); // 06 virtual void PreDisplay(); // 07 - { return; } - only available if kRendersOffscreenTargets is set virtual void RefreshPlatform(); // 08 +#ifdef SKYRIMVR + virtual void Unk_09(std::int32_t a_arg1); // 09 + virtual void ResetOnShow(); // 0A +#endif - [[nodiscard]] constexpr bool AdvancesUnderPauseMenu() const noexcept { return menuFlags.all(Flag::kAdvancesUnderPauseMenu); } + [[nodiscard]] constexpr bool AdvancesUnderPauseMenu() const noexcept + { + return menuFlags.all(Flag::kAdvancesUnderPauseMenu); + } [[nodiscard]] constexpr bool AllowSaving() const noexcept { return menuFlags.all(Flag::kAllowSaving); } [[nodiscard]] constexpr bool AlwaysOpen() const noexcept { return menuFlags.all(Flag::kAlwaysOpen); } [[nodiscard]] constexpr bool ApplicationMenu() const noexcept { return menuFlags.all(Flag::kApplicationMenu); } @@ -106,15 +121,17 @@ namespace RE GPtr uiMovie{ nullptr }; // 10 std::int8_t depthPriority{ 3 }; // 18 std::uint8_t pad19{ 0 }; // 19 - std::uint16_t pad20{ 0 }; // 1A + std::uint16_t pad1A{ 0 }; // 1A stl::enumeration menuFlags{ Flag::kNone }; // 1C stl::enumeration inputContext{ Context::kNone }; // 20 std::uint32_t pad24{ 0 }; // 24 GPtr fxDelegate{ nullptr }; // 28 #ifdef SKYRIMVR - std::int32_t unk30; // 30 - std::int32_t unk34; // 34 - std::uint64_t unk38; // 38 + std::int32_t unkVR30{ -1 }; // 30 + std::uint8_t unkVR34{ 1 }; // 34 + std::uint8_t padVR35; // 35 + std::uint16_t padVR36; // 36 + BSFixedString unkVR38{ "N/A"sv }; // 38 #endif }; #ifndef SKYRIMVR diff --git a/include/RE/I/InputDevices.h b/include/RE/I/InputDevices.h index 8a249eda0..90dcf5064 100644 --- a/include/RE/I/InputDevices.h +++ b/include/RE/I/InputDevices.h @@ -10,10 +10,30 @@ namespace RE kKeyboard = 0, kMouse, kGamepad, +#ifdef SKYRIMVR + kVivePrimary, + kViveSecondary, + kOculusPrimary, + kOculusSecondary, + kWMRPrimary, + kWMRSecondary, +#endif kVirtualKeyboard, kTotal }; }; using INPUT_DEVICE = INPUT_DEVICES::INPUT_DEVICE; + +#ifdef SKYRIMVR + [[nodiscard]] inline bool IsVRWandDevice(INPUT_DEVICE a_device) + { + return a_device == INPUT_DEVICE::kVivePrimary || + a_device == INPUT_DEVICE::kViveSecondary || + a_device == INPUT_DEVICE::kOculusPrimary || + a_device == INPUT_DEVICE::kOculusSecondary || + a_device == INPUT_DEVICE::kWMRPrimary || + a_device == INPUT_DEVICE::kWMRSecondary; + } +#endif } diff --git a/include/RE/I/InputEvent.h b/include/RE/I/InputEvent.h index 2545fc77d..f5507bddc 100644 --- a/include/RE/I/InputEvent.h +++ b/include/RE/I/InputEvent.h @@ -12,7 +12,11 @@ namespace RE kChar, kThumbstick, kDeviceConnect, - kKinect + kKinect, +#ifdef SKYRIMVR + kVrWandTouchpadPosition, + kVrWandTouchpadSwipe, +#endif }; class ButtonEvent; diff --git a/include/RE/I/InterfaceStrings.h b/include/RE/I/InterfaceStrings.h index 5d3e9ad4e..a3ec6450d 100644 --- a/include/RE/I/InterfaceStrings.h +++ b/include/RE/I/InterfaceStrings.h @@ -11,62 +11,64 @@ namespace RE static InterfaceStrings* GetSingleton(); // members - std::uint8_t pad001; // 001 - std::uint16_t pad002; // 002 - std::uint32_t pad004; // 004 - BSFixedString faderData; // 008 - "FaderData" - BSFixedString hudData; // 010 - "HUDData" - BSFixedString hudCamData; // 018 - "HUDCamData" - BSFixedString floatingQuestMarkers; // 020 - "FloatingQuestMarkers" - BSFixedString consoleData; // 028 - "ConsoleData" - BSFixedString quantityData; // 030 - "QuantityData" - BSFixedString messageBoxData; // 038 - "MessageBoxData" - BSFixedString bsUIScaleformData; // 040 - "BSUIScaleformData" - BSFixedString bsUIMessageData; // 048 - "BSUIMessageData" - BSFixedString bsUIAnalogData; // 050 - "BSUIAnalogData" - BSFixedString inventoryUpdateData; // 058 - "InventoryUpdateData" - BSFixedString refHandleUIData; // 060 - "RefHandleUIData" - BSFixedString tesFormUIData; // 068 - "TESFormUIData" - BSFixedString loadingMenuData; // 070 - "LoadingMenuData" - BSFixedString kinectStateData; // 078 - "KinectStateChangeData" - BSFixedString kinectUserEventData; // 080 - "KinectUserEventData" - BSFixedString inventoryMenu; // 088 - "InventoryMenu" - BSFixedString console; // 090 - "Console" - BSFixedString dialogueMenu; // 098 - "Dialogue Menu" - BSFixedString hudMenu; // 0A0 - "HUD Menu" - BSFixedString mainMenu; // 0A8 - "Main Menu" - BSFixedString messageBoxMenu; // 0B0 - "MessageBoxMenu" - BSFixedString cursorMenu; // 0B8 - "Cursor Menu" - BSFixedString faderMenu; // 0C0 - "Fader Menu" - BSFixedString magicMenu; // 0C8 - "MagicMenu" - BSFixedString topMenu; // 0D0 - "Top Menu" - BSFixedString overlayMenu; // 0D8 - "Overlay Menu" - BSFixedString overlayInteractionMenu; // 0E0 - "Overlay Interaction Menu" - BSFixedString loadingMenu; // 0E8 - "Loading Menu" - BSFixedString tweenMenu; // 0F0 - "TweenMenu" - BSFixedString barterMenu; // 0F8 - "BarterMenu" - BSFixedString giftMenu; // 100 - "GiftMenu" - BSFixedString debugTextMenu; // 108 - "Debug Text Menu" - BSFixedString mapMenu; // 110 - "MapMenu" - BSFixedString lockpickingMenu; // 118 - "Lockpicking Menu" - BSFixedString quantityMenu; // 120 - "Quantity Menu" - BSFixedString statsMenu; // 128 - "StatsMenu" - BSFixedString containerMenu; // 130 - "ContainerMenu" - BSFixedString sleepWaitMenu; // 138 - "Sleep/Wait Menu" - BSFixedString levelUpMenu; // 140 - "LevelUp Menu" - BSFixedString journalMenu; // 148 - "Journal Menu" - BSFixedString bookMenu; // 150 - "Book Menu" - BSFixedString favoritesMenu; // 158 - "FavoritesMenu" - BSFixedString raceSexMenu; // 160 - "RaceSex Menu" - BSFixedString craftingMenu; // 168 - "Crafting Menu" - BSFixedString trainingMenu; // 170 - "Training Menu" - BSFixedString mistMenu; // 178 - "Mist Menu" - BSFixedString tutorialMenu; // 180 - "Tutorial Menu" - BSFixedString creditsMenu; // 188 - "Credits Menu" - BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" - BSFixedString creationClubMenu; // 198 - "Creation Club Menu" - BSFixedString loginMenu; // 1A0 - "Login Menu" - BSFixedString marketplaceMenu; // 1A8 - "Marketplace Menu" + std::uint8_t pad001; // 001 + std::uint16_t pad002; // 002 + std::uint32_t pad004; // 004 + BSFixedString faderData; // 008 - "FaderData" + BSFixedString hudData; // 010 - "HUDData" + BSFixedString hudCamData; // 018 - "HUDCamData" + BSFixedString floatingQuestMarkers; // 020 - "FloatingQuestMarkers" + BSFixedString consoleData; // 028 - "ConsoleData" + BSFixedString quantityData; // 030 - "QuantityData" + BSFixedString messageBoxData; // 038 - "MessageBoxData" + BSFixedString bsUIScaleformData; // 040 - "BSUIScaleformData" + BSFixedString bsUIMessageData; // 048 - "BSUIMessageData" + BSFixedString bsUIAnalogData; // 050 - "BSUIAnalogData" + BSFixedString inventoryUpdateData; // 058 - "InventoryUpdateData" + BSFixedString refHandleUIData; // 060 - "RefHandleUIData" + BSFixedString tesFormUIData; // 068 - "TESFormUIData" + BSFixedString loadingMenuData; // 070 - "LoadingMenuData" + BSFixedString kinectStateData; // 078 - "KinectStateChangeData" + BSFixedString kinectUserEventData; // 080 - "KinectUserEventData" + BSFixedString inventoryMenu; // 088 - "InventoryMenu" + BSFixedString console; // 090 - "Console" + BSFixedString dialogueMenu; // 098 - "Dialogue Menu" + BSFixedString hudMenu; // 0A0 - "HUD Menu" + BSFixedString mainMenu; // 0A8 - "Main Menu" + BSFixedString messageBoxMenu; // 0B0 - "MessageBoxMenu" + BSFixedString cursorMenu; // 0B8 - "Cursor Menu" + BSFixedString faderMenu; // 0C0 - "Fader Menu" + BSFixedString magicMenu; // 0C8 - "MagicMenu" + BSFixedString topMenu; // 0D0 - "Top Menu" + BSFixedString overlayMenu; // 0D8 - "Overlay Menu" + BSFixedString overlayInteractionMenu; // 0E0 - "Overlay Interaction Menu" + BSFixedString loadingMenu; // 0E8 - "Loading Menu" + BSFixedString tweenMenu; // 0F0 - "TweenMenu" + BSFixedString barterMenu; // 0F8 - "BarterMenu" + BSFixedString giftMenu; // 100 - "GiftMenu" + BSFixedString debugTextMenu; // 108 - "Debug Text Menu" + BSFixedString mapMenu; // 110 - "MapMenu" + BSFixedString lockpickingMenu; // 118 - "Lockpicking Menu" + BSFixedString quantityMenu; // 120 - "Quantity Menu" + BSFixedString statsMenu; // 128 - "StatsMenu" + BSFixedString containerMenu; // 130 - "ContainerMenu" + BSFixedString sleepWaitMenu; // 138 - "Sleep/Wait Menu" + BSFixedString levelUpMenu; // 140 - "LevelUp Menu" + BSFixedString journalMenu; // 148 - "Journal Menu" + BSFixedString bookMenu; // 150 - "Book Menu" + BSFixedString favoritesMenu; // 158 - "FavoritesMenu" + BSFixedString raceSexMenu; // 160 - "RaceSex Menu" + BSFixedString craftingMenu; // 168 - "Crafting Menu" + BSFixedString trainingMenu; // 170 - "Training Menu" + BSFixedString mistMenu; // 178 - "Mist Menu" + BSFixedString tutorialMenu; // 180 - "Tutorial Menu" + BSFixedString creditsMenu; // 188 - "Credits Menu" + BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" +#if !defined(SKYRIMVR) + BSFixedString creationClubMenu; // 198 - "Creation Club Menu" + BSFixedString loginMenu; // 1A0 - "Login Menu" + BSFixedString marketplaceMenu; // 1A8 - "Marketplace Menu" +#endif BSFixedString titleSequenceMenu; // 1B0 - "TitleSequence Menu" BSFixedString consoleNativeUIMenu; // 1B8 - "Console Native UI Menu" BSFixedString kinectMenu; // 1C0 - "Kinect Menu" @@ -91,6 +93,19 @@ namespace RE BSFixedString cancelLoading; // 258 - "CancelLoading" BSFixedString menuTextureDegradeEvent; // 260 - "Menu Texture Degrade Event" BSFixedString diamondMarker; // 268 - "" +#if defined(SKYRIMVR) + BSFixedString wsEnemyMeters; // 258 - "WSEnemyMeters" + BSFixedString wsActivateRollover; // 260 - "WSActivateRollover" + BSFixedString wsDebugOverlay; // 268 - "WSDebugOverlay" + BSFixedString statsMenuSkillRing; // 270 - "StatsMenuSkillRing" + BSFixedString statsMenuPerks; // 278 - "StatsMenuPerks" + BSFixedString mapMarkerText3D; // 280 - "MapMarkerText3D" + BSFixedString calibrationOptionMenu; // 288 - "CalibrationOptionMenu" +#endif }; +#if !defined(SKYRIMVR) static_assert(sizeof(InterfaceStrings) == 0x270); +#else + static_assert(sizeof(InterfaceStrings) == 0x290); +#endif } diff --git a/include/RE/J/JournalMenu.h b/include/RE/J/JournalMenu.h index bf6851f03..dca1d888e 100644 --- a/include/RE/J/JournalMenu.h +++ b/include/RE/J/JournalMenu.h @@ -33,8 +33,8 @@ namespace RE void PostDisplay() override; // 06 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // override (BSTEventSink) BSEventNotifyControl ProcessEvent(const BSSystemEvent* a_event, BSTEventSource* a_eventSource) override; // 01 diff --git a/include/RE/L/LocalMapMenu.h b/include/RE/L/LocalMapMenu.h index 25b7d6f34..afe5f329f 100644 --- a/include/RE/L/LocalMapMenu.h +++ b/include/RE/L/LocalMapMenu.h @@ -79,10 +79,10 @@ namespace RE ~InputHandler() override; // 00 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessMouseMove(MouseMoveEvent* a_event) override; // 04 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const MouseMoveEvent* a_event) override; // 04 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // members LocalMapMenu* localMapMenu; // 10 diff --git a/include/RE/L/LockpickingMenu.h b/include/RE/L/LockpickingMenu.h index 568e01d59..b499ca8c1 100644 --- a/include/RE/L/LockpickingMenu.h +++ b/include/RE/L/LockpickingMenu.h @@ -28,10 +28,10 @@ namespace RE UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessMouseMove(MouseMoveEvent* a_event) override; // 04 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const MouseMoveEvent* a_event) override; // 04 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // override (BSTEventSink) BSEventNotifyControl ProcessEvent(const MenuOpenCloseEvent* a_event, BSTEventSource* a_eventSource) override; // 01 diff --git a/include/RE/M/MapLookHandler.h b/include/RE/M/MapLookHandler.h index a23abe932..bfe8e14ff 100644 --- a/include/RE/M/MapLookHandler.h +++ b/include/RE/M/MapLookHandler.h @@ -12,9 +12,9 @@ namespace RE ~MapLookHandler() override; // 00 // override (MapInputHandler) - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessMouseMove(MouseMoveEvent* a_event) override; // 04 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const MouseMoveEvent* a_event) override; // 04 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // members std::uint64_t unk18; // 18 diff --git a/include/RE/M/MapMoveHandler.h b/include/RE/M/MapMoveHandler.h index d77d68984..2f4e127ea 100644 --- a/include/RE/M/MapMoveHandler.h +++ b/include/RE/M/MapMoveHandler.h @@ -12,8 +12,8 @@ namespace RE ~MapMoveHandler() override; // 00 // override (MapInputHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // members std::uint64_t unk18; // 18 diff --git a/include/RE/M/MapZoomHandler.h b/include/RE/M/MapZoomHandler.h index 9d942c7be..6079fef7f 100644 --- a/include/RE/M/MapZoomHandler.h +++ b/include/RE/M/MapZoomHandler.h @@ -12,8 +12,8 @@ namespace RE ~MapZoomHandler() override; // 00 // override (MapInputHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 }; static_assert(sizeof(MapZoomHandler) == 0x18); } diff --git a/include/RE/M/MenuControls.h b/include/RE/M/MenuControls.h index 04ec20a2b..f36396628 100644 --- a/include/RE/M/MenuControls.h +++ b/include/RE/M/MenuControls.h @@ -68,13 +68,20 @@ namespace RE MenuOpenHandler* menuOpenHandler; // 68 FavoritesHandler* favoritesHandler; // 70 ScreenshotHandler* screenshotHandler; // 78 - bool isProcessing; // 80 - bool beastForm; // 81 - bool remapMode; // 82 - std::uint8_t unk83; // 83 - std::uint32_t unk84; // 84 +#ifdef SKYRIMVR + std::uint64_t unkVR80; // 80 +#endif + bool isProcessing; // 80 + bool beastForm; // 81 + bool remapMode; // 82 + std::uint8_t unk83; // 83 + std::uint32_t unk84; // 84 }; static_assert(offsetof(MenuControls, handlers) == 0x18); +#ifndef SKYRIMVR static_assert(offsetof(MenuControls, remapMode) == 0x82); static_assert(sizeof(MenuControls) == 0x88); +#else + static_assert(sizeof(MenuControls) == 0x90); +#endif } diff --git a/include/RE/M/MenuEventHandler.h b/include/RE/M/MenuEventHandler.h index daae92d0c..43771c029 100644 --- a/include/RE/M/MenuEventHandler.h +++ b/include/RE/M/MenuEventHandler.h @@ -9,6 +9,9 @@ namespace RE class KinectEvent; class MouseMoveEvent; class ThumbstickEvent; + class VRWandEvent; + class VrWandTouchpadPositionEvent; + class VrWandTouchpadSwipeEvent; class MenuEventHandler : public BSIntrusiveRefCounted { @@ -18,11 +21,16 @@ namespace RE MenuEventHandler() = default; virtual ~MenuEventHandler() = default; // 00 - virtual bool CanProcess(InputEvent* a_event) = 0; // 01 - virtual bool ProcessKinect(KinectEvent* a_event); // 02 - { return false; } - virtual bool ProcessThumbstick(ThumbstickEvent* a_event); // 03 - { return false; } - virtual bool ProcessMouseMove(MouseMoveEvent* a_event); // 04 - { return false; } - virtual bool ProcessButton(ButtonEvent* a_event); // 05 - { return false; } + virtual bool ShouldHandleEvent(const InputEvent* a_event) = 0; // 01 + virtual bool HandleEvent(const ButtonEvent* a_event); // 05 - { return false; } + virtual bool HandleEvent(const MouseMoveEvent* a_event); // 04 - { return false; } + virtual bool HandleEvent(const ThumbstickEvent* a_event); // 03 - { return false; } + virtual bool HandleEvent(const KinectEvent* a_event); // 02 - { return false; } +#ifdef SKYRIMVR + virtual bool HandleEvent(const VRWandEvent* a_event); // 04 - { return false; } + virtual bool HandleEvent(const VrWandTouchpadPositionEvent* a_event); // 03 - { return false; } + virtual bool HandleEvent(const VrWandTouchpadSwipeEvent* a_event); // 02 - { return false; } +#endif // members bool registered; // 0C diff --git a/include/RE/M/MenuOpenHandler.h b/include/RE/M/MenuOpenHandler.h index 59012bd54..d11ff7e2f 100644 --- a/include/RE/M/MenuOpenHandler.h +++ b/include/RE/M/MenuOpenHandler.h @@ -12,9 +12,9 @@ namespace RE ~MenuOpenHandler() override; // 00 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessKinect(KinectEvent* a_event) override; // 02 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const KinectEvent* a_event) override; // 02 // members bool unk10; // 10 diff --git a/include/RE/M/MistMenu.h b/include/RE/M/MistMenu.h index 1c9af9da6..1ddc07cc6 100644 --- a/include/RE/M/MistMenu.h +++ b/include/RE/M/MistMenu.h @@ -42,10 +42,10 @@ namespace RE void PostDisplay() override; // 06 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessMouseMove(MouseMoveEvent* a_event) override; // 04 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const MouseMoveEvent* a_event) override; // 04 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // members NiColor ambientColors[Colors::kTotal]; // 058 diff --git a/include/RE/M/ModManagerMenu.h b/include/RE/M/ModManagerMenu.h index 62e5c0557..65f7ce0d4 100644 --- a/include/RE/M/ModManagerMenu.h +++ b/include/RE/M/ModManagerMenu.h @@ -25,8 +25,8 @@ namespace RE void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // override (GFxFunctionHandler) void Call(Params& a_params) override; // 01 diff --git a/include/RE/R/RaceSexMenu.h b/include/RE/R/RaceSexMenu.h index 61c94d136..b7e079a3b 100644 --- a/include/RE/R/RaceSexMenu.h +++ b/include/RE/R/RaceSexMenu.h @@ -28,10 +28,10 @@ namespace RE void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override = 0; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessMouseMove(MouseMoveEvent* a_event) override; // 04 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override = 0; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const MouseMoveEvent* a_event) override; // 04 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 void ChangeName(const char* a_name); diff --git a/include/RE/S/StatsMenu.h b/include/RE/S/StatsMenu.h index f0102a9d2..02098438d 100644 --- a/include/RE/S/StatsMenu.h +++ b/include/RE/S/StatsMenu.h @@ -66,9 +66,9 @@ namespace RE void PostDisplay() override; // 06 // override (MenuEventHandler) - bool CanProcess(InputEvent* a_event) override; // 01 - bool ProcessThumbstick(ThumbstickEvent* a_event) override; // 03 - bool ProcessButton(ButtonEvent* a_event) override; // 05 + bool ShouldHandleEvent(const InputEvent* a_event) override; // 01 + bool HandleEvent(const ButtonEvent* a_event) override; // 05 + bool HandleEvent(const ThumbstickEvent* a_event) override; // 03 // members NiCamera* unk040; // 040 diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 80127029f..988d3273f 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -248,6 +248,7 @@ #include "RE/B/BSNavmeshInfoMap.h" #include "RE/B/BSNiAllocator.h" #include "RE/B/BSNiNode.h" +#include "RE/B/BSOpenVR.h" #include "RE/B/BSPCGamepadDeviceDelegate.h" #include "RE/B/BSPCGamepadDeviceHandler.h" #include "RE/B/BSPathingCell.h" @@ -307,6 +308,7 @@ #include "RE/B/BSTriShape.h" #include "RE/B/BSUIMessageData.h" #include "RE/B/BSUIScaleformData.h" +#include "RE/B/BSVRInterface.h" #include "RE/B/BSVirtualKeyboardDevice.h" #include "RE/B/BSVisit.h" #include "RE/B/BSVolumetricLightingRenderData.h" diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index c7795eeb9..a65cdf5d7 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -310,38 +310,41 @@ namespace RE virtual const BSTSmartPointer& GetBiped2() const; // 7F virtual const BSTSmartPointer& GetCurrentBiped() const; // 80 - { return GetBiped2(); } virtual void SetBiped(const BSTSmartPointer& a_biped); // 81 - { return; } - virtual void Unk_82(void); // 82 - { return; } - virtual void Unk_83(void); // 83 - { return; } - virtual void SetObjectReference(TESBoundObject* a_object); // 84 - sets flag 24 if the object has destructibles - virtual void MoveHavok(bool a_forceRec); // 85 - virtual void GetLinearVelocity(NiPoint3& a_velocity) const; // 86 - virtual void SetActionComplete(bool a_set); // 87 - { return; } - virtual void SetMovementComplete(bool a_set); // 88 - { return; } - virtual void Disable(); // 89 - virtual void ResetInventory(bool a_leveledOnly); // 8A - virtual void Unk_8B(void); // 8B - { return 0; } - virtual void Unk_8C(void); // 8C - { return; } - virtual NiAVObject* GetCurrent3D() const; // 8D - { return Get3D2(); } - virtual Explosion* AsExplosion(); // 8E - { return 0; } - virtual Projectile* AsProjectile(); // 8F - { return 0; } - virtual bool OnAddCellPerformQueueReference(TESObjectCELL& a_cell) const; // 90 - { return true; } - virtual void DoMoveToHigh(); // 91 - { return; } - virtual void TryMoveToMiddleLow(); // 92 - { return; } - virtual bool TryChangeSkyCellActorsProcessLevel(); // 93 - { return false; } - virtual void Unk_94(void); // 94 - { return; } - virtual void Unk_95(void); // 95 - { return; } - virtual void Unk_96(void); // 96 - related to lockpicking - virtual TESObjectCELL* GetSaveParentCell() const; // 97 - virtual void SetParentCell(TESObjectCELL* a_cell); // 98 - virtual bool IsDead(bool a_notEssential = true) const; // 99 - virtual BSAnimNoteReceiver* CreateAnimNoteReceiver(); // 9A - virtual BSAnimNoteReceiver* GetAnimNoteReceiver(); // 9B - virtual void Unk_9C(void); // 9C - virtual void Unk_9D(void); // 9D - { return 0; } - virtual TESAmmo* GetCurrentAmmo() const; // 9E - { return 0; } - virtual BGSDecalGroup* GetDecalGroup() const; // 9F - virtual void Unk_A0(void); // A0 - virtual void UnequipItem(std::uint64_t a_arg1, TESBoundObject* a_object); // A1 - { return; } +#ifdef SKYRIMVR + virtual void AttachWeapon(RE::TESObjectWEAP* a_weapon, bool a_leftHand); // 82 +#endif + virtual void Unk_82(void); // 82 - { return; } + virtual void Unk_83(void); // 83 - { return; } + virtual void SetObjectReference(TESBoundObject* a_object); // 84 - sets flag 24 if the object has destructibles + virtual void MoveHavok(bool a_forceRec); // 85 + virtual void GetLinearVelocity(NiPoint3& a_velocity) const; // 86 + virtual void SetActionComplete(bool a_set); // 87 - { return; } + virtual void SetMovementComplete(bool a_set); // 88 - { return; } + virtual void Disable(); // 89 + virtual void ResetInventory(bool a_leveledOnly); // 8A + virtual void Unk_8B(void); // 8B - { return 0; } + virtual void Unk_8C(void); // 8C - { return; } + virtual NiAVObject* GetCurrent3D() const; // 8D - { return Get3D2(); } + virtual Explosion* AsExplosion(); // 8E - { return 0; } + virtual Projectile* AsProjectile(); // 8F - { return 0; } + virtual bool OnAddCellPerformQueueReference(TESObjectCELL& a_cell) const; // 90 - { return true; } + virtual void DoMoveToHigh(); // 91 - { return; } + virtual void TryMoveToMiddleLow(); // 92 - { return; } + virtual bool TryChangeSkyCellActorsProcessLevel(); // 93 - { return false; } + virtual void Unk_94(void); // 94 - { return; } + virtual void Unk_95(void); // 95 - { return; } + virtual void Unk_96(void); // 96 - related to lockpicking + virtual TESObjectCELL* GetSaveParentCell() const; // 97 + virtual void SetParentCell(TESObjectCELL* a_cell); // 98 + virtual bool IsDead(bool a_notEssential = true) const; // 99 + virtual BSAnimNoteReceiver* CreateAnimNoteReceiver(); // 9A + virtual BSAnimNoteReceiver* GetAnimNoteReceiver(); // 9B + virtual void Unk_9C(void); // 9C + virtual void Unk_9D(void); // 9D - { return 0; } + virtual TESAmmo* GetCurrentAmmo() const; // 9E - { return 0; } + virtual BGSDecalGroup* GetDecalGroup() const; // 9F + virtual void Unk_A0(void); // A0 + virtual void UnequipItem(std::uint64_t a_arg1, TESBoundObject* a_object); // A1 - { return; } static NiPointer LookupByHandle(RefHandle a_refHandle); static bool LookupByHandle(RefHandle a_refHandle, NiPointer& a_refrOut); diff --git a/include/RE/U/UserEvents.h b/include/RE/U/UserEvents.h index 1e533a54a..50534c4d5 100644 --- a/include/RE/U/UserEvents.h +++ b/include/RE/U/UserEvents.h @@ -28,8 +28,16 @@ namespace RE kTFCMode, kMapDebug, kLockpicking, +#if !defined(SKYRIMVR) kCreationsMenu, // added in 1.6.1130 +#endif kFavor, +#if defined(SKYRIMVR) + kUnk17, + kUnk18, + kUnk19, + kUnk20, +#endif kTotal, @@ -86,7 +94,7 @@ namespace RE BSFixedString kinectShout; // 0A0 - "KinectShout" BSFixedString grab; // 0A8 - "Grab" BSFixedString run; // 0B0 - "Run" - BSFixedString toggleRun; // 0B8 - "Toggle Always Run" + BSFixedString toggleAlwaysRun; // 0B8 - "Toggle Always Run" BSFixedString autoMove; // 0C0 - "Auto-Move" BSFixedString quicksave; // 0C8 - "Quicksave" BSFixedString quickload; // 0D0 - "Quickload" @@ -167,6 +175,37 @@ namespace RE BSFixedString localMap; // 328 - "LocalMap" BSFixedString localMapMoveMode; // 330 - "LocalMapMoveMode" BSFixedString itemZoom; // 338 - "Item Zoom" +#if defined(SKYRIMVR) + BSFixedString vrSneakOrJump; // 340 - "Sneak Or Jump" + BSFixedString vrSwitchTarget; // 348 - "Switch Target" + BSFixedString vrActivateOrFavorites; // 350 - "Activate Or Favorites" + BSFixedString vrTeleportOrActivate; // 358 - "Teleport Or Activate" + BSFixedString vrTurnLeft; // 360 - "Turn Left" + BSFixedString vrTurnRight; // 368 - "Turn Right" + BSFixedString vrSceNavigationMode; // 370 - "Sce Navigation Mode" + BSFixedString vrTabLeft; // 378 - "Tab Left" + BSFixedString vrTabRight; // 380 - "Tab Right" + BSFixedString vrTabByHandedness; // 388 - "Tab By Handedness" + BSFixedString vrChangePage; // 390 - "Change Page" + BSFixedString vrLeftEquipOrTake; // 398 - "Left Equip Or Take" + BSFixedString vrRightEquipOrTake; // 3A0 - "Right Equip Or Take" + BSFixedString vrTakeAllOrStoreOrDropLeft; // 3A8 - "Take All Or Store Or Drop Left" + BSFixedString vrTakeAllOrStoreOrDropRight; // 3B0 - "Take All Or Store Or Drop Right" + BSFixedString vrToggleFavorite; // 3B8 - "Toggle Favorite" + BSFixedString vrChargeOrUnlock; // 3C0 - "Charge Or Unlock" + BSFixedString vrMapTeleport; // 3C8 - "Map Teleport" + BSFixedString vrMapClick; // 3D0 - "Map Click" + BSFixedString vrToggleOccCulling; // 3D8 - "ToggleOccCulling" + BSFixedString vrDeleteSave; // 3E0 - "Delete Save" + BSFixedString vrCancelAlt; // 3E8 - "Cancel Alt" + BSFixedString vrRightStick; // 3F0 - "Right Stick" + BSFixedString vrTweenOrReadyWeapon; // 3F8 - "Tween Or Ready Weapon" + BSFixedString vrJournalOrWait; // 400 - "Journal Or Wait" +#endif }; +#if !defined(SKYRIMVR) static_assert(sizeof(UserEvents) == 0x340); +#else + static_assert(sizeof(UserEvents) == 0x408); +#endif } diff --git a/include/RE/V/VrWandTouchpadPositionEvent.h b/include/RE/V/VrWandTouchpadPositionEvent.h index d5afc99c2..73ec3a4dc 100644 --- a/include/RE/V/VrWandTouchpadPositionEvent.h +++ b/include/RE/V/VrWandTouchpadPositionEvent.h @@ -7,9 +7,12 @@ namespace RE class VrWandTouchpadPositionEvent : public VRWandEvent { public: - std::uint64_t unk30; // 30 - std::uint64_t unk38; // 38 - std::uint64_t unk40; // 40 + float unk30; // 30 + float unk34; // 34 + std::uint32_t unk38; // 38 + std::uint32_t unk3C; // 3C + std::uint32_t unk40; // 40 + std::uint32_t unk44; // 44 }; static_assert(sizeof(VrWandTouchpadPositionEvent) == 0x48); } diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index f7e74d7d8..ed7d76e7a 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -427,11 +427,7 @@ namespace REL class Module { public: - [[nodiscard]] static Module& get() - { - static Module singleton; - return singleton; - } + static Module& get(); [[nodiscard]] std::uintptr_t base() const noexcept { return _base; } [[nodiscard]] stl::zwstring filename() const noexcept { return _filename; } @@ -447,7 +443,6 @@ namespace REL return static_cast(pointer()); } - private: Module() { load(); @@ -461,6 +456,7 @@ namespace REL Module& operator=(const Module&) = delete; Module& operator=(Module&&) = delete; + private: void load() { auto handle = WinAPI::GetModuleHandle(static_cast(nullptr)); @@ -518,6 +514,12 @@ namespace REL std::uintptr_t _base{ 0 }; }; + inline static Module gModule; + inline Module& Module::get() + { + return gModule; + } + class IDDatabase { private: diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index 278f838de..74930f326 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -749,6 +749,7 @@ namespace REL # include "RE/Offsets_NiRTTI_VR.h" # include "RE/Offsets_RTTI_VR.h" # include "RE/Offsets_VR.h" +# include "vr/OpenVR.h" #endif #include "RE/B/BSCoreTypes.h" diff --git a/include/vr/COpenVRContext.h b/include/vr/COpenVRContext.h new file mode 100644 index 000000000..95315d40d --- /dev/null +++ b/include/vr/COpenVRContext.h @@ -0,0 +1,37 @@ +#pragma once + +namespace vr +{ + class IVRApplications; + class IVRChaperone; + class IVRChaperoneSetup; + class IVRCompositor; + class IVRDriverManager; + class IVRExtendedDisplay; + class IVROverlay; + class IVRRenderModels; + class IVRResources; + class IVRScreenshots; + class IVRSettings; + class IVRSystem; + class IVRTrackedCamera; + + class COpenVRContext + { + public: + IVRSystem* m_pVRSystem; // 00 + IVRChaperone* m_pVRChaperone; // 08 + IVRChaperoneSetup* m_pVRChaperoneSetup; // 10 + IVRCompositor* m_pVRCompositor; // 18 + IVROverlay* m_pVROverlay; // 20 + IVRResources* m_pVRResources; // 28 + IVRRenderModels* m_pVRRenderModels; // 30 + IVRExtendedDisplay* m_pVRExtendedDisplay; // 38 + IVRSettings* m_pVRSettings; // 40 + IVRApplications* m_pVRApplications; // 48 + IVRTrackedCamera* m_pVRTrackedCamera; // 50 + IVRScreenshots* m_pVRScreenshots; // 58 + IVRDriverManager* m_pVRDriverManager; // 60 + }; + static_assert(sizeof(COpenVRContext) == 0x68); +} diff --git a/include/vr/Hmd.h b/include/vr/Hmd.h new file mode 100644 index 000000000..4aee1b281 --- /dev/null +++ b/include/vr/Hmd.h @@ -0,0 +1,60 @@ +#pragma once + +namespace vr +{ + // right-handed system + // +y is up + // +x is to the right + // -z is forward + // Distance unit is meters + struct HmdMatrix34_t + { + float m[3][4]; + }; + + struct HmdMatrix44_t + { + float m[4][4]; + }; + + struct HmdVector3_t + { + float v[3]; + }; + + struct HmdVector4_t + { + float v[4]; + }; + + struct HmdVector3d_t + { + double v[3]; + }; + + struct HmdVector2_t + { + float v[2]; + }; + + struct HmdQuaternion_t + { + double w, x, y, z; + }; + + struct HmdColor_t + { + float r, g, b, a; + }; + + struct HmdQuad_t + { + HmdVector3_t vCorners[4]; + }; + + struct HmdRect2_t + { + HmdVector2_t vTopLeft; + HmdVector2_t vBottomRight; + }; +} diff --git a/include/vr/IVROverlay.h b/include/vr/IVROverlay.h new file mode 100644 index 000000000..f8ee43749 --- /dev/null +++ b/include/vr/IVROverlay.h @@ -0,0 +1,253 @@ +#pragma once + +#include "vr/Hmd.h" +#include "vr/OpenVRTypes.h" +#include "vr/VREvent.h" + +namespace vr +{ + // The maximum length of an overlay key in bytes, counting the terminating null character. + static constexpr std::uint32_t k_unVROverlayMaxKeyLength = 128; + + // The maximum length of an overlay name in bytes, counting the terminating null character. + static constexpr std::uint32_t k_unVROverlayMaxNameLength = 128; + + // The maximum number of overlays that can exist in the system at one time. + static constexpr std::uint32_t k_unMaxOverlayCount = 64; + + // The maximum number of overlay intersection mask primitives per overlay + static constexpr std::uint32_t k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; + + // Types of input supported by VR Overlays + enum VROverlayInputMethod + { + VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay + VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically + }; + + // Allows the caller to figure out which overlay transform getter to call. + enum VROverlayTransformType + { + VROverlayTransform_Absolute = 0, + VROverlayTransform_TrackedDeviceRelative = 1, + VROverlayTransform_SystemOverlay = 2, + VROverlayTransform_TrackedComponent = 3, + }; + + // Overlay control settings + enum VROverlayFlags + { + VROverlayFlags_None = 0, + + // The following only take effect when rendered using the high quality render path (see SetHighQualityOverlay). + VROverlayFlags_Curved = 1, + VROverlayFlags_RGSS4X = 2, + + // Set this flag on a dashboard overlay to prevent a tab from showing up for that overlay + VROverlayFlags_NoDashboardTab = 3, + + // Set this flag on a dashboard that is able to deal with gamepad focus events + VROverlayFlags_AcceptsGamepadEvents = 4, + + // Indicates that the overlay should dim/brighten to show gamepad focus + VROverlayFlags_ShowGamepadFocus = 5, + + // When in VROverlayInputMethod_Mouse you can optionally enable sending VRScroll_t + VROverlayFlags_SendVRScrollEvents = 6, + VROverlayFlags_SendVRTouchpadEvents = 7, + + // If set this will render a vertical scroll wheel on the primary controller, + // only needed if not using VROverlayFlags_SendVRScrollEvents but you still want to represent a scroll wheel + VROverlayFlags_ShowTouchPadScrollWheel = 8, + + // If this is set ownership and render access to the overlay are transferred + // to the new scene process on a call to IVRApplications::LaunchInternalProcess + VROverlayFlags_TransferOwnershipToInternalProcess = 9, + + // If set, renders 50% of the texture in each eye, side by side + VROverlayFlags_SideBySide_Parallel = 10, // Texture is left/right + VROverlayFlags_SideBySide_Crossed = 11, // Texture is crossed and right/left + + VROverlayFlags_Panorama = 12, // Texture is a panorama + VROverlayFlags_StereoPanorama = 13, // Texture is a stereo panorama + + // If this is set on an overlay owned by the scene application that overlay + // will be sorted with the "Other" overlays on top of all other scene overlays + VROverlayFlags_SortWithNonSceneOverlays = 14, + + // If set, the overlay will be shown in the dashboard, otherwise it will be hidden. + VROverlayFlags_VisibleInDashboard = 15, + }; + + enum VRMessageOverlayResponse + { + VRMessageOverlayResponse_ButtonPress_0 = 0, + VRMessageOverlayResponse_ButtonPress_1 = 1, + VRMessageOverlayResponse_ButtonPress_2 = 2, + VRMessageOverlayResponse_ButtonPress_3 = 3, + VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, + VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay = 5, + VRMessageOverlayResponse_ApplicationQuit = 6 + }; + + struct VROverlayIntersectionParams_t + { + HmdVector3_t vSource; + HmdVector3_t vDirection; + ETrackingUniverseOrigin eOrigin; + }; + + struct VROverlayIntersectionResults_t + { + HmdVector3_t vPoint; + HmdVector3_t vNormal; + HmdVector2_t vUVs; + float fDistance; + }; + + // Input modes for the Big Picture gamepad text entry + enum EGamepadTextInputMode + { + k_EGamepadTextInputModeNormal = 0, + k_EGamepadTextInputModePassword = 1, + k_EGamepadTextInputModeSubmit = 2, + }; + + // Controls number of allowed lines for the Big Picture gamepad text entry + enum EGamepadTextInputLineMode + { + k_EGamepadTextInputLineModeSingleLine = 0, + k_EGamepadTextInputLineModeMultipleLines = 1 + }; + + // Directions for changing focus between overlays with the gamepad + enum EOverlayDirection + { + OverlayDirection_Up = 0, + OverlayDirection_Down = 1, + OverlayDirection_Left = 2, + OverlayDirection_Right = 3, + + OverlayDirection_Count = 4, + }; + + enum EVROverlayIntersectionMaskPrimitiveType + { + OverlayIntersectionPrimitiveType_Rectangle, + OverlayIntersectionPrimitiveType_Circle, + }; + + struct IntersectionMaskRectangle_t + { + float m_flTopLeftX; + float m_flTopLeftY; + float m_flWidth; + float m_flHeight; + }; + + struct IntersectionMaskCircle_t + { + float m_flCenterX; + float m_flCenterY; + float m_flRadius; + }; + + union VROverlayIntersectionMaskPrimitive_Data_t + { + IntersectionMaskRectangle_t m_Rectangle; + IntersectionMaskCircle_t m_Circle; + }; + + struct VROverlayIntersectionMaskPrimitive_t + { + EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType; + VROverlayIntersectionMaskPrimitive_Data_t m_Primitive; + }; + + class IVROverlay + { + public: + virtual EVROverlayError FindOverlay(const char* pchOverlayKey, VROverlayHandle_t* pOverlayHandle) = 0; // 00 + virtual EVROverlayError CreateOverlay(const char* pchOverlayKey, const char* pchOverlayName, VROverlayHandle_t* pOverlayHandle) = 0; // 01 + virtual EVROverlayError DestroyOverlay(VROverlayHandle_t ulOverlayHandle) = 0; // 02 + virtual EVROverlayError SetHighQualityOverlay(VROverlayHandle_t ulOverlayHandle) = 0; // 03 + virtual vr::VROverlayHandle_t GetHighQualityOverlay() = 0; // 04 + virtual std::uint32_t GetOverlayKey(VROverlayHandle_t ulOverlayHandle, char* pchValue, std::uint32_t unBufferSize, EVROverlayError* pError = 0L) = 0; // 05 + virtual std::uint32_t GetOverlayName(VROverlayHandle_t ulOverlayHandle, char* pchValue, std::uint32_t unBufferSize, EVROverlayError* pError = 0L) = 0; // 06 + virtual EVROverlayError SetOverlayName(VROverlayHandle_t ulOverlayHandle, const char* pchName) = 0; // 07 + virtual EVROverlayError GetOverlayImageData(VROverlayHandle_t ulOverlayHandle, void* pvBuffer, std::uint32_t unBufferSize, std::uint32_t* punWidth, std::uint32_t* punHeight) = 0; // 08 + virtual const char* GetOverlayErrorNameFromEnum(EVROverlayError error) = 0; // 09 + virtual EVROverlayError SetOverlayRenderingPid(VROverlayHandle_t ulOverlayHandle, std::uint32_t unPID) = 0; // 0A + virtual std::uint32_t GetOverlayRenderingPid(VROverlayHandle_t ulOverlayHandle) = 0; // 0B + virtual EVROverlayError SetOverlayFlag(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled) = 0; // 0C + virtual EVROverlayError GetOverlayFlag(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool* pbEnabled) = 0; // 0D + virtual EVROverlayError SetOverlayColor(VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue) = 0; // 0E + virtual EVROverlayError GetOverlayColor(VROverlayHandle_t ulOverlayHandle, float* pfRed, float* pfGreen, float* pfBlue) = 0; // 0F + virtual EVROverlayError SetOverlayAlpha(VROverlayHandle_t ulOverlayHandle, float fAlpha) = 0; // 10 + virtual EVROverlayError GetOverlayAlpha(VROverlayHandle_t ulOverlayHandle, float* pfAlpha) = 0; // 11 + virtual EVROverlayError SetOverlayTexelAspect(VROverlayHandle_t ulOverlayHandle, float fTexelAspect) = 0; // 12 + virtual EVROverlayError GetOverlayTexelAspect(VROverlayHandle_t ulOverlayHandle, float* pfTexelAspect) = 0; // 13 + virtual EVROverlayError SetOverlaySortOrder(VROverlayHandle_t ulOverlayHandle, std::uint32_t unSortOrder) = 0; // 14 + virtual EVROverlayError GetOverlaySortOrder(VROverlayHandle_t ulOverlayHandle, std::uint32_t* punSortOrder) = 0; // 15 + virtual EVROverlayError SetOverlayWidthInMeters(VROverlayHandle_t ulOverlayHandle, float fWidthInMeters) = 0; // 16 + virtual EVROverlayError GetOverlayWidthInMeters(VROverlayHandle_t ulOverlayHandle, float* pfWidthInMeters) = 0; // 17 + virtual EVROverlayError SetOverlayAutoCurveDistanceRangeInMeters(VROverlayHandle_t ulOverlayHandle, float fMinDistanceInMeters, float fMaxDistanceInMeters) = 0; // 18 + virtual EVROverlayError GetOverlayAutoCurveDistanceRangeInMeters(VROverlayHandle_t ulOverlayHandle, float* pfMinDistanceInMeters, float* pfMaxDistanceInMeters) = 0; // 19 + virtual EVROverlayError SetOverlayTextureColorSpace(VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace) = 0; // 1A + virtual EVROverlayError GetOverlayTextureColorSpace(VROverlayHandle_t ulOverlayHandle, EColorSpace* peTextureColorSpace) = 0; // 1B + virtual EVROverlayError SetOverlayTextureBounds(VROverlayHandle_t ulOverlayHandle, const VRTextureBounds_t* pOverlayTextureBounds) = 0; // 1C + virtual EVROverlayError GetOverlayTextureBounds(VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t* pOverlayTextureBounds) = 0; // 1D + virtual std::uint32_t GetOverlayRenderModel(vr::VROverlayHandle_t ulOverlayHandle, char* pchValue, std::uint32_t unBufferSize, HmdColor_t* pColor, vr::EVROverlayError* pError) = 0; // 1E + virtual vr::EVROverlayError SetOverlayRenderModel(vr::VROverlayHandle_t ulOverlayHandle, const char* pchRenderModel, const HmdColor_t* pColor) = 0; // 1F + virtual EVROverlayError GetOverlayTransformType(VROverlayHandle_t ulOverlayHandle, VROverlayTransformType* peTransformType) = 0; // 20 + virtual EVROverlayError SetOverlayTransformAbsolute(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t* pmatTrackingOriginToOverlayTransform) = 0; // 21 + virtual EVROverlayError GetOverlayTransformAbsolute(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin* peTrackingOrigin, HmdMatrix34_t* pmatTrackingOriginToOverlayTransform) = 0; // 22 + virtual EVROverlayError SetOverlayTransformTrackedDeviceRelative(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, const HmdMatrix34_t* pmatTrackedDeviceToOverlayTransform) = 0; // 23 + virtual EVROverlayError GetOverlayTransformTrackedDeviceRelative(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t* punTrackedDevice, HmdMatrix34_t* pmatTrackedDeviceToOverlayTransform) = 0; // 24 + virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char* pchComponentName) = 0; // 25 + virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t* punDeviceIndex, char* pchComponentName, std::uint32_t unComponentNameSize) = 0; // 26 + virtual vr::EVROverlayError GetOverlayTransformOverlayRelative(VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t* ulOverlayHandleParent, HmdMatrix34_t* pmatParentOverlayToOverlayTransform) = 0; // 27 + virtual vr::EVROverlayError SetOverlayTransformOverlayRelative(VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulOverlayHandleParent, const HmdMatrix34_t* pmatParentOverlayToOverlayTransform) = 0; // 28 + virtual EVROverlayError ShowOverlay(VROverlayHandle_t ulOverlayHandle) = 0; // 29 + virtual EVROverlayError HideOverlay(VROverlayHandle_t ulOverlayHandle) = 0; // 2A + virtual bool IsOverlayVisible(VROverlayHandle_t ulOverlayHandle) = 0; // 2B + virtual EVROverlayError GetTransformForOverlayCoordinates(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, HmdMatrix34_t* pmatTransform) = 0; // 2C + virtual bool PollNextOverlayEvent(VROverlayHandle_t ulOverlayHandle, VREvent_t* pEvent, std::uint32_t uncbVREvent) = 0; // 2D + virtual EVROverlayError GetOverlayInputMethod(VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod* peInputMethod) = 0; // 2E + virtual EVROverlayError SetOverlayInputMethod(VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod) = 0; // 2F + virtual EVROverlayError GetOverlayMouseScale(VROverlayHandle_t ulOverlayHandle, HmdVector2_t* pvecMouseScale) = 0; // 30 + virtual EVROverlayError SetOverlayMouseScale(VROverlayHandle_t ulOverlayHandle, const HmdVector2_t* pvecMouseScale) = 0; // 31 + virtual bool ComputeOverlayIntersection(VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t* pParams, VROverlayIntersectionResults_t* pResults) = 0; // 32 + virtual bool IsHoverTargetOverlay(VROverlayHandle_t ulOverlayHandle) = 0; // 33 + virtual vr::VROverlayHandle_t GetGamepadFocusOverlay() = 0; // 34 + virtual EVROverlayError SetGamepadFocusOverlay(VROverlayHandle_t ulNewFocusOverlay) = 0; // 35 + virtual EVROverlayError SetOverlayNeighbor(EOverlayDirection eDirection, VROverlayHandle_t ulFrom, VROverlayHandle_t ulTo) = 0; // 36 + virtual EVROverlayError MoveGamepadFocusToNeighbor(EOverlayDirection eDirection, VROverlayHandle_t ulFrom) = 0; // 37 + virtual EVROverlayError SetOverlayDualAnalogTransform(VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, const HmdVector2_t& vCenter, float fRadius) = 0; // 38 + virtual EVROverlayError GetOverlayDualAnalogTransform(VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, HmdVector2_t* pvCenter, float* pfRadius) = 0; // 39 + virtual EVROverlayError SetOverlayTexture(VROverlayHandle_t ulOverlayHandle, const Texture_t* pTexture) = 0; // 3A + virtual EVROverlayError ClearOverlayTexture(VROverlayHandle_t ulOverlayHandle) = 0; // 3B + virtual EVROverlayError SetOverlayRaw(VROverlayHandle_t ulOverlayHandle, void* pvBuffer, std::uint32_t unWidth, std::uint32_t unHeight, std::uint32_t unDepth) = 0; // 3C + virtual EVROverlayError SetOverlayFromFile(VROverlayHandle_t ulOverlayHandle, const char* pchFilePath) = 0; // 3D + virtual EVROverlayError GetOverlayTexture(VROverlayHandle_t ulOverlayHandle, void** pNativeTextureHandle, void* pNativeTextureRef, std::uint32_t* pWidth, std::uint32_t* pHeight, std::uint32_t* pNativeFormat, ETextureType* pAPIType, EColorSpace* pColorSpace, VRTextureBounds_t* pTextureBounds) = 0; // 3E + virtual EVROverlayError ReleaseNativeOverlayHandle(VROverlayHandle_t ulOverlayHandle, void* pNativeTextureHandle) = 0; // 3F + virtual EVROverlayError GetOverlayTextureSize(VROverlayHandle_t ulOverlayHandle, std::uint32_t* pWidth, std::uint32_t* pHeight) = 0; // 40 + virtual EVROverlayError CreateDashboardOverlay(const char* pchOverlayKey, const char* pchOverlayFriendlyName, VROverlayHandle_t* pMainHandle, VROverlayHandle_t* pThumbnailHandle) = 0; // 41 + virtual bool IsDashboardVisible() = 0; // 42 + virtual bool IsActiveDashboardOverlay(VROverlayHandle_t ulOverlayHandle) = 0; // 43 + virtual EVROverlayError SetDashboardOverlaySceneProcess(VROverlayHandle_t ulOverlayHandle, std::uint32_t unProcessId) = 0; // 44 + virtual EVROverlayError GetDashboardOverlaySceneProcess(VROverlayHandle_t ulOverlayHandle, std::uint32_t* punProcessId) = 0; // 45 + virtual void ShowDashboard(const char* pchOverlayToShow) = 0; // 46 + virtual vr::TrackedDeviceIndex_t GetPrimaryDashboardDevice() = 0; // 47 + virtual EVROverlayError ShowKeyboard(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char* pchDescription, std::uint32_t unCharMax, const char* pchExistingText, bool bUseMinimalMode, uint64_t uUserValue) = 0; // 48 + virtual EVROverlayError ShowKeyboardForOverlay(VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char* pchDescription, std::uint32_t unCharMax, const char* pchExistingText, bool bUseMinimalMode, uint64_t uUserValue) = 0; // 49 + virtual std::uint32_t GetKeyboardText(char* pchText, std::uint32_t cchText) = 0; // 4A + virtual void HideKeyboard() = 0; // 4B + virtual void SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t* pmatTrackingOriginToKeyboardTransform) = 0; // 4C + virtual void SetKeyboardPositionForOverlay(VROverlayHandle_t ulOverlayHandle, HmdRect2_t avoidRect) = 0; // 4D + virtual EVROverlayError SetOverlayIntersectionMask(VROverlayHandle_t ulOverlayHandle, VROverlayIntersectionMaskPrimitive_t* pMaskPrimitives, std::uint32_t unNumMaskPrimitives, std::uint32_t unPrimitiveSize = sizeof(VROverlayIntersectionMaskPrimitive_t)) = 0; // 4E + virtual EVROverlayError GetOverlayFlags(VROverlayHandle_t ulOverlayHandle, std::uint32_t* pFlags) = 0; // 4F + virtual VRMessageOverlayResponse ShowMessageOverlay(const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr) = 0; // 50 + virtual void CloseMessageOverlay() = 0; // 51 + }; +} diff --git a/include/vr/OpenVR.h b/include/vr/OpenVR.h new file mode 100644 index 000000000..36b8f37b5 --- /dev/null +++ b/include/vr/OpenVR.h @@ -0,0 +1,7 @@ +#pragma once + +#include "vr/Hmd.h" +#include "vr/IVROverlay.h" +#include "vr/OpenVRTypes.h" +#include "vr/Properties.h" +#include "vr/VREvent.h" diff --git a/include/vr/OpenVRTypes.h b/include/vr/OpenVRTypes.h new file mode 100644 index 000000000..d0ea5b342 --- /dev/null +++ b/include/vr/OpenVRTypes.h @@ -0,0 +1,96 @@ +#pragma once + +namespace vr +{ + /** Used to return the post-distortion UVs for each color channel. + * UVs range from 0 to 1 with 0,0 in the upper left corner of the + * source render target. The 0,0 to 1,1 range covers a single eye. */ + struct DistortionCoordinates_t + { + float rfRed[2]; + float rfGreen[2]; + float rfBlue[2]; + }; + + enum EVREye + { + Eye_Left = 0, + Eye_Right = 1 + }; + + enum ETextureType + { + TextureType_DirectX = 0, // Handle is an ID3D11Texture + TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags + TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure + TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef + TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure + }; + + enum EColorSpace + { + ColorSpace_Auto = 0, // Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'. This mirrors the DXGI formats which have _SRGB variants. + ColorSpace_Gamma = 1, // Texture data can be displayed directly on the display without any conversion (a.k.a. display native format). + ColorSpace_Linear = 2, // Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm. + }; + + struct Texture_t + { + void* handle; // See ETextureType definition above + ETextureType eType; + EColorSpace eColorSpace; + }; + + /** Used to pass device IDs to API calls */ + using TrackedDeviceIndex_t = std::uint32_t; + + /** used to refer to a single VR overlay */ + using VROverlayHandle_t = std::uint64_t; + + /** Identifies which style of tracking origin the application wants to use + * for the poses it is requesting */ + enum ETrackingUniverseOrigin + { + TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose + TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user + TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. + }; + + /** Errors that can occur around VR overlays */ + enum EVROverlayError + { + VROverlayError_None = 0, + + VROverlayError_UnknownOverlay = 10, + VROverlayError_InvalidHandle = 11, + VROverlayError_PermissionDenied = 12, + VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist + VROverlayError_WrongVisibilityType = 14, + VROverlayError_KeyTooLong = 15, + VROverlayError_NameTooLong = 16, + VROverlayError_KeyInUse = 17, + VROverlayError_WrongTransformType = 18, + VROverlayError_InvalidTrackedDevice = 19, + VROverlayError_InvalidParameter = 20, + VROverlayError_ThumbnailCantBeDestroyed = 21, + VROverlayError_ArrayTooSmall = 22, + VROverlayError_RequestFailed = 23, + VROverlayError_InvalidTexture = 24, + VROverlayError_UnableToLoadFile = 25, + VROverlayError_KeyboardAlreadyInUse = 26, + VROverlayError_NoNeighbor = 27, + VROverlayError_TooManyMaskPrimitives = 29, + VROverlayError_BadMaskPrimitive = 30, + VROverlayError_TextureAlreadyLocked = 31, + VROverlayError_TextureLockCapacityReached = 32, + VROverlayError_TextureNotLocked = 33, + }; + + /** Allows the application to control what part of the provided texture will be used in the + * frame buffer. */ + struct VRTextureBounds_t + { + float uMin, vMin; + float uMax, vMax; + }; +} diff --git a/include/vr/Properties.h b/include/vr/Properties.h new file mode 100644 index 000000000..7b19ba3ff --- /dev/null +++ b/include/vr/Properties.h @@ -0,0 +1,189 @@ +#pragma once + +namespace vr +{ + // Refers to a single container of properties + using PropertyContainerHandle_t = std::uint64_t; + using PropertyTypeTag_t = std::uint32_t; + + static constexpr PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0; + static constexpr PropertyTypeTag_t k_unInvalidPropertyTag = 0; + + // Use these tags to set/get common types as struct properties + static constexpr PropertyTypeTag_t k_unFloatPropertyTag = 1; + static constexpr PropertyTypeTag_t k_unInt32PropertyTag = 2; + static constexpr PropertyTypeTag_t k_unUint64PropertyTag = 3; + static constexpr PropertyTypeTag_t k_unBoolPropertyTag = 4; + static constexpr PropertyTypeTag_t k_unStringPropertyTag = 5; + + static constexpr PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20; + static constexpr PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21; + static constexpr PropertyTypeTag_t k_unHmdVector3PropertyTag = 22; + static constexpr PropertyTypeTag_t k_unHmdVector4PropertyTag = 23; + + static constexpr PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30; + + static constexpr PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; + static constexpr PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; + + // Each entry in this enum represents a property that can be retrieved about a + // tracked device. Many fields are only valid for one ETrackedDeviceClass. + enum ETrackedDeviceProperty + { + Prop_Invalid = 0, + + // general properties that apply to all device classes + Prop_TrackingSystemName_String = 1000, + Prop_ModelNumber_String = 1001, + Prop_SerialNumber_String = 1002, + Prop_RenderModelName_String = 1003, + Prop_WillDriftInYaw_Bool = 1004, + Prop_ManufacturerName_String = 1005, + Prop_TrackingFirmwareVersion_String = 1006, + Prop_HardwareRevision_String = 1007, + Prop_AllWirelessDongleDescriptions_String = 1008, + Prop_ConnectedWirelessDongle_String = 1009, + Prop_DeviceIsWireless_Bool = 1010, + Prop_DeviceIsCharging_Bool = 1011, + Prop_DeviceBatteryPercentage_Float = 1012, // 0 is empty, 1 is full + Prop_StatusDisplayTransform_Matrix34 = 1013, + Prop_Firmware_UpdateAvailable_Bool = 1014, + Prop_Firmware_ManualUpdate_Bool = 1015, + Prop_Firmware_ManualUpdateURL_String = 1016, + Prop_HardwareRevision_Uint64 = 1017, + Prop_FirmwareVersion_Uint64 = 1018, + Prop_FPGAVersion_Uint64 = 1019, + Prop_VRCVersion_Uint64 = 1020, + Prop_RadioVersion_Uint64 = 1021, + Prop_DongleVersion_Uint64 = 1022, + Prop_BlockServerShutdown_Bool = 1023, + Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, + Prop_ContainsProximitySensor_Bool = 1025, + Prop_DeviceProvidesBatteryStatus_Bool = 1026, + Prop_DeviceCanPowerOff_Bool = 1027, + Prop_Firmware_ProgrammingTarget_String = 1028, + Prop_DeviceClass_Int32 = 1029, + Prop_HasCamera_Bool = 1030, + Prop_DriverVersion_String = 1031, + Prop_Firmware_ForceUpdateRequired_Bool = 1032, + Prop_ViveSystemButtonFixRequired_Bool = 1033, + Prop_ParentDriver_Uint64 = 1034, + Prop_ResourceRoot_String = 1035, + + // Properties that are unique to TrackedDeviceClass_HMD + Prop_ReportsTimeSinceVSync_Bool = 2000, + Prop_SecondsFromVsyncToPhotons_Float = 2001, + Prop_DisplayFrequency_Float = 2002, + Prop_UserIpdMeters_Float = 2003, + Prop_CurrentUniverseId_Uint64 = 2004, + Prop_PreviousUniverseId_Uint64 = 2005, + Prop_DisplayFirmwareVersion_Uint64 = 2006, + Prop_IsOnDesktop_Bool = 2007, + Prop_DisplayMCType_Int32 = 2008, + Prop_DisplayMCOffset_Float = 2009, + Prop_DisplayMCScale_Float = 2010, + Prop_EdidVendorID_Int32 = 2011, + Prop_DisplayMCImageLeft_String = 2012, + Prop_DisplayMCImageRight_String = 2013, + Prop_DisplayGCBlackClamp_Float = 2014, + Prop_EdidProductID_Int32 = 2015, + Prop_CameraToHeadTransform_Matrix34 = 2016, + Prop_DisplayGCType_Int32 = 2017, + Prop_DisplayGCOffset_Float = 2018, + Prop_DisplayGCScale_Float = 2019, + Prop_DisplayGCPrescale_Float = 2020, + Prop_DisplayGCImage_String = 2021, + Prop_LensCenterLeftU_Float = 2022, + Prop_LensCenterLeftV_Float = 2023, + Prop_LensCenterRightU_Float = 2024, + Prop_LensCenterRightV_Float = 2025, + Prop_UserHeadToEyeDepthMeters_Float = 2026, + Prop_CameraFirmwareVersion_Uint64 = 2027, + Prop_CameraFirmwareDescription_String = 2028, + Prop_DisplayFPGAVersion_Uint64 = 2029, + Prop_DisplayBootloaderVersion_Uint64 = 2030, + Prop_DisplayHardwareVersion_Uint64 = 2031, + Prop_AudioFirmwareVersion_Uint64 = 2032, + Prop_CameraCompatibilityMode_Int32 = 2033, + Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, + Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, + Prop_DisplaySuppressed_Bool = 2036, + Prop_DisplayAllowNightMode_Bool = 2037, + Prop_DisplayMCImageWidth_Int32 = 2038, + Prop_DisplayMCImageHeight_Int32 = 2039, + Prop_DisplayMCImageNumChannels_Int32 = 2040, + Prop_DisplayMCImageData_Binary = 2041, + Prop_SecondsFromPhotonsToVblank_Float = 2042, + Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, + Prop_DisplayDebugMode_Bool = 2044, + Prop_GraphicsAdapterLuid_Uint64 = 2045, + Prop_DriverProvidedChaperonePath_String = 2048, + + // Properties that are unique to TrackedDeviceClass_Controller + Prop_AttachedDeviceId_String = 3000, + Prop_SupportedButtons_Uint64 = 3001, + Prop_Axis0Type_Int32 = 3002, // Return value is of type EVRControllerAxisType + Prop_Axis1Type_Int32 = 3003, // Return value is of type EVRControllerAxisType + Prop_Axis2Type_Int32 = 3004, // Return value is of type EVRControllerAxisType + Prop_Axis3Type_Int32 = 3005, // Return value is of type EVRControllerAxisType + Prop_Axis4Type_Int32 = 3006, // Return value is of type EVRControllerAxisType + Prop_ControllerRoleHint_Int32 = 3007, // Return value is of type ETrackedControllerRole + + // Properties that are unique to TrackedDeviceClass_TrackingReference + Prop_FieldOfViewLeftDegrees_Float = 4000, + Prop_FieldOfViewRightDegrees_Float = 4001, + Prop_FieldOfViewTopDegrees_Float = 4002, + Prop_FieldOfViewBottomDegrees_Float = 4003, + Prop_TrackingRangeMinimumMeters_Float = 4004, + Prop_TrackingRangeMaximumMeters_Float = 4005, + Prop_ModeLabel_String = 4006, + + // Properties that are used for user interface like icons names + Prop_IconPathName_String = 5000, // DEPRECATED. Value not referenced. Now expected to be part of icon path properties. + Prop_NamedIconPathDeviceOff_String = 5001, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceSearching_String = 5002, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceSearchingAlert_String = 5003, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceReady_String = 5004, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceReadyAlert_String = 5005, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceNotReady_String = 5006, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceStandby_String = 5007, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceAlertLow_String = 5008, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + + // Properties that are used by helpers, but are opaque to applications + Prop_DisplayHiddenArea_Binary_Start = 5100, + Prop_DisplayHiddenArea_Binary_End = 5150, + + // Properties that are unique to drivers + Prop_UserConfigPath_String = 6000, + Prop_InstallPath_String = 6001, + Prop_HasDisplayComponent_Bool = 6002, + Prop_HasControllerComponent_Bool = 6003, + Prop_HasCameraComponent_Bool = 6004, + Prop_HasDriverDirectModeComponent_Bool = 6005, + Prop_HasVirtualDisplayComponent_Bool = 6006, + + // Vendors are free to expose private debug data in this reserved region + Prop_VendorSpecific_Reserved_Start = 10000, + Prop_VendorSpecific_Reserved_End = 10999, + }; + + // No string property will ever be longer than this length + static const uint32_t k_unMaxPropertyStringSize = 32 * 1024; + + // Used to return errors that occur when reading properties. + enum ETrackedPropertyError + { + TrackedProp_Success = 0, + TrackedProp_WrongDataType = 1, + TrackedProp_WrongDeviceClass = 2, + TrackedProp_BufferTooSmall = 3, + TrackedProp_UnknownProperty = 4, // Driver has not set the property (and may not ever). + TrackedProp_InvalidDevice = 5, + TrackedProp_CouldNotContactServer = 6, + TrackedProp_ValueNotProvidedByDevice = 7, + TrackedProp_StringExceedsMaximumLength = 8, + TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. + TrackedProp_PermissionDenied = 10, + TrackedProp_InvalidOperation = 11, + }; +} diff --git a/include/vr/VREvent.h b/include/vr/VREvent.h new file mode 100644 index 000000000..0fe4e142d --- /dev/null +++ b/include/vr/VREvent.h @@ -0,0 +1,424 @@ +#pragma once + +#include "vr/Properties.h" + +namespace vr +{ + /** The types of events that could be posted (and what the parameters mean for each event type) */ + enum EVREventType + { + VREvent_None = 0, + + VREvent_TrackedDeviceActivated = 100, + VREvent_TrackedDeviceDeactivated = 101, + VREvent_TrackedDeviceUpdated = 102, + VREvent_TrackedDeviceUserInteractionStarted = 103, + VREvent_TrackedDeviceUserInteractionEnded = 104, + VREvent_IpdChanged = 105, + VREvent_EnterStandbyMode = 106, + VREvent_LeaveStandbyMode = 107, + VREvent_TrackedDeviceRoleChanged = 108, + VREvent_WatchdogWakeUpRequested = 109, + VREvent_LensDistortionChanged = 110, + VREvent_PropertyChanged = 111, + VREvent_WirelessDisconnect = 112, + VREvent_WirelessReconnect = 113, + + VREvent_ButtonPress = 200, // data is controller + VREvent_ButtonUnpress = 201, // data is controller + VREvent_ButtonTouch = 202, // data is controller + VREvent_ButtonUntouch = 203, // data is controller + + VREvent_DualAnalog_Press = 250, // data is dualAnalog + VREvent_DualAnalog_Unpress = 251, // data is dualAnalog + VREvent_DualAnalog_Touch = 252, // data is dualAnalog + VREvent_DualAnalog_Untouch = 253, // data is dualAnalog + VREvent_DualAnalog_Move = 254, // data is dualAnalog + VREvent_DualAnalog_ModeSwitch1 = 255, // data is dualAnalog + VREvent_DualAnalog_ModeSwitch2 = 256, // data is dualAnalog + VREvent_DualAnalog_Cancel = 257, // data is dualAnalog + + VREvent_MouseMove = 300, // data is mouse + VREvent_MouseButtonDown = 301, // data is mouse + VREvent_MouseButtonUp = 302, // data is mouse + VREvent_FocusEnter = 303, // data is overlay + VREvent_FocusLeave = 304, // data is overlay + VREvent_Scroll = 305, // data is mouse + VREvent_TouchPadMove = 306, // data is mouse + VREvent_OverlayFocusChanged = 307, // data is overlay, global event + + VREvent_InputFocusCaptured = 400, // data is process DEPRECATED + VREvent_InputFocusReleased = 401, // data is process DEPRECATED + VREvent_SceneFocusLost = 402, // data is process + VREvent_SceneFocusGained = 403, // data is process + VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor) + VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene + VREvent_InputFocusChanged = 406, // data is process + VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process + + VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily + VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility + + VREvent_ConsoleOpened = 420, + VREvent_ConsoleClosed = 421, + + VREvent_OverlayShown = 500, + VREvent_OverlayHidden = 501, + VREvent_DashboardActivated = 502, + VREvent_DashboardDeactivated = 503, + VREvent_DashboardThumbSelected = 504, // Sent to the overlay manager - data is overlay + VREvent_DashboardRequested = 505, // Sent to the overlay manager - data is overlay + VREvent_ResetDashboard = 506, // Send to the overlay manager + VREvent_RenderToast = 507, // Send to the dashboard to render a toast - data is the notification ID + VREvent_ImageLoaded = 508, // Sent to overlays when a SetOverlayRaw or SetOverlayFromFile call finishes loading + VREvent_ShowKeyboard = 509, // Sent to keyboard renderer in the dashboard to invoke it + VREvent_HideKeyboard = 510, // Sent to keyboard renderer in the dashboard to hide it + VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it + VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else + VREvent_OverlaySharedTextureChanged = 513, + VREvent_DashboardGuideButtonDown = 514, + VREvent_DashboardGuideButtonUp = 515, + VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot + VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load + VREvent_DashboardOverlayCreated = 518, + + // Screenshot API + VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot + VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken + VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken + VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted + VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted + + VREvent_PrimaryDashboardDeviceChanged = 525, + + VREvent_Notification_Shown = 600, + VREvent_Notification_Hidden = 601, + VREvent_Notification_BeginInteraction = 602, + VREvent_Notification_Destroyed = 603, + + VREvent_Quit = 700, // data is process + VREvent_ProcessQuit = 701, // data is process + VREvent_QuitAborted_UserPrompt = 702, // data is process + VREvent_QuitAcknowledged = 703, // data is process + VREvent_DriverRequestedQuit = 704, // The driver has requested that SteamVR shut down + + VREvent_ChaperoneDataHasChanged = 800, + VREvent_ChaperoneUniverseHasChanged = 801, + VREvent_ChaperoneTempDataHasChanged = 802, + VREvent_ChaperoneSettingsHaveChanged = 803, + VREvent_SeatedZeroPoseReset = 804, + + VREvent_AudioSettingsHaveChanged = 820, + + VREvent_BackgroundSettingHasChanged = 850, + VREvent_CameraSettingsHaveChanged = 851, + VREvent_ReprojectionSettingHasChanged = 852, + VREvent_ModelSkinSettingsHaveChanged = 853, + VREvent_EnvironmentSettingsHaveChanged = 854, + VREvent_PowerSettingsHaveChanged = 855, + VREvent_EnableHomeAppSettingsHaveChanged = 856, + VREvent_SteamVRSectionSettingChanged = 857, + VREvent_LighthouseSectionSettingChanged = 858, + VREvent_NullSectionSettingChanged = 859, + VREvent_UserInterfaceSectionSettingChanged = 860, + VREvent_NotificationsSectionSettingChanged = 861, + VREvent_KeyboardSectionSettingChanged = 862, + VREvent_PerfSectionSettingChanged = 863, + VREvent_DashboardSectionSettingChanged = 864, + VREvent_WebInterfaceSectionSettingChanged = 865, + + VREvent_StatusUpdate = 900, + + VREvent_WebInterface_InstallDriverCompleted = 950, + + VREvent_MCImageUpdated = 1000, + + VREvent_FirmwareUpdateStarted = 1100, + VREvent_FirmwareUpdateFinished = 1101, + + VREvent_KeyboardClosed = 1200, + VREvent_KeyboardCharInput = 1201, + VREvent_KeyboardDone = 1202, // Sent when DONE button clicked on keyboard + + VREvent_ApplicationTransitionStarted = 1300, + VREvent_ApplicationTransitionAborted = 1301, + VREvent_ApplicationTransitionNewAppStarted = 1302, + VREvent_ApplicationListUpdated = 1303, + VREvent_ApplicationMimeTypeLoad = 1304, + VREvent_ApplicationTransitionNewAppLaunchComplete = 1305, + VREvent_ProcessConnected = 1306, + VREvent_ProcessDisconnected = 1307, + + VREvent_Compositor_MirrorWindowShown = 1400, + VREvent_Compositor_MirrorWindowHidden = 1401, + VREvent_Compositor_ChaperoneBoundsShown = 1410, + VREvent_Compositor_ChaperoneBoundsHidden = 1411, + + VREvent_TrackedCamera_StartVideoStream = 1500, + VREvent_TrackedCamera_StopVideoStream = 1501, + VREvent_TrackedCamera_PauseVideoStream = 1502, + VREvent_TrackedCamera_ResumeVideoStream = 1503, + VREvent_TrackedCamera_EditingSurface = 1550, + + VREvent_PerformanceTest_EnableCapture = 1600, + VREvent_PerformanceTest_DisableCapture = 1601, + VREvent_PerformanceTest_FidelityLevel = 1602, + + VREvent_MessageOverlay_Closed = 1650, + VREvent_MessageOverlayCloseRequested = 1651, + + VREvent_Input_HapticVibration = 1700, // data is hapticVibration + + // Vendors are free to expose private events in this reserved region + VREvent_VendorSpecific_Reserved_Start = 10000, + VREvent_VendorSpecific_Reserved_End = 19999, + }; + + /** Level of Hmd activity */ + // UserInteraction_Timeout means the device is in the process of timing out. + // InUse = ( k_EDeviceActivityLevel_UserInteraction || k_EDeviceActivityLevel_UserInteraction_Timeout ) + // VREvent_TrackedDeviceUserInteractionStarted fires when the devices transitions from Standby -> UserInteraction or Idle -> UserInteraction. + // VREvent_TrackedDeviceUserInteractionEnded fires when the devices transitions from UserInteraction_Timeout -> Idle + enum EDeviceActivityLevel + { + k_EDeviceActivityLevel_Unknown = -1, + k_EDeviceActivityLevel_Idle = 0, // No activity for the last 10 seconds + k_EDeviceActivityLevel_UserInteraction = 1, // Activity (movement or prox sensor) is happening now + k_EDeviceActivityLevel_UserInteraction_Timeout = 2, // No activity for the last 0.5 seconds + k_EDeviceActivityLevel_Standby = 3, // Idle for at least 5 seconds (configurable in Settings -> Power Management) + }; + + /** VR controller button and axis IDs */ + enum EVRButtonId + { + k_EButton_System = 0, + k_EButton_ApplicationMenu = 1, + k_EButton_Grip = 2, + k_EButton_DPad_Left = 3, + k_EButton_DPad_Up = 4, + k_EButton_DPad_Right = 5, + k_EButton_DPad_Down = 6, + k_EButton_A = 7, + + k_EButton_ProximitySensor = 31, + + k_EButton_Axis0 = 32, + k_EButton_Axis1 = 33, + k_EButton_Axis2 = 34, + k_EButton_Axis3 = 35, + k_EButton_Axis4 = 36, + + // aliases for well known controllers + k_EButton_SteamVR_Touchpad = k_EButton_Axis0, + k_EButton_SteamVR_Trigger = k_EButton_Axis1, + + k_EButton_Dashboard_Back = k_EButton_Grip, + + k_EButton_Max = 64 + }; + + inline std::uint64_t ButtonMaskFromId(EVRButtonId id) { return 1ull << id; } + + /** used for controller button events */ + struct VREvent_Controller_t + { + std::uint32_t button; // EVRButtonId enum + }; + + /** used for simulated mouse events in overlay space */ + enum EVRMouseButton + { + VRMouseButton_Left = 0x0001, + VRMouseButton_Right = 0x0002, + VRMouseButton_Middle = 0x0004, + }; + + /** used for simulated mouse events in overlay space */ + struct VREvent_Mouse_t + { + float x, y; // co-ords are in GL space, bottom left of the texture is 0,0 + std::uint32_t button; // EVRMouseButton enum + }; + + /** used for simulated mouse wheel scroll in overlay space */ + struct VREvent_Scroll_t + { + float xdelta, ydelta; // movement in fraction of the pad traversed since last delta, 1.0 for a full swipe + std::uint32_t repeatCount; + }; + + /** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger + is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents + flag set. + **/ + struct VREvent_TouchPadMove_t + { + // true if the users finger is detected on the touch pad + bool bFingerDown; + + // How long the finger has been down in seconds + float flSecondsFingerDown; + + // These values indicate the starting finger position (so you can do some basic swipe stuff) + float fValueXFirst; + float fValueYFirst; + + // This is the raw sampled coordinate without deadzoning + float fValueXRaw; + float fValueYRaw; + }; + + /** notification related events. Details will still change at this point */ + struct VREvent_Notification_t + { + std::uint64_t ulUserValue; + std::uint32_t notificationId; + }; + + /** Used for events about processes */ + struct VREvent_Process_t + { + std::uint32_t pid; + std::uint32_t oldPid; + bool bForced; + }; + + /** Used for a few events about overlays */ + struct VREvent_Overlay_t + { + std::uint64_t overlayHandle; + }; + + /** Used for a few events about overlays */ + struct VREvent_Status_t + { + std::uint32_t statusState; // EVRState enum + }; + + /** Used for keyboard events **/ + struct VREvent_Keyboard_t + { + char cNewInput[8]; // Up to 11 bytes of new input + std::uint64_t uUserValue; // Possible flags about the new input + }; + + struct VREvent_Ipd_t + { + float ipdMeters; + }; + + struct VREvent_Chaperone_t + { + std::uint64_t m_nPreviousUniverse; + std::uint64_t m_nCurrentUniverse; + }; + + /** Not actually used for any events */ + struct VREvent_Reserved_t + { + std::uint64_t reserved0; + std::uint64_t reserved1; + }; + + struct VREvent_PerformanceTest_t + { + std::uint32_t m_nFidelityLevel; + }; + + struct VREvent_SeatedZeroPoseReset_t + { + bool bResetBySystemMenu; + }; + + struct VREvent_Screenshot_t + { + std::uint32_t handle; + std::uint32_t type; + }; + + struct VREvent_ScreenshotProgress_t + { + float progress; + }; + + struct VREvent_ApplicationLaunch_t + { + std::uint32_t pid; + std::uint32_t unArgsHandle; + }; + + struct VREvent_EditingCameraSurface_t + { + std::uint64_t overlayHandle; + std::uint32_t nVisualMode; + }; + + struct VREvent_MessageOverlay_t + { + std::uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum + }; + + struct VREvent_Property_t + { + PropertyContainerHandle_t container; + ETrackedDeviceProperty prop; + }; + + enum EDualAnalogWhich + { + k_EDualAnalog_Left = 0, + k_EDualAnalog_Right = 1, + }; + + struct VREvent_DualAnalog_t + { + float x, y; // coordinates are -1..1 analog values + float transformedX, transformedY; // transformed by the center and radius numbers provided by the overlay + EDualAnalogWhich which; + }; + + struct VREvent_HapticVibration_t + { + std::uint64_t containerHandle; // property container handle of the device with the haptic component + std::uint64_t componentHandle; // Which haptic component needs to vibrate + float fDurationSeconds; + float fFrequency; + float fAmplitude; + }; + + union VREvent_Data_t + { + VREvent_Reserved_t reserved; + VREvent_Controller_t controller; + VREvent_Mouse_t mouse; + VREvent_Scroll_t scroll; + VREvent_Process_t process; + VREvent_Notification_t notification; + VREvent_Overlay_t overlay; + VREvent_Status_t status; + VREvent_Keyboard_t keyboard; + VREvent_Ipd_t ipd; + VREvent_Chaperone_t chaperone; + VREvent_PerformanceTest_t performanceTest; + VREvent_TouchPadMove_t touchPadMove; + VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; + VREvent_Screenshot_t screenshot; + VREvent_ScreenshotProgress_t screenshotProgress; + VREvent_ApplicationLaunch_t applicationLaunch; + VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; + VREvent_Property_t property; + VREvent_DualAnalog_t dualAnalog; + VREvent_HapticVibration_t hapticVibration; + }; + + /** An event posted by the server to all running applications */ + struct VREvent_t + { + std::uint32_t eventType; // EVREventType enum + TrackedDeviceIndex_t trackedDeviceIndex; + float eventAgeSeconds; + // event data must be the end of the struct as its size is variable + VREvent_Data_t data; + }; +} diff --git a/src/RE/A/AIProcess.cpp b/src/RE/A/AIProcess.cpp index 6de512106..4eb52bb6e 100644 --- a/src/RE/A/AIProcess.cpp +++ b/src/RE/A/AIProcess.cpp @@ -6,11 +6,11 @@ namespace RE { - void AIProcess::ClearFurniture() + void AIProcess::ClearFurniture(RE::Actor* a_actor) { using func_t = decltype(&AIProcess::ClearFurniture); static REL::Relocation func{ Offset::AIProcess::ClearFurniture }; - return func(this); + return func(this, a_actor); } float AIProcess::GetCachedHeight() const diff --git a/src/RE/I/IMenu.cpp b/src/RE/I/IMenu.cpp index 0aa7d89bb..c08f1d8a9 100644 --- a/src/RE/I/IMenu.cpp +++ b/src/RE/I/IMenu.cpp @@ -10,6 +10,10 @@ namespace RE { + IMenu::~IMenu() + { + } + void IMenu::Accept(CallbackProcessor*) {} @@ -63,4 +67,20 @@ namespace RE REL::Relocation func{ Offset::IMenu::RefreshPlatform }; return func(this); } + +#ifdef SKYRIMVR + void IMenu::Unk_09(std::int32_t a_arg1) + { + unkVR30 = a_arg1; + } + + void IMenu::ResetOnShow() + { + if (uiMovie) { + if (uiMovie->IsAvailable("_root.ResetOnShow")) { + uiMovie->Invoke("_root.ResetOnShow", nullptr, nullptr, 0); + } + } + } +#endif } diff --git a/src/RE/M/MenuEventHandler.cpp b/src/RE/M/MenuEventHandler.cpp index a3a034efa..4622e6a0f 100644 --- a/src/RE/M/MenuEventHandler.cpp +++ b/src/RE/M/MenuEventHandler.cpp @@ -2,23 +2,40 @@ namespace RE { - bool MenuEventHandler::ProcessKinect(KinectEvent*) + bool MenuEventHandler::HandleEvent(const ButtonEvent*) { return false; } - bool MenuEventHandler::ProcessThumbstick(ThumbstickEvent*) + bool MenuEventHandler::HandleEvent(const MouseMoveEvent*) { return false; } - bool MenuEventHandler::ProcessMouseMove(MouseMoveEvent*) + bool MenuEventHandler::HandleEvent(const ThumbstickEvent*) { return false; } - bool MenuEventHandler::ProcessButton(RE::ButtonEvent*) + bool MenuEventHandler::HandleEvent(const KinectEvent*) { return false; } + +#ifdef SKYRIMVR + bool MenuEventHandler::HandleEvent(const VRWandEvent*) + { + return false; + } + + bool MenuEventHandler::HandleEvent(const VrWandTouchpadPositionEvent*) + { + return false; + } + + bool MenuEventHandler::HandleEvent(const VrWandTouchpadSwipeEvent*) + { + return false; + } +#endif }