From 00fc463e674a2892baa97f149cc5e4819aabba99 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Fri, 2 May 2025 21:41:11 -0600 Subject: [PATCH 01/14] refactor: remove `REL`, `REX` --- include/REL/ASM.h | 101 -- include/REL/Hook.h | 341 ----- include/REL/HookObject.h | 74 - include/REL/HookStore.h | 34 - include/REL/IAT.h | 31 - include/REL/ID.h | 32 - include/REL/IDDB.h | 41 - include/REL/Module.h | 62 - include/REL/Offset.h | 30 - include/REL/Offset2ID.h | 70 - include/REL/REL.h | 17 - include/REL/Relocation.h | 386 ----- include/REL/Segment.h | 45 - include/REL/Trampoline.h | 128 -- include/REL/Utility.h | 96 -- include/REL/Version.h | 139 -- include/REX/REX.h | 10 - include/REX/REX/Enum.h | 68 - include/REX/REX/EnumSet.h | 182 --- include/REX/REX/INI.h | 100 -- include/REX/REX/JSON.h | 97 -- include/REX/REX/LOG.h | 178 --- include/REX/REX/Setting.h | 75 - include/REX/REX/Singleton.h | 25 - include/REX/REX/TOML.h | 116 -- include/REX/W32.h | 28 - include/REX/W32/ADVAPI32.h | 16 - include/REX/W32/BASE.h | 198 --- include/REX/W32/BCRYPT.h | 73 - include/REX/W32/COM.h | 25 - include/REX/W32/COMPTR.h | 196 --- include/REX/W32/D3D.h | 736 ---------- include/REX/W32/D3D11.h | 2569 --------------------------------- include/REX/W32/D3D11_1.h | 296 ---- include/REX/W32/D3D11_2.h | 112 -- include/REX/W32/D3D11_3.h | 301 ---- include/REX/W32/D3D11_4.h | 138 -- include/REX/W32/D3DCOMPILER.h | 154 -- include/REX/W32/DBGHELP.h | 22 - include/REX/W32/DINPUT.h | 499 ------- include/REX/W32/DXGI.h | 549 ------- include/REX/W32/DXGI_2.h | 272 ---- include/REX/W32/DXGI_3.h | 148 -- include/REX/W32/DXGI_4.h | 86 -- include/REX/W32/DXGI_5.h | 94 -- include/REX/W32/DXGI_6.h | 114 -- include/REX/W32/KERNEL32.h | 542 ------- include/REX/W32/NT.h | 92 -- include/REX/W32/OLE32.h | 8 - include/REX/W32/SHELL32.h | 34 - include/REX/W32/USER32.h | 293 ---- include/REX/W32/VERSION.h | 13 - include/REX/W32/XINPUT.h | 80 - src/REL/HookObject.cpp | 97 -- src/REL/HookStore.cpp | 106 -- src/REL/IAT.cpp | 77 - src/REL/IDDB.cpp | 110 -- src/REL/Module.cpp | 64 - src/REL/Trampoline.cpp | 238 --- src/REL/Utility.cpp | 52 - src/REL/Version.cpp | 62 - src/REX/REX.cpp | 403 ------ src/REX/W32.cpp | 948 ------------ 63 files changed, 12323 deletions(-) delete mode 100644 include/REL/ASM.h delete mode 100644 include/REL/Hook.h delete mode 100644 include/REL/HookObject.h delete mode 100644 include/REL/HookStore.h delete mode 100644 include/REL/IAT.h delete mode 100644 include/REL/ID.h delete mode 100644 include/REL/IDDB.h delete mode 100644 include/REL/Module.h delete mode 100644 include/REL/Offset.h delete mode 100644 include/REL/Offset2ID.h delete mode 100644 include/REL/REL.h delete mode 100644 include/REL/Relocation.h delete mode 100644 include/REL/Segment.h delete mode 100644 include/REL/Trampoline.h delete mode 100644 include/REL/Utility.h delete mode 100644 include/REL/Version.h delete mode 100644 include/REX/REX.h delete mode 100644 include/REX/REX/Enum.h delete mode 100644 include/REX/REX/EnumSet.h delete mode 100644 include/REX/REX/INI.h delete mode 100644 include/REX/REX/JSON.h delete mode 100644 include/REX/REX/LOG.h delete mode 100644 include/REX/REX/Setting.h delete mode 100644 include/REX/REX/Singleton.h delete mode 100644 include/REX/REX/TOML.h delete mode 100644 include/REX/W32.h delete mode 100644 include/REX/W32/ADVAPI32.h delete mode 100644 include/REX/W32/BASE.h delete mode 100644 include/REX/W32/BCRYPT.h delete mode 100644 include/REX/W32/COM.h delete mode 100644 include/REX/W32/COMPTR.h delete mode 100644 include/REX/W32/D3D.h delete mode 100644 include/REX/W32/D3D11.h delete mode 100644 include/REX/W32/D3D11_1.h delete mode 100644 include/REX/W32/D3D11_2.h delete mode 100644 include/REX/W32/D3D11_3.h delete mode 100644 include/REX/W32/D3D11_4.h delete mode 100644 include/REX/W32/D3DCOMPILER.h delete mode 100644 include/REX/W32/DBGHELP.h delete mode 100644 include/REX/W32/DINPUT.h delete mode 100644 include/REX/W32/DXGI.h delete mode 100644 include/REX/W32/DXGI_2.h delete mode 100644 include/REX/W32/DXGI_3.h delete mode 100644 include/REX/W32/DXGI_4.h delete mode 100644 include/REX/W32/DXGI_5.h delete mode 100644 include/REX/W32/DXGI_6.h delete mode 100644 include/REX/W32/KERNEL32.h delete mode 100644 include/REX/W32/NT.h delete mode 100644 include/REX/W32/OLE32.h delete mode 100644 include/REX/W32/SHELL32.h delete mode 100644 include/REX/W32/USER32.h delete mode 100644 include/REX/W32/VERSION.h delete mode 100644 include/REX/W32/XINPUT.h delete mode 100644 src/REL/HookObject.cpp delete mode 100644 src/REL/HookStore.cpp delete mode 100644 src/REL/IAT.cpp delete mode 100644 src/REL/IDDB.cpp delete mode 100644 src/REL/Module.cpp delete mode 100644 src/REL/Trampoline.cpp delete mode 100644 src/REL/Utility.cpp delete mode 100644 src/REL/Version.cpp delete mode 100644 src/REX/REX.cpp delete mode 100644 src/REX/W32.cpp diff --git a/include/REL/ASM.h b/include/REL/ASM.h deleted file mode 100644 index a81b4b6..0000000 --- a/include/REL/ASM.h +++ /dev/null @@ -1,101 +0,0 @@ -#pragma once - -#pragma pack(push, 1) - -namespace REL::ASM -{ - template - struct BRANCH5 - { - explicit constexpr BRANCH5(const std::int32_t a_disp) : - disp(a_disp) - {} - - explicit constexpr BRANCH5(const std::uintptr_t a_address, const std::uintptr_t a_fn) : - disp(static_cast(a_fn - (a_address + sizeof(BRANCH5)))) - {} - - static std::uintptr_t TARGET(const std::uintptr_t a_address) - { - const auto branch = reinterpret_cast(a_address); - const auto begin = reinterpret_cast(a_address); - const auto address = (begin + sizeof(BRANCH5)) + branch->disp; - return reinterpret_cast(address); - } - - std::uint8_t op{ OP }; // 0 - std::int32_t disp; // 1 - }; - - using CALL5 = BRANCH5<0xE8>; - static_assert(sizeof(CALL5) == 0x5); - - using JMP5 = BRANCH5<0xE9>; - static_assert(sizeof(JMP5) == 0x5); - - template - struct BRANCH6 - { - explicit constexpr BRANCH6(const std::int32_t a_disp) : - disp(a_disp) - {} - - explicit constexpr BRANCH6(const std::uintptr_t a_address, const std::uintptr_t a_fn) : - disp(static_cast(a_fn - (a_address + sizeof(BRANCH6)))) - {} - - static std::uintptr_t TARGET(const std::uintptr_t a_address) - { - const auto branch = reinterpret_cast(a_address); - const auto begin = reinterpret_cast(a_address); - const auto address = (begin + sizeof(BRANCH6)) + branch->disp; - return reinterpret_cast(address); - } - - std::uint8_t op{ 0xFF }; // 0 - std::uint8_t rm{ RM }; // 1 - std::int32_t disp; // 2 - }; - - using CALL6 = BRANCH6<0x15>; - static_assert(sizeof(CALL6) == 0x6); - - using JMP6 = BRANCH6<0x25>; - static_assert(sizeof(JMP6) == 0x6); - - struct CALL16 - { - explicit constexpr CALL16(const std::uintptr_t a_addr) : - addr(a_addr) - {} - - template - explicit constexpr CALL16(const T* a_fn) : - CALL16(reinterpret_cast(a_fn)) - {} - - CALL6 call{ 0x2 }; // 0 - 0x2 - std::uint8_t op{ 0xEB }; // 6 - 0xEB - std::int8_t disp{ 0x8 }; // 7 - 0x8 - std::uint64_t addr; // 8 - }; - static_assert(sizeof(CALL16) == 0x10); - - struct JMP14 - { - explicit constexpr JMP14(const std::uintptr_t a_addr) : - addr(a_addr) - {} - - template - explicit constexpr JMP14(const T* a_fn) : - JMP14(reinterpret_cast(a_fn)) - {} - - JMP6 jmp{ 0x0 }; // 0 - 0x0 - std::uint64_t addr; // 6 - [rip] - }; - static_assert(sizeof(JMP14) == 0xE); -} - -#pragma pack(pop) diff --git a/include/REL/Hook.h b/include/REL/Hook.h deleted file mode 100644 index b6541a7..0000000 --- a/include/REL/Hook.h +++ /dev/null @@ -1,341 +0,0 @@ -#pragma once - -#include "REL/ASM.h" -#include "REL/HookObject.h" -#include "REL/ID.h" -#include "REL/Offset.h" -#include "REL/Trampoline.h" -#include "REL/Utility.h" - -namespace REL -{ - template - class Hook; - - template - class Hook : - public HookObject - { - public: - explicit Hook(const ID a_id, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_id.address() + a_diff) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const Offset a_offset, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_offset.address() + a_diff) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const HOOK_STEP a_step, const ID a_id, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_id.address() + a_diff, a_step) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const HOOK_STEP a_step, const Offset a_offset, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_offset.address() + a_diff, a_step) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const char* a_name, const ID a_id, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_id.address() + a_diff, a_name) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const char* a_name, const Offset a_offset, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_offset.address() + a_diff, a_name) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const char* a_name, const HOOK_STEP a_step, const ID a_id, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_id.address() + a_diff, a_name, a_step) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - explicit Hook(const char* a_name, const HOOK_STEP a_step, const Offset a_offset, const std::ptrdiff_t a_diff, R (*a_function)(T...)) : - HookObject(a_offset.address() + a_diff, a_name, a_step) - { - m_function = reinterpret_cast(a_function); - Detect(); - } - - virtual bool Init() override - { - if (m_type == HOOK_TYPE::NONE) { - REX::ERROR("{}: could not determine hook type", *this); - return false; - } - - REL::Write(std::span{ m_bytesOld }, m_address); - - switch (m_type) { - case HOOK_TYPE::CALL5: { - ASM::CALL5 assembly(m_address, GetTrampoline().allocate_branch5(m_function)); - REL::WriteData(std::span{ m_bytes }, assembly); - } break; - case HOOK_TYPE::CALL6: { - ASM::CALL6 assembly(m_address, GetTrampoline().allocate_branch6(m_function)); - REL::WriteData(std::span{ m_bytes }, assembly); - } break; - case HOOK_TYPE::JMP5: { - ASM::JMP5 assembly(m_address, GetTrampoline().allocate_branch5(m_function)); - REL::WriteData(std::span{ m_bytes }, assembly); - } break; - case HOOK_TYPE::JMP6: { - ASM::JMP6 assembly(m_address, GetTrampoline().allocate_branch6(m_function)); - REL::WriteData(std::span{ m_bytes }, assembly); - } break; - } - - return true; - } - - virtual bool Enable() override - { - if (m_type == HOOK_TYPE::NONE) { - REX::ERROR("{}: hook type is none", *this); - return false; - } - - REL::WriteSafe(m_address, std::span{ m_bytes }); - - m_enabled = true; - - return true; - } - - virtual bool Disable() override - { - if (m_type == HOOK_TYPE::NONE) { - REX::ERROR("{}: hook type is none", *this); - return false; - } - - REL::WriteSafe(m_address, std::span{ m_bytesOld }); - - m_enabled = false; - - return false; - } - - R operator()(T... a_args) const - { - assert(m_functionOld); - return std::invoke(reinterpret_cast>(m_functionOld), a_args...); - } - - private: - void Detect() - { - const auto op = reinterpret_cast(m_address); - switch (*op) { - case 0xE8: { - m_type = HOOK_TYPE::CALL5; - m_size = sizeof(ASM::CALL5); - m_sizeTrampoline = sizeof(ASM::JMP14); - m_functionOld = ASM::CALL5::TARGET(m_address); - } break; - case 0xE9: { - m_type = HOOK_TYPE::JMP5; - m_size = sizeof(ASM::JMP5); - m_sizeTrampoline = sizeof(ASM::JMP14); - m_functionOld = ASM::JMP5::TARGET(m_address); - } break; - case 0xFF: { - switch (*(op + 1)) { - case 0x15: { - m_type = HOOK_TYPE::CALL6; - m_size = sizeof(ASM::CALL6); - m_sizeTrampoline = sizeof(std::uintptr_t); - m_functionOld = ASM::CALL6::TARGET(m_address); - } break; - case 0x25: { - m_type = HOOK_TYPE::JMP6; - m_size = sizeof(ASM::JMP6); - m_sizeTrampoline = sizeof(std::uintptr_t); - m_functionOld = ASM::JMP6::TARGET(m_address); - } break; - } - } break; - } - - m_bytes.resize(m_size); - m_bytesOld.resize(m_size); - } - - private: - std::uintptr_t m_function; - std::uintptr_t m_functionOld; - - std::vector m_bytes; - std::vector m_bytesOld; - }; - - template - Hook(const ID, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const Offset, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const HOOK_STEP, const ID, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const HOOK_STEP, const Offset, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const char*, const ID, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const char*, const Offset, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const char*, const HOOK_STEP, const ID, const std::uint64_t, R (*)(T...)) -> Hook; - - template - Hook(const char*, const HOOK_STEP, const Offset, const std::uint64_t, R (*)(T...)) -> Hook; -} - -namespace REL -{ - template - class HookVFT; - - template - class HookVFT : - public HookObject - { - public: - explicit HookVFT(const ID a_id, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_id.address() + (sizeof(void*) * a_idx), HOOK_TYPE::VFT) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const Offset a_offset, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_offset.address() + (sizeof(void*) * a_idx), HOOK_TYPE::VFT) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const HOOK_STEP a_step, const ID a_id, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_id.address() + (sizeof(void*) * a_idx), HOOK_TYPE::VFT, a_step) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const HOOK_STEP a_step, const Offset a_offset, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_offset.address() + (sizeof(void*) * a_idx), HOOK_TYPE::VFT, a_step) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const char* a_name, const ID a_id, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_id.address() + (sizeof(void*) * a_idx), a_name, HOOK_TYPE::VFT) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const char* a_name, const Offset a_offset, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_offset.address() + (sizeof(void*) * a_idx), a_name, HOOK_TYPE::VFT) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const char* a_name, const HOOK_STEP a_step, const ID a_id, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_id.address() + (sizeof(void*) * a_idx), a_name, HOOK_TYPE::VFT, a_step) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - explicit HookVFT(const char* a_name, const HOOK_STEP a_step, const Offset a_offset, const std::size_t a_idx, R (*a_function)(T...)) : - HookObject(a_offset.address() + (sizeof(void*) * a_idx), a_name, HOOK_TYPE::VFT, a_step) - { - m_function = reinterpret_cast(a_function); - m_functionOld = *reinterpret_cast(m_address); - } - - virtual bool Enable() override - { - if (!m_address) { - REX::ERROR("{}: address is null", *this); - return false; - } - - REL::WriteSafeData(m_address, m_function); - - m_enabled = true; - - return true; - } - - virtual bool Disable() override - { - if (!m_address) { - REX::ERROR("{}: address is null", *this); - return false; - } - - REL::WriteSafeData(m_address, m_functionOld); - - m_enabled = false; - - return true; - } - - R operator()(T... a_args) const - { - assert(m_functionOld); - return std::invoke(reinterpret_cast>(m_functionOld), a_args...); - } - - private: - std::uintptr_t m_function; - std::uintptr_t m_functionOld; - }; - - template - HookVFT(const ID, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const Offset, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const HOOK_STEP, const ID, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const HOOK_STEP, const Offset, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const char*, const ID, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const char*, const Offset, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const char*, const HOOK_STEP, const ID, const std::size_t, R (*)(T...)) -> HookVFT; - - template - HookVFT(const char*, const HOOK_STEP, const Offset, const std::size_t, R (*)(T...)) -> HookVFT; -} diff --git a/include/REL/HookObject.h b/include/REL/HookObject.h deleted file mode 100644 index d9f5800..0000000 --- a/include/REL/HookObject.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -namespace REL -{ - using HOOK_HANDLE = std::uint32_t; - - enum class HOOK_TYPE : std::uint32_t - { - NONE = 0, - CALL5 = 2, - CALL6 = 3, - JMP5 = 4, - JMP6 = 5, - VFT = 6, - }; - - enum class HOOK_STEP : std::uint32_t - { - PRELOAD = 1, - LOAD = 2, - }; - - class HookObject - { - public: - HookObject(const std::uintptr_t a_address); - HookObject(const std::uintptr_t a_address, const char* a_name); - HookObject(const std::uintptr_t a_address, const HOOK_TYPE a_type); - HookObject(const std::uintptr_t a_address, const HOOK_TYPE a_type, const HOOK_STEP a_step); - HookObject(const std::uintptr_t a_address, const HOOK_STEP a_step); - HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type); - HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type, const HOOK_STEP a_step); - - virtual ~HookObject(); - - virtual bool Init(); - virtual HOOK_HANDLE GetHandle() const; - virtual const char* GetName() const; - virtual HOOK_TYPE GetType() const; - virtual HOOK_STEP GetStep() const; - virtual std::size_t GetSize() const; - virtual std::size_t GetSizeTrampoline() const; - virtual bool GetEnabled() const; - virtual bool Enable() = 0; - virtual bool Disable() = 0; - - protected: - std::uintptr_t m_address{ 0 }; - std::string m_name; - HOOK_HANDLE m_handle; - HOOK_TYPE m_type{ HOOK_TYPE::NONE }; - HOOK_STEP m_step{ HOOK_STEP::LOAD }; - std::size_t m_size{ 8 }; - std::size_t m_sizeTrampoline{ 0 }; - bool m_enabled{ false }; - }; -} - -template - requires(std::is_base_of_v) -struct std::formatter -{ - template - constexpr auto parse(ParseContext& a_ctx) - { - return a_ctx.begin(); - } - - template - constexpr auto format(const T& a_hook, FormatContext& a_ctx) const - { - return format_to(a_ctx.out(), "Hook [{}]", a_hook.GetName()); - } -}; diff --git a/include/REL/HookStore.h b/include/REL/HookStore.h deleted file mode 100644 index 8ece6cc..0000000 --- a/include/REL/HookStore.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "REL/HookObject.h" - -#include "REX/REX/Singleton.h" - -namespace REL -{ - class HookStore : - public REX::Singleton - { - public: - HOOK_HANDLE Add(HookObject* a_hook); - void Remove(const HOOK_HANDLE a_handle); - - void Init(); - - void Enable(); - void Enable(const HOOK_HANDLE a_handle); - void Enable(const HOOK_TYPE a_type); - void Enable(const HOOK_STEP a_phase); - - void Disable(); - void Disable(const HOOK_HANDLE a_handle); - void Disable(const HOOK_TYPE a_type); - - std::size_t GetSizeTrampoline(); - - private: - std::map m_hooks; - std::queue m_hookQueue; - std::uint32_t m_handleCount{ 0 }; - }; -} diff --git a/include/REL/IAT.h b/include/REL/IAT.h deleted file mode 100644 index 1e7049a..0000000 --- a/include/REL/IAT.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -namespace REL -{ - [[nodiscard]] std::uintptr_t GetIATAddr(std::string_view a_dll, std::string_view a_function); - [[nodiscard]] std::uintptr_t GetIATAddr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function); - - [[nodiscard]] void* GetIATPtr(std::string_view a_dll, std::string_view a_function); - - template - [[nodiscard]] T* GetIATPtr(std::string_view a_dll, std::string_view a_function) - { - return static_cast(GetIATPtr(std::move(a_dll), std::move(a_function))); - } - - [[nodiscard]] void* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function); - - template - [[nodiscard]] T* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function) - { - return static_cast(GetIATPtr(a_module, std::move(a_dll), std::move(a_function))); - } - - std::uintptr_t PatchIAT(std::uintptr_t a_newFunc, std::string_view a_dll, std::string_view a_function); - - template - std::uintptr_t PatchIAT(F a_newFunc, std::string_view a_dll, std::string_view a_function) - { - return PatchIAT(stl::unrestricted_cast(a_newFunc), a_dll, a_function); - } -} diff --git a/include/REL/ID.h b/include/REL/ID.h deleted file mode 100644 index 4df83e8..0000000 --- a/include/REL/ID.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "REL/IDDB.h" -#include "REL/Module.h" - -namespace REL -{ - class ID - { - public: - constexpr ID() noexcept = default; - - explicit constexpr ID(std::uint64_t a_id) noexcept : - _id(a_id) - {} - - constexpr ID& operator=(std::uint64_t a_id) noexcept - { - _id = a_id; - return *this; - } - - [[nodiscard]] std::uintptr_t address() const { return base() + offset(); } - [[nodiscard]] constexpr std::uint64_t id() const noexcept { return _id; } - [[nodiscard]] std::size_t offset() const { return IDDB::get().id2offset(_id); } - - private: - [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } - - std::uint64_t _id{ static_cast(-1) }; - }; -} diff --git a/include/REL/IDDB.h b/include/REL/IDDB.h deleted file mode 100644 index e7c48e8..0000000 --- a/include/REL/IDDB.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -namespace REL -{ - class IDDB - { - private: - struct mapping_t - { - std::uint64_t id; - std::uint64_t offset; - }; - - public: - IDDB(const IDDB&) = delete; - IDDB(IDDB&&) = delete; - - IDDB& operator=(const IDDB&) = delete; - IDDB& operator=(IDDB&&) = delete; - - [[nodiscard]] static IDDB& get() - { - static IDDB singleton; - return singleton; - } - - [[nodiscard]] std::size_t id2offset(std::uint64_t a_id) const; - - protected: - friend class Offset2ID; - - [[nodiscard]] std::span get_id2offset() const noexcept { return _id2offset; } - - private: - IDDB(); - ~IDDB() = default; - - mmio::mapped_file_source _mmap; - std::span _id2offset; - }; -} diff --git a/include/REL/Module.h b/include/REL/Module.h deleted file mode 100644 index 9ffa441..0000000 --- a/include/REL/Module.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once - -#include "REL/Segment.h" -#include "REL/Version.h" - -namespace REL -{ - class Module - { - public: - Module(const Module&) = delete; - Module(Module&&) = delete; - - Module& operator=(const Module&) = delete; - Module& operator=(Module&&) = delete; - - [[nodiscard]] static Module& get() - { - static Module singleton; - return singleton; - } - - [[nodiscard]] constexpr std::uintptr_t base() const noexcept { return _base; } - [[nodiscard]] stl::zwstring filename() const noexcept { return _filename; } - [[nodiscard]] constexpr Segment segment(Segment::Name a_segment) const noexcept { return _segments[a_segment]; } - [[nodiscard]] constexpr Version version() const noexcept { return _version; } - - [[nodiscard]] void* pointer() const noexcept { return reinterpret_cast(base()); } - - template - [[nodiscard]] T* pointer() const noexcept - { - return static_cast(pointer()); - } - - private: - Module(); - ~Module() noexcept = default; - - void load_segments(); - void load_version(); - - static constexpr auto ENVIRONMENT = L"OBSE_RUNTIME"sv; - - static constexpr std::array SEGMENTS{ - ".text"sv, - ".interpr"sv, - ".idata"sv, - ".rdata"sv, - ".data"sv, - ".pdata"sv, - ".tls"sv - }; - - static inline std::uintptr_t _natvis{ 0 }; - - std::wstring _filename; - std::array _segments; - Version _version; - std::uintptr_t _base{ 0 }; - }; -} diff --git a/include/REL/Offset.h b/include/REL/Offset.h deleted file mode 100644 index 6ed58b8..0000000 --- a/include/REL/Offset.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "REL/Module.h" - -namespace REL -{ - class Offset - { - public: - constexpr Offset() noexcept = default; - - explicit constexpr Offset(std::size_t a_offset) noexcept : - _offset(a_offset) - {} - - constexpr Offset& operator=(std::size_t a_offset) noexcept - { - _offset = a_offset; - return *this; - } - - [[nodiscard]] std::uintptr_t address() const { return base() + offset(); } - [[nodiscard]] constexpr std::size_t offset() const noexcept { return _offset; } - - private: - [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } - - std::size_t _offset{ 0 }; - }; -} diff --git a/include/REL/Offset2ID.h b/include/REL/Offset2ID.h deleted file mode 100644 index b7240e9..0000000 --- a/include/REL/Offset2ID.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include "REL/IDDB.h" - -namespace REL -{ - class Offset2ID - { - public: - using value_type = IDDB::mapping_t; - using container_type = std::vector; - using size_type = typename container_type::size_type; - using const_iterator = typename container_type::const_iterator; - using const_reverse_iterator = typename container_type::const_reverse_iterator; - - template - explicit Offset2ID(ExecutionPolicy&& a_policy) // NOLINT(bugprone-forwarding-reference-overload) - requires(std::is_execution_policy_v>) - { - const auto id2offset = IDDB::get().get_id2offset(); - _offset2id.reserve(id2offset.size()); - _offset2id.insert(_offset2id.begin(), id2offset.begin(), id2offset.end()); - std::sort(a_policy, _offset2id.begin(), _offset2id.end(), [](auto&& a_lhs, auto&& a_rhs) { - return a_lhs.offset < a_rhs.offset; - }); - } - - Offset2ID() : - Offset2ID(std::execution::sequenced_policy{}) - {} - - [[nodiscard]] std::uint64_t operator()(std::size_t a_offset) const - { - if (_offset2id.empty()) { - stl::report_and_fail("data is empty"sv); - } - - const IDDB::mapping_t elem{ 0, a_offset }; - const auto it = std::lower_bound( - _offset2id.begin(), - _offset2id.end(), - elem, - [](auto&& a_lhs, auto&& a_rhs) { - return a_lhs.offset < a_rhs.offset; - }); - if (it == _offset2id.end()) { - stl::report_and_fail("offset not found"sv); - } - - return it->id; - } - - [[nodiscard]] const_iterator begin() const noexcept { return _offset2id.begin(); } - [[nodiscard]] const_iterator cbegin() const noexcept { return _offset2id.cbegin(); } - - [[nodiscard]] const_iterator end() const noexcept { return _offset2id.end(); } - [[nodiscard]] const_iterator cend() const noexcept { return _offset2id.cend(); } - - [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return _offset2id.rbegin(); } - [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return _offset2id.crbegin(); } - - [[nodiscard]] const_reverse_iterator rend() const noexcept { return _offset2id.rend(); } - [[nodiscard]] const_reverse_iterator crend() const noexcept { return _offset2id.crend(); } - - [[nodiscard]] size_type size() const noexcept { return _offset2id.size(); } - - private: - container_type _offset2id; - }; -} diff --git a/include/REL/REL.h b/include/REL/REL.h deleted file mode 100644 index 0db3f55..0000000 --- a/include/REL/REL.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "REL/ASM.h" -#include "REL/Hook.h" -#include "REL/HookObject.h" -#include "REL/HookStore.h" -#include "REL/IAT.h" -#include "REL/ID.h" -#include "REL/IDDB.h" -#include "REL/Module.h" -#include "REL/Offset.h" -#include "REL/Offset2ID.h" -#include "REL/Relocation.h" -#include "REL/Segment.h" -#include "REL/Trampoline.h" -#include "REL/Utility.h" -#include "REL/Version.h" diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h deleted file mode 100644 index f9b4e02..0000000 --- a/include/REL/Relocation.h +++ /dev/null @@ -1,386 +0,0 @@ -#pragma once - -#include "REL/ASM.h" -#include "REL/ID.h" -#include "REL/Module.h" -#include "REL/Offset.h" -#include "REL/Trampoline.h" -#include "REL/Utility.h" - -#define REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_nopropQual, a_propQual, ...) \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_pod_type \ - { \ - using type = R(__VA_ARGS__ Cls*, Args...) a_propQual; \ - }; \ - \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_pod_type \ - { \ - using type = R(__VA_ARGS__ Cls*, Args..., ...) a_propQual; \ - }; - -#define REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(a_qualifer, ...) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_qualifer, , ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_qualifer, noexcept, ##__VA_ARGS__) - -#define REL_MAKE_MEMBER_FUNCTION_POD_TYPE(...) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(, __VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(&, ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(&&, ##__VA_ARGS__) - -#define REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL(a_nopropQual, a_propQual, ...) \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_non_pod_type \ - { \ - using type = R&(__VA_ARGS__ Cls*, void*, Args...)a_propQual; \ - }; \ - \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_non_pod_type \ - { \ - using type = R&(__VA_ARGS__ Cls*, void*, Args..., ...)a_propQual; \ - }; - -#define REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(a_qualifer, ...) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL(a_qualifer, , ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL(a_qualifer, noexcept, ##__VA_ARGS__) - -#define REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(...) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(, __VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(&, ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(&&, ##__VA_ARGS__) - -namespace REL -{ - template - class Relocation; - - namespace detail - { - template - struct member_function_pod_type; - - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(); - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(const); - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(volatile); - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(const volatile); - - template - using member_function_pod_type_t = typename member_function_pod_type::type; - - template - struct member_function_non_pod_type; - - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(); - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(const); - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(volatile); - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(const volatile); - - template - using member_function_non_pod_type_t = typename member_function_non_pod_type::type; - - // https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention - - template - struct meets_length_req : - std::disjunction< - std::bool_constant, - std::bool_constant, - std::bool_constant, - std::bool_constant> - {}; - - template - struct meets_function_req : - std::conjunction< - std::is_trivially_constructible, - std::is_trivially_destructible, - std::is_trivially_copy_assignable, - std::negation< - std::is_polymorphic>> - {}; - - template - struct meets_member_req : - std::is_standard_layout - {}; - - template - struct is_x64_pod : - std::true_type - {}; - - template - struct is_x64_pod< - T, - std::enable_if_t< - std::is_union_v>> : - std::false_type - {}; - - template - struct is_x64_pod< - T, - std::enable_if_t< - std::is_class_v>> : - std::conjunction< - meets_length_req, - meets_function_req, - meets_member_req> - {}; - - template - inline constexpr bool is_x64_pod_v = is_x64_pod::value; - - template < - class F, - class First, - class... Rest> - decltype(auto) invoke_member_function_non_pod(F&& a_func, First&& a_first, Rest&&... a_rest) // - noexcept(std::is_nothrow_invocable_v) - { - using result_t = std::invoke_result_t; - std::aligned_storage_t result; - - using func_t = member_function_non_pod_type_t; - auto func = stl::unrestricted_cast(std::forward(a_func)); - - return func(std::forward(a_first), std::addressof(result), std::forward(a_rest)...); - } - } - - inline constexpr std::uint8_t NOP = 0x90; - inline constexpr std::uint8_t RET = 0xC3; - inline constexpr std::uint8_t INT3 = 0xCC; - - template - std::invoke_result_t invoke(F&& a_func, Args&&... a_args) // - noexcept(std::is_nothrow_invocable_v) // - requires(std::invocable) - { - if constexpr (std::is_member_function_pointer_v>) { - if constexpr (detail::is_x64_pod_v>) { // member functions == free functions in x64 - using func_t = detail::member_function_pod_type_t>; - auto func = stl::unrestricted_cast(std::forward(a_func)); - return func(std::forward(a_args)...); - } else { // shift args to insert result - return detail::invoke_member_function_non_pod(std::forward(a_func), std::forward(a_args)...); - } - } else { - return std::forward(a_func)(std::forward(a_args)...); - } - } - - template - class Relocation - { - public: - using value_type = - std::conditional_t< - std::is_member_pointer_v || std::is_function_v>, - std::decay_t, - T>; - - constexpr Relocation() noexcept = default; - - explicit constexpr Relocation(std::uintptr_t a_address) noexcept : - _impl{ a_address } - {} - - explicit Relocation(Offset a_offset) : - _impl{ a_offset.address() } - {} - - explicit Relocation(ID a_id) : - _impl{ a_id.address() } - {} - - explicit Relocation(ID a_id, std::ptrdiff_t a_offset) : - _impl{ a_id.address() + a_offset } - {} - - explicit Relocation(ID a_id, Offset a_offset) : - _impl{ a_id.address() + a_offset.offset() } - {} - - constexpr Relocation& operator=(std::uintptr_t a_address) noexcept - { - _impl = a_address; - return *this; - } - - Relocation& operator=(Offset a_offset) - { - _impl = a_offset.address(); - return *this; - } - - Relocation& operator=(ID a_id) - { - _impl = a_id.address(); - return *this; - } - - template - [[nodiscard]] decltype(auto) operator*() const noexcept - requires(std::is_pointer_v) - { - return *get(); - } - - template - [[nodiscard]] auto operator->() const noexcept - requires(std::is_pointer_v) - { - return get(); - } - - [[nodiscard]] operator bool() const noexcept - { - return _impl != 0; - } - - template - std::invoke_result_t operator()(Args&&... a_args) const - noexcept(std::is_nothrow_invocable_v) - requires(std::invocable) - { - return REL::invoke(get(), std::forward(a_args)...); - } - - [[nodiscard]] constexpr std::uintptr_t address() const noexcept { return _impl; } - [[nodiscard]] std::size_t offset() const { return _impl - base(); } - - [[nodiscard]] value_type get() const - noexcept(std::is_nothrow_copy_constructible_v) - { - assert(_impl != 0); - return stl::unrestricted_cast(_impl); - } - - template - void replace_func(const std::size_t a_count, const std::uintptr_t a_dst) - requires(std::same_as) - { - ASM::JMP14 assembly(a_dst); - - write_fill(INT3, a_count); - write(&assembly, sizeof(assembly)); - } - - template - void replace_func(const std::size_t a_count, const F a_dst) - requires(std::same_as) - { - replace_func(a_count, stl::unrestricted_cast(a_dst)); - } - - template - void write(const void* a_src, std::size_t a_count) - requires(std::same_as) - { - WriteSafe(address() + O, a_src, a_count); - } - - template - void write(const U& a_data) - requires(std::same_as) - { - WriteSafe(address() + O, std::addressof(a_data), sizeof(U)); - } - - template - void write(const std::initializer_list a_data) - requires(std::same_as) - { - WriteSafe(address() + O, a_data.begin(), a_data.size()); - } - - template - void write(const std::span a_data) - requires(std::same_as) - { - WriteSafe(address() + O, a_data.data(), a_data.size_bytes()); - } - - template - std::uintptr_t write_jmp(const std::uintptr_t a_dst) - requires(std::same_as) - { - return GetTrampoline().write_jmp(address() + O, a_dst); - } - - template - std::uintptr_t write_jmp(const F a_dst) - requires(std::same_as) - { - return GetTrampoline().write_jmp(address() + O, stl::unrestricted_cast(a_dst)); - } - - template - std::uintptr_t write_call(const std::uintptr_t a_dst) - requires(std::same_as) - { - return GetTrampoline().write_call(address() + O, a_dst); - } - - template - std::uintptr_t write_call(const F a_dst) - requires(std::same_as) - { - return GetTrampoline().write_call(address() + O, stl::unrestricted_cast(a_dst)); - } - - template - void write_fill(const std::uint8_t a_value, const std::size_t a_count) - requires(std::same_as) - { - WriteSafeFill(address() + O, a_value, a_count); - } - - template - std::uintptr_t write_vfunc(std::size_t a_idx, std::uintptr_t a_newFunc) - requires(std::same_as) - { - const auto addr = address() + (sizeof(void*) * a_idx); - const auto result = *reinterpret_cast(addr); - WriteSafeData(addr, a_newFunc); - return result; - } - - template - std::uintptr_t write_vfunc(std::size_t a_idx, F a_newFunc) - requires(std::same_as) - { - return write_vfunc(a_idx, stl::unrestricted_cast(a_newFunc)); - } - - private: - // clang-format off - [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } - // clang-format on - - std::uintptr_t _impl{ 0 }; - }; -} - -#undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE -#undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER -#undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL - -#undef REL_MAKE_MEMBER_FUNCTION_POD_TYPE -#undef REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER -#undef REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL diff --git a/include/REL/Segment.h b/include/REL/Segment.h deleted file mode 100644 index be4d279..0000000 --- a/include/REL/Segment.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -namespace REL -{ - class Segment - { - public: - enum Name : std::size_t - { - text, - interpr, - idata, - rdata, - data, - pdata, - tls, - total - }; - - constexpr Segment() noexcept = default; - - constexpr Segment(std::uintptr_t a_proxyBase, std::uintptr_t a_address, std::uintptr_t a_size) noexcept : - _proxyBase(a_proxyBase), - _address(a_address), - _size(a_size) - {} - - [[nodiscard]] constexpr std::uintptr_t address() const noexcept { return _address; } - [[nodiscard]] constexpr std::size_t offset() const noexcept { return address() - _proxyBase; } - [[nodiscard]] constexpr std::size_t size() const noexcept { return _size; } - - [[nodiscard]] void* pointer() const noexcept { return reinterpret_cast(address()); } - - template - [[nodiscard]] T* pointer() const noexcept - { - return static_cast(pointer()); - } - - private: - std::uintptr_t _proxyBase{ 0 }; - std::uintptr_t _address{ 0 }; - std::size_t _size{ 0 }; - }; -} diff --git a/include/REL/Trampoline.h b/include/REL/Trampoline.h deleted file mode 100644 index 08aa575..0000000 --- a/include/REL/Trampoline.h +++ /dev/null @@ -1,128 +0,0 @@ -#pragma once - -#ifdef OBSE_SUPPORT_XBYAK -namespace Xbyak -{ - class CodeGenerator; -} -#endif - -namespace REL -{ - class Trampoline - { - public: - using deleter_type = std::function; - - Trampoline() noexcept = default; - Trampoline(const Trampoline&) = delete; - - Trampoline(Trampoline&& a_rhs) noexcept; - - Trampoline(const std::string_view a_name) : - m_name(a_name) - {} - - ~Trampoline() noexcept - { - release(); - } - - Trampoline& operator=(const Trampoline&) = delete; - - Trampoline& operator=(Trampoline&& a_rhs) noexcept - { - if (this != std::addressof(a_rhs)) { - m_branch5 = std::move(a_rhs.m_branch5); - m_branch6 = std::move(a_rhs.m_branch6); - m_name = std::move(a_rhs.m_name); - m_deleter = std::move(a_rhs.m_deleter); - m_data = std::exchange(a_rhs.m_data, nullptr); - m_capacity = std::exchange(a_rhs.m_capacity, 0); - m_size = std::exchange(a_rhs.m_size, 0); - } - - return *this; - } - - public: - void create(const std::size_t a_size, void* a_module = nullptr); - - void set_trampoline(void* a_trampoline, const std::size_t a_size, deleter_type a_deleter = {}); - - [[nodiscard]] void* allocate(const std::size_t a_size); - -#ifdef OBSE_SUPPORT_XBYAK - [[nodiscard]] void* allocate(const Xbyak::CodeGenerator& a_code); -#endif - - template - [[nodiscard]] T* allocate(Args&&... a_args) - { - auto mem = allocate(sizeof(T)); - return new (mem) T(std::forward(a_args)...); - } - - [[nodiscard]] constexpr std::size_t empty() const noexcept { return m_capacity == 0; } - [[nodiscard]] constexpr std::size_t capacity() const noexcept { return m_capacity; } - [[nodiscard]] constexpr std::size_t allocated_size() const noexcept { return m_size; } - [[nodiscard]] constexpr std::size_t free_size() const noexcept { return m_capacity - m_size; } - - template - std::uintptr_t write_call(const std::uintptr_t a_src, const std::uintptr_t a_dst) - { - if constexpr (N == 5) - return write_call5(a_src, a_dst); - else if constexpr (N == 6) - return write_call6(a_src, a_dst); - else - static_assert(false && N, "invalid call size"); - } - - template - std::uintptr_t write_call(const std::uintptr_t a_src, F a_dst) - { - return write_call(a_src, stl::unrestricted_cast(a_dst)); - } - - template - std::uintptr_t write_jmp(const std::uintptr_t a_src, const std::uintptr_t a_dst) - { - if constexpr (N == 5) - return write_jmp5(a_src, a_dst); - else if constexpr (N == 6) - return write_jmp6(a_src, a_dst); - else - static_assert(false && N, "invalid jmp size"); - } - - template - std::uintptr_t write_jmp(const std::uintptr_t a_src, F a_dst) - { - return write_jmp(a_src, stl::unrestricted_cast(a_dst)); - } - - std::uintptr_t write_call5(const std::uintptr_t a_src, const std::uintptr_t a_dst); - std::uintptr_t write_call6(const std::uintptr_t a_src, const std::uintptr_t a_dst); - std::uintptr_t write_jmp5(const std::uintptr_t a_src, const std::uintptr_t a_dst); - std::uintptr_t write_jmp6(const std::uintptr_t a_src, const std::uintptr_t a_dst); - - std::uintptr_t allocate_branch5(const std::uintptr_t a_dst); - std::uintptr_t allocate_branch6(const std::uintptr_t a_dst); - - private: - void release(); - void stats() const; - - private: - std::map m_branch5; - std::map m_branch6; - std::string m_name{ "Default Trampoline"sv }; - deleter_type m_deleter; - std::byte* m_data{ nullptr }; - std::size_t m_capacity{ 0 }; - std::size_t m_size{ 0 }; - }; - - [[nodiscard]] Trampoline& GetTrampoline() noexcept; -} diff --git a/include/REL/Utility.h b/include/REL/Utility.h deleted file mode 100644 index 7b8e389..0000000 --- a/include/REL/Utility.h +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once - -namespace REL -{ - void Write(void* a_dst, const void* a_src, const std::size_t a_size); - void Write(const std::uintptr_t a_dst, const void* a_src, const std::size_t a_size); - - template - void Write(void* a_dst, const std::span a_src) - { - Write(a_dst, a_src.data(), a_src.size_bytes()); - } - - template - void Write(const std::uintptr_t a_dst, const std::span a_src) - { - Write(reinterpret_cast(a_dst), a_src.data(), a_src.size_bytes()); - } - - template - void Write(const std::span a_dst, const void* a_src) - { - Write(a_dst.data(), a_src, a_dst.size_bytes()); - } - - template - void Write(const std::span a_dst, const std::uintptr_t a_src) - { - Write(a_dst.data(), reinterpret_cast(a_src), a_dst.size_bytes()); - } - - template - void WriteData(void* a_dst, const T& a_src) - { - Write(a_dst, std::addressof(a_src), sizeof(T)); - } - - template - void WriteData(const std::uintptr_t a_dst, const T& a_src) - { - Write(reinterpret_cast(a_dst), std::addressof(a_src), sizeof(T)); - } - - template - void WriteData(const std::span a_dst, const T2& a_src) - { - Write(a_dst.data(), std::addressof(a_src), a_dst.size_bytes()); - } - - void WriteSafe(void* a_dst, const void* a_src, const std::size_t a_size); - void WriteSafe(const std::uintptr_t a_dst, const void* a_src, const std::size_t a_size); - void WriteSafeFill(void* a_dst, const std::uint8_t a_value, const std::size_t a_size); - void WriteSafeFill(const std::uintptr_t a_dst, const std::uint8_t a_value, const std::size_t a_size); - - template - void WriteSafe(void* a_dst, const std::span a_src) - { - WriteSafe(a_dst, a_src.data(), a_src.size_bytes()); - } - - template - void WriteSafe(const std::uintptr_t a_dst, const std::span a_src) - { - WriteSafe(reinterpret_cast(a_dst), a_src.data(), a_src.size_bytes()); - } - - template - void WriteSafe(const std::span a_dst, const void* a_src) - { - WriteSafe(a_dst.data(), a_src, a_dst.size_bytes()); - } - - template - void WriteSafe(const std::span a_dst, const std::uintptr_t a_src) - { - WriteSafe(a_dst.data(), reinterpret_cast(a_src), a_dst.size_bytes()); - } - - template - void WriteSafeData(void* a_dst, const T& a_src) - { - WriteSafe(a_dst, std::addressof(a_src), sizeof(T)); - } - - template - void WriteSafeData(const std::uintptr_t a_dst, const T& a_src) - { - WriteSafe(reinterpret_cast(a_dst), std::addressof(a_src), sizeof(T)); - } - - template - void WriteSafeData(const std::span a_dst, const T2& a_src) - { - WriteSafe(a_dst.data(), std::addressof(a_src), a_dst.size_bytes()); - } -} diff --git a/include/REL/Version.h b/include/REL/Version.h deleted file mode 100644 index 8e233d4..0000000 --- a/include/REL/Version.h +++ /dev/null @@ -1,139 +0,0 @@ -#pragma once - -namespace REL -{ - template - class VersionBase - { - public: - using value_type = std::uint16_t; - using reference = value_type&; - using const_reference = const value_type&; - - constexpr VersionBase() noexcept = default; - - explicit constexpr VersionBase(std::array a_version) noexcept : - _impl(a_version) - {} - - constexpr VersionBase(value_type a_v1, value_type a_v2 = 0, value_type a_v3 = 0, value_type a_v4 = 0) noexcept : - _impl{ a_v1, a_v2, a_v3, a_v4 } - {} - - [[nodiscard]] constexpr reference operator[](std::size_t a_idx) noexcept { return _impl[a_idx]; } - [[nodiscard]] constexpr const_reference operator[](std::size_t a_idx) const noexcept { return _impl[a_idx]; } - - [[nodiscard]] constexpr decltype(auto) begin() const noexcept { return _impl.begin(); } - [[nodiscard]] constexpr decltype(auto) cbegin() const noexcept { return _impl.cbegin(); } - [[nodiscard]] constexpr decltype(auto) end() const noexcept { return _impl.end(); } - [[nodiscard]] constexpr decltype(auto) cend() const noexcept { return _impl.cend(); } - - [[nodiscard]] std::strong_ordering constexpr compare(const VersionBase& a_rhs) const noexcept - { - for (std::size_t i = 0; i < _impl.size(); ++i) { - if ((*this)[i] != a_rhs[i]) { - return (*this)[i] < a_rhs[i] ? std::strong_ordering::less : std::strong_ordering::greater; - } - } - return std::strong_ordering::equal; - } - - [[nodiscard]] constexpr std::uint32_t pack() const noexcept - { - return static_cast( - (_impl[0] & T::AND_MAJOR) << T::SHL_MAJOR | - (_impl[1] & T::AND_MINOR) << T::SHL_MINOR | - (_impl[2] & T::AND_PATCH) << T::SHL_PATCH | - (_impl[3] & T::AND_BUILD) << T::SHL_BUILD); - } - - [[nodiscard]] constexpr value_type major() const noexcept { return _impl[0]; } - [[nodiscard]] constexpr value_type minor() const noexcept { return _impl[1]; } - [[nodiscard]] constexpr value_type patch() const noexcept { return _impl[2]; } - [[nodiscard]] constexpr value_type build() const noexcept { return _impl[3]; } - - [[nodiscard]] constexpr std::string string(const std::string_view a_separator = "."sv) const - { - std::string result; - for (auto&& ver : _impl) { - result += std::to_string(ver); - result.append(a_separator.data(), a_separator.size()); - } - result.erase(result.size() - a_separator.size(), a_separator.size()); - return result; - } - - [[nodiscard]] constexpr std::wstring wstring(const std::wstring_view a_separator = L"."sv) const - { - std::wstring result; - for (auto&& ver : _impl) { - result += std::to_wstring(ver); - result.append(a_separator.data(), a_separator.size()); - } - result.erase(result.size() - a_separator.size(), a_separator.size()); - return result; - } - - [[nodiscard]] static constexpr VersionBase unpack(const std::uint32_t a_packedVersion) noexcept - { - return VersionBase{ - static_cast((a_packedVersion >> T::SHL_MAJOR) & T::AND_MAJOR), - static_cast((a_packedVersion >> T::SHL_MINOR) & T::AND_MINOR), - static_cast((a_packedVersion >> T::SHL_PATCH) & T::AND_PATCH), - static_cast((a_packedVersion >> T::SHL_BUILD) & T::AND_BUILD) - }; - } - - [[nodiscard]] friend constexpr bool operator==(const VersionBase& a_lhs, const VersionBase& a_rhs) noexcept - { - return a_lhs.compare(a_rhs) == 0; - } - - [[nodiscard]] friend constexpr std::strong_ordering operator<=>(const VersionBase& a_lhs, const VersionBase& a_rhs) noexcept - { - return a_lhs.compare(a_rhs); - } - - private: - std::array _impl{ 0, 0, 0, 0 }; - }; - - struct VersionPackInfo - { - static constexpr auto AND_MAJOR{ 0x0FF }; - static constexpr auto AND_MINOR{ 0x0FF }; - static constexpr auto AND_PATCH{ 0xFFF }; - static constexpr auto AND_BUILD{ 0x00F }; - static constexpr auto SHL_MAJOR{ 8 * 3 }; - static constexpr auto SHL_MINOR{ 8 * 2 }; - static constexpr auto SHL_PATCH{ 8 / 2 }; - static constexpr auto SHL_BUILD{ 8 * 0 }; - }; - - using Version = VersionBase; - - [[nodiscard]] std::optional GetFileVersion(std::string_view a_filename); - [[nodiscard]] std::optional GetFileVersion(std::wstring_view a_filename); -} - -template -struct std::formatter, CharT> : formatter -{ - template - constexpr auto format(const REL::VersionBase& a_version, FormatContext& a_ctx) const - { - return formatter::format(a_version.string(), a_ctx); - } -}; - -#ifdef FMT_VERSION -template -struct fmt::formatter, CharT> : formatter -{ - template - auto format(const REL::VersionBase& a_version, FormatContext& a_ctx) const - { - return formatter::format(a_version.string(), a_ctx); - } -}; -#endif diff --git a/include/REX/REX.h b/include/REX/REX.h deleted file mode 100644 index d5e4133..0000000 --- a/include/REX/REX.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "REX/REX/Enum.h" -#include "REX/REX/EnumSet.h" -#include "REX/REX/INI.h" -#include "REX/REX/JSON.h" -#include "REX/REX/LOG.h" -#include "REX/REX/Setting.h" -#include "REX/REX/Singleton.h" -#include "REX/REX/TOML.h" diff --git a/include/REX/REX/Enum.h b/include/REX/REX/Enum.h deleted file mode 100644 index 1fd984b..0000000 --- a/include/REX/REX/Enum.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -namespace REX -{ - template < - class E, - class U = std::underlying_type_t> - class Enum - { - public: - using enum_type = E; - using underlying_type = U; - - static_assert(std::is_enum_v, "Enum must be an enum"); - static_assert(std::is_integral_v, "Enum<..., U> must be an integral"); - - constexpr Enum() noexcept = default; - constexpr Enum(const Enum&) noexcept = default; - constexpr Enum(Enum&&) noexcept = default; - - template // NOLINTNEXTLINE(google-explicit-constructor) - constexpr Enum(Enum a_rhs) noexcept : - _impl(static_cast(a_rhs.get())) - {} - - constexpr Enum(E a_value) noexcept : - _impl(static_cast(a_value)) - {} - - ~Enum() noexcept = default; - - constexpr Enum& operator=(const Enum&) noexcept = default; - constexpr Enum& operator=(Enum&&) noexcept = default; - - template - constexpr Enum& operator=(Enum a_rhs) noexcept - { - _impl = static_cast(a_rhs.get()); - } - - constexpr Enum& operator=(E a_value) noexcept - { - _impl = static_cast(a_value); - return *this; - } - - public: - [[nodiscard]] explicit constexpr operator bool() const noexcept { return _impl != static_cast(0); } - - [[nodiscard]] constexpr E operator*() const noexcept { return get(); } - [[nodiscard]] constexpr E get() const noexcept { return static_cast(_impl); } - [[nodiscard]] constexpr U underlying() const noexcept { return _impl; } - - public: - friend constexpr bool operator==(Enum a_lhs, Enum a_rhs) noexcept { return a_lhs.underlying() == a_rhs.underlying(); } - friend constexpr bool operator==(Enum a_lhs, E a_rhs) noexcept { return a_lhs.underlying() == static_cast(a_rhs); } - friend constexpr bool operator==(E a_lhs, Enum a_rhs) noexcept { return static_cast(a_lhs) == a_rhs.underlying(); } - - private: - U _impl{ 0 }; - }; - - template - Enum(Args...) -> Enum< - std::common_type_t, - std::underlying_type_t< - std::common_type_t>>; -} diff --git a/include/REX/REX/EnumSet.h b/include/REX/REX/EnumSet.h deleted file mode 100644 index 76afa1d..0000000 --- a/include/REX/REX/EnumSet.h +++ /dev/null @@ -1,182 +0,0 @@ -#pragma once - -namespace REX -{ - template < - class E, - class U = std::underlying_type_t> - class EnumSet - { - public: - using enum_type = E; - using underlying_type = U; - - static_assert(std::is_enum_v, "EnumSet must be an enum"); - static_assert(std::is_integral_v, "EnumSet<..., U> must be an integral"); - - constexpr EnumSet() noexcept = default; - constexpr EnumSet(const EnumSet&) noexcept = default; - constexpr EnumSet(EnumSet&&) noexcept = default; - - template // NOLINTNEXTLINE(google-explicit-constructor) - constexpr EnumSet(EnumSet a_rhs) noexcept : - _impl(static_cast(a_rhs.get())) - {} - - template - constexpr EnumSet(Args... a_values) noexcept - requires(std::same_as && ...) - : - _impl((static_cast(a_values) | ...)) - {} - - ~EnumSet() noexcept = default; - - constexpr EnumSet& operator=(const EnumSet&) noexcept = default; - constexpr EnumSet& operator=(EnumSet&&) noexcept = default; - - template - constexpr EnumSet& operator=(EnumSet a_rhs) noexcept - { - _impl = static_cast(a_rhs.get()); - } - - constexpr EnumSet& operator=(E a_value) noexcept - { - _impl = static_cast(a_value); - return *this; - } - - public: - [[nodiscard]] explicit constexpr operator bool() const noexcept { return _impl != static_cast(0); } - - [[nodiscard]] constexpr E operator*() const noexcept { return get(); } - [[nodiscard]] constexpr E get() const noexcept { return static_cast(_impl); } - [[nodiscard]] constexpr U underlying() const noexcept { return _impl; } - - public: - template - constexpr EnumSet& set(Args... a_args) noexcept - requires(std::same_as && ...) - { - _impl |= (static_cast(a_args) | ...); - return *this; - } - - template - constexpr EnumSet& set(bool a_set, Args... a_args) noexcept - requires(std::same_as && ...) - { - if (a_set) - _impl |= (static_cast(a_args) | ...); - else - _impl &= ~(static_cast(a_args) | ...); - - return *this; - } - - template - constexpr EnumSet& reset(Args... a_args) noexcept - requires(std::same_as && ...) - { - _impl &= ~(static_cast(a_args) | ...); - return *this; - } - - constexpr EnumSet& reset() noexcept - { - _impl = 0; - return *this; - } - - template - [[nodiscard]] constexpr bool any(Args... a_args) const noexcept - requires(std::same_as && ...) - { - return (_impl & (static_cast(a_args) | ...)) != static_cast(0); - } - - template - [[nodiscard]] constexpr bool all(Args... a_args) const noexcept - requires(std::same_as && ...) - { - return (_impl & (static_cast(a_args) | ...)) == (static_cast(a_args) | ...); - } - - template - [[nodiscard]] constexpr bool none(Args... a_args) const noexcept - requires(std::same_as && ...) - { - return (_impl & (static_cast(a_args) | ...)) == static_cast(0); - } - - public: - friend constexpr bool operator==(EnumSet a_lhs, EnumSet a_rhs) noexcept { return a_lhs.underlying() == a_rhs.underlying(); } - friend constexpr bool operator==(EnumSet a_lhs, E a_rhs) noexcept { return a_lhs.underlying() == static_cast(a_rhs); } - friend constexpr bool operator==(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs) == a_rhs.underlying(); } - - friend constexpr std::strong_ordering operator<=>(EnumSet a_lhs, EnumSet a_rhs) noexcept { return a_lhs.underlying() <=> a_rhs.underlying(); } - friend constexpr std::strong_ordering operator<=>(EnumSet a_lhs, E a_rhs) noexcept { return a_lhs.underlying() <=> static_cast(a_rhs); } - friend constexpr std::strong_ordering operator<=>(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs) <=> a_rhs.underlying(); } - - friend constexpr EnumSet operator&(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() & a_rhs.underlying()); } - friend constexpr EnumSet operator&(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() & static_cast(a_rhs)); } - friend constexpr EnumSet operator&(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) & a_rhs.underlying()); } - - friend constexpr EnumSet& operator&=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs & a_rhs; } - friend constexpr EnumSet& operator&=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs & a_rhs; } - - friend constexpr EnumSet operator|(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() | a_rhs.underlying()); } - friend constexpr EnumSet operator|(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() | static_cast(a_rhs)); } - friend constexpr EnumSet operator|(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) | a_rhs.underlying()); } - - friend constexpr EnumSet& operator|=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs | a_rhs; } - friend constexpr EnumSet& operator|=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs | a_rhs; } - - friend constexpr EnumSet operator^(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() ^ a_rhs.underlying()); } - friend constexpr EnumSet operator^(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() ^ static_cast(a_rhs)); } - friend constexpr EnumSet operator^(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) ^ a_rhs.underlying()); } - - friend constexpr EnumSet& operator^=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs ^ a_rhs; } - friend constexpr EnumSet& operator^=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs ^ a_rhs; } - - friend constexpr EnumSet operator+(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() + a_rhs.underlying()); } - friend constexpr EnumSet operator+(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() + static_cast(a_rhs)); } - friend constexpr EnumSet operator+(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) + a_rhs.underlying()); } - - friend constexpr EnumSet& operator+=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs + a_rhs; } - friend constexpr EnumSet& operator+=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs + a_rhs; } - - friend constexpr EnumSet operator-(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() - a_rhs.underlying()); } - friend constexpr EnumSet operator-(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() - static_cast(a_rhs)); } - friend constexpr EnumSet operator-(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) - a_rhs.underlying()); } - - friend constexpr EnumSet& operator-=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs - a_rhs; } - friend constexpr EnumSet& operator-=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs - a_rhs; } - - friend constexpr EnumSet operator<<(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() << a_rhs.underlying()); } - friend constexpr EnumSet operator<<(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() << static_cast(a_rhs)); } - friend constexpr EnumSet operator<<(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) << a_rhs.underlying()); } - - friend constexpr EnumSet& operator<<=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs << a_rhs; } - friend constexpr EnumSet& operator<<=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs << a_rhs; } - - friend constexpr EnumSet operator>>(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() >> a_rhs.underlying()); } - friend constexpr EnumSet operator>>(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() >> static_cast(a_rhs)); } - friend constexpr EnumSet operator>>(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) >> a_rhs.underlying()); } - - friend constexpr EnumSet& operator>>=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs >> a_rhs; } - friend constexpr EnumSet& operator>>=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs >> a_rhs; } - - friend constexpr EnumSet& operator~(EnumSet& a_lhs) noexcept { return a_lhs = ~a_lhs.underlying(); } - - private: - U _impl{ 0 }; - }; - - template - EnumSet(Args...) -> EnumSet< - std::common_type_t, - std::underlying_type_t< - std::common_type_t>>; -} diff --git a/include/REX/REX/INI.h b/include/REX/REX/INI.h deleted file mode 100644 index 315dfb8..0000000 --- a/include/REX/REX/INI.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include "REX/REX/Setting.h" - -#ifdef REX_OPTION_INI -namespace REX::INI -{ - using sec_t = std::string_view; - using key_t = std::string_view; - - namespace Impl - { - template - void SettingLoad(void* a_file, sec_t a_section, key_t a_key, T& a_value, T& a_valueDefault); - - template - void SettingSave(void* a_file, sec_t a_section, key_t a_key, T& a_value); - } - - class SettingStore : - public TSettingStore - { - public: - virtual void Load() override; - virtual void Save() override; - }; - - template - class Setting : - public TSetting - { - public: - Setting(sec_t a_section, key_t a_key, T a_default) : - TSetting(a_default), - m_section(a_section), - m_key(a_key) - {} - - public: - virtual void Load(void* a_data, bool a_isBase) override - { - if (a_isBase) { - Impl::SettingLoad(a_data, m_section, m_key, this->m_valueDefault, this->m_valueDefault); - this->SetValue(this->m_valueDefault); - } else { - Impl::SettingLoad(a_data, m_section, m_key, this->m_value, this->m_valueDefault); - } - } - - virtual void Save(void* a_data) override - { - Impl::SettingSave(a_data, m_section, m_key, this->m_value); - } - - private: - sec_t m_section; - key_t m_key; - }; - - template - using Bool = Setting; - - template - using F32 = Setting; - - template - using F64 = Setting; - - template - using I8 = Setting; - - template - using I16 = Setting; - - template - using I32 = Setting; - - template - using U8 = Setting; - - template - using U16 = Setting; - - template - using U32 = Setting; - - template - using Str = Setting; -} - -template -struct std::formatter, CharT> : std::formatter -{ - template - auto format(const REX::INI::Setting& a_setting, FormatContext& a_ctx) const - { - return std::formatter::format(a_setting.GetValue(), a_ctx); - } -}; -#endif diff --git a/include/REX/REX/JSON.h b/include/REX/REX/JSON.h deleted file mode 100644 index 14b2e4a..0000000 --- a/include/REX/REX/JSON.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include "REX/REX/Setting.h" - -#ifdef REX_OPTION_JSON -namespace REX::JSON -{ - using path_t = std::string_view; - - namespace Impl - { - template - void SettingLoad(void* a_file, path_t a_path, T& a_value, T& a_valueDefault); - - template - void SettingSave(void* a_file, path_t a_path, T& a_value); - } - - class SettingStore : - public TSettingStore - { - public: - virtual void Load() override; - virtual void Save() override; - }; - - template - class Setting : - public TSetting - { - public: - Setting(path_t a_path, T a_default) : - TSetting(a_default), - m_path(a_path) - {} - - public: - virtual void Load(void* a_data, bool a_isBase) override - { - if (a_isBase) { - Impl::SettingLoad(a_data, m_path, this->m_valueDefault, this->m_valueDefault); - this->SetValue(this->m_valueDefault); - } else { - Impl::SettingLoad(a_data, m_path, this->m_value, this->m_valueDefault); - } - } - - virtual void Save(void* a_data) override - { - Impl::SettingSave(a_data, m_path, this->m_value); - } - - private: - path_t m_path; - }; - - template - using Bool = Setting; - - template - using F32 = Setting; - - template - using F64 = Setting; - - template - using I8 = Setting; - - template - using I16 = Setting; - - template - using I32 = Setting; - - template - using U8 = Setting; - - template - using U16 = Setting; - - template - using U32 = Setting; - - template - using Str = Setting; -} - -template -struct std::formatter, CharT> : std::formatter -{ - template - auto format(const REX::JSON::Setting& a_setting, FormatContext& a_ctx) const - { - return std::formatter::format(a_setting.GetValue(), a_ctx); - } -}; -#endif diff --git a/include/REX/REX/LOG.h b/include/REX/REX/LOG.h deleted file mode 100644 index ceada34..0000000 --- a/include/REX/REX/LOG.h +++ /dev/null @@ -1,178 +0,0 @@ -#pragma once - -namespace REX -{ - enum class LOG_LEVEL - { - TRACE = 0, - DEBUG = 1, - INFO = 2, - WARN = 3, - ERROR = 4, - CRITICAL = 5, - }; - - void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::string_view a_fmt); - - template - void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::format_string a_fmt, T&&... a_args) - { - LOG(a_loc, a_level, std::vformat(a_fmt.get(), std::make_format_args(a_args...))); - } - - template - struct TRACE - { - TRACE() = delete; - - explicit TRACE(const std::format_string a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::TRACE, a_fmt, std::forward(a_args)...); - } - }; - - template <> - struct TRACE - { - TRACE() = delete; - - explicit TRACE(const std::string_view a_fmt, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::TRACE, a_fmt); - } - }; - - template - struct DEBUG - { - DEBUG() = delete; - - explicit DEBUG(const std::format_string a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::DEBUG, a_fmt, std::forward(a_args)...); - } - }; - - template <> - struct DEBUG - { - DEBUG() = delete; - - explicit DEBUG(const std::string_view a_fmt, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::DEBUG, a_fmt); - } - }; - - template - struct INFO - { - INFO() = delete; - - explicit INFO(const std::format_string a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::INFO, a_fmt, std::forward(a_args)...); - } - }; - - template <> - struct INFO - { - INFO() = delete; - - explicit INFO(const std::string_view a_fmt, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::INFO, a_fmt); - } - }; - - template - struct WARN - { - WARN() = delete; - - explicit WARN(const std::format_string a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::WARN, a_fmt, std::forward(a_args)...); - } - }; - - template <> - struct WARN - { - WARN() = delete; - - explicit WARN(const std::string_view a_fmt, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::WARN, a_fmt); - } - }; - - template - struct ERROR - { - ERROR() = delete; - - explicit ERROR(const std::format_string a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::ERROR, a_fmt, std::forward(a_args)...); - } - }; - - template <> - struct ERROR - { - ERROR() = delete; - - explicit ERROR(const std::string_view a_fmt, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::ERROR, a_fmt); - } - }; - - template - struct CRITICAL - { - CRITICAL() = delete; - - explicit CRITICAL(const std::format_string a_fmt, T&&... a_args, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::CRITICAL, a_fmt, std::forward(a_args)...); - } - }; - - template <> - struct CRITICAL - { - CRITICAL() = delete; - - explicit CRITICAL(const std::string_view a_fmt, const std::source_location a_loc = std::source_location::current()) - { - LOG(a_loc, LOG_LEVEL::CRITICAL, a_fmt); - } - }; - - template - TRACE(const std::format_string, T&&...) -> TRACE; - TRACE(const std::string_view) -> TRACE; - - template - DEBUG(const std::format_string, T&&...) -> DEBUG; - DEBUG(const std::string_view) -> DEBUG; - - template - INFO(const std::format_string, T&&...) -> INFO; - INFO(const std::string_view) -> INFO; - - template - WARN(const std::format_string, T&&...) -> WARN; - WARN(const std::string_view) -> WARN; - - template - ERROR(const std::format_string, T&&...) -> ERROR; - ERROR(const std::string_view) -> ERROR; - - template - CRITICAL(const std::format_string, T&&...) -> CRITICAL; - CRITICAL(const std::string_view) -> CRITICAL; -} diff --git a/include/REX/REX/Setting.h b/include/REX/REX/Setting.h deleted file mode 100644 index fcf63f1..0000000 --- a/include/REX/REX/Setting.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include "REX/REX/Singleton.h" - -namespace REX -{ - class ISetting - { - public: - virtual void Load(void* a_data, bool a_isBase) = 0; - virtual void Save(void* a_data) = 0; - }; - - class ISettingStore - { - public: - virtual void Init(const char* a_file, const char* a_fileCustom) = 0; - virtual void Load() = 0; - virtual void Save() = 0; - virtual void Register(ISetting* a_setting) = 0; - }; - - template - class TSetting : - public ISetting - { - public: - TSetting() = delete; - - TSetting(T a_default) : - m_value(a_default), - m_valueDefault(a_default) - { - Store::GetSingleton()->Register(this); - } - - public: - T GetValue() const { return m_value; } - - T GetValueDefault() const { return m_valueDefault; } - - void SetValue(T a_value) { m_value = a_value; } - - public: - operator T&() { return m_value; } - operator const T&() const { return m_value; } - - protected: - T m_value; - T m_valueDefault; - }; - - template - class TSettingStore : - public ISettingStore, - public Singleton - { - public: - virtual void Init(const char* a_fileBase, const char* a_fileUser) override - { - m_fileBase = a_fileBase; - m_fileUser = a_fileUser; - } - - virtual void Register(ISetting* a_setting) override - { - m_settings.emplace_back(a_setting); - } - - protected: - std::string_view m_fileBase; - std::string_view m_fileUser; - std::vector m_settings; - }; -} diff --git a/include/REX/REX/Singleton.h b/include/REX/REX/Singleton.h deleted file mode 100644 index 836ddb1..0000000 --- a/include/REX/REX/Singleton.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -namespace REX -{ - template - class Singleton - { - public: - static T* GetSingleton() - { - static T singleton; - return std::addressof(singleton); - } - - protected: - Singleton() = default; - ~Singleton() = default; - - Singleton(const Singleton&) = delete; - Singleton(Singleton&&) = delete; - - Singleton& operator=(const Singleton&) = delete; - Singleton& operator=(Singleton&&) = delete; - }; -} diff --git a/include/REX/REX/TOML.h b/include/REX/REX/TOML.h deleted file mode 100644 index 8516479..0000000 --- a/include/REX/REX/TOML.h +++ /dev/null @@ -1,116 +0,0 @@ -#pragma once - -#include "REX/REX/Setting.h" - -#ifdef REX_OPTION_TOML -namespace REX::TOML -{ - using sec_t = std::vector; - using key_t = std::string_view; - - namespace Impl - { - template - void SettingLoad(void* a_file, sec_t a_section, key_t a_key, T& a_value, T& a_valueDefault); - - template - void SettingSave(void* a_file, sec_t a_section, key_t a_key, T& a_value); - } - - class SettingStore : - public TSettingStore - { - public: - virtual void Load() override; - virtual void Save() override; - }; - - template - class Setting : - public TSetting - { - public: - Setting(key_t a_key, T a_default) : - TSetting(a_default), - m_section(), - m_key(a_key) - {} - - Setting(std::string_view a_section, key_t a_key, T a_default) : - TSetting(a_default), - m_section(), - m_key(a_key) - { - for (const auto token : std::ranges::split_view{ a_section, std::string_view{ "." } }) { - m_section.emplace_back(token.data(), token.size()); - } - } - - Setting(std::initializer_list a_section, key_t a_key, T a_default) : - TSetting(a_default), - m_section(a_section), - m_key(a_key) - {} - - public: - virtual void Load(void* a_data, bool a_isBase) override - { - if (a_isBase) { - Impl::SettingLoad(a_data, m_section, m_key, this->m_valueDefault, this->m_valueDefault); - this->SetValue(this->m_valueDefault); - } else { - Impl::SettingLoad(a_data, m_section, m_key, this->m_value, this->m_valueDefault); - } - } - - virtual void Save(void* a_data) override - { - Impl::SettingSave(a_data, m_section, m_key, this->m_value); - } - - private: - sec_t m_section; - key_t m_key; - }; - - template - using Bool = Setting; - - template - using F32 = Setting; - - template - using F64 = Setting; - - template - using I8 = Setting; - - template - using I16 = Setting; - - template - using I32 = Setting; - - template - using U8 = Setting; - - template - using U16 = Setting; - - template - using U32 = Setting; - - template - using Str = Setting; -} - -template -struct std::formatter, CharT> : std::formatter -{ - template - auto format(const REX::TOML::Setting& a_setting, FormatContext& a_ctx) const - { - return std::formatter::format(a_setting.GetValue(), a_ctx); - } -}; -#endif diff --git a/include/REX/W32.h b/include/REX/W32.h deleted file mode 100644 index b11a7f6..0000000 --- a/include/REX/W32.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -#include "REX/W32/ADVAPI32.h" -#include "REX/W32/COM.h" -#include "REX/W32/COMPTR.h" -#include "REX/W32/D3D.h" -#include "REX/W32/D3D11.h" -#include "REX/W32/D3D11_1.h" -#include "REX/W32/D3D11_2.h" -#include "REX/W32/D3D11_3.h" -#include "REX/W32/D3D11_4.h" -#include "REX/W32/D3DCOMPILER.h" -#include "REX/W32/DBGHELP.h" -#include "REX/W32/DINPUT.h" -#include "REX/W32/DXGI.h" -#include "REX/W32/DXGI_2.h" -#include "REX/W32/DXGI_3.h" -#include "REX/W32/DXGI_4.h" -#include "REX/W32/DXGI_5.h" -#include "REX/W32/DXGI_6.h" -#include "REX/W32/KERNEL32.h" -#include "REX/W32/NT.h" -#include "REX/W32/OLE32.h" -#include "REX/W32/USER32.h" -#include "REX/W32/VERSION.h" -#include "REX/W32/XINPUT.h" diff --git a/include/REX/W32/ADVAPI32.h b/include/REX/W32/ADVAPI32.h deleted file mode 100644 index cde4322..0000000 --- a/include/REX/W32/ADVAPI32.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - inline auto HKEY_CLASSES_ROOT{ reinterpret_cast(0x80000000ull) }; - inline auto HKEY_CURRENT_USER{ reinterpret_cast(0x80000001ull) }; - inline auto HKEY_LOCAL_MACHINE{ reinterpret_cast(0x80000002ull) }; -} - -namespace REX::W32 -{ - std::int32_t RegGetValueA(HKEY a_key, const char* a_subKey, const char* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen); - std::int32_t RegGetValueW(HKEY a_key, const wchar_t* a_subKey, const wchar_t* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen); -} diff --git a/include/REX/W32/BASE.h b/include/REX/W32/BASE.h deleted file mode 100644 index 1196560..0000000 --- a/include/REX/W32/BASE.h +++ /dev/null @@ -1,198 +0,0 @@ -#pragma once - -#ifdef _INC_WINAPIFAMILY -# error Windows API detected. Please move any Windows API includes after CommonLib, or remove them. -#endif - -#define REX_W32_IMPORT(a_ret, a_name, ...) \ - extern "C" __declspec(dllimport) a_ret __stdcall W32_IMPL_##a_name(...) noexcept; \ - __pragma(comment(linker, "/alternatename:__imp_W32_IMPL_" #a_name "=__imp_" #a_name)) - -namespace REX::W32 -{ - using BOOL = std::int32_t; - using HANDLE = void*; - using HBITMAP = struct HBITMAP__*; - using HBRUSH = struct HBRUSH__*; - using HCURSOR = struct HCURSOR__*; - using HDC = struct HDC__*; - using HFONT = struct HFONT__*; - using HICON = struct HICON__*; - using HINSTANCE = struct HINSTANCE__*; - using HKEY = struct HKEY__*; - using HMENU = struct HMENU__*; - using HMODULE = HINSTANCE; - using HMONITOR = struct HMONITOR__*; - using HPALETTE = struct HPALETTE__*; - using HPEN = struct HPEN__*; - using HRESULT = std::int32_t; - using HSTRING = struct HSTRING__*; - using HWND = struct HWND__*; - using NTSTATUS = std::int32_t; - - // general constants - inline const auto INVALID_HANDLE_VALUE{ reinterpret_cast(static_cast(-1)) }; - inline constexpr auto MAX_PATH{ 260u }; -} - -namespace REX::W32 -{ - struct FILETIME - { - constexpr FILETIME() noexcept = default; - - constexpr FILETIME(std::uint64_t a_value) noexcept - { - *this = std::bit_cast(a_value); - } - - constexpr operator std::uint64_t() const noexcept - { - return std::bit_cast(*this); - } - - std::uint32_t lo{}; // 00 - std::uint32_t hi{}; // 04 - }; - static_assert(sizeof(FILETIME) == 0x8); -} - -namespace REX::W32 -{ - struct GUID - { - constexpr GUID() noexcept = default; - - constexpr GUID(const std::uint32_t a_data1, const std::uint16_t a_data2, const std::uint16_t a_data3, const std::array& a_data4) noexcept : - data1(a_data1), data2(a_data2), data3(a_data3), data4{ a_data4[0], a_data4[1], a_data4[2], a_data4[3], a_data4[4], a_data4[5], a_data4[6], a_data4[7] } - {} - - friend bool operator==(const GUID& a_lhs, const GUID& a_rhs) noexcept - { - return std::memcmp(&a_lhs, &a_rhs, sizeof(a_lhs)) == 0; - } - - friend bool operator!=(const GUID& a_lhs, const GUID& a_rhs) noexcept - { - return !(a_lhs == a_rhs); - } - - std::uint32_t data1{}; // 00 - std::uint16_t data2{}; // 04 - std::uint16_t data3{}; // 08 - std::uint8_t data4[8]{}; // 10 - }; - static_assert(sizeof(GUID) == 0x10); - - using UUID = GUID; - using IID = GUID; -} - -namespace REX::W32 -{ - struct POINT - { - constexpr POINT() noexcept = default; - - constexpr POINT(std::int32_t a_x, std::int32_t a_y) noexcept : - x(a_x), y(a_y) - {} - - std::int32_t x{}; // 00 - std::int32_t y{}; // 04 - }; - static_assert(sizeof(POINT) == 0x8); -} - -namespace REX::W32 -{ - struct RECT - { - constexpr RECT() noexcept = default; - - constexpr RECT(const std::int32_t a_x1, const std::int32_t a_y1, const std::int32_t a_x2, const std::int32_t a_y2) noexcept : - x1(a_x1), y1(a_y1), x2(a_x2), y2(a_y2) - {} - - std::int32_t x1{}; // 00 - std::int32_t y1{}; // 04 - std::int32_t x2{}; // 08 - std::int32_t y2{}; // 10 - }; - static_assert(sizeof(RECT) == 0x10); -} - -namespace REX::W32 -{ - struct SIZE - { - std::int32_t x; // 00 - std::int32_t y; // 04 - }; - static_assert(sizeof(SIZE) == 0x8); -} - -namespace REX::W32 -{ - struct CRITICAL_SECTION - { - void* debugInfo; // 00 - std::int32_t lockCount; // 08 - std::int32_t recursionCount; // 0C - HANDLE owningThread; // 10 - HANDLE lockSemaphore; // 18 - std::uintptr_t spinCount; // 20 - }; - static_assert(sizeof(CRITICAL_SECTION) == 0x28); - - struct SECURITY_ATTRIBUTES - { - std::uint32_t length; // 00 - void* securityDescriptor; // 04 - BOOL inheritHandle; // 0C - }; - static_assert(sizeof(SECURITY_ATTRIBUTES) == 0x18); - - union LARGE_INTEGER - { - struct - { - std::uint32_t lo; - std::int32_t hi; - }; - std::int64_t value; - }; - static_assert(sizeof(LARGE_INTEGER) == 0x8); - - union ULARGE_INTEGER - { - struct - { - std::uint32_t lo; - std::uint32_t hi; - }; - std::uint64_t value; - }; - static_assert(sizeof(ULARGE_INTEGER) == 0x8); - - struct UNICODE_STRING - { - std::uint16_t length; - std::uint16_t maxLength; - wchar_t* buffer; - }; - static_assert(sizeof(UNICODE_STRING) == 0x10); -} - -namespace REX::W32 -{ - constexpr bool SUCCESS(const HRESULT a_result) - { - return a_result >= 0; - } - - constexpr bool NT_SUCCESS(const NTSTATUS a_status) - { - return a_status >= 0; - } -} diff --git a/include/REX/W32/BCRYPT.h b/include/REX/W32/BCRYPT.h deleted file mode 100644 index 7cb3d93..0000000 --- a/include/REX/W32/BCRYPT.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - using BCRYPT_HANDLE = void*; - using BCRYPT_ALG_HANDLE = void*; - using BCRYPT_KEY_HANDLE = void*; - using BCRYPT_HASH_HANDLE = void*; - using BCRYPT_SECRET_HANDLE = void*; - - // algorithms - inline constexpr auto BCRYPT_RSA_ALGORITHM{ L"RSA" }; - inline constexpr auto BCRYPT_RSA_SIGN_ALGORITHM{ L"RSA_SIGN" }; - inline constexpr auto BCRYPT_DH_ALGORITHM{ L"DH" }; - inline constexpr auto BCRYPT_DSA_ALGORITHM{ L"DSA" }; - inline constexpr auto BCRYPT_RC2_ALGORITHM{ L"RC2" }; - inline constexpr auto BCRYPT_RC4_ALGORITHM{ L"RC4" }; - inline constexpr auto BCRYPT_AES_ALGORITHM{ L"AES" }; - inline constexpr auto BCRYPT_DES_ALGORITHM{ L"DES" }; - inline constexpr auto BCRYPT_DESX_ALGORITHM{ L"DESX" }; - inline constexpr auto BCRYPT_3DES_ALGORITHM{ L"3DES" }; - inline constexpr auto BCRYPT_3DES_112_ALGORITHM{ L"3DES_112" }; - inline constexpr auto BCRYPT_MD2_ALGORITHM{ L"MD2" }; - inline constexpr auto BCRYPT_MD4_ALGORITHM{ L"MD4" }; - inline constexpr auto BCRYPT_MD5_ALGORITHM{ L"MD5" }; - inline constexpr auto BCRYPT_SHA1_ALGORITHM{ L"SHA1" }; - inline constexpr auto BCRYPT_SHA256_ALGORITHM{ L"SHA256" }; - inline constexpr auto BCRYPT_SHA384_ALGORITHM{ L"SHA384" }; - inline constexpr auto BCRYPT_SHA512_ALGORITHM{ L"SHA512" }; - inline constexpr auto BCRYPT_AES_GMAC_ALGORITHM{ L"AES-GMAC" }; - inline constexpr auto BCRYPT_AES_CMAC_ALGORITHM{ L"AES-CMAC" }; - inline constexpr auto BCRYPT_ECDSA_P256_ALGORITHM{ L"ECDSA_P256" }; - inline constexpr auto BCRYPT_ECDSA_P384_ALGORITHM{ L"ECDSA_P384" }; - inline constexpr auto BCRYPT_ECDSA_P521_ALGORITHM{ L"ECDSA_P521" }; - inline constexpr auto BCRYPT_ECDH_P256_ALGORITHM{ L"ECDH_P256" }; - inline constexpr auto BCRYPT_ECDH_P384_ALGORITHM{ L"ECDH_P384" }; - inline constexpr auto BCRYPT_ECDH_P521_ALGORITHM{ L"ECDH_P521" }; - inline constexpr auto BCRYPT_RNG_ALGORITHM{ L"RNG" }; - inline constexpr auto BCRYPT_RNG_FIPS186_DSA_ALGORITHM{ L"FIPS186DSARNG" }; - inline constexpr auto BCRYPT_RNG_DUAL_EC_ALGORITHM{ L"DUALECRNG" }; - - // properties - inline constexpr auto BCRYPT_OBJECT_LENGTH{ L"ObjectLength" }; - inline constexpr auto BCRYPT_ALGORITHM_NAME{ L"AlgorithmName" }; - inline constexpr auto BCRYPT_PROVIDER_HANDLE{ L"ProviderHandle" }; - inline constexpr auto BCRYPT_CHAINING_MODE{ L"ChainingMode" }; - inline constexpr auto BCRYPT_BLOCK_LENGTH{ L"BlockLength" }; - inline constexpr auto BCRYPT_KEY_LENGTH{ L"KeyLength" }; - inline constexpr auto BCRYPT_KEY_OBJECT_LENGTH{ L"KeyObjectLength" }; - inline constexpr auto BCRYPT_KEY_STRENGTH{ L"KeyStrength" }; - inline constexpr auto BCRYPT_KEY_LENGTHS{ L"KeyLengths" }; - inline constexpr auto BCRYPT_BLOCK_SIZE_LIST{ L"BlockSizeList" }; - inline constexpr auto BCRYPT_EFFECTIVE_KEY_LENGTH{ L"EffectiveKeyLength" }; - inline constexpr auto BCRYPT_HASH_LENGTH{ L"HashDigestLength" }; - inline constexpr auto BCRYPT_HASH_OID_LIST{ L"HashOIDList" }; - inline constexpr auto BCRYPT_PADDING_SCHEMES{ L"PaddingSchemes" }; - inline constexpr auto BCRYPT_SIGNATURE_LENGTH{ L"SignatureLength" }; - inline constexpr auto BCRYPT_HASH_BLOCK_LENGTH{ L"HashBlockLength" }; - inline constexpr auto BCRYPT_AUTH_TAG_LENGTH{ L"AuthTagLength" }; -} - -namespace REX::W32 -{ - NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl = nullptr, std::uint32_t a_flags = 0); - NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags = 0); - NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject = nullptr, std::uint32_t a_hashObjectSize = 0, std::uint8_t* a_secret = nullptr, std::uint32_t a_secretSize = 0, std::uint32_t a_flags = 0); - NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash); - NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags = 0); - NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags = 0); - NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags = 0); -} diff --git a/include/REX/W32/COM.h b/include/REX/W32/COM.h deleted file mode 100644 index 938717c..0000000 --- a/include/REX/W32/COM.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("00000000-0000-0000-c000-000000000046")) - IUnknown - { - virtual HRESULT QueryInterface(const IID& a_iid, void** a_object) = 0; - virtual std::uint32_t AddRef() = 0; - virtual std::uint32_t Release() = 0; - - template - HRESULT QueryInterface(T** a_object) - { - return QueryInterface(*reinterpret_cast(&__uuidof(T)), static_cast(a_object)); - } - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IUnknown{ 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; -} diff --git a/include/REX/W32/COMPTR.h b/include/REX/W32/COMPTR.h deleted file mode 100644 index 6453de4..0000000 --- a/include/REX/W32/COMPTR.h +++ /dev/null @@ -1,196 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - // based on Microsoft::WRL::ComPtr - template - struct ComPtr - { - constexpr ComPtr() noexcept = default; - constexpr ComPtr(std::nullptr_t) noexcept {} - - ComPtr(const ComPtr& a_other) noexcept : - _ptr(a_other._ptr) - { - TryAddRef(); - } - - template - ComPtr(U* a_other) noexcept : - _ptr(a_other) - { - TryAddRef(); - } - - ~ComPtr() noexcept - { - TryRelease(); - } - - ComPtr& operator=(std::nullptr_t) noexcept - { - TryRelease(); - return *this; - } - - ComPtr& operator=(T* a_other) noexcept - { - if (_ptr != a_other) - ComPtr(a_other).Swap(*this); - - return *this; - } - - template - ComPtr& operator=(U* a_other) noexcept - { - ComPtr(a_other).Swap(*this); - return *this; - } - - ComPtr& operator=(const ComPtr& a_other) noexcept - { - if (_ptr != a_other._ptr) - ComPtr(a_other).Swap(*this); - - return *this; - } - - template - ComPtr& operator=(const ComPtr& a_other) noexcept - { - ComPtr(a_other).Swap(*this); - return *this; - } - - ComPtr& operator=(ComPtr&& a_other) noexcept - { - ComPtr(static_cast(a_other)).Swap(*this); - return *this; - } - - template - ComPtr& operator=(ComPtr&& a_other) noexcept - { - ComPtr(static_cast&&>(a_other)).Swap(*this); - return *this; - } - - T* operator->() const noexcept - { - return _ptr; - } - - void Attach(T* a_other) noexcept - { - if (_ptr != nullptr) { - [[maybe_unused]] auto ref = _ptr->Release(); - assert((ref != 0) || (_ptr != a_other)); - } - - _ptr = a_other; - } - - T* Detach() noexcept - { - T* ptr = _ptr; - _ptr = nullptr; - return ptr; - } - - T* Get() const noexcept - { - return _ptr; - } - - T** GetAddressOf() noexcept - { - return &_ptr; - } - - T* const* GetAddressOf() const noexcept - { - return &_ptr; - } - - T** ReleaseAndGetAddressOf() noexcept - { - TryRelease(); - return &_ptr; - } - - std::uint32_t Reset() noexcept - { - return TryRelease(); - } - - void Swap(ComPtr& a_other) noexcept - { - T* ptr = _ptr; - _ptr = a_other._ptr; - a_other._ptr = ptr; - } - - void Swap(ComPtr&& a_other) noexcept - { - T* ptr = _ptr; - _ptr = a_other._ptr; - a_other._ptr = ptr; - } - - template - HRESULT As(ComPtr* a_ptr) const noexcept - { - return _ptr->QueryInterface(__uuidof(U), reinterpret_cast(a_ptr->ReleaseAndGetAddressOf())); - } - - template - HRESULT AsIID(const IID& a_iid, ComPtr* a_ptr) const noexcept - { - return _ptr->QueryInterface(a_iid, reinterpret_cast(a_ptr->ReleaseAndGetAddressOf())); - } - - HRESULT CopyTo(const IID& a_iid, void** a_ptr) const noexcept - { - return _ptr->QueryInterface(a_iid, a_ptr); - } - - HRESULT CopyTo(T** a_ptr) const noexcept - { - TryAddRef(); - *a_ptr = _ptr; - return 0; - } - - template - HRESULT CopyTo(U** a_ptr) const noexcept - { - return _ptr->QueryInterface(__uuidof(U), reinterpret_cast(a_ptr)); - } - - protected: - template - friend struct ComPtr; - - void TryAddRef() const noexcept - { - if (_ptr) - _ptr->AddRef(); - } - - std::uint32_t TryRelease() noexcept - { - T* ptr = _ptr; - if (ptr) { - _ptr = nullptr; - return ptr->Release(); - } - - return 0; - } - - T* _ptr{ nullptr }; - }; -} diff --git a/include/REX/W32/D3D.h b/include/REX/W32/D3D.h deleted file mode 100644 index c2e8bcf..0000000 --- a/include/REX/W32/D3D.h +++ /dev/null @@ -1,736 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI.h" - -namespace REX::W32 -{ - struct ID3DBlob; - struct ID3DDestructionNotifier; - struct ID3DInclude; -} - -namespace REX::W32 -{ - enum D3D_CBUFFER_TYPE - { - D3D_CT_CBUFFER = 0, - D3D_CT_TBUFFER = (D3D_CT_CBUFFER + 1), - D3D_CT_INTERFACE_POINTERS = (D3D_CT_TBUFFER + 1), - D3D_CT_RESOURCE_BIND_INFO = (D3D_CT_INTERFACE_POINTERS + 1), - D3D10_CT_CBUFFER = D3D_CT_CBUFFER, - D3D10_CT_TBUFFER = D3D_CT_TBUFFER, - D3D11_CT_CBUFFER = D3D_CT_CBUFFER, - D3D11_CT_TBUFFER = D3D_CT_TBUFFER, - D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS, - D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO, - }; - - enum D3D_DRIVER_TYPE - { - D3D_DRIVER_TYPE_UNKNOWN = 0, - D3D_DRIVER_TYPE_HARDWARE = (D3D_DRIVER_TYPE_UNKNOWN + 1), - D3D_DRIVER_TYPE_REFERENCE = (D3D_DRIVER_TYPE_HARDWARE + 1), - D3D_DRIVER_TYPE_NULL = (D3D_DRIVER_TYPE_REFERENCE + 1), - D3D_DRIVER_TYPE_SOFTWARE = (D3D_DRIVER_TYPE_NULL + 1), - D3D_DRIVER_TYPE_WARP = (D3D_DRIVER_TYPE_SOFTWARE + 1), - }; - - enum D3D_FEATURE_LEVEL - { - D3D_FEATURE_LEVEL_1_0_CORE = 0x1000, - D3D_FEATURE_LEVEL_9_1 = 0x9100, - D3D_FEATURE_LEVEL_9_2 = 0x9200, - D3D_FEATURE_LEVEL_9_3 = 0x9300, - D3D_FEATURE_LEVEL_10_0 = 0xA000, - D3D_FEATURE_LEVEL_10_1 = 0xA100, - D3D_FEATURE_LEVEL_11_0 = 0xB000, - D3D_FEATURE_LEVEL_11_1 = 0xB100, - D3D_FEATURE_LEVEL_12_0 = 0xC000, - D3D_FEATURE_LEVEL_12_1 = 0xC100, - D3D_FEATURE_LEVEL_12_2 = 0xC200, - }; - - enum D3D_INCLUDE_TYPE - { - D3D_INCLUDE_LOCAL = 0, - D3D_INCLUDE_SYSTEM = (D3D_INCLUDE_LOCAL + 1), - D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL, - D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM, - D3D_INCLUDE_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_INTERPOLATION_MODE - { - D3D_INTERPOLATION_UNDEFINED = 0, - D3D_INTERPOLATION_CONSTANT = 1, - D3D_INTERPOLATION_LINEAR = 2, - D3D_INTERPOLATION_LINEAR_CENTROID = 3, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5, - D3D_INTERPOLATION_LINEAR_SAMPLE = 6, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, - }; - - enum D3D_MIN_PRECISION - { - D3D_MIN_PRECISION_DEFAULT = 0, - D3D_MIN_PRECISION_FLOAT_16 = 1, - D3D_MIN_PRECISION_FLOAT_2_8 = 2, - D3D_MIN_PRECISION_RESERVED = 3, - D3D_MIN_PRECISION_SINT_16 = 4, - D3D_MIN_PRECISION_UINT_16 = 5, - D3D_MIN_PRECISION_ANY_16 = 0xF0, - D3D_MIN_PRECISION_ANY_10 = 0xF1, - }; - - enum D3D_NAME - { - D3D_NAME_UNDEFINED = 0, - D3D_NAME_POSITION = 1, - D3D_NAME_CLIP_DISTANCE = 2, - D3D_NAME_CULL_DISTANCE = 3, - D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, - D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, - D3D_NAME_VERTEX_ID = 6, - D3D_NAME_PRIMITIVE_ID = 7, - D3D_NAME_INSTANCE_ID = 8, - D3D_NAME_IS_FRONT_FACE = 9, - D3D_NAME_SAMPLE_INDEX = 10, - D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, - D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, - D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, - D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, - D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, - D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, - D3D_NAME_BARYCENTRICS = 23, - D3D_NAME_SHADINGRATE = 24, - D3D_NAME_CULLPRIMITIVE = 25, - D3D_NAME_TARGET = 64, - D3D_NAME_DEPTH = 65, - D3D_NAME_COVERAGE = 66, - D3D_NAME_DEPTH_GREATER_EQUAL = 67, - D3D_NAME_DEPTH_LESS_EQUAL = 68, - D3D_NAME_STENCIL_REF = 69, - D3D_NAME_INNER_COVERAGE = 70, - D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED, - D3D10_NAME_POSITION = D3D_NAME_POSITION, - D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE, - D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE, - D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX, - D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX, - D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID, - D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID, - D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID, - D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE, - D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX, - D3D10_NAME_TARGET = D3D_NAME_TARGET, - D3D10_NAME_DEPTH = D3D_NAME_DEPTH, - D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE, - D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR, - D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, - D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR, - D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR, - D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR, - D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR, - D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL, - D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL, - D3D11_NAME_STENCIL_REF = D3D_NAME_STENCIL_REF, - D3D11_NAME_INNER_COVERAGE = D3D_NAME_INNER_COVERAGE, - D3D12_NAME_BARYCENTRICS = D3D_NAME_BARYCENTRICS, - D3D12_NAME_SHADINGRATE = D3D_NAME_SHADINGRATE, - D3D12_NAME_CULLPRIMITIVE = D3D_NAME_CULLPRIMITIVE, - }; - - enum D3D_PARAMETER_FLAGS - { - D3D_PF_NONE = 0, - D3D_PF_IN = 0x1, - D3D_PF_OUT = 0x2, - D3D_PF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_PRIMITIVE - { - D3D_PRIMITIVE_UNDEFINED = 0, - D3D_PRIMITIVE_POINT = 1, - D3D_PRIMITIVE_LINE = 2, - D3D_PRIMITIVE_TRIANGLE = 3, - D3D_PRIMITIVE_LINE_ADJ = 6, - D3D_PRIMITIVE_TRIANGLE_ADJ = 7, - D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, - D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, - D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, - D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, - D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, - D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, - D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, - D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, - D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, - D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, - D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, - D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, - D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, - D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, - D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, - D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, - D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, - D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, - D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, - D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 27, - D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 28, - D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 29, - D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 30, - D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 31, - D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 32, - D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 33, - D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 34, - D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 35, - D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 36, - D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 37, - D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 38, - D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 39, - D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED, - D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT, - D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE, - D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE, - D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ, - D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ, - D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED, - D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT, - D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE, - D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE, - D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ, - D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ, - D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH, - }; - - enum D3D_PRIMITIVE_TOPOLOGY - { - D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, - D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, - D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2, - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, - D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, - D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, - D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34, - D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35, - D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36, - D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37, - D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38, - D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39, - D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40, - D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41, - D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42, - D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43, - D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44, - D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45, - D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46, - D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47, - D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48, - D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49, - D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50, - D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51, - D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52, - D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53, - D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54, - D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55, - D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56, - D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57, - D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58, - D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59, - D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60, - D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61, - D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62, - D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63, - D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64, - D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, - D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST, - D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST, - D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, - D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, - D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, - D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST, - D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST, - D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, - D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, - }; - - enum D3D_REGISTER_COMPONENT_TYPE - { - D3D_REGISTER_COMPONENT_UNKNOWN = 0, - D3D_REGISTER_COMPONENT_UINT32 = 1, - D3D_REGISTER_COMPONENT_SINT32 = 2, - D3D_REGISTER_COMPONENT_FLOAT32 = 3, - D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN, - D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32, - D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32, - D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32, - }; - - enum D3D_RESOURCE_RETURN_TYPE - { - D3D_RETURN_TYPE_UNORM = 1, - D3D_RETURN_TYPE_SNORM = 2, - D3D_RETURN_TYPE_SINT = 3, - D3D_RETURN_TYPE_UINT = 4, - D3D_RETURN_TYPE_FLOAT = 5, - D3D_RETURN_TYPE_MIXED = 6, - D3D_RETURN_TYPE_DOUBLE = 7, - D3D_RETURN_TYPE_CONTINUED = 8, - D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM, - D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM, - D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT, - D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT, - D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT, - D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED, - D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM, - D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM, - D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT, - D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT, - D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT, - D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED, - D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE, - D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED, - }; - - enum D3D_SHADER_CBUFFER_FLAGS - { - D3D_CBF_USERPACKED = 1, - D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED, - D3D_CBF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_INPUT_FLAGS - { - D3D_SIF_USERPACKED = 0x1, - D3D_SIF_COMPARISON_SAMPLER = 0x2, - D3D_SIF_TEXTURE_COMPONENT_0 = 0x4, - D3D_SIF_TEXTURE_COMPONENT_1 = 0x8, - D3D_SIF_TEXTURE_COMPONENTS = 0xc, - D3D_SIF_UNUSED = 0x10, - D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED, - D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER, - D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0, - D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1, - D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS, - D3D_SIF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_INPUT_TYPE - { - D3D_SIT_CBUFFER = 0, - D3D_SIT_TBUFFER = (D3D_SIT_CBUFFER + 1), - D3D_SIT_TEXTURE = (D3D_SIT_TBUFFER + 1), - D3D_SIT_SAMPLER = (D3D_SIT_TEXTURE + 1), - D3D_SIT_UAV_RWTYPED = (D3D_SIT_SAMPLER + 1), - D3D_SIT_STRUCTURED = (D3D_SIT_UAV_RWTYPED + 1), - D3D_SIT_UAV_RWSTRUCTURED = (D3D_SIT_STRUCTURED + 1), - D3D_SIT_BYTEADDRESS = (D3D_SIT_UAV_RWSTRUCTURED + 1), - D3D_SIT_UAV_RWBYTEADDRESS = (D3D_SIT_BYTEADDRESS + 1), - D3D_SIT_UAV_APPEND_STRUCTURED = (D3D_SIT_UAV_RWBYTEADDRESS + 1), - D3D_SIT_UAV_CONSUME_STRUCTURED = (D3D_SIT_UAV_APPEND_STRUCTURED + 1), - D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = (D3D_SIT_UAV_CONSUME_STRUCTURED + 1), - D3D_SIT_RTACCELERATIONSTRUCTURE = (D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER + 1), - D3D_SIT_UAV_FEEDBACKTEXTURE = (D3D_SIT_RTACCELERATIONSTRUCTURE + 1), - D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER, - D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER, - D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE, - D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER, - D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED, - D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED, - D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED, - D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS, - D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS, - D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED, - D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED, - D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, - }; - - enum D3D_SHADER_VARIABLE_CLASS - { - D3D_SVC_SCALAR = 0, - D3D_SVC_VECTOR = (D3D_SVC_SCALAR + 1), - D3D_SVC_MATRIX_ROWS = (D3D_SVC_VECTOR + 1), - D3D_SVC_MATRIX_COLUMNS = (D3D_SVC_MATRIX_ROWS + 1), - D3D_SVC_OBJECT = (D3D_SVC_MATRIX_COLUMNS + 1), - D3D_SVC_STRUCT = (D3D_SVC_OBJECT + 1), - D3D_SVC_INTERFACE_CLASS = (D3D_SVC_STRUCT + 1), - D3D_SVC_INTERFACE_POINTER = (D3D_SVC_INTERFACE_CLASS + 1), - D3D10_SVC_SCALAR = D3D_SVC_SCALAR, - D3D10_SVC_VECTOR = D3D_SVC_VECTOR, - D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS, - D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS, - D3D10_SVC_OBJECT = D3D_SVC_OBJECT, - D3D10_SVC_STRUCT = D3D_SVC_STRUCT, - D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS, - D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER, - D3D_SVC_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_VARIABLE_FLAGS - { - D3D_SVF_USERPACKED = 1, - D3D_SVF_USED = 2, - D3D_SVF_INTERFACE_POINTER = 4, - D3D_SVF_INTERFACE_PARAMETER = 8, - D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED, - D3D10_SVF_USED = D3D_SVF_USED, - D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER, - D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER, - D3D_SVF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_VARIABLE_TYPE - { - D3D_SVT_VOID = 0, - D3D_SVT_BOOL = 1, - D3D_SVT_INT = 2, - D3D_SVT_FLOAT = 3, - D3D_SVT_STRING = 4, - D3D_SVT_TEXTURE = 5, - D3D_SVT_TEXTURE1D = 6, - D3D_SVT_TEXTURE2D = 7, - D3D_SVT_TEXTURE3D = 8, - D3D_SVT_TEXTURECUBE = 9, - D3D_SVT_SAMPLER = 10, - D3D_SVT_SAMPLER1D = 11, - D3D_SVT_SAMPLER2D = 12, - D3D_SVT_SAMPLER3D = 13, - D3D_SVT_SAMPLERCUBE = 14, - D3D_SVT_PIXELSHADER = 15, - D3D_SVT_VERTEXSHADER = 16, - D3D_SVT_PIXELFRAGMENT = 17, - D3D_SVT_VERTEXFRAGMENT = 18, - D3D_SVT_UINT = 19, - D3D_SVT_UINT8 = 20, - D3D_SVT_GEOMETRYSHADER = 21, - D3D_SVT_RASTERIZER = 22, - D3D_SVT_DEPTHSTENCIL = 23, - D3D_SVT_BLEND = 24, - D3D_SVT_BUFFER = 25, - D3D_SVT_CBUFFER = 26, - D3D_SVT_TBUFFER = 27, - D3D_SVT_TEXTURE1DARRAY = 28, - D3D_SVT_TEXTURE2DARRAY = 29, - D3D_SVT_RENDERTARGETVIEW = 30, - D3D_SVT_DEPTHSTENCILVIEW = 31, - D3D_SVT_TEXTURE2DMS = 32, - D3D_SVT_TEXTURE2DMSARRAY = 33, - D3D_SVT_TEXTURECUBEARRAY = 34, - D3D_SVT_HULLSHADER = 35, - D3D_SVT_DOMAINSHADER = 36, - D3D_SVT_INTERFACE_POINTER = 37, - D3D_SVT_COMPUTESHADER = 38, - D3D_SVT_DOUBLE = 39, - D3D_SVT_RWTEXTURE1D = 40, - D3D_SVT_RWTEXTURE1DARRAY = 41, - D3D_SVT_RWTEXTURE2D = 42, - D3D_SVT_RWTEXTURE2DARRAY = 43, - D3D_SVT_RWTEXTURE3D = 44, - D3D_SVT_RWBUFFER = 45, - D3D_SVT_BYTEADDRESS_BUFFER = 46, - D3D_SVT_RWBYTEADDRESS_BUFFER = 47, - D3D_SVT_STRUCTURED_BUFFER = 48, - D3D_SVT_RWSTRUCTURED_BUFFER = 49, - D3D_SVT_APPEND_STRUCTURED_BUFFER = 50, - D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51, - D3D_SVT_MIN8FLOAT = 52, - D3D_SVT_MIN10FLOAT = 53, - D3D_SVT_MIN16FLOAT = 54, - D3D_SVT_MIN12INT = 55, - D3D_SVT_MIN16INT = 56, - D3D_SVT_MIN16UINT = 57, - D3D_SVT_INT16 = 58, - D3D_SVT_UINT16 = 59, - D3D_SVT_FLOAT16 = 60, - D3D_SVT_INT64 = 61, - D3D_SVT_UINT64 = 62, - D3D10_SVT_VOID = D3D_SVT_VOID, - D3D10_SVT_BOOL = D3D_SVT_BOOL, - D3D10_SVT_INT = D3D_SVT_INT, - D3D10_SVT_FLOAT = D3D_SVT_FLOAT, - D3D10_SVT_STRING = D3D_SVT_STRING, - D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE, - D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D, - D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D, - D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D, - D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE, - D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER, - D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D, - D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D, - D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D, - D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE, - D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER, - D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER, - D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT, - D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT, - D3D10_SVT_UINT = D3D_SVT_UINT, - D3D10_SVT_UINT8 = D3D_SVT_UINT8, - D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER, - D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER, - D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL, - D3D10_SVT_BLEND = D3D_SVT_BLEND, - D3D10_SVT_BUFFER = D3D_SVT_BUFFER, - D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER, - D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER, - D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY, - D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY, - D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW, - D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW, - D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS, - D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY, - D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY, - D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER, - D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER, - D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER, - D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER, - D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE, - D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D, - D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY, - D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D, - D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY, - D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D, - D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER, - D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER, - D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER, - D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER, - D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER, - D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER, - D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER, - D3D_SVT_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SRV_DIMENSION - { - D3D_SRV_DIMENSION_UNKNOWN = 0, - D3D_SRV_DIMENSION_BUFFER = 1, - D3D_SRV_DIMENSION_TEXTURE1D = 2, - D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3, - D3D_SRV_DIMENSION_TEXTURE2D = 4, - D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5, - D3D_SRV_DIMENSION_TEXTURE2DMS = 6, - D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D_SRV_DIMENSION_TEXTURE3D = 8, - D3D_SRV_DIMENSION_TEXTURECUBE = 9, - D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10, - D3D_SRV_DIMENSION_BUFFEREX = 11, - D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, - D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, - D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, - D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, - D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, - D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, - D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, - D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, - D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, - D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, - D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, - D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, - D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, - D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, - D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, - D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, - D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, - D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, - D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, - D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, - D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY, - D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, - D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, - D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, - D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, - D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, - D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, - D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, - D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, - D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, - D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, - D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY, - D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX, - }; - - enum D3D_TESSELLATOR_DOMAIN - { - D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0, - D3D_TESSELLATOR_DOMAIN_ISOLINE = 1, - D3D_TESSELLATOR_DOMAIN_TRI = 2, - D3D_TESSELLATOR_DOMAIN_QUAD = 3, - D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED, - D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE, - D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI, - D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD, - }; - - enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE - { - D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0, - D3D_TESSELLATOR_OUTPUT_POINT = 1, - D3D_TESSELLATOR_OUTPUT_LINE = 2, - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3, - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4, - D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED, - D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT, - D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE, - D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, - D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, - }; - - enum D3D_TESSELLATOR_PARTITIONING - { - D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0, - D3D_TESSELLATOR_PARTITIONING_INTEGER = 1, - D3D_TESSELLATOR_PARTITIONING_POW2 = 2, - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3, - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4, - D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED, - D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER, - D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2, - D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, - D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, - }; -} - -namespace REX::W32 -{ - using D3DCOLOR = std::uint32_t; - - struct D3DRECT - { - std::int32_t x1; - std::int32_t y1; - std::int32_t x2; - std::int32_t y2; - }; - - struct D3DVECTOR - { - float x; - float y; - float z; - }; - - struct D3D_SHADER_MACRO - { - const char* name; - const char* definition; - }; - - struct XMFLOAT4X4 - { - float m[4][4]; - }; - static_assert(sizeof(XMFLOAT4X4) == 0x40); -} - -namespace REX::W32 -{ - using PFN_DESTRUCTION_CALLBACK = void(__stdcall*)(void* a_data); -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("8BA5FB08-5195-40e2-AC58-0D989C3A0102")) - ID3DBlob : public IUnknown - { - virtual void* GetBufferPointer(void) = 0; - virtual std::size_t GetBufferSize(void) = 0; - }; - - struct __declspec(novtable, uuid("A06EB39A-50DA-425B-8C31-4EECD6C270F3")) - ID3DDestructionNotifier : public IUnknown - { - virtual HRESULT RegisterDestructionCallback(PFN_DESTRUCTION_CALLBACK a_callbackFn, void* a_data, std::uint32_t* a_callbackID) = 0; - virtual HRESULT UnregisterDestructionCallback(std::uint32_t a_callbackID) = 0; - }; - - struct __declspec(novtable) // uuid(?) - ID3DInclude : public IUnknown - { - virtual HRESULT Open(D3D_INCLUDE_TYPE a_includeType, const char* a_fileName, const void* a_parentData, const void** a_data, std::uint32_t* a_bytes) = 0; - virtual HRESULT Close(const void* a_data) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3DBlob{ 0xA06EB39A, 0x50DA, 0x425B, { 0x8C, 0x31, 0x4E, 0xEC, 0xD6, 0xC2, 0x70, 0xF3 } }; - inline constexpr IID IID_ID3DDestructionNotifier{ 0xA06EB39A, 0x50DA, 0x425B, { 0x8C, 0x31, 0x4E, 0xEC, 0xD6, 0xC2, 0x70, 0xF3 } }; -} diff --git a/include/REX/W32/D3D11.h b/include/REX/W32/D3D11.h deleted file mode 100644 index 7efb725..0000000 --- a/include/REX/W32/D3D11.h +++ /dev/null @@ -1,2569 +0,0 @@ -#pragma once - -#include "REX/W32/D3D.h" - -namespace REX::W32 -{ - struct ID3D11Asynchronous; - struct ID3D11AuthenticatedChannel; - struct ID3D11BlendState; - struct ID3D11Buffer; - struct ID3D11ClassInstance; - struct ID3D11ClassLinkage; - struct ID3D11CommandList; - struct ID3D11ComputeShader; - struct ID3D11Counter; - struct ID3D11CryptoSession; - struct ID3D11Device; - struct ID3D11DeviceChild; - struct ID3D11DeviceContext; - struct ID3D11DepthStencilState; - struct ID3D11DepthStencilView; - struct ID3D11DomainShader; - struct ID3D11GeometryShader; - struct ID3D11HullShader; - struct ID3D11InputLayout; - struct ID3D11PixelShader; - struct ID3D11Predicate; - struct ID3D11Query; - struct ID3D11RasterizerState; - struct ID3D11RenderTargetView; - struct ID3D11Resource; - struct ID3D11SamplerState; - struct ID3D11ShaderResourceView; - struct ID3D11Texture1D; - struct ID3D11Texture2D; - struct ID3D11Texture3D; - struct ID3D11UnorderedAccessView; - struct ID3D11VertexShader; - struct ID3D11VideoContext; - struct ID3D11VideoDecoder; - struct ID3D11VideoDecoderOutputView; - struct ID3D11VideoDevice; - struct ID3D11VideoProcessor; - struct ID3D11VideoProcessorEnumerator; - struct ID3D11VideoProcessorInputView; - struct ID3D11VideoProcessorOutputView; - struct ID3D11View; -} - -namespace REX::W32 -{ - inline constexpr auto D3D11_16BIT_INDEX_STRIP_CUT_VALUE{ 0xffff }; - - inline constexpr auto D3D11_32BIT_INDEX_STRIP_CUT_VALUE{ 0xffffffff }; - - inline constexpr auto D3D11_8BIT_INDEX_STRIP_CUT_VALUE{ 0xff }; - - inline constexpr auto D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT{ 9 }; - - inline constexpr auto D3D11_CLIP_OR_CULL_DISTANCE_COUNT{ 8 }; - inline constexpr auto D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT{ 2 }; - - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT{ 14 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT{ 15 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT{ 16 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT{ 15 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT{ 64 }; - - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT{ 128 }; - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT{ 128 }; - - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT{ 16 }; - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT{ 16 }; - - inline constexpr auto D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT{ 32 }; - - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_COUNT{ 4096 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST{ 3 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS{ 3 }; - - inline constexpr auto D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX{ 10 }; - inline constexpr auto D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN{ -10 }; - - inline constexpr auto D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE{ -8 }; - inline constexpr auto D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE{ 7 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 256 }; - inline constexpr auto D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP{ 64 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 240 }; - inline constexpr auto D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP{ 68 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 224 }; - inline constexpr auto D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP{ 72 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 208 }; - inline constexpr auto D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP{ 76 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 192 }; - inline constexpr auto D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP{ 84 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 176 }; - inline constexpr auto D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP{ 92 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 160 }; - inline constexpr auto D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP{ 100 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 144 }; - inline constexpr auto D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP{ 112 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 128 }; - inline constexpr auto D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP{ 128 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 112 }; - inline constexpr auto D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP{ 144 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 96 }; - inline constexpr auto D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP{ 168 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 80 }; - inline constexpr auto D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP{ 204 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 64 }; - inline constexpr auto D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP{ 256 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 48 }; - inline constexpr auto D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP{ 340 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 32 }; - inline constexpr auto D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP{ 512 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 16 }; - inline constexpr auto D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP{ 768 }; - - inline constexpr auto D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION{ 1 }; - - inline constexpr auto D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT{ 256 }; - - inline constexpr auto D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP{ 768 }; - inline constexpr auto D3D11_CS_4_X_THREAD_GROUP_MAX_X{ 768 }; - inline constexpr auto D3D11_CS_4_X_THREAD_GROUP_MAX_Y{ 768 }; - - inline constexpr auto D3D11_CS_4_X_UAV_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION{ 65535 }; - - inline constexpr auto D3D11_CS_TGSM_REGISTER_COUNT{ 8192 }; - inline constexpr auto D3D11_CS_TGSM_REGISTER_READS_PER_INST{ 1 }; - - inline constexpr auto D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_CS_THREADGROUPID_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_CS_THREADGROUPID_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREADIDINGROUP_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_CS_THREADIDINGROUP_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREADID_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_CS_THREADID_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP{ 1024 }; - - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_X{ 1024 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_Y{ 1024 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_Z{ 64 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MIN_X{ 1 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MIN_Y{ 1 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MIN_Z{ 1 }; - - inline constexpr auto D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL{ 16384 }; - - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_ALPHA{ 1.0f }; - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_BLUE{ 1.0f }; - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_GREEN{ 1.0f }; - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_RED{ 1.0f }; - - inline constexpr auto D3D11_DEFAULT_BORDER_COLOR_COMPONENT{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_DEPTH_BIAS{ 0 }; - inline constexpr auto D3D11_DEFAULT_DEPTH_BIAS_CLAMP{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_MAX_ANISOTROPY{ 16 }; - - inline constexpr auto D3D11_DEFAULT_MIP_LOD_BIAS{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX{ 0 }; - - inline constexpr auto D3D11_DEFAULT_SAMPLE_MASK{ 0xffffffff }; - - inline constexpr auto D3D11_DEFAULT_SCISSOR_ENDX{ 0 }; - inline constexpr auto D3D11_DEFAULT_SCISSOR_ENDY{ 0 }; - inline constexpr auto D3D11_DEFAULT_SCISSOR_STARTX{ 0 }; - inline constexpr auto D3D11_DEFAULT_SCISSOR_STARTY{ 0 }; - - inline constexpr auto D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_STENCIL_READ_MASK{ 0xff }; - inline constexpr auto D3D11_DEFAULT_STENCIL_REFERENCE{ 0 }; - inline constexpr auto D3D11_DEFAULT_STENCIL_WRITE_MASK{ 0xff }; - - inline constexpr auto D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_HEIGHT{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_MAX_DEPTH{ 0.0f }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_MIN_DEPTH{ 0.0f }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_TOPLEFTX{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_TOPLEFTY{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_WIDTH{ 0 }; - - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS{ 3968 }; - - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP{ 0.6 }; - - inline constexpr auto D3D11_FLOAT32_MAX{ 3.402823466e+38f }; - inline constexpr auto D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP{ 0.6f }; - - inline constexpr auto D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR{ 2.4f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR{ 1.0f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_OFFSET{ 0.055f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_SCALE_1{ 12.92f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_SCALE_2{ 1.055f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_THRESHOLD{ 0.0031308f }; - - inline constexpr auto D3D11_FTOI_INSTRUCTION_MAX_INPUT{ 2147483647.999f }; - inline constexpr auto D3D11_FTOI_INSTRUCTION_MIN_INPUT{ -2147483648.999f }; - - inline constexpr auto D3D11_FTOU_INSTRUCTION_MAX_INPUT{ 4294967295.999f }; - inline constexpr auto D3D11_FTOU_INSTRUCTION_MIN_INPUT{ 0.0f }; - - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_GS_INPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_READ_PORTS{ 1 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_VERTICES{ 32 }; - - inline constexpr auto D3D11_GS_MAX_INSTANCE_COUNT{ 32 }; - - inline constexpr auto D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES{ 1024 }; - - inline constexpr auto D3D11_GS_OUTPUT_ELEMENTS{ 32 }; - - inline constexpr auto D3D11_GS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND{ 0xffffffff }; - - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND{ 0xffffffff }; - - inline constexpr auto D3D11_HS_MAXTESSFACTOR_LOWER_BOUND{ 1.0f }; - inline constexpr auto D3D11_HS_MAXTESSFACTOR_UPPER_BOUND{ 64.0f }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS{ 3968 }; - - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS{ 1 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS{ 128 }; - - inline constexpr auto D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES{ 0 }; - - inline constexpr auto D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY{ 0 }; - - inline constexpr auto D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES{ 0 }; - - inline constexpr auto D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT{ 1 }; - - inline constexpr auto D3D11_IA_INSTANCE_ID_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_PRIMITIVE_ID_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_VERTEX_ID_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS{ 128 }; - inline constexpr auto D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT{ 32 }; - - inline constexpr auto D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT{ 0xffffffff }; - inline constexpr auto D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER{ 0xffffffff }; - - inline constexpr auto D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL{ 0xffffffff }; - - inline constexpr auto D3D11_KEEP_UNORDERED_ACCESS_VIEWS{ 0xffffffff }; - - inline constexpr auto D3D11_LINEAR_GAMMA{ 1.0f }; - - inline constexpr auto D3D11_MAJOR_VERSION{ 11 }; - - inline constexpr auto D3D11_MAX_BORDER_COLOR_COMPONENT{ 1.0f }; - inline constexpr auto D3D11_MAX_DEPTH{ 1.0f }; - inline constexpr auto D3D11_MAX_MAXANISOTROPY{ 16 }; - inline constexpr auto D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT{ 32 }; - inline constexpr auto D3D11_MAX_POSITION_VALUE{ 3.402823466e+34f }; - inline constexpr auto D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP{ 17 }; - - inline constexpr auto D3D11_MINOR_VERSION{ 0 }; - - inline constexpr auto D3D11_MIN_BORDER_COLOR_COMPONENT{ 0.0f }; - inline constexpr auto D3D11_MIN_DEPTH{ 0.0f }; - inline constexpr auto D3D11_MIN_MAXANISOTROPY{ 0 }; - - inline constexpr auto D3D11_MIP_LOD_BIAS_MAX{ 15.99f }; - inline constexpr auto D3D11_MIP_LOD_BIAS_MIN{ -16.0f }; - inline constexpr auto D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT{ 8 }; - - inline constexpr auto D3D11_MIP_LOD_RANGE_BIT_COUNT{ 8 }; - - inline constexpr auto D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH{ 1.4f }; - inline constexpr auto D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT{ 0 }; - - inline constexpr auto D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT{ 15 }; - - inline constexpr auto D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT{ 16 }; - - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_COUNT{ 8 }; - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_PS_FRONTFACING_DEFAULT_VALUE{ 0xffffffff }; - inline constexpr auto D3D11_PS_FRONTFACING_FALSE_VALUE{ 0 }; - inline constexpr auto D3D11_PS_FRONTFACING_TRUE_VALUE{ 0xffffffff }; - - inline constexpr auto D3D11_PS_INPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT{ 0.0f }; - - inline constexpr auto D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_OUTPUT_MASK_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_OUTPUT_REGISTER_COUNT{ 8 }; - - inline constexpr auto D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT{ 0.5f }; - inline constexpr auto D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT{ 16 }; - - inline constexpr auto D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP{ 27 }; - - inline constexpr auto D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT{ 4096 }; - - inline constexpr auto D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP{ 32 }; - - inline constexpr auto D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP{ 32 }; - - inline constexpr auto D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION{ 16384 }; - - inline constexpr auto D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT{ 1024 }; - - inline constexpr auto D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT{ 4096 }; - - inline constexpr auto D3D11_REQ_MAXANISOTROPY{ 16 }; - - inline constexpr auto D3D11_REQ_MIP_LEVELS{ 15 }; - - inline constexpr auto D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES{ 2048 }; - - inline constexpr auto D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH{ 16384 }; - - inline constexpr auto D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM{ 128 }; - inline constexpr auto D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM{ 0.25f }; - inline constexpr auto D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM{ 2048 }; - - inline constexpr auto D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP{ 20 }; - - inline constexpr auto D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION{ 2048 }; - inline constexpr auto D3D11_REQ_TEXTURE1D_U_DIMENSION{ 16384 }; - inline constexpr auto D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION{ 2048 }; - inline constexpr auto D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION{ 16384 }; - inline constexpr auto D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION{ 2048 }; - - inline constexpr auto D3D11_REQ_TEXTURECUBE_DIMENSION{ 16384 }; - - inline constexpr auto D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL{ 0 }; - - inline constexpr auto D3D11_SHADER_MAJOR_VERSION{ 5 }; - - inline constexpr auto D3D11_SHADER_MAX_INSTANCES{ 65535 }; - inline constexpr auto D3D11_SHADER_MAX_INTERFACES{ 253 }; - inline constexpr auto D3D11_SHADER_MAX_INTERFACE_CALL_SITES{ 4096 }; - inline constexpr auto D3D11_SHADER_MAX_TYPES{ 65535 }; - - inline constexpr auto D3D11_SHADER_MINOR_VERSION{ 0 }; - - inline constexpr auto D3D11_SHIFT_INSTRUCTION_PAD_VALUE{ 0 }; - inline constexpr auto D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT{ 5 }; - - inline constexpr auto D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT{ 8 }; - - inline constexpr auto D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES{ 2048 }; - inline constexpr auto D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES{ 512 }; - inline constexpr auto D3D11_SO_BUFFER_SLOT_COUNT{ 4 }; - inline constexpr auto D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP{ 0xffffffff }; - inline constexpr auto D3D11_SO_NO_RASTERIZED_STREAM{ 0xffffffff }; - inline constexpr auto D3D11_SO_OUTPUT_COMPONENT_COUNT{ 128 }; - inline constexpr auto D3D11_SO_STREAM_COUNT{ 4 }; - - inline constexpr auto D3D11_SPEC_DATE_DAY{ 16 }; - inline constexpr auto D3D11_SPEC_DATE_MONTH{ 05 }; - inline constexpr auto D3D11_SPEC_DATE_YEAR{ 2011 }; - inline constexpr auto D3D11_SPEC_VERSION{ 1.07 }; - - inline constexpr auto D3D11_SRGB_GAMMA{ 2.2f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_DENOMINATOR_1{ 12.92f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_DENOMINATOR_2{ 1.055f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_EXPONENT{ 2.4f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_OFFSET{ 0.055f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_THRESHOLD{ 0.04045f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP{ 0.5f }; - - inline constexpr auto D3D11_STANDARD_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED{ 64 }; - inline constexpr auto D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE{ 4 }; - inline constexpr auto D3D11_STANDARD_PIXEL_COMPONENT_COUNT{ 128 }; - inline constexpr auto D3D11_STANDARD_PIXEL_ELEMENT_COUNT{ 32 }; - inline constexpr auto D3D11_STANDARD_VECTOR_SIZE{ 4 }; - inline constexpr auto D3D11_STANDARD_VERTEX_ELEMENT_COUNT{ 32 }; - inline constexpr auto D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT{ 64 }; - - inline constexpr auto D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT{ 8 }; - inline constexpr auto D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT{ 8 }; - - inline constexpr auto D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR{ 64 }; - inline constexpr auto D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR{ 64 }; - inline constexpr auto D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR{ 63 }; - inline constexpr auto D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR{ 64 }; - inline constexpr auto D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR{ 2 }; - inline constexpr auto D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR{ 1 }; - inline constexpr auto D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR{ 1 }; - - inline constexpr auto D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT{ 16 }; - - inline constexpr auto D3D11_UNBOUND_MEMORY_ACCESS_RESULT{ 0 }; - - inline constexpr auto D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX{ 15 }; - inline constexpr auto D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE{ 16 }; - - inline constexpr auto D3D11_VIEWPORT_BOUNDS_MAX{ 32767 }; - inline constexpr auto D3D11_VIEWPORT_BOUNDS_MIN{ -32768 }; - - inline constexpr auto D3D11_VS_INPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_VS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_VS_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT{ 10 }; - inline constexpr auto D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP{ 25 }; - inline constexpr auto D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP{ 25 }; -} - -namespace REX::W32 -{ - enum D3D11_ASYNC_GETDATA_FLAG - { - D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1, - }; - - enum D3D11_AUTHENTICATED_CHANNEL_TYPE - { - D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1, - D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE = 2, - D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE = 3, - }; - - enum D3D11_BIND_FLAG - { - D3D11_BIND_VERTEX_BUFFER = 0x1L, - D3D11_BIND_INDEX_BUFFER = 0x2L, - D3D11_BIND_CONSTANT_BUFFER = 0x4L, - D3D11_BIND_SHADER_RESOURCE = 0x8L, - D3D11_BIND_STREAM_OUTPUT = 0x10L, - D3D11_BIND_RENDER_TARGET = 0x20L, - D3D11_BIND_DEPTH_STENCIL = 0x40L, - D3D11_BIND_UNORDERED_ACCESS = 0x80L, - D3D11_BIND_DECODER = 0x200L, - D3D11_BIND_VIDEO_ENCODER = 0x400L, - }; - - enum D3D11_BLEND - { - D3D11_BLEND_ZERO = 1, - D3D11_BLEND_ONE = 2, - D3D11_BLEND_SRC_COLOR = 3, - D3D11_BLEND_INV_SRC_COLOR = 4, - D3D11_BLEND_SRC_ALPHA = 5, - D3D11_BLEND_INV_SRC_ALPHA = 6, - D3D11_BLEND_DEST_ALPHA = 7, - D3D11_BLEND_INV_DEST_ALPHA = 8, - D3D11_BLEND_DEST_COLOR = 9, - D3D11_BLEND_INV_DEST_COLOR = 10, - D3D11_BLEND_SRC_ALPHA_SAT = 11, - D3D11_BLEND_BLEND_FACTOR = 14, - D3D11_BLEND_INV_BLEND_FACTOR = 15, - D3D11_BLEND_SRC1_COLOR = 16, - D3D11_BLEND_INV_SRC1_COLOR = 17, - D3D11_BLEND_SRC1_ALPHA = 18, - D3D11_BLEND_INV_SRC1_ALPHA = 19, - }; - - enum D3D11_BLEND_OP - { - D3D11_BLEND_OP_ADD = 1, - D3D11_BLEND_OP_SUBTRACT = 2, - D3D11_BLEND_OP_REV_SUBTRACT = 3, - D3D11_BLEND_OP_MIN = 4, - D3D11_BLEND_OP_MAX = 5, - }; - - enum D3D11_BUFFER_UAV_FLAG - { - D3D11_BUFFER_UAV_FLAG_RAW = 0x1, - D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, - D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4, - }; - - enum D3D11_BUFFEREX_SRV_FLAG - { - D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1, - }; - - enum D3D11_CLEAR_FLAG - { - D3D11_CLEAR_DEPTH = 0x1L, - D3D11_CLEAR_STENCIL = 0x2L, - }; - - enum D3D11_COLOR_WRITE_ENABLE - { - D3D11_COLOR_WRITE_ENABLE_RED = 1, - D3D11_COLOR_WRITE_ENABLE_GREEN = 2, - D3D11_COLOR_WRITE_ENABLE_BLUE = 4, - D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, - D3D11_COLOR_WRITE_ENABLE_ALL = (((D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN) | D3D11_COLOR_WRITE_ENABLE_BLUE) | D3D11_COLOR_WRITE_ENABLE_ALPHA), - }; - - enum D3D11_COMPARISON_FUNC - { - D3D11_COMPARISON_NEVER = 1, - D3D11_COMPARISON_LESS = 2, - D3D11_COMPARISON_EQUAL = 3, - D3D11_COMPARISON_LESS_EQUAL = 4, - D3D11_COMPARISON_GREATER = 5, - D3D11_COMPARISON_NOT_EQUAL = 6, - D3D11_COMPARISON_GREATER_EQUAL = 7, - D3D11_COMPARISON_ALWAYS = 8, - }; - - enum D3D11_CONTENT_PROTECTION_CAPS - { - D3D11_CONTENT_PROTECTION_CAPS_SOFTWARE = 0x1, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE = 0x2, - D3D11_CONTENT_PROTECTION_CAPS_PROTECTION_ALWAYS_ON = 0x4, - D3D11_CONTENT_PROTECTION_CAPS_PARTIAL_DECRYPTION = 0x8, - D3D11_CONTENT_PROTECTION_CAPS_CONTENT_KEY = 0x10, - D3D11_CONTENT_PROTECTION_CAPS_FRESHEN_SESSION_KEY = 0x20, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK = 0x40, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK_KEY = 0x80, - D3D11_CONTENT_PROTECTION_CAPS_SEQUENTIAL_CTR_IV = 0x100, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPT_SLICEDATA_ONLY = 0x200, - D3D11_CONTENT_PROTECTION_CAPS_DECRYPTION_BLT = 0x400, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECT_UNCOMPRESSED = 0x800, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECTED_MEMORY_PAGEABLE = 0x1000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_TEARDOWN = 0x2000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION = 0x4000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION_MULTI_THREADED = 0x8000, - }; - - enum D3D11_COUNTER - { - D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 - }; - - enum D3D11_COUNTER_TYPE - { - D3D11_COUNTER_TYPE_FLOAT32 = 0, - D3D11_COUNTER_TYPE_UINT16 = (D3D11_COUNTER_TYPE_FLOAT32 + 1), - D3D11_COUNTER_TYPE_UINT32 = (D3D11_COUNTER_TYPE_UINT16 + 1), - D3D11_COUNTER_TYPE_UINT64 = (D3D11_COUNTER_TYPE_UINT32 + 1), - }; - - enum D3D11_CPU_ACCESS_FLAG - { - D3D11_CPU_ACCESS_WRITE = 0x10000L, - D3D11_CPU_ACCESS_READ = 0x20000L, - }; - - enum D3D11_CREATE_DEVICE_FLAG - { - D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1, - D3D11_CREATE_DEVICE_DEBUG = 0x2, - D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4, - D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, - D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20, - D3D11_CREATE_DEVICE_DEBUGGABLE = 0x40, - D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80, - D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100, - D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800, - }; - - enum D3D11_CULL_MODE - { - D3D11_CULL_NONE = 1, - D3D11_CULL_FRONT = 2, - D3D11_CULL_BACK = 3, - }; - - enum D3D11_DEPTH_WRITE_MASK - { - D3D11_DEPTH_WRITE_MASK_ZERO = 0, - D3D11_DEPTH_WRITE_MASK_ALL = 1, - }; - - enum D3D11_DEVICE_CONTEXT_TYPE - { - D3D11_DEVICE_CONTEXT_IMMEDIATE = 0, - D3D11_DEVICE_CONTEXT_DEFERRED = (D3D11_DEVICE_CONTEXT_IMMEDIATE + 1), - }; - - enum D3D11_DSV_DIMENSION - { - D3D11_DSV_DIMENSION_UNKNOWN = 0, - D3D11_DSV_DIMENSION_TEXTURE1D = 1, - D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2, - D3D11_DSV_DIMENSION_TEXTURE2D = 3, - D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4, - D3D11_DSV_DIMENSION_TEXTURE2DMS = 5, - D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, - }; - - enum D3D11_DSV_FLAG - { - D3D11_DSV_READ_ONLY_DEPTH = 0x1L, - D3D11_DSV_READ_ONLY_STENCIL = 0x2L, - }; - - enum D3D11_FEATURE - { - D3D11_FEATURE_THREADING = 0, - D3D11_FEATURE_DOUBLES = (D3D11_FEATURE_THREADING + 1), - D3D11_FEATURE_FORMAT_SUPPORT = (D3D11_FEATURE_DOUBLES + 1), - D3D11_FEATURE_FORMAT_SUPPORT2 = (D3D11_FEATURE_FORMAT_SUPPORT + 1), - D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = (D3D11_FEATURE_FORMAT_SUPPORT2 + 1), - D3D11_FEATURE_D3D11_OPTIONS = (D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS + 1), - D3D11_FEATURE_ARCHITECTURE_INFO = (D3D11_FEATURE_D3D11_OPTIONS + 1), - D3D11_FEATURE_D3D9_OPTIONS = (D3D11_FEATURE_ARCHITECTURE_INFO + 1), - D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = (D3D11_FEATURE_D3D9_OPTIONS + 1), - D3D11_FEATURE_D3D9_SHADOW_SUPPORT = (D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT + 1), - D3D11_FEATURE_D3D11_OPTIONS1 = (D3D11_FEATURE_D3D9_SHADOW_SUPPORT + 1), - D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = (D3D11_FEATURE_D3D11_OPTIONS1 + 1), - D3D11_FEATURE_MARKER_SUPPORT = (D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT + 1), - D3D11_FEATURE_D3D9_OPTIONS1 = (D3D11_FEATURE_MARKER_SUPPORT + 1), - D3D11_FEATURE_D3D11_OPTIONS2 = (D3D11_FEATURE_D3D9_OPTIONS1 + 1), - D3D11_FEATURE_D3D11_OPTIONS3 = (D3D11_FEATURE_D3D11_OPTIONS2 + 1), - D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = (D3D11_FEATURE_D3D11_OPTIONS3 + 1), - D3D11_FEATURE_D3D11_OPTIONS4 = (D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT + 1), - D3D11_FEATURE_SHADER_CACHE = (D3D11_FEATURE_D3D11_OPTIONS4 + 1), - D3D11_FEATURE_D3D11_OPTIONS5 = (D3D11_FEATURE_SHADER_CACHE + 1), - D3D11_FEATURE_DISPLAYABLE = (D3D11_FEATURE_D3D11_OPTIONS5 + 1), - }; - - enum D3D11_FILL_MODE - { - D3D11_FILL_WIREFRAME = 2, - D3D11_FILL_SOLID = 3, - }; - - enum D3D11_FILTER - { - D3D11_FILTER_MIN_MAG_MIP_POINT = 0, - D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, - D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, - D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, - D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, - D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, - D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, - D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, - D3D11_FILTER_ANISOTROPIC = 0x55, - D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, - D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, - D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, - D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, - D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, - D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, - D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, - D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, - D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5, - D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, - D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, - D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, - D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, - D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, - D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, - D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, - D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, - D3D11_FILTER_MINIMUM_ANISOTROPIC = 0x155, - D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, - D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, - D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, - D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, - D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, - D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, - D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, - D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, - D3D11_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, - }; - - enum D3D11_FILTER_TYPE - { - D3D11_FILTER_TYPE_POINT = 0, - D3D11_FILTER_TYPE_LINEAR = 1, - }; - - enum D3D11_FILTER_REDUCTION_TYPE - { - D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, - D3D11_FILTER_REDUCTION_TYPE_COMPARISON = 1, - D3D11_FILTER_REDUCTION_TYPE_MINIMUM = 2, - D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = 3, - }; - - enum D3D11_FORMAT_SUPPORT - { - D3D11_FORMAT_SUPPORT_BUFFER = 0x1, - D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, - D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, - D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, - D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, - D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, - D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, - D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, - D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, - D3D11_FORMAT_SUPPORT_MIP = 0x1000, - D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, - D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, - D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, - D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, - D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, - D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, - D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, - D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, - D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, - D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, - D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000, - D3D11_FORMAT_SUPPORT_DECODER_OUTPUT = 0x8000000, - D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT = 0x10000000, - D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT = 0x20000000, - D3D11_FORMAT_SUPPORT_VIDEO_ENCODER = 0x40000000, - }; - - enum D3D11_FORMAT_SUPPORT2 - { - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, - D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, - D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, - D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, - D3D11_FORMAT_SUPPORT2_TILED = 0x200, - D3D11_FORMAT_SUPPORT2_SHAREABLE = 0x400, - D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, - D3D11_FORMAT_SUPPORT2_DISPLAYABLE = 0x10000, - }; - - enum D3D11_INPUT_CLASSIFICATION - { - D3D11_INPUT_PER_VERTEX_DATA = 0, - D3D11_INPUT_PER_INSTANCE_DATA = 1, - }; - - enum D3D11_MAP - { - D3D11_MAP_READ = 1, - D3D11_MAP_WRITE = 2, - D3D11_MAP_READ_WRITE = 3, - D3D11_MAP_WRITE_DISCARD = 4, - D3D11_MAP_WRITE_NO_OVERWRITE = 5, - }; - - enum D3D11_MAP_FLAG - { - D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L, - }; - - using D3D11_PRIMITIVE = D3D_PRIMITIVE; - using D3D11_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; - - enum D3D11_QUERY - { - D3D11_QUERY_EVENT = 0, - D3D11_QUERY_OCCLUSION = (D3D11_QUERY_EVENT + 1), - D3D11_QUERY_TIMESTAMP = (D3D11_QUERY_OCCLUSION + 1), - D3D11_QUERY_TIMESTAMP_DISJOINT = (D3D11_QUERY_TIMESTAMP + 1), - D3D11_QUERY_PIPELINE_STATISTICS = (D3D11_QUERY_TIMESTAMP_DISJOINT + 1), - D3D11_QUERY_OCCLUSION_PREDICATE = (D3D11_QUERY_PIPELINE_STATISTICS + 1), - D3D11_QUERY_SO_STATISTICS = (D3D11_QUERY_OCCLUSION_PREDICATE + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE = (D3D11_QUERY_SO_STATISTICS + 1), - D3D11_QUERY_SO_STATISTICS_STREAM0 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = (D3D11_QUERY_SO_STATISTICS_STREAM0 + 1), - D3D11_QUERY_SO_STATISTICS_STREAM1 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = (D3D11_QUERY_SO_STATISTICS_STREAM1 + 1), - D3D11_QUERY_SO_STATISTICS_STREAM2 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = (D3D11_QUERY_SO_STATISTICS_STREAM2 + 1), - D3D11_QUERY_SO_STATISTICS_STREAM3 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = (D3D11_QUERY_SO_STATISTICS_STREAM3 + 1), - }; - - enum D3D11_QUERY_MISC_FLAG - { - D3D11_QUERY_MISC_PREDICATEHINT = 0x1, - }; - - enum D3D11_RAISE_FLAG - { - D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L, - }; - - enum D3D11_RESOURCE_DIMENSION - { - D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D11_RESOURCE_DIMENSION_BUFFER = 1, - D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, - D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, - D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4, - }; - - enum D3D11_RESOURCE_MISC_FLAG - { - D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1L, - D3D11_RESOURCE_MISC_SHARED = 0x2L, - D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4L, - D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10L, - D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20L, - D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40L, - D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80L, - D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100L, - D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200L, - D3D11_RESOURCE_MISC_SHARED_NTHANDLE = 0x800L, - D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x1000L, - D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x2000L, - D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000L, - D3D11_RESOURCE_MISC_GUARDED = 0x8000L, - D3D11_RESOURCE_MISC_TILE_POOL = 0x20000L, - D3D11_RESOURCE_MISC_TILED = 0x40000L, - D3D11_RESOURCE_MISC_HW_PROTECTED = 0x80000L, - D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE = 0x100000L, - D3D11_RESOURCE_MISC_SHARED_EXCLUSIVE_WRITER = 0x200000L, - }; - - enum D3D11_RTV_DIMENSION - { - D3D11_RTV_DIMENSION_UNKNOWN = 0, - D3D11_RTV_DIMENSION_BUFFER = 1, - D3D11_RTV_DIMENSION_TEXTURE1D = 2, - D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3, - D3D11_RTV_DIMENSION_TEXTURE2D = 4, - D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_RTV_DIMENSION_TEXTURE2DMS = 6, - D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D11_RTV_DIMENSION_TEXTURE3D = 8, - }; - - using D3D11_SRV_DIMENSION = D3D_SRV_DIMENSION; - - enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS - { - D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xFFFFFFFF, - D3D11_CENTER_MULTISAMPLE_PATTERN = 0xFFFFFFFE, - }; - - enum D3D11_STENCIL_OP - { - D3D11_STENCIL_OP_KEEP = 1, - D3D11_STENCIL_OP_ZERO = 2, - D3D11_STENCIL_OP_REPLACE = 3, - D3D11_STENCIL_OP_INCR_SAT = 4, - D3D11_STENCIL_OP_DECR_SAT = 5, - D3D11_STENCIL_OP_INVERT = 6, - D3D11_STENCIL_OP_INCR = 7, - D3D11_STENCIL_OP_DECR = 8, - }; - - enum D3D11_TEXTURE_ADDRESS_MODE - { - D3D11_TEXTURE_ADDRESS_WRAP = 1, - D3D11_TEXTURE_ADDRESS_MIRROR = 2, - D3D11_TEXTURE_ADDRESS_CLAMP = 3, - D3D11_TEXTURE_ADDRESS_BORDER = 4, - D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5, - }; - - enum D3D11_TEXTURECUBE_FACE - { - D3D11_TEXTURECUBE_FACE_POSITIVE_X = 0, - D3D11_TEXTURECUBE_FACE_NEGATIVE_X = 1, - D3D11_TEXTURECUBE_FACE_POSITIVE_Y = 2, - D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = 3, - D3D11_TEXTURECUBE_FACE_POSITIVE_Z = 4, - D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = 5, - }; - - enum D3D11_UAV_DIMENSION - { - D3D11_UAV_DIMENSION_UNKNOWN = 0, - D3D11_UAV_DIMENSION_BUFFER = 1, - D3D11_UAV_DIMENSION_TEXTURE1D = 2, - D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3, - D3D11_UAV_DIMENSION_TEXTURE2D = 4, - D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_UAV_DIMENSION_TEXTURE3D = 8, - }; - - enum D3D11_USAGE - { - D3D11_USAGE_DEFAULT = 0, - D3D11_USAGE_IMMUTABLE = 1, - D3D11_USAGE_DYNAMIC = 2, - D3D11_USAGE_STAGING = 3, - }; - - enum D3D11_VDOV_DIMENSION - { - D3D11_VDOV_DIMENSION_UNKNOWN = 0, - D3D11_VDOV_DIMENSION_TEXTURE2D = 1, - }; - - enum D3D11_VPIV_DIMENSION - { - D3D11_VPIV_DIMENSION_UNKNOWN = 0, - D3D11_VPIV_DIMENSION_TEXTURE2D = 1, - }; - - enum D3D11_VPOV_DIMENSION - { - D3D11_VPOV_DIMENSION_UNKNOWN = 0, - D3D11_VPOV_DIMENSION_TEXTURE2D = 1, - D3D11_VPOV_DIMENSION_TEXTURE2DARRAY = 2, - }; - - enum D3D11_VIDEO_DECODER_BUFFER_TYPE - { - D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = 0, - D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL = 1, - D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE = 2, - D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL = 3, - D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX = 4, - D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL = 5, - D3D11_VIDEO_DECODER_BUFFER_BITSTREAM = 6, - D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR = 7, - D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN = 8, - }; - - enum D3D11_VIDEO_FRAME_FORMAT - { - D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, - D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, - D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE - { - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_OPAQUE = 0, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_BACKGROUND = 1, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_DESTINATION = 2, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_SOURCE_STREAM = 3, - }; - - enum D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS - { - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DENOISE = 0x1, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DERINGING = 0x2, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_EDGE_ENHANCEMENT = 0x4, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_COLOR_CORRECTION = 0x8, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_FLESH_TONE_MAPPING = 0x10, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_IMAGE_STABILIZATION = 0x20, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_SUPER_RESOLUTION = 0x40, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_ANAMORPHIC_SCALING = 0x80, - }; - - enum D3D11_VIDEO_PROCESSOR_DEVICE_CAPS - { - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_LINEAR_SPACE = 0x1, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_xvYCC = 0x2, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_NOMINAL_RANGE = 0x10, - }; - - enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS - { - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_FILL = 0x1, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_CONSTRICTION = 0x2, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY = 0x4, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_PALETTE = 0x8, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY = 0x10, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_STEREO = 0x20, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION = 0x40, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 = 0x800, - }; - - enum D3D11_VIDEO_PROCESSOR_FILTER - { - D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS = 0, - D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST = 1, - D3D11_VIDEO_PROCESSOR_FILTER_HUE = 2, - D3D11_VIDEO_PROCESSOR_FILTER_SATURATION = 3, - D3D11_VIDEO_PROCESSOR_FILTER_NOISE_REDUCTION = 4, - D3D11_VIDEO_PROCESSOR_FILTER_EDGE_ENHANCEMENT = 5, - D3D11_VIDEO_PROCESSOR_FILTER_ANAMORPHIC_SCALING = 6, - D3D11_VIDEO_PROCESSOR_FILTER_STEREO_ADJUSTMENT = 7, - }; - - enum D3D11_VIDEO_PROCESSOR_FILTER_CAPS - { - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS = 0x1, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST = 0x2, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE = 0x4, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION = 0x8, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_NOISE_REDUCTION = 0x10, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_STEREO_ADJUSTMENT = 0x80, - }; - - enum D3D11_VIDEO_PROCESSOR_FORMAT_CAPS - { - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_INTERLACED = 0x1, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_PROCAMP = 0x2, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY = 0x4, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_PALETTE_INTERLACED = 0x8, - }; - - enum D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT - { - D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = 0x1, - D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = 0x2, - }; - - enum D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS - { - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32 = 0x1, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_22 = 0x2, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2224 = 0x4, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2332 = 0x8, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32322 = 0x10, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_55 = 0x20, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_64 = 0x40, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_87 = 0x80, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_222222222223 = 0x100, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_OTHER = 0x80000000, - }; - - enum D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE - { - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_UNDEFINED = 0, - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235 = 1, - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255 = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_OUTPUT_RATE - { - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_NORMAL = 0, - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_HALF = 1, - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_CUSTOM = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS - { - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20, - }; - - enum D3D11_VIDEO_PROCESSOR_ROTATION - { - D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY = 0, - D3D11_VIDEO_PROCESSOR_ROTATION_90 = 1, - D3D11_VIDEO_PROCESSOR_ROTATION_180 = 2, - D3D11_VIDEO_PROCESSOR_ROTATION_270 = 3, - }; - - enum D3D11_VIDEO_PROCESSOR_STEREO_CAPS - { - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_MONO_OFFSET = 0x1, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_ROW_INTERLEAVED = 0x2, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_COLUMN_INTERLEAVED = 0x4, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_CHECKERBOARD = 0x8, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_FLIP_MODE = 0x10, - }; - - enum D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE - { - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_NONE = 0, - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME0 = 1, - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME1 = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_STEREO_FORMAT - { - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO = 0, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_HORIZONTAL = 1, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_VERTICAL = 2, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_SEPARATE = 3, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO_OFFSET = 4, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_ROW_INTERLEAVED = 5, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_CHECKERBOARD = 7, - }; - - enum D3D11_VIDEO_USAGE - { - D3D11_VIDEO_USAGE_PLAYBACK_NORMAL = 0, - D3D11_VIDEO_USAGE_OPTIMAL_SPEED = 1, - D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = 2, - }; -} - -namespace REX::W32 -{ - using D3D11_RECT = RECT; - - struct D3D11_AES_CTR_IV - { - std::uint64_t iv; - std::uint64_t count; - }; - - struct D3D11_BOX - { - std::uint32_t left; - std::uint32_t top; - std::uint32_t front; - std::uint32_t right; - std::uint32_t bottom; - std::uint32_t back; - }; - - struct D3D11_BUFFER_DESC - { - std::uint32_t byteWidth; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - std::uint32_t structureByteStride; - }; - - struct D3D11_BUFFER_RTV - { - union - { - std::uint32_t firstElement; - std::uint32_t elementOffset; - }; - union - { - std::uint32_t numElements; - std::uint32_t elementWidth; - }; - }; - - struct D3D11_BUFFER_SRV - { - union - { - std::uint32_t firstElement; - std::uint32_t elementOffset; - }; - union - { - std::uint32_t numElements; - std::uint32_t elementWidth; - }; - }; - - struct D3D11_BUFFER_UAV - { - std::uint32_t firstElement; - std::uint32_t numElements; - std::uint32_t flags; - }; - - struct D3D11_BUFFEREX_SRV - { - std::uint32_t firstElement; - std::uint32_t numElements; - std::uint32_t flags; - }; - - struct D3D11_CLASS_INSTANCE_DESC - { - std::uint32_t instanceId; - std::uint32_t instanceIndex; - std::uint32_t typeId; - std::uint32_t constantBuffer; - std::uint32_t baseConstantBufferOffset; - std::uint32_t baseTexture; - std::uint32_t baseSampler; - BOOL created; - }; - - struct D3D11_COUNTER_DESC - { - D3D11_COUNTER counter; - std::uint32_t miscFlags; - }; - - struct D3D11_COUNTER_INFO - { - D3D11_COUNTER lastDeviceDependentCounter; - std::uint32_t numSimultaneousCounters; - std::uint8_t numDetectableParallelUnits; - }; - - struct D3D11_DRAW_INSTANCED_INDIRECT_ARGS - { - std::uint32_t vertexCountPerInstance; - std::uint32_t instanceCount; - std::uint32_t startVertexLocation; - std::uint32_t startInstanceLocation; - }; - - struct D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS - { - std::uint32_t indexCountPerInstance; - std::uint32_t instanceCount; - std::uint32_t startIndexLocation; - std::int32_t baseVertexLocation; - std::uint32_t startInstanceLocation; - }; - - struct D3D11_ENCRYPTED_BLOCK_INFO - { - std::uint32_t numEncryptedBytesAtBeginning; - std::uint32_t numBytesInSkipPattern; - std::uint32_t numBytesInEncryptPattern; - }; - - struct D3D11_INPUT_ELEMENT_DESC - { - const char* semanticName; - std::uint32_t semanticIndex; - DXGI_FORMAT format; - std::uint32_t inputSlot; - std::uint32_t alignedByteOffset; - D3D11_INPUT_CLASSIFICATION inputSlotClass; - std::uint32_t instanceDataStepRate; - }; - - struct D3D11_MAPPED_SUBRESOURCE - { - void* data; - std::uint32_t rowPitch; - std::uint32_t depthPitch; - }; - - struct D3D11_QUERY_DATA_PIPELINE_STATISTICS - { - std::uint64_t iaVertices; - std::uint64_t iaPrimitives; - std::uint64_t vsInvocations; - std::uint64_t gsInvocations; - std::uint64_t gsPrimitives; - std::uint64_t cInvocations; - std::uint64_t cPrimitives; - std::uint64_t psInvocations; - std::uint64_t hsInvocations; - std::uint64_t dsInvocations; - std::uint64_t csInvocations; - }; - - struct D3D11_QUERY_DATA_SO_STATISTICS - { - std::uint64_t numPrimitivesWritten; - std::uint64_t primitivesStorageNeeded; - }; - - struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT - { - std::uint64_t frequency; - BOOL disjoint; - }; - - struct D3D11_QUERY_DESC - { - D3D11_QUERY query; - std::uint32_t miscFlags; - }; - - struct D3D11_RASTERIZER_DESC - { - D3D11_FILL_MODE fillMode; - D3D11_CULL_MODE cullMode; - BOOL frontCounterClockwise; - std::int32_t depthBias; - float depthBiasClamp; - float slopeScaledDepthBias; - BOOL depthClipEnable; - BOOL scissorEnable; - BOOL multisampleEnable; - BOOL antialiasedLineEnable; - }; - - struct D3D11_RENDER_TARGET_BLEND_DESC - { - BOOL blendEnable; - D3D11_BLEND srcBlend; - D3D11_BLEND destBlend; - D3D11_BLEND_OP blendOp; - D3D11_BLEND srcBlendAlpha; - D3D11_BLEND destBlendAlpha; - D3D11_BLEND_OP blendOpAlpha; - std::uint8_t renderTargetWriteMask; - }; - - struct D3D11_BLEND_DESC - { - BOOL alphaToCoverageEnable; - BOOL independentBlendEnable; - D3D11_RENDER_TARGET_BLEND_DESC renderTarget[8]; - }; - - struct D3D11_SO_DECLARATION_ENTRY - { - std::uint32_t stream; - const char* semanticName; - std::uint32_t semanticIndex; - std::uint8_t startComponent; - std::uint8_t componentCount; - std::uint8_t outputSlot; - }; - - struct D3D11_SAMPLER_DESC - { - D3D11_FILTER filter; - D3D11_TEXTURE_ADDRESS_MODE addressU; - D3D11_TEXTURE_ADDRESS_MODE addressV; - D3D11_TEXTURE_ADDRESS_MODE addressW; - float mipLODBias; - std::uint32_t maxAnisotropy; - D3D11_COMPARISON_FUNC comparisonFunc; - float borderColor[4]; - float minLOD; - float maxLOD; - }; - - struct D3D11_SUBRESOURCE_DATA - { - const void* sysMem; - std::uint32_t sysMemPitch; - std::uint32_t sysMemSlicePitch; - }; - - struct D3D11_TEX1D_DSV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX1D_RTV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX1D_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEX1D_UAV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX1D_ARRAY_DSV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX1D_ARRAY_RTV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX1D_ARRAY_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX1D_ARRAY_UAV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_DSV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_RTV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEX2D_UAV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_VDOV - { - std::uint32_t arraySlice; - }; - - struct D3D11_TEX2D_VPIV - { - std::uint32_t mipSlice; - std::uint32_t arraySlice; - }; - - struct D3D11_TEX2D_VPOV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_ARRAY_DSV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_RTV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_UAV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_VPOV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2DMS_DSV - { - std::uint32_t _unusedField_NothingToDefine; - }; - - struct D3D11_TEX2DMS_RTV - { - std::uint32_t _unusedField_NothingToDefine; - }; - - struct D3D11_TEX2DMS_SRV - { - std::uint32_t _unusedField_NothingToDefine; - }; - - struct D3D11_TEX2DMS_ARRAY_DSV - { - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2DMS_ARRAY_RTV - { - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2DMS_ARRAY_SRV - { - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX3D_RTV - { - std::uint32_t mipSlice; - std::uint32_t firstWSlice; - std::uint32_t wSize; - }; - - struct D3D11_TEX3D_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEX3D_UAV - { - std::uint32_t mipSlice; - std::uint32_t firstWSlice; - std::uint32_t wSize; - }; - - struct D3D11_TEXCUBE_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEXCUBE_ARRAY_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t first2DArrayFace; - std::uint32_t numCubes; - }; - - struct D3D11_DEPTH_STENCILOP_DESC - { - D3D11_STENCIL_OP stencilFailOp; - D3D11_STENCIL_OP stencilDepthFailOp; - D3D11_STENCIL_OP stencilPassOp; - D3D11_COMPARISON_FUNC stencilFunc; - }; - - struct D3D11_DEPTH_STENCIL_DESC - { - BOOL depthEnable; - D3D11_DEPTH_WRITE_MASK depthWriteMask; - D3D11_COMPARISON_FUNC depthFunc; - BOOL stencilEnable; - std::uint8_t stencilReadMask; - std::uint8_t stencilWriteMask; - D3D11_DEPTH_STENCILOP_DESC frontFace; - D3D11_DEPTH_STENCILOP_DESC backFace; - }; - - struct D3D11_DEPTH_STENCIL_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_DSV_DIMENSION viewDimension; - std::uint32_t flags; - union - { - D3D11_TEX1D_DSV texture1D; - D3D11_TEX1D_ARRAY_DSV texture1DArray; - D3D11_TEX2D_DSV texture2D; - D3D11_TEX2D_ARRAY_DSV texture2DArray; - D3D11_TEX2DMS_DSV texture2DMS; - D3D11_TEX2DMS_ARRAY_DSV texture2DMSArray; - }; - }; - - struct D3D11_OMAC - { - std::uint8_t omac[16]; - }; - - struct D3D11_AUTHENTICATED_CONFIGURE_OUTPUT - { - D3D11_OMAC omac; - GUID configureType; - HANDLE channel; - std::uint32_t sequenceNumber; - HRESULT returnCode; - }; - - struct D3D11_RENDER_TARGET_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_RTV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_RTV buffer; - D3D11_TEX1D_RTV texture1D; - D3D11_TEX1D_ARRAY_RTV texture1DArray; - D3D11_TEX2D_RTV texture2D; - D3D11_TEX2D_ARRAY_RTV texture2DArray; - D3D11_TEX2DMS_RTV texture2DMS; - D3D11_TEX2DMS_ARRAY_RTV texture2DMSArray; - D3D11_TEX3D_RTV texture3D; - }; - }; - - struct D3D11_SHADER_RESOURCE_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_SRV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_SRV buffer; - D3D11_TEX1D_SRV texture1D; - D3D11_TEX1D_ARRAY_SRV texture1DArray; - D3D11_TEX2D_SRV texture2D; - D3D11_TEX2D_ARRAY_SRV texture2DArray; - D3D11_TEX2DMS_SRV texture2DMS; - D3D11_TEX2DMS_ARRAY_SRV texture2DMSArray; - D3D11_TEX3D_SRV texture3D; - D3D11_TEXCUBE_SRV textureCube; - D3D11_TEXCUBE_ARRAY_SRV textureCubeArray; - D3D11_BUFFEREX_SRV bufferEx; - }; - }; - - struct D3D11_TEXTURE1D_DESC - { - std::uint32_t width; - std::uint32_t mipLevels; - std::uint32_t arraySize; - DXGI_FORMAT format; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - }; - - struct D3D11_TEXTURE2D_DESC - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t mipLevels; - std::uint32_t arraySize; - DXGI_FORMAT format; - DXGI_SAMPLE_DESC sampleDesc; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - }; - - struct D3D11_TEXTURE3D_DESC - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t depth; - std::uint32_t mipLevels; - DXGI_FORMAT format; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - }; - - struct D3D11_UNORDERED_ACCESS_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_UAV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_UAV buffer; - D3D11_TEX1D_UAV texture1D; - D3D11_TEX1D_ARRAY_UAV texture1DArray; - D3D11_TEX2D_UAV texture2D; - D3D11_TEX2D_ARRAY_UAV texture2DArray; - D3D11_TEX3D_UAV texture3D; - }; - }; - - struct D3D11_VIDEO_COLOR_RGBA - { - float r; - float g; - float b; - float a; - }; - - struct D3D11_VIDEO_COLOR_YCbCrA - { - float y; - float cb; - float cr; - float a; - }; - - struct D3D11_VIDEO_COLOR - { - union - { - D3D11_VIDEO_COLOR_YCbCrA ycbcr; - D3D11_VIDEO_COLOR_RGBA rgba; - }; - }; - - struct D3D11_VIDEO_CONTENT_PROTECTION_CAPS - { - std::uint32_t caps; - std::uint32_t keyExchangeTypeCount; - std::uint32_t blockAlignmentSize; - std::uint64_t protectedMemorySize; - }; - - struct D3D11_VIDEO_DECODER_BUFFER_DESC - { - D3D11_VIDEO_DECODER_BUFFER_TYPE bufferType; - std::uint32_t bufferIndex; - std::uint32_t dataOffset; - std::uint32_t dataSize; - std::uint32_t firstMBAddress; - std::uint32_t numMBsInBuffer; - std::uint32_t width; - std::uint32_t height; - std::uint32_t stride; - std::uint32_t reservedBits; - void* iv; - std::uint32_t ivSize; - BOOL partialEncryption; - D3D11_ENCRYPTED_BLOCK_INFO encryptedBlockInfo; - }; - - struct D3D11_VIDEO_DECODER_CONFIG - { - GUID guidConfigBitstreamEncryption; - GUID guidConfigMBControlEncryption; - GUID guidConfigResidDiffEncryption; - std::uint32_t configBitstreamRaw; - std::uint32_t configMBControlRasterOrder; - std::uint32_t configResidDiffHost; - std::uint32_t configSpatialResid8; - std::uint32_t configResid8Subtraction; - std::uint32_t configSpatialHost8or9Clipping; - std::uint32_t configSpatialResidInterleaved; - std::uint32_t configIntraResidUnsigned; - std::uint32_t configResidDiffAccelerator; - std::uint32_t configHostInverseScan; - std::uint32_t configSpecificIDCT; - std::uint32_t config4GroupedCoefs; - std::uint16_t configMinRenderTargetBuffCount; - std::uint16_t configDecoderSpecific; - }; - - struct D3D11_VIDEO_DECODER_DESC - { - GUID guid; - std::uint32_t sampleWidth; - std::uint32_t sampleHeight; - DXGI_FORMAT outputFormat; - }; - - struct D3D11_VIDEO_DECODER_EXTENSION - { - std::uint32_t function; - void* privateInputData; - std::uint32_t privateInputDataSize; - void* privateOutputData; - std::uint32_t privateOutputDataSize; - std::uint32_t resourceCount; - ID3D11Resource** resourceList; - }; - - struct D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC - { - GUID decodeProfile; - D3D11_VDOV_DIMENSION viewDimension; - union - { - D3D11_TEX2D_VDOV texture2D; - }; - }; - - struct D3D11_VIDEO_PROCESSOR_CAPS - { - std::uint32_t aeviceCaps; - std::uint32_t featureCaps; - std::uint32_t filterCaps; - std::uint32_t inputFormatCaps; - std::uint32_t autoStreamCaps; - std::uint32_t stereoCaps; - std::uint32_t rateConversionCapsCount; - std::uint32_t maxInputStreams; - std::uint32_t maxStreamStates; - }; - - struct D3D11_VIDEO_PROCESSOR_COLOR_SPACE - { - std::uint32_t usage: 1; - std::uint32_t rgb_Range: 1; - std::uint32_t yCbCr_Matrix: 1; - std::uint32_t yCbCr_xvYCC: 1; - std::uint32_t nominal_Range: 2; - std::uint32_t reserved: 26; - }; - - struct D3D11_VIDEO_PROCESSOR_CONTENT_DESC - { - D3D11_VIDEO_FRAME_FORMAT inputFrameFormat; - DXGI_RATIONAL inputFrameRate; - std::uint32_t inputWidth; - std::uint32_t inputHeight; - DXGI_RATIONAL outputFrameRate; - std::uint32_t outputWidth; - std::uint32_t outputHeight; - D3D11_VIDEO_USAGE usage; - }; - - struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE - { - DXGI_RATIONAL customRate; - std::uint32_t outputFrames; - BOOL inputInterlaced; - std::uint32_t inputFramesOrFields; - }; - - struct D3D11_VIDEO_PROCESSOR_FILTER_RANGE - { - std::int32_t min; - std::int32_t max; - std::int32_t def; - float mult; - }; - - struct D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC - { - std::uint32_t fourCC; - D3D11_VPIV_DIMENSION viewDimension; - union - { - D3D11_TEX2D_VPIV texture2D; - }; - }; - - struct D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC - { - D3D11_VPOV_DIMENSION viewDimension; - union - { - D3D11_TEX2D_VPOV texture2D; - D3D11_TEX2D_ARRAY_VPOV texture2DArray; - }; - }; - - struct D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS - { - std::uint32_t pastFrames; - std::uint32_t futureFrames; - std::uint32_t processorCaps; - std::uint32_t iTelecineCaps; - std::uint32_t customRateCount; - }; - - struct D3D11_VIDEO_PROCESSOR_STREAM - { - BOOL enable; - std::uint32_t outputIndex; - std::uint32_t inputFrameOrField; - std::uint32_t pastFrames; - std::uint32_t futureFrames; - ID3D11VideoProcessorInputView** pastSurfaces; - ID3D11VideoProcessorInputView* inputSurface; - ID3D11VideoProcessorInputView** futureSurfaces; - ID3D11VideoProcessorInputView** pastSurfacesRight; - ID3D11VideoProcessorInputView* inputSurfaceRight; - ID3D11VideoProcessorInputView** futureSurfacesRight; - }; - - struct D3D11_VIEWPORT - { - float topLeftX; - float topLeftY; - float width; - float height; - float minDepth; - float maxDepth; - - friend bool operator==(const D3D11_VIEWPORT& a_lhs, const D3D11_VIEWPORT& a_rhs) - { - return a_lhs.topLeftX == a_rhs.topLeftX && a_lhs.topLeftY == a_rhs.topLeftY && a_lhs.width == a_rhs.width && - a_lhs.height == a_rhs.height && a_lhs.minDepth == a_rhs.minDepth && a_lhs.maxDepth == a_rhs.maxDepth; - } - - friend bool operator!=(const D3D11_VIEWPORT& a_lhs, const D3D11_VIEWPORT& a_rhs) - { - return !(a_lhs == a_rhs); - } - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("db6f6ddb-ac77-4e88-8253-819df9bbf140")) - ID3D11Device : public IUnknown - { - virtual HRESULT CreateBuffer(const D3D11_BUFFER_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Buffer** a_buffer) = 0; - virtual HRESULT CreateTexture1D(const D3D11_TEXTURE1D_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture1D** a_texture1D) = 0; - virtual HRESULT CreateTexture2D(const D3D11_TEXTURE2D_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture2D** a_texture2D) = 0; - virtual HRESULT CreateTexture3D(const D3D11_TEXTURE3D_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture3D** a_texture3D) = 0; - virtual HRESULT CreateShaderResourceView(ID3D11Resource* a_resource, const D3D11_SHADER_RESOURCE_VIEW_DESC* a_desc, ID3D11ShaderResourceView** a_srView) = 0; - virtual HRESULT CreateUnorderedAccessView(ID3D11Resource* a_resource, const D3D11_UNORDERED_ACCESS_VIEW_DESC* a_desc, ID3D11UnorderedAccessView** a_uaView) = 0; - virtual HRESULT CreateRenderTargetView(ID3D11Resource* a_resource, const D3D11_RENDER_TARGET_VIEW_DESC* a_desc, ID3D11RenderTargetView** a_rtView) = 0; - virtual HRESULT CreateDepthStencilView(ID3D11Resource* a_resource, const D3D11_DEPTH_STENCIL_VIEW_DESC* a_desc, ID3D11DepthStencilView** a_dsView) = 0; - virtual HRESULT CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC* a_desc, std::uint32_t a_numElements, const void* a_shaderBytecodeWithInputSignature, std::size_t a_bytecodeLength, ID3D11InputLayout** a_inputLayout) = 0; - virtual HRESULT CreateVertexShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11VertexShader** a_vertexShader) = 0; - virtual HRESULT CreateGeometryShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11GeometryShader** a_geometryShader) = 0; - virtual HRESULT CreateGeometryShaderWithStreamOutput(const void* a_shaderBytecode, std::size_t a_bytecodeLength, const D3D11_SO_DECLARATION_ENTRY* a_soDeclaration, std::uint32_t a_numEntries, const std::uint32_t* a_bufferStrides, std::uint32_t a_numStrides, std::uint32_t a_rasterizedStream, ID3D11ClassLinkage* a_classLinkage, ID3D11GeometryShader** a_geometryShader) = 0; - virtual HRESULT CreatePixelShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11PixelShader** a_pixelShader) = 0; - virtual HRESULT CreateHullShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11HullShader** a_hullShader) = 0; - virtual HRESULT CreateDomainShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11DomainShader** a_domainShader) = 0; - virtual HRESULT CreateComputeShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11ComputeShader** a_computeShader) = 0; - virtual HRESULT CreateClassLinkage(ID3D11ClassLinkage** a_classLinkage) = 0; - virtual HRESULT CreateBlendState(const D3D11_BLEND_DESC* a_blendStateDesc, ID3D11BlendState** a_blendState) = 0; - virtual HRESULT CreateDepthStencilState(const D3D11_DEPTH_STENCIL_DESC* a_depthStencilDesc, ID3D11DepthStencilState** a_depthStencilState) = 0; - virtual HRESULT CreateRasterizerState(const D3D11_RASTERIZER_DESC* a_rasterizerDesc, ID3D11RasterizerState** a_rasterizerState) = 0; - virtual HRESULT CreateSamplerState(const D3D11_SAMPLER_DESC* a_samplerDesc, ID3D11SamplerState** a_samplerState) = 0; - virtual HRESULT CreateQuery(const D3D11_QUERY_DESC* a_queryDesc, ID3D11Query** a_query) = 0; - virtual HRESULT CreatePredicate(const D3D11_QUERY_DESC* a_predicateDesc, ID3D11Predicate** a_predicate) = 0; - virtual HRESULT CreateCounter(const D3D11_COUNTER_DESC* a_counterDesc, ID3D11Counter** a_counter) = 0; - virtual HRESULT CreateDeferredContext(std::uint32_t a_contextFlags, ID3D11DeviceContext** a_deferredContext) = 0; - virtual HRESULT OpenSharedResource(HANDLE a_resourceHandle, const IID& a_returnedInterface, void** a_resource) = 0; - virtual HRESULT CheckFormatSupport(DXGI_FORMAT a_format, std::uint32_t* a_formatSupport) = 0; - virtual HRESULT CheckMultisampleQualityLevels(DXGI_FORMAT a_format, std::uint32_t a_sampleCount, std::uint32_t* a_numQualityLevels) = 0; - virtual void CheckCounterInfo(D3D11_COUNTER_INFO* a_counterInfo) = 0; - virtual HRESULT CheckCounter(const D3D11_COUNTER_DESC* a_desc, D3D11_COUNTER_TYPE* a_type, std::uint32_t* a_activeCounters, char* a_name, std::uint32_t* a_nameLength, char* a_units, std::uint32_t* a_unitsLength, char* a_description, std::uint32_t* a_descriptionLength) = 0; - virtual HRESULT CheckFeatureSupport(D3D11_FEATURE a_feature, void* a_featureSupportData, std::uint32_t a_featureSupportDataSize) = 0; - virtual HRESULT GetPrivateData(const GUID& a_guid, std::uint32_t* a_dataSize, void* a_data) = 0; - virtual HRESULT SetPrivateData(const GUID& a_guid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_guid, const IUnknown* a_data) = 0; - virtual D3D_FEATURE_LEVEL GetFeatureLevel(void) = 0; - virtual std::uint32_t GetCreationFlags(void) = 0; - virtual HRESULT GetDeviceRemovedReason(void) = 0; - virtual void GetImmediateContext(ID3D11DeviceContext** a_immediateContext) = 0; - virtual HRESULT SetExceptionMode(std::uint32_t a_raiseFlags) = 0; - virtual std::uint32_t GetExceptionMode(void) = 0; - }; - - struct __declspec(novtable, uuid("1841e5c8-16b0-489b-bcc8-44cfb0d5deae")) - ID3D11DeviceChild : public IUnknown - { - virtual void GetDevice(ID3D11Device** a_device) = 0; - virtual HRESULT GetPrivateData(const GUID& a_guid, std::uint32_t* a_dataSize, void* a_data) = 0; - virtual HRESULT SetPrivateData(const GUID& a_guid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_guid, const IUnknown* a_data) = 0; - }; - - struct __declspec(novtable, uuid("c0bfa96c-e089-44fb-8eaf-26f8796190da")) - ID3D11DeviceContext : public ID3D11DeviceChild - { - virtual void VSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void PSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void PSSetShader(ID3D11PixelShader* a_pixelShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void PSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void VSSetShader(ID3D11VertexShader* a_vertexShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void DrawIndexed(std::uint32_t IndexCount, std::uint32_t a_startIndexLocation, std::int32_t a_baseVertexLocation) = 0; - virtual void Draw(std::uint32_t a_vertexCount, std::uint32_t a_startVertexLocation) = 0; - virtual HRESULT Map(ID3D11Resource* a_resource, std::uint32_t a_subResource, D3D11_MAP a_mapType, std::uint32_t a_mapFlags, D3D11_MAPPED_SUBRESOURCE* a_mappedResource) = 0; - virtual void Unmap(ID3D11Resource* a_resource, std::uint32_t a_subResource) = 0; - virtual void PSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void IASetInputLayout(ID3D11InputLayout* a_inputLayout) = 0; - virtual void IASetVertexBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_vertexBuffers, const std::uint32_t* a_strides, const std::uint32_t* a_offsets) = 0; - virtual void IASetIndexBuffer(ID3D11Buffer* a_indexBuffer, DXGI_FORMAT a_format, std::uint32_t a_offset) = 0; - virtual void DrawIndexedInstanced(std::uint32_t a_indexCountPerInstance, std::uint32_t a_instanceCount, std::uint32_t a_startIndexLocation, std::int32_t a_baseVertexLocation, std::uint32_t a_startInstanceLocation) = 0; - virtual void DrawInstanced(std::uint32_t a_vertexCountPerInstance, std::uint32_t a_instanceCount, std::uint32_t a_startVertexLocation, std::uint32_t a_startInstanceLocation) = 0; - virtual void GSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void GSSetShader(ID3D11GeometryShader* a_shader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY a_topology) = 0; - virtual void VSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void VSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void Begin(ID3D11Asynchronous* a_async) = 0; - virtual void End(ID3D11Asynchronous* a_async) = 0; - virtual HRESULT GetData(ID3D11Asynchronous* a_async, void* a_data, std::uint32_t a_dataSize, std::uint32_t a_getDataFlags) = 0; - virtual void SetPredication(ID3D11Predicate* a_predicate, BOOL a_predicateValue) = 0; - virtual void GSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void GSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void OMSetRenderTargets(std::uint32_t a_numViews, ID3D11RenderTargetView* const* a_renderTargetViews, ID3D11DepthStencilView* a_depthStencilView) = 0; - virtual void OMSetRenderTargetsAndUnorderedAccessViews(std::uint32_t a_numRTVs, ID3D11RenderTargetView* const* a_renderTargetViews, ID3D11DepthStencilView* a_depthStencilView, std::uint32_t a_uavStartSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView* const* a_unorderedAccessViews, const std::uint32_t* a_uavInitialCounts) = 0; - virtual void OMSetBlendState(ID3D11BlendState* a_blendState, const float a_blendFactor[4], std::uint32_t a_sampleMask) = 0; - virtual void OMSetDepthStencilState(ID3D11DepthStencilState* a_depthStencilState, std::uint32_t a_stencilRef) = 0; - virtual void SOSetTargets(std::uint32_t a_numBuffers, ID3D11Buffer* const* a_soTargets, const std::uint32_t* a_offsets) = 0; - virtual void DrawAuto(void) = 0; - virtual void DrawIndexedInstancedIndirect(ID3D11Buffer* a_bufferForArgs, std::uint32_t a_alignedByteOffsetForArgs) = 0; - virtual void DrawInstancedIndirect(ID3D11Buffer* a_bufferForArgs, std::uint32_t a_alignedByteOffsetForArgs) = 0; - virtual void Dispatch(std::uint32_t a_threadGroupCountX, std::uint32_t a_threadGroupCountY, std::uint32_t a_threadGroupCountZ) = 0; - virtual void DispatchIndirect(ID3D11Buffer* a_bufferForArgs, std::uint32_t a_alignedByteOffsetForArgs) = 0; - virtual void RSSetState(ID3D11RasterizerState* a_rasterizerState) = 0; - virtual void RSSetViewports(std::uint32_t a_numViewports, const D3D11_VIEWPORT* a_viewports) = 0; - virtual void RSSetScissorRects(std::uint32_t a_numRects, const D3D11_RECT* a_rects) = 0; - virtual void CopySubresourceRegion(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, std::uint32_t a_dstX, std::uint32_t a_dstY, std::uint32_t a_dstZ, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, const D3D11_BOX* a_srcBox) = 0; - virtual void CopyResource(ID3D11Resource* a_dstResource, ID3D11Resource* a_srcResource) = 0; - virtual void UpdateSubresource(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, const D3D11_BOX* a_dstBox, const void* a_srcData, std::uint32_t a_srcRowPitch, std::uint32_t a_srcDepthPitch) = 0; - virtual void CopyStructureCount(ID3D11Buffer* a_dstBuffer, std::uint32_t a_dstAlignedByteOffset, ID3D11UnorderedAccessView* a_srcView) = 0; - virtual void ClearRenderTargetView(ID3D11RenderTargetView* a_renderTargetView, const float a_colorRGBA[4]) = 0; - virtual void ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView* a_unorderedAccessView, const std::uint32_t a_values[4]) = 0; - virtual void ClearUnorderedAccessViewFloat(ID3D11UnorderedAccessView* a_unorderedAccessView, const float a_values[4]) = 0; - virtual void ClearDepthStencilView(ID3D11DepthStencilView* a_depthStencilView, std::uint32_t a_clearFlags, float a_depth, std::uint8_t a_stencil) = 0; - virtual void GenerateMips(ID3D11ShaderResourceView* a_shaderResourceView) = 0; - virtual void SetResourceMinLOD(ID3D11Resource* a_resource, float a_minLOD) = 0; - virtual float GetResourceMinLOD(ID3D11Resource* a_resource) = 0; - virtual void ResolveSubresource(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, DXGI_FORMAT a_format) = 0; - virtual void ExecuteCommandList(ID3D11CommandList* a_commandList, BOOL a_restoreContextState) = 0; - virtual void HSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void HSSetShader(ID3D11HullShader* a_hullShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void HSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void HSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void DSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void DSSetShader(ID3D11DomainShader* a_domainShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void DSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void DSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void CSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void CSSetUnorderedAccessViews(std::uint32_t a_startSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView* const* a_unorderedAccessViews, const std::uint32_t* a_uavInitialCounts) = 0; - virtual void CSSetShader(ID3D11ComputeShader* a_computeShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void CSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void CSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void VSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void PSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void PSGetShader(ID3D11PixelShader** a_pixelShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void PSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void VSGetShader(ID3D11VertexShader** a_vertexShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void PSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void IAGetInputLayout(ID3D11InputLayout** a_inputLayout) = 0; - virtual void IAGetVertexBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_vertexBuffers, std::uint32_t* a_strides, std::uint32_t* a_offsets) = 0; - virtual void IAGetIndexBuffer(ID3D11Buffer** a_indexBuffer, DXGI_FORMAT* a_format, std::uint32_t* a_offset) = 0; - virtual void GSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void GSGetShader(ID3D11GeometryShader** a_geometryShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY* a_topology) = 0; - virtual void VSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void VSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void GetPredication(ID3D11Predicate** a_predicate, BOOL* a_predicateValue) = 0; - virtual void GSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void GSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void OMGetRenderTargets(std::uint32_t a_numViews, ID3D11RenderTargetView** a_renderTargetViews, ID3D11DepthStencilView** a_depthStencilView) = 0; - virtual void OMGetRenderTargetsAndUnorderedAccessViews(std::uint32_t a_numRTVs, ID3D11RenderTargetView** a_renderTargetViews, ID3D11DepthStencilView** a_depthStencilView, std::uint32_t a_uavStartSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView** a_unorderedAccessViews) = 0; - virtual void OMGetBlendState(ID3D11BlendState** a_blendState, float a_blendFactor[4], std::uint32_t* a_sampleMask) = 0; - virtual void OMGetDepthStencilState(ID3D11DepthStencilState** a_depthStencilState, std::uint32_t* a_stencilRef) = 0; - virtual void SOGetTargets(std::uint32_t a_numBuffers, ID3D11Buffer** a_soTargets) = 0; - virtual void RSGetState(ID3D11RasterizerState** a_rasterizerState) = 0; - virtual void RSGetViewports(std::uint32_t* a_numViewports, D3D11_VIEWPORT* a_viewports) = 0; - virtual void RSGetScissorRects(std::uint32_t* a_numRects, D3D11_RECT* a_rects) = 0; - virtual void HSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void HSGetShader(ID3D11HullShader** a_hullShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void HSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void HSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void DSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void DSGetShader(ID3D11DomainShader** a_domainShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void DSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void DSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void CSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void CSGetUnorderedAccessViews(std::uint32_t a_startSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView** a_unorderedAccessViews) = 0; - virtual void CSGetShader(ID3D11ComputeShader** a_computeShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void CSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void CSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void ClearState(void) = 0; - virtual void Flush(void) = 0; - virtual D3D11_DEVICE_CONTEXT_TYPE GetType(void) = 0; - virtual std::uint32_t GetContextFlags(void) = 0; - virtual HRESULT FinishCommandList(BOOL a_restoreDeferredContextState, ID3D11CommandList** a_commandList) = 0; - }; - - struct __declspec(novtable, uuid("4b35d0cd-1e15-4258-9c98-1b1333f6dd3b")) - ID3D11Asynchronous : public ID3D11DeviceChild - { - virtual std::uint32_t GetDataSize(void) = 0; - }; - - struct __declspec(novtable, uuid("3015A308-DCBD-47aa-A747-192486D14D4A")) - ID3D11AuthenticatedChannel : public ID3D11DeviceChild - { - virtual HRESULT GetCertificateSize(std::uint32_t* a_certificateSize) = 0; - virtual HRESULT GetCertificate(std::uint32_t a_certificateSize, std::uint8_t* a_certificate) = 0; - virtual void GetChannelHandle(HANDLE* a_channelHandle) = 0; - }; - - struct __declspec(novtable, uuid("75b68faa-347d-4159-8f45-a0640f01cd9a")) - ID3D11BlendState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_BLEND_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("a6cd7faa-b0b7-4a2f-9436-8662a65797cb")) - ID3D11ClassInstance : public ID3D11DeviceChild - { - virtual void GetClassLinkage(ID3D11ClassLinkage** a_linkage) = 0; - virtual void GetDesc(D3D11_CLASS_INSTANCE_DESC* a_desc) = 0; - virtual void GetInstanceName(char* a_instanceName, std::size_t* a_bufferLength) = 0; - virtual void GetTypeName(char* a_typeName, std::size_t* a_bufferLength) = 0; - }; - - struct __declspec(novtable, uuid("ddf57cba-9543-46e4-a12b-f207a0fe7fed")) - ID3D11ClassLinkage : public ID3D11DeviceChild - { - virtual HRESULT GetClassInstance(const char* a_classInstanceName, std::uint32_t a_instanceIndex, ID3D11ClassInstance** a_instance) = 0; - virtual HRESULT CreateClassInstance(const char* a_classTypeName, std::uint32_t a_constantBufferOffset, std::uint32_t a_constantVectorOffset, std::uint32_t a_textureOffset, std::uint32_t a_samplerOffset, ID3D11ClassInstance** a_instance) = 0; - }; - - struct __declspec(novtable, uuid("a24bc4d1-769e-43f7-8013-98ff566c18e2")) - ID3D11CommandList : public ID3D11DeviceChild - { - virtual std::uint32_t GetContextFlags(void) = 0; - }; - - struct __declspec(novtable, uuid("4f5b196e-c2bd-495e-bd01-1fded38e4969")) - ID3D11ComputeShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("6e8c49fb-a371-4770-b440-29086022b741")) - ID3D11Counter : public ID3D11Asynchronous - { - virtual void GetDesc(D3D11_COUNTER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("9B32F9AD-BDCC-40a6-A39D-D5C865845720")) - ID3D11CryptoSession : public ID3D11DeviceChild - { - virtual void GetCryptoType(GUID* a_cryptoType) = 0; - virtual void GetDecoderProfile(GUID* a_decoderProfile) = 0; - virtual HRESULT GetCertificateSize(std::uint32_t* a_certificateSize) = 0; - virtual HRESULT GetCertificate(std::uint32_t a_certificateSize, std::uint8_t* a_certificate) = 0; - virtual void GetCryptoSessionHandle(HANDLE* a_cryptoSessionHandle) = 0; - }; - - struct __declspec(novtable, uuid("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1")) - ID3D11DepthStencilState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_DEPTH_STENCIL_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("f582c508-0f36-490c-9977-31eece268cfa")) - ID3D11DomainShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("38325b96-effb-4022-ba02-2e795b70275c")) - ID3D11GeometryShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("8e5c6061-628a-4c8e-8264-bbe45cb3d5dd")) - ID3D11HullShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("e4819ddc-4cf0-4025-bd26-5de82a3e07b7")) - ID3D11InputLayout : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("ea82e40d-51dc-4f33-93d4-db7c9125ae8c")) - ID3D11PixelShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7")) - ID3D11RasterizerState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_RASTERIZER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("dc8e63f3-d12b-4952-b47b-5e45026a862d")) - ID3D11Resource : public ID3D11DeviceChild - { - virtual void GetType(D3D11_RESOURCE_DIMENSION* a_resourceDimension) = 0; - virtual void SetEvictionPriority(std::uint32_t a_evictionPriority) = 0; - virtual std::uint32_t GetEvictionPriority(void) = 0; - }; - - struct __declspec(novtable, uuid("da6fea51-564c-4487-9810-f0d0f9b4e3a5")) - ID3D11SamplerState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_SAMPLER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("3b301d64-d678-4289-8897-22f8928b72f3")) - ID3D11VertexShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("839d1216-bb2e-412b-b7f4-a9dbebe08ed1")) - ID3D11View : public ID3D11DeviceChild - { - virtual void GetResource(ID3D11Resource** a_resource) = 0; - }; - - struct __declspec(novtable, uuid("48570b85-d1ee-4fcd-a250-eb350722b037")) - ID3D11Buffer : public ID3D11Resource - { - virtual void GetDesc(D3D11_BUFFER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("9fdac92a-1876-48c3-afad-25b94f84a9b6")) - ID3D11DepthStencilView : public ID3D11View - { - virtual void GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("d6c00747-87b7-425e-b84d-44d108560afd")) - ID3D11Query : public ID3D11Asynchronous - { - virtual void GetDesc(D3D11_QUERY_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("9eb576dd-9f77-4d86-81aa-8bab5fe490e2")) - ID3D11Predicate : public ID3D11Query - {}; - - struct __declspec(novtable, uuid("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c")) - ID3D11Texture1D : public ID3D11Resource - { - virtual void GetDesc(D3D11_TEXTURE1D_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("6f15aaf2-d208-4e89-9ab4-489535d34f9c")) - ID3D11Texture2D : public ID3D11Resource - { - virtual void GetDesc(D3D11_TEXTURE2D_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("037e866e-f56d-4357-a8af-9dabbe6e250e")) - ID3D11Texture3D : public ID3D11Resource - { - virtual void GetDesc(D3D11_TEXTURE3D_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("dfdba067-0b8d-4865-875b-d7b4516cc164")) - ID3D11RenderTargetView : public ID3D11View - { - virtual void GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("b0e06fe0-8192-4e1a-b1ca-36d7414710b2")) - ID3D11ShaderResourceView : public ID3D11View - { - virtual void GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("28acf509-7f5c-48f6-8611-f316010a6380")) - ID3D11UnorderedAccessView : public ID3D11View - { - virtual void GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("61F21C45-3C0E-4a74-9CEA-67100D9AD5E4")) - ID3D11VideoContext : public ID3D11DeviceChild - { - virtual HRESULT GetDecoderBuffer(ID3D11VideoDecoder* a_decoder, D3D11_VIDEO_DECODER_BUFFER_TYPE a_type, std::uint32_t* a_bufferSize, void** a_buffer) = 0; - virtual HRESULT ReleaseDecoderBuffer(ID3D11VideoDecoder* a_decoder, D3D11_VIDEO_DECODER_BUFFER_TYPE a_type) = 0; - virtual HRESULT DecoderBeginFrame(ID3D11VideoDecoder* a_decoder, ID3D11VideoDecoderOutputView* a_view, std::uint32_t a_contentKeySize, const void* a_contentKey) = 0; - virtual HRESULT DecoderEndFrame(ID3D11VideoDecoder* a_decoder) = 0; - virtual HRESULT SubmitDecoderBuffers(ID3D11VideoDecoder* a_decoder, std::uint32_t a_numBuffers, const D3D11_VIDEO_DECODER_BUFFER_DESC* a_bufferDesc) = 0; - virtual HRESULT DecoderExtension(ID3D11VideoDecoder* a_decoder, const D3D11_VIDEO_DECODER_EXTENSION* a_extensionData) = 0; - virtual void VideoProcessorSetOutputTargetRect(ID3D11VideoProcessor* a_videoProcessor, BOOL a_enable, const RECT* a_rect) = 0; - virtual void VideoProcessorSetOutputBackgroundColor(ID3D11VideoProcessor* a_videoProcessor, BOOL a_bYCbCr, const D3D11_VIDEO_COLOR* a_color) = 0; - virtual void VideoProcessorSetOutputColorSpace(ID3D11VideoProcessor* a_videoProcessor, const D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorSetOutputAlphaFillMode(ID3D11VideoProcessor* a_videoProcessor, D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE a_alphaFillMode, std::uint32_t a_streamIndex) = 0; - virtual void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* a_videoProcessor, BOOL a_enable, SIZE a_size) = 0; - virtual void VideoProcessorSetOutputStereoMode(ID3D11VideoProcessor* a_videoProcessor, BOOL a_enable) = 0; - virtual HRESULT VideoProcessorSetOutputExtension(ID3D11VideoProcessor* a_videoProcessor, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void VideoProcessorGetOutputTargetRect(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_enabled, RECT* a_rect) = 0; - virtual void VideoProcessorGetOutputBackgroundColor(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_bYCbCr, D3D11_VIDEO_COLOR* a_color) = 0; - virtual void VideoProcessorGetOutputColorSpace(ID3D11VideoProcessor* a_videoProcessor, D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorGetOutputAlphaFillMode(ID3D11VideoProcessor* a_videoProcessor, D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE* a_alphaFillMode, std::uint32_t* a_streamIndex) = 0; - virtual void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_enabled, SIZE* a_size) = 0; - virtual void VideoProcessorGetOutputStereoMode(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_enabled) = 0; - virtual HRESULT VideoProcessorGetOutputExtension(ID3D11VideoProcessor* a_videoProcessor, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void VideoProcessorSetStreamFrameFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_FRAME_FORMAT a_frameFormat) = 0; - virtual void VideoProcessorSetStreamColorSpace(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, const D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorSetStreamOutputRate(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_OUTPUT_RATE a_outputRate, BOOL a_repeatFrame, const DXGI_RATIONAL* a_customRate) = 0; - virtual void VideoProcessorSetStreamSourceRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, const RECT* a_rect) = 0; - virtual void VideoProcessorSetStreamDestRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, const RECT* a_rect) = 0; - virtual void VideoProcessorSetStreamAlpha(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, float a_alpha) = 0; - virtual void VideoProcessorSetStreamPalette(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, std::uint32_t a_count, const std::uint32_t* a_entries) = 0; - virtual void VideoProcessorSetStreamPixelAspectRatio(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, const DXGI_RATIONAL* a_sourceAspectRatio, const DXGI_RATIONAL* a_destinationAspectRatio) = 0; - virtual void VideoProcessorSetStreamLumaKey(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t StreamIndex, BOOL a_enable, float a_lower, float a_upper) = 0; - virtual void VideoProcessorSetStreamStereoFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, D3D11_VIDEO_PROCESSOR_STEREO_FORMAT a_format, BOOL a_leftViewFrame0, BOOL a_baseViewFrame0, D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE a_flipMode, std::int32_t a_monoOffset) = 0; - virtual void VideoProcessorSetStreamAutoProcessingMode(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable) = 0; - virtual void VideoProcessorSetStreamFilter(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_FILTER a_filter, BOOL a_enable, std::int32_t a_level) = 0; - virtual HRESULT VideoProcessorSetStreamExtension(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void VideoProcessorGetStreamFrameFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_FRAME_FORMAT* a_frameFormat) = 0; - virtual void VideoProcessorGetStreamColorSpace(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorGetStreamOutputRate(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_OUTPUT_RATE* a_outputRate, BOOL* a_repeatFrame, DXGI_RATIONAL* a_customRate) = 0; - virtual void VideoProcessorGetStreamSourceRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, RECT* a_rect) = 0; - virtual void VideoProcessorGetStreamDestRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, RECT* a_rect) = 0; - virtual void VideoProcessorGetStreamAlpha(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, float* a_alpha) = 0; - virtual void VideoProcessorGetStreamPalette(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, std::uint32_t a_count, std::uint32_t* a_entries) = 0; - virtual void VideoProcessorGetStreamPixelAspectRatio(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, DXGI_RATIONAL* a_sourceAspectRatio, DXGI_RATIONAL* a_destinationAspectRatio) = 0; - virtual void VideoProcessorGetStreamLumaKey(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, float* a_lower, float* a_upper) = 0; - virtual void VideoProcessorGetStreamStereoFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enable, D3D11_VIDEO_PROCESSOR_STEREO_FORMAT* a_format, BOOL* a_leftViewFrame0, BOOL* a_baseViewFrame0, D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE* a_flipMode, std::int32_t* a_monoOffset) = 0; - virtual void VideoProcessorGetStreamAutoProcessingMode(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled) = 0; - virtual void VideoProcessorGetStreamFilter(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_FILTER a_filter, BOOL* a_enabled, std::int32_t* a_level) = 0; - virtual HRESULT VideoProcessorGetStreamExtension(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual HRESULT VideoProcessorBlt(ID3D11VideoProcessor* a_videoProcessor, ID3D11VideoProcessorOutputView* a_view, std::uint32_t a_outputFrame, std::uint32_t a_streamCount, const D3D11_VIDEO_PROCESSOR_STREAM* a_streams) = 0; - virtual HRESULT NegotiateCryptoSessionKeyExchange(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void EncryptionBlt(ID3D11CryptoSession* a_cryptoSession, ID3D11Texture2D* a_srcSurface, ID3D11Texture2D* a_dstSurface, std::uint32_t a_ivSize, void* a_iv) = 0; - virtual void DecryptionBlt(ID3D11CryptoSession* a_cryptoSession, ID3D11Texture2D* a_srcSurface, ID3D11Texture2D* a_dstSurface, D3D11_ENCRYPTED_BLOCK_INFO* a_encryptedBlockInfo, std::uint32_t a_contentKeySize, const void* a_contentKey, std::uint32_t a_ivSize, void* a_iv) = 0; - virtual void StartSessionKeyRefresh(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_randomNumberSize, void* a_randomNumber) = 0; - virtual void FinishSessionKeyRefresh(ID3D11CryptoSession* a_cryptoSession) = 0; - virtual HRESULT GetEncryptionBltKey(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_keySize, void* a_readbackKey) = 0; - virtual HRESULT NegotiateAuthenticatedChannelKeyExchange(ID3D11AuthenticatedChannel* a_channel, std::uint32_t a_dataSize, void* a_data) = 0; - virtual HRESULT QueryAuthenticatedChannel(ID3D11AuthenticatedChannel* a_channel, std::uint32_t a_inputSize, const void* a_input, std::uint32_t a_outputSize, void* a_output) = 0; - virtual HRESULT ConfigureAuthenticatedChannel(ID3D11AuthenticatedChannel* a_channel, std::uint32_t a_inputSize, const void* a_input, D3D11_AUTHENTICATED_CONFIGURE_OUTPUT* a_output) = 0; - virtual void VideoProcessorSetStreamRotation(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, D3D11_VIDEO_PROCESSOR_ROTATION a_rotation) = 0; - virtual void VideoProcessorGetStreamRotation(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enable, D3D11_VIDEO_PROCESSOR_ROTATION* a_rotation) = 0; - }; - - struct __declspec(novtable, uuid("3C9C5B51-995D-48d1-9B8D-FA5CAEDED65C")) - ID3D11VideoDecoder : public ID3D11DeviceChild - { - virtual HRESULT GetCreationParameters(D3D11_VIDEO_DECODER_DESC* a_videoDesc, D3D11_VIDEO_DECODER_CONFIG* a_config) = 0; - virtual HRESULT GetDriverHandle(HANDLE* a_driverHandle) = 0; - }; - - struct __declspec(novtable, uuid("C2931AEA-2A85-4f20-860F-FBA1FD256E18")) - ID3D11VideoDecoderOutputView : public ID3D11View - { - virtual void GetDesc(D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("10EC4D5B-975A-4689-B9E4-D0AAC30FE333")) - ID3D11VideoDevice : public IUnknown - { - virtual HRESULT CreateVideoDecoder(const D3D11_VIDEO_DECODER_DESC* a_videoDesc, const D3D11_VIDEO_DECODER_CONFIG* a_config, ID3D11VideoDecoder** a_decoder) = 0; - virtual HRESULT CreateVideoProcessor(ID3D11VideoProcessorEnumerator* a_enum, std::uint32_t a_rateConversionIndex, ID3D11VideoProcessor** a_videoProcessor) = 0; - virtual HRESULT CreateAuthenticatedChannel(D3D11_AUTHENTICATED_CHANNEL_TYPE a_channelType, ID3D11AuthenticatedChannel** a_authenticatedChannel) = 0; - virtual HRESULT CreateCryptoSession(const GUID* a_cryptoType, const GUID* a_decoderProfile, const GUID* a_keyExchangeType, ID3D11CryptoSession** a_cryptoSession) = 0; - virtual HRESULT CreateVideoDecoderOutputView(ID3D11Resource* a_resource, const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC* a_desc, ID3D11VideoDecoderOutputView** a_dvovView) = 0; - virtual HRESULT CreateVideoProcessorInputView(ID3D11Resource* a_resource, ID3D11VideoProcessorEnumerator* a_enum, const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC* a_desc, ID3D11VideoProcessorInputView** a_vpiView) = 0; - virtual HRESULT CreateVideoProcessorOutputView(ID3D11Resource* a_resource, ID3D11VideoProcessorEnumerator* a_enum, const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC* a_desc, ID3D11VideoProcessorOutputView** a_vpoView) = 0; - virtual HRESULT CreateVideoProcessorEnumerator(const D3D11_VIDEO_PROCESSOR_CONTENT_DESC* a_desc, ID3D11VideoProcessorEnumerator** a_enum) = 0; - virtual std::uint32_t GetVideoDecoderProfileCount(void) = 0; - virtual HRESULT GetVideoDecoderProfile(std::uint32_t a_index, GUID* a_decoderProfile) = 0; - virtual HRESULT CheckVideoDecoderFormat(const GUID* a_decoderProfile, DXGI_FORMAT a_format, BOOL* a_supported) = 0; - virtual HRESULT GetVideoDecoderConfigCount(const D3D11_VIDEO_DECODER_DESC* a_desc, std::uint32_t* a_count) = 0; - virtual HRESULT GetVideoDecoderConfig(const D3D11_VIDEO_DECODER_DESC* a_desc, std::uint32_t a_index, D3D11_VIDEO_DECODER_CONFIG* a_config) = 0; - virtual HRESULT GetContentProtectionCaps(const GUID* a_cryptoType, const GUID* a_decoderProfile, D3D11_VIDEO_CONTENT_PROTECTION_CAPS* a_caps) = 0; - virtual HRESULT CheckCryptoKeyExchange(const GUID* a_cryptoType, const GUID* a_decoderProfile, std::uint32_t a_index, GUID* a_keyExchangeType) = 0; - virtual HRESULT SetPrivateData(const GUID& a_guid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_guid, const IUnknown* a_data) = 0; - }; - - struct __declspec(novtable, uuid("1D7B0652-185F-41c6-85CE-0C5BE3D4AE6C")) - ID3D11VideoProcessor : public ID3D11DeviceChild - { - virtual void GetContentDesc(D3D11_VIDEO_PROCESSOR_CONTENT_DESC* a_desc) = 0; - virtual void GetRateConversionCaps(D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS* a_caps) = 0; - }; - - struct __declspec(novtable, uuid("31627037-53AB-4200-9061-05FAA9AB45F9")) - ID3D11VideoProcessorEnumerator : public ID3D11DeviceChild - { - virtual HRESULT GetVideoProcessorContentDesc(D3D11_VIDEO_PROCESSOR_CONTENT_DESC* a_contentDesc) = 0; - virtual HRESULT CheckVideoProcessorFormat(DXGI_FORMAT a_format, std::uint32_t* a_flags) = 0; - virtual HRESULT GetVideoProcessorCaps(D3D11_VIDEO_PROCESSOR_CAPS* a_caps) = 0; - virtual HRESULT GetVideoProcessorRateConversionCaps(std::uint32_t a_typeIndex, D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS* a_caps) = 0; - virtual HRESULT GetVideoProcessorCustomRate(std::uint32_t a_typeIndex, std::uint32_t a_customRateIndex, D3D11_VIDEO_PROCESSOR_CUSTOM_RATE* a_rate) = 0; - virtual HRESULT GetVideoProcessorFilterRange(D3D11_VIDEO_PROCESSOR_FILTER a_filter, D3D11_VIDEO_PROCESSOR_FILTER_RANGE* a_range) = 0; - }; - - struct __declspec(novtable, uuid("11EC5A5F-51DC-4945-AB34-6E8C21300EA5")) - ID3D11VideoProcessorInputView : public ID3D11View - { - virtual void GetDesc(D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("A048285E-25A9-4527-BD93-D68B68C44254")) - ID3D11VideoProcessorOutputView : public ID3D11View - { - virtual void GetDesc(D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC* a_desc) = 0; - }; -} - -namespace REX::W32 -{ - using PFN_D3D11_CREATE_DEVICE = HRESULT(__stdcall*)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, std::uint32_t, const D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); - using PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN = HRESULT(__stdcall*)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, std::uint32_t, const D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, const DXGI_SWAP_CHAIN_DESC*, IDXGISwapChain**, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); - - HRESULT D3D11CreateDevice(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept; - HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const DXGI_SWAP_CHAIN_DESC* a_swapChainDesc, IDXGISwapChain** a_swapChain, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Asynchronous{ 0x4B35D0CD, 0x1E15, 0x4258, { 0x9C, 0x98, 0x1B, 0x13, 0x33, 0xF6, 0xDD, 0x3B } }; - inline constexpr IID IID_ID3D11AuthenticatedChannel{ 0x3015A308, 0xDCBD, 0x47AA, { 0xA7, 0x47, 0x19, 0x24, 0x86, 0xD1, 0x4D, 0x4A } }; - inline constexpr IID IID_ID3D11BlendState{ 0x75B68FAA, 0x347D, 0x4159, { 0x8F, 0x45, 0xA0, 0x64, 0x0F, 0x01, 0xCD, 0x9A } }; - inline constexpr IID IID_ID3D11Buffer{ 0x48570B85, 0xD1EE, 0x4FCD, { 0xA2, 0x50, 0xEB, 0x35, 0x07, 0x22, 0xB0, 0x37 } }; - inline constexpr IID IID_ID3D11ClassInstance{ 0xA6CD7FAA, 0xB0B7, 0x4A2F, { 0x94, 0x36, 0x86, 0x62, 0xA6, 0x57, 0x97, 0xCB } }; - inline constexpr IID IID_ID3D11ClassLinkage{ 0xDDF57CBA, 0x9543, 0x46E4, { 0xA1, 0x2B, 0xF2, 0x07, 0xA0, 0xFE, 0x7F, 0xED } }; - inline constexpr IID IID_ID3D11CommandList{ 0xA24BC4D1, 0x769E, 0x43F7, { 0x80, 0x13, 0x98, 0xFF, 0x56, 0x6C, 0x18, 0xE2 } }; - inline constexpr IID IID_ID3D11ComputeShader{ 0x4F5B196E, 0xC2BD, 0x495E, { 0xBD, 0x01, 0x1F, 0xDE, 0xD3, 0x8E, 0x49, 0x69 } }; - inline constexpr IID IID_ID3D11Counter{ 0x6E8C49FB, 0xA371, 0x4770, { 0xB4, 0x40, 0x29, 0x08, 0x60, 0x22, 0xB7, 0x41 } }; - inline constexpr IID IID_ID3D11CryptoSession{ 0x9B32F9AD, 0xBDCC, 0x40A6, { 0xA3, 0x9D, 0xD5, 0xC8, 0x65, 0x84, 0x57, 0x20 } }; - inline constexpr IID IID_ID3D11Device{ 0xDB6F6DDB, 0xAC77, 0x4E88, { 0x82, 0x53, 0x81, 0x9D, 0xF9, 0xBB, 0xF1, 0x40 } }; - inline constexpr IID IID_ID3D11DeviceChild{ 0x1841E5C8, 0x16B0, 0x489B, { 0xBC, 0xC8, 0x44, 0xCF, 0xB0, 0xD5, 0xDE, 0xAE } }; - inline constexpr IID IID_ID3D11DeviceContext{ 0xC0BFA96C, 0xE089, 0x44FB, { 0x8E, 0xAF, 0x26, 0xF8, 0x79, 0x61, 0x90, 0xDA } }; - inline constexpr IID IID_ID3D11DepthStencilState{ 0x03823EFB, 0x8D8F, 0x4E1C, { 0x9A, 0xA2, 0xF6, 0x4B, 0xB2, 0xCB, 0xFD, 0xF1 } }; - inline constexpr IID IID_ID3D11DepthStencilView{ 0x9FDAC92A, 0x1876, 0x48C3, { 0xAF, 0xAD, 0x25, 0xB9, 0x4F, 0x84, 0xA9, 0xB6 } }; - inline constexpr IID IID_ID3D11DomainShader{ 0xF582C508, 0x0F36, 0x490C, { 0x99, 0x77, 0x31, 0xEE, 0xCE, 0x26, 0x8C, 0xFA } }; - inline constexpr IID IID_ID3D11GeometryShader{ 0x38325B96, 0xEFFB, 0x4022, { 0xBA, 0x02, 0x2E, 0x79, 0x5B, 0x70, 0x27, 0x5C } }; - inline constexpr IID IID_ID3D11HullShader{ 0x8E5C6061, 0x628A, 0x4C8E, { 0x82, 0x64, 0xBB, 0xE4, 0x5C, 0xB3, 0xD5, 0xDD } }; - inline constexpr IID IID_ID3D11InputLayout{ 0xE4819DDC, 0x4CF0, 0x4025, { 0xBD, 0x26, 0x5D, 0xE8, 0x2A, 0x3E, 0x07, 0xB7 } }; - inline constexpr IID IID_ID3D11PixelShader{ 0xEA82E40D, 0x51DC, 0x4F33, { 0x93, 0xD4, 0xDB, 0x7C, 0x91, 0x25, 0xAE, 0x8C } }; - inline constexpr IID IID_ID3D11Predicate{ 0x9EB576DD, 0x9F77, 0x4D86, { 0x81, 0xAA, 0x8B, 0xAB, 0x5F, 0xE4, 0x90, 0xE2 } }; - inline constexpr IID IID_ID3D11Query{ 0xD6C00747, 0x87B7, 0x425E, { 0xB8, 0x4D, 0x44, 0xD1, 0x08, 0x56, 0x0A, 0xFD } }; - inline constexpr IID IID_ID3D11RasterizerState{ 0x9BB4AB81, 0xAB1A, 0x4D8F, { 0xB5, 0x06, 0xFC, 0x04, 0x20, 0x0B, 0x6E, 0xE7 } }; - inline constexpr IID IID_ID3D11RenderTargetView{ 0xDFDBA067, 0x0B8D, 0x4865, { 0x87, 0x5B, 0xD7, 0xB4, 0x51, 0x6C, 0xC1, 0x64 } }; - inline constexpr IID IID_ID3D11Resource{ 0xDC8E63F3, 0xD12B, 0x4952, { 0xB4, 0x7B, 0x5E, 0x45, 0x02, 0x6A, 0x86, 0x2D } }; - inline constexpr IID IID_ID3D11SamplerState{ 0xDA6FEA51, 0x564C, 0x4487, { 0x98, 0x10, 0xF0, 0xD0, 0xF9, 0xB4, 0xE3, 0xA5 } }; - inline constexpr IID IID_ID3D11ShaderResourceView{ 0xB0E06FE0, 0x8192, 0x4E1A, { 0xB1, 0xCA, 0x36, 0xD7, 0x41, 0x47, 0x10, 0xB2 } }; - inline constexpr IID IID_ID3D11Texture1D{ 0xF8FB5C27, 0xC6B3, 0x4F75, { 0xA4, 0xC8, 0x43, 0x9A, 0xF2, 0xEF, 0x56, 0x4C } }; - inline constexpr IID IID_ID3D11Texture2D{ 0x6F15AAF2, 0xD208, 0x4E89, { 0x9A, 0xB4, 0x48, 0x95, 0x35, 0xD3, 0x4F, 0x9C } }; - inline constexpr IID IID_ID3D11Texture3D{ 0x037E866E, 0xF56D, 0x4357, { 0xA8, 0xAF, 0x9D, 0xAB, 0xBE, 0x6E, 0x25, 0x0E } }; - inline constexpr IID IID_ID3D11UnorderedAccessView{ 0x28ACF509, 0x7F5C, 0x48F6, { 0x86, 0x11, 0xF3, 0x16, 0x01, 0x0A, 0x63, 0x80 } }; - inline constexpr IID IID_ID3D11VertexShader{ 0x3B301D64, 0xD678, 0x4289, { 0x88, 0x97, 0x22, 0xF8, 0x92, 0x8B, 0x72, 0xF3 } }; - inline constexpr IID IID_ID3D11VideoContext{ 0x61F21C45, 0x3C0E, 0x4A74, { 0x9C, 0xEA, 0x67, 0x10, 0x0D, 0x9A, 0xD5, 0xE4 } }; - inline constexpr IID IID_ID3D11VideoDecoder{ 0x3C9C5B51, 0x995D, 0x48D1, { 0x9B, 0x8D, 0xFA, 0x5C, 0xAE, 0xDE, 0xD6, 0x5C } }; - inline constexpr IID IID_ID3D11VideoDecoderOutputView{ 0xC2931AEA, 0x2A85, 0x4F20, { 0x86, 0x0F, 0xFB, 0xA1, 0xFD, 0x25, 0x6E, 0x18 } }; - inline constexpr IID IID_ID3D11VideoDevice{ 0x10EC4D5B, 0x975A, 0x4689, { 0xB9, 0xE4, 0xD0, 0xAA, 0xC3, 0x0F, 0xE3, 0x33 } }; - inline constexpr IID IID_ID3D11VideoProcessor{ 0x1D7B0652, 0x185F, 0x41C6, { 0x85, 0xCE, 0x0C, 0x5B, 0xE3, 0xD4, 0xAE, 0x6C } }; - inline constexpr IID IID_ID3D11VideoProcessorEnumerator{ 0x31627037, 0x53AB, 0x4200, { 0x90, 0x61, 0x05, 0xFA, 0xA9, 0xAB, 0x45, 0xF9 } }; - inline constexpr IID IID_ID3D11VideoProcessorInputView{ 0x11EC5A5F, 0x51DC, 0x4945, { 0xAB, 0x34, 0x6E, 0x8C, 0x21, 0x30, 0x0E, 0xA5 } }; - inline constexpr IID IID_ID3D11VideoProcessorOutputView{ 0xA048285E, 0x25A9, 0x4527, { 0xBD, 0x93, 0xD6, 0x8B, 0x68, 0xC4, 0x42, 0x54 } }; - inline constexpr IID IID_ID3D11View{ 0x839D1216, 0xBB2E, 0x412B, { 0xB7, 0xF4, 0xA9, 0xDB, 0xEB, 0xE0, 0x8E, 0xD1 } }; -} diff --git a/include/REX/W32/D3D11_1.h b/include/REX/W32/D3D11_1.h deleted file mode 100644 index 1fa8d97..0000000 --- a/include/REX/W32/D3D11_1.h +++ /dev/null @@ -1,296 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11.h" - -namespace REX::W32 -{ - struct ID3DDeviceContextState; - struct ID3DUserDefinedAnnotation; - struct ID3D11BlendState1; - struct ID3D11Device1; - struct ID3D11DeviceContext1; - struct ID3D11RasterizerState1; - struct ID3D11VideoContext1; - struct ID3D11VideoDevice1; - struct ID3D11VideoProcessorEnumerator1; -} - -namespace REX::W32 -{ - enum D3D11_1_CREATE_DEVICE_CONTEXT_STATE_FLAG - { - D3D11_1_CREATE_DEVICE_CONTEXT_STATE_SINGLETHREADED = 0x1, - }; - - enum D3D11_COPY_FLAGS - { - D3D11_COPY_NO_OVERWRITE = 0x1, - D3D11_COPY_DISCARD = 0x2, - }; - - enum D3D11_CRYPTO_SESSION_STATUS - { - D3D11_CRYPTO_SESSION_STATUS_OK = 0, - D3D11_CRYPTO_SESSION_STATUS_KEY_LOST = 1, - D3D11_CRYPTO_SESSION_STATUS_KEY_AND_CONTENT_LOST = 2, - }; - - enum D3D11_LOGIC_OP - { - D3D11_LOGIC_OP_CLEAR = 0, - D3D11_LOGIC_OP_SET = (D3D11_LOGIC_OP_CLEAR + 1), - D3D11_LOGIC_OP_COPY = (D3D11_LOGIC_OP_SET + 1), - D3D11_LOGIC_OP_COPY_INVERTED = (D3D11_LOGIC_OP_COPY + 1), - D3D11_LOGIC_OP_NOOP = (D3D11_LOGIC_OP_COPY_INVERTED + 1), - D3D11_LOGIC_OP_INVERT = (D3D11_LOGIC_OP_NOOP + 1), - D3D11_LOGIC_OP_AND = (D3D11_LOGIC_OP_INVERT + 1), - D3D11_LOGIC_OP_NAND = (D3D11_LOGIC_OP_AND + 1), - D3D11_LOGIC_OP_OR = (D3D11_LOGIC_OP_NAND + 1), - D3D11_LOGIC_OP_NOR = (D3D11_LOGIC_OP_OR + 1), - D3D11_LOGIC_OP_XOR = (D3D11_LOGIC_OP_NOR + 1), - D3D11_LOGIC_OP_EQUIV = (D3D11_LOGIC_OP_XOR + 1), - D3D11_LOGIC_OP_AND_REVERSE = (D3D11_LOGIC_OP_EQUIV + 1), - D3D11_LOGIC_OP_AND_INVERTED = (D3D11_LOGIC_OP_AND_REVERSE + 1), - D3D11_LOGIC_OP_OR_REVERSE = (D3D11_LOGIC_OP_AND_INVERTED + 1), - D3D11_LOGIC_OP_OR_INVERTED = (D3D11_LOGIC_OP_OR_REVERSE + 1), - }; - - enum D3D11_VIDEO_DECODER_CAPS - { - D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE = 0x1, - D3D11_VIDEO_DECODER_CAPS_NON_REAL_TIME = 0x2, - D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE_DYNAMIC = 0x4, - D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE_REQUIRED = 0x8, - D3D11_VIDEO_DECODER_CAPS_UNSUPPORTED = 0x10, - }; - - enum D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS - { - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_ROTATION = 0x1, - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_RESIZE = 0x2, - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_COLOR_SPACE_CONVERSION = 0x4, - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_TRIPLE_BUFFER_OUTPUT = 0x8, - }; -} - -namespace REX::W32 -{ - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA; - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA; - struct D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK; - - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_DATA - { - std::uint32_t hwProtectionFunctionID; - D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA* inputData; - D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA* outputData; - HRESULT status; - }; - - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA - { - std::uint32_t privateDataSize; - std::uint32_t hwProtectionDataSize; - std::uint8_t input[4]; - }; - - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA - { - std::uint32_t privateDataSize; - std::uint32_t maxHWProtectionDataSize; - std::uint32_t hwProtectionDataSize; - std::uint64_t transportTime; - std::uint64_t executionTime; - std::uint8_t output[4]; - }; - - struct D3D11_RASTERIZER_DESC1 - { - D3D11_FILL_MODE fillMode; - D3D11_CULL_MODE cullMode; - BOOL frontCounterClockwise; - std::int32_t depthBias; - float depthBiasClamp; - float slopeScaledDepthBias; - BOOL depthClipEnable; - BOOL scissorEnable; - BOOL multisampleEnable; - BOOL antialiasedLineEnable; - std::uint32_t forcedSampleCount; - }; - - struct D3D11_RENDER_TARGET_BLEND_DESC1 - { - BOOL blendEnable; - BOOL logicOpEnable; - D3D11_BLEND srcBlend; - D3D11_BLEND destBlend; - D3D11_BLEND_OP blendOp; - D3D11_BLEND srcBlendAlpha; - D3D11_BLEND destBlendAlpha; - D3D11_BLEND_OP blendOpAlpha; - D3D11_LOGIC_OP logicOp; - std::uint8_t renderTargetWriteMask; - }; - - struct D3D11_VIDEO_DECODER_BEGIN_FRAME_CRYPTO_SESSION - { - ID3D11CryptoSession* cryptoSession; - std::uint32_t blobSize; - void* blob; - GUID* keyInfoId; - std::uint32_t privateDataSize; - void* privateData; - }; - - struct D3D11_VIDEO_DECODER_BUFFER_DESC1 - { - D3D11_VIDEO_DECODER_BUFFER_TYPE bufferType; - std::uint32_t dataOffset; - std::uint32_t dataSize; - void* iv; - std::uint32_t ivSize; - D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK* subSampleMappingBlock; - std::uint32_t subSampleMappingCount; - }; - - struct D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK - { - std::uint32_t clearSize; - std::uint32_t encryptedSize; - }; - - struct D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT - { - BOOL enable; - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - }; - - struct D3D11_VIDEO_SAMPLE_DESC - { - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - DXGI_COLOR_SPACE_TYPE colorSpace; - }; - - struct D3D11_BLEND_DESC1 - { - BOOL alphaToCoverageEnable; - BOOL independentBlendEnable; - D3D11_RENDER_TARGET_BLEND_DESC1 renderTarget[8]; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("5c1e0d8a-7c23-48f9-8c59-a92958ceff11")) - ID3DDeviceContextState : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("b2daad8b-03d4-4dbf-95eb-32ab4b63d0ab")) - ID3DUserDefinedAnnotation : public IUnknown - { - virtual std::int32_t BeginEvent(const wchar_t* a_name) = 0; - virtual std::int32_t EndEvent(void) = 0; - virtual void SetMarker(const wchar_t* a_name) = 0; - virtual BOOL GetStatus(void) = 0; - }; - - struct __declspec(novtable, uuid("cc86fabe-da55-401d-85e7-e3c9de2877e9")) - ID3D11BlendState1 : public ID3D11BlendState - { - virtual void GetDesc1(D3D11_BLEND_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("a04bfb29-08ef-43d6-a49c-a9bdbdcbe686")) - ID3D11Device1 : public ID3D11Device - { - virtual void GetImmediateContext1(ID3D11DeviceContext1** a_immediateContext) = 0; - virtual HRESULT CreateDeferredContext1(std::uint32_t a_contextFlags, ID3D11DeviceContext1** a_deferredContext) = 0; - virtual HRESULT CreateBlendState1(const D3D11_BLEND_DESC1* a_blendStateDesc, ID3D11BlendState1** a_blendState) = 0; - virtual HRESULT CreateRasterizerState1(const D3D11_RASTERIZER_DESC1* a_rasterizerDesc, ID3D11RasterizerState1** a_rasterizerState) = 0; - virtual HRESULT CreateDeviceContextState(std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const IID& a_emulatedInterface, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3DDeviceContextState** a_contextState) = 0; - virtual HRESULT OpenSharedResource1(HANDLE a_resourceHandle, const IID& a_returnedInterface, void** a_resource) = 0; - virtual HRESULT OpenSharedResourceByName(const wchar_t* a_name, std::uint32_t a_desiredAccess, const IID& a_returnedInterface, void** a_resource) = 0; - }; - - struct __declspec(novtable, uuid("bb2c6faa-b5fb-4082-8e6b-388b8cfa90e1")) - ID3D11DeviceContext1 : public ID3D11DeviceContext - { - virtual void CopySubresourceRegion1(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, std::uint32_t a_dstX, std::uint32_t a_dstY, std::uint32_t a_dstZ, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, const D3D11_BOX* a_srcBox, std::uint32_t a_copyFlags) = 0; - virtual void UpdateSubresource1(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, const D3D11_BOX* a_dstBox, const void* a_srcData, std::uint32_t a_srcRowPitch, std::uint32_t a_srcDepthPitch, std::uint32_t a_copyFlags) = 0; - virtual void DiscardResource(ID3D11Resource* a_resource) = 0; - virtual void DiscardView(ID3D11View* a_resourceView) = 0; - virtual void VSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void HSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void DSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void GSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void PSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void CSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void VSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void HSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void DSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void GSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void PSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void CSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void SwapDeviceContextState(ID3DDeviceContextState* a_state, ID3DDeviceContextState** a_previousState) = 0; - virtual void ClearView(ID3D11View* a_view, const float a_color[4], const D3D11_RECT* a_rect, std::uint32_t a_numRects) = 0; - virtual void DiscardView1(ID3D11View* a_resourceView, const D3D11_RECT* a_rects, std::uint32_t a_numRects) = 0; - }; - - struct __declspec(novtable, uuid("1217d7a6-5039-418c-b042-9cbe256afd6e")) - ID3D11RasterizerState1 : public ID3D11RasterizerState - { - virtual void GetDesc1(D3D11_RASTERIZER_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("A7F026DA-A5F8-4487-A564-15E34357651E")) - ID3D11VideoContext1 : public ID3D11VideoContext - { - virtual HRESULT SubmitDecoderBuffers1(ID3D11VideoDecoder* a_decoder, std::uint32_t a_numBuffers, const D3D11_VIDEO_DECODER_BUFFER_DESC1* a_bufferDesc) = 0; - virtual HRESULT GetDataForNewHardwareKey(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_privateInputSize, const void* a_privateInputData, std::uint64_t* a_privateOutputData) = 0; - virtual HRESULT CheckCryptoSessionStatus(ID3D11CryptoSession* a_cryptoSession, D3D11_CRYPTO_SESSION_STATUS* a_status) = 0; - virtual HRESULT DecoderEnableDownsampling(ID3D11VideoDecoder* a_decoder, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, const D3D11_VIDEO_SAMPLE_DESC* a_outputDesc, std::uint32_t a_referenceFrameCount) = 0; - virtual HRESULT DecoderUpdateDownsampling(ID3D11VideoDecoder* a_decoder, const D3D11_VIDEO_SAMPLE_DESC* a_outputDesc) = 0; - virtual void VideoProcessorSetOutputColorSpace1(ID3D11VideoProcessor* a_videoProcessor, DXGI_COLOR_SPACE_TYPE a_colorSpace) = 0; - virtual void VideoProcessorSetOutputShaderUsage(ID3D11VideoProcessor* a_videoProcessor, BOOL a_shaderUsage) = 0; - virtual void VideoProcessorGetOutputColorSpace1(ID3D11VideoProcessor* a_videoProcessor, DXGI_COLOR_SPACE_TYPE* a_colorSpace) = 0; - virtual void VideoProcessorGetOutputShaderUsage(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_shaderUsage) = 0; - virtual void VideoProcessorSetStreamColorSpace1(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_COLOR_SPACE_TYPE a_colorSpace) = 0; - virtual void VideoProcessorSetStreamMirror(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, BOOL a_flipHorizontal, BOOL a_flipVertical) = 0; - virtual void VideoProcessorGetStreamColorSpace1(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_COLOR_SPACE_TYPE* a_colorSpace) = 0; - virtual void VideoProcessorGetStreamMirror(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enable, BOOL* a_flipHorizontal, BOOL* a_flipVertical) = 0; - virtual HRESULT VideoProcessorGetBehaviorHints(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_outputWidth, std::uint32_t a_outputHeight, DXGI_FORMAT a_outputFormat, std::uint32_t a_streamCount, const D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT* a_streams, std::uint32_t* a_behaviorHints) = 0; - }; - - struct __declspec(novtable, uuid("29DA1D51-1321-4454-804B-F5FC9F861F0F")) - ID3D11VideoDevice1 : public ID3D11VideoDevice - { - virtual HRESULT GetCryptoSessionPrivateDataSize(const GUID* a_cryptoType, const GUID* a_decoderProfile, const GUID* a_keyExchangeType, std::uint32_t* a_privateInputSize, std::uint32_t* a_privateOutputSize) = 0; - virtual HRESULT GetVideoDecoderCaps(const GUID* a_decoderProfile, std::uint32_t a_sampleWidth, std::uint32_t a_sampleHeight, const DXGI_RATIONAL* a_frameRate, std::uint32_t a_bitRate, const GUID* a_cryptoType, std::uint32_t* a_decoderCaps) = 0; - virtual HRESULT CheckVideoDecoderDownsampling(const D3D11_VIDEO_DECODER_DESC* a_inputDesc, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, const D3D11_VIDEO_DECODER_CONFIG* a_inputConfig, const DXGI_RATIONAL* a_frameRate, const D3D11_VIDEO_SAMPLE_DESC* a_outputDesc, BOOL* a_supported, BOOL* a_realTimeHint) = 0; - virtual HRESULT RecommendVideoDecoderDownsampleParameters(const D3D11_VIDEO_DECODER_DESC* a_inputDesc, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, const D3D11_VIDEO_DECODER_CONFIG* a_inputConfig, const DXGI_RATIONAL* a_frameRate, D3D11_VIDEO_SAMPLE_DESC* a_recommendedOutputDesc) = 0; - }; - - struct __declspec(novtable, uuid("465217F2-5568-43CF-B5B9-F61D54531CA1")) - ID3D11VideoProcessorEnumerator1 : public ID3D11VideoProcessorEnumerator - { - virtual HRESULT CheckVideoProcessorFormatConversion(DXGI_FORMAT a_inputFormat, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, DXGI_FORMAT a_outputFormat, DXGI_COLOR_SPACE_TYPE a_outputColorSpace, BOOL* a_supported) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3DDeviceContextState{ 0x5C1E0D8A, 0x7C23, 0x48F9, { 0x8C, 0x59, 0xA9, 0x29, 0x58, 0xCE, 0xFF, 0x11 } }; - inline constexpr IID IID_ID3DUserDefinedAnnotation{ 0xB2DAAD8B, 0x03D4, 0x4DBF, { 0x95, 0xEB, 0x32, 0xAB, 0x4B, 0x63, 0xD0, 0xAB } }; - inline constexpr IID IID_ID3D11BlendState1{ 0xCC86FABE, 0xDA55, 0x401D, { 0x85, 0xE7, 0xE3, 0xC9, 0xDE, 0x28, 0x77, 0xE9 } }; - inline constexpr IID IID_ID3D11Device1{ 0xA04BFB29, 0x08EF, 0x43D6, { 0xA4, 0x9C, 0xA9, 0xBD, 0xBD, 0xCB, 0xE6, 0x86 } }; - inline constexpr IID IID_ID3D11DeviceContext1{ 0xBB2C6FAA, 0xB5FB, 0x4082, { 0x8E, 0x6B, 0x38, 0x8B, 0x8C, 0xFA, 0x90, 0xE1 } }; - inline constexpr IID IID_ID3D11RasterizerState1{ 0x1217D7A6, 0x5039, 0x418C, { 0xB0, 0x42, 0x9C, 0xBE, 0x25, 0x6A, 0xFD, 0x6E } }; - inline constexpr IID IID_ID3D11VideoContext1{ 0xA7F026DA, 0xA5F8, 0x4487, { 0xA5, 0x64, 0x15, 0xE3, 0x43, 0x57, 0x65, 0x1E } }; - inline constexpr IID IID_ID3D11VideoDevice1{ 0x29DA1D51, 0x1321, 0x4454, { 0x80, 0x4B, 0xF5, 0xFC, 0x9F, 0x86, 0x1F, 0x0F } }; - inline constexpr IID IID_ID3D11VideoProcessorEnumerator1{ 0x465217F2, 0x5568, 0x43CF, { 0xB5, 0xB9, 0xF6, 0x1D, 0x54, 0x53, 0x1C, 0xA1 } }; -} diff --git a/include/REX/W32/D3D11_2.h b/include/REX/W32/D3D11_2.h deleted file mode 100644 index 58c4023..0000000 --- a/include/REX/W32/D3D11_2.h +++ /dev/null @@ -1,112 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11_1.h" - -namespace REX::W32 -{ - struct ID3D11Device2; - struct ID3D11DeviceContext2; -} - -namespace REX::W32 -{ - enum D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_FLAG - { - D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_TILED_RESOURCE = 0x1, - }; - - enum D3D11_TILE_COPY_FLAG - { - D3D11_TILE_COPY_NO_OVERWRITE = 0x1, - D3D11_TILE_COPY_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, - D3D11_TILE_COPY_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4, - }; - - enum D3D11_TILE_MAPPING_FLAG - { - D3D11_TILE_MAPPING_NO_OVERWRITE = 0x1, - }; - - enum D3D11_TILE_RANGE_FLAG - { - D3D11_TILE_RANGE_NULL = 0x1, - D3D11_TILE_RANGE_SKIP = 0x2, - D3D11_TILE_RANGE_REUSE_SINGLE_TILE = 0x4, - }; -} - -namespace REX::W32 -{ - struct D3D11_PACKED_MIP_DESC - { - std::uint8_t numStandardMips; - std::uint8_t numPackedMips; - std::uint32_t numTilesForPackedMips; - std::uint32_t startTileIndexInOverallResource; - }; - - struct D3D11_SUBRESOURCE_TILING - { - std::uint32_t widthInTiles; - std::uint16_t heightInTiles; - std::uint16_t depthInTiles; - std::uint32_t startTileIndexInOverallResource; - }; - - struct D3D11_TILED_RESOURCE_COORDINATE - { - std::uint32_t x; - std::uint32_t y; - std::uint32_t z; - std::uint32_t subResource; - }; - - struct D3D11_TILE_REGION_SIZE - { - std::uint32_t numTiles; - BOOL bUseBox; - std::uint32_t width; - std::uint16_t height; - std::uint16_t depth; - }; - - struct D3D11_TILE_SHAPE - { - std::uint32_t widthInTexels; - std::uint32_t heightInTexels; - std::uint32_t depthInTexels; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("9d06dffa-d1e5-4d07-83a8-1bb123f2f841")) - ID3D11Device2 : public ID3D11Device1 - { - virtual void GetImmediateContext2(ID3D11DeviceContext2** a_immediateContext) = 0; - virtual HRESULT CreateDeferredContext2(std::uint32_t a_contextFlags, ID3D11DeviceContext2** a_deferredContext) = 0; - virtual void GetResourceTiling(ID3D11Resource* a_tiledResource, std::uint32_t* a_numTilesForEntireResource, D3D11_PACKED_MIP_DESC* a_packedMipDesc, D3D11_TILE_SHAPE* a_standardTileShapeForNonPackedMips, std::uint32_t* a_numSubresourceTilings, std::uint32_t a_firstSubResourceTilingToGet, D3D11_SUBRESOURCE_TILING* a_subResourceTilingsForNonPackedMips) = 0; - virtual HRESULT CheckMultisampleQualityLevels1(DXGI_FORMAT a_format, std::uint32_t a_sampleCount, std::uint32_t a_flags, std::uint32_t* a_numQualityLevels) = 0; - }; - - struct __declspec(novtable, uuid("420d5b32-b90c-4da4-bef0-359f6a24a83a")) - ID3D11DeviceContext2 : public ID3D11DeviceContext1 - { - virtual HRESULT UpdateTileMappings(ID3D11Resource* a_tiledResource, std::uint32_t numTiledResourceRegions, const D3D11_TILED_RESOURCE_COORDINATE* a_tiledResourceRegionStartCoordinates, const D3D11_TILE_REGION_SIZE* a_tiledResourceRegionSizes, ID3D11Buffer* a_tilePool, std::uint32_t a_numRanges, const std::uint32_t* a_rangeFlags, const std::uint32_t* a_tilePoolStartOffsets, const std::uint32_t* a_rangeTileCounts, std::uint32_t a_flags) = 0; - virtual HRESULT CopyTileMappings(ID3D11Resource* a_destTiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_destRegionStartCoordinate, ID3D11Resource* a_sourceTiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_sourceRegionStartCoordinate, const D3D11_TILE_REGION_SIZE* a_tileRegionSize, std::uint32_t a_flags) = 0; - virtual void CopyTiles(ID3D11Resource* a_tiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_tileRegionStartCoordinate, const D3D11_TILE_REGION_SIZE* a_tileRegionSize, ID3D11Buffer* a_buffer, std::uint64_t a_bufferStartOffsetInBytes, std::uint32_t a_flags) = 0; - virtual void UpdateTiles(ID3D11Resource* a_destTiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_destTileRegionStartCoordinate, const D3D11_TILE_REGION_SIZE* a_destTileRegionSize, const void* a_sourceTileData, std::uint32_t a_flags) = 0; - virtual HRESULT ResizeTilePool(ID3D11Buffer* a_tilePool, std::uint64_t a_newSizeInBytes) = 0; - virtual void TiledResourceBarrier(ID3D11DeviceChild* a_tiledResourceOrViewAccessBeforeBarrier, ID3D11DeviceChild* a_tiledResourceOrViewAccessAfterBarrier) = 0; - virtual BOOL IsAnnotationEnabled(void) = 0; - virtual void SetMarkerInt(const wchar_t* a_label, std::int32_t a_data) = 0; - virtual void BeginEventInt(const wchar_t* a_label, std::int32_t a_data) = 0; - virtual void EndEvent(void) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Device2{ 0x9D06DFFA, 0xD1E5, 0x4D07, { 0x83, 0xA8, 0x1B, 0xB1, 0x23, 0xF2, 0xF8, 0x41 } }; - inline constexpr IID IID_ID3D11DeviceContext2{ 0x420D5B32, 0xB90C, 0x4DA4, { 0xBE, 0xF0, 0x35, 0x9F, 0x6A, 0x24, 0xA8, 0x3A } }; -} diff --git a/include/REX/W32/D3D11_3.h b/include/REX/W32/D3D11_3.h deleted file mode 100644 index 02a9751..0000000 --- a/include/REX/W32/D3D11_3.h +++ /dev/null @@ -1,301 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11_2.h" - -namespace REX::W32 -{ - struct ID3D11Device3; - struct ID3D11DeviceContext3; - struct ID3D11DeviceContext4; - struct ID3D11Fence; - struct ID3D11Query1; - struct ID3D11RasterizerState2; - struct ID3D11RenderTargetView1; - struct ID3D11ShaderResourceView1; - struct ID3D11Texture2D1; - struct ID3D11Texture3D1; - struct ID3D11UnorderedAccessView1; -} - -namespace REX::W32 -{ - enum D3D11_CONSERVATIVE_RASTERIZATION_MODE - { - D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, - D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, - }; - - enum D3D11_CONTEXT_TYPE - { - D3D11_CONTEXT_TYPE_ALL = 0, - D3D11_CONTEXT_TYPE_3D = 1, - D3D11_CONTEXT_TYPE_COMPUTE = 2, - D3D11_CONTEXT_TYPE_COPY = 3, - D3D11_CONTEXT_TYPE_VIDEO = 4, - }; - - enum D3D11_FENCE_FLAG - { - D3D11_FENCE_FLAG_NONE = 0, - D3D11_FENCE_FLAG_SHARED = 0x2, - D3D11_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x4, - D3D11_FENCE_FLAG_NON_MONITORED = 0x8, - }; - - enum D3D11_TEXTURE_LAYOUT - { - D3D11_TEXTURE_LAYOUT_UNDEFINED = 0, - D3D11_TEXTURE_LAYOUT_ROW_MAJOR = 1, - D3D11_TEXTURE_LAYOUT_64K_STANDARD_SWIZZLE = 2, - }; -} - -namespace REX::W32 -{ - struct D3D11_TEX2D_ARRAY_RTV1 - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_ARRAY_SRV1 - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_ARRAY_UAV1 - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_RTV1 - { - std::uint32_t mipSlice; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_SRV1 - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_UAV1 - { - std::uint32_t mipSlice; - std::uint32_t planeSlice; - }; - - struct D3D11_QUERY_DESC1 - { - D3D11_QUERY query; - std::uint32_t miscFlags; - D3D11_CONTEXT_TYPE contextType; - }; - - struct D3D11_RASTERIZER_DESC2 - { - D3D11_FILL_MODE fillMode; - D3D11_CULL_MODE cullMode; - BOOL frontCounterClockwise; - std::int32_t depthBias; - float depthBiasClamp; - float slopeScaledDepthBias; - BOOL depthClipEnable; - BOOL scissorEnable; - BOOL multisampleEnable; - BOOL antialiasedLineEnable; - std::uint32_t forcedSampleCount; - D3D11_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster; - }; - - struct D3D11_RENDER_TARGET_VIEW_DESC1 - { - DXGI_FORMAT format; - D3D11_RTV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_RTV buffer; - D3D11_TEX1D_RTV texture1D; - D3D11_TEX1D_ARRAY_RTV texture1DArray; - D3D11_TEX2D_RTV1 texture2D; - D3D11_TEX2D_ARRAY_RTV1 texture2DArray; - D3D11_TEX2DMS_RTV texture2DMS; - D3D11_TEX2DMS_ARRAY_RTV texture2DMSArray; - D3D11_TEX3D_RTV texture3D; - }; - }; - - struct D3D11_TEXTURE2D_DESC1 - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t mipLevels; - std::uint32_t arraySize; - DXGI_FORMAT format; - DXGI_SAMPLE_DESC sampleDesc; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - D3D11_TEXTURE_LAYOUT textureLayout; - }; - - struct D3D11_TEXTURE3D_DESC1 - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t depth; - std::uint32_t mipLevels; - DXGI_FORMAT format; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - D3D11_TEXTURE_LAYOUT textureLayout; - }; - - struct D3D11_SHADER_RESOURCE_VIEW_DESC1 - { - DXGI_FORMAT format; - D3D11_SRV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_SRV buffer; - D3D11_TEX1D_SRV texture1D; - D3D11_TEX1D_ARRAY_SRV texture1DArray; - D3D11_TEX2D_SRV1 texture2D; - D3D11_TEX2D_ARRAY_SRV1 texture2DArray; - D3D11_TEX2DMS_SRV texture2DMS; - D3D11_TEX2DMS_ARRAY_SRV texture2DMSArray; - D3D11_TEX3D_SRV texture3D; - D3D11_TEXCUBE_SRV textureCube; - D3D11_TEXCUBE_ARRAY_SRV textureCubeArray; - D3D11_BUFFEREX_SRV bufferEx; - }; - }; - - struct D3D11_UNORDERED_ACCESS_VIEW_DESC1 - { - DXGI_FORMAT format; - D3D11_UAV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_UAV buffer; - D3D11_TEX1D_UAV texture1D; - D3D11_TEX1D_ARRAY_UAV texture1DArray; - D3D11_TEX2D_UAV1 texture2D; - D3D11_TEX2D_ARRAY_UAV1 texture2DArray; - D3D11_TEX3D_UAV texture3D; - }; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("A05C8C37-D2C6-4732-B3A0-9CE0B0DC9AE6")) - ID3D11Device3 : public ID3D11Device2 - { - virtual HRESULT CreateTexture2D1(const D3D11_TEXTURE2D_DESC1* a_desc1, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture2D1** a_texture2D) = 0; - virtual HRESULT CreateTexture3D1(const D3D11_TEXTURE3D_DESC1* a_desc1, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture3D1** a_texture3D) = 0; - virtual HRESULT CreateRasterizerState2(const D3D11_RASTERIZER_DESC2* a_rasterizerDesc, ID3D11RasterizerState2** a_rasterizerState) = 0; - virtual HRESULT CreateShaderResourceView1(ID3D11Resource* a_resource, const D3D11_SHADER_RESOURCE_VIEW_DESC1* a_desc1, ID3D11ShaderResourceView1** a_srView1) = 0; - virtual HRESULT CreateUnorderedAccessView1(ID3D11Resource* a_resource, const D3D11_UNORDERED_ACCESS_VIEW_DESC1* a_desc1, ID3D11UnorderedAccessView1** a_uaView1) = 0; - virtual HRESULT CreateRenderTargetView1(ID3D11Resource* a_resource, const D3D11_RENDER_TARGET_VIEW_DESC1* a_desc1, ID3D11RenderTargetView1** a_rtView1) = 0; - virtual HRESULT CreateQuery1(const D3D11_QUERY_DESC1* a_queryDesc1, ID3D11Query1** a_query1) = 0; - virtual void GetImmediateContext3(ID3D11DeviceContext3** a_immediateContext) = 0; - virtual HRESULT CreateDeferredContext3(std::uint32_t a_contextFlags, ID3D11DeviceContext3** a_deferredContext) = 0; - virtual void WriteToSubresource(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, const D3D11_BOX* a_dstBox, const void* a_srcData, std::uint32_t a_srcRowPitch, std::uint32_t a_srcDepthPitch) = 0; - virtual void ReadFromSubresource(void* a_dstData, std::uint32_t a_dstRowPitch, std::uint32_t a_dstDepthPitch, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, const D3D11_BOX* a_srcBox) = 0; - }; - - struct __declspec(novtable, uuid("b4e3c01d-e79e-4637-91b2-510e9f4c9b8f")) - ID3D11DeviceContext3 : public ID3D11DeviceContext2 - { - virtual void Flush1(D3D11_CONTEXT_TYPE a_contextType, HANDLE a_event) = 0; - virtual void SetHardwareProtectionState(BOOL a_hwProtectionEnable) = 0; - virtual void GetHardwareProtectionState(BOOL* a_hwProtectionEnable) = 0; - }; - - struct __declspec(novtable, uuid("917600da-f58c-4c33-98d8-3e15b390fa24")) - ID3D11DeviceContext4 : public ID3D11DeviceContext3 - { - virtual HRESULT Signal(ID3D11Fence* a_fence, std::uint64_t a_value) = 0; - virtual HRESULT Wait(ID3D11Fence* a_fence, std::uint64_t a_value) = 0; - }; - - struct __declspec(novtable, uuid("affde9d1-1df7-4bb7-8a34-0f46251dab80")) - ID3D11Fence : public ID3D11DeviceChild - { - virtual HRESULT CreateSharedHandle(const SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_access, const wchar_t* a_name, HANDLE* a_handle) = 0; - virtual std::uint64_t GetCompletedValue(void) = 0; - virtual HRESULT SetEventOnCompletion(std::uint64_t a_value, HANDLE a_event) = 0; - }; - - struct __declspec(novtable, uuid("631b4766-36dc-461d-8db6-c47e13e60916")) - ID3D11Query1 : public ID3D11Query - { - virtual void GetDesc1(D3D11_QUERY_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("6fbd02fb-209f-46c4-b059-2ed15586a6ac")) - ID3D11RasterizerState2 : public ID3D11RasterizerState1 - { - virtual void GetDesc2(D3D11_RASTERIZER_DESC2* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("ffbe2e23-f011-418a-ac56-5ceed7c5b94b")) - ID3D11RenderTargetView1 : public ID3D11RenderTargetView - { - virtual void GetDesc1(D3D11_RENDER_TARGET_VIEW_DESC1* a_desc1) = 0; - }; - - struct __declspec(novtable, uuid("91308b87-9040-411d-8c67-c39253ce3802")) - ID3D11ShaderResourceView1 : public ID3D11ShaderResourceView - { - virtual void GetDesc1(D3D11_SHADER_RESOURCE_VIEW_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("51218251-1E33-4617-9CCB-4D3A4367E7BB")) - ID3D11Texture2D1 : public ID3D11Texture2D - { - virtual void GetDesc1(D3D11_TEXTURE2D_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("0C711683-2853-4846-9BB0-F3E60639E46A")) - ID3D11Texture3D1 : public ID3D11Texture3D - { - virtual void GetDesc1(D3D11_TEXTURE3D_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("7b3b6153-a886-4544-ab37-6537c8500403")) - ID3D11UnorderedAccessView1 : public ID3D11UnorderedAccessView - { - virtual void GetDesc1(D3D11_UNORDERED_ACCESS_VIEW_DESC1* a_desc) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Device3{ 0xA05C8C37, 0xD2C6, 0x4732, { 0xB3, 0xA0, 0x9C, 0xE0, 0xB0, 0xDC, 0x9A, 0xE6 } }; - inline constexpr IID IID_ID3D11DeviceContext3{ 0xB4E3C01D, 0xE79E, 0x4637, { 0x91, 0xB2, 0x51, 0x0E, 0x9F, 0x4C, 0x9B, 0x8F } }; - inline constexpr IID IID_ID3D11DeviceContext4{ 0x917600DA, 0xF58C, 0x4C33, { 0x98, 0xD8, 0x3E, 0x15, 0xB3, 0x90, 0xFA, 0x24 } }; - inline constexpr IID IID_ID3D11Fence{ 0xAFFDE9D1, 0x1DF7, 0x4BB7, { 0x8A, 0x34, 0x0F, 0x46, 0x25, 0x1D, 0xAB, 0x80 } }; - inline constexpr IID IID_ID3D11Query1{ 0x631B4766, 0x36DC, 0x461D, { 0x8D, 0xB6, 0xC4, 0x7E, 0x13, 0xE6, 0x09, 0x16 } }; - inline constexpr IID IID_ID3D11RasterizerState2{ 0x6FBD02FB, 0x209F, 0x46C4, { 0xb0, 0x59, 0x2E, 0xD1, 0x55, 0x86, 0xA6, 0xAC } }; - inline constexpr IID IID_ID3D11RenderTargetView1{ 0xFFBE2E23, 0xF011, 0x418A, { 0xAC, 0x56, 0x5C, 0xEE, 0xD7, 0xC5, 0xB9, 0x4B } }; - inline constexpr IID IID_ID3D11ShaderResourceView1{ 0x91308B87, 0x9040, 0x411D, { 0x8C, 0x67, 0xC3, 0x92, 0x53, 0xCE, 0x38, 0x02 } }; - inline constexpr IID IID_ID3D11Texture2D1{ 0x51218251, 0x1E33, 0x4617, { 0x9C, 0xCB, 0x4D, 0x3A, 0x43, 0x67, 0xE7, 0xBB } }; - inline constexpr IID IID_ID3D11Texture3D1{ 0x0C711683, 0x2853, 0x4846, { 0x9B, 0xB0, 0xF3, 0xE6, 0x06, 0x39, 0xE4, 0x6A } }; - inline constexpr IID IID_ID3D11UnorderedAccessView1{ 0x7B3B6153, 0xA886, 0x4544, { 0xAB, 0x37, 0x65, 0x37, 0xC8, 0x50, 0x04, 0x03 } }; -} diff --git a/include/REX/W32/D3D11_4.h b/include/REX/W32/D3D11_4.h deleted file mode 100644 index 52514ce..0000000 --- a/include/REX/W32/D3D11_4.h +++ /dev/null @@ -1,138 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11_3.h" -#include "REX/W32/DXGI_5.h" - -namespace REX::W32 -{ - struct ID3D11Device4; - struct ID3D11Device5; - struct ID3D11Multithread; - struct ID3D11VideoContext2; - struct ID3D11VideoContext3; - struct ID3D11VideoDevice2; -} - -namespace REX::W32 -{ - enum D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS - { - D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAG_NONE = 0, - }; - - enum D3D11_FEATURE_VIDEO - { - D3D11_FEATURE_VIDEO_DECODER_HISTOGRAM = 0, - }; - - enum D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT - { - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_Y = 0, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_U = 1, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_V = 2, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_R = 0, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_G = 1, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_B = 2, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_A = 3, - }; - - enum D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS - { - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_NONE = 0, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_Y = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_Y), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_U = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_U), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_V = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_V), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_R = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_R), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_G = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_G), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_B = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_B), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_A = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_A), - }; -} - -namespace REX::W32 -{ - struct D3D11_FEATURE_DATA_D3D11_OPTIONS4 - { - BOOL extendedNV12SharedTextureSupported; - }; - - struct D3D11_FEATURE_DATA_VIDEO_DECODER_HISTOGRAM - { - D3D11_VIDEO_DECODER_DESC decoderDesc; - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS components; - std::uint32_t binCount; - std::uint32_t counterBitDepth; - }; - - struct D3D11_VIDEO_DECODER_BUFFER_DESC2 - { - D3D11_VIDEO_DECODER_BUFFER_TYPE bufferType; - std::uint32_t dataOffset; - std::uint32_t dataSize; - void* iv; - std::uint32_t ivSize; - D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK* subSampleMappingBlock; - std::uint32_t subSampleMappingCount; - std::uint32_t cBlocksStripeEncrypted; - std::uint32_t cBlocksStripeClear; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("8992ab71-02e6-4b8d-ba48-b056dcda42c4")) - ID3D11Device4 : public ID3D11Device3 - { - virtual HRESULT RegisterDeviceRemovedEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterDeviceRemoved(std::uint32_t a_cookie) = 0; - }; - - struct __declspec(novtable, uuid("8ffde202-a0e7-45df-9e01-e837801b5ea0")) - ID3D11Device5 : public ID3D11Device4 - { - virtual HRESULT OpenSharedFence(HANDLE a_fenceHandle, const IID& a_returnedInterface, void** a_fence) = 0; - virtual HRESULT CreateFence(std::uint64_t a_initialValue, D3D11_FENCE_FLAG a_flags, const IID& a_returnedInterface, void** a_fence) = 0; - }; - - struct __declspec(novtable, uuid("9B7E4E00-342C-4106-A19F-4F2704F689F0")) - ID3D11Multithread : public IUnknown - { - virtual void Enter(void) = 0; - virtual void Leave(void) = 0; - virtual BOOL SetMultithreadProtected(BOOL a_mtProtect) = 0; - virtual BOOL GetMultithreadProtected(void) = 0; - }; - - struct __declspec(novtable, uuid("C4E7374C-6243-4D1B-AE87-52B4F740E261")) - ID3D11VideoContext2 : public ID3D11VideoContext1 - { - virtual void VideoProcessorSetOutputHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, DXGI_HDR_METADATA_TYPE a_type, std::uint32_t a_size, const void* a_hdrMetaData) = 0; - virtual void VideoProcessorGetOutputHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, DXGI_HDR_METADATA_TYPE* a_type, std::uint32_t a_size, void* a_hdrMetaData) = 0; - virtual void VideoProcessorSetStreamHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_HDR_METADATA_TYPE a_type, std::uint32_t a_size, const void* a_hdrMetaData) = 0; - virtual void VideoProcessorGetStreamHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_HDR_METADATA_TYPE* a_type, std::uint32_t a_size, void* a_hdrMetaData) = 0; - }; - - struct __declspec(novtable, uuid("A9E2FAA0-CB39-418F-A0B7-D8AAD4DE672E")) - ID3D11VideoContext3 : public ID3D11VideoContext2 - { - virtual HRESULT DecoderBeginFrame1(ID3D11VideoDecoder* a_decoder, ID3D11VideoDecoderOutputView* a_view, std::uint32_t a_contentKeySize, const void* a_contentKey, std::uint32_t a_numComponentHistograms, const std::uint32_t* a_histogramOffsets, ID3D11Buffer* const* a_histogramBuffers) = 0; - virtual HRESULT SubmitDecoderBuffers2(ID3D11VideoDecoder* a_decoder, std::uint32_t a_numBuffers, const D3D11_VIDEO_DECODER_BUFFER_DESC2* a_bufferDesc) = 0; - }; - - struct __declspec(novtable, uuid("59C0CB01-35F0-4A70-8F67-87905C906A53")) - ID3D11VideoDevice2 : public ID3D11VideoDevice1 - { - virtual HRESULT CheckFeatureSupport(D3D11_FEATURE_VIDEO a_feature, void* a_featureSupportData, std::uint32_t a_featureSupportDataSize) = 0; - virtual HRESULT NegotiateCryptoSessionKeyExchangeMT(ID3D11CryptoSession* a_cryptoSession, D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS a_flags, std::uint32_t a_dataSize, void* a_data) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Device4{ 0x8992AB71, 0x02E6, 0x4B8D, { 0xBA, 0x48, 0xB0, 0x56, 0xDC, 0xDA, 0x42, 0xC4 } }; - inline constexpr IID IID_ID3D11Device5{ 0x8FFDE202, 0xA0E7, 0x45DF, { 0x9E, 0x01, 0xE8, 0x37, 0x80, 0x1B, 0x5E, 0xA0 } }; - inline constexpr IID IID_ID3D11Multithread{ 0x9B7E4E00, 0x342C, 0x4106, { 0xA1, 0x9F, 0x4F, 0x27, 0x04, 0xF6, 0x89, 0xF0 } }; - inline constexpr IID IID_ID3D11VideoContext2{ 0xC4E7374C, 0x6243, 0x4D1B, { 0xAE, 0x87, 0x52, 0xB4, 0xF7, 0x40, 0xE2, 0x61 } }; - inline constexpr IID IID_ID3D11VideoContext3{ 0xA9E2FAA0, 0xCB39, 0x418F, { 0xA0, 0xB7, 0xD8, 0xAA, 0xD4, 0xDE, 0x67, 0x2E } }; - inline constexpr IID IID_ID3D11VideoDevice2{ 0x59C0CB01, 0x35F0, 0x4A70, { 0x8F, 0x67, 0x87, 0x90, 0x5C, 0x90, 0x6A, 0x53 } }; -} diff --git a/include/REX/W32/D3DCOMPILER.h b/include/REX/W32/D3DCOMPILER.h deleted file mode 100644 index 0cca3be..0000000 --- a/include/REX/W32/D3DCOMPILER.h +++ /dev/null @@ -1,154 +0,0 @@ -#pragma once - -#include "REX/W32/D3D.h" - -namespace REX::W32 -{ - struct ID3DBlob; - struct ID3DInclude; - struct ID3D10Effect; - struct ID3D11FunctionLinkingGraph; - struct ID3D11Linker; - struct ID3D11Module; -} - -namespace REX::W32 -{ - enum D3D_BLOB_PART - { - D3D_BLOB_INPUT_SIGNATURE_BLOB, - D3D_BLOB_OUTPUT_SIGNATURE_BLOB, - D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, - D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, - D3D_BLOB_ALL_SIGNATURE_BLOB, - D3D_BLOB_DEBUG_INFO, - D3D_BLOB_LEGACY_SHADER, - D3D_BLOB_XNA_PREPASS_SHADER, - D3D_BLOB_XNA_SHADER, - D3D_BLOB_PDB, - D3D_BLOB_PRIVATE_DATA, - D3D_BLOB_ROOT_SIGNATURE, - D3D_BLOB_DEBUG_NAME, - D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000, - D3D_BLOB_TEST_COMPILE_DETAILS, - D3D_BLOB_TEST_COMPILE_PERF, - D3D_BLOB_TEST_COMPILE_REPORT, - }; - - enum D3D_DISASM_FLAGS - { - D3D_DISASM_ENABLE_COLOR_CODE = 0x00000001, - D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS = 0x00000002, - D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING = 0x00000004, - D3D_DISASM_ENABLE_INSTRUCTION_CYCLE = 0x00000008, - D3D_DISASM_DISABLE_DEBUG_INFO = 0x00000010, - D3D_DISASM_ENABLE_INSTRUCTION_OFFSET = 0x00000020, - D3D_DISASM_INSTRUCTION_ONLY = 0x00000040, - D3D_DISASM_PRINT_HEX_LITERALS = 0x00000080, - }; - - enum D3DCOMPILE_EFFECT - { - D3DCOMPILE_EFFECT_CHILD_EFFECT = (1 << 0), - D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS = (1 << 1), - }; - - enum D3DCOMPILE_FLAGS - { - D3DCOMPILE_DEBUG = (1 << 0), - D3DCOMPILE_SKIP_VALIDATION = (1 << 1), - D3DCOMPILE_SKIP_OPTIMIZATION = (1 << 2), - D3DCOMPILE_PACK_MATRIX_ROW_MAJOR = (1 << 3), - D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR = (1 << 4), - D3DCOMPILE_PARTIAL_PRECISION = (1 << 5), - D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT = (1 << 6), - D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT = (1 << 7), - D3DCOMPILE_NO_PRESHADER = (1 << 8), - D3DCOMPILE_AVOID_FLOW_CONTROL = (1 << 9), - D3DCOMPILE_PREFER_FLOW_CONTROL = (1 << 10), - D3DCOMPILE_ENABLE_STRICTNESS = (1 << 11), - D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY = (1 << 12), - D3DCOMPILE_IEEE_STRICTNESS = (1 << 13), - D3DCOMPILE_OPTIMIZATION_LEVEL0 = (1 << 14), - D3DCOMPILE_OPTIMIZATION_LEVEL1 = 0, - D3DCOMPILE_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15)), - D3DCOMPILE_OPTIMIZATION_LEVEL3 = (1 << 15), - D3DCOMPILE_RESERVED16 = (1 << 16), - D3DCOMPILE_RESERVED17 = (1 << 17), - D3DCOMPILE_WARNINGS_ARE_ERRORS = (1 << 18), - D3DCOMPILE_RESOURCES_MAY_ALIAS = (1 << 19), - D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES = (1 << 20), - D3DCOMPILE_ALL_RESOURCES_BOUND = (1 << 21), - D3DCOMPILE_DEBUG_NAME_FOR_SOURCE = (1 << 22), - D3DCOMPILE_DEBUG_NAME_FOR_BINARY = (1 << 23), - }; - - enum D3DCOMPILE_FLAGS2 - { - D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST = 0, - D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 = (1 << 4), - D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 = (1 << 5), - }; - - enum D3DCOMPILE_SECDATA_FLAGS - { - D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS = 0x00000001, - D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS = 0x00000002, - D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH = 0x00000004, - }; - - enum D3DCOMPILER_STRIP_FLAGS - { - D3DCOMPILER_STRIP_REFLECTION_DATA = 0x00000001, - D3DCOMPILER_STRIP_DEBUG_INFO = 0x00000002, - D3DCOMPILER_STRIP_TEST_BLOBS = 0x00000004, - D3DCOMPILER_STRIP_PRIVATE_DATA = 0x00000008, - D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x00000010, - D3DCOMPILER_STRIP_FORCE_DWORD = 0x7FFFFFFF, - }; -} - -namespace REX::W32 -{ - struct D3D_SHADER_DATA - { - const void* bytecode; - std::size_t bytecodeLength; - }; -} - -namespace REX::W32 -{ - inline const auto D3D_COMPILE_STANDARD_FILE_INCLUDE{ reinterpret_cast(static_cast(1)) }; - inline constexpr auto D3D_COMPRESS_SHADER_KEEP_ALL_PARTS{ 0x00000001u }; - inline constexpr auto D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE{ 0x00000001u }; -} - -namespace REX::W32 -{ - HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs); - HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs); - HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs); - HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData); - HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob); - HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph); - HRESULT D3DCreateLinker(ID3D11Linker** a_linker); - HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders); - HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly); - HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly); - HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly); - HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part); - HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo); - HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob); - HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob); - HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob); - HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts); - HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module); - HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs); - HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents); - HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector); - HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector); - HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader); - HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob); - HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite); -} diff --git a/include/REX/W32/DBGHELP.h b/include/REX/W32/DBGHELP.h deleted file mode 100644 index 350b3eb..0000000 --- a/include/REX/W32/DBGHELP.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -namespace REX::W32 -{ - // symbol name undecoration flags - inline constexpr auto UNDNAME_NO_MS_KEYWORDS{ 0x00000002u }; - inline constexpr auto UNDNAME_NO_FUNCTION_RETURNS{ 0x00000004u }; - inline constexpr auto UNDNAME_NO_ALLOCATION_MODEL{ 0x00000008u }; - inline constexpr auto UNDNAME_NO_ALLOCATION_LANGUAGE{ 0x00000010u }; - inline constexpr auto UNDNAME_NO_THISTYPE{ 0x00000060u }; - inline constexpr auto UNDNAME_NO_ACCESS_SPECIFIERS{ 0x00000080u }; - inline constexpr auto UNDNAME_NO_THROW_SIGNATURES{ 0x00000100u }; - inline constexpr auto UNDNAME_NO_RETURN_UDT_MODEL{ 0x00000400u }; - inline constexpr auto UNDNAME_NAME_ONLY{ 0x00001000u }; - inline constexpr auto UNDNAME_NO_ARGUMENTS{ 0x00002000u }; -} - -namespace REX::W32 -{ - std::uint32_t UnDecorateSymbolName(const char* a_name, char* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept; - std::uint32_t UnDecorateSymbolNameW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept; -} diff --git a/include/REX/W32/DINPUT.h b/include/REX/W32/DINPUT.h deleted file mode 100644 index 8a95004..0000000 --- a/include/REX/W32/DINPUT.h +++ /dev/null @@ -1,499 +0,0 @@ -#pragma once - -#include "REX/W32/COM.h" -#include "REX/W32/D3D.h" - -namespace REX::W32 -{ - struct IDirectInput8A; - struct IDirectInputDevice8A; - struct IDirectInputEffect; -} - -namespace REX::W32 -{ - enum DIK : std::uint32_t - { - DIK_ESCAPE = 0x1, - DIK_1 = 0x2, - DIK_2 = 0x3, - DIK_3 = 0x4, - DIK_4 = 0x5, - DIK_5 = 0x6, - DIK_6 = 0x7, - DIK_7 = 0x8, - DIK_8 = 0x9, - DIK_9 = 0xA, - DIK_0 = 0xB, - DIK_MINUS = 0xC, - DIK_EQUALS = 0xD, - DIK_BACK = 0xE, - DIK_TAB = 0xF, - DIK_Q = 0x10, - DIK_W = 0x11, - DIK_E = 0x12, - DIK_R = 0x13, - DIK_T = 0x14, - DIK_Y = 0x15, - DIK_U = 0x16, - DIK_I = 0x17, - DIK_O = 0x18, - DIK_P = 0x19, - DIK_LBRACKET = 0x1A, - DIK_RBRACKET = 0x1B, - DIK_RETURN = 0x1C, - DIK_LCONTROL = 0x1D, - DIK_A = 0x1E, - DIK_S = 0x1F, - DIK_D = 0x20, - DIK_F = 0x21, - DIK_G = 0x22, - DIK_H = 0x23, - DIK_J = 0x24, - DIK_K = 0x25, - DIK_L = 0x26, - DIK_SEMICOLON = 0x27, - DIK_APOSTROPHE = 0x28, - DIK_GRAVE = 0x29, - DIK_LSHIFT = 0x2A, - DIK_BACKSLASH = 0x2B, - DIK_Z = 0x2C, - DIK_X = 0x2D, - DIK_C = 0x2E, - DIK_V = 0x2F, - DIK_B = 0x30, - DIK_N = 0x31, - DIK_M = 0x32, - DIK_COMMA = 0x33, - DIK_PERIOD = 0x34, - DIK_SLASH = 0x35, - DIK_RSHIFT = 0x36, - DIK_MULTIPLY = 0x37, - DIK_LMENU = 0x38, - DIK_SPACE = 0x39, - DIK_CAPITAL = 0x3A, - DIK_F1 = 0x3B, - DIK_F2 = 0x3C, - DIK_F3 = 0x3D, - DIK_F4 = 0x3E, - DIK_F5 = 0x3F, - DIK_F6 = 0x40, - DIK_F7 = 0x41, - DIK_F8 = 0x42, - DIK_F9 = 0x43, - DIK_F10 = 0x44, - DIK_NUMLOCK = 0x45, - DIK_SCROLL = 0x46, - DIK_NUMPAD7 = 0x47, - DIK_NUMPAD8 = 0x48, - DIK_NUMPAD9 = 0x49, - DIK_SUBTRACT = 0x4A, - DIK_NUMPAD4 = 0x4B, - DIK_NUMPAD5 = 0x4C, - DIK_NUMPAD6 = 0x4D, - DIK_ADD = 0x4E, - DIK_NUMPAD1 = 0x4F, - DIK_NUMPAD2 = 0x50, - DIK_NUMPAD3 = 0x51, - DIK_NUMPAD0 = 0x52, - DIK_DECIMAL = 0x53, - DIK_OEM_102 = 0x56, - DIK_F11 = 0x57, - DIK_F12 = 0x58, - DIK_F13 = 0x64, - DIK_F14 = 0x65, - DIK_F15 = 0x66, - DIK_KANA = 0x70, - DIK_ABNT_C1 = 0x73, - DIK_CONVERT = 0x79, - DIK_NOCONVERT = 0x7B, - DIK_YEN = 0x7D, - DIK_ABNT_C2 = 0x7E, - DIK_NUMPADEQUALS = 0x8D, - DIK_PREVTRACK = 0x90, - DIK_AT = 0x91, - DIK_COLON = 0x92, - DIK_UNDERLINE = 0x93, - DIK_KANJI = 0x94, - DIK_STOP = 0x95, - DIK_AX = 0x96, - DIK_UNLABELED = 0x97, - DIK_NEXTTRACK = 0x99, - DIK_NUMPADENTER = 0x9C, - DIK_RCONTROL = 0x9D, - DIK_MUTE = 0xA0, - DIK_CALCULATOR = 0xA1, - DIK_PLAYPAUSE = 0xA2, - DIK_MEDIASTOP = 0xA4, - DIK_VOLUMEDOWN = 0xAE, - DIK_VOLUMEUP = 0xB0, - DIK_WEBHOME = 0xB2, - DIK_NUMPADCOMMA = 0xB3, - DIK_DIVIDE = 0xB5, - DIK_SYSRQ = 0xB7, - DIK_RMENU = 0xB8, - DIK_PAUSE = 0xC5, - DIK_HOME = 0xC7, - DIK_UP = 0xC8, - DIK_PRIOR = 0xC9, - DIK_LEFT = 0xCB, - DIK_RIGHT = 0xCD, - DIK_END = 0xCF, - DIK_DOWN = 0xD0, - DIK_NEXT = 0xD1, - DIK_INSERT = 0xD2, - DIK_DELETE = 0xD3, - DIK_LWIN = 0xDB, - DIK_RWIN = 0xDC, - DIK_APPS = 0xDD, - DIK_POWER = 0xDE, - DIK_SLEEP = 0xDF, - DIK_WAKE = 0xE3, - DIK_WEBSEARCH = 0xE5, - DIK_WEBFAVORITES = 0xE6, - DIK_WEBREFRESH = 0xE7, - DIK_WEBSTOP = 0xE8, - DIK_WEBFORWARD = 0xE9, - DIK_WEBBACK = 0xEA, - DIK_MYCOMPUTER = 0xEB, - DIK_MAIL = 0xEC, - DIK_MEDIASELECT = 0xED, - DIK_BACKSPACE = DIK_BACK, - DIK_NUMPADSTAR = DIK_MULTIPLY, - DIK_LALT = DIK_LMENU, - DIK_CAPSLOCK = DIK_CAPITAL, - DIK_NUMPADMINUS = DIK_SUBTRACT, - DIK_NUMPADPLUS = DIK_ADD, - DIK_NUMPADPERIOD = DIK_DECIMAL, - DIK_NUMPADSLASH = DIK_DIVIDE, - DIK_RALT = DIK_RMENU, - DIK_UPARROW = DIK_UP, - DIK_PGUP = DIK_PRIOR, - DIK_LEFTARROW = DIK_LEFT, - DIK_RIGHTARROW = DIK_RIGHT, - DIK_DOWNARROW = DIK_DOWN, - DIK_PGDN = DIK_NEXT - }; -} - -namespace REX::W32 -{ - struct DIENVELOPE; - struct DIOBJECTDATAFORMAT; - - struct DIACTIONA - { - std::uintptr_t appData; - std::uint32_t semantic; - std::uint32_t flags; - union - { - const char* actionName; - std::uint32_t resIdString; - }; - GUID guidInstance; - std::uint32_t objID; - std::uint32_t how; - }; - - struct DIACTIONFORMATA - { - std::uint32_t size; - std::uint32_t actionSize; - std::uint32_t dataSize; - std::uint32_t numActions; - DIACTIONA* action; - GUID guidActionMap; - std::uint32_t genre; - std::uint32_t bufferSize; - std::int32_t axisMin; - std::int32_t axisMax; - HINSTANCE instString; - FILETIME timeStamp; - std::uint32_t crc; - char actionMap[MAX_PATH]; - }; - - struct DICOLORSET - { - std::uint32_t size; - D3DCOLOR textFore; - D3DCOLOR textHighlight; - D3DCOLOR calloutLine; - D3DCOLOR calloutHighlight; - D3DCOLOR border; - D3DCOLOR controlFill; - D3DCOLOR highlightFill; - D3DCOLOR areaFill; - }; - - struct DICONFIGUREDEVICESPARAMSA - { - std::uint32_t size; - std::uint32_t users; - char* userNames; - std::uint32_t formatsSize; - DIACTIONFORMATA* formats; - HWND hwnd; - DICOLORSET dics; - IUnknown* unkDDSTarget; - }; - - struct DIDATAFORMAT - { - std::uint32_t size; - std::uint32_t objSize; - std::uint32_t flags; - std::uint32_t dataSize; - std::uint32_t numObjs; - DIOBJECTDATAFORMAT* odf; - }; - - struct DIDEVCAPS - { - std::uint32_t size; - std::uint32_t flags; - std::uint32_t devType; - std::uint32_t axes; - std::uint32_t buttons; - std::uint32_t povs; - std::uint32_t ffSamplePeriod; - std::uint32_t ffMinTimeResolution; - std::uint32_t firmwareRevision; - std::uint32_t hardwareRevision; - std::uint32_t ffDriverVersion; - }; - - struct DIDEVICEIMAGEINFOA - { - char imagePath[MAX_PATH]; - std::uint32_t flags; - std::uint32_t viewID; - RECT overlay; - std::uint32_t objID; - std::uint32_t validPts; - POINT calloutLine[5]; - RECT calloutRect; - std::uint32_t textAlign; - }; - - struct DIDEVICEIMAGEINFOHEADERA - { - std::uint32_t size; - std::uint32_t sizeImageInfo; - std::uint32_t views; - std::uint32_t buttons; - std::uint32_t axes; - std::uint32_t povs; - std::uint32_t bufferSize; - std::uint32_t bufferUsed; - DIDEVICEIMAGEINFOA* imageInfoArray; - }; - - struct DIDEVICEINSTANCEA - { - std::uint32_t size; - GUID guidInstance; - GUID guidProduct; - std::uint32_t devType; - char instanceName[MAX_PATH]; - char productName[MAX_PATH]; - GUID guidFFDriver; - - // DIRECTINPUT_VERSION >= 0x0500 - std::uint16_t usagePage; - std::uint16_t usage; - }; - - struct DIDEVICEOBJECTDATA - { - std::uint32_t ofs; - std::uint32_t data; - std::uint32_t timeStamp; - std::uint32_t sequence; - std::uintptr_t appData; - }; - - struct DIDEVICEOBJECTINSTANCEA - { - std::uint32_t size; - GUID guidType; - std::uint32_t ofs; - std::uint32_t type; - std::uint32_t flags; - char name[MAX_PATH]; - - // DIRECTINPUT_VERSION >= 0x0500 - std::uint32_t ffMaxForce; - std::uint32_t ffForceResolution; - std::uint16_t collectionNumber; - std::uint16_t designatorIndex; - std::uint16_t usagePage; - std::uint16_t usage; - std::uint32_t dimension; - std::uint16_t exponent; - std::uint16_t reportId; - }; - - struct DIEFFECT - { - std::uint32_t size; - std::uint32_t flags; - std::uint32_t duration; - std::uint32_t samplePeriod; - std::uint32_t gain; - std::uint32_t triggerButton; - std::uint32_t triggerRepeatInterval; - std::uint32_t axesSize; - std::uint32_t* axes; - std::int32_t* direction; - DIENVELOPE* envelope; - std::uint32_t typeSpecificParamsSize; - void* typeSpecificParams; - std::uint32_t startDelay; - }; - - struct DIENVELOPE - { - std::uint32_t size; - std::uint32_t attackLevel; - std::uint32_t attackTime; - std::uint32_t fadeLevel; - std::uint32_t fadeTime; - }; - - struct DIEFFECTINFOA - { - std::uint32_t size; - GUID guid; - std::uint32_t effectType; - std::uint32_t staticParams; - std::uint32_t dynamicParams; - char name[MAX_PATH]; - }; - - struct DIEFFESCAPE - { - std::uint32_t size; - std::uint32_t command; - void* inBuffer; - std::uint32_t inBufferSize; - void* outBuffer; - std::uint32_t outBufferSize; - }; - - struct DIFILEEFFECT - { - std::uint32_t size; - GUID guidEffect; - const DIEFFECT* effect; - char friendlyName[MAX_PATH]; - }; - - struct DIMOUSESTATE2 - { - std::int32_t x; - std::int32_t y; - std::int32_t z; - std::uint8_t rgbButtons[8]; - }; - - struct DIOBJECTDATAFORMAT - { - const GUID* guid; - std::uint32_t ofs; - std::uint32_t type; - std::uint32_t flags; - }; - - struct DIPROPHEADER - { - std::uint32_t size; - std::uint32_t headerSize; - std::uint32_t obj; - std::uint32_t how; - }; -} - -namespace REX::W32 -{ - using LPDICONFIGUREDEVICESCALLBACK = BOOL(__stdcall*)(IUnknown*, void*); - using LPDIENUMCREATEDEFFECTOBJECTSCALLBACK = BOOL(__stdcall*)(IDirectInputEffect*, void*); - using LPDIENUMDEVICESBYSEMANTICSCBA = BOOL(__stdcall*)(const DIDEVICEINSTANCEA*, IDirectInputDevice8A*, std::uint32_t, std::uint32_t, void*); - using LPDIENUMDEVICESCALLBACKA = BOOL(__stdcall*)(const DIDEVICEINSTANCEA*, void*); - using LPDIENUMDEVICEOBJECTSCALLBACKA = BOOL(__stdcall*)(const DIDEVICEOBJECTINSTANCEA*, void*); - using LPDIENUMEFFECTSCALLBACKA = BOOL(__stdcall*)(const DIEFFECTINFOA*, void*); - using LPDIENUMEFFECTSINFILECALLBACK = BOOL(__stdcall*)(const DIFILEEFFECT*, void*); -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("BF798030-483A-4DA2-AA99-5D64ED369700")) - IDirectInput8A : public IUnknown - { - virtual HRESULT CreateDevice(const GUID&, IDirectInputDevice8A**, IUnknown*) noexcept = 0; - virtual HRESULT EnumDevices(std::uint32_t, LPDIENUMDEVICESCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetDeviceStatus(const GUID&) noexcept = 0; - virtual HRESULT RunControlPanel(HWND, std::uint32_t) noexcept = 0; - virtual HRESULT Initialize(HINSTANCE, std::uint32_t) noexcept = 0; - virtual HRESULT FindDevice(const GUID&, const char*, GUID*) noexcept = 0; - virtual HRESULT EnumDevicesBySemantics(const char*, DIACTIONFORMATA*, LPDIENUMDEVICESBYSEMANTICSCBA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK, DICONFIGUREDEVICESPARAMSA*, std::uint32_t, void*) noexcept = 0; - }; - - struct __declspec(novtable, uuid("54D41080-DC15-4833-A41B-748F73A38179")) - IDirectInputDevice8A : public IUnknown - { - virtual HRESULT GetCapabilities(DIDEVCAPS*) noexcept = 0; - virtual HRESULT EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetProperty(const GUID&, DIPROPHEADER*) noexcept = 0; - virtual HRESULT SetProperty(const GUID&, const DIPROPHEADER*) noexcept = 0; - virtual HRESULT Acquire() noexcept = 0; - virtual HRESULT Unacquire() noexcept = 0; - virtual HRESULT GetDeviceState(std::uint32_t, void*) noexcept = 0; - virtual HRESULT GetDeviceData(std::uint32_t, DIDEVICEOBJECTDATA*, std::uint32_t*, std::uint32_t) noexcept = 0; - virtual HRESULT SetDataFormat(const DIDATAFORMAT*) noexcept = 0; - virtual HRESULT SetEventNotification(HANDLE) noexcept = 0; - virtual HRESULT SetCooperativeLevel(HWND, std::uint32_t) noexcept = 0; - virtual HRESULT GetObjectInfo(DIDEVICEOBJECTINSTANCEA*, std::uint32_t, std::uint32_t) noexcept = 0; - virtual HRESULT GetDeviceInfo(DIDEVICEINSTANCEA*) noexcept = 0; - virtual HRESULT RunControlPanel(HWND, std::uint32_t) noexcept = 0; - virtual HRESULT Initialize(HINSTANCE, std::uint32_t, const GUID&) noexcept = 0; - virtual HRESULT CreateEffect(const GUID&, const DIEFFECT*, IDirectInputEffect*, IUnknown*) noexcept = 0; - virtual HRESULT EnumEffects(LPDIENUMEFFECTSCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetEffectInfo(DIEFFECTINFOA*, const GUID&) noexcept = 0; - virtual HRESULT GetForceFeedbackState(std::uint32_t*) noexcept = 0; - virtual HRESULT SendForceFeedbackCommand(std::uint32_t) noexcept = 0; - virtual HRESULT EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, void*, std::uint32_t) noexcept = 0; - virtual HRESULT Escape(DIEFFESCAPE*) noexcept = 0; - virtual HRESULT Poll() noexcept = 0; - virtual HRESULT SendDeviceData(std::uint32_t, const DIDEVICEOBJECTDATA*, std::uint32_t*, std::uint32_t) noexcept = 0; - virtual HRESULT EnumEffectsInFile(const char*, LPDIENUMEFFECTSINFILECALLBACK, void*, std::uint32_t) noexcept = 0; - virtual HRESULT WriteEffectToFile(const char*, std::uint32_t, DIFILEEFFECT*, std::uint32_t) noexcept = 0; - virtual HRESULT BuildActionMap(DIACTIONFORMATA*, const char*, std::uint32_t) noexcept = 0; - virtual HRESULT SetActionMap(DIACTIONFORMATA*, const char*, std::uint32_t) noexcept = 0; - virtual HRESULT GetImageInfo(DIDEVICEIMAGEINFOHEADERA*) noexcept = 0; - }; - - struct __declspec(novtable, uuid("E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35")) - IDirectInputEffect : public IUnknown - { - virtual HRESULT Initialize(HINSTANCE, std::uint32_t, const GUID&) noexcept = 0; - virtual HRESULT GetEffectGuid(GUID*) noexcept = 0; - virtual HRESULT GetParameters(DIEFFECT*, std::uint32_t) noexcept = 0; - virtual HRESULT SetParameters(const DIEFFECT*, std::uint32_t) noexcept = 0; - virtual HRESULT Start(std::uint32_t, std::uint32_t) noexcept = 0; - virtual HRESULT Stop() noexcept = 0; - virtual HRESULT GetEffectStatus(std::uint32_t*) noexcept = 0; - virtual HRESULT Download() noexcept = 0; - virtual HRESULT Unload() noexcept = 0; - virtual HRESULT Escape(DIEFFESCAPE*) noexcept = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDirectInput8A{ 0xBF798030, 0x483A, 0x4DA2, { 0xAA, 0x99, 0x5D, 0x64, 0xED, 0x36, 0x97, 0x00 } }; - inline constexpr IID IID_IDirectInputDevice8A{ 0x54D41080, 0xDC15, 0x4833, { 0xA4, 0x1B, 0x74, 0x8F, 0x73, 0xA3, 0x81, 0x79 } }; - inline constexpr IID IID_IDirectInputEffect{ 0xE7E1F7C0, 0x88D2, 0x11D0, { 0x9A, 0xD0, 0x00, 0xA0, 0xC9, 0xA0, 0x6E, 0x35 } }; -} diff --git a/include/REX/W32/DXGI.h b/include/REX/W32/DXGI.h deleted file mode 100644 index 623b6bc..0000000 --- a/include/REX/W32/DXGI.h +++ /dev/null @@ -1,549 +0,0 @@ -#pragma once - -#include "REX/W32/COM.h" - -namespace REX::W32 -{ - struct IDXGIAdapter; - struct IDXGIAdapter1; - struct IDXGIDevice; - struct IDXGIDevice1; - struct IDXGIDeviceSubObject; - struct IDXGIFactory1; - struct IDXGIKeyedMutex; - struct IDXGIObject; - struct IDXGIOutput; - struct IDXGIResource; - struct IDXGISurface; - struct IDXGISurface1; - struct IDXGISwapChain; -} - -namespace REX::W32 -{ - enum DXGI_ADAPTER_FLAG - { - DXGI_ADAPTER_FLAG_NONE = 0, - DXGI_ADAPTER_FLAG_REMOTE = 1, - DXGI_ADAPTER_FLAG_SOFTWARE = 2, - DXGI_ADAPTER_FLAG_FORCE_DWORD = 0xFFFFFFFF, - }; - - enum DXGI_COLOR_SPACE_TYPE - { - DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0, - DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3, - DXGI_COLOR_SPACE_RESERVED = 4, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11, - DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13, - DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16, - DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17, - DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18, - DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19, - DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 = 20, - DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 = 21, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 = 22, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 = 23, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24, - DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF, - }; - - enum DXGI_FORMAT - { - DXGI_FORMAT_UNKNOWN = 0, - DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, - DXGI_FORMAT_R32G32B32A32_FLOAT = 2, - DXGI_FORMAT_R32G32B32A32_UINT = 3, - DXGI_FORMAT_R32G32B32A32_SINT = 4, - DXGI_FORMAT_R32G32B32_TYPELESS = 5, - DXGI_FORMAT_R32G32B32_FLOAT = 6, - DXGI_FORMAT_R32G32B32_UINT = 7, - DXGI_FORMAT_R32G32B32_SINT = 8, - DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, - DXGI_FORMAT_R16G16B16A16_FLOAT = 10, - DXGI_FORMAT_R16G16B16A16_UNORM = 11, - DXGI_FORMAT_R16G16B16A16_UINT = 12, - DXGI_FORMAT_R16G16B16A16_SNORM = 13, - DXGI_FORMAT_R16G16B16A16_SINT = 14, - DXGI_FORMAT_R32G32_TYPELESS = 15, - DXGI_FORMAT_R32G32_FLOAT = 16, - DXGI_FORMAT_R32G32_UINT = 17, - DXGI_FORMAT_R32G32_SINT = 18, - DXGI_FORMAT_R32G8X24_TYPELESS = 19, - DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, - DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, - DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, - DXGI_FORMAT_R10G10B10A2_UNORM = 24, - DXGI_FORMAT_R10G10B10A2_UINT = 25, - DXGI_FORMAT_R11G11B10_FLOAT = 26, - DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, - DXGI_FORMAT_R8G8B8A8_UNORM = 28, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, - DXGI_FORMAT_R8G8B8A8_UINT = 30, - DXGI_FORMAT_R8G8B8A8_SNORM = 31, - DXGI_FORMAT_R8G8B8A8_SINT = 32, - DXGI_FORMAT_R16G16_TYPELESS = 33, - DXGI_FORMAT_R16G16_FLOAT = 34, - DXGI_FORMAT_R16G16_UNORM = 35, - DXGI_FORMAT_R16G16_UINT = 36, - DXGI_FORMAT_R16G16_SNORM = 37, - DXGI_FORMAT_R16G16_SINT = 38, - DXGI_FORMAT_R32_TYPELESS = 39, - DXGI_FORMAT_D32_FLOAT = 40, - DXGI_FORMAT_R32_FLOAT = 41, - DXGI_FORMAT_R32_UINT = 42, - DXGI_FORMAT_R32_SINT = 43, - DXGI_FORMAT_R24G8_TYPELESS = 44, - DXGI_FORMAT_D24_UNORM_S8_UINT = 45, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, - DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, - DXGI_FORMAT_R8G8_TYPELESS = 48, - DXGI_FORMAT_R8G8_UNORM = 49, - DXGI_FORMAT_R8G8_UINT = 50, - DXGI_FORMAT_R8G8_SNORM = 51, - DXGI_FORMAT_R8G8_SINT = 52, - DXGI_FORMAT_R16_TYPELESS = 53, - DXGI_FORMAT_R16_FLOAT = 54, - DXGI_FORMAT_D16_UNORM = 55, - DXGI_FORMAT_R16_UNORM = 56, - DXGI_FORMAT_R16_UINT = 57, - DXGI_FORMAT_R16_SNORM = 58, - DXGI_FORMAT_R16_SINT = 59, - DXGI_FORMAT_R8_TYPELESS = 60, - DXGI_FORMAT_R8_UNORM = 61, - DXGI_FORMAT_R8_UINT = 62, - DXGI_FORMAT_R8_SNORM = 63, - DXGI_FORMAT_R8_SINT = 64, - DXGI_FORMAT_A8_UNORM = 65, - DXGI_FORMAT_R1_UNORM = 66, - DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, - DXGI_FORMAT_R8G8_B8G8_UNORM = 68, - DXGI_FORMAT_G8R8_G8B8_UNORM = 69, - DXGI_FORMAT_BC1_TYPELESS = 70, - DXGI_FORMAT_BC1_UNORM = 71, - DXGI_FORMAT_BC1_UNORM_SRGB = 72, - DXGI_FORMAT_BC2_TYPELESS = 73, - DXGI_FORMAT_BC2_UNORM = 74, - DXGI_FORMAT_BC2_UNORM_SRGB = 75, - DXGI_FORMAT_BC3_TYPELESS = 76, - DXGI_FORMAT_BC3_UNORM = 77, - DXGI_FORMAT_BC3_UNORM_SRGB = 78, - DXGI_FORMAT_BC4_TYPELESS = 79, - DXGI_FORMAT_BC4_UNORM = 80, - DXGI_FORMAT_BC4_SNORM = 81, - DXGI_FORMAT_BC5_TYPELESS = 82, - DXGI_FORMAT_BC5_UNORM = 83, - DXGI_FORMAT_BC5_SNORM = 84, - DXGI_FORMAT_B5G6R5_UNORM = 85, - DXGI_FORMAT_B5G5R5A1_UNORM = 86, - DXGI_FORMAT_B8G8R8A8_UNORM = 87, - DXGI_FORMAT_B8G8R8X8_UNORM = 88, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, - DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, - DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, - DXGI_FORMAT_BC6H_TYPELESS = 94, - DXGI_FORMAT_BC6H_UF16 = 95, - DXGI_FORMAT_BC6H_SF16 = 96, - DXGI_FORMAT_BC7_TYPELESS = 97, - DXGI_FORMAT_BC7_UNORM = 98, - DXGI_FORMAT_BC7_UNORM_SRGB = 99, - DXGI_FORMAT_AYUV = 100, - DXGI_FORMAT_Y410 = 101, - DXGI_FORMAT_Y416 = 102, - DXGI_FORMAT_NV12 = 103, - DXGI_FORMAT_P010 = 104, - DXGI_FORMAT_P016 = 105, - DXGI_FORMAT_420_OPAQUE = 106, - DXGI_FORMAT_YUY2 = 107, - DXGI_FORMAT_Y210 = 108, - DXGI_FORMAT_Y216 = 109, - DXGI_FORMAT_NV11 = 110, - DXGI_FORMAT_AI44 = 111, - DXGI_FORMAT_IA44 = 112, - DXGI_FORMAT_P8 = 113, - DXGI_FORMAT_A8P8 = 114, - DXGI_FORMAT_B4G4R4A4_UNORM = 115, - - DXGI_FORMAT_P208 = 130, - DXGI_FORMAT_V208 = 131, - DXGI_FORMAT_V408 = 132, - - DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189, - DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190, - - DXGI_FORMAT_FORCE_UINT = 0xFFFFFFFF, - }; - - enum DXGI_MODE_ROTATION - { - DXGI_MODE_ROTATION_UNSPECIFIED = 0, - DXGI_MODE_ROTATION_IDENTITY = 1, - DXGI_MODE_ROTATION_ROTATE90 = 2, - DXGI_MODE_ROTATION_ROTATE180 = 3, - DXGI_MODE_ROTATION_ROTATE270 = 4, - }; - - enum DXGI_MODE_SCALING - { - DXGI_MODE_SCALING_UNSPECIFIED = 0, - DXGI_MODE_SCALING_CENTERED = 1, - DXGI_MODE_SCALING_STRETCHED = 2, - }; - - enum DXGI_MODE_SCANLINE_ORDER - { - DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, - DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, - DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, - DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3, - }; - - enum DXGI_RESIDENCY - { - DXGI_RESIDENCY_FULLY_RESIDENT = 1, - DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, - DXGI_RESIDENCY_EVICTED_TO_DISK = 3, - }; - - enum DXGI_SWAP_EFFECT - { - DXGI_SWAP_EFFECT_DISCARD = 0, - DXGI_SWAP_EFFECT_SEQUENTIAL = 1, - DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, - DXGI_SWAP_EFFECT_FLIP_DISCARD = 4, - }; - - enum DXGI_SWAP_CHAIN_FLAG - { - DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, - DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, - DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, - DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, - DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, - DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, - DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, - DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, - DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, - DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, - DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024, - DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 2048, - DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 4096, - }; -} - -namespace REX::W32 -{ - struct D3DCOLORVALUE - { - float r; - float g; - float b; - float a; - }; - - using DXGI_RGBA = D3DCOLORVALUE; - using DXGI_USAGE = std::uint32_t; - - struct LUID - { - std::uint32_t lo; - std::int32_t hi; - }; -} - -namespace REX::W32 -{ - struct DXGI_ADAPTER_DESC - { - wchar_t description[128]; - std::uint32_t vendorId; - std::uint32_t deviceId; - std::uint32_t subSysId; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLuid; - }; - - struct DXGI_ADAPTER_DESC1 - { - wchar_t description[128]; - std::uint32_t vendorId; - std::uint32_t deviceId; - std::uint32_t subSysId; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLuid; - std::uint32_t flags; - }; - - struct DXGI_DISPLAY_COLOR_SPACE - { - float primaryCoordinates[8][2]; - float whitePoints[16][2]; - }; - - struct DXGI_FRAME_STATISTICS - { - std::uint32_t presentCount; - std::uint32_t presentRefreshCount; - std::uint32_t syncRefreshCount; - std::int64_t syncQPCTime; - std::int64_t syncGPUTime; - }; - - struct DXGI_RGB - { - float red; - float green; - float blue; - }; - - struct DXGI_GAMMA_CONTROL - { - DXGI_RGB scale; - DXGI_RGB offset; - DXGI_RGB gammaCurve[1025]; - }; - - struct DXGI_GAMMA_CONTROL_CAPABILITIES - { - BOOL scaleAndOffsetSupported; - float maxConvertedValue; - float minConvertedValue; - std::uint32_t numGammaControlPoints; - float controlPointPositions[1025]; - }; - - struct DXGI_MAPPED_RECT - { - std::int32_t pitch; - std::uint8_t* bits; - }; - - struct DXGI_RATIONAL - { - std::uint32_t numerator; - std::uint32_t denominator; - }; - - struct DXGI_MODE_DESC - { - std::uint32_t width; - std::uint32_t height; - DXGI_RATIONAL refreshRate; - DXGI_FORMAT format; - DXGI_MODE_SCANLINE_ORDER scanlineOrdering; - DXGI_MODE_SCALING scaling; - }; - - struct DXGI_OUTPUT_DESC - { - wchar_t deviceName[32]; - RECT desktopCoordinates; - BOOL attachedToDesktop; - DXGI_MODE_ROTATION rotation; - HMONITOR monitor; - }; - - struct DXGI_SAMPLE_DESC - { - std::uint32_t count; - std::uint32_t quality; - }; - - struct DXGI_SHARED_RESOURCE - { - HANDLE handle; - }; - - struct DXGI_SURFACE_DESC - { - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - DXGI_SAMPLE_DESC sampleDesc; - }; - - struct DXGI_SWAP_CHAIN_DESC - { - DXGI_MODE_DESC bufferDesc; - DXGI_SAMPLE_DESC sampleDesc; - DXGI_USAGE bufferUsage; - std::uint32_t bufferCount; - HWND outputWindow; - BOOL windowed; - DXGI_SWAP_EFFECT swapEffect; - std::uint32_t flags; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("aec22fb8-76f3-4639-9be0-28eb43a67a2e")) - IDXGIObject : public IUnknown - { - virtual HRESULT SetPrivateData(const GUID& a_iid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_iid, const IUnknown* a_unknown) = 0; - virtual HRESULT GetPrivateData(const GUID& a_iid, std::uint32_t* a_dataSize, void* a_data) = 0; - virtual HRESULT GetParent(const GUID& a_iid, void** a_parent) = 0; - }; - - struct __declspec(novtable, uuid("3d3e0379-f9de-4d58-bb6c-18d62992f1a6")) - IDXGIDeviceSubObject : public IDXGIObject - { - virtual HRESULT GetDevice(const GUID& a_iid, void** a_device) = 0; - }; - - struct __declspec(novtable, uuid("035f3ab4-482e-4e50-b41f-8a7f8bd8960b")) - IDXGIResource : public IDXGIDeviceSubObject - { - virtual HRESULT GetSharedHandle(HANDLE* a_sharedHandle) = 0; - virtual HRESULT GetUsage(DXGI_USAGE* a_usage) = 0; - virtual HRESULT SetEvictionPriority(std::uint32_t a_evictionPriority) = 0; - virtual HRESULT GetEvictionPriority(std::uint32_t* a_evictionPriority) = 0; - }; - - struct __declspec(novtable, uuid("9d8e1289-d7b3-465f-8126-250e349af85d")) - IDXGIKeyedMutex : public IDXGIDeviceSubObject - { - virtual HRESULT AcquireSync(std::uint64_t a_key, std::uint32_t a_milliseconds) = 0; - virtual HRESULT ReleaseSync(std::uint64_t a_key) = 0; - }; - - struct __declspec(novtable, uuid("cafcb56c-6ac3-4889-bf47-9e23bbd260ec")) - IDXGISurface : public IDXGIDeviceSubObject - { - virtual HRESULT GetDesc(DXGI_SURFACE_DESC* a_desc) = 0; - virtual HRESULT Map(DXGI_MAPPED_RECT* a_lockedRect, std::uint32_t a_mapFlags) = 0; - virtual HRESULT Unmap(void) = 0; - }; - - struct __declspec(novtable, uuid("4AE63092-6327-4c1b-80AE-BFE12EA32B86")) - IDXGISurface1 : public IDXGISurface - { - virtual HRESULT GetDC(BOOL a_discard, HDC* a_hdc) = 0; - virtual HRESULT ReleaseDC(RECT* a_dirtyRect) = 0; - }; - - struct __declspec(novtable, uuid("2411e7e1-12ac-4ccf-bd14-9798e8534dc0")) - IDXGIAdapter : public IDXGIObject - { - virtual HRESULT EnumOutputs(std::uint32_t a_outputSize, IDXGIOutput** a_output) = 0; - virtual HRESULT GetDesc(DXGI_ADAPTER_DESC* a_desc) = 0; - virtual HRESULT CheckInterfaceSupport(const GUID& a_iid, std::int64_t* a_umdVersion) = 0; - }; - - struct __declspec(novtable, uuid("29038f61-3839-4626-91fd-086879011a05")) - IDXGIAdapter1 : public IDXGIAdapter - { - virtual HRESULT GetDesc1(DXGI_ADAPTER_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("ae02eedb-c735-4690-8d52-5a8dc20213aa")) - IDXGIOutput : public IDXGIObject - { - virtual HRESULT GetDesc(DXGI_OUTPUT_DESC* a_desc) = 0; - virtual HRESULT GetDisplayModeList(DXGI_FORMAT a_enumFormat, std::uint32_t a_flags, std::uint32_t* a_numModes, DXGI_MODE_DESC* a_desc) = 0; - virtual HRESULT FindClosestMatchingMode(const DXGI_MODE_DESC* a_modeToMatch, DXGI_MODE_DESC* a_closestMatch, IUnknown* a_concernedDevice) = 0; - virtual HRESULT WaitForVBlank(void) = 0; - virtual HRESULT TakeOwnership(IUnknown* a_device, BOOL a_exclusive) = 0; - virtual void ReleaseOwnership(void) = 0; - virtual HRESULT GetGammaControlCapabilities(DXGI_GAMMA_CONTROL_CAPABILITIES* a_gammaCaps) = 0; - virtual HRESULT SetGammaControl(const DXGI_GAMMA_CONTROL* a_array) = 0; - virtual HRESULT GetGammaControl(DXGI_GAMMA_CONTROL* a_array) = 0; - virtual HRESULT SetDisplaySurface(IDXGISurface* a_scanoutSurface) = 0; - virtual HRESULT GetDisplaySurfaceData(IDXGISurface* a_destination) = 0; - virtual HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* a_stats) = 0; - }; - - struct __declspec(novtable, uuid("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a")) - IDXGISwapChain : public IDXGIDeviceSubObject - { - virtual HRESULT Present(std::uint32_t a_syncInterval, std::uint32_t a_flags) = 0; - virtual HRESULT GetBuffer(std::uint32_t a_buffer, const GUID& a_iid, void** a_surface) = 0; - virtual HRESULT SetFullscreenState(BOOL a_fullscreen, IDXGIOutput* a_target) = 0; - virtual HRESULT GetFullscreenState(BOOL* a_fullscreen, IDXGIOutput** a_target) = 0; - virtual HRESULT GetDesc(DXGI_SWAP_CHAIN_DESC* a_desc) = 0; - virtual HRESULT ResizeBuffers(std::uint32_t a_bufferCount, std::uint32_t a_width, std::uint32_t a_height, DXGI_FORMAT a_newFormat, std::uint32_t a_swapChainFlags) = 0; - virtual HRESULT ResizeTarget(const DXGI_MODE_DESC* a_newTargetParameters) = 0; - virtual HRESULT GetContainingOutput(IDXGIOutput** a_output) = 0; - virtual HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* a_stats) = 0; - virtual HRESULT GetLastPresentCount(std::uint32_t* a_lastPresentCount) = 0; - }; - - struct __declspec(novtable, uuid("7b7166ec-21c7-44ae-b21a-c9ae321ae369")) - IDXGIFactory : public IDXGIObject - { - virtual HRESULT EnumAdapters(std::uint32_t a_adapterSize, IDXGIAdapter** a_adapter) = 0; - virtual HRESULT MakeWindowAssociation(HWND a_windowHandle, std::uint32_t a_flags) = 0; - virtual HRESULT GetWindowAssociation(HWND* a_windowHandle) = 0; - virtual HRESULT CreateSwapChain(IUnknown* a_device, DXGI_SWAP_CHAIN_DESC* a_desc, IDXGISwapChain** a_swapChain) = 0; - virtual HRESULT CreateSoftwareAdapter(HMODULE a_module, IDXGIAdapter** a_adapter) = 0; - }; - - struct __declspec(novtable, uuid("770aae78-f26f-4dba-a829-253c83d1b387")) - IDXGIFactory1 : public IDXGIFactory - { - virtual HRESULT EnumAdapters1(std::uint32_t a_adapterSize, IDXGIAdapter1** a_adapter) = 0; - virtual BOOL IsCurrent(void) = 0; - }; - - struct __declspec(novtable, uuid("54ec77fa-1377-44e6-8c32-88fd5f44c84c")) - IDXGIDevice : public IDXGIObject - { - virtual HRESULT GetAdapter(IDXGIAdapter** a_adapter) = 0; - virtual HRESULT CreateSurface(const DXGI_SURFACE_DESC* a_desc, std::uint32_t a_numSurfaces, DXGI_USAGE a_usage, const DXGI_SHARED_RESOURCE* a_sharedResource, IDXGISurface** a_surface) = 0; - virtual HRESULT QueryResourceResidency(IUnknown* const* a_resources, DXGI_RESIDENCY* a_residencyStatus, std::uint32_t a_numResources) = 0; - virtual HRESULT SetGPUThreadPriority(std::int32_t a_priority) = 0; - virtual HRESULT GetGPUThreadPriority(std::int32_t* a_priority) = 0; - }; - - struct __declspec(novtable, uuid("77db970f-6276-48ba-ba28-070143b4392c")) - IDXGIDevice1 : public IDXGIDevice - { - virtual HRESULT SetMaximumFrameLatency(std::uint32_t a_maxLatency) = 0; - virtual HRESULT GetMaximumFrameLatency(std::uint32_t* a_maxLatency) = 0; - }; -} - -namespace REX::W32 -{ - HRESULT CreateDXGIFactory(const IID& a_iid, void** a_factory) noexcept; - HRESULT CreateDXGIFactory1(const IID& a_iid, void** a_factory) noexcept; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter{ 0x2411E7E1, 0x12AC, 0x4CCF, { 0xBD, 0x14, 0x97, 0x98, 0xE8, 0x53, 0x4D, 0xC0 } }; - inline constexpr IID IID_IDXGIAdapter1{ 0x29038F61, 0x3839, 0x4626, { 0x91, 0xFD, 0x08, 0x68, 0x79, 0x01, 0x1A, 0x05 } }; - inline constexpr IID IID_IDXGIObject{ 0xAEC22Fb8, 0x76F3, 0x4639, { 0x9B, 0xE0, 0x28, 0xEB, 0x43, 0xA6, 0x7A, 0x2E } }; - inline constexpr IID IID_IDXGIDevice{ 0x54EC77FA, 0x1377, 0x44E6, { 0x8C, 0x32, 0x88, 0xFD, 0x5F, 0x44, 0xC8, 0x4C } }; - inline constexpr IID IID_IDXGIDevice1{ 0x77DB970F, 0x6276, 0x48BA, { 0xBA, 0x28, 0x07, 0x01, 0x43, 0xB4, 0x39, 0x2C } }; - inline constexpr IID IID_IDXGIDeviceSubObject{ 0x3D3E0379, 0xF9DE, 0x4D58, { 0xBB, 0x6C, 0x18, 0xD6, 0x29, 0x92, 0xF1, 0xA6 } }; - inline constexpr IID IID_IDXGIFactory{ 0x7B7166EC, 0x21C7, 0x44AE, { 0xB2, 0x1A, 0xC9, 0xAE, 0x32, 0x1A, 0xE3, 0x69 } }; - inline constexpr IID IID_IDXGIFactory1{ 0x770AAE78, 0xF26F, 0x4DBA, { 0xA8, 0x29, 0x25, 0x3C, 0x83, 0xD1, 0xB3, 0x87 } }; - inline constexpr IID IID_IDXGIKeyedMutex{ 0x9D8E1289, 0xD7B3, 0x465F, { 0x81, 0x26, 0x25, 0x0E, 0x34, 0x9A, 0xF8, 0x5D } }; - inline constexpr IID IID_IDXGIOutput{ 0xAE02EEDB, 0xC735, 0x4690, { 0x8D, 0x52, 0x5A, 0x8D, 0xC2, 0x02, 0x13, 0xAA } }; - inline constexpr IID IID_IDXGIResource{ 0x035F3AB4, 0x482E, 0x4E50, { 0xB4, 0x1F, 0x8A, 0x7F, 0x8B, 0xD8, 0x96, 0x0B } }; - inline constexpr IID IID_IDXGISurface{ 0xCAFCB56C, 0x6AC3, 0x4889, { 0xBF, 0x47, 0x9E, 0x23, 0xBB, 0xD2, 0x60, 0xEC } }; - inline constexpr IID IID_IDXGISurface1{ 0x4AE63092, 0x6327, 0x4C1B, { 0x80, 0xAE, 0xBF, 0xE1, 0x2E, 0xA3, 0x2B, 0x86 } }; - inline constexpr IID IID_IDXGISwapChain{ 0x310D36A0, 0xD2E7, 0x4C0A, { 0xAA, 0x04, 0x6A, 0x9D, 0x23, 0xB8, 0x88, 0x6A } }; -} diff --git a/include/REX/W32/DXGI_2.h b/include/REX/W32/DXGI_2.h deleted file mode 100644 index 4261a87..0000000 --- a/include/REX/W32/DXGI_2.h +++ /dev/null @@ -1,272 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI.h" - -namespace REX::W32 -{ - struct IDXGIAdapter2; - struct IDXGIDevice2; - struct IDXGIDisplayControl; - struct IDXGIFactory2; - struct IDXGIOutput1; - struct IDXGIOutputDuplication; - struct IDXGIResource1; - struct IDXGISurface2; - struct IDXGISwapChain1; -} - -namespace REX::W32 -{ - enum DXGI_ALPHA_MODE - { - DXGI_ALPHA_MODE_UNSPECIFIED = 0, - DXGI_ALPHA_MODE_PREMULTIPLIED = 1, - DXGI_ALPHA_MODE_STRAIGHT = 2, - DXGI_ALPHA_MODE_IGNORE = 3, - DXGI_ALPHA_MODE_FORCE_DWORD = 0xFFFFFFFF, - }; - - enum DXGI_COMPUTE_PREEMPTION_GRANULARITY - { - DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, - DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY = 1, - DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY = 2, - DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY = 3, - DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY = 4, - }; - - enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY - { - DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, - DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY = 1, - DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY = 2, - DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY = 3, - DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY = 4, - }; - - enum DXGI_OFFER_RESOURCE_PRIORITY - { - DXGI_OFFER_RESOURCE_PRIORITY_LOW = 1, - DXGI_OFFER_RESOURCE_PRIORITY_NORMAL = (DXGI_OFFER_RESOURCE_PRIORITY_LOW + 1), - DXGI_OFFER_RESOURCE_PRIORITY_HIGH = (DXGI_OFFER_RESOURCE_PRIORITY_NORMAL + 1) - }; - - enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE - { - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 0x1, - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR = 0x2, - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR = 0x4, - }; - - enum DXGI_SCALING - { - DXGI_SCALING_STRETCH = 0, - DXGI_SCALING_NONE = 1, - DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, - }; -} - -namespace REX::W32 -{ - struct DXGI_ADAPTER_DESC2 - { - wchar_t description[128]; - std::uint32_t vendorID; - std::uint32_t deviceID; - std::uint32_t subSysID; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLUID; - std::uint32_t flags; - DXGI_GRAPHICS_PREEMPTION_GRANULARITY graphicsPreemptionGranularity; - DXGI_COMPUTE_PREEMPTION_GRANULARITY computePreemptionGranularity; - }; - - struct DXGI_MODE_DESC1 - { - std::uint32_t width; - std::uint32_t height; - DXGI_RATIONAL refreshRate; - DXGI_FORMAT format; - DXGI_MODE_SCANLINE_ORDER scanlineOrdering; - DXGI_MODE_SCALING scaling; - BOOL stereo; - }; - - struct DXGI_OUTDUPL_DESC - { - DXGI_MODE_DESC modeDesc; - DXGI_MODE_ROTATION rotation; - BOOL desktopImageInSystemMemory; - }; - - struct DXGI_OUTDUPL_POINTER_POSITION - { - POINT position; - BOOL visible; - }; - - struct DXGI_OUTDUPL_FRAME_INFO - { - std::int64_t lastPresentTime; - std::int64_t lastMouseUpdateTime; - std::uint32_t accumulatedFrames; - BOOL rectsCoalesced; - BOOL protectedContentMaskedOut; - DXGI_OUTDUPL_POINTER_POSITION pointerPosition; - std::uint32_t totalMetadataBufferSize; - std::uint32_t pointerShapeBufferSize; - }; - - struct DXGI_OUTDUPL_MOVE_RECT - { - POINT sourcePoint; - RECT destinationRect; - }; - - struct DXGI_OUTDUPL_POINTER_SHAPE_INFO - { - std::uint32_t type; - std::uint32_t width; - std::uint32_t height; - std::uint32_t pitch; - POINT hotSpot; - }; - - struct DXGI_PRESENT_PARAMETERS - { - std::uint32_t dirtyRectsCount; - RECT* dirtyRects; - RECT* scrollRect; - POINT* scrollOffset; - }; - - struct DXGI_SWAP_CHAIN_DESC1 - { - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - BOOL stereo; - DXGI_SAMPLE_DESC sampleDesc; - DXGI_USAGE bufferUsage; - std::uint32_t bufferCount; - DXGI_SCALING scaling; - DXGI_SWAP_EFFECT swapEffect; - DXGI_ALPHA_MODE alphaMode; - std::uint32_t flags; - }; - - struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC - { - DXGI_RATIONAL refreshRate; - DXGI_MODE_SCANLINE_ORDER scanlineOrdering; - DXGI_MODE_SCALING scaling; - BOOL windowed; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("0AA1AE0A-FA0E-4B84-8644-E05FF8E5ACB5")) - IDXGIAdapter2 : public IDXGIAdapter1 - { - virtual HRESULT GetDesc2(DXGI_ADAPTER_DESC2* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("05008617-FBFD-4051-A790-144884B4F6A9")) - IDXGIDevice2 : public IDXGIDevice1 - { - virtual HRESULT OfferResources(std::uint32_t a_numResources, IDXGIResource* const* a_resources, DXGI_OFFER_RESOURCE_PRIORITY a_priority) = 0; - virtual HRESULT ReclaimResources(std::uint32_t a_numResources, IDXGIResource* const* a_resources, BOOL* a_discarded) = 0; - virtual HRESULT EnqueueSetEvent(HANDLE a_event) = 0; - }; - - struct __declspec(novtable, uuid("EA9DBF1A-C88E-4486-854A-98AA0138F30C")) - IDXGIDisplayControl : public IUnknown - { - virtual BOOL IsStereoEnabled(void) = 0; - virtual void SetStereoEnabled(BOOL a_enabled) = 0; - }; - - struct __declspec(novtable, uuid("50C83A1C-E072-4C48-87B0-3630FA36A6D0")) - IDXGIFactory2 : public IDXGIFactory1 - { - virtual BOOL IsWindowedStereoEnabled(void) = 0; - virtual HRESULT CreateSwapChainForHwnd(IUnknown* a_device, HWND a_wnd, const DXGI_SWAP_CHAIN_DESC1* a_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* a_fullscreenDesc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - virtual HRESULT CreateSwapChainForCoreWindow(IUnknown* a_device, IUnknown* a_window, const DXGI_SWAP_CHAIN_DESC1* a_desc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - virtual HRESULT GetSharedResourceAdapterLuid(HANDLE a_resource, LUID* a_luid) = 0; - virtual HRESULT RegisterStereoStatusWindow(HWND a_wnd, std::uint32_t a_msg, std::uint32_t* a_cookie) = 0; - virtual HRESULT RegisterStereoStatusEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterStereoStatus(std::uint32_t a_cookie) = 0; - virtual HRESULT RegisterOcclusionStatusWindow(HWND a_wnd, std::uint32_t a_msg, std::uint32_t* a_cookie) = 0; - virtual HRESULT RegisterOcclusionStatusEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterOcclusionStatus(std::uint32_t dwCookie) = 0; - virtual HRESULT CreateSwapChainForComposition(IUnknown* a_device, const DXGI_SWAP_CHAIN_DESC1* a_desc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - }; - - struct __declspec(novtable, uuid("00CDDEA8-939B-4B83-A340-A685226666CC")) - IDXGIOutput1 : public IDXGIOutput - { - virtual HRESULT GetDisplayModeList1(DXGI_FORMAT a_enumFormat, std::uint32_t a_flags, std::uint32_t* a_numModes, DXGI_MODE_DESC1* a_desc) = 0; - virtual HRESULT FindClosestMatchingMode1(const DXGI_MODE_DESC1* a_modeToMatch, DXGI_MODE_DESC1* a_closestMatch, IUnknown* a_concernedDevice) = 0; - virtual HRESULT GetDisplaySurfaceData1(IDXGIResource* a_destination) = 0; - virtual HRESULT DuplicateOutput(IUnknown* a_device, IDXGIOutputDuplication** a_outputDuplication) = 0; - }; - - struct __declspec(novtable, uuid("191CFAC3-A341-470D-B26E-A864F428319C")) - IDXGIOutputDuplication : public IDXGIObject - { - virtual void GetDesc(DXGI_OUTDUPL_DESC* a_desc) = 0; - virtual HRESULT AcquireNextFrame(std::uint32_t a_timeoutInMilliseconds, DXGI_OUTDUPL_FRAME_INFO* a_frameInfo, IDXGIResource** a_desktopResource) = 0; - virtual HRESULT GetFrameDirtyRects(std::uint32_t a_dirtyRectsBufferSize, RECT* a_dirtyRectsBuffer, std::uint32_t* a_dirtyRectsBufferSizeRequired) = 0; - virtual HRESULT GetFrameMoveRects(std::uint32_t a_moveRectsBufferSize, DXGI_OUTDUPL_MOVE_RECT* a_moveRectBuffer, std::uint32_t* a_moveRectsBufferSizeRequired) = 0; - virtual HRESULT GetFramePointerShape(std::uint32_t a_pointerShapeBufferSize, void* a_pointerShapeBuffer, std::uint32_t* a_pointerShapeBufferSizeRequired, DXGI_OUTDUPL_POINTER_SHAPE_INFO* a_pointerShapeInfo) = 0; - virtual HRESULT MapDesktopSurface(DXGI_MAPPED_RECT* a_lockedRect) = 0; - virtual HRESULT UnMapDesktopSurface(void) = 0; - virtual HRESULT ReleaseFrame(void) = 0; - }; - - struct __declspec(novtable, uuid("30961379-4609-4A41-998E-54FE567EE0C1")) - IDXGIResource1 : public IDXGIResource - { - virtual HRESULT CreateSubresourceSurface(std::uint32_t a_index, IDXGISurface2** a_surface) = 0; - virtual HRESULT CreateSharedHandle(const SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_access, const wchar_t* a_name, HANDLE* a_handle) = 0; - }; - - struct __declspec(novtable, uuid("ABA496DD-B617-4CB8-A866-BC44D7EB1FA2")) - IDXGISurface2 : public IDXGISurface1 - { - virtual HRESULT GetResource(const IID& a_iid, void** a_parentResource, std::uint32_t* a_subresourceIndex) = 0; - }; - - struct __declspec(novtable, uuid("790A45F7-0D42-4876-983A-0A55CFE6F4AA")) - IDXGISwapChain1 : public IDXGISwapChain - { - virtual HRESULT GetDesc1(DXGI_SWAP_CHAIN_DESC1* a_desc) = 0; - virtual HRESULT GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC* a_desc) = 0; - virtual HRESULT GetHwnd(HWND* a_wnd) = 0; - virtual HRESULT GetCoreWindow(const IID& a_iid, void** a_unk) = 0; - virtual HRESULT Present1(std::uint32_t a_syncInterval, std::uint32_t a_presentFlags, const DXGI_PRESENT_PARAMETERS* a_presentParameters) = 0; - virtual BOOL IsTemporaryMonoSupported(void) = 0; - virtual HRESULT GetRestrictToOutput(IDXGIOutput** a_restrictToOutput) = 0; - virtual HRESULT SetBackgroundColor(const DXGI_RGBA* a_color) = 0; - virtual HRESULT GetBackgroundColor(DXGI_RGBA* a_color) = 0; - virtual HRESULT SetRotation(DXGI_MODE_ROTATION a_rotation) = 0; - virtual HRESULT GetRotation(DXGI_MODE_ROTATION* a_rotation) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter2{ 0x0AA1AE0A, 0xFA0E, 0x4B84, { 0x86, 0x44, 0xE0, 0x5F, 0xF8, 0xE5, 0xAC, 0xB5 } }; - inline constexpr IID IID_IDXGIDevice2{ 0x05008617, 0xFBFD, 0x4051, { 0xA7, 0x90, 0x14, 0x48, 0x84, 0xB4, 0xF6, 0xA9 } }; - inline constexpr IID IID_IDXGIDisplayControl{ 0xEA9DBF1A, 0xC88E, 0x4486, { 0x85, 0x4A, 0x98, 0xAA, 0x01, 0x38, 0xF3, 0x0C } }; - inline constexpr IID IID_IDXGIFactory2{ 0x50C83A1C, 0xE072, 0x4C48, { 0x87, 0xB0, 0x36, 0x30, 0xFA, 0x36, 0xA6, 0xD0 } }; - inline constexpr IID IID_IDXGIOutput1{ 0x00CDDEA8, 0x939B, 0x4B83, { 0xA3, 0x40, 0xA6, 0x85, 0x22, 0x66, 0x66, 0xCC } }; - inline constexpr IID IID_IDXGIOutputDuplication{ 0x191CFAC3, 0xA341, 0x470D, { 0xB2, 0x6E, 0xA8, 0x64, 0xF4, 0x28, 0x31, 0x9C } }; - inline constexpr IID IID_IDXGIResource1{ 0x30961379, 0x4609, 0x4A41, { 0x99, 0x8E, 0x54, 0xFE, 0x56, 0x7E, 0xE0, 0xC1 } }; - inline constexpr IID IID_IDXGISurface2{ 0xABA496DD, 0xB617, 0x4CB8, { 0xA8, 0x66, 0xBC, 0x44, 0xD7, 0xEB, 0x1F, 0xA2 } }; - inline constexpr IID IID_IDXGISwapChain1{ 0x790A45F7, 0x0D42, 0x4876, { 0x98, 0x3A, 0x0A, 0x55, 0xCF, 0xE6, 0xF4, 0xAA } }; -} diff --git a/include/REX/W32/DXGI_3.h b/include/REX/W32/DXGI_3.h deleted file mode 100644 index 5b9096f..0000000 --- a/include/REX/W32/DXGI_3.h +++ /dev/null @@ -1,148 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_2.h" - -namespace REX::W32 -{ - struct IDXGIDecodeSwapChain; - struct IDXGIDevice3; - struct IDXGIFactory3; - struct IDXGIFactoryMedia; - struct IDXGIOutput2; - struct IDXGIOutput3; - struct IDXGISwapChain2; - struct IDXGISwapChainMedia; -} - -namespace REX::W32 -{ - enum DXGI_FRAME_PRESENTATION_MODE - { - DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0, - DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1, - DXGI_FRAME_PRESENTATION_MODE_NONE = 2, - DXGI_FRAME_PRESENTATION_MODE_COMPOSITION_FAILURE = 3, - }; - - enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS - { - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, - }; - - enum DXGI_OVERLAY_SUPPORT_FLAG - { - DXGI_OVERLAY_SUPPORT_FLAG_DIRECT = 0x1, - DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2, - }; -} - -namespace REX::W32 -{ - struct DXGI_DECODE_SWAP_CHAIN_DESC - { - std::uint32_t flags; - }; - - struct DXGI_FRAME_STATISTICS_MEDIA - { - std::uint32_t presentCount; - std::uint32_t presentRefreshCount; - std::uint32_t syncRefreshCount; - std::int64_t syncQPCTime; - std::int64_t syncGPUTime; - DXGI_FRAME_PRESENTATION_MODE compositionMode; - std::uint32_t approvedPresentDuration; - }; - - struct DXGI_MATRIX_3X2_F - { - float _11; - float _12; - float _21; - float _22; - float _31; - float _32; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("2633066B-4514-4C7A-8FD8-12EA98059D18")) - IDXGIDecodeSwapChain : public IUnknown - { - virtual HRESULT PresentBuffer(std::uint32_t a_bufferToPresent, std::uint32_t a_syncInterval, std::uint32_t a_flags) = 0; - virtual HRESULT SetSourceRect(const RECT* a_rect) = 0; - virtual HRESULT SetTargetRect(const RECT* a_rect) = 0; - virtual HRESULT SetDestSize(std::uint32_t a_width, std::uint32_t a_height) = 0; - virtual HRESULT GetSourceRect(RECT* a_rect) = 0; - virtual HRESULT GetTargetRect(RECT* a_rect) = 0; - virtual HRESULT GetDestSize(std::uint32_t* a_width, std::uint32_t* a_height) = 0; - virtual HRESULT SetColorSpace(DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS a_colorSpace) = 0; - virtual DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS GetColorSpace(void) = 0; - }; - - struct __declspec(novtable, uuid("6007896C-3244-4AFD-BF18-A6D3BEDA5023")) - IDXGIDevice3 : public IDXGIDevice2 - { - virtual void Trim(void) = 0; - }; - - struct __declspec(novtable, uuid("25483823-CD46-4C7D-86CA-47AA95B837BD")) - IDXGIFactory3 : public IDXGIFactory2 - { - virtual std::uint32_t GetCreationFlags(void) = 0; - }; - - struct __declspec(novtable, uuid("41E7D1F2-A591-4F7B-A2E5-FA9C843E1C12")) - IDXGIFactoryMedia : public IUnknown - { - virtual HRESULT CreateSwapChainForCompositionSurfaceHandle(IUnknown* a_device, HANDLE a_surface, const DXGI_SWAP_CHAIN_DESC1* a_desc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - virtual HRESULT CreateDecodeSwapChainForCompositionSurfaceHandle(IUnknown* a_device, HANDLE a_surface, DXGI_DECODE_SWAP_CHAIN_DESC* a_desc, IDXGIResource* a_yuvDecodeBuffers, IDXGIOutput* a_restrictToOutput, IDXGIDecodeSwapChain** a_swapChain) = 0; - }; - - struct __declspec(novtable, uuid("595E39D1-2724-4663-99B1-DA969DE28364")) - IDXGIOutput2 : public IDXGIOutput1 - { - virtual BOOL SupportsOverlays(void) = 0; - }; - - struct __declspec(novtable, uuid("8A6BB301-7E7E-41F4-A8E0-5B32F7F99B18")) - IDXGIOutput3 : public IDXGIOutput2 - { - virtual HRESULT CheckOverlaySupport(DXGI_FORMAT a_enumFormat, IUnknown* a_concernedDevice, std::uint32_t* a_flags) = 0; - }; - - struct __declspec(novtable, uuid("A8BE2AC4-199F-4946-B331-79599FB98DE7")) - IDXGISwapChain2 : public IDXGISwapChain1 - { - virtual HRESULT SetSourceSize(std::uint32_t a_width, std::uint32_t a_height) = 0; - virtual HRESULT GetSourceSize(std::uint32_t* a_width, std::uint32_t* a_height) = 0; - virtual HRESULT SetMaximumFrameLatency(std::uint32_t a_maxLatency) = 0; - virtual HRESULT GetMaximumFrameLatency(std::uint32_t* a_maxLatency) = 0; - virtual HANDLE GetFrameLatencyWaitableObject(void) = 0; - virtual HRESULT SetMatrixTransform(const DXGI_MATRIX_3X2_F* a_matrix) = 0; - virtual HRESULT GetMatrixTransform(DXGI_MATRIX_3X2_F* a_matrix) = 0; - }; - - struct __declspec(novtable, uuid("DD95B90B-F05F-4F6A-BD65-25BFB264BD84")) - IDXGISwapChainMedia : public IUnknown - { - virtual HRESULT GetFrameStatisticsMedia(DXGI_FRAME_STATISTICS_MEDIA* a_stats) = 0; - virtual HRESULT SetPresentDuration(std::uint32_t a_duration) = 0; - virtual HRESULT CheckPresentDurationSupport(std::uint32_t a_desiredPresentDuration, std::uint32_t* a_closestSmallerPresentDuration, std::uint32_t* a_closestLargerPresentDuration) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIDecodeSwapChain{ 0x2633066B, 0x4514, 0x4C7A, { 0x8F, 0xD8, 0x12, 0xEA, 0x98, 0x05, 0x9D, 0x18 } }; - inline constexpr IID IID_IDXGIDevice3{ 0x6007896C, 0x3244, 0x4AFD, { 0xBF, 0x18, 0xA6, 0xD3, 0xBE, 0xDA, 0x50, 0x23 } }; - inline constexpr IID IID_IDXGIFactory3{ 0x25483823, 0xCD46, 0x4C7D, { 0x86, 0xCA, 0x47, 0xAA, 0x95, 0xB8, 0x37, 0xBD } }; - inline constexpr IID IID_IDXGIFactoryMedia{ 0x41E7D1F2, 0xA591, 0x4F7B, { 0xA2, 0xE5, 0xFA, 0x9C, 0x84, 0x3E, 0x1C, 0x12 } }; - inline constexpr IID IID_IDXGIOutput2{ 0x595E39D1, 0x2724, 0x4663, { 0x99, 0xB1, 0xDA, 0x96, 0x9D, 0xE2, 0x83, 0x64 } }; - inline constexpr IID IID_IDXGIOutput3{ 0x8A6BB301, 0x7E7E, 0x41F4, { 0xA8, 0xE0, 0x5B, 0x32, 0xF7, 0xF9, 0x9B, 0x18 } }; - inline constexpr IID IID_IDXGISwapChain2{ 0xA8BE2AC4, 0x199F, 0x4946, { 0xB3, 0x31, 0x79, 0x59, 0x9F, 0xB9, 0x8D, 0xE7 } }; - inline constexpr IID IID_IDXGISwapChainMedia{ 0xDD95B90B, 0xF05F, 0x4F6A, { 0xBD, 0x65, 0x25, 0xBF, 0xB2, 0x64, 0xBD, 0x84 } }; -} diff --git a/include/REX/W32/DXGI_4.h b/include/REX/W32/DXGI_4.h deleted file mode 100644 index d584976..0000000 --- a/include/REX/W32/DXGI_4.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_3.h" - -namespace REX::W32 -{ - struct IDXGIAdapter3; - struct IDXGIFactory4; - struct IDXGIOutput4; - struct IDXGISwapChain3; -} - -namespace REX::W32 -{ - enum DXGI_MEMORY_SEGMENT_GROUP - { - DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, - DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1, - }; - - enum DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG - { - DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, - }; - - enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG - { - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x2, - }; -} - -namespace REX::W32 -{ - struct DXGI_QUERY_VIDEO_MEMORY_INFO - { - std::uint64_t budget; - std::uint64_t currentUsage; - std::uint64_t availableForReservation; - std::uint64_t currentReservation; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("645967A4-1392-4310-A798-8053CE3E93FD")) - IDXGIAdapter3 : public IDXGIAdapter2 - { - virtual HRESULT RegisterHardwareContentProtectionTeardownStatusEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterHardwareContentProtectionTeardownStatus(std::uint32_t a_cookie) = 0; - virtual HRESULT QueryVideoMemoryInfo(std::uint32_t a_nodeIndex, DXGI_MEMORY_SEGMENT_GROUP a_memorySegmentGroup, DXGI_QUERY_VIDEO_MEMORY_INFO* a_videoMemoryInfo) = 0; - virtual HRESULT SetVideoMemoryReservation(std::uint32_t a_nodeIndex, DXGI_MEMORY_SEGMENT_GROUP a_memorySegmentGroup, std::uint64_t a_reservation) = 0; - virtual HRESULT RegisterVideoMemoryBudgetChangeNotificationEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterVideoMemoryBudgetChangeNotification(std::uint32_t a_cookie) = 0; - }; - - struct __declspec(novtable, uuid("1BC6EA02-EF36-464F-BF0C-21CA39E5168A")) - IDXGIFactory4 : public IDXGIFactory3 - { - virtual HRESULT EnumAdapterByLuid(LUID a_luid, const IID& a_iid, void** a_adapter) = 0; - virtual HRESULT EnumWarpAdapter(const IID& a_iid, void** a_adapter) = 0; - }; - - struct __declspec(novtable, uuid("DC7DCA35-2196-414D-9F53-617884032A60")) - IDXGIOutput4 : public IDXGIOutput3 - { - virtual HRESULT CheckOverlayColorSpaceSupport(DXGI_FORMAT a_format, DXGI_COLOR_SPACE_TYPE a_colorSpace, IUnknown* a_concernedDevice, std::uint32_t* a_flags) = 0; - }; - - struct __declspec(novtable, uuid("94D99BDB-F1F8-4AB0-B236-7DA0170EDAB1")) - IDXGISwapChain3 : public IDXGISwapChain2 - { - virtual std::uint32_t GetCurrentBackBufferIndex(void) = 0; - virtual HRESULT CheckColorSpaceSupport(DXGI_COLOR_SPACE_TYPE a_colorSpace, std::uint32_t* a_colorSpaceSupport) = 0; - virtual HRESULT SetColorSpace1(DXGI_COLOR_SPACE_TYPE a_colorSpace) = 0; - virtual HRESULT ResizeBuffers1(std::uint32_t a_bufferCount, std::uint32_t a_width, std::uint32_t a_height, DXGI_FORMAT a_format, std::uint32_t a_swapChainFlags, const std::uint32_t* a_creationNodeMask, IUnknown* const* a_presentQueue) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter3{ 0x645967A4, 0x1392, 0x4310, { 0xA7, 0x98, 0x80, 0x53, 0xCE, 0x3E, 0x93, 0xFD } }; - inline constexpr IID IID_IDXGIFactory4{ 0x1BC6EA02, 0xEF36, 0x464F, { 0xBF, 0x0C, 0x21, 0xCA, 0x39, 0xE5, 0x16, 0x8A } }; - inline constexpr IID IID_IDXGIOutput4{ 0xDC7DCA35, 0x2196, 0x414D, { 0x9F, 0x53, 0x61, 0x78, 0x84, 0x03, 0x2A, 0x60 } }; - inline constexpr IID IID_IDXGISwapChain3{ 0x94D99BDB, 0xF1F8, 0x4AB0, { 0xB2, 0x36, 0x7D, 0xA0, 0x17, 0x0E, 0xDA, 0xB1 } }; -} diff --git a/include/REX/W32/DXGI_5.h b/include/REX/W32/DXGI_5.h deleted file mode 100644 index b7bae4d..0000000 --- a/include/REX/W32/DXGI_5.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_4.h" - -namespace REX::W32 -{ - struct IDXGIDevice4; - struct IDXGIFactory5; - struct IDXGIOutput5; - struct IDXGISwapChain4; -} - -namespace REX::W32 -{ - enum DXGI_FEATURE - { - DXGI_FEATURE_PRESENT_ALLOW_TEARING = 0, - }; - - enum DXGI_HDR_METADATA_TYPE - { - DXGI_HDR_METADATA_TYPE_NONE = 0, - DXGI_HDR_METADATA_TYPE_HDR10 = 1, - DXGI_HDR_METADATA_TYPE_HDR10PLUS = 2, - }; - - enum DXGI_OFFER_RESOURCE_FLAGS - { - DXGI_OFFER_RESOURCE_FLAG_ALLOW_DECOMMIT = 0x1, - }; - - enum DXGI_RECLAIM_RESOURCE_RESULTS - { - DXGI_RECLAIM_RESOURCE_RESULT_OK = 0, - DXGI_RECLAIM_RESOURCE_RESULT_DISCARDED = 1, - DXGI_RECLAIM_RESOURCE_RESULT_NOT_COMMITTED = 2, - }; -} - -namespace REX::W32 -{ - struct DXGI_HDR_METADATA_HDR10 - { - std::uint16_t redPrimary[2]; - std::uint16_t GreenPrimary[2]; - std::uint16_t bluePrimary[2]; - std::uint16_t whitePoint[2]; - std::uint32_t maxMasteringLuminance; - std::uint32_t minMasteringLuminance; - std::uint16_t maxContentLightLevel; - std::uint16_t maxFrameAverageLightLevel; - }; - - struct DXGI_HDR_METADATA_HDR10PLUS - { - std::uint8_t data[72]; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("95B4F95F-D8DA-4CA4-9EE6-3B76D5968A10")) - IDXGIDevice4 : public IDXGIDevice3 - { - virtual HRESULT OfferResources1(std::uint32_t a_numResources, IDXGIResource* const* a_resources, DXGI_OFFER_RESOURCE_PRIORITY a_priority, std::uint32_t a_flags) = 0; - virtual HRESULT ReclaimResources1(std::uint32_t a_numResources, IDXGIResource* const* a_resources, DXGI_RECLAIM_RESOURCE_RESULTS* a_results) = 0; - }; - - struct __declspec(novtable, uuid("7632E1F5-EE65-4DCA-87FD-84CD75F8838D")) - IDXGIFactory5 : public IDXGIFactory4 - { - virtual HRESULT CheckFeatureSupport(DXGI_FEATURE a_feature, void* a_featureSupportData, std::uint32_t a_featureSupportDataSize) = 0; - }; - - struct __declspec(novtable, uuid("80A07424-AB52-42EB-833C-0C42FD282D98")) - IDXGIOutput5 : public IDXGIOutput4 - { - virtual HRESULT DuplicateOutput1(IUnknown* a_device, std::uint32_t a_flags, std::uint32_t a_supportedFormatsCount, const DXGI_FORMAT* a_supportedFormats, IDXGIOutputDuplication** a_outputDuplication) = 0; - }; - - struct __declspec(novtable, uuid("3D585D5A-BD4A-489E-B1F4-3DBCB6452FFB")) - IDXGISwapChain4 : public IDXGISwapChain3 - { - virtual HRESULT SetHDRMetaData(DXGI_HDR_METADATA_TYPE a_type, std::uint32_t a_size, void* a_metaData) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIDevice4{ 0x95B4F95F, 0xD8DA, 0x4CA4, { 0x9E, 0xE6, 0x3B, 0x76, 0xD5, 0x96, 0x8A, 0x10 } }; - inline constexpr IID IID_IDXGIFactory5{ 0x7632E1F5, 0xEE65, 0x4DCA, { 0x87, 0xFD, 0x84, 0xCD, 0x75, 0xF8, 0x83, 0x8D } }; - inline constexpr IID IID_IDXGIOutput5{ 0x80A07424, 0xAB52, 0x42EB, { 0x83, 0x3C, 0x0C, 0x42, 0xFD, 0x28, 0x2D, 0x98 } }; - inline constexpr IID IID_IDXGISwapChain4{ 0x3D585D5A, 0xBD4A, 0x489E, { 0xB1, 0xF4, 0x3D, 0xBC, 0xB6, 0x45, 0x2F, 0xFB } }; -} diff --git a/include/REX/W32/DXGI_6.h b/include/REX/W32/DXGI_6.h deleted file mode 100644 index 60431e3..0000000 --- a/include/REX/W32/DXGI_6.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_5.h" - -namespace REX::W32 -{ - struct IDXGIAdapter4; - struct IDXGIFactory6; - struct IDXGIFactory7; - struct IDXGIOutput6; -} - -namespace REX::W32 -{ - enum DXGI_ADAPTER_FLAG3 - { - DXGI_ADAPTER_FLAG3_NONE = 0, - DXGI_ADAPTER_FLAG3_REMOTE = 1, - DXGI_ADAPTER_FLAG3_SOFTWARE = 2, - DXGI_ADAPTER_FLAG3_ACG_COMPATIBLE = 4, - DXGI_ADAPTER_FLAG3_SUPPORT_MONITORED_FENCES = 8, - DXGI_ADAPTER_FLAG3_SUPPORT_NON_MONITORED_FENCES = 0x10, - DXGI_ADAPTER_FLAG3_KEYED_MUTEX_CONFORMANCE = 0x20, - DXGI_ADAPTER_FLAG3_FORCE_DWORD = 0xFFFFFFFF, - }; - - enum DXGI_GPU_PREFERENCE - { - DXGI_GPU_PREFERENCE_UNSPECIFIED = 0, - DXGI_GPU_PREFERENCE_MINIMUM_POWER = (DXGI_GPU_PREFERENCE_UNSPECIFIED + 1), - DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE = (DXGI_GPU_PREFERENCE_MINIMUM_POWER + 1), - }; - - enum DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAGS - { - DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_FULLSCREEN = 1, - DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_WINDOWED = 2, - DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_CURSOR_STRETCHED = 4, - }; -} - -namespace REX::W32 -{ - struct DXGI_ADAPTER_DESC3 - { - wchar_t description[128]; - std::uint32_t vendorID; - std::uint32_t deviceID; - std::uint32_t subSysID; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLUID; - DXGI_ADAPTER_FLAG3 flags; - DXGI_GRAPHICS_PREEMPTION_GRANULARITY graphicsPreemptionGranularity; - DXGI_COMPUTE_PREEMPTION_GRANULARITY computePreemptionGranularity; - }; - - struct DXGI_OUTPUT_DESC1 - { - wchar_t deviceName[32]; - RECT desktopCoordinates; - BOOL attachedToDesktop; - DXGI_MODE_ROTATION rotation; - HMONITOR monitor; - std::uint32_t bitsPerColor; - DXGI_COLOR_SPACE_TYPE colorSpace; - float redPrimary[2]; - float greenPrimary[2]; - float bluePrimary[2]; - float whitePoint[2]; - float minLuminance; - float maxLuminance; - float maxFullFrameLuminance; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("3C8D99D1-4FBF-4181-A82C-AF66BF7BD24E")) - IDXGIAdapter4 : public IDXGIAdapter3 - { - virtual HRESULT GetDesc3(DXGI_ADAPTER_DESC3* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("C1B6694F-FF09-44A9-B03C-77900A0A1D17")) - IDXGIFactory6 : public IDXGIFactory5 - { - virtual HRESULT EnumAdapterByGpuPreference(std::uint32_t a_adapterFlags, DXGI_GPU_PREFERENCE a_gpuPreference, const IID& a_iid, void** a_adapter) = 0; - }; - - struct __declspec(novtable, uuid("A4966EED-76DB-44DA-84C1-EE9A7AFB20A8")) - IDXGIFactory7 : public IDXGIFactory6 - { - virtual HRESULT RegisterAdaptersChangedEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual HRESULT UnregisterAdaptersChangedEvent(std::uint32_t a_cookie) = 0; - }; - - struct __declspec(novtable, uuid("068346E8-AAEC-4B84-ADD7-137F513F77A1")) - IDXGIOutput6 : public IDXGIOutput5 - { - virtual HRESULT GetDesc1(DXGI_OUTPUT_DESC1* a_desc) = 0; - virtual HRESULT CheckHardwareCompositionSupport(std::uint32_t* a_flags) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter4{ 0x3C8D99D1, 0x4FBF, 0x4181, { 0xA8, 0x2C, 0xAF, 0x66, 0xBF, 0x7B, 0xD2, 0x4E } }; - inline constexpr IID IID_IDXGIFactory6{ 0xC1B6694F, 0xFF09, 0x44A9, { 0xB0, 0x3C, 0x77, 0x90, 0x0A, 0x0A, 0x1D, 0x17 } }; - inline constexpr IID IID_IDXGIFactory7{ 0xA4966EED, 0x76DB, 0x44DA, { 0x84, 0xC1, 0xEE, 0x9A, 0x7A, 0xFB, 0x20, 0xA8 } }; - inline constexpr IID IID_IDXGIOutput6{ 0x068346E8, 0xAAEC, 0x4B84, { 0xAD, 0xD7, 0x13, 0x7F, 0x51, 0x3F, 0x77, 0xA1 } }; -} diff --git a/include/REX/W32/KERNEL32.h b/include/REX/W32/KERNEL32.h deleted file mode 100644 index b413b7d..0000000 --- a/include/REX/W32/KERNEL32.h +++ /dev/null @@ -1,542 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - // standard access - inline constexpr auto STANDARD_RIGHTS_REQUIRED{ 0x000F0000 }; - inline constexpr auto STANDARD_RIGHTS_ALL{ 0x001F0000 }; - - // code page identifiers - inline constexpr auto CP_UTF8{ 65001u }; - - // memory allocation types - inline constexpr auto MEM_COMMIT{ 0x00001000u }; - inline constexpr auto MEM_RESERVE{ 0x00002000u }; - inline constexpr auto MEM_DECOMMIT{ 0x00004000u }; - inline constexpr auto MEM_RELEASE{ 0x00008000u }; - inline constexpr auto MEM_FREE{ 0x00010000u }; - inline constexpr auto MEM_RESET{ 0x00080000u }; - inline constexpr auto MEM_RESET_UNDO{ 0x01000000u }; - - // memory page protection attributes - inline constexpr auto PAGE_NOACCESS{ 0x00000001u }; - inline constexpr auto PAGE_READONLY{ 0x00000002u }; - inline constexpr auto PAGE_READWRITE{ 0x00000004u }; - inline constexpr auto PAGE_WRITECOPY{ 0x00000008u }; - inline constexpr auto PAGE_EXECUTE{ 0x00000010u }; - inline constexpr auto PAGE_EXECUTE_READ{ 0x00000020u }; - inline constexpr auto PAGE_EXECUTE_READWRITE{ 0x00000040u }; - - // memory section - inline constexpr auto SECTION_QUERY{ 0x00000001 }; - inline constexpr auto SECTION_MAP_WRITE{ 0x00000002 }; - inline constexpr auto SECTION_MAP_READ{ 0x00000004 }; - inline constexpr auto SECTION_MAP_EXECUTE{ 0x00000008 }; - inline constexpr auto SECTION_EXTEND_SIZE{ 0x00000010 }; - inline constexpr auto SECTION_MAP_EXECUTE_EXPLICIT{ 0x00000020 }; - inline constexpr auto SECTION_ALL_ACCESS{ - STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE - }; - - // file attributes - inline constexpr auto FILE_ATTRIBUTE_READONLY{ 0x00000001u }; - inline constexpr auto FILE_ATTRIBUTE_HIDDEN{ 0x00000002u }; - inline constexpr auto FILE_ATTRIBUTE_SYSTEM{ 0x00000004u }; - inline constexpr auto FILE_ATTRIBUTE_DIRECTORY{ 0x00000010u }; - inline constexpr auto FILE_ATTRIBUTE_ARCHIVE{ 0x00000020u }; - inline constexpr auto FILE_ATTRIBUTE_DEVICE{ 0x00000040 }; - inline constexpr auto FILE_ATTRIBUTE_NORMAL{ 0x00000080 }; - inline constexpr auto FILE_ATTRIBUTE_TEMPORARY{ 0x00000100 }; - inline constexpr auto FILE_ATTRIBUTE_SPARSE_FILE{ 0x00000200 }; - inline constexpr auto FILE_ATTRIBUTE_REPARSE_POINT{ 0x00000400 }; - inline constexpr auto FILE_ATTRIBUTE_COMPRESSED{ 0x00000800 }; - inline constexpr auto FILE_ATTRIBUTE_OFFLINE{ 0x00001000 }; - inline constexpr auto FILE_ATTRIBUTE_NOT_CONTENT_INDEXED{ 0x00002000 }; - inline constexpr auto FILE_ATTRIBUTE_ENCRYPTED{ 0x00004000 }; - inline constexpr auto FILE_ATTRIBUTE_INTEGRITY_STREAM{ 0x00008000 }; - inline constexpr auto FILE_ATTRIBUTE_VIRTUAL{ 0x00010000 }; - inline constexpr auto FILE_ATTRIBUTE_NO_SCRUB_DATA{ 0x00020000 }; - inline constexpr auto FILE_ATTRIBUTE_EA{ 0x00040000 }; - inline constexpr auto FILE_ATTRIBUTE_PINNED{ 0x00080000 }; - inline constexpr auto FILE_ATTRIBUTE_UNPINNED{ 0x00100000 }; - inline constexpr auto FILE_ATTRIBUTE_RECALL_ON_OPEN{ 0x00040000 }; - inline constexpr auto FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS{ 0x00400000 }; - - // file creation diposition - inline constexpr auto CREATE_NEW{ 1 }; - inline constexpr auto CREATE_ALWAYS{ 2 }; - inline constexpr auto OPEN_EXISTING{ 3 }; - inline constexpr auto OPEN_ALWAYS{ 4 }; - inline constexpr auto TRUNCATE_EXISTING{ 5 }; - - // file share mode - inline constexpr auto FILE_SHARE_READ{ 0x00000001 }; - inline constexpr auto FILE_SHARE_WRITE{ 0x00000002 }; - inline constexpr auto FILE_SHARE_DELETE{ 0x00000004 }; - - // file mapping flags - inline constexpr auto FILE_MAP_ALL_ACCESS{ SECTION_ALL_ACCESS }; - inline constexpr auto FILE_MAP_COPY{ 0x00000001u }; - inline constexpr auto FILE_MAP_WRITE{ 0x00000002u }; - inline constexpr auto FILE_MAP_READ{ 0x00000004u }; - inline constexpr auto FILE_MAP_EXECUTE{ 0x00000020u }; - inline constexpr auto FILE_MAP_LARGE_PAGES{ 0x20000000u }; - inline constexpr auto FILE_MAP_TARGETS_INVALID{ 0x40000000u }; - inline constexpr auto FILE_MAP_RESERVE{ 0x80000000u }; - - // file open mode flags - inline constexpr auto GENERIC_READ{ 0x80000000L }; - inline constexpr auto GENERIC_WRITE{ 0x40000000L }; - inline constexpr auto GENERIC_EXECUTE{ 0x20000000L }; - inline constexpr auto GENERIC_ALL{ 0x10000000L }; - - // pe image header - inline constexpr auto IMAGE_DOS_SIGNATURE{ 0x5A4Du }; - inline constexpr auto IMAGE_NT_SIGNATURE{ 0x00004550u }; - inline constexpr auto IMAGE_NT_OPTIONAL_HDR32_MAGIC{ 0x10Bu }; - inline constexpr auto IMAGE_NT_OPTIONAL_HDR64_MAGIC{ 0x20Bu }; - - // pe image directory entries - inline constexpr auto IMAGE_DIRECTORY_ENTRY_EXPORT{ 0u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_IMPORT{ 1u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_RESOURCE{ 2u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_EXCEPTION{ 3u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_SECURITY{ 4u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_BASERELOC{ 5u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_DEBUG{ 6u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_ARCHITECTURE{ 7u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_GLOBALPTR{ 8u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_TLS{ 9u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG{ 10u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT{ 11u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_IAT{ 12u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT{ 13u }; - inline constexpr auto IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR{ 14u }; - inline constexpr auto IMAGE_NUMBEROF_DIRECTORY_ENTRIES{ 16u }; - - // pe image ordinal - inline constexpr auto IMAGE_ORDINAL_FLAG32{ 0x80000000u }; - inline constexpr auto IMAGE_ORDINAL_FLAG64{ 0x8000000000000000ull }; - - // pe image section header characteristics - inline constexpr auto IMAGE_SCN_MEM_SHARED{ 0x10000000u }; - inline constexpr auto IMAGE_SCN_MEM_EXECUTE{ 0x20000000u }; - inline constexpr auto IMAGE_SCN_MEM_READ{ 0x40000000u }; - inline constexpr auto IMAGE_SCN_MEM_WRITE{ 0x80000000u }; - inline constexpr auto IMAGE_SIZEOF_SECTION_HEADER{ 40u }; - inline constexpr auto IMAGE_SIZEOF_SHORT_NAME{ 8u }; - - // process creation flags - inline constexpr auto DEBUG_PROCESS{ 0x00000001u }; - inline constexpr auto DEBUG_ONLY_THIS_PROCESS{ 0x00000002u }; - inline constexpr auto CREATE_SUSPENDED{ 0x00000004u }; - inline constexpr auto DETACHED_PROCESS{ 0x00000008u }; - inline constexpr auto CREATE_NEW_CONSOLE{ 0x00000010u }; - inline constexpr auto NORMAL_PRIORITY_CLASS{ 0x00000020u }; - inline constexpr auto IDLE_PRIORITY_CLASS{ 0x00000040u }; - inline constexpr auto HIGH_PRIORITY_CLASS{ 0x00000080u }; - inline constexpr auto REALTIME_PRIORITY_CLASS{ 0x00000100u }; - inline constexpr auto CREATE_NEW_PROCESS_GROUP{ 0x00000200u }; - inline constexpr auto CREATE_UNICODE_ENVIRONMENT{ 0x00000400u }; - inline constexpr auto CREATE_FORCEDOS{ 0x00002000u }; - inline constexpr auto BELOW_NORMAL_PRIORITY_CLASS{ 0x00004000u }; - inline constexpr auto ABOVE_NORMAL_PRIORITY_CLASS{ 0x00008000u }; - inline constexpr auto INHERIT_PARENT_AFFINITY{ 0x00010000u }; - inline constexpr auto CREATE_PROTECTED_PROCESS{ 0x00040000u }; - inline constexpr auto EXTENDED_STARTUPINFO_PRESENT{ 0x00080000u }; - inline constexpr auto PROCESS_MODE_BACKGROUND_BEGIN{ 0x00100000u }; - inline constexpr auto PROCESS_MODE_BACKGROUND_END{ 0x00200000u }; - inline constexpr auto CREATE_SECURE_PROCESS{ 0x00400000 }; - inline constexpr auto CREATE_BREAKAWAY_FROM_JOB{ 0x01000000u }; - inline constexpr auto CREATE_PRESERVE_CODE_AUTHZ_LEVEL{ 0x02000000u }; - inline constexpr auto CREATE_DEFAULT_ERROR_MODE{ 0x04000000u }; - inline constexpr auto CREATE_NO_WINDOW{ 0x08000000u }; - - // locale map flags - inline constexpr auto LCMAP_LOWERCASE{ 0x00000100u }; - inline constexpr auto LCMAP_UPPERCASE{ 0x00000200u }; - inline constexpr auto LCMAP_TITLECASE{ 0x00000300u }; - inline constexpr auto LCMAP_SORTKEY{ 0x00000400u }; - inline constexpr auto LCMAP_BYTEREV{ 0x00000800u }; - inline constexpr auto LCMAP_HIRAGANA{ 0x00100000u }; - inline constexpr auto LCMAP_KATAKANA{ 0x00200000u }; - inline constexpr auto LCMAP_HALFWIDTH{ 0x00400000u }; - inline constexpr auto LCMAP_FULLWIDTH{ 0x00800000u }; - inline constexpr auto LCMAP_LINGUISTIC_CASING{ 0x01000000u }; - inline constexpr auto LCMAP_SIMPLIFIED_CHINESE{ 0x02000000u }; - inline constexpr auto LCMAP_TRADITIONAL_CHINESE{ 0x04000000u }; - - // locale names - inline constexpr auto LOCALE_NAME_USER_DEFAULT{ nullptr }; - inline constexpr auto LOCALE_NAME_INVARIANT{ L"" }; - inline constexpr auto LOCALE_NAME_SYSTEM_DEFAULT{ L"!x-sys-default-locale" }; -} - -namespace REX::W32 -{ - struct IMAGE_DATA_DIRECTORY - { - std::uint32_t virtualAddress; - std::uint32_t size; - }; - static_assert(sizeof(IMAGE_DATA_DIRECTORY) == 0x8); - - struct IMAGE_DOS_HEADER - { - std::uint16_t magic; - std::uint16_t cblp; - std::uint16_t cp; - std::uint16_t crlc; - std::uint16_t cparhdr; - std::uint16_t minalloc; - std::uint16_t maxalloc; - std::uint16_t ss; - std::uint16_t sp; - std::uint16_t csum; - std::uint16_t ip; - std::uint16_t cs; - std::uint16_t lfarlc; - std::uint16_t ovno; - std::uint16_t res[4]; - std::uint16_t oemid; - std::uint16_t oeminfo; - std::uint16_t res2[10]; - std::int32_t lfanew; - }; - static_assert(sizeof(IMAGE_DOS_HEADER) == 0x40); - - struct IMAGE_FILE_HEADER - { - std::uint16_t machine; - std::uint16_t sectionCount; - std::uint32_t timeDateStamp; - std::uint32_t symbolTablePtr; - std::uint32_t symbolCount; - std::uint16_t optionalHeaderSize; - std::uint16_t characteristics; - }; - static_assert(sizeof(IMAGE_FILE_HEADER) == 0x14); - - struct IMAGE_IMPORT_BY_NAME - { - std::uint16_t hint; - char name[1]; - }; - static_assert(sizeof(IMAGE_IMPORT_BY_NAME) == 0x4); - - struct IMAGE_IMPORT_DESCRIPTOR - { - union - { - std::uint32_t characteristics; - std::uint32_t firstThunkOriginal; - }; - - std::uint32_t timeDateStamp; - std::uint32_t forwarderChain; - std::uint32_t name; - std::uint32_t firstThunk; - }; - static_assert(sizeof(IMAGE_IMPORT_DESCRIPTOR) == 0x14); - - struct IMAGE_OPTIONAL_HEADER64 - { - std::uint16_t magic; - std::uint8_t linkerVersionMajor; - std::uint8_t linkerVersionMinor; - std::uint32_t codeSize; - std::uint32_t initializedDataSize; - std::uint32_t uninitializedDataSize; - std::uint32_t entryPointAddress; - std::uint32_t codeBase; - std::uint64_t imageBase; - std::uint32_t sectionAlignment; - std::uint32_t fileAlignment; - std::uint16_t osVersionMajor; - std::uint16_t osVersionMinor; - std::uint16_t imageVersionMajor; - std::uint16_t imageVersionMinor; - std::uint16_t subsystemVersionMajor; - std::uint16_t subsystemVersionMinor; - std::uint32_t win32Version; - std::uint32_t imageSize; - std::uint32_t headersSize; - std::uint32_t checksum; - std::uint16_t subsystem; - std::uint16_t dllCharacteristics; - std::uint64_t stackReserveSize; - std::uint64_t stackCommitSize; - std::uint64_t heapReserveSize; - std::uint64_t heapCommitSize; - std::uint32_t loaderFlags; - std::uint32_t rvaAndSizesCount; - IMAGE_DATA_DIRECTORY dataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; - }; - static_assert(sizeof(IMAGE_OPTIONAL_HEADER64) == 0xF0); - - struct IMAGE_NT_HEADERS64 - { - std::uint32_t signature; - IMAGE_FILE_HEADER fileHeader; - IMAGE_OPTIONAL_HEADER64 optionalHeader; - }; - static_assert(sizeof(IMAGE_NT_HEADERS64) == 0x108); - - struct IMAGE_SECTION_HEADER - { - std::uint8_t name[IMAGE_SIZEOF_SHORT_NAME]; - union - { - std::uint32_t physicalAddress; - std::uint32_t virtualSize; - }; - std::uint32_t virtualAddress; - std::uint32_t rawDataSize; - std::uint32_t rawDataPtr; - std::uint32_t relocationsPtr; - std::uint32_t lineNumbersPtr; - std::uint16_t relocationsCount; - std::uint16_t lineNumbersCount; - std::uint32_t characteristics; - }; - static_assert(sizeof(IMAGE_SECTION_HEADER) == 0x28); - - struct IMAGE_THUNK_DATA64 - { - union - { - std::uint64_t forwarderString; - std::uint64_t function; - std::uint64_t ordinal; - std::uint64_t address; - }; - }; - static_assert(sizeof(IMAGE_THUNK_DATA64) == 0x8); - - struct MEMORY_BASIC_INFORMATION - { - void* baseAddress; - void* allocationBase; - std::uint32_t allocationProtect; - std::uint16_t partitionID; - std::size_t regionSize; - std::uint32_t state; - std::uint32_t protect; - std::uint32_t type; - }; - static_assert(sizeof(MEMORY_BASIC_INFORMATION) == 0x30); - - struct NLSVERSIONINFO - { - std::uint32_t nlsVersionInfoSize; - std::uint32_t nlsVersion; - std::uint32_t definedVersion; - std::uint32_t effectiveID; - GUID guidCustomVersion; - }; - static_assert(sizeof(NLSVERSIONINFO) == 0x20); - - struct PROCESS_INFORMATION - { - void* process; - void* thread; - std::uint32_t processID; - std::uint32_t threadID; - }; - static_assert(sizeof(PROCESS_INFORMATION) == 0x18); - - struct STARTUPINFOA - { - std::uint32_t size; - char* reserved0; - char* desktop; - char* title; - std::uint32_t x; - std::uint32_t y; - std::uint32_t xSize; - std::uint32_t ySize; - std::uint32_t xCountChars; - std::uint32_t yCountChars; - std::uint32_t fillAttribute; - std::uint32_t flags; - std::uint16_t showWindow; - std::uint16_t reserved1; - std::uint8_t* reserved2; - void* stdIn; - void* stdOut; - void* stdErr; - }; - static_assert(sizeof(STARTUPINFOA) == 0x68); - - struct STARTUPINFOW - { - std::uint32_t size; - wchar_t* reserved0; - wchar_t* desktop; - wchar_t* title; - std::uint32_t x; - std::uint32_t y; - std::uint32_t xSize; - std::uint32_t ySize; - std::uint32_t xCountChars; - std::uint32_t yCountChars; - std::uint32_t fillAttribute; - std::uint32_t flags; - std::uint16_t showWindow; - std::uint16_t reserved1; - std::uint8_t* reserved2; - void* stdIn; - void* stdOut; - void* stdErr; - }; - static_assert(sizeof(STARTUPINFOW) == 0x68); - - struct SYSTEM_INFO - { - union - { - std::uint32_t oemID; - struct - { - std::uint16_t processorArch; - std::uint16_t reserved; - }; - }; - std::uint32_t pageSize; - void* appAddressMin; - void* appAddressMax; - std::uintptr_t processorActiveMask; - std::uint32_t processorCount; - std::uint32_t processorType; - std::uint32_t allocationGranularity; - std::uint16_t processorLevel; - std::uint16_t processorRevision; - }; - static_assert(sizeof(SYSTEM_INFO) == 0x30); - - struct WIN32_FIND_DATAA - { - std::uint32_t fileAttributes; - FILETIME creationTime; - FILETIME lastAccessTime; - FILETIME lastWriteTime; - std::uint32_t fileSizeHi; - std::uint32_t fileSizeLo; - std::uint32_t reserved0; - std::uint32_t reserved1; - char fileName[MAX_PATH]; - char fileNameAlt[14]; - }; - static_assert(sizeof(WIN32_FIND_DATAA) == 0x140); - - struct WIN32_FIND_DATAW - { - std::uint32_t fileAttributes; - FILETIME creationTime; - FILETIME lastAccessTime; - FILETIME lastWriteTime; - std::uint32_t fileSizeHi; - std::uint32_t fileSizeLo; - std::uint32_t reserved0; - std::uint32_t reserved1; - wchar_t fileName[MAX_PATH]; - wchar_t fileNameAlt[14]; - }; - static_assert(sizeof(WIN32_FIND_DATAW) == 0x250); -} - -namespace REX::W32 -{ - using THREAD_START_ROUTINE = std::uint32_t(void* a_param); -} - -namespace REX::W32 -{ - bool CloseHandle(HANDLE a_handle) noexcept; - HANDLE CreateFileA(const char* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile); - HANDLE CreateFileW(const wchar_t* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile); - HANDLE CreateFileMappingA(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const char* a_name) noexcept; - HANDLE CreateFileMappingW(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const wchar_t* a_name) noexcept; - bool CreateProcessA(const char* a_name, char* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const char* a_curDir, STARTUPINFOA* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept; - bool CreateProcessW(const wchar_t* a_name, wchar_t* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const wchar_t* a_curDir, STARTUPINFOW* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept; - HANDLE CreateRemoteThread(HANDLE a_process, SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept; - HANDLE CreateSemaphoreA(SECURITY_ATTRIBUTES* a_semaphoreAttr, std::int32_t a_initCount, std::int32_t a_maxCount, const char* a_name); - HANDLE CreateThread(SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept; - void DeleteCriticalSection(CRITICAL_SECTION* a_criticalSection); - void EnterCriticalSection(CRITICAL_SECTION* a_criticalSection); - std::uint32_t ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; - std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept; - bool FindClose(HANDLE a_file) noexcept; - HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept; - HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept; - bool FindNextFileA(HANDLE a_file, WIN32_FIND_DATAA* a_data) noexcept; - bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept; - bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept; - bool FreeLibrary(HMODULE a_module) noexcept; - bool GetComputerNameA(char* a_buffer, std::uint32_t* a_size) noexcept; - bool GetComputerNameW(wchar_t* a_buffer, std::uint32_t* a_size) noexcept; - HMODULE GetCurrentModule() noexcept; - HANDLE GetCurrentProcess() noexcept; - std::uint32_t GetCurrentThreadId() noexcept; - std::uint32_t GetEnvironmentVariableA(const char* a_name, char* a_buf, std::uint32_t a_bufLen) noexcept; - std::uint32_t GetEnvironmentVariableW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen) noexcept; - bool GetFileSizeEx(HANDLE a_file, LARGE_INTEGER* a_fileSize) noexcept; - std::uint32_t GetLastError() noexcept; - std::uint32_t GetModuleFileNameA(HMODULE a_module, char* a_name, std::uint32_t a_nameLen) noexcept; - std::uint32_t GetModuleFileNameW(HMODULE a_module, wchar_t* a_name, std::uint32_t a_nameLen) noexcept; - HMODULE GetModuleHandleA(const char* a_name) noexcept; - HMODULE GetModuleHandleW(const wchar_t* a_name) noexcept; - std::uint32_t GetPrivateProfileIntA(const char* a_app, const char* a_key, std::int32_t a_default, const char* a_name) noexcept; - std::uint32_t GetPrivateProfileIntW(const wchar_t* a_app, const wchar_t* a_key, std::int32_t a_default, const wchar_t* a_name) noexcept; - std::uint32_t GetPrivateProfileStringA(const char* a_app, const char* a_key, const char* a_default, char* a_buf, std::uint32_t a_bufLen, const char* a_name) noexcept; - std::uint32_t GetPrivateProfileStringW(const wchar_t* a_app, const wchar_t* a_key, const wchar_t* a_default, wchar_t* a_buf, std::uint32_t a_bufLen, const wchar_t* a_name) noexcept; - void* GetProcAddress(HMODULE a_module, const char* a_name) noexcept; - void GetSystemInfo(SYSTEM_INFO* a_info) noexcept; - bool IMAGE_SNAP_BY_ORDINAL64(std::uint64_t a_ordinal) noexcept; - IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION(const IMAGE_NT_HEADERS64* a_header) noexcept; - bool InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount); - std::uint32_t InterlockedCompareExchange(volatile std::uint32_t* a_target, std::uint32_t a_value, std::uint32_t a_compare) noexcept; - std::uint64_t InterlockedCompareExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value, std::uint64_t a_compare) noexcept; - std::uint32_t InterlockedDecrement(volatile std::uint32_t* a_target) noexcept; - std::uint64_t InterlockedDecrement64(volatile std::uint64_t* a_target) noexcept; - std::uint32_t InterlockedExchange(volatile std::uint32_t* a_target, std::uint32_t a_value) noexcept; - std::uint64_t InterlockedExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value) noexcept; - std::uint32_t InterlockedIncrement(volatile std::uint32_t* a_target) noexcept; - std::uint64_t InterlockedIncrement64(volatile std::uint64_t* a_target) noexcept; - bool IsDebuggerPresent() noexcept; - std::int32_t LCMapStringEx(const wchar_t* a_locale, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen, NLSVERSIONINFO* a_info, void* a_reserved, std::intptr_t a_sortHandle) noexcept; - void LeaveCriticalSection(CRITICAL_SECTION* a_criticalSection); - HMODULE LoadLibraryA(const char* a_name) noexcept; - HMODULE LoadLibraryW(const wchar_t* a_name) noexcept; - void* MapViewOfFile(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes) noexcept; - void* MapViewOfFileEx(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes, void* a_baseAddr) noexcept; - std::int32_t MultiByteToWideChar(std::uint32_t a_codePage, std::uint32_t a_flags, const char* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen) noexcept; - HANDLE OpenFileMappingA(std::uint32_t a_desiredAccess, bool a_inheritHandle, const char* a_name) noexcept; - HANDLE OpenFileMappingW(std::uint32_t a_desiredAccess, bool a_inheritHandle, const wchar_t* a_name) noexcept; - void OutputDebugStringA(const char* a_str) noexcept; - void OutputDebugStringW(const wchar_t* a_str) noexcept; - bool QueryPerformanceCounter(std::int64_t* a_counter) noexcept; - bool QueryPerformanceFrequency(std::int64_t* a_frequency) noexcept; - std::uint32_t ResumeThread(HANDLE a_handle) noexcept; - bool SetEnvironmentVariableA(const char* a_name, const char* a_value) noexcept; - bool SetEnvironmentVariableW(const wchar_t* a_name, const wchar_t* a_value) noexcept; - void Sleep(std::uint32_t a_milliseconds) noexcept; - bool TerminateProcess(HANDLE a_process, std::uint32_t a_exitCode) noexcept; - void* TlsGetValue(std::uint32_t a_index) noexcept; - bool TlsSetValue(std::uint32_t a_index, void* a_value) noexcept; - bool UnmapViewOfFile(const void* a_baseAddress) noexcept; - void* VirtualAlloc(void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept; - void* VirtualAllocEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept; - bool VirtualFree(void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept; - bool VirtualFreeEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept; - bool VirtualProtect(void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept; - bool VirtualProtectEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept; - std::size_t VirtualQuery(const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept; - std::size_t VirtualQueryEx(HANDLE a_process, const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept; - std::uint32_t WaitForSingleObject(HANDLE a_handle, std::uint32_t a_milliseconds) noexcept; - std::uint32_t WaitForSingleObjectEx(HANDLE a_handle, std::uint32_t a_milliseconds, bool a_alertable) noexcept; - std::int32_t WideCharToMultiByte(std::uint32_t a_codePage, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, char* a_dst, std::int32_t a_dstLen, const char* a_default, std::int32_t* a_defaultLen); - bool WriteProcessMemory(HANDLE a_process, void* a_address, const void* a_buf, std::size_t a_bufLen, std::size_t* a_bufWritten) noexcept; -} diff --git a/include/REX/W32/NT.h b/include/REX/W32/NT.h deleted file mode 100644 index 9a410f6..0000000 --- a/include/REX/W32/NT.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - struct EXCEPTION_REGISTRATION_RECORD; - struct PEB_LDR_DATA; - struct RTL_USER_PROCESS_PARAMETERS; - struct UNICODE_STRING; - - using PS_POST_PROCESS_INIT_ROUTINE = void (*)(); - - struct LIST_ENTRY - { - struct LIST_ENTRY* fLink; - struct LIST_ENTRY* bLink; - }; - - struct NT_TIB - { - EXCEPTION_REGISTRATION_RECORD* exceptionList; - void* stackBase; - void* stackLimit; - void* subSystemTib; - union - { - void* fiberData; - std::uint32_t version; - }; - void* arbitraryUserPointer; - struct NT_TIB* self; - }; - - struct PEB - { - std::byte reserved1[2]; - std::byte beingDebugged; - std::byte reserved2[1]; - void* reserved3[2]; - PEB_LDR_DATA* ldr; - RTL_USER_PROCESS_PARAMETERS* processParameters; - void* reserved4[3]; - void* atlThunkSListPtr; - void* reserved5; - std::uint32_t reserved6; - void* reserved7; - std::uint32_t reserved8; - std::uint32_t atlThunkSListPtr32; - void* reserved9[45]; - std::byte reserved10[96]; - PS_POST_PROCESS_INIT_ROUTINE postProcessInitRoutine; - std::byte reserved11[128]; - void* reserved12[1]; - std::uint32_t sessionID; - }; - - struct PEB_LDR_DATA - { - std::byte reserved1[8]; - void* reserved2[3]; - LIST_ENTRY inMemoryOrderModuleList; - }; - - struct RTL_USER_PROCESS_PARAMETERS - { - std::byte reserved1[16]; - void* reserved2[10]; - UNICODE_STRING imagePathName; - UNICODE_STRING commandLine; - }; - - struct TEB - { - void* reserved1[11]; - void* threadLocalStoragePointer; - PEB* processEnvironmentBlock; - void* reserved2[399]; - std::byte reserved3[1952]; - void* tlsSlots[64]; - std::byte reserved4[8]; - void* reserved5[26]; - void* reservedForOle; - void* reserved6[4]; - void* tlsExpansionSlots; - }; -} - -namespace REX::W32 -{ - TEB* NtCurrentTeb() noexcept; -} diff --git a/include/REX/W32/OLE32.h b/include/REX/W32/OLE32.h deleted file mode 100644 index 517861e..0000000 --- a/include/REX/W32/OLE32.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - void CoTaskMemFree(void* a_block) noexcept; -} diff --git a/include/REX/W32/SHELL32.h b/include/REX/W32/SHELL32.h deleted file mode 100644 index e99e7d2..0000000 --- a/include/REX/W32/SHELL32.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - // known folder ids - inline constexpr GUID FOLDERID_Documents{ 0xFDD39AD0u, 0x238Fu, 0x46AFu, { 0xADu, 0xB4u, 0x6Cu, 0x85u, 0x48u, 0x03u, 0x69u, 0xC7u } }; - inline constexpr GUID FOLDERID_Pictures{ 0x33E28130u, 0x4E1Eu, 0x4676u, { 0x83u, 0x5Au, 0x98u, 0x39u, 0x5Cu, 0x3Bu, 0xC3u, 0xBBu } }; - inline constexpr GUID FOLDERID_ProgramData{ 0x62AB5D82u, 0xFDC1u, 0x4DC3u, { 0xA9u, 0xDDu, 0x07u, 0x0Du, 0x1Du, 0x49u, 0x5Du, 0x97u } }; - - // known folder flags - inline constexpr auto KF_FLAG_DEFAULT{ 0x00000000u }; - inline constexpr auto KF_FLAG_FORCE_APP_DATA_REDIRECTION{ 0x00080000u }; - inline constexpr auto KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET{ 0x00040000u }; - inline constexpr auto KF_FLAG_FORCE_PACKAGE_REDIRECTION{ 0x00020000u }; - inline constexpr auto KF_FLAG_NO_PACKAGE_REDIRECTION{ 0x00010000u }; - inline constexpr auto KF_FLAG_FORCE_APPCONTAINER_REDIRECTION{ 0x00020000u }; - inline constexpr auto KF_FLAG_NO_APPCONTAINER_REDIRECTION{ 0x00010000u }; - inline constexpr auto KF_FLAG_CREATE{ 0x00008000u }; - inline constexpr auto KF_FLAG_DONT_VERIFY{ 0x00004000u }; - inline constexpr auto KF_FLAG_DONT_UNEXPAND{ 0x00002000u }; - inline constexpr auto KF_FLAG_NO_ALIAS{ 0x00001000u }; - inline constexpr auto KF_FLAG_INIT{ 0x00000800u }; - inline constexpr auto KF_FLAG_DEFAULT_PATH{ 0x00000400u }; - inline constexpr auto KF_FLAG_NOT_PARENT_RELATIVE{ 0x00000200u }; - inline constexpr auto KF_FLAG_SIMPLE_IDLIST{ 0x00000100u }; - inline constexpr auto KF_FLAG_ALIAS_ONLY{ 0x80000000u }; -} - -namespace REX::W32 -{ - std::int32_t SHGetKnownFolderPath(const GUID& a_id, std::uint32_t a_flags, void* a_token, wchar_t** a_path) noexcept; -} diff --git a/include/REX/W32/USER32.h b/include/REX/W32/USER32.h deleted file mode 100644 index f3325fa..0000000 --- a/include/REX/W32/USER32.h +++ /dev/null @@ -1,293 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - enum GWLP : std::int32_t - { - GWLP_USERDATA = -21, - GWLP_ID = -12, - GWLP_HWNDPARENT = -8, - GWLP_HINSTANCE = -6, - GWLP_WNDPROC = -4, - }; - - enum WM : std::uint32_t - { - WM_NULL = 0x0000u, - WM_CREATE = 0x0001u, - WM_DESTROY = 0x0002u, - WM_MOVE = 0x0003u, - WM_SIZE = 0x0005u, - WM_ACTIVATE = 0x0006u, - WM_SETFOCUS = 0x0007u, - WM_KILLFOCUS = 0x0008u, - WM_ENABLE = 0x000Au, - WM_SETREDRAW = 0x000Bu, - WM_SETTEXT = 0x000Cu, - WM_GETTEXT = 0x000Du, - WM_GETTEXTLENGTH = 0x000Eu, - WM_PAINT = 0x000Fu, - WM_CLOSE = 0x0010u, - WM_QUIT = 0x0012u, - WM_ERASEBKGND = 0x0014u, - WM_SHOWWINDOW = 0x0018u, - WM_ACTIVATEAPP = 0x001Cu, - WM_FONTCHANGE = 0x001Du, - WM_TIMECHANGE = 0x001Eu, - WM_CANCELMODE = 0x001Fu, - WM_SETCURSOR = 0x0020u, - WM_MOUSEACTIVATE = 0x0021u, - WM_CHILDACTIVATE = 0x0022u, - }; - - enum VK : std::uint32_t - { - VK_LBUTTON = 0x1, - VK_RBUTTON = 0x2, - VK_CANCEL = 0x3, - VK_MBUTTON = 0x4, - VK_XBUTTON1 = 0x5, - VK_XBUTTON2 = 0x6, - VK_BACK = 0x8, - VK_TAB = 0x9, - VK_RESERVED_0A = 0xA, - VK_RESERVED_0B = 0xB, - VK_CLEAR = 0xC, - VK_RETURN = 0xD, - VK_SHIFT = 0x10, - VK_CONTROL = 0x11, - VK_MENU = 0x12, - VK_PAUSE = 0x13, - VK_CAPITAL = 0x14, - VK_KANA = 0x15, - VK_HANGUEL = 0x15, - VK_HANGUL = 0x15, - VK_IME_ON = 0x16, - VK_JUNJA = 0x17, - VK_FINAL = 0x18, - VK_HANJA = 0x19, - VK_KANJI = VK_HANJA, - VK_IME_OFF = 0x1A, - VK_ESCAPE = 0x1B, - VK_CONVERT = 0x1C, - VK_NONCONVERT = 0x1D, - VK_ACCEPT = 0x1E, - VK_MODECHANGE = 0x1F, - VK_SPACE = 0x20, - VK_PRIOR = 0x21, - VK_NEXT = 0x22, - VK_END = 0x23, - VK_HOME = 0x24, - VK_LEFT = 0x25, - VK_UP = 0x26, - VK_RIGHT = 0x27, - VK_DOWN = 0x28, - VK_SELECT = 0x29, - VK_PRINT = 0x2A, - VK_EXECUTE = 0x2B, - VK_SNAPSHOT = 0x2C, - VK_INSERT = 0x2D, - VK_DELETE = 0x2E, - VK_HELP = 0x2F, - VK_0 = 0x30, - VK_1 = 0x31, - VK_2 = 0x32, - VK_3 = 0x33, - VK_4 = 0x34, - VK_5 = 0x35, - VK_6 = 0x36, - VK_7 = 0x37, - VK_8 = 0x38, - VK_9 = 0x39, - VK_A = 0x41, - VK_B = 0x42, - VK_C = 0x43, - VK_D = 0x44, - VK_E = 0x45, - VK_F = 0x46, - VK_G = 0x47, - VK_H = 0x48, - VK_I = 0x49, - VK_J = 0x4A, - VK_K = 0x4B, - VK_L = 0x4C, - VK_M = 0x4D, - VK_N = 0x4E, - VK_O = 0x4F, - VK_P = 0x50, - VK_Q = 0x51, - VK_R = 0x52, - VK_S = 0x53, - VK_T = 0x54, - VK_U = 0x55, - VK_V = 0x56, - VK_W = 0x57, - VK_X = 0x58, - VK_Y = 0x59, - VK_Z = 0x5A, - VK_LWIN = 0x5B, - VK_RWIN = 0x5C, - VK_APPS = 0x5D, - VK_RESERVED_5E = 0x5E, - VK_SLEEP = 0x5F, - VK_NUMPAD0 = 0x60, - VK_NUMPAD1 = 0x61, - VK_NUMPAD2 = 0x62, - VK_NUMPAD3 = 0x63, - VK_NUMPAD4 = 0x64, - VK_NUMPAD5 = 0x65, - VK_NUMPAD6 = 0x66, - VK_NUMPAD7 = 0x67, - VK_NUMPAD8 = 0x68, - VK_NUMPAD9 = 0x69, - VK_MULTIPLY = 0x6A, - VK_ADD = 0x6B, - VK_SEPARATOR = 0x6C, - VK_SUBTRACT = 0x6D, - VK_DECIMAL = 0x6E, - VK_DIVIDE = 0x6F, - VK_F1 = 0x70, - VK_F2 = 0x71, - VK_F3 = 0x72, - VK_F4 = 0x73, - VK_F5 = 0x74, - VK_F6 = 0x75, - VK_F7 = 0x76, - VK_F8 = 0x77, - VK_F9 = 0x78, - VK_F10 = 0x79, - VK_F11 = 0x7A, - VK_F12 = 0x7B, - VK_F13 = 0x7C, - VK_F14 = 0x7D, - VK_F15 = 0x7E, - VK_F16 = 0x7F, - VK_F17 = 0x80, - VK_F18 = 0x81, - VK_F19 = 0x82, - VK_F20 = 0x83, - VK_F21 = 0x84, - VK_F22 = 0x85, - VK_F23 = 0x86, - VK_F24 = 0x87, - VK_NUMLOCK = 0x90, - VK_SCROLL = 0x91, - VK_OEMSPECIFIC_92 = 0x92, - VK_OEMSPECIFIC_93 = 0x93, - VK_OEMSPECIFIC_94 = 0x94, - VK_OEMSPECIFIC_95 = 0x95, - VK_OEMSPECIFIC_96 = 0x96, - VK_LSHIFT = 0xA0, - VK_RSHIFT = 0xA1, - VK_LCONTROL = 0xA2, - VK_RCONTROL = 0xA3, - VK_LMENU = 0xA4, - VK_RMENU = 0xA5, - VK_BROWSER_BACK = 0xA6, - VK_BROWSER_FORWARD = 0xA7, - VK_BROWSER_REFRESH = 0xA8, - VK_BROWSER_STOP = 0xA9, - VK_BROWSER_SEARCH = 0xAA, - VK_BROWSER_FAVORITES = 0xAB, - VK_BROWSER_HOME = 0xAC, - VK_VOLUME_MUTE = 0xAD, - VK_VOLUME_DOWN = 0xAE, - VK_VOLUME_UP = 0xAF, - VK_MEDIA_NEXT_TRACK = 0xB0, - VK_MEDIA_PREV_TRACK = 0xB1, - VK_MEDIA_STOP = 0xB2, - VK_MEDIA_PLAY_PAUSE = 0xB3, - VK_LAUNCH_MAIL = 0xB4, - VK_LAUNCH_MEDIA_SELECT = 0xB5, - VK_LAUNCH_APP1 = 0xB6, - VK_LAUNCH_APP2 = 0xB7, - VK_RESERVED_B8 = 0xB8, - VK_RESERVED_B9 = 0xB9, - VK_OEM_1 = 0xBA, - VK_OEM_PLUS = 0xBB, - VK_OEM_COMMA = 0xBC, - VK_OEM_MINUS = 0xBD, - VK_OEM_PERIOD = 0xBE, - VK_OEM_2 = 0xBF, - VK_OEM_3 = 0xC0, - VK_RESERVED_C1 = 0xC1, - VK_RESERVED_C2 = 0xC2, - VK_RESERVED_C3 = 0xC3, - VK_RESERVED_C4 = 0xC4, - VK_RESERVED_C5 = 0xC5, - VK_RESERVED_C6 = 0xC6, - VK_RESERVED_C7 = 0xC7, - VK_RESERVED_C8 = 0xC8, - VK_RESERVED_C9 = 0xC9, - VK_RESERVED_CA = 0xCA, - VK_RESERVED_CB = 0xCB, - VK_RESERVED_CC = 0xCC, - VK_RESERVED_CD = 0xCD, - VK_RESERVED_CE = 0xCE, - VK_RESERVED_CF = 0xCF, - VK_RESERVED_D0 = 0xD0, - VK_RESERVED_D1 = 0xD1, - VK_RESERVED_D2 = 0xD2, - VK_RESERVED_D3 = 0xD3, - VK_RESERVED_D4 = 0xD4, - VK_RESERVED_D5 = 0xD5, - VK_RESERVED_D6 = 0xD6, - VK_RESERVED_D7 = 0xD7, - VK_OEM_4 = 0xDB, - VK_OEM_5 = 0xDC, - VK_OEM_6 = 0xDD, - VK_OEM_7 = 0xDE, - VK_OEM_8 = 0xDF, - VK_RESERVED_E0 = 0xE0, - VK_OEMSPECIFIC_E1 = 0xE1, - VK_OEM_102 = 0xE2, - VK_OEMSPECIFIC_E3 = 0xE3, - VK_OEMSPECIFIC_E4 = 0xE4, - VK_PROCESSKEY = 0xE5, - VK_OEMSPECIFIC_E6 = 0xE6, - VK_PACKET = 0xE7, - VK_OEMSPECIFIC_E9 = 0xE9, - VK_OEMSPECIFIC_EA = 0xEA, - VK_OEMSPECIFIC_EB = 0xEB, - VK_OEMSPECIFIC_EC = 0xEC, - VK_OEMSPECIFIC_ED = 0xED, - VK_OEMSPECIFIC_EE = 0xEE, - VK_OEMSPECIFIC_EF = 0xEF, - VK_OEMSPECIFIC_F0 = 0xF0, - VK_OEMSPECIFIC_F1 = 0xF1, - VK_OEMSPECIFIC_F2 = 0xF2, - VK_OEMSPECIFIC_F3 = 0xF3, - VK_OEMSPECIFIC_F4 = 0xF4, - VK_OEMSPECIFIC_F5 = 0xF5, - VK_ATTN = 0xF6, - VK_CRSEL = 0xF7, - VK_EXSEL = 0xF8, - VK_EREOF = 0xF9, - VK_PLAY = 0xFA, - VK_ZOOM = 0xFB, - VK_NONAME = 0xFC, - VK_PA1 = 0xFD, - VK_OEM_CLEAR = 0xFE, - VK_RESERVED_FF = 0xFF, - }; -} - -namespace REX::W32 -{ - using WNDPROC = std::intptr_t (*)(HWND, std::uint32_t, std::uintptr_t, std::intptr_t); -} - -namespace REX::W32 -{ - bool GetClientRect(HWND a_wnd, RECT* a_rect) noexcept; - std::int32_t GetKeyNameTextA(std::int32_t a_param, char* a_buf, std::int32_t a_bufLen) noexcept; - std::int32_t GetKeyNameTextW(std::int32_t a_param, wchar_t* a_buf, std::int32_t a_bufLen) noexcept; - std::int16_t GetKeyState(std::int32_t a_key) noexcept; - bool GetWindowRect(HWND a_wnd, RECT* a_rect) noexcept; - std::int32_t MessageBoxA(HWND a_wnd, const char* a_text, const char* a_caption, std::uint32_t a_type) noexcept; - std::int32_t MessageBoxW(HWND a_wnd, const wchar_t* a_text, const wchar_t* a_caption, std::uint32_t a_type) noexcept; - std::intptr_t SetWindowLongPtrA(HWND a_wnd, std::int32_t a_index, std::intptr_t a_newPtr) noexcept; - std::int32_t ShowCursor(bool a_show) noexcept; -} diff --git a/include/REX/W32/VERSION.h b/include/REX/W32/VERSION.h deleted file mode 100644 index 25c72d9..0000000 --- a/include/REX/W32/VERSION.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -namespace REX::W32 -{ - bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept; - std::uint32_t GetFileVersionInfoSizeA(const char* a_name, std::uint32_t* a_handle) noexcept; - //std::uint32_t GetFileVersionInfoSizeExA(std::uint32_t a_flags, const char* a_name, std::uint32_t* a_handle) noexcept; - std::uint32_t GetFileVersionInfoSizeExW(std::uint32_t a_flags, const wchar_t* a_name, std::uint32_t* a_handle) noexcept; - std::uint32_t GetFileVersionInfoSizeW(const wchar_t* a_name, std::uint32_t* a_handle) noexcept; - bool GetFileVersionInfoW(const wchar_t* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept; - bool VerQueryValueA(const void* a_block, const char* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept; - bool VerQueryValueW(const void* a_block, const wchar_t* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept; -} diff --git a/include/REX/W32/XINPUT.h b/include/REX/W32/XINPUT.h deleted file mode 100644 index 071a97a..0000000 --- a/include/REX/W32/XINPUT.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -namespace REX::W32 -{ - inline constexpr std::uint16_t XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE{ 7849 }; - inline constexpr std::uint16_t XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE{ 8689 }; - inline constexpr std::uint8_t XINPUT_GAMEPAD_TRIGGER_THRESHOLD{ 30 }; -} - -namespace REX::W32 -{ - enum XINPUT_GAMEPAD_BUTTON : std::uint16_t - { - XINPUT_GAMEPAD_DPAD_UP = 0x0001, - XINPUT_GAMEPAD_DPAD_DOWN = 0x0002, - XINPUT_GAMEPAD_DPAD_LEFT = 0x0004, - XINPUT_GAMEPAD_DPAD_RIGHT = 0x0008, - XINPUT_GAMEPAD_START = 0x0010, - XINPUT_GAMEPAD_BACK = 0x0020, - XINPUT_GAMEPAD_LEFT_THUMB = 0x0040, - XINPUT_GAMEPAD_RIGHT_THUMB = 0x0080, - XINPUT_GAMEPAD_LEFT_SHOULDER = 0x0100, - XINPUT_GAMEPAD_RIGHT_SHOULDER = 0x0200, - XINPUT_GAMEPAD_A = 0x1000, - XINPUT_GAMEPAD_B = 0x2000, - XINPUT_GAMEPAD_X = 0x4000, - XINPUT_GAMEPAD_Y = 0x8000, - XINPUT_GAMEPAD_BUTTON_MASK = XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_DPAD_RIGHT | XINPUT_GAMEPAD_START | XINPUT_GAMEPAD_BACK | XINPUT_GAMEPAD_LEFT_THUMB | XINPUT_GAMEPAD_RIGHT_THUMB | XINPUT_GAMEPAD_LEFT_SHOULDER | XINPUT_GAMEPAD_RIGHT_SHOULDER | XINPUT_GAMEPAD_A | XINPUT_GAMEPAD_B | XINPUT_GAMEPAD_X | XINPUT_GAMEPAD_Y, - }; -} - -namespace REX::W32 -{ - struct XINPUT_BATTERY_INFORMATION - { - std::uint8_t batteryType; - std::uint8_t batteryLevel; - }; - - struct XINPUT_GAMEPAD - { - std::uint16_t buttons; - std::uint8_t leftTrigger; - std::uint8_t rightTrigger; - std::int16_t thumbLX; - std::int16_t thumbLY; - std::int16_t thumbRX; - std::int16_t thumbRY; - }; - - struct XINPUT_KEYSTROKE - { - std::uint16_t virtualKey; - std::uint16_t unicode; - std::uint16_t flags; - std::uint8_t userIndex; - std::uint8_t hidCode; - }; - - struct XINPUT_STATE - { - std::uint32_t packetNumber; - XINPUT_GAMEPAD gamepad; - }; - - struct XINPUT_VIBRATION - { - std::uint16_t leftMotorSpeed; - std::uint16_t rightMotorSpeed; - }; - - struct XINPUT_CAPABILITIES - { - std::uint8_t type; - std::uint8_t subType; - std::uint16_t flags; - XINPUT_GAMEPAD gamepad; - XINPUT_VIBRATION vibration; - }; -} diff --git a/src/REL/HookObject.cpp b/src/REL/HookObject.cpp deleted file mode 100644 index 5176e65..0000000 --- a/src/REL/HookObject.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include "REL/HookStore.h" - -namespace REL -{ - HookObject::HookObject(const std::uintptr_t a_address) : - m_address(a_address) - { - m_handle = HookStore::GetSingleton()->Add(this); - m_name = std::to_string(m_handle); - } - - HookObject::HookObject(const std::uintptr_t a_address, const char* a_name) : - m_address(a_address), m_name(a_name) - { - m_handle = HookStore::GetSingleton()->Add(this); - } - - HookObject::HookObject(const std::uintptr_t a_address, const HOOK_TYPE a_type) : - m_address(a_address), m_type(a_type) - { - m_handle = HookStore::GetSingleton()->Add(this); - m_name = std::to_string(m_handle); - } - - HookObject::HookObject(const std::uintptr_t a_address, const HOOK_TYPE a_type, const HOOK_STEP a_step) : - m_address(a_address), m_type(a_type), m_step(a_step) - { - m_handle = HookStore::GetSingleton()->Add(this); - m_name = std::to_string(m_handle); - } - - HookObject::HookObject(const std::uintptr_t a_address, const HOOK_STEP a_step) : - m_address(a_address), m_step(a_step) - { - m_handle = HookStore::GetSingleton()->Add(this); - m_name = std::to_string(m_handle); - } - - HookObject::HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type) : - m_address(a_address), m_name(a_name), m_type(a_type) - { - m_handle = HookStore::GetSingleton()->Add(this); - } - - HookObject::HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type, const HOOK_STEP a_step) : - m_address(a_address), m_name(a_name), m_type(a_type), m_step(a_step) - { - m_handle = HookStore::GetSingleton()->Add(this); - } - - HookObject::~HookObject() - { - HookStore::GetSingleton()->Remove(m_handle); - } - - bool HookObject::Init() - { - return true; - } - - HOOK_HANDLE HookObject::GetHandle() const - { - return m_handle; - } - - const char* HookObject::GetName() const - { - return m_name.c_str(); - } - - HOOK_TYPE HookObject::GetType() const - { - return m_type; - } - - HOOK_STEP HookObject::GetStep() const - { - return m_step; - } - - std::size_t HookObject::GetSize() const - { - return m_size; - } - - std::size_t HookObject::GetSizeTrampoline() const - { - return m_sizeTrampoline; - } - - bool HookObject::GetEnabled() const - { - return m_enabled; - } -} diff --git a/src/REL/HookStore.cpp b/src/REL/HookStore.cpp deleted file mode 100644 index b2ab969..0000000 --- a/src/REL/HookStore.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "REL/HookStore.h" - -#include "REL/Hook.h" - -namespace REL -{ - HOOK_HANDLE HookStore::Add(HookObject* a_hook) - { - if (a_hook && a_hook->GetHandle() == 0) { - m_hooks.insert({ ++m_handleCount, a_hook }); - m_hookQueue.push(m_handleCount); - return m_handleCount; - } - - return 0; - } - - void HookStore::Remove(const HOOK_HANDLE a_handle) - { - m_hooks.erase(a_handle); - } - - void HookStore::Init() - { - REX::DEBUG("Init {} queued hooks", m_hookQueue.size()); - while (!m_hookQueue.empty()) { - m_hooks[m_hookQueue.front()]->Init(); - m_hookQueue.pop(); - } - } - - void HookStore::Enable() - { - for (auto& [name, hook] : m_hooks) { - if (hook) { - hook->Enable(); - } - } - } - - void HookStore::Enable(const HOOK_HANDLE a_handle) - { - if (const auto it = m_hooks.find(a_handle); it != m_hooks.end()) { - if (it->second) { - it->second->Enable(); - } - } - } - - void HookStore::Enable(const HOOK_TYPE a_type) - { - for (auto& [name, hook] : m_hooks) { - if (hook && hook->GetType() == a_type) { - hook->Enable(); - } - } - } - - void HookStore::Enable(const HOOK_STEP a_phase) - { - for (auto& [name, hook] : m_hooks) { - if (hook && hook->GetStep() == a_phase) { - hook->Enable(); - } - } - } - - void HookStore::Disable() - { - for (auto& [name, hook] : m_hooks) { - if (hook) { - hook->Disable(); - } - } - } - - void HookStore::Disable(const HOOK_HANDLE a_handle) - { - for (auto& [name, hook] : m_hooks) { - if (hook && hook->GetHandle() == a_handle) { - hook->Disable(); - } - } - } - - void HookStore::Disable(const HOOK_TYPE a_type) - { - for (auto& [name, hook] : m_hooks) { - if (hook && hook->GetType() == a_type) { - hook->Disable(); - } - } - } - - std::size_t HookStore::GetSizeTrampoline() - { - std::size_t size{ 0 }; - for (auto& [name, hook] : m_hooks) { - if (hook) { - size += hook->GetSizeTrampoline(); - } - } - - return size; - } -} diff --git a/src/REL/IAT.cpp b/src/REL/IAT.cpp deleted file mode 100644 index ac3e4cd..0000000 --- a/src/REL/IAT.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "REL/IAT.h" -#include "REL/Module.h" -#include "REL/Utility.h" - -#include "REX/W32/KERNEL32.h" - -namespace REL -{ - std::uintptr_t GetIATAddr(std::string_view a_dll, std::string_view a_function) - { - return reinterpret_cast(GetIATPtr(std::move(a_dll), std::move(a_function))); - } - - std::uintptr_t GetIATAddr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function) - { - return reinterpret_cast(GetIATPtr(a_module, std::move(a_dll), std::move(a_function))); - } - - void* GetIATPtr(std::string_view a_dll, std::string_view a_function) - { - const auto mod = static_cast(REL::Module::get().pointer()); - return GetIATPtr(mod, std::move(a_dll), std::move(a_function)); - } - - // https://guidedhacking.com/attachments/pe_imptbl_headers-jpg.2241/ - void* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function) - { - assert(a_module); - const auto dosHeader = reinterpret_cast(a_module); - if (dosHeader->magic != REX::W32::IMAGE_DOS_SIGNATURE) { - REX::ERROR("Invalid DOS header"); - return nullptr; - } - - const auto ntHeader = stl::adjust_pointer(dosHeader, dosHeader->lfanew); - const auto& dataDir = ntHeader->optionalHeader.dataDirectory[REX::W32::IMAGE_DIRECTORY_ENTRY_IMPORT]; - const auto importDesc = stl::adjust_pointer(dosHeader, dataDir.virtualAddress); - - for (auto import = importDesc; import->characteristics != 0; ++import) { - auto name = stl::adjust_pointer(dosHeader, import->name); - if (a_dll.size() == strlen(name) && _strnicmp(a_dll.data(), name, a_dll.size()) != 0) { - continue; - } - - const auto thunk = stl::adjust_pointer(dosHeader, import->firstThunkOriginal); - for (std::size_t i = 0; thunk[i].ordinal; ++i) { - if (REX::W32::IMAGE_SNAP_BY_ORDINAL64(thunk[i].ordinal)) { - continue; - } - - const auto importByName = stl::adjust_pointer(dosHeader, thunk[i].address); - if (a_function.size() == strlen(importByName->name) && - _strnicmp(a_function.data(), importByName->name, a_function.size()) == 0) { - return stl::adjust_pointer(dosHeader, import->firstThunk) + i; - } - } - } - - REX::ERROR("Failed to find {} ({})", a_dll, a_function); - return nullptr; - } - - std::uintptr_t PatchIAT(std::uintptr_t a_newFunc, std::string_view a_dll, std::string_view a_function) - { - std::uintptr_t origAddr = 0; - - const auto oldFunc = GetIATAddr(a_dll, a_function); - if (oldFunc) { - origAddr = *reinterpret_cast(oldFunc); - REL::WriteSafeData(oldFunc, a_newFunc); - } else { - REX::ERROR("Failed to patch {} ({})", a_dll, a_function); - } - - return origAddr; - } -} diff --git a/src/REL/IDDB.cpp b/src/REL/IDDB.cpp deleted file mode 100644 index 84ff368..0000000 --- a/src/REL/IDDB.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "REL/IDDB.h" -#include "REL/Module.h" -#include "REL/Version.h" - -#include "REX/W32/BCRYPT.h" - -namespace REL -{ - std::optional SHA512(std::span a_data) - { - REX::W32::BCRYPT_ALG_HANDLE algorithm; - if (!REX::W32::NT_SUCCESS(REX::W32::BCryptOpenAlgorithmProvider(&algorithm, REX::W32::BCRYPT_SHA512_ALGORITHM))) { - REX::ERROR("failed to open algorithm provider"); - return std::nullopt; - } - - const stl::scope_exit delAlgorithm([&]() { - [[maybe_unused]] const auto success = REX::W32::NT_SUCCESS(REX::W32::BCryptCloseAlgorithmProvider(algorithm)); - assert(success); - }); - - REX::W32::BCRYPT_HASH_HANDLE hash; - if (!REX::W32::NT_SUCCESS(REX::W32::BCryptCreateHash(algorithm, &hash))) { - REX::ERROR("failed to create hash"); - return std::nullopt; - } - - const stl::scope_exit delHash([&]() { - [[maybe_unused]] const auto success = REX::W32::NT_SUCCESS(REX::W32::BCryptDestroyHash(hash)); - assert(success); - }); - - if (!REX::W32::NT_SUCCESS(REX::W32::BCryptHashData( - hash, - reinterpret_cast(const_cast(a_data.data())), // does not modify contents of buffer - static_cast(a_data.size())))) { - REX::ERROR("failed to hash data"); - return std::nullopt; - } - - std::uint32_t hashLen = 0; - std::uint32_t discard = 0; - if (!REX::W32::NT_SUCCESS(REX::W32::BCryptGetProperty( - hash, - REX::W32::BCRYPT_HASH_LENGTH, - reinterpret_cast(&hashLen), - sizeof(hashLen), - &discard))) { - REX::ERROR("failed to get property"); - return std::nullopt; - } - - std::vector buffer(static_cast(hashLen)); - if (!REX::W32::NT_SUCCESS(REX::W32::BCryptFinishHash( - hash, - buffer.data(), - static_cast(buffer.size())))) { - REX::ERROR("failed to finish hash"); - return std::nullopt; - } - - std::string result; - result.reserve(buffer.size() * 2); - for (const auto byte : buffer) { - result += std::format("{:02X}", byte); - } - - return { std::move(result) }; - } -} - -namespace REL -{ - IDDB::IDDB() - { - const auto version = Module::get().version(); - const auto path = std::format("OBSE/Plugins/versionlib-{}.bin", version.string("-"sv)); - if (!_mmap.open(path)) { - stl::report_and_fail(std::format("failed to open: {}", path)); - } - - _id2offset = std::span{ - reinterpret_cast(_mmap.data() + sizeof(std::uint64_t)), - *reinterpret_cast(_mmap.data()) - }; - } - - std::size_t IDDB::id2offset(std::uint64_t a_id) const - { - if (_id2offset.empty()) { - stl::report_and_fail("data is empty"sv); - } - - const mapping_t elem{ a_id, 0 }; - const auto it = std::lower_bound( - _id2offset.begin(), - _id2offset.end(), - elem, - [](auto&& a_lhs, auto&& a_rhs) { - return a_lhs.id < a_rhs.id; - }); - if (it == _id2offset.end()) { - const auto version = Module::get().version(); - const auto str = std::format("id {} not found!\ngame version: {}"sv, a_id, version.string()); - stl::report_and_fail(str); - } - - return static_cast(it->offset); - } -} diff --git a/src/REL/Module.cpp b/src/REL/Module.cpp deleted file mode 100644 index 0afa760..0000000 --- a/src/REL/Module.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "REL/Module.h" - -#include "REX/W32/KERNEL32.h" - -namespace REL -{ - Module::Module() - { - const auto getFilename = [&]() { - return REX::W32::GetEnvironmentVariableW( - ENVIRONMENT.data(), - _filename.data(), - static_cast(_filename.size())); - }; - - _filename.resize(getFilename()); - if (const auto result = getFilename(); - result != _filename.size() - 1 || - result == 0) { - _filename = L"OblivionRemastered-Win64-Shipping.exe"sv; - } - - auto handle = REX::W32::GetModuleHandleW(_filename.c_str()); - if (handle == nullptr) { - stl::report_and_fail("failed to obtain module handle"sv); - } - - _base = reinterpret_cast(handle); - _natvis = _base; - - load_version(); - load_segments(); - } - - void Module::load_version() - { - const auto version = GetFileVersion(_filename); - if (version) { - _version = *version; - } else { - stl::report_and_fail("failed to obtain file version"sv); - } - } - - void Module::load_segments() - { - const auto dosHeader = reinterpret_cast(_base); - const auto ntHeader = stl::adjust_pointer(dosHeader, dosHeader->lfanew); - const auto sections = REX::W32::IMAGE_FIRST_SECTION(ntHeader); - const auto size = std::min(ntHeader->fileHeader.sectionCount, _segments.size()); - for (std::size_t i = 0; i < size; ++i) { - const auto& section = sections[i]; - const auto it = std::find_if(SEGMENTS.begin(), SEGMENTS.end(), [&](auto&& a_elem) { - constexpr auto size = std::extent_v; - const auto len = std::min(a_elem.size(), size); - return std::memcmp(a_elem.data(), section.name, len) == 0; - }); - if (it != SEGMENTS.end()) { - const auto idx = static_cast(std::distance(SEGMENTS.begin(), it)); - _segments[idx] = Segment{ _base, _base + section.virtualAddress, section.virtualSize }; - } - } - } -} diff --git a/src/REL/Trampoline.cpp b/src/REL/Trampoline.cpp deleted file mode 100644 index 215cbef..0000000 --- a/src/REL/Trampoline.cpp +++ /dev/null @@ -1,238 +0,0 @@ -#include "REL/Trampoline.h" - -#include "REL/ASM.h" -#include "REL/Utility.h" - -#include "REX/W32/KERNEL32.h" - -// xbyak brings in -#ifdef OBSE_SUPPORT_XBYAK -# include -# undef ERROR -# undef max -# undef MEM_COMMIT -# undef MEM_FREE -# undef MEM_RELEASE -# undef MEM_RESERVE -# undef PAGE_EXECUTE_READWRITE -#endif - -namespace REL -{ - namespace Impl - { - constexpr std::size_t RoundUp(const std::size_t a_number, const std::size_t a_multiple) noexcept - { - if (a_multiple == 0) - return 0; - - const auto remainder = a_number % a_multiple; - return (remainder == 0) ? a_number : (a_number + a_multiple - remainder); - } - - constexpr std::size_t RoundDown(const std::size_t a_number, const std::size_t a_multiple) noexcept - { - if (a_multiple == 0) - return 0; - - const auto remainder = a_number % a_multiple; - return (remainder == 0) ? a_number : (a_number - remainder); - } - - // https://stackoverflow.com/a/54732489 - void* AllocTrampoline(const std::size_t a_size, const std::uintptr_t a_address) - { - constexpr std::size_t gigabyte = static_cast(1) << 30; - constexpr std::size_t minRange = gigabyte * 2; - constexpr std::uintptr_t maxAddr = std::numeric_limits::max(); - - REX::W32::SYSTEM_INFO si; - REX::W32::GetSystemInfo(&si); - const std::uint32_t granularity = si.allocationGranularity; - - std::uintptr_t min = a_address >= minRange ? RoundUp(a_address - minRange, granularity) : 0; - const std::uintptr_t max = a_address < (maxAddr - minRange) ? RoundDown(a_address + minRange, granularity) : maxAddr; - - REX::W32::MEMORY_BASIC_INFORMATION mbi; - do { - if (!REX::W32::VirtualQuery(reinterpret_cast(min), std::addressof(mbi), sizeof(mbi))) { - REX::ERROR("VirtualQuery failed with code: 0x{:08X}"sv, REX::W32::GetLastError()); - return nullptr; - } - - const auto baseAddr = reinterpret_cast(mbi.baseAddress); - min = baseAddr + mbi.regionSize; - - if (mbi.state == REX::W32::MEM_FREE) { - const std::uintptr_t addr = RoundUp(baseAddr, granularity); - - // if rounding didn't advance us into the next region and the region is the required size - if (addr < min && (min - addr) >= a_size) { - const auto mem = REX::W32::VirtualAlloc( - reinterpret_cast(addr), a_size, REX::W32::MEM_COMMIT | REX::W32::MEM_RESERVE, REX::W32::PAGE_EXECUTE_READWRITE); - if (mem) { - return mem; - } - REX::ERROR("VirtualAlloc failed with code: 0x{:08X}"sv, REX::W32::GetLastError()); - } - } - } while (min < max); - - return nullptr; - } - } - - Trampoline::Trampoline(Trampoline&& a_rhs) noexcept - { - m_branch5 = std::move(a_rhs.m_branch5); - m_branch6 = std::move(a_rhs.m_branch6); - m_name = std::move(a_rhs.m_name); - m_deleter = std::move(a_rhs.m_deleter); - m_data = std::exchange(a_rhs.m_data, nullptr); - m_capacity = std::exchange(a_rhs.m_capacity, 0); - m_size = std::exchange(a_rhs.m_size, 0); - } - - void Trampoline::create(const std::size_t a_size, void* a_module) - { - if (a_size == 0) { - stl::report_and_fail("cannot create a trampoline with a zero size"sv); - } - - if (!a_module) { - const auto text = REL::Module::get().segment(REL::Segment::text); - a_module = text.pointer() + text.size(); - } - - auto mem = Impl::AllocTrampoline(a_size, reinterpret_cast(a_module)); - if (!mem) { - stl::report_and_fail("failed to create trampoline"sv); - } - - set_trampoline(mem, a_size, [](void* a_mem, std::size_t) { - REX::W32::VirtualFree(a_mem, 0, REX::W32::MEM_RELEASE); - }); - } - - void Trampoline::set_trampoline(void* a_trampoline, const std::size_t a_size, deleter_type a_deleter) - { - auto trampoline = static_cast(a_trampoline); - if (trampoline) - std::memset(trampoline, REL::INT3, a_size); - - release(); - - m_deleter = std::move(a_deleter); - m_data = trampoline; - m_capacity = a_size; - m_size = 0; - - stats(); - } - - void* Trampoline::allocate(const std::size_t a_size) - { - if (a_size > free_size()) { - stl::report_and_fail(std::format("Failed to handle allocation request\nAllocate Size: {}\nFree Size: {}", a_size, free_size())); - } - - auto mem = m_data + m_size; - m_size += a_size; - - stats(); - return mem; - } - -#ifdef OBSE_SUPPORT_XBYAK - void* Trampoline::allocate(const Xbyak::CodeGenerator& a_code) - { - auto mem = allocate(a_code.getSize()); - std::memcpy(mem, a_code.getCode(), a_code.getSize()); - return mem; - } -#endif - - std::uintptr_t Trampoline::write_call5(const std::uintptr_t a_src, const std::uintptr_t a_dst) - { - const auto original = ASM::CALL5::TARGET(a_src); - ASM::CALL5 assembly(a_src, allocate_branch5(a_dst)); - REL::WriteSafeData(a_src, assembly); - return original; - } - - std::uintptr_t Trampoline::write_call6(const std::uintptr_t a_src, const std::uintptr_t a_dst) - { - const auto original = ASM::CALL6::TARGET(a_src); - ASM::CALL6 assembly(a_src, allocate_branch6(a_dst)); - REL::WriteSafeData(a_src, assembly); - return original; - } - - std::uintptr_t Trampoline::write_jmp5(const std::uintptr_t a_src, const std::uintptr_t a_dst) - { - const auto original = ASM::JMP5::TARGET(a_src); - ASM::JMP5 assembly(a_src, allocate_branch5(a_dst)); - REL::WriteSafeData(a_src, assembly); - return original; - } - - std::uintptr_t Trampoline::write_jmp6(const std::uintptr_t a_src, const std::uintptr_t a_dst) - { - const auto original = ASM::JMP6::TARGET(a_src); - ASM::JMP6 assembly(a_src, allocate_branch6(a_dst)); - REL::WriteSafeData(a_src, assembly); - return original; - } - - std::uintptr_t Trampoline::allocate_branch5(const std::uintptr_t a_dst) - { - ASM::JMP14* mem = nullptr; - if (const auto it = m_branch5.find(a_dst); it != m_branch5.end()) { - mem = reinterpret_cast(it->second); - mem->addr = static_cast(a_dst); - } else { - mem = allocate(a_dst); - m_branch5.emplace(a_dst, reinterpret_cast(mem)); - } - - return reinterpret_cast(mem); - } - - std::uintptr_t Trampoline::allocate_branch6(const std::uintptr_t a_dst) - { - std::uintptr_t* mem = nullptr; - if (const auto it = m_branch6.find(a_dst); it != m_branch6.end()) { - mem = reinterpret_cast(it->second); - *mem = a_dst; - } else { - mem = allocate(a_dst); - m_branch6.emplace(a_dst, reinterpret_cast(mem)); - } - - return reinterpret_cast(mem); - } - - void Trampoline::release() - { - if (m_data && m_deleter) - m_deleter(m_data, m_capacity); - - m_branch5.clear(); - m_branch6.clear(); - m_data = nullptr; - m_capacity = 0; - m_size = 0; - } - - void Trampoline::stats() const - { - auto pct = (static_cast(m_size) / static_cast(m_capacity)) * 100.0; - REX::DEBUG("{} => {}B / {}B ({:05.2f}%)", m_name, m_size, m_capacity, pct); - } - - Trampoline& GetTrampoline() noexcept - { - static Trampoline trampoline; - return trampoline; - } -} diff --git a/src/REL/Utility.cpp b/src/REL/Utility.cpp deleted file mode 100644 index a5e1caf..0000000 --- a/src/REL/Utility.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "REL/Utility.h" - -#include "REX/W32/KERNEL32.h" - -namespace REL -{ - void Write(void* a_dst, const void* a_src, const std::size_t a_size) - { - std::memcpy(a_dst, a_src, a_size); - } - - void Write(const std::uintptr_t a_dst, const void* a_src, const std::size_t a_size) - { - std::memcpy(reinterpret_cast(a_dst), a_src, a_size); - } - - void WriteSafe(void* a_dst, const void* a_src, const std::size_t a_size) - { - std::uint32_t protect{ 0 }; - - bool success = REX::W32::VirtualProtect(a_dst, a_size, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(protect)); - if (success) { - std::memcpy(a_dst, a_src, a_size); - success = REX::W32::VirtualProtect(a_dst, a_size, protect, std::addressof(protect)); - } - - assert(success); - } - - void WriteSafe(const std::uintptr_t a_dst, const void* a_src, const std::size_t a_size) - { - WriteSafe(reinterpret_cast(a_dst), a_src, a_size); - } - - void WriteSafeFill(void* a_dst, const std::uint8_t a_value, const std::size_t a_size) - { - std::uint32_t protect{ 0 }; - - bool success = REX::W32::VirtualProtect(a_dst, a_size, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(protect)); - if (success) { - std::fill_n(reinterpret_cast(a_dst), a_size, a_value); - success = REX::W32::VirtualProtect(a_dst, a_size, protect, std::addressof(protect)); - } - - assert(success); - } - - void WriteSafeFill(const std::uintptr_t a_dst, const std::uint8_t a_value, const std::size_t a_size) - { - WriteSafeFill(reinterpret_cast(a_dst), a_value, a_size); - } -} diff --git a/src/REL/Version.cpp b/src/REL/Version.cpp deleted file mode 100644 index 36f7688..0000000 --- a/src/REL/Version.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "REL/Version.h" - -#include "REX/W32/VERSION.h" - -namespace REL -{ - std::optional GetFileVersion(std::string_view a_filename) - { - std::uint32_t dummy; - std::vector buf(REX::W32::GetFileVersionInfoSizeA(a_filename.data(), std::addressof(dummy))); - if (buf.empty()) { - return std::nullopt; - } - - if (!REX::W32::GetFileVersionInfoA(a_filename.data(), 0, static_cast(buf.size()), buf.data())) { - return std::nullopt; - } - - void* verBuf{ nullptr }; - std::uint32_t verLen{ 0 }; - if (!REX::W32::VerQueryValueA(buf.data(), "\\StringFileInfo\\040904B0\\ProductVersion", std::addressof(verBuf), std::addressof(verLen))) { - return std::nullopt; - } - - Version version; - std::wistringstream ss(std::wstring(static_cast(verBuf), verLen)); - std::wstring token; - for (std::size_t i = 0; i < 4 && std::getline(ss, token, L'.'); ++i) { - version[i] = static_cast(std::stoi(token)); - } - - return version; - } - - std::optional GetFileVersion(std::wstring_view a_filename) - { - std::uint32_t dummy; - std::vector buf(REX::W32::GetFileVersionInfoSizeW(a_filename.data(), std::addressof(dummy))); - if (buf.empty()) { - return std::nullopt; - } - - if (!REX::W32::GetFileVersionInfoW(a_filename.data(), 0, static_cast(buf.size()), buf.data())) { - return std::nullopt; - } - - void* verBuf{ nullptr }; - std::uint32_t verLen{ 0 }; - if (!REX::W32::VerQueryValueW(buf.data(), L"\\StringFileInfo\\040904B0\\ProductVersion", std::addressof(verBuf), std::addressof(verLen))) { - return std::nullopt; - } - - Version version; - std::wistringstream ss(std::wstring(static_cast(verBuf), verLen)); - std::wstring token; - for (std::size_t i = 0; i < 4 && std::getline(ss, token, L'.'); ++i) { - version[i] = static_cast(std::stoi(token)); - } - - return version; - } -} diff --git a/src/REX/REX.cpp b/src/REX/REX.cpp deleted file mode 100644 index 2963444..0000000 --- a/src/REX/REX.cpp +++ /dev/null @@ -1,403 +0,0 @@ -#include "REX/REX/INI.h" -#include "REX/REX/JSON.h" -#include "REX/REX/LOG.h" -#include "REX/REX/TOML.h" - -#ifdef REX_OPTION_INI -# include -# undef ERROR - -namespace REX::INI -{ - namespace Impl - { - template - constexpr bool is_long_integral_v = std::_Is_any_of_v, std::uint8_t, std::uint16_t, std::uint32_t, std::int8_t, std::int16_t, std::int32_t>; - - template - void SettingLoad( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value, - T& a_valueDefault) - { - const auto file = static_cast(a_data); - if constexpr (std::is_same_v) { - a_value = file->GetBoolValue(a_section.data(), a_key.data(), a_valueDefault); - } else if constexpr (std::is_floating_point_v) { - a_value = static_cast(file->GetDoubleValue(a_section.data(), a_key.data(), a_valueDefault)); - } else if constexpr (is_long_integral_v) { - a_value = static_cast(file->GetLongValue(a_section.data(), a_key.data(), a_valueDefault)); - } else if constexpr (std::is_same_v) { - a_value = file->GetValue(a_section.data(), a_key.data(), a_valueDefault.c_str()); - } - } - - template void SettingLoad(void*, sec_t, key_t, bool&, bool&); - template void SettingLoad(void*, sec_t, key_t, float&, float&); - template void SettingLoad(void*, sec_t, key_t, double&, double&); - template void SettingLoad(void*, sec_t, key_t, std::uint8_t&, std::uint8_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint16_t&, std::uint16_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint32_t&, std::uint32_t&); - template void SettingLoad(void*, sec_t, key_t, std::int8_t&, std::int8_t&); - template void SettingLoad(void*, sec_t, key_t, std::int16_t&, std::int16_t&); - template void SettingLoad(void*, sec_t, key_t, std::int32_t&, std::int32_t&); - template void SettingLoad(void*, sec_t, key_t, std::string&, std::string&); - - template - void SettingSave( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value) - { - auto& file = *static_cast(a_data); - if constexpr (std::is_same_v) { - file.SetBoolValue(a_section.data(), a_key.data(), a_value); - } else if constexpr (std::is_floating_point_v) { - file.SetDoubleValue(a_section.data(), a_key.data(), a_value); - } else if constexpr (is_long_integral_v) { - file.SetLongValue(a_section.data(), a_key.data(), a_value); - } else if constexpr (std::is_same_v) { - file.SetValue(a_section.data(), a_key.data(), a_value.c_str()); - } - } - - template void SettingSave(void*, sec_t, key_t, bool&); - template void SettingSave(void*, sec_t, key_t, float&); - template void SettingSave(void*, sec_t, key_t, double&); - template void SettingSave(void*, sec_t, key_t, std::uint8_t&); - template void SettingSave(void*, sec_t, key_t, std::uint16_t&); - template void SettingSave(void*, sec_t, key_t, std::uint32_t&); - template void SettingSave(void*, sec_t, key_t, std::int8_t&); - template void SettingSave(void*, sec_t, key_t, std::int16_t&); - template void SettingSave(void*, sec_t, key_t, std::int32_t&); - template void SettingSave(void*, sec_t, key_t, std::string&); - } - - void SettingStore::Load() - { - CSimpleIniA file; - file.SetUnicode(true); - file.SetQuotes(true); - - if (std::filesystem::exists(m_fileBase)) { - file.LoadFile(m_fileBase.data()); - for (auto& setting : m_settings) { - setting->Load(&file, true); - } - } - - if (std::filesystem::exists(m_fileUser)) { - file.LoadFile(m_fileUser.data()); - for (auto& setting : m_settings) { - setting->Load(&file, false); - } - } - } - - void SettingStore::Save() - { - CSimpleIniA file; - file.SetUnicode(true); - file.SetQuotes(true); - - file.LoadFile(m_fileBase.data()); - for (auto& setting : m_settings) { - setting->Save(&file); - } - - file.SaveFile(m_fileBase.data()); - } -} -#endif - -#ifdef REX_OPTION_JSON -# include - -namespace REX::JSON -{ - namespace Impl - { - template - void SettingLoad( - void* a_data, - path_t a_path, - T& a_value, - T& a_valueDefault) - { - const auto& json = *static_cast(a_data); - if (a_path[0] == '/') { - a_value = json.value(nlohmann::json::json_pointer(a_path.data()), a_valueDefault); - } else { - a_value = json.value(a_path, a_valueDefault); - } - } - - template void SettingLoad(void*, path_t, bool&, bool&); - template void SettingLoad(void*, path_t, float&, float&); - template void SettingLoad(void*, path_t, double&, double&); - template void SettingLoad(void*, path_t, std::uint8_t&, std::uint8_t&); - template void SettingLoad(void*, path_t, std::uint16_t&, std::uint16_t&); - template void SettingLoad(void*, path_t, std::uint32_t&, std::uint32_t&); - template void SettingLoad(void*, path_t, std::int8_t&, std::int8_t&); - template void SettingLoad(void*, path_t, std::int16_t&, std::int16_t&); - template void SettingLoad(void*, path_t, std::int32_t&, std::int32_t&); - template void SettingLoad(void*, path_t, std::string&, std::string&); - - template - void SettingSave( - void* a_data, - path_t a_path, - T& a_value) - { - auto& json = *static_cast(a_data); - if (a_path[0] == '/') { - json[nlohmann::json::json_pointer(a_path.data())] = a_value; - } else { - json[a_path] = a_value; - } - } - - template void SettingSave(void*, path_t, bool&); - template void SettingSave(void*, path_t, float&); - template void SettingSave(void*, path_t, double&); - template void SettingSave(void*, path_t, std::uint8_t&); - template void SettingSave(void*, path_t, std::uint16_t&); - template void SettingSave(void*, path_t, std::uint32_t&); - template void SettingSave(void*, path_t, std::int8_t&); - template void SettingSave(void*, path_t, std::int16_t&); - template void SettingSave(void*, path_t, std::int32_t&); - template void SettingSave(void*, path_t, std::string&); - } - - void SettingStore::Load() - { - if (std::filesystem::exists(m_fileBase)) { - std::ifstream file{ m_fileBase.data() }; - try { - auto result = nlohmann::json::parse(file); - for (auto setting : m_settings) { - setting->Load(&result, true); - } - } catch (const std::exception& e) { - REX::ERROR("{}", e.what()); - } - } - - if (std::filesystem::exists(m_fileUser)) { - std::ifstream file{ m_fileUser.data() }; - try { - auto result = nlohmann::json::parse(file); - for (auto setting : m_settings) { - setting->Load(&result, false); - } - } catch (const std::exception& e) { - REX::ERROR("{}", e.what()); - } - } - } - - void SettingStore::Save() - { - nlohmann::json output{}; - if (std::filesystem::exists(m_fileBase)) { - std::ifstream file{ m_fileBase.data() }; - output = nlohmann::json::parse(file); - } - - for (auto& setting : m_settings) { - setting->Save(&output); - } - - std::ofstream file{ m_fileBase.data(), std::ios::trunc }; - file << std::setw(4) << output; - } -} -#endif - -#ifdef REX_OPTION_TOML -# include - -namespace REX::TOML -{ - namespace Impl - { - static toml::value* recurse_table(toml::value* a_result, toml::value& a_value, const std::string& a_section, bool a_create) - { - if (a_result && a_result->is_table()) { - for (auto& value : a_result->as_table()) { - if (value.first == a_section) { - return std::addressof(value.second); - } - } - if (a_create) { - (*a_result)[a_section] = toml::table{}; - return std::addressof((*a_result)[a_section]); - } - } else if (a_value.is_table()) { - for (auto& value : a_value.as_table()) { - if (value.first == a_section) { - return std::addressof(value.second); - } - } - if (a_create) { - a_value[a_section] = toml::table{}; - return std::addressof(a_value[a_section]); - } - } - return a_result; - } - - static bool recurse_mark_implicit(toml::value& a_value) - { - for (auto& kv : a_value.as_table()) { - if (kv.second.is_table()) { - if (!recurse_mark_implicit(kv.second)) { - continue; - } - kv.second.as_table_fmt().fmt = toml::table_format::implicit; - } else { - return false; - } - } - return true; - } - - template - void SettingLoad( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value, - T& a_valueDefault) - { - const auto& data = static_cast(a_data); - if (a_section.empty()) { - auto& path = (*data); - a_value = toml::find_or(path, a_key.data(), a_valueDefault); - return; - } else if (a_section.size() == 1) { - auto& path = (*data)[a_section.front()]; - a_value = toml::find_or(path, a_key.data(), a_valueDefault); - return; - } else { - toml::value* path{ nullptr }; - for (auto& section : a_section) { - path = recurse_table(path, *data, section, false); - } - if (path) { - a_value = toml::find_or(*path, a_key.data(), a_valueDefault); - return; - } - } - a_value = a_valueDefault; - } - - template void SettingLoad(void*, sec_t, key_t, bool&, bool&); - template void SettingLoad(void*, sec_t, key_t, float&, float&); - template void SettingLoad(void*, sec_t, key_t, double&, double&); - template void SettingLoad(void*, sec_t, key_t, std::uint8_t&, std::uint8_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint16_t&, std::uint16_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint32_t&, std::uint32_t&); - template void SettingLoad(void*, sec_t, key_t, std::int8_t&, std::int8_t&); - template void SettingLoad(void*, sec_t, key_t, std::int16_t&, std::int16_t&); - template void SettingLoad(void*, sec_t, key_t, std::int32_t&, std::int32_t&); - template void SettingLoad(void*, sec_t, key_t, std::string&, std::string&); - - template - void SettingSave( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value) - { - auto& data = *static_cast(a_data); - if (a_section.empty()) { - data[a_key.data()] = a_value; - } else if (a_section.size() == 1) { - data[a_section.front()][a_key.data()] = a_value; - } else { - toml::value* path{ nullptr }; - for (auto& section : a_section) { - path = recurse_table(path, data, section, true); - } - if (path) { - (*path)[a_key.data()] = a_value; - } - } - } - - template void SettingSave(void*, sec_t, key_t, bool&); - template void SettingSave(void*, sec_t, key_t, float&); - template void SettingSave(void*, sec_t, key_t, double&); - template void SettingSave(void*, sec_t, key_t, std::uint8_t&); - template void SettingSave(void*, sec_t, key_t, std::uint16_t&); - template void SettingSave(void*, sec_t, key_t, std::uint32_t&); - template void SettingSave(void*, sec_t, key_t, std::int8_t&); - template void SettingSave(void*, sec_t, key_t, std::int16_t&); - template void SettingSave(void*, sec_t, key_t, std::int32_t&); - template void SettingSave(void*, sec_t, key_t, std::string&); - } - - void SettingStore::Load() - { - if (auto result = toml::try_parse(m_fileBase.data()); result.is_ok()) { - for (auto& setting : m_settings) { - setting->Load(&result.unwrap(), true); - } - } - - if (auto result = toml::try_parse(m_fileUser.data()); result.is_ok()) { - for (auto& setting : m_settings) { - setting->Load(&result.unwrap(), false); - } - } - } - - void SettingStore::Save() - { - toml::value output{}; - if (auto result = toml::try_parse(m_fileBase.data()); result.is_ok()) { - output = result.unwrap(); - } - - for (auto setting : m_settings) { - setting->Save(&output); - } - - Impl::recurse_mark_implicit(output); - std::ofstream file{ m_fileBase.data(), std::ios::trunc }; - file << toml::format(output); - } -} -#endif - -namespace REX -{ - void LOG(const std::source_location a_loc, const LOG_LEVEL a_level, const std::string_view a_fmt) - { - const auto loc = spdlog::source_loc{ a_loc.file_name(), static_cast(a_loc.line()), a_loc.function_name() }; - switch (a_level) { - case LOG_LEVEL::TRACE: - spdlog::default_logger_raw()->log(loc, spdlog::level::trace, a_fmt); - break; - case LOG_LEVEL::DEBUG: - spdlog::default_logger_raw()->log(loc, spdlog::level::debug, a_fmt); - break; - case LOG_LEVEL::INFO: - spdlog::default_logger_raw()->log(loc, spdlog::level::info, a_fmt); - break; - case LOG_LEVEL::WARN: - spdlog::default_logger_raw()->log(loc, spdlog::level::warn, a_fmt); - break; - case LOG_LEVEL::ERROR: - spdlog::default_logger_raw()->log(loc, spdlog::level::err, a_fmt); - break; - case LOG_LEVEL::CRITICAL: - spdlog::default_logger_raw()->log(loc, spdlog::level::critical, a_fmt); - break; - } - } -} diff --git a/src/REX/W32.cpp b/src/REX/W32.cpp deleted file mode 100644 index 7249cab..0000000 --- a/src/REX/W32.cpp +++ /dev/null @@ -1,948 +0,0 @@ -#include "REX/W32/ADVAPI32.h" -#include "REX/W32/BCRYPT.h" -#include "REX/W32/D3D11.h" -#include "REX/W32/D3DCOMPILER.h" -#include "REX/W32/DBGHELP.h" -#include "REX/W32/DXGI.h" -#include "REX/W32/KERNEL32.h" -#include "REX/W32/NT.h" -#include "REX/W32/OLE32.h" -#include "REX/W32/SHELL32.h" -#include "REX/W32/USER32.h" -#include "REX/W32/VERSION.h" - -// ADVAPI32 - -REX_W32_IMPORT(std::int32_t, RegGetValueA, REX::W32::HKEY, const char*, const char*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); -REX_W32_IMPORT(std::int32_t, RegGetValueW, REX::W32::HKEY, const wchar_t*, const wchar_t*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); - -namespace REX::W32 -{ - std::int32_t RegGetValueA(HKEY a_key, const char* a_subKey, const char* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) - { - return ::W32_IMPL_RegGetValueA(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); - } - - std::int32_t RegGetValueW(HKEY a_key, const wchar_t* a_subKey, const wchar_t* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) - { - return ::W32_IMPL_RegGetValueW(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); - } -} - -// BCRYPT - -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptOpenAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE*, const wchar_t*, const wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCloseAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCreateHash, REX::W32::BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE*, std::uint8_t*, std::uint32_t, std::uint8_t*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptDestroyHash, REX::W32::BCRYPT_HASH_HANDLE); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptFinishHash, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptGetProperty, REX::W32::BCRYPT_HANDLE, const wchar_t*, std::uint8_t*, std::uint32_t, std::uint32_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptHashData, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); - -namespace REX::W32 -{ - NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptOpenAlgorithmProvider(a_algorithm, a_id, a_impl, a_flags); - } - - NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptCloseAlgorithmProvider(a_algorithm, a_flags); - } - - NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject, std::uint32_t a_hashObjectSize, std::uint8_t* a_secret, std::uint32_t a_secretSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptCreateHash(a_algorithm, a_hash, a_hashObject, a_hashObjectSize, a_secret, a_secretSize, a_flags); - } - - NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash) - { - return ::W32_IMPL_BCryptDestroyHash(a_hash); - } - - NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptFinishHash(a_hash, a_output, a_outputSize, a_flags); - } - - NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptGetProperty(a_object, a_property, a_output, a_outputSize, a_result, a_flags); - } - - NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptHashData(a_hash, a_input, a_inputSize, a_flags); - } -} - -// D3D11 - -REX_W32_IMPORT(std::int32_t, D3D11CreateDevice, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); -REX_W32_IMPORT(std::int32_t, D3D11CreateDeviceAndSwapChain, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, const REX::W32::DXGI_SWAP_CHAIN_DESC*, REX::W32::IDXGISwapChain**, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); - -namespace REX::W32 -{ - HRESULT D3D11CreateDevice(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept - { - return ::W32_IMPL_D3D11CreateDevice(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_device, a_pFeatureLevel, a_immediateContext); - } - - HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const DXGI_SWAP_CHAIN_DESC* a_swapChainDesc, IDXGISwapChain** a_swapChain, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept - { - return ::W32_IMPL_D3D11CreateDeviceAndSwapChain(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_swapChainDesc, a_swapChain, a_device, a_pFeatureLevel, a_immediateContext); - } -} - -// D3DCOMPILER - -REX_W32_IMPORT(std::int32_t, D3DCompile, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompile2, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompileFromFile, const wchar_t*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompressShaders, std::uint32_t, REX::W32::D3D_SHADER_DATA*, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCreateBlob, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCreateFunctionLinkingGraph, std::uint32_t, REX::W32::ID3D11FunctionLinkingGraph**); -REX_W32_IMPORT(std::int32_t, D3DCreateLinker, REX::W32::ID3D11Linker**); -REX_W32_IMPORT(std::int32_t, D3DDecompressShaders, const void*, std::size_t, std::uint32_t, std::uint32_t, std::uint32_t*, std::uint32_t, REX::W32::ID3DBlob**, std::uint32_t*); -REX_W32_IMPORT(std::int32_t, D3DDisassemble, const void*, std::size_t, std::uint32_t, const char*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DDisassemble10Effect, REX::W32::ID3D10Effect*, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DDisassembleRegion, const void*, std::size_t, std::uint32_t, const char*, std::size_t, std::size_t, std::size_t*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t a_flags, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetDebugInfo, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetInputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetInputAndOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetTraceInstructionOffsets, const void*, std::size_t, std::uint32_t, std::size_t, std::size_t, std::size_t*, std::size_t*); -REX_W32_IMPORT(std::int32_t, D3DLoadModule, const void*, std::size_t, REX::W32::ID3D11Module**); -REX_W32_IMPORT(std::int32_t, D3DPreprocess, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DReadFileToBlob, const wchar_t*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DReflect, const void*, std::size_t, const REX::W32::IID&, void**); -REX_W32_IMPORT(std::int32_t, D3DReflectLibrary, const void*, std::size_t, const REX::W32::IID&, void**); -REX_W32_IMPORT(std::int32_t, D3DSetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DStripShader, const void*, std::size_t, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DWriteBlobToFile, REX::W32::ID3DBlob*, const wchar_t*, REX::W32::BOOL); - -namespace REX::W32 -{ - HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompile(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); - } - - HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompile2(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_secondaryDataFlags, a_secondaryData, a_secondaryDataSize, a_code, a_errorMsgs); - } - - HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompileFromFile(a_fileName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); - } - - HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData) - { - return ::W32_IMPL_D3DCompressShaders(a_numShaders, a_shaderData, a_flags, a_compressedData); - } - - HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob) - { - return ::W32_IMPL_D3DCreateBlob(a_size, a_blob); - } - - HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph) - { - return ::W32_IMPL_D3DCreateFunctionLinkingGraph(a_flags, a_functionLinkingGraph); - } - - HRESULT D3DCreateLinker(ID3D11Linker** a_linker) - { - return ::W32_IMPL_D3DCreateLinker(a_linker); - } - - HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders) - { - return ::W32_IMPL_D3DDecompressShaders(a_srcData, a_srcDataSize, a_numShaders, a_startIndex, a_indices, a_flags, a_shaders, a_totalShaders); - } - - HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassemble(a_srcData, a_srcDataSize, a_flags, a_comments, a_disassembly); - } - - HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassemble10Effect(a_effect, a_flags, a_disassembly); - } - - HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassembleRegion(a_srcData, a_srcDataSize, a_flags, a_comments, a_startByteOffset, a_numInsts, a_finishByteOffset, a_disassembly); - } - - HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part) - { - return ::W32_IMPL_D3DGetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part); - } - - HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo) - { - return ::W32_IMPL_D3DGetDebugInfo(a_srcData, a_srcDataSize, a_debugInfo); - } - - HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetInputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetInputAndOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts) - { - return ::W32_IMPL_D3DGetTraceInstructionOffsets(a_srcData, a_srcDataSize, a_flags, a_startInstIndex, a_numInsts, a_offsets, a_totalInsts); - } - - HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module) - { - return ::W32_IMPL_D3DLoadModule(a_srcData, a_srcDataSize, a_module); - } - - HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DPreprocess(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_codeText, a_errorMsgs); - } - - HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents) - { - return ::W32_IMPL_D3DReadFileToBlob(a_fileName, a_contents); - } - - HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) - { - return ::W32_IMPL_D3DReflect(a_srcData, a_srcDataSize, a_iid, a_reflector); - } - - HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) - { - return ::W32_IMPL_D3DReflectLibrary(a_srcData, a_srcDataSize, a_iid, a_reflector); - } - - HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader) - { - return ::W32_IMPL_D3DSetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part, a_partSize, a_newShader); - } - - HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob) - { - return ::W32_IMPL_D3DStripShader(a_srcData, a_srcDataSize, a_stripFlags, a_strippedBlob); - } - - HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite) - { - return ::W32_IMPL_D3DWriteBlobToFile(a_blob, a_fileName, static_cast(a_overwrite)); - } -} - -// DBGHELP - -REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolName, const char*, char*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolNameW, const wchar_t*, wchar_t*, std::uint32_t, std::uint32_t); - -namespace REX::W32 -{ - std::uint32_t UnDecorateSymbolName(const char* a_name, char* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept - { - return ::W32_IMPL_UnDecorateSymbolName(a_name, a_buf, a_bufLen, a_flags); - } - - std::uint32_t UnDecorateSymbolNameW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept - { - return ::W32_IMPL_UnDecorateSymbolNameW(a_name, a_buf, a_bufLen, a_flags); - } -} - -// DXGI - -REX_W32_IMPORT(std::int32_t, CreateDXGIFactory, const IID&, void**); -REX_W32_IMPORT(std::int32_t, CreateDXGIFactory1, const IID&, void**); - -namespace REX::W32 -{ - HRESULT CreateDXGIFactory(const IID& a_iid, void** a_factory) noexcept - { - return ::W32_IMPL_CreateDXGIFactory(a_iid, a_factory); - } - - HRESULT CreateDXGIFactory1(const IID& a_iid, void** a_factory) noexcept - { - return ::W32_IMPL_CreateDXGIFactory1(a_iid, a_factory); - } -} - -// KERNEL32 - -REX_W32_IMPORT(REX::W32::BOOL, CloseHandle, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileA, const char*, std::uint32_t, std::uint32_t, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileW, const wchar_t*, std::uint32_t, std::uint32_t, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingA, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingW, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const wchar_t*); -REX_W32_IMPORT(REX::W32::BOOL, CreateProcessA, const char*, char*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const char*, REX::W32::STARTUPINFOA*, REX::W32::PROCESS_INFORMATION*); -REX_W32_IMPORT(REX::W32::BOOL, CreateProcessW, const wchar_t*, wchar_t*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const wchar_t*, REX::W32::STARTUPINFOW*, REX::W32::PROCESS_INFORMATION*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateRemoteThread, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateSemaphoreA, REX::W32::SECURITY_ATTRIBUTES*, std::int32_t, std::int32_t, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateThread, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(void, DeleteCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(void, EnterCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsA, const char*, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsW, const wchar_t*, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, FindClose, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileA, const char*, REX::W32::WIN32_FIND_DATAA*); -REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileW, const wchar_t*, REX::W32::WIN32_FIND_DATAW*); -REX_W32_IMPORT(REX::W32::BOOL, FindNextFileA, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAA*); -REX_W32_IMPORT(REX::W32::BOOL, FindNextFileW, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAW*); -REX_W32_IMPORT(REX::W32::BOOL, FlushInstructionCache, REX::W32::HANDLE, const void*, std::size_t); -REX_W32_IMPORT(REX::W32::BOOL, FreeLibrary, REX::W32::HMODULE); -REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameA, char*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameW, wchar_t*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::HANDLE, GetCurrentProcess); -REX_W32_IMPORT(std::uint32_t, GetCurrentThreadId); -REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableA, const char*, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableW, const wchar_t*, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, GetFileSizeEx, REX::W32::HANDLE, REX::W32::LARGE_INTEGER*); -REX_W32_IMPORT(std::uint32_t, GetLastError); -REX_W32_IMPORT(std::uint32_t, GetModuleFileNameA, REX::W32::HMODULE, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetModuleFileNameW, REX::W32::HMODULE, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleA, const char*); -REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleW, const wchar_t*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileIntA, const char*, const char*, std::int32_t, const char*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileIntW, const wchar_t*, const wchar_t*, std::int32_t, const wchar_t*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringA, const char*, const char*, const char*, char*, std::uint32_t, const char*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringW, const wchar_t*, const wchar_t*, const wchar_t*, wchar_t*, std::uint32_t, const wchar_t*); -REX_W32_IMPORT(void*, GetProcAddress, REX::W32::HMODULE, const char*); -REX_W32_IMPORT(void, GetSystemInfo, REX::W32::SYSTEM_INFO*); -REX_W32_IMPORT(REX::W32::BOOL, InitializeCriticalSectionAndSpinCount, REX::W32::CRITICAL_SECTION*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, IsDebuggerPresent); -REX_W32_IMPORT(std::int32_t, LCMapStringEx, const wchar_t*, std::uint32_t, const wchar_t*, std::int32_t, wchar_t*, std::int32_t, REX::W32::NLSVERSIONINFO*, void*, std::intptr_t); -REX_W32_IMPORT(void, LeaveCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryA, const char*); -REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryW, const wchar_t*); -REX_W32_IMPORT(void*, MapViewOfFile, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t); -REX_W32_IMPORT(void*, MapViewOfFileEx, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t, void*); -REX_W32_IMPORT(std::int32_t, MultiByteToWideChar, std::uint32_t, std::uint32_t, const char*, std::int32_t, wchar_t*, std::int32_t); -REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingA, std::uint32_t, REX::W32::BOOL, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingW, std::uint32_t, REX::W32::BOOL, const wchar_t*); -REX_W32_IMPORT(void, OutputDebugStringA, const char*); -REX_W32_IMPORT(void, OutputDebugStringW, const wchar_t*); -REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceCounter, std::int64_t*); -REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceFrequency, std::int64_t*); -REX_W32_IMPORT(std::uint32_t, ResumeThread, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableA, const char*, const char*); -REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableW, const wchar_t*, const wchar_t*); -REX_W32_IMPORT(void, Sleep, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, TerminateProcess, REX::W32::HANDLE, std::uint32_t); -REX_W32_IMPORT(void*, TlsGetValue, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, TlsSetValue, std::uint32_t, void*); -REX_W32_IMPORT(REX::W32::BOOL, UnmapViewOfFile, const void*); -REX_W32_IMPORT(void*, VirtualAlloc, void*, std::size_t, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(void*, VirtualAllocEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualFree, void*, std::size_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualFreeEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualProtect, void*, std::size_t, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VirtualProtectEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(std::size_t, VirtualQuery, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); -REX_W32_IMPORT(std::size_t, VirtualQueryEx, REX::W32::HANDLE, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); -REX_W32_IMPORT(std::uint32_t, WaitForSingleObject, REX::W32::HANDLE, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, WaitForSingleObjectEx, REX::W32::HANDLE, std::uint32_t, REX::W32::BOOL); -REX_W32_IMPORT(std::int32_t, WideCharToMultiByte, std::uint32_t, std::uint32_t, const wchar_t*, std::int32_t, char*, std::int32_t, const char*, std::int32_t*); -REX_W32_IMPORT(REX::W32::BOOL, WriteProcessMemory, REX::W32::HANDLE, void*, const void*, std::size_t, std::size_t*); - -extern "C" REX::W32::IMAGE_DOS_HEADER __ImageBase; - -namespace REX::W32 -{ - bool CloseHandle(HANDLE a_handle) noexcept - { - return ::W32_IMPL_CloseHandle(a_handle); - } - - HANDLE CreateFileA(const char* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile) - { - return ::W32_IMPL_CreateFileA(a_fileName, a_desiredAccess, a_shareMode, a_attributes, a_creationDisposition, a_flags, a_templateFile); - } - - HANDLE CreateFileW(const wchar_t* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile) - { - return ::W32_IMPL_CreateFileW(a_fileName, a_desiredAccess, a_shareMode, a_attributes, a_creationDisposition, a_flags, a_templateFile); - } - - HANDLE CreateFileMappingA(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const char* a_name) noexcept - { - return ::W32_IMPL_CreateFileMappingA(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); - } - - HANDLE CreateFileMappingW(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_CreateFileMappingW(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); - } - - bool CreateProcessA(const char* a_name, char* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const char* a_curDir, STARTUPINFOA* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept - { - return ::W32_IMPL_CreateProcessA(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); - } - - bool CreateProcessW(const wchar_t* a_name, wchar_t* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const wchar_t* a_curDir, STARTUPINFOW* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept - { - return ::W32_IMPL_CreateProcessW(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); - } - - HANDLE CreateRemoteThread(HANDLE a_process, SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept - { - return ::W32_IMPL_CreateRemoteThread(a_process, a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); - } - - HANDLE CreateSemaphoreA(SECURITY_ATTRIBUTES* a_semaphoreAttr, std::int32_t a_initCount, std::int32_t a_maxCount, const char* a_name) - { - return ::W32_IMPL_CreateSemaphoreA(a_semaphoreAttr, a_initCount, a_maxCount, a_name); - } - - HANDLE CreateThread(SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept - { - return ::W32_IMPL_CreateThread(a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); - } - - void DeleteCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_DeleteCriticalSection(a_criticalSection); - } - - void EnterCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_EnterCriticalSection(a_criticalSection); - } - - std::uint32_t ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept - { - return ::W32_IMPL_ExpandEnvironmentStringsA(a_src, a_dst, a_dstLen); - } - - std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept - { - return ::W32_IMPL_ExpandEnvironmentStringsW(a_src, a_dst, a_dstLen); - } - - bool FindClose(HANDLE a_file) noexcept - { - return ::W32_IMPL_FindClose(a_file); - } - - HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept - { - return ::W32_IMPL_FindFirstFileA(a_name, a_data); - } - - HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept - { - return ::W32_IMPL_FindFirstFileW(a_name, a_data); - } - - bool FindNextFileA(HANDLE a_file, WIN32_FIND_DATAA* a_data) noexcept - { - return ::W32_IMPL_FindNextFileA(a_file, a_data); - } - - bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept - { - return ::W32_IMPL_FindNextFileW(a_file, a_data); - } - - bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept - { - return ::W32_IMPL_FlushInstructionCache(a_process, a_baseAddr, a_size); - } - - bool FreeLibrary(HMODULE a_module) noexcept - { - return ::W32_IMPL_FreeLibrary(a_module); - } - - bool GetComputerNameA(char* a_buffer, std::uint32_t* a_size) noexcept - { - return ::W32_IMPL_GetComputerNameA(a_buffer, a_size); - } - - bool GetComputerNameW(wchar_t* a_buffer, std::uint32_t* a_size) noexcept - { - return ::W32_IMPL_GetComputerNameW(a_buffer, a_size); - } - - HMODULE GetCurrentModule() noexcept - { - return reinterpret_cast(std::addressof(__ImageBase)); - } - - HANDLE GetCurrentProcess() noexcept - { - return ::W32_IMPL_GetCurrentProcess(); - } - - std::uint32_t GetCurrentThreadId() noexcept - { - return ::W32_IMPL_GetCurrentThreadId(); - } - - std::uint32_t GetEnvironmentVariableA(const char* a_name, char* a_buf, std::uint32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetEnvironmentVariableA(a_name, a_buf, a_bufLen); - } - - std::uint32_t GetEnvironmentVariableW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetEnvironmentVariableW(a_name, a_buf, a_bufLen); - } - - bool GetFileSizeEx(HANDLE a_file, LARGE_INTEGER* a_fileSize) noexcept - { - return ::W32_IMPL_GetFileSizeEx(a_file, a_fileSize); - } - - std::uint32_t GetLastError() noexcept - { - return ::W32_IMPL_GetLastError(); - } - - std::uint32_t GetModuleFileNameA(HMODULE a_module, char* a_name, std::uint32_t a_nameLen) noexcept - { - return ::W32_IMPL_GetModuleFileNameA(a_module, a_name, a_nameLen); - } - - std::uint32_t GetModuleFileNameW(HMODULE a_module, wchar_t* a_name, std::uint32_t a_nameLen) noexcept - { - return ::W32_IMPL_GetModuleFileNameW(a_module, a_name, a_nameLen); - } - - HMODULE GetModuleHandleA(const char* a_name) noexcept - { - return ::W32_IMPL_GetModuleHandleA(a_name); - } - - HMODULE GetModuleHandleW(const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetModuleHandleW(a_name); - } - - std::uint32_t GetPrivateProfileIntA(const char* a_app, const char* a_key, std::int32_t a_default, const char* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileIntA(a_app, a_key, a_default, a_name); - } - - std::uint32_t GetPrivateProfileIntW(const wchar_t* a_app, const wchar_t* a_key, std::int32_t a_default, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileIntW(a_app, a_key, a_default, a_name); - } - - std::uint32_t GetPrivateProfileStringA(const char* a_app, const char* a_key, const char* a_default, char* a_buf, std::uint32_t a_bufLen, const char* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileStringA(a_app, a_key, a_default, a_buf, a_bufLen, a_name); - } - - std::uint32_t GetPrivateProfileStringW(const wchar_t* a_app, const wchar_t* a_key, const wchar_t* a_default, wchar_t* a_buf, std::uint32_t a_bufLen, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileStringW(a_app, a_key, a_default, a_buf, a_bufLen, a_name); - } - - void* GetProcAddress(HMODULE a_module, const char* a_name) noexcept - { - return ::W32_IMPL_GetProcAddress(a_module, a_name); - } - - void GetSystemInfo(SYSTEM_INFO* a_info) noexcept - { - return ::W32_IMPL_GetSystemInfo(a_info); - } - - bool IMAGE_SNAP_BY_ORDINAL64(std::uint64_t a_ordinal) noexcept - { - return (a_ordinal & IMAGE_ORDINAL_FLAG64) != 0; - } - - IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION(const IMAGE_NT_HEADERS64* a_header) noexcept - { - constexpr auto opt = __builtin_offsetof(IMAGE_NT_HEADERS64, optionalHeader); - const auto optSize = a_header->fileHeader.optionalHeaderSize; - const auto section = reinterpret_cast(a_header) + opt + optSize; - return reinterpret_cast(section); - } - - bool InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount) - { - return ::W32_IMPL_InitializeCriticalSectionAndSpinCount(a_criticalSection, a_spinCount); - } - - std::uint32_t InterlockedCompareExchange(volatile std::uint32_t* a_target, std::uint32_t a_value, std::uint32_t a_compare) noexcept - { - return _InterlockedCompareExchange((volatile long*)a_target, a_value, a_compare); - } - - std::uint64_t InterlockedCompareExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value, std::uint64_t a_compare) noexcept - { - return _InterlockedCompareExchange64((volatile long long*)a_target, a_value, a_compare); - } - - std::uint32_t InterlockedDecrement(volatile std::uint32_t* a_target) noexcept - { - return _InterlockedDecrement((volatile long*)a_target); - } - - std::uint64_t InterlockedDecrement64(volatile std::uint64_t* a_target) noexcept - { - return _InterlockedDecrement64((volatile long long*)a_target); - } - - std::uint32_t InterlockedExchange(volatile std::uint32_t* a_target, std::uint32_t a_value) noexcept - { - return _InterlockedExchange((volatile long*)a_target, a_value); - } - - std::uint64_t InterlockedExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value) noexcept - { - return _InterlockedExchange64((volatile long long*)a_target, a_value); - } - - std::uint32_t InterlockedIncrement(volatile std::uint32_t* a_target) noexcept - { - return _InterlockedIncrement((volatile long*)a_target); - } - - std::uint64_t InterlockedIncrement64(volatile std::uint64_t* a_target) noexcept - { - return _InterlockedIncrement64((volatile long long*)a_target); - } - - bool IsDebuggerPresent() noexcept - { - return ::W32_IMPL_IsDebuggerPresent(); - } - - std::int32_t LCMapStringEx(const wchar_t* a_locale, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen, NLSVERSIONINFO* a_info, void* a_reserved, std::intptr_t a_sortHandle) noexcept - { - return ::W32_IMPL_LCMapStringEx(a_locale, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_info, a_reserved, a_sortHandle); - } - - void LeaveCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_LeaveCriticalSection(a_criticalSection); - } - - HMODULE LoadLibraryA(const char* a_name) noexcept - { - return ::W32_IMPL_LoadLibraryA(a_name); - } - - HMODULE LoadLibraryW(const wchar_t* a_name) noexcept - { - return ::W32_IMPL_LoadLibraryW(a_name); - } - - void* MapViewOfFile(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes) noexcept - { - return ::W32_IMPL_MapViewOfFile(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes); - } - - void* MapViewOfFileEx(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes, void* a_baseAddr) noexcept - { - return ::W32_IMPL_MapViewOfFileEx(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes, a_baseAddr); - } - - std::int32_t MultiByteToWideChar(std::uint32_t a_codePage, std::uint32_t a_flags, const char* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen) noexcept - { - return ::W32_IMPL_MultiByteToWideChar(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen); - } - - HANDLE OpenFileMappingA(std::uint32_t a_desiredAccess, bool a_inheritHandle, const char* a_name) noexcept - { - return ::W32_IMPL_OpenFileMappingA(a_desiredAccess, a_inheritHandle, a_name); - } - - HANDLE OpenFileMappingW(std::uint32_t a_desiredAccess, bool a_inheritHandle, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_OpenFileMappingW(a_desiredAccess, a_inheritHandle, a_name); - } - - void OutputDebugStringA(const char* a_str) noexcept - { - ::W32_IMPL_OutputDebugStringA(a_str); - } - - void OutputDebugStringW(const wchar_t* a_str) noexcept - { - ::W32_IMPL_OutputDebugStringW(a_str); - } - - bool QueryPerformanceCounter(std::int64_t* a_counter) noexcept - { - return ::W32_IMPL_QueryPerformanceCounter(a_counter); - } - - bool QueryPerformanceFrequency(std::int64_t* a_frequency) noexcept - { - return ::W32_IMPL_QueryPerformanceFrequency(a_frequency); - } - - std::uint32_t ResumeThread(HANDLE a_handle) noexcept - { - return ::W32_IMPL_ResumeThread(a_handle); - } - - bool SetEnvironmentVariableA(const char* a_name, const char* a_value) noexcept - { - return ::W32_IMPL_SetEnvironmentVariableA(a_name, a_value); - } - - bool SetEnvironmentVariableW(const wchar_t* a_name, const wchar_t* a_value) noexcept - { - return ::W32_IMPL_SetEnvironmentVariableW(a_name, a_value); - } - - void Sleep(std::uint32_t a_milliseconds) noexcept - { - ::W32_IMPL_Sleep(a_milliseconds); - } - - bool TerminateProcess(HANDLE a_process, std::uint32_t a_exitCode) noexcept - { - return ::W32_IMPL_TerminateProcess(a_process, a_exitCode); - } - - void* TlsGetValue(std::uint32_t a_index) noexcept - { - return ::W32_IMPL_TlsGetValue(a_index); - } - - bool TlsSetValue(std::uint32_t a_index, void* a_value) noexcept - { - return ::W32_IMPL_TlsSetValue(a_index, a_value); - } - - bool UnmapViewOfFile(const void* a_baseAddress) noexcept - { - return ::W32_IMPL_UnmapViewOfFile(a_baseAddress); - } - - void* VirtualAlloc(void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept - { - return ::W32_IMPL_VirtualAlloc(a_address, a_size, a_type, a_protect); - } - - void* VirtualAllocEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept - { - return ::W32_IMPL_VirtualAllocEx(a_process, a_address, a_size, a_type, a_protect); - } - - bool VirtualFree(void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_VirtualFree(a_address, a_size, a_type); - } - - bool VirtualFreeEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_VirtualFreeEx(a_process, a_address, a_size, a_type); - } - - bool VirtualProtect(void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept - { - return ::W32_IMPL_VirtualProtect(a_address, a_size, a_newProtect, a_oldProtect); - } - - bool VirtualProtectEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept - { - return ::W32_IMPL_VirtualProtectEx(a_process, a_address, a_size, a_newProtect, a_oldProtect); - } - - std::size_t VirtualQuery(const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept - { - return ::W32_IMPL_VirtualQuery(a_address, a_buf, a_bufLen); - } - - std::size_t VirtualQueryEx(HANDLE a_process, const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept - { - return ::W32_IMPL_VirtualQueryEx(a_process, a_address, a_buf, a_bufLen); - } - - std::uint32_t WaitForSingleObject(HANDLE a_handle, std::uint32_t a_milliseconds) noexcept - { - return ::W32_IMPL_WaitForSingleObject(a_handle, a_milliseconds); - } - - std::uint32_t WaitForSingleObjectEx(HANDLE a_handle, std::uint32_t a_milliseconds, bool a_alertable) noexcept - { - return ::W32_IMPL_WaitForSingleObjectEx(a_handle, a_milliseconds, a_alertable); - } - - std::int32_t WideCharToMultiByte(std::uint32_t a_codePage, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, char* a_dst, std::int32_t a_dstLen, const char* a_default, std::int32_t* a_defaultLen) - { - return ::W32_IMPL_WideCharToMultiByte(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_default, a_defaultLen); - } - - bool WriteProcessMemory(HANDLE a_process, void* a_address, const void* a_buf, std::size_t a_bufLen, std::size_t* a_bufWritten) noexcept - { - return ::W32_IMPL_WriteProcessMemory(a_process, a_address, a_buf, a_bufLen, a_bufWritten); - } -} - -// NT - -namespace REX::W32 -{ - TEB* NtCurrentTeb() noexcept - { - return reinterpret_cast(__readgsqword(offsetof(NT_TIB, self))); - } -} - -// OLE32 - -REX_W32_IMPORT(void, CoTaskMemFree, void*); - -namespace REX::W32 -{ - void CoTaskMemFree(void* a_block) noexcept - { - ::W32_IMPL_CoTaskMemFree(a_block); - } -} - -// SHELL32 - -REX_W32_IMPORT(std::int32_t, SHGetKnownFolderPath, const REX::W32::GUID&, std::uint32_t, void*, wchar_t**); - -namespace REX::W32 -{ - std::int32_t SHGetKnownFolderPath(const GUID& a_id, std::uint32_t a_flags, void* a_token, wchar_t** a_path) noexcept - { - return ::W32_IMPL_SHGetKnownFolderPath(a_id, a_flags, a_token, a_path); - } -} - -// USER32 - -REX_W32_IMPORT(REX::W32::BOOL, GetClientRect, REX::W32::HWND, REX::W32::RECT*); -REX_W32_IMPORT(std::int32_t, GetKeyNameTextA, std::int32_t, char*, std::int32_t); -REX_W32_IMPORT(std::int32_t, GetKeyNameTextW, std::int32_t, wchar_t*, std::int32_t); -REX_W32_IMPORT(std::int16_t, GetKeyState, std::int32_t); -REX_W32_IMPORT(REX::W32::BOOL, GetWindowRect, REX::W32::HWND, REX::W32::RECT*); -REX_W32_IMPORT(std::int32_t, MessageBoxA, REX::W32::HWND, const char*, const char*, std::uint32_t); -REX_W32_IMPORT(std::int32_t, MessageBoxW, REX::W32::HWND, const wchar_t*, const wchar_t*, std::uint32_t); -REX_W32_IMPORT(std::intptr_t, SetWindowLongPtrA, REX::W32::HWND, std::int32_t, std::intptr_t); -REX_W32_IMPORT(std::int32_t, ShowCursor, REX::W32::BOOL); - -namespace REX::W32 -{ - bool GetClientRect(HWND a_wnd, RECT* a_rect) noexcept - { - return ::W32_IMPL_GetClientRect(a_wnd, a_rect); - } - - std::int32_t GetKeyNameTextA(std::int32_t a_param, char* a_buf, std::int32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetKeyNameTextA(a_param, a_buf, a_bufLen); - } - - std::int32_t GetKeyNameTextW(std::int32_t a_param, wchar_t* a_buf, std::int32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetKeyNameTextW(a_param, a_buf, a_bufLen); - } - - std::int16_t GetKeyState(std::int32_t a_key) noexcept - { - return ::W32_IMPL_GetKeyState(a_key); - } - - bool GetWindowRect(HWND a_wnd, RECT* a_rect) noexcept - { - return ::W32_IMPL_GetWindowRect(a_wnd, a_rect); - } - - std::int32_t MessageBoxA(HWND a_wnd, const char* a_text, const char* a_caption, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_MessageBoxA(a_wnd, a_text, a_caption, a_type); - } - - std::int32_t MessageBoxW(HWND a_wnd, const wchar_t* a_text, const wchar_t* a_caption, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_MessageBoxW(a_wnd, a_text, a_caption, a_type); - } - - std::intptr_t SetWindowLongPtrA(HWND a_wnd, std::int32_t a_index, std::intptr_t a_newPtr) noexcept - { - return ::W32_IMPL_SetWindowLongPtrA(a_wnd, a_index, a_newPtr); - } - - std::int32_t ShowCursor(bool a_show) noexcept - { - return ::W32_IMPL_ShowCursor(a_show); - } -} - -// VERSION - -REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoA, const char*, std::uint32_t, std::uint32_t, void*); -REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoW, const wchar_t*, std::uint32_t, std::uint32_t, void*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeA, const char*, std::uint32_t*); -//REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExA, std::uint32_t, const char*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExW, std::uint32_t, const wchar_t*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeW, const wchar_t*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueA, const void*, const char*, void**, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueW, const void*, const wchar_t*, void**, std::uint32_t*); - -namespace REX::W32 -{ - bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept - { - return ::W32_IMPL_GetFileVersionInfoA(a_name, a_handle, a_dataLen, a_data); - } - - std::uint32_t GetFileVersionInfoSizeA(const char* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeA(a_name, a_handle); - } - - /* - std::uint32_t GetFileVersionInfoSizeExA(std::uint32_t a_flags, const char* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeExA(a_flags, a_name, a_handle); - } - */ - - std::uint32_t GetFileVersionInfoSizeExW(std::uint32_t a_flags, const wchar_t* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeExW(a_flags, a_name, a_handle); - } - - std::uint32_t GetFileVersionInfoSizeW(const wchar_t* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeW(a_name, a_handle); - } - - bool GetFileVersionInfoW(const wchar_t* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept - { - return ::W32_IMPL_GetFileVersionInfoW(a_name, a_handle, a_dataLen, a_data); - } - - bool VerQueryValueA(const void* a_block, const char* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept - { - return ::W32_IMPL_VerQueryValueA(a_block, a_subBlock, a_buf, a_bufLen); - } - - bool VerQueryValueW(const void* a_block, const wchar_t* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept - { - return ::W32_IMPL_VerQueryValueW(a_block, a_subBlock, a_buf, a_bufLen); - } -} From f3ae0fa15382677f5d2f67c088e9d4618e946363 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 Date: Sat, 3 May 2025 03:44:56 +0000 Subject: [PATCH 02/14] maintenance --- res/cmake/sourcelist.cmake | 63 -------------------------------------- 1 file changed, 63 deletions(-) diff --git a/res/cmake/sourcelist.cmake b/res/cmake/sourcelist.cmake index 69acaa2..e293d58 100644 --- a/res/cmake/sourcelist.cmake +++ b/res/cmake/sourcelist.cmake @@ -22,72 +22,9 @@ set(SOURCES include/RE/S/SettingCollectionMap.h include/RE/S/SettingT.h include/RE/VTABLE_IDs.h - include/REL/ASM.h - include/REL/Hook.h - include/REL/HookObject.h - include/REL/HookStore.h - include/REL/IAT.h - include/REL/ID.h - include/REL/IDDB.h - include/REL/Module.h - include/REL/Offset.h - include/REL/Offset2ID.h - include/REL/REL.h - include/REL/Relocation.h - include/REL/Segment.h - include/REL/Trampoline.h - include/REL/Utility.h - include/REL/Version.h - include/REX/REX.h - include/REX/REX/Enum.h - include/REX/REX/EnumSet.h - include/REX/REX/INI.h - include/REX/REX/JSON.h - include/REX/REX/LOG.h - include/REX/REX/Setting.h - include/REX/REX/Singleton.h - include/REX/REX/TOML.h - include/REX/W32.h - include/REX/W32/ADVAPI32.h - include/REX/W32/BASE.h - include/REX/W32/BCRYPT.h - include/REX/W32/COM.h - include/REX/W32/COMPTR.h - include/REX/W32/D3D.h - include/REX/W32/D3D11.h - include/REX/W32/D3D11_1.h - include/REX/W32/D3D11_2.h - include/REX/W32/D3D11_3.h - include/REX/W32/D3D11_4.h - include/REX/W32/D3DCOMPILER.h - include/REX/W32/DBGHELP.h - include/REX/W32/DINPUT.h - include/REX/W32/DXGI.h - include/REX/W32/DXGI_2.h - include/REX/W32/DXGI_3.h - include/REX/W32/DXGI_4.h - include/REX/W32/DXGI_5.h - include/REX/W32/DXGI_6.h - include/REX/W32/KERNEL32.h - include/REX/W32/NT.h - include/REX/W32/OLE32.h - include/REX/W32/SHELL32.h - include/REX/W32/USER32.h - include/REX/W32/VERSION.h - include/REX/W32/XINPUT.h src/OBSE/API.cpp src/OBSE/Impl/PCH.cpp src/OBSE/Interfaces.cpp src/RE/Oblivion.cpp src/RE/S/Setting.cpp - src/REL/HookObject.cpp - src/REL/HookStore.cpp - src/REL/IAT.cpp - src/REL/IDDB.cpp - src/REL/Module.cpp - src/REL/Trampoline.cpp - src/REL/Utility.cpp - src/REL/Version.cpp - src/REX/REX.cpp - src/REX/W32.cpp ) From 4664888d959d8341666c8a88530807724e041898 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Sat, 3 May 2025 00:53:51 -0600 Subject: [PATCH 03/14] refactor: utilize `commonlib-shared` package --- include/OBSE/Impl/PCH.h | 538 +--------------------------------------- src/OBSE/API.cpp | 2 + xmake.lua | 75 ++---- 3 files changed, 31 insertions(+), 584 deletions(-) diff --git a/include/OBSE/Impl/PCH.h b/include/OBSE/Impl/PCH.h index 9c8e37b..bf9598b 100644 --- a/include/OBSE/Impl/PCH.h +++ b/include/OBSE/Impl/PCH.h @@ -1,540 +1,12 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static_assert( - std::is_integral_v && sizeof(std::time_t) == sizeof(std::size_t), - "wrap std::time_t instead"); - -#include "REX/REX/Enum.h" -#include "REX/REX/EnumSet.h" -#include "REX/REX/LOG.h" -#include "REX/W32/KERNEL32.h" -#include "REX/W32/USER32.h" - -#pragma warning(push, 0) -#include -#include -#pragma warning(pop) +#include namespace OBSE { using namespace std::literals; + namespace stl = XSE::stl; - namespace stl - { - template - using basic_zstring = std::basic_string_view; - - using zstring = basic_zstring; - using zwstring = basic_zstring; - - // owning pointer - template < - class T, - class = std::enable_if_t< - std::is_pointer_v>> - using owner = T; - - // non-owning pointer - template < - class T, - class = std::enable_if_t< - std::is_pointer_v>> - using observer = T; - - // non-null pointer - template < - class T, - class = std::enable_if_t< - std::is_pointer_v>> - using not_null = T; - - template - struct remove_cvptr - { - using type = std::remove_cv_t>; - }; - - template - using remove_cvptr_t = typename remove_cvptr::type; - - template - concept transparent_comparator = - requires( - const K& a_transparent, - const typename C::key_type& a_key, - typename C::key_compare& a_compare) { - typename C::key_compare::is_transparent; - // clang-format off - { a_compare(a_transparent, a_key) } -> std::convertible_to; - { a_compare(a_key, a_transparent) } -> std::convertible_to; - // clang-format on - }; - - namespace nttp - { - template - struct string - { - using char_type = CharT; - using pointer = char_type*; - using const_pointer = const char_type*; - using reference = char_type&; - using const_reference = const char_type&; - using size_type = std::size_t; - - consteval string(const_pointer a_string) noexcept - { - for (size_type i = 0; i < N; ++i) { - c[i] = a_string[i]; - } - } - - [[nodiscard]] consteval const_reference operator[](size_type a_pos) const noexcept - { - assert(a_pos < N); - return c[a_pos]; - } - - [[nodiscard]] consteval const_reference back() const noexcept { return (*this)[size() - 1]; } - [[nodiscard]] consteval const_pointer data() const noexcept { return c; } - [[nodiscard]] consteval const_reference front() const noexcept { return (*this)[0]; } - [[nodiscard]] consteval size_type length() const noexcept { return N; } - [[nodiscard]] consteval size_type size() const noexcept { return length(); } - - char_type c[N]{ static_cast('\0') }; - }; - - template - string(const CharT (&)[N]) -> string; - } - - template // - requires(std::invocable>) // - class scope_exit - { - public: - // 1) - template - explicit scope_exit(Fn&& a_fn) // - noexcept(std::is_nothrow_constructible_v || - std::is_nothrow_constructible_v) // - requires(!std::is_same_v, scope_exit> && - std::is_constructible_v) - { - static_assert(std::invocable); - - if constexpr (!std::is_lvalue_reference_v && - std::is_nothrow_constructible_v) { - _fn.emplace(std::forward(a_fn)); - } else { - _fn.emplace(a_fn); - } - } - - // 2) - scope_exit(scope_exit&& a_rhs) // - noexcept(std::is_nothrow_move_constructible_v || - std::is_nothrow_copy_constructible_v) // - requires(std::is_nothrow_move_constructible_v || - std::is_copy_constructible_v) - { - static_assert(!(std::is_nothrow_move_constructible_v && !std::is_move_constructible_v)); - static_assert(!(!std::is_nothrow_move_constructible_v && !std::is_copy_constructible_v)); - - if (a_rhs.active()) { - if constexpr (std::is_nothrow_move_constructible_v) { - _fn.emplace(std::forward(*a_rhs._fn)); - } else { - _fn.emplace(a_rhs._fn); - } - a_rhs.release(); - } - } - - // 3) - scope_exit(const scope_exit&) = delete; - - ~scope_exit() noexcept - { - if (_fn.has_value()) { - (*_fn)(); - } - } - - void release() noexcept { _fn.reset(); } - - private: - [[nodiscard]] bool active() const noexcept { return _fn.has_value(); } - - std::optional> _fn; - }; - - template - scope_exit(EF) -> scope_exit; - - template - class counted_function_iterator - { - public: - using difference_type = std::ptrdiff_t; - using value_type = std::remove_const_t()())>>; - using pointer = value_type*; - using reference = value_type&; - using iterator_category = std::input_iterator_tag; - - counted_function_iterator() noexcept = default; - - counted_function_iterator(F a_fn, std::size_t a_count) noexcept : - _fn(std::move(a_fn)), - _left(a_count) - {} - - [[nodiscard]] reference operator*() const // - noexcept(noexcept(std::declval()())) - { - assert(_fn != std::nullopt); - return (*_fn)(); - } - - [[nodiscard]] pointer operator->() const - { - return std::pointer_traits::pointer_to(operator*()); - } - - [[nodiscard]] friend bool operator==( - const counted_function_iterator& a_lhs, - const counted_function_iterator& a_rhs) noexcept - { - return a_lhs._left == a_rhs._left; - } - - counted_function_iterator& operator++() noexcept - { - assert(_left > 0); - _left -= 1; - return *this; - } - - counted_function_iterator operator++(int) noexcept - { - counted_function_iterator tmp{ *this }; - operator++(); - return tmp; - } - - private: - std::optional _fn; - std::size_t _left{ 0 }; - }; - - // backwards compat - template < - class E, - class U = std::underlying_type_t> - class enumeration : public REX::EnumSet - { - using super = REX::EnumSet; - - public: - using enum_type = E; - using underlying_type = U; - - using super::super; - using super::operator=; - using super::operator*; - }; - - template - enumeration(Args...) -> enumeration< - std::common_type_t, - std::underlying_type_t< - std::common_type_t>>; - } -} - -namespace OBSE -{ - namespace stl - { - template - class atomic_ref : - public std::atomic_ref - { - private: - using super = std::atomic_ref; - - public: - using value_type = typename super::value_type; - - explicit atomic_ref(volatile T& a_obj) noexcept(std::is_nothrow_constructible_v) : - super(const_cast(a_obj)) - {} - - using super::super; - using super::operator=; - }; - - template - atomic_ref(volatile T&) -> atomic_ref; - - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - - template - [[nodiscard]] auto adjust_pointer(U* a_ptr, std::ptrdiff_t a_adjust) noexcept - { - auto addr = a_ptr ? reinterpret_cast(a_ptr) + a_adjust : 0; - if constexpr (std::is_const_v && std::is_volatile_v) { - return reinterpret_cast*>(addr); - } else if constexpr (std::is_const_v) { - return reinterpret_cast*>(addr); - } else if constexpr (std::is_volatile_v) { - return reinterpret_cast*>(addr); - } else { - return reinterpret_cast(addr); - } - } - - template - void emplace_vtable(T* a_ptr) - { - reinterpret_cast(a_ptr)[0] = T::VTABLE[0].address(); - } - - template - void memzero(volatile T* a_ptr, std::size_t a_size = sizeof(T)) - { - const auto begin = reinterpret_cast(a_ptr); - constexpr char val{ 0 }; - std::fill_n(begin, a_size, val); - } - - [[noreturn]] inline void report_and_fail(std::string_view a_msg, std::source_location a_loc = std::source_location::current()) - { - const auto body = [&]() { - constexpr std::array directories{ - "include/"sv, - "src/"sv, - }; - - const std::filesystem::path p = a_loc.file_name(); - const auto filename = p.generic_string(); - std::string_view fileview = filename; - - constexpr auto npos = std::string::npos; - std::size_t pos = npos; - std::size_t off = 0; - for (const auto& dir : directories) { - pos = fileview.find(dir); - if (pos != npos) { - off = dir.length(); - break; - } - } - - if (pos != npos) { - fileview = fileview.substr(pos + off); - } - - return std::format("{}({}): {}", fileview, a_loc.line(), a_msg); - }(); - - const auto caption = []() -> std::string { - std::vector buf; - buf.reserve(REX::W32::MAX_PATH); - buf.resize(REX::W32::MAX_PATH / 2); - std::uint32_t result = 0; - do { - buf.resize(buf.size() * 2); - result = REX::W32::GetModuleFileNameA( - REX::W32::GetCurrentModule(), - buf.data(), - static_cast(buf.size())); - } while (result && result == buf.size() && buf.size() <= std::numeric_limits::max()); - - if (result && result != buf.size()) { - std::filesystem::path p(buf.begin(), buf.begin() + result); - return p.filename().string(); - } else { - return {}; - } - }(); - - spdlog::log( - spdlog::source_loc{ - a_loc.file_name(), - static_cast(a_loc.line()), - a_loc.function_name() }, - spdlog::level::critical, - a_msg); - REX::W32::MessageBoxA(nullptr, body.c_str(), (caption.empty() ? nullptr : caption.c_str()), 0); - REX::W32::TerminateProcess(REX::W32::GetCurrentProcess(), EXIT_FAILURE); - } - - template - [[nodiscard]] To unrestricted_cast(From a_from) - { - if constexpr (std::is_same_v< - std::remove_cv_t, - std::remove_cv_t>) { - return To{ a_from }; - - // From != To - } else if constexpr (std::is_reference_v) { - return unrestricted_cast(std::addressof(a_from)); - - // From: NOT reference - } else if constexpr (std::is_reference_v) { - return *unrestricted_cast< - std::add_pointer_t< - std::remove_reference_t>>(a_from); - - // To: NOT reference - } else if constexpr (std::is_pointer_v && - std::is_pointer_v) { - return static_cast( - const_cast( - static_cast(a_from))); - } else if constexpr ((std::is_pointer_v && std::is_integral_v) || - (std::is_integral_v && std::is_pointer_v)) { - return reinterpret_cast(a_from); - } else { - union - { - std::remove_cv_t> from; - std::remove_cv_t> to; - }; - - from = std::forward(a_from); - return to; - } - } - - [[nodiscard]] inline auto utf8_to_utf16(std::string_view a_in) noexcept - -> std::optional - { - const auto cvt = [&](wchar_t* a_dst, std::size_t a_length) { - return REX::W32::MultiByteToWideChar( - REX::W32::CP_UTF8, - 0, - a_in.data(), - static_cast(a_in.length()), - a_dst, - static_cast(a_length)); - }; - - const auto len = cvt(nullptr, 0); - if (len == 0) { - return std::nullopt; - } - - std::wstring out(len, '\0'); - if (cvt(out.data(), out.length()) == 0) { - return std::nullopt; - } - - return out; - } - - [[nodiscard]] inline auto utf16_to_utf8(std::wstring_view a_in) noexcept - -> std::optional - { - const auto cvt = [&](char* a_dst, std::size_t a_length) { - return REX::W32::WideCharToMultiByte( - REX::W32::CP_UTF8, - 0, - a_in.data(), - static_cast(a_in.length()), - a_dst, - static_cast(a_length), - nullptr, - nullptr); - }; - - const auto len = cvt(nullptr, 0); - if (len == 0) { - return std::nullopt; - } - - std::string out(len, '\0'); - if (cvt(out.data(), out.length()) == 0) { - return std::nullopt; - } - - return out; - } - } -} - -namespace RE -{ - using namespace std::literals; - namespace stl = OBSE::stl; -} - -namespace REL -{ - using namespace std::literals; - namespace stl = OBSE::stl; -} - -#include "REL/REL.h" - -namespace OBSE -{ struct VersionPackInfo { static constexpr auto AND_MAJOR{ 0x00F }; @@ -550,6 +22,12 @@ namespace OBSE using Version = REL::VersionBase; } +namespace RE +{ + using namespace std::literals; + namespace stl = XSE::stl; +} + #include "RE/IDs.h" #include "RE/NiRTTI_IDs.h" #include "RE/RTTI_IDs.h" diff --git a/src/OBSE/API.cpp b/src/OBSE/API.cpp index 31afdfa..9743d6a 100644 --- a/src/OBSE/API.cpp +++ b/src/OBSE/API.cpp @@ -42,8 +42,10 @@ namespace OBSE { info = a_info; + REL::Module::set_info(L"OBSE_RUNTIME"sv, L"OblivionRemastered-Win64-Shipping.exe"sv); (void)REL::Module::get(); if (info.iddb) { + REL::IDDB::set_info("OBSE/Plugins/versionlib-{}.bin"sv); (void)REL::IDDB::get(); } diff --git a/xmake.lua b/xmake.lua index 64bcb56..7e39ec0 100644 --- a/xmake.lua +++ b/xmake.lua @@ -7,6 +7,9 @@ set_languages("c++23") set_warnings("allextra") set_encodings("utf-8") +-- add repositories +add_repositories("libxse-xrepo https://github.com/libxse/libxse-xrepo") + -- add rules add_rules("mode.debug", "mode.releasedbg") @@ -14,49 +17,34 @@ add_rules("mode.debug", "mode.releasedbg") includes("xmake-rules.lua") -- define options -option("obse_xbyak", function() - set_default(false) - set_description("Enable trampoline support for Xbyak") - add_defines("OBSE_SUPPORT_XBYAK=1") -end) - option("rex_ini", function() set_default(false) - set_description("Enable ini config support for REX") - add_defines("REX_OPTION_INI=1") + set_description("enable ini config support for REX") end) option("rex_json", function() set_default(false) - set_description("Enable json config support for REX") - add_defines("REX_OPTION_JSON=1") + set_description("enable json config support for REX") end) option("rex_toml", function() set_default(false) - set_description("Enable toml config support for REX") - add_defines("REX_OPTION_TOML=1") + set_description("enable toml config support for REX") end) --- require packages -add_requires("rsm-mmio") -add_requires("spdlog", { configs = { header_only = false, wchar = true, std_format = true } }) - -if has_config("obse_xbyak") then - add_requires("xbyak") -end - -if has_config("rex_ini") then - add_requires("simpleini") -end - -if has_config("rex_json") then - add_requires("nlohmann_json") -end +option("obse_xbyak", function() + set_default(false) + set_description("enable xbyak support for trampoline") + add_defines("OBSE_SUPPORT_XBYAK=1") +end) -if has_config("rex_toml") then - add_requires("toml11") -end +-- require packages +add_requires("commonlib-shared", { configs = { + rex_ini = has_config("rex_ini"), + rex_json = has_config("rex_json"), + rex_toml = has_config("rex_toml"), + xse_xbyak = has_config("obse_xbyak") +} }) -- define targets target("commonlibob64", function() @@ -70,30 +58,11 @@ target("commonlibob64", function() set_group("commonlibob64") -- add packages - add_packages("rsm-mmio", "spdlog", { public = true }) - - if has_config("obse_xbyak") then - add_packages("xbyak", { public = true }) - end - - if has_config("rex_ini") then - add_packages("simpleini", { public = true }) - end - - if has_config("rex_json") then - add_packages("nlohmann_json", { public = true }) - end - - if has_config("rex_toml") then - add_packages("toml11", { public = true }) - end + add_packages("commonlib-shared", { public = true }) -- add options add_options("obse_xbyak", "rex_ini", "rex_json", "rex_toml", { public = true }) - -- add system links - add_syslinks("advapi32", "bcrypt", "d3d11", "d3dcompiler", "dbghelp", "dxgi", "ole32", "shell32", "user32", "version") - -- add source files add_files("src/**.cpp") @@ -101,9 +70,7 @@ target("commonlibob64", function() add_includedirs("include", { public = true }) add_headerfiles( "include/(OBSE/**.h)", - "include/(RE/**.h)", - "include/(REL/**.h)", - "include/(REX/**.h)" + "include/(RE/**.h)" ) -- add extra files @@ -126,7 +93,7 @@ target("commonlibob64", function() "cl::/guard:cf-", "cl::/Zc:preprocessor", "cl::/Zc:templateScope" - ) + ) -- add flags (cl: disable warnings) add_cxxflags( From 9b7d262d80f0d526cb73c4508a39769e9ff02f50 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 3 May 2025 11:57:44 -0500 Subject: [PATCH 04/14] feat: `Module` and `IDDB` changes --- src/OBSE/API.cpp | 15 ++++++++------- xmake.lua | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/OBSE/API.cpp b/src/OBSE/API.cpp index 9743d6a..881c9ff 100644 --- a/src/OBSE/API.cpp +++ b/src/OBSE/API.cpp @@ -42,15 +42,16 @@ namespace OBSE { info = a_info; - REL::Module::set_info(L"OBSE_RUNTIME"sv, L"OblivionRemastered-Win64-Shipping.exe"sv); - (void)REL::Module::get(); - if (info.iddb) { - REL::IDDB::set_info("OBSE/Plugins/versionlib-{}.bin"sv); - (void)REL::IDDB::get(); - } - static std::once_flag once; std::call_once(once, [&]() { + const auto mod = REL::Module::GetSingleton(); + mod->load(L"OblivionRemastered-Win64-Shipping.exe"sv, L"OBSE_RUNTIME"sv); + + if (info.iddb) { + const auto iddb = REL::IDDB::GetSingleton(); + iddb->load("OBSE/Plugins/versionlib-{}.bin"sv); + } + if (const auto data = PluginVersionData::GetSingleton()) { pluginName = data->GetPluginName(); pluginAuthor = data->GetAuthorName(); diff --git a/xmake.lua b/xmake.lua index 7e39ec0..78c3daf 100644 --- a/xmake.lua +++ b/xmake.lua @@ -39,7 +39,7 @@ option("obse_xbyak", function() end) -- require packages -add_requires("commonlib-shared", { configs = { +add_requires("commonlib-shared d72a3d06def7cbcb960c5a15db0e7c4fceb36463", { configs = { rex_ini = has_config("rex_ini"), rex_json = has_config("rex_json"), rex_toml = has_config("rex_toml"), From fffea1e1b5e2d166e5c93f69e6dbc5c51739bffa Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 18 May 2025 04:35:55 -0500 Subject: [PATCH 05/14] fix: `Module` change --- src/OBSE/API.cpp | 3 --- xmake.lua | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/OBSE/API.cpp b/src/OBSE/API.cpp index 881c9ff..f8b6c93 100644 --- a/src/OBSE/API.cpp +++ b/src/OBSE/API.cpp @@ -44,9 +44,6 @@ namespace OBSE static std::once_flag once; std::call_once(once, [&]() { - const auto mod = REL::Module::GetSingleton(); - mod->load(L"OblivionRemastered-Win64-Shipping.exe"sv, L"OBSE_RUNTIME"sv); - if (info.iddb) { const auto iddb = REL::IDDB::GetSingleton(); iddb->load("OBSE/Plugins/versionlib-{}.bin"sv); diff --git a/xmake.lua b/xmake.lua index 78c3daf..14fd2fd 100644 --- a/xmake.lua +++ b/xmake.lua @@ -39,7 +39,7 @@ option("obse_xbyak", function() end) -- require packages -add_requires("commonlib-shared d72a3d06def7cbcb960c5a15db0e7c4fceb36463", { configs = { +add_requires("commonlib-shared 75981b8181925dc09fdda11ac86ff6f6425e634f", { configs = { rex_ini = has_config("rex_ini"), rex_json = has_config("rex_json"), rex_toml = has_config("rex_toml"), From 5ea56e24dad8e75d2f8c030df8a56f3d9a67f5ee Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Sun, 18 May 2025 20:55:17 -0600 Subject: [PATCH 06/14] fix: `IDDB` change --- src/OBSE/API.cpp | 2 +- xmake.lua | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/OBSE/API.cpp b/src/OBSE/API.cpp index f8b6c93..e6477a4 100644 --- a/src/OBSE/API.cpp +++ b/src/OBSE/API.cpp @@ -46,7 +46,7 @@ namespace OBSE std::call_once(once, [&]() { if (info.iddb) { const auto iddb = REL::IDDB::GetSingleton(); - iddb->load("OBSE/Plugins/versionlib-{}.bin"sv); + iddb->load(L"OBSE/Plugins/versionlib-{}.bin"sv); } if (const auto data = PluginVersionData::GetSingleton()) { diff --git a/xmake.lua b/xmake.lua index 14fd2fd..1f665d9 100644 --- a/xmake.lua +++ b/xmake.lua @@ -17,6 +17,12 @@ add_rules("mode.debug", "mode.releasedbg") includes("xmake-rules.lua") -- define options +option("obse_xbyak", function() + set_default(false) + set_description("enable xbyak support for trampoline") + add_defines("OBSE_SUPPORT_XBYAK=1") +end) + option("rex_ini", function() set_default(false) set_description("enable ini config support for REX") @@ -32,14 +38,8 @@ option("rex_toml", function() set_description("enable toml config support for REX") end) -option("obse_xbyak", function() - set_default(false) - set_description("enable xbyak support for trampoline") - add_defines("OBSE_SUPPORT_XBYAK=1") -end) - -- require packages -add_requires("commonlib-shared 75981b8181925dc09fdda11ac86ff6f6425e634f", { configs = { +add_requires("commonlib-shared e9e8619678cc166de00a9e96dc465b696f7bd831", { configs = { rex_ini = has_config("rex_ini"), rex_json = has_config("rex_json"), rex_toml = has_config("rex_toml"), @@ -54,9 +54,6 @@ target("commonlibob64", function() -- set build by default set_default(os.scriptdir() == os.projectdir()) - -- set build group - set_group("commonlibob64") - -- add packages add_packages("commonlib-shared", { public = true }) From 50ca97ce3d64f1793e8b9b0b1ced63ff5e465871 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Sun, 18 May 2025 21:05:34 -0600 Subject: [PATCH 07/14] refactor: remove `cmake` --- .github/workflows/main_ci.yml | 54 +++---- .github/workflows/main_ci_xmake.yml | 38 ----- .github/workflows/maintenance.yml | 2 +- CMakeLists.txt | 151 ------------------ CMakePresets.json | 72 --------- ...{cmake_generate.py => generate_headers.py} | 36 +---- vcpkg.json | 12 -- 7 files changed, 24 insertions(+), 341 deletions(-) delete mode 100644 .github/workflows/main_ci_xmake.yml delete mode 100644 CMakeLists.txt delete mode 100644 CMakePresets.json rename res/scripts/{cmake_generate.py => generate_headers.py} (52%) delete mode 100644 vcpkg.json diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 6417b7b..ada6205 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -4,49 +4,35 @@ on: push: branches: [ master ] paths: - - '.github/workflows/main_ci.yml' - - 'cmake/**' - - 'include/**' - - 'src/**' - - 'CMakeLists.txt' - - 'CMakePresets.json' - - 'vcpkg.json' + - ".github/workflows/main_ci_xmake.yml" + - "include/**" + - "src/**" + - "xmake.lua" + - "xmake-extra.lua" pull_request: branches: [ master ] workflow_dispatch: -env: - BUILD_TYPE: Debug - VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache - jobs: - windows: + build-xmake: runs-on: windows-latest + strategy: + fail-fast: false + matrix: + mode: + - debug + - release steps: - - uses: actions/checkout@v4 - with: - path: main - - - name: Setup vcpkg - run: | - mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} - cd $env:VCPKG_INSTALLATION_ROOT - ./bootstrap-vcpkg.bat - ./vcpkg --version > ${{ github.workspace }}/vcpkg-version.txt + - name: Checkout + uses: actions/checkout@v4 - - name: Cache vcpkg - uses: actions/cache@v4 - id: vcpkg-cache - env: - cache-name: vcpkg-cache + - name: Setup XMake + uses: xmake-io/github-action-setup-xmake@v1 with: - path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/* - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('main/**/vcpkg.json', 'vcpkg-version.txt') }} + xmake-version: "latest" - - name: Configure CMake - working-directory: ${{ github.workspace }}/main - run: cmake --preset vs2022-windows-vcpkg + - name: Configure + run: xmake config -y --mode=${{ matrix.mode }} - name: Build - working-directory: ${{ github.workspace }}/main - run: cmake --build build --config ${{ env.BUILD_TYPE }} + run: xmake build -y -vD diff --git a/.github/workflows/main_ci_xmake.yml b/.github/workflows/main_ci_xmake.yml deleted file mode 100644 index dc616fd..0000000 --- a/.github/workflows/main_ci_xmake.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Main CI [XMake] - -on: - push: - branches: [ master ] - paths: - - ".github/workflows/main_ci_xmake.yml" - - "include/**" - - "src/**" - - "xmake.lua" - - "xmake-extra.lua" - pull_request: - branches: [ master ] - workflow_dispatch: - -jobs: - build-xmake: - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - mode: - - debug - - release - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup XMake - uses: xmake-io/github-action-setup-xmake@v1 - with: - xmake-version: "latest" - - - name: Configure - run: xmake config -y --mode=${{ matrix.mode }} - - - name: Build - run: xmake build -y -vD diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index 571d1d4..1992726 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -17,7 +17,7 @@ jobs: run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format -style=file -i - name: Glob files - run: python ${{ github.workspace }}/res/scripts/cmake_generate.py + run: python ${{ github.workspace }}/res/scripts/generate_headers.py - uses: stefanzweifel/git-auto-commit-action@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 0fee64c..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,151 +0,0 @@ -cmake_minimum_required(VERSION 3.21) - -include("res/cmake/common.cmake") - -option(OBSE_SUPPORT_XBYAK "Enables trampoline support for Xbyak." OFF) -option(REX_OPTION_INI "Enables ini config support for REX." OFF) -option(REX_OPTION_JSON "Enables json config support for REX." OFF) -option(REX_OPTION_TOML "Enables toml config support for REX." OFF) - -project( - CommonLibOB64 - LANGUAGES CXX -) - -include(GNUInstallDirs) - -if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") - message(FATAL_ERROR "in-source builds are not allowed") -endif() - -find_package(mmio REQUIRED CONFIG) -find_package(spdlog REQUIRED CONFIG) - -include(res/cmake/sourcelist.cmake) - -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - FILES ${SOURCES} -) - -add_library( - "${PROJECT_NAME}" - STATIC - ${SOURCES} - .clang-format - res/commonlibob64.natvis -) - -add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") - -target_compile_definitions( - "${PROJECT_NAME}" - PUBLIC - WINVER=0x0601 # windows 7, minimum supported version by fallout 4 - _WIN32_WINNT=0x0601 - "$<$:OBSE_SUPPORT_XBYAK=1>" - "$<$:REX_OPTION_INI=1>" - "$<$:REX_OPTION_JSON=1>" - "$<$:REX_OPTION_TOML=1>" -) - -target_compile_features( - "${PROJECT_NAME}" - PUBLIC - cxx_std_23 -) - -if (MSVC) - target_compile_options( - "${PROJECT_NAME}" - PRIVATE - # warnings -> errors - /we4715 # 'function' : not all control paths return a value - - # disable warnings - /wd4061 # enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label - /wd4200 # nonstandard extension used : zero-sized array in struct/union - /wd4201 # nonstandard extension used : nameless struct/union - /wd4264 # 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden - /wd4265 # 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly - /wd4266 # 'function' : no override available for virtual member function from base 'type'; function is hidden - /wd4324 # 'struct_name' : structure was padded due to __declspec(align()) - /wd4371 # 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member' - /wd4514 # 'function' : unreferenced inline function has been removed - /wd4582 # 'type': constructor is not implicitly called - /wd4583 # 'type': destructor is not implicitly called - /wd4623 # 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted - /wd4625 # 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted - /wd4626 # 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted - /wd4686 # 'user-defined type' : possible change in behavior, change in UDT return calling convention - /wd4702 # unreachable code - /wd4710 # 'function' : function not inlined - /wd4711 # function 'function' selected for inline expansion - /wd4820 # 'bytes' bytes padding added after construct 'member_name' - /wd5026 # 'type': move constructor was implicitly defined as deleted - /wd5027 # 'type': move assignment operator was implicitly defined as deleted - /wd5045 # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified - /wd5053 # support for 'explicit()' in C++17 and earlier is a vendor extension - /wd5204 # 'type-name': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly - /wd5220 # 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial - ) -endif() - -target_include_directories( - "${PROJECT_NAME}" - PUBLIC - "$" - "$" -) - -target_link_libraries( - "${PROJECT_NAME}" - PUBLIC - advapi32.lib - bcrypt.lib - d3d11.lib - d3dcompiler.lib - dbghelp.lib - dxgi.lib - mmio::mmio - ole32.lib - spdlog::spdlog - version.lib -) - -target_precompile_headers( - "${PROJECT_NAME}" - PRIVATE - include/OBSE/Impl/PCH.h -) - -install( - TARGETS "${PROJECT_NAME}" - EXPORT "${PROJECT_NAME}-targets" -) - -install( - EXPORT "${PROJECT_NAME}-targets" - NAMESPACE "${PROJECT_NAME}::" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" -) - -configure_file( - res/cmake/config.cmake.in - "${PROJECT_NAME}Config.cmake" - @ONLY -) - -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" -) - -install( - DIRECTORY - "include/OBSE" - "include/RE" - "include/REL" - "include/REX" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" -) diff --git a/CMakePresets.json b/CMakePresets.json deleted file mode 100644 index db5296f..0000000 --- a/CMakePresets.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "configurePresets": [ - { - "binaryDir": "${sourceDir}/build", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Debug" - } - }, - "errors": { - "deprecated": true - }, - "hidden": true, - "name": "cmake-dev", - "warnings": { - "deprecated": true, - "dev": true - } - }, - { - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "type": "STRING", - "value": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" - } - }, - "hidden": true, - "name": "vcpkg" - }, - { - "cacheVariables": { - "CMAKE_MSVC_RUNTIME_LIBRARY": { - "type": "STRING", - "value": "MultiThreaded$<$:Debug>DLL" - }, - "VCPKG_TARGET_TRIPLET": { - "type": "STRING", - "value": "x64-windows-static-md" - } - }, - "hidden": true, - "name": "windows" - }, - { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:anglebrackets /external:W0" - }, - "generator": "Visual Studio 16 2019", - "inherits": [ - "cmake-dev", - "vcpkg", - "windows" - ], - "name": "vs2019-windows-vcpkg" - }, - { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:W0" - }, - "generator": "Visual Studio 17 2022", - "inherits": [ - "cmake-dev", - "vcpkg", - "windows" - ], - "name": "vs2022-windows-vcpkg", - "toolset": "v143" - } - ], - "version": 2 -} diff --git a/res/scripts/cmake_generate.py b/res/scripts/generate_headers.py similarity index 52% rename from res/scripts/cmake_generate.py rename to res/scripts/generate_headers.py index 14865bc..bfb4181 100644 --- a/res/scripts/cmake_generate.py +++ b/res/scripts/generate_headers.py @@ -1,11 +1,7 @@ import os import pathlib -HEADER_TYPES = (".h", ".hpp", ".hxx") -SOURCE_TYPES = (".c", ".cpp", ".cxx") -ALL_TYPES = HEADER_TYPES + SOURCE_TYPES - -def make_header(a_directory, a_filename, a_exclude): +def make_header(a_directory, a_filename, a_exclude = set()): a_exclude.add(a_filename) with open(a_directory + "/" + a_filename, "w", encoding="utf-8") as out: @@ -24,7 +20,7 @@ def make_header(a_directory, a_filename, a_exclude): dirnames.remove(todo) for filename in filenames: - if filename not in a_exclude and filename.endswith(HEADER_TYPES): + if filename not in a_exclude and filename.endswith((".h", ".hpp", ".hxx")): path = os.path.join(dirpath, filename) tmp.append(os.path.normpath(path)) @@ -38,36 +34,10 @@ def make_header(a_directory, a_filename, a_exclude): out.write(file) out.write('"\n') -def make_cmake(): - tmp = [] - for directory in { "include", "src" }: - for dirpath, dirnames, filenames in os.walk(directory): - for filename in filenames: - if filename.endswith(ALL_TYPES): - path = os.path.join(dirpath, filename) - tmp.append(os.path.normpath(path)) - - sources = [] - for file in tmp: - name = file.replace("\\", "/") - sources.append(name) - sources.sort() - - def do_make(a_filename, a_varname, a_files): - with open("res/cmake/{}.cmake".format(a_filename), "w", encoding="utf-8") as out: - out.write("set({}\n".format(a_varname)) - for file in a_files: - out.write("\t{}\n".format(file)) - out.write(")\n") - - do_make("sourcelist", "SOURCES", sources) - def main(): root = pathlib.Path(os.path.dirname(os.path.realpath(__file__))).parent.parent - os.chdir(root) - make_cmake() - os.chdir(os.path.join(root, "include")) + make_header("OBSE", "OBSE.h", { "Impl" }) make_header("RE", "Oblivion.h", { "IDs.h", "NiRTTI_IDs.h", "RTTI_IDs.h", "VTABLE_IDs.h" }) diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 0dce288..0000000 --- a/vcpkg.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "commonlibob64", - "version-string": "1.0.0", - "description": "A reverse engineered resource for developing OBSE64 plugins for Oblivion Remastered", - "homepage": "https://github.com/libxse/commonlibob64", - "license": "GPL-3.0-only", - "supports": "windows & x64", - "dependencies": [ - "rsm-mmio", - "spdlog" - ] -} From 98345308707062235c93139cebee3c86afed4869 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Sun, 18 May 2025 21:09:01 -0600 Subject: [PATCH 08/14] refactor: remove additional cmake files --- res/cmake/comfig.cmake.in | 5 - res/cmake/common.cmake | 230 ------------------------------------- res/cmake/config.cmake.in | 5 - res/cmake/sourcelist.cmake | 30 ----- 4 files changed, 270 deletions(-) delete mode 100644 res/cmake/comfig.cmake.in delete mode 100644 res/cmake/common.cmake delete mode 100644 res/cmake/config.cmake.in delete mode 100644 res/cmake/sourcelist.cmake diff --git a/res/cmake/comfig.cmake.in b/res/cmake/comfig.cmake.in deleted file mode 100644 index d2a4c6b..0000000 --- a/res/cmake/comfig.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") -include(CMakeFindDependencyMacro) - -find_dependency(mmio CONFIG) -find_dependency(spdlog CONFIG) diff --git a/res/cmake/common.cmake b/res/cmake/common.cmake deleted file mode 100644 index 1d795bf..0000000 --- a/res/cmake/common.cmake +++ /dev/null @@ -1,230 +0,0 @@ -macro(set_from_environment VARIABLE) - if(NOT DEFINED "${VARIABLE}" AND DEFINED "ENV{${VARIABLE}}") - set("${VARIABLE}" "$ENV{${VARIABLE}}") - endif() -endmacro() - -macro(add_project) - set(_PREFIX add_project) - - set(_OPTIONS) - set(_ONE_VALUE_ARGS - LIBRARY_TYPE - PROJECT - TARGET_TYPE - VERSION - ) - set(_MULTI_VALUE_ARGS - COMPILE_DEFINITIONS - GROUPED_FILES - INCLUDE_DIRECTORIES - MISC_FILES - PRECOMPILED_HEADERS - ) - - set(_REQUIRED - PROJECT - TARGET_TYPE - ) - - cmake_parse_arguments( - "${_PREFIX}" - "${_OPTIONS}" - "${_ONE_VALUE_ARGS}" - "${_MULTI_VALUE_ARGS}" - "${ARGN}" - ) - - foreach(_ARG ${_REQUIRED}) - if(NOT DEFINED "${_PREFIX}_${_ARG}") - message(FATAL_ERROR "Argument is required to be defined: ${_ARG}") - endif() - endforeach() - - set(_CLEANUP - _PREFIX - _OPTIONS - _ONE_VALUE_ARGS - _MULTI_VALUE_ARGS - _REQUIRED - ${_PREFIX}_UNPARSED_ARGUMENTS - ${_PREFIX}_KEYWORDS_MISSING_VALUES - ) - - foreach(_ARG IN LISTS _OPTIONS _ONE_VALUE_ARGS _MULTI_VALUE_ARGS) - list(APPEND _CLEANUP "${_PREFIX}_${_ARG}") - endforeach() - - # ---- Argument validation - - string(TOLOWER "${${_PREFIX}_TARGET_TYPE}" "${_PREFIX}_TARGET_TYPE") - - if(DEFINED "${_PREFIX}_UNPARSED_ARGUMENTS") - foreach(_ARG "${_PREFIX}_UNPARSED_ARGUMENTS") - message(WARNING "Unused argument: ${_ARG}") - endforeach() - endif() - - set(_TARGET_TYPES executable library) - list(APPEND _CLEANUP _TARGET_TYPES) - if(NOT "${${_PREFIX}_TARGET_TYPE}" IN_LIST _TARGET_TYPES) - message(FATAL_ERROR "TARGET_TYPE \"${${_PREFIX}_TARGET_TYPE}\" must be one of: ${_TARGET_TYPES}") - endif() - - set(_LIBRARY_TYPES STATIC SHARED MODULE) - list(APPEND _CLEANUP _LIBRARY_TYPES) - if(DEFINED "${_PREFIX}_LIBRARY_TYPE" AND - NOT "${${_PREFIX}_LIBRARY_TYPE}" IN_LIST _LIBRARY_TYPES) - message(FATAL_ERROR "LIBRARY_TYPE \"${${_PREFIX}_LIBRARY_TYPE}\" must be one of: ${_LIBRARY_TYPES}") - endif() - - if("${_PREFIX}_TARGET_TYPE" STREQUAL "library" AND - NOT DEFINED "${_PREFIX}_LIBRARY_TYPE") - message(FATAL_ERROR "LIBRARY_TYPE must be set for \"library\" targets") - elseif("${_PREFIX}_TARGET_TYPE" STREQUAL "executable" AND - DEFINED "${_PREFIX}_LIBRARY_TYPE") - message(FATAL_ERROR "LIBRARY_TYPE must not be set for \"executable\" targets") - endif() - - # ---- Project ---- - - if(DEFINED "${_PREFIX}_VERSION") - set(_VERSION_PREFIX "VERSION") - list(APPEND _CLEANUP _VERSION_PREFIX) - else() - unset(_VERSION_PREFIX) - endif() - - project( - "${${_PREFIX}_PROJECT}" - ${_VERSION_PREFIX} ${${_PREFIX}_VERSION} - LANGUAGES CXX - ) - - # ---- Include guards ---- - - if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") - message(FATAL_ERROR "in-source builds are not allowed") - endif() - - # ---- Add target ---- - - cmake_language( - CALL - "add_${${_PREFIX}_TARGET_TYPE}" # add_executable/add_library - "${PROJECT_NAME}" - "${${_PREFIX}_LIBRARY_TYPE}" - ${${_PREFIX}_GROUPED_FILES} - ${${_PREFIX}_MISC_FILES} - ) - - set_target_properties( - "${PROJECT_NAME}" - PROPERTIES - CXX_STANDARD 23 - CXX_STANDARD_REQUIRED ON - INTERPROCEDURAL_OPTIMIZATION ON - INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF - ) - - target_compile_definitions( - "${PROJECT_NAME}" - PRIVATE - _UNICODE - ${${_PREFIX}_COMPILE_DEFINITIONS} - ) - - target_include_directories( - "${PROJECT_NAME}" - PRIVATE - ${${_PREFIX}_INCLUDE_DIRECTORIES} - ) - - target_precompile_headers( - "${PROJECT_NAME}" - PRIVATE - ${${_PREFIX}_PRECOMPILED_HEADERS} - ) - - if(MSVC) - target_compile_options( - "${PROJECT_NAME}" - PRIVATE - "/sdl" # Enable Additional Security Checks - "/utf-8" # Set Source and Executable character sets to UTF-8 - "/Zi" # Debug Information Format - - "/permissive-" # Standards conformance - PUBLIC - "/wd4702" # unreachable code - ) - - target_link_options( - "${PROJECT_NAME}" - PRIVATE - /WX # Treat Linker Warnings as Errors - - "$<$:/INCREMENTAL;/OPT:NOREF;/OPT:NOICF>" - "$<$:/INCREMENTAL:NO;/OPT:REF;/OPT:ICF;/DEBUG:FULL>" - ) - endif() - - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - FILES - ${${_PREFIX}_GROUPED_FILES} - ) - - # ---- Cleanup local variables ---- - - foreach(_VAR "${_CLEANUP}") - unset("${_VAR}") - endforeach() - unset(_CLEANUP) -endmacro() - -macro(copy_files) - if(NOT "${ARGC}" GREATER 0) - message(FATAL_ERROR "Invalid number of arguments.") - endif() - - math(EXPR _REMAINDER "${ARGC} % 2") - if(NOT _REMAINDER EQUAL 0) - message(FATAL_ERROR "Arguments must be paired as a file + path spec.") - endif() - - option(COPY_BUILD "Copy the build output to the Fallout 4 directory." OFF) - - set(_ARGS "${ARGN}") - - if(COPY_BUILD) - set_from_environment(Fallout4Path) - if(DEFINED Fallout4Path) - math(EXPR _PAIRS "${ARGC} / 2 - 1") - foreach(_IDX RANGE "${_PAIRS}") - math(EXPR _IDX "${_IDX} * 2") - math(EXPR _IDXN "${_IDX} + 1") - - list(GET _ARGS "${_IDX}" _FROM) - list(GET _ARGS "${_IDXN}" _TO) - - cmake_path(SET _TO NORMALIZE "${Fallout4Path}/${_TO}") - - add_custom_command( - TARGET "${PROJECT_NAME}" - POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${_FROM}" "${_TO}" - ) - endforeach() - else() - message(WARNING "Variable Fallout4Path is not defined. Skipping post-build copy command.") - endif() - endif() - - unset(_ARGS) - unset(_REMAINDER) - unset(_IDX) - unset(_IDXN) - unset(_FROM) - unset(_TO) -endmacro() diff --git a/res/cmake/config.cmake.in b/res/cmake/config.cmake.in deleted file mode 100644 index d2a4c6b..0000000 --- a/res/cmake/config.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") -include(CMakeFindDependencyMacro) - -find_dependency(mmio CONFIG) -find_dependency(spdlog CONFIG) diff --git a/res/cmake/sourcelist.cmake b/res/cmake/sourcelist.cmake deleted file mode 100644 index e293d58..0000000 --- a/res/cmake/sourcelist.cmake +++ /dev/null @@ -1,30 +0,0 @@ -set(SOURCES - include/OBSE/API.h - include/OBSE/Impl/PCH.h - include/OBSE/Interfaces.h - include/OBSE/OBSE.h - include/OBSE/Trampoline.h - include/OBSE/Version.h - include/RE/B/BSTCaseInsensitiveStringMap.h - include/RE/G/GameSettingCollection.h - include/RE/IDs.h - include/RE/M/MemoryManager.h - include/RE/N/NiTDefaultAllocator.h - include/RE/N/NiTMap.h - include/RE/N/NiTMapBase.h - include/RE/N/NiTStringMap.h - include/RE/NiRTTI_IDs.h - include/RE/Oblivion.h - include/RE/RTTI.h - include/RE/RTTI_IDs.h - include/RE/S/Setting.h - include/RE/S/SettingCollection.h - include/RE/S/SettingCollectionMap.h - include/RE/S/SettingT.h - include/RE/VTABLE_IDs.h - src/OBSE/API.cpp - src/OBSE/Impl/PCH.cpp - src/OBSE/Interfaces.cpp - src/RE/Oblivion.cpp - src/RE/S/Setting.cpp -) From 90ee87c25f87ad36714ac896c394730d58d26555 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Sun, 18 May 2025 21:14:16 -0600 Subject: [PATCH 09/14] refactor: rename ID headers --- include/OBSE/Impl/PCH.h | 6 +++--- include/RE/{NiRTTI_IDs.h => IDs_NiRTTI.h} | 0 include/RE/{RTTI_IDs.h => IDs_RTTI.h} | 0 include/RE/{VTABLE_IDs.h => IDs_VTABLE.h} | 0 include/RE/Oblivion.h | 1 - res/scripts/generate_headers.py | 2 +- 6 files changed, 4 insertions(+), 5 deletions(-) rename include/RE/{NiRTTI_IDs.h => IDs_NiRTTI.h} (100%) rename include/RE/{RTTI_IDs.h => IDs_RTTI.h} (100%) rename include/RE/{VTABLE_IDs.h => IDs_VTABLE.h} (100%) diff --git a/include/OBSE/Impl/PCH.h b/include/OBSE/Impl/PCH.h index cd71f13..e77bb41 100644 --- a/include/OBSE/Impl/PCH.h +++ b/include/OBSE/Impl/PCH.h @@ -29,8 +29,8 @@ namespace RE } #include "RE/IDs.h" -#include "RE/NiRTTI_IDs.h" -#include "RE/RTTI_IDs.h" -#include "RE/VTABLE_IDs.h" +#include "RE/IDs_NiRTTI.h" +#include "RE/IDs_RTTI.h" +#include "RE/IDs_VTABLE.h" #include "RE/B/BSCoreTypes.h" diff --git a/include/RE/NiRTTI_IDs.h b/include/RE/IDs_NiRTTI.h similarity index 100% rename from include/RE/NiRTTI_IDs.h rename to include/RE/IDs_NiRTTI.h diff --git a/include/RE/RTTI_IDs.h b/include/RE/IDs_RTTI.h similarity index 100% rename from include/RE/RTTI_IDs.h rename to include/RE/IDs_RTTI.h diff --git a/include/RE/VTABLE_IDs.h b/include/RE/IDs_VTABLE.h similarity index 100% rename from include/RE/VTABLE_IDs.h rename to include/RE/IDs_VTABLE.h diff --git a/include/RE/Oblivion.h b/include/RE/Oblivion.h index 4a7625d..406af9d 100644 --- a/include/RE/Oblivion.h +++ b/include/RE/Oblivion.h @@ -15,7 +15,6 @@ #include "RE/A/AlchemyItem.h" #include "RE/A/AlchemyItemData.h" #include "RE/B/BIPED_MODEL.h" -#include "RE/B/BSCoreTypes.h" #include "RE/B/BSStringT.h" #include "RE/B/BSTCaseInsensitiveStringMap.h" #include "RE/B/BSTList.h" diff --git a/res/scripts/generate_headers.py b/res/scripts/generate_headers.py index 27590a1..e3d7e4b 100644 --- a/res/scripts/generate_headers.py +++ b/res/scripts/generate_headers.py @@ -39,7 +39,7 @@ def main(): os.chdir(os.path.join(root, "include")) make_header("OBSE", "OBSE.h", { "Impl" }) - make_header("RE", "Oblivion.h", { "IDs.h", "NiRTTI_IDs.h", "RTTI_IDs.h", "VTABLE_IDs.h" }) + make_header("RE", "Oblivion.h", { "BSCoreTypes.h", "IDs.h", "IDs_NiRTTI.h", "IDs_RTTI.h", "IDs_VTABLE.h" }) make_header("UE", "Unreal.h") if __name__ == "__main__": From 56f3a4f150fd69e100086278800cd7c99b64f053 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 <2724172+shad0wshayd3@users.noreply.github.com> Date: Mon, 19 May 2025 00:40:00 -0600 Subject: [PATCH 10/14] feat: add `MessagingInterface::DataLoaded` --- include/OBSE/Interfaces.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/OBSE/Interfaces.h b/include/OBSE/Interfaces.h index f8a7549..471e14d 100644 --- a/include/OBSE/Interfaces.h +++ b/include/OBSE/Interfaces.h @@ -133,7 +133,8 @@ namespace OBSE enum : std::uint32_t { kPostLoad, - kPostPostLoad + kPostPostLoad, + kDataLoaded }; struct Message From cb58ed17d9c1f37a329cbacf39f4f4c949cdf32e Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 20 May 2025 21:33:00 -0500 Subject: [PATCH 11/14] feat: shared changes --- include/OBSE/API.h | 1 - include/OBSE/Impl/PCH.h | 5 ++--- include/OBSE/Interfaces.h | 2 +- include/RE/B/BSTList.h | 6 +++--- include/RE/M/MemoryManager.h | 4 ++-- src/OBSE/API.cpp | 6 +----- src/OBSE/Interfaces.cpp | 2 +- xmake.lua | 32 ++++++++++++++------------------ 8 files changed, 24 insertions(+), 34 deletions(-) diff --git a/include/OBSE/API.h b/include/OBSE/API.h index f4f6ed0..4721b13 100644 --- a/include/OBSE/API.h +++ b/include/OBSE/API.h @@ -19,7 +19,6 @@ namespace OBSE bool trampoline{ false }; std::size_t trampolineSize{ 0 }; bool hook{ true }; - bool iddb{ false }; }; void Init(const PreLoadInterface* a_intfc, InitInfo a_info = {}) noexcept; diff --git a/include/OBSE/Impl/PCH.h b/include/OBSE/Impl/PCH.h index e77bb41..2c8a0e3 100644 --- a/include/OBSE/Impl/PCH.h +++ b/include/OBSE/Impl/PCH.h @@ -1,11 +1,11 @@ #pragma once -#include +#include +#include namespace OBSE { using namespace std::literals; - namespace stl = XSE::stl; struct VersionPackInfo { @@ -25,7 +25,6 @@ namespace OBSE namespace RE { using namespace std::literals; - namespace stl = XSE::stl; } #include "RE/IDs.h" diff --git a/include/OBSE/Interfaces.h b/include/OBSE/Interfaces.h index 471e14d..a112b91 100644 --- a/include/OBSE/Interfaces.h +++ b/include/OBSE/Interfaces.h @@ -150,7 +150,7 @@ namespace OBSE [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } bool RegisterListener(EventCallback* a_handler) const { return RegisterListener(a_handler, "OBSE"sv); } - bool RegisterListener(EventCallback* a_handler, stl::zstring a_sender) const; + bool RegisterListener(EventCallback* a_handler, std::string_view a_sender) const; bool Dispatch(std::uint32_t a_messageType, void* a_data, std::uint32_t a_dataLen, const char* a_receiver) const; }; diff --git a/include/RE/B/BSTList.h b/include/RE/B/BSTList.h index cebca56..13a68bc 100644 --- a/include/RE/B/BSTList.h +++ b/include/RE/B/BSTList.h @@ -74,8 +74,8 @@ namespace RE TES_HEAP_REDEFINE_NEW(); // members - value_type item; // 00 - stl::observer next; // ?? + value_type item; // 00 + Node* next; // ?? }; template @@ -164,7 +164,7 @@ namespace RE } private: - stl::observer _cur; + Node* _cur; }; using iterator = iterator_base; diff --git a/include/RE/M/MemoryManager.h b/include/RE/M/MemoryManager.h index 60f09fa..a1e5205 100644 --- a/include/RE/M/MemoryManager.h +++ b/include/RE/M/MemoryManager.h @@ -96,7 +96,7 @@ namespace RE if (mem) { \ return mem; \ } else { \ - stl::report_and_fail("out of memory"sv); \ + REX::FAIL("out of memory"); \ } \ } \ \ @@ -106,7 +106,7 @@ namespace RE if (mem) { \ return mem; \ } else { \ - stl::report_and_fail("out of memory"sv); \ + REX::FAIL("out of memory"); \ } \ } \ \ diff --git a/src/OBSE/API.cpp b/src/OBSE/API.cpp index e6477a4..5c21f13 100644 --- a/src/OBSE/API.cpp +++ b/src/OBSE/API.cpp @@ -7,6 +7,7 @@ #include "REX/W32/OLE32.h" #include "REX/W32/SHELL32.h" +#include #include #include @@ -44,11 +45,6 @@ namespace OBSE static std::once_flag once; std::call_once(once, [&]() { - if (info.iddb) { - const auto iddb = REL::IDDB::GetSingleton(); - iddb->load(L"OBSE/Plugins/versionlib-{}.bin"sv); - } - if (const auto data = PluginVersionData::GetSingleton()) { pluginName = data->GetPluginName(); pluginAuthor = data->GetAuthorName(); diff --git a/src/OBSE/Interfaces.cpp b/src/OBSE/Interfaces.cpp index 4d45640..1ca2ea0 100644 --- a/src/OBSE/Interfaces.cpp +++ b/src/OBSE/Interfaces.cpp @@ -6,7 +6,7 @@ namespace OBSE { - bool MessagingInterface::RegisterListener(EventCallback* a_handler, stl::zstring a_sender) const + bool MessagingInterface::RegisterListener(EventCallback* a_handler, std::string_view a_sender) const { const auto success = GetProxy().RegisterListener( diff --git a/xmake.lua b/xmake.lua index 1f665d9..3895bac 100644 --- a/xmake.lua +++ b/xmake.lua @@ -17,34 +17,33 @@ add_rules("mode.debug", "mode.releasedbg") includes("xmake-rules.lua") -- define options -option("obse_xbyak", function() - set_default(false) - set_description("enable xbyak support for trampoline") - add_defines("OBSE_SUPPORT_XBYAK=1") -end) - -option("rex_ini", function() +option("commonlib_ini", function() set_default(false) set_description("enable ini config support for REX") end) -option("rex_json", function() +option("commonlib_json", function() set_default(false) set_description("enable json config support for REX") end) -option("rex_toml", function() +option("commonlib_toml", function() set_default(false) set_description("enable toml config support for REX") end) +option("commonlib_xbyak", function() + set_default(false) + set_description("enable xbyak support for trampoline") +end) + -- require packages -add_requires("commonlib-shared e9e8619678cc166de00a9e96dc465b696f7bd831", { configs = { - rex_ini = has_config("rex_ini"), - rex_json = has_config("rex_json"), - rex_toml = has_config("rex_toml"), - xse_xbyak = has_config("obse_xbyak") -} }) +add_requires("commonlib-shared 4830431543103648ac6ff53ff74ae945bc85b70f", { configs = { + ini = has_config("commonlib_ini"), + json = has_config("commonlib_json"), + toml = has_config("commonlib_toml"), + xbyak = has_config("commonlib_xbyak") +}}) -- define targets target("commonlibob64", function() @@ -57,9 +56,6 @@ target("commonlibob64", function() -- add packages add_packages("commonlib-shared", { public = true }) - -- add options - add_options("obse_xbyak", "rex_ini", "rex_json", "rex_toml", { public = true }) - -- add source files add_files("src/**.cpp") From 3f6e025f9216b4adc9cc37c8748d9daef9c892c9 Mon Sep 17 00:00:00 2001 From: qudix Date: Wed, 21 May 2025 02:33:16 +0000 Subject: [PATCH 12/14] maintenance --- include/OBSE/Impl/PCH.h | 2 +- src/OBSE/API.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/OBSE/Impl/PCH.h b/include/OBSE/Impl/PCH.h index 2c8a0e3..2139e7b 100644 --- a/include/OBSE/Impl/PCH.h +++ b/include/OBSE/Impl/PCH.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include namespace OBSE { diff --git a/src/OBSE/API.cpp b/src/OBSE/API.cpp index 5c21f13..dcdf762 100644 --- a/src/OBSE/API.cpp +++ b/src/OBSE/API.cpp @@ -7,9 +7,9 @@ #include "REX/W32/OLE32.h" #include "REX/W32/SHELL32.h" -#include #include #include +#include namespace OBSE { From 2ebf671bf1786ad5abbb039350668e2462e137d6 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 20 May 2025 23:28:49 -0500 Subject: [PATCH 13/14] feat: update `commonlib-shared` --- xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake.lua b/xmake.lua index 3895bac..5713dfd 100644 --- a/xmake.lua +++ b/xmake.lua @@ -38,7 +38,7 @@ option("commonlib_xbyak", function() end) -- require packages -add_requires("commonlib-shared 4830431543103648ac6ff53ff74ae945bc85b70f", { configs = { +add_requires("commonlib-shared d81a6748c1316d9ff731d2a5dd1e6f017be45ce9", { configs = { ini = has_config("commonlib_ini"), json = has_config("commonlib_json"), toml = has_config("commonlib_toml"), From d78f2dc29598437563d4b578550ee9acbd6eb191 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 25 May 2025 16:07:34 -0500 Subject: [PATCH 14/14] fix: missing headerfiles --- xmake.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xmake.lua b/xmake.lua index 5713dfd..4198f8f 100644 --- a/xmake.lua +++ b/xmake.lua @@ -63,7 +63,8 @@ target("commonlibob64", function() add_includedirs("include", { public = true }) add_headerfiles( "include/(OBSE/**.h)", - "include/(RE/**.h)" + "include/(RE/**.h)", + "include/(UE/**.h)" ) -- add extra files