diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 0872c3681..ffc7cdce1 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -268,6 +268,7 @@ set(SOURCES include/RE/B/BSStringPool.h include/RE/B/BSSystemFile.h include/RE/B/BSSystemFileStorage.h + include/RE/B/BSSystemUtility.h include/RE/B/BSTAnimationGraphDataChannel.h include/RE/B/BSTArray.h include/RE/B/BSTCaseInsensitiveStringMap.h @@ -306,6 +307,7 @@ set(SOURCES include/RE/B/BSWin32KeyboardDevice.h include/RE/B/BSWin32MouseDevice.h include/RE/B/BSWin32SaveDataSystemUtility.h + include/RE/B/BSWin32SystemUtility.h include/RE/B/BSWin32VirtualKeyboardDevice.h include/RE/B/BSXAudio2GameSound.h include/RE/B/BSXFlags.h @@ -346,6 +348,7 @@ set(SOURCES include/RE/B/bhkThreadMemorySource.h include/RE/B/bhkWorld.h include/RE/B/bhkWorldObject.h + include/RE/C/CCallback.h include/RE/C/CFilter.h include/RE/C/CRC.h include/RE/C/Calendar.h diff --git a/include/RE/B/BSSystemUtility.h b/include/RE/B/BSSystemUtility.h new file mode 100644 index 000000000..a7bc8b590 --- /dev/null +++ b/include/RE/B/BSSystemUtility.h @@ -0,0 +1,47 @@ +#pragma once + +#include "RE/B/BSTEvent.h" + +namespace RE +{ + class BSSystemEvent; + struct BSGamepadEvent; + + class BSSystemUtility : + public BSTEventSink, // 000 + public BSTEventSource // 008 + { + public: + virtual ~BSSystemUtility(); // 00 + + // override (BSTEventSink) + BSEventNotifyControl ProcessEvent(const BSGamepadEvent* a_event, BSTEventSource* a_eventSource); // 01 + + // add + virtual void GetAuthenticationInfo(char*& userAuthID, std::uint64_t& size); // 02 + virtual void Func03(void); // 03 + virtual void DoInitialize(); // 04 + virtual void Func05(void); // 05 + virtual void DoUpdate(); // 06 + virtual void Func07(void); // 07 + virtual void DoGetUserName(char* buffer, std::uint64_t size); // 08 + virtual void Func09(void); // 09 + virtual void Func0A(void); // 0A + virtual void Func0B(void); // 0B + virtual void Func0C(void); // 0C + virtual void DoGetComputerName(char* buffer, std::uint64_t size); // 0D + virtual void Func0E(void); // 0E + virtual void Func0F(void); // 0F + virtual void DoAuthenticateUser(); // 10 + virtual void Func11(void); // 11 + virtual bool Func12(); // 12 - added in 1.6.1130 + + // members + std::uint64_t unk060[24]; // 060 + std::uint8_t unk120; // 120 - added in 1.6.1130 + std::uint8_t unk121; // 121 - added in 1.6.1130 + std::uint16_t pad122; // 122 + std::uint32_t pad124; // 124 + }; + static_assert(sizeof(BSSystemUtility) == 0x128); +} diff --git a/include/RE/B/BSVirtualKeyboardDevice.h b/include/RE/B/BSVirtualKeyboardDevice.h index 9ecf7e43d..775929b55 100644 --- a/include/RE/B/BSVirtualKeyboardDevice.h +++ b/include/RE/B/BSVirtualKeyboardDevice.h @@ -7,6 +7,18 @@ namespace RE class BSVirtualKeyboardDevice : public BSKeyboardDevice { public: + struct kbInfo + { + using DoneCallback = void(void*, const char*); + using CancelCallback = void(); + + const char* startingText; // 00 + DoneCallback* doneCallback; // 08 + CancelCallback* cancelCallback; // 10 + void* userParam; // 18 + std::uint32_t maxChars; // 20 + }; + inline static constexpr auto RTTI = RTTI_BSVirtualKeyboardDevice; ~BSVirtualKeyboardDevice() override; // 00 @@ -16,9 +28,9 @@ namespace RE void Unk_0A(void) override; // 0A - { return; } // add - virtual void Unk_0B(void) = 0; // 0B - virtual void Unk_0C(void) = 0; // 0C - virtual void Unk_0D(void) = 0; // 0D + virtual void Start(const kbInfo* info) = 0; // 0B + virtual void Stop() = 0; // 0C + virtual void UserCancelled() = 0; // 0D }; static_assert(sizeof(BSVirtualKeyboardDevice) == 0x70); } diff --git a/include/RE/B/BSWin32SystemUtility.h b/include/RE/B/BSWin32SystemUtility.h new file mode 100644 index 000000000..8ba913e60 --- /dev/null +++ b/include/RE/B/BSWin32SystemUtility.h @@ -0,0 +1,66 @@ +#pragma once + +#include "RE/B/BSSystemUtility.h" +#include "RE/B/BSVirtualKeyboardDevice.h" +#include "RE/C/CCallback.h" + +class ISteamClient; +class ISteamUtils; +struct EncryptedAppTicketResponse_t; +struct FloatingGamepadTextInputDismissed_t; +struct GameOverlayActivated_t; +struct GamepadTextInputDismissed_t; + +using HSteamPipe = std::int32_t; + +namespace RE +{ + class BSWin32SystemUtility : public BSSystemUtility + { + public: + template + using SteamCallback = CCallback; + template + using SteamCallResult = CCallResult; + + using VirtualKeyboardDoneCallback = void(void*, const char*); + using VirtualKeyboardCancelCallback = void(); + + virtual ~BSWin32SystemUtility(); // 00 + + // override (BSSystemUtility) + void GetAuthenticationInfo(char*& userAuthID, std::uint64_t& size) override; // 02 + void DoInitialize() override; // 04 + void DoUpdate() override; // 06 + void DoGetUserName(char* buffer, std::uint64_t size) override; // 08 + void DoGetComputerName(char* buffer, std::uint64_t size) override; // 0D + void DoAuthenticateUser() override; // 10 + bool Func12() override; // 12 + + [[nodiscard]] static BSWin32SystemUtility* GetSingleton() + { + using func_t = decltype(&BSWin32SystemUtility::GetSingleton); + REL::Relocation func{ Offset::BSWin32SystemUtility::GetSingleton }; + return func(); + } + + // members + SteamCallback steamcallback_GameOverlayActivated; // 128 + SteamCallback steamcallback_FloatingGamepadTextInputDismissed; // 150 - added in 1.6.1130 + SteamCallback steamcallback_GamepadTextInputDismissed; // 178 - added in 1.6.1130 + SteamCallResult steamcallresult_EncryptedAppTicketResponse; // 1A0 + VirtualKeyboardDoneCallback* virtualKeyboardDone; // 1D0 - added in 1.6.1130 + VirtualKeyboardCancelCallback* virtualKeyboardCancel; // 1D8 - added in 1.6.1130 + void* virtualKeyboardUserParam; // 1E0 - added in 1.6.1130 + bool steamAPIInitialized; // 1E8 - added in 1.6.1130 + std::uint8_t pad1E9; // 1E9 + std::uint16_t pad1EA; // 1EA + std::uint32_t pad1EC; // 1EC + ISteamClient* steamClient; // 1F0 - added in 1.6.1130 + HSteamPipe steamPipe; // 1F8 - added in 1.6.1130 + std::uint32_t pad1FC; // 1FC + ISteamUtils* steamUtils; // 200 - added in 1.6.1130 + bool isRunningOnSteamDeck; // 208 - added in 1.6.1130 + }; + static_assert(sizeof(BSWin32SystemUtility) == 0x210); +} diff --git a/include/RE/B/BSWin32VirtualKeyboardDevice.h b/include/RE/B/BSWin32VirtualKeyboardDevice.h index 44fa38563..57fce80da 100644 --- a/include/RE/B/BSWin32VirtualKeyboardDevice.h +++ b/include/RE/B/BSWin32VirtualKeyboardDevice.h @@ -12,13 +12,13 @@ namespace RE ~BSWin32VirtualKeyboardDevice() override; // 00 // override (BSVirtualKeyboardDevice) - void Initialize() override; // 01 - { return; } - void Poll(float a_timeDelta) override; // 02 - { return; } - void Shutdown() override; // 03 - { return; } - void ClearInputState() override; // 08 - { return; } - void Unk_0B(void) override; // 0B - { return; } - void Unk_0C(void) override; // 0C - { return; } - void Unk_0D(void) override; // 0D - { return; } + void Initialize() override; // 01 - { return; } + void Poll(float a_timeDelta) override; // 02 - { return; } + void Shutdown() override; // 03 - { return; } + void ClearInputState() override; // 08 - { return; } + void Start(const kbInfo* info) override; // 0B - { return; } + void Stop() override; // 0C - { return; } + void UserCancelled() override; // 0D - { return; } }; static_assert(sizeof(BSWin32VirtualKeyboardDevice) == 0x70); } diff --git a/include/RE/C/CCallback.h b/include/RE/C/CCallback.h new file mode 100644 index 000000000..16cc79e2d --- /dev/null +++ b/include/RE/C/CCallback.h @@ -0,0 +1,64 @@ +#pragma once + +using SteamAPICall_t = std::uint64_t; + +namespace RE +{ + class CCallbackBase + { + public: + enum + { + k_ECallbackFlagsRegistered = 0x01, + k_ECallbackFlagsGameServer = 0x02 + }; + + virtual void Run(void* vParam); // 01 + virtual void Run(void* vParam, bool ioFailure, SteamAPICall_t steamAPICall); // 00 + virtual int GetCallbackSizeBytes(); // 02 + + // members + std::uint8_t callbackFlags; // 08 + std::uint8_t pad09; // 09 + std::uint16_t pad0A; // 0A + std::int32_t iCallback; // 0C + }; + static_assert(sizeof(CCallbackBase) == 0x10); + + template + class CCallResult : public CCallbackBase + { + public: + using func_t = void (T::*)(P*); + + // override (CCallbackBase) + void Run(void* vParam) override; // 01 + void Run(void* vParam, bool ioFailure, SteamAPICall_t steamAPICall) override; // 00 + int GetCallbackSizeBytes() override; // 02 + + SteamAPICall_t apiCall; // 10 + T* obj; // 18 + func_t func; // 20 + }; + // size == 0x30 + + template + class CCallback : public CCallbackBase + { + public: + using func_t = void (T::*)(P*); + + // override (CCallbackBase) + void Run(void* vParam) override; // 01 + void Run(void* vParam, bool ioFailure, SteamAPICall_t steamAPICall) override; // 00 + int GetCallbackSizeBytes() override; // 02 + + // add + virtual ~CCallback(); // 03 + + // members + T* pObj; // 10 + func_t func; // 18 + }; + // size == 0x28 +} diff --git a/include/RE/Offsets.h b/include/RE/Offsets.h index ce9370d06..fcf1a6ca5 100644 --- a/include/RE/Offsets.h +++ b/include/RE/Offsets.h @@ -346,6 +346,11 @@ namespace RE inline constexpr REL::ID GetSingleton(static_cast(109278)); } + namespace BSWin32SystemUtility + { + inline constexpr REL::ID GetSingleton(static_cast(109206)); + } + namespace Calendar { inline constexpr REL::ID Singleton(static_cast(400447)); diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 92dfb4cf5..98c27b715 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -270,6 +270,7 @@ #include "RE/B/BSStringPool.h" #include "RE/B/BSSystemFile.h" #include "RE/B/BSSystemFileStorage.h" +#include "RE/B/BSSystemUtility.h" #include "RE/B/BSTAnimationGraphDataChannel.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTCaseInsensitiveStringMap.h" @@ -308,6 +309,7 @@ #include "RE/B/BSWin32KeyboardDevice.h" #include "RE/B/BSWin32MouseDevice.h" #include "RE/B/BSWin32SaveDataSystemUtility.h" +#include "RE/B/BSWin32SystemUtility.h" #include "RE/B/BSWin32VirtualKeyboardDevice.h" #include "RE/B/BSXAudio2GameSound.h" #include "RE/B/BSXFlags.h" @@ -348,6 +350,7 @@ #include "RE/B/bhkThreadMemorySource.h" #include "RE/B/bhkWorld.h" #include "RE/B/bhkWorldObject.h" +#include "RE/C/CCallback.h" #include "RE/C/CFilter.h" #include "RE/C/CRC.h" #include "RE/C/Calendar.h"