From 87002e7314aef9096c1878c70902801d3b9d5ef7 Mon Sep 17 00:00:00 2001 From: Vermunds <33235701+Vermunds@users.noreply.github.com> Date: Sat, 30 Sep 2023 20:24:18 +0200 Subject: [PATCH 01/76] MapMenu findings --- include/RE/M/MapMenu.h | 43 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/include/RE/M/MapMenu.h b/include/RE/M/MapMenu.h index d284457d6..34bc99a2d 100644 --- a/include/RE/M/MapMenu.h +++ b/include/RE/M/MapMenu.h @@ -50,29 +50,26 @@ namespace RE } // members - BSTSmartPointer moveHandler; // 00040 - BSTSmartPointer lookHandler; // 00048 - BSTSmartPointer zoomHandler; // 00050 - ObjectRefHandle mapMarker; // 00058 - LocalMapMenu localMapMenu; // 00060 - RefHandle unk30460; // 30460 - std::uint32_t unk30464; // 30464 - std::uint32_t unk30468; // 30468 - std::uint32_t unk3046C; // 3046C - BSTArray unk30470; // 30470 - BSTArray unk30488; // 30488 - MapCamera camera; // 304A0 - std::uint64_t unk30530; // 30530 - TESWorldSpace* worldSpace; // 30538 - GFxValue unk30540; // 30540 - std::uint64_t unk30558; // 30558 - std::uint64_t unk30560; // 30560 - std::uint64_t unk30568; // 30568 - std::uint32_t unk30570; // 30570 - BSSoundHandle unk30574; // 30574 - std::uint64_t unk30580; // 30580 - std::uint64_t unk30588; // 30588 - std::uint64_t unk30590; // 30590 + BSTSmartPointer moveHandler; // 00040 + BSTSmartPointer lookHandler; // 00048 + BSTSmartPointer zoomHandler; // 00050 + ObjectRefHandle mapMarker; // 00058 + LocalMapMenu localMapMenu; // 00060 + RefHandle unk30460; // 30460 + NiPoint3 playerMarkerPosition; // 30464 + BSTArray unk30470; // 30470 + BSTArray unk30488; // 30488 + MapCamera camera; // 304A0 + std::uint64_t unk30530; // 30530 + TESWorldSpace* worldSpace; // 30538 + GFxValue unk30540; // 30540 + std::uint32_t unk30558; // 30558 + NiPoint3 unk3055C; // 3055C + NiPoint3 unk30568; // 30568 + BSSoundHandle unk30574; // 30574 + std::uint64_t unk30580; // 30580 + std::uint64_t unk30588; // 30588 + std::uint64_t unk30590; // 30590 }; static_assert(sizeof(MapMenu) == 0x30598); } From 133942fb9891dca11c4792be87ab82dc9d17cf43 Mon Sep 17 00:00:00 2001 From: Vermunds <33235701+Vermunds@users.noreply.github.com> Date: Sun, 1 Oct 2023 14:27:50 +0200 Subject: [PATCH 02/76] Very basic BGSTerrainManager RE --- cmake/sourcelist.cmake | 1 + include/RE/B/BGSTerrainManager.h | 42 ++++++++++++++++++++++++++++++++ include/RE/Skyrim.h | 1 + 3 files changed, 44 insertions(+) create mode 100644 include/RE/B/BGSTerrainManager.h diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 3b62697f8..88c09ccb5 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -191,6 +191,7 @@ set(SOURCES include/RE/B/BGSStoryManagerTreeForm.h include/RE/B/BGSStoryTeller.h include/RE/B/BGSTalkingActivator.h + include/RE/B/BGSTerrainManager.h include/RE/B/BGSTextureModel.h include/RE/B/BGSTextureSet.h include/RE/B/BGSTypedItem.h diff --git a/include/RE/B/BGSTerrainManager.h b/include/RE/B/BGSTerrainManager.h new file mode 100644 index 000000000..cc462d909 --- /dev/null +++ b/include/RE/B/BGSTerrainManager.h @@ -0,0 +1,42 @@ +#pragma once + +namespace RE +{ + class BGSTerrainManager + { + public: + std::uint64_t unk00; // 00 + std::uint64_t unk08; // 08 + std::uint64_t unk10; // 10 + std::uint64_t unk18; // 18 + std::uint64_t unk20; // 20 + std::uint64_t unk28; // 28 + std::uint8_t unk30; // 30 + std::uint8_t unk31; // 31 + bool lodTreesHidden; // 32 + std::uint8_t unk33; // 33 + std::uint8_t unk34; // 34 + std::uint8_t unk35; // 35 + std::uint8_t unk36; // 36 + std::uint8_t unk37; // 37 + std::uint64_t unk38; // 38 + std::uint64_t unk40; // 40 + std::uint64_t unk48; // 48 + std::uint64_t unk50; // 50 + std::uint64_t unk58; // 58 + std::uint64_t unk60; // 60 + std::uint64_t unk68; // 68 + std::uint64_t unk70; // 70 + std::uint64_t unk78; // 78 + std::uint64_t unk80; // 80 + std::uint64_t unk88; // 88 + std::uint64_t unk90; // 90 + std::uint64_t unk98; // 98 + std::uint64_t unkA0; // A0 + std::uint64_t unkA8; // A8 + std::uint64_t unkB0; // B0 + std::uint64_t unkB8; // B8 + std::uint64_t unkC0; // C0 + }; + static_assert(sizeof(BGSTerrainManager) == 0xC8); +} diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index ce4db14df..6e0bddf22 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -194,6 +194,7 @@ #include "RE/B/BGSStoryManagerTreeForm.h" #include "RE/B/BGSStoryTeller.h" #include "RE/B/BGSTalkingActivator.h" +#include "RE/B/BGSTerrainManager.h" #include "RE/B/BGSTextureModel.h" #include "RE/B/BGSTextureSet.h" #include "RE/B/BGSTypedItem.h" From 98fcfbf24eab78cf4001530dfbdfb20435ea2207 Mon Sep 17 00:00:00 2001 From: Vermunds <33235701+Vermunds@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:07:10 +0100 Subject: [PATCH 03/76] Update InterfaceStrings.h --- include/RE/I/InterfaceStrings.h | 53 +++++++++++++++++---------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/include/RE/I/InterfaceStrings.h b/include/RE/I/InterfaceStrings.h index 10270749c..82354a4b6 100644 --- a/include/RE/I/InterfaceStrings.h +++ b/include/RE/I/InterfaceStrings.h @@ -65,30 +65,33 @@ namespace RE BSFixedString creditsMenu; // 188 - "Credits Menu" BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" BSFixedString creationClubMenu; // 198 - "Creation Club Menu" - BSFixedString titleSequenceMenu; // 1A0 - "TitleSequence Menu" - BSFixedString consoleNativeUIMenu; // 1A8 - "Console Native UI Menu" - BSFixedString kinectMenu; // 1B0 - "Kinect Menu" - BSFixedString loadWaitSpinner; // 1B8 - "LoadWaitSpinner" - BSFixedString streamingInstallMenu; // 1C0 - "StreamingInstallMenu" - BSFixedString textWidget; // 1C8 - "TextWidget" - BSFixedString buttonBarWidget; // 1D0 - "ButtonBarWidget" - BSFixedString graphWidget; // 1D8 - "GraphWidget" - BSFixedString textureWidget; // 1E0 - "TextureWidget" - BSFixedString uiMenuOK; // 1E8 - "UIMenuOK" - BSFixedString uiMenuCancel; // 1F0 - "UIMenuCancel" - BSFixedString showText; // 1F8 - "Show Text" - BSFixedString hideText; // 200 - "Hide Text" - BSFixedString showList; // 208 - "Show List" - BSFixedString voiceReady; // 210 - "Voice Ready" - BSFixedString dmfoStr; // 218 - "DMFOStr" - BSFixedString showJournal; // 220 - "Show Journal" - BSFixedString journalSettingsSaved; // 228 - "Journal Settings Saved" - BSFixedString closeMenu; // 230 - "CloseMenu" - BSFixedString closingAllMenus; // 238 - "Closing All Menus" - BSFixedString refreshMenu; // 240 - "RefreshMenu" - BSFixedString cancelLoading; // 248 - "CancelLoading" - BSFixedString menuTextureDegradeEvent; // 250 - "Menu Texture Degrade Event" - BSFixedString diamondMarker; // 258 - "" + BSFixedString marketplaceMenu; // 1A0 - "Marketplace Menu" + BSFixedString titleSequenceMenu; // 1A8 - "TitleSequence Menu" + BSFixedString consoleNativeUIMenu; // 1B0 - "Console Native UI Menu" + BSFixedString kinectMenu; // 1B8 - "Kinect Menu" + BSFixedString loadWaitSpinner; // 1C0 - "LoadWaitSpinner" + BSFixedString streamingInstallMenu; // 1C8 - "StreamingInstallMenu" + BSFixedString textWidget; // 1D0 - "TextWidget" + BSFixedString buttonBarWidget; // 1D8 - "ButtonBarWidget" + BSFixedString graphWidget; // 1E0 - "GraphWidget" + BSFixedString textureWidget; // 1E8 - "TextureWidget" + BSFixedString uiMenuOK; // 1F0 - "UIMenuOK" + BSFixedString uiMenuCancel; // 1F8 - "UIMenuCancel" + BSFixedString showText; // 200 - "Show Text" + BSFixedString hideText; // 208 - "Hide Text" + BSFixedString showList; // 210 - "Show List" + BSFixedString voiceReady; // 218 - "Voice Ready" + BSFixedString dmfoStr; // 220 - "DMFOStr" + BSFixedString showJournal; // 228 - "Show Journal" + BSFixedString journalSettingsSaved; // 230 - "Journal Settings Saved" + BSFixedString closeMenu; // 238 - "CloseMenu" + BSFixedString closingAllMenus; // 240 - "Closing All Menus" + BSFixedString refreshMenu; // 248 - "RefreshMenu" + BSFixedString cancelLoading; // 250 - "CancelLoading" + BSFixedString menuTextureDegradeEvent; // 258 - "Menu Texture Degrade Event" + BSFixedString userSettingsLoaded; // 260 - "UserSettingsLoaded" + BSFixedString activityStarted; // 268 - "ActivityStarted" + BSFixedString diamondMarker; // 270 - "" }; - static_assert(sizeof(InterfaceStrings) == 0x260); + static_assert(sizeof(InterfaceStrings) == 0x278); } From 483173e0cf53454645f66bd4362c90ccdaf5f0a4 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 10 Dec 2023 15:04:14 -0500 Subject: [PATCH 04/76] Fix windSpeed typing --- include/RE/T/TESWeather.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/T/TESWeather.h b/include/RE/T/TESWeather.h index 47ffe144d..69fcc12b0 100644 --- a/include/RE/T/TESWeather.h +++ b/include/RE/T/TESWeather.h @@ -107,7 +107,7 @@ namespace RE static_assert(sizeof(Color3) == 0x3); // members - std::int8_t windSpeed; // 00 + std::uint8_t windSpeed; // 00 std::int8_t unk01; // 01 std::int8_t unk02; // 02 std::int8_t transDelta; // 03 From 4b16708d752d5424f2780dde93105e58467908c9 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Wed, 13 Dec 2023 21:16:00 +0530 Subject: [PATCH 05/76] 1.6.1130 update --- include/RE/C/ControlMap.h | 2 +- include/RE/I/IngredientItem.h | 1 + include/RE/J/Journal_SystemTab.h | 1 + include/RE/Offsets.h | 2 +- include/RE/T/TES.h | 3 ++- include/RE/T/TESContainer.h | 2 +- include/RE/U/UserEvents.h | 5 +++-- include/SKSE/Version.h | 3 ++- src/SKSE/Logger.cpp | 2 +- 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/RE/C/ControlMap.h b/include/RE/C/ControlMap.h index c12bb2878..635d2b570 100644 --- a/include/RE/C/ControlMap.h +++ b/include/RE/C/ControlMap.h @@ -96,5 +96,5 @@ namespace RE std::uint8_t pad123; // 123 stl::enumeration gamePadMapType; // 124 }; - static_assert(sizeof(ControlMap) == 0x128); + static_assert(sizeof(ControlMap) == 0x130); } diff --git a/include/RE/I/IngredientItem.h b/include/RE/I/IngredientItem.h index 5e8a5213e..f159359e8 100644 --- a/include/RE/I/IngredientItem.h +++ b/include/RE/I/IngredientItem.h @@ -104,6 +104,7 @@ namespace RE bool LearnEffect(EffectSetting* a_effect); std::optional LearnNextEffect(); void LearnAllEffects(); + // members Data data; // 130 - ENIT GameData gamedata; // 138 diff --git a/include/RE/J/Journal_SystemTab.h b/include/RE/J/Journal_SystemTab.h index 53e037cb5..37d8004f6 100644 --- a/include/RE/J/Journal_SystemTab.h +++ b/include/RE/J/Journal_SystemTab.h @@ -19,6 +19,7 @@ namespace RE { public: inline static constexpr auto RTTI = RTTI_Journal_SystemTab; + inline static constexpr auto VTABLE = VTABLE_Journal_SystemTab; ~Journal_SystemTab() override; // 00 diff --git a/include/RE/Offsets.h b/include/RE/Offsets.h index 4b1911300..c81ba6a85 100644 --- a/include/RE/Offsets.h +++ b/include/RE/Offsets.h @@ -473,7 +473,7 @@ namespace RE namespace Script { - inline constexpr REL::ID CompileAndRun(static_cast(21890)); + inline constexpr REL::ID CompileAndRun(static_cast(441582)); inline constexpr REL::ID GetProcessScripts(static_cast(21921)); inline constexpr REL::ID SetProcessScripts(static_cast(21920)); } diff --git a/include/RE/T/TES.h b/include/RE/T/TES.h index 95b913e44..bf122655b 100644 --- a/include/RE/T/TES.h +++ b/include/RE/T/TES.h @@ -114,6 +114,7 @@ namespace RE std::uint8_t unk133; // 133 std::uint32_t unk134; // 134 std::uint64_t unk138; // 138 + std::uint64_t unk140; // 140 - actual offset change is somewhere near showLandBorder TESWorldSpace* worldSpace; // 140 BSSimpleList*> deadCount; // 148 void* unk158; // 158 - smart ptr @@ -160,5 +161,5 @@ namespace RE NavMeshInfoMap* unk2A8; // 2A8 std::uint64_t unk2B0; // 2B0 }; - static_assert(sizeof(TES) == 0x2B8); + static_assert(sizeof(TES) == 0x2C0); } diff --git a/include/RE/T/TESContainer.h b/include/RE/T/TESContainer.h index dcde6eeb1..1a65dcc17 100644 --- a/include/RE/T/TESContainer.h +++ b/include/RE/T/TESContainer.h @@ -63,7 +63,7 @@ namespace RE // members ContainerObject** containerObjects; // 08 std::uint32_t numContainerObjects; // 10 - std::uint32_t pad14; // 14 + bool allowStolenItems; // 14 - new in 1.6.1130 private: void CopyObjectList(const std::vector& a_copiedData); diff --git a/include/RE/U/UserEvents.h b/include/RE/U/UserEvents.h index a42defa7b..6668737e0 100644 --- a/include/RE/U/UserEvents.h +++ b/include/RE/U/UserEvents.h @@ -28,11 +28,12 @@ namespace RE kTFCMode, kMapDebug, kLockpicking, + kMarketplace, kFavor, - kTotal = 17, + kTotal = 18, - kNone = 18 + kNone = 19 }; }; using INPUT_CONTEXT_ID = INPUT_CONTEXT_IDS::INPUT_CONTEXT_ID; diff --git a/include/SKSE/Version.h b/include/SKSE/Version.h index eae7ce46c..7db68d41f 100644 --- a/include/SKSE/Version.h +++ b/include/SKSE/Version.h @@ -29,9 +29,10 @@ namespace SKSE inline constexpr REL::Version RUNTIME_1_6_640(1, 6, 640, 0); inline constexpr REL::Version RUNTIME_1_6_659(1, 6, 659, 0); inline constexpr REL::Version RUNTIME_1_6_678(1, 6, 678, 0); + inline constexpr REL::Version RUNTIME_1_6_1130(1, 6, 1130, 0); #endif #ifdef SKYRIM_SUPPORT_AE - inline constexpr auto RUNTIME_LATEST = RUNTIME_1_6_640; // latest for steam + inline constexpr auto RUNTIME_LATEST = RUNTIME_1_6_1130; // latest for steam #else inline constexpr auto RUNTIME_LATEST = RUNTIME_1_5_97; #endif diff --git a/src/SKSE/Logger.cpp b/src/SKSE/Logger.cpp index 163e3fd7e..206425b2e 100644 --- a/src/SKSE/Logger.cpp +++ b/src/SKSE/Logger.cpp @@ -73,7 +73,7 @@ namespace SKSE std::filesystem::path path = knownPath.get(); path /= "My Games"sv; - path /= *REL::Relocation(RELOCATION_ID(508778, 380738)).get(); + path /= *REL::Relocation(RELOCATION_ID(508778, 502114)).get(); path /= "SKSE"sv; return path; From 4d2b0ec9b9a647c7866ce5b04ec42b2840ec9416 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Wed, 13 Dec 2023 21:24:22 +0530 Subject: [PATCH 06/76] Add 1.5.97 `InterfaceStrings` defs --- include/RE/I/InterfaceStrings.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/RE/I/InterfaceStrings.h b/include/RE/I/InterfaceStrings.h index 82354a4b6..50666b59e 100644 --- a/include/RE/I/InterfaceStrings.h +++ b/include/RE/I/InterfaceStrings.h @@ -65,7 +65,9 @@ namespace RE BSFixedString creditsMenu; // 188 - "Credits Menu" BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" BSFixedString creationClubMenu; // 198 - "Creation Club Menu" +#ifndef SKYRIM_SUPPORT_AE BSFixedString marketplaceMenu; // 1A0 - "Marketplace Menu" +#endif BSFixedString titleSequenceMenu; // 1A8 - "TitleSequence Menu" BSFixedString consoleNativeUIMenu; // 1B0 - "Console Native UI Menu" BSFixedString kinectMenu; // 1B8 - "Kinect Menu" @@ -89,9 +91,15 @@ namespace RE BSFixedString refreshMenu; // 248 - "RefreshMenu" BSFixedString cancelLoading; // 250 - "CancelLoading" BSFixedString menuTextureDegradeEvent; // 258 - "Menu Texture Degrade Event" +#ifndef SKYRIM_SUPPORT_AE BSFixedString userSettingsLoaded; // 260 - "UserSettingsLoaded" BSFixedString activityStarted; // 268 - "ActivityStarted" +#endif BSFixedString diamondMarker; // 270 - "" }; +#ifndef SKYRIM_SUPPORT_AE static_assert(sizeof(InterfaceStrings) == 0x278); +#else + static_assert(sizeof(InterfaceStrings) == 0x260); +#endif } From 839607a7f5e5a1156b694ae9ad10b66a95cc52d5 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Wed, 13 Dec 2023 15:54:48 +0000 Subject: [PATCH 07/76] maintenance --- include/RE/I/InterfaceStrings.h | 116 ++++++++++++++++---------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/include/RE/I/InterfaceStrings.h b/include/RE/I/InterfaceStrings.h index 50666b59e..e1c1e2907 100644 --- a/include/RE/I/InterfaceStrings.h +++ b/include/RE/I/InterfaceStrings.h @@ -11,62 +11,62 @@ namespace RE static InterfaceStrings* GetSingleton(); // members - std::uint8_t pad001; // 001 - std::uint16_t pad002; // 002 - std::uint32_t pad004; // 004 - BSFixedString faderData; // 008 - "FaderData" - BSFixedString hudData; // 010 - "HUDData" - BSFixedString hudCamData; // 018 - "HUDCamData" - BSFixedString floatingQuestMarkers; // 020 - "FloatingQuestMarkers" - BSFixedString consoleData; // 028 - "ConsoleData" - BSFixedString quantityData; // 030 - "QuantityData" - BSFixedString messageBoxData; // 038 - "MessageBoxData" - BSFixedString bsUIScaleformData; // 040 - "BSUIScaleformData" - BSFixedString bsUIMessageData; // 048 - "BSUIMessageData" - BSFixedString bsUIAnalogData; // 050 - "BSUIAnalogData" - BSFixedString inventoryUpdateData; // 058 - "InventoryUpdateData" - BSFixedString refHandleUIData; // 060 - "RefHandleUIData" - BSFixedString tesFormUIData; // 068 - "TESFormUIData" - BSFixedString loadingMenuData; // 070 - "LoadingMenuData" - BSFixedString kinectStateData; // 078 - "KinectStateChangeData" - BSFixedString kinectUserEventData; // 080 - "KinectUserEventData" - BSFixedString inventoryMenu; // 088 - "InventoryMenu" - BSFixedString console; // 090 - "Console" - BSFixedString dialogueMenu; // 098 - "Dialogue Menu" - BSFixedString hudMenu; // 0A0 - "HUD Menu" - BSFixedString mainMenu; // 0A8 - "Main Menu" - BSFixedString messageBoxMenu; // 0B0 - "MessageBoxMenu" - BSFixedString cursorMenu; // 0B8 - "Cursor Menu" - BSFixedString faderMenu; // 0C0 - "Fader Menu" - BSFixedString magicMenu; // 0C8 - "MagicMenu" - BSFixedString topMenu; // 0D0 - "Top Menu" - BSFixedString overlayMenu; // 0D8 - "Overlay Menu" - BSFixedString overlayInteractionMenu; // 0E0 - "Overlay Interaction Menu" - BSFixedString loadingMenu; // 0E8 - "Loading Menu" - BSFixedString tweenMenu; // 0F0 - "TweenMenu" - BSFixedString barterMenu; // 0F8 - "BarterMenu" - BSFixedString giftMenu; // 100 - "GiftMenu" - BSFixedString debugTextMenu; // 108 - "Debug Text Menu" - BSFixedString mapMenu; // 110 - "MapMenu" - BSFixedString lockpickingMenu; // 118 - "Lockpicking Menu" - BSFixedString quantityMenu; // 120 - "Quantity Menu" - BSFixedString statsMenu; // 128 - "StatsMenu" - BSFixedString containerMenu; // 130 - "ContainerMenu" - BSFixedString sleepWaitMenu; // 138 - "Sleep/Wait Menu" - BSFixedString levelUpMenu; // 140 - "LevelUp Menu" - BSFixedString journalMenu; // 148 - "Journal Menu" - BSFixedString bookMenu; // 150 - "Book Menu" - BSFixedString favoritesMenu; // 158 - "FavoritesMenu" - BSFixedString raceSexMenu; // 160 - "RaceSex Menu" - BSFixedString craftingMenu; // 168 - "Crafting Menu" - BSFixedString trainingMenu; // 170 - "Training Menu" - BSFixedString mistMenu; // 178 - "Mist Menu" - BSFixedString tutorialMenu; // 180 - "Tutorial Menu" - BSFixedString creditsMenu; // 188 - "Credits Menu" - BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" - BSFixedString creationClubMenu; // 198 - "Creation Club Menu" + std::uint8_t pad001; // 001 + std::uint16_t pad002; // 002 + std::uint32_t pad004; // 004 + BSFixedString faderData; // 008 - "FaderData" + BSFixedString hudData; // 010 - "HUDData" + BSFixedString hudCamData; // 018 - "HUDCamData" + BSFixedString floatingQuestMarkers; // 020 - "FloatingQuestMarkers" + BSFixedString consoleData; // 028 - "ConsoleData" + BSFixedString quantityData; // 030 - "QuantityData" + BSFixedString messageBoxData; // 038 - "MessageBoxData" + BSFixedString bsUIScaleformData; // 040 - "BSUIScaleformData" + BSFixedString bsUIMessageData; // 048 - "BSUIMessageData" + BSFixedString bsUIAnalogData; // 050 - "BSUIAnalogData" + BSFixedString inventoryUpdateData; // 058 - "InventoryUpdateData" + BSFixedString refHandleUIData; // 060 - "RefHandleUIData" + BSFixedString tesFormUIData; // 068 - "TESFormUIData" + BSFixedString loadingMenuData; // 070 - "LoadingMenuData" + BSFixedString kinectStateData; // 078 - "KinectStateChangeData" + BSFixedString kinectUserEventData; // 080 - "KinectUserEventData" + BSFixedString inventoryMenu; // 088 - "InventoryMenu" + BSFixedString console; // 090 - "Console" + BSFixedString dialogueMenu; // 098 - "Dialogue Menu" + BSFixedString hudMenu; // 0A0 - "HUD Menu" + BSFixedString mainMenu; // 0A8 - "Main Menu" + BSFixedString messageBoxMenu; // 0B0 - "MessageBoxMenu" + BSFixedString cursorMenu; // 0B8 - "Cursor Menu" + BSFixedString faderMenu; // 0C0 - "Fader Menu" + BSFixedString magicMenu; // 0C8 - "MagicMenu" + BSFixedString topMenu; // 0D0 - "Top Menu" + BSFixedString overlayMenu; // 0D8 - "Overlay Menu" + BSFixedString overlayInteractionMenu; // 0E0 - "Overlay Interaction Menu" + BSFixedString loadingMenu; // 0E8 - "Loading Menu" + BSFixedString tweenMenu; // 0F0 - "TweenMenu" + BSFixedString barterMenu; // 0F8 - "BarterMenu" + BSFixedString giftMenu; // 100 - "GiftMenu" + BSFixedString debugTextMenu; // 108 - "Debug Text Menu" + BSFixedString mapMenu; // 110 - "MapMenu" + BSFixedString lockpickingMenu; // 118 - "Lockpicking Menu" + BSFixedString quantityMenu; // 120 - "Quantity Menu" + BSFixedString statsMenu; // 128 - "StatsMenu" + BSFixedString containerMenu; // 130 - "ContainerMenu" + BSFixedString sleepWaitMenu; // 138 - "Sleep/Wait Menu" + BSFixedString levelUpMenu; // 140 - "LevelUp Menu" + BSFixedString journalMenu; // 148 - "Journal Menu" + BSFixedString bookMenu; // 150 - "Book Menu" + BSFixedString favoritesMenu; // 158 - "FavoritesMenu" + BSFixedString raceSexMenu; // 160 - "RaceSex Menu" + BSFixedString craftingMenu; // 168 - "Crafting Menu" + BSFixedString trainingMenu; // 170 - "Training Menu" + BSFixedString mistMenu; // 178 - "Mist Menu" + BSFixedString tutorialMenu; // 180 - "Tutorial Menu" + BSFixedString creditsMenu; // 188 - "Credits Menu" + BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" + BSFixedString creationClubMenu; // 198 - "Creation Club Menu" #ifndef SKYRIM_SUPPORT_AE - BSFixedString marketplaceMenu; // 1A0 - "Marketplace Menu" + BSFixedString marketplaceMenu; // 1A0 - "Marketplace Menu" #endif BSFixedString titleSequenceMenu; // 1A8 - "TitleSequence Menu" BSFixedString consoleNativeUIMenu; // 1B0 - "Console Native UI Menu" @@ -92,10 +92,10 @@ namespace RE BSFixedString cancelLoading; // 250 - "CancelLoading" BSFixedString menuTextureDegradeEvent; // 258 - "Menu Texture Degrade Event" #ifndef SKYRIM_SUPPORT_AE - BSFixedString userSettingsLoaded; // 260 - "UserSettingsLoaded" - BSFixedString activityStarted; // 268 - "ActivityStarted" + BSFixedString userSettingsLoaded; // 260 - "UserSettingsLoaded" + BSFixedString activityStarted; // 268 - "ActivityStarted" #endif - BSFixedString diamondMarker; // 270 - "" + BSFixedString diamondMarker; // 270 - "" }; #ifndef SKYRIM_SUPPORT_AE static_assert(sizeof(InterfaceStrings) == 0x278); From e9844f81f3a23bd258d6927558352ff3510d90f9 Mon Sep 17 00:00:00 2001 From: Spectral Platypus Date: Wed, 13 Dec 2023 16:05:09 -0500 Subject: [PATCH 08/76] Console updates for 1130 --- include/RE/C/Console.h | 8 +++++++- include/RE/Offsets.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/RE/C/Console.h b/include/RE/C/Console.h index 643b5ee9c..8f441a664 100644 --- a/include/RE/C/Console.h +++ b/include/RE/C/Console.h @@ -35,10 +35,16 @@ namespace RE std::uint64_t unk38; // 38 std::uint64_t unk40; // 40 std::uint64_t unk48; // 48 - std::uint64_t unk50; // 50 +#ifndef SKYRIM_SUPPORT_AE + std::uint64_t unk50; // 50 +#endif protected: void SetSelectedRef_Impl(ObjectRefHandle& a_handle); }; +#ifdef SKYRIM_SUPPORT_AE + static_assert(sizeof(Console) == 0x50); +#else static_assert(sizeof(Console) == 0x58); +#endif } diff --git a/include/RE/Offsets.h b/include/RE/Offsets.h index c81ba6a85..894d1d45f 100644 --- a/include/RE/Offsets.h +++ b/include/RE/Offsets.h @@ -171,7 +171,7 @@ namespace RE namespace Console { - inline constexpr REL::ID SelectedRef(static_cast(405935)); + inline constexpr REL::ID SelectedRef(static_cast(504099)); inline constexpr REL::ID SetSelectedRef(static_cast(51093)); } From 415679b2586a07499ef03e2899fbef790eca187d Mon Sep 17 00:00:00 2001 From: Spectral Platypus Date: Wed, 13 Dec 2023 16:21:27 -0500 Subject: [PATCH 09/76] Console class layout changes --- include/RE/C/Console.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/RE/C/Console.h b/include/RE/C/Console.h index 8f441a664..459448348 100644 --- a/include/RE/C/Console.h +++ b/include/RE/C/Console.h @@ -34,8 +34,13 @@ namespace RE void* opcode; // 30 std::uint64_t unk38; // 38 std::uint64_t unk40; // 40 - std::uint64_t unk48; // 48 -#ifndef SKYRIM_SUPPORT_AE +#ifdef SKYRIM_SUPPORT_AE + std::uint32_t unk48; // 48 + std::uint16_t unk4c; // 4c + bool ctrlKeyHeld; // 4e + std::uint8_t pad4f; // 4f +#else + std::uint64_t unk48; // 48 std::uint64_t unk50; // 50 #endif From 89866e08ee8e9db109ed1a0520f4a6d530fd6447 Mon Sep 17 00:00:00 2001 From: SpectralPlatypus Date: Wed, 13 Dec 2023 21:21:50 +0000 Subject: [PATCH 10/76] maintenance --- include/RE/C/Console.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/RE/C/Console.h b/include/RE/C/Console.h index 459448348..025183819 100644 --- a/include/RE/C/Console.h +++ b/include/RE/C/Console.h @@ -35,8 +35,8 @@ namespace RE std::uint64_t unk38; // 38 std::uint64_t unk40; // 40 #ifdef SKYRIM_SUPPORT_AE - std::uint32_t unk48; // 48 - std::uint16_t unk4c; // 4c + std::uint32_t unk48; // 48 + std::uint16_t unk4c; // 4c bool ctrlKeyHeld; // 4e std::uint8_t pad4f; // 4f #else From bf4c25a8300bb887cf8fa2c8b095bf5d2091e6ed Mon Sep 17 00:00:00 2001 From: Spectral Platypus Date: Wed, 13 Dec 2023 16:23:49 -0500 Subject: [PATCH 11/76] Forgot to save before pushing --- include/RE/C/Console.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/RE/C/Console.h b/include/RE/C/Console.h index 025183819..85e5a0384 100644 --- a/include/RE/C/Console.h +++ b/include/RE/C/Console.h @@ -35,10 +35,11 @@ namespace RE std::uint64_t unk38; // 38 std::uint64_t unk40; // 40 #ifdef SKYRIM_SUPPORT_AE - std::uint32_t unk48; // 48 - std::uint16_t unk4c; // 4c - bool ctrlKeyHeld; // 4e - std::uint8_t pad4f; // 4f + std::uint32_t unk48; // 48 + std::uint8_t unk4c; // 4c + bool showAchievementWarning; // 4d -- only used in ctor + bool ctrlKeyHeld; // 4e + std::uint8_t pad4f; // 4f #else std::uint64_t unk48; // 48 std::uint64_t unk50; // 50 From 6927cc789c1bd08b0f6f2dd5b6da7aa19ada920c Mon Sep 17 00:00:00 2001 From: SpectralPlatypus Date: Wed, 13 Dec 2023 21:25:04 +0000 Subject: [PATCH 12/76] maintenance --- include/RE/C/Console.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/RE/C/Console.h b/include/RE/C/Console.h index 85e5a0384..2c0a19888 100644 --- a/include/RE/C/Console.h +++ b/include/RE/C/Console.h @@ -35,11 +35,11 @@ namespace RE std::uint64_t unk38; // 38 std::uint64_t unk40; // 40 #ifdef SKYRIM_SUPPORT_AE - std::uint32_t unk48; // 48 - std::uint8_t unk4c; // 4c - bool showAchievementWarning; // 4d -- only used in ctor - bool ctrlKeyHeld; // 4e - std::uint8_t pad4f; // 4f + std::uint32_t unk48; // 48 + std::uint8_t unk4c; // 4c + bool showAchievementWarning; // 4d -- only used in ctor + bool ctrlKeyHeld; // 4e + std::uint8_t pad4f; // 4f #else std::uint64_t unk48; // 48 std::uint64_t unk50; // 50 From 74c406e7e9fe3d8cfd29d52e004097adae0160ab Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 16 Dec 2023 16:40:44 +0530 Subject: [PATCH 13/76] ifdef new 1130 changes --- include/RE/B/BGSSaveLoadManager.h | 17 +++++- include/RE/C/ControlMap.h | 4 ++ include/RE/I/InterfaceStrings.h | 6 +- include/RE/T/TES.h | 98 ++++++++++++++++--------------- include/RE/U/UserEvents.h | 6 +- 5 files changed, 77 insertions(+), 54 deletions(-) diff --git a/include/RE/B/BGSSaveLoadManager.h b/include/RE/B/BGSSaveLoadManager.h index 195f3e05e..ec2af5923 100644 --- a/include/RE/B/BGSSaveLoadManager.h +++ b/include/RE/B/BGSSaveLoadManager.h @@ -101,8 +101,7 @@ namespace RE std::uint64_t unk0C0; // 0C0 std::uint64_t unk0C8; // 0C8 std::uint64_t currentPlayerID; // 0D0 - std::uint32_t unk0D8; // 0D8 - std::uint32_t unk0DC; // 0DC + std::uint64_t displayPlayerID; // 0D8 std::uint32_t unk0E0; // 0E0 std::uint32_t unk0E4; // 0E4 BSTArray unk0E8; // 0E8 @@ -175,7 +174,15 @@ namespace RE std::uint32_t unk2A0; // 2A0 std::uint32_t unk2A4; // 2A4 std::uint64_t unk2A8; // 2A8 - Thread unk2B0; // 2B0 +#ifdef SKYRIM_SUPPORT_AE + std::uint16_t unk2B0; // 2B0 + std::uint16_t unk2B2; // 2B2 + std::uint64_t unk2B8; // 2B8 + BSTArray unk2C0; // 2C0 + BSTArray unk2D8; // 2D8 + std::uint8_t unk2F0; // 2F0 +#endif + Thread thread; // 2B0 BSTCommonStaticMessageQueue, 8> unk370; // 370 @@ -183,5 +190,9 @@ namespace RE bool Save_Impl(std::int32_t a_deviceID, std::uint32_t a_outputStats, const char* a_fileName); bool Load_Impl(const char* a_fileName, std::int32_t a_deviceID, std::uint32_t a_outputStats, bool a_checkForMods); }; +#ifdef SKYRIM_SUPPORT_AE + static_assert(sizeof(BGSSaveLoadManager) == 0x418); +#else static_assert(sizeof(BGSSaveLoadManager) == 0x3D0); +#endif } diff --git a/include/RE/C/ControlMap.h b/include/RE/C/ControlMap.h index 635d2b570..39522355e 100644 --- a/include/RE/C/ControlMap.h +++ b/include/RE/C/ControlMap.h @@ -96,5 +96,9 @@ namespace RE std::uint8_t pad123; // 123 stl::enumeration gamePadMapType; // 124 }; +#ifdef SKYRIM_SUPPORT_AE static_assert(sizeof(ControlMap) == 0x130); +#else + static_assert(sizeof(ControlMap) == 0x128); +#endif } diff --git a/include/RE/I/InterfaceStrings.h b/include/RE/I/InterfaceStrings.h index e1c1e2907..23e3847f3 100644 --- a/include/RE/I/InterfaceStrings.h +++ b/include/RE/I/InterfaceStrings.h @@ -65,7 +65,7 @@ namespace RE BSFixedString creditsMenu; // 188 - "Credits Menu" BSFixedString modManagerMenu; // 190 - "Mod Manager Menu" BSFixedString creationClubMenu; // 198 - "Creation Club Menu" -#ifndef SKYRIM_SUPPORT_AE +#ifdef SKYRIM_SUPPORT_AE BSFixedString marketplaceMenu; // 1A0 - "Marketplace Menu" #endif BSFixedString titleSequenceMenu; // 1A8 - "TitleSequence Menu" @@ -91,13 +91,13 @@ namespace RE BSFixedString refreshMenu; // 248 - "RefreshMenu" BSFixedString cancelLoading; // 250 - "CancelLoading" BSFixedString menuTextureDegradeEvent; // 258 - "Menu Texture Degrade Event" -#ifndef SKYRIM_SUPPORT_AE +#ifdef SKYRIM_SUPPORT_AE BSFixedString userSettingsLoaded; // 260 - "UserSettingsLoaded" BSFixedString activityStarted; // 268 - "ActivityStarted" #endif BSFixedString diamondMarker; // 270 - "" }; -#ifndef SKYRIM_SUPPORT_AE +#ifdef SKYRIM_SUPPORT_AE static_assert(sizeof(InterfaceStrings) == 0x278); #else static_assert(sizeof(InterfaceStrings) == 0x260); diff --git a/include/RE/T/TES.h b/include/RE/T/TES.h index bf122655b..75bbf3b73 100644 --- a/include/RE/T/TES.h +++ b/include/RE/T/TES.h @@ -114,52 +114,58 @@ namespace RE std::uint8_t unk133; // 133 std::uint32_t unk134; // 134 std::uint64_t unk138; // 138 - std::uint64_t unk140; // 140 - actual offset change is somewhere near showLandBorder - TESWorldSpace* worldSpace; // 140 - BSSimpleList*> deadCount; // 148 - void* unk158; // 158 - smart ptr - void* unk160; // 160 - smart ptr - void* unk168; // 168 - smart ptr - void* unk170; // 170 - smart ptr - std::uint64_t unk178; // 178 - std::uint64_t unk180; // 180 - std::uint64_t unk188; // 188 - std::uint64_t unk190; // 190 - std::uint64_t unk198; // 198 - std::uint64_t unk1A0; // 1A0 - std::uint64_t unk1A8; // 1A8 - std::uint64_t unk1B0; // 1B0 - std::uint64_t unk1B8; // 1B8 - std::uint64_t unk1C0; // 1C0 - std::uint64_t unk1C8; // 1C8 - std::uint64_t unk1D0; // 1D0 - std::uint64_t unk1D8; // 1D8 - std::uint64_t unk1E0; // 1E0 - std::uint64_t unk1E8; // 1E8 - std::uint64_t unk1F0; // 1F0 - std::uint64_t unk1F8; // 1F8 - std::uint64_t unk200; // 200 - std::uint64_t unk208; // 208 - std::uint64_t unk210; // 210 - std::uint64_t unk218; // 218 - std::uint64_t unk220; // 220 - std::uint64_t unk228; // 228 - std::uint64_t unk230; // 230 - std::uint64_t unk238; // 238 - std::uint64_t unk240; // 240 - std::uint64_t unk248; // 248 - std::uint64_t unk250; // 250 - std::uint64_t unk258; // 258 - std::uint64_t unk260; // 260 - std::uint64_t unk268; // 268 - std::uint64_t unk270; // 270 - std::uint64_t unk278; // 278 - std::uint64_t unk280; // 280 - std::uint64_t unk288; // 288 - SystemEventAdapter unk290; // 290 - std::uint64_t unk2A0; // 2A0 - NavMeshInfoMap* unk2A8; // 2A8 - std::uint64_t unk2B0; // 2B0 +#ifdef SKYRIM_SUPPORT_AE + std::uint64_t unk140; // 140 - actual offset change is somewhere near showLandBorder +#endif + TESWorldSpace* worldSpace; // 140 + BSSimpleList*> deadCount; // 148 + void* unk158; // 158 - smart ptr + void* unk160; // 160 - smart ptr + void* unk168; // 168 - smart ptr + void* unk170; // 170 - smart ptr + std::uint64_t unk178; // 178 + std::uint64_t unk180; // 180 + std::uint64_t unk188; // 188 + std::uint64_t unk190; // 190 + std::uint64_t unk198; // 198 + std::uint64_t unk1A0; // 1A0 + std::uint64_t unk1A8; // 1A8 + std::uint64_t unk1B0; // 1B0 + std::uint64_t unk1B8; // 1B8 + std::uint64_t unk1C0; // 1C0 + std::uint64_t unk1C8; // 1C8 + std::uint64_t unk1D0; // 1D0 + std::uint64_t unk1D8; // 1D8 + std::uint64_t unk1E0; // 1E0 + std::uint64_t unk1E8; // 1E8 + std::uint64_t unk1F0; // 1F0 + std::uint64_t unk1F8; // 1F8 + std::uint64_t unk200; // 200 + std::uint64_t unk208; // 208 + std::uint64_t unk210; // 210 + std::uint64_t unk218; // 218 + std::uint64_t unk220; // 220 + std::uint64_t unk228; // 228 + std::uint64_t unk230; // 230 + std::uint64_t unk238; // 238 + std::uint64_t unk240; // 240 + std::uint64_t unk248; // 248 + std::uint64_t unk250; // 250 + std::uint64_t unk258; // 258 + std::uint64_t unk260; // 260 + std::uint64_t unk268; // 268 + std::uint64_t unk270; // 270 + std::uint64_t unk278; // 278 + std::uint64_t unk280; // 280 + std::uint64_t unk288; // 288 + SystemEventAdapter unk290; // 290 + std::uint64_t unk2A0; // 2A0 + NavMeshInfoMap* unk2A8; // 2A8 + std::uint64_t unk2B0; // 2B0 }; +#ifdef SKYRIM_SUPPORT_AE static_assert(sizeof(TES) == 0x2C0); +#else + static_assert(sizeof(TES) == 0x2B8); +#endif } diff --git a/include/RE/U/UserEvents.h b/include/RE/U/UserEvents.h index 6668737e0..e6df20b29 100644 --- a/include/RE/U/UserEvents.h +++ b/include/RE/U/UserEvents.h @@ -28,12 +28,14 @@ namespace RE kTFCMode, kMapDebug, kLockpicking, +#ifdef SKYRIM_SUPPORT_AE kMarketplace, +#endif kFavor, - kTotal = 18, + kTotal, - kNone = 19 + kNone }; }; using INPUT_CONTEXT_ID = INPUT_CONTEXT_IDS::INPUT_CONTEXT_ID; From aec5f9b5c5839fdb0241b1b06076fa85fbfd4678 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 16 Dec 2023 17:00:10 +0530 Subject: [PATCH 14/76] Fix logger directory so it isn't 1130 exclusive --- src/SKSE/Logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SKSE/Logger.cpp b/src/SKSE/Logger.cpp index 206425b2e..c212b95d6 100644 --- a/src/SKSE/Logger.cpp +++ b/src/SKSE/Logger.cpp @@ -73,7 +73,7 @@ namespace SKSE std::filesystem::path path = knownPath.get(); path /= "My Games"sv; - path /= *REL::Relocation(RELOCATION_ID(508778, 502114)).get(); + path /= std::filesystem::exists("steam_api64.dll") ? "Skyrim Special Edition" : "Skyrim Special Edition GOG"; path /= "SKSE"sv; return path; From d6f734cf4e0ec105316792664907c8c865528086 Mon Sep 17 00:00:00 2001 From: Spectral Platypus Date: Sat, 16 Dec 2023 14:12:12 -0500 Subject: [PATCH 15/76] Toggle Border changes AE --- include/RE/T/TES.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/include/RE/T/TES.h b/include/RE/T/TES.h index 75bbf3b73..16cf140c9 100644 --- a/include/RE/T/TES.h +++ b/include/RE/T/TES.h @@ -101,17 +101,23 @@ namespace RE BSSimpleList> activeImageSpaceModifiers; // 108 std::uint64_t unk118; // 118 std::uint64_t unk120; // 120 +#ifdef SKYRIM_SUPPORT_AE + std::uint32_t unk128; // 128 + std::uint32_t landBorderMode; // 12C + std::uint32_t borderColorAGBR; // 130 +#else std::uint8_t unk128; // 128 bool showLANDborders; // 129 std::uint8_t unk12A; // 12A - std::uint8_t unk12B; // 12B - std::uint8_t unk12C; // 12C - std::uint8_t unk12D; // 12D - std::uint8_t unk12E; // 12E - std::uint8_t unk12F; // 12F - std::uint16_t unk130; // 130 - std::uint8_t unk132; // 132 - std::uint8_t unk133; // 133 + std::uint8_t unk12B; // 12B + std::uint8_t unk12C; // 12C + std::uint8_t unk12D; // 12D + std::uint8_t unk12E; // 12E + std::uint8_t unk12F; // 12F + std::uint16_t unk130; // 130 + std::uint8_t unk132; // 132 + std::uint8_t unk133; // 133 +#endif std::uint32_t unk134; // 134 std::uint64_t unk138; // 138 #ifdef SKYRIM_SUPPORT_AE From 33b7008c24874f07952b431713806f232a187f95 Mon Sep 17 00:00:00 2001 From: SpectralPlatypus Date: Sat, 16 Dec 2023 19:12:42 +0000 Subject: [PATCH 16/76] maintenance --- include/RE/T/TES.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/RE/T/TES.h b/include/RE/T/TES.h index 16cf140c9..73387d824 100644 --- a/include/RE/T/TES.h +++ b/include/RE/T/TES.h @@ -102,24 +102,24 @@ namespace RE std::uint64_t unk118; // 118 std::uint64_t unk120; // 120 #ifdef SKYRIM_SUPPORT_AE - std::uint32_t unk128; // 128 - std::uint32_t landBorderMode; // 12C - std::uint32_t borderColorAGBR; // 130 + std::uint32_t unk128; // 128 + std::uint32_t landBorderMode; // 12C + std::uint32_t borderColorAGBR; // 130 #else - std::uint8_t unk128; // 128 - bool showLANDborders; // 129 - std::uint8_t unk12A; // 12A - std::uint8_t unk12B; // 12B - std::uint8_t unk12C; // 12C - std::uint8_t unk12D; // 12D - std::uint8_t unk12E; // 12E - std::uint8_t unk12F; // 12F - std::uint16_t unk130; // 130 - std::uint8_t unk132; // 132 - std::uint8_t unk133; // 133 + std::uint8_t unk128; // 128 + bool showLANDborders; // 129 + std::uint8_t unk12A; // 12A + std::uint8_t unk12B; // 12B + std::uint8_t unk12C; // 12C + std::uint8_t unk12D; // 12D + std::uint8_t unk12E; // 12E + std::uint8_t unk12F; // 12F + std::uint16_t unk130; // 130 + std::uint8_t unk132; // 132 + std::uint8_t unk133; // 133 #endif - std::uint32_t unk134; // 134 - std::uint64_t unk138; // 138 + std::uint32_t unk134; // 134 + std::uint64_t unk138; // 138 #ifdef SKYRIM_SUPPORT_AE std::uint64_t unk140; // 140 - actual offset change is somewhere near showLandBorder #endif From 80a2384b74044ba69fe859c6ca4b9f890e154b83 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Mon, 4 Dec 2023 06:00:11 -0600 Subject: [PATCH 17/76] Add RE::BGSEntryPointFunctionDataSpellItem Needed for complete implementation of perkentry point patch in Scrambled Bugs port --- .../RE/B/BGSEntryPointFunctionDataSpellItem.h | 25 +++++++++++++++++++ include/RE/Skyrim.h | 1 + 2 files changed, 26 insertions(+) create mode 100644 include/RE/B/BGSEntryPointFunctionDataSpellItem.h diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h new file mode 100644 index 000000000..9a8401af9 --- /dev/null +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -0,0 +1,25 @@ +#pragma once + +#include "RE/B/BGSEntryPointFunctionData.h" + +namespace RE +{ + class SpellItem; + + class BGSEntryPointFunctionDataSpellItem : public BGSEntryPointFunctionData + { + public: + // Override + virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 + + // Override (BGSEntryPointFunctionData) + [[nodiscard]] virtual ENTRY_POINT_FUNCTION_DATA GetType() const override; // 1 + virtual bool LoadImpl(TESFile* a_mod) override; // 2 + virtual void InitItem(TESForm* a_form) override; // 3 + + // Member variables + SpellItem* spell; // 8 + }; + static_assert(offsetof(BGSEntryPointFunctionDataSpellItem, spell) == 0x8); + static_assert(sizeof(BGSEntryPointFunctionDataSpellItem) == 0x10); +} diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 6e0bddf22..8cc917b0e 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -98,6 +98,7 @@ #include "RE/B/BGSEntryPointFunctionData.h" #include "RE/B/BGSEntryPointFunctionDataActivateChoice.h" #include "RE/B/BGSEntryPointFunctionDataOneValue.h" +#include "RE/B/BGSEntryPointFunctionDataSpellItem.h" #include "RE/B/BGSEntryPointFunctionDataText.h" #include "RE/B/BGSEntryPointPerkEntry.h" #include "RE/B/BGSEquipSlot.h" From 66932455ca768f91e58c3f2474587df36807066d Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Thu, 14 Dec 2023 02:58:43 -0600 Subject: [PATCH 18/76] Add RE for FindMaxMagnitudeVisitor --- cmake/sourcelist.cmake | 2 ++ include/RE/F/FindMaxMagnitudeVisitor.h | 28 ++++++++++++++++++++++++++ include/RE/Skyrim.h | 1 + src/RE/F/FindMaxMagnitudeVisitor.cpp | 13 ++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 include/RE/F/FindMaxMagnitudeVisitor.h create mode 100644 src/RE/F/FindMaxMagnitudeVisitor.cpp diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 88c09ccb5..355fa6dfc 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -709,6 +709,7 @@ set(SOURCES include/RE/F/FavoritesMenu.h include/RE/F/FightReactions.h include/RE/F/FileID.h + include/RE/F/FindMaxMagnitudeVisitor.h include/RE/F/FirstPersonState.h include/RE/F/FixedStrings.h include/RE/F/FlameProjectile.h @@ -1754,6 +1755,7 @@ set(SOURCES src/RE/E/ExtraSoul.cpp src/RE/E/ExtraTextDisplayData.cpp src/RE/E/ExtraUniqueID.cpp + src/RE/F/FindMaxMagnitudeVisitor.cpp src/RE/F/FormTypes.cpp src/RE/F/FxDelegate.cpp src/RE/F/FxDelegateArgs.cpp diff --git a/include/RE/F/FindMaxMagnitudeVisitor.h b/include/RE/F/FindMaxMagnitudeVisitor.h new file mode 100644 index 000000000..d4692f2c4 --- /dev/null +++ b/include/RE/F/FindMaxMagnitudeVisitor.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/M/MagicTarget.h" + +namespace RE +{ + class ActiveEffect; + + class FindMaxMagnitudeVisitor : + public MagicTarget::ForEachActiveEffectVisitor + { + public: + inline static constexpr auto RTTI = RTTI_FindMaxMagnitudeVisitor; + inline static constexpr auto VTABLE = VTABLE_FindMaxMagnitudeVisitor; + + virtual ~FindMaxMagnitudeVisitor(){}; // 00 + + // add + virtual BSContainer::ForEachResult Accept(ActiveEffect* a_effect) override; // 01 + + // Member variables + ActiveEffect* activeEffect{ nullptr }; // 8 + float maxMagnitude{ -1.0F }; // 10 + }; + static_assert(sizeof(FindMaxMagnitudeVisitor) == 0x18); + + +} // namespace RE diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 8cc917b0e..2f57d7c90 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -712,6 +712,7 @@ #include "RE/F/FavoritesMenu.h" #include "RE/F/FightReactions.h" #include "RE/F/FileID.h" +#include "RE/F/FindMaxMagnitudeVisitor.h" #include "RE/F/FirstPersonState.h" #include "RE/F/FixedStrings.h" #include "RE/F/FlameProjectile.h" diff --git a/src/RE/F/FindMaxMagnitudeVisitor.cpp b/src/RE/F/FindMaxMagnitudeVisitor.cpp new file mode 100644 index 000000000..a54740349 --- /dev/null +++ b/src/RE/F/FindMaxMagnitudeVisitor.cpp @@ -0,0 +1,13 @@ +#pragma once + +#include "RE/F/FindMaxMagnitudeVisitor.h" + +namespace RE +{ + BSContainer::ForEachResult FindMaxMagnitudeVisitor::Accept(ActiveEffect* a_effect) + { + using func_t = decltype(&FindMaxMagnitudeVisitor::Accept); + REL::Relocation func{ reinterpret_cast(RELOCATION_ID(257550, 205805).address())[0x1] }; // AE address/ID untested + return func(this, a_effect); + } +} // namespace RE From 27db265efc034365dc82ef03c16bee76253cd975 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Thu, 14 Dec 2023 03:24:52 -0600 Subject: [PATCH 19/76] Add missed sourcelist.cmake line from prior RE --- cmake/sourcelist.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 355fa6dfc..f95c17a30 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -95,6 +95,7 @@ set(SOURCES include/RE/B/BGSEntryPointFunctionData.h include/RE/B/BGSEntryPointFunctionDataActivateChoice.h include/RE/B/BGSEntryPointFunctionDataOneValue.h + include/RE/B/BGSEntryPointFunctionDataSpellItem.h include/RE/B/BGSEntryPointFunctionDataText.h include/RE/B/BGSEntryPointPerkEntry.h include/RE/B/BGSEquipSlot.h From 5011d573c04d2253c47dc18f6e00c99191e7c5f8 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Thu, 14 Dec 2023 23:50:17 -0600 Subject: [PATCH 20/76] Label maximumWardPower for RE::MiddleHighProcessData --- include/RE/M/MiddleHighProcessData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/M/MiddleHighProcessData.h b/include/RE/M/MiddleHighProcessData.h index ffcf6316b..dd1be6302 100644 --- a/include/RE/M/MiddleHighProcessData.h +++ b/include/RE/M/MiddleHighProcessData.h @@ -199,7 +199,7 @@ namespace RE float unk2B0; // 2B0 float bleedoutRate; // 2B4 float unk2B8; // 2B8 - float unk2BC; // 2BC + float maximumWardPower; // 2BC float unk2C0; // 2C0 float torchEvaluationTimer; // 2C4 float alphaMult; // 2C8 From faeb437b11b7a5b7d82811be972a6f543d930167 Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Tue, 19 Dec 2023 11:46:53 -0600 Subject: [PATCH 21/76] Add RTTI and VTABLE variables to BGSEntryPointFunctionDataSpellItem --- include/RE/B/BGSEntryPointFunctionDataSpellItem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h index 9a8401af9..df1206587 100644 --- a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -9,6 +9,8 @@ namespace RE class BGSEntryPointFunctionDataSpellItem : public BGSEntryPointFunctionData { public: + inline static constexpr auto RTTI = RTTI_BGSEntryPointFunctionDataSpellItem; + inline static constexpr auto VTABLE = VTABLE_BGSEntryPointFunctionDataSpellItem; // Override virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 From c627db459065d47bd3f369aad3d5356975afb69f Mon Sep 17 00:00:00 2001 From: RafearTheModder Date: Tue, 19 Dec 2023 11:50:34 -0600 Subject: [PATCH 22/76] Adapt BGSEntryPointFunctionDataSpellItem to PO3 branch version of BGSEntryPointFunctionData instead of Alandtse branch version --- include/RE/B/BGSEntryPointFunctionDataSpellItem.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h index df1206587..1eaf64c16 100644 --- a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -15,9 +15,9 @@ namespace RE virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 // Override (BGSEntryPointFunctionData) - [[nodiscard]] virtual ENTRY_POINT_FUNCTION_DATA GetType() const override; // 1 - virtual bool LoadImpl(TESFile* a_mod) override; // 2 - virtual void InitItem(TESForm* a_form) override; // 3 + [[nodiscard]] virtual FunctionType GetType() const override; // 1 + virtual bool LoadFunctionData(TESFile* a_mod) override; // 2 + virtual void ResolveForms(TESFile* a_form) override; // 3 // Member variables SpellItem* spell; // 8 From 195851e84593777122249a8ea2ee86fe472cf91e Mon Sep 17 00:00:00 2001 From: powerof3 Date: Wed, 20 Dec 2023 02:16:06 +0000 Subject: [PATCH 23/76] maintenance --- .../RE/B/BGSEntryPointFunctionDataSpellItem.h | 10 +++--- include/RE/F/FindMaxMagnitudeVisitor.h | 33 +++++++++---------- src/RE/F/FindMaxMagnitudeVisitor.cpp | 10 +++--- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h index 1eaf64c16..71bc76dd7 100644 --- a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -12,15 +12,15 @@ namespace RE inline static constexpr auto RTTI = RTTI_BGSEntryPointFunctionDataSpellItem; inline static constexpr auto VTABLE = VTABLE_BGSEntryPointFunctionDataSpellItem; // Override - virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 + virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 // Override (BGSEntryPointFunctionData) - [[nodiscard]] virtual FunctionType GetType() const override; // 1 - virtual bool LoadFunctionData(TESFile* a_mod) override; // 2 - virtual void ResolveForms(TESFile* a_form) override; // 3 + [[nodiscard]] virtual FunctionType GetType() const override; // 1 + virtual bool LoadFunctionData(TESFile* a_mod) override; // 2 + virtual void ResolveForms(TESFile* a_form) override; // 3 // Member variables - SpellItem* spell; // 8 + SpellItem* spell; // 8 }; static_assert(offsetof(BGSEntryPointFunctionDataSpellItem, spell) == 0x8); static_assert(sizeof(BGSEntryPointFunctionDataSpellItem) == 0x10); diff --git a/include/RE/F/FindMaxMagnitudeVisitor.h b/include/RE/F/FindMaxMagnitudeVisitor.h index d4692f2c4..ea967a24d 100644 --- a/include/RE/F/FindMaxMagnitudeVisitor.h +++ b/include/RE/F/FindMaxMagnitudeVisitor.h @@ -4,25 +4,24 @@ namespace RE { - class ActiveEffect; + class ActiveEffect; - class FindMaxMagnitudeVisitor : - public MagicTarget::ForEachActiveEffectVisitor - { - public: - inline static constexpr auto RTTI = RTTI_FindMaxMagnitudeVisitor; - inline static constexpr auto VTABLE = VTABLE_FindMaxMagnitudeVisitor; + class FindMaxMagnitudeVisitor : + public MagicTarget::ForEachActiveEffectVisitor + { + public: + inline static constexpr auto RTTI = RTTI_FindMaxMagnitudeVisitor; + inline static constexpr auto VTABLE = VTABLE_FindMaxMagnitudeVisitor; - virtual ~FindMaxMagnitudeVisitor(){}; // 00 + virtual ~FindMaxMagnitudeVisitor(){}; // 00 - // add - virtual BSContainer::ForEachResult Accept(ActiveEffect* a_effect) override; // 01 + // add + virtual BSContainer::ForEachResult Accept(ActiveEffect* a_effect) override; // 01 // Member variables - ActiveEffect* activeEffect{ nullptr }; // 8 - float maxMagnitude{ -1.0F }; // 10 - }; - static_assert(sizeof(FindMaxMagnitudeVisitor) == 0x18); - - -} // namespace RE + ActiveEffect* activeEffect{ nullptr }; // 8 + float maxMagnitude{ -1.0F }; // 10 + }; + static_assert(sizeof(FindMaxMagnitudeVisitor) == 0x18); + +} // namespace RE diff --git a/src/RE/F/FindMaxMagnitudeVisitor.cpp b/src/RE/F/FindMaxMagnitudeVisitor.cpp index a54740349..be9dd52ce 100644 --- a/src/RE/F/FindMaxMagnitudeVisitor.cpp +++ b/src/RE/F/FindMaxMagnitudeVisitor.cpp @@ -4,10 +4,10 @@ namespace RE { - BSContainer::ForEachResult FindMaxMagnitudeVisitor::Accept(ActiveEffect* a_effect) - { + BSContainer::ForEachResult FindMaxMagnitudeVisitor::Accept(ActiveEffect* a_effect) + { using func_t = decltype(&FindMaxMagnitudeVisitor::Accept); - REL::Relocation func{ reinterpret_cast(RELOCATION_ID(257550, 205805).address())[0x1] }; // AE address/ID untested + REL::Relocation func{ reinterpret_cast(RELOCATION_ID(257550, 205805).address())[0x1] }; // AE address/ID untested return func(this, a_effect); - } -} // namespace RE + } +} // namespace RE From 509842b41661492ce0bcef9516e5af85e7bd8e3b Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Wed, 20 Dec 2023 07:50:43 +0530 Subject: [PATCH 24/76] cleanup --- include/RE/B/BGSEntryPointFunctionDataSpellItem.h | 13 +++++++------ include/RE/F/FindMaxMagnitudeVisitor.h | 11 +++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h index 71bc76dd7..6f426e617 100644 --- a/include/RE/B/BGSEntryPointFunctionDataSpellItem.h +++ b/include/RE/B/BGSEntryPointFunctionDataSpellItem.h @@ -11,13 +11,14 @@ namespace RE public: inline static constexpr auto RTTI = RTTI_BGSEntryPointFunctionDataSpellItem; inline static constexpr auto VTABLE = VTABLE_BGSEntryPointFunctionDataSpellItem; - // Override - virtual ~BGSEntryPointFunctionDataSpellItem() override; // 0 - // Override (BGSEntryPointFunctionData) - [[nodiscard]] virtual FunctionType GetType() const override; // 1 - virtual bool LoadFunctionData(TESFile* a_mod) override; // 2 - virtual void ResolveForms(TESFile* a_form) override; // 3 + // override + ~BGSEntryPointFunctionDataSpellItem() override; // 0 + + // override (BGSEntryPointFunctionData) + [[nodiscard]] FunctionType GetType() const override; // 01 + bool LoadFunctionData(TESFile* a_mod) override; // 02 + void ResolveForms(TESFile* a_form) override; // 03 // Member variables SpellItem* spell; // 8 diff --git a/include/RE/F/FindMaxMagnitudeVisitor.h b/include/RE/F/FindMaxMagnitudeVisitor.h index ea967a24d..1c001f690 100644 --- a/include/RE/F/FindMaxMagnitudeVisitor.h +++ b/include/RE/F/FindMaxMagnitudeVisitor.h @@ -6,22 +6,21 @@ namespace RE { class ActiveEffect; - class FindMaxMagnitudeVisitor : - public MagicTarget::ForEachActiveEffectVisitor + class FindMaxMagnitudeVisitor : public MagicTarget::ForEachActiveEffectVisitor { public: inline static constexpr auto RTTI = RTTI_FindMaxMagnitudeVisitor; inline static constexpr auto VTABLE = VTABLE_FindMaxMagnitudeVisitor; - virtual ~FindMaxMagnitudeVisitor(){}; // 00 + ~FindMaxMagnitudeVisitor() override = default; // 00 // add virtual BSContainer::ForEachResult Accept(ActiveEffect* a_effect) override; // 01 - // Member variables - ActiveEffect* activeEffect{ nullptr }; // 8 + // members + ActiveEffect* activeEffect{ nullptr }; // 08 float maxMagnitude{ -1.0F }; // 10 }; static_assert(sizeof(FindMaxMagnitudeVisitor) == 0x18); -} // namespace RE +} From 23b4c49d95e92d9ee7c0e84c5e3d756b800f0611 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Wed, 20 Dec 2023 02:21:03 +0000 Subject: [PATCH 25/76] maintenance --- include/RE/F/FindMaxMagnitudeVisitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/F/FindMaxMagnitudeVisitor.h b/include/RE/F/FindMaxMagnitudeVisitor.h index 1c001f690..e1b08bb49 100644 --- a/include/RE/F/FindMaxMagnitudeVisitor.h +++ b/include/RE/F/FindMaxMagnitudeVisitor.h @@ -12,7 +12,7 @@ namespace RE inline static constexpr auto RTTI = RTTI_FindMaxMagnitudeVisitor; inline static constexpr auto VTABLE = VTABLE_FindMaxMagnitudeVisitor; - ~FindMaxMagnitudeVisitor() override = default; // 00 + ~FindMaxMagnitudeVisitor() override = default; // 00 // add virtual BSContainer::ForEachResult Accept(ActiveEffect* a_effect) override; // 01 From f63f0f2a9f008fc7a42b0a981855c112194a0308 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 31 Dec 2023 17:07:34 -0600 Subject: [PATCH 26/76] Remove boost --- CMakeLists.txt | 3 --- README.md | 2 -- cmake/config.cmake.in | 1 - include/RE/B/BSTHashMap.h | 37 ++++++++++++++++++------------------- include/SKSE/Impl/PCH.h | 1 - vcpkg.json | 1 - 6 files changed, 18 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a1852c05..1a08923da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,6 @@ if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") endif() find_package(binary_io REQUIRED CONFIG) -find_package(Boost MODULE REQUIRED) find_package(spdlog REQUIRED CONFIG) include(cmake/sourcelist.cmake) @@ -38,7 +37,6 @@ add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") target_compile_definitions( "${PROJECT_NAME}" PUBLIC - BOOST_STL_INTERFACES_DISABLE_CONCEPTS WINVER=0x0601 # windows 7, minimum supported version by skyrim special edition _WIN32_WINNT=0x0601 "$<$:SKSE_SUPPORT_XBYAK=1>" @@ -95,7 +93,6 @@ target_link_libraries( "${PROJECT_NAME}" PUBLIC binary_io::binary_io - Boost::headers spdlog::spdlog Version.lib ) diff --git a/README.md b/README.md index 759cc741c..ed3755510 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ ## Build Dependencies -* [Boost](https://www.boost.org/) - * Stl_interfaces * [spdlog](https://github.com/gabime/spdlog) * [Visual Studio Community 2019 16.10.0 Preview 3.0](https://visualstudio.microsoft.com/vs/preview/) * Desktop development with C++ diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in index 64a949649..ffecc2033 100644 --- a/cmake/config.cmake.in +++ b/cmake/config.cmake.in @@ -2,5 +2,4 @@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") include(CMakeFindDependencyMacro) find_dependency(binary_io CONFIG) -find_dependency(Boost MODULE) find_dependency(spdlog CONFIG) diff --git a/include/RE/B/BSTHashMap.h b/include/RE/B/BSTHashMap.h index 323317e6a..1059802ec 100644 --- a/include/RE/B/BSTHashMap.h +++ b/include/RE/B/BSTHashMap.h @@ -113,25 +113,14 @@ namespace RE }; template - class iterator_base : - public boost::stl_interfaces::iterator_interface< - iterator_base, - std::forward_iterator_tag, - U> + class iterator_base { - private: - using super = - boost::stl_interfaces::iterator_interface< - iterator_base, - std::forward_iterator_tag, - U>; - public: - using difference_type = typename super::difference_type; - using value_type = typename super::value_type; - using pointer = typename super::pointer; - using reference = typename super::reference; - using iterator_category = typename super::iterator_category; + 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::forward_iterator_tag; iterator_base() = default; ~iterator_base() = default; @@ -176,7 +165,17 @@ namespace RE return *this; } - using super::operator++; + iterator_base operator++(int) noexcept + { + iterator_base result = *this; + ++result; + return result; + } + + [[nodiscard]] pointer operator->() const noexcept + { + return &**this; + } protected: friend class BSTScatterTable; @@ -740,7 +739,7 @@ namespace RE namespace detail { using _dummy_bsthashmap = BSTHashMap; - BOOST_STL_INTERFACES_STATIC_ASSERT_CONCEPT(_dummy_bsthashmap::iterator, std::forward_iterator); + static_assert(std::forward_iterator<_dummy_bsthashmap::iterator>); } template < diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index 58dbd2ba2..d38454d65 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -59,7 +59,6 @@ static_assert( #pragma warning(push) #include -#include #include #include #pragma warning(pop) diff --git a/vcpkg.json b/vcpkg.json index a6ee45c80..e1afdea7b 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -6,7 +6,6 @@ "license": "MIT", "supports": "windows & x64", "dependencies": [ - "boost-stl-interfaces", "fmt", "rsm-binary-io", "spdlog" From 3b7a36d485fbdff026946edcece4db7e79e7b946 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 31 Dec 2023 17:09:22 -0600 Subject: [PATCH 27/76] .gitignore --- .gitignore | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 50253ac97..50a52675a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,12 @@ -/build* +# dot folders +.vs/ +.vscode/ +.xmake/ + +# folders +build/ +out/ + +# files +*.zip CMakeUserPresets.json -/out* -/.vs* From dd66203c508ecb71dc786f997e2b071fd58e3923 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Mon, 1 Jan 2024 16:14:59 -0600 Subject: [PATCH 28/76] Remove fmtlib, use std::format --- include/RE/A/ActorValueList.h | 2 ++ include/RE/E/EffectArchetypes.h | 2 ++ include/RE/F/FormTypes.h | 2 ++ include/RE/M/MaterialIDs.h | 2 ++ include/REL/Relocation.h | 16 ++++++++-------- include/SKSE/Impl/PCH.h | 4 ++-- include/SKSE/Logger.h | 4 ++-- src/RE/C/Color.cpp | 2 +- src/RE/N/NiColor.cpp | 2 +- src/SKSE/Translation.cpp | 2 +- vcpkg.json | 1 - 11 files changed, 23 insertions(+), 16 deletions(-) diff --git a/include/RE/A/ActorValueList.h b/include/RE/A/ActorValueList.h index 581a2ef03..9baf8fded 100644 --- a/include/RE/A/ActorValueList.h +++ b/include/RE/A/ActorValueList.h @@ -24,6 +24,7 @@ namespace RE }; } +#ifdef FMT_VERSION namespace fmt { template <> @@ -43,6 +44,7 @@ namespace fmt } }; } +#endif #ifdef __cpp_lib_format namespace std diff --git a/include/RE/E/EffectArchetypes.h b/include/RE/E/EffectArchetypes.h index b2b2b538e..7c7729dae 100644 --- a/include/RE/E/EffectArchetypes.h +++ b/include/RE/E/EffectArchetypes.h @@ -69,6 +69,7 @@ namespace std } } +#ifdef FMT_VERSION namespace fmt { template <> @@ -87,6 +88,7 @@ namespace fmt } }; } +#endif #ifdef __cpp_lib_format namespace std diff --git a/include/RE/F/FormTypes.h b/include/RE/F/FormTypes.h index 746faa446..55adfb1e2 100644 --- a/include/RE/F/FormTypes.h +++ b/include/RE/F/FormTypes.h @@ -291,6 +291,7 @@ namespace std } } +#ifdef FMT_VERSION namespace fmt { template <> @@ -309,6 +310,7 @@ namespace fmt } }; } +#endif #ifdef __cpp_lib_format namespace std diff --git a/include/RE/M/MaterialIDs.h b/include/RE/M/MaterialIDs.h index cd1ef9260..19289b09a 100644 --- a/include/RE/M/MaterialIDs.h +++ b/include/RE/M/MaterialIDs.h @@ -106,6 +106,7 @@ namespace std } } +#ifdef FMT_VERSION namespace fmt { template <> @@ -124,6 +125,7 @@ namespace fmt } }; } +#endif #ifdef __cpp_lib_format namespace std diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index 20b8b7d7e..b71423f5e 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -482,7 +482,7 @@ namespace REL auto handle = WinAPI::GetModuleHandle(_filename.c_str()); if (handle == nullptr) { stl::report_and_fail( - fmt::format( + std::format( "Failed to obtain module handle for: \"{0}\".\n" "You have likely renamed the executable to something unexpected. " "Renaming the executable back to \"{0}\" may resolve the issue."sv, @@ -503,7 +503,7 @@ namespace REL _version = *version; } else { stl::report_and_fail( - fmt::format( + std::format( "Failed to obtain file version info for: {}\n" "Please contact the author of this script extender plugin for further assistance."sv, stl::utf16_to_utf8(_filename).value_or(""s))); @@ -580,7 +580,7 @@ namespace REL }); if (it == _offset2id.end()) { stl::report_and_fail( - fmt::format( + std::format( "Failed to find the offset within the database: 0x{:08X}"sv, a_offset)); } @@ -624,7 +624,7 @@ namespace REL }); if (it == _id2offset.end()) { stl::report_and_fail( - fmt::format( + std::format( "Failed to find the id within the address library: {}\n" "This means this script extender plugin is incompatible with the address " "library for this version of the game, and thus does not support it."sv, @@ -649,7 +649,7 @@ namespace REL if (format != 1) { #endif stl::report_and_fail( - fmt::format( + std::format( "Unsupported address library format: {}\n" "This means this script extender plugin is incompatible with the address " "library available for this version of the game, and thus does not " @@ -695,7 +695,7 @@ namespace REL const auto version = Module::get().version(); const auto filename = stl::utf8_to_utf16( - fmt::format( + std::format( #ifdef SKYRIM_SUPPORT_AE "Data/SKSE/Plugins/versionlib-{}.bin"sv, #else @@ -735,7 +735,7 @@ namespace REL } } catch (const std::system_error&) { stl::report_and_fail( - fmt::format( + std::format( "Failed to locate an appropriate address library with the path: {}\n" "This means you are missing the address library for this specific version of " "the game. Please continue to the mod page for address library to download " @@ -1105,7 +1105,7 @@ namespace REL if (!this->match(a_address)) { const auto version = Module::get().version(); stl::report_and_fail( - fmt::format( + std::format( "A pattern has failed to match.\n" "This means the plugin is incompatible with the current version of the game ({}.{}.{}). " "Head to the mod page of this plugin to see if an update is available."sv, diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index d38454d65..0a4b8051d 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,6 @@ static_assert( #pragma warning(push) #include -#include #include #pragma warning(pop) @@ -599,7 +599,7 @@ namespace SKSE } return utf8_to_utf16( - fmt::format( + std::format( "{}({}): {}"sv, filename, a_loc.line(), diff --git a/include/SKSE/Logger.h b/include/SKSE/Logger.h index fa7218afa..1fcc425db 100644 --- a/include/SKSE/Logger.h +++ b/include/SKSE/Logger.h @@ -11,7 +11,7 @@ a_func() = delete; \ \ explicit a_func( \ - fmt::format_string a_fmt, \ + spdlog::format_string_t a_fmt, \ Args&&... a_args, \ std::source_location a_loc = std::source_location::current()) \ { \ @@ -27,7 +27,7 @@ }; \ \ template \ - a_func(fmt::format_string, Args&&...) -> a_func; + a_func(spdlog::format_string_t, Args&&...) -> a_func; namespace SKSE::log { diff --git a/src/RE/C/Color.cpp b/src/RE/C/Color.cpp index 08cd9d9f3..cdbb51b0b 100644 --- a/src/RE/C/Color.cpp +++ b/src/RE/C/Color.cpp @@ -18,6 +18,6 @@ namespace RE std::string Color::ToHex() const { - return fmt::format("{:X}{:X}{:X}{:X}", red, green, blue, alpha); + return std::format("{:X}{:X}{:X}{:X}", red, green, blue, alpha); } } diff --git a/src/RE/N/NiColor.cpp b/src/RE/N/NiColor.cpp index b07f4351f..66d271a5d 100644 --- a/src/RE/N/NiColor.cpp +++ b/src/RE/N/NiColor.cpp @@ -25,7 +25,7 @@ namespace RE auto g = static_cast(green * 255); auto b = static_cast(blue * 255); - return fmt::format("{:X}{:X}{:X}", r, g, b); + return std::format("{:X}{:X}{:X}", r, g, b); } NiColorA::NiColorA(const Color& a_rhs) : diff --git a/src/SKSE/Translation.cpp b/src/SKSE/Translation.cpp index 3c7876db3..2a3c2b668 100644 --- a/src/SKSE/Translation.cpp +++ b/src/SKSE/Translation.cpp @@ -58,7 +58,7 @@ namespace SKSE // Construct translation filename std::string language = (setting && setting->GetType() == RE::Setting::Type::kString) ? setting->data.s : "ENGLISH"s; - std::string path = fmt::format("Interface\\Translations\\{}_{}.txt"sv, a_name, language); + std::string path = std::format("Interface\\Translations\\{}_{}.txt"sv, a_name, language); RE::BSResourceNiBinaryStream fileStream{ path }; if (!fileStream.good()) { diff --git a/vcpkg.json b/vcpkg.json index e1afdea7b..457ac1957 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -6,7 +6,6 @@ "license": "MIT", "supports": "windows & x64", "dependencies": [ - "fmt", "rsm-binary-io", "spdlog" ] From 06ed6387c22c6998954af05a0df7100136c64f8d Mon Sep 17 00:00:00 2001 From: shad0wshayd3 Date: Mon, 1 Jan 2024 15:40:39 -0700 Subject: [PATCH 29/76] Misc Blood Magic Defs I forgot to submit a PR for these a year ago --- include/RE/A/AIProcess.h | 3 +++ include/RE/A/Actor.h | 2 ++ include/RE/G/GFxValue.h | 2 ++ include/RE/H/HUDMenu.h | 7 +++++++ include/RE/M/MagicCaster.h | 1 + include/RE/M/MagicTarget.h | 13 ++++++------ include/RE/P/PlayerCharacter.h | 1 + include/RE/T/TESObjectREFR.h | 1 + include/RE/T/TutorialMenu.h | 7 +++++++ src/RE/A/AIProcess.cpp | 36 ++++++++++++++++++++++++++++++++++ src/RE/A/Actor.cpp | 15 ++++++++++++++ src/RE/G/GFxValue.cpp | 13 ++++++++++++ src/RE/M/MagicCaster.cpp | 9 ++++++++- src/RE/M/MagicSystem.cpp | 35 ++++++++++++++++++--------------- src/RE/M/MagicTarget.cpp | 10 ++++++++++ src/RE/P/PlayerCharacter.cpp | 7 +++++++ src/RE/T/TESObjectREFR.cpp | 7 +++++++ 17 files changed, 146 insertions(+), 23 deletions(-) diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index d7581313a..0d1c6b537 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -1,6 +1,7 @@ #pragma once #include "RE/A/ActorPackage.h" +#include "RE/A/ActorValues.h" #include "RE/B/BGSDefaultObjectManager.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTList.h" @@ -161,6 +162,7 @@ namespace RE [[nodiscard]] bool GetIsSummonedCreature() const noexcept; NiAVObject* GetMagicNode(const BSTSmartPointer& a_biped) const; ObjectRefHandle GetOccupiedFurniture() const; + float GetRegenDelay(ActorValue a_actorvalue) const; TESPackage* GetRunningPackage() const; Actor* GetUserData() const; float GetVoiceRecoveryTime() const; @@ -181,6 +183,7 @@ namespace RE bool SetupSpecialIdle(Actor* a_actor, DEFAULT_OBJECT a_action, TESIdleForm* a_idle, bool a_arg5, bool a_arg6, TESObjectREFR* a_target); void StopCurrentIdle(Actor* a_actor, bool a_forceIdleStop); void Update3DModel(Actor* a_actor); + void UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay); // members MiddleLowProcessData* middleLow; // 000 diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 38017deb7..656bc0e73 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -543,6 +543,7 @@ namespace RE double GetMoveDirectionRelativeToFacing(); ObjectRefHandle GetOccupiedFurniture() const; TESRace* GetRace() const; + float GetRegenDelay(ActorValue a_actorValue) const; bool GetRider(NiPointer& a_outRider); [[nodiscard]] TESObjectARMO* GetSkin() const; [[nodiscard]] TESObjectARMO* GetSkin(BGSBipedObjectForm::BipedObjectSlot a_slot, bool a_noInit = false); @@ -616,6 +617,7 @@ namespace RE void UpdateAwakeSound(NiAVObject* a_obj3D); void Update3DModel(); void UpdateHairColor(); + void UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay); void UpdateSkinColor(); void UpdateWeaponAbility(TESForm* a_weapon, ExtraDataList* a_extraData, bool a_leftHand); void VisitArmorAddon(TESObjectARMO* a_armor, TESObjectARMA* a_arma, std::function a_visitor); diff --git a/include/RE/G/GFxValue.h b/include/RE/G/GFxValue.h index fde0dd501..e9965649b 100644 --- a/include/RE/G/GFxValue.h +++ b/include/RE/G/GFxValue.h @@ -260,6 +260,7 @@ namespace RE bool SetText(void* a_data, const char* a_text, bool a_isHTML); bool AttachMovie(void* a_data, GFxValue* a_movieClip, const char* a_symbolName, const char* a_instanceName, std::int32_t a_depth, const GFxValue* a_initObj); + bool CreateEmptyMovieClip(void* a_data, GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth); bool GotoAndPlay(void* a_data, const char* a_frame, bool a_stop); bool IsSameContext(const ObjectInterface* a_rhs) const; @@ -399,6 +400,7 @@ namespace RE // AS MovieClip support. Valid for MovieClips. bool AttachMovie(GFxValue* a_movieClip, const char* a_symbolName, const char* a_instanceName, std::int32_t a_depth = -1, const GFxValue* a_initObj = nullptr); + bool CreateEmptyMovieClip(GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth = -1); bool GotoAndPlay(const char* a_frame); bool GotoAndStop(const char* a_frame); diff --git a/include/RE/H/HUDMenu.h b/include/RE/H/HUDMenu.h index 21d676b58..edfceee1f 100644 --- a/include/RE/H/HUDMenu.h +++ b/include/RE/H/HUDMenu.h @@ -40,6 +40,13 @@ namespace RE // override (BSTEventSink) BSEventNotifyControl ProcessEvent(const BSRemoteGamepadEvent* a_event, BSTEventSource* a_eventSource) override; // 01 + static void FlashMeter(ActorValue a_actorValue) + { + using func_t = decltype(&HUDMenu::FlashMeter); + REL::Relocation func{ RELOCATION_ID(51907, 52845) }; + return func(a_actorValue); + } + static void UpdateCrosshairMagicTarget(bool a_valid) { using func_t = decltype(&HUDMenu::UpdateCrosshairMagicTarget); diff --git a/include/RE/M/MagicCaster.h b/include/RE/M/MagicCaster.h index 619e73c7a..63df5cca6 100644 --- a/include/RE/M/MagicCaster.h +++ b/include/RE/M/MagicCaster.h @@ -78,6 +78,7 @@ namespace RE float GetCurrentSpellCost(); void InterruptCast(bool a_refund); void PlayReleaseSound(MagicItem* a_item); + void SetCurrentSpell(MagicItem* a_item); bool TestProjectilePlacement(const Effect& a_effect, const bhkPickData& a_pickData); void UpdateImpl(float a_delta); diff --git a/include/RE/M/MagicTarget.h b/include/RE/M/MagicTarget.h index f36dd9277..45bb4009b 100644 --- a/include/RE/M/MagicTarget.h +++ b/include/RE/M/MagicTarget.h @@ -86,12 +86,13 @@ namespace RE virtual float CheckResistance(MagicItem* a_magicItem, Effect* a_effect, TESBoundObject* a_object); // 0A - { return 1.0; } virtual bool CheckAbsorb(Actor* a_actor, MagicItem* a_magicItem, const Effect* a_effect); // 0B - { return false; } - bool DispelEffect(MagicItem* a_spell, BSPointerHandle& a_caster, ActiveEffect* a_effect = nullptr); - void DispelEffectsWithArchetype(Archetype a_type, bool a_force); - bool HasEffectWithArchetype(Archetype a_type); - bool HasMagicEffect(EffectSetting* a_effect); - bool HasMagicEffectWithKeyword(BGSKeyword* a_keyword, std::uint64_t a_arg2); - void VisitEffects(ForEachActiveEffectVisitor& visitor); + bool DispelEffect(MagicItem* a_spell, BSPointerHandle& a_caster, ActiveEffect* a_effect = nullptr); + void DispelEffectsWithArchetype(Archetype a_type, bool a_force); + Actor* GetTargetAsActor(); + bool HasEffectWithArchetype(Archetype a_type); + bool HasMagicEffect(EffectSetting* a_effect); + bool HasMagicEffectWithKeyword(BGSKeyword* a_keyword, std::uint64_t a_arg2); + void VisitEffects(ForEachActiveEffectVisitor& visitor); // members SpellDispelData* postUpdateDispelList; // 08 diff --git a/include/RE/P/PlayerCharacter.h b/include/RE/P/PlayerCharacter.h index 267d362a1..2bd604d56 100644 --- a/include/RE/P/PlayerCharacter.h +++ b/include/RE/P/PlayerCharacter.h @@ -367,6 +367,7 @@ namespace RE TintMask* GetTintMask(std::uint32_t a_tintType, std::uint32_t a_index); bool HasActorDoingCommand() const; bool IsGrabbing() const; + void PlayMagicFailureSound(MagicSystem::SpellType a_spellType); void PlayPickupEvent(TESForm* a_item, TESForm* a_containerOwner, TESObjectREFR* a_containerRef, EventType a_eventType); void SetAIDriven(bool a_enable); void SetEscaping(bool a_flag, bool a_escaped); diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index f711cf017..a26df60ae 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -366,6 +366,7 @@ namespace RE ObjectRefHandle CreateRefHandle(); void DoTrap(TrapData& a_data); void DoTrap(TrapEntry* a_trap, TargetEntry* a_target); + void Enable(bool a_resetInventory); NiAVObject* Get3D() const; NiAVObject* Get3D(bool a_firstPerson) const; TESNPC* GetActorOwner(); diff --git a/include/RE/T/TutorialMenu.h b/include/RE/T/TutorialMenu.h index 6720e4a33..6d41bd8c7 100644 --- a/include/RE/T/TutorialMenu.h +++ b/include/RE/T/TutorialMenu.h @@ -20,6 +20,13 @@ namespace RE void Accept(CallbackProcessor* a_processor) override; // 01 UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04 + static void OpenTutorialMenu(DEFAULT_OBJECT a_tutorial) + { + using func_t = decltype(&TutorialMenu::OpenTutorialMenu); + REL::Relocation func{ RELOCATION_ID(51818, 52692) }; + return func(a_tutorial); + } + // members GFxValue root; // 30 - "Menu_mc" }; diff --git a/src/RE/A/AIProcess.cpp b/src/RE/A/AIProcess.cpp index 74ebd89d0..39e0f1d09 100644 --- a/src/RE/A/AIProcess.cpp +++ b/src/RE/A/AIProcess.cpp @@ -96,6 +96,23 @@ namespace RE } } + float AIProcess::GetRegenDelay(ActorValue a_actorValue) const + { + if (high) { + switch (a_actorValue) { + case ActorValue::kHealth: + return high->healthRegenDelay; + case ActorValue::kMagicka: + return high->magickaRegenDelay; + case ActorValue::kStamina: + return high->staminaRegenDelay; + default: + break; + } + } + return 0.0f; + } + TESPackage* AIProcess::GetRunningPackage() const { TESPackage* package = nullptr; @@ -254,4 +271,23 @@ namespace RE REL::Relocation func{ Offset::AIProcess::Update3DModel }; return func(this, a_actor); } + + void AIProcess::UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay) + { + if (high) { + switch (a_actorValue) { + case ActorValue::kHealth: + high->healthRegenDelay = a_regenDelay; + break; + case ActorValue::kMagicka: + high->magickaRegenDelay = a_regenDelay; + break; + case ActorValue::kStamina: + high->staminaRegenDelay = a_regenDelay; + break; + default: + break; + } + } + } } diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 858bb1176..cfc81a100 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -527,6 +527,14 @@ namespace RE return base ? base->race : nullptr; } + float Actor::GetRegenDelay(ActorValue a_actorValue) const + { + if (currentProcess) { + return currentProcess->GetRegenDelay(a_actorValue); + } + return 0.0f; + } + bool Actor::GetRider(NiPointer& a_outRider) { using func_t = decltype(&Actor::GetRider); @@ -1088,6 +1096,13 @@ namespace RE } } + void Actor::UpdateRegenDelay(ActorValue a_actorValue, float a_regenDelay) + { + if (currentProcess) { + currentProcess->UpdateRegenDelay(a_actorValue, a_regenDelay); + } + } + void Actor::UpdateSkinColor() { const auto* npc = GetActorBase(); diff --git a/src/RE/G/GFxValue.cpp b/src/RE/G/GFxValue.cpp index 2b1ef15d9..d6970606d 100644 --- a/src/RE/G/GFxValue.cpp +++ b/src/RE/G/GFxValue.cpp @@ -424,6 +424,13 @@ namespace RE return func(this, a_data, a_movieClip, a_symbolName, a_instanceName, a_depth, a_initObj); } + bool GFxValue::ObjectInterface::CreateEmptyMovieClip(void* a_data, GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth) + { + using func_t = decltype(&GFxValue::ObjectInterface::CreateEmptyMovieClip); + REL::Relocation func{ RELOCATION_ID(80201, 82224) }; + return func(this, a_data, a_movieClip, a_instanceName, a_depth); + } + bool GFxValue::ObjectInterface::GotoAndPlay(void* a_data, const char* a_frame, bool a_stop) { using func_t = decltype(&GFxValue::ObjectInterface::GotoAndPlay); @@ -967,6 +974,12 @@ namespace RE return _objectInterface->AttachMovie(_value.obj, a_movieClip, a_symbolName, a_instanceName, a_depth, a_initObj); } + bool GFxValue::CreateEmptyMovieClip(GFxValue* a_movieClip, const char* a_instanceName, std::int32_t a_depth) + { + assert(IsDisplayObject()); + return _objectInterface->CreateEmptyMovieClip(_value.obj, a_movieClip, a_instanceName, a_depth); + } + bool GFxValue::GotoAndPlay(const char* a_frame) { assert(IsDisplayObject()); diff --git a/src/RE/M/MagicCaster.cpp b/src/RE/M/MagicCaster.cpp index f2c557539..b80f16ec4 100644 --- a/src/RE/M/MagicCaster.cpp +++ b/src/RE/M/MagicCaster.cpp @@ -16,7 +16,7 @@ namespace RE bool MagicCaster::FindTargets(float a_effectivenessMult, std::uint32_t& a_targetCount, TESBoundObject* a_source, bool a_loadCast, bool a_adjustOnlyHostileEffectiveness) { using func_t = decltype(&MagicCaster::FindTargets); - REL::Relocation func{ RELOCATION_ID(33676, 34456) }; + REL::Relocation func{ RELOCATION_ID(33632, 34410) }; return func(this, a_effectivenessMult, a_targetCount, a_source, a_loadCast, a_adjustOnlyHostileEffectiveness); } @@ -48,6 +48,13 @@ namespace RE return func(this, a_item); } + void MagicCaster::SetCurrentSpell(MagicItem* a_item) + { + using func_t = decltype(&MagicCaster::SetCurrentSpell); + REL::Relocation func{ RELOCATION_ID(33644, 34422) }; + return func(this, a_item); + } + bool MagicCaster::TestProjectilePlacement(const Effect& a_effect, const bhkPickData& a_pickData) { if (auto baseEffect = a_effect.baseEffect) { diff --git a/src/RE/M/MagicSystem.cpp b/src/RE/M/MagicSystem.cpp index 2d942435f..49bd0d358 100644 --- a/src/RE/M/MagicSystem.cpp +++ b/src/RE/M/MagicSystem.cpp @@ -2,24 +2,27 @@ namespace RE { - const char* GetCannotCastString(MagicSystem::CannotCastReason a_reason) + namespace MagicSystem { - using func_t = decltype(&MagicSystem::GetCannotCastString); - REL::Relocation func{ RELOCATION_ID(11295, 11423) }; - return func(a_reason); - } + const char* GetCannotCastString(MagicSystem::CannotCastReason a_reason) + { + using func_t = decltype(&MagicSystem::GetCannotCastString); + REL::Relocation func{ RELOCATION_ID(11295, 11423) }; + return func(a_reason); + } - float GetMagicCasterTargetUpdateInterval() - { - using func_t = decltype(&MagicSystem::GetMagicCasterTargetUpdateInterval); - REL::Relocation func{ RELOCATION_ID(11294, 11422) }; - return func(); - } + float GetMagicCasterTargetUpdateInterval() + { + using func_t = decltype(&MagicSystem::GetMagicCasterTargetUpdateInterval); + REL::Relocation func{ RELOCATION_ID(11294, 11422) }; + return func(); + } - BGSSoundDescriptorForm* GetMagicFailureSound(MagicSystem::SpellType a_type) - { - using func_t = decltype(&MagicSystem::GetMagicFailureSound); - REL::Relocation func{ RELOCATION_ID(11286, 11411) }; - return func(a_type); + BGSSoundDescriptorForm* GetMagicFailureSound(MagicSystem::SpellType a_type) + { + using func_t = decltype(&MagicSystem::GetMagicFailureSound); + REL::Relocation func{ RELOCATION_ID(11286, 11411) }; + return func(a_type); + } } } diff --git a/src/RE/M/MagicTarget.cpp b/src/RE/M/MagicTarget.cpp index e8939d719..e26df0608 100644 --- a/src/RE/M/MagicTarget.cpp +++ b/src/RE/M/MagicTarget.cpp @@ -1,6 +1,7 @@ #include "RE/M/MagicTarget.h" #include "RE/A/ActiveEffect.h" +#include "RE/A/Actor.h" #include "RE/B/BSTList.h" #include "RE/E/EffectSetting.h" @@ -33,6 +34,15 @@ namespace RE } } + Actor* MagicTarget::GetTargetAsActor() + { + if (MagicTargetIsActor()) { + return static_cast(this); + } + + return nullptr; + } + bool MagicTarget::HasEffectWithArchetype(Archetype a_type) { auto effects = GetActiveEffectList(); diff --git a/src/RE/P/PlayerCharacter.cpp b/src/RE/P/PlayerCharacter.cpp index 0b8e18750..bb901f52c 100644 --- a/src/RE/P/PlayerCharacter.cpp +++ b/src/RE/P/PlayerCharacter.cpp @@ -150,6 +150,13 @@ namespace RE return static_cast(grabbedObject); } + void PlayerCharacter::PlayMagicFailureSound(MagicSystem::SpellType a_spellType) + { + using func_t = decltype(&PlayerCharacter::PlayMagicFailureSound); + REL::Relocation func{ RELOCATION_ID(39486, 40565) }; + return func(this, a_spellType); + } + void PlayerCharacter::PlayPickupEvent(TESForm* a_item, TESForm* a_containerOwner, TESObjectREFR* a_containerRef, EventType a_eventType) { using func_t = decltype(&PlayerCharacter::PlayPickupEvent); diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index 0ec42cd9d..f7a782f8d 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -92,6 +92,13 @@ namespace RE return DoTrap2(a_trap, a_target); } + void TESObjectREFR::Enable(bool a_resetInventory) + { + using func_t = decltype(&TESObjectREFR::Enable); + REL::Relocation func{ RELOCATION_ID(19373, 19800) }; + return func(this, a_resetInventory); + } + NiAVObject* TESObjectREFR::Get3D() const { return Get3D2(); From 5183ce52e5a23ed51eaed45864c9f59007155131 Mon Sep 17 00:00:00 2001 From: Bobbyclue Date: Thu, 4 Jan 2024 21:56:07 -0500 Subject: [PATCH 30/76] Update MagicSystem.cpp Added missing namespace --- src/RE/M/MagicSystem.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/RE/M/MagicSystem.cpp b/src/RE/M/MagicSystem.cpp index 2d942435f..49bd0d358 100644 --- a/src/RE/M/MagicSystem.cpp +++ b/src/RE/M/MagicSystem.cpp @@ -2,24 +2,27 @@ namespace RE { - const char* GetCannotCastString(MagicSystem::CannotCastReason a_reason) + namespace MagicSystem { - using func_t = decltype(&MagicSystem::GetCannotCastString); - REL::Relocation func{ RELOCATION_ID(11295, 11423) }; - return func(a_reason); - } + const char* GetCannotCastString(MagicSystem::CannotCastReason a_reason) + { + using func_t = decltype(&MagicSystem::GetCannotCastString); + REL::Relocation func{ RELOCATION_ID(11295, 11423) }; + return func(a_reason); + } - float GetMagicCasterTargetUpdateInterval() - { - using func_t = decltype(&MagicSystem::GetMagicCasterTargetUpdateInterval); - REL::Relocation func{ RELOCATION_ID(11294, 11422) }; - return func(); - } + float GetMagicCasterTargetUpdateInterval() + { + using func_t = decltype(&MagicSystem::GetMagicCasterTargetUpdateInterval); + REL::Relocation func{ RELOCATION_ID(11294, 11422) }; + return func(); + } - BGSSoundDescriptorForm* GetMagicFailureSound(MagicSystem::SpellType a_type) - { - using func_t = decltype(&MagicSystem::GetMagicFailureSound); - REL::Relocation func{ RELOCATION_ID(11286, 11411) }; - return func(a_type); + BGSSoundDescriptorForm* GetMagicFailureSound(MagicSystem::SpellType a_type) + { + using func_t = decltype(&MagicSystem::GetMagicFailureSound); + REL::Relocation func{ RELOCATION_ID(11286, 11411) }; + return func(a_type); + } } } From 579a20bbd4da5461599207ca5a80b48432f08e1a Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Wed, 10 Jan 2024 02:37:11 +0530 Subject: [PATCH 31/76] Add `SendUIMessage::SendInventoryUpdateMessage` --- include/RE/A/ActorMagicCaster.h | 2 +- include/RE/I/InventoryUpdateData.h | 10 ++++++---- include/RE/M/MagicCaster.h | 2 +- include/RE/M/MagicSystem.h | 3 ++- include/RE/S/SendUIMessage.h | 17 +++++++++++++++++ 5 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 include/RE/S/SendUIMessage.h diff --git a/include/RE/A/ActorMagicCaster.h b/include/RE/A/ActorMagicCaster.h index 3318dad72..71868251c 100644 --- a/include/RE/A/ActorMagicCaster.h +++ b/include/RE/A/ActorMagicCaster.h @@ -47,7 +47,7 @@ namespace RE void FinishCastImpl() override; // 07 - { return; } void InterruptCastImpl(bool a_depleteEnergy) override; // 08 - { return; } void SpellCast(bool a_doCast, std::uint32_t a_arg2, MagicItem* a_spell) override; // 09 - { return; } - bool CheckCast(MagicItem* a_spell, bool a_dualCast, float* a_alchStrength, MagicSystem::CannotCastReason* a_reason, bool a_useBaseValueForCost) override; // 0A + bool CheckCast(MagicItem* a_spell, bool a_dualCast, float* a_effectStrength, MagicSystem::CannotCastReason* a_reason, bool a_useBaseValueForCost) override; // 0A TESObjectREFR* GetCasterStatsObject() const override; // 0B - { return actor; } Actor* GetCasterAsActor() const override; // 0C - { return actor; } NiNode* GetMagicNode() override; // 0E - { return magicNode; } diff --git a/include/RE/I/InventoryUpdateData.h b/include/RE/I/InventoryUpdateData.h index 0c1a8e769..dd96e9d7e 100644 --- a/include/RE/I/InventoryUpdateData.h +++ b/include/RE/I/InventoryUpdateData.h @@ -4,7 +4,9 @@ namespace RE { - class InventoryUpdateData : public IUIMessageData + class TESBoundObject; + + class InventoryUpdateData : public IUIMessageData { public: inline static constexpr auto RTTI = RTTI_InventoryUpdateData; @@ -12,9 +14,9 @@ namespace RE ~InventoryUpdateData() override = default; // 00 // members - RefHandle unk10; // 10 - std::uint32_t pad14; // 14 - TESForm* unk18; // 18 + RefHandle inventoryRef; // 10 + std::uint32_t pad14; // 14 + TESBoundObject* updateObj; // 18 }; static_assert(sizeof(InventoryUpdateData) == 0x20); } diff --git a/include/RE/M/MagicCaster.h b/include/RE/M/MagicCaster.h index 63df5cca6..3586862b3 100644 --- a/include/RE/M/MagicCaster.h +++ b/include/RE/M/MagicCaster.h @@ -52,7 +52,7 @@ namespace RE virtual void FinishCastImpl(); // 07 - { return; } virtual void InterruptCastImpl(bool a_depleteEnergy); // 08 - { return; } virtual void SpellCast(bool a_doCast, std::uint32_t a_arg2, MagicItem* a_spell); // 09 - { return; } - virtual bool CheckCast(MagicItem* a_spell, bool a_dualCast, float* a_alchStrength, MagicSystem::CannotCastReason* a_reason, bool a_useBaseValueForCost); // 0A + virtual bool CheckCast(MagicItem* a_spell, bool a_dualCast, float* a_effectStrength, MagicSystem::CannotCastReason* a_reason, bool a_useBaseValueForCost); // 0A virtual TESObjectREFR* GetCasterStatsObject() const; // 0B - { return 0; } virtual Actor* GetCasterAsActor() const; // 0C - { return 0; } virtual TESObjectREFR* GetCasterObjectReference(Actor** a_outCaster) const; // 0D diff --git a/include/RE/M/MagicSystem.h b/include/RE/M/MagicSystem.h index a5190684d..2dbb0f53a 100644 --- a/include/RE/M/MagicSystem.h +++ b/include/RE/M/MagicSystem.h @@ -16,7 +16,8 @@ namespace RE kItemCharge = 5, kCastWhileShouting = 6, kShoutWhileCasting = 7, - kShoutWhileRecovering = 8 + kShoutWhileRecovering = 8, + kCustomReasonNoStart = 100, }; enum class CastingSource diff --git a/include/RE/S/SendUIMessage.h b/include/RE/S/SendUIMessage.h new file mode 100644 index 000000000..12932922f --- /dev/null +++ b/include/RE/S/SendUIMessage.h @@ -0,0 +1,17 @@ +#pragma once + +namespace RE +{ + class TESBoundObject; + class TESObjectREFR; + + namespace SendUIMessage + { + void SendInventoryUpdateMessage(TESObjectREFR* a_inventoryRef, const TESBoundObject* a_updateObj) + { + using func_t = decltype(&SendUIMessage::SendInventoryUpdateMessage); + static REL::Relocation func{ RELOCATION_ID(51911, 52849) }; + return func(a_inventoryRef, a_updateObj); + } + } +} From bade6c1cfbb35c9af41d50c9607edec4883931a2 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Tue, 9 Jan 2024 21:07:39 +0000 Subject: [PATCH 32/76] maintenance --- cmake/sourcelist.cmake | 1 + include/RE/A/ActorMagicCaster.h | 48 +++++++++++++++--------------- include/RE/I/InventoryUpdateData.h | 2 +- include/RE/S/SendUIMessage.h | 2 +- include/RE/Skyrim.h | 1 + 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index f95c17a30..338c78755 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1373,6 +1373,7 @@ set(SOURCES include/RE/S/ScriptedRefEffect.h include/RE/S/ScrollItem.h include/RE/S/SendPlayerToJailFunctor.h + include/RE/S/SendUIMessage.h include/RE/S/SetEventData.h include/RE/S/SetMotionTypeFunctor.h include/RE/S/SetPositionFunctor.h diff --git a/include/RE/A/ActorMagicCaster.h b/include/RE/A/ActorMagicCaster.h index 71868251c..23d259e31 100644 --- a/include/RE/A/ActorMagicCaster.h +++ b/include/RE/A/ActorMagicCaster.h @@ -40,31 +40,31 @@ namespace RE ~ActorMagicCaster() override; // 00 // override (MagicCaster) - void RequestCastImpl() override; // 03 - bool StartChargeImpl() override; // 04 - void StartReadyImpl() override; // 05 - void StartCastImpl() override; // 06 - void FinishCastImpl() override; // 07 - { return; } - void InterruptCastImpl(bool a_depleteEnergy) override; // 08 - { return; } - void SpellCast(bool a_doCast, std::uint32_t a_arg2, MagicItem* a_spell) override; // 09 - { return; } + void RequestCastImpl() override; // 03 + bool StartChargeImpl() override; // 04 + void StartReadyImpl() override; // 05 + void StartCastImpl() override; // 06 + void FinishCastImpl() override; // 07 - { return; } + void InterruptCastImpl(bool a_depleteEnergy) override; // 08 - { return; } + void SpellCast(bool a_doCast, std::uint32_t a_arg2, MagicItem* a_spell) override; // 09 - { return; } bool CheckCast(MagicItem* a_spell, bool a_dualCast, float* a_effectStrength, MagicSystem::CannotCastReason* a_reason, bool a_useBaseValueForCost) override; // 0A - TESObjectREFR* GetCasterStatsObject() const override; // 0B - { return actor; } - Actor* GetCasterAsActor() const override; // 0C - { return actor; } - NiNode* GetMagicNode() override; // 0E - { return magicNode; } - void ClearMagicNode() override; // 0F - { magicNode = 0; } - void SetCurrentSpellImpl(MagicItem* a_spell) override; // 10 - { return; } - void SelectSpellImpl() override; // 11 - { return; } - void DeselectSpellImpl() override; // 12 - { return; } - void SetSkipCheckCast() override; // 13 - { return; } - void SetCastingTimerForCharge() override; // 14 - MagicSystem::CastingSource GetCastingSource() const override; // 15 - { return castingSource; } - bool GetIsDualCasting() const override; // 16 - { return flags & 1; } - void SetDualCasting(bool a_set) override; // 17 - void SaveGame(BGSSaveGameBuffer* a_buf) override; // 18 - void LoadGame(BGSLoadGameBuffer* a_buf) override; // 19 - void FinishLoadGame(BGSLoadGameBuffer* a_buf) override; // 1A - void PrepareSound(MagicSystem::SoundID a_sound, MagicItem* a_spell) override; // 1B - void AdjustActiveEffect(ActiveEffect* a_activeEffect, float a_power, bool a_arg3) override; // 1C + TESObjectREFR* GetCasterStatsObject() const override; // 0B - { return actor; } + Actor* GetCasterAsActor() const override; // 0C - { return actor; } + NiNode* GetMagicNode() override; // 0E - { return magicNode; } + void ClearMagicNode() override; // 0F - { magicNode = 0; } + void SetCurrentSpellImpl(MagicItem* a_spell) override; // 10 - { return; } + void SelectSpellImpl() override; // 11 - { return; } + void DeselectSpellImpl() override; // 12 - { return; } + void SetSkipCheckCast() override; // 13 - { return; } + void SetCastingTimerForCharge() override; // 14 + MagicSystem::CastingSource GetCastingSource() const override; // 15 - { return castingSource; } + bool GetIsDualCasting() const override; // 16 - { return flags & 1; } + void SetDualCasting(bool a_set) override; // 17 + void SaveGame(BGSSaveGameBuffer* a_buf) override; // 18 + void LoadGame(BGSLoadGameBuffer* a_buf) override; // 19 + void FinishLoadGame(BGSLoadGameBuffer* a_buf) override; // 1A + void PrepareSound(MagicSystem::SoundID a_sound, MagicItem* a_spell) override; // 1B + void AdjustActiveEffect(ActiveEffect* a_activeEffect, float a_power, bool a_arg3) override; // 1C // add virtual void Update(float a_delta); // 1D diff --git a/include/RE/I/InventoryUpdateData.h b/include/RE/I/InventoryUpdateData.h index dd96e9d7e..be45849d7 100644 --- a/include/RE/I/InventoryUpdateData.h +++ b/include/RE/I/InventoryUpdateData.h @@ -6,7 +6,7 @@ namespace RE { class TESBoundObject; - class InventoryUpdateData : public IUIMessageData + class InventoryUpdateData : public IUIMessageData { public: inline static constexpr auto RTTI = RTTI_InventoryUpdateData; diff --git a/include/RE/S/SendUIMessage.h b/include/RE/S/SendUIMessage.h index 12932922f..c01a01327 100644 --- a/include/RE/S/SendUIMessage.h +++ b/include/RE/S/SendUIMessage.h @@ -4,7 +4,7 @@ namespace RE { class TESBoundObject; class TESObjectREFR; - + namespace SendUIMessage { void SendInventoryUpdateMessage(TESObjectREFR* a_inventoryRef, const TESBoundObject* a_updateObj) diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 2f57d7c90..579e38545 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -1371,6 +1371,7 @@ #include "RE/S/ScriptedRefEffect.h" #include "RE/S/ScrollItem.h" #include "RE/S/SendPlayerToJailFunctor.h" +#include "RE/S/SendUIMessage.h" #include "RE/S/SetEventData.h" #include "RE/S/SetMotionTypeFunctor.h" #include "RE/S/SetPositionFunctor.h" From 00d54d9b6f2f03530ebfa0e9acc6419c98a64017 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Wed, 10 Jan 2024 03:09:20 +0530 Subject: [PATCH 33/76] Add `TESForm::HasKeywordByEditorID` --- cmake/sourcelist.cmake | 1 + include/RE/S/SendUIMessage.h | 7 +------ include/RE/T/TESForm.h | 11 ++--------- src/RE/S/SendUIMessage.cpp | 14 ++++++++++++++ src/RE/T/TESForm.cpp | 34 +++++++++++++++++++--------------- 5 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 src/RE/S/SendUIMessage.cpp diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 338c78755..e94d783bb 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1900,6 +1900,7 @@ set(SOURCES src/RE/S/ScrapHeap.cpp src/RE/S/Script.cpp src/RE/S/ScriptEventSourceHolder.cpp + src/RE/S/SendUIMessage.cpp src/RE/S/Setting.cpp src/RE/S/ShoutAttack.cpp src/RE/S/SkillIncrease.cpp diff --git a/include/RE/S/SendUIMessage.h b/include/RE/S/SendUIMessage.h index c01a01327..ec6ad5d1c 100644 --- a/include/RE/S/SendUIMessage.h +++ b/include/RE/S/SendUIMessage.h @@ -7,11 +7,6 @@ namespace RE namespace SendUIMessage { - void SendInventoryUpdateMessage(TESObjectREFR* a_inventoryRef, const TESBoundObject* a_updateObj) - { - using func_t = decltype(&SendUIMessage::SendInventoryUpdateMessage); - static REL::Relocation func{ RELOCATION_ID(51911, 52849) }; - return func(a_inventoryRef, a_updateObj); - } + void SendInventoryUpdateMessage(TESObjectREFR* a_inventoryRef, const TESBoundObject* a_updateObj); } } diff --git a/include/RE/T/TESForm.h b/include/RE/T/TESForm.h index 5141fd0ba..7884cb423 100644 --- a/include/RE/T/TESForm.h +++ b/include/RE/T/TESForm.h @@ -302,6 +302,7 @@ namespace RE [[nodiscard]] float GetWeight() const; [[nodiscard]] bool HasKeywordInArray(const std::vector& a_keywords, bool a_matchAll) const; [[nodiscard]] bool HasAnyKeywordByEditorID(const std::vector& editorIDs) const; + [[nodiscard]] bool HasKeywordByEditorID(std::string_view a_editorID); [[nodiscard]] bool HasKeywordInList(BGSListForm* a_keywordList, bool a_matchAll) const; [[nodiscard]] bool HasVMAD() const; [[nodiscard]] bool HasWorldModel() const noexcept; @@ -327,15 +328,6 @@ namespace RE [[nodiscard]] bool IsInitialized() const noexcept { return (GetFormFlags() & RecordFlags::kInitialized) != 0; } [[nodiscard]] bool IsKey() const noexcept { return Is(FormType::KeyMaster); } [[nodiscard]] bool IsLockpick() const noexcept { return GetFormID() == 0x0000000A; } - /** - * @brief Checks if the Form represents Skooma. - * - * Determines whether the FormID matches one of the known form IDs for Skooma. - * - * @return True if the FormID is either 0x00057A7A or 0x0201391D, indicating that it is Skooma or RedWater Skooma. - * - */ - [[nodiscard]] bool IsSkooma() const noexcept { return (GetFormID() == 0x00057A7A || GetFormID() == 0x0201391D); } [[nodiscard]] bool IsNot(FormType a_type) const noexcept { return !Is(a_type); } template @@ -348,6 +340,7 @@ namespace RE [[nodiscard]] bool IsNote() const noexcept { return Is(FormType::Note); } [[nodiscard]] bool IsPlayer() const noexcept { return GetFormID() == 0x00000007; } [[nodiscard]] bool IsPlayerRef() const noexcept { return GetFormID() == 0x00000014; } + [[nodiscard]] bool IsSkooma() const noexcept { return (GetFormID() == 0x00057A7A || GetFormID() == 0x0201391D); } [[nodiscard]] bool IsSoulGem() const noexcept { return Is(FormType::SoulGem); } [[nodiscard]] bool IsWeapon() const noexcept { return Is(FormType::Weapon); } diff --git a/src/RE/S/SendUIMessage.cpp b/src/RE/S/SendUIMessage.cpp new file mode 100644 index 000000000..66391a510 --- /dev/null +++ b/src/RE/S/SendUIMessage.cpp @@ -0,0 +1,14 @@ +#include "RE/S/SendUIMessage.h" + +namespace RE +{ + namespace SendUIMessage + { + void SendInventoryUpdateMessage(TESObjectREFR* a_inventoryRef, const TESBoundObject* a_updateObj) + { + using func_t = decltype(&SendInventoryUpdateMessage); + static REL::Relocation func{ RELOCATION_ID(51911, 52849) }; + return func(a_inventoryRef, a_updateObj); + } + } +} diff --git a/src/RE/T/TESForm.cpp b/src/RE/T/TESForm.cpp index ac034abff..41d88a701 100644 --- a/src/RE/T/TESForm.cpp +++ b/src/RE/T/TESForm.cpp @@ -67,26 +67,30 @@ namespace RE } // Iterate through the keywords - for (std::uint32_t i = 0; i < keywordForm->GetNumKeywords(); ++i) { - auto keywordOpt = keywordForm->GetKeywordAt(i); - if (keywordOpt) { - auto keyword = *keywordOpt; - if (keyword) { - const char* keywordEditorID = keyword->GetFormEditorID(); - if (keywordEditorID) { - // Check if the keywordEditorID is in the given editorIDs vector - if (std::find(editorIDs.begin(), editorIDs.end(), keywordEditorID) != editorIDs.end()) { - return true; - } - } - } + bool hasKeyword = false; + + keywordForm->ForEachKeyword([&](const BGSKeyword& a_keyword) { + if (std::ranges::find(editorIDs, a_keyword.GetFormEditorID()) != editorIDs.end()) { + hasKeyword = true; + return BSContainer::ForEachResult::kStop; } + return BSContainer::ForEachResult::kContinue; + }); + + return hasKeyword; + } + + bool TESForm::HasKeywordByEditorID(std::string_view a_editorID) + { + const auto keywordForm = As(); + if (!keywordForm) { + return false; } - return false; + return keywordForm->HasKeywordString(a_editorID); } - bool TESForm::HasKeywordInArray(const std::vector& a_keywords, bool a_matchAll) const + bool TESForm::HasKeywordInArray(const std::vector& a_keywords, bool a_matchAll) const { const auto keywordForm = As(); if (!keywordForm) { From abf5e00766ac45333868ab7fa4af56664e6129cf Mon Sep 17 00:00:00 2001 From: powerof3 Date: Tue, 9 Jan 2024 21:39:46 +0000 Subject: [PATCH 34/76] maintenance --- src/RE/T/TESForm.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RE/T/TESForm.cpp b/src/RE/T/TESForm.cpp index 41d88a701..d280c2869 100644 --- a/src/RE/T/TESForm.cpp +++ b/src/RE/T/TESForm.cpp @@ -72,7 +72,7 @@ namespace RE keywordForm->ForEachKeyword([&](const BGSKeyword& a_keyword) { if (std::ranges::find(editorIDs, a_keyword.GetFormEditorID()) != editorIDs.end()) { hasKeyword = true; - return BSContainer::ForEachResult::kStop; + return BSContainer::ForEachResult::kStop; } return BSContainer::ForEachResult::kContinue; }); @@ -80,7 +80,7 @@ namespace RE return hasKeyword; } - bool TESForm::HasKeywordByEditorID(std::string_view a_editorID) + bool TESForm::HasKeywordByEditorID(std::string_view a_editorID) { const auto keywordForm = As(); if (!keywordForm) { @@ -90,7 +90,7 @@ namespace RE return keywordForm->HasKeywordString(a_editorID); } - bool TESForm::HasKeywordInArray(const std::vector& a_keywords, bool a_matchAll) const + bool TESForm::HasKeywordInArray(const std::vector& a_keywords, bool a_matchAll) const { const auto keywordForm = As(); if (!keywordForm) { From 0d835fd78cc268068d665eb90548183480c88bc8 Mon Sep 17 00:00:00 2001 From: Drew Warwick Date: Fri, 12 Jan 2024 02:56:59 -0800 Subject: [PATCH 35/76] Add BSSoundHandle::Pause --- include/RE/B/BSSoundHandle.h | 1 + include/RE/Offsets.h | 1 + src/RE/B/BSSoundHandle.cpp | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/include/RE/B/BSSoundHandle.h b/include/RE/B/BSSoundHandle.h index 7ac42a719..d1a6fbe06 100644 --- a/include/RE/B/BSSoundHandle.h +++ b/include/RE/B/BSSoundHandle.h @@ -42,6 +42,7 @@ namespace RE bool SetVolume(float a_volume); bool Stop(); bool Play(); + bool Pause(); // members std::uint32_t soundID; // 00 diff --git a/include/RE/Offsets.h b/include/RE/Offsets.h index 894d1d45f..a49e4fd35 100644 --- a/include/RE/Offsets.h +++ b/include/RE/Offsets.h @@ -146,6 +146,7 @@ namespace RE inline constexpr REL::ID Play(static_cast(67616)); inline constexpr REL::ID SetObjectToFollow(static_cast(67636)); inline constexpr REL::ID SetPosition(static_cast(67631)); + inline constexpr REL::ID Pause(static_cast(67618)); inline constexpr REL::ID Stop(static_cast(67619)); } diff --git a/src/RE/B/BSSoundHandle.cpp b/src/RE/B/BSSoundHandle.cpp index b7f79ee5d..212fa23db 100644 --- a/src/RE/B/BSSoundHandle.cpp +++ b/src/RE/B/BSSoundHandle.cpp @@ -81,4 +81,11 @@ namespace RE REL::Relocation func{ Offset::BSSoundHandle::Play }; return func(this); } + + bool BSSoundHandle::Pause() + { + using func_t = decltype(&BSSoundHandle::Pause); + REL::Relocation func{ Offset::BSSoundHandle::Pause }; + return func(this); + } } From c8eb6ae434f71acee175a888ff0b3b6bab0cbb44 Mon Sep 17 00:00:00 2001 From: Drew Warwick Date: Fri, 12 Jan 2024 03:15:57 -0800 Subject: [PATCH 36/76] Missed SSE ID --- include/RE/Offsets.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/RE/Offsets.h b/include/RE/Offsets.h index a49e4fd35..ad7c5ca45 100644 --- a/include/RE/Offsets.h +++ b/include/RE/Offsets.h @@ -727,6 +727,7 @@ namespace RE inline constexpr REL::ID Play(static_cast(66355)); inline constexpr REL::ID SetObjectToFollow(static_cast(66375)); inline constexpr REL::ID SetPosition(static_cast(66370)); + inline constexpr REL::ID Pause(static_cast(66357)); inline constexpr REL::ID Stop(static_cast(66358)); } From 5106e571e6606e00ea18fce70fc999e041b6e152 Mon Sep 17 00:00:00 2001 From: W-Drew Date: Fri, 12 Jan 2024 11:16:48 +0000 Subject: [PATCH 37/76] maintenance --- include/RE/B/BSSoundHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/B/BSSoundHandle.h b/include/RE/B/BSSoundHandle.h index d1a6fbe06..7151fe358 100644 --- a/include/RE/B/BSSoundHandle.h +++ b/include/RE/B/BSSoundHandle.h @@ -42,7 +42,7 @@ namespace RE bool SetVolume(float a_volume); bool Stop(); bool Play(); - bool Pause(); + bool Pause(); // members std::uint32_t soundID; // 00 From 7c5df1bae45cde63c55a37f7ecb7e788e27b1131 Mon Sep 17 00:00:00 2001 From: Drew Warwick Date: Fri, 12 Jan 2024 03:02:21 -0800 Subject: [PATCH 38/76] RE constraints --- include/RE/H/hkpConstraintAtom.h | 26 ++--- include/RE/H/hkpConstraintMotor.h | 108 +++++++++++++++++++ include/RE/H/hkpLimitedHingeConstraintData.h | 30 ++++++ include/RE/H/hkpRagdollConstraintData.h | 31 ++++++ include/RE/H/hkpSolverResults.h | 14 +++ include/RE/Skyrim.h | 2 + 6 files changed, 199 insertions(+), 12 deletions(-) create mode 100644 include/RE/H/hkpConstraintMotor.h create mode 100644 include/RE/H/hkpSolverResults.h diff --git a/include/RE/H/hkpConstraintAtom.h b/include/RE/H/hkpConstraintAtom.h index 55c5aef08..54174c9f5 100644 --- a/include/RE/H/hkpConstraintAtom.h +++ b/include/RE/H/hkpConstraintAtom.h @@ -2,6 +2,8 @@ namespace RE { + class hkpConstraintMotor; + struct hkpConstraintAtom { public: @@ -150,23 +152,23 @@ namespace RE struct hkpAngMotorConstraintAtom : public hkpConstraintAtom { - bool enabled; // 02 - uint8_t motorAxis; // 03 - int16_t initializedOffset; // 04 - int16_t previousTargetAngleOffset; // 06 - int16_t correspondingAngLimitSolverResultOffset; // 08 - float targetAngle; // 0C - uintptr_t motor; // 10 + bool enabled; // 02 + uint8_t motorAxis; // 03 + int16_t initializedOffset; // 04 + int16_t previousTargetAngleOffset; // 06 + int16_t correspondingAngLimitSolverResultOffset; // 08 + float targetAngle; // 0C + hkpConstraintMotor* motor; // 10 }; static_assert(sizeof(hkpAngMotorConstraintAtom) == 0x18); struct hkpRagdollMotorConstraintAtom : public hkpConstraintAtom { - bool enabled; // 02 - int16_t initializedOffset; // 04 - int16_t previousTargetAnglesOffset; // 06 - hkMatrix3 target_bRca; // 10 - uintptr_t motors[3]; // 40 + bool enabled; // 02 + int16_t initializedOffset; // 04 + int16_t previousTargetAnglesOffset; // 06 + hkMatrix3 target_bRca; // 10 + hkpConstraintMotor* motors[3]; // 40 }; static_assert(sizeof(hkpRagdollMotorConstraintAtom) == 0x60); } diff --git a/include/RE/H/hkpConstraintMotor.h b/include/RE/H/hkpConstraintMotor.h new file mode 100644 index 000000000..46e87d520 --- /dev/null +++ b/include/RE/H/hkpConstraintMotor.h @@ -0,0 +1,108 @@ +#pragma once + +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class hkpConstraintMotor : public hkReferencedObject + { + public: + enum class MotorType + { + kInvalid = 0, + + kPosition, + kVelocity, + kSpring, + kCallback, + + kNUM + }; + + inline static constexpr auto RTTI = RTTI_hkpConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpConstraintMotor; + + // members + stl::enumeration type; // 10 + }; + static_assert(sizeof(hkpConstraintMotor) == 0x18); + + class hkpLimitedForceConstraintMotor : public hkpConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpLimitedForceConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpLimitedForceConstraintMotor; + + // members + float minForce; // 18 + float maxForce; // 1C + }; + static_assert(sizeof(hkpLimitedForceConstraintMotor) == 0x20); + + class hkpPositionConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpPositionConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpPositionConstraintMotor; + + // members + float tau; // 20 + float damping; // 24 + float proportionalRecoveryVelocity; // 28 + float constantRecoveryVelocity; // 2C + }; + static_assert(sizeof(hkpPositionConstraintMotor) == 0x30); + + class hkpVelocityConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpVelocityConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpVelocityConstraintMotor; + + // members + float tau; // 20 + float targetVelocity; // 24 + bool useConstraintTarget; // 28 + }; + static_assert(sizeof(hkpVelocityConstraintMotor) == 0x30); + + class hkpSpringDamperConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpSpringDamperConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpSpringDamperConstraintMotor; + + // members + float springConstant; // 20 + float springDamping; // 24 + }; + static_assert(sizeof(hkpSpringDamperConstraintMotor) == 0x28); + + class hkpCallbackConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + enum class CallbackType + { + kUnk = 0, + + kUser0, + kUser1, + kUser2, + + kNUM + }; + + inline static constexpr auto RTTI = RTTI_hkpCallbackConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpCallbackConstraintMotor; + + using CallbackFunction = void(const hkpCallbackConstraintMotor& motor, const void* unk0, void* unk1); + + // members + CallbackFunction* func; // 20 + stl::enumeration callbackType; // 28 + std::uint64_t userData0; // 30 + std::uint64_t userData1; // 38 + std::uint64_t userData2; // 40 + }; + static_assert(sizeof(hkpCallbackConstraintMotor) == 0x48); +} \ No newline at end of file diff --git a/include/RE/H/hkpLimitedHingeConstraintData.h b/include/RE/H/hkpLimitedHingeConstraintData.h index 2ba81a8e0..4830a79bd 100644 --- a/include/RE/H/hkpLimitedHingeConstraintData.h +++ b/include/RE/H/hkpLimitedHingeConstraintData.h @@ -2,12 +2,29 @@ #include "RE/H/hkpConstraintAtom.h" #include "RE/H/hkpConstraintData.h" +#include "RE/H/hkpSolverResults.h" namespace RE { class hkpLimitedHingeConstraintData : public hkpConstraintData { public: + enum SolverResultType + { + kMotor = 0, + kFriction, + kLimit, + + kAngle0, + kAngle1, + + kLinear0, + kLinear1, + kLinear2, + + kNUM + }; + inline static constexpr auto RTTI = RTTI_hkpLimitedHingeConstraintData; inline static constexpr auto VTABLE = VTABLE_hkpLimitedHingeConstraintData; @@ -23,6 +40,19 @@ namespace RE }; static_assert(sizeof(Atoms) == 0xF0); + struct Runtime + { + inline float getCurrentAngle() + { + return solverResults[SolverResultType::kLimit].data * -1.f; + } + + hkpSolverResults solverResults[SolverResultType::kNUM]; // 00 + bool previousTargetInitialized; // 40 + float previousTargetAngle; // 44 + }; + static_assert(sizeof(Runtime) == 0x48); + // members Atoms atoms; // 18 }; diff --git a/include/RE/H/hkpRagdollConstraintData.h b/include/RE/H/hkpRagdollConstraintData.h index 6195f6409..8f4956ef4 100644 --- a/include/RE/H/hkpRagdollConstraintData.h +++ b/include/RE/H/hkpRagdollConstraintData.h @@ -2,12 +2,34 @@ #include "RE/H/hkpConstraintAtom.h" #include "RE/H/hkpConstraintData.h" +#include "RE/H/hkpSolverResults.h" namespace RE { class hkpRagdollConstraintData : public hkpConstraintData { public: + enum SolverResultType + { + kMotor0 = 0, + kMotor1, + kMotor2, + + kFriction0, + kFriction1, + kFriction2, + + kTwist, + kCone, + kPlane, + + kLinear0, + kLinear1, + kLinear2, + + kNUM + }; + inline static constexpr auto RTTI = RTTI_hkpRagdollConstraintData; inline static constexpr auto VTABLE = VTABLE_hkpRagdollConstraintData; @@ -24,6 +46,15 @@ namespace RE }; static_assert(sizeof(Atoms) == 0x160); + struct Runtime + { + hkpSolverResults solverResults[SolverResultType::kNUM]; // 00 + bool previousTargetInitialized[3]; // 60 + float previousTargetAngle[3]; // 64 + float coneAngle; // 70 + }; + static_assert(sizeof(Runtime) == 0x74); + // members Atoms atoms; // 18 }; diff --git a/include/RE/H/hkpSolverResults.h b/include/RE/H/hkpSolverResults.h new file mode 100644 index 000000000..52da57080 --- /dev/null +++ b/include/RE/H/hkpSolverResults.h @@ -0,0 +1,14 @@ +#pragma once + +namespace RE +{ + + class hkpSolverResults + { + public: + float impulse; // 00 + float data; // 04 + }; + static_assert(sizeof(hkpSolverResults) == 0x08); + +} \ No newline at end of file diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 579e38545..9c0ca6d3f 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -986,6 +986,7 @@ #include "RE/H/hkpConstraintData.h" #include "RE/H/hkpConstraintInfo.h" #include "RE/H/hkpConstraintInstance.h" +#include "RE/H/hkpConstraintMotor.h" #include "RE/H/hkpConstraintOwner.h" #include "RE/H/hkpContactListener.h" #include "RE/H/hkpContactPointEvent.h" @@ -1030,6 +1031,7 @@ #include "RE/H/hkpSimulationIsland.h" #include "RE/H/hkpSingleShapeContainer.h" #include "RE/H/hkpSolverInfo.h" +#include "RE/H/hkpSolverResults.h" #include "RE/H/hkpSphereRepShape.h" #include "RE/H/hkpSphereShape.h" #include "RE/H/hkpTypedBroadPhaseHandle.h" From d8d82ef9ddb07dac50b3bf19c957d896cd653b49 Mon Sep 17 00:00:00 2001 From: W-Drew Date: Fri, 12 Jan 2024 18:56:53 +0000 Subject: [PATCH 39/76] maintenance --- cmake/sourcelist.cmake | 2 + include/RE/H/hkpConstraintMotor.h | 164 +++++++++---------- include/RE/H/hkpLimitedHingeConstraintData.h | 2 +- include/RE/H/hkpRagdollConstraintData.h | 2 +- include/RE/H/hkpSolverResults.h | 14 +- 5 files changed, 93 insertions(+), 91 deletions(-) diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index e94d783bb..10ddee0a5 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -984,6 +984,7 @@ set(SOURCES include/RE/H/hkpConstraintData.h include/RE/H/hkpConstraintInfo.h include/RE/H/hkpConstraintInstance.h + include/RE/H/hkpConstraintMotor.h include/RE/H/hkpConstraintOwner.h include/RE/H/hkpContactListener.h include/RE/H/hkpContactPointEvent.h @@ -1028,6 +1029,7 @@ set(SOURCES include/RE/H/hkpSimulationIsland.h include/RE/H/hkpSingleShapeContainer.h include/RE/H/hkpSolverInfo.h + include/RE/H/hkpSolverResults.h include/RE/H/hkpSphereRepShape.h include/RE/H/hkpSphereShape.h include/RE/H/hkpTypedBroadPhaseHandle.h diff --git a/include/RE/H/hkpConstraintMotor.h b/include/RE/H/hkpConstraintMotor.h index 46e87d520..dec9efe0a 100644 --- a/include/RE/H/hkpConstraintMotor.h +++ b/include/RE/H/hkpConstraintMotor.h @@ -4,105 +4,105 @@ namespace RE { - class hkpConstraintMotor : public hkReferencedObject - { - public: - enum class MotorType - { - kInvalid = 0, - - kPosition, - kVelocity, - kSpring, - kCallback, - - kNUM - }; - - inline static constexpr auto RTTI = RTTI_hkpConstraintMotor; + class hkpConstraintMotor : public hkReferencedObject + { + public: + enum class MotorType + { + kInvalid = 0, + + kPosition, + kVelocity, + kSpring, + kCallback, + + kNUM + }; + + inline static constexpr auto RTTI = RTTI_hkpConstraintMotor; inline static constexpr auto VTABLE = VTABLE_hkpConstraintMotor; - // members - stl::enumeration type; // 10 - }; - static_assert(sizeof(hkpConstraintMotor) == 0x18); + // members + stl::enumeration type; // 10 + }; + static_assert(sizeof(hkpConstraintMotor) == 0x18); - class hkpLimitedForceConstraintMotor : public hkpConstraintMotor - { - public: - inline static constexpr auto RTTI = RTTI_hkpLimitedForceConstraintMotor; + class hkpLimitedForceConstraintMotor : public hkpConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpLimitedForceConstraintMotor; inline static constexpr auto VTABLE = VTABLE_hkpLimitedForceConstraintMotor; - // members - float minForce; // 18 - float maxForce; // 1C - }; - static_assert(sizeof(hkpLimitedForceConstraintMotor) == 0x20); + // members + float minForce; // 18 + float maxForce; // 1C + }; + static_assert(sizeof(hkpLimitedForceConstraintMotor) == 0x20); - class hkpPositionConstraintMotor : public hkpLimitedForceConstraintMotor - { - public: - inline static constexpr auto RTTI = RTTI_hkpPositionConstraintMotor; + class hkpPositionConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpPositionConstraintMotor; inline static constexpr auto VTABLE = VTABLE_hkpPositionConstraintMotor; - // members - float tau; // 20 - float damping; // 24 - float proportionalRecoveryVelocity; // 28 - float constantRecoveryVelocity; // 2C - }; - static_assert(sizeof(hkpPositionConstraintMotor) == 0x30); - - class hkpVelocityConstraintMotor : public hkpLimitedForceConstraintMotor - { - public: - inline static constexpr auto RTTI = RTTI_hkpVelocityConstraintMotor; + // members + float tau; // 20 + float damping; // 24 + float proportionalRecoveryVelocity; // 28 + float constantRecoveryVelocity; // 2C + }; + static_assert(sizeof(hkpPositionConstraintMotor) == 0x30); + + class hkpVelocityConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpVelocityConstraintMotor; inline static constexpr auto VTABLE = VTABLE_hkpVelocityConstraintMotor; - // members - float tau; // 20 - float targetVelocity; // 24 - bool useConstraintTarget; // 28 - }; - static_assert(sizeof(hkpVelocityConstraintMotor) == 0x30); - - class hkpSpringDamperConstraintMotor : public hkpLimitedForceConstraintMotor - { - public: - inline static constexpr auto RTTI = RTTI_hkpSpringDamperConstraintMotor; + // members + float tau; // 20 + float targetVelocity; // 24 + bool useConstraintTarget; // 28 + }; + static_assert(sizeof(hkpVelocityConstraintMotor) == 0x30); + + class hkpSpringDamperConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpSpringDamperConstraintMotor; inline static constexpr auto VTABLE = VTABLE_hkpSpringDamperConstraintMotor; - // members - float springConstant; // 20 - float springDamping; // 24 - }; - static_assert(sizeof(hkpSpringDamperConstraintMotor) == 0x28); + // members + float springConstant; // 20 + float springDamping; // 24 + }; + static_assert(sizeof(hkpSpringDamperConstraintMotor) == 0x28); - class hkpCallbackConstraintMotor : public hkpLimitedForceConstraintMotor - { - public: - enum class CallbackType - { - kUnk = 0, + class hkpCallbackConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + enum class CallbackType + { + kUnk = 0, - kUser0, - kUser1, - kUser2, + kUser0, + kUser1, + kUser2, - kNUM - }; + kNUM + }; - inline static constexpr auto RTTI = RTTI_hkpCallbackConstraintMotor; + inline static constexpr auto RTTI = RTTI_hkpCallbackConstraintMotor; inline static constexpr auto VTABLE = VTABLE_hkpCallbackConstraintMotor; - using CallbackFunction = void(const hkpCallbackConstraintMotor& motor, const void* unk0, void* unk1); + using CallbackFunction = void(const hkpCallbackConstraintMotor& motor, const void* unk0, void* unk1); - // members - CallbackFunction* func; // 20 - stl::enumeration callbackType; // 28 - std::uint64_t userData0; // 30 - std::uint64_t userData1; // 38 - std::uint64_t userData2; // 40 - }; - static_assert(sizeof(hkpCallbackConstraintMotor) == 0x48); + // members + CallbackFunction* func; // 20 + stl::enumeration callbackType; // 28 + std::uint64_t userData0; // 30 + std::uint64_t userData1; // 38 + std::uint64_t userData2; // 40 + }; + static_assert(sizeof(hkpCallbackConstraintMotor) == 0x48); } \ No newline at end of file diff --git a/include/RE/H/hkpLimitedHingeConstraintData.h b/include/RE/H/hkpLimitedHingeConstraintData.h index 4830a79bd..13349d088 100644 --- a/include/RE/H/hkpLimitedHingeConstraintData.h +++ b/include/RE/H/hkpLimitedHingeConstraintData.h @@ -45,7 +45,7 @@ namespace RE inline float getCurrentAngle() { return solverResults[SolverResultType::kLimit].data * -1.f; - } + } hkpSolverResults solverResults[SolverResultType::kNUM]; // 00 bool previousTargetInitialized; // 40 diff --git a/include/RE/H/hkpRagdollConstraintData.h b/include/RE/H/hkpRagdollConstraintData.h index 8f4956ef4..283be4267 100644 --- a/include/RE/H/hkpRagdollConstraintData.h +++ b/include/RE/H/hkpRagdollConstraintData.h @@ -22,7 +22,7 @@ namespace RE kTwist, kCone, kPlane, - + kLinear0, kLinear1, kLinear2, diff --git a/include/RE/H/hkpSolverResults.h b/include/RE/H/hkpSolverResults.h index 52da57080..96ea565cd 100644 --- a/include/RE/H/hkpSolverResults.h +++ b/include/RE/H/hkpSolverResults.h @@ -3,12 +3,12 @@ namespace RE { - class hkpSolverResults - { - public: - float impulse; // 00 - float data; // 04 - }; - static_assert(sizeof(hkpSolverResults) == 0x08); + class hkpSolverResults + { + public: + float impulse; // 00 + float data; // 04 + }; + static_assert(sizeof(hkpSolverResults) == 0x08); } \ No newline at end of file From 78f140e3878f241b40d0004ae3bd9f30f7a2fa74 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:58:46 +0530 Subject: [PATCH 40/76] Standardize `BSContainer::ForEachResult` functions --- include/RE/B/BGSKeywordForm.h | 4 ++-- include/RE/B/BGSListForm.h | 2 +- include/RE/B/BGSOutfit.h | 4 ++-- include/RE/P/ProcessLists.h | 10 +++++----- include/RE/T/TES.h | 4 ++-- include/RE/T/TESObjectCELL.h | 4 ++-- src/RE/B/BGSKeywordForm.cpp | 18 +++++++++--------- src/RE/B/BGSListForm.cpp | 10 +++++----- src/RE/P/ProcessLists.cpp | 32 ++++++++++++++++---------------- src/RE/T/TES.cpp | 18 +++++++++--------- src/RE/T/TESForm.cpp | 8 ++++---- src/RE/T/TESObjectCELL.cpp | 10 +++++----- src/RE/T/TESObjectREFR.cpp | 4 ++-- 13 files changed, 64 insertions(+), 64 deletions(-) diff --git a/include/RE/B/BGSKeywordForm.h b/include/RE/B/BGSKeywordForm.h index 2ae40869c..29d23dafb 100644 --- a/include/RE/B/BGSKeywordForm.h +++ b/include/RE/B/BGSKeywordForm.h @@ -27,7 +27,7 @@ namespace RE bool AddKeyword(BGSKeyword* a_keyword); bool AddKeywords(const std::vector& a_keywords); [[nodiscard]] bool ContainsKeywordString(std::string_view a_editorID) const; - void ForEachKeyword(std::function a_callback) const; + void ForEachKeyword(std::function a_callback) const; [[nodiscard]] std::optional GetKeywordAt(std::uint32_t a_idx) const; [[nodiscard]] std::optional GetKeywordIndex(BGSKeyword* a_keyword) const; [[nodiscard]] std::uint32_t GetNumKeywords() const; @@ -35,7 +35,7 @@ namespace RE [[nodiscard]] bool HasKeywordString(std::string_view a_editorID) const; bool RemoveKeyword(std::uint32_t a_index); bool RemoveKeyword(BGSKeyword* a_keyword); - bool RemoveKeywords(const std::vector& a_keywords); + bool RemoveKeywords(const std::vector& a_keywords); // members BGSKeyword** keywords; // 08 - KWDA diff --git a/include/RE/B/BGSListForm.h b/include/RE/B/BGSListForm.h index e70fc5048..978367d95 100644 --- a/include/RE/B/BGSListForm.h +++ b/include/RE/B/BGSListForm.h @@ -43,7 +43,7 @@ namespace RE void AddForm(TESForm* a_form); [[nodiscard]] bool ContainsOnlyType(FormType a_formType) const; - void ForEachForm(std::function a_callback) const; + void ForEachForm(std::function a_callback) const; [[nodiscard]] bool HasForm(const TESForm* a_form) const; [[nodiscard]] bool HasForm(FormID a_formID) const; diff --git a/include/RE/B/BGSOutfit.h b/include/RE/B/BGSOutfit.h index 55d00a9f2..36002ad66 100644 --- a/include/RE/B/BGSOutfit.h +++ b/include/RE/B/BGSOutfit.h @@ -30,10 +30,10 @@ namespace RE bool Load(TESFile* a_mod) override; // 06 void InitItemImpl() override; // 13 - void ForEachItem(std::function a_callback) const + void ForEachItem(std::function a_callback) const { for (auto& item : outfitItems) { - if (item && a_callback(*item) == BSContainer::ForEachResult::kStop) { + if (item && a_callback(item) == BSContainer::ForEachResult::kStop) { return; } } diff --git a/include/RE/P/ProcessLists.h b/include/RE/P/ProcessLists.h index db8c8b40e..18d9d7ec1 100644 --- a/include/RE/P/ProcessLists.h +++ b/include/RE/P/ProcessLists.h @@ -36,11 +36,11 @@ namespace RE static ProcessLists* GetSingleton(); void ClearCachedFactionFightReactions() const; - void ForAllActors(std::function a_callback); - void ForEachHighActor(std::function a_callback); - void ForEachMagicTempEffect(std::function a_callback); - void ForEachModelEffect(std::function a_callback); - void ForEachShaderEffect(std::function a_callback); + void ForAllActors(std::function a_callback); + void ForEachHighActor(std::function a_callback); + void ForEachMagicTempEffect(std::function a_callback); + void ForEachModelEffect(std::function a_callback); + void ForEachShaderEffect(std::function a_callback); float GetSystemTimeClock(); std::int16_t RequestHighestDetectionLevelAgainstActor(Actor* a_actor, std::uint32_t& a_LOSCount); void StopAllMagicEffects(TESObjectREFR& a_ref); diff --git a/include/RE/T/TES.h b/include/RE/T/TES.h index 73387d824..e586f9ef1 100644 --- a/include/RE/T/TES.h +++ b/include/RE/T/TES.h @@ -66,8 +66,8 @@ namespace RE static TES* GetSingleton(); - void ForEachReference(std::function a_callback); - void ForEachReferenceInRange(TESObjectREFR* a_origin, float a_radius, std::function a_callback); + void ForEachReference(std::function a_callback); + void ForEachReferenceInRange(TESObjectREFR* a_origin, float a_radius, std::function a_callback); TESObjectCELL* GetCell(const NiPoint3& a_position) const; MATERIAL_ID GetLandMaterialType(const NiPoint3& a_position) const; diff --git a/include/RE/T/TESObjectCELL.h b/include/RE/T/TESObjectCELL.h index eb6c58399..eb5ee231b 100644 --- a/include/RE/T/TESObjectCELL.h +++ b/include/RE/T/TESObjectCELL.h @@ -194,8 +194,8 @@ namespace RE TESNPC* GetActorOwner(); bhkWorld* GetbhkWorld() const; - void ForEachReference(std::function a_callback) const; - void ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function a_callback) const; + void ForEachReference(std::function a_callback) const; + void ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function a_callback) const; EXTERIOR_DATA* GetCoordinates(); TESFaction* GetFactionOwner(); INTERIOR_DATA* GetLighting(); diff --git a/src/RE/B/BGSKeywordForm.cpp b/src/RE/B/BGSKeywordForm.cpp index 93154b46b..14a2c15c8 100644 --- a/src/RE/B/BGSKeywordForm.cpp +++ b/src/RE/B/BGSKeywordForm.cpp @@ -42,8 +42,8 @@ namespace RE bool BGSKeywordForm::ContainsKeywordString(std::string_view a_editorID) const { bool result = false; - ForEachKeyword([&](const BGSKeyword& a_keyword) { - if (a_keyword.formEditorID.contains(a_editorID)) { + ForEachKeyword([&](const BGSKeyword* a_keyword) { + if (a_keyword->formEditorID.contains(a_editorID)) { result = true; return BSContainer::ForEachResult::kStop; } @@ -52,11 +52,11 @@ namespace RE return result; } - void BGSKeywordForm::ForEachKeyword(std::function a_callback) const + void BGSKeywordForm::ForEachKeyword(std::function a_callback) const { if (keywords) { for (std::uint32_t idx = 0; idx < numKeywords; ++idx) { - if (keywords[idx] && a_callback(*keywords[idx]) == BSContainer::ForEachResult::kStop) { + if (keywords[idx] && a_callback(keywords[idx]) == BSContainer::ForEachResult::kStop) { return; } } @@ -92,8 +92,8 @@ namespace RE bool BGSKeywordForm::HasKeywordID(FormID a_formID) const { bool result = false; - ForEachKeyword([&](const BGSKeyword& a_keyword) { - if (a_keyword.GetFormID() == a_formID) { + ForEachKeyword([&](const BGSKeyword* a_keyword) { + if (a_keyword->GetFormID() == a_formID) { result = true; return BSContainer::ForEachResult::kStop; } @@ -105,8 +105,8 @@ namespace RE bool BGSKeywordForm::HasKeywordString(std::string_view a_editorID) const { bool result = false; - ForEachKeyword([&](const BGSKeyword& a_keyword) { - if (a_keyword.formEditorID == a_editorID) { + ForEachKeyword([&](const BGSKeyword* a_keyword) { + if (a_keyword->formEditorID == a_editorID) { result = true; return BSContainer::ForEachResult::kStop; } @@ -129,7 +129,7 @@ namespace RE return index ? RemoveKeyword(*index) : false; } - bool BGSKeywordForm::RemoveKeywords(const std::vector& a_keywords) + bool BGSKeywordForm::RemoveKeywords(const std::vector& a_keywords) { std::vector copiedData{ keywords, keywords + numKeywords }; if (std::erase_if(copiedData, [&](auto& keyword) { return std::ranges::find(a_keywords, keyword) != a_keywords.end(); }) > 0) { diff --git a/src/RE/B/BGSListForm.cpp b/src/RE/B/BGSListForm.cpp index 15361c080..5433b8c97 100644 --- a/src/RE/B/BGSListForm.cpp +++ b/src/RE/B/BGSListForm.cpp @@ -12,8 +12,8 @@ namespace RE bool BGSListForm::ContainsOnlyType(FormType a_formType) const { bool result = true; - ForEachForm([&](const TESForm& a_form) { - if (a_form.GetFormType() != a_formType) { + ForEachForm([&](const TESForm* a_form) { + if (a_form->GetFormType() != a_formType) { result = false; return BSContainer::ForEachResult::kStop; } @@ -47,17 +47,17 @@ namespace RE return HasForm(form); } - void BGSListForm::ForEachForm(std::function a_callback) const + void BGSListForm::ForEachForm(std::function a_callback) const { for (const auto& form : forms) { - if (form && a_callback(*form) == BSContainer::ForEachResult::kStop) { + if (form && a_callback(form) == BSContainer::ForEachResult::kStop) { return; } } if (scriptAddedTempForms) { for (const auto& addedFormID : *scriptAddedTempForms) { const auto addedForm = TESForm::LookupByID(addedFormID); - if (addedForm && a_callback(*addedForm) == BSContainer::ForEachResult::kStop) { + if (addedForm && a_callback(addedForm) == BSContainer::ForEachResult::kStop) { return; } } diff --git a/src/RE/P/ProcessLists.cpp b/src/RE/P/ProcessLists.cpp index cd861fd0e..acf86dfd4 100644 --- a/src/RE/P/ProcessLists.cpp +++ b/src/RE/P/ProcessLists.cpp @@ -21,13 +21,13 @@ namespace RE return func(this); } - void ProcessLists::ForAllActors(std::function a_callback) + void ProcessLists::ForAllActors(std::function a_callback) { for (auto& list : allProcesses) { if (list) { for (auto& actorHandle : *list) { const auto& actor = actorHandle.get(); - if (actor && a_callback(*actor) == BSContainer::ForEachResult::kStop) { + if (actor && a_callback(actor.get()) == BSContainer::ForEachResult::kStop) { return; } } @@ -35,44 +35,44 @@ namespace RE } } - void ProcessLists::ForEachHighActor(std::function a_callback) + void ProcessLists::ForEachHighActor(std::function a_callback) { for (auto& highActorHandle : highActorHandles) { const auto& highActor = highActorHandle.get(); - if (highActor && a_callback(*highActor) == BSContainer::ForEachResult::kStop) { + if (highActor && a_callback(highActor.get()) == BSContainer::ForEachResult::kStop) { break; } } } - void ProcessLists::ForEachMagicTempEffect(std::function a_callback) + void ProcessLists::ForEachMagicTempEffect(std::function a_callback) { BSSpinLockGuard locker(magicEffectsLock); for (auto& tempEffectPtr : magicEffects) { const auto& tempEffect = tempEffectPtr.get(); - if (tempEffect && a_callback(*tempEffect) == BSContainer::ForEachResult::kStop) { + if (tempEffect && a_callback(tempEffect) == BSContainer::ForEachResult::kStop) { break; } } } - void ProcessLists::ForEachModelEffect(std::function a_callback) + void ProcessLists::ForEachModelEffect(std::function a_callback) { - ForEachMagicTempEffect([a_callback](BSTempEffect& a_tempEffect) { - const auto modelEffect = a_tempEffect.As(); - if (modelEffect && a_callback(*modelEffect) == BSContainer::ForEachResult::kStop) { + ForEachMagicTempEffect([a_callback](BSTempEffect* a_tempEffect) { + const auto modelEffect = a_tempEffect->As(); + if (modelEffect && a_callback(modelEffect) == BSContainer::ForEachResult::kStop) { return BSContainer::ForEachResult::kStop; } return BSContainer::ForEachResult::kContinue; }); } - void ProcessLists::ForEachShaderEffect(std::function a_callback) + void ProcessLists::ForEachShaderEffect(std::function a_callback) { - ForEachMagicTempEffect([a_callback](BSTempEffect& a_tempEffect) { - const auto shaderEffect = a_tempEffect.As(); - if (shaderEffect && a_callback(*shaderEffect) == BSContainer::ForEachResult::kStop) { + ForEachMagicTempEffect([a_callback](BSTempEffect* a_tempEffect) { + const auto shaderEffect = a_tempEffect->As(); + if (shaderEffect && a_callback(shaderEffect) == BSContainer::ForEachResult::kStop) { return BSContainer::ForEachResult::kStop; } return BSContainer::ForEachResult::kContinue; @@ -96,8 +96,8 @@ namespace RE void ProcessLists::StopAllMagicEffects(TESObjectREFR& a_ref) { const auto handle = a_ref.CreateRefHandle(); - ForEachMagicTempEffect([&](BSTempEffect& a_tempEffect) { - const auto referenceEffect = a_tempEffect.As(); + ForEachMagicTempEffect([&](BSTempEffect* a_tempEffect) { + const auto referenceEffect = a_tempEffect->As(); if (referenceEffect && referenceEffect->target == handle) { referenceEffect->finished = true; } diff --git a/src/RE/T/TES.cpp b/src/RE/T/TES.cpp index 485a3620f..8e6305308 100644 --- a/src/RE/T/TES.cpp +++ b/src/RE/T/TES.cpp @@ -15,10 +15,10 @@ namespace RE return *singleton; } - void TES::ForEachReference(std::function a_callback) + void TES::ForEachReference(std::function a_callback) { if (interiorCell) { - interiorCell->ForEachReference([&](TESObjectREFR& a_ref) { + interiorCell->ForEachReference([&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } else { @@ -28,7 +28,7 @@ namespace RE std::uint32_t y = 0; do { if (const auto cell = gridCells->GetCell(x, y); cell && cell->IsAttached()) { - cell->ForEachReference([&](TESObjectREFR& a_ref) { + cell->ForEachReference([&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } @@ -39,19 +39,19 @@ namespace RE } } if (const auto skyCell = worldSpace ? worldSpace->GetSkyCell() : nullptr; skyCell) { - skyCell->ForEachReference([&](TESObjectREFR& a_ref) { + skyCell->ForEachReference([&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } } - void TES::ForEachReferenceInRange(TESObjectREFR* a_origin, float a_radius, std::function a_callback) + void TES::ForEachReferenceInRange(TESObjectREFR* a_origin, float a_radius, std::function a_callback) { if (a_origin && a_radius > 0.0f) { const auto originPos = a_origin->GetPosition(); if (interiorCell) { - interiorCell->ForEachReferenceInRange(originPos, a_radius, [&](TESObjectREFR& a_ref) { + interiorCell->ForEachReferenceInRange(originPos, a_radius, [&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } else { @@ -69,7 +69,7 @@ namespace RE if (const auto cellCoords = cell->GetCoordinates(); cellCoords) { const NiPoint2 worldPos{ cellCoords->worldX, cellCoords->worldY }; if (worldPos.x < xPlus && (worldPos.x + 4096.0f) > xMinus && worldPos.y < yPlus && (worldPos.y + 4096.0f) > yMinus) { - cell->ForEachReferenceInRange(originPos, a_radius, [&](TESObjectREFR& a_ref) { + cell->ForEachReferenceInRange(originPos, a_radius, [&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } @@ -83,12 +83,12 @@ namespace RE } if (const auto skyCell = worldSpace ? worldSpace->GetSkyCell() : nullptr; skyCell) { - skyCell->ForEachReferenceInRange(originPos, a_radius, [&](TESObjectREFR& a_ref) { + skyCell->ForEachReferenceInRange(originPos, a_radius, [&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } } else { - ForEachReference([&](TESObjectREFR& a_ref) { + ForEachReference([&](TESObjectREFR* a_ref) { return a_callback(a_ref); }); } diff --git a/src/RE/T/TESForm.cpp b/src/RE/T/TESForm.cpp index d280c2869..68b67cd00 100644 --- a/src/RE/T/TESForm.cpp +++ b/src/RE/T/TESForm.cpp @@ -69,8 +69,8 @@ namespace RE // Iterate through the keywords bool hasKeyword = false; - keywordForm->ForEachKeyword([&](const BGSKeyword& a_keyword) { - if (std::ranges::find(editorIDs, a_keyword.GetFormEditorID()) != editorIDs.end()) { + keywordForm->ForEachKeyword([&](const BGSKeyword* a_keyword) { + if (std::ranges::find(editorIDs, a_keyword->GetFormEditorID()) != editorIDs.end()) { hasKeyword = true; return BSContainer::ForEachResult::kStop; } @@ -122,8 +122,8 @@ namespace RE bool hasKeyword = false; - a_keywordList->ForEachForm([&](const TESForm& a_form) { - const auto keyword = a_form.As(); + a_keywordList->ForEachForm([&](const TESForm* a_form) { + const auto keyword = a_form->As(); hasKeyword = keyword && keywordForm->HasKeyword(keyword); if (a_matchAll && !hasKeyword || hasKeyword) { return BSContainer::ForEachResult::kStop; diff --git a/src/RE/T/TESObjectCELL.cpp b/src/RE/T/TESObjectCELL.cpp index e93c657c9..779df2405 100644 --- a/src/RE/T/TESObjectCELL.cpp +++ b/src/RE/T/TESObjectCELL.cpp @@ -10,21 +10,21 @@ namespace RE { - void TESObjectCELL::ForEachReference(std::function a_callback) const + void TESObjectCELL::ForEachReference(std::function a_callback) const { BSSpinLockGuard locker(spinLock); for (const auto& ref : references) { - if (ref && a_callback(*ref) == BSContainer::ForEachResult::kStop) { + if (ref && a_callback(ref.get()) == BSContainer::ForEachResult::kStop) { break; } } } - void TESObjectCELL::ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function a_callback) const + void TESObjectCELL::ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function a_callback) const { const float squaredRadius = a_radius * a_radius; - ForEachReference([&](TESObjectREFR& ref) { - const auto distance = a_origin.GetSquaredDistance(ref.GetPosition()); + ForEachReference([&](TESObjectREFR* ref) { + const auto distance = a_origin.GetSquaredDistance(ref->GetPosition()); return distance <= squaredRadius ? a_callback(ref) : BSContainer::ForEachResult::kContinue; diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index f7a782f8d..9d83840dd 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -578,8 +578,8 @@ namespace RE bool hasKeyword = false; - a_keywordList->ForEachForm([&](TESForm& a_form) { - const auto keyword = a_form.As(); + a_keywordList->ForEachForm([&](TESForm* a_form) { + const auto keyword = a_form->As(); hasKeyword = keyword && HasKeyword(keyword); if (a_matchAll && !hasKeyword || hasKeyword) { return BSContainer::ForEachResult::kStop; From 248c2d26f214aa4385f0ddeba71e8b61640af85c Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:24:20 +0530 Subject: [PATCH 41/76] Add `MagicItem::IsHostile` --- include/RE/I/IngredientItem.h | 1 - include/RE/M/MagicItem.h | 1 + src/RE/I/IngredientItem.cpp | 5 ----- src/RE/M/MagicItem.cpp | 5 +++++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/RE/I/IngredientItem.h b/include/RE/I/IngredientItem.h index f159359e8..3884ff2b4 100644 --- a/include/RE/I/IngredientItem.h +++ b/include/RE/I/IngredientItem.h @@ -99,7 +99,6 @@ namespace RE // override (BGSKeywordForm) [[nodiscard]] BGSKeyword* GetDefaultKeyword() const override; // 05 - [[nodiscard]] bool IsHostile() const; bool LearnEffect(std::uint32_t a_index); bool LearnEffect(EffectSetting* a_effect); std::optional LearnNextEffect(); diff --git a/include/RE/M/MagicItem.h b/include/RE/M/MagicItem.h index 1da6b0779..fc9310bf3 100644 --- a/include/RE/M/MagicItem.h +++ b/include/RE/M/MagicItem.h @@ -118,6 +118,7 @@ namespace RE [[nodiscard]] std::int32_t GetLargestArea() const; [[nodiscard]] std::uint32_t GetLongestDuration() const; [[nodiscard]] bool HasEffect(EffectArchetype a_archetype); + [[nodiscard]] bool IsHostile() const; [[nodiscard]] bool IsPermanent() const; void Traverse(MagicItemTraversalFunctor& a_visitor) const; diff --git a/src/RE/I/IngredientItem.cpp b/src/RE/I/IngredientItem.cpp index 88f2f1339..3b31df0c4 100644 --- a/src/RE/I/IngredientItem.cpp +++ b/src/RE/I/IngredientItem.cpp @@ -4,11 +4,6 @@ namespace RE { - bool IngredientItem::IsHostile() const - { - return hostileCount > 0; - } - bool IngredientItem::LearnEffect(std::uint32_t a_index) { if (a_index < 4) { diff --git a/src/RE/M/MagicItem.cpp b/src/RE/M/MagicItem.cpp index 1bf83c274..785d9ff7e 100644 --- a/src/RE/M/MagicItem.cpp +++ b/src/RE/M/MagicItem.cpp @@ -73,6 +73,11 @@ namespace RE return func(this, a_archetype); } + bool MagicItem::IsHostile() const + { + return hostileCount > 0; + } + bool MagicItem::IsPermanent() const { using func_t = decltype(&MagicItem::IsPermanent); From 800b4e071bffd0a6527387f0d9164e35b5ae4120 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 27 Jan 2024 00:02:44 +0530 Subject: [PATCH 42/76] `ReferenceEffect` RE --- include/RE/A/AttachTechniqueInput.h | 11 +++++------ include/RE/M/ModelReferenceEffect.h | 18 +++++++++--------- include/RE/R/RefAttachTechniqueInput.h | 14 +++++++------- include/RE/S/ShaderReferenceEffect.h | 8 ++++---- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/RE/A/AttachTechniqueInput.h b/include/RE/A/AttachTechniqueInput.h index b2236eb25..71632ce8c 100644 --- a/include/RE/A/AttachTechniqueInput.h +++ b/include/RE/A/AttachTechniqueInput.h @@ -1,6 +1,5 @@ #pragma once -#include "RE/M/MagicSystem.h" #include "RE/N/NiSmartPointer.h" namespace RE @@ -17,13 +16,13 @@ namespace RE virtual ~AttachTechniqueInput(); // 00 // add - virtual void Unk_01(void); // 01 + virtual void Clear(); // 01 // members - NiPointer current3DRoot; // 08 - smart ptr - NiPointer attachedArt; // 10 - smart ptr - MagicSystem::CastingSource castingSource; // 18 - std::uint32_t unk1C; // 1C + NiPointer current3DRoot; // 08 - smart ptr + NiPointer attachedArt; // 10 - smart ptr + std::uint32_t attachPoint; // 18 - MagicSystem::CastingSource for casting art + std::uint32_t pad18; // 18 }; static_assert(sizeof(AttachTechniqueInput) == 0x20); } diff --git a/include/RE/M/ModelReferenceEffect.h b/include/RE/M/ModelReferenceEffect.h index 3c379f203..f29e9c360 100644 --- a/include/RE/M/ModelReferenceEffect.h +++ b/include/RE/M/ModelReferenceEffect.h @@ -1,6 +1,6 @@ #pragma once -#include "RE/B/BSFixedString.h" +#include "RE/B/BGSLoadGameSubBuffer.h" #include "RE/B/BSTEvent.h" #include "RE/N/NiSmartPointer.h" #include "RE/R/RefAttachTechniqueInput.h" @@ -9,9 +9,9 @@ namespace RE { + class BGSArtObjectCloneTask; class NiAVObject; struct BSAnimationGraphEvent; - class BGSArtObjectCloneTask; class ModelReferenceEffect : public ReferenceEffect, // 00 @@ -55,13 +55,13 @@ namespace RE BSEventNotifyControl ProcessEvent(const BSAnimationGraphEvent* a_event, BSTEventSource* a_eventSource) override; // 01 // members - RefAttachTechniqueInput hitEffectArtData; // 68 - std::uint64_t unkB0; // B0 - BGSArtObject* artObject; // B8 - BSTSmartPointer cloneTask; // C0 - NiPointer artObject3D; // C8 - stl::enumeration flags; // D0 - std::uint32_t padD4; // D4 + RefAttachTechniqueInput hitEffectArtData; // 68 + BGSLoadGameSubBuffer loadGameSubBuffer; // B0 + BGSArtObject* artObject; // B8 + BSTSmartPointer cloneTask; // C0 + NiPointer artObject3D; // C8 + stl::enumeration flags; // D0 + std::uint32_t padD4; // D4 }; static_assert(sizeof(ModelReferenceEffect) == 0xD8); } diff --git a/include/RE/R/RefAttachTechniqueInput.h b/include/RE/R/RefAttachTechniqueInput.h index 887531011..53fc3be5a 100644 --- a/include/RE/R/RefAttachTechniqueInput.h +++ b/include/RE/R/RefAttachTechniqueInput.h @@ -16,15 +16,15 @@ namespace RE ~RefAttachTechniqueInput() override; // 00 // override (BSAttachTechniques::AttachTechniqueInput) - void Unk_01(void) override; // 01 + void Clear() override; // 01 // members - std::uint64_t unk20; // 20 - TESRace* actorRace; // 28 - bhkWorld* physicsWorld; // 30 - std::uint32_t collisionFilter; // 38 - std::uint32_t unk3C; // 3C - BSFixedString nodeName; // 40 + TESObjectREFR* actor; // 20 + TESRace* actorRace; // 28 + bhkWorld* physicsWorld; // 30 + std::uint32_t collisionFilter; // 38 + std::uint32_t pad3C; // 3C + BSFixedString nodeName; // 40 }; static_assert(sizeof(RefAttachTechniqueInput) == 0x48); } diff --git a/include/RE/S/ShaderReferenceEffect.h b/include/RE/S/ShaderReferenceEffect.h index dcd152f57..c3dedac2f 100644 --- a/include/RE/S/ShaderReferenceEffect.h +++ b/include/RE/S/ShaderReferenceEffect.h @@ -88,10 +88,10 @@ namespace RE TESEffectShader* effectData; // 108 BSEffectShaderData* effectShaderData; // 110 NiPointer targetRoot; // 118 - smart ptr - float unk120; // 120 - float unk124; // 124 - 1.0f - float addonModelsScaleStart; // 128 - 1.0f - std::uint32_t unk12C; // 12C + float alphaTimer; // 120 + float addonAlpha; // 124 - 1.0f + float addonScale; // 128 - 1.0f + float effectShaderAge; // 12C stl::enumeration flags; // 130 std::uint32_t pushCount; // 134 }; From 767d6ba23e776d0b40b2888696f3ae120bf5f375 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 27 Jan 2024 00:03:16 +0530 Subject: [PATCH 43/76] Add `Actor::IsDualCasting` --- include/RE/A/Actor.h | 1 + src/RE/A/Actor.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 656bc0e73..258e2e95b 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -573,6 +573,7 @@ namespace RE bool IsCasting(MagicItem* a_spell) const; bool IsCommandedActor() const; bool IsCurrentShout(SpellItem* a_power); + bool IsDualCasting() const; bool IsEssential() const; bool IsFactionInCrimeGroup(const TESFaction* a_faction) const; bool IsGhost() const; diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index cfc81a100..1d330057a 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -749,14 +749,24 @@ namespace RE return boolFlags.all(BOOL_FLAGS::kIsCommandedActor); } - bool Actor::IsCurrentShout(SpellItem* a_spell) + bool Actor::IsCurrentShout(SpellItem* a_power) { using func_t = decltype(&Actor::IsCurrentShout); REL::Relocation func{ RELOCATION_ID(37858, 38812) }; - return func(this, a_spell); + return func(this, a_power); + } + + bool Actor::IsDualCasting() const + { + if (!currentProcess) { + return false; + } + + const auto highProcess = currentProcess->high; + return highProcess && highProcess->isDualCasting; } - bool Actor::IsEssential() const + bool Actor::IsEssential() const { return boolFlags.all(BOOL_FLAGS::kEssential); } From 23abe97fca24d024d5379db73307149ea4ad38fb Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 27 Jan 2024 00:04:10 +0530 Subject: [PATCH 44/76] Add `ExtraDataList::HasQuestObjectAlias` --- include/RE/E/ExtraDataList.h | 1 + src/RE/E/ExtraDataList.cpp | 9 ++++++++- src/RE/I/InventoryEntryData.cpp | 12 +++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/RE/E/ExtraDataList.h b/include/RE/E/ExtraDataList.h index 98e891596..baec37472 100644 --- a/include/RE/E/ExtraDataList.h +++ b/include/RE/E/ExtraDataList.h @@ -181,6 +181,7 @@ namespace RE TESForm* GetOwner(); SOUL_LEVEL GetSoulLevel() const; ObjectRefHandle GetTeleportLinkedDoor(); + bool HasQuestObjectAlias(); void SetCount(std::uint16_t a_count); void SetEncounterZone(BGSEncounterZone* a_zone); void SetExtraFlags(ExtraFlags::Flag a_flags, bool a_enable); diff --git a/src/RE/E/ExtraDataList.cpp b/src/RE/E/ExtraDataList.cpp index bbf0b83ba..7d3b546df 100644 --- a/src/RE/E/ExtraDataList.cpp +++ b/src/RE/E/ExtraDataList.cpp @@ -282,7 +282,14 @@ namespace RE ObjectRefHandle(); } - void ExtraDataList::SetCount(std::uint16_t a_count) + bool ExtraDataList::HasQuestObjectAlias() + { + using func_t = decltype(&ExtraDataList::HasQuestObjectAlias); + REL::Relocation func{ RELOCATION_ID(11913, 12052) }; + return func(this); + } + + void ExtraDataList::SetCount(std::uint16_t a_count) { using func_t = decltype(&ExtraDataList::SetCount); REL::Relocation func{ Offset::ExtraDataList::SetCount }; diff --git a/src/RE/I/InventoryEntryData.cpp b/src/RE/I/InventoryEntryData.cpp index 18402da92..2c467664e 100644 --- a/src/RE/I/InventoryEntryData.cpp +++ b/src/RE/I/InventoryEntryData.cpp @@ -245,9 +245,15 @@ namespace RE bool InventoryEntryData::IsQuestObject() const { - using func_t = decltype(&InventoryEntryData::IsQuestObject); - REL::Relocation func{ RELOCATION_ID(15767, 16005) }; - return func(this); + if (extraLists) { + for (const auto& xList : *extraLists) { + if (xList && xList->HasQuestObjectAlias()) { + return true; + } + } + } + + return false; } void InventoryEntryData::PoisonObject(AlchemyItem* a_alchItem, std::uint32_t a_count) From b749caeee7ab8acee793c714915e34cad339642f Mon Sep 17 00:00:00 2001 From: powerof3 Date: Fri, 26 Jan 2024 18:40:16 +0000 Subject: [PATCH 45/76] maintenance --- src/RE/A/Actor.cpp | 6 +++--- src/RE/E/ExtraDataList.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 1d330057a..bc67a5067 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -756,17 +756,17 @@ namespace RE return func(this, a_power); } - bool Actor::IsDualCasting() const + bool Actor::IsDualCasting() const { if (!currentProcess) { return false; } - const auto highProcess = currentProcess->high; + const auto highProcess = currentProcess->high; return highProcess && highProcess->isDualCasting; } - bool Actor::IsEssential() const + bool Actor::IsEssential() const { return boolFlags.all(BOOL_FLAGS::kEssential); } diff --git a/src/RE/E/ExtraDataList.cpp b/src/RE/E/ExtraDataList.cpp index 7d3b546df..b14e07df9 100644 --- a/src/RE/E/ExtraDataList.cpp +++ b/src/RE/E/ExtraDataList.cpp @@ -282,14 +282,14 @@ namespace RE ObjectRefHandle(); } - bool ExtraDataList::HasQuestObjectAlias() + bool ExtraDataList::HasQuestObjectAlias() { using func_t = decltype(&ExtraDataList::HasQuestObjectAlias); REL::Relocation func{ RELOCATION_ID(11913, 12052) }; return func(this); } - void ExtraDataList::SetCount(std::uint16_t a_count) + void ExtraDataList::SetCount(std::uint16_t a_count) { using func_t = decltype(&ExtraDataList::SetCount); REL::Relocation func{ Offset::ExtraDataList::SetCount }; From 19b33364522b4a96a8828599bd3547603a278733 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:01:47 -0600 Subject: [PATCH 46/76] Improve WinAPI --- include/SKSE/Impl/WinAPI.h | 978 ++++++++++++++++++++++++++++------ src/SKSE/Impl/WinAPI.cpp | 1023 ++++++++++++++++++++++++++++-------- 2 files changed, 1641 insertions(+), 360 deletions(-) diff --git a/include/SKSE/Impl/WinAPI.h b/include/SKSE/Impl/WinAPI.h index ab6b84cb8..3b65100aa 100644 --- a/include/SKSE/Impl/WinAPI.h +++ b/include/SKSE/Impl/WinAPI.h @@ -1,117 +1,543 @@ #pragma once +#ifdef _INC_WINAPIFAMILY +# error Windows API detected. Please move any Windows API includes after CommonLibSSE, or remove them. +#else + namespace SKSE::WinAPI { + // general constants + inline const auto INVALID_HANDLE_VALUE{ reinterpret_cast(static_cast(-1)) }; + inline constexpr auto MAX_PATH{ 260u }; + + // 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 }; + + // 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 }; + + // 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 IMAGE_SCN_MEM_EXECUTE{ 0x20000000u }; - inline constexpr auto IMAGE_SCN_MEM_WRITE{ 0x80000000u }; - inline const auto INVALID_HANDLE_VALUE{ reinterpret_cast(static_cast(-1)) }; - inline constexpr auto MAX_PATH{ 260u }; - inline constexpr auto MEM_RELEASE{ 0x00008000u }; - inline constexpr auto PAGE_EXECUTE_READWRITE{ 0x40u }; + + // 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 }; + + // 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 }; + + // string normalization forms + inline constexpr auto NORM_FORM_OTHER{ 0x0 }; + inline constexpr auto NORM_FORM_C{ 0x1 }; + inline constexpr auto NORM_FORM_D{ 0x2 }; + inline constexpr auto NORM_FORM_KC{ 0x5 }; + inline constexpr auto NORM_FORM_KD{ 0x6 }; + + // 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" }; + + // 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 }; + + // 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 }; + + using THREAD_START_ROUTINE = std::uint32_t(void* a_param); struct CRITICAL_SECTION { public: - // members - void* DebugInfo; // 00 - std::int32_t LockCount; // 08 - std::int32_t RecursionCount; // 0C - void* OwningThread; // 10 - void* LockSemaphore; // 18 - std::uint64_t* SpinCount; // 20 + void* debugInfo; // 00 + std::int32_t lockCount; // 08 + std::int32_t recursionCount; // 0C + void* owningThread; // 10 + void* lockSemaphore; // 18 + std::uint64_t* spinCount; // 20 }; static_assert(sizeof(CRITICAL_SECTION) == 0x28); - struct _FILETIME + struct FILETIME { - public: - // members - std::uint32_t dwLowDateTime; // 00 - std::uint32_t dwHighDateTime; // 04 + std::uint32_t lo; // 00 + std::uint32_t hi; // 04 }; - static_assert(sizeof(_FILETIME) == 0x8); - using FILETIME = _FILETIME; + static_assert(sizeof(FILETIME) == 0x8); - struct _GUID + struct GUID { - std::uint32_t Data1; - std::uint16_t Data2; - std::uint16_t Data3; - std::uint8_t Data4[8]; + std::uint32_t data1; + std::uint16_t data2; + std::uint16_t data3; + std::uint8_t data4[8]; }; - static_assert(sizeof(_GUID) == 0x10); - using GUID = _GUID; + static_assert(sizeof(GUID) == 0x10); + + // 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 }; + + using HRESULT = std::uint32_t; struct HWND__; using HWND = HWND__*; - struct HINSTANCE__; - using HINSTANCE = HINSTANCE__*; + using WNDPROC = std::int32_t(__stdcall*)(HWND, std::uint32_t, std::uint64_t, std::int64_t); struct HICON__; using HICON = HICON__*; - using WNDPROC = std::int32_t(__stdcall*)(HWND, std::uint32_t, std::uint64_t, std::int64_t); + struct HINSTANCE__; + using HINSTANCE = HINSTANCE__*; + using HMODULE = HINSTANCE; + + struct HKEY__; + using HKEY = HKEY__*; + + inline auto HKEY_CLASSES_ROOT{ reinterpret_cast(0x80000000ull) }; + inline auto HKEY_CURRENT_USER{ reinterpret_cast(0x80000001ull) }; + inline auto HKEY_LOCAL_MACHINE{ reinterpret_cast(0x80000002ull) }; - struct _WIN32_FIND_DATAA + struct IMAGE_DATA_DIRECTORY { - public: - // members - std::uint32_t dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - std::uint32_t nFileSizeHigh; - std::uint32_t nFileSizeLow; - std::uint32_t dwReserved0; - std::uint32_t dwReserved1; - char cFileName[MAX_PATH]; - char cAlternateFileName[14]; + std::uint32_t virtualAddress; + std::uint32_t size; }; - static_assert(sizeof(_WIN32_FIND_DATAA) == 0x140); - using WIN32_FIND_DATAA = _WIN32_FIND_DATAA; + static_assert(sizeof(IMAGE_DATA_DIRECTORY) == 0x8); - struct _WIN32_FIND_DATAW + struct IMAGE_DOS_HEADER { - public: - // members - std::uint32_t dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - std::uint32_t nFileSizeHigh; - std::uint32_t nFileSizeLow; - std::uint32_t dwReserved0; - std::uint32_t dwReserved1; - wchar_t cFileName[MAX_PATH]; - wchar_t cAlternateFileName[14]; + 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(_WIN32_FIND_DATAW) == 0x250); - using WIN32_FIND_DATAW = _WIN32_FIND_DATAW; + static_assert(sizeof(IMAGE_IMPORT_DESCRIPTOR) == 0x14); - struct tagRECT + 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; // PBYTE + std::uint64_t function; // PDWORD + std::uint64_t ordinal; + std::uint64_t address; // PIMAGE_IMPORT_BY_NAME + }; + }; + 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; + + struct POINT + { + std::int32_t x; + std::int32_t y; + }; + + struct PROCESS_INFORMATION + { + void* process; + void* thread; + std::uint32_t processID; + std::uint32_t threadID; + }; + static_assert(sizeof(PROCESS_INFORMATION) == 0x18); + + struct RECT { std::int32_t left; std::int32_t top; std::int32_t right; std::int32_t bottom; }; - using RECT = tagRECT; - struct tagPOINT + struct SECURITY_ATTRIBUTES { - std::int32_t x; - std::int32_t y; + std::uint32_t length; + void* securityDescriptor; + bool inheritHandle; }; - using POINT = tagPOINT; + static_assert(sizeof(SECURITY_ATTRIBUTES) == 0x18); - using HRESULT = std::int32_t; + 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); + + union ULARGE_INTEGER + { + struct + { + std::uint32_t lo; + std::uint32_t hi; + }; + std::uint64_t value; + }; + + struct WIN32_FIND_DATAA + { + // members + 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 + { + // members + 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); enum VKEnum : std::uint32_t { @@ -344,23 +770,105 @@ namespace SKSE::WinAPI VK_RESERVED_FF = 0xFF }; - [[nodiscard]] bool FindClose(void* a_findFile) noexcept; + bool CloseHandle( + void* a_handle) noexcept; + + void CoTaskMemFree( + void* a_block) noexcept; + + void* CreateFileMapping( + void* 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; + + void* CreateFileMapping( + void* 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 CreateProcess( + const char* a_name, + char* a_cmd, + SECURITY_ATTRIBUTES* a_procAttr, + SECURITY_ATTRIBUTES* a_threadAttr, + bool a_inherit, + std::uint32_t a_flags, + void* a_env, + const char* a_curDir, + STARTUPINFOA* a_startInfo, + PROCESS_INFORMATION* a_procInfo) noexcept; + + bool CreateProcess( + const wchar_t* a_name, + wchar_t* a_cmd, + SECURITY_ATTRIBUTES* a_procAttr, + SECURITY_ATTRIBUTES* a_threadAttr, + bool a_inherit, + std::uint32_t a_flags, + void* a_env, + const wchar_t* a_curDir, + STARTUPINFOW* a_startInfo, + PROCESS_INFORMATION* a_procInfo) noexcept; + + void* CreateRemoteThread( + void* 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; + + void* 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; + + std::uint32_t ExpandEnvironmentStrings( + const char* a_src, + char* a_dst, + std::uint32_t a_dstLen) noexcept; + + std::uint32_t ExpandEnvironmentStrings( + const wchar_t* a_src, + wchar_t* a_dst, + std::uint32_t a_dstLen) noexcept; + + [[nodiscard]] bool FindClose( + void* a_file) noexcept; [[nodiscard]] void* FindFirstFile( - const char* a_fileName, - WIN32_FIND_DATAA* a_findFileData) noexcept; + const char* a_name, + WIN32_FIND_DATAA* a_data) noexcept; [[nodiscard]] void* FindFirstFile( - const wchar_t* a_fileName, - WIN32_FIND_DATAW* a_findFileData) noexcept; + const wchar_t* a_name, + WIN32_FIND_DATAW* a_data) noexcept; [[nodiscard]] bool FindNextFile( - void* a_findFile, - WIN32_FIND_DATAA* a_findFileData) noexcept; + void* a_file, + WIN32_FIND_DATAA* a_data) noexcept; [[nodiscard]] bool FindNextFile( - void* a_findFile, - WIN32_FIND_DATAW* a_findFileData) noexcept; + void* a_file, + WIN32_FIND_DATAW* a_data) noexcept; + + bool FlushInstructionCache( + void* a_process, + const void* a_baseAddr, + std::size_t a_size) noexcept; + + bool FreeLibrary( + HMODULE a_module) noexcept; [[nodiscard]] void* GetCurrentModule() noexcept; @@ -379,152 +887,327 @@ namespace SKSE::WinAPI std::uint32_t a_size) noexcept; [[nodiscard]] bool GetFileVersionInfo( - const char* a_filename, + const char* a_name, std::uint32_t a_handle, - std::uint32_t a_len, + std::uint32_t a_dataLen, void* a_data) noexcept; [[nodiscard]] bool GetFileVersionInfo( - const wchar_t* a_filename, + const wchar_t* a_name, std::uint32_t a_handle, - std::uint32_t a_len, + std::uint32_t a_dataLen, void* a_data) noexcept; [[nodiscard]] std::uint32_t GetFileVersionInfoSize( - const char* a_filename, + const char* a_name, std::uint32_t* a_handle) noexcept; [[nodiscard]] std::uint32_t GetFileVersionInfoSize( - const wchar_t* a_filename, + const wchar_t* a_name, std::uint32_t* a_handle) noexcept; - [[nodiscard]] int GetKeyNameText( - std::int32_t a_lParam, + [[nodiscard]] std::int32_t GetKeyNameText( + std::int32_t a_param, char* a_buffer, - int a_size) noexcept; + std::int32_t a_bufferLen) noexcept; - [[nodiscard]] int GetKeyNameText( - std::int32_t a_lParam, + [[nodiscard]] std::int32_t GetKeyNameText( + std::int32_t a_param, wchar_t* a_buffer, - int a_size) noexcept; + std::int32_t a_bufferLen) noexcept; + + [[nodiscard]] std::int16_t GetKeyState( + std::int32_t a_key) noexcept; - [[nodiscard]] std::int16_t GetKeyState(int nVirtKey) noexcept; + [[nodiscard]] std::uint32_t GetLastError() noexcept; [[nodiscard]] std::size_t GetMaxPath() noexcept; [[nodiscard]] std::uint32_t GetModuleFileName( void* a_module, - char* a_filename, - std::uint32_t a_size) noexcept; + char* a_name, + std::uint32_t a_nameLen) noexcept; [[nodiscard]] std::uint32_t GetModuleFileName( void* a_module, - wchar_t* a_filename, - std::uint32_t a_size) noexcept; + wchar_t* a_name, + std::uint32_t a_nameLen) noexcept; - [[nodiscard]] void* GetModuleHandle(const char* a_moduleName) noexcept; + [[nodiscard]] HMODULE GetModuleHandle( + const char* a_name) noexcept; - [[nodiscard]] void* GetModuleHandle(const wchar_t* a_moduleName) noexcept; + [[nodiscard]] HMODULE GetModuleHandle( + const wchar_t* a_name) noexcept; [[nodiscard]] std::uint32_t GetPrivateProfileString( - const char* a_appName, - const char* a_keyName, + const char* a_app, + const char* a_key, const char* a_default, - char* a_outString, - std::uint32_t a_size, - const char* a_fileName) noexcept; + char* a_out, + std::uint32_t a_outLen, + const char* a_name) noexcept; [[nodiscard]] std::uint32_t GetPrivateProfileString( - const wchar_t* a_appName, - const wchar_t* a_keyName, + const wchar_t* a_app, + const wchar_t* a_key, const wchar_t* a_default, - wchar_t* a_outString, - std::uint32_t a_size, - const wchar_t* a_fileName) noexcept; + wchar_t* a_out, + std::uint32_t a_outLen, + const wchar_t* a_name) noexcept; [[nodiscard]] void* GetProcAddress( void* a_module, - const char* a_procName) noexcept; + const char* a_name) noexcept; + + [[nodiscard]] std::string_view GetProcPath( + HMODULE a_handle) noexcept; + + void GetSystemInfo( + SYSTEM_INFO* a_info) noexcept; + + [[nodiscard]] bool IMAGE_SNAP_BY_ORDINAL64( + std::uint64_t a_ordinal) noexcept; + + [[nodiscard]] IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION( + const IMAGE_NT_HEADERS64* a_header) noexcept; [[nodiscard]] 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_dest, + std::int32_t a_destLen, + NLSVERSIONINFO* a_info, + void* a_reserved, + std::intptr_t a_sortHandle) noexcept; + + [[nodiscard]] HMODULE LoadLibrary( + const char* a_name) noexcept; + + [[nodiscard]] HMODULE LoadLibrary( + const wchar_t* a_name) noexcept; + + [[nodiscard]] void* MapViewOfFile( + void* a_object, + std::uint32_t a_desiredAccess, + std::uint32_t a_fileOffsetHigh, + std::uint32_t a_fileOffsetLow, + std::size_t a_numBytesToMap) noexcept; + + [[nodiscard]] void* MapViewOfFileEx( + void* a_object, + std::uint32_t a_desiredAccess, + std::uint32_t a_fileOffsetHigh, + std::uint32_t a_fileOffsetLow, + std::size_t a_numBytesToMap, + void* a_baseAddress) noexcept; + std::int32_t MessageBox( - void* a_wnd, - const char* a_text, - const char* a_caption, - unsigned int a_type) noexcept; + void* a_wnd, + const char* a_text, + const char* a_caption, + std::uint32_t a_type) noexcept; std::int32_t MessageBox( void* a_wnd, const wchar_t* a_text, const wchar_t* a_caption, - unsigned int a_type) noexcept; + std::uint32_t a_type) noexcept; - [[nodiscard]] int MultiByteToWideChar( - unsigned int a_codePage, + [[nodiscard]] std::int32_t MultiByteToWideChar( + std::uint32_t a_codePage, std::uint32_t a_flags, - const char* a_multiByteStr, - int a_multiByte, - wchar_t* a_wideCharStr, - int a_wideChar); + const char* a_str, + std::int32_t a_strLen, + wchar_t* a_wstr, + std::int32_t a_wstrLen); + + [[nodiscard]] std::int32_t NormalizeString( + std::int32_t a_normForm, + const wchar_t* a_src, + std::int32_t a_srcLen, + wchar_t* a_dest, + std::int32_t a_destLen); + + [[nodiscard]] void* OpenFileMapping( + std::uint32_t a_desiredAccess, + bool a_inheritHandle, + const char* a_name) noexcept; + + [[nodiscard]] void* OpenFileMapping( + std::uint32_t a_desiredAccess, + bool a_inheritHandle, + const wchar_t* a_name) noexcept; void OutputDebugString( - const char* a_outputString) noexcept; + const char* a_outStr) noexcept; void OutputDebugString( - const wchar_t* a_outputString) noexcept; + const wchar_t* a_outStr) noexcept; - [[nodiscard]] int ShowCursor(bool bShow) noexcept; + std::int32_t RegGetValue( + 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); - [[noreturn]] void TerminateProcess( - void* a_process, - unsigned int a_exitCode) noexcept; + std::int32_t RegGetValue( + 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); - [[nodiscard]] void* TlsGetValue(std::uint32_t a_tlsIndex) noexcept; + std::uint32_t ResumeThread( + void* a_handle) noexcept; + + bool SetEnvironmentVariable( + const char* a_name, + const char* a_value) noexcept; + + bool SetEnvironmentVariable( + const wchar_t* a_name, + const wchar_t* a_value) noexcept; + + [[nodiscard]] std::int32_t SHGetKnownFolderPath( + const GUID& a_id, + std::uint32_t a_flags, + void* a_token, + wchar_t** a_path) noexcept; + + [[nodiscard]] std::int32_t ShowCursor( + bool a_show) noexcept; + + void Sleep( + std::uint32_t a_milliseconds) noexcept; + + bool TerminateProcess( + void* a_process, + std::uint32_t a_exitCode) noexcept; + + [[nodiscard]] void* TlsGetValue( + std::uint32_t a_index) noexcept; bool TlsSetValue( - std::uint32_t a_tlsIndex, - void* a_tlsValue) noexcept; + std::uint32_t a_index, + void* a_value) noexcept; - bool VirtualFree( - void* a_address, - std::size_t a_size, - std::uint32_t a_freeType) noexcept; + [[nodiscard]] std::uint32_t UnDecorateSymbolName( + const char* a_name, + char* a_out, + std::uint32_t a_outLenMax, + std::uint32_t a_flags) noexcept; + + [[nodiscard]] std::uint32_t UnDecorateSymbolName( + const wchar_t* a_name, + wchar_t* a_out, + std::uint32_t a_outLenMax, + std::uint32_t a_flags) noexcept; - [[nodiscard]] bool VerQueryValue( - const void* a_block, - const char* a_subBlock, - void** a_buffer, - unsigned int* a_len) noexcept; + bool UnmapViewOfFile( + const void* a_baseAddress) noexcept; + + bool VerQueryValue( + const void* a_block, + const char* a_subBlock, + void** a_buffer, + std::uint32_t* a_bufferLen) noexcept; - [[nodiscard]] bool VerQueryValue( + bool VerQueryValue( const void* a_block, const wchar_t* a_subBlock, void** a_buffer, - unsigned int* a_len) noexcept; + std::uint32_t* a_bufferLen) noexcept; - [[nodiscard]] bool VirtualProtect( + void* VirtualAlloc( + void* a_address, + std::size_t a_size, + std::uint32_t a_type, + std::uint32_t a_protect) noexcept; + + void* VirtualAllocEx( + void* 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( + void* 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( + void* a_process, void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept; - [[nodiscard]] int WideCharToMultiByte( - unsigned int a_codePage, + [[nodiscard]] std::size_t VirtualQuery( + const void* a_address, + MEMORY_BASIC_INFORMATION* a_buffer, + std::size_t a_bufferLen) noexcept; + + [[nodiscard]] std::size_t VirtualQueryEx( + void* a_process, + const void* a_address, + MEMORY_BASIC_INFORMATION* a_buffer, + std::size_t a_bufferLen) noexcept; + + [[nodiscard]] std::uint32_t WaitForSingleObject( + void* a_handle, + std::uint32_t a_milliseconds) noexcept; + + [[nodiscard]] std::uint32_t WaitForSingleObjectEx( + void* a_handle, + std::uint32_t a_milliseconds, + bool a_alertable) noexcept; + + [[nodiscard]] std::int32_t WideCharToMultiByte( + std::uint32_t a_codePage, std::uint32_t a_flags, - const wchar_t* a_wideCharStr, - int a_wideChar, - char* a_multiByteStr, - int a_multiByte, - const char* a_defaultChar, - int* a_usedDefaultChar); + const wchar_t* a_wstr, + std::int32_t a_wstrLen, + char* a_str, + std::int32_t a_strLen, + const char* a_default, + std::int32_t* a_defaultLen); + + bool WriteProcessMemory( + void* a_process, + void* a_address, + const void* a_buffer, + std::size_t a_bufferLen, + std::size_t* a_bufferWritten) noexcept; } +#endif // _INC_WINAPIFAMILY + namespace RE::DirectX { struct XMFLOAT4X4 { - public: // members float m[4][4]; }; @@ -532,7 +1215,6 @@ namespace RE::DirectX struct DXGI_RATIONAL { - public: // members std::uint32_t numerator; // 00 std::uint32_t denominator; // 04 diff --git a/src/SKSE/Impl/WinAPI.cpp b/src/SKSE/Impl/WinAPI.cpp index 0a7fecb9a..3a28645eb 100644 --- a/src/SKSE/Impl/WinAPI.cpp +++ b/src/SKSE/Impl/WinAPI.cpp @@ -1,7 +1,17 @@ #include "SKSE/Impl/WinAPI.h" +#define WIN32_LEAN_AND_MEAN + +// clang-format off #include +#include +#include +#include +// clang-format on +#undef CreateFileMapping +#undef CreateProcess +#undef ExpandEnvironmentStrings #undef FindFirstFile #undef FindNextFile #undef GetEnvironmentVariable @@ -11,252 +21,493 @@ #undef GetModuleFileName #undef GetModuleHandle #undef GetPrivateProfileString +#undef IMAGE_FIRST_SECTION +#undef IMAGE_SNAP_BY_ORDINAL64 +#undef LoadLibrary #undef MessageBox +#undef OpenFileMapping #undef OutputDebugString +#undef RegGetValue +#undef RegQueryValueEx +#undef SetEnvironmentVariable #undef VerQueryValue extern "C" IMAGE_DOS_HEADER __ImageBase; namespace SKSE::WinAPI { - [[nodiscard]] bool FindClose(void* a_findFile) noexcept + bool CloseHandle( + void* a_handle) noexcept { return static_cast( - ::FindClose(static_cast<::HMODULE>(a_findFile))); + ::CloseHandle( + a_handle)); + } + + void CoTaskMemFree( + void* a_block) noexcept + { + ::CoTaskMemFree( + a_block); + } + + void* CreateFileMapping( + void* 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 CreateFileMappingA( + a_file, + reinterpret_cast(a_attributes), + a_protect, + a_maxSizeHigh, + a_maxSizeLow, + a_name); } - [[nodiscard]] void* FindFirstFile( - const char* a_fileName, - WIN32_FIND_DATAA* a_findFileData) noexcept + void* CreateFileMapping( + void* 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 static_cast( - ::FindFirstFileA( - static_cast<::LPCSTR>(a_fileName), - reinterpret_cast<::LPWIN32_FIND_DATAA>(a_findFileData))); + return CreateFileMappingW( + a_file, + reinterpret_cast(a_attributes), + a_protect, + a_maxSizeHigh, + a_maxSizeLow, + a_name); } - [[nodiscard]] void* FindFirstFile( - const wchar_t* a_fileName, - WIN32_FIND_DATAW* a_findFileData) noexcept + bool CreateProcess( + const char* a_name, + char* a_cmd, + SECURITY_ATTRIBUTES* a_procAttr, + SECURITY_ATTRIBUTES* a_threadAttr, + bool a_inherit, + std::uint32_t a_flags, + void* a_env, + const char* a_curDir, + STARTUPINFOA* a_startInfo, + PROCESS_INFORMATION* a_procInfo) noexcept { - return static_cast( - ::FindFirstFileW( - static_cast<::LPCWSTR>(a_fileName), - reinterpret_cast<::LPWIN32_FIND_DATAW>(a_findFileData))); + return static_cast( + CreateProcessA( + a_name, + a_cmd, + reinterpret_cast(a_procAttr), + reinterpret_cast(a_threadAttr), + a_inherit, + a_flags, + a_env, + a_curDir, + reinterpret_cast(a_startInfo), + reinterpret_cast(a_procInfo))); } - [[nodiscard]] bool FindNextFile( - void* a_findFile, - WIN32_FIND_DATAA* a_findFileData) noexcept + bool CreateProcess( + const wchar_t* a_name, + wchar_t* a_cmd, + SECURITY_ATTRIBUTES* a_procAttr, + SECURITY_ATTRIBUTES* a_threadAttr, + bool a_inherit, + std::uint32_t a_flags, + void* a_env, + const wchar_t* a_curDir, + STARTUPINFOW* a_startInfo, + PROCESS_INFORMATION* a_procInfo) noexcept { return static_cast( - ::FindNextFileA( - static_cast<::HANDLE>(a_findFile), - reinterpret_cast<::LPWIN32_FIND_DATAA>(a_findFileData))); + CreateProcessW( + a_name, + a_cmd, + reinterpret_cast(a_procAttr), + reinterpret_cast(a_threadAttr), + a_inherit, + a_flags, + a_env, + a_curDir, + reinterpret_cast(a_startInfo), + reinterpret_cast(a_procInfo))); + } + + void* CreateRemoteThread( + void* 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 ::CreateRemoteThread( + a_process, + reinterpret_cast(a_threadAttr), + a_stackSize, + reinterpret_cast(a_startAddr), + a_param, + a_flags, + reinterpret_cast(a_threadID)); + } + + void* 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 ::CreateThread( + reinterpret_cast(a_threadAttr), + a_stackSize, + reinterpret_cast(a_startAddr), + a_param, + a_flags, + reinterpret_cast(a_threadID)); + } + + std::uint32_t ExpandEnvironmentStrings( + const char* a_src, + char* a_dst, + std::uint32_t a_dstLen) noexcept + { + return static_cast( + ExpandEnvironmentStringsA( + a_src, + a_dst, + a_dstLen)); } - [[nodiscard]] bool FindNextFile( - void* a_findFile, - WIN32_FIND_DATAW* a_findFileData) noexcept + std::uint32_t ExpandEnvironmentStrings( + const wchar_t* a_src, + wchar_t* a_dst, + std::uint32_t a_dstLen) noexcept + { + return static_cast( + ExpandEnvironmentStringsW( + a_src, + a_dst, + a_dstLen)); + } + + bool FindClose( + void* a_file) noexcept { return static_cast( - ::FindNextFileW( - static_cast<::HANDLE>(a_findFile), - reinterpret_cast<::LPWIN32_FIND_DATAW>(a_findFileData))); + ::FindClose( + a_file)); + } + + void* FindFirstFile( + const char* a_name, + WIN32_FIND_DATAA* a_data) noexcept + { + return FindFirstFileA( + a_name, + reinterpret_cast(a_data)); + } + + void* FindFirstFile( + const wchar_t* a_name, + WIN32_FIND_DATAW* a_data) noexcept + { + return FindFirstFileW( + a_name, + reinterpret_cast(a_data)); + } + + bool FindNextFile( + void* a_file, + WIN32_FIND_DATAA* a_data) noexcept + { + return static_cast( + FindNextFileA( + a_file, + reinterpret_cast(a_data))); + } + + bool FindNextFile( + void* a_file, + WIN32_FIND_DATAW* a_data) noexcept + { + return static_cast( + FindNextFileW( + a_file, + reinterpret_cast(a_data))); + } + + bool FlushInstructionCache( + void* a_process, + const void* a_baseAddr, + std::size_t a_size) noexcept + { + return static_cast( + ::FlushInstructionCache( + a_process, + a_baseAddr, + a_size)); + } + + bool FreeLibrary( + HMODULE a_module) noexcept + { + return static_cast( + ::FreeLibrary( + reinterpret_cast<::HMODULE>(a_module))); } void* GetCurrentModule() noexcept { - return static_cast( - std::addressof(__ImageBase)); + return std::addressof(__ImageBase); } void* GetCurrentProcess() noexcept { - return static_cast( - ::GetCurrentProcess()); + return ::GetCurrentProcess(); } std::uint32_t GetCurrentThreadID() noexcept { return static_cast( - ::GetCurrentThreadId()); + GetCurrentThreadId()); } - [[nodiscard]] std::uint32_t GetEnvironmentVariable( + std::uint32_t GetEnvironmentVariable( const char* a_name, char* a_buffer, - std::uint32_t a_size) noexcept + std::uint32_t a_bufferLen) noexcept { return static_cast( - ::GetEnvironmentVariableA( - static_cast<::LPCSTR>(a_name), - static_cast<::LPSTR>(a_buffer), - static_cast<::DWORD>(a_size))); + GetEnvironmentVariableA( + a_name, + a_buffer, + a_bufferLen)); } - [[nodiscard]] std::uint32_t GetEnvironmentVariable( + std::uint32_t GetEnvironmentVariable( const wchar_t* a_name, wchar_t* a_buffer, - std::uint32_t a_size) noexcept + std::uint32_t a_bufferLen) noexcept { return static_cast( - ::GetEnvironmentVariableW( - static_cast<::LPCWSTR>(a_name), - static_cast<::LPWSTR>(a_buffer), - static_cast<::DWORD>(a_size))); + GetEnvironmentVariableW( + a_name, + a_buffer, + a_bufferLen)); } bool GetFileVersionInfo( - const char* a_filename, + const char* a_name, std::uint32_t a_handle, - std::uint32_t a_len, + std::uint32_t a_dataLen, void* a_data) noexcept { return static_cast( - ::GetFileVersionInfoA( - static_cast<::LPCSTR>(a_filename), - static_cast<::DWORD>(a_handle), - static_cast<::DWORD>(a_len), - static_cast<::LPVOID>(a_data))); + GetFileVersionInfoA( + a_name, + a_handle, + a_dataLen, + a_data)); } bool GetFileVersionInfo( - const wchar_t* a_filename, + const wchar_t* a_name, std::uint32_t a_handle, - std::uint32_t a_len, + std::uint32_t a_dataLen, void* a_data) noexcept { return static_cast( - ::GetFileVersionInfoW( - static_cast<::LPCWSTR>(a_filename), - static_cast<::DWORD>(a_handle), - static_cast<::DWORD>(a_len), - static_cast<::LPVOID>(a_data))); + GetFileVersionInfoW( + a_name, + a_handle, + a_dataLen, + a_data)); } std::uint32_t GetFileVersionInfoSize( - const char* a_filename, + const char* a_name, std::uint32_t* a_handle) noexcept { return static_cast( - ::GetFileVersionInfoSizeA( - static_cast<::LPCSTR>(a_filename), - reinterpret_cast<::LPDWORD>(a_handle))); + GetFileVersionInfoSizeA( + a_name, + reinterpret_cast(a_handle))); } std::uint32_t GetFileVersionInfoSize( - const wchar_t* a_filename, + const wchar_t* a_name, std::uint32_t* a_handle) noexcept { return static_cast( - ::GetFileVersionInfoSizeW( - static_cast<::LPCWSTR>(a_filename), - reinterpret_cast<::LPDWORD>(a_handle))); + GetFileVersionInfoSizeW( + a_name, + reinterpret_cast(a_handle))); } - int GetKeyNameText(std::int32_t a_lParam, wchar_t* a_buffer, int a_size) noexcept + std::int32_t GetKeyNameText( + std::int32_t a_param, + wchar_t* a_buffer, + std::int32_t a_bufferLen) noexcept { - return ::GetKeyNameTextW(static_cast<::LONG>(a_lParam), static_cast<::LPWSTR>(a_buffer), a_size); + return GetKeyNameTextW( + a_param, + a_buffer, + a_bufferLen); } - int GetKeyNameText(std::int32_t a_lParam, char* a_buffer, int a_size) noexcept + std::int32_t GetKeyNameText( + std::int32_t a_param, + char* a_buffer, + std::int32_t a_bufferLen) noexcept { - return ::GetKeyNameTextA(static_cast<::LONG>(a_lParam), static_cast<::LPSTR>(a_buffer), a_size); + return GetKeyNameTextA( + a_param, + a_buffer, + a_bufferLen); } - std::int16_t GetKeyState(int nVirtKey) noexcept + std::int16_t GetKeyState( + std::int32_t a_key) noexcept { - return ::GetKeyState(nVirtKey); + return ::GetKeyState(a_key); + } + + std::uint32_t GetLastError() noexcept + { + return static_cast( + ::GetLastError()); } std::size_t GetMaxPath() noexcept { - return static_cast(MAX_PATH); + return MAX_PATH; } std::uint32_t GetModuleFileName( void* a_module, - char* a_filename, - std::uint32_t a_size) noexcept + char* a_name, + std::uint32_t a_nameLen) noexcept { return static_cast( - ::GetModuleFileNameA( + GetModuleFileNameA( static_cast<::HMODULE>(a_module), - static_cast<::LPSTR>(a_filename), - static_cast<::DWORD>(a_size))); + a_name, + a_nameLen)); } std::uint32_t GetModuleFileName( void* a_module, - wchar_t* a_filename, - std::uint32_t a_size) noexcept + wchar_t* a_name, + std::uint32_t a_nameLen) noexcept { return static_cast( - ::GetModuleFileNameW( + GetModuleFileNameW( static_cast<::HMODULE>(a_module), - static_cast<::LPWSTR>(a_filename), - static_cast<::DWORD>(a_size))); + a_name, + a_nameLen)); } - void* GetModuleHandle(const char* a_moduleName) noexcept + HMODULE GetModuleHandle( + const char* a_name) noexcept { - return static_cast( - ::GetModuleHandleA( - static_cast<::LPCSTR>(a_moduleName))); + return reinterpret_cast( + GetModuleHandleA( + a_name)); } - void* GetModuleHandle(const wchar_t* a_moduleName) noexcept + HMODULE GetModuleHandle( + const wchar_t* a_name) noexcept { - return static_cast( - ::GetModuleHandleW( - static_cast<::LPCWSTR>(a_moduleName))); + return reinterpret_cast( + GetModuleHandleW(a_name)); } std::uint32_t GetPrivateProfileString( - const char* a_appName, - const char* a_keyName, + const char* a_app, + const char* a_key, const char* a_default, - char* a_outString, - std::uint32_t a_size, - const char* a_fileName) noexcept + char* a_out, + std::uint32_t a_outLen, + const char* a_name) noexcept { return static_cast( - ::GetPrivateProfileStringA( - static_cast<::LPCSTR>(a_appName), - static_cast<::LPCSTR>(a_keyName), - static_cast<::LPCSTR>(a_default), - static_cast<::LPSTR>(a_outString), - static_cast<::DWORD>(a_size), - static_cast<::LPCSTR>(a_fileName))); + GetPrivateProfileStringA( + a_app, + a_key, + a_default, + a_out, + a_outLen, + a_name)); } std::uint32_t GetPrivateProfileString( - const wchar_t* a_appName, - const wchar_t* a_keyName, + const wchar_t* a_app, + const wchar_t* a_key, const wchar_t* a_default, - wchar_t* a_outString, - std::uint32_t a_size, - const wchar_t* a_fileName) noexcept + wchar_t* a_out, + std::uint32_t a_outLen, + const wchar_t* a_name) noexcept { return static_cast( - ::GetPrivateProfileStringW( - static_cast<::LPCWSTR>(a_appName), - static_cast<::LPCWSTR>(a_keyName), - static_cast<::LPCWSTR>(a_default), - static_cast<::LPWSTR>(a_outString), - static_cast<::DWORD>(a_size), - static_cast<::LPCWSTR>(a_fileName))); + GetPrivateProfileStringW( + a_app, + a_key, + a_default, + a_out, + a_outLen, + a_name)); } void* GetProcAddress( void* a_module, - const char* a_procName) noexcept + const char* a_name) noexcept { return reinterpret_cast( ::GetProcAddress( static_cast<::HMODULE>(a_module), - static_cast<::LPCSTR>(a_procName))); + a_name)); + } + + std::string_view GetProcPath( + HMODULE a_handle) noexcept + { + static std::string fileName(MAX_PATH + 1, ' '); + auto res = GetModuleFileName(a_handle, fileName.data(), MAX_PATH + 1); + if (res == 0) { + fileName = "[ProcessHost]"; + res = 13; + } + + return { fileName.c_str(), res }; + } + + void GetSystemInfo( + SYSTEM_INFO* a_info) noexcept + { + ::GetSystemInfo( + reinterpret_cast(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 IsDebuggerPresent() noexcept @@ -265,134 +516,405 @@ namespace SKSE::WinAPI ::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_dest, + std::int32_t a_destLen, + NLSVERSIONINFO* a_info, + void* a_reserved, + std::intptr_t a_sortHandle) noexcept + { + return ::LCMapStringEx( + a_locale, + a_flags, + a_src, + a_srcLen, + a_dest, + a_destLen, + reinterpret_cast(a_info), + a_reserved, + a_sortHandle); + } + + HMODULE LoadLibrary( + const char* a_name) noexcept + { + return reinterpret_cast( + LoadLibraryA( + a_name)); + } + + HMODULE LoadLibrary( + const wchar_t* a_name) noexcept + { + return reinterpret_cast( + LoadLibraryW(a_name)); + } + + void* MapViewOfFile( + void* a_object, + std::uint32_t a_desiredAccess, + std::uint32_t a_fileOffsetHigh, + std::uint32_t a_fileOffsetLow, + std::size_t a_numBytesToMap) noexcept + { + return ::MapViewOfFile( + a_object, + a_desiredAccess, + a_fileOffsetHigh, + a_fileOffsetLow, + a_numBytesToMap); + } + + void* MapViewOfFileEx( + void* a_object, + std::uint32_t a_desiredAccess, + std::uint32_t a_fileOffsetHigh, + std::uint32_t a_fileOffsetLow, + std::size_t a_numBytesToMap, + void* a_baseAddress) noexcept + { + return ::MapViewOfFileEx( + a_object, + a_desiredAccess, + a_fileOffsetHigh, + a_fileOffsetLow, + a_numBytesToMap, + a_baseAddress); + } + std::int32_t MessageBox( - void* a_wnd, - const char* a_text, - const char* a_caption, - unsigned int a_type) noexcept + void* a_wnd, + const char* a_text, + const char* a_caption, + std::uint32_t a_type) noexcept { - return static_cast( - ::MessageBoxA( - static_cast<::HWND>(a_wnd), - static_cast<::LPCSTR>(a_text), - static_cast<::LPCSTR>(a_caption), - static_cast<::UINT>(a_type))); + return MessageBoxA( + static_cast<::HWND>(a_wnd), + a_text, + a_caption, + a_type); } std::int32_t MessageBox( void* a_wnd, const wchar_t* a_text, const wchar_t* a_caption, - unsigned int a_type) noexcept + std::uint32_t a_type) noexcept { - return static_cast( - ::MessageBoxW( - static_cast<::HWND>(a_wnd), - static_cast<::LPCWSTR>(a_text), - static_cast<::LPCWSTR>(a_caption), - static_cast<::UINT>(a_type))); + return MessageBoxW( + static_cast<::HWND>(a_wnd), + a_text, + a_caption, + a_type); } - int MultiByteToWideChar( - unsigned int a_codePage, + std::int32_t MultiByteToWideChar( + std::uint32_t a_codePage, std::uint32_t a_flags, - const char* a_multiByteStr, - int a_multiByte, - wchar_t* a_wideCharStr, - int a_wideChar) + const char* a_str, + std::int32_t a_strLen, + wchar_t* a_wstr, + std::int32_t a_wstrLen) { return ::MultiByteToWideChar( - static_cast<::UINT>(a_codePage), - static_cast<::DWORD>(a_flags), - static_cast<::LPCCH>(a_multiByteStr), - a_multiByte, - static_cast<::LPWSTR>(a_wideCharStr), - a_wideChar); + a_codePage, + a_flags, + a_str, + a_strLen, + a_wstr, + a_wstrLen); + } + + std::int32_t NormalizeString( + std::int32_t a_normForm, + const wchar_t* a_src, + std::int32_t a_srcLen, + wchar_t* a_dest, + std::int32_t a_destLen) + { + return ::NormalizeString( + static_cast(a_normForm), + a_src, + a_srcLen, + a_dest, + a_destLen); + } + + void* OpenFileMapping( + std::uint32_t a_desiredAccess, + bool a_inheritHandle, + const char* a_name) noexcept + { + return OpenFileMappingA( + a_desiredAccess, + a_inheritHandle, + a_name); + } + + void* OpenFileMapping( + std::uint32_t a_desiredAccess, + bool a_inheritHandle, + const wchar_t* a_name) noexcept + { + return OpenFileMappingW( + a_desiredAccess, + a_inheritHandle, + a_name); } void OutputDebugString( - const char* a_outputString) noexcept + const char* a_out) noexcept { - ::OutputDebugStringA( - static_cast<::LPCSTR>(a_outputString)); + OutputDebugStringA( + a_out); } void OutputDebugString( - const wchar_t* a_outputString) noexcept + const wchar_t* a_out) noexcept { - ::OutputDebugStringW( - static_cast<::LPCWSTR>(a_outputString)); + OutputDebugStringW( + a_out); } - int ShowCursor(bool bShow) noexcept + std::int32_t RegGetValue( + 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 ::ShowCursor(static_cast<::BOOL>(bShow)); + return RegGetValueA( + reinterpret_cast<::HKEY>(a_key), + a_subKey, + a_value, + a_flags, + reinterpret_cast(a_type), + a_data, + reinterpret_cast(a_dataLen)); } - void TerminateProcess( - void* a_process, - unsigned int a_exitCode) noexcept + std::int32_t RegGetValue( + 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) { - ::TerminateProcess( - static_cast<::HANDLE>(a_process), - static_cast<::UINT>(a_exitCode)); + return RegGetValueW( + reinterpret_cast<::HKEY>(a_key), + a_subKey, + a_value, + a_flags, + reinterpret_cast(a_type), + a_data, + reinterpret_cast(a_dataLen)); } - void* TlsGetValue(std::uint32_t a_tlsIndex) noexcept + std::uint32_t ResumeThread( + void* a_handle) noexcept { - return static_cast( - ::TlsGetValue( - static_cast<::DWORD>(a_tlsIndex))); + return static_cast( + ::ResumeThread( + a_handle)); + } + + bool SetEnvironmentVariable( + const char* a_name, + const char* a_value) noexcept + { + return static_cast( + SetEnvironmentVariableA( + a_name, + a_value)); + } + + bool SetEnvironmentVariable( + const wchar_t* a_name, + const wchar_t* a_value) noexcept + { + return static_cast( + SetEnvironmentVariableW( + a_name, + a_value)); + } + + std::int32_t SHGetKnownFolderPath( + const GUID& a_id, + std::uint32_t a_flags, + void* a_token, + wchar_t** a_path) noexcept + { + return static_cast( + ::SHGetKnownFolderPath( + reinterpret_cast(a_id), + a_flags, + a_token, + a_path)); + } + + std::int32_t ShowCursor( + bool a_show) noexcept + { + return ::ShowCursor( + a_show); + } + + void Sleep( + std::uint32_t a_milliseconds) noexcept + { + ::Sleep(a_milliseconds); + } + + bool TerminateProcess( + void* a_process, + std::uint32_t a_exitCode) noexcept + { + return static_cast( + ::TerminateProcess( + a_process, + a_exitCode)); + } + + void* TlsGetValue( + std::uint32_t a_index) noexcept + { + return ::TlsGetValue( + a_index); } bool TlsSetValue( - std::uint32_t a_tlsIndex, - void* a_tlsValue) noexcept + std::uint32_t a_index, + void* a_value) noexcept { return static_cast( ::TlsSetValue( - static_cast<::DWORD>(a_tlsIndex), - static_cast<::LPVOID>(a_tlsValue))); + a_index, + a_value)); } - bool VirtualFree( - void* a_address, - std::size_t a_size, - std::uint32_t a_freeType) noexcept + std::uint32_t UnDecorateSymbolName( + const char* a_name, + char* a_out, + std::uint32_t a_outLenMax, + std::uint32_t a_flags) noexcept + { + return static_cast( + ::UnDecorateSymbolName( + a_name, + a_out, + a_outLenMax, + a_flags)); + } + + std::uint32_t UnDecorateSymbolName( + const wchar_t* a_name, + wchar_t* a_out, + std::uint32_t a_outLenMax, + std::uint32_t a_flags) noexcept + { + return static_cast( + UnDecorateSymbolNameW( + a_name, + a_out, + a_outLenMax, + a_flags)); + } + + bool UnmapViewOfFile( + const void* a_baseAddress) noexcept { return static_cast( - ::VirtualFree( - static_cast<::LPVOID>(a_address), - static_cast<::SIZE_T>(a_size), - static_cast<::DWORD>(a_freeType))); + ::UnmapViewOfFile( + a_baseAddress)); } bool VerQueryValue( - const void* a_block, - const char* a_subBlock, - void** a_buffer, - unsigned int* a_len) noexcept + const void* a_block, + const char* a_subBlock, + void** a_buffer, + std::uint32_t* a_bufferLen) noexcept { return static_cast( - ::VerQueryValueA( - static_cast<::LPCVOID>(a_block), - static_cast<::LPCSTR>(a_subBlock), - static_cast<::LPVOID*>(a_buffer), - static_cast<::PUINT>(a_len))); + VerQueryValueA(a_block, + a_subBlock, + a_buffer, + a_bufferLen)); } bool VerQueryValue( const void* a_block, const wchar_t* a_subBlock, void** a_buffer, - unsigned int* a_len) noexcept + std::uint32_t* a_bufferLen) noexcept { return static_cast( - ::VerQueryValueW( - static_cast<::LPCVOID>(a_block), - static_cast<::LPCWSTR>(a_subBlock), - static_cast<::LPVOID*>(a_buffer), - static_cast<::PUINT>(a_len))); + VerQueryValueW( + a_block, + a_subBlock, + a_buffer, + a_bufferLen)); + } + + void* VirtualAlloc( + void* a_address, + std::size_t a_size, + std::uint32_t a_type, + std::uint32_t a_protect) noexcept + { + return ::VirtualAlloc( + a_address, + a_size, + a_type, + a_protect); + } + + void* VirtualAllocEx( + void* a_process, + void* a_address, + std::size_t a_size, + std::uint32_t a_type, + std::uint32_t a_protect) noexcept + { + return ::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 static_cast( + ::VirtualFree( + a_address, + a_size, + a_type)); + } + + bool VirtualFreeEx( + void* a_process, + void* a_address, + std::size_t a_size, + std::uint32_t a_type) noexcept + { + return static_cast( + ::VirtualFreeEx( + a_process, + a_address, + a_size, + a_type)); } bool VirtualProtect( @@ -403,31 +925,108 @@ namespace SKSE::WinAPI { return static_cast( ::VirtualProtect( - static_cast<::LPVOID>(a_address), - static_cast<::SIZE_T>(a_size), - static_cast<::DWORD>(a_newProtect), - reinterpret_cast<::PDWORD>(a_oldProtect))); + a_address, + a_size, + a_newProtect, + reinterpret_cast(a_oldProtect))); + } + + bool VirtualProtectEx( + void* a_process, + void* a_address, + std::size_t a_size, + std::uint32_t a_newProtect, + std::uint32_t* a_oldProtect) noexcept + { + return static_cast( + ::VirtualProtectEx( + a_process, + a_address, + a_size, + a_newProtect, + reinterpret_cast(a_oldProtect))); + } + + std::size_t VirtualQuery( + const void* a_address, + MEMORY_BASIC_INFORMATION* a_buffer, + std::size_t a_bufferLen) noexcept + { + return ::VirtualQuery( + a_address, + reinterpret_cast(a_buffer), + a_bufferLen); + } + + std::size_t VirtualQueryEx( + void* a_process, + const void* a_address, + MEMORY_BASIC_INFORMATION* a_buffer, + std::size_t a_bufferLen) noexcept + { + return ::VirtualQueryEx( + a_process, + a_address, + reinterpret_cast(a_buffer), + a_bufferLen); } - int WideCharToMultiByte( - unsigned int a_codePage, + std::uint32_t WaitForSingleObject( + void* a_handle, + std::uint32_t a_milliseconds) noexcept + { + return static_cast( + ::WaitForSingleObject( + a_handle, + a_milliseconds)); + } + + std::uint32_t WaitForSingleObjectEx( + void* a_handle, + std::uint32_t a_milliseconds, + bool a_alertable) noexcept + { + return static_cast( + ::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_wideCharStr, - int a_wideChar, - char* a_multiByteStr, - int a_multiByte, - const char* a_defaultChar, - int* a_usedDefaultChar) + const wchar_t* a_wstr, + std::int32_t a_wstrLen, + char* a_str, + std::int32_t a_strLen, + const char* a_default, + std::int32_t* a_defaultLen) { return ::WideCharToMultiByte( - static_cast<::UINT>(a_codePage), - static_cast<::DWORD>(a_flags), - static_cast<::LPCWCH>(a_wideCharStr), - a_wideChar, - static_cast<::LPSTR>(a_multiByteStr), - a_multiByte, - static_cast<::LPCCH>(a_defaultChar), - static_cast<::LPBOOL>(a_usedDefaultChar)); + a_codePage, + a_flags, + a_wstr, + a_wstrLen, + a_str, + a_strLen, + a_default, + a_defaultLen); } + bool WriteProcessMemory( + void* a_process, + void* a_address, + const void* a_buffer, + std::size_t a_bufferLen, + std::size_t* a_bufferWritten) noexcept + { + return static_cast( + ::WriteProcessMemory( + a_process, + a_address, + a_buffer, + a_bufferLen, + a_bufferWritten)); + } } From 89bbcd3fde7b0e6b6576e6311ffd43240300ce63 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:02:20 -0600 Subject: [PATCH 47/76] Improve WinAPI+ --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a08923da..5bace4cb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ target_link_libraries( binary_io::binary_io spdlog::spdlog Version.lib + Dbghelp.lib ) target_precompile_headers( From 55bdb18c4b7d8395a935b6f883362d7cd9eed0b3 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 27 Jan 2024 16:05:05 -0600 Subject: [PATCH 48/76] Separate Relocation.h --- cmake/sourcelist.cmake | 9 +- include/REL/ID.h | 374 ++++++++++++++++++ include/REL/Module.h | 151 +++++++ include/REL/Offset.h | 30 ++ include/REL/Pattern.h | 189 +++++++++ include/REL/REL.h | 8 + include/REL/Relocation.h | 823 --------------------------------------- include/REL/Version.h | 105 +++++ include/SKSE/Impl/PCH.h | 2 +- src/REL/ID.cpp | 87 +++++ src/REL/Module.cpp | 25 ++ src/REL/Relocation.cpp | 155 -------- 12 files changed, 978 insertions(+), 980 deletions(-) create mode 100644 include/REL/ID.h create mode 100644 include/REL/Module.h create mode 100644 include/REL/Offset.h create mode 100644 include/REL/Pattern.h create mode 100644 include/REL/REL.h create mode 100644 include/REL/Version.h create mode 100644 src/REL/ID.cpp create mode 100644 src/REL/Module.cpp delete mode 100644 src/REL/Relocation.cpp diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 10ddee0a5..297ce72d1 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1613,7 +1613,13 @@ set(SOURCES include/RE/W/WerewolfFeedEffect.h include/RE/Z/ZeroFunctionArguments.h include/RE/Z/ZeroOverheadHeap.h + include/REL/ID.h + include/REL/Module.h + include/REL/Offset.h + include/REL/Pattern.h + include/REL/REL.h include/REL/Relocation.h + include/REL/Version.h include/SKSE/API.h include/SKSE/Events.h include/SKSE/IAT.h @@ -1957,7 +1963,8 @@ set(SOURCES src/RE/V/Variable.cpp src/RE/V/VirtualMachine.cpp src/RE/Z/ZeroFunctionArguments.cpp - src/REL/Relocation.cpp + src/REL/ID.cpp + src/REL/Module.cpp src/SKSE/API.cpp src/SKSE/IAT.cpp src/SKSE/Impl/PCH.cpp diff --git a/include/REL/ID.h b/include/REL/ID.h new file mode 100644 index 000000000..09d5f25ee --- /dev/null +++ b/include/REL/ID.h @@ -0,0 +1,374 @@ +#pragma once + +#include "REL/Module.h" + +namespace REL +{ + namespace detail + { + class memory_map + { + public: + memory_map() noexcept = default; + memory_map(const memory_map&) = delete; + + memory_map(memory_map&& a_rhs) noexcept : + _mapping(a_rhs._mapping), + _view(a_rhs._view) + { + a_rhs._mapping = nullptr; + a_rhs._view = nullptr; + } + + ~memory_map() { close(); } + + memory_map& operator=(const memory_map&) = delete; + + memory_map& operator=(memory_map&& a_rhs) noexcept + { + if (this != std::addressof(a_rhs)) { + _mapping = a_rhs._mapping; + a_rhs._mapping = nullptr; + + _view = a_rhs._view; + a_rhs._view = nullptr; + } + return *this; + } + + [[nodiscard]] void* data() noexcept { return _view; } + + bool open(stl::zwstring a_name, std::size_t a_size); + bool create(stl::zwstring a_name, std::size_t a_size); + void close(); + + private: + void* _mapping{ nullptr }; + void* _view{ nullptr }; + }; + } + + class IDDatabase + { + private: + struct mapping_t + { + std::uint64_t id; + std::uint64_t offset; + }; + + public: + class Offset2ID + { + public: + using value_type = 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) // + requires(std::is_execution_policy_v>) + { + const std::span id2offset = IDDatabase::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 + { + const 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( + std::format( + "Failed to find the offset within the database: 0x{:08X}"sv, + a_offset)); + } + + 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; + }; + + [[nodiscard]] static IDDatabase& get() + { + static IDDatabase singleton; + return singleton; + } + + [[nodiscard]] inline std::size_t id2offset(std::uint64_t a_id) 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()) { + stl::report_and_fail( + std::format( + "Failed to find the id within the address library: {}\n" + "This means this script extender plugin is incompatible with the address " + "library for this version of the game, and thus does not support it."sv, + a_id)); + } + + return static_cast(it->offset); + } + + private: + friend Offset2ID; + + class header_t + { + public: + void read(binary_io::file_istream& a_in) + { + const auto [format] = a_in.read(); +#ifdef SKYRIM_SUPPORT_AE + if (format != 2) { +#else + if (format != 1) { +#endif + stl::report_and_fail( + std::format( + "Unsupported address library format: {}\n" + "This means this script extender plugin is incompatible with the address " + "library available for this version of the game, and thus does not " + "support it."sv, + format)); + } + + const auto [major, minor, patch, revision] = + a_in.read(); + _version[0] = static_cast(major); + _version[1] = static_cast(minor); + _version[2] = static_cast(patch); + _version[3] = static_cast(revision); + + const auto [nameLen] = a_in.read(); + a_in.seek_relative(nameLen); + + a_in.read(_pointerSize, _addressCount); + } + + [[nodiscard]] std::size_t address_count() const noexcept { return static_cast(_addressCount); } + [[nodiscard]] std::uint64_t pointer_size() const noexcept { return static_cast(_pointerSize); } + [[nodiscard]] Version version() const noexcept { return _version; } + + private: + Version _version; + std::int32_t _pointerSize{ 0 }; + std::int32_t _addressCount{ 0 }; + }; + + IDDatabase() { load(); } + + IDDatabase(const IDDatabase&) = delete; + IDDatabase(IDDatabase&&) = delete; + + ~IDDatabase() = default; + + IDDatabase& operator=(const IDDatabase&) = delete; + IDDatabase& operator=(IDDatabase&&) = delete; + + void load() + { + const auto version = Module::get().version(); + const auto filename = + stl::utf8_to_utf16( + std::format( +#ifdef SKYRIM_SUPPORT_AE + "Data/SKSE/Plugins/versionlib-{}.bin"sv, +#else + "Data/SKSE/Plugins/version-{}.bin"sv, +#endif + version.string())) + .value_or(L""s); + load_file(filename, version); + } + + void load_file(stl::zwstring a_filename, Version a_version) + { + try { + binary_io::file_istream in(a_filename); + header_t header; + header.read(in); + if (header.version() != a_version) { + stl::report_and_fail("version mismatch"sv); + } + + auto mapname = L"CommonLibSSEOffsets-v2-"s; + mapname += a_version.wstring(); + const auto byteSize = static_cast(header.address_count()) * sizeof(mapping_t); + if (_mmap.open(mapname, byteSize)) { + _id2offset = { static_cast(_mmap.data()), header.address_count() }; + } else if (_mmap.create(mapname, byteSize)) { + _id2offset = { static_cast(_mmap.data()), header.address_count() }; + unpack_file(in, header); + std::sort( + _id2offset.begin(), + _id2offset.end(), + [](auto&& a_lhs, auto&& a_rhs) { + return a_lhs.id < a_rhs.id; + }); + } else { + stl::report_and_fail("failed to create shared mapping"sv); + } + } catch (const std::system_error&) { + stl::report_and_fail( + std::format( + "Failed to locate an appropriate address library with the path: {}\n" + "This means you are missing the address library for this specific version of " + "the game. Please continue to the mod page for address library to download " + "an appropriate version. If one is not available, then it is likely that " + "address library has not yet added support for this version of the game."sv, + stl::utf16_to_utf8(a_filename).value_or(""s))); + } + } + + void unpack_file(binary_io::file_istream& a_in, header_t a_header) + { + std::uint8_t type = 0; + std::uint64_t id = 0; + std::uint64_t offset = 0; + std::uint64_t prevID = 0; + std::uint64_t prevOffset = 0; + for (auto& mapping : _id2offset) { + a_in.read(type); + const auto lo = static_cast(type & 0xF); + const auto hi = static_cast(type >> 4); + + switch (lo) { + case 0: + a_in.read(id); + break; + case 1: + id = prevID + 1; + break; + case 2: + id = prevID + std::get<0>(a_in.read()); + break; + case 3: + id = prevID - std::get<0>(a_in.read()); + break; + case 4: + id = prevID + std::get<0>(a_in.read()); + break; + case 5: + id = prevID - std::get<0>(a_in.read()); + break; + case 6: + std::tie(id) = a_in.read(); + break; + case 7: + std::tie(id) = a_in.read(); + break; + default: + stl::report_and_fail("unhandled type"sv); + } + + const std::uint64_t tmp = (hi & 8) != 0 ? (prevOffset / a_header.pointer_size()) : prevOffset; + + switch (hi & 7) { + case 0: + a_in.read(offset); + break; + case 1: + offset = tmp + 1; + break; + case 2: + offset = tmp + std::get<0>(a_in.read()); + break; + case 3: + offset = tmp - std::get<0>(a_in.read()); + break; + case 4: + offset = tmp + std::get<0>(a_in.read()); + break; + case 5: + offset = tmp - std::get<0>(a_in.read()); + break; + case 6: + std::tie(offset) = a_in.read(); + break; + case 7: + std::tie(offset) = a_in.read(); + break; + default: + stl::report_and_fail("unhandled type"sv); + } + + if ((hi & 8) != 0) { + offset *= a_header.pointer_size(); + } + + mapping = { id, offset }; + + prevOffset = offset; + prevID = id; + } + } + + detail::memory_map _mmap; + std::span _id2offset; + }; + + 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 IDDatabase::get().id2offset(_id); } + + private: + [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } + + std::uint64_t _id{ 0 }; + }; +} diff --git a/include/REL/Module.h b/include/REL/Module.h new file mode 100644 index 000000000..07f465e40 --- /dev/null +++ b/include/REL/Module.h @@ -0,0 +1,151 @@ +#pragma once + +#include "REL/Version.h" + +namespace REL +{ + class Segment + { + public: + enum Name : std::size_t + { + textx, + idata, + rdata, + data, + pdata, + tls, + textw, + gfids, + total + }; + + Segment() noexcept = default; + + 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]] std::uintptr_t address() const noexcept { return _address; } + [[nodiscard]] std::size_t offset() const noexcept { return address() - _proxyBase; } + [[nodiscard]] 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 }; + }; + + class Module + { + public: + [[nodiscard]] static Module& get() + { + static Module singleton; + return singleton; + } + + [[nodiscard]] std::uintptr_t base() const noexcept { return _base; } + [[nodiscard]] stl::zwstring filename() const noexcept { return _filename; } + [[nodiscard]] Version version() const noexcept { return _version; } + + [[nodiscard]] Segment segment(Segment::Name a_segment) const noexcept { return _segments[a_segment]; } + + [[nodiscard]] void* pointer() const noexcept { return reinterpret_cast(base()); } + + template + [[nodiscard]] T* pointer() const noexcept + { + return static_cast(pointer()); + } + + private: + Module() + { + const auto getFilename = [&]() { + return WinAPI::GetEnvironmentVariable( + ENVIRONMENT.data(), + _filename.data(), + static_cast(_filename.size())); + }; + + _filename.resize(getFilename()); + if (const auto result = getFilename(); + result != _filename.size() - 1 || + result == 0) { + _filename = L"SkyrimSE.exe"sv; + } + + load(); + } + + Module(const Module&) = delete; + Module(Module&&) = delete; + + ~Module() noexcept = default; + + Module& operator=(const Module&) = delete; + Module& operator=(Module&&) = delete; + + void load() + { + auto handle = WinAPI::GetModuleHandle(_filename.c_str()); + if (handle == nullptr) { + stl::report_and_fail( + std::format( + "Failed to obtain module handle for: \"{0}\".\n" + "You have likely renamed the executable to something unexpected. " + "Renaming the executable back to \"{0}\" may resolve the issue."sv, + stl::utf16_to_utf8(_filename).value_or(""s))); + } + _base = reinterpret_cast(handle); + + load_version(); + load_segments(); + } + + void load_segments(); + + void load_version() + { + const auto version = get_file_version(_filename); + if (version) { + _version = *version; + } else { + stl::report_and_fail( + std::format( + "Failed to obtain file version info for: {}\n" + "Please contact the author of this script extender plugin for further assistance."sv, + stl::utf16_to_utf8(_filename).value_or(""s))); + } + } + + static constexpr std::array SEGMENTS{ + std::make_pair(".text"sv, WinAPI::IMAGE_SCN_MEM_EXECUTE), + std::make_pair(".idata"sv, 0u), + std::make_pair(".rdata"sv, 0u), + std::make_pair(".data"sv, 0u), + std::make_pair(".pdata"sv, 0u), + std::make_pair(".tls"sv, 0u), + std::make_pair(".text"sv, WinAPI::IMAGE_SCN_MEM_WRITE), + std::make_pair(".gfids"sv, 0u) + }; + + static constexpr auto ENVIRONMENT = L"SKSE_RUNTIME"sv; + + 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 new file mode 100644 index 000000000..6ed58b82d --- /dev/null +++ b/include/REL/Offset.h @@ -0,0 +1,30 @@ +#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/Pattern.h b/include/REL/Pattern.h new file mode 100644 index 000000000..a23631940 --- /dev/null +++ b/include/REL/Pattern.h @@ -0,0 +1,189 @@ +#pragma once + +#include "REL/Module.h" + +namespace REL +{ + namespace detail + { + namespace characters + { + [[nodiscard]] constexpr bool hexadecimal(char a_ch) noexcept + { + return ('0' <= a_ch && a_ch <= '9') || + ('A' <= a_ch && a_ch <= 'F') || + ('a' <= a_ch && a_ch <= 'f'); + } + + [[nodiscard]] constexpr bool space(char a_ch) noexcept + { + return a_ch == ' '; + } + + [[nodiscard]] constexpr bool wildcard(char a_ch) noexcept + { + return a_ch == '?'; + } + } + + namespace rules + { + namespace detail + { + [[nodiscard]] consteval std::byte hexacharacters_to_hexadecimal(char a_hi, char a_lo) noexcept + { + constexpr auto lut = []() noexcept { + std::array::max() + 1> a = {}; + + const auto iterate = [&](std::uint8_t a_iFirst, unsigned char a_cFirst, unsigned char a_cLast) noexcept { + for (; a_cFirst <= a_cLast; ++a_cFirst, ++a_iFirst) { + a[a_cFirst] = a_iFirst; + } + }; + + iterate(0, '0', '9'); + iterate(0xA, 'A', 'F'); + iterate(0xa, 'a', 'f'); + + return a; + }(); + + return static_cast( + lut[static_cast(a_hi)] * 0x10u + + lut[static_cast(a_lo)]); + } + } + + template + class Hexadecimal + { + public: + [[nodiscard]] static constexpr bool match(std::byte a_byte) noexcept + { + constexpr auto expected = detail::hexacharacters_to_hexadecimal(HI, LO); + return a_byte == expected; + } + }; + + static_assert(Hexadecimal<'5', '7'>::match(std::byte{ 0x57 })); + static_assert(Hexadecimal<'6', '5'>::match(std::byte{ 0x65 })); + static_assert(Hexadecimal<'B', 'D'>::match(std::byte{ 0xBD })); + static_assert(Hexadecimal<'1', 'C'>::match(std::byte{ 0x1C })); + static_assert(Hexadecimal<'F', '2'>::match(std::byte{ 0xF2 })); + static_assert(Hexadecimal<'9', 'f'>::match(std::byte{ 0x9f })); + + static_assert(!Hexadecimal<'D', '4'>::match(std::byte{ 0xF8 })); + static_assert(!Hexadecimal<'6', '7'>::match(std::byte{ 0xAA })); + static_assert(!Hexadecimal<'7', '8'>::match(std::byte{ 0xE3 })); + static_assert(!Hexadecimal<'6', 'E'>::match(std::byte{ 0x61 })); + + class Wildcard + { + public: + [[nodiscard]] static constexpr bool match(std::byte) noexcept + { + return true; + } + }; + + static_assert(Wildcard::match(std::byte{ 0xB9 })); + static_assert(Wildcard::match(std::byte{ 0x96 })); + static_assert(Wildcard::match(std::byte{ 0x35 })); + static_assert(Wildcard::match(std::byte{ 0xE4 })); + + template + void rule_for() noexcept; + + template + Hexadecimal rule_for() noexcept + requires(characters::hexadecimal(C1) && characters::hexadecimal(C2)); + + template + Wildcard rule_for() noexcept + requires(characters::wildcard(C1) && characters::wildcard(C2)); + } + + template + class PatternMatcher + { + public: + static_assert(sizeof...(Rules) >= 1, "must provide at least 1 rule for the pattern matcher"); + + [[nodiscard]] constexpr bool match(std::span a_bytes) const noexcept + { + std::size_t i = 0; + return (Rules::match(a_bytes[i++]) && ...); + } + + [[nodiscard]] bool match(std::uintptr_t a_address) const noexcept + { + return this->match(*reinterpret_cast(a_address)); + } + + void match_or_fail(std::uintptr_t a_address, std::source_location a_loc = std::source_location::current()) const noexcept + { + if (!this->match(a_address)) { + const auto version = Module::get().version(); + stl::report_and_fail( + std::format( + "A pattern has failed to match.\n" + "This means the plugin is incompatible with the current version of the game ({}.{}.{}). " + "Head to the mod page of this plugin to see if an update is available."sv, + version[0], + version[1], + version[2]), + a_loc); + } + } + }; + + void consteval_error(const char* a_error); + + template + [[nodiscard]] constexpr auto do_make_pattern() noexcept + { + if constexpr (S.length() == 0) { + return PatternMatcher(); + } else if constexpr (S.length() == 1) { + constexpr char c = S[0]; + if constexpr (characters::hexadecimal(c) || characters::wildcard(c)) { + consteval_error("the given pattern has an unpaired rule (rules are required to be written in pairs of 2)"); + } else { + consteval_error("the given pattern has trailing characters at the end (which is not allowed)"); + } + } else { + using rule_t = decltype(rules::rule_for()); + if constexpr (std::same_as) { + consteval_error("the given pattern failed to match any known rules"); + } else { + if constexpr (S.length() <= 3) { + return do_make_pattern(), Rules..., rule_t>(); + } else if constexpr (characters::space(S[2])) { + return do_make_pattern(), Rules..., rule_t>(); + } else { + consteval_error("a space character is required to split byte patterns"); + } + } + } + } + + template + [[nodiscard]] consteval auto make_byte_array(Bytes... a_bytes) noexcept + -> std::array + { + static_assert((std::integral && ...), "all bytes must be an integral type"); + return { static_cast(a_bytes)... }; + } + } + + template + [[nodiscard]] constexpr auto make_pattern() noexcept + { + return detail::do_make_pattern(); + } + + static_assert(make_pattern<"40 10 F2 ??">().match( + detail::make_byte_array(0x40, 0x10, 0xF2, 0x41))); + static_assert(make_pattern<"B8 D0 ?? ?? D4 6E">().match( + detail::make_byte_array(0xB8, 0xD0, 0x35, 0x2A, 0xD4, 0x6E))); +} diff --git a/include/REL/REL.h b/include/REL/REL.h new file mode 100644 index 000000000..0fab8ad1f --- /dev/null +++ b/include/REL/REL.h @@ -0,0 +1,8 @@ +#pragma once + +#include "REL/ID.h" +#include "REL/Module.h" +#include "REL/Offset.h" +#include "REL/Pattern.h" +#include "REL/Relocation.h" +#include "REL/Version.h" diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index b71423f5e..b8edfe732 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -60,47 +60,6 @@ namespace REL { namespace detail { - class memory_map - { - public: - memory_map() noexcept = default; - memory_map(const memory_map&) = delete; - - memory_map(memory_map&& a_rhs) noexcept : - _mapping(a_rhs._mapping), - _view(a_rhs._view) - { - a_rhs._mapping = nullptr; - a_rhs._view = nullptr; - } - - ~memory_map() { close(); } - - memory_map& operator=(const memory_map&) = delete; - - memory_map& operator=(memory_map&& a_rhs) noexcept - { - if (this != std::addressof(a_rhs)) { - _mapping = a_rhs._mapping; - a_rhs._mapping = nullptr; - - _view = a_rhs._view; - a_rhs._view = nullptr; - } - return *this; - } - - [[nodiscard]] void* data() noexcept { return _view; } - - bool open(stl::zwstring a_name, std::size_t a_size); - bool create(stl::zwstring a_name, std::size_t a_size); - void close(); - - private: - void* _mapping{ nullptr }; - void* _view{ nullptr }; - }; - template struct member_function_pod_type; @@ -282,605 +241,6 @@ namespace REL assert(success != 0); } - class Version - { - public: - using value_type = std::uint16_t; - using reference = value_type&; - using const_reference = const value_type&; - - constexpr Version() noexcept = default; - - explicit constexpr Version(std::array a_version) noexcept : - _impl(a_version) - {} - - constexpr Version(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 Version& 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] & 0x0FF) << 24u | - (_impl[1] & 0x0FF) << 16u | - (_impl[2] & 0xFFF) << 4u | - (_impl[3] & 0x00F) << 0u); - } - - [[nodiscard]] std::string string() const - { - std::string result; - for (auto&& ver : _impl) { - result += std::to_string(ver); - result += '-'; - } - result.pop_back(); - return result; - } - - [[nodiscard]] std::wstring wstring() const - { - std::wstring result; - for (auto&& ver : _impl) { - result += std::to_wstring(ver); - result += L'-'; - } - result.pop_back(); - return result; - } - - private: - std::array _impl{ 0, 0, 0, 0 }; - }; - - [[nodiscard]] constexpr bool operator==(const Version& a_lhs, const Version& a_rhs) noexcept { return a_lhs.compare(a_rhs) == 0; } - [[nodiscard]] constexpr std::strong_ordering operator<=>(const Version& a_lhs, const Version& a_rhs) noexcept { return a_lhs.compare(a_rhs); } - - [[nodiscard]] inline std::optional get_file_version(stl::zwstring a_filename) - { - std::uint32_t dummy; - std::vector buf(WinAPI::GetFileVersionInfoSize(a_filename.data(), std::addressof(dummy))); - if (buf.empty()) { - return std::nullopt; - } - - if (!WinAPI::GetFileVersionInfo(a_filename.data(), 0, static_cast(buf.size()), buf.data())) { - return std::nullopt; - } - - void* verBuf{ nullptr }; - std::uint32_t verLen{ 0 }; - if (!WinAPI::VerQueryValue(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; - } - - class Segment - { - public: - enum Name : std::size_t - { - textx, - idata, - rdata, - data, - pdata, - tls, - textw, - gfids, - total - }; - - Segment() noexcept = default; - - 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]] std::uintptr_t address() const noexcept { return _address; } - [[nodiscard]] std::size_t offset() const noexcept { return address() - _proxyBase; } - [[nodiscard]] 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 }; - }; - - class Module - { - public: - [[nodiscard]] static Module& get() - { - static Module singleton; - return singleton; - } - - [[nodiscard]] std::uintptr_t base() const noexcept { return _base; } - [[nodiscard]] stl::zwstring filename() const noexcept { return _filename; } - [[nodiscard]] Version version() const noexcept { return _version; } - - [[nodiscard]] Segment segment(Segment::Name a_segment) const noexcept { return _segments[a_segment]; } - - [[nodiscard]] void* pointer() const noexcept { return reinterpret_cast(base()); } - - template - [[nodiscard]] T* pointer() const noexcept - { - return static_cast(pointer()); - } - - private: - Module() - { - const auto getFilename = [&]() { - return WinAPI::GetEnvironmentVariable( - ENVIRONMENT.data(), - _filename.data(), - static_cast(_filename.size())); - }; - - _filename.resize(getFilename()); - if (const auto result = getFilename(); - result != _filename.size() - 1 || - result == 0) { - _filename = L"SkyrimSE.exe"sv; - } - - load(); - } - - Module(const Module&) = delete; - Module(Module&&) = delete; - - ~Module() noexcept = default; - - Module& operator=(const Module&) = delete; - Module& operator=(Module&&) = delete; - - void load() - { - auto handle = WinAPI::GetModuleHandle(_filename.c_str()); - if (handle == nullptr) { - stl::report_and_fail( - std::format( - "Failed to obtain module handle for: \"{0}\".\n" - "You have likely renamed the executable to something unexpected. " - "Renaming the executable back to \"{0}\" may resolve the issue."sv, - stl::utf16_to_utf8(_filename).value_or(""s))); - } - _base = reinterpret_cast(handle); - - load_version(); - load_segments(); - } - - void load_segments(); - - void load_version() - { - const auto version = get_file_version(_filename); - if (version) { - _version = *version; - } else { - stl::report_and_fail( - std::format( - "Failed to obtain file version info for: {}\n" - "Please contact the author of this script extender plugin for further assistance."sv, - stl::utf16_to_utf8(_filename).value_or(""s))); - } - } - - static constexpr std::array SEGMENTS{ - std::make_pair(".text"sv, WinAPI::IMAGE_SCN_MEM_EXECUTE), - std::make_pair(".idata"sv, static_cast(0)), - std::make_pair(".rdata"sv, static_cast(0)), - std::make_pair(".data"sv, static_cast(0)), - std::make_pair(".pdata"sv, static_cast(0)), - std::make_pair(".tls"sv, static_cast(0)), - std::make_pair(".text"sv, WinAPI::IMAGE_SCN_MEM_WRITE), - std::make_pair(".gfids"sv, static_cast(0)) - }; - - static constexpr auto ENVIRONMENT = L"SKSE_RUNTIME"sv; - - std::wstring _filename; - std::array _segments; - Version _version; - std::uintptr_t _base{ 0 }; - }; - - class IDDatabase - { - private: - struct mapping_t - { - std::uint64_t id; - std::uint64_t offset; - }; - - public: - class Offset2ID - { - public: - using value_type = 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) // - requires(std::is_execution_policy_v>) - { - const std::span id2offset = IDDatabase::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 - { - const 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( - std::format( - "Failed to find the offset within the database: 0x{:08X}"sv, - a_offset)); - } - - 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; - }; - - [[nodiscard]] static IDDatabase& get() - { - static IDDatabase singleton; - return singleton; - } - - [[nodiscard]] inline std::size_t id2offset(std::uint64_t a_id) 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()) { - stl::report_and_fail( - std::format( - "Failed to find the id within the address library: {}\n" - "This means this script extender plugin is incompatible with the address " - "library for this version of the game, and thus does not support it."sv, - a_id)); - } - - return static_cast(it->offset); - } - - private: - friend Offset2ID; - - class header_t - { - public: - void read(binary_io::file_istream& a_in) - { - const auto [format] = a_in.read(); -#ifdef SKYRIM_SUPPORT_AE - if (format != 2) { -#else - if (format != 1) { -#endif - stl::report_and_fail( - std::format( - "Unsupported address library format: {}\n" - "This means this script extender plugin is incompatible with the address " - "library available for this version of the game, and thus does not " - "support it."sv, - format)); - } - - const auto [major, minor, patch, revision] = - a_in.read(); - _version[0] = static_cast(major); - _version[1] = static_cast(minor); - _version[2] = static_cast(patch); - _version[3] = static_cast(revision); - - const auto [nameLen] = a_in.read(); - a_in.seek_relative(nameLen); - - a_in.read(_pointerSize, _addressCount); - } - - [[nodiscard]] std::size_t address_count() const noexcept { return static_cast(_addressCount); } - [[nodiscard]] std::uint64_t pointer_size() const noexcept { return static_cast(_pointerSize); } - [[nodiscard]] Version version() const noexcept { return _version; } - - private: - Version _version; - std::int32_t _pointerSize{ 0 }; - std::int32_t _addressCount{ 0 }; - }; - - IDDatabase() { load(); } - - IDDatabase(const IDDatabase&) = delete; - IDDatabase(IDDatabase&&) = delete; - - ~IDDatabase() = default; - - IDDatabase& operator=(const IDDatabase&) = delete; - IDDatabase& operator=(IDDatabase&&) = delete; - - void load() - { - const auto version = Module::get().version(); - const auto filename = - stl::utf8_to_utf16( - std::format( -#ifdef SKYRIM_SUPPORT_AE - "Data/SKSE/Plugins/versionlib-{}.bin"sv, -#else - "Data/SKSE/Plugins/version-{}.bin"sv, -#endif - version.string())) - .value_or(L""s); - load_file(filename, version); - } - - void load_file(stl::zwstring a_filename, Version a_version) - { - try { - binary_io::file_istream in(a_filename); - header_t header; - header.read(in); - if (header.version() != a_version) { - stl::report_and_fail("version mismatch"sv); - } - - auto mapname = L"CommonLibSSEOffsets-v2-"s; - mapname += a_version.wstring(); - const auto byteSize = static_cast(header.address_count()) * sizeof(mapping_t); - if (_mmap.open(mapname, byteSize)) { - _id2offset = { static_cast(_mmap.data()), header.address_count() }; - } else if (_mmap.create(mapname, byteSize)) { - _id2offset = { static_cast(_mmap.data()), header.address_count() }; - unpack_file(in, header); - std::sort( - _id2offset.begin(), - _id2offset.end(), - [](auto&& a_lhs, auto&& a_rhs) { - return a_lhs.id < a_rhs.id; - }); - } else { - stl::report_and_fail("failed to create shared mapping"sv); - } - } catch (const std::system_error&) { - stl::report_and_fail( - std::format( - "Failed to locate an appropriate address library with the path: {}\n" - "This means you are missing the address library for this specific version of " - "the game. Please continue to the mod page for address library to download " - "an appropriate version. If one is not available, then it is likely that " - "address library has not yet added support for this version of the game."sv, - stl::utf16_to_utf8(a_filename).value_or(""s))); - } - } - - void unpack_file(binary_io::file_istream& a_in, header_t a_header) - { - std::uint8_t type = 0; - std::uint64_t id = 0; - std::uint64_t offset = 0; - std::uint64_t prevID = 0; - std::uint64_t prevOffset = 0; - for (auto& mapping : _id2offset) { - a_in.read(type); - const auto lo = static_cast(type & 0xF); - const auto hi = static_cast(type >> 4); - - switch (lo) { - case 0: - a_in.read(id); - break; - case 1: - id = prevID + 1; - break; - case 2: - id = prevID + std::get<0>(a_in.read()); - break; - case 3: - id = prevID - std::get<0>(a_in.read()); - break; - case 4: - id = prevID + std::get<0>(a_in.read()); - break; - case 5: - id = prevID - std::get<0>(a_in.read()); - break; - case 6: - std::tie(id) = a_in.read(); - break; - case 7: - std::tie(id) = a_in.read(); - break; - default: - stl::report_and_fail("unhandled type"sv); - } - - const std::uint64_t tmp = (hi & 8) != 0 ? (prevOffset / a_header.pointer_size()) : prevOffset; - - switch (hi & 7) { - case 0: - a_in.read(offset); - break; - case 1: - offset = tmp + 1; - break; - case 2: - offset = tmp + std::get<0>(a_in.read()); - break; - case 3: - offset = tmp - std::get<0>(a_in.read()); - break; - case 4: - offset = tmp + std::get<0>(a_in.read()); - break; - case 5: - offset = tmp - std::get<0>(a_in.read()); - break; - case 6: - std::tie(offset) = a_in.read(); - break; - case 7: - std::tie(offset) = a_in.read(); - break; - default: - stl::report_and_fail("unhandled type"sv); - } - - if ((hi & 8) != 0) { - offset *= a_header.pointer_size(); - } - - mapping = { id, offset }; - - prevOffset = offset; - prevID = id; - } - } - - detail::memory_map _mmap; - std::span _id2offset; - }; - - 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 }; - }; - - 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 IDDatabase::get().id2offset(_id); } - - private: - [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } - - std::uint64_t _id{ 0 }; - }; - template class Relocation { @@ -983,189 +343,6 @@ namespace REL std::uintptr_t _impl{ 0 }; }; - - namespace detail - { - namespace characters - { - [[nodiscard]] constexpr bool hexadecimal(char a_ch) noexcept - { - return ('0' <= a_ch && a_ch <= '9') || - ('A' <= a_ch && a_ch <= 'F') || - ('a' <= a_ch && a_ch <= 'f'); - } - - [[nodiscard]] constexpr bool space(char a_ch) noexcept - { - return a_ch == ' '; - } - - [[nodiscard]] constexpr bool wildcard(char a_ch) noexcept - { - return a_ch == '?'; - } - } - - namespace rules - { - namespace detail - { - [[nodiscard]] consteval std::byte hexacharacters_to_hexadecimal(char a_hi, char a_lo) noexcept - { - constexpr auto lut = []() noexcept { - std::array::max() + 1> a = {}; - - const auto iterate = [&](std::uint8_t a_iFirst, unsigned char a_cFirst, unsigned char a_cLast) noexcept { - for (; a_cFirst <= a_cLast; ++a_cFirst, ++a_iFirst) { - a[a_cFirst] = a_iFirst; - } - }; - - iterate(0, '0', '9'); - iterate(0xA, 'A', 'F'); - iterate(0xa, 'a', 'f'); - - return a; - }(); - - return static_cast( - lut[static_cast(a_hi)] * 0x10u + - lut[static_cast(a_lo)]); - } - } - - template - class Hexadecimal - { - public: - [[nodiscard]] static constexpr bool match(std::byte a_byte) noexcept - { - constexpr auto expected = detail::hexacharacters_to_hexadecimal(HI, LO); - return a_byte == expected; - } - }; - - static_assert(Hexadecimal<'5', '7'>::match(std::byte{ 0x57 })); - static_assert(Hexadecimal<'6', '5'>::match(std::byte{ 0x65 })); - static_assert(Hexadecimal<'B', 'D'>::match(std::byte{ 0xBD })); - static_assert(Hexadecimal<'1', 'C'>::match(std::byte{ 0x1C })); - static_assert(Hexadecimal<'F', '2'>::match(std::byte{ 0xF2 })); - static_assert(Hexadecimal<'9', 'f'>::match(std::byte{ 0x9f })); - - static_assert(!Hexadecimal<'D', '4'>::match(std::byte{ 0xF8 })); - static_assert(!Hexadecimal<'6', '7'>::match(std::byte{ 0xAA })); - static_assert(!Hexadecimal<'7', '8'>::match(std::byte{ 0xE3 })); - static_assert(!Hexadecimal<'6', 'E'>::match(std::byte{ 0x61 })); - - class Wildcard - { - public: - [[nodiscard]] static constexpr bool match(std::byte) noexcept - { - return true; - } - }; - - static_assert(Wildcard::match(std::byte{ 0xB9 })); - static_assert(Wildcard::match(std::byte{ 0x96 })); - static_assert(Wildcard::match(std::byte{ 0x35 })); - static_assert(Wildcard::match(std::byte{ 0xE4 })); - - template - void rule_for() noexcept; - - template - Hexadecimal rule_for() noexcept - requires(characters::hexadecimal(C1) && characters::hexadecimal(C2)); - - template - Wildcard rule_for() noexcept - requires(characters::wildcard(C1) && characters::wildcard(C2)); - } - - template - class PatternMatcher - { - public: - static_assert(sizeof...(Rules) >= 1, "must provide at least 1 rule for the pattern matcher"); - - [[nodiscard]] constexpr bool match(std::span a_bytes) const noexcept - { - std::size_t i = 0; - return (Rules::match(a_bytes[i++]) && ...); - } - - [[nodiscard]] bool match(std::uintptr_t a_address) const noexcept - { - return this->match(*reinterpret_cast(a_address)); - } - - void match_or_fail(std::uintptr_t a_address, std::source_location a_loc = std::source_location::current()) const noexcept - { - if (!this->match(a_address)) { - const auto version = Module::get().version(); - stl::report_and_fail( - std::format( - "A pattern has failed to match.\n" - "This means the plugin is incompatible with the current version of the game ({}.{}.{}). " - "Head to the mod page of this plugin to see if an update is available."sv, - version[0], - version[1], - version[2]), - a_loc); - } - } - }; - - void consteval_error(const char* a_error); - - template - [[nodiscard]] constexpr auto do_make_pattern() noexcept - { - if constexpr (S.length() == 0) { - return PatternMatcher(); - } else if constexpr (S.length() == 1) { - constexpr char c = S[0]; - if constexpr (characters::hexadecimal(c) || characters::wildcard(c)) { - consteval_error("the given pattern has an unpaired rule (rules are required to be written in pairs of 2)"); - } else { - consteval_error("the given pattern has trailing characters at the end (which is not allowed)"); - } - } else { - using rule_t = decltype(rules::rule_for()); - if constexpr (std::same_as) { - consteval_error("the given pattern failed to match any known rules"); - } else { - if constexpr (S.length() <= 3) { - return do_make_pattern(), Rules..., rule_t>(); - } else if constexpr (characters::space(S[2])) { - return do_make_pattern(), Rules..., rule_t>(); - } else { - consteval_error("a space character is required to split byte patterns"); - } - } - } - } - - template - [[nodiscard]] consteval auto make_byte_array(Bytes... a_bytes) noexcept - -> std::array - { - static_assert((std::integral && ...), "all bytes must be an integral type"); - return { static_cast(a_bytes)... }; - } - } - - template - [[nodiscard]] constexpr auto make_pattern() noexcept - { - return detail::do_make_pattern(); - } - - static_assert(make_pattern<"40 10 F2 ??">().match( - detail::make_byte_array(0x40, 0x10, 0xF2, 0x41))); - static_assert(make_pattern<"B8 D0 ?? ?? D4 6E">().match( - detail::make_byte_array(0xB8, 0xD0, 0x35, 0x2A, 0xD4, 0x6E))); } #undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE diff --git a/include/REL/Version.h b/include/REL/Version.h new file mode 100644 index 000000000..04b3ffca8 --- /dev/null +++ b/include/REL/Version.h @@ -0,0 +1,105 @@ +#pragma once + +namespace REL +{ + class Version + { + public: + using value_type = std::uint16_t; + using reference = value_type&; + using const_reference = const value_type&; + + constexpr Version() noexcept = default; + + explicit constexpr Version(std::array a_version) noexcept : + _impl(a_version) + {} + + constexpr Version(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 Version& 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] & 0x0FF) << 24u | + (_impl[1] & 0x0FF) << 16u | + (_impl[2] & 0xFFF) << 4u | + (_impl[3] & 0x00F) << 0u); + } + + [[nodiscard]] std::string string() const + { + std::string result; + for (auto&& ver : _impl) { + result += std::to_string(ver); + result += '-'; + } + result.pop_back(); + return result; + } + + [[nodiscard]] std::wstring wstring() const + { + std::wstring result; + for (auto&& ver : _impl) { + result += std::to_wstring(ver); + result += L'-'; + } + result.pop_back(); + return result; + } + + private: + std::array _impl{ 0, 0, 0, 0 }; + }; + + [[nodiscard]] constexpr bool operator==(const Version& a_lhs, const Version& a_rhs) noexcept { return a_lhs.compare(a_rhs) == 0; } + [[nodiscard]] constexpr std::strong_ordering operator<=>(const Version& a_lhs, const Version& a_rhs) noexcept { return a_lhs.compare(a_rhs); } + + [[nodiscard]] inline std::optional get_file_version(stl::zwstring a_filename) + { + std::uint32_t dummy; + std::vector buf(WinAPI::GetFileVersionInfoSize(a_filename.data(), std::addressof(dummy))); + if (buf.empty()) { + return std::nullopt; + } + + if (!WinAPI::GetFileVersionInfo(a_filename.data(), 0, static_cast(buf.size()), buf.data())) { + return std::nullopt; + } + + void* verBuf{ nullptr }; + std::uint32_t verLen{ 0 }; + if (!WinAPI::VerQueryValue(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/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index 0a4b8051d..e76a73124 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -713,7 +713,7 @@ namespace REL # define RELOCATION_ID(SE, AE) REL::ID(SE) #endif -#include "REL/Relocation.h" +#include "REL/REL.h" #include "RE/Offsets.h" #include "RE/Offsets_NiRTTI.h" diff --git a/src/REL/ID.cpp b/src/REL/ID.cpp new file mode 100644 index 000000000..86926e12a --- /dev/null +++ b/src/REL/ID.cpp @@ -0,0 +1,87 @@ +#include "REL/ID.h" + +namespace REL +{ + namespace detail + { + bool memory_map::open(stl::zwstring a_name, std::size_t a_size) + { + close(); + + WinAPI::ULARGE_INTEGER bytes; + bytes.value = a_size; + + _mapping = WinAPI::OpenFileMapping( + WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + false, + a_name.data()); + if (!_mapping) { + close(); + return false; + } + + _view = WinAPI::MapViewOfFile( + _mapping, + WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + 0, + 0, + bytes.value); + if (!_view) { + close(); + return false; + } + + return true; + } + + bool memory_map::create(stl::zwstring a_name, std::size_t a_size) + { + close(); + + WinAPI::ULARGE_INTEGER bytes; + bytes.value = a_size; + + _mapping = WinAPI::OpenFileMapping( + WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + false, + a_name.data()); + if (!_mapping) { + _mapping = WinAPI::CreateFileMapping( + WinAPI::INVALID_HANDLE_VALUE, + nullptr, + WinAPI::PAGE_READWRITE, + bytes.hi, + bytes.lo, + a_name.data()); + if (!_mapping) { + return false; + } + } + + _view = WinAPI::MapViewOfFile( + _mapping, + WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + 0, + 0, + bytes.value); + if (!_view) { + return false; + } + + return true; + } + + void memory_map::close() + { + if (_view) { + WinAPI::UnmapViewOfFile(static_cast(_view)); + _view = nullptr; + } + + if (_mapping) { + WinAPI::CloseHandle(_mapping); + _mapping = nullptr; + } + } + } +} diff --git a/src/REL/Module.cpp b/src/REL/Module.cpp new file mode 100644 index 000000000..1e70aea3e --- /dev/null +++ b/src/REL/Module.cpp @@ -0,0 +1,25 @@ +#include "REL/Module.h" + +namespace REL +{ + void Module::load_segments() + { + const auto dosHeader = reinterpret_cast(_base); + const auto ntHeader = stl::adjust_pointer(dosHeader, dosHeader->lfanew); + const auto sections = WinAPI::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.first.size(), size); + return std::memcmp(a_elem.first.data(), section.name, len) == 0 && + (section.characteristics & a_elem.second) == a_elem.second; + }); + 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/Relocation.cpp b/src/REL/Relocation.cpp deleted file mode 100644 index 940ed6a2c..000000000 --- a/src/REL/Relocation.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "REL/Relocation.h" - -#define WIN32_LEAN_AND_MEAN - -#define NOGDICAPMASKS -#define NOVIRTUALKEYCODES -//#define NOWINMESSAGES -#define NOWINSTYLES -#define NOSYSMETRICS -#define NOMENUS -#define NOICONS -#define NOKEYSTATES -#define NOSYSCOMMANDS -#define NORASTEROPS -#define NOSHOWWINDOW -#define OEMRESOURCE -#define NOATOM -#define NOCLIPBOARD -#define NOCOLOR -//#define NOCTLMGR -#define NODRAWTEXT -#define NOGDI -#define NOKERNEL -//#define NOUSER -#define NONLS -//#define NOMB -#define NOMEMMGR -#define NOMETAFILE -#define NOMINMAX -//#define NOMSG -#define NOOPENFILE -#define NOSCROLL -#define NOSERVICE -#define NOSOUND -#define NOTEXTMETRIC -#define NOWH -#define NOWINOFFSETS -#define NOCOMM -#define NOKANJI -#define NOHELP -#define NOPROFILER -#define NODEFERWINDOWPOS -#define NOMCX - -#include - -namespace REL -{ - namespace detail - { - bool memory_map::open(stl::zwstring a_name, std::size_t a_size) - { - close(); - - ::ULARGE_INTEGER bytes; - bytes.QuadPart = a_size; - - _mapping = ::OpenFileMappingW( - FILE_MAP_READ | FILE_MAP_WRITE, - false, - a_name.data()); - if (!_mapping) { - close(); - return false; - } - - _view = ::MapViewOfFile( - _mapping, - FILE_MAP_READ | FILE_MAP_WRITE, - 0, - 0, - bytes.QuadPart); - if (!_view) { - close(); - return false; - } - - return true; - } - - bool memory_map::create(stl::zwstring a_name, std::size_t a_size) - { - close(); - - ::ULARGE_INTEGER bytes; - bytes.QuadPart = a_size; - - _mapping = ::OpenFileMappingW( - FILE_MAP_READ | FILE_MAP_WRITE, - false, - a_name.data()); - if (!_mapping) { - _mapping = ::CreateFileMappingW( - INVALID_HANDLE_VALUE, - nullptr, - PAGE_READWRITE, - bytes.HighPart, - bytes.LowPart, - a_name.data()); - if (!_mapping) { - return false; - } - } - - _view = ::MapViewOfFile( - _mapping, - FILE_MAP_READ | FILE_MAP_WRITE, - 0, - 0, - bytes.QuadPart); - if (!_view) { - return false; - } - - return true; - } - - void memory_map::close() - { - if (_view) { - ::UnmapViewOfFile(static_cast(_view)); - _view = nullptr; - } - - if (_mapping) { - ::CloseHandle(_mapping); - _mapping = nullptr; - } - } - } - - void Module::load_segments() - { - auto dosHeader = reinterpret_cast(_base); - auto ntHeader = stl::adjust_pointer(dosHeader, dosHeader->e_lfanew); - const auto* sections = IMAGE_FIRST_SECTION(ntHeader); - const auto size = std::min(ntHeader->FileHeader.NumberOfSections, _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.first.size(), size); - return std::memcmp(a_elem.first.data(), section.Name, len) == 0 && - (section.Characteristics & a_elem.second) == a_elem.second; - }); - if (it != SEGMENTS.end()) { - const auto idx = static_cast(std::distance(SEGMENTS.begin(), it)); - _segments[idx] = Segment{ _base, _base + section.VirtualAddress, section.Misc.VirtualSize }; - } - } - } -} From 9e9e2daaa132bb0cc64fe809402761e38a4752e0 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Sun, 28 Jan 2024 00:28:19 +0000 Subject: [PATCH 49/76] maintenance --- include/REL/ID.h | 2 +- include/REL/Version.h | 4 ++-- src/REL/Module.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/REL/ID.h b/include/REL/ID.h index 09d5f25ee..a6214a429 100644 --- a/include/REL/ID.h +++ b/include/REL/ID.h @@ -46,7 +46,7 @@ namespace REL void* _mapping{ nullptr }; void* _view{ nullptr }; }; - } + } class IDDatabase { diff --git a/include/REL/Version.h b/include/REL/Version.h index 04b3ffca8..b6f4ddd91 100644 --- a/include/REL/Version.h +++ b/include/REL/Version.h @@ -2,7 +2,7 @@ namespace REL { - class Version + class Version { public: using value_type = std::uint16_t; @@ -95,7 +95,7 @@ namespace REL Version version; std::wistringstream ss(std::wstring(static_cast(verBuf), verLen)); - std::wstring token; + std::wstring token; for (std::size_t i = 0; i < 4 && std::getline(ss, token, L'.'); ++i) { version[i] = static_cast(std::stoi(token)); } diff --git a/src/REL/Module.cpp b/src/REL/Module.cpp index 1e70aea3e..3a590cf74 100644 --- a/src/REL/Module.cpp +++ b/src/REL/Module.cpp @@ -14,7 +14,7 @@ namespace REL constexpr auto size = std::extent_v; const auto len = std::min(a_elem.first.size(), size); return std::memcmp(a_elem.first.data(), section.name, len) == 0 && - (section.characteristics & a_elem.second) == a_elem.second; + (section.characteristics & a_elem.second) == a_elem.second; }); if (it != SEGMENTS.end()) { const auto idx = static_cast(std::distance(SEGMENTS.begin(), it)); From 90247652ecaa5fc518b4570c4046ea80c1611893 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:54:23 +0530 Subject: [PATCH 50/76] Misc RE --- include/RE/A/AIProcess.h | 1 - include/RE/A/Actor.h | 1 + include/RE/B/BGSSaveLoadGame.h | 7 +++++++ include/RE/D/DialogueMenu.h | 1 + include/RE/E/ExtraSayToTopicInfo.h | 4 ++-- include/RE/H/HighProcessData.h | 23 +++++------------------ include/RE/I/InputEvent.h | 4 ++++ include/RE/M/MenuTopicManager.h | 1 + src/RE/A/Actor.cpp | 7 +++++++ src/RE/I/InputEvent.cpp | 11 +++++++++++ 10 files changed, 39 insertions(+), 21 deletions(-) diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index 0d1c6b537..30814c154 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -13,7 +13,6 @@ namespace RE class Actor; class bhkCharacterController; class BipedAnim; - class HighProcess; class NiAVObject; class NiPoint3; class TESForm; diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 258e2e95b..f897e7953 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -583,6 +583,7 @@ namespace RE [[nodiscard]] constexpr bool IsInKillMove() const noexcept { return boolFlags.all(BOOL_FLAGS::kIsInKillMove); } bool IsInMidair() const; bool IsInRagdollState() const; + bool IsLeveled() const; bool IsLimbGone(std::uint32_t a_limb); bool IsMoving() const; bool IsOnMount() const; diff --git a/include/RE/B/BGSSaveLoadGame.h b/include/RE/B/BGSSaveLoadGame.h index d71a53174..d67b8465f 100644 --- a/include/RE/B/BGSSaveLoadGame.h +++ b/include/RE/B/BGSSaveLoadGame.h @@ -72,6 +72,13 @@ namespace RE return *singleton; } + bool GetChange(TESForm* a_form, std::uint32_t a_changes) + { + using func_t = decltype(&BGSSaveLoadGame::GetChange); + REL::Relocation func{ RELOCATION_ID(34655, 35577) }; + return func(this, a_form, a_changes); + } + // members BSTArray pluginList; // 000 BSTArray unk18; // 018 diff --git a/include/RE/D/DialogueMenu.h b/include/RE/D/DialogueMenu.h index 723b82904..7bef61c98 100644 --- a/include/RE/D/DialogueMenu.h +++ b/include/RE/D/DialogueMenu.h @@ -17,6 +17,7 @@ namespace RE { public: inline static constexpr auto RTTI = RTTI_DialogueMenu; + inline static constexpr auto VTABLE = VTABLE_DialogueMenu; constexpr static std::string_view MENU_NAME = "Dialogue Menu"; struct Data diff --git a/include/RE/E/ExtraSayToTopicInfo.h b/include/RE/E/ExtraSayToTopicInfo.h index 4cefa9a6c..018b6ebfe 100644 --- a/include/RE/E/ExtraSayToTopicInfo.h +++ b/include/RE/E/ExtraSayToTopicInfo.h @@ -23,12 +23,12 @@ namespace RE // members TESTopic* topic; // 10 - std::uint8_t unk18; // 18 + bool voicePaused; // 18 std::uint8_t pad19; // 19 std::uint16_t pad1A; // 1A float subtitleSpeechDelay; // 1C BGSDialogueBranch* exclusiveBranch; // 20 - BSSoundHandle unk28; // 28 + BSSoundHandle sound; // 28 std::uint32_t pad34; // 34 DialogueItem* item; // 38 }; diff --git a/include/RE/H/HighProcessData.h b/include/RE/H/HighProcessData.h index 3e081d302..079a767f8 100644 --- a/include/RE/H/HighProcessData.h +++ b/include/RE/H/HighProcessData.h @@ -10,6 +10,7 @@ #include "RE/B/BSTList.h" #include "RE/B/BSTSmartPointer.h" #include "RE/B/BSTTuple.h" +#include "RE/M/Movement.h" #include "RE/N/NiPoint3.h" #include "RE/N/NiSmartPointer.h" #include "RE/P/PlayerCharacter.h" @@ -207,23 +208,9 @@ namespace RE ObjectRefHandle lastExtDoorActivated; // 0D8 float activationHeight; // 0DC ActorHandle reanimateCaster; // 0E0 - std::uint32_t unk0E4; // 0E4 + std::uint32_t pad0E4; // 0E4 MagicItem* reanimateSpell; // 0E8 - BSFixedString voiceSubtitle; // 0F0 - float unk0F8; // 0F8 - float unk0FC; // 0FC - float unk100; // 100 - float unk104; // 104 - float unk108; // 108 - float unk10C; // 10C - float unk110; // 110 - float unk114; // 114 - float unk118; // 118 - float unk11C; // 11C - float unk120; // 120 - float unk124; // 124 - float unk128; // 128 - float unk12C; // 12C + Movement::TypeData currentMovementType; // 0F0 stl::enumeration fadeState; // 130 float fadeAlpha; // 134 TESObjectREFR* fadeTrigger; // 138 @@ -262,7 +249,7 @@ namespace RE Data208* unk208; // 208 std::uint32_t unk210; // 210 PLAYER_ACTION playerActionReaction; // 214 - BSFixedString subtitle; // 218 + BSFixedString voiceSubtitle; // 218 BSTArray>> knowledgeArray; // 220 mutable BSReadWriteLock knowledgeLock; // 238 BSTArray queueofGreetings; // 240 @@ -281,7 +268,7 @@ namespace RE float maxAlpha; // 2A0 float unk2A4; // 2A4 std::uint64_t unk2A8; // 2A8 - float unk2B0; // 2B0 - fAISocialTimerForConversationsMin + float checkToTalkTimer; // 2B0 - fAISocialTimerForConversationsMin std::uint32_t unk2B4; // 2B4 std::uint64_t unk2B8; // 2B8 std::uint64_t unk2C0; // 2C0 diff --git a/include/RE/I/InputEvent.h b/include/RE/I/InputEvent.h index 97243a7e2..b8b8841e3 100644 --- a/include/RE/I/InputEvent.h +++ b/include/RE/I/InputEvent.h @@ -18,6 +18,7 @@ namespace RE class ButtonEvent; class CharEvent; class IDEvent; + class MouseMoveEvent; class InputEvent { @@ -41,6 +42,9 @@ namespace RE [[nodiscard]] IDEvent* AsIDEvent(); [[nodiscard]] const IDEvent* AsIDEvent() const; + [[nodiscard]] MouseMoveEvent* AsMouseMoveEvent(); + [[nodiscard]] const MouseMoveEvent* AsMouseMoveEvent() const; + // members stl::enumeration device; // 08 stl::enumeration eventType; // 0C diff --git a/include/RE/M/MenuTopicManager.h b/include/RE/M/MenuTopicManager.h index 30150ff56..3365b7650 100644 --- a/include/RE/M/MenuTopicManager.h +++ b/include/RE/M/MenuTopicManager.h @@ -10,6 +10,7 @@ namespace RE { class BGSDialogueBranch; + class DialogueResponse; class MenuOpenCloseEvent; class TESQuest; class TESTopic; diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 1d330057a..81b18773b 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -825,6 +825,13 @@ namespace RE return func(this); } + bool Actor::IsLeveled() const + { + using func_t = decltype(&Actor::IsLeveled); + REL::Relocation func{ RELOCATION_ID(19824, 20229) }; + return func(this); + } + bool Actor::IsLimbGone(std::uint32_t a_limb) { using func_t = decltype(&Actor::IsLimbGone); diff --git a/src/RE/I/InputEvent.cpp b/src/RE/I/InputEvent.cpp index b46890726..0506dbbca 100644 --- a/src/RE/I/InputEvent.cpp +++ b/src/RE/I/InputEvent.cpp @@ -3,6 +3,7 @@ #include "RE/B/ButtonEvent.h" #include "RE/C/CharEvent.h" #include "RE/I/IDEvent.h" +#include "RE/M/MouseMoveEvent.h" namespace RE { @@ -35,4 +36,14 @@ namespace RE { return HasIDCode() ? static_cast(this) : nullptr; } + + MouseMoveEvent* InputEvent::AsMouseMoveEvent() + { + return GetEventType() == INPUT_EVENT_TYPE::kMouseMove ? static_cast(this) : nullptr; + } + + const MouseMoveEvent* InputEvent::AsMouseMoveEvent() const + { + return GetEventType() == INPUT_EVENT_TYPE::kMouseMove ? static_cast(this) : nullptr; + } } From 3d96a29f21177772c59cd18a86886c4af6195190 Mon Sep 17 00:00:00 2001 From: Sabrina Bjurman Date: Mon, 19 Feb 2024 18:43:04 +0100 Subject: [PATCH 51/76] AIProcess::forms = list of equipped objects and the slot they are equipped to + renamed to equippedForms (equippedObjects was taken). --- include/RE/A/AIProcess.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index 30814c154..052c061db 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -134,6 +134,13 @@ namespace RE }; using Hand = Hands::Hand; + struct EquippedObject + { + TESBoundObject* object; // 00 + BGSEquipSlot* slot; // 08 + }; + static_assert(sizeof(EquippedObject) == 0x10); + struct Data0B8 { public: @@ -202,7 +209,7 @@ namespace RE float deathTime; // 094 float trackedDamage; // 098 std::uint32_t pad09C; // 09C - BSTArray forms; // 0A0 + BSTArray equippedForms; // 0A0 Data0B8 unk0B8; // 0B8 TESForm* equippedObjects[Hand::kTotal]; // 0F0 std::uint64_t unk100; // 100 From 2fd14d26800512f778159ce3cc8204eebdcf07c2 Mon Sep 17 00:00:00 2001 From: Sabrina Bjurman Date: Mon, 19 Feb 2024 18:51:18 +0100 Subject: [PATCH 52/76] Convenient function to get object equipped in a specific equipslot. --- include/RE/A/Actor.h | 1 + src/RE/A/Actor.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index f897e7953..4676491ae 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -529,6 +529,7 @@ namespace RE InventoryEntryData* GetEquippedEntryData(bool a_leftHand) const; TESForm* GetEquippedObject(bool a_leftHand) const; float GetEquippedWeight(); + TESBoundObject* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const; std::int32_t GetFactionRank(TESFaction* a_faction, bool a_isPlayer); std::int32_t GetGoldAmount(bool a_noInit = false); ActorHandle GetHandle(); diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 239ad8c47..1b1c5c3aa 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -396,6 +396,21 @@ namespace RE } } + TESBoundObject* Actor::GetEquippedObjectInSlot(const BGSEquipSlot* slot) const + { + if (!currentProcess) { + return nullptr; + } + + for (const auto& equippedObject : currentProcess->equippedForms) { + if (equippedObject.slot == slot) { + return equippedObject.object; + } + } + + return nullptr; + } + float Actor::GetEquippedWeight() { if (equippedWeight < 0.0f) { From baf0c8cc58d07e915b3b2dc28be5b98b588db8a1 Mon Sep 17 00:00:00 2001 From: Sabrina Bjurman Date: Mon, 19 Feb 2024 18:53:41 +0100 Subject: [PATCH 53/76] yeah --- include/RE/A/Actor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 4676491ae..0cb6e6b68 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -528,8 +528,8 @@ namespace RE const TESShout* GetCurrentShout() const; InventoryEntryData* GetEquippedEntryData(bool a_leftHand) const; TESForm* GetEquippedObject(bool a_leftHand) const; - float GetEquippedWeight(); TESBoundObject* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const; + float GetEquippedWeight(); std::int32_t GetFactionRank(TESFaction* a_faction, bool a_isPlayer); std::int32_t GetGoldAmount(bool a_noInit = false); ActorHandle GetHandle(); From c3c9df7d84a401d606d48526c15442bc708d1249 Mon Sep 17 00:00:00 2001 From: Sabrina Bjurman Date: Mon, 19 Feb 2024 19:25:05 +0100 Subject: [PATCH 54/76] On a second thought it's probably TESForm and not TESBoundObject since shouts are not bound objects. --- include/RE/A/AIProcess.h | 6 +++--- include/RE/A/Actor.h | 2 +- src/RE/A/Actor.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index 052c061db..550d3ef4c 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -136,8 +136,8 @@ namespace RE struct EquippedObject { - TESBoundObject* object; // 00 - BGSEquipSlot* slot; // 08 + TESForm* object; // 00 + BGSEquipSlot* slot; // 08 }; static_assert(sizeof(EquippedObject) == 0x10); @@ -209,7 +209,7 @@ namespace RE float deathTime; // 094 float trackedDamage; // 098 std::uint32_t pad09C; // 09C - BSTArray equippedForms; // 0A0 + BSTArray equippedForms; // 0A0 Data0B8 unk0B8; // 0B8 TESForm* equippedObjects[Hand::kTotal]; // 0F0 std::uint64_t unk100; // 100 diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 0cb6e6b68..cbf210e86 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -528,7 +528,7 @@ namespace RE const TESShout* GetCurrentShout() const; InventoryEntryData* GetEquippedEntryData(bool a_leftHand) const; TESForm* GetEquippedObject(bool a_leftHand) const; - TESBoundObject* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const; + TESForm* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const; float GetEquippedWeight(); std::int32_t GetFactionRank(TESFaction* a_faction, bool a_isPlayer); std::int32_t GetGoldAmount(bool a_noInit = false); diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 1b1c5c3aa..3ef846858 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -396,7 +396,7 @@ namespace RE } } - TESBoundObject* Actor::GetEquippedObjectInSlot(const BGSEquipSlot* slot) const + TESForm* Actor::GetEquippedObjectInSlot(const BGSEquipSlot* slot) const { if (!currentProcess) { return nullptr; From 18d42a7cc1a7a831267a4de6d68f69f7e0a685d0 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:49:15 -0600 Subject: [PATCH 55/76] Refactor OS API's --- CMakeLists.txt | 6 +- cmake/sourcelist.cmake | 43 +- include/RE/A/Actor.h | 4 +- include/RE/B/BSAtomic.h | 4 +- include/RE/B/BSDirectInputManager.h | 21 +- include/RE/B/BSFile.h | 34 +- include/RE/B/BSMultiIndexTriShape.h | 4 +- include/RE/B/BSPCOrbisGamepadDevice.h | 38 +- include/RE/B/BSParticleShaderCubeEmitter.h | 26 +- include/RE/B/BSSystemFile.h | 17 +- include/RE/B/BSThread.h | 20 +- include/RE/B/BSWin32GamepadDevice.h | 62 +- include/RE/B/BSWin32KeyboardDevice.h | 14 +- include/RE/B/BSWin32MouseDevice.h | 12 +- include/RE/G/GAtomic.h | 4 +- include/RE/I/Info.h | 8 +- include/RE/L/LooseFileLocation.h | 12 +- include/RE/M/Main.h | 6 +- include/RE/M/MenuTopicManager.h | 4 +- include/RE/N/NiSkinInstance.h | 4 +- include/RE/N/NiStream.h | 70 +- include/RE/P/Precipitation.h | 12 +- include/RE/R/Renderer.h | 131 +- include/RE/S/ScrapHeap.h | 4 +- include/RE/T/TESFile.h | 10 +- include/REL/Module.h | 12 +- include/REL/Relocation.h | 42 +- include/REL/Version.h | 8 +- include/REX/PS4.h | 3 + include/REX/PS4/SCEPAD.h | 27 + include/REX/W32.h | 27 + include/REX/W32/ADVAPI32.h | 16 + include/REX/W32/BASE.h | 188 ++ include/REX/W32/COM.h | 25 + include/REX/W32/COMPTR.h | 196 ++ include/REX/W32/D3D.h | 736 +++++++ include/REX/W32/D3D11.h | 2043 ++++++++++++++++++++ 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 | 506 +++++ 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 + include/SKSE/IAT.h | 6 +- include/SKSE/Impl/DInputAPI.h | 572 ------ include/SKSE/Impl/PCH.h | 29 +- include/SKSE/Impl/ScePadAPI.h | 27 - include/SKSE/Impl/WinAPI.h | 1238 ------------ include/SKSE/Impl/XInputAPI.h | 84 - include/SKSE/Trampoline.h | 9 +- src/RE/A/Actor.cpp | 2 +- src/RE/B/BSAtomic.cpp | 66 +- src/RE/B/BSDirectInputManager.cpp | 8 +- src/RE/B/BSWin32KeyboardDevice.cpp | 28 +- src/RE/G/GAtomic.cpp | 54 +- src/RE/G/GFxLog.cpp | 4 +- src/RE/G/GMemoryHeap.cpp | 5 +- src/RE/M/MenuCursor.cpp | 5 +- src/RE/R/Renderer.cpp | 62 +- src/RE/T/TESObjectARMA.cpp | 4 +- src/RE/T/TESObjectWEAP.cpp | 4 +- src/REL/ID.cpp | 32 +- src/REL/Module.cpp | 8 +- src/REX/W32/ADVAPI32.cpp | 17 + src/REX/W32/D3D11.cpp | 17 + src/REX/W32/D3DCOMPILER.cpp | 155 ++ src/REX/W32/DBGHELP.cpp | 17 + src/REX/W32/DXGI.cpp | 17 + src/REX/W32/KERNEL32.cpp | 467 +++++ src/REX/W32/OLE32.cpp | 11 + src/REX/W32/SHELL32.cpp | 11 + src/REX/W32/USER32.cpp | 59 + src/REX/W32/VERSION.cpp | 53 + src/SKSE/IAT.cpp | 81 +- src/SKSE/Impl/WinAPI.cpp | 1032 ---------- src/SKSE/InputMap.cpp | 212 +- src/SKSE/Logger.cpp | 12 +- src/SKSE/Trampoline.cpp | 81 +- 91 files changed, 8437 insertions(+), 3664 deletions(-) create mode 100644 include/REX/PS4.h create mode 100644 include/REX/PS4/SCEPAD.h create mode 100644 include/REX/W32.h create mode 100644 include/REX/W32/ADVAPI32.h create mode 100644 include/REX/W32/BASE.h create mode 100644 include/REX/W32/COM.h create mode 100644 include/REX/W32/COMPTR.h create mode 100644 include/REX/W32/D3D.h create mode 100644 include/REX/W32/D3D11.h create mode 100644 include/REX/W32/D3D11_1.h create mode 100644 include/REX/W32/D3D11_2.h create mode 100644 include/REX/W32/D3D11_3.h create mode 100644 include/REX/W32/D3D11_4.h create mode 100644 include/REX/W32/D3DCOMPILER.h create mode 100644 include/REX/W32/DBGHELP.h create mode 100644 include/REX/W32/DINPUT.h create mode 100644 include/REX/W32/DXGI.h create mode 100644 include/REX/W32/DXGI_2.h create mode 100644 include/REX/W32/DXGI_3.h create mode 100644 include/REX/W32/DXGI_4.h create mode 100644 include/REX/W32/DXGI_5.h create mode 100644 include/REX/W32/DXGI_6.h create mode 100644 include/REX/W32/KERNEL32.h create mode 100644 include/REX/W32/OLE32.h create mode 100644 include/REX/W32/SHELL32.h create mode 100644 include/REX/W32/USER32.h create mode 100644 include/REX/W32/VERSION.h create mode 100644 include/REX/W32/XINPUT.h delete mode 100644 include/SKSE/Impl/DInputAPI.h delete mode 100644 include/SKSE/Impl/ScePadAPI.h delete mode 100644 include/SKSE/Impl/WinAPI.h delete mode 100644 include/SKSE/Impl/XInputAPI.h create mode 100644 src/REX/W32/ADVAPI32.cpp create mode 100644 src/REX/W32/D3D11.cpp create mode 100644 src/REX/W32/D3DCOMPILER.cpp create mode 100644 src/REX/W32/DBGHELP.cpp create mode 100644 src/REX/W32/DXGI.cpp create mode 100644 src/REX/W32/KERNEL32.cpp create mode 100644 src/REX/W32/OLE32.cpp create mode 100644 src/REX/W32/SHELL32.cpp create mode 100644 src/REX/W32/USER32.cpp create mode 100644 src/REX/W32/VERSION.cpp delete mode 100644 src/SKSE/Impl/WinAPI.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bace4cb0..5f9ae839d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,12 @@ target_link_libraries( PUBLIC binary_io::binary_io spdlog::spdlog - Version.lib + Advapi32.lib + D3D11.lib Dbghelp.lib + DXGI.lib + Ole32.lib + Version.lib ) target_precompile_headers( diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 297ce72d1..516b10289 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1620,16 +1620,40 @@ set(SOURCES include/REL/REL.h include/REL/Relocation.h include/REL/Version.h + include/REX/PS4.h + include/REX/PS4/SCEPAD.h + include/REX/W32.h + include/REX/W32/ADVAPI32.h + include/REX/W32/BASE.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/OLE32.h + include/REX/W32/SHELL32.h + include/REX/W32/USER32.h + include/REX/W32/VERSION.h + include/REX/W32/XINPUT.h include/SKSE/API.h include/SKSE/Events.h include/SKSE/IAT.h - include/SKSE/Impl/DInputAPI.h include/SKSE/Impl/PCH.h include/SKSE/Impl/RegistrationTraits.h - include/SKSE/Impl/ScePadAPI.h include/SKSE/Impl/Stubs.h - include/SKSE/Impl/WinAPI.h - include/SKSE/Impl/XInputAPI.h include/SKSE/InputMap.h include/SKSE/Interfaces.h include/SKSE/Logger.h @@ -1965,10 +1989,19 @@ set(SOURCES src/RE/Z/ZeroFunctionArguments.cpp src/REL/ID.cpp src/REL/Module.cpp + src/REX/W32/ADVAPI32.cpp + src/REX/W32/D3D11.cpp + src/REX/W32/D3DCOMPILER.cpp + src/REX/W32/DBGHELP.cpp + src/REX/W32/DXGI.cpp + src/REX/W32/KERNEL32.cpp + src/REX/W32/OLE32.cpp + src/REX/W32/SHELL32.cpp + src/REX/W32/USER32.cpp + src/REX/W32/VERSION.cpp src/SKSE/API.cpp src/SKSE/IAT.cpp src/SKSE/Impl/PCH.cpp - src/SKSE/Impl/WinAPI.cpp src/SKSE/InputMap.cpp src/SKSE/Interfaces.cpp src/SKSE/Logger.cpp diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index f897e7953..7b054aee7 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -24,6 +24,8 @@ #include "RE/T/TESNPC.h" #include "RE/T/TESObjectREFR.h" +#include "REX/W32/BASE.h" + namespace RE { class ActorMagicCaster; @@ -687,7 +689,7 @@ namespace RE std::uint32_t unk274; // 274 std::uint64_t unk278; // 278 std::uint64_t unk280; // 280 - WinAPI::CRITICAL_SECTION unk288; // 288 - havok related + REX::W32::CRITICAL_SECTION unk288; // 288 - havok related private: void CalculateCurrentVendorFaction() const; diff --git a/include/RE/B/BSAtomic.h b/include/RE/B/BSAtomic.h index a804fe4be..037376f49 100644 --- a/include/RE/B/BSAtomic.h +++ b/include/RE/B/BSAtomic.h @@ -1,12 +1,14 @@ #pragma once +#include "REX/W32/BASE.h" + namespace RE { class BSCriticalSection { public: // members - WinAPI::CRITICAL_SECTION criticalSection; // 00 + REX::W32::CRITICAL_SECTION criticalSection; // 00 }; static_assert(sizeof(BSCriticalSection) == 0x28); diff --git a/include/RE/B/BSDirectInputManager.h b/include/RE/B/BSDirectInputManager.h index 53db931c1..b0631a59f 100644 --- a/include/RE/B/BSDirectInputManager.h +++ b/include/RE/B/BSDirectInputManager.h @@ -2,6 +2,15 @@ #include "RE/B/BSTSingleton.h" +#include "REX/W32/BASE.h" + +namespace REX::W32 +{ + struct DIDEVICEOBJECTDATA; + struct IDirectInput8A; + struct IDirectInputDevice8A; +} + namespace RE { class BSDirectInputManager : public BSTSingletonSDM @@ -9,14 +18,14 @@ namespace RE public: static BSDirectInputManager* GetSingleton(); - DirectInput8::IDirectInputDevice8A* CreateDeviceWithGUID(WinAPI::GUID* a_guid); - void GetDeviceState(DirectInput8::IDirectInputDevice8A* a_device, std::uint32_t a_size, void* a_outData); - void GetDeviceData(DirectInput8::IDirectInputDevice8A* a_device, std::uint32_t* a_dataSize, DirectInput8::DIDEVICEOBJECTDATA** a_outData); - void ReleaseDevice(DirectInput8::IDirectInputDevice8A* a_device); + REX::W32::IDirectInputDevice8A* CreateDeviceWithGUID(REX::W32::GUID* a_guid); + void GetDeviceState(REX::W32::IDirectInputDevice8A* a_device, std::uint32_t a_size, void* a_outData); + void GetDeviceData(REX::W32::IDirectInputDevice8A* a_device, std::uint32_t* a_dataSize, REX::W32::DIDEVICEOBJECTDATA** a_outData); + void ReleaseDevice(REX::W32::IDirectInputDevice8A* a_device); // members - std::uint32_t pad00; // 00 - DirectInput8::IDirectInput8A* diInterface; // 08 + std::uint32_t pad00; // 00 + REX::W32::IDirectInput8A* diInterface; // 08 }; static_assert(sizeof(BSDirectInputManager) == 0x10); } diff --git a/include/RE/B/BSFile.h b/include/RE/B/BSFile.h index 239add3a7..ce2883010 100644 --- a/include/RE/B/BSFile.h +++ b/include/RE/B/BSFile.h @@ -2,6 +2,8 @@ #include "RE/N/NiFile.h" +#include "REX/W32/BASE.h" + namespace RE { class BSFile : public NiFile @@ -31,22 +33,22 @@ namespace RE virtual void Unk_12(void); // 12 // members - bool useAuxBuffer; // 048 - std::uint8_t pad049; // 049 - std::uint16_t pad04A; // 04A - std::uint32_t pad04C; // 04C - char* auxBuffer; // 050 - std::int32_t auxTrueFilePos; // 058 - std::uint32_t auxBufferMinIndex; // 05C - std::uint32_t auxBufferMaxIndex; // 060 - char fileName[WinAPI::MAX_PATH]; // 064 - std::uint32_t result; // 168 - std::uint32_t ioSize; // 16C - std::uint32_t trueFilePos; // 170 - std::uint32_t fileSize; // 174 - bool virtualAlloc; // 178 - std::uint8_t unk179; // 179 - std::uint16_t unk17A; // 17A + bool useAuxBuffer; // 048 + std::uint8_t pad049; // 049 + std::uint16_t pad04A; // 04A + std::uint32_t pad04C; // 04C + char* auxBuffer; // 050 + std::int32_t auxTrueFilePos; // 058 + std::uint32_t auxBufferMinIndex; // 05C + std::uint32_t auxBufferMaxIndex; // 060 + char fileName[REX::W32::MAX_PATH]; // 064 + std::uint32_t result; // 168 + std::uint32_t ioSize; // 16C + std::uint32_t trueFilePos; // 170 + std::uint32_t fileSize; // 174 + bool virtualAlloc; // 178 + std::uint8_t unk179; // 179 + std::uint16_t unk17A; // 17A }; static_assert(sizeof(BSFile) == 0x180); } diff --git a/include/RE/B/BSMultiIndexTriShape.h b/include/RE/B/BSMultiIndexTriShape.h index 31f5ab53a..fcc7a1dd1 100644 --- a/include/RE/B/BSMultiIndexTriShape.h +++ b/include/RE/B/BSMultiIndexTriShape.h @@ -4,6 +4,8 @@ #include "RE/N/NiColor.h" #include "RE/N/NiSmartPointer.h" +#include "REX/W32/D3D.h" + namespace RE { namespace BSGraphics @@ -29,7 +31,7 @@ namespace RE // members BSGraphics::IndexBuffer* altIndexBuffer; // 160 std::uint32_t altPrimCount; // 168 - DirectX::XMFLOAT4X4 materialProjection; // 16C + REX::W32::XMFLOAT4X4 materialProjection; // 16C std::uint32_t pad1AC; // 1AC NiPointer additionalShaderProperty; // 1B0 std::uint8_t useAdditionalTriList; // 1B8 diff --git a/include/RE/B/BSPCOrbisGamepadDevice.h b/include/RE/B/BSPCOrbisGamepadDevice.h index c3a85046d..b5e0a4be0 100644 --- a/include/RE/B/BSPCOrbisGamepadDevice.h +++ b/include/RE/B/BSPCOrbisGamepadDevice.h @@ -2,6 +2,8 @@ #include "RE/B/BSPCGamepadDeviceDelegate.h" +#include "REX/PS4/SCEPAD.h" + namespace RE { // PS4 controller used via HID polling @@ -17,26 +19,26 @@ namespace RE { // Masks for buttonState // Key hardware value - kUp = ScePad::ScePadButton::SCE_PAD_BUTTON_UP, - kDown = ScePad::ScePadButton::SCE_PAD_BUTTON_DOWN, - kLeft = ScePad::ScePadButton::SCE_PAD_BUTTON_LEFT, - kRight = ScePad::ScePadButton::SCE_PAD_BUTTON_RIGHT, - kPS3_Start = ScePad::ScePadButton::SCE_PAD_BUTTON_OPTIONS, - kPS3_Back = ScePad::ScePadButton::SCE_PAD_BUTTON_TOUCH_PAD, // This is mapped to the touchpad on the PS4 controller - kPS3_L3 = ScePad::ScePadButton::SCE_PAD_BUTTON_L3, - kPS3_R3 = ScePad::ScePadButton::SCE_PAD_BUTTON_R3, - kPS3_LB = ScePad::ScePadButton::SCE_PAD_BUTTON_L1, - kPS3_RB = ScePad::ScePadButton::SCE_PAD_BUTTON_R1, - kPS3_A = ScePad::ScePadButton::SCE_PAD_BUTTON_CROSS, - kPS3_B = ScePad::ScePadButton::SCE_PAD_BUTTON_CIRCLE, - kPS3_X = ScePad::ScePadButton::SCE_PAD_BUTTON_SQUARE, - kPS3_Y = ScePad::ScePadButton::SCE_PAD_BUTTON_TRIANGLE, + kUp = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_UP, + kDown = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_DOWN, + kLeft = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_LEFT, + kRight = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_RIGHT, + kPS3_Start = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_OPTIONS, + kPS3_Back = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_TOUCH_PAD, // This is mapped to the touchpad on the PS4 controller + kPS3_L3 = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_L3, + kPS3_R3 = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_R3, + kPS3_LB = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_L1, + kPS3_RB = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_R1, + kPS3_A = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_CROSS, + kPS3_B = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_CIRCLE, + kPS3_X = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_SQUARE, + kPS3_Y = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_TRIANGLE, // Unused by Skyrim - kPS4_Share = ScePad::ScePadButton::SCE_PAD_BUTTON_SHARE, // Skyrim uses the touchpad for Back and leaves the Share button unused - kPS4_L2 = ScePad::ScePadButton::SCE_PAD_BUTTON_L2, // Skyrim uses trigger axis read instead of button press - kPS4_R2 = ScePad::ScePadButton::SCE_PAD_BUTTON_R2, // Skyrim uses trigger axis read instead of button press - kPS4_PSBtn = ScePad::ScePadButton::SCE_PAD_BUTTON_PLAYSTATION, // Playstation button + kPS4_Share = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_SHARE, // Skyrim uses the touchpad for Back and leaves the Share button unused + kPS4_L2 = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_L2, // Skyrim uses trigger axis read instead of button press + kPS4_R2 = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_R2, // Skyrim uses trigger axis read instead of button press + kPS4_PSBtn = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_PLAYSTATION, // Playstation button // arbitrary values // IDs meant to be used with ButtonEvent diff --git a/include/RE/B/BSParticleShaderCubeEmitter.h b/include/RE/B/BSParticleShaderCubeEmitter.h index e1a9dc615..c0d72e331 100644 --- a/include/RE/B/BSParticleShaderCubeEmitter.h +++ b/include/RE/B/BSParticleShaderCubeEmitter.h @@ -3,6 +3,8 @@ #include "RE/B/BSParticleShaderEmitter.h" #include "RE/N/NiPoint3.h" +#include "REX/W32/D3D.h" + namespace RE { class BSParticleShaderCubeEmitter : public BSParticleShaderEmitter @@ -16,18 +18,18 @@ namespace RE bool Generate(bool a_arg1, NiPoint3& a_arg2, NiPoint3& a_arg3) override; // 03 - { return false; } // members - alignas(0x10) DirectX::XMFLOAT4X4 occlusionProjection; // ED0 - NiPoint3 cameraOffsetVector; // F10 - NiPoint3 offsetVector; // F1C - NiPoint3 compositeOffsetVector; // F28 - NiPoint3 frameVelocityVector; // F34 - NiPoint3 windVelocity; // F40 - NiPoint3 gravityVelocity; // F4C - float rotation; // F58 - float rotationVelocity; // F5C - float cubeSize; // F60 - float density; // F64 - NiPoint3 instanceOffsets[10]; // F68 + alignas(0x10) REX::W32::XMFLOAT4X4 occlusionProjection; // ED0 + NiPoint3 cameraOffsetVector; // F10 + NiPoint3 offsetVector; // F1C + NiPoint3 compositeOffsetVector; // F28 + NiPoint3 frameVelocityVector; // F34 + NiPoint3 windVelocity; // F40 + NiPoint3 gravityVelocity; // F4C + float rotation; // F58 + float rotationVelocity; // F5C + float cubeSize; // F60 + float density; // F64 + NiPoint3 instanceOffsets[10]; // F68 }; static_assert(sizeof(BSParticleShaderCubeEmitter) == 0xFE0); } diff --git a/include/RE/B/BSSystemFile.h b/include/RE/B/BSSystemFile.h index 3a2209141..2045ec08f 100644 --- a/include/RE/B/BSSystemFile.h +++ b/include/RE/B/BSSystemFile.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/BASE.h" + namespace RE { namespace BSResource @@ -9,21 +11,20 @@ namespace RE public: struct Info { - public: // members - WinAPI::FILETIME accessTime; // 00 - WinAPI::FILETIME modifyTime; // 08 - WinAPI::FILETIME createTime; // 10 - std::uint64_t fileSize; // 18 + REX::W32::FILETIME accessTime; // 00 + REX::W32::FILETIME modifyTime; // 08 + REX::W32::FILETIME createTime; // 10 + std::uint64_t fileSize; // 18 }; static_assert(sizeof(Info) == 0x20); BSSystemFile(); // members - std::uint32_t flags{ 1 }; // 00 - std::uint32_t pad04{ 0 }; // 04 - void* file{ WinAPI::INVALID_HANDLE_VALUE }; // 08 + std::uint32_t flags{ 1 }; // 00 + std::uint32_t pad04{ 0 }; // 04 + void* file{ REX::W32::INVALID_HANDLE_VALUE }; // 08 }; static_assert(sizeof(BSSystemFile) == 0x10); } diff --git a/include/RE/B/BSThread.h b/include/RE/B/BSThread.h index 7f6ae9036..cc8aa0b78 100644 --- a/include/RE/B/BSThread.h +++ b/include/RE/B/BSThread.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/BASE.h" + namespace RE { class BSThread @@ -14,15 +16,15 @@ namespace RE virtual void Unk_02(void); // 02 - { return; } // members - WinAPI::CRITICAL_SECTION lock; // 08 - void* thread; // 30 - void* ownerThread; // 38 - std::uint32_t threadID; // 40 - std::uint32_t ownerThreadID; // 44 - bool initialized; // 48 - std::uint8_t pad49; // 49 - std::uint16_t pad4A; // 4A - std::uint32_t pad4C; // 4C + REX::W32::CRITICAL_SECTION lock; // 08 + void* thread; // 30 + void* ownerThread; // 38 + std::uint32_t threadID; // 40 + std::uint32_t ownerThreadID; // 44 + bool initialized; // 48 + std::uint8_t pad49; // 49 + std::uint16_t pad4A; // 4A + std::uint32_t pad4C; // 4C }; static_assert(sizeof(BSThread) == 0x50); } diff --git a/include/RE/B/BSWin32GamepadDevice.h b/include/RE/B/BSWin32GamepadDevice.h index 08d433c9b..9952bf19f 100644 --- a/include/RE/B/BSWin32GamepadDevice.h +++ b/include/RE/B/BSWin32GamepadDevice.h @@ -2,6 +2,8 @@ #include "RE/B/BSPCGamepadDeviceDelegate.h" +#include "REX/W32/XINPUT.h" + namespace RE { class BSWin32GamepadDevice : public BSPCGamepadDeviceDelegate @@ -15,20 +17,20 @@ namespace RE enum Key : std::uint32_t { // button masks for wButtons - kUp = XInput::XInputButton::XINPUT_GAMEPAD_DPAD_UP, // 0x0001 - kDown = XInput::XInputButton::XINPUT_GAMEPAD_DPAD_DOWN, // 0x0002 - kLeft = XInput::XInputButton::XINPUT_GAMEPAD_DPAD_LEFT, // 0x0004 - kRight = XInput::XInputButton::XINPUT_GAMEPAD_DPAD_RIGHT, // 0x0008 - kStart = XInput::XInputButton::XINPUT_GAMEPAD_START, // 0x0010 - kBack = XInput::XInputButton::XINPUT_GAMEPAD_BACK, // 0x0020 - kLeftThumb = XInput::XInputButton::XINPUT_GAMEPAD_LEFT_THUMB, // 0x0040 - kRightThumb = XInput::XInputButton::XINPUT_GAMEPAD_RIGHT_THUMB, // 0x0080 - kLeftShoulder = XInput::XInputButton::XINPUT_GAMEPAD_LEFT_SHOULDER, // 0x0100 - kRightShoulder = XInput::XInputButton::XINPUT_GAMEPAD_RIGHT_SHOULDER, // 0x0200 - kA = XInput::XInputButton::XINPUT_GAMEPAD_A, // 0x1000 - kB = XInput::XInputButton::XINPUT_GAMEPAD_B, // 0x2000 - kX = XInput::XInputButton::XINPUT_GAMEPAD_X, // 0x4000 - kY = XInput::XInputButton::XINPUT_GAMEPAD_Y, // 0x8000 + kUp = REX::W32::XINPUT_GAMEPAD_DPAD_UP, // 0x0001 + kDown = REX::W32::XINPUT_GAMEPAD_DPAD_DOWN, // 0x0002 + kLeft = REX::W32::XINPUT_GAMEPAD_DPAD_LEFT, // 0x0004 + kRight = REX::W32::XINPUT_GAMEPAD_DPAD_RIGHT, // 0x0008 + kStart = REX::W32::XINPUT_GAMEPAD_START, // 0x0010 + kBack = REX::W32::XINPUT_GAMEPAD_BACK, // 0x0020 + kLeftThumb = REX::W32::XINPUT_GAMEPAD_LEFT_THUMB, // 0x0040 + kRightThumb = REX::W32::XINPUT_GAMEPAD_RIGHT_THUMB, // 0x0080 + kLeftShoulder = REX::W32::XINPUT_GAMEPAD_LEFT_SHOULDER, // 0x0100 + kRightShoulder = REX::W32::XINPUT_GAMEPAD_RIGHT_SHOULDER, // 0x0200 + kA = REX::W32::XINPUT_GAMEPAD_A, // 0x1000 + kB = REX::W32::XINPUT_GAMEPAD_B, // 0x2000 + kX = REX::W32::XINPUT_GAMEPAD_X, // 0x4000 + kY = REX::W32::XINPUT_GAMEPAD_Y, // 0x8000 // arbitrary values // IDs meant to be used with ButtonEvent @@ -71,30 +73,30 @@ namespace RE // Returns the previous ButtonState of the gamepad ButtonState GetPreviousButtonState() const { - return stl::unrestricted_cast(previousState.Gamepad.wButtons & XInput::XINPUT_BUTTON_MASK); + return stl::unrestricted_cast(previousState.gamepad.buttons & REX::W32::XINPUT_GAMEPAD_BUTTON_MASK); } // Returns the current ButtonState of the gamepad ButtonState GetCurrentButtonState() const { - return stl::unrestricted_cast(currentState.Gamepad.wButtons & XInput::XINPUT_BUTTON_MASK); + return stl::unrestricted_cast(currentState.gamepad.buttons & REX::W32::XINPUT_GAMEPAD_BUTTON_MASK); } // members - XInput::XINPUT_STATE previousState; // 0D8 - float previousLT; // 0E8 - float previousRT; // 0EC - float previousLX; // 0F0 - float previousLY; // 0F4 - float previousRX; // 0F8 - float previousRY; // 0FC - XInput::XINPUT_STATE currentState; // 100 - float currentLT; // 110 - float currentRT; // 114 - float currentLX; // 118 - float currentLY; // 11C - float currentRX; // 120 - float currentRY; // 124 + REX::W32::XINPUT_STATE previousState; // 0D8 + float previousLT; // 0E8 + float previousRT; // 0EC + float previousLX; // 0F0 + float previousLY; // 0F4 + float previousRX; // 0F8 + float previousRY; // 0FC + REX::W32::XINPUT_STATE currentState; // 100 + float currentLT; // 110 + float currentRT; // 114 + float currentLX; // 118 + float currentLY; // 11C + float currentRX; // 120 + float currentRY; // 124 protected: friend class BSGamepadDeviceHandler; diff --git a/include/RE/B/BSWin32KeyboardDevice.h b/include/RE/B/BSWin32KeyboardDevice.h index f4690e892..54abacaa8 100644 --- a/include/RE/B/BSWin32KeyboardDevice.h +++ b/include/RE/B/BSWin32KeyboardDevice.h @@ -2,6 +2,8 @@ #include "RE/B/BSKeyboardDevice.h" +#include "REX/W32/DINPUT.h" + namespace RE { class BSWin32KeyboardDevice : public BSKeyboardDevice @@ -21,14 +23,14 @@ namespace RE void Unk_0A(void) override; // 0A - { return; } [[nodiscard]] bool IsPressed(std::uint32_t a_keyCode) const; - [[nodiscard]] Key RemapNumpadKey(DirectInput8::DIKey a_key); + [[nodiscard]] Key RemapNumpadKey(REX::W32::DIK a_key); // members - DirectInput8::IDirectInput8A* dInputDevice; // 070 - DirectInput8::DIDEVICEOBJECTDATA diObjData[10]; // 078 - std::uint8_t prevState[0x100]; // 168 - std::uint8_t curState[0x100]; // 268 - bool capsLockOn; // 368 + REX::W32::IDirectInput8A* dInputDevice; // 070 + REX::W32::DIDEVICEOBJECTDATA diObjData[10]; // 078 + std::uint8_t prevState[0x100]; // 168 + std::uint8_t curState[0x100]; // 268 + bool capsLockOn; // 368 protected: BSWin32KeyboardDevice(); diff --git a/include/RE/B/BSWin32MouseDevice.h b/include/RE/B/BSWin32MouseDevice.h index d771c6a6c..609ed4cc8 100644 --- a/include/RE/B/BSWin32MouseDevice.h +++ b/include/RE/B/BSWin32MouseDevice.h @@ -3,6 +3,8 @@ #include "RE/B/BSAtomic.h" #include "RE/B/BSMouseDevice.h" +#include "REX/W32/DINPUT.h" + namespace RE { class BSWin32MouseDevice : public BSMouseDevice @@ -39,11 +41,11 @@ namespace RE void Reinitialize(void) override; // 09 // members - DirectInput8::IDirectInputDevice8A* dInputDevice; // 78 - DirectInput8::DIMOUSESTATE2 dInputPrevState{}; // 80 - DirectInput8::DIMOUSESTATE2 dInputNextState{}; // 94 - bool notInitialized; // A8 - mutable BSSpinLock reinitializeLock; // AC + REX::W32::IDirectInputDevice8A* dInputDevice; // 78 + REX::W32::DIMOUSESTATE2 dInputPrevState{}; // 80 + REX::W32::DIMOUSESTATE2 dInputNextState{}; // 94 + bool notInitialized; // A8 + mutable BSSpinLock reinitializeLock; // AC protected: BSWin32MouseDevice(); diff --git a/include/RE/G/GAtomic.h b/include/RE/G/GAtomic.h index b276ce09c..80a1cb521 100644 --- a/include/RE/G/GAtomic.h +++ b/include/RE/G/GAtomic.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/BASE.h" + namespace RE { class GLock @@ -25,7 +27,7 @@ namespace RE void Unlock(); // members - WinAPI::CRITICAL_SECTION cs; // 00 + REX::W32::CRITICAL_SECTION cs; // 00 }; static_assert(sizeof(GLock) == 0x28); diff --git a/include/RE/I/Info.h b/include/RE/I/Info.h index c923666a9..dbcddd809 100644 --- a/include/RE/I/Info.h +++ b/include/RE/I/Info.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/BASE.h" + namespace RE { namespace BSResource @@ -8,9 +10,9 @@ namespace RE { public: // members - WinAPI::FILETIME modifyTime; // 00 - WinAPI::FILETIME createTime; // 08 - std::uint64_t fileSize; // 10 + REX::W32::FILETIME modifyTime; // 00 + REX::W32::FILETIME createTime; // 08 + std::uint64_t fileSize; // 10 }; static_assert(sizeof(Info) == 0x18); } diff --git a/include/RE/L/LooseFileLocation.h b/include/RE/L/LooseFileLocation.h index 794707e9b..5785f50f6 100644 --- a/include/RE/L/LooseFileLocation.h +++ b/include/RE/L/LooseFileLocation.h @@ -3,6 +3,8 @@ #include "RE/B/BSFixedString.h" #include "RE/L/Location.h" +#include "REX/W32/KERNEL32.h" + namespace RE { namespace BSResource @@ -11,11 +13,11 @@ namespace RE { public: // members - void* handle; // 000 - WinAPI::WIN32_FIND_DATAA findData; // 008 - char dirPath[WinAPI::MAX_PATH]; // 148 - ErrorCode lastError; // 24C - std::uint64_t entryPos; // 250 + void* handle; // 000 + REX::W32::WIN32_FIND_DATAA findData; // 008 + char dirPath[REX::W32::MAX_PATH]; // 148 + ErrorCode lastError; // 24C + std::uint64_t entryPos; // 250 }; static_assert(sizeof(BSSystemDir) == 0x258); diff --git a/include/RE/M/Main.h b/include/RE/M/Main.h index e5b6f5f54..872fc8218 100644 --- a/include/RE/M/Main.h +++ b/include/RE/M/Main.h @@ -4,6 +4,8 @@ #include "RE/B/BSTMessageQueue.h" #include "RE/S/ScrapHeap.h" +#include "REX/W32/BASE.h" + namespace RE { class NiNode; @@ -80,8 +82,8 @@ namespace RE bool reloadContent; // 015 bool freezeTime; // 016 bool freezeNextFrame; // 017 - WinAPI::HWND wnd; // 018 - WinAPI::HINSTANCE instance; // 020 + REX::W32::HWND wnd; // 018 + REX::W32::HINSTANCE instance; // 020 std::uint32_t threadID; // 028 std::uint32_t unk02C; // 02C std::uint64_t unk030; // 030 diff --git a/include/RE/M/MenuTopicManager.h b/include/RE/M/MenuTopicManager.h index 3365b7650..8ce2fd92e 100644 --- a/include/RE/M/MenuTopicManager.h +++ b/include/RE/M/MenuTopicManager.h @@ -7,6 +7,8 @@ #include "RE/B/BSTList.h" #include "RE/B/BSTSingleton.h" +#include "REX/W32/BASE.h" + namespace RE { class BGSDialogueBranch; @@ -68,7 +70,7 @@ namespace RE std::uint64_t unk28; // 28 TESTopicInfo* rootTopicInfo; // 30 Dialogue* lastSelectedDialogue; // 38 - WinAPI::CRITICAL_SECTION criticalSection; // 40 + REX::W32::CRITICAL_SECTION criticalSection; // 40 ObjectRefHandle speaker; // 68 ObjectRefHandle lastSpeaker; // 6C - used if the dialogue menu was closed but the NPC is still talking TESTopicInfo* currentTopicInfo; // 70 - only valid when the NPC is talking diff --git a/include/RE/N/NiSkinInstance.h b/include/RE/N/NiSkinInstance.h index ef70c76f0..70495ea15 100644 --- a/include/RE/N/NiSkinInstance.h +++ b/include/RE/N/NiSkinInstance.h @@ -3,6 +3,8 @@ #include "RE/N/NiObject.h" #include "RE/N/NiSmartPointer.h" +#include "REX/W32/BASE.h" + namespace RE { class NiAVObject; @@ -46,7 +48,7 @@ namespace RE void* boneMatrices; // 48 void* prevBoneMatrices; // 50 void* skinToWorldWorldToSkinMatrix; // 58 - WinAPI::CRITICAL_SECTION lock; // 60 + REX::W32::CRITICAL_SECTION lock; // 60 }; static_assert(sizeof(NiSkinInstance) == 0x88); } diff --git a/include/RE/N/NiStream.h b/include/RE/N/NiStream.h index 8e47fc7fb..d97e8e3f3 100644 --- a/include/RE/N/NiStream.h +++ b/include/RE/N/NiStream.h @@ -6,6 +6,8 @@ #include "RE/N/NiTArray.h" #include "RE/N/NiTPointerMap.h" +#include "REX/W32/BASE.h" + namespace RE { class NiBinaryStream; @@ -57,40 +59,40 @@ namespace RE virtual bool LoadObjectSizeTable(); // 17 // members - BSStreamHeader header; // 008 - BSTSmallArray groups; // 0D0 - std::uint32_t nifMaxVersion; // 100 - std::uint32_t nifMaxUserDefinedVersion; // 104 - char inputFilePath[WinAPI::MAX_PATH]; // 108 - std::uint16_t unk20C; // 20C - std::uint16_t unk20E; // 20E - std::uint64_t unk210; // 210 - NiTLargeObjectArray> objects; // 218 - NiTLargePrimitiveArray objectSizes; // 238 - NiTLargeObjectArray> topObjects; // 258 - NiTLargeObjectArray fixedStrings; // 278 - NiBinaryStream* iStr; // 298 - NiBinaryStream* oStr; // 2A0 - std::uint32_t linkIndex; // 2A8 - std::uint32_t linkBlockIndex; // 2AC - NiTPointerMap registerMap; // 2B0 - std::uint16_t niAVObjectFlags; // 2D0 - std::uint16_t niTimeControllerFlags; // 2D2 - std::uint16_t niPropertyFlags; // 2D4 - std::uint32_t unk2D8; // 2D8 - bool unk2DC; // 2DC - std::uint32_t load; // 2E0 - std::uint32_t link; // 2E4 - std::uint32_t postLink; // 2E8 - std::uint64_t unk2F0; // 2F0 - std::uint64_t unk2F8; // 2F8 - std::uint32_t unk300; // 300 - std::uint32_t unk304; // 304 - std::int32_t unk308; // 308 - char lastLoadedRTTI[WinAPI::MAX_PATH]; // 30C - std::uint32_t lastError; // 410 - char lastErrorMessage[WinAPI::MAX_PATH]; // 414 - char filePath[WinAPI::MAX_PATH]; // 518 + BSStreamHeader header; // 008 + BSTSmallArray groups; // 0D0 + std::uint32_t nifMaxVersion; // 100 + std::uint32_t nifMaxUserDefinedVersion; // 104 + char inputFilePath[REX::W32::MAX_PATH]; // 108 + std::uint16_t unk20C; // 20C + std::uint16_t unk20E; // 20E + std::uint64_t unk210; // 210 + NiTLargeObjectArray> objects; // 218 + NiTLargePrimitiveArray objectSizes; // 238 + NiTLargeObjectArray> topObjects; // 258 + NiTLargeObjectArray fixedStrings; // 278 + NiBinaryStream* iStr; // 298 + NiBinaryStream* oStr; // 2A0 + std::uint32_t linkIndex; // 2A8 + std::uint32_t linkBlockIndex; // 2AC + NiTPointerMap registerMap; // 2B0 + std::uint16_t niAVObjectFlags; // 2D0 + std::uint16_t niTimeControllerFlags; // 2D2 + std::uint16_t niPropertyFlags; // 2D4 + std::uint32_t unk2D8; // 2D8 + bool unk2DC; // 2DC + std::uint32_t load; // 2E0 + std::uint32_t link; // 2E4 + std::uint32_t postLink; // 2E8 + std::uint64_t unk2F0; // 2F0 + std::uint64_t unk2F8; // 2F8 + std::uint32_t unk300; // 300 + std::uint32_t unk304; // 304 + std::int32_t unk308; // 308 + char lastLoadedRTTI[REX::W32::MAX_PATH]; // 30C + std::uint32_t lastError; // 410 + char lastErrorMessage[REX::W32::MAX_PATH]; // 414 + char filePath[REX::W32::MAX_PATH]; // 518 }; static_assert(sizeof(NiStream) == 0x620); } diff --git a/include/RE/P/Precipitation.h b/include/RE/P/Precipitation.h index 99de06463..9b2555d7f 100644 --- a/include/RE/P/Precipitation.h +++ b/include/RE/P/Precipitation.h @@ -3,6 +3,8 @@ #include "RE/N/NiPoint3.h" #include "RE/N/NiSmartPointer.h" +#include "REX/W32/D3D.h" + namespace RE { class BSCullingProcess; @@ -19,11 +21,11 @@ namespace RE { public: // members - alignas(0x10) DirectX::XMFLOAT4X4 projection; // 00 - NiPointer camera; // 40 - NiPointer accumulator; // 48 - BSCullingProcess* cullingProcess; // 50 - std::uint64_t pad58; // 58 + alignas(0x10) REX::W32::XMFLOAT4X4 projection; // 00 + NiPointer camera; // 40 + NiPointer accumulator; // 48 + BSCullingProcess* cullingProcess; // 50 + std::uint64_t pad58; // 58 }; static_assert(sizeof(OcclusionMapData) == 0x60); diff --git a/include/RE/R/Renderer.h b/include/RE/R/Renderer.h index 0f4eec671..cdf42d58f 100644 --- a/include/RE/R/Renderer.h +++ b/include/RE/R/Renderer.h @@ -5,11 +5,8 @@ #include "RE/R/RenderTargetData.h" #include "RE/T/TextureFileFormat.h" -struct ID3D11Device; -struct ID3D11DeviceContext; -struct IDXGISwapChain; -struct ID3D11RenderTargetView1; -struct ID3D11ShaderResourceView1; +#include "REX/W32/D3D11_3.h" +#include "REX/W32/USER32.h" namespace RE { @@ -17,66 +14,62 @@ namespace RE { struct RendererWindow { - public: - // members - SKSE::WinAPI::HWND hWnd; // 00 - std::int32_t windowX; // 08 - std::int32_t windowY; // 0C - std::int32_t windowWidth; // 10 - std::int32_t windowHeight; // 14 - IDXGISwapChain* swapChain; // 18 - RENDER_TARGET swapChainRenderTarget; // 20 - std::uint32_t unk24; // 24 - std::uint64_t unk28; // 28 - ID3D11RenderTargetView1* renderView; // 30 - ID3D11ShaderResourceView1* resourceView; // 38 - std::uint64_t unk40; // 40 - std::uint64_t unk48; // 48 + REX::W32::HWND hWnd; // 00 + std::int32_t windowX; // 08 + std::int32_t windowY; // 0C + std::int32_t windowWidth; // 10 + std::int32_t windowHeight; // 14 + REX::W32::IDXGISwapChain* swapChain; // 18 + RENDER_TARGET swapChainRenderTarget; // 20 + std::uint32_t unk24; // 24 + std::uint64_t unk28; // 28 + REX::W32::ID3D11RenderTargetView1* renderView; // 30 + REX::W32::ID3D11ShaderResourceView1* resourceView; // 38 + std::uint64_t unk40; // 40 + std::uint64_t unk48; // 48 }; static_assert(sizeof(RendererWindow) == 0x50); struct RendererData { - public: - // members - std::uint32_t adapter; // 0000 - DirectX::DXGI_RATIONAL desiredRefreshRate; // 0004 - DirectX::DXGI_RATIONAL actualRefreshRate; // 000C - DirectX::DXGI_MODE_SCALING scaleMode; // 0014 - DirectX::DXGI_MODE_SCANLINE_ORDER scanlineOrdering; // 0018 - std::uint32_t isNotWindowed; // 001C - bool fullScreen; // 0020 - bool borderlessDisplay; // 0021 - bool readOnlyDepth; // 0022 - bool instantiated; // 0023 - bool requestedWindowSizeChange; // 0024 - std::uint32_t newWidth; // 0028 - std::uint32_t newHeight; // 002C - std::uint32_t presentInterval; // 0030 - ID3D11Device* forwarder; // 0038 - ID3D11DeviceContext* context; // 0040 - RendererWindow renderWindows[32]; // 0048 - RenderTargetData renderTargets[RENDER_TARGET::kTOTAL]; // 0A48 - DepthStencilData depthStencils[RENDER_TARGET_DEPTHSTENCIL::kTOTAL]; // 1FA8 - CubemapRenderTargetData cubemapRenderTargets[RENDER_TARGET_CUBEMAP::kTOTAL]; // 26C8 - Texture3DTargetData texture3DRenderTargets[RENDER_TARGET_3D::kTOTAL]; // 2708 - float clearColor[4]; // 2768 - std::uint8_t clearStencil; // 2778 - SKSE::WinAPI::CRITICAL_SECTION lock; // 2780 - const char* className; // 27A8 - SKSE::WinAPI::HINSTANCE hInstance; // 27B0 + std::uint32_t adapter; // 0000 + REX::W32::DXGI_RATIONAL desiredRefreshRate; // 0004 + REX::W32::DXGI_RATIONAL actualRefreshRate; // 000C + REX::W32::DXGI_MODE_SCALING scaleMode; // 0014 + REX::W32::DXGI_MODE_SCANLINE_ORDER scanlineOrdering; // 0018 + std::uint32_t isNotWindowed; // 001C + bool fullScreen; // 0020 + bool borderlessDisplay; // 0021 + bool readOnlyDepth; // 0022 + bool instantiated; // 0023 + bool requestedWindowSizeChange; // 0024 + std::uint32_t newWidth; // 0028 + std::uint32_t newHeight; // 002C + std::uint32_t presentInterval; // 0030 + REX::W32::ID3D11Device* forwarder; // 0038 + REX::W32::ID3D11DeviceContext* context; // 0040 + RendererWindow renderWindows[32]; // 0048 + RenderTargetData renderTargets[RENDER_TARGET::kTOTAL]; // 0A48 + DepthStencilData depthStencils[RENDER_TARGET_DEPTHSTENCIL::kTOTAL]; // 1FA8 + CubemapRenderTargetData cubemapRenderTargets[RENDER_TARGET_CUBEMAP::kTOTAL]; // 26C8 + Texture3DTargetData texture3DRenderTargets[RENDER_TARGET_3D::kTOTAL]; // 2708 + float clearColor[4]; // 2768 + std::uint8_t clearStencil; // 2778 + REX::W32::CRITICAL_SECTION lock; // 2780 + const char* className; // 27A8 + REX::W32::HINSTANCE hInstance; // 27B0 }; static_assert(offsetof(RendererData, lock) == 0x2780); struct RendererInitOSData { - WinAPI::HWND hwnd; // 00 - WinAPI::HINSTANCE instance; // 08 - WinAPI::WNDPROC windowProcFunction; // 10 - WinAPI::HICON icon; // 18 - const char* className; // 20 - uint32_t adapter; // 28 - uint32_t unk2C; // 2C + REX::W32::HWND hwnd; // 00 + REX::W32::HINSTANCE instance; // 08 + REX::W32::WNDPROC windowProcFunction; // 10 + REX::W32::HICON icon; // 18 + const char* className; // 20 + std::uint32_t adapter; // 28 + std::uint32_t unk2C; // 2C }; static_assert(sizeof(RendererInitOSData) == 0x30); @@ -105,29 +98,29 @@ namespace RE public: [[nodiscard]] static Renderer* GetSingleton() noexcept; - void CreateSwapChain(WinAPI::HWND* window, bool setCurrent); - void KillWindow(std::uint32_t windowID); + void CreateSwapChain(REX::W32::HWND* a_window, bool a_setCurrent); + void KillWindow(std::uint32_t a_windowID); void Lock(); void Unlock(); - void ResizeWindow(std::uint32_t windowID, std::uint32_t width, std::uint32_t height, bool fullscreen, bool borderless); - void RequestWindowResize(std::uint32_t width, std::uint32_t height); - void SetWindowPosition(std::uint32_t windowID, std::int32_t x, std::int32_t y); - void SetWindowActiveState(bool show); - void WindowSizeChanged(std::uint32_t windowID); - void ResetWindow(std::uint32_t windowID); - void UpdateViewPort(std::uint32_t a_unk, std::uint32_t b_unk, bool c_unk); + void ResizeWindow(std::uint32_t a_windowID, std::uint32_t a_width, std::uint32_t a_height, bool a_fullscreen, bool a_borderless); + void RequestWindowResize(std::uint32_t a_width, std::uint32_t a_height); + void SetWindowPosition(std::uint32_t a_windowID, std::int32_t a_x, std::int32_t a_y); + void SetWindowActiveState(bool a_show); + void WindowSizeChanged(std::uint32_t a_windowID); + void ResetWindow(std::uint32_t a_windowID); + void UpdateViewPort(std::uint32_t a_unk1, std::uint32_t a_unk2, bool a_unk3); [[nodiscard]] NiTexture::RendererData* CreateRenderTexture(std::uint32_t a_width, std::uint32_t a_height); void SaveRenderTargetToFile(RENDER_TARGET a_renderTarget, const char* a_filePath, TextureFileFormat a_textureFileFormat); - [[nodiscard]] static RendererData* GetRendererData(); - [[nodiscard]] static ScreenSize GetScreenSize(); - [[nodiscard]] static ID3D11Device* GetDevice(); - [[nodiscard]] static RendererWindow* GetCurrentRenderWindow(); + [[nodiscard]] static RendererData* GetRendererData(); + [[nodiscard]] static ScreenSize GetScreenSize(); + [[nodiscard]] static REX::W32::ID3D11Device* GetDevice(); + [[nodiscard]] static RendererWindow* GetCurrentRenderWindow(); private: void Begin(std::uint32_t windowID); - void Init(RendererInitOSData* a_data, ApplicationWindowProperties* windowProps, WinAPI::HWND window); + void Init(RendererInitOSData* a_data, ApplicationWindowProperties* a_windowProps, REX::W32::HWND a_window); void End(); void Shutdown(); diff --git a/include/RE/S/ScrapHeap.h b/include/RE/S/ScrapHeap.h index ad6b5be18..27fd6c7a7 100644 --- a/include/RE/S/ScrapHeap.h +++ b/include/RE/S/ScrapHeap.h @@ -2,6 +2,8 @@ #include "RE/I/IMemoryStore.h" +#include "REX/W32/KERNEL32.h" + namespace RE { class ScrapHeap : public IMemoryStore @@ -38,7 +40,7 @@ namespace RE }; static_assert(sizeof(FreeTreeNode) == 0x30); - ~ScrapHeap() override { WinAPI::VirtualFree(baseAddress, 0, WinAPI::MEM_RELEASE); } // 00 + ~ScrapHeap() override { REX::W32::VirtualFree(baseAddress, 0, REX::W32::MEM_RELEASE); } // 00 // override (IMemoryStore) std::size_t Size(void const* a_mem) const override { return *static_cast(a_mem) & ~(std::size_t{ 3 } << 62); } // 01 diff --git a/include/RE/T/TESFile.h b/include/RE/T/TESFile.h index 3548af341..353b80f55 100644 --- a/include/RE/T/TESFile.h +++ b/include/RE/T/TESFile.h @@ -6,6 +6,8 @@ #include "RE/F/FormTypes.h" #include "RE/N/NiFile.h" +#include "REX/W32/KERNEL32.h" + namespace RE { class BSFile; @@ -82,8 +84,8 @@ namespace RE TESBitArrayFile* formUserDataBitArray; // 040 TESBitArrayFile* formVersionBitArray; // 048 TESBitArrayFile* formIDBitArray; // 050 - char fileName[WinAPI::MAX_PATH]; // 058 - char path[WinAPI::MAX_PATH]; // 15C + char fileName[REX::W32::MAX_PATH]; // 058 + char path[REX::W32::MAX_PATH]; // 15C char* buffer; // 260 std::uint32_t bufferAllocSize; // 268 std::uint32_t firstCellOffset; // 26C @@ -107,7 +109,7 @@ namespace RE bool isBigEndian; // 2E9 std::uint8_t unk2EA; // 2EA std::uint8_t pad2EB; // 2EB - WinAPI::WIN32_FIND_DATAA fileData; // 2EC + REX::W32::WIN32_FIND_DATAA fileData; // 2EC float unk42C; // 42C std::uint32_t unk430; // 430 std::uint32_t flags; // 434 @@ -118,7 +120,7 @@ namespace RE std::uint32_t masterCount; // 460 std::uint32_t pad464; // 464 TESFile** masterPtrs; // 468 - WinAPI::FILETIME deletedFormTime; // 470 + REX::W32::FILETIME deletedFormTime; // 470 std::uint8_t compileIndex; // 478 std::uint8_t pad479; // 479 std::uint16_t smallFileCompileIndex; // 47A diff --git a/include/REL/Module.h b/include/REL/Module.h index 07f465e40..52b220b3a 100644 --- a/include/REL/Module.h +++ b/include/REL/Module.h @@ -2,6 +2,8 @@ #include "REL/Version.h" +#include "REX/W32/KERNEL32.h" + namespace REL { class Segment @@ -61,7 +63,7 @@ namespace REL [[nodiscard]] Segment segment(Segment::Name a_segment) const noexcept { return _segments[a_segment]; } - [[nodiscard]] void* pointer() const noexcept { return reinterpret_cast(base()); } + [[nodiscard]] REX::W32::HMODULE pointer() const noexcept { return reinterpret_cast(base()); } template [[nodiscard]] T* pointer() const noexcept @@ -73,7 +75,7 @@ namespace REL Module() { const auto getFilename = [&]() { - return WinAPI::GetEnvironmentVariable( + return REX::W32::GetEnvironmentVariableW( ENVIRONMENT.data(), _filename.data(), static_cast(_filename.size())); @@ -99,7 +101,7 @@ namespace REL void load() { - auto handle = WinAPI::GetModuleHandle(_filename.c_str()); + auto handle = REX::W32::GetModuleHandleW(_filename.c_str()); if (handle == nullptr) { stl::report_and_fail( std::format( @@ -131,13 +133,13 @@ namespace REL } static constexpr std::array SEGMENTS{ - std::make_pair(".text"sv, WinAPI::IMAGE_SCN_MEM_EXECUTE), + std::make_pair(".text"sv, REX::W32::IMAGE_SCN_MEM_EXECUTE), std::make_pair(".idata"sv, 0u), std::make_pair(".rdata"sv, 0u), std::make_pair(".data"sv, 0u), std::make_pair(".pdata"sv, 0u), std::make_pair(".tls"sv, 0u), - std::make_pair(".text"sv, WinAPI::IMAGE_SCN_MEM_WRITE), + std::make_pair(".text"sv, REX::W32::IMAGE_SCN_MEM_WRITE), std::make_pair(".gfids"sv, 0u) }; diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index b8edfe732..93e27e53d 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/KERNEL32.h" + #define REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_nopropQual, a_propQual, ...) \ template < \ class R, \ @@ -188,23 +190,15 @@ namespace REL inline void safe_write(std::uintptr_t a_dst, const void* a_src, std::size_t a_count) { std::uint32_t old{ 0 }; - auto success = - WinAPI::VirtualProtect( - reinterpret_cast(a_dst), - a_count, - (WinAPI::PAGE_EXECUTE_READWRITE), - std::addressof(old)); - if (success != 0) { + bool success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); + if (success) { std::memcpy(reinterpret_cast(a_dst), a_src, a_count); - success = - WinAPI::VirtualProtect( - reinterpret_cast(a_dst), - a_count, - old, - std::addressof(old)); + success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, old, std::addressof(old)); } - assert(success != 0); + assert(success); } template @@ -222,23 +216,15 @@ namespace REL inline void safe_fill(std::uintptr_t a_dst, std::uint8_t a_value, std::size_t a_count) { std::uint32_t old{ 0 }; - auto success = - WinAPI::VirtualProtect( - reinterpret_cast(a_dst), - a_count, - (WinAPI::PAGE_EXECUTE_READWRITE), - std::addressof(old)); - if (success != 0) { + bool success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); + if (success) { std::fill_n(reinterpret_cast(a_dst), a_count, a_value); - success = - WinAPI::VirtualProtect( - reinterpret_cast(a_dst), - a_count, - old, - std::addressof(old)); + success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, old, std::addressof(old)); } - assert(success != 0); + assert(success); } template diff --git a/include/REL/Version.h b/include/REL/Version.h index b6f4ddd91..f72ebeb62 100644 --- a/include/REL/Version.h +++ b/include/REL/Version.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/VERSION.h" + namespace REL { class Version @@ -78,18 +80,18 @@ namespace REL [[nodiscard]] inline std::optional get_file_version(stl::zwstring a_filename) { std::uint32_t dummy; - std::vector buf(WinAPI::GetFileVersionInfoSize(a_filename.data(), std::addressof(dummy))); + std::vector buf(REX::W32::GetFileVersionInfoSizeW(a_filename.data(), std::addressof(dummy))); if (buf.empty()) { return std::nullopt; } - if (!WinAPI::GetFileVersionInfo(a_filename.data(), 0, static_cast(buf.size()), buf.data())) { + 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 (!WinAPI::VerQueryValue(buf.data(), L"\\StringFileInfo\\040904B0\\ProductVersion", std::addressof(verBuf), std::addressof(verLen))) { + if (!REX::W32::VerQueryValueW(buf.data(), L"\\StringFileInfo\\040904B0\\ProductVersion", std::addressof(verBuf), std::addressof(verLen))) { return std::nullopt; } diff --git a/include/REX/PS4.h b/include/REX/PS4.h new file mode 100644 index 000000000..8d7b0f3f5 --- /dev/null +++ b/include/REX/PS4.h @@ -0,0 +1,3 @@ +#pragma once + +#include "REX/PS4/SCEPAD.h" diff --git a/include/REX/PS4/SCEPAD.h b/include/REX/PS4/SCEPAD.h new file mode 100644 index 000000000..dd8c8ea88 --- /dev/null +++ b/include/REX/PS4/SCEPAD.h @@ -0,0 +1,27 @@ +#pragma once + +namespace REX::PS4 +{ + enum SCE_PAD_BUTTON : std::uint32_t + { + SCE_PAD_BUTTON_SHARE = 0x00000001, + SCE_PAD_BUTTON_L3 = 0x00000002, + SCE_PAD_BUTTON_R3 = 0x00000004, + SCE_PAD_BUTTON_OPTIONS = 0x00000008, + SCE_PAD_BUTTON_UP = 0x00000010, + SCE_PAD_BUTTON_RIGHT = 0x00000020, + SCE_PAD_BUTTON_DOWN = 0x00000040, + SCE_PAD_BUTTON_LEFT = 0x00000080, + SCE_PAD_BUTTON_L2 = 0x00000100, + SCE_PAD_BUTTON_R2 = 0x00000200, + SCE_PAD_BUTTON_L1 = 0x00000400, + SCE_PAD_BUTTON_R1 = 0x00000800, + SCE_PAD_BUTTON_TRIANGLE = 0x00001000, + SCE_PAD_BUTTON_CIRCLE = 0x00002000, + SCE_PAD_BUTTON_CROSS = 0x00004000, + SCE_PAD_BUTTON_SQUARE = 0x00008000, + SCE_PAD_BUTTON_PLAYSTATION = 0x00010000, + SCE_PAD_BUTTON_TOUCH_PAD = 0x00100000, + SCE_PAD_BUTTON_INTERCEPTED = 0x80000000, + }; +} diff --git a/include/REX/W32.h b/include/REX/W32.h new file mode 100644 index 000000000..6deadaa11 --- /dev/null +++ b/include/REX/W32.h @@ -0,0 +1,27 @@ +#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/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 new file mode 100644 index 000000000..cde432247 --- /dev/null +++ b/include/REX/W32/ADVAPI32.h @@ -0,0 +1,16 @@ +#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 new file mode 100644 index 000000000..1da8accaf --- /dev/null +++ b/include/REX/W32/BASE.h @@ -0,0 +1,188 @@ +#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 HSTRING = struct HSTRING__*; + using HWND = struct HWND__*; + + // 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, std::uint16_t const 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 HRESULT + { + constexpr HRESULT() noexcept = default; + + constexpr HRESULT(const std::int32_t a_hr) noexcept : + value(a_hr) + {} + + constexpr operator bool() const noexcept + { + return value >= 0; + } + + constexpr operator std::int32_t() const noexcept + { + return value; + } + + std::int32_t value; + }; + static_assert(sizeof(HRESULT) == 0x4); +} + +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 ULARGE_INTEGER + { + struct + { + std::uint32_t lo; + std::uint32_t hi; + }; + std::uint64_t value; + }; +} diff --git a/include/REX/W32/COM.h b/include/REX/W32/COM.h new file mode 100644 index 000000000..414801252 --- /dev/null +++ b/include/REX/W32/COM.h @@ -0,0 +1,25 @@ +#pragma once + +#include "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(__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 new file mode 100644 index 000000000..b80769fa1 --- /dev/null +++ b/include/REX/W32/COMPTR.h @@ -0,0 +1,196 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..9c60bcad6 --- /dev/null +++ b/include/REX/W32/D3D.h @@ -0,0 +1,736 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..2a5aaab56 --- /dev/null +++ b/include/REX/W32/D3D11.h @@ -0,0 +1,2043 @@ +#pragma once + +#include "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 +{ + 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 new file mode 100644 index 000000000..b8b1de79e --- /dev/null +++ b/include/REX/W32/D3D11_1.h @@ -0,0 +1,296 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..b8809920c --- /dev/null +++ b/include/REX/W32/D3D11_2.h @@ -0,0 +1,112 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..1c6222873 --- /dev/null +++ b/include/REX/W32/D3D11_3.h @@ -0,0 +1,301 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..8b0b5b8af --- /dev/null +++ b/include/REX/W32/D3D11_4.h @@ -0,0 +1,138 @@ +#pragma once + +#include "D3D11_3.h" +#include "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 new file mode 100644 index 000000000..edef47126 --- /dev/null +++ b/include/REX/W32/D3DCOMPILER.h @@ -0,0 +1,154 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..350b3ebb6 --- /dev/null +++ b/include/REX/W32/DBGHELP.h @@ -0,0 +1,22 @@ +#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 new file mode 100644 index 000000000..b56b923c1 --- /dev/null +++ b/include/REX/W32/DINPUT.h @@ -0,0 +1,499 @@ +#pragma once + +#include "COM.h" +#include "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 new file mode 100644 index 000000000..9c3325cc8 --- /dev/null +++ b/include/REX/W32/DXGI.h @@ -0,0 +1,549 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..a1b98cbe6 --- /dev/null +++ b/include/REX/W32/DXGI_2.h @@ -0,0 +1,272 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..3dc7040cd --- /dev/null +++ b/include/REX/W32/DXGI_3.h @@ -0,0 +1,148 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..82522a1f9 --- /dev/null +++ b/include/REX/W32/DXGI_4.h @@ -0,0 +1,86 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..80ead088c --- /dev/null +++ b/include/REX/W32/DXGI_5.h @@ -0,0 +1,94 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..59ae84df9 --- /dev/null +++ b/include/REX/W32/DXGI_6.h @@ -0,0 +1,114 @@ +#pragma once + +#include "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 new file mode 100644 index 000000000..38a3d3938 --- /dev/null +++ b/include/REX/W32/KERNEL32.h @@ -0,0 +1,506 @@ +#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 }; + + // 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 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 ExpandEnvironmentStrings(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; + std::uint32_t ExpandEnvironmentStrings(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; + 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; + 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 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/OLE32.h b/include/REX/W32/OLE32.h new file mode 100644 index 000000000..517861ec4 --- /dev/null +++ b/include/REX/W32/OLE32.h @@ -0,0 +1,8 @@ +#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 new file mode 100644 index 000000000..85b3d95c0 --- /dev/null +++ b/include/REX/W32/SHELL32.h @@ -0,0 +1,34 @@ +#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 new file mode 100644 index 000000000..eab565dc5 --- /dev/null +++ b/include/REX/W32/USER32.h @@ -0,0 +1,293 @@ +#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 new file mode 100644 index 000000000..ae626a6e7 --- /dev/null +++ b/include/REX/W32/VERSION.h @@ -0,0 +1,13 @@ +#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 new file mode 100644 index 000000000..a55060baa --- /dev/null +++ b/include/REX/W32/XINPUT.h @@ -0,0 +1,80 @@ +#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/include/SKSE/IAT.h b/include/SKSE/IAT.h index 27a89e8a1..57fa55a2d 100644 --- a/include/SKSE/IAT.h +++ b/include/SKSE/IAT.h @@ -3,7 +3,7 @@ namespace SKSE { [[nodiscard]] std::uintptr_t GetIATAddr(std::string_view a_dll, std::string_view a_function); - [[nodiscard]] std::uintptr_t GetIATAddr(void* a_module, 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); @@ -13,10 +13,10 @@ namespace SKSE return static_cast(GetIATPtr(std::move(a_dll), std::move(a_function))); } - [[nodiscard]] void* GetIATPtr(void* a_module, std::string_view a_dll, std::string_view a_function); + [[nodiscard]] void* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function); template - [[nodiscard]] inline T* GetIATPtr(void* a_module, std::string_view a_dll, std::string_view a_function) + [[nodiscard]] inline 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))); } diff --git a/include/SKSE/Impl/DInputAPI.h b/include/SKSE/Impl/DInputAPI.h deleted file mode 100644 index 6e818957e..000000000 --- a/include/SKSE/Impl/DInputAPI.h +++ /dev/null @@ -1,572 +0,0 @@ -#pragma once - -#include "WinAPI.h" - -// TODO: This should probably be behind some sort of pragma that allows linking with dinput and dinput8 -namespace RE::DirectInput8 -{ - using DWORD = std::uint32_t; - using LONG = std::int32_t; - using WORD = std::uint16_t; - using BYTE = std::uint8_t; - using UINT = std::uint32_t; - using CHAR = char; - - using LPSTR = char*; - using LPCSTR = const char*; - - using UINT_PTR = std::uintptr_t; - using HANDLE = void*; - using LPDWORD = DWORD*; - using LPVOID = void*; - using LPLONG = LONG*; - using LPWORD = WORD*; - - using GUID = SKSE::WinAPI::GUID; - using LPGUID = GUID*; - using REFGUID = const GUID&; - using FILETIME = SKSE::WinAPI::FILETIME; - using RECT = SKSE::WinAPI::RECT; - using POINT = SKSE::WinAPI::POINT; - - using IID = GUID; - using REFIID = const IID&; - using LPIID = IID*; - using D3DCOLOR = std::uint32_t; - - using HRESULT = SKSE::WinAPI::HRESULT; - using HWND = SKSE::WinAPI::HWND; - using HINSTANCE = SKSE::WinAPI::HINSTANCE; - - inline static constexpr std::uint32_t MAX_PATH = 260; - - enum DIKey : 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 - }; - - struct DIMOUSESTATE2__ - { - LONG lX; - LONG lY; - LONG lZ; - BYTE rgbButtons[8]; - }; - static_assert(sizeof(DIMOUSESTATE2__) == 0x14); - using DIMOUSESTATE2 = DIMOUSESTATE2__; - using LPDIMOUSESTATE2 = DIMOUSESTATE2*; - - struct DIDEVICEOBJECTDATA__ - { - DWORD dwOfs; // 00 - DWORD dwData; // 04 - DWORD dwTimeStamp; // 08 - DWORD dwSequence; // 0C - UINT_PTR uAppData; // 10 - }; - static_assert(sizeof(DIDEVICEOBJECTDATA__) == 0x18); - using DIDEVICEOBJECTDATA = DIDEVICEOBJECTDATA__; - using LPDIDEVICEOBJECTDATA = DIDEVICEOBJECTDATA*; - using LPCDIDEVICEOBJECTDATA = const DIDEVICEOBJECTDATA*; - - struct DIDEVICEINSTANCEA__ - { - DWORD dwSize; - GUID guidInstance; - GUID guidProduct; - DWORD dwDevType; - CHAR tszInstanceName[MAX_PATH]; - CHAR tszProductName[MAX_PATH]; - GUID guidFFDriver; // DIRECTINPUT_VERSION >= 0x0500 - WORD wUsagePage; - WORD wUsage; - }; - using DIDEVICEINSTANCEA = DIDEVICEINSTANCEA__; - using LPDIDEVICEINSTANCEA = DIDEVICEINSTANCEA*; - using LPCDIDEVICEINSTANCEA = const DIDEVICEINSTANCEA*; - - struct DIDEVICEOBJECTINSTANCEA__ - { - DWORD dwSize; - GUID guidType; - DWORD dwOfs; - DWORD dwType; - DWORD dwFlags; - CHAR tszName[MAX_PATH]; - //#if(DIRECTINPUT_VERSION >= 0x0500) - DWORD dwFFMaxForce; - DWORD dwFFForceResolution; - WORD wCollectionNumber; - WORD wDesignatorIndex; - WORD wUsagePage; - WORD wUsage; - DWORD dwDimension; - WORD wExponent; - WORD wReportId; - //#endif /* DIRECTINPUT_VERSION >= 0x0500 */ - }; - using DIDEVICEOBJECTINSTANCEA = DIDEVICEOBJECTINSTANCEA__; - using LPDIDEVICEOBJECTINSTANCEA = DIDEVICEOBJECTINSTANCEA*; - using LPCDIDEVICEOBJECTINSTANCEA = const DIDEVICEOBJECTINSTANCEA*; - - using LPDIENUMDEVICEOBJECTSCALLBACKA = bool(__stdcall*)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); - - struct DIPROPHEADER__ - { - DWORD dwSize; - DWORD dwHeaderSize; - DWORD dwObj; - DWORD dwHow; - }; - - using DIPROPHEADER = DIPROPHEADER__; - using LPDIPROPHEADER = DIPROPHEADER*; - using LPCDIPROPHEADER = const DIPROPHEADER*; - - struct DIDEVCAPS__ - { - DWORD dwSize; - DWORD dwFlags; - DWORD dwDevType; - DWORD dwAxes; - DWORD dwButtons; - DWORD dwPOVs; - DWORD dwFFSamplePeriod; // -- fields here are Dinput >= 0x0500 - DWORD dwFFMinTimeResolution; - DWORD dwFirmwareRevision; - DWORD dwHardwareRevision; - DWORD dwFFDriverVersion; - }; - static_assert(sizeof(DIDEVCAPS__) == 0x2C); - using DIDEVCAPS = DIDEVCAPS__; - using LPDIDEVCAPS = DIDEVCAPS*; - using LPCDIDEVCAPS = const DIDEVCAPS*; - struct _DIDEVICEIMAGEINFOA - { - CHAR tszImagePath[MAX_PATH]; - DWORD dwFlags; - DWORD dwViewID; - RECT rcOverlay; - DWORD dwObjID; - DWORD dwcValidPts; - POINT rgptCalloutLine[5]; - RECT rcCalloutRect; - DWORD dwTextAlign; - }; - using DIDEVICEIMAGEINFOA = _DIDEVICEIMAGEINFOA; - using LPDIDEVICEIMAGEINFOA = DIDEVICEIMAGEINFOA*; - using LPCDIDEVICEIMAGEINFOA = const DIDEVICEIMAGEINFOA*; - - struct _DIOBJECTDATAFORMAT - { - const GUID* pguid; - DWORD dwOfs; - DWORD dwType; - DWORD dwFlags; - }; - using DIOBJECTDATAFORMAT = _DIOBJECTDATAFORMAT; - using LPDIOBJECTDATAFORMAT = DIOBJECTDATAFORMAT*; - using LPCDIOBJECTDATAFORMAT = const DIOBJECTDATAFORMAT*; - - struct _DIDATAFORMAT - { - DWORD dwSize; - DWORD dwObjSize; - DWORD dwFlags; - DWORD dwDataSize; - DWORD dwNumObjs; - LPDIOBJECTDATAFORMAT rgodf; - }; - using DIDATAFORMAT = _DIDATAFORMAT; - using LPDIDATAFORMAT = DIDATAFORMAT*; - using LPCDIDATAFORMAT = const DIDATAFORMAT*; - - struct DIENVELOPE__ - { - DWORD dwSize; /* sizeof(DIENVELOPE) */ - DWORD dwAttackLevel; - DWORD dwAttackTime; /* Microseconds */ - DWORD dwFadeLevel; - DWORD dwFadeTime; /* Microseconds */ - }; - using DIENVELOPE = DIENVELOPE__; - using LPDIENVELOPE = DIENVELOPE*; - using LPCDIENVELOPE = const DIENVELOPE*; - - struct DIEFFECTINFOA__ - { - DWORD dwSize; - GUID guid; - DWORD dwEffType; - DWORD dwStaticParams; - DWORD dwDynamicParams; - CHAR tszName[MAX_PATH]; - }; - using DIEFFECTINFOA = DIEFFECTINFOA__; - using LPDIEFFECTINFOA = DIEFFECTINFOA*; - using LPCDIEFFECTINFOA = const DIEFFECTINFOA*; - - using LPDIENUMEFFECTSCALLBACKA = bool(__stdcall*)(LPCDIEFFECTINFOA, LPVOID); - - struct DIEFFECT__ - { - DWORD dwSize; /* sizeof(DIEFFECT) */ - DWORD dwFlags; /* DIEFF_* */ - DWORD dwDuration; /* Microseconds */ - DWORD dwSamplePeriod; /* Microseconds */ - DWORD dwGain; - DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ - DWORD dwTriggerRepeatInterval; /* Microseconds */ - DWORD cAxes; /* Number of axes */ - LPDWORD rgdwAxes; /* Array of axes */ - LPLONG rglDirection; /* Array of directions */ - LPDIENVELOPE lpEnvelope; /* Optional */ - DWORD cbTypeSpecificParams; /* Size of params */ - LPVOID lpvTypeSpecificParams; /* Pointer to params */ - DWORD dwStartDelay; /* Microseconds */ // -- fields here are Dinput >= 0x0600 - }; - using DIEFFECT = DIEFFECT__; - using LPDIEFFECT = DIEFFECT*; - using LPCDIEFFECT = const DIEFFECT*; - - struct DIEFFESCAPE__ - { - DWORD dwSize; - DWORD dwCommand; - LPVOID lpvInBuffer; - DWORD cbInBuffer; - LPVOID lpvOutBuffer; - DWORD cbOutBuffer; - }; - using DIEFFESCAPE = DIEFFESCAPE__; - using LPDIEFFESCAPE = DIEFFESCAPE*; - using LPCDIEFFESCAPE = const DIEFFESCAPE*; - struct DIFILEEFFECT__ - { - DWORD dwSize; - GUID GuidEffect; - LPCDIEFFECT lpDiEffect; - CHAR szFriendlyName[MAX_PATH]; - }; - using DIFILEEFFECT = DIFILEEFFECT__; - using LPDIFILEEFFECT = DIFILEEFFECT*; - using LPCDIFILEEFFECT = const DIFILEEFFECT*; - struct _DIACTIONA - { - UINT_PTR uAppData; - DWORD dwSemantic; - DWORD dwFlags; - union - { - LPCSTR lptszActionName; - UINT uResIdString; - }; - GUID guidInstance; - DWORD dwObjID; - DWORD dwHow; - }; - using DIACTIONA = _DIACTIONA; - using LPDIACTIONA = DIACTIONA*; - - struct _DIACTIONFORMATA - { - DWORD dwSize; - DWORD dwActionSize; - DWORD dwDataSize; - DWORD dwNumActions; - LPDIACTIONA rgoAction; - GUID guidActionMap; - DWORD dwGenre; - DWORD dwBufferSize; - LONG lAxisMin; - LONG lAxisMax; - HINSTANCE hInstString; - FILETIME ftTimeStamp; - DWORD dwCRC; - CHAR tszActionMap[MAX_PATH]; - }; - using DIACTIONFORMATA = _DIACTIONFORMATA; - using LPDIACTIONFORMATA = DIACTIONFORMATA*; - using LPCDIACTIONFORMATA = const DIACTIONFORMATA*; - struct _DIDEVICEIMAGEINFOHEADERA - { - DWORD dwSize; - DWORD dwSizeImageInfo; - DWORD dwcViews; - DWORD dwcButtons; - DWORD dwcAxes; - DWORD dwcPOVs; - DWORD dwBufferSize; - DWORD dwBufferUsed; - LPDIDEVICEIMAGEINFOA lprgImageInfoArray; - }; - using DIDEVICEIMAGEINFOHEADERA = _DIDEVICEIMAGEINFOHEADERA; - using LPDIDEVICEIMAGEINFOHEADERA = DIDEVICEIMAGEINFOHEADERA*; - using LPCDIDEVICEIMAGEINFOHEADERA = const DIDEVICEIMAGEINFOHEADERA*; - - struct _DICOLORSET - { - DWORD dwSize; - D3DCOLOR cTextFore; - D3DCOLOR cTextHighlight; - D3DCOLOR cCalloutLine; - D3DCOLOR cCalloutHighlight; - D3DCOLOR cBorder; - D3DCOLOR cControlFill; - D3DCOLOR cHighlightFill; - D3DCOLOR cAreaFill; - }; - using DICOLORSET = _DICOLORSET; - - struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) - IUnknown - { - virtual HRESULT QueryInterface(const GUID&, void**) noexcept = 0; - virtual std::uint32_t AddRef() noexcept = 0; - virtual std::uint32_t Release() noexcept = 0; - }; - using LPUNKNOWN = IUnknown*; - - struct _DICONFIGUREDEVICESPARAMSA - { - DWORD dwSize; - DWORD dwcUsers; - LPSTR lptszUserNames; - DWORD dwcFormats; - LPDIACTIONFORMATA lprgFormats; - HWND hwnd; - DICOLORSET dics; - IUnknown* lpUnkDDSTarget; - }; - using DICONFIGUREDEVICESPARAMSA = _DICONFIGUREDEVICESPARAMSA; - - struct __declspec(novtable) IDirectInputEffect : public IUnknown - { - virtual HRESULT Initialize(HINSTANCE, DWORD, REFGUID) noexcept = 0; - virtual HRESULT GetEffectGuid(LPGUID) noexcept = 0; - virtual HRESULT GetParameters(LPDIEFFECT, DWORD) noexcept = 0; - virtual HRESULT SetParameters(LPCDIEFFECT, DWORD) 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(LPDIEFFESCAPE) noexcept = 0; - }; - using LPDIRECTINPUTEFFECT = IDirectInputEffect*; - using LPCDIRECTINPUTEFFECT = const IDirectInputEffect*; - - using LPDIENUMCREATEDEFFECTOBJECTSCALLBACK = bool(__stdcall*)(LPDIRECTINPUTEFFECT, void*); - using LPDICONFIGUREDEVICESCALLBACK = bool(__stdcall*)(IUnknown*, void*); - using LPDIENUMDEVICESCALLBACKA = bool(__stdcall*)(const DIDEVICEINSTANCEA*, void*); - - using LPDIENUMEFFECTSCALLBACKA = bool(__stdcall*)(const DIEFFECTINFOA*, void*); - - using LPDIENUMEFFECTSINFILECALLBACK = bool(__stdcall*)(const DIFILEEFFECT*, void*); - - struct __declspec(novtable) IDirectInputDevice8A : public IUnknown - { - virtual HRESULT GetCapabilities(DIDEVCAPS*) noexcept = 0; - virtual HRESULT EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetProperty(std::uint32_t, DIPROPHEADER*) noexcept = 0; - virtual HRESULT SetProperty(std::uint32_t, 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; - }; - - using LPDIENUMDEVICESBYSEMANTICSCBA = bool(__stdcall*)(const DIDEVICEINSTANCEA*, IDirectInputDevice8A*, DWORD, DWORD, LPVOID); - - struct __declspec(novtable) 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*, LPDIACTIONFORMATA, LPDIENUMDEVICESBYSEMANTICSCBA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK, DICONFIGUREDEVICESPARAMSA*, std::uint32_t, void*) noexcept = 0; - }; - -} diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index e76a73124..e82ba3469 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -63,10 +63,8 @@ static_assert( #include #pragma warning(pop) -#include "SKSE/Impl/DInputAPI.h" -#include "SKSE/Impl/ScePadAPI.h" -#include "SKSE/Impl/WinAPI.h" -#include "SKSE/Impl/XInputAPI.h" +#include "REX/W32/KERNEL32.h" +#include "REX/W32/USER32.h" namespace SKSE { @@ -536,8 +534,8 @@ namespace SKSE -> std::optional { const auto cvt = [&](wchar_t* a_dst, std::size_t a_length) { - return WinAPI::MultiByteToWideChar( - WinAPI::CP_UTF8, + return REX::W32::MultiByteToWideChar( + REX::W32::CP_UTF8, 0, a_in.data(), static_cast(a_in.length()), @@ -562,8 +560,8 @@ namespace SKSE -> std::optional { const auto cvt = [&](char* a_dst, std::size_t a_length) { - return WinAPI::WideCharToMultiByte( - WinAPI::CP_UTF8, + return REX::W32::WideCharToMultiByte( + REX::W32::CP_UTF8, 0, a_in.data(), static_cast(a_in.length()), @@ -608,15 +606,14 @@ namespace SKSE }(); const auto caption = []() { - const auto maxPath = WinAPI::GetMaxPath(); std::vector buf; - buf.reserve(maxPath); - buf.resize(maxPath / 2); + 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 = WinAPI::GetModuleFileName( - WinAPI::GetCurrentModule(), + result = REX::W32::GetModuleFileNameW( + REX::W32::GetCurrentModule(), buf.data(), static_cast(buf.size())); } while (result && result == buf.size() && buf.size() <= std::numeric_limits::max()); @@ -636,8 +633,8 @@ namespace SKSE a_loc.function_name() }, spdlog::level::critical, a_msg); - WinAPI::MessageBox(nullptr, body.c_str(), (caption.empty() ? nullptr : caption.c_str()), 0); - WinAPI::TerminateProcess(WinAPI::GetCurrentProcess(), EXIT_FAILURE); + REX::W32::MessageBoxW(nullptr, body.c_str(), (caption.empty() ? nullptr : caption.c_str()), 0); + REX::W32::TerminateProcess(REX::W32::GetCurrentProcess(), EXIT_FAILURE); } template @@ -697,14 +694,12 @@ namespace RE { using namespace std::literals; namespace stl = SKSE::stl; - namespace WinAPI = SKSE::WinAPI; } namespace REL { using namespace std::literals; namespace stl = SKSE::stl; - namespace WinAPI = SKSE::WinAPI; } #ifdef SKYRIM_SUPPORT_AE diff --git a/include/SKSE/Impl/ScePadAPI.h b/include/SKSE/Impl/ScePadAPI.h deleted file mode 100644 index a1d8df583..000000000 --- a/include/SKSE/Impl/ScePadAPI.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -namespace RE::ScePad -{ - enum ScePadButton : std::uint32_t - { - SCE_PAD_BUTTON_SHARE = 0x00000001, - SCE_PAD_BUTTON_L3 = 0x00000002, - SCE_PAD_BUTTON_R3 = 0x00000004, - SCE_PAD_BUTTON_OPTIONS = 0x00000008, - SCE_PAD_BUTTON_UP = 0x00000010, - SCE_PAD_BUTTON_RIGHT = 0x00000020, - SCE_PAD_BUTTON_DOWN = 0x00000040, - SCE_PAD_BUTTON_LEFT = 0x00000080, - SCE_PAD_BUTTON_L2 = 0x00000100, - SCE_PAD_BUTTON_R2 = 0x00000200, - SCE_PAD_BUTTON_L1 = 0x00000400, - SCE_PAD_BUTTON_R1 = 0x00000800, - SCE_PAD_BUTTON_TRIANGLE = 0x00001000, - SCE_PAD_BUTTON_CIRCLE = 0x00002000, - SCE_PAD_BUTTON_CROSS = 0x00004000, - SCE_PAD_BUTTON_SQUARE = 0x00008000, - SCE_PAD_BUTTON_PLAYSTATION = 0x0010000, - SCE_PAD_BUTTON_TOUCH_PAD = 0x00100000, - SCE_PAD_BUTTON_INTERCEPTED = 0x80000000, - }; -} diff --git a/include/SKSE/Impl/WinAPI.h b/include/SKSE/Impl/WinAPI.h deleted file mode 100644 index 3b65100aa..000000000 --- a/include/SKSE/Impl/WinAPI.h +++ /dev/null @@ -1,1238 +0,0 @@ -#pragma once - -#ifdef _INC_WINAPIFAMILY -# error Windows API detected. Please move any Windows API includes after CommonLibSSE, or remove them. -#else - -namespace SKSE::WinAPI -{ - // general constants - inline const auto INVALID_HANDLE_VALUE{ reinterpret_cast(static_cast(-1)) }; - inline constexpr auto MAX_PATH{ 260u }; - - // 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 }; - - // 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 }; - - // 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 }; - - // 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 }; - - // 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 }; - - // string normalization forms - inline constexpr auto NORM_FORM_OTHER{ 0x0 }; - inline constexpr auto NORM_FORM_C{ 0x1 }; - inline constexpr auto NORM_FORM_D{ 0x2 }; - inline constexpr auto NORM_FORM_KC{ 0x5 }; - inline constexpr auto NORM_FORM_KD{ 0x6 }; - - // 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" }; - - // 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 }; - - // 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 }; - - using THREAD_START_ROUTINE = std::uint32_t(void* a_param); - - struct CRITICAL_SECTION - { - public: - void* debugInfo; // 00 - std::int32_t lockCount; // 08 - std::int32_t recursionCount; // 0C - void* owningThread; // 10 - void* lockSemaphore; // 18 - std::uint64_t* spinCount; // 20 - }; - static_assert(sizeof(CRITICAL_SECTION) == 0x28); - - struct FILETIME - { - std::uint32_t lo; // 00 - std::uint32_t hi; // 04 - }; - static_assert(sizeof(FILETIME) == 0x8); - - struct GUID - { - std::uint32_t data1; - std::uint16_t data2; - std::uint16_t data3; - std::uint8_t data4[8]; - }; - static_assert(sizeof(GUID) == 0x10); - - // 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 }; - - using HRESULT = std::uint32_t; - - struct HWND__; - using HWND = HWND__*; - - using WNDPROC = std::int32_t(__stdcall*)(HWND, std::uint32_t, std::uint64_t, std::int64_t); - - struct HICON__; - using HICON = HICON__*; - - struct HINSTANCE__; - using HINSTANCE = HINSTANCE__*; - using HMODULE = HINSTANCE; - - struct HKEY__; - using HKEY = HKEY__*; - - inline auto HKEY_CLASSES_ROOT{ reinterpret_cast(0x80000000ull) }; - inline auto HKEY_CURRENT_USER{ reinterpret_cast(0x80000001ull) }; - inline auto HKEY_LOCAL_MACHINE{ reinterpret_cast(0x80000002ull) }; - - 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; // PBYTE - std::uint64_t function; // PDWORD - std::uint64_t ordinal; - std::uint64_t address; // PIMAGE_IMPORT_BY_NAME - }; - }; - 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; - - struct POINT - { - std::int32_t x; - std::int32_t y; - }; - - struct PROCESS_INFORMATION - { - void* process; - void* thread; - std::uint32_t processID; - std::uint32_t threadID; - }; - static_assert(sizeof(PROCESS_INFORMATION) == 0x18); - - struct RECT - { - std::int32_t left; - std::int32_t top; - std::int32_t right; - std::int32_t bottom; - }; - - struct SECURITY_ATTRIBUTES - { - std::uint32_t length; - void* securityDescriptor; - bool inheritHandle; - }; - static_assert(sizeof(SECURITY_ATTRIBUTES) == 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); - - union ULARGE_INTEGER - { - struct - { - std::uint32_t lo; - std::uint32_t hi; - }; - std::uint64_t value; - }; - - struct WIN32_FIND_DATAA - { - // members - 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 - { - // members - 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); - - enum VKEnum : 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 - }; - - bool CloseHandle( - void* a_handle) noexcept; - - void CoTaskMemFree( - void* a_block) noexcept; - - void* CreateFileMapping( - void* 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; - - void* CreateFileMapping( - void* 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 CreateProcess( - const char* a_name, - char* a_cmd, - SECURITY_ATTRIBUTES* a_procAttr, - SECURITY_ATTRIBUTES* a_threadAttr, - bool a_inherit, - std::uint32_t a_flags, - void* a_env, - const char* a_curDir, - STARTUPINFOA* a_startInfo, - PROCESS_INFORMATION* a_procInfo) noexcept; - - bool CreateProcess( - const wchar_t* a_name, - wchar_t* a_cmd, - SECURITY_ATTRIBUTES* a_procAttr, - SECURITY_ATTRIBUTES* a_threadAttr, - bool a_inherit, - std::uint32_t a_flags, - void* a_env, - const wchar_t* a_curDir, - STARTUPINFOW* a_startInfo, - PROCESS_INFORMATION* a_procInfo) noexcept; - - void* CreateRemoteThread( - void* 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; - - void* 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; - - std::uint32_t ExpandEnvironmentStrings( - const char* a_src, - char* a_dst, - std::uint32_t a_dstLen) noexcept; - - std::uint32_t ExpandEnvironmentStrings( - const wchar_t* a_src, - wchar_t* a_dst, - std::uint32_t a_dstLen) noexcept; - - [[nodiscard]] bool FindClose( - void* a_file) noexcept; - - [[nodiscard]] void* FindFirstFile( - const char* a_name, - WIN32_FIND_DATAA* a_data) noexcept; - - [[nodiscard]] void* FindFirstFile( - const wchar_t* a_name, - WIN32_FIND_DATAW* a_data) noexcept; - - [[nodiscard]] bool FindNextFile( - void* a_file, - WIN32_FIND_DATAA* a_data) noexcept; - - [[nodiscard]] bool FindNextFile( - void* a_file, - WIN32_FIND_DATAW* a_data) noexcept; - - bool FlushInstructionCache( - void* a_process, - const void* a_baseAddr, - std::size_t a_size) noexcept; - - bool FreeLibrary( - HMODULE a_module) noexcept; - - [[nodiscard]] void* GetCurrentModule() noexcept; - - [[nodiscard]] void* GetCurrentProcess() noexcept; - - [[nodiscard]] std::uint32_t GetCurrentThreadID() noexcept; - - [[nodiscard]] std::uint32_t GetEnvironmentVariable( - const char* a_name, - char* a_buffer, - std::uint32_t a_size) noexcept; - - [[nodiscard]] std::uint32_t GetEnvironmentVariable( - const wchar_t* a_name, - wchar_t* a_buffer, - std::uint32_t a_size) noexcept; - - [[nodiscard]] bool GetFileVersionInfo( - const char* a_name, - std::uint32_t a_handle, - std::uint32_t a_dataLen, - void* a_data) noexcept; - - [[nodiscard]] bool GetFileVersionInfo( - const wchar_t* a_name, - std::uint32_t a_handle, - std::uint32_t a_dataLen, - void* a_data) noexcept; - - [[nodiscard]] std::uint32_t GetFileVersionInfoSize( - const char* a_name, - std::uint32_t* a_handle) noexcept; - - [[nodiscard]] std::uint32_t GetFileVersionInfoSize( - const wchar_t* a_name, - std::uint32_t* a_handle) noexcept; - - [[nodiscard]] std::int32_t GetKeyNameText( - std::int32_t a_param, - char* a_buffer, - std::int32_t a_bufferLen) noexcept; - - [[nodiscard]] std::int32_t GetKeyNameText( - std::int32_t a_param, - wchar_t* a_buffer, - std::int32_t a_bufferLen) noexcept; - - [[nodiscard]] std::int16_t GetKeyState( - std::int32_t a_key) noexcept; - - [[nodiscard]] std::uint32_t GetLastError() noexcept; - - [[nodiscard]] std::size_t GetMaxPath() noexcept; - - [[nodiscard]] std::uint32_t GetModuleFileName( - void* a_module, - char* a_name, - std::uint32_t a_nameLen) noexcept; - - [[nodiscard]] std::uint32_t GetModuleFileName( - void* a_module, - wchar_t* a_name, - std::uint32_t a_nameLen) noexcept; - - [[nodiscard]] HMODULE GetModuleHandle( - const char* a_name) noexcept; - - [[nodiscard]] HMODULE GetModuleHandle( - const wchar_t* a_name) noexcept; - - [[nodiscard]] std::uint32_t GetPrivateProfileString( - const char* a_app, - const char* a_key, - const char* a_default, - char* a_out, - std::uint32_t a_outLen, - const char* a_name) noexcept; - - [[nodiscard]] std::uint32_t GetPrivateProfileString( - const wchar_t* a_app, - const wchar_t* a_key, - const wchar_t* a_default, - wchar_t* a_out, - std::uint32_t a_outLen, - const wchar_t* a_name) noexcept; - - [[nodiscard]] void* GetProcAddress( - void* a_module, - const char* a_name) noexcept; - - [[nodiscard]] std::string_view GetProcPath( - HMODULE a_handle) noexcept; - - void GetSystemInfo( - SYSTEM_INFO* a_info) noexcept; - - [[nodiscard]] bool IMAGE_SNAP_BY_ORDINAL64( - std::uint64_t a_ordinal) noexcept; - - [[nodiscard]] IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION( - const IMAGE_NT_HEADERS64* a_header) noexcept; - - [[nodiscard]] 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_dest, - std::int32_t a_destLen, - NLSVERSIONINFO* a_info, - void* a_reserved, - std::intptr_t a_sortHandle) noexcept; - - [[nodiscard]] HMODULE LoadLibrary( - const char* a_name) noexcept; - - [[nodiscard]] HMODULE LoadLibrary( - const wchar_t* a_name) noexcept; - - [[nodiscard]] void* MapViewOfFile( - void* a_object, - std::uint32_t a_desiredAccess, - std::uint32_t a_fileOffsetHigh, - std::uint32_t a_fileOffsetLow, - std::size_t a_numBytesToMap) noexcept; - - [[nodiscard]] void* MapViewOfFileEx( - void* a_object, - std::uint32_t a_desiredAccess, - std::uint32_t a_fileOffsetHigh, - std::uint32_t a_fileOffsetLow, - std::size_t a_numBytesToMap, - void* a_baseAddress) noexcept; - - std::int32_t MessageBox( - void* a_wnd, - const char* a_text, - const char* a_caption, - std::uint32_t a_type) noexcept; - - std::int32_t MessageBox( - void* a_wnd, - const wchar_t* a_text, - const wchar_t* a_caption, - std::uint32_t a_type) noexcept; - - [[nodiscard]] std::int32_t MultiByteToWideChar( - std::uint32_t a_codePage, - std::uint32_t a_flags, - const char* a_str, - std::int32_t a_strLen, - wchar_t* a_wstr, - std::int32_t a_wstrLen); - - [[nodiscard]] std::int32_t NormalizeString( - std::int32_t a_normForm, - const wchar_t* a_src, - std::int32_t a_srcLen, - wchar_t* a_dest, - std::int32_t a_destLen); - - [[nodiscard]] void* OpenFileMapping( - std::uint32_t a_desiredAccess, - bool a_inheritHandle, - const char* a_name) noexcept; - - [[nodiscard]] void* OpenFileMapping( - std::uint32_t a_desiredAccess, - bool a_inheritHandle, - const wchar_t* a_name) noexcept; - - void OutputDebugString( - const char* a_outStr) noexcept; - - void OutputDebugString( - const wchar_t* a_outStr) noexcept; - - std::int32_t RegGetValue( - 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 RegGetValue( - 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); - - std::uint32_t ResumeThread( - void* a_handle) noexcept; - - bool SetEnvironmentVariable( - const char* a_name, - const char* a_value) noexcept; - - bool SetEnvironmentVariable( - const wchar_t* a_name, - const wchar_t* a_value) noexcept; - - [[nodiscard]] std::int32_t SHGetKnownFolderPath( - const GUID& a_id, - std::uint32_t a_flags, - void* a_token, - wchar_t** a_path) noexcept; - - [[nodiscard]] std::int32_t ShowCursor( - bool a_show) noexcept; - - void Sleep( - std::uint32_t a_milliseconds) noexcept; - - bool TerminateProcess( - void* a_process, - std::uint32_t a_exitCode) noexcept; - - [[nodiscard]] void* TlsGetValue( - std::uint32_t a_index) noexcept; - - bool TlsSetValue( - std::uint32_t a_index, - void* a_value) noexcept; - - [[nodiscard]] std::uint32_t UnDecorateSymbolName( - const char* a_name, - char* a_out, - std::uint32_t a_outLenMax, - std::uint32_t a_flags) noexcept; - - [[nodiscard]] std::uint32_t UnDecorateSymbolName( - const wchar_t* a_name, - wchar_t* a_out, - std::uint32_t a_outLenMax, - std::uint32_t a_flags) noexcept; - - bool UnmapViewOfFile( - const void* a_baseAddress) noexcept; - - bool VerQueryValue( - const void* a_block, - const char* a_subBlock, - void** a_buffer, - std::uint32_t* a_bufferLen) noexcept; - - bool VerQueryValue( - const void* a_block, - const wchar_t* a_subBlock, - void** a_buffer, - std::uint32_t* a_bufferLen) noexcept; - - void* VirtualAlloc( - void* a_address, - std::size_t a_size, - std::uint32_t a_type, - std::uint32_t a_protect) noexcept; - - void* VirtualAllocEx( - void* 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( - void* 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( - void* a_process, - void* a_address, - std::size_t a_size, - std::uint32_t a_newProtect, - std::uint32_t* a_oldProtect) noexcept; - - [[nodiscard]] std::size_t VirtualQuery( - const void* a_address, - MEMORY_BASIC_INFORMATION* a_buffer, - std::size_t a_bufferLen) noexcept; - - [[nodiscard]] std::size_t VirtualQueryEx( - void* a_process, - const void* a_address, - MEMORY_BASIC_INFORMATION* a_buffer, - std::size_t a_bufferLen) noexcept; - - [[nodiscard]] std::uint32_t WaitForSingleObject( - void* a_handle, - std::uint32_t a_milliseconds) noexcept; - - [[nodiscard]] std::uint32_t WaitForSingleObjectEx( - void* a_handle, - std::uint32_t a_milliseconds, - bool a_alertable) noexcept; - - [[nodiscard]] std::int32_t WideCharToMultiByte( - std::uint32_t a_codePage, - std::uint32_t a_flags, - const wchar_t* a_wstr, - std::int32_t a_wstrLen, - char* a_str, - std::int32_t a_strLen, - const char* a_default, - std::int32_t* a_defaultLen); - - bool WriteProcessMemory( - void* a_process, - void* a_address, - const void* a_buffer, - std::size_t a_bufferLen, - std::size_t* a_bufferWritten) noexcept; -} - -#endif // _INC_WINAPIFAMILY - -namespace RE::DirectX -{ - struct XMFLOAT4X4 - { - // members - float m[4][4]; - }; - static_assert(sizeof(XMFLOAT4X4) == 0x40); - - struct DXGI_RATIONAL - { - // members - std::uint32_t numerator; // 00 - std::uint32_t denominator; // 04 - }; - static_assert(sizeof(DXGI_RATIONAL) == 0x08); - - enum DXGI_MODE_SCALING : std::uint32_t - { - DXGI_MODE_SCALING_UNSPECIFIED = 0, - DXGI_MODE_SCALING_CENTERED = 1, - DXGI_MODE_SCALING_STRETCHED = 2 - }; - - enum DXGI_MODE_SCANLINE_ORDER : std::uint32_t - { - 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 - }; -} diff --git a/include/SKSE/Impl/XInputAPI.h b/include/SKSE/Impl/XInputAPI.h deleted file mode 100644 index 42280876a..000000000 --- a/include/SKSE/Impl/XInputAPI.h +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -// TODO: This should probably be behind some sort of pragma that allows linking with xinput -namespace RE::XInput -{ - struct __XINPUT_GAMEPAD - { - std::uint16_t wButtons; - std::byte bLeftTrigger; - std::byte bRightTrigger; - std::int16_t sThumbLX; - std::int16_t sThumbLY; - std::int16_t sThumbRX; - std::int16_t sThumbRY; - }; - using XINPUT_GAMEPAD = __XINPUT_GAMEPAD; - struct __XINPUT_STATE - { - std::uint32_t dwPacketNumber; - __XINPUT_GAMEPAD Gamepad; - }; - using XINPUT_STATE = __XINPUT_STATE; - struct __XINPUT_KEYSTROKE - { - std::uint16_t VirtualKey; - std::uint16_t Unicode; - std::uint16_t Flags; - std::uint8_t UserIndex; - std::uint8_t HidCode; - }; - using XINPUT_KEYSTROKE = __XINPUT_KEYSTROKE; - struct __XINPUT_VIBRATION - { - std::uint16_t wLeftMotorSpeed; - std::uint16_t wRightMotorSpeed; - }; - using XINPUT_VIBRATION = __XINPUT_VIBRATION; - - struct __XINPUT_CAPABILITIES - { - std::uint8_t Type; - std::uint8_t SubType; - std::uint16_t Flags; - XINPUT_GAMEPAD Gamepad; - XINPUT_VIBRATION Vibration; - }; - using XINPUT_CAPABILITIES = __XINPUT_CAPABILITIES; - - enum XInputButton : 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 - }; - static constexpr std::uint16_t XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE = 7849; - static constexpr std::uint16_t XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE = 8689; - static constexpr std::uint8_t XINPUT_GAMEPAD_TRIGGER_THRESHOLD = 30; - - static constexpr std::uint16_t XINPUT_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; -} diff --git a/include/SKSE/Trampoline.h b/include/SKSE/Trampoline.h index dc2703757..3285b9a68 100644 --- a/include/SKSE/Trampoline.h +++ b/include/SKSE/Trampoline.h @@ -1,5 +1,7 @@ #pragma once +#include "REX/W32/KERNEL32.h" + #if defined(SKSE_SUPPORT_XBYAK) namespace Xbyak { @@ -80,10 +82,9 @@ namespace SKSE stl::report_and_fail("failed to create trampoline"sv); } - set_trampoline(mem, a_size, - [](void* a_mem, std::size_t) { - WinAPI::VirtualFree(a_mem, 0, WinAPI::MEM_RELEASE); - }); + set_trampoline(mem, a_size, [](void* a_mem, std::size_t) { + REX::W32::VirtualFree(a_mem, 0, REX::W32::MEM_RELEASE); + }); } void set_trampoline(void* a_trampoline, std::size_t a_size) { set_trampoline(a_trampoline, a_size, {}); } diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index 239ad8c47..0a9b04616 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -1157,7 +1157,7 @@ namespace RE kTotal }; - char addonString[WinAPI::MAX_PATH]{ '\0' }; + char addonString[REX::W32::MAX_PATH]{ '\0' }; a_arma->GetNodeName(addonString, this, a_armor, -1); std::array skeletonRoot = { Get3D(k3rd), Get3D(k1st) }; if (skeletonRoot[k1st] == skeletonRoot[k3rd]) { diff --git a/src/RE/B/BSAtomic.cpp b/src/RE/B/BSAtomic.cpp index 1be15fa3d..a9f9cfcae 100644 --- a/src/RE/B/BSAtomic.cpp +++ b/src/RE/B/BSAtomic.cpp @@ -1,48 +1,6 @@ #include "RE/B/BSAtomic.h" -#define WIN32_LEAN_AND_MEAN - -#define NOGDICAPMASKS -#define NOVIRTUALKEYCODES -//#define NOWINMESSAGES -#define NOWINSTYLES -#define NOSYSMETRICS -#define NOMENUS -#define NOICONS -#define NOKEYSTATES -#define NOSYSCOMMANDS -#define NORASTEROPS -#define NOSHOWWINDOW -#define OEMRESOURCE -#define NOATOM -#define NOCLIPBOARD -#define NOCOLOR -//#define NOCTLMGR -#define NODRAWTEXT -#define NOGDI -#define NOKERNEL -//#define NOUSER -#define NONLS -//#define NOMB -#define NOMEMMGR -#define NOMETAFILE -#define NOMINMAX -//#define NOMSG -#define NOOPENFILE -#define NOSCROLL -#define NOSERVICE -#define NOSOUND -#define NOTEXTMETRIC -#define NOWH -#define NOWINOFFSETS -#define NOCOMM -#define NOKANJI -#define NOHELP -#define NOPROFILER -#define NODEFERWINDOWPOS -#define NOMCX - -#include +#include "REX/W32/KERNEL32.h" namespace RE { @@ -50,12 +8,12 @@ namespace RE semaphore() { stl::memzero(&semaphore); - semaphore = ::CreateSemaphoreA(nullptr, 0, 40, nullptr); + semaphore = REX::W32::CreateSemaphoreA(nullptr, 0, 40, nullptr); } BSSemaphoreBase::~BSSemaphoreBase() { - ::CloseHandle(semaphore); + REX::W32::CloseHandle(semaphore); stl::memzero(&semaphore); } @@ -66,25 +24,25 @@ namespace RE void BSSpinLock::Lock(std::uint32_t a_pauseAttempts) { - std::uint32_t myThreadID = ::GetCurrentThreadId(); + std::uint32_t myThreadID = REX::W32::GetCurrentThreadId(); _mm_lfence(); if (_owningThread == myThreadID) { - ::_InterlockedIncrement(&_lockCount); + REX::W32::InterlockedIncrement(&_lockCount); } else { std::uint32_t attempts = 0; - if (::_InterlockedCompareExchange(&_lockCount, 1, 0)) { + if (REX::W32::InterlockedCompareExchange(&_lockCount, 1, 0)) { do { ++attempts; _mm_pause(); if (attempts >= a_pauseAttempts) { std::uint32_t spinCount = 0; - while (::_InterlockedCompareExchange(&_lockCount, 1, 0)) { - Sleep(++spinCount < kFastSpinThreshold ? 0 : 1); + while (REX::W32::InterlockedCompareExchange(&_lockCount, 1, 0)) { + REX::W32::Sleep(++spinCount < kFastSpinThreshold ? 0 : 1); } break; } - } while (::_InterlockedCompareExchange(&_lockCount, 1, 0)); + } while (REX::W32::InterlockedCompareExchange(&_lockCount, 1, 0)); _mm_lfence(); } @@ -95,16 +53,16 @@ namespace RE void BSSpinLock::Unlock() { - std::uint32_t myThreadID = GetCurrentThreadId(); + std::uint32_t myThreadID = REX::W32::GetCurrentThreadId(); _mm_lfence(); if (_owningThread == myThreadID) { if (_lockCount == 1) { _owningThread = 0; _mm_mfence(); - ::_InterlockedCompareExchange(&_lockCount, 0, 1); + REX::W32::InterlockedCompareExchange(&_lockCount, 0, 1); } else { - ::_InterlockedDecrement(&_lockCount); + REX::W32::InterlockedDecrement(&_lockCount); } } } diff --git a/src/RE/B/BSDirectInputManager.cpp b/src/RE/B/BSDirectInputManager.cpp index dc5fd250f..ce9fcd0e7 100644 --- a/src/RE/B/BSDirectInputManager.cpp +++ b/src/RE/B/BSDirectInputManager.cpp @@ -8,28 +8,28 @@ namespace RE return *singleton; } - DirectInput8::IDirectInputDevice8A* BSDirectInputManager::CreateDeviceWithGUID(WinAPI::GUID* a_guid) + REX::W32::IDirectInputDevice8A* BSDirectInputManager::CreateDeviceWithGUID(REX::W32::GUID* a_guid) { using func_t = decltype(&BSDirectInputManager::CreateDeviceWithGUID); REL::Relocation func{ RELOCATION_ID(67373, 68675) }; return func(this, a_guid); } - void BSDirectInputManager::GetDeviceState(DirectInput8::IDirectInputDevice8A* a_device, std::uint32_t a_size, void* a_outData) + void BSDirectInputManager::GetDeviceState(REX::W32::IDirectInputDevice8A* a_device, std::uint32_t a_size, void* a_outData) { using func_t = decltype(&BSDirectInputManager::GetDeviceState); REL::Relocation func{ RELOCATION_ID(67375, 68677) }; return func(this, a_device, a_size, a_outData); } - void BSDirectInputManager::GetDeviceData(DirectInput8::IDirectInputDevice8A* a_device, std::uint32_t* a_dataSize, DirectInput8::DIDEVICEOBJECTDATA** a_outData) + void BSDirectInputManager::GetDeviceData(REX::W32::IDirectInputDevice8A* a_device, std::uint32_t* a_dataSize, REX::W32::DIDEVICEOBJECTDATA** a_outData) { using func_t = decltype(&BSDirectInputManager::GetDeviceData); REL::Relocation func{ RELOCATION_ID(67376, 68678) }; return func(this, a_device, a_dataSize, a_outData); } - void BSDirectInputManager::ReleaseDevice(DirectInput8::IDirectInputDevice8A* a_device) + void BSDirectInputManager::ReleaseDevice(REX::W32::IDirectInputDevice8A* a_device) { using func_t = decltype(&BSDirectInputManager::ReleaseDevice); REL::Relocation func{ RELOCATION_ID(67374, 68676) }; diff --git a/src/RE/B/BSWin32KeyboardDevice.cpp b/src/RE/B/BSWin32KeyboardDevice.cpp index ca63326f6..e0f0abe73 100644 --- a/src/RE/B/BSWin32KeyboardDevice.cpp +++ b/src/RE/B/BSWin32KeyboardDevice.cpp @@ -7,35 +7,35 @@ namespace RE return (a_keyCode < sizeof(curState)) && ((curState[a_keyCode] & 0x80) != 0); } - BSKeyboardDevice::Key BSWin32KeyboardDevice::RemapNumpadKey(DirectInput8::DIKey a_key) + BSKeyboardDevice::Key BSWin32KeyboardDevice::RemapNumpadKey(REX::W32::DIK a_key) { - if (WinAPI::GetKeyState(WinAPI::VKEnum::VK_NUMLOCK) != 1) { + if (REX::W32::GetKeyState(REX::W32::VK::VK_NUMLOCK) != 1) { return Key::kNone; } switch (a_key) { - case DirectInput8::DIKey::DIK_NUMPAD7: + case REX::W32::DIK::DIK_NUMPAD7: return Key::kKP_Multiply; - case DirectInput8::DIKey::DIK_NUMPAD8: + case REX::W32::DIK::DIK_NUMPAD8: return Key::kLeftAlt; - case DirectInput8::DIKey::DIK_NUMPAD9: + case REX::W32::DIK::DIK_NUMPAD9: return Key::kSpacebar; - case DirectInput8::DIKey::DIK_NUMPAD4: + case REX::W32::DIK::DIK_NUMPAD4: return Key::kPeriod; - case DirectInput8::DIKey::DIK_NUMPAD5: + case REX::W32::DIK::DIK_NUMPAD5: return Key::kSlash; - case DirectInput8::DIKey::DIK_NUMPAD6: + case REX::W32::DIK::DIK_NUMPAD6: return Key::kRightShift; - case DirectInput8::DIKey::DIK_NUMPAD1: + case REX::W32::DIK::DIK_NUMPAD1: return Key::kN; - case DirectInput8::DIKey::DIK_NUMPAD2: + case REX::W32::DIK::DIK_NUMPAD2: return Key::kM; - case DirectInput8::DIKey::DIK_NUMPAD3: + case REX::W32::DIK::DIK_NUMPAD3: return Key::kComma; - case DirectInput8::DIKey::DIK_NUMPAD0: + case REX::W32::DIK::DIK_NUMPAD0: return Key::kB; - case DirectInput8::DIKey::DIK_DECIMAL: + case REX::W32::DIK::DIK_DECIMAL: return Key::kC; - case DirectInput8::DIKey::DIK_DIVIDE: + case REX::W32::DIK::DIK_DIVIDE: return Key::kV; default: break; diff --git a/src/RE/G/GAtomic.cpp b/src/RE/G/GAtomic.cpp index e933c1096..b8db39aec 100644 --- a/src/RE/G/GAtomic.cpp +++ b/src/RE/G/GAtomic.cpp @@ -1,48 +1,6 @@ #include "RE/G/GAtomic.h" -#define WIN32_LEAN_AND_MEAN - -#define NOGDICAPMASKS -#define NOVIRTUALKEYCODES -//#define NOWINMESSAGES -#define NOWINSTYLES -#define NOSYSMETRICS -#define NOMENUS -#define NOICONS -#define NOKEYSTATES -#define NOSYSCOMMANDS -#define NORASTEROPS -#define NOSHOWWINDOW -#define OEMRESOURCE -#define NOATOM -#define NOCLIPBOARD -#define NOCOLOR -//#define NOCTLMGR -#define NODRAWTEXT -#define NOGDI -#define NOKERNEL -//#define NOUSER -#define NONLS -//#define NOMB -#define NOMEMMGR -#define NOMETAFILE -#define NOMINMAX -//#define NOMSG -#define NOOPENFILE -#define NOSCROLL -#define NOSERVICE -#define NOSOUND -#define NOTEXTMETRIC -#define NOWH -#define NOWINOFFSETS -#define NOCOMM -#define NOKANJI -#define NOHELP -#define NOPROFILER -#define NODEFERWINDOWPOS -#define NOMCX - -#include +#include "REX/W32/KERNEL32.h" namespace RE { @@ -59,23 +17,21 @@ namespace RE GLock::GLock(std::uint32_t a_spinCount) { - ::InitializeCriticalSectionAndSpinCount( - reinterpret_cast<::LPCRITICAL_SECTION>(&cs), - a_spinCount); + REX::W32::InitializeCriticalSectionAndSpinCount(&cs, a_spinCount); } GLock::~GLock() { - ::DeleteCriticalSection(reinterpret_cast<::LPCRITICAL_SECTION>(&cs)); + REX::W32::DeleteCriticalSection(&cs); } void GLock::Lock() { - ::EnterCriticalSection(reinterpret_cast<::LPCRITICAL_SECTION>(&cs)); + REX::W32::EnterCriticalSection(&cs); } void GLock::Unlock() { - ::LeaveCriticalSection(reinterpret_cast<::LPCRITICAL_SECTION>(&cs)); + REX::W32::LeaveCriticalSection(&cs); } } diff --git a/src/RE/G/GFxLog.cpp b/src/RE/G/GFxLog.cpp index 75b2530cc..ab4f64be7 100644 --- a/src/RE/G/GFxLog.cpp +++ b/src/RE/G/GFxLog.cpp @@ -1,5 +1,7 @@ #include "RE/G/GFxLog.h" +#include "REX/W32/KERNEL32.h" + namespace RE { GFxLog::GFxLog() : @@ -13,7 +15,7 @@ namespace RE std::vector buf(std::vsnprintf(nullptr, 0, a_fmt, a_argList) + 1); std::vsnprintf(buf.data(), buf.size(), a_fmt, args); va_end(args); - WinAPI::OutputDebugString(buf.data()); + REX::W32::OutputDebugStringA(buf.data()); } void GFxLog::LogMessageByType(LogMessageType a_messageType, const char* a_fmt, ...) diff --git a/src/RE/G/GMemoryHeap.cpp b/src/RE/G/GMemoryHeap.cpp index f98553d5d..56eff8fe4 100644 --- a/src/RE/G/GMemoryHeap.cpp +++ b/src/RE/G/GMemoryHeap.cpp @@ -1,4 +1,5 @@ #include "RE/G/GMemoryHeap.h" +#include "REX/W32/KERNEL32.h" namespace RE { @@ -102,8 +103,8 @@ namespace RE void GMemoryHeap::AssignToCurrentThread() { - assert(_ownerThreadID == 0 || _ownerThreadID == WinAPI::GetCurrentThreadID()); - _ownerThreadID = WinAPI::GetCurrentThreadID(); + assert(_ownerThreadID == 0 || _ownerThreadID == REX::W32::GetCurrentThreadId()); + _ownerThreadID = REX::W32::GetCurrentThreadId(); } bool GMemoryHeap::DumpMemoryLeaks() diff --git a/src/RE/M/MenuCursor.cpp b/src/RE/M/MenuCursor.cpp index 09287e3b3..72b8b5125 100644 --- a/src/RE/M/MenuCursor.cpp +++ b/src/RE/M/MenuCursor.cpp @@ -1,4 +1,5 @@ #include "RE/M/MenuCursor.h" +#include "REX/W32/USER32.h" namespace RE { @@ -12,11 +13,11 @@ namespace RE { if (a_visible && showCursorCount < 0) { do { - showCursorCount = WinAPI::ShowCursor(true); + showCursorCount = REX::W32::ShowCursor(true); } while (showCursorCount < 0); } else if (!a_visible && showCursorCount >= 0) { do { - showCursorCount = WinAPI::ShowCursor(false); + showCursorCount = REX::W32::ShowCursor(false); } while (showCursorCount >= 0); } } diff --git a/src/RE/R/Renderer.cpp b/src/RE/R/Renderer.cpp index a0c836949..1c7336337 100644 --- a/src/RE/R/Renderer.cpp +++ b/src/RE/R/Renderer.cpp @@ -24,90 +24,104 @@ namespace RE return func(this, a_renderTarget, a_filePath, a_textureFileFormat); } - void Renderer::Init(RendererInitOSData* a_data, ApplicationWindowProperties* windowProps, WinAPI::HWND window) + void Renderer::Init(RendererInitOSData* a_data, ApplicationWindowProperties* a_windowProps, REX::W32::HWND a_window) { using func_t = decltype(&Renderer::Init); REL::Relocation func{ RELOCATION_ID(75445, 77226) }; - return func(this, a_data, windowProps, window); + return func(this, a_data, a_windowProps, a_window); } - void Renderer::Begin(std::uint32_t windowID) + + void Renderer::Begin(std::uint32_t a_windowID) { using func_t = decltype(&Renderer::Begin); REL::Relocation func{ RELOCATION_ID(75460, 77245) }; - return func(this, windowID); + return func(this, a_windowID); } - void Renderer::CreateSwapChain(WinAPI::HWND* window, bool setCurrent) + + void Renderer::CreateSwapChain(REX::W32::HWND* a_window, bool a_setCurrent) { using func_t = decltype(&Renderer::CreateSwapChain); REL::Relocation func{ RELOCATION_ID(75457, 77242) }; - return func(this, window, setCurrent); + return func(this, a_window, a_setCurrent); } + void Renderer::End() { using func_t = decltype(&Renderer::End); REL::Relocation func{ RELOCATION_ID(75461, 77246) }; return func(this); } - void Renderer::KillWindow(std::uint32_t windowID) + + void Renderer::KillWindow(std::uint32_t a_windowID) { using func_t = decltype(&Renderer::KillWindow); REL::Relocation func{ RELOCATION_ID(75452, 77237) }; - return func(this, windowID); + return func(this, a_windowID); } + void Renderer::Lock() { using func_t = decltype(&Renderer::Lock); REL::Relocation func{ RELOCATION_ID(75458, 77243) }; return func(this); } + void Renderer::Unlock() { using func_t = decltype(&Renderer::Unlock); REL::Relocation func{ RELOCATION_ID(75459, 77244) }; return func(this); } - void Renderer::ResizeWindow(std::uint32_t windowID, std::uint32_t width, std::uint32_t height, bool fullscreen, bool borderless) + + void Renderer::ResizeWindow(std::uint32_t a_windowID, std::uint32_t a_width, std::uint32_t a_height, bool a_fullscreen, bool a_borderless) { using func_t = decltype(&Renderer::ResizeWindow); REL::Relocation func{ RELOCATION_ID(75454, 77239) }; - return func(this, windowID, width, height, fullscreen, borderless); + return func(this, a_windowID, a_width, a_height, a_fullscreen, a_borderless); } - void Renderer::RequestWindowResize(std::uint32_t width, std::uint32_t height) + + void Renderer::RequestWindowResize(std::uint32_t a_width, std::uint32_t a_height) { using func_t = decltype(&Renderer::RequestWindowResize); REL::Relocation func{ RELOCATION_ID(75450, 77235) }; - return func(this, width, height); + return func(this, a_width, a_height); } - void Renderer::SetWindowPosition(std::uint32_t windowID, std::int32_t x, std::int32_t y) + + void Renderer::SetWindowPosition(std::uint32_t a_windowID, std::int32_t a_x, std::int32_t a_y) { using func_t = decltype(&Renderer::SetWindowPosition); REL::Relocation func{ RELOCATION_ID(75448, 77233) }; - return func(this, windowID, x, y); + return func(this, a_windowID, a_x, a_y); } - void Renderer::SetWindowActiveState(bool show) + + void Renderer::SetWindowActiveState(bool a_show) { using func_t = decltype(&Renderer::SetWindowActiveState); REL::Relocation func{ RELOCATION_ID(75451, 77236) }; - return func(this, show); + return func(this, a_show); } - void Renderer::WindowSizeChanged(std::uint32_t windowID) + + void Renderer::WindowSizeChanged(std::uint32_t a_windowID) { using func_t = decltype(&Renderer::WindowSizeChanged); REL::Relocation func{ RELOCATION_ID(75453, 77238) }; - return func(this, windowID); + return func(this, a_windowID); } - void Renderer::ResetWindow(std::uint32_t windowID) + + void Renderer::ResetWindow(std::uint32_t a_windowID) { using func_t = decltype(&Renderer::ResetWindow); REL::Relocation func{ RELOCATION_ID(75454, 77239) }; - return func(this, windowID); + return func(this, a_windowID); } - void Renderer::UpdateViewPort(std::uint32_t a_unk, std::uint32_t b_unk, bool c_unk) + + void Renderer::UpdateViewPort(std::uint32_t a_unk1, std::uint32_t a_unk2, bool a_unk3) { using func_t = decltype(&Renderer::UpdateViewPort); REL::Relocation func{ RELOCATION_ID(75455, 77240) }; - return func(this, a_unk, b_unk, c_unk); + return func(this, a_unk1, a_unk2, a_unk3); } + void Renderer::Shutdown() { using func_t = decltype(&Renderer::Shutdown); @@ -128,10 +142,10 @@ namespace RE REL::Relocation singleton{ RELOCATION_ID(525002, 411483) }; return *singleton; } - [[nodiscard]] ID3D11Device* Renderer::GetDevice() + [[nodiscard]] REX::W32::ID3D11Device* Renderer::GetDevice() { // Location is a global pointer to the device in the Renderer Data - REL::Relocation device{ RELOCATION_ID(524729, 411348) }; + REL::Relocation device{ RELOCATION_ID(524729, 411348) }; return *device; } [[nodiscard]] RendererWindow* Renderer::GetCurrentRenderWindow() diff --git a/src/RE/T/TESObjectARMA.cpp b/src/RE/T/TESObjectARMA.cpp index 4cc238f24..2cc83163c 100644 --- a/src/RE/T/TESObjectARMA.cpp +++ b/src/RE/T/TESObjectARMA.cpp @@ -6,6 +6,8 @@ #include "RE/T/TESObjectREFR.h" #include "RE/T/TESRace.h" +#include "REX/W32/BASE.h" + namespace RE { bool HasArmorRace(const TESRace* a_sourceRace, const TESRace* a_targetRace) @@ -63,6 +65,6 @@ namespace RE } std::uint32_t sex = npc ? static_cast(npc->GetSex()) : 0; - sprintf_s(a_dstBuff, WinAPI::MAX_PATH, " (%08X)[%d]/ (%08X) [%2.0f%%]", GetFormID(), sex, a_armor->GetFormID(), weight); + sprintf_s(a_dstBuff, REX::W32::MAX_PATH, " (%08X)[%d]/ (%08X) [%2.0f%%]", GetFormID(), sex, a_armor->GetFormID(), weight); } } diff --git a/src/RE/T/TESObjectWEAP.cpp b/src/RE/T/TESObjectWEAP.cpp index ab9000b05..feadd9cc6 100644 --- a/src/RE/T/TESObjectWEAP.cpp +++ b/src/RE/T/TESObjectWEAP.cpp @@ -1,5 +1,7 @@ #include "RE/T/TESObjectWEAP.h" +#include "REX/W32/BASE.h" + namespace RE { float TESObjectWEAP::GetSpeed() const @@ -41,7 +43,7 @@ namespace RE void TESObjectWEAP::GetNodeName(char* a_dstBuff) const { - sprintf_s(a_dstBuff, WinAPI::MAX_PATH, "%s (%08X)", "Weapon", formID); + sprintf_s(a_dstBuff, REX::W32::MAX_PATH, "%s (%08X)", "Weapon", formID); } WEAPON_TYPE TESObjectWEAP::GetWeaponType() const diff --git a/src/REL/ID.cpp b/src/REL/ID.cpp index 86926e12a..e6c0f63bf 100644 --- a/src/REL/ID.cpp +++ b/src/REL/ID.cpp @@ -1,5 +1,7 @@ #include "REL/ID.h" +#include "REX/W32/KERNEL32.h" + namespace REL { namespace detail @@ -8,11 +10,11 @@ namespace REL { close(); - WinAPI::ULARGE_INTEGER bytes; + REX::W32::ULARGE_INTEGER bytes; bytes.value = a_size; - _mapping = WinAPI::OpenFileMapping( - WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + _mapping = REX::W32::OpenFileMappingW( + REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, false, a_name.data()); if (!_mapping) { @@ -20,9 +22,9 @@ namespace REL return false; } - _view = WinAPI::MapViewOfFile( + _view = REX::W32::MapViewOfFile( _mapping, - WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, 0, 0, bytes.value); @@ -38,18 +40,18 @@ namespace REL { close(); - WinAPI::ULARGE_INTEGER bytes; + REX::W32::ULARGE_INTEGER bytes; bytes.value = a_size; - _mapping = WinAPI::OpenFileMapping( - WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + _mapping = REX::W32::OpenFileMappingW( + REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, false, a_name.data()); if (!_mapping) { - _mapping = WinAPI::CreateFileMapping( - WinAPI::INVALID_HANDLE_VALUE, + _mapping = REX::W32::CreateFileMappingW( + REX::W32::INVALID_HANDLE_VALUE, nullptr, - WinAPI::PAGE_READWRITE, + REX::W32::PAGE_READWRITE, bytes.hi, bytes.lo, a_name.data()); @@ -58,9 +60,9 @@ namespace REL } } - _view = WinAPI::MapViewOfFile( + _view = REX::W32::MapViewOfFile( _mapping, - WinAPI::FILE_MAP_READ | WinAPI::FILE_MAP_WRITE, + REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, 0, 0, bytes.value); @@ -74,12 +76,12 @@ namespace REL void memory_map::close() { if (_view) { - WinAPI::UnmapViewOfFile(static_cast(_view)); + REX::W32::UnmapViewOfFile(static_cast(_view)); _view = nullptr; } if (_mapping) { - WinAPI::CloseHandle(_mapping); + REX::W32::CloseHandle(_mapping); _mapping = nullptr; } } diff --git a/src/REL/Module.cpp b/src/REL/Module.cpp index 3a590cf74..846df2bf3 100644 --- a/src/REL/Module.cpp +++ b/src/REL/Module.cpp @@ -1,12 +1,14 @@ #include "REL/Module.h" +#include "REX/W32/KERNEL32.h" + namespace REL { void Module::load_segments() { - const auto dosHeader = reinterpret_cast(_base); - const auto ntHeader = stl::adjust_pointer(dosHeader, dosHeader->lfanew); - const auto sections = WinAPI::IMAGE_FIRST_SECTION(ntHeader); + 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]; diff --git a/src/REX/W32/ADVAPI32.cpp b/src/REX/W32/ADVAPI32.cpp new file mode 100644 index 000000000..a84eb0b01 --- /dev/null +++ b/src/REX/W32/ADVAPI32.cpp @@ -0,0 +1,17 @@ +#include "REX/W32/ADVAPI32.h" + +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); + } +} diff --git a/src/REX/W32/D3D11.cpp b/src/REX/W32/D3D11.cpp new file mode 100644 index 000000000..536f6f42d --- /dev/null +++ b/src/REX/W32/D3D11.cpp @@ -0,0 +1,17 @@ +#include "D3D11.h" + +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); + } +} diff --git a/src/REX/W32/D3DCOMPILER.cpp b/src/REX/W32/D3DCOMPILER.cpp new file mode 100644 index 000000000..d13e89e91 --- /dev/null +++ b/src/REX/W32/D3DCOMPILER.cpp @@ -0,0 +1,155 @@ +#include "D3DCOMPILER.h" + +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)); + } +} diff --git a/src/REX/W32/DBGHELP.cpp b/src/REX/W32/DBGHELP.cpp new file mode 100644 index 000000000..dc532bc39 --- /dev/null +++ b/src/REX/W32/DBGHELP.cpp @@ -0,0 +1,17 @@ +#include "REX/W32/DBGHELP.h" + +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); + } +} diff --git a/src/REX/W32/DXGI.cpp b/src/REX/W32/DXGI.cpp new file mode 100644 index 000000000..101933a12 --- /dev/null +++ b/src/REX/W32/DXGI.cpp @@ -0,0 +1,17 @@ +#include "DXGI.h" + +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); + } +} diff --git a/src/REX/W32/KERNEL32.cpp b/src/REX/W32/KERNEL32.cpp new file mode 100644 index 000000000..69c11ca27 --- /dev/null +++ b/src/REX/W32/KERNEL32.cpp @@ -0,0 +1,467 @@ +#include "REX/W32/KERNEL32.h" + +REX_W32_IMPORT(REX::W32::BOOL, CloseHandle, 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::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(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, 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 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); + } + + 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); + } + + 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 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); + } +} diff --git a/src/REX/W32/OLE32.cpp b/src/REX/W32/OLE32.cpp new file mode 100644 index 000000000..2e20d0b7f --- /dev/null +++ b/src/REX/W32/OLE32.cpp @@ -0,0 +1,11 @@ +#include "REX/W32/OLE32.h" + +REX_W32_IMPORT(void, CoTaskMemFree, void*); + +namespace REX::W32 +{ + void CoTaskMemFree(void* a_block) noexcept + { + ::W32_IMPL_CoTaskMemFree(a_block); + } +} diff --git a/src/REX/W32/SHELL32.cpp b/src/REX/W32/SHELL32.cpp new file mode 100644 index 000000000..fd52204e4 --- /dev/null +++ b/src/REX/W32/SHELL32.cpp @@ -0,0 +1,11 @@ +#include "REX/W32/SHELL32.h" + +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); + } +} diff --git a/src/REX/W32/USER32.cpp b/src/REX/W32/USER32.cpp new file mode 100644 index 000000000..aac4229d2 --- /dev/null +++ b/src/REX/W32/USER32.cpp @@ -0,0 +1,59 @@ +#include "REX/W32/KERNEL32.h" + +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); + } +} diff --git a/src/REX/W32/VERSION.cpp b/src/REX/W32/VERSION.cpp new file mode 100644 index 000000000..ce249a491 --- /dev/null +++ b/src/REX/W32/VERSION.cpp @@ -0,0 +1,53 @@ +#include "REX/W32/VERSION.h" + +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); + } +} diff --git a/src/SKSE/IAT.cpp b/src/SKSE/IAT.cpp index ba879b123..9039bc5d6 100644 --- a/src/SKSE/IAT.cpp +++ b/src/SKSE/IAT.cpp @@ -2,49 +2,7 @@ #include "SKSE/Logger.h" -#define WIN32_LEAN_AND_MEAN - -#define NOGDICAPMASKS -#define NOVIRTUALKEYCODES -//#define NOWINMESSAGES -#define NOWINSTYLES -#define NOSYSMETRICS -#define NOMENUS -#define NOICONS -#define NOKEYSTATES -#define NOSYSCOMMANDS -#define NORASTEROPS -#define NOSHOWWINDOW -#define OEMRESOURCE -#define NOATOM -#define NOCLIPBOARD -#define NOCOLOR -//#define NOCTLMGR -#define NODRAWTEXT -#define NOGDI -#define NOKERNEL -//#define NOUSER -#define NONLS -//#define NOMB -#define NOMEMMGR -#define NOMETAFILE -#define NOMINMAX -//#define NOMSG -#define NOOPENFILE -#define NOSCROLL -#define NOSERVICE -#define NOSOUND -#define NOTEXTMETRIC -#define NOWH -#define NOWINOFFSETS -#define NOCOMM -#define NOKANJI -#define NOHELP -#define NOPROFILER -#define NODEFERWINDOWPOS -#define NOMCX - -#include +#include "REX/W32/KERNEL32.h" namespace SKSE { @@ -53,7 +11,7 @@ namespace SKSE return reinterpret_cast(GetIATPtr(std::move(a_dll), std::move(a_function))); } - std::uintptr_t GetIATAddr(void* a_module, std::string_view a_dll, std::string_view 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))); } @@ -64,36 +22,35 @@ namespace SKSE } // https://guidedhacking.com/attachments/pe_imptbl_headers-jpg.2241/ - void* GetIATPtr(void* a_module, std::string_view a_dll, std::string_view a_function) + void* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function) { assert(a_module); - auto dosHeader = static_cast<::IMAGE_DOS_HEADER*>(a_module); - if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE) { + const auto dosHeader = reinterpret_cast(a_module); + if (dosHeader->magic != REX::W32::IMAGE_DOS_SIGNATURE) { log::error("Invalid DOS header"); return nullptr; } - auto ntHeader = stl::adjust_pointer<::IMAGE_NT_HEADERS>(dosHeader, dosHeader->e_lfanew); - auto& dataDir = ntHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; - auto importDesc = stl::adjust_pointer<::IMAGE_IMPORT_DESCRIPTOR>(dosHeader, dataDir.VirtualAddress); + 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) { + 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; } - auto thunk = stl::adjust_pointer<::IMAGE_THUNK_DATA>(dosHeader, import->OriginalFirstThunk); - for (std::size_t i = 0; thunk[i].u1.Ordinal; ++i) { - if (IMAGE_SNAP_BY_ORDINAL(thunk[i].u1.Ordinal)) { + 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; } - auto importByName = stl::adjust_pointer(dosHeader, thunk[i].u1.AddressOfData); - if (a_function.size() == strlen(importByName->Name) && - _strnicmp(a_function.data(), importByName->Name, a_function.size()) == 0) { - return stl::adjust_pointer<::IMAGE_THUNK_DATA>(dosHeader, import->FirstThunk) + i; + 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; } } } @@ -106,7 +63,7 @@ namespace SKSE { std::uintptr_t origAddr = 0; - auto oldFunc = GetIATAddr(a_dll, a_function); + const auto oldFunc = GetIATAddr(a_dll, a_function); if (oldFunc) { origAddr = *reinterpret_cast(oldFunc); REL::safe_write(oldFunc, a_newFunc); diff --git a/src/SKSE/Impl/WinAPI.cpp b/src/SKSE/Impl/WinAPI.cpp deleted file mode 100644 index 3a28645eb..000000000 --- a/src/SKSE/Impl/WinAPI.cpp +++ /dev/null @@ -1,1032 +0,0 @@ -#include "SKSE/Impl/WinAPI.h" - -#define WIN32_LEAN_AND_MEAN - -// clang-format off -#include -#include -#include -#include -// clang-format on - -#undef CreateFileMapping -#undef CreateProcess -#undef ExpandEnvironmentStrings -#undef FindFirstFile -#undef FindNextFile -#undef GetEnvironmentVariable -#undef GetFileVersionInfo -#undef GetFileVersionInfoSize -#undef GetKeyNameText -#undef GetModuleFileName -#undef GetModuleHandle -#undef GetPrivateProfileString -#undef IMAGE_FIRST_SECTION -#undef IMAGE_SNAP_BY_ORDINAL64 -#undef LoadLibrary -#undef MessageBox -#undef OpenFileMapping -#undef OutputDebugString -#undef RegGetValue -#undef RegQueryValueEx -#undef SetEnvironmentVariable -#undef VerQueryValue - -extern "C" IMAGE_DOS_HEADER __ImageBase; - -namespace SKSE::WinAPI -{ - bool CloseHandle( - void* a_handle) noexcept - { - return static_cast( - ::CloseHandle( - a_handle)); - } - - void CoTaskMemFree( - void* a_block) noexcept - { - ::CoTaskMemFree( - a_block); - } - - void* CreateFileMapping( - void* 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 CreateFileMappingA( - a_file, - reinterpret_cast(a_attributes), - a_protect, - a_maxSizeHigh, - a_maxSizeLow, - a_name); - } - - void* CreateFileMapping( - void* 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 CreateFileMappingW( - a_file, - reinterpret_cast(a_attributes), - a_protect, - a_maxSizeHigh, - a_maxSizeLow, - a_name); - } - - bool CreateProcess( - const char* a_name, - char* a_cmd, - SECURITY_ATTRIBUTES* a_procAttr, - SECURITY_ATTRIBUTES* a_threadAttr, - bool a_inherit, - std::uint32_t a_flags, - void* a_env, - const char* a_curDir, - STARTUPINFOA* a_startInfo, - PROCESS_INFORMATION* a_procInfo) noexcept - { - return static_cast( - CreateProcessA( - a_name, - a_cmd, - reinterpret_cast(a_procAttr), - reinterpret_cast(a_threadAttr), - a_inherit, - a_flags, - a_env, - a_curDir, - reinterpret_cast(a_startInfo), - reinterpret_cast(a_procInfo))); - } - - bool CreateProcess( - const wchar_t* a_name, - wchar_t* a_cmd, - SECURITY_ATTRIBUTES* a_procAttr, - SECURITY_ATTRIBUTES* a_threadAttr, - bool a_inherit, - std::uint32_t a_flags, - void* a_env, - const wchar_t* a_curDir, - STARTUPINFOW* a_startInfo, - PROCESS_INFORMATION* a_procInfo) noexcept - { - return static_cast( - CreateProcessW( - a_name, - a_cmd, - reinterpret_cast(a_procAttr), - reinterpret_cast(a_threadAttr), - a_inherit, - a_flags, - a_env, - a_curDir, - reinterpret_cast(a_startInfo), - reinterpret_cast(a_procInfo))); - } - - void* CreateRemoteThread( - void* 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 ::CreateRemoteThread( - a_process, - reinterpret_cast(a_threadAttr), - a_stackSize, - reinterpret_cast(a_startAddr), - a_param, - a_flags, - reinterpret_cast(a_threadID)); - } - - void* 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 ::CreateThread( - reinterpret_cast(a_threadAttr), - a_stackSize, - reinterpret_cast(a_startAddr), - a_param, - a_flags, - reinterpret_cast(a_threadID)); - } - - std::uint32_t ExpandEnvironmentStrings( - const char* a_src, - char* a_dst, - std::uint32_t a_dstLen) noexcept - { - return static_cast( - ExpandEnvironmentStringsA( - a_src, - a_dst, - a_dstLen)); - } - - std::uint32_t ExpandEnvironmentStrings( - const wchar_t* a_src, - wchar_t* a_dst, - std::uint32_t a_dstLen) noexcept - { - return static_cast( - ExpandEnvironmentStringsW( - a_src, - a_dst, - a_dstLen)); - } - - bool FindClose( - void* a_file) noexcept - { - return static_cast( - ::FindClose( - a_file)); - } - - void* FindFirstFile( - const char* a_name, - WIN32_FIND_DATAA* a_data) noexcept - { - return FindFirstFileA( - a_name, - reinterpret_cast(a_data)); - } - - void* FindFirstFile( - const wchar_t* a_name, - WIN32_FIND_DATAW* a_data) noexcept - { - return FindFirstFileW( - a_name, - reinterpret_cast(a_data)); - } - - bool FindNextFile( - void* a_file, - WIN32_FIND_DATAA* a_data) noexcept - { - return static_cast( - FindNextFileA( - a_file, - reinterpret_cast(a_data))); - } - - bool FindNextFile( - void* a_file, - WIN32_FIND_DATAW* a_data) noexcept - { - return static_cast( - FindNextFileW( - a_file, - reinterpret_cast(a_data))); - } - - bool FlushInstructionCache( - void* a_process, - const void* a_baseAddr, - std::size_t a_size) noexcept - { - return static_cast( - ::FlushInstructionCache( - a_process, - a_baseAddr, - a_size)); - } - - bool FreeLibrary( - HMODULE a_module) noexcept - { - return static_cast( - ::FreeLibrary( - reinterpret_cast<::HMODULE>(a_module))); - } - - void* GetCurrentModule() noexcept - { - return std::addressof(__ImageBase); - } - - void* GetCurrentProcess() noexcept - { - return ::GetCurrentProcess(); - } - - std::uint32_t GetCurrentThreadID() noexcept - { - return static_cast( - GetCurrentThreadId()); - } - - std::uint32_t GetEnvironmentVariable( - const char* a_name, - char* a_buffer, - std::uint32_t a_bufferLen) noexcept - { - return static_cast( - GetEnvironmentVariableA( - a_name, - a_buffer, - a_bufferLen)); - } - - std::uint32_t GetEnvironmentVariable( - const wchar_t* a_name, - wchar_t* a_buffer, - std::uint32_t a_bufferLen) noexcept - { - return static_cast( - GetEnvironmentVariableW( - a_name, - a_buffer, - a_bufferLen)); - } - - bool GetFileVersionInfo( - const char* a_name, - std::uint32_t a_handle, - std::uint32_t a_dataLen, - void* a_data) noexcept - { - return static_cast( - GetFileVersionInfoA( - a_name, - a_handle, - a_dataLen, - a_data)); - } - - bool GetFileVersionInfo( - const wchar_t* a_name, - std::uint32_t a_handle, - std::uint32_t a_dataLen, - void* a_data) noexcept - { - return static_cast( - GetFileVersionInfoW( - a_name, - a_handle, - a_dataLen, - a_data)); - } - - std::uint32_t GetFileVersionInfoSize( - const char* a_name, - std::uint32_t* a_handle) noexcept - { - return static_cast( - GetFileVersionInfoSizeA( - a_name, - reinterpret_cast(a_handle))); - } - - std::uint32_t GetFileVersionInfoSize( - const wchar_t* a_name, - std::uint32_t* a_handle) noexcept - { - return static_cast( - GetFileVersionInfoSizeW( - a_name, - reinterpret_cast(a_handle))); - } - - std::int32_t GetKeyNameText( - std::int32_t a_param, - wchar_t* a_buffer, - std::int32_t a_bufferLen) noexcept - { - return GetKeyNameTextW( - a_param, - a_buffer, - a_bufferLen); - } - - std::int32_t GetKeyNameText( - std::int32_t a_param, - char* a_buffer, - std::int32_t a_bufferLen) noexcept - { - return GetKeyNameTextA( - a_param, - a_buffer, - a_bufferLen); - } - - std::int16_t GetKeyState( - std::int32_t a_key) noexcept - { - return ::GetKeyState(a_key); - } - - std::uint32_t GetLastError() noexcept - { - return static_cast( - ::GetLastError()); - } - - std::size_t GetMaxPath() noexcept - { - return MAX_PATH; - } - - std::uint32_t GetModuleFileName( - void* a_module, - char* a_name, - std::uint32_t a_nameLen) noexcept - { - return static_cast( - GetModuleFileNameA( - static_cast<::HMODULE>(a_module), - a_name, - a_nameLen)); - } - - std::uint32_t GetModuleFileName( - void* a_module, - wchar_t* a_name, - std::uint32_t a_nameLen) noexcept - { - return static_cast( - GetModuleFileNameW( - static_cast<::HMODULE>(a_module), - a_name, - a_nameLen)); - } - - HMODULE GetModuleHandle( - const char* a_name) noexcept - { - return reinterpret_cast( - GetModuleHandleA( - a_name)); - } - - HMODULE GetModuleHandle( - const wchar_t* a_name) noexcept - { - return reinterpret_cast( - GetModuleHandleW(a_name)); - } - - std::uint32_t GetPrivateProfileString( - const char* a_app, - const char* a_key, - const char* a_default, - char* a_out, - std::uint32_t a_outLen, - const char* a_name) noexcept - { - return static_cast( - GetPrivateProfileStringA( - a_app, - a_key, - a_default, - a_out, - a_outLen, - a_name)); - } - - std::uint32_t GetPrivateProfileString( - const wchar_t* a_app, - const wchar_t* a_key, - const wchar_t* a_default, - wchar_t* a_out, - std::uint32_t a_outLen, - const wchar_t* a_name) noexcept - { - return static_cast( - GetPrivateProfileStringW( - a_app, - a_key, - a_default, - a_out, - a_outLen, - a_name)); - } - - void* GetProcAddress( - void* a_module, - const char* a_name) noexcept - { - return reinterpret_cast( - ::GetProcAddress( - static_cast<::HMODULE>(a_module), - a_name)); - } - - std::string_view GetProcPath( - HMODULE a_handle) noexcept - { - static std::string fileName(MAX_PATH + 1, ' '); - auto res = GetModuleFileName(a_handle, fileName.data(), MAX_PATH + 1); - if (res == 0) { - fileName = "[ProcessHost]"; - res = 13; - } - - return { fileName.c_str(), res }; - } - - void GetSystemInfo( - SYSTEM_INFO* a_info) noexcept - { - ::GetSystemInfo( - reinterpret_cast(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 IsDebuggerPresent() noexcept - { - return static_cast( - ::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_dest, - std::int32_t a_destLen, - NLSVERSIONINFO* a_info, - void* a_reserved, - std::intptr_t a_sortHandle) noexcept - { - return ::LCMapStringEx( - a_locale, - a_flags, - a_src, - a_srcLen, - a_dest, - a_destLen, - reinterpret_cast(a_info), - a_reserved, - a_sortHandle); - } - - HMODULE LoadLibrary( - const char* a_name) noexcept - { - return reinterpret_cast( - LoadLibraryA( - a_name)); - } - - HMODULE LoadLibrary( - const wchar_t* a_name) noexcept - { - return reinterpret_cast( - LoadLibraryW(a_name)); - } - - void* MapViewOfFile( - void* a_object, - std::uint32_t a_desiredAccess, - std::uint32_t a_fileOffsetHigh, - std::uint32_t a_fileOffsetLow, - std::size_t a_numBytesToMap) noexcept - { - return ::MapViewOfFile( - a_object, - a_desiredAccess, - a_fileOffsetHigh, - a_fileOffsetLow, - a_numBytesToMap); - } - - void* MapViewOfFileEx( - void* a_object, - std::uint32_t a_desiredAccess, - std::uint32_t a_fileOffsetHigh, - std::uint32_t a_fileOffsetLow, - std::size_t a_numBytesToMap, - void* a_baseAddress) noexcept - { - return ::MapViewOfFileEx( - a_object, - a_desiredAccess, - a_fileOffsetHigh, - a_fileOffsetLow, - a_numBytesToMap, - a_baseAddress); - } - - std::int32_t MessageBox( - void* a_wnd, - const char* a_text, - const char* a_caption, - std::uint32_t a_type) noexcept - { - return MessageBoxA( - static_cast<::HWND>(a_wnd), - a_text, - a_caption, - a_type); - } - - std::int32_t MessageBox( - void* a_wnd, - const wchar_t* a_text, - const wchar_t* a_caption, - std::uint32_t a_type) noexcept - { - return MessageBoxW( - static_cast<::HWND>(a_wnd), - a_text, - a_caption, - a_type); - } - - std::int32_t MultiByteToWideChar( - std::uint32_t a_codePage, - std::uint32_t a_flags, - const char* a_str, - std::int32_t a_strLen, - wchar_t* a_wstr, - std::int32_t a_wstrLen) - { - return ::MultiByteToWideChar( - a_codePage, - a_flags, - a_str, - a_strLen, - a_wstr, - a_wstrLen); - } - - std::int32_t NormalizeString( - std::int32_t a_normForm, - const wchar_t* a_src, - std::int32_t a_srcLen, - wchar_t* a_dest, - std::int32_t a_destLen) - { - return ::NormalizeString( - static_cast(a_normForm), - a_src, - a_srcLen, - a_dest, - a_destLen); - } - - void* OpenFileMapping( - std::uint32_t a_desiredAccess, - bool a_inheritHandle, - const char* a_name) noexcept - { - return OpenFileMappingA( - a_desiredAccess, - a_inheritHandle, - a_name); - } - - void* OpenFileMapping( - std::uint32_t a_desiredAccess, - bool a_inheritHandle, - const wchar_t* a_name) noexcept - { - return OpenFileMappingW( - a_desiredAccess, - a_inheritHandle, - a_name); - } - - void OutputDebugString( - const char* a_out) noexcept - { - OutputDebugStringA( - a_out); - } - - void OutputDebugString( - const wchar_t* a_out) noexcept - { - OutputDebugStringW( - a_out); - } - - std::int32_t RegGetValue( - 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 RegGetValueA( - reinterpret_cast<::HKEY>(a_key), - a_subKey, - a_value, - a_flags, - reinterpret_cast(a_type), - a_data, - reinterpret_cast(a_dataLen)); - } - - std::int32_t RegGetValue( - 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 RegGetValueW( - reinterpret_cast<::HKEY>(a_key), - a_subKey, - a_value, - a_flags, - reinterpret_cast(a_type), - a_data, - reinterpret_cast(a_dataLen)); - } - - std::uint32_t ResumeThread( - void* a_handle) noexcept - { - return static_cast( - ::ResumeThread( - a_handle)); - } - - bool SetEnvironmentVariable( - const char* a_name, - const char* a_value) noexcept - { - return static_cast( - SetEnvironmentVariableA( - a_name, - a_value)); - } - - bool SetEnvironmentVariable( - const wchar_t* a_name, - const wchar_t* a_value) noexcept - { - return static_cast( - SetEnvironmentVariableW( - a_name, - a_value)); - } - - std::int32_t SHGetKnownFolderPath( - const GUID& a_id, - std::uint32_t a_flags, - void* a_token, - wchar_t** a_path) noexcept - { - return static_cast( - ::SHGetKnownFolderPath( - reinterpret_cast(a_id), - a_flags, - a_token, - a_path)); - } - - std::int32_t ShowCursor( - bool a_show) noexcept - { - return ::ShowCursor( - a_show); - } - - void Sleep( - std::uint32_t a_milliseconds) noexcept - { - ::Sleep(a_milliseconds); - } - - bool TerminateProcess( - void* a_process, - std::uint32_t a_exitCode) noexcept - { - return static_cast( - ::TerminateProcess( - a_process, - a_exitCode)); - } - - void* TlsGetValue( - std::uint32_t a_index) noexcept - { - return ::TlsGetValue( - a_index); - } - - bool TlsSetValue( - std::uint32_t a_index, - void* a_value) noexcept - { - return static_cast( - ::TlsSetValue( - a_index, - a_value)); - } - - std::uint32_t UnDecorateSymbolName( - const char* a_name, - char* a_out, - std::uint32_t a_outLenMax, - std::uint32_t a_flags) noexcept - { - return static_cast( - ::UnDecorateSymbolName( - a_name, - a_out, - a_outLenMax, - a_flags)); - } - - std::uint32_t UnDecorateSymbolName( - const wchar_t* a_name, - wchar_t* a_out, - std::uint32_t a_outLenMax, - std::uint32_t a_flags) noexcept - { - return static_cast( - UnDecorateSymbolNameW( - a_name, - a_out, - a_outLenMax, - a_flags)); - } - - bool UnmapViewOfFile( - const void* a_baseAddress) noexcept - { - return static_cast( - ::UnmapViewOfFile( - a_baseAddress)); - } - - bool VerQueryValue( - const void* a_block, - const char* a_subBlock, - void** a_buffer, - std::uint32_t* a_bufferLen) noexcept - { - return static_cast( - VerQueryValueA(a_block, - a_subBlock, - a_buffer, - a_bufferLen)); - } - - bool VerQueryValue( - const void* a_block, - const wchar_t* a_subBlock, - void** a_buffer, - std::uint32_t* a_bufferLen) noexcept - { - return static_cast( - VerQueryValueW( - a_block, - a_subBlock, - a_buffer, - a_bufferLen)); - } - - void* VirtualAlloc( - void* a_address, - std::size_t a_size, - std::uint32_t a_type, - std::uint32_t a_protect) noexcept - { - return ::VirtualAlloc( - a_address, - a_size, - a_type, - a_protect); - } - - void* VirtualAllocEx( - void* a_process, - void* a_address, - std::size_t a_size, - std::uint32_t a_type, - std::uint32_t a_protect) noexcept - { - return ::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 static_cast( - ::VirtualFree( - a_address, - a_size, - a_type)); - } - - bool VirtualFreeEx( - void* a_process, - void* a_address, - std::size_t a_size, - std::uint32_t a_type) noexcept - { - return static_cast( - ::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 static_cast( - ::VirtualProtect( - a_address, - a_size, - a_newProtect, - reinterpret_cast(a_oldProtect))); - } - - bool VirtualProtectEx( - void* a_process, - void* a_address, - std::size_t a_size, - std::uint32_t a_newProtect, - std::uint32_t* a_oldProtect) noexcept - { - return static_cast( - ::VirtualProtectEx( - a_process, - a_address, - a_size, - a_newProtect, - reinterpret_cast(a_oldProtect))); - } - - std::size_t VirtualQuery( - const void* a_address, - MEMORY_BASIC_INFORMATION* a_buffer, - std::size_t a_bufferLen) noexcept - { - return ::VirtualQuery( - a_address, - reinterpret_cast(a_buffer), - a_bufferLen); - } - - std::size_t VirtualQueryEx( - void* a_process, - const void* a_address, - MEMORY_BASIC_INFORMATION* a_buffer, - std::size_t a_bufferLen) noexcept - { - return ::VirtualQueryEx( - a_process, - a_address, - reinterpret_cast(a_buffer), - a_bufferLen); - } - - std::uint32_t WaitForSingleObject( - void* a_handle, - std::uint32_t a_milliseconds) noexcept - { - return static_cast( - ::WaitForSingleObject( - a_handle, - a_milliseconds)); - } - - std::uint32_t WaitForSingleObjectEx( - void* a_handle, - std::uint32_t a_milliseconds, - bool a_alertable) noexcept - { - return static_cast( - ::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_wstr, - std::int32_t a_wstrLen, - char* a_str, - std::int32_t a_strLen, - const char* a_default, - std::int32_t* a_defaultLen) - { - return ::WideCharToMultiByte( - a_codePage, - a_flags, - a_wstr, - a_wstrLen, - a_str, - a_strLen, - a_default, - a_defaultLen); - } - - bool WriteProcessMemory( - void* a_process, - void* a_address, - const void* a_buffer, - std::size_t a_bufferLen, - std::size_t* a_bufferWritten) noexcept - { - return static_cast( - ::WriteProcessMemory( - a_process, - a_address, - a_buffer, - a_bufferLen, - a_bufferWritten)); - } -} diff --git a/src/SKSE/InputMap.cpp b/src/SKSE/InputMap.cpp index 02c223715..0ce8af9f7 100644 --- a/src/SKSE/InputMap.cpp +++ b/src/SKSE/InputMap.cpp @@ -1,45 +1,45 @@ #include "SKSE/InputMap.h" #include "RE/C/ControlMap.h" -#include "SKSE/Impl/ScePadAPI.h" -#include "SKSE/Impl/XInputAPI.h" + +#include "REX/PS4/SCEPAD.h" +#include "REX/W32/DINPUT.h" +#include "REX/W32/USER32.h" +#include "REX/W32/XINPUT.h" namespace SKSE { - using XInputButton = RE::XInput::XInputButton; - using ScePadButton = RE::ScePad::ScePadButton; - std::uint32_t InputMap::XInputToScePadOffset(std::uint32_t keyMask) { switch (keyMask) { - case XInputButton::XINPUT_GAMEPAD_DPAD_UP: - return ScePadButton::SCE_PAD_BUTTON_UP; - case XInputButton::XINPUT_GAMEPAD_DPAD_DOWN: - return ScePadButton::SCE_PAD_BUTTON_DOWN; - case XInputButton::XINPUT_GAMEPAD_DPAD_LEFT: - return ScePadButton::SCE_PAD_BUTTON_LEFT; - case XInputButton::XINPUT_GAMEPAD_DPAD_RIGHT: - return ScePadButton::SCE_PAD_BUTTON_RIGHT; - case XInputButton::XINPUT_GAMEPAD_START: - return ScePadButton::SCE_PAD_BUTTON_OPTIONS; - case XInputButton::XINPUT_GAMEPAD_BACK: - return ScePadButton::SCE_PAD_BUTTON_TOUCH_PAD; - case XInputButton::XINPUT_GAMEPAD_LEFT_THUMB: - return ScePadButton::SCE_PAD_BUTTON_L3; - case XInputButton::XINPUT_GAMEPAD_RIGHT_THUMB: - return ScePadButton::SCE_PAD_BUTTON_R3; - case XInputButton::XINPUT_GAMEPAD_LEFT_SHOULDER: - return ScePadButton::SCE_PAD_BUTTON_L1; - case XInputButton::XINPUT_GAMEPAD_RIGHT_SHOULDER: - return ScePadButton::SCE_PAD_BUTTON_R1; - case XInputButton::XINPUT_GAMEPAD_A: - return ScePadButton::SCE_PAD_BUTTON_CROSS; - case XInputButton::XINPUT_GAMEPAD_B: - return ScePadButton::SCE_PAD_BUTTON_CIRCLE; - case XInputButton::XINPUT_GAMEPAD_X: - return ScePadButton::SCE_PAD_BUTTON_SQUARE; - case XInputButton::XINPUT_GAMEPAD_Y: - return ScePadButton::SCE_PAD_BUTTON_TRIANGLE; + case REX::W32::XINPUT_GAMEPAD_DPAD_UP: + return REX::PS4::SCE_PAD_BUTTON_UP; + case REX::W32::XINPUT_GAMEPAD_DPAD_DOWN: + return REX::PS4::SCE_PAD_BUTTON_DOWN; + case REX::W32::XINPUT_GAMEPAD_DPAD_LEFT: + return REX::PS4::SCE_PAD_BUTTON_LEFT; + case REX::W32::XINPUT_GAMEPAD_DPAD_RIGHT: + return REX::PS4::SCE_PAD_BUTTON_RIGHT; + case REX::W32::XINPUT_GAMEPAD_START: + return REX::PS4::SCE_PAD_BUTTON_OPTIONS; + case REX::W32::XINPUT_GAMEPAD_BACK: + return REX::PS4::SCE_PAD_BUTTON_TOUCH_PAD; + case REX::W32::XINPUT_GAMEPAD_LEFT_THUMB: + return REX::PS4::SCE_PAD_BUTTON_L3; + case REX::W32::XINPUT_GAMEPAD_RIGHT_THUMB: + return REX::PS4::SCE_PAD_BUTTON_R3; + case REX::W32::XINPUT_GAMEPAD_LEFT_SHOULDER: + return REX::PS4::SCE_PAD_BUTTON_L1; + case REX::W32::XINPUT_GAMEPAD_RIGHT_SHOULDER: + return REX::PS4::SCE_PAD_BUTTON_R1; + case REX::W32::XINPUT_GAMEPAD_A: + return REX::PS4::SCE_PAD_BUTTON_CROSS; + case REX::W32::XINPUT_GAMEPAD_B: + return REX::PS4::SCE_PAD_BUTTON_CIRCLE; + case REX::W32::XINPUT_GAMEPAD_X: + return REX::PS4::SCE_PAD_BUTTON_SQUARE; + case REX::W32::XINPUT_GAMEPAD_Y: + return REX::PS4::SCE_PAD_BUTTON_TRIANGLE; default: return keyMask; } @@ -48,34 +48,34 @@ namespace SKSE std::uint32_t InputMap::ScePadOffsetToXInput(std::uint32_t keyMask) { switch (keyMask) { - case ScePadButton::SCE_PAD_BUTTON_UP: - return XInputButton::XINPUT_GAMEPAD_DPAD_UP; - case ScePadButton::SCE_PAD_BUTTON_DOWN: - return XInputButton::XINPUT_GAMEPAD_DPAD_DOWN; - case ScePadButton::SCE_PAD_BUTTON_LEFT: - return XInputButton::XINPUT_GAMEPAD_DPAD_LEFT; - case ScePadButton::SCE_PAD_BUTTON_RIGHT: - return XInputButton::XINPUT_GAMEPAD_DPAD_RIGHT; - case ScePadButton::SCE_PAD_BUTTON_OPTIONS: - return XInputButton::XINPUT_GAMEPAD_START; - case ScePadButton::SCE_PAD_BUTTON_TOUCH_PAD: - return XInputButton::XINPUT_GAMEPAD_BACK; - case ScePadButton::SCE_PAD_BUTTON_L3: - return XInputButton::XINPUT_GAMEPAD_LEFT_THUMB; - case ScePadButton::SCE_PAD_BUTTON_R3: - return XInputButton::XINPUT_GAMEPAD_RIGHT_THUMB; - case ScePadButton::SCE_PAD_BUTTON_L1: - return XInputButton::XINPUT_GAMEPAD_LEFT_SHOULDER; - case ScePadButton::SCE_PAD_BUTTON_R1: - return XInputButton::XINPUT_GAMEPAD_RIGHT_SHOULDER; - case ScePadButton::SCE_PAD_BUTTON_CROSS: - return XInputButton::XINPUT_GAMEPAD_A; - case ScePadButton::SCE_PAD_BUTTON_CIRCLE: - return XInputButton::XINPUT_GAMEPAD_B; - case ScePadButton::SCE_PAD_BUTTON_SQUARE: - return XInputButton::XINPUT_GAMEPAD_X; - case ScePadButton::SCE_PAD_BUTTON_TRIANGLE: - return XInputButton::XINPUT_GAMEPAD_Y; + case REX::PS4::SCE_PAD_BUTTON_UP: + return REX::W32::XINPUT_GAMEPAD_DPAD_UP; + case REX::PS4::SCE_PAD_BUTTON_DOWN: + return REX::W32::XINPUT_GAMEPAD_DPAD_DOWN; + case REX::PS4::SCE_PAD_BUTTON_LEFT: + return REX::W32::XINPUT_GAMEPAD_DPAD_LEFT; + case REX::PS4::SCE_PAD_BUTTON_RIGHT: + return REX::W32::XINPUT_GAMEPAD_DPAD_RIGHT; + case REX::PS4::SCE_PAD_BUTTON_OPTIONS: + return REX::W32::XINPUT_GAMEPAD_START; + case REX::PS4::SCE_PAD_BUTTON_TOUCH_PAD: + return REX::W32::XINPUT_GAMEPAD_BACK; + case REX::PS4::SCE_PAD_BUTTON_L3: + return REX::W32::XINPUT_GAMEPAD_LEFT_THUMB; + case REX::PS4::SCE_PAD_BUTTON_R3: + return REX::W32::XINPUT_GAMEPAD_RIGHT_THUMB; + case REX::PS4::SCE_PAD_BUTTON_L1: + return REX::W32::XINPUT_GAMEPAD_LEFT_SHOULDER; + case REX::PS4::SCE_PAD_BUTTON_R1: + return REX::W32::XINPUT_GAMEPAD_RIGHT_SHOULDER; + case REX::PS4::SCE_PAD_BUTTON_CROSS: + return REX::W32::XINPUT_GAMEPAD_A; + case REX::PS4::SCE_PAD_BUTTON_CIRCLE: + return REX::W32::XINPUT_GAMEPAD_B; + case REX::PS4::SCE_PAD_BUTTON_SQUARE: + return REX::W32::XINPUT_GAMEPAD_X; + case REX::PS4::SCE_PAD_BUTTON_TRIANGLE: + return REX::W32::XINPUT_GAMEPAD_Y; default: return keyMask; } @@ -88,33 +88,33 @@ namespace SKSE } switch (keyMask) { - case XInputButton::XINPUT_GAMEPAD_DPAD_UP: + case REX::W32::XINPUT_GAMEPAD_DPAD_UP: return kGamepadButtonOffset_DPAD_UP; - case XInputButton::XINPUT_GAMEPAD_DPAD_DOWN: + case REX::W32::XINPUT_GAMEPAD_DPAD_DOWN: return kGamepadButtonOffset_DPAD_DOWN; - case XInputButton::XINPUT_GAMEPAD_DPAD_LEFT: + case REX::W32::XINPUT_GAMEPAD_DPAD_LEFT: return kGamepadButtonOffset_DPAD_LEFT; - case XInputButton::XINPUT_GAMEPAD_DPAD_RIGHT: + case REX::W32::XINPUT_GAMEPAD_DPAD_RIGHT: return kGamepadButtonOffset_DPAD_RIGHT; - case XInputButton::XINPUT_GAMEPAD_START: + case REX::W32::XINPUT_GAMEPAD_START: return kGamepadButtonOffset_START; - case XInputButton::XINPUT_GAMEPAD_BACK: + case REX::W32::XINPUT_GAMEPAD_BACK: return kGamepadButtonOffset_BACK; - case XInputButton::XINPUT_GAMEPAD_LEFT_THUMB: + case REX::W32::XINPUT_GAMEPAD_LEFT_THUMB: return kGamepadButtonOffset_LEFT_THUMB; - case XInputButton::XINPUT_GAMEPAD_RIGHT_THUMB: + case REX::W32::XINPUT_GAMEPAD_RIGHT_THUMB: return kGamepadButtonOffset_RIGHT_THUMB; - case XInputButton::XINPUT_GAMEPAD_LEFT_SHOULDER: + case REX::W32::XINPUT_GAMEPAD_LEFT_SHOULDER: return kGamepadButtonOffset_LEFT_SHOULDER; - case XInputButton::XINPUT_GAMEPAD_RIGHT_SHOULDER: + case REX::W32::XINPUT_GAMEPAD_RIGHT_SHOULDER: return kGamepadButtonOffset_RIGHT_SHOULDER; - case XInputButton::XINPUT_GAMEPAD_A: + case REX::W32::XINPUT_GAMEPAD_A: return kGamepadButtonOffset_A; - case XInputButton::XINPUT_GAMEPAD_B: + case REX::W32::XINPUT_GAMEPAD_B: return kGamepadButtonOffset_B; - case XInputButton::XINPUT_GAMEPAD_X: + case REX::W32::XINPUT_GAMEPAD_X: return kGamepadButtonOffset_X; - case XInputButton::XINPUT_GAMEPAD_Y: + case REX::W32::XINPUT_GAMEPAD_Y: return kGamepadButtonOffset_Y; case 0x9: // Left Trigger game-defined ID return kGamepadButtonOffset_LT; @@ -131,46 +131,46 @@ namespace SKSE switch (keyCode) { case kGamepadButtonOffset_DPAD_UP: - keyMask = XInputButton::XINPUT_GAMEPAD_DPAD_UP; + keyMask = REX::W32::XINPUT_GAMEPAD_DPAD_UP; break; case kGamepadButtonOffset_DPAD_DOWN: - keyMask = XInputButton::XINPUT_GAMEPAD_DPAD_DOWN; + keyMask = REX::W32::XINPUT_GAMEPAD_DPAD_DOWN; break; case kGamepadButtonOffset_DPAD_LEFT: - keyMask = XInputButton::XINPUT_GAMEPAD_DPAD_LEFT; + keyMask = REX::W32::XINPUT_GAMEPAD_DPAD_LEFT; break; case kGamepadButtonOffset_DPAD_RIGHT: - keyMask = XInputButton::XINPUT_GAMEPAD_DPAD_RIGHT; + keyMask = REX::W32::XINPUT_GAMEPAD_DPAD_RIGHT; break; case kGamepadButtonOffset_START: - keyMask = XInputButton::XINPUT_GAMEPAD_START; + keyMask = REX::W32::XINPUT_GAMEPAD_START; break; case kGamepadButtonOffset_BACK: - keyMask = XInputButton::XINPUT_GAMEPAD_BACK; + keyMask = REX::W32::XINPUT_GAMEPAD_BACK; break; case kGamepadButtonOffset_LEFT_THUMB: - keyMask = XInputButton::XINPUT_GAMEPAD_LEFT_THUMB; + keyMask = REX::W32::XINPUT_GAMEPAD_LEFT_THUMB; break; case kGamepadButtonOffset_RIGHT_THUMB: - keyMask = XInputButton::XINPUT_GAMEPAD_RIGHT_THUMB; + keyMask = REX::W32::XINPUT_GAMEPAD_RIGHT_THUMB; break; case kGamepadButtonOffset_LEFT_SHOULDER: - keyMask = XInputButton::XINPUT_GAMEPAD_LEFT_SHOULDER; + keyMask = REX::W32::XINPUT_GAMEPAD_LEFT_SHOULDER; break; case kGamepadButtonOffset_RIGHT_SHOULDER: - keyMask = XInputButton::XINPUT_GAMEPAD_RIGHT_SHOULDER; + keyMask = REX::W32::XINPUT_GAMEPAD_RIGHT_SHOULDER; break; case kGamepadButtonOffset_A: - keyMask = XInputButton::XINPUT_GAMEPAD_A; + keyMask = REX::W32::XINPUT_GAMEPAD_A; break; case kGamepadButtonOffset_B: - keyMask = XInputButton::XINPUT_GAMEPAD_B; + keyMask = REX::W32::XINPUT_GAMEPAD_B; break; case kGamepadButtonOffset_X: - keyMask = XInputButton::XINPUT_GAMEPAD_X; + keyMask = REX::W32::XINPUT_GAMEPAD_X; break; case kGamepadButtonOffset_Y: - keyMask = XInputButton::XINPUT_GAMEPAD_Y; + keyMask = REX::W32::XINPUT_GAMEPAD_Y; break; case kGamepadButtonOffset_LT: keyMask = 0x9; // Left Trigger game-defined ID @@ -205,49 +205,47 @@ namespace SKSE { std::int32_t scancode = static_cast(a_keyCode & 0xFF); - using DIKey = RE::DirectInput8::DIKey; - switch (scancode) { - case DIKey::DIK_NUMPADENTER: // Numpad Enter + case REX::W32::DIK_NUMPADENTER: // Numpad Enter scancode = 0x11C; break; - case DIKey::DIK_RCONTROL: // Right Control + case REX::W32::DIK_RCONTROL: // Right Control scancode = 0x11D; break; - case DIKey::DIK_DIVIDE: // Numpad / + case REX::W32::DIK_DIVIDE: // Numpad / scancode = 0x135; break; - case DIKey::DIK_RALT: // Right Alt + case REX::W32::DIK_RALT: // Right Alt scancode = 0x138; break; - case DIKey::DIK_HOME: // Home + case REX::W32::DIK_HOME: // Home scancode = 0x147; break; - case DIKey::DIK_UPARROW: // Up Arrow + case REX::W32::DIK_UPARROW: // Up Arrow scancode = 0x148; break; - case DIKey::DIK_PGUP: // Page Up + case REX::W32::DIK_PGUP: // Page Up scancode = 0x149; break; - case DIKey::DIK_LEFTARROW: // Left Arrow + case REX::W32::DIK_LEFTARROW: // Left Arrow scancode = 0x14B; break; - case DIKey::DIK_RIGHTARROW: // Right Arrow + case REX::W32::DIK_RIGHTARROW: // Right Arrow scancode = 0x14D; break; - case DIKey::DIK_END: // End + case REX::W32::DIK_END: // End scancode = 0x14F; break; - case DIKey::DIK_DOWNARROW: // Down Arrow + case REX::W32::DIK_DOWNARROW: // Down Arrow scancode = 0x150; break; - case DIKey::DIK_PGDN: // Page Down + case REX::W32::DIK_PGDN: // Page Down scancode = 0x151; break; - case DIKey::DIK_INSERT: // Insert + case REX::W32::DIK_INSERT: // Insert scancode = 0x152; break; - case DIKey::DIK_DELETE: // Delete + case REX::W32::DIK_DELETE: // Delete scancode = 0x153; break; } @@ -258,8 +256,8 @@ namespace SKSE lParam |= (0x1 << 24); } - wchar_t buffer[WinAPI::MAX_PATH]; - auto length = WinAPI::GetKeyNameText(lParam, buffer, WinAPI::MAX_PATH); + wchar_t buffer[REX::W32::MAX_PATH]; + auto length = REX::W32::GetKeyNameTextW(lParam, buffer, REX::W32::MAX_PATH); std::wstring keyNameW{ buffer, static_cast(length) }; return stl::utf16_to_utf8(keyNameW).value_or(""s); diff --git a/src/SKSE/Logger.cpp b/src/SKSE/Logger.cpp index c212b95d6..0da3d86b9 100644 --- a/src/SKSE/Logger.cpp +++ b/src/SKSE/Logger.cpp @@ -1,9 +1,11 @@ #include "SKSE/Logger.h" #include "RE/V/VirtualMachine.h" + #include "SKSE/API.h" -#include +#include "REX/W32/OLE32.h" +#include "REX/W32/SHELL32.h" namespace SKSE { @@ -63,10 +65,10 @@ namespace SKSE { std::optional log_directory() { - wchar_t* buffer{ nullptr }; - const auto result = ::SHGetKnownFolderPath(::FOLDERID_Documents, ::KNOWN_FOLDER_FLAG::KF_FLAG_DEFAULT, nullptr, std::addressof(buffer)); - std::unique_ptr knownPath(buffer, ::CoTaskMemFree); - if (!knownPath || result != S_OK) { + wchar_t* buffer{ nullptr }; + const auto result = REX::W32::SHGetKnownFolderPath(REX::W32::FOLDERID_Documents, REX::W32::KF_FLAG_DEFAULT, nullptr, std::addressof(buffer)); + std::unique_ptr knownPath(buffer, REX::W32::CoTaskMemFree); + if (!knownPath || result != 0) { error("failed to get known folder path"sv); return std::nullopt; } diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp index 1de3f6be0..851c9955d 100644 --- a/src/SKSE/Trampoline.cpp +++ b/src/SKSE/Trampoline.cpp @@ -2,52 +2,15 @@ #include "SKSE/Logger.h" -#define WIN32_LEAN_AND_MEAN - -#define NOGDICAPMASKS -#define NOVIRTUALKEYCODES -//#define NOWINMESSAGES -#define NOWINSTYLES -#define NOSYSMETRICS -#define NOMENUS -#define NOICONS -#define NOKEYSTATES -#define NOSYSCOMMANDS -#define NORASTEROPS -#define NOSHOWWINDOW -#define OEMRESOURCE -#define NOATOM -#define NOCLIPBOARD -#define NOCOLOR -//#define NOCTLMGR -#define NODRAWTEXT -#define NOGDI -#define NOKERNEL -//#define NOUSER -#define NONLS -//#define NOMB -#define NOMEMMGR -#define NOMETAFILE -#define NOMINMAX -//#define NOMSG -#define NOOPENFILE -#define NOSCROLL -#define NOSERVICE -#define NOSOUND -#define NOTEXTMETRIC -#define NOWH -#define NOWINOFFSETS -#define NOCOMM -#define NOKANJI -#define NOHELP -#define NOPROFILER -#define NODEFERWINDOWPOS -#define NOMCX - -#include +#include "REX/W32/KERNEL32.h" +// xbyak brings in #ifdef SKSE_SUPPORT_XBYAK # include +# undef MEM_COMMIT +# undef MEM_FREE +# undef MEM_RESERVE +# undef PAGE_EXECUTE_READWRITE #endif namespace SKSE @@ -69,36 +32,34 @@ namespace SKSE constexpr std::size_t minRange = gigabyte * 2; constexpr std::uintptr_t maxAddr = std::numeric_limits::max(); - ::DWORD granularity; - ::SYSTEM_INFO si; - ::GetSystemInfo(&si); - granularity = si.dwAllocationGranularity; + REX::W32::SYSTEM_INFO si; + REX::W32::GetSystemInfo(&si); + const std::uint32_t granularity = si.allocationGranularity; std::uintptr_t min = a_address >= minRange ? detail::roundup(a_address - minRange, granularity) : 0; const std::uintptr_t max = a_address < (maxAddr - minRange) ? detail::rounddown(a_address + minRange, granularity) : maxAddr; - std::uintptr_t addr; - ::MEMORY_BASIC_INFORMATION mbi; + REX::W32::MEMORY_BASIC_INFORMATION mbi; do { - if (!::VirtualQuery(reinterpret_cast(min), std::addressof(mbi), sizeof(mbi))) { - log::error("VirtualQuery failed with code: 0x{:08X}"sv, ::GetLastError()); + if (!REX::W32::VirtualQuery(reinterpret_cast(min), std::addressof(mbi), sizeof(mbi))) { + log::error("VirtualQuery failed with code: 0x{:08X}"sv, REX::W32::GetLastError()); return nullptr; } - auto baseAddr = reinterpret_cast(mbi.BaseAddress); - min = baseAddr + mbi.RegionSize; + const auto baseAddr = reinterpret_cast(mbi.baseAddress); + min = baseAddr + mbi.regionSize; - if (mbi.State == MEM_FREE) { - addr = detail::roundup(baseAddr, granularity); + if (mbi.state == REX::W32::MEM_FREE) { + const std::uintptr_t addr = detail::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) { - auto mem = ::VirtualAlloc(reinterpret_cast(addr), a_size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); + 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; - } else { - log::warn("VirtualAlloc failed with code: 0x{:08X}"sv, ::GetLastError()); } + log::warn("VirtualAlloc failed with code: 0x{:08X}"sv, REX::W32::GetLastError()); } } } while (min < max); @@ -108,9 +69,7 @@ namespace SKSE void Trampoline::log_stats() const { - auto pct = (static_cast(_size) / - static_cast(_capacity)) * - 100.0; + const auto pct = (static_cast(_size) / static_cast(_capacity)) * 100.0; log::debug("{} => {}B / {}B ({:05.2f}%)"sv, _name, _size, _capacity, pct); } } From 8a3d9611de81a4090c2a91c076ae3f36b4ddf829 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:02:20 -0600 Subject: [PATCH 56/76] It's always MIN/MAX --- src/SKSE/Trampoline.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp index 851c9955d..f310d3c26 100644 --- a/src/SKSE/Trampoline.cpp +++ b/src/SKSE/Trampoline.cpp @@ -7,6 +7,7 @@ // xbyak brings in #ifdef SKSE_SUPPORT_XBYAK # include +# undef max # undef MEM_COMMIT # undef MEM_FREE # undef MEM_RESERVE From 6510df45beb342766e058ac7763863993b358632 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Fri, 23 Feb 2024 21:59:09 +0000 Subject: [PATCH 57/76] maintenance --- include/RE/A/AIProcess.h | 4 +- include/RE/A/Actor.h | 2 +- include/RE/B/BSPCOrbisGamepadDevice.h | 2 +- include/RE/P/Precipitation.h | 10 +- include/REL/Relocation.h | 8 +- include/REX/PS4/SCEPAD.h | 34 +- include/REX/W32/BASE.h | 12 +- include/REX/W32/COM.h | 2 +- include/REX/W32/COMPTR.h | 6 +- include/REX/W32/D3D.h | 1002 ++++++++++----------- include/REX/W32/D3D11.h | 1148 ++++++++++++------------- include/REX/W32/D3D11_1.h | 74 +- include/REX/W32/D3D11_2.h | 26 +- include/REX/W32/D3D11_3.h | 48 +- include/REX/W32/D3D11_4.h | 16 +- include/REX/W32/D3DCOMPILER.h | 88 +- include/REX/W32/DINPUT.h | 336 ++++---- include/REX/W32/DXGI.h | 362 ++++---- include/REX/W32/DXGI_2.h | 46 +- include/REX/W32/DXGI_3.h | 30 +- include/REX/W32/DXGI_4.h | 14 +- include/REX/W32/DXGI_5.h | 10 +- include/REX/W32/DXGI_6.h | 22 +- include/REX/W32/KERNEL32.h | 154 ++-- include/REX/W32/SHELL32.h | 2 +- include/REX/W32/USER32.h | 522 +++++------ include/REX/W32/VERSION.h | 8 +- include/REX/W32/XINPUT.h | 28 +- src/RE/R/Renderer.cpp | 2 +- src/REX/W32/D3D11.cpp | 2 +- src/REX/W32/D3DCOMPILER.cpp | 4 +- src/REX/W32/KERNEL32.cpp | 2 +- src/SKSE/Logger.cpp | 4 +- src/SKSE/Trampoline.cpp | 4 +- 34 files changed, 2017 insertions(+), 2017 deletions(-) diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index 550d3ef4c..bf82a4bbd 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -136,8 +136,8 @@ namespace RE struct EquippedObject { - TESForm* object; // 00 - BGSEquipSlot* slot; // 08 + TESForm* object; // 00 + BGSEquipSlot* slot; // 08 }; static_assert(sizeof(EquippedObject) == 0x10); diff --git a/include/RE/A/Actor.h b/include/RE/A/Actor.h index 13dd763ae..cdb45802d 100644 --- a/include/RE/A/Actor.h +++ b/include/RE/A/Actor.h @@ -530,7 +530,7 @@ namespace RE const TESShout* GetCurrentShout() const; InventoryEntryData* GetEquippedEntryData(bool a_leftHand) const; TESForm* GetEquippedObject(bool a_leftHand) const; - TESForm* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const; + TESForm* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const; float GetEquippedWeight(); std::int32_t GetFactionRank(TESFaction* a_faction, bool a_isPlayer); std::int32_t GetGoldAmount(bool a_noInit = false); diff --git a/include/RE/B/BSPCOrbisGamepadDevice.h b/include/RE/B/BSPCOrbisGamepadDevice.h index b5e0a4be0..635c058cf 100644 --- a/include/RE/B/BSPCOrbisGamepadDevice.h +++ b/include/RE/B/BSPCOrbisGamepadDevice.h @@ -24,7 +24,7 @@ namespace RE kLeft = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_LEFT, kRight = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_RIGHT, kPS3_Start = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_OPTIONS, - kPS3_Back = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_TOUCH_PAD, // This is mapped to the touchpad on the PS4 controller + kPS3_Back = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_TOUCH_PAD, // This is mapped to the touchpad on the PS4 controller kPS3_L3 = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_L3, kPS3_R3 = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_R3, kPS3_LB = REX::PS4::SCE_PAD_BUTTON::SCE_PAD_BUTTON_L1, diff --git a/include/RE/P/Precipitation.h b/include/RE/P/Precipitation.h index 9b2555d7f..7e7dcf9dc 100644 --- a/include/RE/P/Precipitation.h +++ b/include/RE/P/Precipitation.h @@ -21,11 +21,11 @@ namespace RE { public: // members - alignas(0x10) REX::W32::XMFLOAT4X4 projection; // 00 - NiPointer camera; // 40 - NiPointer accumulator; // 48 - BSCullingProcess* cullingProcess; // 50 - std::uint64_t pad58; // 58 + alignas(0x10) REX::W32::XMFLOAT4X4 projection; // 00 + NiPointer camera; // 40 + NiPointer accumulator; // 48 + BSCullingProcess* cullingProcess; // 50 + std::uint64_t pad58; // 58 }; static_assert(sizeof(OcclusionMapData) == 0x60); diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index 93e27e53d..a96e1c48a 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -190,8 +190,8 @@ namespace REL inline void safe_write(std::uintptr_t a_dst, const void* a_src, std::size_t a_count) { std::uint32_t old{ 0 }; - bool success = REX::W32::VirtualProtect( - reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); + bool success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); if (success) { std::memcpy(reinterpret_cast(a_dst), a_src, a_count); success = REX::W32::VirtualProtect( @@ -216,8 +216,8 @@ namespace REL inline void safe_fill(std::uintptr_t a_dst, std::uint8_t a_value, std::size_t a_count) { std::uint32_t old{ 0 }; - bool success = REX::W32::VirtualProtect( - reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); + bool success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); if (success) { std::fill_n(reinterpret_cast(a_dst), a_count, a_value); success = REX::W32::VirtualProtect( diff --git a/include/REX/PS4/SCEPAD.h b/include/REX/PS4/SCEPAD.h index dd8c8ea88..fa88dfc26 100644 --- a/include/REX/PS4/SCEPAD.h +++ b/include/REX/PS4/SCEPAD.h @@ -4,24 +4,24 @@ namespace REX::PS4 { enum SCE_PAD_BUTTON : std::uint32_t { - SCE_PAD_BUTTON_SHARE = 0x00000001, - SCE_PAD_BUTTON_L3 = 0x00000002, - SCE_PAD_BUTTON_R3 = 0x00000004, - SCE_PAD_BUTTON_OPTIONS = 0x00000008, - SCE_PAD_BUTTON_UP = 0x00000010, - SCE_PAD_BUTTON_RIGHT = 0x00000020, - SCE_PAD_BUTTON_DOWN = 0x00000040, - SCE_PAD_BUTTON_LEFT = 0x00000080, - SCE_PAD_BUTTON_L2 = 0x00000100, - SCE_PAD_BUTTON_R2 = 0x00000200, - SCE_PAD_BUTTON_L1 = 0x00000400, - SCE_PAD_BUTTON_R1 = 0x00000800, - SCE_PAD_BUTTON_TRIANGLE = 0x00001000, - SCE_PAD_BUTTON_CIRCLE = 0x00002000, - SCE_PAD_BUTTON_CROSS = 0x00004000, - SCE_PAD_BUTTON_SQUARE = 0x00008000, + SCE_PAD_BUTTON_SHARE = 0x00000001, + SCE_PAD_BUTTON_L3 = 0x00000002, + SCE_PAD_BUTTON_R3 = 0x00000004, + SCE_PAD_BUTTON_OPTIONS = 0x00000008, + SCE_PAD_BUTTON_UP = 0x00000010, + SCE_PAD_BUTTON_RIGHT = 0x00000020, + SCE_PAD_BUTTON_DOWN = 0x00000040, + SCE_PAD_BUTTON_LEFT = 0x00000080, + SCE_PAD_BUTTON_L2 = 0x00000100, + SCE_PAD_BUTTON_R2 = 0x00000200, + SCE_PAD_BUTTON_L1 = 0x00000400, + SCE_PAD_BUTTON_R1 = 0x00000800, + SCE_PAD_BUTTON_TRIANGLE = 0x00001000, + SCE_PAD_BUTTON_CIRCLE = 0x00002000, + SCE_PAD_BUTTON_CROSS = 0x00004000, + SCE_PAD_BUTTON_SQUARE = 0x00008000, SCE_PAD_BUTTON_PLAYSTATION = 0x00010000, - SCE_PAD_BUTTON_TOUCH_PAD = 0x00100000, + SCE_PAD_BUTTON_TOUCH_PAD = 0x00100000, SCE_PAD_BUTTON_INTERCEPTED = 0x80000000, }; } diff --git a/include/REX/W32/BASE.h b/include/REX/W32/BASE.h index 1da8accaf..9171dd60f 100644 --- a/include/REX/W32/BASE.h +++ b/include/REX/W32/BASE.h @@ -1,11 +1,11 @@ #pragma once #ifdef _INC_WINAPIFAMILY -#error Windows API detected. Please move any Windows API includes after CommonLib, or remove them. +# 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;\ +#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 @@ -22,15 +22,15 @@ namespace REX::W32 using HKEY = struct HKEY__*; using HMENU = struct HMENU__*; using HMODULE = HINSTANCE; - using HMONITOR = struct HMONITOR__*; + using HMONITOR = struct HMONITOR__*; using HPALETTE = struct HPALETTE__*; using HPEN = struct HPEN__*; using HSTRING = struct HSTRING__*; - using HWND = struct HWND__*; + using HWND = struct HWND__*; // general constants inline const auto INVALID_HANDLE_VALUE{ reinterpret_cast(static_cast(-1)) }; - inline constexpr auto MAX_PATH{ 260u }; + inline constexpr auto MAX_PATH{ 260u }; } namespace REX::W32 diff --git a/include/REX/W32/COM.h b/include/REX/W32/COM.h index 414801252..ad60061f8 100644 --- a/include/REX/W32/COM.h +++ b/include/REX/W32/COM.h @@ -7,7 +7,7 @@ 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 HRESULT QueryInterface(const IID& a_iid, void** a_object) = 0; virtual std::uint32_t AddRef() = 0; virtual std::uint32_t Release() = 0; diff --git a/include/REX/W32/COMPTR.h b/include/REX/W32/COMPTR.h index b80769fa1..eb485a113 100644 --- a/include/REX/W32/COMPTR.h +++ b/include/REX/W32/COMPTR.h @@ -58,7 +58,7 @@ namespace REX::W32 return *this; } - template + template ComPtr& operator=(const ComPtr& a_other) noexcept { ComPtr(a_other).Swap(*this); @@ -71,7 +71,7 @@ namespace REX::W32 return *this; } - template + template ComPtr& operator=(ComPtr&& a_other) noexcept { ComPtr(static_cast&&>(a_other)).Swap(*this); @@ -167,7 +167,7 @@ namespace REX::W32 template HRESULT CopyTo(U** a_ptr) const noexcept { - return _ptr->QueryInterface(__uuidof(U), reinterpret_cast(a_ptr)); + return _ptr->QueryInterface(__uuidof(U), reinterpret_cast(a_ptr)); } protected: diff --git a/include/REX/W32/D3D.h b/include/REX/W32/D3D.h index 9c60bcad6..669d80782 100644 --- a/include/REX/W32/D3D.h +++ b/include/REX/W32/D3D.h @@ -13,203 +13,203 @@ 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, + 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_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), + 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, + 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_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_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, + 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_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, + 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, + 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, + 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_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, + 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, @@ -237,78 +237,78 @@ namespace REX::W32 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, + 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, @@ -335,335 +335,335 @@ namespace REX::W32 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, + 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_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, + 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, + D3D_CBF_USERPACKED = 1, D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED, - D3D_CBF_FORCE_DWORD = 0x7FFFFFFF, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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, + 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_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, + 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, + 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, + 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, + 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, + 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, }; } @@ -710,7 +710,7 @@ namespace REX::W32 struct __declspec(novtable, uuid("8BA5FB08-5195-40e2-AC58-0D989C3A0102")) ID3DBlob : public IUnknown { - virtual void* GetBufferPointer(void) = 0; + virtual void* GetBufferPointer(void) = 0; virtual std::size_t GetBufferSize(void) = 0; }; @@ -721,7 +721,7 @@ namespace REX::W32 virtual HRESULT UnregisterDestructionCallback(std::uint32_t a_callbackID) = 0; }; - struct __declspec(novtable) // uuid(?) + 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; diff --git a/include/REX/W32/D3D11.h b/include/REX/W32/D3D11.h index 2a5aaab56..32ed9df36 100644 --- a/include/REX/W32/D3D11.h +++ b/include/REX/W32/D3D11.h @@ -56,59 +56,59 @@ namespace REX::W32 enum D3D11_AUTHENTICATED_CHANNEL_TYPE { - D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1, + 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_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, + 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_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, + 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, + 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_RAW = 0x1, + D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4, }; @@ -119,48 +119,48 @@ namespace REX::W32 enum D3D11_CLEAR_FLAG { - D3D11_CLEAR_DEPTH = 0x1L, + D3D11_CLEAR_DEPTH = 0x1L, D3D11_CLEAR_STENCIL = 0x2L, }; enum D3D11_COLOR_WRITE_ENABLE { - D3D11_COLOR_WRITE_ENABLE_RED = 1, + D3D11_COLOR_WRITE_ENABLE_RED = 1, D3D11_COLOR_WRITE_ENABLE_GREEN = 2, - D3D11_COLOR_WRITE_ENABLE_BLUE = 4, + 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), + 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_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, + 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_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, }; @@ -172,215 +172,215 @@ namespace REX::W32 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), + 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, + 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_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, + D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100, + D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800, }; enum D3D11_CULL_MODE { - D3D11_CULL_NONE = 1, + D3D11_CULL_NONE = 1, D3D11_CULL_FRONT = 2, - D3D11_CULL_BACK = 3, + D3D11_CULL_BACK = 3, }; enum D3D11_DEPTH_WRITE_MASK { D3D11_DEPTH_WRITE_MASK_ZERO = 0, - D3D11_DEPTH_WRITE_MASK_ALL = 1, + 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), + 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_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_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_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), + 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, + 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_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, + 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_POINT = 0, D3D11_FILTER_TYPE_LINEAR = 1, }; enum D3D11_FILTER_REDUCTION_TYPE { - D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, + D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, D3D11_FILTER_REDUCTION_TYPE_COMPARISON = 1, - D3D11_FILTER_REDUCTION_TYPE_MINIMUM = 2, - D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = 3, + 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_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, + 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_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, + 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_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_READ = 1, + D3D11_MAP_WRITE = 2, + D3D11_MAP_READ_WRITE = 3, + D3D11_MAP_WRITE_DISCARD = 4, D3D11_MAP_WRITE_NO_OVERWRITE = 5, }; @@ -394,21 +394,21 @@ namespace REX::W32 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_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_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_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_STATISTICS_STREAM3 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 + 1), D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = (D3D11_QUERY_SO_STATISTICS_STREAM3 + 1), }; @@ -424,8 +424,8 @@ namespace REX::W32 enum D3D11_RESOURCE_DIMENSION { - D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D11_RESOURCE_DIMENSION_BUFFER = 1, + 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, @@ -433,38 +433,38 @@ namespace REX::W32 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_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, + 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_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, + D3D11_RTV_DIMENSION_TEXTURE3D = 8, }; using D3D11_SRV_DIMENSION = D3D_SRV_DIMENSION; @@ -472,27 +472,27 @@ namespace REX::W32 enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS { D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xFFFFFFFF, - D3D11_CENTER_MULTISAMPLE_PATTERN = 0xFFFFFFFE, + 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_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, + 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_WRAP = 1, + D3D11_TEXTURE_ADDRESS_MIRROR = 2, + D3D11_TEXTURE_ADDRESS_CLAMP = 3, + D3D11_TEXTURE_ADDRESS_BORDER = 4, D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5, }; @@ -508,223 +508,223 @@ namespace REX::W32 enum D3D11_UAV_DIMENSION { - D3D11_UAV_DIMENSION_UNKNOWN = 0, - D3D11_UAV_DIMENSION_BUFFER = 1, - D3D11_UAV_DIMENSION_TEXTURE1D = 2, + 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_TEXTURE2D = 4, D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_UAV_DIMENSION_TEXTURE3D = 8, + D3D11_UAV_DIMENSION_TEXTURE3D = 8, }; enum D3D11_USAGE { - D3D11_USAGE_DEFAULT = 0, + D3D11_USAGE_DEFAULT = 0, D3D11_USAGE_IMMUTABLE = 1, - D3D11_USAGE_DYNAMIC = 2, - D3D11_USAGE_STAGING = 3, + D3D11_USAGE_DYNAMIC = 2, + D3D11_USAGE_STAGING = 3, }; enum D3D11_VDOV_DIMENSION { - D3D11_VDOV_DIMENSION_UNKNOWN = 0, + D3D11_VDOV_DIMENSION_UNKNOWN = 0, D3D11_VDOV_DIMENSION_TEXTURE2D = 1, }; enum D3D11_VPIV_DIMENSION { - D3D11_VPIV_DIMENSION_UNKNOWN = 0, + 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_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_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, + 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_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_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_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, + 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_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, + 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_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, + 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_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, + 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_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, + 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_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_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_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, + 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, + 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_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_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, + 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, + 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_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, + 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_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_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, + 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_SPEED = 1, D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = 2, }; } @@ -761,12 +761,12 @@ namespace REX::W32 struct D3D11_BUFFER_RTV { - union + union { std::uint32_t firstElement; std::uint32_t elementOffset; }; - union + union { std::uint32_t numElements; std::uint32_t elementWidth; @@ -775,12 +775,12 @@ namespace REX::W32 struct D3D11_BUFFER_SRV { - union + union { std::uint32_t firstElement; std::uint32_t elementOffset; }; - union + union { std::uint32_t numElements; std::uint32_t elementWidth; @@ -1177,10 +1177,10 @@ namespace REX::W32 struct D3D11_DEPTH_STENCIL_VIEW_DESC { - DXGI_FORMAT format; - D3D11_DSV_DIMENSION viewDimension; - std::uint32_t flags; - union + DXGI_FORMAT format; + D3D11_DSV_DIMENSION viewDimension; + std::uint32_t flags; + union { D3D11_TEX1D_DSV texture1D; D3D11_TEX1D_ARRAY_DSV texture1DArray; @@ -1207,9 +1207,9 @@ namespace REX::W32 struct D3D11_RENDER_TARGET_VIEW_DESC { - DXGI_FORMAT format; - D3D11_RTV_DIMENSION viewDimension; - union + DXGI_FORMAT format; + D3D11_RTV_DIMENSION viewDimension; + union { D3D11_BUFFER_RTV buffer; D3D11_TEX1D_RTV texture1D; @@ -1224,9 +1224,9 @@ namespace REX::W32 struct D3D11_SHADER_RESOURCE_VIEW_DESC { - DXGI_FORMAT format; - D3D11_SRV_DIMENSION viewDimension; - union + DXGI_FORMAT format; + D3D11_SRV_DIMENSION viewDimension; + union { D3D11_BUFFER_SRV buffer; D3D11_TEX1D_SRV texture1D; @@ -1283,8 +1283,8 @@ namespace REX::W32 struct D3D11_UNORDERED_ACCESS_VIEW_DESC { - DXGI_FORMAT format; - D3D11_UAV_DIMENSION viewDimension; + DXGI_FORMAT format; + D3D11_UAV_DIMENSION viewDimension; union { D3D11_BUFFER_UAV buffer; @@ -1314,7 +1314,7 @@ namespace REX::W32 struct D3D11_VIDEO_COLOR { - union + union { D3D11_VIDEO_COLOR_YCbCrA ycbcr; D3D11_VIDEO_COLOR_RGBA rgba; @@ -1412,12 +1412,12 @@ namespace REX::W32 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; + 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 @@ -1460,7 +1460,7 @@ namespace REX::W32 struct D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC { - D3D11_VPOV_DIMENSION viewDimension; + D3D11_VPOV_DIMENSION viewDimension; union { D3D11_TEX2D_VPOV texture2D; @@ -1504,7 +1504,7 @@ namespace REX::W32 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; + 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) @@ -1519,52 +1519,52 @@ 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 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; + 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 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; @@ -1573,114 +1573,114 @@ namespace REX::W32 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 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; + 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")) @@ -1694,7 +1694,7 @@ namespace REX::W32 { 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; + virtual void GetChannelHandle(HANDLE* a_channelHandle) = 0; }; struct __declspec(novtable, uuid("75b68faa-347d-4159-8f45-a0640f01cd9a")) @@ -1738,11 +1738,11 @@ namespace REX::W32 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 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; + virtual void GetCryptoSessionHandle(HANDLE* a_cryptoSessionHandle) = 0; }; struct __declspec(novtable, uuid("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1")) @@ -1780,8 +1780,8 @@ namespace REX::W32 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 void GetType(D3D11_RESOURCE_DIMENSION* a_resourceDimension) = 0; + virtual void SetEvictionPriority(std::uint32_t a_evictionPriority) = 0; virtual std::uint32_t GetEvictionPriority(void) = 0; }; @@ -1868,58 +1868,58 @@ namespace REX::W32 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 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 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 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 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 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; + 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")) @@ -1938,23 +1938,23 @@ namespace REX::W32 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 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; + 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")) diff --git a/include/REX/W32/D3D11_1.h b/include/REX/W32/D3D11_1.h index b8b1de79e..6a0328a19 100644 --- a/include/REX/W32/D3D11_1.h +++ b/include/REX/W32/D3D11_1.h @@ -25,56 +25,56 @@ namespace REX::W32 enum D3D11_COPY_FLAGS { D3D11_COPY_NO_OVERWRITE = 0x1, - D3D11_COPY_DISCARD = 0x2, + 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_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_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), + 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 = 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, + 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_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, + 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; @@ -195,8 +195,8 @@ namespace REX::W32 { 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; + virtual void SetMarker(const wchar_t* a_name) = 0; + virtual BOOL GetStatus(void) = 0; }; struct __declspec(novtable, uuid("cc86fabe-da55-401d-85e7-e3c9de2877e9")) @@ -208,7 +208,7 @@ namespace REX::W32 struct __declspec(novtable, uuid("a04bfb29-08ef-43d6-a49c-a9bdbdcbe686")) ID3D11Device1 : public ID3D11Device { - virtual void GetImmediateContext1(ID3D11DeviceContext1** a_immediateContext) = 0; + 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; @@ -255,14 +255,14 @@ namespace REX::W32 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 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; }; diff --git a/include/REX/W32/D3D11_2.h b/include/REX/W32/D3D11_2.h index b8809920c..0d9e1a094 100644 --- a/include/REX/W32/D3D11_2.h +++ b/include/REX/W32/D3D11_2.h @@ -17,7 +17,7 @@ namespace REX::W32 enum D3D11_TILE_COPY_FLAG { - D3D11_TILE_COPY_NO_OVERWRITE = 0x1, + 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, }; @@ -26,11 +26,11 @@ namespace REX::W32 { D3D11_TILE_MAPPING_NO_OVERWRITE = 0x1, }; - + enum D3D11_TILE_RANGE_FLAG { - D3D11_TILE_RANGE_NULL = 0x1, - D3D11_TILE_RANGE_SKIP = 0x2, + D3D11_TILE_RANGE_NULL = 0x1, + D3D11_TILE_RANGE_SKIP = 0x2, D3D11_TILE_RANGE_REUSE_SINGLE_TILE = 0x4, }; } @@ -83,9 +83,9 @@ namespace REX::W32 struct __declspec(novtable, uuid("9d06dffa-d1e5-4d07-83a8-1bb123f2f841")) ID3D11Device2 : public ID3D11Device1 { - virtual void GetImmediateContext2(ID3D11DeviceContext2** a_immediateContext) = 0; + 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 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; }; @@ -94,14 +94,14 @@ namespace REX::W32 { 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 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; + 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; }; } diff --git a/include/REX/W32/D3D11_3.h b/include/REX/W32/D3D11_3.h index 1c6222873..9ad54f484 100644 --- a/include/REX/W32/D3D11_3.h +++ b/include/REX/W32/D3D11_3.h @@ -22,30 +22,30 @@ namespace REX::W32 enum D3D11_CONSERVATIVE_RASTERIZATION_MODE { D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, - D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, + D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, }; enum D3D11_CONTEXT_TYPE { - D3D11_CONTEXT_TYPE_ALL = 0, - D3D11_CONTEXT_TYPE_3D = 1, + 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, + 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_NONE = 0, + D3D11_FENCE_FLAG_SHARED = 0x2, D3D11_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x4, - D3D11_FENCE_FLAG_NON_MONITORED = 0x8, + D3D11_FENCE_FLAG_NON_MONITORED = 0x8, }; enum D3D11_TEXTURE_LAYOUT { - D3D11_TEXTURE_LAYOUT_UNDEFINED = 0, - D3D11_TEXTURE_LAYOUT_ROW_MAJOR = 1, + D3D11_TEXTURE_LAYOUT_UNDEFINED = 0, + D3D11_TEXTURE_LAYOUT_ROW_MAJOR = 1, D3D11_TEXTURE_LAYOUT_64K_STANDARD_SWIZZLE = 2, }; } @@ -121,9 +121,9 @@ namespace REX::W32 struct D3D11_RENDER_TARGET_VIEW_DESC1 { - DXGI_FORMAT format; - D3D11_RTV_DIMENSION viewDimension; - union + DXGI_FORMAT format; + D3D11_RTV_DIMENSION viewDimension; + union { D3D11_BUFFER_RTV buffer; D3D11_TEX1D_RTV texture1D; @@ -167,9 +167,9 @@ namespace REX::W32 struct D3D11_SHADER_RESOURCE_VIEW_DESC1 { - DXGI_FORMAT format; - D3D11_SRV_DIMENSION viewDimension; - union + DXGI_FORMAT format; + D3D11_SRV_DIMENSION viewDimension; + union { D3D11_BUFFER_SRV buffer; D3D11_TEX1D_SRV texture1D; @@ -187,9 +187,9 @@ namespace REX::W32 struct D3D11_UNORDERED_ACCESS_VIEW_DESC1 { - DXGI_FORMAT format; - D3D11_UAV_DIMENSION viewDimension; - union + DXGI_FORMAT format; + D3D11_UAV_DIMENSION viewDimension; + union { D3D11_BUFFER_UAV buffer; D3D11_TEX1D_UAV texture1D; @@ -213,10 +213,10 @@ namespace REX::W32 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 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; + 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")) @@ -237,9 +237,9 @@ namespace REX::W32 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 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; + virtual HRESULT SetEventOnCompletion(std::uint64_t a_value, HANDLE a_event) = 0; }; struct __declspec(novtable, uuid("631b4766-36dc-461d-8db6-c47e13e60916")) diff --git a/include/REX/W32/D3D11_4.h b/include/REX/W32/D3D11_4.h index 8b0b5b8af..9a46de759 100644 --- a/include/REX/W32/D3D11_4.h +++ b/include/REX/W32/D3D11_4.h @@ -39,13 +39,13 @@ namespace REX::W32 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), + 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), }; } @@ -84,7 +84,7 @@ namespace REX::W32 ID3D11Device4 : public ID3D11Device3 { virtual HRESULT RegisterDeviceRemovedEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterDeviceRemoved(std::uint32_t a_cookie) = 0; + virtual void UnregisterDeviceRemoved(std::uint32_t a_cookie) = 0; }; struct __declspec(novtable, uuid("8ffde202-a0e7-45df-9e01-e837801b5ea0")) diff --git a/include/REX/W32/D3DCOMPILER.h b/include/REX/W32/D3DCOMPILER.h index edef47126..174cc39d5 100644 --- a/include/REX/W32/D3DCOMPILER.h +++ b/include/REX/W32/D3DCOMPILER.h @@ -37,74 +37,74 @@ namespace REX::W32 enum D3D_DISASM_FLAGS { - D3D_DISASM_ENABLE_COLOR_CODE = 0x00000001, - D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS = 0x00000002, + 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, + 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_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_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), + 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), + 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_MERGE_UAV_SLOTS = 0x00000001, D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS = 0x00000002, - D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH = 0x00000004, + 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, + 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, }; } @@ -119,7 +119,7 @@ namespace REX::W32 namespace REX::W32 { - inline const auto D3D_COMPILE_STANDARD_FILE_INCLUDE{ reinterpret_cast(static_cast(1)) }; + 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 }; } @@ -127,7 +127,7 @@ namespace REX::W32 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 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); diff --git a/include/REX/W32/DINPUT.h b/include/REX/W32/DINPUT.h index b56b923c1..11e9da643 100644 --- a/include/REX/W32/DINPUT.h +++ b/include/REX/W32/DINPUT.h @@ -14,165 +14,165 @@ 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_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_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_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 + 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 }; } @@ -183,17 +183,17 @@ namespace REX::W32 struct DIACTIONA { - std::uintptr_t appData; - std::uint32_t semantic; - std::uint32_t flags; + 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; + GUID guidInstance; + std::uint32_t objID; + std::uint32_t how; }; struct DIACTIONFORMATA @@ -374,12 +374,12 @@ namespace REX::W32 struct DIEFFESCAPE { - std::uint32_t size; - std::uint32_t command; - void* inBuffer; - std::uint32_t inBufferSize; - void* outBuffer; - std::uint32_t outBufferSize; + std::uint32_t size; + std::uint32_t command; + void* inBuffer; + std::uint32_t inBufferSize; + void* outBuffer; + std::uint32_t outBufferSize; }; struct DIFILEEFFECT diff --git a/include/REX/W32/DXGI.h b/include/REX/W32/DXGI.h index 9c3325cc8..ea3240ab8 100644 --- a/include/REX/W32/DXGI.h +++ b/include/REX/W32/DXGI.h @@ -23,224 +23,224 @@ 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_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_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, + 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_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, + 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, + 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, + 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_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_FULLY_RESIDENT = 1, DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, - DXGI_RESIDENCY_EVICTED_TO_DISK = 3, + DXGI_RESIDENCY_EVICTED_TO_DISK = 3, }; enum DXGI_SWAP_EFFECT { - DXGI_SWAP_EFFECT_DISCARD = 0, - DXGI_SWAP_EFFECT_SEQUENTIAL = 1, + DXGI_SWAP_EFFECT_DISCARD = 0, + DXGI_SWAP_EFFECT_SEQUENTIAL = 1, DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, - DXGI_SWAP_EFFECT_FLIP_DISCARD = 4, + 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_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, }; } @@ -460,16 +460,16 @@ namespace REX::W32 struct __declspec(novtable, uuid("ae02eedb-c735-4690-8d52-5a8dc20213aa")) IDXGIOutput : public IDXGIObject { - virtual HRESULT GetDesc(DXGI_OUTPUT_DESC* a_desc) = 0; + 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 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 SetDisplaySurface(IDXGISurface* a_scanoutSurface) = 0; virtual HRESULT GetDisplaySurfaceData(IDXGISurface* a_destination) = 0; virtual HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* a_stats) = 0; }; @@ -477,7 +477,7 @@ namespace REX::W32 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 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; @@ -503,7 +503,7 @@ namespace REX::W32 IDXGIFactory1 : public IDXGIFactory { virtual HRESULT EnumAdapters1(std::uint32_t a_adapterSize, IDXGIAdapter1** a_adapter) = 0; - virtual BOOL IsCurrent(void) = 0; + virtual BOOL IsCurrent(void) = 0; }; struct __declspec(novtable, uuid("54ec77fa-1377-44e6-8c32-88fd5f44c84c")) diff --git a/include/REX/W32/DXGI_2.h b/include/REX/W32/DXGI_2.h index a1b98cbe6..14d94e72b 100644 --- a/include/REX/W32/DXGI_2.h +++ b/include/REX/W32/DXGI_2.h @@ -19,49 +19,49 @@ namespace REX::W32 { enum DXGI_ALPHA_MODE { - DXGI_ALPHA_MODE_UNSPECIFIED = 0, + 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, + 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_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, + 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_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_LOW = 1, DXGI_OFFER_RESOURCE_PRIORITY_NORMAL = (DXGI_OFFER_RESOURCE_PRIORITY_LOW + 1), - DXGI_OFFER_RESOURCE_PRIORITY_HIGH = (DXGI_OFFER_RESOURCE_PRIORITY_NORMAL + 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_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_STRETCH = 0, + DXGI_SCALING_NONE = 1, DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, }; } @@ -193,16 +193,16 @@ namespace REX::W32 struct __declspec(novtable, uuid("50C83A1C-E072-4C48-87B0-3630FA36A6D0")) IDXGIFactory2 : public IDXGIFactory1 { - virtual BOOL IsWindowedStereoEnabled(void) = 0; + 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 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 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; }; @@ -218,7 +218,7 @@ namespace REX::W32 struct __declspec(novtable, uuid("191CFAC3-A341-470D-B26E-A864F428319C")) IDXGIOutputDuplication : public IDXGIObject { - virtual void GetDesc(DXGI_OUTDUPL_DESC* a_desc) = 0; + 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; @@ -249,7 +249,7 @@ namespace REX::W32 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 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; diff --git a/include/REX/W32/DXGI_3.h b/include/REX/W32/DXGI_3.h index 3dc7040cd..445acde51 100644 --- a/include/REX/W32/DXGI_3.h +++ b/include/REX/W32/DXGI_3.h @@ -18,22 +18,22 @@ 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_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, + 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_DIRECT = 0x1, DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2, }; } @@ -72,14 +72,14 @@ 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 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; }; @@ -121,7 +121,7 @@ namespace REX::W32 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 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; }; diff --git a/include/REX/W32/DXGI_4.h b/include/REX/W32/DXGI_4.h index 82522a1f9..e08e58b67 100644 --- a/include/REX/W32/DXGI_4.h +++ b/include/REX/W32/DXGI_4.h @@ -14,7 +14,7 @@ namespace REX::W32 { enum DXGI_MEMORY_SEGMENT_GROUP { - DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, + DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1, }; @@ -25,7 +25,7 @@ namespace REX::W32 enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG { - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, + DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x2, }; } @@ -47,11 +47,11 @@ namespace REX::W32 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 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; + virtual void UnregisterVideoMemoryBudgetChangeNotification(std::uint32_t a_cookie) = 0; }; struct __declspec(novtable, uuid("1BC6EA02-EF36-464F-BF0C-21CA39E5168A")) @@ -71,9 +71,9 @@ namespace REX::W32 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; + 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; }; } diff --git a/include/REX/W32/DXGI_5.h b/include/REX/W32/DXGI_5.h index 80ead088c..01eba7be4 100644 --- a/include/REX/W32/DXGI_5.h +++ b/include/REX/W32/DXGI_5.h @@ -19,8 +19,8 @@ namespace REX::W32 enum DXGI_HDR_METADATA_TYPE { - DXGI_HDR_METADATA_TYPE_NONE = 0, - DXGI_HDR_METADATA_TYPE_HDR10 = 1, + DXGI_HDR_METADATA_TYPE_NONE = 0, + DXGI_HDR_METADATA_TYPE_HDR10 = 1, DXGI_HDR_METADATA_TYPE_HDR10PLUS = 2, }; @@ -31,8 +31,8 @@ namespace REX::W32 enum DXGI_RECLAIM_RESOURCE_RESULTS { - DXGI_RECLAIM_RESOURCE_RESULT_OK = 0, - DXGI_RECLAIM_RESOURCE_RESULT_DISCARDED = 1, + DXGI_RECLAIM_RESOURCE_RESULT_OK = 0, + DXGI_RECLAIM_RESOURCE_RESULT_DISCARDED = 1, DXGI_RECLAIM_RESOURCE_RESULT_NOT_COMMITTED = 2, }; } @@ -62,7 +62,7 @@ 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 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; }; diff --git a/include/REX/W32/DXGI_6.h b/include/REX/W32/DXGI_6.h index 59ae84df9..5809cc6f3 100644 --- a/include/REX/W32/DXGI_6.h +++ b/include/REX/W32/DXGI_6.h @@ -14,27 +14,27 @@ 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_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, + 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_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_FULLSCREEN = 1, + DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_WINDOWED = 2, DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_CURSOR_STRETCHED = 4, }; } diff --git a/include/REX/W32/KERNEL32.h b/include/REX/W32/KERNEL32.h index 38a3d3938..86c7ad9d9 100644 --- a/include/REX/W32/KERNEL32.h +++ b/include/REX/W32/KERNEL32.h @@ -425,82 +425,82 @@ namespace REX::W32 namespace REX::W32 { - bool CloseHandle(HANDLE a_handle) noexcept; - 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 ExpandEnvironmentStrings(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; - std::uint32_t ExpandEnvironmentStrings(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; - 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; - 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 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; + bool CloseHandle(HANDLE a_handle) noexcept; + 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 ExpandEnvironmentStrings(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; + std::uint32_t ExpandEnvironmentStrings(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; + 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; + 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 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; + 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/SHELL32.h b/include/REX/W32/SHELL32.h index 85b3d95c0..e99e7d29f 100644 --- a/include/REX/W32/SHELL32.h +++ b/include/REX/W32/SHELL32.h @@ -4,7 +4,7 @@ namespace REX::W32 { - // known folder ids + // 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 } }; diff --git a/include/REX/W32/USER32.h b/include/REX/W32/USER32.h index eab565dc5..f3325fa02 100644 --- a/include/REX/W32/USER32.h +++ b/include/REX/W32/USER32.h @@ -6,288 +6,288 @@ namespace REX::W32 { enum GWLP : std::int32_t { - GWLP_USERDATA = -21, - GWLP_ID = -12, + GWLP_USERDATA = -21, + GWLP_ID = -12, GWLP_HWNDPARENT = -8, - GWLP_HINSTANCE = -6, - GWLP_WNDPROC = -4, + 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_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_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_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, + 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); + 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; + 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; + std::int32_t ShowCursor(bool a_show) noexcept; } diff --git a/include/REX/W32/VERSION.h b/include/REX/W32/VERSION.h index ae626a6e7..25c72d901 100644 --- a/include/REX/W32/VERSION.h +++ b/include/REX/W32/VERSION.h @@ -2,12 +2,12 @@ namespace REX::W32 { - bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept; + 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; + 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 index a55060baa..071a97aa0 100644 --- a/include/REX/W32/XINPUT.h +++ b/include/REX/W32/XINPUT.h @@ -11,21 +11,21 @@ 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_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, + 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, }; } diff --git a/src/RE/R/Renderer.cpp b/src/RE/R/Renderer.cpp index 1c7336337..e122bce10 100644 --- a/src/RE/R/Renderer.cpp +++ b/src/RE/R/Renderer.cpp @@ -65,7 +65,7 @@ namespace RE REL::Relocation func{ RELOCATION_ID(75458, 77243) }; return func(this); } - + void Renderer::Unlock() { using func_t = decltype(&Renderer::Unlock); diff --git a/src/REX/W32/D3D11.cpp b/src/REX/W32/D3D11.cpp index 536f6f42d..d26768385 100644 --- a/src/REX/W32/D3D11.cpp +++ b/src/REX/W32/D3D11.cpp @@ -7,7 +7,7 @@ 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); + 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 diff --git a/src/REX/W32/D3DCOMPILER.cpp b/src/REX/W32/D3DCOMPILER.cpp index d13e89e91..58bbd5696 100644 --- a/src/REX/W32/D3DCOMPILER.cpp +++ b/src/REX/W32/D3DCOMPILER.cpp @@ -27,13 +27,13 @@ REX_W32_IMPORT(std::int32_t, D3DStripShader, const void*, std::size_t, std::uint 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) + 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); } diff --git a/src/REX/W32/KERNEL32.cpp b/src/REX/W32/KERNEL32.cpp index 69c11ca27..53b352eac 100644 --- a/src/REX/W32/KERNEL32.cpp +++ b/src/REX/W32/KERNEL32.cpp @@ -340,7 +340,7 @@ namespace REX::W32 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 + 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); } diff --git a/src/SKSE/Logger.cpp b/src/SKSE/Logger.cpp index 0da3d86b9..9170e9068 100644 --- a/src/SKSE/Logger.cpp +++ b/src/SKSE/Logger.cpp @@ -65,8 +65,8 @@ namespace SKSE { std::optional log_directory() { - wchar_t* buffer{ nullptr }; - const auto result = REX::W32::SHGetKnownFolderPath(REX::W32::FOLDERID_Documents, REX::W32::KF_FLAG_DEFAULT, nullptr, std::addressof(buffer)); + wchar_t* buffer{ nullptr }; + const auto result = REX::W32::SHGetKnownFolderPath(REX::W32::FOLDERID_Documents, REX::W32::KF_FLAG_DEFAULT, nullptr, std::addressof(buffer)); std::unique_ptr knownPath(buffer, REX::W32::CoTaskMemFree); if (!knownPath || result != 0) { error("failed to get known folder path"sv); diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp index f310d3c26..ddd808712 100644 --- a/src/SKSE/Trampoline.cpp +++ b/src/SKSE/Trampoline.cpp @@ -7,7 +7,7 @@ // xbyak brings in #ifdef SKSE_SUPPORT_XBYAK # include -# undef max +# undef max # undef MEM_COMMIT # undef MEM_FREE # undef MEM_RESERVE @@ -56,7 +56,7 @@ namespace SKSE // 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); + reinterpret_cast(addr), a_size, REX::W32::MEM_COMMIT | REX::W32::MEM_RESERVE, REX::W32::PAGE_EXECUTE_READWRITE); if (mem) { return mem; } From 00dbe9ad81ff9433bd0cc9845c1bb7516ffc8c6c Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 27 Feb 2024 01:41:42 -0600 Subject: [PATCH 58/76] Fix HRESULT --- include/REX/W32/BASE.h | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/include/REX/W32/BASE.h b/include/REX/W32/BASE.h index 9171dd60f..4e517e6c6 100644 --- a/include/REX/W32/BASE.h +++ b/include/REX/W32/BASE.h @@ -25,6 +25,7 @@ namespace REX::W32 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__*; @@ -86,31 +87,6 @@ namespace REX::W32 using IID = GUID; } -namespace REX::W32 -{ - struct HRESULT - { - constexpr HRESULT() noexcept = default; - - constexpr HRESULT(const std::int32_t a_hr) noexcept : - value(a_hr) - {} - - constexpr operator bool() const noexcept - { - return value >= 0; - } - - constexpr operator std::int32_t() const noexcept - { - return value; - } - - std::int32_t value; - }; - static_assert(sizeof(HRESULT) == 0x4); -} - namespace REX::W32 { struct POINT From 1d99978729283d4f101861bf7aaba2919b2ef071 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 27 Feb 2024 01:44:05 -0600 Subject: [PATCH 59/76] Fix includes, missing lib, etc --- CMakeLists.txt | 1 + include/REX/W32/COM.h | 4 ++-- include/REX/W32/COMPTR.h | 2 +- include/REX/W32/D3D.h | 2 +- include/REX/W32/D3D11.h | 2 +- include/REX/W32/D3D11_1.h | 2 +- include/REX/W32/D3D11_2.h | 2 +- include/REX/W32/D3D11_3.h | 2 +- include/REX/W32/D3D11_4.h | 4 ++-- include/REX/W32/D3DCOMPILER.h | 2 +- include/REX/W32/DINPUT.h | 4 ++-- include/REX/W32/DXGI.h | 2 +- include/REX/W32/DXGI_2.h | 2 +- include/REX/W32/DXGI_3.h | 2 +- include/REX/W32/DXGI_4.h | 2 +- include/REX/W32/DXGI_5.h | 2 +- include/REX/W32/DXGI_6.h | 2 +- src/REX/W32/D3D11.cpp | 2 +- src/REX/W32/D3DCOMPILER.cpp | 2 +- src/REX/W32/DXGI.cpp | 2 +- 20 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f9ae839d..5582f6c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ target_link_libraries( spdlog::spdlog Advapi32.lib D3D11.lib + d3dcompiler.lib Dbghelp.lib DXGI.lib Ole32.lib diff --git a/include/REX/W32/COM.h b/include/REX/W32/COM.h index ad60061f8..e5a74c47b 100644 --- a/include/REX/W32/COM.h +++ b/include/REX/W32/COM.h @@ -1,6 +1,6 @@ #pragma once -#include "BASE.h" +#include "REX/W32/BASE.h" namespace REX::W32 { @@ -14,7 +14,7 @@ namespace REX::W32 template HRESULT QueryInterface(T** a_object) { - return QueryInterface(__uuidof(T), static_cast(a_object)); + return QueryInterface(*reinterpret_cast(&__uuidof(T)), static_cast(a_object)); } }; } diff --git a/include/REX/W32/COMPTR.h b/include/REX/W32/COMPTR.h index eb485a113..6453de44e 100644 --- a/include/REX/W32/COMPTR.h +++ b/include/REX/W32/COMPTR.h @@ -1,6 +1,6 @@ #pragma once -#include "BASE.h" +#include "REX/W32/BASE.h" namespace REX::W32 { diff --git a/include/REX/W32/D3D.h b/include/REX/W32/D3D.h index 669d80782..03a353c51 100644 --- a/include/REX/W32/D3D.h +++ b/include/REX/W32/D3D.h @@ -1,6 +1,6 @@ #pragma once -#include "DXGI.h" +#include "REX/W32/DXGI.h" namespace REX::W32 { diff --git a/include/REX/W32/D3D11.h b/include/REX/W32/D3D11.h index 32ed9df36..ad96dda3a 100644 --- a/include/REX/W32/D3D11.h +++ b/include/REX/W32/D3D11.h @@ -1,6 +1,6 @@ #pragma once -#include "D3D.h" +#include "REX/W32/D3D.h" namespace REX::W32 { diff --git a/include/REX/W32/D3D11_1.h b/include/REX/W32/D3D11_1.h index 6a0328a19..db1a789df 100644 --- a/include/REX/W32/D3D11_1.h +++ b/include/REX/W32/D3D11_1.h @@ -1,6 +1,6 @@ #pragma once -#include "D3D11.h" +#include "REX/W32/D3D11.h" namespace REX::W32 { diff --git a/include/REX/W32/D3D11_2.h b/include/REX/W32/D3D11_2.h index 0d9e1a094..084532a3b 100644 --- a/include/REX/W32/D3D11_2.h +++ b/include/REX/W32/D3D11_2.h @@ -1,6 +1,6 @@ #pragma once -#include "D3D11_1.h" +#include "REX/W32/D3D11_1.h" namespace REX::W32 { diff --git a/include/REX/W32/D3D11_3.h b/include/REX/W32/D3D11_3.h index 9ad54f484..aa066d952 100644 --- a/include/REX/W32/D3D11_3.h +++ b/include/REX/W32/D3D11_3.h @@ -1,6 +1,6 @@ #pragma once -#include "D3D11_2.h" +#include "REX/W32/D3D11_2.h" namespace REX::W32 { diff --git a/include/REX/W32/D3D11_4.h b/include/REX/W32/D3D11_4.h index 9a46de759..f8034dd2c 100644 --- a/include/REX/W32/D3D11_4.h +++ b/include/REX/W32/D3D11_4.h @@ -1,7 +1,7 @@ #pragma once -#include "D3D11_3.h" -#include "DXGI_5.h" +#include "REX/W32/D3D11_3.h" +#include "REX/W32/DXGI_5.h" namespace REX::W32 { diff --git a/include/REX/W32/D3DCOMPILER.h b/include/REX/W32/D3DCOMPILER.h index 174cc39d5..0cca3be73 100644 --- a/include/REX/W32/D3DCOMPILER.h +++ b/include/REX/W32/D3DCOMPILER.h @@ -1,6 +1,6 @@ #pragma once -#include "D3D.h" +#include "REX/W32/D3D.h" namespace REX::W32 { diff --git a/include/REX/W32/DINPUT.h b/include/REX/W32/DINPUT.h index 11e9da643..85f4e5396 100644 --- a/include/REX/W32/DINPUT.h +++ b/include/REX/W32/DINPUT.h @@ -1,7 +1,7 @@ #pragma once -#include "COM.h" -#include "D3D.h" +#include "REX/W32/COM.h" +#include "REX/W32/D3D.h" namespace REX::W32 { diff --git a/include/REX/W32/DXGI.h b/include/REX/W32/DXGI.h index ea3240ab8..022ebcfc3 100644 --- a/include/REX/W32/DXGI.h +++ b/include/REX/W32/DXGI.h @@ -1,6 +1,6 @@ #pragma once -#include "COM.h" +#include "REX/W32/COM.h" namespace REX::W32 { diff --git a/include/REX/W32/DXGI_2.h b/include/REX/W32/DXGI_2.h index 14d94e72b..aca5932db 100644 --- a/include/REX/W32/DXGI_2.h +++ b/include/REX/W32/DXGI_2.h @@ -1,6 +1,6 @@ #pragma once -#include "DXGI.h" +#include "REX/W32/DXGI.h" namespace REX::W32 { diff --git a/include/REX/W32/DXGI_3.h b/include/REX/W32/DXGI_3.h index 445acde51..04333f6da 100644 --- a/include/REX/W32/DXGI_3.h +++ b/include/REX/W32/DXGI_3.h @@ -1,6 +1,6 @@ #pragma once -#include "DXGI_2.h" +#include "REX/W32/DXGI_2.h" namespace REX::W32 { diff --git a/include/REX/W32/DXGI_4.h b/include/REX/W32/DXGI_4.h index e08e58b67..5e60b9731 100644 --- a/include/REX/W32/DXGI_4.h +++ b/include/REX/W32/DXGI_4.h @@ -1,6 +1,6 @@ #pragma once -#include "DXGI_3.h" +#include "REX/W32/DXGI_3.h" namespace REX::W32 { diff --git a/include/REX/W32/DXGI_5.h b/include/REX/W32/DXGI_5.h index 01eba7be4..7ebf3b702 100644 --- a/include/REX/W32/DXGI_5.h +++ b/include/REX/W32/DXGI_5.h @@ -1,6 +1,6 @@ #pragma once -#include "DXGI_4.h" +#include "REX/W32/DXGI_4.h" namespace REX::W32 { diff --git a/include/REX/W32/DXGI_6.h b/include/REX/W32/DXGI_6.h index 5809cc6f3..1d2915997 100644 --- a/include/REX/W32/DXGI_6.h +++ b/include/REX/W32/DXGI_6.h @@ -1,6 +1,6 @@ #pragma once -#include "DXGI_5.h" +#include "REX/W32/DXGI_5.h" namespace REX::W32 { diff --git a/src/REX/W32/D3D11.cpp b/src/REX/W32/D3D11.cpp index d26768385..f69676ae9 100644 --- a/src/REX/W32/D3D11.cpp +++ b/src/REX/W32/D3D11.cpp @@ -1,4 +1,4 @@ -#include "D3D11.h" +#include "REX/W32/D3D11.h" 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**); diff --git a/src/REX/W32/D3DCOMPILER.cpp b/src/REX/W32/D3DCOMPILER.cpp index 58bbd5696..d4964425a 100644 --- a/src/REX/W32/D3DCOMPILER.cpp +++ b/src/REX/W32/D3DCOMPILER.cpp @@ -1,4 +1,4 @@ -#include "D3DCOMPILER.h" +#include "REX/W32/D3DCOMPILER.h" 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**); diff --git a/src/REX/W32/DXGI.cpp b/src/REX/W32/DXGI.cpp index 101933a12..0d96643dc 100644 --- a/src/REX/W32/DXGI.cpp +++ b/src/REX/W32/DXGI.cpp @@ -1,4 +1,4 @@ -#include "DXGI.h" +#include "REX/W32/DXGI.h" REX_W32_IMPORT(std::int32_t, CreateDXGIFactory, const IID&, void**); REX_W32_IMPORT(std::int32_t, CreateDXGIFactory1, const IID&, void**); From 1b66eaabbad9b097a838bbfc0117fe201f65db74 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Tue, 27 Feb 2024 12:36:58 -0600 Subject: [PATCH 60/76] Add missing constants --- include/REX/W32/D3D11.h | 526 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 526 insertions(+) diff --git a/include/REX/W32/D3D11.h b/include/REX/W32/D3D11.h index ad96dda3a..c543fe0b3 100644 --- a/include/REX/W32/D3D11.h +++ b/include/REX/W32/D3D11.h @@ -47,6 +47,532 @@ namespace REX::W32 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 From 7501d4073267de0eb4b1a88bdf9a36305d1e246b Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:04:34 -0600 Subject: [PATCH 61/76] Minor changes --- .gitignore | 7 ++++--- CMakeLists.txt | 1 + include/RE/B/BGSEntryPoint.h | 2 +- include/RE/B/BSStringPool.h | 4 ++-- include/RE/Offsets.h | 2 +- include/RE/Offsets_NiRTTI.h | 2 +- include/RE/Offsets_RTTI.h | 2 +- include/RE/Offsets_VTABLE.h | 2 +- include/RE/T/TESForm.h | 3 ++- include/RE/T/TESFullName.h | 2 +- include/SKSE/Version.h | 2 ++ 11 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 50a52675a..ad8f1c8f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,12 @@ # dot folders -.vs/ +.vs*/ .vscode/ .xmake/ # folders -build/ -out/ +build*/ +out*/ +vs*/ # files *.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index 5582f6c17..95607da82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,7 @@ install( DIRECTORY "include/RE" "include/REL" + "include/REX" "include/SKSE" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) diff --git a/include/RE/B/BGSEntryPoint.h b/include/RE/B/BGSEntryPoint.h index 48f6861a8..5fd132bf0 100644 --- a/include/RE/B/BGSEntryPoint.h +++ b/include/RE/B/BGSEntryPoint.h @@ -113,7 +113,7 @@ namespace RE { using func_t = decltype(&BGSEntryPoint::HandleEntryPoint); REL::Relocation func{ RELOCATION_ID(23073, 23526) }; - return func(a_entryPoint, a_perkOwner, a_args...); + func(a_entryPoint, a_perkOwner, a_args...); } }; } diff --git a/include/RE/B/BSStringPool.h b/include/RE/B/BSStringPool.h index e7537cca3..7345da9c3 100644 --- a/include/RE/B/BSStringPool.h +++ b/include/RE/B/BSStringPool.h @@ -27,14 +27,14 @@ namespace RE { using func_t = decltype(&Entry::release8); REL::Relocation func{ RELOCATION_ID(67847, 69192) }; - return func(a_entry); + func(a_entry); } static inline void release16(const wchar_t*& a_entry) { using func_t = decltype(&Entry::release16); REL::Relocation func{ RELOCATION_ID(67848, 69193) }; - return func(a_entry); + func(a_entry); } inline void acquire() diff --git a/include/RE/Offsets.h b/include/RE/Offsets.h index ad7c5ca45..45fa117f2 100644 --- a/include/RE/Offsets.h +++ b/include/RE/Offsets.h @@ -1,6 +1,6 @@ #pragma once -#include "REL/Relocation.h" +#include "REL/ID.h" namespace RE { diff --git a/include/RE/Offsets_NiRTTI.h b/include/RE/Offsets_NiRTTI.h index ac36c2132..65a28f384 100644 --- a/include/RE/Offsets_NiRTTI.h +++ b/include/RE/Offsets_NiRTTI.h @@ -1,6 +1,6 @@ #pragma once -#include "REL/Relocation.h" +#include "REL/ID.h" namespace RE { diff --git a/include/RE/Offsets_RTTI.h b/include/RE/Offsets_RTTI.h index 9b94d7118..096df1b09 100644 --- a/include/RE/Offsets_RTTI.h +++ b/include/RE/Offsets_RTTI.h @@ -1,6 +1,6 @@ #pragma once -#include "REL/Relocation.h" +#include "REL/ID.h" namespace RE { diff --git a/include/RE/Offsets_VTABLE.h b/include/RE/Offsets_VTABLE.h index ed17f3c40..44bb38776 100644 --- a/include/RE/Offsets_VTABLE.h +++ b/include/RE/Offsets_VTABLE.h @@ -1,6 +1,6 @@ #pragma once -#include "REL/Relocation.h" +#include "REL/ID.h" namespace RE { diff --git a/include/RE/T/TESForm.h b/include/RE/T/TESForm.h index 7884cb423..8a743190d 100644 --- a/include/RE/T/TESForm.h +++ b/include/RE/T/TESForm.h @@ -1,6 +1,7 @@ #pragma once #include "RE/B/BSAtomic.h" +#include "RE/B/BSCoreTypes.h" #include "RE/B/BSFixedString.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTHashMap.h" @@ -183,7 +184,7 @@ namespace RE { using func_t = decltype(&TESForm::AddCompileIndex); REL::Relocation func{ RELOCATION_ID(14509, 14667) }; - return func(a_id, a_file); + func(a_id, a_file); } [[nodiscard]] static auto GetAllForms() diff --git a/include/RE/T/TESFullName.h b/include/RE/T/TESFullName.h index b6113f0d6..0cd10c7a0 100644 --- a/include/RE/T/TESFullName.h +++ b/include/RE/T/TESFullName.h @@ -25,7 +25,7 @@ namespace RE { using func_t = decltype(&TESFullName::SetFullName); REL::Relocation func{ RELOCATION_ID(22318, 22791) }; - return func(this, a_name); + func(this, a_name); } // members diff --git a/include/SKSE/Version.h b/include/SKSE/Version.h index 7db68d41f..a8a1c7598 100644 --- a/include/SKSE/Version.h +++ b/include/SKSE/Version.h @@ -1,5 +1,7 @@ #pragma once +#include "REL/Version.h" + namespace SKSE { inline constexpr REL::Version RUNTIME_1_1_47(1, 1, 47, 0); From dc71983b0d2f0e31aa7542c3d5376f8c674ea0bd Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:08:37 -0600 Subject: [PATCH 62/76] Minor changes again --- include/SKSE/Interfaces.h | 23 +++++++++++++++++------ include/SKSE/Logger.h | 3 --- src/SKSE/Logger.cpp | 6 ++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/SKSE/Interfaces.h b/include/SKSE/Interfaces.h index c17d7e5be..fa9d4d9a3 100644 --- a/include/SKSE/Interfaces.h +++ b/include/SKSE/Interfaces.h @@ -1,14 +1,25 @@ #pragma once -#include "RE/G/GFxMovieView.h" -#include "RE/G/GFxValue.h" -#include "RE/I/IVirtualMachine.h" -#include "RE/I/InventoryEntryData.h" -#include "RE/V/VirtualMachine.h" - #include "SKSE/Impl/Stubs.h" #include "SKSE/Version.h" +namespace RE +{ + class GFxMovieView; + class GFxValue; + class InventoryEntryData; + + namespace BSScript + { + namespace Internal + { + class VirtualMachine; + } + + class IVirtualMachine; + } +} + namespace SKSE { struct PluginInfo; diff --git a/include/SKSE/Logger.h b/include/SKSE/Logger.h index 1fcc425db..338367225 100644 --- a/include/SKSE/Logger.h +++ b/include/SKSE/Logger.h @@ -1,8 +1,5 @@ #pragma once -#include "RE/B/BSTEvent.h" -#include "RE/L/LogEvent.h" - #define SKSE_MAKE_SOURCE_LOGGER(a_func, a_type) \ \ template \ diff --git a/src/SKSE/Logger.cpp b/src/SKSE/Logger.cpp index 9170e9068..424ba6fed 100644 --- a/src/SKSE/Logger.cpp +++ b/src/SKSE/Logger.cpp @@ -1,12 +1,14 @@ #include "SKSE/Logger.h" +#include "RE/B/BSTEvent.h" +#include "RE/L/LogEvent.h" #include "RE/V/VirtualMachine.h" -#include "SKSE/API.h" - #include "REX/W32/OLE32.h" #include "REX/W32/SHELL32.h" +#include "SKSE/API.h" + namespace SKSE { namespace Impl From e228f3e5e078d30dca6366335722ac6918b45201 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:11:16 -0600 Subject: [PATCH 63/76] Improve Trampoline --- include/SKSE/API.h | 3 +- include/SKSE/Trampoline.h | 171 ++------------------------------------ src/SKSE/API.cpp | 6 -- src/SKSE/Trampoline.cpp | 156 ++++++++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 170 deletions(-) diff --git a/include/SKSE/API.h b/include/SKSE/API.h index 551934952..f84eb7f48 100644 --- a/include/SKSE/API.h +++ b/include/SKSE/API.h @@ -36,6 +36,5 @@ namespace SKSE const SKSEObjectRegistry* GetObjectRegistry() noexcept; const SKSEPersistentObjectStorage* GetPersistentObjectStorage() noexcept; - Trampoline& GetTrampoline(); - void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve = true); + void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve = true); } diff --git a/include/SKSE/Trampoline.h b/include/SKSE/Trampoline.h index 3285b9a68..a630896da 100644 --- a/include/SKSE/Trampoline.h +++ b/include/SKSE/Trampoline.h @@ -1,7 +1,5 @@ #pragma once -#include "REX/W32/KERNEL32.h" - #if defined(SKSE_SUPPORT_XBYAK) namespace Xbyak { @@ -11,33 +9,6 @@ namespace Xbyak namespace SKSE { - namespace detail - { - [[nodiscard]] constexpr std::size_t roundup(std::size_t a_number, 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; - } - - [[nodiscard]] constexpr std::size_t rounddown(std::size_t a_number, 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; - } - } - class Trampoline { public: @@ -46,7 +17,7 @@ namespace SKSE Trampoline() = default; Trampoline(const Trampoline&) = delete; - Trampoline(Trampoline&& a_rhs) { move_from(std::move(a_rhs)); } + Trampoline(Trampoline&& a_rhs) noexcept { move_from(std::move(a_rhs)); } explicit Trampoline(std::string_view a_name) : _name(a_name) @@ -56,7 +27,7 @@ namespace SKSE Trampoline& operator=(const Trampoline&) = delete; - Trampoline& operator=(Trampoline&& a_rhs) + Trampoline& operator=(Trampoline&& a_rhs) noexcept { if (this != std::addressof(a_rhs)) { move_from(std::move(a_rhs)); @@ -65,31 +36,9 @@ namespace SKSE } void create(std::size_t a_size) { return create(a_size, nullptr); } + void create(std::size_t a_size, void* a_module); - void create(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::textx); - a_module = text.pointer() + text.size(); - } - - auto mem = do_create(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 set_trampoline(void* a_trampoline, std::size_t a_size) { set_trampoline(a_trampoline, a_size, {}); } - - void set_trampoline(void* a_trampoline, std::size_t a_size, deleter_type a_deleter) + void set_trampoline(void* a_trampoline, std::size_t a_size, deleter_type a_deleter = {}) { auto trampoline = static_cast(a_trampoline); if (trampoline) { @@ -181,114 +130,10 @@ namespace SKSE private: [[nodiscard]] void* do_create(std::size_t a_size, std::uintptr_t a_address); + [[nodiscard]] void* do_allocate(std::size_t a_size); - [[nodiscard]] void* do_allocate(std::size_t a_size) - { - if (a_size > free_size()) { - stl::report_and_fail("Failed to handle allocation request"sv); - } - - auto mem = _data + _size; - _size += a_size; - - return mem; - } - - void write_5branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_opcode) - { -#pragma pack(push, 1) - struct SrcAssembly - { - // jmp/call [rip + imm32] - std::uint8_t opcode; // 0 - 0xE9/0xE8 - std::int32_t disp; // 1 - }; - static_assert(offsetof(SrcAssembly, opcode) == 0x0); - static_assert(offsetof(SrcAssembly, disp) == 0x1); - static_assert(sizeof(SrcAssembly) == 0x5); - - // FF /4 - // JMP r/m64 - struct TrampolineAssembly - { - // jmp [rip] - std::uint8_t jmp; // 0 - 0xFF - std::uint8_t modrm; // 1 - 0x25 - std::int32_t disp; // 2 - 0x00000000 - std::uint64_t addr; // 6 - [rip] - }; - static_assert(offsetof(TrampolineAssembly, jmp) == 0x0); - static_assert(offsetof(TrampolineAssembly, modrm) == 0x1); - static_assert(offsetof(TrampolineAssembly, disp) == 0x2); - static_assert(offsetof(TrampolineAssembly, addr) == 0x6); - static_assert(sizeof(TrampolineAssembly) == 0xE); -#pragma pack(pop) - - TrampolineAssembly* mem = nullptr; - if (const auto it = _5branches.find(a_dst); it != _5branches.end()) { - mem = reinterpret_cast(it->second); - } else { - mem = allocate(); - _5branches.emplace(a_dst, reinterpret_cast(mem)); - } - - const auto disp = - reinterpret_cast(mem) - - reinterpret_cast(a_src + sizeof(SrcAssembly)); - if (!in_range(disp)) { // the trampoline should already be in range, so this should never happen - stl::report_and_fail("displacement is out of range"sv); - } - - SrcAssembly assembly; - assembly.opcode = a_opcode; - assembly.disp = static_cast(disp); - REL::safe_write(a_src, &assembly, sizeof(assembly)); - - mem->jmp = static_cast(0xFF); - mem->modrm = static_cast(0x25); - mem->disp = static_cast(0); - mem->addr = static_cast(a_dst); - } - - void write_6branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_modrm) - { -#pragma pack(push, 1) - struct Assembly - { - // jmp/call [rip + imm32] - std::uint8_t opcode; // 0 - 0xFF - std::uint8_t modrm; // 1 - 0x25/0x15 - std::int32_t disp; // 2 - }; - static_assert(offsetof(Assembly, opcode) == 0x0); - static_assert(offsetof(Assembly, modrm) == 0x1); - static_assert(offsetof(Assembly, disp) == 0x2); - static_assert(sizeof(Assembly) == 0x6); -#pragma pack(pop) - - std::uintptr_t* mem = nullptr; - if (const auto it = _6branches.find(a_dst); it != _6branches.end()) { - mem = reinterpret_cast(it->second); - } else { - mem = allocate(); - _6branches.emplace(a_dst, reinterpret_cast(mem)); - } - - const auto disp = - reinterpret_cast(mem) - - reinterpret_cast(a_src + sizeof(Assembly)); - if (!in_range(disp)) { // the trampoline should already be in range, so this should never happen - stl::report_and_fail("displacement is out of range"sv); - } - - Assembly assembly; - assembly.opcode = static_cast(0xFF); - assembly.modrm = a_modrm; - assembly.disp = static_cast(disp); - REL::safe_write(a_src, &assembly, sizeof(assembly)); - - *mem = a_dst; - } + void write_5branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_opcode); + void write_6branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_modrm); template [[nodiscard]] std::uintptr_t write_branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_data) @@ -357,4 +202,6 @@ namespace SKSE std::size_t _capacity{ 0 }; std::size_t _size{ 0 }; }; + + Trampoline& GetTrampoline(); } diff --git a/src/SKSE/API.cpp b/src/SKSE/API.cpp index 79a765f4e..c157b8283 100644 --- a/src/SKSE/API.cpp +++ b/src/SKSE/API.cpp @@ -218,12 +218,6 @@ namespace SKSE return detail::APIStorage::get().persistentObjectStorage; } - Trampoline& GetTrampoline() - { - static Trampoline trampoline; - return trampoline; - } - void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve) { auto& trampoline = GetTrampoline(); diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp index ddd808712..daa1849d1 100644 --- a/src/SKSE/Trampoline.cpp +++ b/src/SKSE/Trampoline.cpp @@ -16,6 +16,48 @@ namespace SKSE { + namespace detail + { + [[nodiscard]] constexpr std::size_t roundup(std::size_t a_number, 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); + } + + [[nodiscard]] constexpr std::size_t rounddown(std::size_t a_number, 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); + } + } + + void Trampoline::create(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::textx); + a_module = text.pointer() + text.size(); + } + + auto mem = do_create(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); + }); + } + #ifdef SKSE_SUPPORT_XBYAK void* Trampoline::allocate(Xbyak::CodeGenerator& a_code) { @@ -68,9 +110,123 @@ namespace SKSE return nullptr; } + void* Trampoline::do_allocate(std::size_t a_size) + { + if (a_size > free_size()) { + stl::report_and_fail("Failed to handle allocation request"sv); + } + + auto mem = _data + _size; + _size += a_size; + + return mem; + } + + void Trampoline::write_5branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_opcode) + { +#pragma pack(push, 1) + struct SrcAssembly + { + // jmp/call [rip + imm32] + std::uint8_t opcode; // 0 - 0xE9/0xE8 + std::int32_t disp; // 1 + }; + static_assert(offsetof(SrcAssembly, opcode) == 0x0); + static_assert(offsetof(SrcAssembly, disp) == 0x1); + static_assert(sizeof(SrcAssembly) == 0x5); + + // FF /4 + // JMP r/m64 + struct TrampolineAssembly + { + // jmp [rip] + std::uint8_t jmp; // 0 - 0xFF + std::uint8_t modrm; // 1 - 0x25 + std::int32_t disp; // 2 - 0x00000000 + std::uint64_t addr; // 6 - [rip] + }; + static_assert(offsetof(TrampolineAssembly, jmp) == 0x0); + static_assert(offsetof(TrampolineAssembly, modrm) == 0x1); + static_assert(offsetof(TrampolineAssembly, disp) == 0x2); + static_assert(offsetof(TrampolineAssembly, addr) == 0x6); + static_assert(sizeof(TrampolineAssembly) == 0xE); +#pragma pack(pop) + + TrampolineAssembly* mem = nullptr; + if (const auto it = _5branches.find(a_dst); it != _5branches.end()) { + mem = reinterpret_cast(it->second); + } else { + mem = allocate(); + _5branches.emplace(a_dst, reinterpret_cast(mem)); + } + + const auto disp = + reinterpret_cast(mem) - + reinterpret_cast(a_src + sizeof(SrcAssembly)); + if (!in_range(disp)) { // the trampoline should already be in range, so this should never happen + stl::report_and_fail("displacement is out of range"sv); + } + + SrcAssembly assembly; + assembly.opcode = a_opcode; + assembly.disp = static_cast(disp); + REL::safe_write(a_src, &assembly, sizeof(assembly)); + + mem->jmp = static_cast(0xFF); + mem->modrm = static_cast(0x25); + mem->disp = static_cast(0); + mem->addr = static_cast(a_dst); + } + + void Trampoline::write_6branch(std::uintptr_t a_src, std::uintptr_t a_dst, std::uint8_t a_modrm) + { +#pragma pack(push, 1) + struct Assembly + { + // jmp/call [rip + imm32] + std::uint8_t opcode; // 0 - 0xFF + std::uint8_t modrm; // 1 - 0x25/0x15 + std::int32_t disp; // 2 + }; + static_assert(offsetof(Assembly, opcode) == 0x0); + static_assert(offsetof(Assembly, modrm) == 0x1); + static_assert(offsetof(Assembly, disp) == 0x2); + static_assert(sizeof(Assembly) == 0x6); +#pragma pack(pop) + + std::uintptr_t* mem = nullptr; + if (const auto it = _6branches.find(a_dst); it != _6branches.end()) { + mem = reinterpret_cast(it->second); + } else { + mem = allocate(); + _6branches.emplace(a_dst, reinterpret_cast(mem)); + } + + const auto disp = + reinterpret_cast(mem) - + reinterpret_cast(a_src + sizeof(Assembly)); + if (!in_range(disp)) { // the trampoline should already be in range, so this should never happen + stl::report_and_fail("displacement is out of range"sv); + } + + Assembly assembly; + assembly.opcode = static_cast(0xFF); + assembly.modrm = a_modrm; + assembly.disp = static_cast(disp); + REL::safe_write(a_src, &assembly, sizeof(assembly)); + + *mem = a_dst; + } + void Trampoline::log_stats() const { const auto pct = (static_cast(_size) / static_cast(_capacity)) * 100.0; log::debug("{} => {}B / {}B ({:05.2f}%)"sv, _name, _size, _capacity, pct); } + + Trampoline& GetTrampoline() + { + static Trampoline trampoline; + return trampoline; + } } From a0fee55a598ad1859b4b9884ac322bcc9a4f7c6c Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:15:22 -0600 Subject: [PATCH 64/76] Improve Version --- cmake/sourcelist.cmake | 1 + include/REL/Module.h | 2 +- include/REL/Version.h | 40 +++++++++++----------------------------- src/REL/Version.cpp | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 src/REL/Version.cpp diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 516b10289..1d0c24c93 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1989,6 +1989,7 @@ set(SOURCES src/RE/Z/ZeroFunctionArguments.cpp src/REL/ID.cpp src/REL/Module.cpp + src/REL/Version.cpp src/REX/W32/ADVAPI32.cpp src/REX/W32/D3D11.cpp src/REX/W32/D3DCOMPILER.cpp diff --git a/include/REL/Module.h b/include/REL/Module.h index 52b220b3a..a7c461013 100644 --- a/include/REL/Module.h +++ b/include/REL/Module.h @@ -120,7 +120,7 @@ namespace REL void load_version() { - const auto version = get_file_version(_filename); + const auto version = GetFileVersion(_filename); if (version) { _version = *version; } else { diff --git a/include/REL/Version.h b/include/REL/Version.h index f72ebeb62..d24462e5a 100644 --- a/include/REL/Version.h +++ b/include/REL/Version.h @@ -1,7 +1,5 @@ #pragma once -#include "REX/W32/VERSION.h" - namespace REL { class Version @@ -70,6 +68,16 @@ namespace REL return result; } + [[nodiscard]] static constexpr Version unpack(std::uint32_t a_packedVersion) noexcept + { + return REL::Version{ + static_cast((a_packedVersion >> 24) & 0x0FF), + static_cast((a_packedVersion >> 16) & 0x0FF), + static_cast((a_packedVersion >> 4) & 0xFFF), + static_cast(a_packedVersion & 0x0F) + }; + } + private: std::array _impl{ 0, 0, 0, 0 }; }; @@ -77,31 +85,5 @@ namespace REL [[nodiscard]] constexpr bool operator==(const Version& a_lhs, const Version& a_rhs) noexcept { return a_lhs.compare(a_rhs) == 0; } [[nodiscard]] constexpr std::strong_ordering operator<=>(const Version& a_lhs, const Version& a_rhs) noexcept { return a_lhs.compare(a_rhs); } - [[nodiscard]] inline std::optional get_file_version(stl::zwstring 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; - } + [[nodiscard]] std::optional GetFileVersion(stl::zwstring a_filename); } diff --git a/src/REL/Version.cpp b/src/REL/Version.cpp new file mode 100644 index 000000000..c204adc02 --- /dev/null +++ b/src/REL/Version.cpp @@ -0,0 +1,34 @@ +#include "REL/Version.h" + +#include "REX/W32/VERSION.h" + +namespace REL +{ + std::optional GetFileVersion(stl::zwstring 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; + } +} From 923bbe5c0a5e524eb65198cce6b99d09418682ef Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:18:59 -0600 Subject: [PATCH 65/76] Improve Relocation --- cmake/sourcelist.cmake | 1 + include/REL/Relocation.h | 96 +++++++++++++++++++++++++--------------- src/REL/Relocation.cpp | 34 ++++++++++++++ 3 files changed, 96 insertions(+), 35 deletions(-) create mode 100644 src/REL/Relocation.cpp diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 1d0c24c93..38c8cd4d1 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1989,6 +1989,7 @@ set(SOURCES src/RE/Z/ZeroFunctionArguments.cpp src/REL/ID.cpp src/REL/Module.cpp + src/REL/Relocation.cpp src/REL/Version.cpp src/REX/W32/ADVAPI32.cpp src/REX/W32/D3D11.cpp diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index a96e1c48a..1b5aa5fde 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -1,6 +1,8 @@ #pragma once -#include "REX/W32/KERNEL32.h" +#include "REL/Module.h" + +#include "SKSE/Trampoline.h" #define REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_nopropQual, a_propQual, ...) \ template < \ @@ -187,19 +189,7 @@ namespace REL } } - inline void safe_write(std::uintptr_t a_dst, const void* a_src, std::size_t a_count) - { - std::uint32_t old{ 0 }; - bool success = REX::W32::VirtualProtect( - reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); - if (success) { - std::memcpy(reinterpret_cast(a_dst), a_src, a_count); - success = REX::W32::VirtualProtect( - reinterpret_cast(a_dst), a_count, old, std::addressof(old)); - } - - assert(success); - } + void safe_write(std::uintptr_t a_dst, const void* a_src, std::size_t a_count); template void safe_write(std::uintptr_t a_dst, const T& a_data) @@ -213,21 +203,9 @@ namespace REL safe_write(a_dst, a_data.data(), a_data.size_bytes()); } - inline void safe_fill(std::uintptr_t a_dst, std::uint8_t a_value, std::size_t a_count) - { - std::uint32_t old{ 0 }; - bool success = REX::W32::VirtualProtect( - reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); - if (success) { - std::fill_n(reinterpret_cast(a_dst), a_count, a_value); - success = REX::W32::VirtualProtect( - reinterpret_cast(a_dst), a_count, old, std::addressof(old)); - } + void safe_fill(std::uintptr_t a_dst, std::uint8_t a_value, std::size_t a_count); - assert(success); - } - - template + template class Relocation { public: @@ -274,22 +252,22 @@ namespace REL } template - [[nodiscard]] decltype(auto) operator*() const noexcept // + [[nodiscard]] decltype(auto) operator*() const noexcept requires(std::is_pointer_v) { return *get(); } template - [[nodiscard]] auto operator->() const noexcept // + [[nodiscard]] auto operator->() const noexcept requires(std::is_pointer_v) { return get(); } template - std::invoke_result_t operator()(Args&&... a_args) const // - noexcept(std::is_nothrow_invocable_v) // + 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)...); @@ -298,15 +276,63 @@ namespace REL [[nodiscard]] constexpr std::uintptr_t address() const noexcept { return _impl; } [[nodiscard]] std::size_t offset() const { return _impl - base(); } - [[nodiscard]] value_type get() const // + [[nodiscard]] value_type get() const noexcept(std::is_nothrow_copy_constructible_v) { assert(_impl != 0); return stl::unrestricted_cast(_impl); } + template + void write(const U& a_data) + requires(std::same_as) + { + safe_write(address(), std::addressof(a_data), sizeof(T)); + } + + template + void write(const std::span a_data) + requires(std::same_as) + { + safe_write(address(), a_data.data(), a_data.size_bytes()); + } + + template + std::uintptr_t write_branch(const std::uintptr_t a_dst) + requires(std::same_as) + { + return SKSE::GetTrampoline().write_branch(address(), a_dst); + } + + template + std::uintptr_t write_branch(const F a_dst) + requires(std::same_as) + { + return SKSE::GetTrampoline().write_branch(address(), stl::unrestricted_cast(a_dst)); + } + + template + std::uintptr_t write_call(const std::uintptr_t a_dst) + requires(std::same_as) + { + return SKSE::GetTrampoline().write_call(address(), a_dst); + } + + template + std::uintptr_t write_call(const F a_dst) + requires(std::same_as) + { + return SKSE::GetTrampoline().write_call(address(), stl::unrestricted_cast(a_dst)); + } + + void write_fill(const std::uint8_t a_value, const std::size_t a_count) + requires(std::same_as) + { + safe_fill(address(), a_value, a_count); + } + template - std::uintptr_t write_vfunc(std::size_t a_idx, std::uintptr_t a_newFunc) // + std::uintptr_t write_vfunc(const std::size_t a_idx, const std::uintptr_t a_newFunc) requires(std::same_as) { const auto addr = address() + (sizeof(void*) * a_idx); @@ -316,7 +342,7 @@ namespace REL } template - std::uintptr_t write_vfunc(std::size_t a_idx, F a_newFunc) // + std::uintptr_t write_vfunc(const std::size_t a_idx, const F a_newFunc) requires(std::same_as) { return write_vfunc(a_idx, stl::unrestricted_cast(a_newFunc)); diff --git a/src/REL/Relocation.cpp b/src/REL/Relocation.cpp new file mode 100644 index 000000000..4ce831bde --- /dev/null +++ b/src/REL/Relocation.cpp @@ -0,0 +1,34 @@ +#include "REL/Relocation.h" + +#include "REX/W32/KERNEL32.h" + +namespace REL +{ + void safe_write(std::uintptr_t a_dst, const void* a_src, std::size_t a_count) + { + std::uint32_t old{ 0 }; + bool success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); + if (success) { + std::memcpy(reinterpret_cast(a_dst), a_src, a_count); + success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, old, std::addressof(old)); + } + + assert(success); + } + + void safe_fill(std::uintptr_t a_dst, std::uint8_t a_value, std::size_t a_count) + { + std::uint32_t old{ 0 }; + bool success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, REX::W32::PAGE_EXECUTE_READWRITE, std::addressof(old)); + if (success) { + std::fill_n(reinterpret_cast(a_dst), a_count, a_value); + success = REX::W32::VirtualProtect( + reinterpret_cast(a_dst), a_count, old, std::addressof(old)); + } + + assert(success); + } +} From 44969e9246386cf0e9044764c6c12c9b8264253c Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:22:07 -0600 Subject: [PATCH 66/76] Add xmake support --- xmake.lua | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 xmake.lua diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 000000000..64a89959d --- /dev/null +++ b/xmake.lua @@ -0,0 +1,127 @@ +-- set minimum xmake version +set_xmakever("2.8.2") + +-- set project +set_project("commonlibsse") +set_arch("x64") +set_languages("c++20") +set_warnings("allextra") +set_encodings("utf-8") + +-- add rules +add_rules("mode.debug", "mode.release") + +-- define options +option("skyrim_ae") + set_default(false) + set_description("Enable support for Skyrim AE") + add_defines("SKYRIM_SUPPORT_AE=1") +option_end() + +option("skse_xbyak") + set_default(false) + set_description("Enable trampoline support for Xbyak") + add_defines("SKSE_SUPPORT_XBYAK=1") +option_end() + +-- require packages +add_requires("rsm-binary-io") +add_requires("spdlog", { configs = { header_only = false, wchar = true, std_format = true } }) + +if has_config("skse_xbyak") then + add_requires("xbyak") +end + +-- define targets +target("commonlibsse") + -- set target kind + set_kind("static") + + -- add packages + add_packages("rsm-binary-io", "spdlog", { public = true }) + + if has_config("skse_xbyak") then + add_packages("xbyak", { public = true }) + end + + -- add options + add_options("skyrim_ae", "skse_xbyak", { public = true }) + + -- add system links + add_syslinks("advapi32", "d3d11", "d3dcompiler", "dbghelp", "dxgi", "ole32", "shell32", "user32", "version") + + -- add source files + add_files("src/**.cpp") + + -- add header files + add_includedirs("include", { public = true }) + add_headerfiles( + "include/(RE/**.h)", + "include/(REL/**.h)", + "include/(REX/**.h)", + "include/(SKSE/**.h)" + ) + + -- set precompiled header + set_pcxxheader("include/SKSE/Impl/PCH.h") + + -- add flags + add_cxxflags("/EHsc", "/permissive-", { public = true }) + + -- add flags (cl) + add_cxxflags( + "cl::/bigobj", + "cl::/cgthreads8", + "cl::/diagnostics:caret", + "cl::/external:W0", + "cl::/fp:contract", + "cl::/fp:except-", + "cl::/guard:cf-", + "cl::/Zc:enumTypes", + "cl::/Zc:preprocessor", + "cl::/Zc:templateScope" + ) + + -- add flags (cl: warnings -> errors) + add_cxxflags("cl::/we4715") -- `function` : not all control paths return a value + + -- add flags (cl: disable warnings) + add_cxxflags( + "cl::/wd4005", -- macro redefinition + "cl::/wd4061", -- enumerator `identifier` in switch of enum `enumeration` is not explicitly handled by a case label + "cl::/wd4068", -- unknown pragma 'clang' + "cl::/wd4200", -- nonstandard extension used : zero-sized array in struct/union + "cl::/wd4201", -- nonstandard extension used : nameless struct/union + "cl::/wd4264", -- 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden + "cl::/wd4265", -- 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly + "cl::/wd4266", -- 'function' : no override available for virtual member function from base 'type'; function is hidden + "cl::/wd4324", -- 'struct_name' : structure was padded due to __declspec(align()) + "cl::/wd4371", -- 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member' + "cl::/wd4514", -- 'function' : unreferenced inline function has been removed + "cl::/wd4582", -- 'type': constructor is not implicitly called + "cl::/wd4583", -- 'type': destructor is not implicitly called + "cl::/wd4623", -- 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted + "cl::/wd4625", -- 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted + "cl::/wd4626", -- 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted + "cl::/wd4686", -- 'user-defined type' : possible change in behavior, change in UDT return calling convention + "cl::/wd4710", -- 'function' : function not inlined + "cl::/wd4711", -- function 'function' selected for inline expansion + "cl::/wd4820", -- 'bytes' bytes padding added after construct 'member_name' + "cl::/wd5082", -- second argument to 'va_start' is not the last named parameter + "cl::/wd5026", -- 'type': move constructor was implicitly defined as deleted + "cl::/wd5027", -- 'type': move assignment operator was implicitly defined as deleted + "cl::/wd5045", -- compiler will insert Spectre mitigation for memory load if /Qspectre switch specified + "cl::/wd5053", -- support for 'explicit()' in C++17 and earlier is a vendor extension + "cl::/wd5105", -- macro expansion producing 'defined' has undefined behavior (workaround for older msvc bug) + "cl::/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 + "cl::/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 + ) + + -- add flags (clang-cl: disable warnings) + add_cxxflags( + "clang_cl::-Wno-delete-non-abstract-non-virtual-dtor", + "clang_cl::-Wno-inconsistent-missing-override", + "clang_cl::-Wno-overloaded-virtual", + "clang_cl::-Wno-reinterpret-base-class" + ) +target_end() From d910f48e831064427a5908e98ee914dc41410c83 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:50:39 -0600 Subject: [PATCH 67/76] Improve xmake --- xmake-extra.lua | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ xmake.lua | 3 ++ 2 files changed, 102 insertions(+) create mode 100644 xmake-extra.lua diff --git a/xmake-extra.lua b/xmake-extra.lua new file mode 100644 index 000000000..7ab6b9419 --- /dev/null +++ b/xmake-extra.lua @@ -0,0 +1,99 @@ +local PLUGIN_VERSION_FILE = [[ +#include + +1 VERSIONINFO +FILEVERSION ${PLUGIN_VERSION_MAJOR}, ${PLUGIN_VERSION_MINOR}, ${PLUGIN_VERSION_PATCH}, 0 +PRODUCTVERSION ${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, ${PROJECT_VERSION_PATCH}, 0 +FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif +FILEOS 0x4L +FILETYPE 0x1L +FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "${PLUGIN_DESCRIPTION}" + VALUE "FileVersion", "${PLUGIN_VERSION}.0" + VALUE "InternalName", "${PLUGIN_NAME}" + VALUE "LegalCopyright", "${PLUGIN_AUTHOR} | ${PLUGIN_LICENSE}" + VALUE "ProductName", "${PROJECT_NAME}" + VALUE "ProductVersion", "${PROJECT_VERSION}.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END]] + +-- Usage: +-- add_deps("commonlibsse") +-- add_rules("commonlibsse.plugin", { +-- name = "PluginName", +-- author = "Author Name", +-- description = "Plugin Description", +-- email = "example@site.com" +-- }) + +rule("commonlibsse.plugin") + add_deps("win.sdk.resource") + + on_config(function(target) + import("core.base.semver") + import("core.project.depend") + import("core.project.project") + + target:set("arch", "x64") + target:set("kind", "shared") + + local conf = target:extraconf("rules", "commonlibsse.plugin") + local conf_dir = path.join(target:autogendir(), "rules", "commonlibsse", "plugin") + + local conf_map = { + PLUGIN_AUTHOR = conf.author or "", + PLUGIN_DESCRIPTION = conf.description or "", + PLUGIN_EMAIL = conf.email or "", + PLUGIN_LICENSE = (target:license() or "Unknown") .. " License", + PLUGIN_NAME = conf.name or target:name(), + PLUGIN_VERSION = target:version() or "0.0.0", + PLUGIN_VERSION_MAJOR = semver.new(target:version() or "0.0.0"):major(), + PLUGIN_VERSION_MINOR = semver.new(target:version() or "0.0.0"):minor(), + PLUGIN_VERSION_PATCH = semver.new(target:version() or "0.0.0"):patch(), + PROJECT_NAME = project.name() or "", + PROJECT_VERSION = project.version() or "0.0.0", + PROJECT_VERSION_MAJOR = semver.new(project.version() or "0.0.0"):major(), + PROJECT_VERSION_MINOR = semver.new(project.version() or "0.0.0"):minor(), + PROJECT_VERSION_PATCH = semver.new(project.version() or "0.0.0"):patch(), + } + + local conf_parse = function(a_str) + return a_str:gsub("(%${([^\n]-)})", function(_, a_var) + local result = conf_map[a_var:trim()] + if type(result) ~= "string" then + result = tostring(result) + end + assert(result ~= nil, "cannot get variable(%s)", a_var) + return result + end) + end + + local add_file = function(a_path, a_data) + local file_path = path.join(conf_dir, a_path) + depend.on_changed(function() + local file = io.open(file_path, "w") + if file then + file:write(conf_parse(a_data), "\n") + file:close() + end + end, { dependfile = target:dependfile(file_path), files = project.allfiles()}) + target:add("files", file_path) + end + + add_file("version.rc", PLUGIN_VERSION_FILE) + end) diff --git a/xmake.lua b/xmake.lua index 64a89959d..2fc70316d 100644 --- a/xmake.lua +++ b/xmake.lua @@ -1,6 +1,9 @@ -- set minimum xmake version set_xmakever("2.8.2") +-- make extras available +includes("xmake-extra.lua") + -- set project set_project("commonlibsse") set_arch("x64") From e184250b7d885ce72799fea1c810d216f1ab5c48 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 1 Mar 2024 20:28:57 -0600 Subject: [PATCH 68/76] Improve xmake again --- xmake-extra.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xmake-extra.lua b/xmake-extra.lua index 7ab6b9419..406fa926a 100644 --- a/xmake-extra.lua +++ b/xmake-extra.lua @@ -1,3 +1,20 @@ +local PLUGIN_FILE = [[ +#include +#ifdef SKYRIM_SUPPORT_AE +extern "C" __declspec(dllexport) constinit auto SKSEPlugin_Version = []() { + SKSE::PluginVersionData v; + v.PluginVersion({ ${PLUGIN_VERSION_MAJOR}, ${PLUGIN_VERSION_MINOR}, ${PLUGIN_VERSION_PATCH}, 0 }); + v.PluginName("${PLUGIN_NAME}"); + v.AuthorName("${PLUGIN_AUTHOR}"); + v.AuthorEmail("${PLUGIN_EMAIL}"); + v.UsesAddressLibrary(); + v.UsesUpdatedStructs(); + v.CompatibleVersions({ SKSE::RUNTIME_LATEST }); + return v; +}(); +#endif +]] + local PLUGIN_VERSION_FILE = [[ #include @@ -95,5 +112,6 @@ rule("commonlibsse.plugin") target:add("files", file_path) end + add_file("plugin.cpp", PLUGIN_FILE) add_file("version.rc", PLUGIN_VERSION_FILE) end) From f9197d35fb83f74664d4cfce13ee382eae214df9 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 2 Mar 2024 12:59:51 -0600 Subject: [PATCH 69/76] Fix Trampoline when Xbyak is enabled --- src/SKSE/Trampoline.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp index daa1849d1..a6a8347e2 100644 --- a/src/SKSE/Trampoline.cpp +++ b/src/SKSE/Trampoline.cpp @@ -10,6 +10,7 @@ # undef max # undef MEM_COMMIT # undef MEM_FREE +# undef MEM_RELEASE # undef MEM_RESERVE # undef PAGE_EXECUTE_READWRITE #endif From 185e7902ff2fdcaa81c93ff1186b44478a4a1da2 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 2 Mar 2024 13:03:56 -0600 Subject: [PATCH 70/76] Improve xmake (for SE) --- xmake-extra.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/xmake-extra.lua b/xmake-extra.lua index 406fa926a..e2ec0fff6 100644 --- a/xmake-extra.lua +++ b/xmake-extra.lua @@ -1,7 +1,8 @@ local PLUGIN_FILE = [[ #include #ifdef SKYRIM_SUPPORT_AE -extern "C" __declspec(dllexport) constinit auto SKSEPlugin_Version = []() { +extern "C" __declspec(dllexport) +constinit auto SKSEPlugin_Version = []() { SKSE::PluginVersionData v; v.PluginVersion({ ${PLUGIN_VERSION_MAJOR}, ${PLUGIN_VERSION_MINOR}, ${PLUGIN_VERSION_PATCH}, 0 }); v.PluginName("${PLUGIN_NAME}"); @@ -12,6 +13,27 @@ extern "C" __declspec(dllexport) constinit auto SKSEPlugin_Version = []() { v.CompatibleVersions({ SKSE::RUNTIME_LATEST }); return v; }(); +#else +extern "C" __declspec(dllexport) +bool SKSEPlugin_Query(const SKSE::QueryInterface* a_skse, SKSE::PluginInfo* a_info) +{ + a_info->infoVersion = SKSE::PluginInfo::kVersion; + a_info->name = "${PLUGIN_NAME}"; + a_info->version = REL::Version{ ${PLUGIN_VERSION_MAJOR}, ${PLUGIN_VERSION_MINOR}, ${PLUGIN_VERSION_PATCH}, 0 }.pack(); + + if (a_skse->IsEditor()) { + SKSE::log::critical("Loaded in editor, marking as incompatible"); + return false; + } + + const auto ver = a_skse->RuntimeVersion(); + if (ver < SKSE::RUNTIME_1_5_39) { + SKSE::log::critical("Unsupported runtime version {}", ver.string()); + return false; + } + + return true; +} #endif ]] From 48d0e917547bcbbe59d51aed4d24dd6514a3769d Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:54:56 -0600 Subject: [PATCH 71/76] c++23 --- CMakeLists.txt | 2 +- README.md | 2 +- include/RE/A/ActorValueList.h | 2 +- include/RE/B/BGSDefaultObjectManager.h | 6 +++--- include/RE/G/GFxTask.h | 2 +- include/RE/M/MiddleHighProcessData.h | 2 +- include/RE/T/TESDataHandler.h | 2 +- include/SKSE/Impl/PCH.h | 7 ------- src/RE/A/Actor.cpp | 2 +- src/RE/A/ActorValueList.cpp | 4 ++-- src/RE/B/BSInputDeviceManager.cpp | 12 ++++++------ src/RE/B/BSXFlags.cpp | 2 +- src/RE/G/GFxResource.cpp | 8 ++++---- src/RE/I/IFormFactory.cpp | 2 +- src/RE/N/NiAlphaProperty.cpp | 4 ++-- src/RE/T/TESAIForm.cpp | 6 +++--- src/RE/T/TESDataHandler.cpp | 2 +- src/RE/T/TypeInfo.cpp | 4 ++-- xmake.lua | 2 +- 19 files changed, 33 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95607da82..29d1637ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ target_compile_definitions( target_compile_features( "${PROJECT_NAME}" PUBLIC - cxx_std_20 + cxx_std_23 ) if (MSVC) diff --git a/README.md b/README.md index ed3755510..23baf2388 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # `CommonLibSSE` -[![C++20](https://img.shields.io/static/v1?label=standard&message=C%2B%2B20&color=blue&logo=c%2B%2B&&logoColor=white&style=flat)](https://en.cppreference.com/w/cpp/compiler_support) +[![C++23](https://img.shields.io/static/v1?label=standard&message=C%2B%2B20&color=blue&logo=c%2B%2B&&logoColor=white&style=flat)](https://en.cppreference.com/w/cpp/compiler_support) [![Platform](https://img.shields.io/static/v1?label=platform&message=windows&color=dimgray&style=flat)](#) [![Main CI](https://github.com/dann1/CommonLibSSE/actions/workflows/main_ci.yml/badge.svg?branch=dev)](https://github.com/dann1/CommonLibSSE/actions/workflows/main_ci.yml?branch=dev) diff --git a/include/RE/A/ActorValueList.h b/include/RE/A/ActorValueList.h index 9baf8fded..c8cd07c3f 100644 --- a/include/RE/A/ActorValueList.h +++ b/include/RE/A/ActorValueList.h @@ -20,7 +20,7 @@ namespace RE // members std::uint32_t unk00; // 00 std::uint32_t pad04; // 04 - ActorValueInfo* actorValues[stl::to_underlying(ActorValue::kTotal)]; // 08 + ActorValueInfo* actorValues[std::to_underlying(ActorValue::kTotal)]; // 08 }; } diff --git a/include/RE/B/BGSDefaultObjectManager.h b/include/RE/B/BGSDefaultObjectManager.h index 57b9525fd..3cdf81c05 100644 --- a/include/RE/B/BGSDefaultObjectManager.h +++ b/include/RE/B/BGSDefaultObjectManager.h @@ -442,17 +442,17 @@ namespace RE return func(); } - [[nodiscard]] TESForm* GetObject(DefaultObject a_object) const noexcept { return GetObject(stl::to_underlying(a_object)); } + [[nodiscard]] TESForm* GetObject(DefaultObject a_object) const noexcept { return GetObject(std::to_underlying(a_object)); } template [[nodiscard]] T* GetObject(DefaultObject a_object) const noexcept { - return GetObject(stl::to_underlying(a_object)); + return GetObject(std::to_underlying(a_object)); } [[nodiscard]] TESForm* GetObject(std::size_t a_idx) const noexcept { - assert(a_idx < stl::to_underlying(DefaultObject::kTotal)); + assert(a_idx < std::to_underlying(DefaultObject::kTotal)); return objectInit[a_idx] ? objects[a_idx] : nullptr; } diff --git a/include/RE/G/GFxTask.h b/include/RE/G/GFxTask.h index f3725597b..d7e174fb5 100644 --- a/include/RE/G/GFxTask.h +++ b/include/RE/G/GFxTask.h @@ -51,7 +51,7 @@ namespace RE inline TaskId GetTaskType() const { - return static_cast(stl::to_underlying(thisTaskId) & stl::to_underlying(TaskId::kType_Mask)); + return static_cast(std::to_underlying(thisTaskId) & std::to_underlying(TaskId::kType_Mask)); } inline TaskState GetTaskState() const diff --git a/include/RE/M/MiddleHighProcessData.h b/include/RE/M/MiddleHighProcessData.h index dd1be6302..dce381b3b 100644 --- a/include/RE/M/MiddleHighProcessData.h +++ b/include/RE/M/MiddleHighProcessData.h @@ -120,7 +120,7 @@ namespace RE BSTArray& operator[](BGSEntryPoint::ENTRY_POINT a_pos) { assert(a_pos < BGSEntryPoint::ENTRY_POINT::kTotal); - return perkEntryArrays[stl::to_underlying(a_pos)]; + return perkEntryArrays[std::to_underlying(a_pos)]; } // members diff --git a/include/RE/T/TESDataHandler.h b/include/RE/T/TESDataHandler.h index f0983c85a..64132cb68 100644 --- a/include/RE/T/TESDataHandler.h +++ b/include/RE/T/TESDataHandler.h @@ -72,7 +72,7 @@ namespace RE std::uint16_t pad002; // 002 std::uint32_t pad004; // 004 TESObjectList* objectList; // 008 - BSTArray formArrays[stl::to_underlying(FormType::Max)]; // 010 + BSTArray formArrays[std::to_underlying(FormType::Max)]; // 010 TESRegionList* regionList; // D00 NiTPrimitiveArray interiorCells; // D08 NiTPrimitiveArray addonNodes; // D20 diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index e82ba3469..4a87ff47b 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -637,13 +637,6 @@ namespace SKSE REX::W32::TerminateProcess(REX::W32::GetCurrentProcess(), EXIT_FAILURE); } - template - [[nodiscard]] constexpr auto to_underlying(Enum a_val) noexcept // - requires(std::is_enum_v) - { - return static_cast>(a_val); - } - template [[nodiscard]] To unrestricted_cast(From a_from) noexcept { diff --git a/src/RE/A/Actor.cpp b/src/RE/A/Actor.cpp index d4c77ca0a..e0a6abe8b 100644 --- a/src/RE/A/Actor.cpp +++ b/src/RE/A/Actor.cpp @@ -1225,7 +1225,7 @@ namespace RE if (auto magicCaster = magicCasters[i]) { auto castingSource = magicCaster->GetCastingSource(); if (magicCaster->currentSpell) { - result |= 1 << stl::to_underlying(castingSource); + result |= 1 << std::to_underlying(castingSource); } } } diff --git a/src/RE/A/ActorValueList.cpp b/src/RE/A/ActorValueList.cpp index 533f622fb..af7cacc33 100644 --- a/src/RE/A/ActorValueList.cpp +++ b/src/RE/A/ActorValueList.cpp @@ -7,13 +7,13 @@ namespace RE ActorValueInfo* ActorValueList::GetActorValue(ActorValue a_actorValue) const { return a_actorValue < ActorValue::kTotal ? - actorValues[stl::to_underlying(a_actorValue)] : + actorValues[std::to_underlying(a_actorValue)] : nullptr; } ActorValue ActorValueList::LookupActorValueByName(std::string_view a_enumName) const { - for (std::size_t i = 0; i < stl::to_underlying(ActorValue::kTotal); ++i) { + for (std::size_t i = 0; i < std::to_underlying(ActorValue::kTotal); ++i) { if (a_enumName.size() == strlen(actorValues[i]->enumName) && _strnicmp(actorValues[i]->enumName, a_enumName.data(), a_enumName.size()) == 0) { return static_cast(i); diff --git a/src/RE/B/BSInputDeviceManager.cpp b/src/RE/B/BSInputDeviceManager.cpp index 2851b7977..0b021d3a1 100644 --- a/src/RE/B/BSInputDeviceManager.cpp +++ b/src/RE/B/BSInputDeviceManager.cpp @@ -23,22 +23,22 @@ namespace RE BSPCGamepadDeviceHandler* BSInputDeviceManager::GetGamepadHandler() { - return static_cast(devices[stl::to_underlying(INPUT_DEVICE::kGamepad)]); + return static_cast(devices[std::to_underlying(INPUT_DEVICE::kGamepad)]); } BSWin32KeyboardDevice* BSInputDeviceManager::GetKeyboard() { - return static_cast(devices[stl::to_underlying(INPUT_DEVICE::kKeyboard)]); + return static_cast(devices[std::to_underlying(INPUT_DEVICE::kKeyboard)]); } BSWin32MouseDevice* BSInputDeviceManager::GetMouse() { - return static_cast(devices[stl::to_underlying(INPUT_DEVICE::kMouse)]); + return static_cast(devices[std::to_underlying(INPUT_DEVICE::kMouse)]); } BSWin32VirtualKeyboardDevice* BSInputDeviceManager::GetVirtualKeyboard() { - return static_cast(devices[stl::to_underlying(INPUT_DEVICE::kVirtualKeyboard)]); + return static_cast(devices[std::to_underlying(INPUT_DEVICE::kVirtualKeyboard)]); } bool BSInputDeviceManager::IsGamepadConnected() @@ -61,13 +61,13 @@ namespace RE bool BSInputDeviceManager::GetDeviceKeyMapping(INPUT_DEVICE a_device, std::uint32_t a_key, BSFixedString& a_mapping) { - auto device = devices[stl::to_underlying(a_device)]; + auto device = devices[std::to_underlying(a_device)]; return device && device->GetKeyMapping(a_key, a_mapping); } bool BSInputDeviceManager::GetDeviceMappedKeycode(INPUT_DEVICE a_device, std::uint32_t a_key, uint32_t& a_outKeyCode) { - auto device = devices[stl::to_underlying(a_device)]; + auto device = devices[std::to_underlying(a_device)]; return device && device->GetMappedKeycode(a_key, a_outKeyCode); } diff --git a/src/RE/B/BSXFlags.cpp b/src/RE/B/BSXFlags.cpp index 1d6377951..7ec1130d5 100644 --- a/src/RE/B/BSXFlags.cpp +++ b/src/RE/B/BSXFlags.cpp @@ -10,6 +10,6 @@ namespace RE void BSXFlags::SetFlags(Flag a_flags) { - value = stl::to_underlying(a_flags); + value = std::to_underlying(a_flags); } } diff --git a/src/RE/G/GFxResource.cpp b/src/RE/G/GFxResource.cpp index f5575f39c..f7321bb5e 100644 --- a/src/RE/G/GFxResource.cpp +++ b/src/RE/G/GFxResource.cpp @@ -71,19 +71,19 @@ namespace RE { return static_cast( GetResourceTypeCode() >> - stl::to_underlying(ResourceType::kTypeCode_Shift)); + std::to_underlying(ResourceType::kTypeCode_Shift)); } GFxResource::ResourceUse GFxResource::GetResourceUse() const { return static_cast( GetResourceTypeCode() & - stl::to_underlying(ResourceUse::kTypeCode_Mask)); + std::to_underlying(ResourceUse::kTypeCode_Mask)); } std::uint32_t GFxResource::MakeTypeCode(ResourceType a_resourceType, ResourceUse a_resourceUse) { - return (stl::to_underlying(a_resourceType) << stl::to_underlying(ResourceType::kTypeCode_Shift)) | - stl::to_underlying(a_resourceUse); + return (std::to_underlying(a_resourceType) << std::to_underlying(ResourceType::kTypeCode_Shift)) | + std::to_underlying(a_resourceUse); } } diff --git a/src/RE/I/IFormFactory.cpp b/src/RE/I/IFormFactory.cpp index a8418dcb1..eb986c89a 100644 --- a/src/RE/I/IFormFactory.cpp +++ b/src/RE/I/IFormFactory.cpp @@ -6,7 +6,7 @@ namespace RE { struct Factories { - IFormFactory* data[stl::to_underlying(FormType::Max)]; + IFormFactory* data[std::to_underlying(FormType::Max)]; }; REL::Relocation formFactories{ RELOCATION_ID(514355, 400508) }; diff --git a/src/RE/N/NiAlphaProperty.cpp b/src/RE/N/NiAlphaProperty.cpp index dfe706c02..4ea82c3f4 100644 --- a/src/RE/N/NiAlphaProperty.cpp +++ b/src/RE/N/NiAlphaProperty.cpp @@ -43,12 +43,12 @@ namespace RE void NiAlphaProperty::SetDestBlendMode(AlphaFunction a_mode) { alphaFlags &= ~480; - alphaFlags |= 32 * stl::to_underlying(a_mode); + alphaFlags |= 32 * std::to_underlying(a_mode); } void NiAlphaProperty::SetSrcBlendMode(AlphaFunction a_mode) { alphaFlags &= ~30; - alphaFlags |= 2 * stl::to_underlying(a_mode); + alphaFlags |= 2 * std::to_underlying(a_mode); } } diff --git a/src/RE/T/TESAIForm.cpp b/src/RE/T/TESAIForm.cpp index 1295e6e6c..5e331c64f 100644 --- a/src/RE/T/TESAIForm.cpp +++ b/src/RE/T/TESAIForm.cpp @@ -44,21 +44,21 @@ namespace RE void TESAIForm::SetAggressionLevel(ACTOR_AGGRESSION a_level) { - const auto level = stl::to_underlying(a_level); + const auto level = std::to_underlying(a_level); aiData.aggression1 = (level & 1) != 0; aiData.aggression2 = (level & 2) != 0; } void TESAIForm::SetAssistanceLevel(ACTOR_ASSISTANCE a_level) { - const auto level = stl::to_underlying(a_level); + const auto level = std::to_underlying(a_level); aiData.assistance1 = (level & 1) != 0; aiData.assistance2 = (level & 2) != 0; } void TESAIForm::SetConfidenceLevel(ACTOR_CONFIDENCE a_level) { - const auto level = stl::to_underlying(a_level); + const auto level = std::to_underlying(a_level); aiData.confidence1 = (level & 1) != 0; aiData.confidence2 = (level & 2) != 0; aiData.confidence3 = (level & 4) != 0; diff --git a/src/RE/T/TESDataHandler.cpp b/src/RE/T/TESDataHandler.cpp index c16c1341f..70db58a93 100644 --- a/src/RE/T/TESDataHandler.cpp +++ b/src/RE/T/TESDataHandler.cpp @@ -131,7 +131,7 @@ namespace RE BSTArray& TESDataHandler::GetFormArray(FormType a_formType) { - return formArrays[stl::to_underlying(a_formType)]; + return formArrays[std::to_underlying(a_formType)]; } ObjectRefHandle TESDataHandler::CreateReferenceAtLocation(TESBoundObject* a_base, const NiPoint3& a_location, const NiPoint3& a_rotation, TESObjectCELL* a_targetCell, TESWorldSpace* a_selfWorldSpace, TESObjectREFR* a_alreadyCreatedRef, BGSPrimitive* a_primitive, const ObjectRefHandle& a_linkedRoomRefHandle, bool a_forcePersist, bool a_arg11) diff --git a/src/RE/T/TypeInfo.cpp b/src/RE/T/TypeInfo.cpp index a6a61884f..8ec2c1601 100644 --- a/src/RE/T/TypeInfo.cpp +++ b/src/RE/T/TypeInfo.cpp @@ -82,9 +82,9 @@ namespace RE { assert(IsObject() || IsObjectArray()); if (IsObject()) { - return reinterpret_cast(stl::to_underlying(GetRawType()) & ~stl::to_underlying(RawType::kObject)); + return reinterpret_cast(std::to_underlying(GetRawType()) & ~std::to_underlying(RawType::kObject)); } else { - return reinterpret_cast(stl::to_underlying(GetRawType()) & ~stl::to_underlying(RawType::kObjectArray)); + return reinterpret_cast(std::to_underlying(GetRawType()) & ~std::to_underlying(RawType::kObjectArray)); } } diff --git a/xmake.lua b/xmake.lua index 2fc70316d..5830912bf 100644 --- a/xmake.lua +++ b/xmake.lua @@ -7,7 +7,7 @@ includes("xmake-extra.lua") -- set project set_project("commonlibsse") set_arch("x64") -set_languages("c++20") +set_languages("c++23") set_warnings("allextra") set_encodings("utf-8") From 475c51d80543dd8f1d652f9f765e76198ff4c2c4 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sat, 2 Mar 2024 18:12:33 -0600 Subject: [PATCH 72/76] Fix SerializationInterface return types --- include/SKSE/Interfaces.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/SKSE/Interfaces.h b/include/SKSE/Interfaces.h index fa9d4d9a3..a519212cd 100644 --- a/include/SKSE/Interfaces.h +++ b/include/SKSE/Interfaces.h @@ -106,7 +106,7 @@ namespace SKSE std::negation_v< std::is_pointer>, int> = 0> - inline std::uint32_t WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const T& a_buf) const + inline bool WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const T& a_buf) const { return WriteRecord(a_type, a_version, std::addressof(a_buf), sizeof(T)); } @@ -117,7 +117,7 @@ namespace SKSE std::enable_if_t< std::is_array_v, int> = 0> - inline std::uint32_t WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const T (&a_buf)[N]) const + inline bool WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const T (&a_buf)[N]) const { return WriteRecord(a_type, a_version, std::addressof(a_buf), sizeof(T) * N); } @@ -132,7 +132,7 @@ namespace SKSE std::negation_v< std::is_pointer>, int> = 0> - inline std::uint32_t WriteRecordData(const T& a_buf) const + inline bool WriteRecordData(const T& a_buf) const { return WriteRecordData(std::addressof(a_buf), sizeof(T)); } @@ -143,7 +143,7 @@ namespace SKSE std::enable_if_t< std::is_array_v, int> = 0> - inline std::uint32_t WriteRecordData(const T (&a_buf)[N]) const + inline bool WriteRecordData(const T (&a_buf)[N]) const { return WriteRecordData(std::addressof(a_buf), sizeof(T) * N); } From bbdfa49cc02c588354bb9c861522e7cda6a87615 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 3 Mar 2024 18:17:19 -0600 Subject: [PATCH 73/76] Add TESObjectREFR::OpenContainer --- include/RE/T/TESObjectREFR.h | 1 + src/RE/T/TESObjectREFR.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index a26df60ae..bb0abfbfb 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -450,6 +450,7 @@ namespace RE bool MoveToNode(TESObjectREFR* a_target, const BSFixedString& a_nodeName); bool MoveToNode(TESObjectREFR* a_target, NiAVObject* a_node); bool NameIncludes(std::string a_word); + void OpenContainer(std::int32_t a_openType) const; NiPointer PlaceObjectAtMe(TESBoundObject* a_baseToPlace, bool a_forcePersist) const; void PlayAnimation(stl::zstring a_from, stl::zstring a_to); void PlayAnimation(NiControllerManager* a_manager, NiControllerSequence* a_toSeq, NiControllerSequence* a_fromSeq); diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index 9d83840dd..9fa6af0f6 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -790,6 +790,13 @@ namespace RE return name.find(a_word) != std::string::npos; } + void TESObjectREFR::OpenContainer(std::int32_t a_openType) const + { + using func_t = decltype(&TESObjectREFR::OpenContainer); + REL::Relocation func{ RELOCATION_ID(50211, 51140) }; + func(this, a_openType); + } + NiPointer TESObjectREFR::PlaceObjectAtMe(TESBoundObject* a_baseToPlace, bool a_forcePersist) const { const auto handle = TESDataHandler::GetSingleton()->CreateReferenceAtLocation(a_baseToPlace, GetPosition(), GetAngle(), GetParentCell(), GetWorldspace(), nullptr, nullptr, ObjectRefHandle(), a_forcePersist, true); From 919033346b867bedf25cb31660c8c2990872b593 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Mon, 4 Mar 2024 00:24:23 +0000 Subject: [PATCH 74/76] maintenance --- include/REL/Relocation.h | 32 +++++++++++--------------------- include/REL/Version.h | 2 +- src/SKSE/Trampoline.cpp | 2 +- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index 1b5aa5fde..8f07112bc 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -267,8 +267,7 @@ namespace REL template std::invoke_result_t operator()(Args&&... a_args) const - noexcept(std::is_nothrow_invocable_v) - requires(std::invocable) + noexcept(std::is_nothrow_invocable_v) requires(std::invocable) { return REL::invoke(get(), std::forward(a_args)...); } @@ -284,56 +283,48 @@ namespace REL } template - void write(const U& a_data) - requires(std::same_as) + void write(const U& a_data) requires(std::same_as) { safe_write(address(), std::addressof(a_data), sizeof(T)); } template - void write(const std::span a_data) - requires(std::same_as) + void write(const std::span a_data) requires(std::same_as) { safe_write(address(), a_data.data(), a_data.size_bytes()); } - + template - std::uintptr_t write_branch(const std::uintptr_t a_dst) - requires(std::same_as) + std::uintptr_t write_branch(const std::uintptr_t a_dst) requires(std::same_as) { return SKSE::GetTrampoline().write_branch(address(), a_dst); } template - std::uintptr_t write_branch(const F a_dst) - requires(std::same_as) + std::uintptr_t write_branch(const F a_dst) requires(std::same_as) { return SKSE::GetTrampoline().write_branch(address(), stl::unrestricted_cast(a_dst)); } template - std::uintptr_t write_call(const std::uintptr_t a_dst) - requires(std::same_as) + std::uintptr_t write_call(const std::uintptr_t a_dst) requires(std::same_as) { return SKSE::GetTrampoline().write_call(address(), a_dst); } template - std::uintptr_t write_call(const F a_dst) - requires(std::same_as) + std::uintptr_t write_call(const F a_dst) requires(std::same_as) { return SKSE::GetTrampoline().write_call(address(), stl::unrestricted_cast(a_dst)); } - void write_fill(const std::uint8_t a_value, const std::size_t a_count) - requires(std::same_as) + void write_fill(const std::uint8_t a_value, const std::size_t a_count) requires(std::same_as) { safe_fill(address(), a_value, a_count); } template - std::uintptr_t write_vfunc(const std::size_t a_idx, const std::uintptr_t a_newFunc) - requires(std::same_as) + std::uintptr_t write_vfunc(const std::size_t a_idx, const std::uintptr_t a_newFunc) requires(std::same_as) { const auto addr = address() + (sizeof(void*) * a_idx); const auto result = *reinterpret_cast(addr); @@ -342,8 +333,7 @@ namespace REL } template - std::uintptr_t write_vfunc(const std::size_t a_idx, const F a_newFunc) - requires(std::same_as) + std::uintptr_t write_vfunc(const std::size_t a_idx, const F a_newFunc) requires(std::same_as) { return write_vfunc(a_idx, stl::unrestricted_cast(a_newFunc)); } diff --git a/include/REL/Version.h b/include/REL/Version.h index d24462e5a..31fb4a29f 100644 --- a/include/REL/Version.h +++ b/include/REL/Version.h @@ -68,7 +68,7 @@ namespace REL return result; } - [[nodiscard]] static constexpr Version unpack(std::uint32_t a_packedVersion) noexcept + [[nodiscard]] static constexpr Version unpack(std::uint32_t a_packedVersion) noexcept { return REL::Version{ static_cast((a_packedVersion >> 24) & 0x0FF), diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp index a6a8347e2..67ada4d5e 100644 --- a/src/SKSE/Trampoline.cpp +++ b/src/SKSE/Trampoline.cpp @@ -10,7 +10,7 @@ # undef max # undef MEM_COMMIT # undef MEM_FREE -# undef MEM_RELEASE +# undef MEM_RELEASE # undef MEM_RESERVE # undef PAGE_EXECUTE_READWRITE #endif From fd38f90ac976920b10b188fd06588a1563befe83 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sat, 16 Mar 2024 23:56:21 +0530 Subject: [PATCH 75/76] Misc RE --- cmake/sourcelist.cmake | 9 ++- include/RE/B/BSAudioManager.h | 6 ++ include/RE/B/BSScaleformExternalTexture.h | 55 +++++++++++++++ include/RE/B/BSScaleformImageLoader.h | 51 ++++++++++++++ include/RE/B/BSSoundHandle.h | 3 + include/RE/B/BookMenu.h | 28 ++++---- include/RE/C/Calendar.h | 4 +- include/RE/C/CreationClubMenu.h | 6 +- include/RE/F/FileID.h | 4 +- include/RE/G/GFxImageLoader.h | 20 ++++++ include/RE/G/GFxImageResource.h | 28 ++++++++ include/RE/G/GImage.h | 2 +- include/RE/G/GImageInfo.h | 32 +++++++++ include/RE/G/GImageInfoBase.h | 36 ++++++++++ include/RE/G/GImageInfoBaseImpl.h | 24 +++++++ include/RE/H/HUDData.h | 2 + include/RE/H/HighProcessData.h | 4 +- include/RE/H/SendHUDMessage.h | 21 ++++++ include/RE/I/ID.h | 9 ++- include/RE/I/ImageData.h | 14 ---- include/RE/I/InputEvent.h | 4 ++ include/RE/L/LocalMapMenu.h | 4 +- include/RE/M/MainMenu.h | 14 ++-- include/RE/M/MenuTopicManager.h | 84 +++++++++++------------ include/RE/M/MiddleHighProcessData.h | 2 +- include/RE/Skyrim.h | 9 ++- include/RE/U/UISaveLoadManager.h | 15 ++-- src/RE/B/BSAudioManager.cpp | 7 ++ src/RE/B/BSSoundHandle.cpp | 14 ++++ src/RE/C/Calendar.cpp | 29 +++++++- src/RE/I/InputEvent.cpp | 11 +++ 31 files changed, 449 insertions(+), 102 deletions(-) create mode 100644 include/RE/B/BSScaleformExternalTexture.h create mode 100644 include/RE/B/BSScaleformImageLoader.h create mode 100644 include/RE/G/GFxImageLoader.h create mode 100644 include/RE/G/GFxImageResource.h create mode 100644 include/RE/G/GImageInfo.h create mode 100644 include/RE/G/GImageInfoBase.h create mode 100644 include/RE/G/GImageInfoBaseImpl.h create mode 100644 include/RE/H/SendHUDMessage.h delete mode 100644 include/RE/I/ImageData.h diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 38c8cd4d1..8dea6831c 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -310,6 +310,8 @@ set(SOURCES include/RE/B/BSResourceNiBinaryStream.h include/RE/B/BSResponse.h include/RE/B/BSSaveDataSystemUtility.h + include/RE/B/BSScaleformExternalTexture.h + include/RE/B/BSScaleformImageLoader.h include/RE/B/BSScaleformManager.h include/RE/B/BSScaleformTranslator.h include/RE/B/BSSceneGraph.h @@ -768,6 +770,8 @@ set(SOURCES include/RE/G/GFxExternalInterface.h include/RE/G/GFxFileConstants.h include/RE/G/GFxFunctionHandler.h + include/RE/G/GFxImageLoader.h + include/RE/G/GFxImageResource.h include/RE/G/GFxInitImportActions.h include/RE/G/GFxKey.h include/RE/G/GFxKeyboardState.h @@ -839,6 +843,9 @@ set(SOURCES include/RE/G/GHashsetNodeEntry.h include/RE/G/GImage.h include/RE/G/GImageBase.h + include/RE/G/GImageInfo.h + include/RE/G/GImageInfoBase.h + include/RE/G/GImageInfoBaseImpl.h include/RE/G/GList.h include/RE/G/GMath.h include/RE/G/GMatrix2D.h @@ -897,6 +904,7 @@ set(SOURCES include/RE/H/HighProcessData.h include/RE/H/HitData.h include/RE/H/HorseCameraState.h + include/RE/H/SendHUDMessage.h include/RE/H/hkAabb.h include/RE/H/hkArray.h include/RE/H/hkBaseObject.h @@ -1091,7 +1099,6 @@ set(SOURCES include/RE/I/IVMSaveLoadInterface.h include/RE/I/IVirtualMachine.h include/RE/I/IXAudio2VoiceCallback.h - include/RE/I/ImageData.h include/RE/I/ImageSpaceData.h include/RE/I/ImageSpaceEffect.h include/RE/I/ImageSpaceEffectDepthOfField.h diff --git a/include/RE/B/BSAudioManager.h b/include/RE/B/BSAudioManager.h index a69dc95c5..8e172b160 100644 --- a/include/RE/B/BSAudioManager.h +++ b/include/RE/B/BSAudioManager.h @@ -10,6 +10,11 @@ namespace RE class BSXAudio2GameSound; struct BSSoundHandle; + namespace BSResource + { + struct ID; + } + class BSAudioManager { public: @@ -19,6 +24,7 @@ namespace RE bool Play(BSISoundDescriptor* a_descriptor); bool BuildSoundDataFromDescriptor(BSSoundHandle& a_soundHandle, BSISoundDescriptor* a_descriptor, std::uint32_t a_flags = 0x1A); void BuildSoundDataFromEditorID(BSSoundHandle& a_soundHandle, const char* a_editorID, std::uint32_t a_flags); + void BuildSoundDataFromFile(BSSoundHandle& a_soundHandle, const BSResource::ID& a_file, std::uint32_t a_flags, std::uint32_t a_priority); // members std::uint64_t unk000; // 000 diff --git a/include/RE/B/BSScaleformExternalTexture.h b/include/RE/B/BSScaleformExternalTexture.h new file mode 100644 index 000000000..2616769cb --- /dev/null +++ b/include/RE/B/BSScaleformExternalTexture.h @@ -0,0 +1,55 @@ +#pragma once + +#include "RE/B/BSFixedString.h" +#include "RE/N/NiTexture.h" + +namespace RE +{ + class BSScaleformExternalTexture + { + public: + BSScaleformExternalTexture() : + gamebryoTexture{ nullptr }, + renderTarget(0), + pad0C(0) + {} + + ~BSScaleformExternalTexture() + { + ReleaseTexture(); + } + + BSScaleformExternalTexture(const BSScaleformExternalTexture&) = delete; + BSScaleformExternalTexture(BSScaleformExternalTexture&&) = delete; + BSScaleformExternalTexture& operator=(const BSScaleformExternalTexture&) = delete; + BSScaleformExternalTexture& operator=(BSScaleformExternalTexture&&) = delete; + + bool LoadPNG(const BSFixedString& a_path) + { + using func_t = decltype(&BSScaleformExternalTexture::LoadPNG); + REL::Relocation func{ RELOCATION_ID(80298, 82321) }; + return func(this, a_path); + } + + void ReleaseTexture() + { + using func_t = decltype(&BSScaleformExternalTexture::ReleaseTexture); + REL::Relocation func{ RELOCATION_ID(80294, 82317) }; + return func(this); + } + + bool SetTexture(NiTexture* a_texture) + { + using func_t = decltype(&BSScaleformExternalTexture::SetTexture); + REL::Relocation func{ RELOCATION_ID(80295, 82318) }; + return func(this, a_texture); + } + + // members + NiPointer gamebryoTexture; // 00 + std::uint32_t renderTarget; // 08 + std::uint32_t pad0C; // 0C + BSFixedString filePath; // 10 + }; + static_assert(sizeof(BSScaleformExternalTexture) == 0x18); +} diff --git a/include/RE/B/BSScaleformImageLoader.h b/include/RE/B/BSScaleformImageLoader.h new file mode 100644 index 000000000..3362da032 --- /dev/null +++ b/include/RE/B/BSScaleformImageLoader.h @@ -0,0 +1,51 @@ +#pragma once + +#include "RE/B/BSTHashMap.h" +#include "RE/G/GFxImageLoader.h" +#include "RE/G/GPtr.h" + +namespace RE +{ + class BSScaleformExternalTexture; + class GTexture; + class NiTexture; + + class BSScaleformImageLoader : public GFxImageLoader + { + public: + inline static constexpr auto RTTI = RTTI_BSScaleformImageLoader; + + class TextureEntry + { + public: + GPtr texture; // 00 + NiTexture* sourceTexture; // 08 + std::uint32_t refCount; // 10 + std::uint32_t pad14; // 14 + }; + static_assert(sizeof(TextureEntry) == 0x18); + + virtual ~BSScaleformImageLoader(); // 00 + + // override (GFxImageLoader) + GImageInfoBase* LoadImage(const char* a_url) override; // 01 + + bool AddTexture(BSScaleformExternalTexture& a_texture) + { + using func_t = decltype(&BSScaleformImageLoader::AddTexture); + REL::Relocation func{ RELOCATION_ID(82382, 84469) }; + return func(this, a_texture); + } + + void RemoveTexture(BSScaleformExternalTexture& a_texture) + { + using func_t = decltype(&BSScaleformImageLoader::RemoveTexture); + REL::Relocation func{ RELOCATION_ID(82383, 84470) }; + return func(this, a_texture); + } + + // members + BSTHashMap textures; // 18 + }; + static_assert(sizeof(BSScaleformImageLoader) == 0x48); +} diff --git a/include/RE/B/BSSoundHandle.h b/include/RE/B/BSSoundHandle.h index 7151fe358..c7d12e40a 100644 --- a/include/RE/B/BSSoundHandle.h +++ b/include/RE/B/BSSoundHandle.h @@ -2,6 +2,7 @@ namespace RE { + class BGSSoundOutput; class NiAVObject; class NiPoint3; @@ -34,11 +35,13 @@ namespace RE bool FadeInPlay(std::uint16_t a_fadeTimeMS); bool FadeOutAndRelease(std::uint16_t a_fadeTimeMS); + std::uint64_t GetDuration(); [[nodiscard]] bool IsPlaying() const; [[nodiscard]] bool IsValid() const; bool SetFrequency(float a_frequency); bool SetPosition(NiPoint3 a_pos); void SetObjectToFollow(NiAVObject* a_node); + void SetOutputModel(const BGSSoundOutput* a_outputModel); bool SetVolume(float a_volume); bool Stop(); bool Play(); diff --git a/include/RE/B/BookMenu.h b/include/RE/B/BookMenu.h index a99c7d2af..8650f730c 100644 --- a/include/RE/B/BookMenu.h +++ b/include/RE/B/BookMenu.h @@ -1,10 +1,10 @@ #pragma once +#include "RE/B/BSScaleformExternalTexture.h" #include "RE/B/BSString.h" #include "RE/B/BSTEvent.h" #include "RE/G/GPtr.h" #include "RE/I/IMenu.h" -#include "RE/I/ImageData.h" #include "RE/N/NiMatrix3.h" #include "RE/N/NiSmartPointer.h" #include "RE/S/SimpleAnimationGraphManagerHolder.h" @@ -48,19 +48,19 @@ namespace RE static void OpenBookMenu(const BSString& a_description, const ExtraDataList* a_extraList, TESObjectREFR* a_ref, TESObjectBOOK* a_book, const NiPoint3& a_pos, const NiMatrix3& a_rot, float a_scale, bool a_useDefaultPos); // members - BSTArray unk50; // 50 - GPtr book; // 68 - NiPointer book3D; // 70 - std::uint32_t unk78; // 78 - std::uint32_t pad7C; // 7C - std::uint64_t unk80; // 80 - void* unk88; // 88 - smart ptr - std::uint16_t unk90; // 90 - std::uint16_t unk92; // 92 - bool closeMenu; // 94 - bool isNote; // 95 - std::uint8_t unk96; // 96 - std::uint8_t pad97; // 97 + BSTArray bookTextures; // 50 + GPtr book; // 68 + NiPointer book3D; // 70 + std::uint32_t unk78; // 78 + std::uint32_t pad7C; // 7C + std::uint64_t unk80; // 80 + void* unk88; // 88 - smart ptr + std::uint16_t unk90; // 90 + std::uint16_t unk92; // 92 + bool closeMenu; // 94 + bool isNote; // 95 + std::uint8_t unk96; // 96 + std::uint8_t pad97; // 97 }; static_assert(sizeof(BookMenu) == 0x98); } diff --git a/include/RE/C/Calendar.h b/include/RE/C/Calendar.h index 3ac4dcd06..8495e80b0 100644 --- a/include/RE/C/Calendar.h +++ b/include/RE/C/Calendar.h @@ -71,9 +71,11 @@ namespace RE void GetTimeDateString(char* a_dest, std::uint32_t a_max, bool a_showYear) const; [[nodiscard]] float GetHour() const; [[nodiscard]] float GetHoursPassed() const; - [[nodiscard]] float GetHoursPerDay() const; + [[nodiscard]] static float GetHoursPerDay(); + [[nodiscard]] std::uint32_t GetMinutes() const; [[nodiscard]] std::uint32_t GetMonth() const; [[nodiscard]] std::string GetMonthName() const; + [[nodiscard]] std::string GetOrdinalSuffix() const; [[nodiscard]] std::tm GetTime() const; [[nodiscard]] float GetTimescale() const; [[nodiscard]] std::uint32_t GetYear() const; diff --git a/include/RE/C/CreationClubMenu.h b/include/RE/C/CreationClubMenu.h index 9e26db4d0..82a6536a0 100644 --- a/include/RE/C/CreationClubMenu.h +++ b/include/RE/C/CreationClubMenu.h @@ -1,9 +1,9 @@ #pragma once +#include "RE/B/BSScaleformExternalTexture.h" #include "RE/B/BSTEvent.h" #include "RE/G/GFxFunctionHandler.h" #include "RE/I/IMenu.h" -#include "RE/I/ImageData.h" #include "RE/M/MenuEventHandler.h" namespace RE @@ -39,8 +39,8 @@ namespace RE BSEventNotifyControl ProcessEvent(const MenuOpenCloseEvent* a_event, BSTEventSource* a_eventSource) override; // 01 // members - ImageData background; // 58 - ImageData details; // 70 + BSScaleformExternalTexture background; // 58 + BSScaleformExternalTexture details; // 70 }; static_assert(sizeof(CreationClubMenu) == 0x88); } diff --git a/include/RE/F/FileID.h b/include/RE/F/FileID.h index a4c8003fa..921394ec4 100644 --- a/include/RE/F/FileID.h +++ b/include/RE/F/FileID.h @@ -8,8 +8,8 @@ namespace RE { public: // members - std::uint32_t file; // 0 - char ext[4]; // 0 + std::uint32_t file{ 0 }; // 0 + char ext[4]{ 0 }; // 0 }; static_assert(sizeof(FileID) == 0x8); } diff --git a/include/RE/G/GFxImageLoader.h b/include/RE/G/GFxImageLoader.h new file mode 100644 index 000000000..27b44228b --- /dev/null +++ b/include/RE/G/GFxImageLoader.h @@ -0,0 +1,20 @@ +#pragma once + +#include "RE/G/GFxState.h" + +namespace RE +{ + class GImageInfoBase; + + class GFxImageLoader : public GFxState + { + public: + inline static constexpr auto RTTI = RTTI_GFxImageLoader; + + virtual ~GFxImageLoader(); // 00 + + // add + virtual GImageInfoBase* LoadImage(const char* a_url) = 0; // 01 + }; + static_assert(sizeof(GFxImageLoader) == 0x18); +} diff --git a/include/RE/G/GFxImageResource.h b/include/RE/G/GFxImageResource.h new file mode 100644 index 000000000..2dc628f0c --- /dev/null +++ b/include/RE/G/GFxImageResource.h @@ -0,0 +1,28 @@ +#pragma once + +#include "RE/G/GFxResource.h" +#include "RE/G/GFxResourceKey.h" +#include "RE/G/GPtr.h" + +namespace RE +{ + class GImageInfoBase; + + class GFxImageResource : public GFxResource + { + public: + ~GFxImageResource() override; // 00 + + GImageInfoBase* GetImageInfo() const + { + return _imageInfo.get(); + } + + protected: + // members + GPtr _imageInfo; // 18 + GFxResourceKey _key; // 20 + ResourceUse _useType; // 30 + }; + static_assert(sizeof(GFxImageResource) == 0x38); +} diff --git a/include/RE/G/GImage.h b/include/RE/G/GImage.h index ca6b45d67..b2934116a 100644 --- a/include/RE/G/GImage.h +++ b/include/RE/G/GImage.h @@ -10,7 +10,7 @@ namespace RE public GImageBase { public: - ~GImage() override; // 00 + ~GImage() override = default; // 00 }; static_assert(sizeof(GImage) == 0x48); } diff --git a/include/RE/G/GImageInfo.h b/include/RE/G/GImageInfo.h new file mode 100644 index 000000000..f49943e1b --- /dev/null +++ b/include/RE/G/GImageInfo.h @@ -0,0 +1,32 @@ +#pragma once + +#include "RE/G/GImageInfoBaseImpl.h" + +namespace RE +{ + class GImageInfo : public GImageInfoBaseImpl + { + public: + ~GImageInfo() override; // 00 + + // override (GImageInfoImpl) + std::uint32_t GetWidth() const override; // 01 + std::uint32_t GetHeight() const override; // 02 + GTexture* GetTexture(GRenderer* a_renderer) override; // 03 + std::uint32_t GetImageInfoType() const override; // 06 + + // override (GTexture::ChangeHandler) + void OnChange(GRenderer* a_renderer, EventType a_changeType) override; // 01 + bool Recreate(GRenderer* a_renderer) override; // 02 + + // members + GPtr image; // 28 + std::uint32_t targetWidth; // 30 + std::uint32_t targetHeight; // 34 + bool releaseImage; // 38 + std::uint8_t pad39; // 39 + std::uint16_t pad3A; // 3A + std::uint32_t pad3C; // 3C + }; + static_assert(sizeof(GImageInfo) == 0x40); +} diff --git a/include/RE/G/GImageInfoBase.h b/include/RE/G/GImageInfoBase.h new file mode 100644 index 000000000..94ca9c576 --- /dev/null +++ b/include/RE/G/GImageInfoBase.h @@ -0,0 +1,36 @@ +#pragma once + +#include "RE/G/GMemory.h" +#include "RE/G/GRect.h" +#include "RE/G/GRefCountBaseNTS.h" +#include "RE/G/GStats.h" +#include "RE/G/GTexture.h" + +namespace RE +{ + class GRenderer; + + class GImageInfoBase : + public GRefCountBaseNTS, // 00 + public GTexture::ChangeHandler // 10 + { + public: + enum class ImageInfoType + { + kImageInfo, + kSubImageInfo, + kOther + }; + + virtual ~GImageInfoBase(); // 00 + + // add + virtual std::uint32_t GetWidth() const = 0; // 01 + virtual std::uint32_t GetHeight() const = 0; // 02 + virtual GTexture* GetTexture(GRenderer* a_renderer) = 0; // 03 + virtual GImageInfoBase* CreateSubImage(const GRect& a_rect, GMemoryHeap* a_heap = GMemory::GetGlobalHeap()); // 04 + virtual GRect GetRect() const; // 05 + virtual std::uint32_t GetImageInfoType() const; // 06 + }; + static_assert(sizeof(GImageInfoBase) == 0x18); +} diff --git a/include/RE/G/GImageInfoBaseImpl.h b/include/RE/G/GImageInfoBaseImpl.h new file mode 100644 index 000000000..649128635 --- /dev/null +++ b/include/RE/G/GImageInfoBaseImpl.h @@ -0,0 +1,24 @@ +#pragma once + +#include "RE/G/GImageInfoBase.h" + +namespace RE +{ + class GImageInfoBaseImpl : public GImageInfoBase + { + public: + ~GImageInfoBaseImpl() override; // 00 + + // override (GImageInfoBase) + GTexture* GetTexture(GRenderer* a_renderer) override; // 03 + + // override (GTexture::ChangeHandler) + void OnChange(GRenderer* a_renderer, EventType a_changeType); // 01 + + // members + GPtr texture; // 18 + std::uint32_t textureUsage; // 20 + std::uint32_t pad24; // 24 + }; + static_assert(sizeof(GImageInfoBaseImpl) == 0x28); +} diff --git a/include/RE/H/HUDData.h b/include/RE/H/HUDData.h index 4b5c1d9a7..bf65ac3e2 100644 --- a/include/RE/H/HUDData.h +++ b/include/RE/H/HUDData.h @@ -19,6 +19,8 @@ namespace RE kActivateNoLabel = 3, kCenter = 4, kSubtitle = 5, + kSubtitleHide = 6, + kShowArrowCount = 7, kSetBlinking = 11, kSetFadeOut = 12, kSetPct = 13, diff --git a/include/RE/H/HighProcessData.h b/include/RE/H/HighProcessData.h index 079a767f8..6b94fcb58 100644 --- a/include/RE/H/HighProcessData.h +++ b/include/RE/H/HighProcessData.h @@ -287,9 +287,9 @@ namespace RE float breathTimer; // 324 float voiceTimer; // 328 float dyingTimer; // 32C - std::uint64_t unk330; // 330 + TESTopicInfo* lastGreeting; // 330 std::uint64_t unk338; // 338 - float closeDialogueTimer; // 340 + float awarePlayerTimer; // 340 std::uint32_t unk344; // 344 TESIdleForm* currentProcessIdle; // 348 RefHandle unk350; // 350 diff --git a/include/RE/H/SendHUDMessage.h b/include/RE/H/SendHUDMessage.h new file mode 100644 index 000000000..e09adee5f --- /dev/null +++ b/include/RE/H/SendHUDMessage.h @@ -0,0 +1,21 @@ +#pragma once + +namespace RE +{ + namespace SendHUDMessage + { + inline void PopHUDMode(const char* a_hudMode) + { + using func_t = decltype(&SendHUDMessage::PopHUDMode); + REL::Relocation func{ RELOCATION_ID(50726, 51621) }; + return func(a_hudMode); + } + + inline void PushHUDMode(const char* a_hudMode) + { + using func_t = decltype(&SendHUDMessage::PushHUDMode); + REL::Relocation func{ RELOCATION_ID(50725, 51620) }; + return func(a_hudMode); + } + } +} diff --git a/include/RE/I/ID.h b/include/RE/I/ID.h index 037d92558..3aa2081d8 100644 --- a/include/RE/I/ID.h +++ b/include/RE/I/ID.h @@ -9,8 +9,15 @@ namespace RE struct ID : public FileID { public: + void GenerateFromPath(const char* a_path) + { + using func_t = decltype(&ID::GenerateFromPath); + REL::Relocation func{ RELOCATION_ID(68635, 69979) }; + return func(this, a_path); + } + // members - std::uint32_t dir; // 0 + std::uint32_t dir{ 0 }; // 0 }; static_assert(sizeof(ID) == 0xC); } diff --git a/include/RE/I/ImageData.h b/include/RE/I/ImageData.h deleted file mode 100644 index 2cb0db36c..000000000 --- a/include/RE/I/ImageData.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "RE/B/BSFixedString.h" - -namespace RE -{ - struct ImageData - { - void* unk00; // 00 - smart ptr - std::uint64_t unk08; // 08 - BSFixedString filePath; // 10 - }; - static_assert(sizeof(ImageData) == 0x18); -} diff --git a/include/RE/I/InputEvent.h b/include/RE/I/InputEvent.h index b8b8841e3..a5eef04ba 100644 --- a/include/RE/I/InputEvent.h +++ b/include/RE/I/InputEvent.h @@ -19,6 +19,7 @@ namespace RE class CharEvent; class IDEvent; class MouseMoveEvent; + class ThumbstickEvent; class InputEvent { @@ -45,6 +46,9 @@ namespace RE [[nodiscard]] MouseMoveEvent* AsMouseMoveEvent(); [[nodiscard]] const MouseMoveEvent* AsMouseMoveEvent() const; + [[nodiscard]] ThumbstickEvent* AsThumbstickEvent(); + [[nodiscard]] const ThumbstickEvent* AsThumbstickEvent() const; + // members stl::enumeration device; // 08 stl::enumeration eventType; // 0C diff --git a/include/RE/L/LocalMapMenu.h b/include/RE/L/LocalMapMenu.h index fa5e1e7cb..ae5846c86 100644 --- a/include/RE/L/LocalMapMenu.h +++ b/include/RE/L/LocalMapMenu.h @@ -1,10 +1,10 @@ #pragma once #include "RE/B/BSCullingProcess.h" +#include "RE/B/BSScaleformExternalTexture.h" #include "RE/B/BSTArray.h" #include "RE/B/BSTSmartPointer.h" #include "RE/G/GFxValue.h" -#include "RE/I/ImageData.h" #include "RE/I/ImageSpaceShaderParam.h" #include "RE/L/LocalMapCamera.h" #include "RE/M/MenuEventHandler.h" @@ -79,7 +79,7 @@ namespace RE float unk00038; // 00038 float unk0003C; // 0003C LocalMapCullingProcess localCullingProcess; // 00040 - ImageData unk303A0; // 303A0 + BSScaleformExternalTexture unk303A0; // 303A0 GFxValue unk303B8; // 303B8 GFxValue unk303D0; // 303D0 void* unk303E8; // 303E8 diff --git a/include/RE/M/MainMenu.h b/include/RE/M/MainMenu.h index 1c1766cb2..46f678157 100644 --- a/include/RE/M/MainMenu.h +++ b/include/RE/M/MainMenu.h @@ -1,9 +1,9 @@ #pragma once +#include "RE/B/BSScaleformExternalTexture.h" #include "RE/B/BSTEvent.h" #include "RE/G/GFxFunctionHandler.h" #include "RE/I/IMenu.h" -#include "RE/I/ImageData.h" namespace RE { @@ -40,12 +40,12 @@ namespace RE void Call(Params& a_params) override; // 01 // members - ImageData unk50; // 50 - std::uint32_t unk68; // 68 - std::uint8_t unk6C; // 6C - std::uint8_t unk6D; // 6D - std::uint8_t unk6E; // 6E - std::uint8_t pad6F; // 6F + BSScaleformExternalTexture gamerIconTexture; // 50 + std::uint32_t unk68; // 68 + std::uint8_t unk6C; // 6C + std::uint8_t unk6D; // 6D + std::uint8_t unk6E; // 6E + std::uint8_t pad6F; // 6F }; static_assert(sizeof(MainMenu) == 0x70); } diff --git a/include/RE/M/MenuTopicManager.h b/include/RE/M/MenuTopicManager.h index 8ce2fd92e..3bd12eeca 100644 --- a/include/RE/M/MenuTopicManager.h +++ b/include/RE/M/MenuTopicManager.h @@ -31,22 +31,22 @@ namespace RE { public: // members - BSString topicText; // 00 - bool unk10; // 10 - bool unk11; // 11 - bool unk12; // 12 - data.topic->formID == 0xFD || data.topic->formID == 0x118 - std::uint8_t unk13; // 13 - std::uint32_t unk14; // 14 - BSSimpleList responses; // 18 - TESQuest* parentQuest; // 28 - TESTopicInfo* parentTopicInfo; // 30 - TESTopic* parentTopic; // 38 - BSSimpleList* unk40; // 40 - std::uint8_t unk48; // 48 - bool neverSaid; // 49 - std::uint16_t unk4A; // 4A - std::uint32_t unk4C; // 4C - TESTopic* unk50; // 50 + BSString topicText; // 00 + bool unk10; // 10 + bool unk11; // 11 + bool unk12; // 12 - data.topic->formID == 0xFD || data.topic->formID == 0x118 + std::uint8_t unk13; // 13 + std::uint32_t unk14; // 14 + BSSimpleList responses; // 18 + TESQuest* parentQuest; // 28 + TESTopicInfo* parentTopicInfo; // 30 + TESTopic* parentTopic; // 38 + BSSimpleList::Node* currentResponse; // 40 + std::uint8_t unk48; // 48 + bool neverSaid; // 49 + std::uint16_t unk4A; // 4A + std::uint32_t unk4C; // 4C + TESTopic* unk50; // 50 }; static_assert(sizeof(Dialogue) == 0x58); @@ -65,32 +65,32 @@ namespace RE } // members - BSSimpleList* selectedResponseNode; // 18 - BSSimpleList* dialogueList; // 20 - std::uint64_t unk28; // 28 - TESTopicInfo* rootTopicInfo; // 30 - Dialogue* lastSelectedDialogue; // 38 - REX::W32::CRITICAL_SECTION criticalSection; // 40 - ObjectRefHandle speaker; // 68 - ObjectRefHandle lastSpeaker; // 6C - used if the dialogue menu was closed but the NPC is still talking - TESTopicInfo* currentTopicInfo; // 70 - only valid when the NPC is talking - TESTopicInfo* lastTopicInfo; // 78 - used if the dialogue menu was closed but the NPC is still talking - BSTArray blockingBranches; // 80 - BSTArray topLevelBranches; // 98 - bool isGreetingPlayer; // B0 - bool unkB1; // B1 - bool isSayingGoodbye; // B2 - bool unkB3; // B3 - bool unkB4; // B4 - bool unkB5; // B5 - bool unkB6; // B6 - bool unkB7; // B7 - bool unkB8; // B8 - bool unkB9; // B9 - bool unkBA; // BA - bool unkBB; // BB - std::uint16_t padBC; // BC - BSTArray unkC0; // C0 + BSSimpleList::Node* selectedResponseNode; // 18 + BSSimpleList* dialogueList; // 20 + std::uint64_t unk28; // 28 + TESTopicInfo* rootTopicInfo; // 30 + Dialogue* lastSelectedDialogue; // 38 + REX::W32::CRITICAL_SECTION criticalSection; // 40 + ObjectRefHandle speaker; // 68 + ObjectRefHandle lastSpeaker; // 6C - used if the dialogue menu was closed but the NPC is still talking + TESTopicInfo* currentTopicInfo; // 70 - only valid when the NPC is talking + TESTopicInfo* lastTopicInfo; // 78 - used if the dialogue menu was closed but the NPC is still talking + BSTArray blockingBranches; // 80 + BSTArray topLevelBranches; // 98 + bool isGreetingPlayer; // B0 + bool unkB1; // B1 + bool isSayingGoodbye; // B2 + bool unkB3; // B3 + bool unkB4; // B4 + bool unkB5; // B5 + bool unkB6; // B6 + bool unkB7; // B7 + bool unkB8; // B8 + bool unkB9; // B9 + bool unkBA; // BA + bool unkBB; // BB + std::uint16_t padBC; // BC + BSTArray unkC0; // C0 }; static_assert(sizeof(MenuTopicManager) == 0xD8); } diff --git a/include/RE/M/MiddleHighProcessData.h b/include/RE/M/MiddleHighProcessData.h index dce381b3b..2bf632a17 100644 --- a/include/RE/M/MiddleHighProcessData.h +++ b/include/RE/M/MiddleHighProcessData.h @@ -171,7 +171,7 @@ namespace RE float headHeightOffset; // 204 ObjectRefHandle occupiedFurniture; // 208 std::uint32_t unk20C; // 20C - std::uint64_t unk210; // 210 + TESIdleForm* unk210; // 210 ActorHandle commandingActor; // 218 std::uint32_t pad21C; // 21C InventoryEntryData* leftHand; // 220 diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 9c0ca6d3f..c97e5c3be 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -312,6 +312,8 @@ #include "RE/B/BSResourceNiBinaryStream.h" #include "RE/B/BSResponse.h" #include "RE/B/BSSaveDataSystemUtility.h" +#include "RE/B/BSScaleformExternalTexture.h" +#include "RE/B/BSScaleformImageLoader.h" #include "RE/B/BSScaleformManager.h" #include "RE/B/BSScaleformTranslator.h" #include "RE/B/BSSceneGraph.h" @@ -770,6 +772,8 @@ #include "RE/G/GFxExternalInterface.h" #include "RE/G/GFxFileConstants.h" #include "RE/G/GFxFunctionHandler.h" +#include "RE/G/GFxImageLoader.h" +#include "RE/G/GFxImageResource.h" #include "RE/G/GFxInitImportActions.h" #include "RE/G/GFxKey.h" #include "RE/G/GFxKeyboardState.h" @@ -841,6 +845,9 @@ #include "RE/G/GHashsetNodeEntry.h" #include "RE/G/GImage.h" #include "RE/G/GImageBase.h" +#include "RE/G/GImageInfo.h" +#include "RE/G/GImageInfoBase.h" +#include "RE/G/GImageInfoBaseImpl.h" #include "RE/G/GList.h" #include "RE/G/GMath.h" #include "RE/G/GMatrix2D.h" @@ -899,6 +906,7 @@ #include "RE/H/HighProcessData.h" #include "RE/H/HitData.h" #include "RE/H/HorseCameraState.h" +#include "RE/H/SendHUDMessage.h" #include "RE/H/hkAabb.h" #include "RE/H/hkArray.h" #include "RE/H/hkBaseObject.h" @@ -1093,7 +1101,6 @@ #include "RE/I/IVMSaveLoadInterface.h" #include "RE/I/IVirtualMachine.h" #include "RE/I/IXAudio2VoiceCallback.h" -#include "RE/I/ImageData.h" #include "RE/I/ImageSpaceData.h" #include "RE/I/ImageSpaceEffect.h" #include "RE/I/ImageSpaceEffectDepthOfField.h" diff --git a/include/RE/U/UISaveLoadManager.h b/include/RE/U/UISaveLoadManager.h index f12cdf269..ce628b983 100644 --- a/include/RE/U/UISaveLoadManager.h +++ b/include/RE/U/UISaveLoadManager.h @@ -1,6 +1,7 @@ #pragma once #include "RE/B/BSFixedString.h" +#include "RE/B/BSScaleformExternalTexture.h" #include "RE/B/BSTEvent.h" #include "RE/B/BSTSingleton.h" #include "RE/G/GFxValue.h" @@ -27,14 +28,12 @@ namespace RE BSEventNotifyControl ProcessEvent(const BGSSaveLoadManagerEvent* a_event, BSTEventSource* a_eventSource) override; // 01 // members - void* unk18; // 18 - std::uint64_t unk20; // 20 - BSFixedString unk28; // 28 - GFxValue unk30; // 30 - BSFixedString unk48; // 48 - std::uint64_t unk50; // 50 - std::uint64_t unk58; // 58 - std::uint64_t unk60; // 60 + BSScaleformExternalTexture screenshotTexture; // 18 + GFxValue unk30; // 30 + BSFixedString unk48; // 48 + std::uint64_t unk50; // 50 + std::uint64_t unk58; // 58 + std::uint64_t unk60; // 60 }; static_assert(sizeof(UISaveLoadManager) == 0x68); } diff --git a/src/RE/B/BSAudioManager.cpp b/src/RE/B/BSAudioManager.cpp index 7bfe6292f..503918d23 100644 --- a/src/RE/B/BSAudioManager.cpp +++ b/src/RE/B/BSAudioManager.cpp @@ -39,4 +39,11 @@ namespace RE REL::Relocation func{ RELOCATION_ID(66403, 67665) }; return func(this, a_soundHandle, a_editorID, a_flags); } + + void BSAudioManager::BuildSoundDataFromFile(BSSoundHandle& a_soundHandle, const BSResource::ID& a_file, std::uint32_t a_flags, std::uint32_t a_priority) + { + using func_t = decltype(&BSAudioManager::BuildSoundDataFromFile); + REL::Relocation func{ RELOCATION_ID(66402, 67664) }; + return func(this, a_soundHandle, a_file, a_flags, a_priority); + } } diff --git a/src/RE/B/BSSoundHandle.cpp b/src/RE/B/BSSoundHandle.cpp index 212fa23db..65df5d268 100644 --- a/src/RE/B/BSSoundHandle.cpp +++ b/src/RE/B/BSSoundHandle.cpp @@ -26,6 +26,13 @@ namespace RE return func(this, a_fadeTimeMS); } + std::uint64_t BSSoundHandle::GetDuration() + { + using func_t = decltype(&BSSoundHandle::GetDuration); + REL::Relocation func{ RELOCATION_ID(66369, 67630) }; + return func(this); + } + bool BSSoundHandle::IsPlaying() const { using func_t = decltype(&BSSoundHandle::IsPlaying); @@ -61,6 +68,13 @@ namespace RE return func(this, a_node); } + void BSSoundHandle::SetOutputModel(const BGSSoundOutput* a_outputModel) + { + using func_t = decltype(&BSSoundHandle::SetOutputModel); + REL::Relocation func{ RELOCATION_ID(66363, 67624) }; + return func(this, a_outputModel); + } + bool BSSoundHandle::SetVolume(float a_volume) { using func_t = decltype(&BSSoundHandle::SetVolume); diff --git a/src/RE/C/Calendar.cpp b/src/RE/C/Calendar.cpp index 7f5114dfb..2c9552493 100644 --- a/src/RE/C/Calendar.cpp +++ b/src/RE/C/Calendar.cpp @@ -86,12 +86,17 @@ namespace RE return GetDaysPassed() * 24.0F; } - float Calendar::GetHoursPerDay() const + float Calendar::GetHoursPerDay() { REL::Relocation hours{ RELOCATION_ID(241610, 195681) }; return *hours; } + std::uint32_t Calendar::GetMinutes() const + { + return static_cast(60 * GetHour()) % 60; + } + std::uint32_t Calendar::GetMonth() const { return gameMonth ? static_cast(gameMonth->value) : 7; @@ -147,12 +152,32 @@ namespace RE return setting ? setting->GetString() : "Bad Month"; } + std::string Calendar::GetOrdinalSuffix() const + { + auto gmst = RE::GameSettingCollection::GetSingleton(); + + switch (static_cast(GetDay())) { + case 1: + case 21: + case 31: + return gmst->GetSetting("sFirstOrdSuffix")->GetString(); + case 2: + case 22: + return gmst->GetSetting("sSecondOrdSuffix")->GetString(); + case 3: + case 23: + return gmst->GetSetting("sThirdOrdSuffix")->GetString(); + default: + return gmst->GetSetting("sDefaultOrdSuffix")->GetString(); + } + } + std::tm Calendar::GetTime() const { std::tm time; time.tm_sec = 0; - time.tm_min = 0; + time.tm_min = static_cast(GetMinutes()); time.tm_hour = static_cast(GetHour()); time.tm_mday = static_cast(GetDay()); time.tm_mon = static_cast(GetMonth()); diff --git a/src/RE/I/InputEvent.cpp b/src/RE/I/InputEvent.cpp index 0506dbbca..033ce090b 100644 --- a/src/RE/I/InputEvent.cpp +++ b/src/RE/I/InputEvent.cpp @@ -4,6 +4,7 @@ #include "RE/C/CharEvent.h" #include "RE/I/IDEvent.h" #include "RE/M/MouseMoveEvent.h" +#include "RE/T/ThumbstickEvent.h" namespace RE { @@ -46,4 +47,14 @@ namespace RE { return GetEventType() == INPUT_EVENT_TYPE::kMouseMove ? static_cast(this) : nullptr; } + + ThumbstickEvent* InputEvent::AsThumbstickEvent() + { + return GetEventType() == INPUT_EVENT_TYPE::kThumbstick ? static_cast(this) : nullptr; + } + + const ThumbstickEvent* InputEvent::AsThumbstickEvent() const + { + return GetEventType() == INPUT_EVENT_TYPE::kThumbstick ? static_cast(this) : nullptr; + } } From 0a1e692485b631e8bc718ec3c713dbb504ffc3a2 Mon Sep 17 00:00:00 2001 From: powerof3 Date: Sat, 16 Mar 2024 18:26:44 +0000 Subject: [PATCH 76/76] maintenance --- include/RE/I/ID.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/RE/I/ID.h b/include/RE/I/ID.h index 3aa2081d8..3c4c5ffbc 100644 --- a/include/RE/I/ID.h +++ b/include/RE/I/ID.h @@ -15,7 +15,7 @@ namespace RE REL::Relocation func{ RELOCATION_ID(68635, 69979) }; return func(this, a_path); } - + // members std::uint32_t dir{ 0 }; // 0 };