diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml deleted file mode 100644 index dfabfd9d1..000000000 --- a/.github/workflows/main_ci.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Main CI - -on: - push: - branches: [ master ] - paths: - - '.github/workflows/main_ci.yml' - - 'cmake/**' - - 'include/**' - - 'src/**' - - 'CMakeLists.txt' - - 'CMakePresets.json' - - 'vcpkg.json' - pull_request: - branches: [ master ] - workflow_dispatch: - -env: - BUILD_TYPE: Debug - VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache - -jobs: - windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - with: - path: main - - - name: Setup vcpkg - run: | - mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} - cd $env:VCPKG_INSTALLATION_ROOT - ./bootstrap-vcpkg.bat - ./vcpkg --version > ${{ github.workspace }}/vcpkg-version.txt - - - name: Cache vcpkg - uses: actions/cache@v2 - id: vcpkg-cache - env: - cache-name: vcpkg-cache - with: - path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/* - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('main/**/vcpkg.json', 'vcpkg-version.txt') }} - - - name: Configure CMake - working-directory: ${{ github.workspace }}/main - run: cmake --preset vs2022-windows-vcpkg - - - name: Build - working-directory: ${{ github.workspace }}/main - run: cmake --build build --config ${{ env.BUILD_TYPE }} diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index 22ce2cd43..fc3d93a4c 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -17,7 +17,7 @@ jobs: run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-16 -style=file -i - name: Glob files - run: python ${{ github.workspace }}/scripts/cmake_generate.py + run: python ${{ github.workspace }}/res/scripts/generate_headers.py - uses: stefanzweifel/git-auto-commit-action@v5 with: diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a2f9a0002..000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,148 +0,0 @@ -cmake_minimum_required(VERSION 3.19) - -option(REX_OPTION_INI "Enables ini config support for REX." OFF) -option(REX_OPTION_JSON "Enables json config support for REX." OFF) -option(REX_OPTION_TOML "Enables toml config support for REX." OFF) -option(SKSE_SUPPORT_XBYAK "Enables trampoline support for Xbyak." OFF) -option(SKYRIM_SUPPORT_AE "Enables support for Skyrim AE" OFF) - -project( - CommonLibSSE - LANGUAGES CXX -) - -include(GNUInstallDirs) - -if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") - message(FATAL_ERROR "in-source builds are not allowed") -endif() - -find_package(binary_io REQUIRED CONFIG) -find_package(spdlog REQUIRED CONFIG) - -include(cmake/sourcelist.cmake) - -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}" - FILES ${SOURCES} -) - -add_library( - "${PROJECT_NAME}" - STATIC - ${SOURCES} - .clang-format - CommonLibSSE.natvis -) - -add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") - -target_compile_definitions( - "${PROJECT_NAME}" - PUBLIC - WINVER=0x0601 # windows 7, minimum supported version by skyrim special edition - _WIN32_WINNT=0x0601 - "$<$:REX_OPTION_INI=1>" - "$<$:REX_OPTION_JSON=1>" - "$<$:REX_OPTION_TOML=1>" - "$<$:SKSE_SUPPORT_XBYAK=1>" - "$<$:SKYRIM_SUPPORT_AE=1>" -) - -target_compile_features( - "${PROJECT_NAME}" - PUBLIC - cxx_std_23 -) - -if (MSVC) - target_compile_options( - "${PROJECT_NAME}" - PRIVATE - # warnings -> errors - /we4715 # 'function' : not all control paths return a value - - # disable warnings - /wd4005 # macro redefinition - /wd4061 # enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label - /wd4200 # nonstandard extension used : zero-sized array in struct/union - /wd4201 # nonstandard extension used : nameless struct/union - /wd4265 # 'type': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly - /wd4266 # 'function' : no override available for virtual member function from base 'type'; function is hidden - /wd4371 # 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member' - /wd4514 # 'function' : unreferenced inline function has been removed - /wd4582 # 'type': constructor is not implicitly called - /wd4583 # 'type': destructor is not implicitly called - /wd4623 # 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted - /wd4625 # 'derived class' : copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted - /wd4626 # 'derived class' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted - /wd4710 # 'function' : function not inlined - /wd4711 # function 'function' selected for inline expansion - /wd4820 # 'bytes' bytes padding added after construct 'member_name' - /wd5026 # 'type': move constructor was implicitly defined as deleted - /wd5027 # 'type': move assignment operator was implicitly defined as deleted - /wd5045 # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified - /wd5053 # support for 'explicit()' in C++17 and earlier is a vendor extension - /wd5204 # 'type-name': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly - /wd5220 # 'member': a non-static data member with a volatile qualified type no longer implies that compiler generated copy / move constructors and copy / move assignment operators are not trivial - ) -endif() - -target_include_directories( - "${PROJECT_NAME}" - PUBLIC - "$" - "$" -) - -target_link_libraries( - "${PROJECT_NAME}" - PUBLIC - binary_io::binary_io - spdlog::spdlog - Advapi32.lib - bcrypt.lib - D3D11.lib - d3dcompiler.lib - Dbghelp.lib - DXGI.lib - Ole32.lib - Version.lib -) - -target_precompile_headers( - "${PROJECT_NAME}" - PRIVATE - include/SKSE/Impl/PCH.h -) - -install( - TARGETS "${PROJECT_NAME}" - EXPORT "${PROJECT_NAME}-targets" -) - -install( - EXPORT "${PROJECT_NAME}-targets" - NAMESPACE "${PROJECT_NAME}::" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" -) - -configure_file( - cmake/config.cmake.in - "${PROJECT_NAME}Config.cmake" - @ONLY -) - -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" -) - -install( - DIRECTORY - "include/RE" - "include/REL" - "include/REX" - "include/SKSE" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" -) diff --git a/CMakePresets.json b/CMakePresets.json deleted file mode 100644 index db5296f86..000000000 --- a/CMakePresets.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "configurePresets": [ - { - "binaryDir": "${sourceDir}/build", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Debug" - } - }, - "errors": { - "deprecated": true - }, - "hidden": true, - "name": "cmake-dev", - "warnings": { - "deprecated": true, - "dev": true - } - }, - { - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "type": "STRING", - "value": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" - } - }, - "hidden": true, - "name": "vcpkg" - }, - { - "cacheVariables": { - "CMAKE_MSVC_RUNTIME_LIBRARY": { - "type": "STRING", - "value": "MultiThreaded$<$:Debug>DLL" - }, - "VCPKG_TARGET_TRIPLET": { - "type": "STRING", - "value": "x64-windows-static-md" - } - }, - "hidden": true, - "name": "windows" - }, - { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:anglebrackets /external:W0" - }, - "generator": "Visual Studio 16 2019", - "inherits": [ - "cmake-dev", - "vcpkg", - "windows" - ], - "name": "vs2019-windows-vcpkg" - }, - { - "cacheVariables": { - "CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:W0" - }, - "generator": "Visual Studio 17 2022", - "inherits": [ - "cmake-dev", - "vcpkg", - "windows" - ], - "name": "vs2022-windows-vcpkg", - "toolset": "v143" - } - ], - "version": 2 -} diff --git a/CMakeSettings.json b/CMakeSettings.json deleted file mode 100644 index 9204f06eb..000000000 --- a/CMakeSettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "configurations": [ - { - "name": "x64-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "inheritEnvironments": [ "msvc_x64_x64" ], - "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", - "cmakeCommandArgs": "", - "buildCommandArgs": "", - "ctestCommandArgs": "" - } - ] -} \ No newline at end of file diff --git a/README.md b/README.md index 23baf2388..2998af6e6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # `CommonLibSSE` [![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) ## Build Dependencies * [spdlog](https://github.com/gabime/spdlog) -* [Visual Studio Community 2019 16.10.0 Preview 3.0](https://visualstudio.microsoft.com/vs/preview/) +* [Visual Studio Community 2022 Preview](https://visualstudio.microsoft.com/vs/preview/) * Desktop development with C++ ## End User Dependencies @@ -15,9 +14,4 @@ ## Development * [Address Library for SKSE Plugins](https://www.nexusmods.com/skyrimspecialedition/mods/32444) -* [clang-format 12.0.0](https://github.com/llvm/llvm-project/releases) -* [CMake](https://cmake.org/) -* [vcpkg](https://github.com/microsoft/vcpkg) - -## Notes -* CommonLib is incompatible with SKSE and is intended to replace it as a static dependency. However, you will still need the runtime component. +* [xmake](https://xmake.io/) diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in deleted file mode 100644 index ffecc2033..000000000 --- a/cmake/config.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") -include(CMakeFindDependencyMacro) - -find_dependency(binary_io CONFIG) -find_dependency(spdlog CONFIG) diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake deleted file mode 100644 index 784ade3ba..000000000 --- a/cmake/sourcelist.cmake +++ /dev/null @@ -1,2078 +0,0 @@ -set(SOURCES - include/RE/A/AIFormulas.h - include/RE/A/AIProcess.h - include/RE/A/AITimeStamp.h - include/RE/A/AITimer.h - include/RE/A/AbsorbEffect.h - include/RE/A/AbstractHeap.h - include/RE/A/AccumulatingValueModifierEffect.h - include/RE/A/ActionInput.h - include/RE/A/ActionOutput.h - include/RE/A/ActivateHandler.h - include/RE/A/ActiveEffect.h - include/RE/A/ActiveEffectFactory.h - include/RE/A/ActiveEffectReferenceEffectController.h - include/RE/A/Actor.h - include/RE/A/ActorCause.h - include/RE/A/ActorEquipManager.h - include/RE/A/ActorInventoryEvent.h - include/RE/A/ActorKill.h - include/RE/A/ActorKnowledge.h - include/RE/A/ActorMagicCaster.h - include/RE/A/ActorMover.h - include/RE/A/ActorPackage.h - include/RE/A/ActorSpeedChannel.h - include/RE/A/ActorState.h - include/RE/A/ActorTargetCheck.h - include/RE/A/ActorValueInfo.h - include/RE/A/ActorValueList.h - include/RE/A/ActorValueMeter.h - include/RE/A/ActorValueOwner.h - include/RE/A/ActorValues.h - include/RE/A/AddCallbackVisitor.h - include/RE/A/AlchemyItem.h - include/RE/A/AlchemyMenu.h - include/RE/A/AnimationFileManagerSingleton.h - include/RE/A/AnimationObjects.h - include/RE/A/Archive.h - include/RE/A/ArchiveStream.h - include/RE/A/ArmorRatingVisitor.h - include/RE/A/ArmorRatingVisitorBase.h - include/RE/A/Array.h - include/RE/A/ArrowProjectile.h - include/RE/A/AsyncStream.h - include/RE/A/Atmosphere.h - include/RE/A/AttachAshPileFunctor.h - include/RE/A/AttachLightHitEffectVisitor.h - include/RE/A/AttachTechniqueInput.h - include/RE/A/AttachedScript.h - include/RE/A/AttackAnimationArrayMap.h - include/RE/A/AttackBlockHandler.h - include/RE/A/AutoMoveHandler.h - include/RE/A/AutoRegisterCreator.h - include/RE/A/AutoRegisterFactory.h - include/RE/A/AutoVanityState.h - include/RE/A/ahkpCharacterProxy.h - include/RE/A/ahkpWorld.h - include/RE/B/BGSAbilityPerkEntry.h - include/RE/B/BGSAcousticSpace.h - include/RE/B/BGSAction.h - include/RE/B/BGSActionData.h - include/RE/B/BGSActorCellEvent.h - include/RE/B/BGSActorEvent.h - include/RE/B/BGSAddToPlayerInventoryEvent.h - include/RE/B/BGSAddonNode.h - include/RE/B/BGSAnimationSequencer.h - include/RE/B/BGSApparatus.h - include/RE/B/BGSArtObject.h - include/RE/B/BGSAssociationType.h - include/RE/B/BGSAttackData.h - include/RE/B/BGSAttackDataForm.h - include/RE/B/BGSAttackDataMap.h - include/RE/B/BGSBaseAlias.h - include/RE/B/BGSBehaviorGraphModel.h - include/RE/B/BGSBipedObjectForm.h - include/RE/B/BGSBlockBashData.h - include/RE/B/BGSBodyPartData.h - include/RE/B/BGSBodyPartDefs.h - include/RE/B/BGSCameraPath.h - include/RE/B/BGSCameraShot.h - include/RE/B/BGSCollisionLayer.h - include/RE/B/BGSColorForm.h - include/RE/B/BGSConstructibleObject.h - include/RE/B/BGSCreatedObjectManager.h - include/RE/B/BGSDebris.h - include/RE/B/BGSDecalEmitter.h - include/RE/B/BGSDecalGroup.h - include/RE/B/BGSDecalManager.h - include/RE/B/BGSDecalNode.h - include/RE/B/BGSDefaultObjectManager.h - include/RE/B/BGSDestructibleObjectForm.h - include/RE/B/BGSDialogueBranch.h - include/RE/B/BGSDirectionalAmbientLightingColors.h - include/RE/B/BGSDistantTreeBlock.h - include/RE/B/BGSDualCastData.h - include/RE/B/BGSDynamicPersistenceManager.h - include/RE/B/BGSEncounterZone.h - include/RE/B/BGSEntryPoint.h - 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 - include/RE/B/BGSEquipType.h - include/RE/B/BGSExplosion.h - include/RE/B/BGSFootstep.h - include/RE/B/BGSFootstepEvent.h - include/RE/B/BGSFootstepManager.h - include/RE/B/BGSFootstepSet.h - include/RE/B/BGSGrassManager.h - include/RE/B/BGSHazard.h - include/RE/B/BGSHeadPart.h - include/RE/B/BGSIdleCollection.h - include/RE/B/BGSIdleMarker.h - include/RE/B/BGSImpactData.h - include/RE/B/BGSImpactDataSet.h - include/RE/B/BGSImpactManager.h - include/RE/B/BGSInstancedQuestObjective.h - include/RE/B/BGSKeyword.h - include/RE/B/BGSKeywordForm.h - include/RE/B/BGSLensFlare.h - include/RE/B/BGSLightingTemplate.h - include/RE/B/BGSListForm.h - include/RE/B/BGSLoadFormBuffer.h - include/RE/B/BGSLoadFormData.h - include/RE/B/BGSLoadGameBuffer.h - include/RE/B/BGSLoadGameSubBuffer.h - include/RE/B/BGSLocAlias.h - include/RE/B/BGSLocalizedStringDL.h - include/RE/B/BGSLocation.h - include/RE/B/BGSLocationRefType.h - include/RE/B/BGSMaterialObject.h - include/RE/B/BGSMaterialType.h - include/RE/B/BGSMenuDisplayObject.h - include/RE/B/BGSMenuIcon.h - include/RE/B/BGSMessage.h - include/RE/B/BGSMessageIcon.h - include/RE/B/BGSMovableStatic.h - include/RE/B/BGSMovementType.h - include/RE/B/BGSMoviePlayer.h - include/RE/B/BGSMusicPaletteTrack.h - include/RE/B/BGSMusicSilenceTrack.h - include/RE/B/BGSMusicSingleTrack.h - include/RE/B/BGSMusicTrack.h - include/RE/B/BGSMusicTrackFormWrapper.h - include/RE/B/BGSMusicType.h - include/RE/B/BGSNamedPackageData.h - include/RE/B/BGSNote.h - include/RE/B/BGSNumericIDIndex.h - include/RE/B/BGSOpenCloseForm.h - include/RE/B/BGSOutfit.h - include/RE/B/BGSOverridePackCollection.h - include/RE/B/BGSPackageDataBool.h - include/RE/B/BGSPackageDataLocation.h - include/RE/B/BGSPackageDataPointerTemplate.h - include/RE/B/BGSPerk.h - include/RE/B/BGSPerkEntry.h - include/RE/B/BGSPerkRankArray.h - include/RE/B/BGSPickupPutdownSounds.h - include/RE/B/BGSPreloadable.h - include/RE/B/BGSProcedureTreeBranch.h - include/RE/B/BGSProcedureTreeConditionalItem.h - include/RE/B/BGSProcedureTreeProcedure.h - include/RE/B/BGSProcedureTreeSequence.h - include/RE/B/BGSProjectile.h - include/RE/B/BGSRagdoll.h - include/RE/B/BGSRefAlias.h - include/RE/B/BGSReferenceEffect.h - include/RE/B/BGSRelationship.h - include/RE/B/BGSReverbParameters.h - include/RE/B/BGSSaveFormBuffer.h - include/RE/B/BGSSaveGameBuffer.h - include/RE/B/BGSSaveLoadGame.h - include/RE/B/BGSSaveLoadManager.h - include/RE/B/BGSScene.h - include/RE/B/BGSSceneAction.h - include/RE/B/BGSSceneActionDialogue.h - include/RE/B/BGSSceneActionPackage.h - include/RE/B/BGSSceneActionTimer.h - include/RE/B/BGSShaderParticleGeometryData.h - include/RE/B/BGSSkillPerkTreeNode.h - include/RE/B/BGSSkinForm.h - include/RE/B/BGSSoundCategory.h - include/RE/B/BGSSoundDescriptor.h - include/RE/B/BGSSoundDescriptorForm.h - include/RE/B/BGSSoundOutput.h - include/RE/B/BGSStandardSoundDef.h - include/RE/B/BGSStaticCollection.h - include/RE/B/BGSStoryEventManager.h - include/RE/B/BGSStoryManagerBranchNode.h - include/RE/B/BGSStoryManagerEventNode.h - include/RE/B/BGSStoryManagerNodeBase.h - include/RE/B/BGSStoryManagerQuestNode.h - 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 - include/RE/B/BGSVoiceType.h - include/RE/B/BGSVolumetricLighting.h - include/RE/B/BGSWorldLocation.h - include/RE/B/BSAnimNote.h - include/RE/B/BSAnimNoteListener.h - include/RE/B/BSAnimationGraphChannel.h - include/RE/B/BSAnimationGraphEvent.h - include/RE/B/BSAnimationGraphManager.h - include/RE/B/BSAnimationUpdateData.h - include/RE/B/BSArchive.h - include/RE/B/BSArchiveHeader.h - include/RE/B/BSAtomic.h - include/RE/B/BSAudioManager.h - include/RE/B/BSAudioManagerThread.h - include/RE/B/BSBatchRenderer.h - include/RE/B/BSBitField.h - include/RE/B/BSBloodSplatterShaderProperty.h - include/RE/B/BSBound.h - include/RE/B/BSCompoundFrustum.h - include/RE/B/BSComputeShader.h - include/RE/B/BSContainer.h - include/RE/B/BSCoreTypes.h - include/RE/B/BSCullingProcess.h - include/RE/B/BSDirectInputManager.h - include/RE/B/BSDismemberSkinInstance.h - include/RE/B/BSDistantTreeShaderProperty.h - include/RE/B/BSDynamicTriShape.h - include/RE/B/BSEffectShaderData.h - include/RE/B/BSEffectShaderMaterial.h - include/RE/B/BSEffectShaderProperty.h - include/RE/B/BSExtraData.h - include/RE/B/BSFaceGenAnimationData.h - include/RE/B/BSFaceGenKeyframe.h - include/RE/B/BSFaceGenKeyframeMultiple.h - include/RE/B/BSFaceGenManager.h - include/RE/B/BSFaceGenModel.h - include/RE/B/BSFaceGenNiNode.h - include/RE/B/BSFadeNode.h - include/RE/B/BSFile.h - include/RE/B/BSFixedString.h - include/RE/B/BSFurnitureMarkerNode.h - include/RE/B/BSGameSound.h - include/RE/B/BSGamepadDevice.h - include/RE/B/BSGeometry.h - include/RE/B/BSGrassShaderProperty.h - include/RE/B/BSHandleRefObject.h - include/RE/B/BSIInputDevice.h - include/RE/B/BSIMusicTrack.h - include/RE/B/BSIMusicType.h - include/RE/B/BSIRagdollDriver.h - include/RE/B/BSIReverbType.h - include/RE/B/BSISoundCategory.h - include/RE/B/BSISoundDescriptor.h - include/RE/B/BSISoundOutputModel.h - include/RE/B/BSImagespaceShader.h - include/RE/B/BSImagespaceShaderBlur3.h - include/RE/B/BSInputDevice.h - include/RE/B/BSInputDeviceFactory.h - include/RE/B/BSInputDeviceManager.h - include/RE/B/BSInputEventQueue.h - include/RE/B/BSInstanceTriShape.h - include/RE/B/BSIntrusiveRefCounted.h - include/RE/B/BSKeyboardDevice.h - include/RE/B/BSLensFlareRenderData.h - include/RE/B/BSLight.h - include/RE/B/BSLightingShaderMaterial.h - include/RE/B/BSLightingShaderMaterialBase.h - include/RE/B/BSLightingShaderMaterialEnvmap.h - include/RE/B/BSLightingShaderMaterialEye.h - include/RE/B/BSLightingShaderMaterialFacegen.h - include/RE/B/BSLightingShaderMaterialFacegenTint.h - include/RE/B/BSLightingShaderMaterialGlowmap.h - include/RE/B/BSLightingShaderMaterialHairTint.h - include/RE/B/BSLightingShaderMaterialLODLandscape.h - include/RE/B/BSLightingShaderMaterialLandscape.h - include/RE/B/BSLightingShaderMaterialMultiLayerParallax.h - include/RE/B/BSLightingShaderMaterialParallax.h - include/RE/B/BSLightingShaderMaterialParallaxOcc.h - include/RE/B/BSLightingShaderMaterialSnow.h - include/RE/B/BSLightingShaderProperty.h - include/RE/B/BSMasterParticleSystem.h - include/RE/B/BSMaterialObject.h - include/RE/B/BSMemStorage.h - include/RE/B/BSModelDB.h - include/RE/B/BSMouseDevice.h - include/RE/B/BSMultiBound.h - include/RE/B/BSMultiBoundAABB.h - include/RE/B/BSMultiBoundNode.h - include/RE/B/BSMultiBoundOBB.h - include/RE/B/BSMultiBoundShape.h - include/RE/B/BSMultiIndexTriShape.h - include/RE/B/BSMultiStreamInstanceTriShape.h - include/RE/B/BSMusicEvent.h - include/RE/B/BSMusicManager.h - include/RE/B/BSNavmesh.h - include/RE/B/BSNavmeshInfoMap.h - include/RE/B/BSNiAllocator.h - include/RE/B/BSNiNode.h - include/RE/B/BSOcclusionBox.h - include/RE/B/BSOcclusionPlane.h - include/RE/B/BSOcclusionShape.h - include/RE/B/BSOrderedNode.h - include/RE/B/BSPCGamepadDeviceDelegate.h - include/RE/B/BSPCGamepadDeviceHandler.h - include/RE/B/BSPCOrbisGamepadDevice.h - include/RE/B/BSParabolicCullingProcess.h - include/RE/B/BSParticleShaderCubeEmitter.h - include/RE/B/BSParticleShaderEmitter.h - include/RE/B/BSParticleShaderObjectEmitter.h - include/RE/B/BSParticleShaderProperty.h - include/RE/B/BSParticleShaderRainEmitter.h - include/RE/B/BSParticleShaderSnowEmitter.h - include/RE/B/BSPathingCell.h - include/RE/B/BSPointerHandle.h - include/RE/B/BSPointerHandleManager.h - include/RE/B/BSPointerHandleSmartPointer.h - include/RE/B/BSPortal.h - include/RE/B/BSPortalGraph.h - include/RE/B/BSPortalGraphEntry.h - include/RE/B/BSPortalSharedNode.h - include/RE/B/BSPrecomputedNavmeshInfoPathMap.h - include/RE/B/BSReloadShaderI.h - include/RE/B/BSRenderPass.h - include/RE/B/BSResourceEntry.h - include/RE/B/BSResourceEntryCache.h - include/RE/B/BSResourceEntryDB.h - include/RE/B/BSResourceEntryQueue.h - include/RE/B/BSResourceHandle.h - 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 - include/RE/B/BSScriptObjectBindPolicy.h - include/RE/B/BSShader.h - include/RE/B/BSShaderManager.h - include/RE/B/BSShaderMaterial.h - include/RE/B/BSShaderProperty.h - include/RE/B/BSShaderPropertyLightData.h - include/RE/B/BSShaderRenderTargets.h - include/RE/B/BSShaderTextureSet.h - include/RE/B/BSShadowFrustumLight.h - include/RE/B/BSShadowLight.h - include/RE/B/BSShadowParabolicLight.h - include/RE/B/BSSimpleScaleController.h - include/RE/B/BSSkyShaderProperty.h - include/RE/B/BSSmallBlockAllocator.h - include/RE/B/BSSoundHandle.h - include/RE/B/BSStorage.h - include/RE/B/BSStream.h - include/RE/B/BSString.h - include/RE/B/BSStringPool.h - include/RE/B/BSSystemFile.h - include/RE/B/BSSystemFileStorage.h - include/RE/B/BSTAnimationGraphDataChannel.h - include/RE/B/BSTArray.h - include/RE/B/BSTCaseInsensitiveStringMap.h - include/RE/B/BSTCreateFactoryManager.h - include/RE/B/BSTDerivedCreator.h - include/RE/B/BSTEvent.h - include/RE/B/BSTFreeList.h - include/RE/B/BSTHashMap.h - include/RE/B/BSTList.h - include/RE/B/BSTLocklessQueue.h - include/RE/B/BSTMessageQueue.h - include/RE/B/BSTObjectDictionary.h - include/RE/B/BSTPoint.h - include/RE/B/BSTPointerAndFlags.h - include/RE/B/BSTSingleton.h - include/RE/B/BSTSmartPointer.h - include/RE/B/BSTTuple.h - include/RE/B/BSTempEffect.h - include/RE/B/BSTempEffectDebris.h - include/RE/B/BSTempEffectGeometryDecal.h - include/RE/B/BSTempEffectParticle.h - include/RE/B/BSTempEffectSPG.h - include/RE/B/BSTempEffectSimpleDecal.h - include/RE/B/BSTempEffectWeaponBlood.h - include/RE/B/BSTerrainEffect.h - include/RE/B/BSTextureSet.h - include/RE/B/BSThread.h - include/RE/B/BSThreadEvent.h - include/RE/B/BSTimer.h - include/RE/B/BSTreeManager.h - include/RE/B/BSTriShape.h - include/RE/B/BSUIMessageData.h - include/RE/B/BSUIScaleformData.h - include/RE/B/BSUtilityShader.h - include/RE/B/BSValueNode.h - include/RE/B/BSVirtualKeyboardDevice.h - include/RE/B/BSVisit.h - include/RE/B/BSVolumetricLightingRenderData.h - include/RE/B/BSWaterShaderMaterial.h - include/RE/B/BSWaterShaderProperty.h - include/RE/B/BSWin32GamepadDevice.h - include/RE/B/BSWin32KeyboardDevice.h - include/RE/B/BSWin32MouseDevice.h - include/RE/B/BSWin32SaveDataSystemUtility.h - include/RE/B/BSWin32VirtualKeyboardDevice.h - include/RE/B/BSWindModifier.h - include/RE/B/BSXAudio2GameSound.h - include/RE/B/BSXFlags.h - include/RE/B/BShkbAnimationGraph.h - include/RE/B/BanishEffect.h - include/RE/B/BarrierProjectile.h - include/RE/B/BarterMenu.h - include/RE/B/BaseFormComponent.h - include/RE/B/BaseHandleReaderWriter.h - include/RE/B/BeamProjectile.h - include/RE/B/BipedAnim.h - include/RE/B/BipedObjects.h - include/RE/B/BleedoutCameraState.h - include/RE/B/BookMenu.h - include/RE/B/BooksRead.h - include/RE/B/BottomBar.h - include/RE/B/BoundItemEffect.h - include/RE/B/ButtonEvent.h - include/RE/B/bhkAction.h - include/RE/B/bhkBackfaceContactListener.h - include/RE/B/bhkCachingShapePhantom.h - include/RE/B/bhkCharProxyController.h - include/RE/B/bhkCharacterController.h - include/RE/B/bhkCharacterPointCollector.h - include/RE/B/bhkCharacterProxy.h - include/RE/B/bhkCharacterState.h - include/RE/B/bhkCharacterStateClimbing.h - include/RE/B/bhkCharacterStateFlying.h - include/RE/B/bhkCharacterStateInAir.h - include/RE/B/bhkCharacterStateJumping.h - include/RE/B/bhkCharacterStateOnGround.h - include/RE/B/bhkCharacterStateSwimming.h - include/RE/B/bhkCollisionFilter.h - include/RE/B/bhkCollisionObject.h - include/RE/B/bhkCompressedMeshShape.h - include/RE/B/bhkCompressedMeshShapeData.h - include/RE/B/bhkContactListener.h - include/RE/B/bhkEntity.h - include/RE/B/bhkListShape.h - include/RE/B/bhkMeshMaterial.h - include/RE/B/bhkMouseSpringAction.h - include/RE/B/bhkNiCollisionObject.h - include/RE/B/bhkPCollisionObject.h - include/RE/B/bhkPhantom.h - include/RE/B/bhkPickData.h - include/RE/B/bhkRefObject.h - include/RE/B/bhkRigidBody.h - include/RE/B/bhkSPCollisionObject.h - include/RE/B/bhkSerializable.h - include/RE/B/bhkShape.h - include/RE/B/bhkShapeCollection.h - include/RE/B/bhkShapePhantom.h - include/RE/B/bhkTelekinesisListener.h - include/RE/B/bhkThreadMemorySource.h - include/RE/B/bhkUnaryAction.h - include/RE/B/bhkWorld.h - include/RE/B/bhkWorldObject.h - include/RE/C/CFilter.h - include/RE/C/CRC.h - include/RE/C/Calendar.h - include/RE/C/CalmEffect.h - include/RE/C/CharEvent.h - include/RE/C/Character.h - include/RE/C/ChestsLooted.h - include/RE/C/CloakEffect.h - include/RE/C/Clouds.h - include/RE/C/CodeTasklet.h - include/RE/C/CollisionLayers.h - include/RE/C/Color.h - include/RE/C/ColorUtil.h - include/RE/C/CombatController.h - include/RE/C/CombatGroup.h - include/RE/C/CombatGroupDetectionListener.h - include/RE/C/CombatInventory.h - include/RE/C/CombatInventoryItem.h - include/RE/C/CombatInventoryItemMagic.h - include/RE/C/CombatInventoryItemMagicT.h - include/RE/C/CombatInventoryItemPotion.h - include/RE/C/CombatInventoryItemScroll.h - include/RE/C/CombatInventoryItemShout.h - include/RE/C/CombatInventoryItemStaff.h - include/RE/C/CombatMagicCaster.h - include/RE/C/CombatMagicCasterBoundItem.h - include/RE/C/CombatMagicCasterCloak.h - include/RE/C/CombatMagicCasterDisarm.h - include/RE/C/CombatMagicCasterInvisibility.h - include/RE/C/CombatMagicCasterLight.h - include/RE/C/CombatMagicCasterOffensive.h - include/RE/C/CombatMagicCasterParalyze.h - include/RE/C/CombatMagicCasterReanimate.h - include/RE/C/CombatMagicCasterRestore.h - include/RE/C/CombatMagicCasterScript.h - include/RE/C/CombatMagicCasterStagger.h - include/RE/C/CombatMagicCasterSummon.h - include/RE/C/CombatMagicCasterTargetEffect.h - include/RE/C/CombatMagicCasterWard.h - include/RE/C/CombatManager.h - include/RE/C/CombatObject.h - include/RE/C/CombatSearchLocation.h - include/RE/C/CombatState.h - include/RE/C/CommandEffect.h - include/RE/C/CommandSummonedEffect.h - include/RE/C/CommandTable.h - include/RE/C/CommonTypeTraits.h - include/RE/C/CompactingStore.h - include/RE/C/CompiledScriptLoader.h - include/RE/C/CompressedArchiveStream.h - include/RE/C/ConcreteFormFactory.h - include/RE/C/ConcreteObjectFormFactory.h - include/RE/C/ConcussionEffect.h - include/RE/C/ConeProjectile.h - include/RE/C/Console.h - include/RE/C/ConsoleData.h - include/RE/C/ConsoleLog.h - include/RE/C/ConsoleNativeUIMenu.h - include/RE/C/ConstructibleObjectMenu.h - include/RE/C/ContainerItemExtra.h - include/RE/C/ContainerMenu.h - include/RE/C/ControlMap.h - include/RE/C/CraftingMenu.h - include/RE/C/CraftingSubMenu.h - include/RE/C/CreationClubMenu.h - include/RE/C/CreditsMenu.h - include/RE/C/Crime.h - include/RE/C/CriticalHit.h - include/RE/C/CrosshairPickData.h - include/RE/C/CureEffect.h - include/RE/C/CursorMenu.h - include/RE/D/DamageImpactData.h - include/RE/D/DarknessEffect.h - include/RE/D/DecalData.h - include/RE/D/DefaultObjectsReadyEvent.h - include/RE/D/DelayFunctor.h - include/RE/D/DemoralizeEffect.h - include/RE/D/DepthStencilDepthModes.h - include/RE/D/DetectLifeEffect.h - include/RE/D/DetectionListener.h - include/RE/D/DetectionPriorities.h - include/RE/D/DetectionState.h - include/RE/D/DevNull.h - include/RE/D/DeviceConnectEvent.h - include/RE/D/DialogueItem.h - include/RE/D/DialogueMenu.h - include/RE/D/DialoguePackage.h - include/RE/D/DialogueTypes.h - include/RE/D/DisarmEffect.h - include/RE/D/DisarmedEvent.h - include/RE/D/DisguiseEffect.h - include/RE/D/DispelEffect.h - include/RE/D/DoNothingUnhandledPolicy.h - include/RE/D/DragonSoulsGained.h - include/RE/D/DropObjectFunctor.h - include/RE/D/DualValueModifierEffect.h - include/RE/E/Effect.h - include/RE/E/EffectArchetypes.h - include/RE/E/EffectSetting.h - include/RE/E/EmotionTypes.h - include/RE/E/EnchantConstructMenu.h - include/RE/E/EnchantmentItem.h - include/RE/E/EnhanceWeaponEffect.h - include/RE/E/ErrorCodes.h - include/RE/E/ErrorLogger.h - include/RE/E/EtherealizationEffect.h - include/RE/E/Explosion.h - include/RE/E/ExtraAction.h - include/RE/E/ExtraActivateLoopSound.h - include/RE/E/ExtraActivateRef.h - include/RE/E/ExtraActivateRefChildren.h - include/RE/E/ExtraActorCause.h - include/RE/E/ExtraAliasInstanceArray.h - include/RE/E/ExtraAlphaCutoff.h - include/RE/E/ExtraAmmo.h - include/RE/E/ExtraAnimGraphManager.h - include/RE/E/ExtraAnimNoteReceiver.h - include/RE/E/ExtraAnimationSequencer.h - include/RE/E/ExtraAshPileRef.h - include/RE/E/ExtraAttachRef.h - include/RE/E/ExtraAttachRefChildren.h - include/RE/E/ExtraAttachedArrows3D.h - include/RE/E/ExtraBadPosition.h - include/RE/E/ExtraBiped.h - include/RE/E/ExtraCachedScale.h - include/RE/E/ExtraCanTalkToPlayer.h - include/RE/E/ExtraCannotWear.h - include/RE/E/ExtraCell3D.h - include/RE/E/ExtraCellAcousticSpace.h - include/RE/E/ExtraCellGrassData.h - include/RE/E/ExtraCellImageSpace.h - include/RE/E/ExtraCellMusicType.h - include/RE/E/ExtraCellSkyRegion.h - include/RE/E/ExtraCellWaterEnvMap.h - include/RE/E/ExtraCellWaterType.h - include/RE/E/ExtraCharge.h - include/RE/E/ExtraCollisionData.h - include/RE/E/ExtraCombatStyle.h - include/RE/E/ExtraContainerChanges.h - include/RE/E/ExtraCount.h - include/RE/E/ExtraCreatureAwakeSound.h - include/RE/E/ExtraCreatureMovementSound.h - include/RE/E/ExtraDataList.h - include/RE/E/ExtraDataTypes.h - include/RE/E/ExtraDecalGroup.h - include/RE/E/ExtraDetachTime.h - include/RE/E/ExtraDismemberedLimbs.h - include/RE/E/ExtraDistantData.h - include/RE/E/ExtraDroppedItemList.h - include/RE/E/ExtraEditorID.h - include/RE/E/ExtraEditorRef3DData.h - include/RE/E/ExtraEditorRefMoveData.h - include/RE/E/ExtraEmittanceSource.h - include/RE/E/ExtraEnableStateChildren.h - include/RE/E/ExtraEnableStateParent.h - include/RE/E/ExtraEnchantment.h - include/RE/E/ExtraEncounterZone.h - include/RE/E/ExtraFactionChanges.h - include/RE/E/ExtraFavorCost.h - include/RE/E/ExtraFlags.h - include/RE/E/ExtraFollower.h - include/RE/E/ExtraFollowerSwimBreadcrumbs.h - include/RE/E/ExtraForcedLandingMarker.h - include/RE/E/ExtraForcedTarget.h - include/RE/E/ExtraFriendHits.h - include/RE/E/ExtraFromAlias.h - include/RE/E/ExtraGIDBuffer.h - include/RE/E/ExtraGhost.h - include/RE/E/ExtraGlobal.h - include/RE/E/ExtraGroupConstraint.h - include/RE/E/ExtraGuardedRefData.h - include/RE/E/ExtraHasNoRumors.h - include/RE/E/ExtraHavok.h - include/RE/E/ExtraHeadTrackingWeight.h - include/RE/E/ExtraHeadingTarget.h - include/RE/E/ExtraHealth.h - include/RE/E/ExtraHealthPerc.h - include/RE/E/ExtraHorse.h - include/RE/E/ExtraHotkey.h - include/RE/E/ExtraIgnoredBySandbox.h - include/RE/E/ExtraInfoGeneralTopic.h - include/RE/E/ExtraInteraction.h - include/RE/E/ExtraItemDropper.h - include/RE/E/ExtraLargeRefOwnerCells.h - include/RE/E/ExtraLastFinishedSequence.h - include/RE/E/ExtraLevCreaModifier.h - include/RE/E/ExtraLeveledCreature.h - include/RE/E/ExtraLeveledItem.h - include/RE/E/ExtraLeveledItemBase.h - include/RE/E/ExtraLight.h - include/RE/E/ExtraLightData.h - include/RE/E/ExtraLinkedRef.h - include/RE/E/ExtraLinkedRefChildren.h - include/RE/E/ExtraLitWaterRefs.h - include/RE/E/ExtraLocation.h - include/RE/E/ExtraLocationRefType.h - include/RE/E/ExtraLock.h - include/RE/E/ExtraLockList.h - include/RE/E/ExtraMagicCaster.h - include/RE/E/ExtraMagicLight.h - include/RE/E/ExtraMapMarker.h - include/RE/E/ExtraMissingLinkedRefIDs.h - include/RE/E/ExtraMissingRefIDs.h - include/RE/E/ExtraModelSwap.h - include/RE/E/ExtraMultiBound.h - include/RE/E/ExtraMultiBoundRef.h - include/RE/E/ExtraNavMeshPortal.h - include/RE/E/ExtraNorthRotation.h - include/RE/E/ExtraObjectHealth.h - include/RE/E/ExtraOcclusionPlaneRefData.h - include/RE/E/ExtraOcclusionShape.h - include/RE/E/ExtraOpenCloseActivateRef.h - include/RE/E/ExtraOriginalReference.h - include/RE/E/ExtraOutfitItem.h - include/RE/E/ExtraOwnership.h - include/RE/E/ExtraPackage.h - include/RE/E/ExtraPackageData.h - include/RE/E/ExtraPackageStartLocation.h - include/RE/E/ExtraPatrolRefData.h - include/RE/E/ExtraPatrolRefInUseData.h - include/RE/E/ExtraPersistentCell.h - include/RE/E/ExtraPlayerCrimeList.h - include/RE/E/ExtraPoison.h - include/RE/E/ExtraPortal.h - include/RE/E/ExtraPortalRefData.h - include/RE/E/ExtraPrimitive.h - include/RE/E/ExtraProcessMiddleLow.h - include/RE/E/ExtraPromotedRef.h - include/RE/E/ExtraRaceData.h - include/RE/E/ExtraRadius.h - include/RE/E/ExtraRagDollData.h - include/RE/E/ExtraRandomTeleportMarker.h - include/RE/E/ExtraRank.h - include/RE/E/ExtraReferenceHandle.h - include/RE/E/ExtraReflectedRefs.h - include/RE/E/ExtraReflectorRefs.h - include/RE/E/ExtraRefrPath.h - include/RE/E/ExtraRefractionProperty.h - include/RE/E/ExtraRegionList.h - include/RE/E/ExtraReservedMarkers.h - include/RE/E/ExtraResourcesPreload.h - include/RE/E/ExtraRoom.h - include/RE/E/ExtraRoomRefData.h - include/RE/E/ExtraRunOncePacks.h - include/RE/E/ExtraSavedAnimation.h - include/RE/E/ExtraSavedHavokData.h - include/RE/E/ExtraSayToTopicInfo.h - include/RE/E/ExtraSayTopicInfoOnceADay.h - include/RE/E/ExtraScale.h - include/RE/E/ExtraSceneData.h - include/RE/E/ExtraScriptedAnimDependence.h - include/RE/E/ExtraSeenData.h - include/RE/E/ExtraShouldWear.h - include/RE/E/ExtraSoul.h - include/RE/E/ExtraSound.h - include/RE/E/ExtraSpawnContainer.h - include/RE/E/ExtraStartingPosition.h - include/RE/E/ExtraStartingWorldOrCell.h - include/RE/E/ExtraTeleport.h - include/RE/E/ExtraTeleportName.h - include/RE/E/ExtraTerminalState.h - include/RE/E/ExtraTextDisplayData.h - include/RE/E/ExtraTimeLeft.h - include/RE/E/ExtraTresPassPackage.h - include/RE/E/ExtraUniqueID.h - include/RE/E/ExtraUsedMarkers.h - include/RE/E/ExtraWaterCurrentZoneData.h - include/RE/E/ExtraWaterData.h - include/RE/E/ExtraWaterLightRefs.h - include/RE/E/ExtraWeaponAttackSound.h - include/RE/E/ExtraWeaponIdleSound.h - include/RE/E/ExtraWorn.h - include/RE/E/ExtraWornLeft.h - include/RE/F/FOCollisionListener.h - include/RE/F/FORM.h - include/RE/F/FORM_ENUM_STRING.h - include/RE/F/FactionRank.h - include/RE/F/FaderMenu.h - include/RE/F/FastTravelConfirmCallback.h - include/RE/F/FavoritesHandler.h - 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 - include/RE/F/FormTraits.h - include/RE/F/FormTypes.h - include/RE/F/FragmentSystem.h - include/RE/F/FreeCameraState.h - include/RE/F/FrenzyEffect.h - include/RE/F/FunctionArguments.h - include/RE/F/FunctionMessage.h - include/RE/F/FxDelegate.h - include/RE/F/FxDelegateArgs.h - include/RE/F/FxDelegateHandler.h - include/RE/F/FxResponseArgs.h - include/RE/F/FxResponseArgsBase.h - include/RE/G/GASActionBufferData.h - include/RE/G/GASDoAction.h - include/RE/G/GASDoInitAction.h - include/RE/G/GASEnvironment.h - include/RE/G/GASExecuteTag.h - include/RE/G/GASFunctionObject.h - include/RE/G/GASGlobalContext.h - include/RE/G/GASObject.h - include/RE/G/GASObjectInterface.h - include/RE/G/GASRefCountBase.h - include/RE/G/GASStringBuiltinManager.h - include/RE/G/GASStringManager.h - include/RE/G/GASUserDefinedFunctionObject.h - include/RE/G/GAcquireInterface.h - include/RE/G/GAllocator.h - include/RE/G/GAllocatorBaseGH.h - include/RE/G/GAllocatorBaseLH.h - include/RE/G/GArray.h - include/RE/G/GArrayBase.h - include/RE/G/GArrayConstPolicy.h - include/RE/G/GArrayData.h - include/RE/G/GArrayDataBase.h - include/RE/G/GArrayDefaultPolicy.h - include/RE/G/GArrayLH.h - include/RE/G/GAtomic.h - include/RE/G/GColor.h - include/RE/G/GConstructorMov.h - include/RE/G/GEvent.h - include/RE/G/GFixedSizeHash.h - include/RE/G/GFxASCharacter.h - include/RE/G/GFxActionControl.h - include/RE/G/GFxButtonCharacterDef.h - include/RE/G/GFxCharacter.h - include/RE/G/GFxCharacterDef.h - include/RE/G/GFxConstShapeCharacterDef.h - include/RE/G/GFxConstShapeNoStyles.h - include/RE/G/GFxConstShapeWithStyles.h - include/RE/G/GFxEditTextCharacterDef.h - include/RE/G/GFxEvent.h - 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 - include/RE/G/GFxLoadProcess.h - include/RE/G/GFxLoadStates.h - include/RE/G/GFxLoadUpdateSync.h - include/RE/G/GFxLoader.h - include/RE/G/GFxLoaderImpl.h - include/RE/G/GFxLoaderTask.h - include/RE/G/GFxLog.h - include/RE/G/GFxLogBase.h - include/RE/G/GFxLogConstants.h - include/RE/G/GFxMorphCharacterDef.h - include/RE/G/GFxMovie.h - include/RE/G/GFxMovieBindProcess.h - include/RE/G/GFxMovieDataDef.h - include/RE/G/GFxMovieDef.h - include/RE/G/GFxMovieDefBindStates.h - include/RE/G/GFxMovieDefImpl.h - include/RE/G/GFxMovieImageLoadTask.h - include/RE/G/GFxMovieRoot.h - include/RE/G/GFxMovieView.h - include/RE/G/GFxPlaceObject.h - include/RE/G/GFxPlaceObject2.h - include/RE/G/GFxPlaceObject2a.h - include/RE/G/GFxPlaceObject3.h - include/RE/G/GFxPlaceObjectBase.h - include/RE/G/GFxPlaceObjectUnpacked.h - include/RE/G/GFxPlayerStats.h - include/RE/G/GFxRemoveObject.h - include/RE/G/GFxRemoveObject2.h - include/RE/G/GFxRenderConfig.h - include/RE/G/GFxResource.h - include/RE/G/GFxResourceID.h - include/RE/G/GFxResourceKey.h - include/RE/G/GFxResourceLib.h - include/RE/G/GFxResourceLibBase.h - include/RE/G/GFxResourceReport.h - include/RE/G/GFxResourceWeakLib.h - include/RE/G/GFxSetBackgroundColor.h - include/RE/G/GFxShapeBase.h - include/RE/G/GFxShapeBaseCharacterDef.h - include/RE/G/GFxShapeCharacterDef.h - include/RE/G/GFxShapeNoStyles.h - include/RE/G/GFxShapeWithStyles.h - include/RE/G/GFxSpecialKeysState.h - include/RE/G/GFxSprite.h - include/RE/G/GFxSpriteDef.h - include/RE/G/GFxState.h - include/RE/G/GFxStateBag.h - include/RE/G/GFxStateBagImpl.h - include/RE/G/GFxStaticTextCharacterDef.h - include/RE/G/GFxStream.h - include/RE/G/GFxTask.h - include/RE/G/GFxTimelineDef.h - include/RE/G/GFxTranslator.h - include/RE/G/GFxValue.h - include/RE/G/GFxWStringBuffer.h - include/RE/G/GFxWWHelper.h - include/RE/G/GHash.h - include/RE/G/GHashNode.h - include/RE/G/GHashSet.h - include/RE/G/GHashSetBase.h - include/RE/G/GHashSetUncached.h - include/RE/G/GHashUncached.h - include/RE/G/GHashsetCachedEntry.h - include/RE/G/GHashsetCachedNodeEntry.h - include/RE/G/GHashsetEntry.h - 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 - include/RE/G/GMatrix3D.h - include/RE/G/GMemory.h - include/RE/G/GMemoryHeap.h - include/RE/G/GMutex.h - include/RE/G/GNewOverrideBase.h - include/RE/G/GPoint.h - include/RE/G/GPtr.h - include/RE/G/GRect.h - include/RE/G/GRefCountBase.h - include/RE/G/GRefCountBaseGC.h - include/RE/G/GRefCountBaseNTS.h - include/RE/G/GRefCountBaseStatImpl.h - include/RE/G/GRefCountBaseWeakSupport.h - include/RE/G/GRefCountImpl.h - include/RE/G/GRefCountImplCore.h - include/RE/G/GRefCountNTSImpl.h - include/RE/G/GRefCountWeakSupportImpl.h - include/RE/G/GRenderer.h - include/RE/G/GRendererEventHandler.h - include/RE/G/GStats.h - include/RE/G/GStd.h - include/RE/G/GString.h - include/RE/G/GStringDH.h - include/RE/G/GStringHash.h - include/RE/G/GSysAllocBase.h - include/RE/G/GSysAllocPaged.h - include/RE/G/GTexture.h - include/RE/G/GViewport.h - include/RE/G/GWaitCondition.h - include/RE/G/GWaitable.h - include/RE/G/GameSettingCollection.h - include/RE/G/GarbageCollector.h - include/RE/G/GiftMenu.h - include/RE/G/GlobalLocations.h - include/RE/G/GlobalPaths.h - include/RE/G/GrabActorEffect.h - include/RE/G/GrassParam.h - include/RE/G/GrenadeProjectile.h - include/RE/G/GridArray.h - include/RE/G/GridCellArray.h - include/RE/G/GuideEffect.h - include/RE/H/HUDChargeMeter.h - include/RE/H/HUDData.h - include/RE/H/HUDMenu.h - include/RE/H/HUDMeter.h - include/RE/H/HUDNotifications.h - include/RE/H/HUDObject.h - include/RE/H/HandleManager.h - include/RE/H/HandlePolicy.h - include/RE/H/Hazard.h - include/RE/H/HeapBlock.h - include/RE/H/HeapBlockFreeHead.h - include/RE/H/HeldStateHandler.h - 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 - include/RE/H/hkBaseTypes.h - include/RE/H/hkContactPoint.h - include/RE/H/hkContactPointMaterial.h - include/RE/H/hkContainerAllocators.h - include/RE/H/hkFinishLoadedObjectFlag.h - include/RE/H/hkMatrix3.h - include/RE/H/hkMemoryAllocator.h - include/RE/H/hkMoppBvTreeShapeBase.h - include/RE/H/hkMotionState.h - include/RE/H/hkMultiThreadCheck.h - include/RE/H/hkQsTransform.h - include/RE/H/hkQuaternion.h - include/RE/H/hkRefPtr.h - include/RE/H/hkRefVariant.h - include/RE/H/hkReferencedObject.h - include/RE/H/hkRotation.h - include/RE/H/hkSmallArray.h - include/RE/H/hkSseMathTypes.h - include/RE/H/hkStepInfo.h - include/RE/H/hkStringPtr.h - include/RE/H/hkSweptTransform.h - include/RE/H/hkTransform.h - include/RE/H/hkVector4.h - include/RE/H/hkaAnimatedReferenceFrame.h - include/RE/H/hkaAnimation.h - include/RE/H/hkaAnimationBinding.h - include/RE/H/hkaAnimationControl.h - include/RE/H/hkaAnnotationTrack.h - include/RE/H/hkaDefaultAnimationControl.h - include/RE/H/hkaRagdollInstance.h - include/RE/H/hkbAnimationBindingSet.h - include/RE/H/hkbAssetBundleStringData.h - include/RE/H/hkbBehaviorGraph.h - include/RE/H/hkbBehaviorGraphData.h - include/RE/H/hkbBehaviorGraphStringData.h - include/RE/H/hkbBindable.h - include/RE/H/hkbCharacter.h - include/RE/H/hkbCharacterControllerSetup.h - include/RE/H/hkbCharacterData.h - include/RE/H/hkbCharacterSetup.h - include/RE/H/hkbCharacterStringData.h - include/RE/H/hkbClipGenerator.h - include/RE/H/hkbContext.h - include/RE/H/hkbEvent.h - include/RE/H/hkbEventBase.h - include/RE/H/hkbGenerator.h - include/RE/H/hkbNode.h - include/RE/H/hkbProjectData.h - include/RE/H/hkbProjectStringData.h - include/RE/H/hkbRagdollDriver.h - include/RE/H/hkbRigidBodySetup.h - include/RE/H/hkbShapeSetup.h - include/RE/H/hkbStateMachine.h - include/RE/H/hkp3AxisSweep.h - include/RE/H/hkpAction.h - include/RE/H/hkpAgentNnTrack.h - include/RE/H/hkpAllCdPointCollector.h - include/RE/H/hkpArrayAction.h - include/RE/H/hkpBoxShape.h - include/RE/H/hkpBroadPhase.h - include/RE/H/hkpBroadPhaseCastCollector.h - include/RE/H/hkpBroadPhaseHandle.h - include/RE/H/hkpBvTreeShape.h - include/RE/H/hkpCachingShapePhantom.h - include/RE/H/hkpCapsuleShape.h - include/RE/H/hkpCdBody.h - include/RE/H/hkpCdPoint.h - include/RE/H/hkpCdPointCollector.h - include/RE/H/hkpCharacterContext.h - include/RE/H/hkpCharacterControl.h - include/RE/H/hkpCharacterProxy.h - include/RE/H/hkpCharacterProxyListener.h - include/RE/H/hkpCharacterState.h - include/RE/H/hkpCharacterStateManager.h - include/RE/H/hkpClosestRayHitCollector.h - include/RE/H/hkpCollidable.h - include/RE/H/hkpCollidableCollidableFilter.h - include/RE/H/hkpCollisionEvent.h - include/RE/H/hkpCollisionFilter.h - include/RE/H/hkpCollisionInput.h - include/RE/H/hkpCompressedMeshShape.h - include/RE/H/hkpConstraintAtom.h - 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 - include/RE/H/hkpContactPointProperties.h - include/RE/H/hkpConvexListFilter.h - include/RE/H/hkpConvexShape.h - include/RE/H/hkpEaseConstraintsAction.h - include/RE/H/hkpEntity.h - include/RE/H/hkpEntityListener.h - include/RE/H/hkpFixedRigidMotion.h - include/RE/H/hkpKeyframedRigidMotion.h - include/RE/H/hkpLimitedHingeConstraintData.h - include/RE/H/hkpLinearCastCollisionInput.h - include/RE/H/hkpLinearCastInput.h - include/RE/H/hkpLinkedCollidable.h - include/RE/H/hkpListShape.h - include/RE/H/hkpMaterial.h - include/RE/H/hkpMeshMaterial.h - include/RE/H/hkpMoppAabbCastVirtualMachine.h - include/RE/H/hkpMoppBvTreeShape.h - include/RE/H/hkpMoppCode.h - include/RE/H/hkpMotion.h - include/RE/H/hkpMouseSpringAction.h - include/RE/H/hkpPhantom.h - include/RE/H/hkpPhantomListener.h - include/RE/H/hkpPhantomType.h - include/RE/H/hkpProperty.h - include/RE/H/hkpRagdollConstraintData.h - include/RE/H/hkpRayCollidableFilter.h - include/RE/H/hkpRayHitCollector.h - include/RE/H/hkpRayShapeCollectionFilter.h - include/RE/H/hkpRigidBody.h - include/RE/H/hkpRootCdPoint.h - include/RE/H/hkpShape.h - include/RE/H/hkpShapeBuffer.h - include/RE/H/hkpShapeCollection.h - include/RE/H/hkpShapeCollectionFilter.h - include/RE/H/hkpShapeContainer.h - include/RE/H/hkpShapePhantom.h - include/RE/H/hkpShapeRayCastCollectorOutput.h - include/RE/H/hkpShapeRayCastOutput.h - include/RE/H/hkpShapeType.h - include/RE/H/hkpSimplexSolver.h - 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 - include/RE/H/hkpUnaryAction.h - include/RE/H/hkpWeldingUtility.h - include/RE/H/hkpWorld.h - include/RE/H/hkpWorldCinfo.h - include/RE/H/hkpWorldLinearCaster.h - include/RE/H/hkpWorldObject.h - include/RE/H/hkpWorldPostSimulationListener.h - include/RE/H/hkpWorldRayCastInput.h - include/RE/H/hkpWorldRayCastOutput.h - include/RE/I/IAIWorldLocationHandle.h - include/RE/I/IAnimationClipLoaderSingleton.h - include/RE/I/IAnimationGraphManagerHolder.h - include/RE/I/IAnimationSetCallbackFunctor.h - include/RE/I/IBSTCreator.h - include/RE/I/ICellAttachDetachEventSource.h - include/RE/I/ID.h - include/RE/I/IDEvent.h - include/RE/I/IFormFactory.h - include/RE/I/IFreezeQuery.h - include/RE/I/IFuncCallQuery.h - include/RE/I/IFunction.h - include/RE/I/IFunctionArguments.h - include/RE/I/IHandleReaderWriter.h - include/RE/I/IHandlerFunctor.h - include/RE/I/ILoader.h - include/RE/I/IMapCameraCallbacks.h - include/RE/I/IMemoryHeap.h - include/RE/I/IMemoryPagePolicy.h - include/RE/I/IMemoryStore.h - include/RE/I/IMemoryStoreBase.h - include/RE/I/IMenu.h - include/RE/I/IMessageBoxCallback.h - include/RE/I/IMovementControllerRegisterInterface.h - include/RE/I/IMovementDirectControl.h - include/RE/I/IMovementInterface.h - include/RE/I/IMovementMessageInterface.h - include/RE/I/IMovementMotionDrivenControl.h - include/RE/I/IMovementPlannerDirectControl.h - include/RE/I/IMovementSelectIdle.h - include/RE/I/IMovementState.h - include/RE/I/INIPrefSettingCollection.h - include/RE/I/INISettingCollection.h - include/RE/I/IObjectHandlePolicy.h - include/RE/I/IObjectProcessor.h - include/RE/I/IPackageData.h - include/RE/I/IPackageDataAIWorldLocationHandle.h - include/RE/I/IPostAnimationChannelUpdateFunctor.h - include/RE/I/IProcedureTreeItem.h - include/RE/I/IProfilePolicy.h - include/RE/I/ISavePatcherInterface.h - include/RE/I/IStackCallbackFunctor.h - include/RE/I/IStackCallbackSaveInterface.h - include/RE/I/IStore.h - include/RE/I/IUIMessageData.h - include/RE/I/IVMDebugInterface.h - include/RE/I/IVMObjectBindInterface.h - include/RE/I/IVMSaveLoadInterface.h - include/RE/I/IVirtualMachine.h - include/RE/I/IXAudio2VoiceCallback.h - include/RE/I/ImageSpaceData.h - include/RE/I/ImageSpaceEffect.h - include/RE/I/ImageSpaceEffectDepthOfField.h - include/RE/I/ImageSpaceEffectOption.h - include/RE/I/ImageSpaceEffectParam.h - include/RE/I/ImageSpaceManager.h - include/RE/I/ImageSpaceModifierInstance.h - include/RE/I/ImageSpaceModifierInstanceDOF.h - include/RE/I/ImageSpaceModifierInstanceForm.h - include/RE/I/ImageSpaceModifierInstanceTemp.h - include/RE/I/ImageSpaceShaderParam.h - include/RE/I/ImageSpaceTexture.h - include/RE/I/ImpactResults.h - include/RE/I/Info.h - include/RE/I/IngredientItem.h - include/RE/I/InputDevices.h - include/RE/I/InputEvent.h - include/RE/I/InterfaceLightSchemes.h - include/RE/I/InterfaceStrings.h - include/RE/I/InteriorData.h - include/RE/I/Inventory.h - include/RE/I/Inventory3DManager.h - include/RE/I/InventoryChanges.h - include/RE/I/InventoryEntryData.h - include/RE/I/InventoryEvent.h - include/RE/I/InventoryMenu.h - include/RE/I/InventoryUpdateData.h - include/RE/I/InvisibilityEffect.h - include/RE/I/ItemCard.h - include/RE/I/ItemCrafted.h - include/RE/I/ItemHarvested.h - include/RE/I/ItemList.h - include/RE/I/ItemRemoveReason.h - include/RE/I/ItemsPickpocketed.h - include/RE/J/JournalMenu.h - include/RE/J/JournalTab.h - include/RE/J/Journal_QuestsTab.h - include/RE/J/Journal_StatsTab.h - include/RE/J/Journal_SystemTab.h - include/RE/J/JumpHandler.h - include/RE/K/KinectEvent.h - include/RE/K/KinectMenu.h - include/RE/L/LegendarySkillResetConfirmCallback.h - include/RE/L/LevelIncrease.h - include/RE/L/LevelUpMenu.h - include/RE/L/LightEffect.h - include/RE/L/LinkerProcessor.h - include/RE/L/LoadStorageWrapper.h - include/RE/L/LoadWaitSpinner.h - include/RE/L/LoadingMenu.h - include/RE/L/LocalMapCamera.h - include/RE/L/LocalMapMenu.h - include/RE/L/Location.h - include/RE/L/LocationCleared.h - include/RE/L/LocationDiscovery.h - include/RE/L/LocationTraverser.h - include/RE/L/LocationTree.h - include/RE/L/LockEffect.h - include/RE/L/LockpickingMenu.h - include/RE/L/LogEvent.h - include/RE/L/Logger.h - include/RE/L/LoggingDisabler.h - include/RE/L/LookHandler.h - include/RE/L/LooseFileLocation.h - include/RE/L/LooseFileStream.h - include/RE/L/LooseFileStreamBase.h - include/RE/M/MagicCaster.h - include/RE/M/MagicFavorites.h - include/RE/M/MagicFormulas.h - include/RE/M/MagicItem.h - include/RE/M/MagicItemDataCollector.h - include/RE/M/MagicItemFindFunctor.h - include/RE/M/MagicItemFindKeywordFunctor.h - include/RE/M/MagicItemTraversalFunctor.h - include/RE/M/MagicMenu.h - include/RE/M/MagicSystem.h - include/RE/M/MagicTarget.h - include/RE/M/MagicUtilities.h - include/RE/M/Main.h - include/RE/M/MainMenu.h - include/RE/M/MapCamera.h - include/RE/M/MapInputHandler.h - include/RE/M/MapLookHandler.h - include/RE/M/MapMenu.h - include/RE/M/MapMenuMarker.h - include/RE/M/MapMoveHandler.h - include/RE/M/MapZoomHandler.h - include/RE/M/MarkerUsedData.h - include/RE/M/MaterialIDs.h - include/RE/M/MemoryHeap.h - include/RE/M/MemoryManager.h - include/RE/M/MemoryPage.h - include/RE/M/MenuControls.h - include/RE/M/MenuCursor.h - include/RE/M/MenuEventHandler.h - include/RE/M/MenuModeChangeEvent.h - include/RE/M/MenuOpenCloseEvent.h - include/RE/M/MenuOpenHandler.h - include/RE/M/MenuTopicManager.h - include/RE/M/MessageBoxData.h - include/RE/M/MessageBoxMenu.h - include/RE/M/MiddleHighProcessData.h - include/RE/M/Misc.h - include/RE/M/MissileProjectile.h - include/RE/M/MistMenu.h - include/RE/M/ModManagerMenu.h - include/RE/M/ModelReferenceEffect.h - include/RE/M/Moon.h - include/RE/M/MouseMoveEvent.h - include/RE/M/MoveToFunctor.h - include/RE/M/Movement.h - include/RE/M/MovementControllerAI.h - include/RE/M/MovementControllerNPC.h - include/RE/M/MovementHandler.h - include/RE/M/MoviePlayer.h - include/RE/M/MultiBoundMarkerData.h - include/RE/N/NativeFunction.h - include/RE/N/NativeFunctionBase.h - include/RE/N/NativeLatentFunction.h - include/RE/N/NavMesh.h - include/RE/N/NavMeshInfoMap.h - include/RE/N/NiAVObject.h - include/RE/N/NiAllocator.h - include/RE/N/NiAlphaProperty.h - include/RE/N/NiAnimationKey.h - include/RE/N/NiBillboardNode.h - include/RE/N/NiBinaryStream.h - include/RE/N/NiBoneMatrixSetterI.h - include/RE/N/NiBooleanExtraData.h - include/RE/N/NiBound.h - include/RE/N/NiCamera.h - include/RE/N/NiCloningProcess.h - include/RE/N/NiCollisionObject.h - include/RE/N/NiColor.h - include/RE/N/NiColorData.h - include/RE/N/NiColorInterpolator.h - include/RE/N/NiColorKey.h - include/RE/N/NiControllerManager.h - include/RE/N/NiControllerSequence.h - include/RE/N/NiCullingProcess.h - include/RE/N/NiDirectionalLight.h - include/RE/N/NiExtraData.h - include/RE/N/NiFile.h - include/RE/N/NiFloatData.h - include/RE/N/NiFloatExtraData.h - include/RE/N/NiFloatInterpolator.h - include/RE/N/NiFloatKey.h - include/RE/N/NiFloatsExtraData.h - include/RE/N/NiFrustum.h - include/RE/N/NiFrustumPlanes.h - include/RE/N/NiGeometry.h - include/RE/N/NiGeometryData.h - include/RE/N/NiIntegerExtraData.h - include/RE/N/NiIntegersExtraData.h - include/RE/N/NiInterpController.h - include/RE/N/NiInterpolator.h - include/RE/N/NiKeyBasedInterpolator.h - include/RE/N/NiLight.h - include/RE/N/NiMath.h - include/RE/N/NiMatrix3.h - include/RE/N/NiMemManager.h - include/RE/N/NiMeshParticleSystem.h - include/RE/N/NiMultiTargetTransformController.h - include/RE/N/NiNode.h - include/RE/N/NiObject.h - include/RE/N/NiObjectGroup.h - include/RE/N/NiObjectNET.h - include/RE/N/NiPSysData.h - include/RE/N/NiPSysGravityModifier.h - include/RE/N/NiPSysModifier.h - include/RE/N/NiParticleSystem.h - include/RE/N/NiParticles.h - include/RE/N/NiParticlesData.h - include/RE/N/NiPlane.h - include/RE/N/NiPoint2.h - include/RE/N/NiPoint3.h - include/RE/N/NiPointLight.h - include/RE/N/NiProperty.h - include/RE/N/NiQuaternion.h - include/RE/N/NiRTTI.h - include/RE/N/NiRect.h - include/RE/N/NiRefObject.h - include/RE/N/NiShadeProperty.h - include/RE/N/NiSkinData.h - include/RE/N/NiSkinInstance.h - include/RE/N/NiSkinPartition.h - include/RE/N/NiSmartPointer.h - include/RE/N/NiSourceTexture.h - include/RE/N/NiStream.h - include/RE/N/NiStringExtraData.h - include/RE/N/NiStringsExtraData.h - include/RE/N/NiSwitchNode.h - include/RE/N/NiSystem.h - include/RE/N/NiTArray.h - include/RE/N/NiTCollection.h - include/RE/N/NiTDefaultAllocator.h - include/RE/N/NiTList.h - include/RE/N/NiTListBase.h - include/RE/N/NiTMap.h - include/RE/N/NiTMapBase.h - include/RE/N/NiTPointerAllocator.h - include/RE/N/NiTPointerList.h - include/RE/N/NiTPointerListBase.h - include/RE/N/NiTPointerMap.h - include/RE/N/NiTSet.h - include/RE/N/NiTStringMap.h - include/RE/N/NiTexture.h - include/RE/N/NiTimeController.h - include/RE/N/NiTransform.h - include/RE/N/NiTriBasedGeometry.h - include/RE/N/NiTriShape.h - include/RE/N/NightEyeEffect.h - include/RE/N/NonActorMagicCaster.h - include/RE/N/NonActorMagicTarget.h - include/RE/O/Object.h - include/RE/O/ObjectTypeInfo.h - include/RE/O/ObjectiveState.h - include/RE/O/OldMessageBoxCallback.h - include/RE/O/OpenEffect.h - include/RE/Offsets.h - include/RE/Offsets_NiRTTI.h - include/RE/Offsets_RTTI.h - include/RE/Offsets_VTABLE.h - include/RE/P/PCGamepadType.h - include/RE/P/PackUnpack.h - include/RE/P/PackUnpackImpl.h - include/RE/P/PackageLocation.h - include/RE/P/PackedInstructionStream.h - include/RE/P/ParalysisEffect.h - include/RE/P/PathingCell.h - include/RE/P/PeakValueModifierEffect.h - include/RE/P/PerkEntryVisitor.h - include/RE/P/PerkRankVisitor.h - include/RE/P/PermanentMagicFunctor.h - include/RE/P/PlayerCamera.h - include/RE/P/PlayerCameraTransitionState.h - include/RE/P/PlayerCharacter.h - include/RE/P/PlayerControls.h - include/RE/P/PlayerControlsData.h - include/RE/P/PlayerInputHandler.h - include/RE/P/PoisonedWeapon.h - include/RE/P/PositionPlayerEvent.h - include/RE/P/Precipitation.h - include/RE/P/PrecomputedNavmeshInfoPathMap.h - include/RE/P/ProcessLists.h - include/RE/P/Profiler.h - include/RE/P/Projectile.h - include/RE/P/PropertyTypeInfo.h - include/RE/Q/QuestEvents.h - include/RE/Q/QuestObjectiveStates.h - include/RE/Q/QuestStatus.h - include/RE/Q/QuickSaveLoadHandler.h - include/RE/R/REFREventCallbacks.h - include/RE/R/RaceSexCamera.h - include/RE/R/RaceSexMenu.h - include/RE/R/RaceSexMenuEvent.h - include/RE/R/RallyEffect.h - include/RE/R/RawFuncCallQuery.h - include/RE/R/ReadyWeaponHandler.h - include/RE/R/ReanimateEffect.h - include/RE/R/RefActivateData.h - include/RE/R/RefAttachTechniqueInput.h - include/RE/R/ReferenceArray.h - include/RE/R/ReferenceEffect.h - include/RE/R/ReferenceEffectController.h - include/RE/R/RefrInteraction.h - include/RE/R/RegSettingCollection.h - include/RE/R/RegisterPrefix.h - include/RE/R/RemoveCallbackVisitor.h - include/RE/R/RemoveItemFunctor.h - include/RE/R/RenderTargetData.h - include/RE/R/RenderTargetManager.h - include/RE/R/RenderTargetProperties.h - include/RE/R/Renderer.h - include/RE/R/Request.h - include/RE/R/ReticuleController.h - include/RE/R/Rumble.h - include/RE/R/RunHandler.h - include/RE/RTTI.h - include/RE/S/SFTypes.h - include/RE/S/SafeZoneMenu.h - include/RE/S/SaveFileHandleReaderWriter.h - include/RE/S/SavePatcher.h - include/RE/S/SaveStorageWrapper.h - include/RE/S/SceneGraph.h - include/RE/S/ScrapHeap.h - include/RE/S/ScreenSplatter.h - include/RE/S/ScreenshotHandler.h - include/RE/S/Script.h - include/RE/S/ScriptEffect.h - include/RE/S/ScriptEventSourceHolder.h - include/RE/S/ScriptFunction.h - 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 - include/RE/S/Setting.h - include/RE/S/SettingCollection.h - include/RE/S/SettingCollectionList.h - include/RE/S/SettingCollectionMap.h - include/RE/S/SettingT.h - include/RE/S/Sexes.h - include/RE/S/ShaderReferenceEffect.h - include/RE/S/ShadowSceneNode.h - include/RE/S/ShoutAttack.h - include/RE/S/ShoutHandler.h - include/RE/S/ShoutMeter.h - include/RE/S/SimpleAllocMemoryPagePolicy.h - include/RE/S/SimpleAnimationGraphManagerHolder.h - include/RE/S/SkillIncrease.h - include/RE/S/Sky.h - include/RE/S/SkyEffectController.h - include/RE/S/SkyObject.h - include/RE/S/SkyrimScriptObjectBindPolicy.h - include/RE/S/SkyrimScriptStore.h - include/RE/S/SkyrimVM.h - include/RE/S/SleepWaitMenu.h - include/RE/S/SlowTimeEffect.h - include/RE/S/SmithingMenu.h - include/RE/S/SneakHandler.h - include/RE/S/SoulLevels.h - include/RE/S/SoulTrapEffect.h - include/RE/S/SoulsTrapped.h - include/RE/S/SoundLevels.h - include/RE/S/SourceActionMap.h - include/RE/S/SpawnHazardEffect.h - include/RE/S/SpellItem.h - include/RE/S/SpellsLearned.h - include/RE/S/SprintHandler.h - include/RE/S/Stack.h - include/RE/S/StackFrame.h - include/RE/S/StaggerEffect.h - include/RE/S/StandardItemData.h - include/RE/S/Stars.h - include/RE/S/State.h - include/RE/S/StatsEvent.h - include/RE/S/StatsMenu.h - include/RE/S/StatsNode.h - include/RE/S/StealthMeter.h - include/RE/S/Stream.h - include/RE/S/StreamBase.h - include/RE/S/SubtitleManager.h - include/RE/S/SummonCreatureEffect.h - include/RE/S/SummonPlacementEffect.h - include/RE/S/Sun.h - include/RE/S/SuspendedStack.h - include/RE/S/SyncQueueObj.h - include/RE/Skyrim.h - include/RE/T/TES.h - include/RE/T/TESAIForm.h - include/RE/T/TESActionData.h - include/RE/T/TESActivateEvent.h - include/RE/T/TESActiveEffectApplyRemoveEvent.h - include/RE/T/TESActorBase.h - include/RE/T/TESActorBaseData.h - include/RE/T/TESActorLocationChangeEvent.h - include/RE/T/TESAmmo.h - include/RE/T/TESAttackDamageForm.h - include/RE/T/TESBipedModelForm.h - include/RE/T/TESBookReadEvent.h - include/RE/T/TESBoundAnimObject.h - include/RE/T/TESBoundObject.h - include/RE/T/TESCamera.h - include/RE/T/TESCameraState.h - include/RE/T/TESCellAttachDetachEvent.h - include/RE/T/TESCellFullyLoadedEvent.h - include/RE/T/TESChildCell.h - include/RE/T/TESClass.h - include/RE/T/TESClimate.h - include/RE/T/TESCombatEvent.h - include/RE/T/TESCombatStyle.h - include/RE/T/TESCondition.h - include/RE/T/TESContainer.h - include/RE/T/TESContainerChangedEvent.h - include/RE/T/TESCustomPackageData.h - include/RE/T/TESDataHandler.h - include/RE/T/TESDeathEvent.h - include/RE/T/TESDescription.h - include/RE/T/TESEffectShader.h - include/RE/T/TESEnchantableForm.h - include/RE/T/TESEnterBleedoutEvent.h - include/RE/T/TESEquipEvent.h - include/RE/T/TESEyes.h - include/RE/T/TESFaction.h - include/RE/T/TESFastTravelEndEvent.h - include/RE/T/TESFile.h - include/RE/T/TESFlora.h - include/RE/T/TESForm.h - include/RE/T/TESFormDeleteEvent.h - include/RE/T/TESFullName.h - include/RE/T/TESFurniture.h - include/RE/T/TESFurnitureEvent.h - include/RE/T/TESGlobal.h - include/RE/T/TESGrabReleaseEvent.h - include/RE/T/TESGrass.h - include/RE/T/TESHavokUtilities.h - include/RE/T/TESHitEvent.h - include/RE/T/TESIcon.h - include/RE/T/TESIdleForm.h - include/RE/T/TESImageSpace.h - include/RE/T/TESImageSpaceModifiableForm.h - include/RE/T/TESImageSpaceModifier.h - include/RE/T/TESInitScriptEvent.h - include/RE/T/TESKey.h - include/RE/T/TESLandTexture.h - include/RE/T/TESLevCharacter.h - include/RE/T/TESLevItem.h - include/RE/T/TESLevSpell.h - include/RE/T/TESLeveledList.h - include/RE/T/TESLoadGameEvent.h - include/RE/T/TESLoadScreen.h - include/RE/T/TESLockChangedEvent.h - include/RE/T/TESMagicCasterForm.h - include/RE/T/TESMagicEffectApplyEvent.h - include/RE/T/TESMagicTargetForm.h - include/RE/T/TESModel.h - include/RE/T/TESModelPSA.h - include/RE/T/TESModelRDT.h - include/RE/T/TESModelTextureSwap.h - include/RE/T/TESModelTri.h - include/RE/T/TESMoveAttachDetachEvent.h - include/RE/T/TESNPC.h - include/RE/T/TESObject.h - include/RE/T/TESObjectACTI.h - include/RE/T/TESObjectANIO.h - include/RE/T/TESObjectARMA.h - include/RE/T/TESObjectARMO.h - include/RE/T/TESObjectBOOK.h - include/RE/T/TESObjectCELL.h - include/RE/T/TESObjectCONT.h - include/RE/T/TESObjectDOOR.h - include/RE/T/TESObjectLAND.h - include/RE/T/TESObjectLIGH.h - include/RE/T/TESObjectLoadedEvent.h - include/RE/T/TESObjectMISC.h - include/RE/T/TESObjectREFR.h - include/RE/T/TESObjectSTAT.h - include/RE/T/TESObjectTREE.h - include/RE/T/TESObjectWEAP.h - include/RE/T/TESOpenCloseEvent.h - include/RE/T/TESPackage.h - include/RE/T/TESPackageData.h - include/RE/T/TESPlayerBowShotEvent.h - include/RE/T/TESProcessor.h - include/RE/T/TESProduceForm.h - include/RE/T/TESQualityForm.h - include/RE/T/TESQuest.h - include/RE/T/TESQuestStageEvent.h - include/RE/T/TESQuestStageItem.h - include/RE/T/TESQuestStartStopEvent.h - include/RE/T/TESRace.h - include/RE/T/TESRaceForm.h - include/RE/T/TESReactionForm.h - include/RE/T/TESRegion.h - include/RE/T/TESRegionData.h - include/RE/T/TESRegionDataLandscape.h - include/RE/T/TESRegionDataManager.h - include/RE/T/TESRegionDataMap.h - include/RE/T/TESRegionDataSound.h - include/RE/T/TESRegionDataWeather.h - include/RE/T/TESRegionList.h - include/RE/T/TESResetEvent.h - include/RE/T/TESResolveNPCTemplatesEvent.h - include/RE/T/TESShout.h - include/RE/T/TESSleepStopEvent.h - include/RE/T/TESSoulGem.h - include/RE/T/TESSound.h - include/RE/T/TESSpellCastEvent.h - include/RE/T/TESSpellList.h - include/RE/T/TESSwitchRaceCompleteEvent.h - include/RE/T/TESTexture.h - include/RE/T/TESTexture1024.h - include/RE/T/TESTopic.h - include/RE/T/TESTopicInfo.h - include/RE/T/TESTopicInfoEvent.h - include/RE/T/TESTrackedStatsEvent.h - include/RE/T/TESUniqueIDChangeEvent.h - include/RE/T/TESValueForm.h - include/RE/T/TESWaitStopEvent.h - include/RE/T/TESWaterDisplacement.h - include/RE/T/TESWaterForm.h - include/RE/T/TESWaterNormals.h - include/RE/T/TESWaterObject.h - include/RE/T/TESWaterReflections.h - include/RE/T/TESWaterSystem.h - include/RE/T/TESWeather.h - include/RE/T/TESWeightForm.h - include/RE/T/TESWordOfPower.h - include/RE/T/TESWorldSpace.h - include/RE/T/TLSData.h - include/RE/T/TargetValueModifierEffect.h - include/RE/T/TaskQueueInterface.h - include/RE/T/TelekinesisEffect.h - include/RE/T/TempEffectTraits.h - include/RE/T/TextureAddressModes.h - include/RE/T/TextureFileFormat.h - include/RE/T/TextureFilterModes.h - include/RE/T/TextureFormat.h - include/RE/T/ThirdPersonState.h - include/RE/T/ThumbstickEvent.h - include/RE/T/TitleSequenceMenu.h - include/RE/T/TogglePOVHandler.h - include/RE/T/ToggleRunHandler.h - include/RE/T/TrainingMenu.h - include/RE/T/TurnUndeadEffect.h - include/RE/T/TutorialMenu.h - include/RE/T/TweenMenu.h - include/RE/T/TweenMenuCameraState.h - include/RE/T/TypeInfo.h - include/RE/T/TypeTraits.h - include/RE/U/UI.h - include/RE/U/UI3DSceneManager.h - include/RE/U/UIBlurManager.h - include/RE/U/UIMessage.h - include/RE/U/UIMessageQueue.h - include/RE/U/UISaveLoadManager.h - include/RE/U/UnlinkedTypes.h - include/RE/U/UserEventEnabled.h - include/RE/U/UserEvents.h - include/RE/V/VATS.h - include/RE/V/VDescTable.h - include/RE/V/ValueAndConditionsEffect.h - include/RE/V/ValueModifierEffect.h - include/RE/V/VampireLordEffect.h - include/RE/V/Variable.h - include/RE/V/VertexDesc.h - include/RE/V/VirtualMachine.h - include/RE/V/VoiceSpellFireHandler.h - include/RE/W/WeaponAnimationGraphManagerHolder.h - include/RE/W/WeaponEnchantmentController.h - include/RE/W/WeatherType.h - include/RE/W/WerewolfEffect.h - 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/REX/PS4.h - include/REX/PS4/SCEPAD.h - include/REX/REX.h - include/REX/REX/Enum.h - include/REX/REX/EnumSet.h - include/REX/REX/INI.h - include/REX/REX/JSON.h - include/REX/REX/Setting.h - include/REX/REX/Singleton.h - include/REX/REX/TOML.h - include/REX/W32.h - include/REX/W32/ADVAPI32.h - include/REX/W32/BASE.h - include/REX/W32/BCRYPT.h - include/REX/W32/COM.h - include/REX/W32/COMPTR.h - include/REX/W32/D3D.h - include/REX/W32/D3D11.h - include/REX/W32/D3D11_1.h - include/REX/W32/D3D11_2.h - include/REX/W32/D3D11_3.h - include/REX/W32/D3D11_4.h - include/REX/W32/D3DCOMPILER.h - include/REX/W32/DBGHELP.h - include/REX/W32/DINPUT.h - include/REX/W32/DXGI.h - include/REX/W32/DXGI_2.h - include/REX/W32/DXGI_3.h - include/REX/W32/DXGI_4.h - include/REX/W32/DXGI_5.h - include/REX/W32/DXGI_6.h - include/REX/W32/KERNEL32.h - include/REX/W32/NT.h - include/REX/W32/OLE32.h - include/REX/W32/SHELL32.h - include/REX/W32/USER32.h - include/REX/W32/VERSION.h - include/REX/W32/XINPUT.h - include/SKSE/API.h - include/SKSE/Events.h - include/SKSE/IAT.h - include/SKSE/Impl/PCH.h - include/SKSE/Impl/RegistrationTraits.h - include/SKSE/Impl/Stubs.h - include/SKSE/InputMap.h - include/SKSE/Interfaces.h - include/SKSE/Logger.h - include/SKSE/RegistrationMap.h - include/SKSE/RegistrationMapUnique.h - include/SKSE/RegistrationSet.h - include/SKSE/RegistrationSetUnique.h - include/SKSE/SKSE.h - include/SKSE/Trampoline.h - include/SKSE/Translation.h - include/SKSE/Version.h - src/RE/A/AIFormulas.cpp - src/RE/A/AIProcess.cpp - src/RE/A/ActiveEffect.cpp - src/RE/A/ActiveEffectFactory.cpp - src/RE/A/Actor.cpp - src/RE/A/ActorEquipManager.cpp - src/RE/A/ActorKill.cpp - src/RE/A/ActorValueList.cpp - src/RE/A/ActorValueOwner.cpp - src/RE/A/AddCallbackVisitor.cpp - src/RE/A/ArmorRatingVisitor.cpp - src/RE/A/ArmorRatingVisitorBase.cpp - src/RE/A/Array.cpp - src/RE/B/BGSAttackData.cpp - src/RE/B/BGSBaseAlias.cpp - src/RE/B/BGSBipedObjectForm.cpp - src/RE/B/BGSColorForm.cpp - src/RE/B/BGSCreatedObjectManager.cpp - src/RE/B/BGSDebris.cpp - src/RE/B/BGSEntryPointFunctionDataActivateChoice.cpp - src/RE/B/BGSEntryPointPerkEntry.cpp - src/RE/B/BGSFootstepManager.cpp - src/RE/B/BGSHeadPart.cpp - src/RE/B/BGSIdleCollection.cpp - src/RE/B/BGSKeywordForm.cpp - src/RE/B/BGSListForm.cpp - src/RE/B/BGSLocation.cpp - src/RE/B/BGSOpenCloseForm.cpp - src/RE/B/BGSPerkEntry.cpp - src/RE/B/BGSPerkRankArray.cpp - src/RE/B/BGSRefAlias.cpp - src/RE/B/BGSSaveLoadManager.cpp - src/RE/B/BGSSkillPerkTreeNode.cpp - src/RE/B/BGSSoundCategory.cpp - src/RE/B/BGSStoryTeller.cpp - src/RE/B/BSAtomic.cpp - src/RE/B/BSAudioManager.cpp - src/RE/B/BSDirectInputManager.cpp - src/RE/B/BSEffectShaderData.cpp - src/RE/B/BSExtraData.cpp - src/RE/B/BSFixedString.cpp - src/RE/B/BSGamepadDevice.cpp - src/RE/B/BSHandleRefObject.cpp - src/RE/B/BSInputDevice.cpp - src/RE/B/BSInputDeviceFactory.cpp - src/RE/B/BSInputDeviceManager.cpp - src/RE/B/BSInputEventQueue.cpp - src/RE/B/BSKeyboardDevice.cpp - src/RE/B/BSLightingShaderMaterialBase.cpp - src/RE/B/BSLightingShaderProperty.cpp - src/RE/B/BSModelDB.cpp - src/RE/B/BSMouseDevice.cpp - src/RE/B/BSPCGamepadDeviceDelegate.cpp - src/RE/B/BSPCGamepadDeviceHandler.cpp - src/RE/B/BSPCOrbisGamepadDevice.cpp - src/RE/B/BSPointerHandle.cpp - src/RE/B/BSResourceNiBinaryStream.cpp - src/RE/B/BSResponse.cpp - src/RE/B/BSScaleformManager.cpp - src/RE/B/BSScaleformTranslator.cpp - src/RE/B/BSScriptObjectBindPolicy.cpp - src/RE/B/BSShaderProperty.cpp - src/RE/B/BSShaderTextureSet.cpp - src/RE/B/BSSoundHandle.cpp - src/RE/B/BSStringPool.cpp - src/RE/B/BSSystemFileStorage.cpp - src/RE/B/BSTArray.cpp - src/RE/B/BSTCreateFactoryManager.cpp - src/RE/B/BSVirtualKeyboardDevice.cpp - src/RE/B/BSVisit.cpp - src/RE/B/BSWin32GamepadDevice.cpp - src/RE/B/BSWin32KeyboardDevice.cpp - src/RE/B/BSWin32MouseDevice.cpp - src/RE/B/BSWin32SaveDataSystemUtility.cpp - src/RE/B/BSWin32VirtualKeyboardDevice.cpp - src/RE/B/BSWindModifier.cpp - src/RE/B/BSXFlags.cpp - src/RE/B/BarterMenu.cpp - src/RE/B/BipedAnim.cpp - src/RE/B/BookMenu.cpp - src/RE/B/BooksRead.cpp - src/RE/B/bhkCharProxyController.cpp - src/RE/B/bhkRigidBody.cpp - src/RE/C/Calendar.cpp - src/RE/C/ChestsLooted.cpp - src/RE/C/Color.cpp - src/RE/C/ColorUtil.cpp - src/RE/C/CommandTable.cpp - src/RE/C/Console.cpp - src/RE/C/ConsoleLog.cpp - src/RE/C/ContainerItemExtra.cpp - src/RE/C/ContainerMenu.cpp - src/RE/C/ControlMap.cpp - src/RE/C/CriticalHit.cpp - src/RE/D/DisarmedEvent.cpp - src/RE/D/DragonSoulsGained.cpp - src/RE/E/Effect.cpp - src/RE/E/EffectArchetypes.cpp - src/RE/E/EnchantConstructMenu.cpp - src/RE/E/ExtraAliasInstanceArray.cpp - src/RE/E/ExtraAshPileRef.cpp - src/RE/E/ExtraCanTalkToPlayer.cpp - src/RE/E/ExtraCannotWear.cpp - src/RE/E/ExtraCharge.cpp - src/RE/E/ExtraContainerChanges.cpp - src/RE/E/ExtraCount.cpp - src/RE/E/ExtraDataList.cpp - src/RE/E/ExtraEnchantment.cpp - src/RE/E/ExtraEncounterZone.cpp - src/RE/E/ExtraForcedTarget.cpp - src/RE/E/ExtraHealth.cpp - src/RE/E/ExtraHotkey.cpp - src/RE/E/ExtraLevCreaModifier.cpp - src/RE/E/ExtraLightData.cpp - src/RE/E/ExtraLock.cpp - src/RE/E/ExtraMissingLinkedRefIDs.cpp - src/RE/E/ExtraNorthRotation.cpp - src/RE/E/ExtraOwnership.cpp - src/RE/E/ExtraPoison.cpp - src/RE/E/ExtraRank.cpp - src/RE/E/ExtraReferenceHandle.cpp - 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 - src/RE/G/GAtomic.cpp - src/RE/G/GFxLoader.cpp - src/RE/G/GFxLog.cpp - src/RE/G/GFxMovie.cpp - src/RE/G/GFxMovieDataDef.cpp - src/RE/G/GFxMovieDef.cpp - src/RE/G/GFxMovieView.cpp - src/RE/G/GFxRenderConfig.cpp - src/RE/G/GFxResource.cpp - src/RE/G/GFxResourceID.cpp - src/RE/G/GFxResourceKey.cpp - src/RE/G/GFxState.cpp - src/RE/G/GFxStateBag.cpp - src/RE/G/GFxTranslator.cpp - src/RE/G/GFxValue.cpp - src/RE/G/GFxWStringBuffer.cpp - src/RE/G/GFxWWHelper.cpp - src/RE/G/GMemory.cpp - src/RE/G/GMemoryHeap.cpp - src/RE/G/GRefCountImpl.cpp - src/RE/G/GRefCountNTSImpl.cpp - src/RE/G/GRenderer.cpp - src/RE/G/GStd.cpp - src/RE/G/GString.cpp - src/RE/G/GViewport.cpp - src/RE/G/GameSettingCollection.cpp - src/RE/G/GiftMenu.cpp - src/RE/H/HUDMeter.cpp - src/RE/H/HUDObject.cpp - src/RE/H/HeapBlock.cpp - src/RE/H/HeldStateHandler.cpp - src/RE/H/hkBaseTypes.cpp - src/RE/H/hkReferencedObject.cpp - src/RE/H/hkStringPtr.cpp - src/RE/H/hkVector4.cpp - src/RE/H/hkpBroadPhase.cpp - src/RE/H/hkpCdBody.cpp - src/RE/H/hkpCharacterProxyListener.cpp - src/RE/H/hkpMaterial.cpp - src/RE/H/hkpProperty.cpp - src/RE/H/hkpRigidBody.cpp - src/RE/H/hkpWorldObject.cpp - src/RE/I/IAnimationGraphManagerHolder.cpp - src/RE/I/IFormFactory.cpp - src/RE/I/IFunction.cpp - src/RE/I/IHandlerFunctor.cpp - src/RE/I/IMemoryStore.cpp - src/RE/I/IMenu.cpp - src/RE/I/INIPrefSettingCollection.cpp - src/RE/I/INISettingCollection.cpp - src/RE/I/IObjectHandlePolicy.cpp - src/RE/I/IStackCallbackFunctor.cpp - src/RE/I/IVirtualMachine.cpp - src/RE/I/IngredientItem.cpp - src/RE/I/InputEvent.cpp - src/RE/I/InterfaceStrings.cpp - src/RE/I/Inventory.cpp - src/RE/I/Inventory3DManager.cpp - src/RE/I/InventoryChanges.cpp - src/RE/I/InventoryEntryData.cpp - src/RE/I/ItemCrafted.cpp - src/RE/I/ItemHarvested.cpp - src/RE/I/ItemList.cpp - src/RE/I/ItemsPickpocketed.cpp - src/RE/L/LevelIncrease.cpp - src/RE/L/LocalMapCamera.cpp - src/RE/L/Location.cpp - src/RE/L/LocationCleared.cpp - src/RE/L/LocationDiscovery.cpp - src/RE/L/LockpickingMenu.cpp - src/RE/L/LooseFileStream.cpp - src/RE/M/MagicCaster.cpp - src/RE/M/MagicFavorites.cpp - src/RE/M/MagicFormulas.cpp - src/RE/M/MagicItem.cpp - src/RE/M/MagicItemDataCollector.cpp - src/RE/M/MagicSystem.cpp - src/RE/M/MagicTarget.cpp - src/RE/M/MagicUtilities.cpp - src/RE/M/Main.cpp - src/RE/M/MaterialIDs.cpp - src/RE/M/MemoryPage.cpp - src/RE/M/MenuControls.cpp - src/RE/M/MenuCursor.cpp - src/RE/M/MenuEventHandler.cpp - src/RE/M/Misc.cpp - src/RE/N/NativeFunctionBase.cpp - src/RE/N/NiAVObject.cpp - src/RE/N/NiAlphaProperty.cpp - src/RE/N/NiAnimationKey.cpp - src/RE/N/NiBinaryStream.cpp - src/RE/N/NiBooleanExtraData.cpp - src/RE/N/NiCamera.cpp - src/RE/N/NiColor.cpp - src/RE/N/NiColorData.cpp - src/RE/N/NiColorKey.cpp - src/RE/N/NiControllerManager.cpp - src/RE/N/NiControllerSequence.cpp - src/RE/N/NiExtraData.cpp - src/RE/N/NiFloatData.cpp - src/RE/N/NiFloatExtraData.cpp - src/RE/N/NiFloatKey.cpp - src/RE/N/NiFloatsExtraData.cpp - src/RE/N/NiIntegerExtraData.cpp - src/RE/N/NiIntegersExtraData.cpp - src/RE/N/NiInterpolator.cpp - src/RE/N/NiMath.cpp - src/RE/N/NiMatrix3.cpp - src/RE/N/NiMemManager.cpp - src/RE/N/NiNode.cpp - src/RE/N/NiObject.cpp - src/RE/N/NiObjectNET.cpp - src/RE/N/NiPoint2.cpp - src/RE/N/NiPoint3.cpp - src/RE/N/NiRefObject.cpp - src/RE/N/NiSkinInstance.cpp - src/RE/N/NiStringsExtraData.cpp - src/RE/N/NiSystem.cpp - src/RE/N/NiTCollection.cpp - src/RE/N/NiTexture.cpp - src/RE/N/NiTimeController.cpp - src/RE/N/NiTransform.cpp - src/RE/O/Object.cpp - src/RE/O/ObjectTypeInfo.cpp - src/RE/O/ObjectiveState.cpp - src/RE/P/PackUnpack.cpp - src/RE/P/PackedInstructionStream.cpp - src/RE/P/PlayerCamera.cpp - src/RE/P/PlayerCharacter.cpp - src/RE/P/PlayerControls.cpp - src/RE/P/PlayerInputHandler.cpp - src/RE/P/ProcessLists.cpp - src/RE/P/Projectile.cpp - src/RE/Q/QuestStatus.cpp - src/RE/R/RaceSexMenu.cpp - src/RE/R/ReferenceEffectController.cpp - src/RE/R/RemoveCallbackVisitor.cpp - src/RE/R/Renderer.cpp - src/RE/R/Rumble.cpp - 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/ShadowSceneNode.cpp - src/RE/S/ShoutAttack.cpp - src/RE/S/SkillIncrease.cpp - src/RE/S/Sky.cpp - src/RE/S/SkyrimVM.cpp - src/RE/S/SoulsTrapped.cpp - src/RE/S/SourceActionMap.cpp - src/RE/S/SpellsLearned.cpp - src/RE/S/Stack.cpp - src/RE/S/StackFrame.cpp - src/RE/S/Stream.cpp - src/RE/S/StreamBase.cpp - src/RE/Skyrim.cpp - src/RE/T/TES.cpp - src/RE/T/TESAIForm.cpp - src/RE/T/TESAmmo.cpp - src/RE/T/TESCamera.cpp - src/RE/T/TESClimate.cpp - src/RE/T/TESCondition.cpp - src/RE/T/TESContainer.cpp - src/RE/T/TESDataHandler.cpp - src/RE/T/TESDescription.cpp - src/RE/T/TESFaction.cpp - src/RE/T/TESFile.cpp - src/RE/T/TESForm.cpp - src/RE/T/TESHavokUtilities.cpp - src/RE/T/TESHitEvent.cpp - src/RE/T/TESLeveledList.cpp - src/RE/T/TESNPC.cpp - src/RE/T/TESObjectARMA.cpp - src/RE/T/TESObjectARMO.cpp - src/RE/T/TESObjectBOOK.cpp - src/RE/T/TESObjectCELL.cpp - src/RE/T/TESObjectREFR.cpp - src/RE/T/TESObjectSTAT.cpp - src/RE/T/TESObjectWEAP.cpp - src/RE/T/TESQuest.cpp - src/RE/T/TESRace.cpp - src/RE/T/TESSpellList.cpp - src/RE/T/TESTopic.cpp - src/RE/T/TESTopicInfo.cpp - src/RE/T/TESWorldSpace.cpp - src/RE/T/TaskQueueInterface.cpp - src/RE/T/ThumbstickEvent.cpp - src/RE/T/TypeInfo.cpp - src/RE/U/UI.cpp - src/RE/U/UI3DSceneManager.cpp - src/RE/U/UIBlurManager.cpp - src/RE/U/UIMessageQueue.cpp - src/RE/U/UnlinkedTypes.cpp - src/RE/U/UserEvents.cpp - src/RE/V/Variable.cpp - src/RE/V/VirtualMachine.cpp - src/RE/Z/ZeroFunctionArguments.cpp - src/REL/ID.cpp - src/REL/Module.cpp - src/REL/Relocation.cpp - src/REL/Version.cpp - src/REX/REX.cpp - src/REX/W32.cpp - src/SKSE/API.cpp - src/SKSE/IAT.cpp - src/SKSE/Impl/PCH.cpp - src/SKSE/InputMap.cpp - src/SKSE/Interfaces.cpp - src/SKSE/Logger.cpp - src/SKSE/RegistrationSet.cpp - src/SKSE/RegistrationSetUnique.cpp - src/SKSE/Trampoline.cpp - src/SKSE/Translation.cpp -) diff --git a/extern/openvr b/extern/openvr deleted file mode 160000 index ebdea152f..000000000 --- a/extern/openvr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ebdea152f8aac77e9a6db29682b81d762159df7e diff --git a/include/RE/A/ActorCause.h b/include/RE/A/ActorCause.h index d2b9bb8fa..fd63c7187 100644 --- a/include/RE/A/ActorCause.h +++ b/include/RE/A/ActorCause.h @@ -10,13 +10,13 @@ namespace RE public: std::int32_t DecRefCount() const { - stl::atomic_ref myRefCount{ refCount }; + REX::TAtomicRef myRefCount{ refCount }; return --myRefCount; } std::int32_t IncRefCount() const { - stl::atomic_ref myRefCount{ refCount }; + REX::TAtomicRef myRefCount{ refCount }; return ++myRefCount; } diff --git a/include/RE/B/BSAtomic.h b/include/RE/B/BSAtomic.h index 1992b8377..bde4b0c46 100644 --- a/include/RE/B/BSAtomic.h +++ b/include/RE/B/BSAtomic.h @@ -17,22 +17,22 @@ namespace RE T operator++() { - stl::atomic_ref value{ _value }; + REX::TAtomicRef value{ _value }; return ++value; } [[nodiscard]] T operator++(int) { - stl::atomic_ref value{ _value }; + REX::TAtomicRef value{ _value }; return value++; } T operator--() { - stl::atomic_ref value{ _value }; + REX::TAtomicRef value{ _value }; return --value; } [[nodiscard]] T operator--(int) { - stl::atomic_ref value{ _value }; + REX::TAtomicRef value{ _value }; return value--; } diff --git a/include/RE/B/BSImagespaceShader.h b/include/RE/B/BSImagespaceShader.h index 005a9dc81..cef7c0381 100644 --- a/include/RE/B/BSImagespaceShader.h +++ b/include/RE/B/BSImagespaceShader.h @@ -67,7 +67,7 @@ namespace RE using func_t = decltype(&BSImagespaceShader::Ctor); static REL::Relocation func{ RELOCATION_ID(100943, 107725) }; BSImagespaceShader* isShader = func(this); - stl::emplace_vtable(isShader); + REX::EMPLACE_VTABLE(isShader); return isShader; } }; diff --git a/include/RE/B/BSIntrusiveRefCounted.h b/include/RE/B/BSIntrusiveRefCounted.h index 1e4719071..3ec0ee1a4 100644 --- a/include/RE/B/BSIntrusiveRefCounted.h +++ b/include/RE/B/BSIntrusiveRefCounted.h @@ -12,13 +12,13 @@ namespace RE std::uint32_t IncRef() const { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; return ++myRefCount; } std::uint32_t DecRef() const { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; return --myRefCount; } diff --git a/include/RE/B/BSPCOrbisGamepadDevice.h b/include/RE/B/BSPCOrbisGamepadDevice.h index 635c058cf..3fb4c9ed2 100644 --- a/include/RE/B/BSPCOrbisGamepadDevice.h +++ b/include/RE/B/BSPCOrbisGamepadDevice.h @@ -172,11 +172,11 @@ namespace RE ButtonState GetPreviousButtonState() const { - return stl::unrestricted_cast(previousPadState.buttonState); + return REX::UNRESTRICTED_CAST(previousPadState.buttonState); } ButtonState GetCurrentButtonState() const { - return stl::unrestricted_cast(currentPadState.buttonState); + return REX::UNRESTRICTED_CAST(currentPadState.buttonState); } // members diff --git a/include/RE/B/BSStringPool.h b/include/RE/B/BSStringPool.h index 225365c74..4fbb30d98 100644 --- a/include/RE/B/BSStringPool.h +++ b/include/RE/B/BSStringPool.h @@ -39,7 +39,7 @@ namespace RE inline void acquire() { - stl::atomic_ref flags{ _flags }; + REX::TAtomicRef flags{ _flags }; std::uint16_t expected{ 0 }; do { expected = flags; diff --git a/include/RE/B/BSTArray.h b/include/RE/B/BSTArray.h index 1443e3981..e10897de2 100644 --- a/include/RE/B/BSTArray.h +++ b/include/RE/B/BSTArray.h @@ -121,7 +121,7 @@ namespace RE { const auto mem = malloc(a_size); if (!mem) { - stl::report_and_fail("out of memory"sv); + REX::FAIL("out of memory"sv); } else { std::memset(mem, 0, a_size); return mem; @@ -199,7 +199,7 @@ namespace RE if (a_size > N) { const auto mem = malloc(a_size); if (!mem) { - stl::report_and_fail("out of memory"sv); + REX::FAIL("out of memory"sv); } else { std::memset(mem, 0, a_size); return mem; @@ -242,7 +242,7 @@ namespace RE if (!local()) { const auto mem = malloc(capacity()); if (!mem) { - stl::report_and_fail("out of memory"sv); + REX::FAIL("out of memory"sv); } else { _data.heap = mem; } diff --git a/include/RE/B/BSTHashMap.h b/include/RE/B/BSTHashMap.h index b6df72606..1dfb0c967 100644 --- a/include/RE/B/BSTHashMap.h +++ b/include/RE/B/BSTHashMap.h @@ -337,12 +337,12 @@ namespace RE const auto cap = std::max(std::bit_ceil(a_count), min); assert(cap >= min); if (cap > 1u << 31) { - stl::report_and_fail("a buffer grew too large"sv); + REX::FAIL("a buffer grew too large"sv); } const auto entries = allocate(static_cast(cap)); if (!entries) { - stl::report_and_fail("failed to handle an allocation"sv); + REX::FAIL("failed to handle an allocation"sv); } return std::make_pair(static_cast(cap), entries); @@ -459,7 +459,7 @@ namespace RE assert(_free > 0); } - const stl::scope_exit decrement{ [&]() noexcept { --_free; } }; + const REX::TScopeExit decrement{ [&]() noexcept { --_free; } }; const auto entry = &get_entry_for(unwrap_key(a_value)); if (entry->has_value()) { // slot is taken, resolve conflict const auto free = &get_free_entry(); diff --git a/include/RE/B/BSTList.h b/include/RE/B/BSTList.h index cebca56ad..13a68bc91 100644 --- a/include/RE/B/BSTList.h +++ b/include/RE/B/BSTList.h @@ -74,8 +74,8 @@ namespace RE TES_HEAP_REDEFINE_NEW(); // members - value_type item; // 00 - stl::observer next; // ?? + value_type item; // 00 + Node* next; // ?? }; template @@ -164,7 +164,7 @@ namespace RE } private: - stl::observer _cur; + Node* _cur; }; using iterator = iterator_base; diff --git a/include/RE/B/BSWin32GamepadDevice.h b/include/RE/B/BSWin32GamepadDevice.h index 9952bf19f..3f5bf42dc 100644 --- a/include/RE/B/BSWin32GamepadDevice.h +++ b/include/RE/B/BSWin32GamepadDevice.h @@ -73,13 +73,13 @@ namespace RE // Returns the previous ButtonState of the gamepad ButtonState GetPreviousButtonState() const { - return stl::unrestricted_cast(previousState.gamepad.buttons & REX::W32::XINPUT_GAMEPAD_BUTTON_MASK); + return REX::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.buttons & REX::W32::XINPUT_GAMEPAD_BUTTON_MASK); + return REX::UNRESTRICTED_CAST(currentState.gamepad.buttons & REX::W32::XINPUT_GAMEPAD_BUTTON_MASK); } // members diff --git a/include/RE/B/ButtonEvent.h b/include/RE/B/ButtonEvent.h index eec72f0cd..3a5d44825 100644 --- a/include/RE/B/ButtonEvent.h +++ b/include/RE/B/ButtonEvent.h @@ -32,7 +32,7 @@ namespace RE auto buttonEvent = malloc(sizeof(ButtonEvent)); std::memset((void*)buttonEvent, 0, sizeof(ButtonEvent)); if (buttonEvent) { - stl::emplace_vtable(buttonEvent); + REX::EMPLACE_VTABLE(buttonEvent); buttonEvent->device = a_inputDevice; buttonEvent->eventType = INPUT_EVENT_TYPE::kButton; buttonEvent->next = nullptr; diff --git a/include/RE/H/hkpCollidable.h b/include/RE/H/hkpCollidable.h index 9386725b9..d2aa5016e 100644 --- a/include/RE/H/hkpCollidable.h +++ b/include/RE/H/hkpCollidable.h @@ -56,7 +56,7 @@ namespace RE [[nodiscard]] void* GetOwner() const { - return const_cast(stl::adjust_pointer(this, ownerOffset)); + return const_cast(REX::ADJUST_POINTER(this, ownerOffset)); } template diff --git a/include/RE/M/MemoryManager.h b/include/RE/M/MemoryManager.h index 872523cfe..973a7de62 100644 --- a/include/RE/M/MemoryManager.h +++ b/include/RE/M/MemoryManager.h @@ -208,7 +208,7 @@ namespace RE if (mem) { \ return mem; \ } else { \ - stl::report_and_fail("out of memory"sv); \ + REX::FAIL("out of memory"sv); \ } \ } \ \ @@ -218,7 +218,7 @@ namespace RE if (mem) { \ return mem; \ } else { \ - stl::report_and_fail("out of memory"sv); \ + REX::FAIL("out of memory"sv); \ } \ } \ \ diff --git a/include/RE/N/NiTCollection.h b/include/RE/N/NiTCollection.h index 98b826105..237e38fd9 100644 --- a/include/RE/N/NiTCollection.h +++ b/include/RE/N/NiTCollection.h @@ -58,7 +58,7 @@ namespace RE inline static void Deallocate(T* a_array) { if (a_array) { - auto head = stl::adjust_pointer(a_array, -stl::ssizeof_v); + auto head = REX::ADJUST_POINTER(a_array, -0x8); for (std::size_t i = 0; i < *head; ++i) { a_array[i].~T(); } diff --git a/include/RE/T/TESActionData.h b/include/RE/T/TESActionData.h index 59e6c64c7..69adc482c 100644 --- a/include/RE/T/TESActionData.h +++ b/include/RE/T/TESActionData.h @@ -37,7 +37,7 @@ namespace RE using func_t = decltype(&TESActionData::Ctor); static REL::Relocation func{ RELOCATION_ID(15916, 41558) }; TESActionData* tesActionData = func(this); - stl::emplace_vtable(tesActionData); + REX::EMPLACE_VTABLE(tesActionData); return tesActionData; } }; diff --git a/include/RE/T/TESObjectREFR.h b/include/RE/T/TESObjectREFR.h index ef7523495..243d65482 100644 --- a/include/RE/T/TESObjectREFR.h +++ b/include/RE/T/TESObjectREFR.h @@ -400,7 +400,7 @@ namespace RE [[nodiscard]] constexpr float GetPositionY() const noexcept { return data.location.y; } [[nodiscard]] constexpr float GetPositionZ() const noexcept { return data.location.z; } [[nodiscard]] float GetScale() const; - NiControllerSequence* GetSequence(stl::zstring a_name) const; + NiControllerSequence* GetSequence(std::string_view a_name) const; std::uint32_t GetStealValue(const InventoryEntryData* a_entryData, std::uint32_t a_numItems, bool a_useMult) const; float GetSubmergeLevel(float a_zPos, TESObjectCELL* a_cell) const; void GetTransform(NiTransform& a_transform) const; @@ -441,7 +441,7 @@ namespace RE bool NameIncludes(std::string_view a_word) const; 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(std::string_view a_from, std::string_view a_to); void PlayAnimation(NiControllerManager* a_manager, NiControllerSequence* a_toSeq, NiControllerSequence* a_fromSeq); void SetActivationBlocked(bool a_blocked); void SetAngle(const NiPoint3& a_angle); diff --git a/include/REL/ID.h b/include/REL/ID.h deleted file mode 100644 index fa4c7f9c8..000000000 --- a/include/REL/ID.h +++ /dev/null @@ -1,374 +0,0 @@ -#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 deleted file mode 100644 index a7c461013..000000000 --- a/include/REL/Module.h +++ /dev/null @@ -1,153 +0,0 @@ -#pragma once - -#include "REL/Version.h" - -#include "REX/W32/KERNEL32.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]] REX::W32::HMODULE pointer() const noexcept { return reinterpret_cast(base()); } - - template - [[nodiscard]] T* pointer() const noexcept - { - return static_cast(pointer()); - } - - private: - Module() - { - const auto getFilename = [&]() { - return REX::W32::GetEnvironmentVariableW( - ENVIRONMENT.data(), - _filename.data(), - static_cast(_filename.size())); - }; - - _filename.resize(getFilename()); - if (const auto result = getFilename(); - result != _filename.size() - 1 || - result == 0) { - _filename = L"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 = REX::W32::GetModuleHandleW(_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 = GetFileVersion(_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, 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, REX::W32::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 deleted file mode 100644 index 6ed58b82d..000000000 --- a/include/REL/Offset.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "REL/Module.h" - -namespace REL -{ - class Offset - { - public: - constexpr Offset() noexcept = default; - - explicit constexpr Offset(std::size_t a_offset) noexcept : - _offset(a_offset) - {} - - constexpr Offset& operator=(std::size_t a_offset) noexcept - { - _offset = a_offset; - return *this; - } - - [[nodiscard]] std::uintptr_t address() const { return base() + offset(); } - [[nodiscard]] constexpr std::size_t offset() const noexcept { return _offset; } - - private: - [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } - - std::size_t _offset{ 0 }; - }; -} diff --git a/include/REL/Pattern.h b/include/REL/Pattern.h deleted file mode 100644 index a23631940..000000000 --- a/include/REL/Pattern.h +++ /dev/null @@ -1,189 +0,0 @@ -#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 deleted file mode 100644 index 0fab8ad1f..000000000 --- a/include/REL/REL.h +++ /dev/null @@ -1,8 +0,0 @@ -#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 deleted file mode 100644 index 76e4c873b..000000000 --- a/include/REL/Relocation.h +++ /dev/null @@ -1,399 +0,0 @@ -#pragma once - -#include "REL/Module.h" - -#include "SKSE/Trampoline.h" - -#define REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_nopropQual, a_propQual, ...) \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_pod_type \ - { \ - using type = R(__VA_ARGS__ Cls*, Args...) a_propQual; \ - }; \ - \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_pod_type \ - { \ - using type = R(__VA_ARGS__ Cls*, Args..., ...) a_propQual; \ - }; - -#define REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(a_qualifer, ...) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_qualifer, , ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL(a_qualifer, noexcept, ##__VA_ARGS__) - -#define REL_MAKE_MEMBER_FUNCTION_POD_TYPE(...) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(, __VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(&, ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER(&&, ##__VA_ARGS__) - -#define REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL(a_nopropQual, a_propQual, ...) \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_non_pod_type \ - { \ - using type = R&(__VA_ARGS__ Cls*, void*, Args...)a_propQual; \ - }; \ - \ - template < \ - class R, \ - class Cls, \ - class... Args> \ - struct member_function_non_pod_type \ - { \ - using type = R&(__VA_ARGS__ Cls*, void*, Args..., ...)a_propQual; \ - }; - -#define REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(a_qualifer, ...) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL(a_qualifer, , ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL(a_qualifer, noexcept, ##__VA_ARGS__) - -#define REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(...) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(, __VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(&, ##__VA_ARGS__) \ - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER(&&, ##__VA_ARGS__) - -namespace REL -{ - namespace detail - { - template - struct member_function_pod_type; - - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(); - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(const); - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(volatile); - REL_MAKE_MEMBER_FUNCTION_POD_TYPE(const volatile); - - template - using member_function_pod_type_t = typename member_function_pod_type::type; - - template - struct member_function_non_pod_type; - - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(); - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(const); - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(volatile); - REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE(const volatile); - - template - using member_function_non_pod_type_t = typename member_function_non_pod_type::type; - - // https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention - - template - struct meets_length_req : - std::disjunction< - std::bool_constant, - std::bool_constant, - std::bool_constant, - std::bool_constant> - {}; - - template - struct meets_function_req : - std::conjunction< - std::is_trivially_constructible, - std::is_trivially_destructible, - std::is_trivially_copy_assignable, - std::negation< - std::is_polymorphic>> - {}; - - template - struct meets_member_req : - std::is_standard_layout - {}; - - template - struct is_x64_pod : - std::true_type - {}; - - template - struct is_x64_pod< - T, - std::enable_if_t< - std::is_union_v>> : - std::false_type - {}; - - template - struct is_x64_pod< - T, - std::enable_if_t< - std::is_class_v>> : - std::conjunction< - meets_length_req, - meets_function_req, - meets_member_req> - {}; - - template - inline constexpr bool is_x64_pod_v = is_x64_pod::value; - - template < - class F, - class First, - class... Rest> - decltype(auto) invoke_member_function_non_pod(F&& a_func, First&& a_first, Rest&&... a_rest) // - noexcept(std::is_nothrow_invocable_v) - { - using result_t = std::invoke_result_t; - std::aligned_storage_t result; - - using func_t = member_function_non_pod_type_t; - auto func = stl::unrestricted_cast(std::forward(a_func)); - - return func(std::forward(a_first), std::addressof(result), std::forward(a_rest)...); - } - } - - inline constexpr std::uint8_t NOP = 0x90; - inline constexpr std::uint8_t NOP2[] = { 0x66, 0x90 }; - inline constexpr std::uint8_t NOP3[] = { 0x0F, 0x1F, 0x00 }; - inline constexpr std::uint8_t NOP4[] = { 0x0F, 0x1F, 0x40, 0x00 }; - inline constexpr std::uint8_t NOP5[] = { 0x0F, 0x1F, 0x44, 0x00, 0x00 }; - inline constexpr std::uint8_t NOP6[] = { 0x66, 0x0F, 0x1F, 0x44, 0x00, 0x00 }; - inline constexpr std::uint8_t NOP7[] = { 0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00 }; - inline constexpr std::uint8_t NOP8[] = { 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 }; - inline constexpr std::uint8_t NOP9[] = { 0x66, 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 }; - - inline constexpr std::uint8_t JMP8 = 0xEB; - inline constexpr std::uint8_t JMP32 = 0xE9; - inline constexpr std::uint8_t RET = 0xC3; - inline constexpr std::uint8_t INT3 = 0xCC; - - template - std::invoke_result_t invoke(F&& a_func, Args&&... a_args) // - noexcept(std::is_nothrow_invocable_v) // - requires(std::invocable) - { - if constexpr (std::is_member_function_pointer_v>) { - if constexpr (detail::is_x64_pod_v>) { // member functions == free functions in x64 - using func_t = detail::member_function_pod_type_t>; - auto func = stl::unrestricted_cast(std::forward(a_func)); - return func(std::forward(a_args)...); - } else { // shift args to insert result - return detail::invoke_member_function_non_pod(std::forward(a_func), std::forward(a_args)...); - } - } else { - return std::forward(a_func)(std::forward(a_args)...); - } - } - - 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) - { - safe_write(a_dst, std::addressof(a_data), sizeof(T)); - } - - template - void safe_write(std::uintptr_t a_dst, std::span a_data) - { - safe_write(a_dst, a_data.data(), a_data.size_bytes()); - } - - void safe_fill(std::uintptr_t a_dst, std::uint8_t a_value, std::size_t a_count); - - template - class Relocation - { - public: - using value_type = - std::conditional_t< - std::is_member_pointer_v || std::is_function_v>, - std::decay_t, - T>; - - constexpr Relocation() noexcept = default; - - explicit constexpr Relocation(std::uintptr_t a_address) noexcept : - _impl{ a_address } - {} - - explicit Relocation(Offset a_offset) : - _impl{ a_offset.address() } - {} - - explicit Relocation(ID a_id) : - _impl{ a_id.address() } - {} - - explicit Relocation(ID a_id, std::ptrdiff_t a_offset) : - _impl{ a_id.address() + a_offset } - {} - - constexpr Relocation& operator=(std::uintptr_t a_address) noexcept - { - _impl = a_address; - return *this; - } - - Relocation& operator=(Offset a_offset) - { - _impl = a_offset.address(); - return *this; - } - - Relocation& operator=(ID a_id) - { - _impl = a_id.address(); - return *this; - } - - template - [[nodiscard]] decltype(auto) operator*() const noexcept - requires(std::is_pointer_v) - { - return *get(); - } - - template - [[nodiscard]] auto operator->() const noexcept - requires(std::is_pointer_v) - { - return get(); - } - - template - std::invoke_result_t operator()(Args&&... a_args) const - noexcept(std::is_nothrow_invocable_v) - requires(std::invocable) - { - return REL::invoke(get(), std::forward(a_args)...); - } - - [[nodiscard]] constexpr std::uintptr_t address() const noexcept { return _impl; } - [[nodiscard]] std::size_t offset() const { return _impl - base(); } - - [[nodiscard]] value_type get() const - noexcept(std::is_nothrow_copy_constructible_v) - { - assert(_impl != 0); - return stl::unrestricted_cast(_impl); - } - - template - void replace_func(const std::size_t a_count, const std::uintptr_t a_dst) - requires(std::same_as) - { -#pragma pack(push, 1) - struct Assembly - { - std::uint8_t jmp; - std::uint8_t modrm; - std::int32_t disp; - std::uint64_t addr; - }; - static_assert(sizeof(Assembly) == 0xE); -#pragma pack(pop) - - Assembly assembly{ - .jmp = static_cast(0xFF), - .modrm = static_cast(0x25), - .disp = static_cast(0), - .addr = static_cast(a_dst), - }; - - safe_fill(address() + O, INT3, a_count); - safe_write(address() + O, &assembly, sizeof(assembly)); - } - - template - void replace_func(const std::size_t a_count, const F a_dst) - requires(std::same_as) - { - replace_func(a_count, stl::unrestricted_cast(a_dst)); - } - - template - void write(const 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(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); - safe_write(addr, a_newFunc); - return result; - } - - template - 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)); - } - - private: - // clang-format off - [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } - // clang-format on - - std::uintptr_t _impl{ 0 }; - }; -} - -#undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE -#undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER -#undef REL_MAKE_MEMBER_FUNCTION_NON_POD_TYPE_HELPER_IMPL - -#undef REL_MAKE_MEMBER_FUNCTION_POD_TYPE -#undef REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER -#undef REL_MAKE_MEMBER_FUNCTION_POD_TYPE_HELPER_IMPL diff --git a/include/REL/Version.h b/include/REL/Version.h deleted file mode 100644 index 63aba38ff..000000000 --- a/include/REL/Version.h +++ /dev/null @@ -1,113 +0,0 @@ -#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; - } - - [[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 }; - }; - - [[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]] std::optional GetFileVersion(stl::zwstring a_filename); -} - -#ifdef __cpp_lib_format -template -struct std::formatter : formatter -{ - template - constexpr auto format(const REL::Version a_version, FormatContext& a_ctx) const - { - return formatter::format(a_version.string(), a_ctx); - } -}; -#endif - -#ifdef FMT_VERSION -template -struct fmt::formatter : formatter -{ - template - auto format(const REL::Version a_version, FormatContext& a_ctx) const - { - return formatter::format(a_version.string(), a_ctx); - } -}; -#endif diff --git a/include/REX/PS4.h b/include/REX/PS4.h deleted file mode 100644 index 8d7b0f3f5..000000000 --- a/include/REX/PS4.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "REX/PS4/SCEPAD.h" diff --git a/include/REX/PS4/SCEPAD.h b/include/REX/PS4/SCEPAD.h deleted file mode 100644 index fa88dfc26..000000000 --- a/include/REX/PS4/SCEPAD.h +++ /dev/null @@ -1,27 +0,0 @@ -#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/REX.h b/include/REX/REX.h deleted file mode 100644 index 43a000af9..000000000 --- a/include/REX/REX.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "REX/REX/Enum.h" -#include "REX/REX/EnumSet.h" -#include "REX/REX/INI.h" -#include "REX/REX/JSON.h" -#include "REX/REX/Setting.h" -#include "REX/REX/Singleton.h" -#include "REX/REX/TOML.h" diff --git a/include/REX/REX/Enum.h b/include/REX/REX/Enum.h deleted file mode 100644 index cc0482751..000000000 --- a/include/REX/REX/Enum.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -namespace REX -{ - template < - class E, - class U = std::underlying_type_t> - class Enum - { - public: - using enum_type = E; - using underlying_type = U; - - static_assert(std::is_enum_v, "Enum must be an enum"); - static_assert(std::is_integral_v, "Enum<..., U> must be an integral"); - - constexpr Enum() noexcept = default; - constexpr Enum(const Enum&) noexcept = default; - constexpr Enum(Enum&&) noexcept = default; - - template // NOLINTNEXTLINE(google-explicit-constructor) - constexpr Enum(Enum a_rhs) noexcept : - _impl(static_cast(a_rhs.get())) - {} - - constexpr Enum(E a_value) noexcept : - _impl(static_cast(a_value)) - {} - - ~Enum() noexcept = default; - - constexpr Enum& operator=(const Enum&) noexcept = default; - constexpr Enum& operator=(Enum&&) noexcept = default; - - template - constexpr Enum& operator=(Enum a_rhs) noexcept - { - _impl = static_cast(a_rhs.get()); - } - - constexpr Enum& operator=(E a_value) noexcept - { - _impl = static_cast(a_value); - return *this; - } - - public: - [[nodiscard]] explicit constexpr operator bool() const noexcept { return _impl != static_cast(0); } - - [[nodiscard]] constexpr E operator*() const noexcept { return get(); } - [[nodiscard]] constexpr E get() const noexcept { return static_cast(_impl); } - [[nodiscard]] constexpr U underlying() const noexcept { return _impl; } - - public: - friend constexpr bool operator==(Enum a_lhs, Enum a_rhs) noexcept { return a_lhs.underlying() == a_rhs.underlying(); } - friend constexpr bool operator==(Enum a_lhs, E a_rhs) noexcept { return a_lhs.underlying() == static_cast(a_rhs); } - friend constexpr bool operator==(E a_lhs, Enum a_rhs) noexcept { return static_cast(a_lhs) == a_rhs.underlying(); } - - private: - U _impl{ 0 }; - }; - - template - Enum(Args...) -> Enum< - std::common_type_t, - std::underlying_type_t< - std::common_type_t>>; -} diff --git a/include/REX/REX/EnumSet.h b/include/REX/REX/EnumSet.h deleted file mode 100644 index 296703458..000000000 --- a/include/REX/REX/EnumSet.h +++ /dev/null @@ -1,182 +0,0 @@ -#pragma once - -namespace REX -{ - template < - class E, - class U = std::underlying_type_t> - class EnumSet - { - public: - using enum_type = E; - using underlying_type = U; - - static_assert(std::is_enum_v, "EnumSet must be an enum"); - static_assert(std::is_integral_v, "EnumSet<..., U> must be an integral"); - - constexpr EnumSet() noexcept = default; - constexpr EnumSet(const EnumSet&) noexcept = default; - constexpr EnumSet(EnumSet&&) noexcept = default; - - template // NOLINTNEXTLINE(google-explicit-constructor) - constexpr EnumSet(EnumSet a_rhs) noexcept : - _impl(static_cast(a_rhs.get())) - {} - - template - constexpr EnumSet(Args... a_values) noexcept - requires(std::same_as && ...) - : - _impl((static_cast(a_values) | ...)) - {} - - ~EnumSet() noexcept = default; - - constexpr EnumSet& operator=(const EnumSet&) noexcept = default; - constexpr EnumSet& operator=(EnumSet&&) noexcept = default; - - template - constexpr EnumSet& operator=(EnumSet a_rhs) noexcept - { - _impl = static_cast(a_rhs.get()); - } - - constexpr EnumSet& operator=(E a_value) noexcept - { - _impl = static_cast(a_value); - return *this; - } - - public: - [[nodiscard]] explicit constexpr operator bool() const noexcept { return _impl != static_cast(0); } - - [[nodiscard]] constexpr E operator*() const noexcept { return get(); } - [[nodiscard]] constexpr E get() const noexcept { return static_cast(_impl); } - [[nodiscard]] constexpr U underlying() const noexcept { return _impl; } - - public: - template - constexpr EnumSet& set(Args... a_args) noexcept - requires(std::same_as && ...) - { - _impl |= (static_cast(a_args) | ...); - return *this; - } - - template - constexpr EnumSet& set(bool a_set, Args... a_args) noexcept - requires(std::same_as && ...) - { - if (a_set) - _impl |= (static_cast(a_args) | ...); - else - _impl &= ~(static_cast(a_args) | ...); - - return *this; - } - - template - constexpr EnumSet& reset(Args... a_args) noexcept - requires(std::same_as && ...) - { - _impl &= ~(static_cast(a_args) | ...); - return *this; - } - - constexpr EnumSet& reset() noexcept - { - _impl = 0; - return *this; - } - - template - [[nodiscard]] constexpr bool any(Args... a_args) const noexcept - requires(std::same_as && ...) - { - return (_impl & (static_cast(a_args) | ...)) != static_cast(0); - } - - template - [[nodiscard]] constexpr bool all(Args... a_args) const noexcept - requires(std::same_as && ...) - { - return (_impl & (static_cast(a_args) | ...)) == (static_cast(a_args) | ...); - } - - template - [[nodiscard]] constexpr bool none(Args... a_args) const noexcept - requires(std::same_as && ...) - { - return (_impl & (static_cast(a_args) | ...)) == static_cast(0); - } - - public: - friend constexpr bool operator==(EnumSet a_lhs, EnumSet a_rhs) noexcept { return a_lhs.underlying() == a_rhs.underlying(); } - friend constexpr bool operator==(EnumSet a_lhs, E a_rhs) noexcept { return a_lhs.underlying() == static_cast(a_rhs); } - friend constexpr bool operator==(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs) == a_rhs.underlying(); } - - friend constexpr std::strong_ordering operator<=>(EnumSet a_lhs, EnumSet a_rhs) noexcept { return a_lhs.underlying() <=> a_rhs.underlying(); } - friend constexpr std::strong_ordering operator<=>(EnumSet a_lhs, E a_rhs) noexcept { return a_lhs.underlying() <=> static_cast(a_rhs); } - friend constexpr std::strong_ordering operator<=>(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs) <=> a_rhs.underlying(); } - - friend constexpr EnumSet operator&(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() & a_rhs.underlying()); } - friend constexpr EnumSet operator&(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() & static_cast(a_rhs)); } - friend constexpr EnumSet operator&(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) & a_rhs.underlying()); } - - friend constexpr EnumSet& operator&=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs & a_rhs; } - friend constexpr EnumSet& operator&=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs & a_rhs; } - - friend constexpr EnumSet operator|(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() | a_rhs.underlying()); } - friend constexpr EnumSet operator|(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() | static_cast(a_rhs)); } - friend constexpr EnumSet operator|(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) | a_rhs.underlying()); } - - friend constexpr EnumSet& operator|=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs | a_rhs; } - friend constexpr EnumSet& operator|=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs | a_rhs; } - - friend constexpr EnumSet operator^(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() ^ a_rhs.underlying()); } - friend constexpr EnumSet operator^(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() ^ static_cast(a_rhs)); } - friend constexpr EnumSet operator^(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) ^ a_rhs.underlying()); } - - friend constexpr EnumSet& operator^=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs ^ a_rhs; } - friend constexpr EnumSet& operator^=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs ^ a_rhs; } - - friend constexpr EnumSet operator+(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() + a_rhs.underlying()); } - friend constexpr EnumSet operator+(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() + static_cast(a_rhs)); } - friend constexpr EnumSet operator+(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) + a_rhs.underlying()); } - - friend constexpr EnumSet& operator+=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs + a_rhs; } - friend constexpr EnumSet& operator+=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs + a_rhs; } - - friend constexpr EnumSet operator-(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() - a_rhs.underlying()); } - friend constexpr EnumSet operator-(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() - static_cast(a_rhs)); } - friend constexpr EnumSet operator-(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) - a_rhs.underlying()); } - - friend constexpr EnumSet& operator-=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs - a_rhs; } - friend constexpr EnumSet& operator-=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs - a_rhs; } - - friend constexpr EnumSet operator<<(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() << a_rhs.underlying()); } - friend constexpr EnumSet operator<<(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() << static_cast(a_rhs)); } - friend constexpr EnumSet operator<<(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) << a_rhs.underlying()); } - - friend constexpr EnumSet& operator<<=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs << a_rhs; } - friend constexpr EnumSet& operator<<=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs << a_rhs; } - - friend constexpr EnumSet operator>>(EnumSet a_lhs, EnumSet a_rhs) noexcept { return static_cast(a_lhs.underlying() >> a_rhs.underlying()); } - friend constexpr EnumSet operator>>(EnumSet a_lhs, E a_rhs) noexcept { return static_cast(a_lhs.underlying() >> static_cast(a_rhs)); } - friend constexpr EnumSet operator>>(E a_lhs, EnumSet a_rhs) noexcept { return static_cast(static_cast(a_lhs) >> a_rhs.underlying()); } - - friend constexpr EnumSet& operator>>=(EnumSet& a_lhs, EnumSet a_rhs) noexcept { return a_lhs = a_lhs >> a_rhs; } - friend constexpr EnumSet& operator>>=(EnumSet& a_lhs, E a_rhs) noexcept { return a_lhs = a_lhs >> a_rhs; } - - friend constexpr EnumSet& operator~(EnumSet& a_lhs) noexcept { return a_lhs = ~a_lhs.underlying(); } - - private: - U _impl{ 0 }; - }; - - template - EnumSet(Args...) -> EnumSet< - std::common_type_t, - std::underlying_type_t< - std::common_type_t>>; -} diff --git a/include/REX/REX/INI.h b/include/REX/REX/INI.h deleted file mode 100644 index 315dfb89e..000000000 --- a/include/REX/REX/INI.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include "REX/REX/Setting.h" - -#ifdef REX_OPTION_INI -namespace REX::INI -{ - using sec_t = std::string_view; - using key_t = std::string_view; - - namespace Impl - { - template - void SettingLoad(void* a_file, sec_t a_section, key_t a_key, T& a_value, T& a_valueDefault); - - template - void SettingSave(void* a_file, sec_t a_section, key_t a_key, T& a_value); - } - - class SettingStore : - public TSettingStore - { - public: - virtual void Load() override; - virtual void Save() override; - }; - - template - class Setting : - public TSetting - { - public: - Setting(sec_t a_section, key_t a_key, T a_default) : - TSetting(a_default), - m_section(a_section), - m_key(a_key) - {} - - public: - virtual void Load(void* a_data, bool a_isBase) override - { - if (a_isBase) { - Impl::SettingLoad(a_data, m_section, m_key, this->m_valueDefault, this->m_valueDefault); - this->SetValue(this->m_valueDefault); - } else { - Impl::SettingLoad(a_data, m_section, m_key, this->m_value, this->m_valueDefault); - } - } - - virtual void Save(void* a_data) override - { - Impl::SettingSave(a_data, m_section, m_key, this->m_value); - } - - private: - sec_t m_section; - key_t m_key; - }; - - template - using Bool = Setting; - - template - using F32 = Setting; - - template - using F64 = Setting; - - template - using I8 = Setting; - - template - using I16 = Setting; - - template - using I32 = Setting; - - template - using U8 = Setting; - - template - using U16 = Setting; - - template - using U32 = Setting; - - template - using Str = Setting; -} - -template -struct std::formatter, CharT> : std::formatter -{ - template - auto format(const REX::INI::Setting& a_setting, FormatContext& a_ctx) const - { - return std::formatter::format(a_setting.GetValue(), a_ctx); - } -}; -#endif diff --git a/include/REX/REX/JSON.h b/include/REX/REX/JSON.h deleted file mode 100644 index 14b2e4ae6..000000000 --- a/include/REX/REX/JSON.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include "REX/REX/Setting.h" - -#ifdef REX_OPTION_JSON -namespace REX::JSON -{ - using path_t = std::string_view; - - namespace Impl - { - template - void SettingLoad(void* a_file, path_t a_path, T& a_value, T& a_valueDefault); - - template - void SettingSave(void* a_file, path_t a_path, T& a_value); - } - - class SettingStore : - public TSettingStore - { - public: - virtual void Load() override; - virtual void Save() override; - }; - - template - class Setting : - public TSetting - { - public: - Setting(path_t a_path, T a_default) : - TSetting(a_default), - m_path(a_path) - {} - - public: - virtual void Load(void* a_data, bool a_isBase) override - { - if (a_isBase) { - Impl::SettingLoad(a_data, m_path, this->m_valueDefault, this->m_valueDefault); - this->SetValue(this->m_valueDefault); - } else { - Impl::SettingLoad(a_data, m_path, this->m_value, this->m_valueDefault); - } - } - - virtual void Save(void* a_data) override - { - Impl::SettingSave(a_data, m_path, this->m_value); - } - - private: - path_t m_path; - }; - - template - using Bool = Setting; - - template - using F32 = Setting; - - template - using F64 = Setting; - - template - using I8 = Setting; - - template - using I16 = Setting; - - template - using I32 = Setting; - - template - using U8 = Setting; - - template - using U16 = Setting; - - template - using U32 = Setting; - - template - using Str = Setting; -} - -template -struct std::formatter, CharT> : std::formatter -{ - template - auto format(const REX::JSON::Setting& a_setting, FormatContext& a_ctx) const - { - return std::formatter::format(a_setting.GetValue(), a_ctx); - } -}; -#endif diff --git a/include/REX/REX/Setting.h b/include/REX/REX/Setting.h deleted file mode 100644 index 5d26eb572..000000000 --- a/include/REX/REX/Setting.h +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include "REX/REX/Singleton.h" - -namespace REX -{ - class ISetting - { - public: - virtual void Load(void* a_data, bool a_isBase) = 0; - virtual void Save(void* a_data) = 0; - }; - - class ISettingStore - { - public: - virtual void Init(const char* a_file, const char* a_fileCustom) = 0; - virtual void Load() = 0; - virtual void Save() = 0; - virtual void Register(ISetting* a_setting) = 0; - }; - - template - class TSetting : - public ISetting - { - public: - TSetting() = delete; - - TSetting(T a_default) : - m_value(a_default), - m_valueDefault(a_default) - { - Store::GetSingleton()->Register(this); - } - - public: - T GetValue() const { return m_value; } - - T GetValueDefault() const { return m_valueDefault; } - - void SetValue(T a_value) { m_value = a_value; } - - protected: - T m_value; - T m_valueDefault; - }; - - template - class TSettingStore : - public ISettingStore, - public Singleton - { - public: - virtual void Init(const char* a_fileBase, const char* a_fileUser) override - { - m_fileBase = a_fileBase; - m_fileUser = a_fileUser; - } - - virtual void Register(ISetting* a_setting) override - { - m_settings.emplace_back(a_setting); - } - - protected: - std::string_view m_fileBase; - std::string_view m_fileUser; - std::vector m_settings; - }; -} diff --git a/include/REX/REX/Singleton.h b/include/REX/REX/Singleton.h deleted file mode 100644 index 836ddb1ee..000000000 --- a/include/REX/REX/Singleton.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -namespace REX -{ - template - class Singleton - { - public: - static T* GetSingleton() - { - static T singleton; - return std::addressof(singleton); - } - - protected: - Singleton() = default; - ~Singleton() = default; - - Singleton(const Singleton&) = delete; - Singleton(Singleton&&) = delete; - - Singleton& operator=(const Singleton&) = delete; - Singleton& operator=(Singleton&&) = delete; - }; -} diff --git a/include/REX/REX/TOML.h b/include/REX/REX/TOML.h deleted file mode 100644 index 8516479f7..000000000 --- a/include/REX/REX/TOML.h +++ /dev/null @@ -1,116 +0,0 @@ -#pragma once - -#include "REX/REX/Setting.h" - -#ifdef REX_OPTION_TOML -namespace REX::TOML -{ - using sec_t = std::vector; - using key_t = std::string_view; - - namespace Impl - { - template - void SettingLoad(void* a_file, sec_t a_section, key_t a_key, T& a_value, T& a_valueDefault); - - template - void SettingSave(void* a_file, sec_t a_section, key_t a_key, T& a_value); - } - - class SettingStore : - public TSettingStore - { - public: - virtual void Load() override; - virtual void Save() override; - }; - - template - class Setting : - public TSetting - { - public: - Setting(key_t a_key, T a_default) : - TSetting(a_default), - m_section(), - m_key(a_key) - {} - - Setting(std::string_view a_section, key_t a_key, T a_default) : - TSetting(a_default), - m_section(), - m_key(a_key) - { - for (const auto token : std::ranges::split_view{ a_section, std::string_view{ "." } }) { - m_section.emplace_back(token.data(), token.size()); - } - } - - Setting(std::initializer_list a_section, key_t a_key, T a_default) : - TSetting(a_default), - m_section(a_section), - m_key(a_key) - {} - - public: - virtual void Load(void* a_data, bool a_isBase) override - { - if (a_isBase) { - Impl::SettingLoad(a_data, m_section, m_key, this->m_valueDefault, this->m_valueDefault); - this->SetValue(this->m_valueDefault); - } else { - Impl::SettingLoad(a_data, m_section, m_key, this->m_value, this->m_valueDefault); - } - } - - virtual void Save(void* a_data) override - { - Impl::SettingSave(a_data, m_section, m_key, this->m_value); - } - - private: - sec_t m_section; - key_t m_key; - }; - - template - using Bool = Setting; - - template - using F32 = Setting; - - template - using F64 = Setting; - - template - using I8 = Setting; - - template - using I16 = Setting; - - template - using I32 = Setting; - - template - using U8 = Setting; - - template - using U16 = Setting; - - template - using U32 = Setting; - - template - using Str = Setting; -} - -template -struct std::formatter, CharT> : std::formatter -{ - template - auto format(const REX::TOML::Setting& a_setting, FormatContext& a_ctx) const - { - return std::formatter::format(a_setting.GetValue(), a_ctx); - } -}; -#endif diff --git a/include/REX/W32.h b/include/REX/W32.h deleted file mode 100644 index e740fa83b..000000000 --- a/include/REX/W32.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -#include "REX/W32/ADVAPI32.h" -#include "REX/W32/BCRYPT.h" -#include "REX/W32/COM.h" -#include "REX/W32/COMPTR.h" -#include "REX/W32/D3D.h" -#include "REX/W32/D3D11.h" -#include "REX/W32/D3D11_1.h" -#include "REX/W32/D3D11_2.h" -#include "REX/W32/D3D11_3.h" -#include "REX/W32/D3D11_4.h" -#include "REX/W32/D3DCOMPILER.h" -#include "REX/W32/DBGHELP.h" -#include "REX/W32/DINPUT.h" -#include "REX/W32/DXGI.h" -#include "REX/W32/DXGI_2.h" -#include "REX/W32/DXGI_3.h" -#include "REX/W32/DXGI_4.h" -#include "REX/W32/DXGI_5.h" -#include "REX/W32/DXGI_6.h" -#include "REX/W32/KERNEL32.h" -#include "REX/W32/NT.h" -#include "REX/W32/OLE32.h" -#include "REX/W32/USER32.h" -#include "REX/W32/VERSION.h" -#include "REX/W32/XINPUT.h" diff --git a/include/REX/W32/ADVAPI32.h b/include/REX/W32/ADVAPI32.h deleted file mode 100644 index cde432247..000000000 --- a/include/REX/W32/ADVAPI32.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - inline auto HKEY_CLASSES_ROOT{ reinterpret_cast(0x80000000ull) }; - inline auto HKEY_CURRENT_USER{ reinterpret_cast(0x80000001ull) }; - inline auto HKEY_LOCAL_MACHINE{ reinterpret_cast(0x80000002ull) }; -} - -namespace REX::W32 -{ - std::int32_t RegGetValueA(HKEY a_key, const char* a_subKey, const char* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen); - std::int32_t RegGetValueW(HKEY a_key, const wchar_t* a_subKey, const wchar_t* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen); -} diff --git a/include/REX/W32/BASE.h b/include/REX/W32/BASE.h deleted file mode 100644 index 8a44bfd2b..000000000 --- a/include/REX/W32/BASE.h +++ /dev/null @@ -1,198 +0,0 @@ -#pragma once - -#ifdef _INC_WINAPIFAMILY -# error Windows API detected. Please move any Windows API includes after CommonLib, or remove them. -#endif - -#define REX_W32_IMPORT(a_ret, a_name, ...) \ - extern "C" __declspec(dllimport) a_ret __stdcall W32_IMPL_##a_name(...) noexcept; \ - __pragma(comment(linker, "/alternatename:__imp_W32_IMPL_" #a_name "=__imp_" #a_name)) - -namespace REX::W32 -{ - using BOOL = std::int32_t; - using HANDLE = void*; - using HBITMAP = struct HBITMAP__*; - using HBRUSH = struct HBRUSH__*; - using HCURSOR = struct HCURSOR__*; - using HDC = struct HDC__*; - using HFONT = struct HFONT__*; - using HICON = struct HICON__*; - using HINSTANCE = struct HINSTANCE__*; - using HKEY = struct HKEY__*; - using HMENU = struct HMENU__*; - using HMODULE = HINSTANCE; - using HMONITOR = struct HMONITOR__*; - using HPALETTE = struct HPALETTE__*; - using HPEN = struct HPEN__*; - using HRESULT = std::int32_t; - using HSTRING = struct HSTRING__*; - using HWND = struct HWND__*; - using NTSTATUS = std::int32_t; - - // general constants - inline const auto INVALID_HANDLE_VALUE{ reinterpret_cast(static_cast(-1)) }; - inline constexpr auto MAX_PATH{ 260u }; -} - -namespace REX::W32 -{ - struct FILETIME - { - constexpr FILETIME() noexcept = default; - - constexpr FILETIME(std::uint64_t a_value) noexcept - { - *this = std::bit_cast(a_value); - } - - constexpr operator std::uint64_t() const noexcept - { - return std::bit_cast(*this); - } - - std::uint32_t lo{}; // 00 - std::uint32_t hi{}; // 04 - }; - static_assert(sizeof(FILETIME) == 0x8); -} - -namespace REX::W32 -{ - struct GUID - { - constexpr GUID() noexcept = default; - - constexpr GUID(const std::uint32_t a_data1, 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 POINT - { - constexpr POINT() noexcept = default; - - constexpr POINT(std::int32_t a_x, std::int32_t a_y) noexcept : - x(a_x), y(a_y) - {} - - std::int32_t x{}; // 00 - std::int32_t y{}; // 04 - }; - static_assert(sizeof(POINT) == 0x8); -} - -namespace REX::W32 -{ - struct RECT - { - constexpr RECT() noexcept = default; - - constexpr RECT(const std::int32_t a_x1, const std::int32_t a_y1, const std::int32_t a_x2, const std::int32_t a_y2) noexcept : - x1(a_x1), y1(a_y1), x2(a_x2), y2(a_y2) - {} - - std::int32_t x1{}; // 00 - std::int32_t y1{}; // 04 - std::int32_t x2{}; // 08 - std::int32_t y2{}; // 10 - }; - static_assert(sizeof(RECT) == 0x10); -} - -namespace REX::W32 -{ - struct SIZE - { - std::int32_t x{}; // 00 - std::int32_t y{}; // 04 - }; - static_assert(sizeof(SIZE) == 0x8); -} - -namespace REX::W32 -{ - struct CRITICAL_SECTION - { - void* debugInfo; // 00 - std::int32_t lockCount; // 08 - std::int32_t recursionCount; // 0C - HANDLE owningThread; // 10 - HANDLE lockSemaphore; // 18 - std::uintptr_t spinCount; // 20 - }; - static_assert(sizeof(CRITICAL_SECTION) == 0x28); - - struct SECURITY_ATTRIBUTES - { - std::uint32_t length; // 00 - void* securityDescriptor; // 04 - BOOL inheritHandle; // 0C - }; - static_assert(sizeof(SECURITY_ATTRIBUTES) == 0x18); - - union LARGE_INTEGER - { - struct - { - std::uint32_t lo; - std::int32_t hi; - }; - std::int64_t value; - }; - static_assert(sizeof(LARGE_INTEGER) == 0x8); - - union ULARGE_INTEGER - { - struct - { - std::uint32_t lo; - std::uint32_t hi; - }; - std::uint64_t value; - }; - static_assert(sizeof(ULARGE_INTEGER) == 0x8); - - struct UNICODE_STRING - { - std::uint16_t length; - std::uint16_t maxLength; - wchar_t* buffer; - }; - static_assert(sizeof(UNICODE_STRING) == 0x10); -} - -namespace REX::W32 -{ - constexpr bool SUCCESS(const HRESULT a_result) - { - return a_result >= 0; - } - - constexpr bool NT_SUCCESS(const NTSTATUS a_status) - { - return a_status >= 0; - } -} diff --git a/include/REX/W32/BCRYPT.h b/include/REX/W32/BCRYPT.h deleted file mode 100644 index 7cb3d9337..000000000 --- a/include/REX/W32/BCRYPT.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - using BCRYPT_HANDLE = void*; - using BCRYPT_ALG_HANDLE = void*; - using BCRYPT_KEY_HANDLE = void*; - using BCRYPT_HASH_HANDLE = void*; - using BCRYPT_SECRET_HANDLE = void*; - - // algorithms - inline constexpr auto BCRYPT_RSA_ALGORITHM{ L"RSA" }; - inline constexpr auto BCRYPT_RSA_SIGN_ALGORITHM{ L"RSA_SIGN" }; - inline constexpr auto BCRYPT_DH_ALGORITHM{ L"DH" }; - inline constexpr auto BCRYPT_DSA_ALGORITHM{ L"DSA" }; - inline constexpr auto BCRYPT_RC2_ALGORITHM{ L"RC2" }; - inline constexpr auto BCRYPT_RC4_ALGORITHM{ L"RC4" }; - inline constexpr auto BCRYPT_AES_ALGORITHM{ L"AES" }; - inline constexpr auto BCRYPT_DES_ALGORITHM{ L"DES" }; - inline constexpr auto BCRYPT_DESX_ALGORITHM{ L"DESX" }; - inline constexpr auto BCRYPT_3DES_ALGORITHM{ L"3DES" }; - inline constexpr auto BCRYPT_3DES_112_ALGORITHM{ L"3DES_112" }; - inline constexpr auto BCRYPT_MD2_ALGORITHM{ L"MD2" }; - inline constexpr auto BCRYPT_MD4_ALGORITHM{ L"MD4" }; - inline constexpr auto BCRYPT_MD5_ALGORITHM{ L"MD5" }; - inline constexpr auto BCRYPT_SHA1_ALGORITHM{ L"SHA1" }; - inline constexpr auto BCRYPT_SHA256_ALGORITHM{ L"SHA256" }; - inline constexpr auto BCRYPT_SHA384_ALGORITHM{ L"SHA384" }; - inline constexpr auto BCRYPT_SHA512_ALGORITHM{ L"SHA512" }; - inline constexpr auto BCRYPT_AES_GMAC_ALGORITHM{ L"AES-GMAC" }; - inline constexpr auto BCRYPT_AES_CMAC_ALGORITHM{ L"AES-CMAC" }; - inline constexpr auto BCRYPT_ECDSA_P256_ALGORITHM{ L"ECDSA_P256" }; - inline constexpr auto BCRYPT_ECDSA_P384_ALGORITHM{ L"ECDSA_P384" }; - inline constexpr auto BCRYPT_ECDSA_P521_ALGORITHM{ L"ECDSA_P521" }; - inline constexpr auto BCRYPT_ECDH_P256_ALGORITHM{ L"ECDH_P256" }; - inline constexpr auto BCRYPT_ECDH_P384_ALGORITHM{ L"ECDH_P384" }; - inline constexpr auto BCRYPT_ECDH_P521_ALGORITHM{ L"ECDH_P521" }; - inline constexpr auto BCRYPT_RNG_ALGORITHM{ L"RNG" }; - inline constexpr auto BCRYPT_RNG_FIPS186_DSA_ALGORITHM{ L"FIPS186DSARNG" }; - inline constexpr auto BCRYPT_RNG_DUAL_EC_ALGORITHM{ L"DUALECRNG" }; - - // properties - inline constexpr auto BCRYPT_OBJECT_LENGTH{ L"ObjectLength" }; - inline constexpr auto BCRYPT_ALGORITHM_NAME{ L"AlgorithmName" }; - inline constexpr auto BCRYPT_PROVIDER_HANDLE{ L"ProviderHandle" }; - inline constexpr auto BCRYPT_CHAINING_MODE{ L"ChainingMode" }; - inline constexpr auto BCRYPT_BLOCK_LENGTH{ L"BlockLength" }; - inline constexpr auto BCRYPT_KEY_LENGTH{ L"KeyLength" }; - inline constexpr auto BCRYPT_KEY_OBJECT_LENGTH{ L"KeyObjectLength" }; - inline constexpr auto BCRYPT_KEY_STRENGTH{ L"KeyStrength" }; - inline constexpr auto BCRYPT_KEY_LENGTHS{ L"KeyLengths" }; - inline constexpr auto BCRYPT_BLOCK_SIZE_LIST{ L"BlockSizeList" }; - inline constexpr auto BCRYPT_EFFECTIVE_KEY_LENGTH{ L"EffectiveKeyLength" }; - inline constexpr auto BCRYPT_HASH_LENGTH{ L"HashDigestLength" }; - inline constexpr auto BCRYPT_HASH_OID_LIST{ L"HashOIDList" }; - inline constexpr auto BCRYPT_PADDING_SCHEMES{ L"PaddingSchemes" }; - inline constexpr auto BCRYPT_SIGNATURE_LENGTH{ L"SignatureLength" }; - inline constexpr auto BCRYPT_HASH_BLOCK_LENGTH{ L"HashBlockLength" }; - inline constexpr auto BCRYPT_AUTH_TAG_LENGTH{ L"AuthTagLength" }; -} - -namespace REX::W32 -{ - NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl = nullptr, std::uint32_t a_flags = 0); - NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags = 0); - NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject = nullptr, std::uint32_t a_hashObjectSize = 0, std::uint8_t* a_secret = nullptr, std::uint32_t a_secretSize = 0, std::uint32_t a_flags = 0); - NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash); - NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags = 0); - NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags = 0); - NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags = 0); -} diff --git a/include/REX/W32/COM.h b/include/REX/W32/COM.h deleted file mode 100644 index e5a74c47b..000000000 --- a/include/REX/W32/COM.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("00000000-0000-0000-c000-000000000046")) - IUnknown - { - virtual HRESULT QueryInterface(const IID& a_iid, void** a_object) = 0; - virtual std::uint32_t AddRef() = 0; - virtual std::uint32_t Release() = 0; - - template - HRESULT QueryInterface(T** a_object) - { - return QueryInterface(*reinterpret_cast(&__uuidof(T)), static_cast(a_object)); - } - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IUnknown{ 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; -} diff --git a/include/REX/W32/COMPTR.h b/include/REX/W32/COMPTR.h deleted file mode 100644 index 6453de44e..000000000 --- a/include/REX/W32/COMPTR.h +++ /dev/null @@ -1,196 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - // based on Microsoft::WRL::ComPtr - template - struct ComPtr - { - constexpr ComPtr() noexcept = default; - constexpr ComPtr(std::nullptr_t) noexcept {} - - ComPtr(const ComPtr& a_other) noexcept : - _ptr(a_other._ptr) - { - TryAddRef(); - } - - template - ComPtr(U* a_other) noexcept : - _ptr(a_other) - { - TryAddRef(); - } - - ~ComPtr() noexcept - { - TryRelease(); - } - - ComPtr& operator=(std::nullptr_t) noexcept - { - TryRelease(); - return *this; - } - - ComPtr& operator=(T* a_other) noexcept - { - if (_ptr != a_other) - ComPtr(a_other).Swap(*this); - - return *this; - } - - template - ComPtr& operator=(U* a_other) noexcept - { - ComPtr(a_other).Swap(*this); - return *this; - } - - ComPtr& operator=(const ComPtr& a_other) noexcept - { - if (_ptr != a_other._ptr) - ComPtr(a_other).Swap(*this); - - return *this; - } - - template - ComPtr& operator=(const ComPtr& a_other) noexcept - { - ComPtr(a_other).Swap(*this); - return *this; - } - - ComPtr& operator=(ComPtr&& a_other) noexcept - { - ComPtr(static_cast(a_other)).Swap(*this); - return *this; - } - - template - ComPtr& operator=(ComPtr&& a_other) noexcept - { - ComPtr(static_cast&&>(a_other)).Swap(*this); - return *this; - } - - T* operator->() const noexcept - { - return _ptr; - } - - void Attach(T* a_other) noexcept - { - if (_ptr != nullptr) { - [[maybe_unused]] auto ref = _ptr->Release(); - assert((ref != 0) || (_ptr != a_other)); - } - - _ptr = a_other; - } - - T* Detach() noexcept - { - T* ptr = _ptr; - _ptr = nullptr; - return ptr; - } - - T* Get() const noexcept - { - return _ptr; - } - - T** GetAddressOf() noexcept - { - return &_ptr; - } - - T* const* GetAddressOf() const noexcept - { - return &_ptr; - } - - T** ReleaseAndGetAddressOf() noexcept - { - TryRelease(); - return &_ptr; - } - - std::uint32_t Reset() noexcept - { - return TryRelease(); - } - - void Swap(ComPtr& a_other) noexcept - { - T* ptr = _ptr; - _ptr = a_other._ptr; - a_other._ptr = ptr; - } - - void Swap(ComPtr&& a_other) noexcept - { - T* ptr = _ptr; - _ptr = a_other._ptr; - a_other._ptr = ptr; - } - - template - HRESULT As(ComPtr* a_ptr) const noexcept - { - return _ptr->QueryInterface(__uuidof(U), reinterpret_cast(a_ptr->ReleaseAndGetAddressOf())); - } - - template - HRESULT AsIID(const IID& a_iid, ComPtr* a_ptr) const noexcept - { - return _ptr->QueryInterface(a_iid, reinterpret_cast(a_ptr->ReleaseAndGetAddressOf())); - } - - HRESULT CopyTo(const IID& a_iid, void** a_ptr) const noexcept - { - return _ptr->QueryInterface(a_iid, a_ptr); - } - - HRESULT CopyTo(T** a_ptr) const noexcept - { - TryAddRef(); - *a_ptr = _ptr; - return 0; - } - - template - HRESULT CopyTo(U** a_ptr) const noexcept - { - return _ptr->QueryInterface(__uuidof(U), reinterpret_cast(a_ptr)); - } - - protected: - template - friend struct ComPtr; - - void TryAddRef() const noexcept - { - if (_ptr) - _ptr->AddRef(); - } - - std::uint32_t TryRelease() noexcept - { - T* ptr = _ptr; - if (ptr) { - _ptr = nullptr; - return ptr->Release(); - } - - return 0; - } - - T* _ptr{ nullptr }; - }; -} diff --git a/include/REX/W32/D3D.h b/include/REX/W32/D3D.h deleted file mode 100644 index 03a353c51..000000000 --- a/include/REX/W32/D3D.h +++ /dev/null @@ -1,736 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI.h" - -namespace REX::W32 -{ - struct ID3DBlob; - struct ID3DDestructionNotifier; - struct ID3DInclude; -} - -namespace REX::W32 -{ - enum D3D_CBUFFER_TYPE - { - D3D_CT_CBUFFER = 0, - D3D_CT_TBUFFER = (D3D_CT_CBUFFER + 1), - D3D_CT_INTERFACE_POINTERS = (D3D_CT_TBUFFER + 1), - D3D_CT_RESOURCE_BIND_INFO = (D3D_CT_INTERFACE_POINTERS + 1), - D3D10_CT_CBUFFER = D3D_CT_CBUFFER, - D3D10_CT_TBUFFER = D3D_CT_TBUFFER, - D3D11_CT_CBUFFER = D3D_CT_CBUFFER, - D3D11_CT_TBUFFER = D3D_CT_TBUFFER, - D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS, - D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO, - }; - - enum D3D_DRIVER_TYPE - { - D3D_DRIVER_TYPE_UNKNOWN = 0, - D3D_DRIVER_TYPE_HARDWARE = (D3D_DRIVER_TYPE_UNKNOWN + 1), - D3D_DRIVER_TYPE_REFERENCE = (D3D_DRIVER_TYPE_HARDWARE + 1), - D3D_DRIVER_TYPE_NULL = (D3D_DRIVER_TYPE_REFERENCE + 1), - D3D_DRIVER_TYPE_SOFTWARE = (D3D_DRIVER_TYPE_NULL + 1), - D3D_DRIVER_TYPE_WARP = (D3D_DRIVER_TYPE_SOFTWARE + 1), - }; - - enum D3D_FEATURE_LEVEL - { - D3D_FEATURE_LEVEL_1_0_CORE = 0x1000, - D3D_FEATURE_LEVEL_9_1 = 0x9100, - D3D_FEATURE_LEVEL_9_2 = 0x9200, - D3D_FEATURE_LEVEL_9_3 = 0x9300, - D3D_FEATURE_LEVEL_10_0 = 0xA000, - D3D_FEATURE_LEVEL_10_1 = 0xA100, - D3D_FEATURE_LEVEL_11_0 = 0xB000, - D3D_FEATURE_LEVEL_11_1 = 0xB100, - D3D_FEATURE_LEVEL_12_0 = 0xC000, - D3D_FEATURE_LEVEL_12_1 = 0xC100, - D3D_FEATURE_LEVEL_12_2 = 0xC200, - }; - - enum D3D_INCLUDE_TYPE - { - D3D_INCLUDE_LOCAL = 0, - D3D_INCLUDE_SYSTEM = (D3D_INCLUDE_LOCAL + 1), - D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL, - D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM, - D3D_INCLUDE_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_INTERPOLATION_MODE - { - D3D_INTERPOLATION_UNDEFINED = 0, - D3D_INTERPOLATION_CONSTANT = 1, - D3D_INTERPOLATION_LINEAR = 2, - D3D_INTERPOLATION_LINEAR_CENTROID = 3, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5, - D3D_INTERPOLATION_LINEAR_SAMPLE = 6, - D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, - }; - - enum D3D_MIN_PRECISION - { - D3D_MIN_PRECISION_DEFAULT = 0, - D3D_MIN_PRECISION_FLOAT_16 = 1, - D3D_MIN_PRECISION_FLOAT_2_8 = 2, - D3D_MIN_PRECISION_RESERVED = 3, - D3D_MIN_PRECISION_SINT_16 = 4, - D3D_MIN_PRECISION_UINT_16 = 5, - D3D_MIN_PRECISION_ANY_16 = 0xF0, - D3D_MIN_PRECISION_ANY_10 = 0xF1, - }; - - enum D3D_NAME - { - D3D_NAME_UNDEFINED = 0, - D3D_NAME_POSITION = 1, - D3D_NAME_CLIP_DISTANCE = 2, - D3D_NAME_CULL_DISTANCE = 3, - D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, - D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, - D3D_NAME_VERTEX_ID = 6, - D3D_NAME_PRIMITIVE_ID = 7, - D3D_NAME_INSTANCE_ID = 8, - D3D_NAME_IS_FRONT_FACE = 9, - D3D_NAME_SAMPLE_INDEX = 10, - D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, - D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, - D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, - D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, - D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, - D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, - D3D_NAME_BARYCENTRICS = 23, - D3D_NAME_SHADINGRATE = 24, - D3D_NAME_CULLPRIMITIVE = 25, - D3D_NAME_TARGET = 64, - D3D_NAME_DEPTH = 65, - D3D_NAME_COVERAGE = 66, - D3D_NAME_DEPTH_GREATER_EQUAL = 67, - D3D_NAME_DEPTH_LESS_EQUAL = 68, - D3D_NAME_STENCIL_REF = 69, - D3D_NAME_INNER_COVERAGE = 70, - D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED, - D3D10_NAME_POSITION = D3D_NAME_POSITION, - D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE, - D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE, - D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX, - D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX, - D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID, - D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID, - D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID, - D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE, - D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX, - D3D10_NAME_TARGET = D3D_NAME_TARGET, - D3D10_NAME_DEPTH = D3D_NAME_DEPTH, - D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE, - D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR, - D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, - D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR, - D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR, - D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR, - D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR, - D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL, - D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL, - D3D11_NAME_STENCIL_REF = D3D_NAME_STENCIL_REF, - D3D11_NAME_INNER_COVERAGE = D3D_NAME_INNER_COVERAGE, - D3D12_NAME_BARYCENTRICS = D3D_NAME_BARYCENTRICS, - D3D12_NAME_SHADINGRATE = D3D_NAME_SHADINGRATE, - D3D12_NAME_CULLPRIMITIVE = D3D_NAME_CULLPRIMITIVE, - }; - - enum D3D_PARAMETER_FLAGS - { - D3D_PF_NONE = 0, - D3D_PF_IN = 0x1, - D3D_PF_OUT = 0x2, - D3D_PF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_PRIMITIVE - { - D3D_PRIMITIVE_UNDEFINED = 0, - D3D_PRIMITIVE_POINT = 1, - D3D_PRIMITIVE_LINE = 2, - D3D_PRIMITIVE_TRIANGLE = 3, - D3D_PRIMITIVE_LINE_ADJ = 6, - D3D_PRIMITIVE_TRIANGLE_ADJ = 7, - D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, - D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, - D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, - D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, - D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, - D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, - D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, - D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, - D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, - D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, - D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, - D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, - D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, - D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, - D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, - D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, - D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, - D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, - D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, - D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 27, - D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 28, - D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 29, - D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 30, - D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 31, - D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 32, - D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 33, - D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 34, - D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 35, - D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 36, - D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 37, - D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 38, - D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 39, - D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED, - D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT, - D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE, - D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE, - D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ, - D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ, - D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED, - D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT, - D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE, - D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE, - D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ, - D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ, - D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH, - D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH, - }; - - enum D3D_PRIMITIVE_TOPOLOGY - { - D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, - D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, - D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2, - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, - D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, - D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, - D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34, - D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35, - D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36, - D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37, - D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38, - D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39, - D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40, - D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41, - D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42, - D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43, - D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44, - D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45, - D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46, - D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47, - D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48, - D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49, - D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50, - D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51, - D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52, - D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53, - D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54, - D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55, - D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56, - D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57, - D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58, - D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59, - D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60, - D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61, - D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62, - D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63, - D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64, - D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, - D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST, - D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST, - D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, - D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, - D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, - D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST, - D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST, - D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, - D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, - D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, - D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST, - }; - - enum D3D_REGISTER_COMPONENT_TYPE - { - D3D_REGISTER_COMPONENT_UNKNOWN = 0, - D3D_REGISTER_COMPONENT_UINT32 = 1, - D3D_REGISTER_COMPONENT_SINT32 = 2, - D3D_REGISTER_COMPONENT_FLOAT32 = 3, - D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN, - D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32, - D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32, - D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32, - }; - - enum D3D_RESOURCE_RETURN_TYPE - { - D3D_RETURN_TYPE_UNORM = 1, - D3D_RETURN_TYPE_SNORM = 2, - D3D_RETURN_TYPE_SINT = 3, - D3D_RETURN_TYPE_UINT = 4, - D3D_RETURN_TYPE_FLOAT = 5, - D3D_RETURN_TYPE_MIXED = 6, - D3D_RETURN_TYPE_DOUBLE = 7, - D3D_RETURN_TYPE_CONTINUED = 8, - D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM, - D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM, - D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT, - D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT, - D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT, - D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED, - D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM, - D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM, - D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT, - D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT, - D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT, - D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED, - D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE, - D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED, - }; - - enum D3D_SHADER_CBUFFER_FLAGS - { - D3D_CBF_USERPACKED = 1, - D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED, - D3D_CBF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_INPUT_FLAGS - { - D3D_SIF_USERPACKED = 0x1, - D3D_SIF_COMPARISON_SAMPLER = 0x2, - D3D_SIF_TEXTURE_COMPONENT_0 = 0x4, - D3D_SIF_TEXTURE_COMPONENT_1 = 0x8, - D3D_SIF_TEXTURE_COMPONENTS = 0xc, - D3D_SIF_UNUSED = 0x10, - D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED, - D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER, - D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0, - D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1, - D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS, - D3D_SIF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_INPUT_TYPE - { - D3D_SIT_CBUFFER = 0, - D3D_SIT_TBUFFER = (D3D_SIT_CBUFFER + 1), - D3D_SIT_TEXTURE = (D3D_SIT_TBUFFER + 1), - D3D_SIT_SAMPLER = (D3D_SIT_TEXTURE + 1), - D3D_SIT_UAV_RWTYPED = (D3D_SIT_SAMPLER + 1), - D3D_SIT_STRUCTURED = (D3D_SIT_UAV_RWTYPED + 1), - D3D_SIT_UAV_RWSTRUCTURED = (D3D_SIT_STRUCTURED + 1), - D3D_SIT_BYTEADDRESS = (D3D_SIT_UAV_RWSTRUCTURED + 1), - D3D_SIT_UAV_RWBYTEADDRESS = (D3D_SIT_BYTEADDRESS + 1), - D3D_SIT_UAV_APPEND_STRUCTURED = (D3D_SIT_UAV_RWBYTEADDRESS + 1), - D3D_SIT_UAV_CONSUME_STRUCTURED = (D3D_SIT_UAV_APPEND_STRUCTURED + 1), - D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = (D3D_SIT_UAV_CONSUME_STRUCTURED + 1), - D3D_SIT_RTACCELERATIONSTRUCTURE = (D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER + 1), - D3D_SIT_UAV_FEEDBACKTEXTURE = (D3D_SIT_RTACCELERATIONSTRUCTURE + 1), - D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER, - D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER, - D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE, - D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER, - D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED, - D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED, - D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED, - D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS, - D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS, - D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED, - D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED, - D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER, - }; - - enum D3D_SHADER_VARIABLE_CLASS - { - D3D_SVC_SCALAR = 0, - D3D_SVC_VECTOR = (D3D_SVC_SCALAR + 1), - D3D_SVC_MATRIX_ROWS = (D3D_SVC_VECTOR + 1), - D3D_SVC_MATRIX_COLUMNS = (D3D_SVC_MATRIX_ROWS + 1), - D3D_SVC_OBJECT = (D3D_SVC_MATRIX_COLUMNS + 1), - D3D_SVC_STRUCT = (D3D_SVC_OBJECT + 1), - D3D_SVC_INTERFACE_CLASS = (D3D_SVC_STRUCT + 1), - D3D_SVC_INTERFACE_POINTER = (D3D_SVC_INTERFACE_CLASS + 1), - D3D10_SVC_SCALAR = D3D_SVC_SCALAR, - D3D10_SVC_VECTOR = D3D_SVC_VECTOR, - D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS, - D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS, - D3D10_SVC_OBJECT = D3D_SVC_OBJECT, - D3D10_SVC_STRUCT = D3D_SVC_STRUCT, - D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS, - D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER, - D3D_SVC_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_VARIABLE_FLAGS - { - D3D_SVF_USERPACKED = 1, - D3D_SVF_USED = 2, - D3D_SVF_INTERFACE_POINTER = 4, - D3D_SVF_INTERFACE_PARAMETER = 8, - D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED, - D3D10_SVF_USED = D3D_SVF_USED, - D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER, - D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER, - D3D_SVF_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SHADER_VARIABLE_TYPE - { - D3D_SVT_VOID = 0, - D3D_SVT_BOOL = 1, - D3D_SVT_INT = 2, - D3D_SVT_FLOAT = 3, - D3D_SVT_STRING = 4, - D3D_SVT_TEXTURE = 5, - D3D_SVT_TEXTURE1D = 6, - D3D_SVT_TEXTURE2D = 7, - D3D_SVT_TEXTURE3D = 8, - D3D_SVT_TEXTURECUBE = 9, - D3D_SVT_SAMPLER = 10, - D3D_SVT_SAMPLER1D = 11, - D3D_SVT_SAMPLER2D = 12, - D3D_SVT_SAMPLER3D = 13, - D3D_SVT_SAMPLERCUBE = 14, - D3D_SVT_PIXELSHADER = 15, - D3D_SVT_VERTEXSHADER = 16, - D3D_SVT_PIXELFRAGMENT = 17, - D3D_SVT_VERTEXFRAGMENT = 18, - D3D_SVT_UINT = 19, - D3D_SVT_UINT8 = 20, - D3D_SVT_GEOMETRYSHADER = 21, - D3D_SVT_RASTERIZER = 22, - D3D_SVT_DEPTHSTENCIL = 23, - D3D_SVT_BLEND = 24, - D3D_SVT_BUFFER = 25, - D3D_SVT_CBUFFER = 26, - D3D_SVT_TBUFFER = 27, - D3D_SVT_TEXTURE1DARRAY = 28, - D3D_SVT_TEXTURE2DARRAY = 29, - D3D_SVT_RENDERTARGETVIEW = 30, - D3D_SVT_DEPTHSTENCILVIEW = 31, - D3D_SVT_TEXTURE2DMS = 32, - D3D_SVT_TEXTURE2DMSARRAY = 33, - D3D_SVT_TEXTURECUBEARRAY = 34, - D3D_SVT_HULLSHADER = 35, - D3D_SVT_DOMAINSHADER = 36, - D3D_SVT_INTERFACE_POINTER = 37, - D3D_SVT_COMPUTESHADER = 38, - D3D_SVT_DOUBLE = 39, - D3D_SVT_RWTEXTURE1D = 40, - D3D_SVT_RWTEXTURE1DARRAY = 41, - D3D_SVT_RWTEXTURE2D = 42, - D3D_SVT_RWTEXTURE2DARRAY = 43, - D3D_SVT_RWTEXTURE3D = 44, - D3D_SVT_RWBUFFER = 45, - D3D_SVT_BYTEADDRESS_BUFFER = 46, - D3D_SVT_RWBYTEADDRESS_BUFFER = 47, - D3D_SVT_STRUCTURED_BUFFER = 48, - D3D_SVT_RWSTRUCTURED_BUFFER = 49, - D3D_SVT_APPEND_STRUCTURED_BUFFER = 50, - D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51, - D3D_SVT_MIN8FLOAT = 52, - D3D_SVT_MIN10FLOAT = 53, - D3D_SVT_MIN16FLOAT = 54, - D3D_SVT_MIN12INT = 55, - D3D_SVT_MIN16INT = 56, - D3D_SVT_MIN16UINT = 57, - D3D_SVT_INT16 = 58, - D3D_SVT_UINT16 = 59, - D3D_SVT_FLOAT16 = 60, - D3D_SVT_INT64 = 61, - D3D_SVT_UINT64 = 62, - D3D10_SVT_VOID = D3D_SVT_VOID, - D3D10_SVT_BOOL = D3D_SVT_BOOL, - D3D10_SVT_INT = D3D_SVT_INT, - D3D10_SVT_FLOAT = D3D_SVT_FLOAT, - D3D10_SVT_STRING = D3D_SVT_STRING, - D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE, - D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D, - D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D, - D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D, - D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE, - D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER, - D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D, - D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D, - D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D, - D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE, - D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER, - D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER, - D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT, - D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT, - D3D10_SVT_UINT = D3D_SVT_UINT, - D3D10_SVT_UINT8 = D3D_SVT_UINT8, - D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER, - D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER, - D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL, - D3D10_SVT_BLEND = D3D_SVT_BLEND, - D3D10_SVT_BUFFER = D3D_SVT_BUFFER, - D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER, - D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER, - D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY, - D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY, - D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW, - D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW, - D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS, - D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY, - D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY, - D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER, - D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER, - D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER, - D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER, - D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE, - D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D, - D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY, - D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D, - D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY, - D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D, - D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER, - D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER, - D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER, - D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER, - D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER, - D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER, - D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER, - D3D_SVT_FORCE_DWORD = 0x7FFFFFFF, - }; - - enum D3D_SRV_DIMENSION - { - D3D_SRV_DIMENSION_UNKNOWN = 0, - D3D_SRV_DIMENSION_BUFFER = 1, - D3D_SRV_DIMENSION_TEXTURE1D = 2, - D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3, - D3D_SRV_DIMENSION_TEXTURE2D = 4, - D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5, - D3D_SRV_DIMENSION_TEXTURE2DMS = 6, - D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D_SRV_DIMENSION_TEXTURE3D = 8, - D3D_SRV_DIMENSION_TEXTURECUBE = 9, - D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10, - D3D_SRV_DIMENSION_BUFFEREX = 11, - D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, - D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, - D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, - D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, - D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, - D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, - D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, - D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, - D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, - D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, - D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, - D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, - D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, - D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, - D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, - D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, - D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, - D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, - D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, - D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, - D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY, - D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, - D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, - D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, - D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, - D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, - D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, - D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, - D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, - D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, - D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, - D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY, - D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX, - }; - - enum D3D_TESSELLATOR_DOMAIN - { - D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0, - D3D_TESSELLATOR_DOMAIN_ISOLINE = 1, - D3D_TESSELLATOR_DOMAIN_TRI = 2, - D3D_TESSELLATOR_DOMAIN_QUAD = 3, - D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED, - D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE, - D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI, - D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD, - }; - - enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE - { - D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0, - D3D_TESSELLATOR_OUTPUT_POINT = 1, - D3D_TESSELLATOR_OUTPUT_LINE = 2, - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3, - D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4, - D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED, - D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT, - D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE, - D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, - D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW, - }; - - enum D3D_TESSELLATOR_PARTITIONING - { - D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0, - D3D_TESSELLATOR_PARTITIONING_INTEGER = 1, - D3D_TESSELLATOR_PARTITIONING_POW2 = 2, - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3, - D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4, - D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED, - D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER, - D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2, - D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, - D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN, - }; -} - -namespace REX::W32 -{ - using D3DCOLOR = std::uint32_t; - - struct D3DRECT - { - std::int32_t x1; - std::int32_t y1; - std::int32_t x2; - std::int32_t y2; - }; - - struct D3DVECTOR - { - float x; - float y; - float z; - }; - - struct D3D_SHADER_MACRO - { - const char* name; - const char* definition; - }; - - struct XMFLOAT4X4 - { - float m[4][4]; - }; - static_assert(sizeof(XMFLOAT4X4) == 0x40); -} - -namespace REX::W32 -{ - using PFN_DESTRUCTION_CALLBACK = void(__stdcall*)(void* a_data); -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("8BA5FB08-5195-40e2-AC58-0D989C3A0102")) - ID3DBlob : public IUnknown - { - virtual void* GetBufferPointer(void) = 0; - virtual std::size_t GetBufferSize(void) = 0; - }; - - struct __declspec(novtable, uuid("A06EB39A-50DA-425B-8C31-4EECD6C270F3")) - ID3DDestructionNotifier : public IUnknown - { - virtual HRESULT RegisterDestructionCallback(PFN_DESTRUCTION_CALLBACK a_callbackFn, void* a_data, std::uint32_t* a_callbackID) = 0; - virtual HRESULT UnregisterDestructionCallback(std::uint32_t a_callbackID) = 0; - }; - - struct __declspec(novtable) // uuid(?) - ID3DInclude : public IUnknown - { - virtual HRESULT Open(D3D_INCLUDE_TYPE a_includeType, const char* a_fileName, const void* a_parentData, const void** a_data, std::uint32_t* a_bytes) = 0; - virtual HRESULT Close(const void* a_data) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3DBlob{ 0xA06EB39A, 0x50DA, 0x425B, { 0x8C, 0x31, 0x4E, 0xEC, 0xD6, 0xC2, 0x70, 0xF3 } }; - inline constexpr IID IID_ID3DDestructionNotifier{ 0xA06EB39A, 0x50DA, 0x425B, { 0x8C, 0x31, 0x4E, 0xEC, 0xD6, 0xC2, 0x70, 0xF3 } }; -} diff --git a/include/REX/W32/D3D11.h b/include/REX/W32/D3D11.h deleted file mode 100644 index c543fe0b3..000000000 --- a/include/REX/W32/D3D11.h +++ /dev/null @@ -1,2569 +0,0 @@ -#pragma once - -#include "REX/W32/D3D.h" - -namespace REX::W32 -{ - struct ID3D11Asynchronous; - struct ID3D11AuthenticatedChannel; - struct ID3D11BlendState; - struct ID3D11Buffer; - struct ID3D11ClassInstance; - struct ID3D11ClassLinkage; - struct ID3D11CommandList; - struct ID3D11ComputeShader; - struct ID3D11Counter; - struct ID3D11CryptoSession; - struct ID3D11Device; - struct ID3D11DeviceChild; - struct ID3D11DeviceContext; - struct ID3D11DepthStencilState; - struct ID3D11DepthStencilView; - struct ID3D11DomainShader; - struct ID3D11GeometryShader; - struct ID3D11HullShader; - struct ID3D11InputLayout; - struct ID3D11PixelShader; - struct ID3D11Predicate; - struct ID3D11Query; - struct ID3D11RasterizerState; - struct ID3D11RenderTargetView; - struct ID3D11Resource; - struct ID3D11SamplerState; - struct ID3D11ShaderResourceView; - struct ID3D11Texture1D; - struct ID3D11Texture2D; - struct ID3D11Texture3D; - struct ID3D11UnorderedAccessView; - struct ID3D11VertexShader; - struct ID3D11VideoContext; - struct ID3D11VideoDecoder; - struct ID3D11VideoDecoderOutputView; - struct ID3D11VideoDevice; - struct ID3D11VideoProcessor; - struct ID3D11VideoProcessorEnumerator; - struct ID3D11VideoProcessorInputView; - struct ID3D11VideoProcessorOutputView; - struct ID3D11View; -} - -namespace REX::W32 -{ - inline constexpr auto D3D11_16BIT_INDEX_STRIP_CUT_VALUE{ 0xffff }; - - inline constexpr auto D3D11_32BIT_INDEX_STRIP_CUT_VALUE{ 0xffffffff }; - - inline constexpr auto D3D11_8BIT_INDEX_STRIP_CUT_VALUE{ 0xff }; - - inline constexpr auto D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT{ 9 }; - - inline constexpr auto D3D11_CLIP_OR_CULL_DISTANCE_COUNT{ 8 }; - inline constexpr auto D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT{ 2 }; - - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT{ 14 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT{ 15 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT{ 16 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT{ 15 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT{ 64 }; - - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT{ 128 }; - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT{ 128 }; - - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT{ 16 }; - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT{ 16 }; - - inline constexpr auto D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT{ 32 }; - - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_COUNT{ 4096 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST{ 3 }; - inline constexpr auto D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS{ 3 }; - - inline constexpr auto D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX{ 10 }; - inline constexpr auto D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN{ -10 }; - - inline constexpr auto D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE{ -8 }; - inline constexpr auto D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE{ 7 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 256 }; - inline constexpr auto D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP{ 64 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 240 }; - inline constexpr auto D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP{ 68 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 224 }; - inline constexpr auto D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP{ 72 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 208 }; - inline constexpr auto D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP{ 76 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 192 }; - inline constexpr auto D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP{ 84 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 176 }; - inline constexpr auto D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP{ 92 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 160 }; - inline constexpr auto D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP{ 100 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 144 }; - inline constexpr auto D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP{ 112 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 128 }; - inline constexpr auto D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP{ 128 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 112 }; - inline constexpr auto D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP{ 144 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 96 }; - inline constexpr auto D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP{ 168 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 80 }; - inline constexpr auto D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP{ 204 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 64 }; - inline constexpr auto D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP{ 256 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 48 }; - inline constexpr auto D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP{ 340 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 32 }; - inline constexpr auto D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP{ 512 }; - - inline constexpr auto D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD{ 16 }; - inline constexpr auto D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP{ 768 }; - - inline constexpr auto D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION{ 1 }; - - inline constexpr auto D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT{ 256 }; - - inline constexpr auto D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP{ 768 }; - inline constexpr auto D3D11_CS_4_X_THREAD_GROUP_MAX_X{ 768 }; - inline constexpr auto D3D11_CS_4_X_THREAD_GROUP_MAX_Y{ 768 }; - - inline constexpr auto D3D11_CS_4_X_UAV_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION{ 65535 }; - - inline constexpr auto D3D11_CS_TGSM_REGISTER_COUNT{ 8192 }; - inline constexpr auto D3D11_CS_TGSM_REGISTER_READS_PER_INST{ 1 }; - - inline constexpr auto D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_CS_THREADGROUPID_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_CS_THREADGROUPID_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREADIDINGROUP_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_CS_THREADIDINGROUP_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREADID_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_CS_THREADID_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP{ 1024 }; - - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_X{ 1024 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_Y{ 1024 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MAX_Z{ 64 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MIN_X{ 1 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MIN_Y{ 1 }; - inline constexpr auto D3D11_CS_THREAD_GROUP_MIN_Z{ 1 }; - - inline constexpr auto D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL{ 16384 }; - - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_ALPHA{ 1.0f }; - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_BLUE{ 1.0f }; - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_GREEN{ 1.0f }; - inline constexpr auto D3D11_DEFAULT_BLEND_FACTOR_RED{ 1.0f }; - - inline constexpr auto D3D11_DEFAULT_BORDER_COLOR_COMPONENT{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_DEPTH_BIAS{ 0 }; - inline constexpr auto D3D11_DEFAULT_DEPTH_BIAS_CLAMP{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_MAX_ANISOTROPY{ 16 }; - - inline constexpr auto D3D11_DEFAULT_MIP_LOD_BIAS{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX{ 0 }; - - inline constexpr auto D3D11_DEFAULT_SAMPLE_MASK{ 0xffffffff }; - - inline constexpr auto D3D11_DEFAULT_SCISSOR_ENDX{ 0 }; - inline constexpr auto D3D11_DEFAULT_SCISSOR_ENDY{ 0 }; - inline constexpr auto D3D11_DEFAULT_SCISSOR_STARTX{ 0 }; - inline constexpr auto D3D11_DEFAULT_SCISSOR_STARTY{ 0 }; - - inline constexpr auto D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS{ 0.0f }; - - inline constexpr auto D3D11_DEFAULT_STENCIL_READ_MASK{ 0xff }; - inline constexpr auto D3D11_DEFAULT_STENCIL_REFERENCE{ 0 }; - inline constexpr auto D3D11_DEFAULT_STENCIL_WRITE_MASK{ 0xff }; - - inline constexpr auto D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_HEIGHT{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_MAX_DEPTH{ 0.0f }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_MIN_DEPTH{ 0.0f }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_TOPLEFTX{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_TOPLEFTY{ 0 }; - inline constexpr auto D3D11_DEFAULT_VIEWPORT_WIDTH{ 0 }; - - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS{ 3968 }; - - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS{ 3 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_DS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_DS_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP{ 0.6 }; - - inline constexpr auto D3D11_FLOAT32_MAX{ 3.402823466e+38f }; - inline constexpr auto D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP{ 0.6f }; - - inline constexpr auto D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR{ 2.4f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR{ 1.0f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_OFFSET{ 0.055f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_SCALE_1{ 12.92f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_SCALE_2{ 1.055f }; - inline constexpr auto D3D11_FLOAT_TO_SRGB_THRESHOLD{ 0.0031308f }; - - inline constexpr auto D3D11_FTOI_INSTRUCTION_MAX_INPUT{ 2147483647.999f }; - inline constexpr auto D3D11_FTOI_INSTRUCTION_MIN_INPUT{ -2147483648.999f }; - - inline constexpr auto D3D11_FTOU_INSTRUCTION_MAX_INPUT{ 4294967295.999f }; - inline constexpr auto D3D11_FTOU_INSTRUCTION_MIN_INPUT{ 0.0f }; - - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT{ 1 }; - - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_GS_INPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_READ_PORTS{ 1 }; - inline constexpr auto D3D11_GS_INPUT_REGISTER_VERTICES{ 32 }; - - inline constexpr auto D3D11_GS_MAX_INSTANCE_COUNT{ 32 }; - - inline constexpr auto D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES{ 1024 }; - - inline constexpr auto D3D11_GS_OUTPUT_ELEMENTS{ 32 }; - - inline constexpr auto D3D11_GS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_GS_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND{ 0xffffffff }; - - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND{ 0xffffffff }; - - inline constexpr auto D3D11_HS_MAXTESSFACTOR_LOWER_BOUND{ 1.0f }; - inline constexpr auto D3D11_HS_MAXTESSFACTOR_UPPER_BOUND{ 64.0f }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS{ 3968 }; - - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS{ 1 }; - inline constexpr auto D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS{ 128 }; - - inline constexpr auto D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES{ 0 }; - - inline constexpr auto D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY{ 0 }; - - inline constexpr auto D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES{ 0 }; - - inline constexpr auto D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT{ 1 }; - - inline constexpr auto D3D11_IA_INSTANCE_ID_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_PRIMITIVE_ID_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_VERTEX_ID_BIT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT{ 32 }; - - inline constexpr auto D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS{ 128 }; - inline constexpr auto D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT{ 32 }; - - inline constexpr auto D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT{ 0xffffffff }; - inline constexpr auto D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER{ 0xffffffff }; - - inline constexpr auto D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL{ 0xffffffff }; - - inline constexpr auto D3D11_KEEP_UNORDERED_ACCESS_VIEWS{ 0xffffffff }; - - inline constexpr auto D3D11_LINEAR_GAMMA{ 1.0f }; - - inline constexpr auto D3D11_MAJOR_VERSION{ 11 }; - - inline constexpr auto D3D11_MAX_BORDER_COLOR_COMPONENT{ 1.0f }; - inline constexpr auto D3D11_MAX_DEPTH{ 1.0f }; - inline constexpr auto D3D11_MAX_MAXANISOTROPY{ 16 }; - inline constexpr auto D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT{ 32 }; - inline constexpr auto D3D11_MAX_POSITION_VALUE{ 3.402823466e+34f }; - inline constexpr auto D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP{ 17 }; - - inline constexpr auto D3D11_MINOR_VERSION{ 0 }; - - inline constexpr auto D3D11_MIN_BORDER_COLOR_COMPONENT{ 0.0f }; - inline constexpr auto D3D11_MIN_DEPTH{ 0.0f }; - inline constexpr auto D3D11_MIN_MAXANISOTROPY{ 0 }; - - inline constexpr auto D3D11_MIP_LOD_BIAS_MAX{ 15.99f }; - inline constexpr auto D3D11_MIP_LOD_BIAS_MIN{ -16.0f }; - inline constexpr auto D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT{ 8 }; - - inline constexpr auto D3D11_MIP_LOD_RANGE_BIT_COUNT{ 8 }; - - inline constexpr auto D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH{ 1.4f }; - inline constexpr auto D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT{ 0 }; - - inline constexpr auto D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT{ 15 }; - - inline constexpr auto D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT{ 16 }; - - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_COUNT{ 8 }; - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_READS_PER_INST{ 1 }; - inline constexpr auto D3D11_PS_CS_UAV_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_PS_FRONTFACING_DEFAULT_VALUE{ 0xffffffff }; - inline constexpr auto D3D11_PS_FRONTFACING_FALSE_VALUE{ 0 }; - inline constexpr auto D3D11_PS_FRONTFACING_TRUE_VALUE{ 0xffffffff }; - - inline constexpr auto D3D11_PS_INPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_PS_INPUT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT{ 0.0f }; - - inline constexpr auto D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_OUTPUT_MASK_REGISTER_COUNT{ 1 }; - inline constexpr auto D3D11_PS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_PS_OUTPUT_REGISTER_COUNT{ 8 }; - - inline constexpr auto D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT{ 0.5f }; - inline constexpr auto D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT{ 16 }; - - inline constexpr auto D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP{ 27 }; - - inline constexpr auto D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT{ 4096 }; - - inline constexpr auto D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP{ 32 }; - - inline constexpr auto D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP{ 32 }; - - inline constexpr auto D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION{ 16384 }; - - inline constexpr auto D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT{ 1024 }; - - inline constexpr auto D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT{ 4096 }; - - inline constexpr auto D3D11_REQ_MAXANISOTROPY{ 16 }; - - inline constexpr auto D3D11_REQ_MIP_LEVELS{ 15 }; - - inline constexpr auto D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES{ 2048 }; - - inline constexpr auto D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH{ 16384 }; - - inline constexpr auto D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM{ 128 }; - inline constexpr auto D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM{ 0.25f }; - inline constexpr auto D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM{ 2048 }; - - inline constexpr auto D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP{ 20 }; - - inline constexpr auto D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE{ 4096 }; - - inline constexpr auto D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION{ 2048 }; - inline constexpr auto D3D11_REQ_TEXTURE1D_U_DIMENSION{ 16384 }; - inline constexpr auto D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION{ 2048 }; - inline constexpr auto D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION{ 16384 }; - inline constexpr auto D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION{ 2048 }; - - inline constexpr auto D3D11_REQ_TEXTURECUBE_DIMENSION{ 16384 }; - - inline constexpr auto D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL{ 0 }; - - inline constexpr auto D3D11_SHADER_MAJOR_VERSION{ 5 }; - - inline constexpr auto D3D11_SHADER_MAX_INSTANCES{ 65535 }; - inline constexpr auto D3D11_SHADER_MAX_INTERFACES{ 253 }; - inline constexpr auto D3D11_SHADER_MAX_INTERFACE_CALL_SITES{ 4096 }; - inline constexpr auto D3D11_SHADER_MAX_TYPES{ 65535 }; - - inline constexpr auto D3D11_SHADER_MINOR_VERSION{ 0 }; - - inline constexpr auto D3D11_SHIFT_INSTRUCTION_PAD_VALUE{ 0 }; - inline constexpr auto D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT{ 5 }; - - inline constexpr auto D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT{ 8 }; - - inline constexpr auto D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES{ 2048 }; - inline constexpr auto D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES{ 512 }; - inline constexpr auto D3D11_SO_BUFFER_SLOT_COUNT{ 4 }; - inline constexpr auto D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP{ 0xffffffff }; - inline constexpr auto D3D11_SO_NO_RASTERIZED_STREAM{ 0xffffffff }; - inline constexpr auto D3D11_SO_OUTPUT_COMPONENT_COUNT{ 128 }; - inline constexpr auto D3D11_SO_STREAM_COUNT{ 4 }; - - inline constexpr auto D3D11_SPEC_DATE_DAY{ 16 }; - inline constexpr auto D3D11_SPEC_DATE_MONTH{ 05 }; - inline constexpr auto D3D11_SPEC_DATE_YEAR{ 2011 }; - inline constexpr auto D3D11_SPEC_VERSION{ 1.07 }; - - inline constexpr auto D3D11_SRGB_GAMMA{ 2.2f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_DENOMINATOR_1{ 12.92f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_DENOMINATOR_2{ 1.055f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_EXPONENT{ 2.4f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_OFFSET{ 0.055f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_THRESHOLD{ 0.04045f }; - inline constexpr auto D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP{ 0.5f }; - - inline constexpr auto D3D11_STANDARD_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED{ 64 }; - inline constexpr auto D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE{ 4 }; - inline constexpr auto D3D11_STANDARD_PIXEL_COMPONENT_COUNT{ 128 }; - inline constexpr auto D3D11_STANDARD_PIXEL_ELEMENT_COUNT{ 32 }; - inline constexpr auto D3D11_STANDARD_VECTOR_SIZE{ 4 }; - inline constexpr auto D3D11_STANDARD_VERTEX_ELEMENT_COUNT{ 32 }; - inline constexpr auto D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT{ 64 }; - - inline constexpr auto D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT{ 8 }; - inline constexpr auto D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT{ 8 }; - - inline constexpr auto D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR{ 64 }; - inline constexpr auto D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR{ 64 }; - inline constexpr auto D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR{ 63 }; - inline constexpr auto D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR{ 64 }; - inline constexpr auto D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR{ 2 }; - inline constexpr auto D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR{ 1 }; - inline constexpr auto D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR{ 1 }; - - inline constexpr auto D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT{ 16 }; - - inline constexpr auto D3D11_UNBOUND_MEMORY_ACCESS_RESULT{ 0 }; - - inline constexpr auto D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX{ 15 }; - inline constexpr auto D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE{ 16 }; - - inline constexpr auto D3D11_VIEWPORT_BOUNDS_MAX{ 32767 }; - inline constexpr auto D3D11_VIEWPORT_BOUNDS_MIN{ -32768 }; - - inline constexpr auto D3D11_VS_INPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_COUNT{ 32 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_READS_PER_INST{ 2 }; - inline constexpr auto D3D11_VS_INPUT_REGISTER_READ_PORTS{ 1 }; - - inline constexpr auto D3D11_VS_OUTPUT_REGISTER_COMPONENTS{ 4 }; - inline constexpr auto D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT{ 32 }; - inline constexpr auto D3D11_VS_OUTPUT_REGISTER_COUNT{ 32 }; - - inline constexpr auto D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT{ 10 }; - inline constexpr auto D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP{ 25 }; - inline constexpr auto D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP{ 25 }; -} - -namespace REX::W32 -{ - enum D3D11_ASYNC_GETDATA_FLAG - { - D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1, - }; - - enum D3D11_AUTHENTICATED_CHANNEL_TYPE - { - D3D11_AUTHENTICATED_CHANNEL_D3D11 = 1, - D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE = 2, - D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE = 3, - }; - - enum D3D11_BIND_FLAG - { - D3D11_BIND_VERTEX_BUFFER = 0x1L, - D3D11_BIND_INDEX_BUFFER = 0x2L, - D3D11_BIND_CONSTANT_BUFFER = 0x4L, - D3D11_BIND_SHADER_RESOURCE = 0x8L, - D3D11_BIND_STREAM_OUTPUT = 0x10L, - D3D11_BIND_RENDER_TARGET = 0x20L, - D3D11_BIND_DEPTH_STENCIL = 0x40L, - D3D11_BIND_UNORDERED_ACCESS = 0x80L, - D3D11_BIND_DECODER = 0x200L, - D3D11_BIND_VIDEO_ENCODER = 0x400L, - }; - - enum D3D11_BLEND - { - D3D11_BLEND_ZERO = 1, - D3D11_BLEND_ONE = 2, - D3D11_BLEND_SRC_COLOR = 3, - D3D11_BLEND_INV_SRC_COLOR = 4, - D3D11_BLEND_SRC_ALPHA = 5, - D3D11_BLEND_INV_SRC_ALPHA = 6, - D3D11_BLEND_DEST_ALPHA = 7, - D3D11_BLEND_INV_DEST_ALPHA = 8, - D3D11_BLEND_DEST_COLOR = 9, - D3D11_BLEND_INV_DEST_COLOR = 10, - D3D11_BLEND_SRC_ALPHA_SAT = 11, - D3D11_BLEND_BLEND_FACTOR = 14, - D3D11_BLEND_INV_BLEND_FACTOR = 15, - D3D11_BLEND_SRC1_COLOR = 16, - D3D11_BLEND_INV_SRC1_COLOR = 17, - D3D11_BLEND_SRC1_ALPHA = 18, - D3D11_BLEND_INV_SRC1_ALPHA = 19, - }; - - enum D3D11_BLEND_OP - { - D3D11_BLEND_OP_ADD = 1, - D3D11_BLEND_OP_SUBTRACT = 2, - D3D11_BLEND_OP_REV_SUBTRACT = 3, - D3D11_BLEND_OP_MIN = 4, - D3D11_BLEND_OP_MAX = 5, - }; - - enum D3D11_BUFFER_UAV_FLAG - { - D3D11_BUFFER_UAV_FLAG_RAW = 0x1, - D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, - D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4, - }; - - enum D3D11_BUFFEREX_SRV_FLAG - { - D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1, - }; - - enum D3D11_CLEAR_FLAG - { - D3D11_CLEAR_DEPTH = 0x1L, - D3D11_CLEAR_STENCIL = 0x2L, - }; - - enum D3D11_COLOR_WRITE_ENABLE - { - D3D11_COLOR_WRITE_ENABLE_RED = 1, - D3D11_COLOR_WRITE_ENABLE_GREEN = 2, - D3D11_COLOR_WRITE_ENABLE_BLUE = 4, - D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, - D3D11_COLOR_WRITE_ENABLE_ALL = (((D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN) | D3D11_COLOR_WRITE_ENABLE_BLUE) | D3D11_COLOR_WRITE_ENABLE_ALPHA), - }; - - enum D3D11_COMPARISON_FUNC - { - D3D11_COMPARISON_NEVER = 1, - D3D11_COMPARISON_LESS = 2, - D3D11_COMPARISON_EQUAL = 3, - D3D11_COMPARISON_LESS_EQUAL = 4, - D3D11_COMPARISON_GREATER = 5, - D3D11_COMPARISON_NOT_EQUAL = 6, - D3D11_COMPARISON_GREATER_EQUAL = 7, - D3D11_COMPARISON_ALWAYS = 8, - }; - - enum D3D11_CONTENT_PROTECTION_CAPS - { - D3D11_CONTENT_PROTECTION_CAPS_SOFTWARE = 0x1, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE = 0x2, - D3D11_CONTENT_PROTECTION_CAPS_PROTECTION_ALWAYS_ON = 0x4, - D3D11_CONTENT_PROTECTION_CAPS_PARTIAL_DECRYPTION = 0x8, - D3D11_CONTENT_PROTECTION_CAPS_CONTENT_KEY = 0x10, - D3D11_CONTENT_PROTECTION_CAPS_FRESHEN_SESSION_KEY = 0x20, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK = 0x40, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK_KEY = 0x80, - D3D11_CONTENT_PROTECTION_CAPS_SEQUENTIAL_CTR_IV = 0x100, - D3D11_CONTENT_PROTECTION_CAPS_ENCRYPT_SLICEDATA_ONLY = 0x200, - D3D11_CONTENT_PROTECTION_CAPS_DECRYPTION_BLT = 0x400, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECT_UNCOMPRESSED = 0x800, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECTED_MEMORY_PAGEABLE = 0x1000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_TEARDOWN = 0x2000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION = 0x4000, - D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION_MULTI_THREADED = 0x8000, - }; - - enum D3D11_COUNTER - { - D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 - }; - - enum D3D11_COUNTER_TYPE - { - D3D11_COUNTER_TYPE_FLOAT32 = 0, - D3D11_COUNTER_TYPE_UINT16 = (D3D11_COUNTER_TYPE_FLOAT32 + 1), - D3D11_COUNTER_TYPE_UINT32 = (D3D11_COUNTER_TYPE_UINT16 + 1), - D3D11_COUNTER_TYPE_UINT64 = (D3D11_COUNTER_TYPE_UINT32 + 1), - }; - - enum D3D11_CPU_ACCESS_FLAG - { - D3D11_CPU_ACCESS_WRITE = 0x10000L, - D3D11_CPU_ACCESS_READ = 0x20000L, - }; - - enum D3D11_CREATE_DEVICE_FLAG - { - D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1, - D3D11_CREATE_DEVICE_DEBUG = 0x2, - D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4, - D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, - D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20, - D3D11_CREATE_DEVICE_DEBUGGABLE = 0x40, - D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80, - D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = 0x100, - D3D11_CREATE_DEVICE_VIDEO_SUPPORT = 0x800, - }; - - enum D3D11_CULL_MODE - { - D3D11_CULL_NONE = 1, - D3D11_CULL_FRONT = 2, - D3D11_CULL_BACK = 3, - }; - - enum D3D11_DEPTH_WRITE_MASK - { - D3D11_DEPTH_WRITE_MASK_ZERO = 0, - D3D11_DEPTH_WRITE_MASK_ALL = 1, - }; - - enum D3D11_DEVICE_CONTEXT_TYPE - { - D3D11_DEVICE_CONTEXT_IMMEDIATE = 0, - D3D11_DEVICE_CONTEXT_DEFERRED = (D3D11_DEVICE_CONTEXT_IMMEDIATE + 1), - }; - - enum D3D11_DSV_DIMENSION - { - D3D11_DSV_DIMENSION_UNKNOWN = 0, - D3D11_DSV_DIMENSION_TEXTURE1D = 1, - D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2, - D3D11_DSV_DIMENSION_TEXTURE2D = 3, - D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4, - D3D11_DSV_DIMENSION_TEXTURE2DMS = 5, - D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6, - }; - - enum D3D11_DSV_FLAG - { - D3D11_DSV_READ_ONLY_DEPTH = 0x1L, - D3D11_DSV_READ_ONLY_STENCIL = 0x2L, - }; - - enum D3D11_FEATURE - { - D3D11_FEATURE_THREADING = 0, - D3D11_FEATURE_DOUBLES = (D3D11_FEATURE_THREADING + 1), - D3D11_FEATURE_FORMAT_SUPPORT = (D3D11_FEATURE_DOUBLES + 1), - D3D11_FEATURE_FORMAT_SUPPORT2 = (D3D11_FEATURE_FORMAT_SUPPORT + 1), - D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = (D3D11_FEATURE_FORMAT_SUPPORT2 + 1), - D3D11_FEATURE_D3D11_OPTIONS = (D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS + 1), - D3D11_FEATURE_ARCHITECTURE_INFO = (D3D11_FEATURE_D3D11_OPTIONS + 1), - D3D11_FEATURE_D3D9_OPTIONS = (D3D11_FEATURE_ARCHITECTURE_INFO + 1), - D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = (D3D11_FEATURE_D3D9_OPTIONS + 1), - D3D11_FEATURE_D3D9_SHADOW_SUPPORT = (D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT + 1), - D3D11_FEATURE_D3D11_OPTIONS1 = (D3D11_FEATURE_D3D9_SHADOW_SUPPORT + 1), - D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = (D3D11_FEATURE_D3D11_OPTIONS1 + 1), - D3D11_FEATURE_MARKER_SUPPORT = (D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT + 1), - D3D11_FEATURE_D3D9_OPTIONS1 = (D3D11_FEATURE_MARKER_SUPPORT + 1), - D3D11_FEATURE_D3D11_OPTIONS2 = (D3D11_FEATURE_D3D9_OPTIONS1 + 1), - D3D11_FEATURE_D3D11_OPTIONS3 = (D3D11_FEATURE_D3D11_OPTIONS2 + 1), - D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = (D3D11_FEATURE_D3D11_OPTIONS3 + 1), - D3D11_FEATURE_D3D11_OPTIONS4 = (D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT + 1), - D3D11_FEATURE_SHADER_CACHE = (D3D11_FEATURE_D3D11_OPTIONS4 + 1), - D3D11_FEATURE_D3D11_OPTIONS5 = (D3D11_FEATURE_SHADER_CACHE + 1), - D3D11_FEATURE_DISPLAYABLE = (D3D11_FEATURE_D3D11_OPTIONS5 + 1), - }; - - enum D3D11_FILL_MODE - { - D3D11_FILL_WIREFRAME = 2, - D3D11_FILL_SOLID = 3, - }; - - enum D3D11_FILTER - { - D3D11_FILTER_MIN_MAG_MIP_POINT = 0, - D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, - D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, - D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, - D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, - D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, - D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, - D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, - D3D11_FILTER_ANISOTROPIC = 0x55, - D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, - D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, - D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, - D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, - D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, - D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, - D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, - D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, - D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5, - D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100, - D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101, - D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104, - D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105, - D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110, - D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111, - D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114, - D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115, - D3D11_FILTER_MINIMUM_ANISOTROPIC = 0x155, - D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180, - D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181, - D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184, - D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185, - D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190, - D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191, - D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194, - D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195, - D3D11_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5, - }; - - enum D3D11_FILTER_TYPE - { - D3D11_FILTER_TYPE_POINT = 0, - D3D11_FILTER_TYPE_LINEAR = 1, - }; - - enum D3D11_FILTER_REDUCTION_TYPE - { - D3D11_FILTER_REDUCTION_TYPE_STANDARD = 0, - D3D11_FILTER_REDUCTION_TYPE_COMPARISON = 1, - D3D11_FILTER_REDUCTION_TYPE_MINIMUM = 2, - D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = 3, - }; - - enum D3D11_FORMAT_SUPPORT - { - D3D11_FORMAT_SUPPORT_BUFFER = 0x1, - D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, - D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, - D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, - D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, - D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, - D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, - D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, - D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, - D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, - D3D11_FORMAT_SUPPORT_MIP = 0x1000, - D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, - D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, - D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, - D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, - D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, - D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, - D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, - D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, - D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, - D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, - D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, - D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000, - D3D11_FORMAT_SUPPORT_DECODER_OUTPUT = 0x8000000, - D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT = 0x10000000, - D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT = 0x20000000, - D3D11_FORMAT_SUPPORT_VIDEO_ENCODER = 0x40000000, - }; - - enum D3D11_FORMAT_SUPPORT2 - { - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, - D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, - D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, - D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80, - D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100, - D3D11_FORMAT_SUPPORT2_TILED = 0x200, - D3D11_FORMAT_SUPPORT2_SHAREABLE = 0x400, - D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000, - D3D11_FORMAT_SUPPORT2_DISPLAYABLE = 0x10000, - }; - - enum D3D11_INPUT_CLASSIFICATION - { - D3D11_INPUT_PER_VERTEX_DATA = 0, - D3D11_INPUT_PER_INSTANCE_DATA = 1, - }; - - enum D3D11_MAP - { - D3D11_MAP_READ = 1, - D3D11_MAP_WRITE = 2, - D3D11_MAP_READ_WRITE = 3, - D3D11_MAP_WRITE_DISCARD = 4, - D3D11_MAP_WRITE_NO_OVERWRITE = 5, - }; - - enum D3D11_MAP_FLAG - { - D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L, - }; - - using D3D11_PRIMITIVE = D3D_PRIMITIVE; - using D3D11_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY; - - enum D3D11_QUERY - { - D3D11_QUERY_EVENT = 0, - D3D11_QUERY_OCCLUSION = (D3D11_QUERY_EVENT + 1), - D3D11_QUERY_TIMESTAMP = (D3D11_QUERY_OCCLUSION + 1), - D3D11_QUERY_TIMESTAMP_DISJOINT = (D3D11_QUERY_TIMESTAMP + 1), - D3D11_QUERY_PIPELINE_STATISTICS = (D3D11_QUERY_TIMESTAMP_DISJOINT + 1), - D3D11_QUERY_OCCLUSION_PREDICATE = (D3D11_QUERY_PIPELINE_STATISTICS + 1), - D3D11_QUERY_SO_STATISTICS = (D3D11_QUERY_OCCLUSION_PREDICATE + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE = (D3D11_QUERY_SO_STATISTICS + 1), - D3D11_QUERY_SO_STATISTICS_STREAM0 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = (D3D11_QUERY_SO_STATISTICS_STREAM0 + 1), - D3D11_QUERY_SO_STATISTICS_STREAM1 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = (D3D11_QUERY_SO_STATISTICS_STREAM1 + 1), - D3D11_QUERY_SO_STATISTICS_STREAM2 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = (D3D11_QUERY_SO_STATISTICS_STREAM2 + 1), - D3D11_QUERY_SO_STATISTICS_STREAM3 = (D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 + 1), - D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = (D3D11_QUERY_SO_STATISTICS_STREAM3 + 1), - }; - - enum D3D11_QUERY_MISC_FLAG - { - D3D11_QUERY_MISC_PREDICATEHINT = 0x1, - }; - - enum D3D11_RAISE_FLAG - { - D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L, - }; - - enum D3D11_RESOURCE_DIMENSION - { - D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D11_RESOURCE_DIMENSION_BUFFER = 1, - D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, - D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, - D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4, - }; - - enum D3D11_RESOURCE_MISC_FLAG - { - D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1L, - D3D11_RESOURCE_MISC_SHARED = 0x2L, - D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4L, - D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10L, - D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20L, - D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40L, - D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80L, - D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100L, - D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200L, - D3D11_RESOURCE_MISC_SHARED_NTHANDLE = 0x800L, - D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x1000L, - D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x2000L, - D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = 0x4000L, - D3D11_RESOURCE_MISC_GUARDED = 0x8000L, - D3D11_RESOURCE_MISC_TILE_POOL = 0x20000L, - D3D11_RESOURCE_MISC_TILED = 0x40000L, - D3D11_RESOURCE_MISC_HW_PROTECTED = 0x80000L, - D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE = 0x100000L, - D3D11_RESOURCE_MISC_SHARED_EXCLUSIVE_WRITER = 0x200000L, - }; - - enum D3D11_RTV_DIMENSION - { - D3D11_RTV_DIMENSION_UNKNOWN = 0, - D3D11_RTV_DIMENSION_BUFFER = 1, - D3D11_RTV_DIMENSION_TEXTURE1D = 2, - D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3, - D3D11_RTV_DIMENSION_TEXTURE2D = 4, - D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_RTV_DIMENSION_TEXTURE2DMS = 6, - D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D11_RTV_DIMENSION_TEXTURE3D = 8, - }; - - using D3D11_SRV_DIMENSION = D3D_SRV_DIMENSION; - - enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS - { - D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xFFFFFFFF, - D3D11_CENTER_MULTISAMPLE_PATTERN = 0xFFFFFFFE, - }; - - enum D3D11_STENCIL_OP - { - D3D11_STENCIL_OP_KEEP = 1, - D3D11_STENCIL_OP_ZERO = 2, - D3D11_STENCIL_OP_REPLACE = 3, - D3D11_STENCIL_OP_INCR_SAT = 4, - D3D11_STENCIL_OP_DECR_SAT = 5, - D3D11_STENCIL_OP_INVERT = 6, - D3D11_STENCIL_OP_INCR = 7, - D3D11_STENCIL_OP_DECR = 8, - }; - - enum D3D11_TEXTURE_ADDRESS_MODE - { - D3D11_TEXTURE_ADDRESS_WRAP = 1, - D3D11_TEXTURE_ADDRESS_MIRROR = 2, - D3D11_TEXTURE_ADDRESS_CLAMP = 3, - D3D11_TEXTURE_ADDRESS_BORDER = 4, - D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5, - }; - - enum D3D11_TEXTURECUBE_FACE - { - D3D11_TEXTURECUBE_FACE_POSITIVE_X = 0, - D3D11_TEXTURECUBE_FACE_NEGATIVE_X = 1, - D3D11_TEXTURECUBE_FACE_POSITIVE_Y = 2, - D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = 3, - D3D11_TEXTURECUBE_FACE_POSITIVE_Z = 4, - D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = 5, - }; - - enum D3D11_UAV_DIMENSION - { - D3D11_UAV_DIMENSION_UNKNOWN = 0, - D3D11_UAV_DIMENSION_BUFFER = 1, - D3D11_UAV_DIMENSION_TEXTURE1D = 2, - D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3, - D3D11_UAV_DIMENSION_TEXTURE2D = 4, - D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, - D3D11_UAV_DIMENSION_TEXTURE3D = 8, - }; - - enum D3D11_USAGE - { - D3D11_USAGE_DEFAULT = 0, - D3D11_USAGE_IMMUTABLE = 1, - D3D11_USAGE_DYNAMIC = 2, - D3D11_USAGE_STAGING = 3, - }; - - enum D3D11_VDOV_DIMENSION - { - D3D11_VDOV_DIMENSION_UNKNOWN = 0, - D3D11_VDOV_DIMENSION_TEXTURE2D = 1, - }; - - enum D3D11_VPIV_DIMENSION - { - D3D11_VPIV_DIMENSION_UNKNOWN = 0, - D3D11_VPIV_DIMENSION_TEXTURE2D = 1, - }; - - enum D3D11_VPOV_DIMENSION - { - D3D11_VPOV_DIMENSION_UNKNOWN = 0, - D3D11_VPOV_DIMENSION_TEXTURE2D = 1, - D3D11_VPOV_DIMENSION_TEXTURE2DARRAY = 2, - }; - - enum D3D11_VIDEO_DECODER_BUFFER_TYPE - { - D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = 0, - D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL = 1, - D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE = 2, - D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL = 3, - D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX = 4, - D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL = 5, - D3D11_VIDEO_DECODER_BUFFER_BITSTREAM = 6, - D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR = 7, - D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN = 8, - }; - - enum D3D11_VIDEO_FRAME_FORMAT - { - D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, - D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, - D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE - { - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_OPAQUE = 0, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_BACKGROUND = 1, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_DESTINATION = 2, - D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_SOURCE_STREAM = 3, - }; - - enum D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS - { - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DENOISE = 0x1, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DERINGING = 0x2, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_EDGE_ENHANCEMENT = 0x4, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_COLOR_CORRECTION = 0x8, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_FLESH_TONE_MAPPING = 0x10, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_IMAGE_STABILIZATION = 0x20, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_SUPER_RESOLUTION = 0x40, - D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_ANAMORPHIC_SCALING = 0x80, - }; - - enum D3D11_VIDEO_PROCESSOR_DEVICE_CAPS - { - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_LINEAR_SPACE = 0x1, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_xvYCC = 0x2, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x4, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x8, - D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_NOMINAL_RANGE = 0x10, - }; - - enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS - { - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_FILL = 0x1, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_CONSTRICTION = 0x2, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY = 0x4, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_PALETTE = 0x8, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY = 0x10, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_STEREO = 0x20, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION = 0x40, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 = 0x800, - }; - - enum D3D11_VIDEO_PROCESSOR_FILTER - { - D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS = 0, - D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST = 1, - D3D11_VIDEO_PROCESSOR_FILTER_HUE = 2, - D3D11_VIDEO_PROCESSOR_FILTER_SATURATION = 3, - D3D11_VIDEO_PROCESSOR_FILTER_NOISE_REDUCTION = 4, - D3D11_VIDEO_PROCESSOR_FILTER_EDGE_ENHANCEMENT = 5, - D3D11_VIDEO_PROCESSOR_FILTER_ANAMORPHIC_SCALING = 6, - D3D11_VIDEO_PROCESSOR_FILTER_STEREO_ADJUSTMENT = 7, - }; - - enum D3D11_VIDEO_PROCESSOR_FILTER_CAPS - { - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS = 0x1, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST = 0x2, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE = 0x4, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION = 0x8, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_NOISE_REDUCTION = 0x10, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40, - D3D11_VIDEO_PROCESSOR_FILTER_CAPS_STEREO_ADJUSTMENT = 0x80, - }; - - enum D3D11_VIDEO_PROCESSOR_FORMAT_CAPS - { - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_INTERLACED = 0x1, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_PROCAMP = 0x2, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY = 0x4, - D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_PALETTE_INTERLACED = 0x8, - }; - - enum D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT - { - D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = 0x1, - D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = 0x2, - }; - - enum D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS - { - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32 = 0x1, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_22 = 0x2, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2224 = 0x4, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2332 = 0x8, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32322 = 0x10, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_55 = 0x20, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_64 = 0x40, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_87 = 0x80, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_222222222223 = 0x100, - D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_OTHER = 0x80000000, - }; - - enum D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE - { - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_UNDEFINED = 0, - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235 = 1, - D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255 = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_OUTPUT_RATE - { - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_NORMAL = 0, - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_HALF = 1, - D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_CUSTOM = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS - { - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND = 0x1, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB = 0x2, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = 0x4, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = 0x8, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE = 0x10, - D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = 0x20, - }; - - enum D3D11_VIDEO_PROCESSOR_ROTATION - { - D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY = 0, - D3D11_VIDEO_PROCESSOR_ROTATION_90 = 1, - D3D11_VIDEO_PROCESSOR_ROTATION_180 = 2, - D3D11_VIDEO_PROCESSOR_ROTATION_270 = 3, - }; - - enum D3D11_VIDEO_PROCESSOR_STEREO_CAPS - { - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_MONO_OFFSET = 0x1, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_ROW_INTERLEAVED = 0x2, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_COLUMN_INTERLEAVED = 0x4, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_CHECKERBOARD = 0x8, - D3D11_VIDEO_PROCESSOR_STEREO_CAPS_FLIP_MODE = 0x10, - }; - - enum D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE - { - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_NONE = 0, - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME0 = 1, - D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME1 = 2, - }; - - enum D3D11_VIDEO_PROCESSOR_STEREO_FORMAT - { - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO = 0, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_HORIZONTAL = 1, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_VERTICAL = 2, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_SEPARATE = 3, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO_OFFSET = 4, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_ROW_INTERLEAVED = 5, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, - D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_CHECKERBOARD = 7, - }; - - enum D3D11_VIDEO_USAGE - { - D3D11_VIDEO_USAGE_PLAYBACK_NORMAL = 0, - D3D11_VIDEO_USAGE_OPTIMAL_SPEED = 1, - D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = 2, - }; -} - -namespace REX::W32 -{ - using D3D11_RECT = RECT; - - struct D3D11_AES_CTR_IV - { - std::uint64_t iv; - std::uint64_t count; - }; - - struct D3D11_BOX - { - std::uint32_t left; - std::uint32_t top; - std::uint32_t front; - std::uint32_t right; - std::uint32_t bottom; - std::uint32_t back; - }; - - struct D3D11_BUFFER_DESC - { - std::uint32_t byteWidth; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - std::uint32_t structureByteStride; - }; - - struct D3D11_BUFFER_RTV - { - union - { - std::uint32_t firstElement; - std::uint32_t elementOffset; - }; - union - { - std::uint32_t numElements; - std::uint32_t elementWidth; - }; - }; - - struct D3D11_BUFFER_SRV - { - union - { - std::uint32_t firstElement; - std::uint32_t elementOffset; - }; - union - { - std::uint32_t numElements; - std::uint32_t elementWidth; - }; - }; - - struct D3D11_BUFFER_UAV - { - std::uint32_t firstElement; - std::uint32_t numElements; - std::uint32_t flags; - }; - - struct D3D11_BUFFEREX_SRV - { - std::uint32_t firstElement; - std::uint32_t numElements; - std::uint32_t flags; - }; - - struct D3D11_CLASS_INSTANCE_DESC - { - std::uint32_t instanceId; - std::uint32_t instanceIndex; - std::uint32_t typeId; - std::uint32_t constantBuffer; - std::uint32_t baseConstantBufferOffset; - std::uint32_t baseTexture; - std::uint32_t baseSampler; - BOOL created; - }; - - struct D3D11_COUNTER_DESC - { - D3D11_COUNTER counter; - std::uint32_t miscFlags; - }; - - struct D3D11_COUNTER_INFO - { - D3D11_COUNTER lastDeviceDependentCounter; - std::uint32_t numSimultaneousCounters; - std::uint8_t numDetectableParallelUnits; - }; - - struct D3D11_DRAW_INSTANCED_INDIRECT_ARGS - { - std::uint32_t vertexCountPerInstance; - std::uint32_t instanceCount; - std::uint32_t startVertexLocation; - std::uint32_t startInstanceLocation; - }; - - struct D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS - { - std::uint32_t indexCountPerInstance; - std::uint32_t instanceCount; - std::uint32_t startIndexLocation; - std::int32_t baseVertexLocation; - std::uint32_t startInstanceLocation; - }; - - struct D3D11_ENCRYPTED_BLOCK_INFO - { - std::uint32_t numEncryptedBytesAtBeginning; - std::uint32_t numBytesInSkipPattern; - std::uint32_t numBytesInEncryptPattern; - }; - - struct D3D11_INPUT_ELEMENT_DESC - { - const char* semanticName; - std::uint32_t semanticIndex; - DXGI_FORMAT format; - std::uint32_t inputSlot; - std::uint32_t alignedByteOffset; - D3D11_INPUT_CLASSIFICATION inputSlotClass; - std::uint32_t instanceDataStepRate; - }; - - struct D3D11_MAPPED_SUBRESOURCE - { - void* data; - std::uint32_t rowPitch; - std::uint32_t depthPitch; - }; - - struct D3D11_QUERY_DATA_PIPELINE_STATISTICS - { - std::uint64_t iaVertices; - std::uint64_t iaPrimitives; - std::uint64_t vsInvocations; - std::uint64_t gsInvocations; - std::uint64_t gsPrimitives; - std::uint64_t cInvocations; - std::uint64_t cPrimitives; - std::uint64_t psInvocations; - std::uint64_t hsInvocations; - std::uint64_t dsInvocations; - std::uint64_t csInvocations; - }; - - struct D3D11_QUERY_DATA_SO_STATISTICS - { - std::uint64_t numPrimitivesWritten; - std::uint64_t primitivesStorageNeeded; - }; - - struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT - { - std::uint64_t frequency; - BOOL disjoint; - }; - - struct D3D11_QUERY_DESC - { - D3D11_QUERY query; - std::uint32_t miscFlags; - }; - - struct D3D11_RASTERIZER_DESC - { - D3D11_FILL_MODE fillMode; - D3D11_CULL_MODE cullMode; - BOOL frontCounterClockwise; - std::int32_t depthBias; - float depthBiasClamp; - float slopeScaledDepthBias; - BOOL depthClipEnable; - BOOL scissorEnable; - BOOL multisampleEnable; - BOOL antialiasedLineEnable; - }; - - struct D3D11_RENDER_TARGET_BLEND_DESC - { - BOOL blendEnable; - D3D11_BLEND srcBlend; - D3D11_BLEND destBlend; - D3D11_BLEND_OP blendOp; - D3D11_BLEND srcBlendAlpha; - D3D11_BLEND destBlendAlpha; - D3D11_BLEND_OP blendOpAlpha; - std::uint8_t renderTargetWriteMask; - }; - - struct D3D11_BLEND_DESC - { - BOOL alphaToCoverageEnable; - BOOL independentBlendEnable; - D3D11_RENDER_TARGET_BLEND_DESC renderTarget[8]; - }; - - struct D3D11_SO_DECLARATION_ENTRY - { - std::uint32_t stream; - const char* semanticName; - std::uint32_t semanticIndex; - std::uint8_t startComponent; - std::uint8_t componentCount; - std::uint8_t outputSlot; - }; - - struct D3D11_SAMPLER_DESC - { - D3D11_FILTER filter; - D3D11_TEXTURE_ADDRESS_MODE addressU; - D3D11_TEXTURE_ADDRESS_MODE addressV; - D3D11_TEXTURE_ADDRESS_MODE addressW; - float mipLODBias; - std::uint32_t maxAnisotropy; - D3D11_COMPARISON_FUNC comparisonFunc; - float borderColor[4]; - float minLOD; - float maxLOD; - }; - - struct D3D11_SUBRESOURCE_DATA - { - const void* sysMem; - std::uint32_t sysMemPitch; - std::uint32_t sysMemSlicePitch; - }; - - struct D3D11_TEX1D_DSV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX1D_RTV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX1D_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEX1D_UAV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX1D_ARRAY_DSV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX1D_ARRAY_RTV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX1D_ARRAY_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX1D_ARRAY_UAV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_DSV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_RTV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEX2D_UAV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_VDOV - { - std::uint32_t arraySlice; - }; - - struct D3D11_TEX2D_VPIV - { - std::uint32_t mipSlice; - std::uint32_t arraySlice; - }; - - struct D3D11_TEX2D_VPOV - { - std::uint32_t mipSlice; - }; - - struct D3D11_TEX2D_ARRAY_DSV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_RTV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_UAV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2D_ARRAY_VPOV - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2DMS_DSV - { - std::uint32_t _unusedField_NothingToDefine; - }; - - struct D3D11_TEX2DMS_RTV - { - std::uint32_t _unusedField_NothingToDefine; - }; - - struct D3D11_TEX2DMS_SRV - { - std::uint32_t _unusedField_NothingToDefine; - }; - - struct D3D11_TEX2DMS_ARRAY_DSV - { - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2DMS_ARRAY_RTV - { - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX2DMS_ARRAY_SRV - { - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - }; - - struct D3D11_TEX3D_RTV - { - std::uint32_t mipSlice; - std::uint32_t firstWSlice; - std::uint32_t wSize; - }; - - struct D3D11_TEX3D_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEX3D_UAV - { - std::uint32_t mipSlice; - std::uint32_t firstWSlice; - std::uint32_t wSize; - }; - - struct D3D11_TEXCUBE_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - }; - - struct D3D11_TEXCUBE_ARRAY_SRV - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t first2DArrayFace; - std::uint32_t numCubes; - }; - - struct D3D11_DEPTH_STENCILOP_DESC - { - D3D11_STENCIL_OP stencilFailOp; - D3D11_STENCIL_OP stencilDepthFailOp; - D3D11_STENCIL_OP stencilPassOp; - D3D11_COMPARISON_FUNC stencilFunc; - }; - - struct D3D11_DEPTH_STENCIL_DESC - { - BOOL depthEnable; - D3D11_DEPTH_WRITE_MASK depthWriteMask; - D3D11_COMPARISON_FUNC depthFunc; - BOOL stencilEnable; - std::uint8_t stencilReadMask; - std::uint8_t stencilWriteMask; - D3D11_DEPTH_STENCILOP_DESC frontFace; - D3D11_DEPTH_STENCILOP_DESC backFace; - }; - - struct D3D11_DEPTH_STENCIL_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_DSV_DIMENSION viewDimension; - std::uint32_t flags; - union - { - D3D11_TEX1D_DSV texture1D; - D3D11_TEX1D_ARRAY_DSV texture1DArray; - D3D11_TEX2D_DSV texture2D; - D3D11_TEX2D_ARRAY_DSV texture2DArray; - D3D11_TEX2DMS_DSV texture2DMS; - D3D11_TEX2DMS_ARRAY_DSV texture2DMSArray; - }; - }; - - struct D3D11_OMAC - { - std::uint8_t omac[16]; - }; - - struct D3D11_AUTHENTICATED_CONFIGURE_OUTPUT - { - D3D11_OMAC omac; - GUID configureType; - HANDLE channel; - std::uint32_t sequenceNumber; - HRESULT returnCode; - }; - - struct D3D11_RENDER_TARGET_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_RTV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_RTV buffer; - D3D11_TEX1D_RTV texture1D; - D3D11_TEX1D_ARRAY_RTV texture1DArray; - D3D11_TEX2D_RTV texture2D; - D3D11_TEX2D_ARRAY_RTV texture2DArray; - D3D11_TEX2DMS_RTV texture2DMS; - D3D11_TEX2DMS_ARRAY_RTV texture2DMSArray; - D3D11_TEX3D_RTV texture3D; - }; - }; - - struct D3D11_SHADER_RESOURCE_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_SRV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_SRV buffer; - D3D11_TEX1D_SRV texture1D; - D3D11_TEX1D_ARRAY_SRV texture1DArray; - D3D11_TEX2D_SRV texture2D; - D3D11_TEX2D_ARRAY_SRV texture2DArray; - D3D11_TEX2DMS_SRV texture2DMS; - D3D11_TEX2DMS_ARRAY_SRV texture2DMSArray; - D3D11_TEX3D_SRV texture3D; - D3D11_TEXCUBE_SRV textureCube; - D3D11_TEXCUBE_ARRAY_SRV textureCubeArray; - D3D11_BUFFEREX_SRV bufferEx; - }; - }; - - struct D3D11_TEXTURE1D_DESC - { - std::uint32_t width; - std::uint32_t mipLevels; - std::uint32_t arraySize; - DXGI_FORMAT format; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - }; - - struct D3D11_TEXTURE2D_DESC - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t mipLevels; - std::uint32_t arraySize; - DXGI_FORMAT format; - DXGI_SAMPLE_DESC sampleDesc; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - }; - - struct D3D11_TEXTURE3D_DESC - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t depth; - std::uint32_t mipLevels; - DXGI_FORMAT format; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - }; - - struct D3D11_UNORDERED_ACCESS_VIEW_DESC - { - DXGI_FORMAT format; - D3D11_UAV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_UAV buffer; - D3D11_TEX1D_UAV texture1D; - D3D11_TEX1D_ARRAY_UAV texture1DArray; - D3D11_TEX2D_UAV texture2D; - D3D11_TEX2D_ARRAY_UAV texture2DArray; - D3D11_TEX3D_UAV texture3D; - }; - }; - - struct D3D11_VIDEO_COLOR_RGBA - { - float r; - float g; - float b; - float a; - }; - - struct D3D11_VIDEO_COLOR_YCbCrA - { - float y; - float cb; - float cr; - float a; - }; - - struct D3D11_VIDEO_COLOR - { - union - { - D3D11_VIDEO_COLOR_YCbCrA ycbcr; - D3D11_VIDEO_COLOR_RGBA rgba; - }; - }; - - struct D3D11_VIDEO_CONTENT_PROTECTION_CAPS - { - std::uint32_t caps; - std::uint32_t keyExchangeTypeCount; - std::uint32_t blockAlignmentSize; - std::uint64_t protectedMemorySize; - }; - - struct D3D11_VIDEO_DECODER_BUFFER_DESC - { - D3D11_VIDEO_DECODER_BUFFER_TYPE bufferType; - std::uint32_t bufferIndex; - std::uint32_t dataOffset; - std::uint32_t dataSize; - std::uint32_t firstMBAddress; - std::uint32_t numMBsInBuffer; - std::uint32_t width; - std::uint32_t height; - std::uint32_t stride; - std::uint32_t reservedBits; - void* iv; - std::uint32_t ivSize; - BOOL partialEncryption; - D3D11_ENCRYPTED_BLOCK_INFO encryptedBlockInfo; - }; - - struct D3D11_VIDEO_DECODER_CONFIG - { - GUID guidConfigBitstreamEncryption; - GUID guidConfigMBControlEncryption; - GUID guidConfigResidDiffEncryption; - std::uint32_t configBitstreamRaw; - std::uint32_t configMBControlRasterOrder; - std::uint32_t configResidDiffHost; - std::uint32_t configSpatialResid8; - std::uint32_t configResid8Subtraction; - std::uint32_t configSpatialHost8or9Clipping; - std::uint32_t configSpatialResidInterleaved; - std::uint32_t configIntraResidUnsigned; - std::uint32_t configResidDiffAccelerator; - std::uint32_t configHostInverseScan; - std::uint32_t configSpecificIDCT; - std::uint32_t config4GroupedCoefs; - std::uint16_t configMinRenderTargetBuffCount; - std::uint16_t configDecoderSpecific; - }; - - struct D3D11_VIDEO_DECODER_DESC - { - GUID guid; - std::uint32_t sampleWidth; - std::uint32_t sampleHeight; - DXGI_FORMAT outputFormat; - }; - - struct D3D11_VIDEO_DECODER_EXTENSION - { - std::uint32_t function; - void* privateInputData; - std::uint32_t privateInputDataSize; - void* privateOutputData; - std::uint32_t privateOutputDataSize; - std::uint32_t resourceCount; - ID3D11Resource** resourceList; - }; - - struct D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC - { - GUID decodeProfile; - D3D11_VDOV_DIMENSION viewDimension; - union - { - D3D11_TEX2D_VDOV texture2D; - }; - }; - - struct D3D11_VIDEO_PROCESSOR_CAPS - { - std::uint32_t aeviceCaps; - std::uint32_t featureCaps; - std::uint32_t filterCaps; - std::uint32_t inputFormatCaps; - std::uint32_t autoStreamCaps; - std::uint32_t stereoCaps; - std::uint32_t rateConversionCapsCount; - std::uint32_t maxInputStreams; - std::uint32_t maxStreamStates; - }; - - struct D3D11_VIDEO_PROCESSOR_COLOR_SPACE - { - std::uint32_t usage: 1; - std::uint32_t rgb_Range: 1; - std::uint32_t yCbCr_Matrix: 1; - std::uint32_t yCbCr_xvYCC: 1; - std::uint32_t nominal_Range: 2; - std::uint32_t reserved: 26; - }; - - struct D3D11_VIDEO_PROCESSOR_CONTENT_DESC - { - D3D11_VIDEO_FRAME_FORMAT inputFrameFormat; - DXGI_RATIONAL inputFrameRate; - std::uint32_t inputWidth; - std::uint32_t inputHeight; - DXGI_RATIONAL outputFrameRate; - std::uint32_t outputWidth; - std::uint32_t outputHeight; - D3D11_VIDEO_USAGE usage; - }; - - struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE - { - DXGI_RATIONAL customRate; - std::uint32_t outputFrames; - BOOL inputInterlaced; - std::uint32_t inputFramesOrFields; - }; - - struct D3D11_VIDEO_PROCESSOR_FILTER_RANGE - { - std::int32_t min; - std::int32_t max; - std::int32_t def; - float mult; - }; - - struct D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC - { - std::uint32_t fourCC; - D3D11_VPIV_DIMENSION viewDimension; - union - { - D3D11_TEX2D_VPIV texture2D; - }; - }; - - struct D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC - { - D3D11_VPOV_DIMENSION viewDimension; - union - { - D3D11_TEX2D_VPOV texture2D; - D3D11_TEX2D_ARRAY_VPOV texture2DArray; - }; - }; - - struct D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS - { - std::uint32_t pastFrames; - std::uint32_t futureFrames; - std::uint32_t processorCaps; - std::uint32_t iTelecineCaps; - std::uint32_t customRateCount; - }; - - struct D3D11_VIDEO_PROCESSOR_STREAM - { - BOOL enable; - std::uint32_t outputIndex; - std::uint32_t inputFrameOrField; - std::uint32_t pastFrames; - std::uint32_t futureFrames; - ID3D11VideoProcessorInputView** pastSurfaces; - ID3D11VideoProcessorInputView* inputSurface; - ID3D11VideoProcessorInputView** futureSurfaces; - ID3D11VideoProcessorInputView** pastSurfacesRight; - ID3D11VideoProcessorInputView* inputSurfaceRight; - ID3D11VideoProcessorInputView** futureSurfacesRight; - }; - - struct D3D11_VIEWPORT - { - float topLeftX; - float topLeftY; - float width; - float height; - float minDepth; - float maxDepth; - - friend bool operator==(const D3D11_VIEWPORT& a_lhs, const D3D11_VIEWPORT& a_rhs) - { - return a_lhs.topLeftX == a_rhs.topLeftX && a_lhs.topLeftY == a_rhs.topLeftY && a_lhs.width == a_rhs.width && - a_lhs.height == a_rhs.height && a_lhs.minDepth == a_rhs.minDepth && a_lhs.maxDepth == a_rhs.maxDepth; - } - - friend bool operator!=(const D3D11_VIEWPORT& a_lhs, const D3D11_VIEWPORT& a_rhs) - { - return !(a_lhs == a_rhs); - } - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("db6f6ddb-ac77-4e88-8253-819df9bbf140")) - ID3D11Device : public IUnknown - { - virtual HRESULT CreateBuffer(const D3D11_BUFFER_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Buffer** a_buffer) = 0; - virtual HRESULT CreateTexture1D(const D3D11_TEXTURE1D_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture1D** a_texture1D) = 0; - virtual HRESULT CreateTexture2D(const D3D11_TEXTURE2D_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture2D** a_texture2D) = 0; - virtual HRESULT CreateTexture3D(const D3D11_TEXTURE3D_DESC* a_desc, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture3D** a_texture3D) = 0; - virtual HRESULT CreateShaderResourceView(ID3D11Resource* a_resource, const D3D11_SHADER_RESOURCE_VIEW_DESC* a_desc, ID3D11ShaderResourceView** a_srView) = 0; - virtual HRESULT CreateUnorderedAccessView(ID3D11Resource* a_resource, const D3D11_UNORDERED_ACCESS_VIEW_DESC* a_desc, ID3D11UnorderedAccessView** a_uaView) = 0; - virtual HRESULT CreateRenderTargetView(ID3D11Resource* a_resource, const D3D11_RENDER_TARGET_VIEW_DESC* a_desc, ID3D11RenderTargetView** a_rtView) = 0; - virtual HRESULT CreateDepthStencilView(ID3D11Resource* a_resource, const D3D11_DEPTH_STENCIL_VIEW_DESC* a_desc, ID3D11DepthStencilView** a_dsView) = 0; - virtual HRESULT CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC* a_desc, std::uint32_t a_numElements, const void* a_shaderBytecodeWithInputSignature, std::size_t a_bytecodeLength, ID3D11InputLayout** a_inputLayout) = 0; - virtual HRESULT CreateVertexShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11VertexShader** a_vertexShader) = 0; - virtual HRESULT CreateGeometryShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11GeometryShader** a_geometryShader) = 0; - virtual HRESULT CreateGeometryShaderWithStreamOutput(const void* a_shaderBytecode, std::size_t a_bytecodeLength, const D3D11_SO_DECLARATION_ENTRY* a_soDeclaration, std::uint32_t a_numEntries, const std::uint32_t* a_bufferStrides, std::uint32_t a_numStrides, std::uint32_t a_rasterizedStream, ID3D11ClassLinkage* a_classLinkage, ID3D11GeometryShader** a_geometryShader) = 0; - virtual HRESULT CreatePixelShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11PixelShader** a_pixelShader) = 0; - virtual HRESULT CreateHullShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11HullShader** a_hullShader) = 0; - virtual HRESULT CreateDomainShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11DomainShader** a_domainShader) = 0; - virtual HRESULT CreateComputeShader(const void* a_shaderBytecode, std::size_t a_bytecodeLength, ID3D11ClassLinkage* a_classLinkage, ID3D11ComputeShader** a_computeShader) = 0; - virtual HRESULT CreateClassLinkage(ID3D11ClassLinkage** a_classLinkage) = 0; - virtual HRESULT CreateBlendState(const D3D11_BLEND_DESC* a_blendStateDesc, ID3D11BlendState** a_blendState) = 0; - virtual HRESULT CreateDepthStencilState(const D3D11_DEPTH_STENCIL_DESC* a_depthStencilDesc, ID3D11DepthStencilState** a_depthStencilState) = 0; - virtual HRESULT CreateRasterizerState(const D3D11_RASTERIZER_DESC* a_rasterizerDesc, ID3D11RasterizerState** a_rasterizerState) = 0; - virtual HRESULT CreateSamplerState(const D3D11_SAMPLER_DESC* a_samplerDesc, ID3D11SamplerState** a_samplerState) = 0; - virtual HRESULT CreateQuery(const D3D11_QUERY_DESC* a_queryDesc, ID3D11Query** a_query) = 0; - virtual HRESULT CreatePredicate(const D3D11_QUERY_DESC* a_predicateDesc, ID3D11Predicate** a_predicate) = 0; - virtual HRESULT CreateCounter(const D3D11_COUNTER_DESC* a_counterDesc, ID3D11Counter** a_counter) = 0; - virtual HRESULT CreateDeferredContext(std::uint32_t a_contextFlags, ID3D11DeviceContext** a_deferredContext) = 0; - virtual HRESULT OpenSharedResource(HANDLE a_resourceHandle, const IID& a_returnedInterface, void** a_resource) = 0; - virtual HRESULT CheckFormatSupport(DXGI_FORMAT a_format, std::uint32_t* a_formatSupport) = 0; - virtual HRESULT CheckMultisampleQualityLevels(DXGI_FORMAT a_format, std::uint32_t a_sampleCount, std::uint32_t* a_numQualityLevels) = 0; - virtual void CheckCounterInfo(D3D11_COUNTER_INFO* a_counterInfo) = 0; - virtual HRESULT CheckCounter(const D3D11_COUNTER_DESC* a_desc, D3D11_COUNTER_TYPE* a_type, std::uint32_t* a_activeCounters, char* a_name, std::uint32_t* a_nameLength, char* a_units, std::uint32_t* a_unitsLength, char* a_description, std::uint32_t* a_descriptionLength) = 0; - virtual HRESULT CheckFeatureSupport(D3D11_FEATURE a_feature, void* a_featureSupportData, std::uint32_t a_featureSupportDataSize) = 0; - virtual HRESULT GetPrivateData(const GUID& a_guid, std::uint32_t* a_dataSize, void* a_data) = 0; - virtual HRESULT SetPrivateData(const GUID& a_guid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_guid, const IUnknown* a_data) = 0; - virtual D3D_FEATURE_LEVEL GetFeatureLevel(void) = 0; - virtual std::uint32_t GetCreationFlags(void) = 0; - virtual HRESULT GetDeviceRemovedReason(void) = 0; - virtual void GetImmediateContext(ID3D11DeviceContext** a_immediateContext) = 0; - virtual HRESULT SetExceptionMode(std::uint32_t a_raiseFlags) = 0; - virtual std::uint32_t GetExceptionMode(void) = 0; - }; - - struct __declspec(novtable, uuid("1841e5c8-16b0-489b-bcc8-44cfb0d5deae")) - ID3D11DeviceChild : public IUnknown - { - virtual void GetDevice(ID3D11Device** a_device) = 0; - virtual HRESULT GetPrivateData(const GUID& a_guid, std::uint32_t* a_dataSize, void* a_data) = 0; - virtual HRESULT SetPrivateData(const GUID& a_guid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_guid, const IUnknown* a_data) = 0; - }; - - struct __declspec(novtable, uuid("c0bfa96c-e089-44fb-8eaf-26f8796190da")) - ID3D11DeviceContext : public ID3D11DeviceChild - { - virtual void VSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void PSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void PSSetShader(ID3D11PixelShader* a_pixelShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void PSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void VSSetShader(ID3D11VertexShader* a_vertexShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void DrawIndexed(std::uint32_t IndexCount, std::uint32_t a_startIndexLocation, std::int32_t a_baseVertexLocation) = 0; - virtual void Draw(std::uint32_t a_vertexCount, std::uint32_t a_startVertexLocation) = 0; - virtual HRESULT Map(ID3D11Resource* a_resource, std::uint32_t a_subResource, D3D11_MAP a_mapType, std::uint32_t a_mapFlags, D3D11_MAPPED_SUBRESOURCE* a_mappedResource) = 0; - virtual void Unmap(ID3D11Resource* a_resource, std::uint32_t a_subResource) = 0; - virtual void PSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void IASetInputLayout(ID3D11InputLayout* a_inputLayout) = 0; - virtual void IASetVertexBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_vertexBuffers, const std::uint32_t* a_strides, const std::uint32_t* a_offsets) = 0; - virtual void IASetIndexBuffer(ID3D11Buffer* a_indexBuffer, DXGI_FORMAT a_format, std::uint32_t a_offset) = 0; - virtual void DrawIndexedInstanced(std::uint32_t a_indexCountPerInstance, std::uint32_t a_instanceCount, std::uint32_t a_startIndexLocation, std::int32_t a_baseVertexLocation, std::uint32_t a_startInstanceLocation) = 0; - virtual void DrawInstanced(std::uint32_t a_vertexCountPerInstance, std::uint32_t a_instanceCount, std::uint32_t a_startVertexLocation, std::uint32_t a_startInstanceLocation) = 0; - virtual void GSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void GSSetShader(ID3D11GeometryShader* a_shader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY a_topology) = 0; - virtual void VSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void VSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void Begin(ID3D11Asynchronous* a_async) = 0; - virtual void End(ID3D11Asynchronous* a_async) = 0; - virtual HRESULT GetData(ID3D11Asynchronous* a_async, void* a_data, std::uint32_t a_dataSize, std::uint32_t a_getDataFlags) = 0; - virtual void SetPredication(ID3D11Predicate* a_predicate, BOOL a_predicateValue) = 0; - virtual void GSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void GSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void OMSetRenderTargets(std::uint32_t a_numViews, ID3D11RenderTargetView* const* a_renderTargetViews, ID3D11DepthStencilView* a_depthStencilView) = 0; - virtual void OMSetRenderTargetsAndUnorderedAccessViews(std::uint32_t a_numRTVs, ID3D11RenderTargetView* const* a_renderTargetViews, ID3D11DepthStencilView* a_depthStencilView, std::uint32_t a_uavStartSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView* const* a_unorderedAccessViews, const std::uint32_t* a_uavInitialCounts) = 0; - virtual void OMSetBlendState(ID3D11BlendState* a_blendState, const float a_blendFactor[4], std::uint32_t a_sampleMask) = 0; - virtual void OMSetDepthStencilState(ID3D11DepthStencilState* a_depthStencilState, std::uint32_t a_stencilRef) = 0; - virtual void SOSetTargets(std::uint32_t a_numBuffers, ID3D11Buffer* const* a_soTargets, const std::uint32_t* a_offsets) = 0; - virtual void DrawAuto(void) = 0; - virtual void DrawIndexedInstancedIndirect(ID3D11Buffer* a_bufferForArgs, std::uint32_t a_alignedByteOffsetForArgs) = 0; - virtual void DrawInstancedIndirect(ID3D11Buffer* a_bufferForArgs, std::uint32_t a_alignedByteOffsetForArgs) = 0; - virtual void Dispatch(std::uint32_t a_threadGroupCountX, std::uint32_t a_threadGroupCountY, std::uint32_t a_threadGroupCountZ) = 0; - virtual void DispatchIndirect(ID3D11Buffer* a_bufferForArgs, std::uint32_t a_alignedByteOffsetForArgs) = 0; - virtual void RSSetState(ID3D11RasterizerState* a_rasterizerState) = 0; - virtual void RSSetViewports(std::uint32_t a_numViewports, const D3D11_VIEWPORT* a_viewports) = 0; - virtual void RSSetScissorRects(std::uint32_t a_numRects, const D3D11_RECT* a_rects) = 0; - virtual void CopySubresourceRegion(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, std::uint32_t a_dstX, std::uint32_t a_dstY, std::uint32_t a_dstZ, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, const D3D11_BOX* a_srcBox) = 0; - virtual void CopyResource(ID3D11Resource* a_dstResource, ID3D11Resource* a_srcResource) = 0; - virtual void UpdateSubresource(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, const D3D11_BOX* a_dstBox, const void* a_srcData, std::uint32_t a_srcRowPitch, std::uint32_t a_srcDepthPitch) = 0; - virtual void CopyStructureCount(ID3D11Buffer* a_dstBuffer, std::uint32_t a_dstAlignedByteOffset, ID3D11UnorderedAccessView* a_srcView) = 0; - virtual void ClearRenderTargetView(ID3D11RenderTargetView* a_renderTargetView, const float a_colorRGBA[4]) = 0; - virtual void ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView* a_unorderedAccessView, const std::uint32_t a_values[4]) = 0; - virtual void ClearUnorderedAccessViewFloat(ID3D11UnorderedAccessView* a_unorderedAccessView, const float a_values[4]) = 0; - virtual void ClearDepthStencilView(ID3D11DepthStencilView* a_depthStencilView, std::uint32_t a_clearFlags, float a_depth, std::uint8_t a_stencil) = 0; - virtual void GenerateMips(ID3D11ShaderResourceView* a_shaderResourceView) = 0; - virtual void SetResourceMinLOD(ID3D11Resource* a_resource, float a_minLOD) = 0; - virtual float GetResourceMinLOD(ID3D11Resource* a_resource) = 0; - virtual void ResolveSubresource(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, DXGI_FORMAT a_format) = 0; - virtual void ExecuteCommandList(ID3D11CommandList* a_commandList, BOOL a_restoreContextState) = 0; - virtual void HSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void HSSetShader(ID3D11HullShader* a_hullShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void HSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void HSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void DSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void DSSetShader(ID3D11DomainShader* a_domainShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void DSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void DSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void CSSetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView* const* a_shaderResourceViews) = 0; - virtual void CSSetUnorderedAccessViews(std::uint32_t a_startSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView* const* a_unorderedAccessViews, const std::uint32_t* a_uavInitialCounts) = 0; - virtual void CSSetShader(ID3D11ComputeShader* a_computeShader, ID3D11ClassInstance* const* a_classInstances, std::uint32_t a_numClassInstances) = 0; - virtual void CSSetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState* const* a_samplers) = 0; - virtual void CSSetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers) = 0; - virtual void VSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void PSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void PSGetShader(ID3D11PixelShader** a_pixelShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void PSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void VSGetShader(ID3D11VertexShader** a_vertexShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void PSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void IAGetInputLayout(ID3D11InputLayout** a_inputLayout) = 0; - virtual void IAGetVertexBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_vertexBuffers, std::uint32_t* a_strides, std::uint32_t* a_offsets) = 0; - virtual void IAGetIndexBuffer(ID3D11Buffer** a_indexBuffer, DXGI_FORMAT* a_format, std::uint32_t* a_offset) = 0; - virtual void GSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void GSGetShader(ID3D11GeometryShader** a_geometryShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY* a_topology) = 0; - virtual void VSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void VSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void GetPredication(ID3D11Predicate** a_predicate, BOOL* a_predicateValue) = 0; - virtual void GSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void GSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void OMGetRenderTargets(std::uint32_t a_numViews, ID3D11RenderTargetView** a_renderTargetViews, ID3D11DepthStencilView** a_depthStencilView) = 0; - virtual void OMGetRenderTargetsAndUnorderedAccessViews(std::uint32_t a_numRTVs, ID3D11RenderTargetView** a_renderTargetViews, ID3D11DepthStencilView** a_depthStencilView, std::uint32_t a_uavStartSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView** a_unorderedAccessViews) = 0; - virtual void OMGetBlendState(ID3D11BlendState** a_blendState, float a_blendFactor[4], std::uint32_t* a_sampleMask) = 0; - virtual void OMGetDepthStencilState(ID3D11DepthStencilState** a_depthStencilState, std::uint32_t* a_stencilRef) = 0; - virtual void SOGetTargets(std::uint32_t a_numBuffers, ID3D11Buffer** a_soTargets) = 0; - virtual void RSGetState(ID3D11RasterizerState** a_rasterizerState) = 0; - virtual void RSGetViewports(std::uint32_t* a_numViewports, D3D11_VIEWPORT* a_viewports) = 0; - virtual void RSGetScissorRects(std::uint32_t* a_numRects, D3D11_RECT* a_rects) = 0; - virtual void HSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void HSGetShader(ID3D11HullShader** a_hullShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void HSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void HSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void DSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void DSGetShader(ID3D11DomainShader** a_domainShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void DSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void DSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void CSGetShaderResources(std::uint32_t a_startSlot, std::uint32_t a_numViews, ID3D11ShaderResourceView** a_shaderResourceViews) = 0; - virtual void CSGetUnorderedAccessViews(std::uint32_t a_startSlot, std::uint32_t a_numUAVs, ID3D11UnorderedAccessView** a_unorderedAccessViews) = 0; - virtual void CSGetShader(ID3D11ComputeShader** a_computeShader, ID3D11ClassInstance** a_classInstances, std::uint32_t* a_numClassInstances) = 0; - virtual void CSGetSamplers(std::uint32_t a_startSlot, std::uint32_t a_numSamplers, ID3D11SamplerState** a_samplers) = 0; - virtual void CSGetConstantBuffers(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers) = 0; - virtual void ClearState(void) = 0; - virtual void Flush(void) = 0; - virtual D3D11_DEVICE_CONTEXT_TYPE GetType(void) = 0; - virtual std::uint32_t GetContextFlags(void) = 0; - virtual HRESULT FinishCommandList(BOOL a_restoreDeferredContextState, ID3D11CommandList** a_commandList) = 0; - }; - - struct __declspec(novtable, uuid("4b35d0cd-1e15-4258-9c98-1b1333f6dd3b")) - ID3D11Asynchronous : public ID3D11DeviceChild - { - virtual std::uint32_t GetDataSize(void) = 0; - }; - - struct __declspec(novtable, uuid("3015A308-DCBD-47aa-A747-192486D14D4A")) - ID3D11AuthenticatedChannel : public ID3D11DeviceChild - { - virtual HRESULT GetCertificateSize(std::uint32_t* a_certificateSize) = 0; - virtual HRESULT GetCertificate(std::uint32_t a_certificateSize, std::uint8_t* a_certificate) = 0; - virtual void GetChannelHandle(HANDLE* a_channelHandle) = 0; - }; - - struct __declspec(novtable, uuid("75b68faa-347d-4159-8f45-a0640f01cd9a")) - ID3D11BlendState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_BLEND_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("a6cd7faa-b0b7-4a2f-9436-8662a65797cb")) - ID3D11ClassInstance : public ID3D11DeviceChild - { - virtual void GetClassLinkage(ID3D11ClassLinkage** a_linkage) = 0; - virtual void GetDesc(D3D11_CLASS_INSTANCE_DESC* a_desc) = 0; - virtual void GetInstanceName(char* a_instanceName, std::size_t* a_bufferLength) = 0; - virtual void GetTypeName(char* a_typeName, std::size_t* a_bufferLength) = 0; - }; - - struct __declspec(novtable, uuid("ddf57cba-9543-46e4-a12b-f207a0fe7fed")) - ID3D11ClassLinkage : public ID3D11DeviceChild - { - virtual HRESULT GetClassInstance(const char* a_classInstanceName, std::uint32_t a_instanceIndex, ID3D11ClassInstance** a_instance) = 0; - virtual HRESULT CreateClassInstance(const char* a_classTypeName, std::uint32_t a_constantBufferOffset, std::uint32_t a_constantVectorOffset, std::uint32_t a_textureOffset, std::uint32_t a_samplerOffset, ID3D11ClassInstance** a_instance) = 0; - }; - - struct __declspec(novtable, uuid("a24bc4d1-769e-43f7-8013-98ff566c18e2")) - ID3D11CommandList : public ID3D11DeviceChild - { - virtual std::uint32_t GetContextFlags(void) = 0; - }; - - struct __declspec(novtable, uuid("4f5b196e-c2bd-495e-bd01-1fded38e4969")) - ID3D11ComputeShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("6e8c49fb-a371-4770-b440-29086022b741")) - ID3D11Counter : public ID3D11Asynchronous - { - virtual void GetDesc(D3D11_COUNTER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("9B32F9AD-BDCC-40a6-A39D-D5C865845720")) - ID3D11CryptoSession : public ID3D11DeviceChild - { - virtual void GetCryptoType(GUID* a_cryptoType) = 0; - virtual void GetDecoderProfile(GUID* a_decoderProfile) = 0; - virtual HRESULT GetCertificateSize(std::uint32_t* a_certificateSize) = 0; - virtual HRESULT GetCertificate(std::uint32_t a_certificateSize, std::uint8_t* a_certificate) = 0; - virtual void GetCryptoSessionHandle(HANDLE* a_cryptoSessionHandle) = 0; - }; - - struct __declspec(novtable, uuid("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1")) - ID3D11DepthStencilState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_DEPTH_STENCIL_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("f582c508-0f36-490c-9977-31eece268cfa")) - ID3D11DomainShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("38325b96-effb-4022-ba02-2e795b70275c")) - ID3D11GeometryShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("8e5c6061-628a-4c8e-8264-bbe45cb3d5dd")) - ID3D11HullShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("e4819ddc-4cf0-4025-bd26-5de82a3e07b7")) - ID3D11InputLayout : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("ea82e40d-51dc-4f33-93d4-db7c9125ae8c")) - ID3D11PixelShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7")) - ID3D11RasterizerState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_RASTERIZER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("dc8e63f3-d12b-4952-b47b-5e45026a862d")) - ID3D11Resource : public ID3D11DeviceChild - { - virtual void GetType(D3D11_RESOURCE_DIMENSION* a_resourceDimension) = 0; - virtual void SetEvictionPriority(std::uint32_t a_evictionPriority) = 0; - virtual std::uint32_t GetEvictionPriority(void) = 0; - }; - - struct __declspec(novtable, uuid("da6fea51-564c-4487-9810-f0d0f9b4e3a5")) - ID3D11SamplerState : public ID3D11DeviceChild - { - virtual void GetDesc(D3D11_SAMPLER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("3b301d64-d678-4289-8897-22f8928b72f3")) - ID3D11VertexShader : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("839d1216-bb2e-412b-b7f4-a9dbebe08ed1")) - ID3D11View : public ID3D11DeviceChild - { - virtual void GetResource(ID3D11Resource** a_resource) = 0; - }; - - struct __declspec(novtable, uuid("48570b85-d1ee-4fcd-a250-eb350722b037")) - ID3D11Buffer : public ID3D11Resource - { - virtual void GetDesc(D3D11_BUFFER_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("9fdac92a-1876-48c3-afad-25b94f84a9b6")) - ID3D11DepthStencilView : public ID3D11View - { - virtual void GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("d6c00747-87b7-425e-b84d-44d108560afd")) - ID3D11Query : public ID3D11Asynchronous - { - virtual void GetDesc(D3D11_QUERY_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("9eb576dd-9f77-4d86-81aa-8bab5fe490e2")) - ID3D11Predicate : public ID3D11Query - {}; - - struct __declspec(novtable, uuid("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c")) - ID3D11Texture1D : public ID3D11Resource - { - virtual void GetDesc(D3D11_TEXTURE1D_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("6f15aaf2-d208-4e89-9ab4-489535d34f9c")) - ID3D11Texture2D : public ID3D11Resource - { - virtual void GetDesc(D3D11_TEXTURE2D_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("037e866e-f56d-4357-a8af-9dabbe6e250e")) - ID3D11Texture3D : public ID3D11Resource - { - virtual void GetDesc(D3D11_TEXTURE3D_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("dfdba067-0b8d-4865-875b-d7b4516cc164")) - ID3D11RenderTargetView : public ID3D11View - { - virtual void GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("b0e06fe0-8192-4e1a-b1ca-36d7414710b2")) - ID3D11ShaderResourceView : public ID3D11View - { - virtual void GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("28acf509-7f5c-48f6-8611-f316010a6380")) - ID3D11UnorderedAccessView : public ID3D11View - { - virtual void GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("61F21C45-3C0E-4a74-9CEA-67100D9AD5E4")) - ID3D11VideoContext : public ID3D11DeviceChild - { - virtual HRESULT GetDecoderBuffer(ID3D11VideoDecoder* a_decoder, D3D11_VIDEO_DECODER_BUFFER_TYPE a_type, std::uint32_t* a_bufferSize, void** a_buffer) = 0; - virtual HRESULT ReleaseDecoderBuffer(ID3D11VideoDecoder* a_decoder, D3D11_VIDEO_DECODER_BUFFER_TYPE a_type) = 0; - virtual HRESULT DecoderBeginFrame(ID3D11VideoDecoder* a_decoder, ID3D11VideoDecoderOutputView* a_view, std::uint32_t a_contentKeySize, const void* a_contentKey) = 0; - virtual HRESULT DecoderEndFrame(ID3D11VideoDecoder* a_decoder) = 0; - virtual HRESULT SubmitDecoderBuffers(ID3D11VideoDecoder* a_decoder, std::uint32_t a_numBuffers, const D3D11_VIDEO_DECODER_BUFFER_DESC* a_bufferDesc) = 0; - virtual HRESULT DecoderExtension(ID3D11VideoDecoder* a_decoder, const D3D11_VIDEO_DECODER_EXTENSION* a_extensionData) = 0; - virtual void VideoProcessorSetOutputTargetRect(ID3D11VideoProcessor* a_videoProcessor, BOOL a_enable, const RECT* a_rect) = 0; - virtual void VideoProcessorSetOutputBackgroundColor(ID3D11VideoProcessor* a_videoProcessor, BOOL a_bYCbCr, const D3D11_VIDEO_COLOR* a_color) = 0; - virtual void VideoProcessorSetOutputColorSpace(ID3D11VideoProcessor* a_videoProcessor, const D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorSetOutputAlphaFillMode(ID3D11VideoProcessor* a_videoProcessor, D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE a_alphaFillMode, std::uint32_t a_streamIndex) = 0; - virtual void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* a_videoProcessor, BOOL a_enable, SIZE a_size) = 0; - virtual void VideoProcessorSetOutputStereoMode(ID3D11VideoProcessor* a_videoProcessor, BOOL a_enable) = 0; - virtual HRESULT VideoProcessorSetOutputExtension(ID3D11VideoProcessor* a_videoProcessor, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void VideoProcessorGetOutputTargetRect(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_enabled, RECT* a_rect) = 0; - virtual void VideoProcessorGetOutputBackgroundColor(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_bYCbCr, D3D11_VIDEO_COLOR* a_color) = 0; - virtual void VideoProcessorGetOutputColorSpace(ID3D11VideoProcessor* a_videoProcessor, D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorGetOutputAlphaFillMode(ID3D11VideoProcessor* a_videoProcessor, D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE* a_alphaFillMode, std::uint32_t* a_streamIndex) = 0; - virtual void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_enabled, SIZE* a_size) = 0; - virtual void VideoProcessorGetOutputStereoMode(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_enabled) = 0; - virtual HRESULT VideoProcessorGetOutputExtension(ID3D11VideoProcessor* a_videoProcessor, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void VideoProcessorSetStreamFrameFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_FRAME_FORMAT a_frameFormat) = 0; - virtual void VideoProcessorSetStreamColorSpace(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, const D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorSetStreamOutputRate(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_OUTPUT_RATE a_outputRate, BOOL a_repeatFrame, const DXGI_RATIONAL* a_customRate) = 0; - virtual void VideoProcessorSetStreamSourceRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, const RECT* a_rect) = 0; - virtual void VideoProcessorSetStreamDestRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, const RECT* a_rect) = 0; - virtual void VideoProcessorSetStreamAlpha(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, float a_alpha) = 0; - virtual void VideoProcessorSetStreamPalette(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, std::uint32_t a_count, const std::uint32_t* a_entries) = 0; - virtual void VideoProcessorSetStreamPixelAspectRatio(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, const DXGI_RATIONAL* a_sourceAspectRatio, const DXGI_RATIONAL* a_destinationAspectRatio) = 0; - virtual void VideoProcessorSetStreamLumaKey(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t StreamIndex, BOOL a_enable, float a_lower, float a_upper) = 0; - virtual void VideoProcessorSetStreamStereoFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, D3D11_VIDEO_PROCESSOR_STEREO_FORMAT a_format, BOOL a_leftViewFrame0, BOOL a_baseViewFrame0, D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE a_flipMode, std::int32_t a_monoOffset) = 0; - virtual void VideoProcessorSetStreamAutoProcessingMode(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable) = 0; - virtual void VideoProcessorSetStreamFilter(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_FILTER a_filter, BOOL a_enable, std::int32_t a_level) = 0; - virtual HRESULT VideoProcessorSetStreamExtension(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void VideoProcessorGetStreamFrameFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_FRAME_FORMAT* a_frameFormat) = 0; - virtual void VideoProcessorGetStreamColorSpace(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_COLOR_SPACE* a_colorSpace) = 0; - virtual void VideoProcessorGetStreamOutputRate(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_OUTPUT_RATE* a_outputRate, BOOL* a_repeatFrame, DXGI_RATIONAL* a_customRate) = 0; - virtual void VideoProcessorGetStreamSourceRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, RECT* a_rect) = 0; - virtual void VideoProcessorGetStreamDestRect(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, RECT* a_rect) = 0; - virtual void VideoProcessorGetStreamAlpha(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, float* a_alpha) = 0; - virtual void VideoProcessorGetStreamPalette(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, std::uint32_t a_count, std::uint32_t* a_entries) = 0; - virtual void VideoProcessorGetStreamPixelAspectRatio(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, DXGI_RATIONAL* a_sourceAspectRatio, DXGI_RATIONAL* a_destinationAspectRatio) = 0; - virtual void VideoProcessorGetStreamLumaKey(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled, float* a_lower, float* a_upper) = 0; - virtual void VideoProcessorGetStreamStereoFormat(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enable, D3D11_VIDEO_PROCESSOR_STEREO_FORMAT* a_format, BOOL* a_leftViewFrame0, BOOL* a_baseViewFrame0, D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE* a_flipMode, std::int32_t* a_monoOffset) = 0; - virtual void VideoProcessorGetStreamAutoProcessingMode(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enabled) = 0; - virtual void VideoProcessorGetStreamFilter(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, D3D11_VIDEO_PROCESSOR_FILTER a_filter, BOOL* a_enabled, std::int32_t* a_level) = 0; - virtual HRESULT VideoProcessorGetStreamExtension(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, const GUID* a_extensionGuid, std::uint32_t a_dataSize, void* a_data) = 0; - virtual HRESULT VideoProcessorBlt(ID3D11VideoProcessor* a_videoProcessor, ID3D11VideoProcessorOutputView* a_view, std::uint32_t a_outputFrame, std::uint32_t a_streamCount, const D3D11_VIDEO_PROCESSOR_STREAM* a_streams) = 0; - virtual HRESULT NegotiateCryptoSessionKeyExchange(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_dataSize, void* a_data) = 0; - virtual void EncryptionBlt(ID3D11CryptoSession* a_cryptoSession, ID3D11Texture2D* a_srcSurface, ID3D11Texture2D* a_dstSurface, std::uint32_t a_ivSize, void* a_iv) = 0; - virtual void DecryptionBlt(ID3D11CryptoSession* a_cryptoSession, ID3D11Texture2D* a_srcSurface, ID3D11Texture2D* a_dstSurface, D3D11_ENCRYPTED_BLOCK_INFO* a_encryptedBlockInfo, std::uint32_t a_contentKeySize, const void* a_contentKey, std::uint32_t a_ivSize, void* a_iv) = 0; - virtual void StartSessionKeyRefresh(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_randomNumberSize, void* a_randomNumber) = 0; - virtual void FinishSessionKeyRefresh(ID3D11CryptoSession* a_cryptoSession) = 0; - virtual HRESULT GetEncryptionBltKey(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_keySize, void* a_readbackKey) = 0; - virtual HRESULT NegotiateAuthenticatedChannelKeyExchange(ID3D11AuthenticatedChannel* a_channel, std::uint32_t a_dataSize, void* a_data) = 0; - virtual HRESULT QueryAuthenticatedChannel(ID3D11AuthenticatedChannel* a_channel, std::uint32_t a_inputSize, const void* a_input, std::uint32_t a_outputSize, void* a_output) = 0; - virtual HRESULT ConfigureAuthenticatedChannel(ID3D11AuthenticatedChannel* a_channel, std::uint32_t a_inputSize, const void* a_input, D3D11_AUTHENTICATED_CONFIGURE_OUTPUT* a_output) = 0; - virtual void VideoProcessorSetStreamRotation(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, D3D11_VIDEO_PROCESSOR_ROTATION a_rotation) = 0; - virtual void VideoProcessorGetStreamRotation(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enable, D3D11_VIDEO_PROCESSOR_ROTATION* a_rotation) = 0; - }; - - struct __declspec(novtable, uuid("3C9C5B51-995D-48d1-9B8D-FA5CAEDED65C")) - ID3D11VideoDecoder : public ID3D11DeviceChild - { - virtual HRESULT GetCreationParameters(D3D11_VIDEO_DECODER_DESC* a_videoDesc, D3D11_VIDEO_DECODER_CONFIG* a_config) = 0; - virtual HRESULT GetDriverHandle(HANDLE* a_driverHandle) = 0; - }; - - struct __declspec(novtable, uuid("C2931AEA-2A85-4f20-860F-FBA1FD256E18")) - ID3D11VideoDecoderOutputView : public ID3D11View - { - virtual void GetDesc(D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("10EC4D5B-975A-4689-B9E4-D0AAC30FE333")) - ID3D11VideoDevice : public IUnknown - { - virtual HRESULT CreateVideoDecoder(const D3D11_VIDEO_DECODER_DESC* a_videoDesc, const D3D11_VIDEO_DECODER_CONFIG* a_config, ID3D11VideoDecoder** a_decoder) = 0; - virtual HRESULT CreateVideoProcessor(ID3D11VideoProcessorEnumerator* a_enum, std::uint32_t a_rateConversionIndex, ID3D11VideoProcessor** a_videoProcessor) = 0; - virtual HRESULT CreateAuthenticatedChannel(D3D11_AUTHENTICATED_CHANNEL_TYPE a_channelType, ID3D11AuthenticatedChannel** a_authenticatedChannel) = 0; - virtual HRESULT CreateCryptoSession(const GUID* a_cryptoType, const GUID* a_decoderProfile, const GUID* a_keyExchangeType, ID3D11CryptoSession** a_cryptoSession) = 0; - virtual HRESULT CreateVideoDecoderOutputView(ID3D11Resource* a_resource, const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC* a_desc, ID3D11VideoDecoderOutputView** a_dvovView) = 0; - virtual HRESULT CreateVideoProcessorInputView(ID3D11Resource* a_resource, ID3D11VideoProcessorEnumerator* a_enum, const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC* a_desc, ID3D11VideoProcessorInputView** a_vpiView) = 0; - virtual HRESULT CreateVideoProcessorOutputView(ID3D11Resource* a_resource, ID3D11VideoProcessorEnumerator* a_enum, const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC* a_desc, ID3D11VideoProcessorOutputView** a_vpoView) = 0; - virtual HRESULT CreateVideoProcessorEnumerator(const D3D11_VIDEO_PROCESSOR_CONTENT_DESC* a_desc, ID3D11VideoProcessorEnumerator** a_enum) = 0; - virtual std::uint32_t GetVideoDecoderProfileCount(void) = 0; - virtual HRESULT GetVideoDecoderProfile(std::uint32_t a_index, GUID* a_decoderProfile) = 0; - virtual HRESULT CheckVideoDecoderFormat(const GUID* a_decoderProfile, DXGI_FORMAT a_format, BOOL* a_supported) = 0; - virtual HRESULT GetVideoDecoderConfigCount(const D3D11_VIDEO_DECODER_DESC* a_desc, std::uint32_t* a_count) = 0; - virtual HRESULT GetVideoDecoderConfig(const D3D11_VIDEO_DECODER_DESC* a_desc, std::uint32_t a_index, D3D11_VIDEO_DECODER_CONFIG* a_config) = 0; - virtual HRESULT GetContentProtectionCaps(const GUID* a_cryptoType, const GUID* a_decoderProfile, D3D11_VIDEO_CONTENT_PROTECTION_CAPS* a_caps) = 0; - virtual HRESULT CheckCryptoKeyExchange(const GUID* a_cryptoType, const GUID* a_decoderProfile, std::uint32_t a_index, GUID* a_keyExchangeType) = 0; - virtual HRESULT SetPrivateData(const GUID& a_guid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_guid, const IUnknown* a_data) = 0; - }; - - struct __declspec(novtable, uuid("1D7B0652-185F-41c6-85CE-0C5BE3D4AE6C")) - ID3D11VideoProcessor : public ID3D11DeviceChild - { - virtual void GetContentDesc(D3D11_VIDEO_PROCESSOR_CONTENT_DESC* a_desc) = 0; - virtual void GetRateConversionCaps(D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS* a_caps) = 0; - }; - - struct __declspec(novtable, uuid("31627037-53AB-4200-9061-05FAA9AB45F9")) - ID3D11VideoProcessorEnumerator : public ID3D11DeviceChild - { - virtual HRESULT GetVideoProcessorContentDesc(D3D11_VIDEO_PROCESSOR_CONTENT_DESC* a_contentDesc) = 0; - virtual HRESULT CheckVideoProcessorFormat(DXGI_FORMAT a_format, std::uint32_t* a_flags) = 0; - virtual HRESULT GetVideoProcessorCaps(D3D11_VIDEO_PROCESSOR_CAPS* a_caps) = 0; - virtual HRESULT GetVideoProcessorRateConversionCaps(std::uint32_t a_typeIndex, D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS* a_caps) = 0; - virtual HRESULT GetVideoProcessorCustomRate(std::uint32_t a_typeIndex, std::uint32_t a_customRateIndex, D3D11_VIDEO_PROCESSOR_CUSTOM_RATE* a_rate) = 0; - virtual HRESULT GetVideoProcessorFilterRange(D3D11_VIDEO_PROCESSOR_FILTER a_filter, D3D11_VIDEO_PROCESSOR_FILTER_RANGE* a_range) = 0; - }; - - struct __declspec(novtable, uuid("11EC5A5F-51DC-4945-AB34-6E8C21300EA5")) - ID3D11VideoProcessorInputView : public ID3D11View - { - virtual void GetDesc(D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("A048285E-25A9-4527-BD93-D68B68C44254")) - ID3D11VideoProcessorOutputView : public ID3D11View - { - virtual void GetDesc(D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC* a_desc) = 0; - }; -} - -namespace REX::W32 -{ - using PFN_D3D11_CREATE_DEVICE = HRESULT(__stdcall*)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, std::uint32_t, const D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); - using PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN = HRESULT(__stdcall*)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, std::uint32_t, const D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, const DXGI_SWAP_CHAIN_DESC*, IDXGISwapChain**, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); - - HRESULT D3D11CreateDevice(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept; - HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const DXGI_SWAP_CHAIN_DESC* a_swapChainDesc, IDXGISwapChain** a_swapChain, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Asynchronous{ 0x4B35D0CD, 0x1E15, 0x4258, { 0x9C, 0x98, 0x1B, 0x13, 0x33, 0xF6, 0xDD, 0x3B } }; - inline constexpr IID IID_ID3D11AuthenticatedChannel{ 0x3015A308, 0xDCBD, 0x47AA, { 0xA7, 0x47, 0x19, 0x24, 0x86, 0xD1, 0x4D, 0x4A } }; - inline constexpr IID IID_ID3D11BlendState{ 0x75B68FAA, 0x347D, 0x4159, { 0x8F, 0x45, 0xA0, 0x64, 0x0F, 0x01, 0xCD, 0x9A } }; - inline constexpr IID IID_ID3D11Buffer{ 0x48570B85, 0xD1EE, 0x4FCD, { 0xA2, 0x50, 0xEB, 0x35, 0x07, 0x22, 0xB0, 0x37 } }; - inline constexpr IID IID_ID3D11ClassInstance{ 0xA6CD7FAA, 0xB0B7, 0x4A2F, { 0x94, 0x36, 0x86, 0x62, 0xA6, 0x57, 0x97, 0xCB } }; - inline constexpr IID IID_ID3D11ClassLinkage{ 0xDDF57CBA, 0x9543, 0x46E4, { 0xA1, 0x2B, 0xF2, 0x07, 0xA0, 0xFE, 0x7F, 0xED } }; - inline constexpr IID IID_ID3D11CommandList{ 0xA24BC4D1, 0x769E, 0x43F7, { 0x80, 0x13, 0x98, 0xFF, 0x56, 0x6C, 0x18, 0xE2 } }; - inline constexpr IID IID_ID3D11ComputeShader{ 0x4F5B196E, 0xC2BD, 0x495E, { 0xBD, 0x01, 0x1F, 0xDE, 0xD3, 0x8E, 0x49, 0x69 } }; - inline constexpr IID IID_ID3D11Counter{ 0x6E8C49FB, 0xA371, 0x4770, { 0xB4, 0x40, 0x29, 0x08, 0x60, 0x22, 0xB7, 0x41 } }; - inline constexpr IID IID_ID3D11CryptoSession{ 0x9B32F9AD, 0xBDCC, 0x40A6, { 0xA3, 0x9D, 0xD5, 0xC8, 0x65, 0x84, 0x57, 0x20 } }; - inline constexpr IID IID_ID3D11Device{ 0xDB6F6DDB, 0xAC77, 0x4E88, { 0x82, 0x53, 0x81, 0x9D, 0xF9, 0xBB, 0xF1, 0x40 } }; - inline constexpr IID IID_ID3D11DeviceChild{ 0x1841E5C8, 0x16B0, 0x489B, { 0xBC, 0xC8, 0x44, 0xCF, 0xB0, 0xD5, 0xDE, 0xAE } }; - inline constexpr IID IID_ID3D11DeviceContext{ 0xC0BFA96C, 0xE089, 0x44FB, { 0x8E, 0xAF, 0x26, 0xF8, 0x79, 0x61, 0x90, 0xDA } }; - inline constexpr IID IID_ID3D11DepthStencilState{ 0x03823EFB, 0x8D8F, 0x4E1C, { 0x9A, 0xA2, 0xF6, 0x4B, 0xB2, 0xCB, 0xFD, 0xF1 } }; - inline constexpr IID IID_ID3D11DepthStencilView{ 0x9FDAC92A, 0x1876, 0x48C3, { 0xAF, 0xAD, 0x25, 0xB9, 0x4F, 0x84, 0xA9, 0xB6 } }; - inline constexpr IID IID_ID3D11DomainShader{ 0xF582C508, 0x0F36, 0x490C, { 0x99, 0x77, 0x31, 0xEE, 0xCE, 0x26, 0x8C, 0xFA } }; - inline constexpr IID IID_ID3D11GeometryShader{ 0x38325B96, 0xEFFB, 0x4022, { 0xBA, 0x02, 0x2E, 0x79, 0x5B, 0x70, 0x27, 0x5C } }; - inline constexpr IID IID_ID3D11HullShader{ 0x8E5C6061, 0x628A, 0x4C8E, { 0x82, 0x64, 0xBB, 0xE4, 0x5C, 0xB3, 0xD5, 0xDD } }; - inline constexpr IID IID_ID3D11InputLayout{ 0xE4819DDC, 0x4CF0, 0x4025, { 0xBD, 0x26, 0x5D, 0xE8, 0x2A, 0x3E, 0x07, 0xB7 } }; - inline constexpr IID IID_ID3D11PixelShader{ 0xEA82E40D, 0x51DC, 0x4F33, { 0x93, 0xD4, 0xDB, 0x7C, 0x91, 0x25, 0xAE, 0x8C } }; - inline constexpr IID IID_ID3D11Predicate{ 0x9EB576DD, 0x9F77, 0x4D86, { 0x81, 0xAA, 0x8B, 0xAB, 0x5F, 0xE4, 0x90, 0xE2 } }; - inline constexpr IID IID_ID3D11Query{ 0xD6C00747, 0x87B7, 0x425E, { 0xB8, 0x4D, 0x44, 0xD1, 0x08, 0x56, 0x0A, 0xFD } }; - inline constexpr IID IID_ID3D11RasterizerState{ 0x9BB4AB81, 0xAB1A, 0x4D8F, { 0xB5, 0x06, 0xFC, 0x04, 0x20, 0x0B, 0x6E, 0xE7 } }; - inline constexpr IID IID_ID3D11RenderTargetView{ 0xDFDBA067, 0x0B8D, 0x4865, { 0x87, 0x5B, 0xD7, 0xB4, 0x51, 0x6C, 0xC1, 0x64 } }; - inline constexpr IID IID_ID3D11Resource{ 0xDC8E63F3, 0xD12B, 0x4952, { 0xB4, 0x7B, 0x5E, 0x45, 0x02, 0x6A, 0x86, 0x2D } }; - inline constexpr IID IID_ID3D11SamplerState{ 0xDA6FEA51, 0x564C, 0x4487, { 0x98, 0x10, 0xF0, 0xD0, 0xF9, 0xB4, 0xE3, 0xA5 } }; - inline constexpr IID IID_ID3D11ShaderResourceView{ 0xB0E06FE0, 0x8192, 0x4E1A, { 0xB1, 0xCA, 0x36, 0xD7, 0x41, 0x47, 0x10, 0xB2 } }; - inline constexpr IID IID_ID3D11Texture1D{ 0xF8FB5C27, 0xC6B3, 0x4F75, { 0xA4, 0xC8, 0x43, 0x9A, 0xF2, 0xEF, 0x56, 0x4C } }; - inline constexpr IID IID_ID3D11Texture2D{ 0x6F15AAF2, 0xD208, 0x4E89, { 0x9A, 0xB4, 0x48, 0x95, 0x35, 0xD3, 0x4F, 0x9C } }; - inline constexpr IID IID_ID3D11Texture3D{ 0x037E866E, 0xF56D, 0x4357, { 0xA8, 0xAF, 0x9D, 0xAB, 0xBE, 0x6E, 0x25, 0x0E } }; - inline constexpr IID IID_ID3D11UnorderedAccessView{ 0x28ACF509, 0x7F5C, 0x48F6, { 0x86, 0x11, 0xF3, 0x16, 0x01, 0x0A, 0x63, 0x80 } }; - inline constexpr IID IID_ID3D11VertexShader{ 0x3B301D64, 0xD678, 0x4289, { 0x88, 0x97, 0x22, 0xF8, 0x92, 0x8B, 0x72, 0xF3 } }; - inline constexpr IID IID_ID3D11VideoContext{ 0x61F21C45, 0x3C0E, 0x4A74, { 0x9C, 0xEA, 0x67, 0x10, 0x0D, 0x9A, 0xD5, 0xE4 } }; - inline constexpr IID IID_ID3D11VideoDecoder{ 0x3C9C5B51, 0x995D, 0x48D1, { 0x9B, 0x8D, 0xFA, 0x5C, 0xAE, 0xDE, 0xD6, 0x5C } }; - inline constexpr IID IID_ID3D11VideoDecoderOutputView{ 0xC2931AEA, 0x2A85, 0x4F20, { 0x86, 0x0F, 0xFB, 0xA1, 0xFD, 0x25, 0x6E, 0x18 } }; - inline constexpr IID IID_ID3D11VideoDevice{ 0x10EC4D5B, 0x975A, 0x4689, { 0xB9, 0xE4, 0xD0, 0xAA, 0xC3, 0x0F, 0xE3, 0x33 } }; - inline constexpr IID IID_ID3D11VideoProcessor{ 0x1D7B0652, 0x185F, 0x41C6, { 0x85, 0xCE, 0x0C, 0x5B, 0xE3, 0xD4, 0xAE, 0x6C } }; - inline constexpr IID IID_ID3D11VideoProcessorEnumerator{ 0x31627037, 0x53AB, 0x4200, { 0x90, 0x61, 0x05, 0xFA, 0xA9, 0xAB, 0x45, 0xF9 } }; - inline constexpr IID IID_ID3D11VideoProcessorInputView{ 0x11EC5A5F, 0x51DC, 0x4945, { 0xAB, 0x34, 0x6E, 0x8C, 0x21, 0x30, 0x0E, 0xA5 } }; - inline constexpr IID IID_ID3D11VideoProcessorOutputView{ 0xA048285E, 0x25A9, 0x4527, { 0xBD, 0x93, 0xD6, 0x8B, 0x68, 0xC4, 0x42, 0x54 } }; - inline constexpr IID IID_ID3D11View{ 0x839D1216, 0xBB2E, 0x412B, { 0xB7, 0xF4, 0xA9, 0xDB, 0xEB, 0xE0, 0x8E, 0xD1 } }; -} diff --git a/include/REX/W32/D3D11_1.h b/include/REX/W32/D3D11_1.h deleted file mode 100644 index db1a789df..000000000 --- a/include/REX/W32/D3D11_1.h +++ /dev/null @@ -1,296 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11.h" - -namespace REX::W32 -{ - struct ID3DDeviceContextState; - struct ID3DUserDefinedAnnotation; - struct ID3D11BlendState1; - struct ID3D11Device1; - struct ID3D11DeviceContext1; - struct ID3D11RasterizerState1; - struct ID3D11VideoContext1; - struct ID3D11VideoDevice1; - struct ID3D11VideoProcessorEnumerator1; -} - -namespace REX::W32 -{ - enum D3D11_1_CREATE_DEVICE_CONTEXT_STATE_FLAG - { - D3D11_1_CREATE_DEVICE_CONTEXT_STATE_SINGLETHREADED = 0x1, - }; - - enum D3D11_COPY_FLAGS - { - D3D11_COPY_NO_OVERWRITE = 0x1, - D3D11_COPY_DISCARD = 0x2, - }; - - enum D3D11_CRYPTO_SESSION_STATUS - { - D3D11_CRYPTO_SESSION_STATUS_OK = 0, - D3D11_CRYPTO_SESSION_STATUS_KEY_LOST = 1, - D3D11_CRYPTO_SESSION_STATUS_KEY_AND_CONTENT_LOST = 2, - }; - - enum D3D11_LOGIC_OP - { - D3D11_LOGIC_OP_CLEAR = 0, - D3D11_LOGIC_OP_SET = (D3D11_LOGIC_OP_CLEAR + 1), - D3D11_LOGIC_OP_COPY = (D3D11_LOGIC_OP_SET + 1), - D3D11_LOGIC_OP_COPY_INVERTED = (D3D11_LOGIC_OP_COPY + 1), - D3D11_LOGIC_OP_NOOP = (D3D11_LOGIC_OP_COPY_INVERTED + 1), - D3D11_LOGIC_OP_INVERT = (D3D11_LOGIC_OP_NOOP + 1), - D3D11_LOGIC_OP_AND = (D3D11_LOGIC_OP_INVERT + 1), - D3D11_LOGIC_OP_NAND = (D3D11_LOGIC_OP_AND + 1), - D3D11_LOGIC_OP_OR = (D3D11_LOGIC_OP_NAND + 1), - D3D11_LOGIC_OP_NOR = (D3D11_LOGIC_OP_OR + 1), - D3D11_LOGIC_OP_XOR = (D3D11_LOGIC_OP_NOR + 1), - D3D11_LOGIC_OP_EQUIV = (D3D11_LOGIC_OP_XOR + 1), - D3D11_LOGIC_OP_AND_REVERSE = (D3D11_LOGIC_OP_EQUIV + 1), - D3D11_LOGIC_OP_AND_INVERTED = (D3D11_LOGIC_OP_AND_REVERSE + 1), - D3D11_LOGIC_OP_OR_REVERSE = (D3D11_LOGIC_OP_AND_INVERTED + 1), - D3D11_LOGIC_OP_OR_INVERTED = (D3D11_LOGIC_OP_OR_REVERSE + 1), - }; - - enum D3D11_VIDEO_DECODER_CAPS - { - D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE = 0x1, - D3D11_VIDEO_DECODER_CAPS_NON_REAL_TIME = 0x2, - D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE_DYNAMIC = 0x4, - D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE_REQUIRED = 0x8, - D3D11_VIDEO_DECODER_CAPS_UNSUPPORTED = 0x10, - }; - - enum D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS - { - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_ROTATION = 0x1, - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_RESIZE = 0x2, - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_COLOR_SPACE_CONVERSION = 0x4, - D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_TRIPLE_BUFFER_OUTPUT = 0x8, - }; -} - -namespace REX::W32 -{ - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA; - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA; - struct D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK; - - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_DATA - { - std::uint32_t hwProtectionFunctionID; - D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA* inputData; - D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA* outputData; - HRESULT status; - }; - - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA - { - std::uint32_t privateDataSize; - std::uint32_t hwProtectionDataSize; - std::uint8_t input[4]; - }; - - struct D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA - { - std::uint32_t privateDataSize; - std::uint32_t maxHWProtectionDataSize; - std::uint32_t hwProtectionDataSize; - std::uint64_t transportTime; - std::uint64_t executionTime; - std::uint8_t output[4]; - }; - - struct D3D11_RASTERIZER_DESC1 - { - D3D11_FILL_MODE fillMode; - D3D11_CULL_MODE cullMode; - BOOL frontCounterClockwise; - std::int32_t depthBias; - float depthBiasClamp; - float slopeScaledDepthBias; - BOOL depthClipEnable; - BOOL scissorEnable; - BOOL multisampleEnable; - BOOL antialiasedLineEnable; - std::uint32_t forcedSampleCount; - }; - - struct D3D11_RENDER_TARGET_BLEND_DESC1 - { - BOOL blendEnable; - BOOL logicOpEnable; - D3D11_BLEND srcBlend; - D3D11_BLEND destBlend; - D3D11_BLEND_OP blendOp; - D3D11_BLEND srcBlendAlpha; - D3D11_BLEND destBlendAlpha; - D3D11_BLEND_OP blendOpAlpha; - D3D11_LOGIC_OP logicOp; - std::uint8_t renderTargetWriteMask; - }; - - struct D3D11_VIDEO_DECODER_BEGIN_FRAME_CRYPTO_SESSION - { - ID3D11CryptoSession* cryptoSession; - std::uint32_t blobSize; - void* blob; - GUID* keyInfoId; - std::uint32_t privateDataSize; - void* privateData; - }; - - struct D3D11_VIDEO_DECODER_BUFFER_DESC1 - { - D3D11_VIDEO_DECODER_BUFFER_TYPE bufferType; - std::uint32_t dataOffset; - std::uint32_t dataSize; - void* iv; - std::uint32_t ivSize; - D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK* subSampleMappingBlock; - std::uint32_t subSampleMappingCount; - }; - - struct D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK - { - std::uint32_t clearSize; - std::uint32_t encryptedSize; - }; - - struct D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT - { - BOOL enable; - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - }; - - struct D3D11_VIDEO_SAMPLE_DESC - { - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - DXGI_COLOR_SPACE_TYPE colorSpace; - }; - - struct D3D11_BLEND_DESC1 - { - BOOL alphaToCoverageEnable; - BOOL independentBlendEnable; - D3D11_RENDER_TARGET_BLEND_DESC1 renderTarget[8]; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("5c1e0d8a-7c23-48f9-8c59-a92958ceff11")) - ID3DDeviceContextState : public ID3D11DeviceChild - {}; - - struct __declspec(novtable, uuid("b2daad8b-03d4-4dbf-95eb-32ab4b63d0ab")) - ID3DUserDefinedAnnotation : public IUnknown - { - virtual std::int32_t BeginEvent(const wchar_t* a_name) = 0; - virtual std::int32_t EndEvent(void) = 0; - virtual void SetMarker(const wchar_t* a_name) = 0; - virtual BOOL GetStatus(void) = 0; - }; - - struct __declspec(novtable, uuid("cc86fabe-da55-401d-85e7-e3c9de2877e9")) - ID3D11BlendState1 : public ID3D11BlendState - { - virtual void GetDesc1(D3D11_BLEND_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("a04bfb29-08ef-43d6-a49c-a9bdbdcbe686")) - ID3D11Device1 : public ID3D11Device - { - virtual void GetImmediateContext1(ID3D11DeviceContext1** a_immediateContext) = 0; - virtual HRESULT CreateDeferredContext1(std::uint32_t a_contextFlags, ID3D11DeviceContext1** a_deferredContext) = 0; - virtual HRESULT CreateBlendState1(const D3D11_BLEND_DESC1* a_blendStateDesc, ID3D11BlendState1** a_blendState) = 0; - virtual HRESULT CreateRasterizerState1(const D3D11_RASTERIZER_DESC1* a_rasterizerDesc, ID3D11RasterizerState1** a_rasterizerState) = 0; - virtual HRESULT CreateDeviceContextState(std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const IID& a_emulatedInterface, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3DDeviceContextState** a_contextState) = 0; - virtual HRESULT OpenSharedResource1(HANDLE a_resourceHandle, const IID& a_returnedInterface, void** a_resource) = 0; - virtual HRESULT OpenSharedResourceByName(const wchar_t* a_name, std::uint32_t a_desiredAccess, const IID& a_returnedInterface, void** a_resource) = 0; - }; - - struct __declspec(novtable, uuid("bb2c6faa-b5fb-4082-8e6b-388b8cfa90e1")) - ID3D11DeviceContext1 : public ID3D11DeviceContext - { - virtual void CopySubresourceRegion1(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, std::uint32_t a_dstX, std::uint32_t a_dstY, std::uint32_t a_dstZ, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, const D3D11_BOX* a_srcBox, std::uint32_t a_copyFlags) = 0; - virtual void UpdateSubresource1(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, const D3D11_BOX* a_dstBox, const void* a_srcData, std::uint32_t a_srcRowPitch, std::uint32_t a_srcDepthPitch, std::uint32_t a_copyFlags) = 0; - virtual void DiscardResource(ID3D11Resource* a_resource) = 0; - virtual void DiscardView(ID3D11View* a_resourceView) = 0; - virtual void VSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void HSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void DSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void GSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void PSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void CSSetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer* const* a_constantBuffers, const std::uint32_t* a_firstConstant, const std::uint32_t* a_numConstants) = 0; - virtual void VSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void HSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void DSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void GSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void PSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void CSGetConstantBuffers1(std::uint32_t a_startSlot, std::uint32_t a_numBuffers, ID3D11Buffer** a_constantBuffers, std::uint32_t* a_firstConstant, std::uint32_t* a_numConstants) = 0; - virtual void SwapDeviceContextState(ID3DDeviceContextState* a_state, ID3DDeviceContextState** a_previousState) = 0; - virtual void ClearView(ID3D11View* a_view, const float a_color[4], const D3D11_RECT* a_rect, std::uint32_t a_numRects) = 0; - virtual void DiscardView1(ID3D11View* a_resourceView, const D3D11_RECT* a_rects, std::uint32_t a_numRects) = 0; - }; - - struct __declspec(novtable, uuid("1217d7a6-5039-418c-b042-9cbe256afd6e")) - ID3D11RasterizerState1 : public ID3D11RasterizerState - { - virtual void GetDesc1(D3D11_RASTERIZER_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("A7F026DA-A5F8-4487-A564-15E34357651E")) - ID3D11VideoContext1 : public ID3D11VideoContext - { - virtual HRESULT SubmitDecoderBuffers1(ID3D11VideoDecoder* a_decoder, std::uint32_t a_numBuffers, const D3D11_VIDEO_DECODER_BUFFER_DESC1* a_bufferDesc) = 0; - virtual HRESULT GetDataForNewHardwareKey(ID3D11CryptoSession* a_cryptoSession, std::uint32_t a_privateInputSize, const void* a_privateInputData, std::uint64_t* a_privateOutputData) = 0; - virtual HRESULT CheckCryptoSessionStatus(ID3D11CryptoSession* a_cryptoSession, D3D11_CRYPTO_SESSION_STATUS* a_status) = 0; - virtual HRESULT DecoderEnableDownsampling(ID3D11VideoDecoder* a_decoder, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, const D3D11_VIDEO_SAMPLE_DESC* a_outputDesc, std::uint32_t a_referenceFrameCount) = 0; - virtual HRESULT DecoderUpdateDownsampling(ID3D11VideoDecoder* a_decoder, const D3D11_VIDEO_SAMPLE_DESC* a_outputDesc) = 0; - virtual void VideoProcessorSetOutputColorSpace1(ID3D11VideoProcessor* a_videoProcessor, DXGI_COLOR_SPACE_TYPE a_colorSpace) = 0; - virtual void VideoProcessorSetOutputShaderUsage(ID3D11VideoProcessor* a_videoProcessor, BOOL a_shaderUsage) = 0; - virtual void VideoProcessorGetOutputColorSpace1(ID3D11VideoProcessor* a_videoProcessor, DXGI_COLOR_SPACE_TYPE* a_colorSpace) = 0; - virtual void VideoProcessorGetOutputShaderUsage(ID3D11VideoProcessor* a_videoProcessor, BOOL* a_shaderUsage) = 0; - virtual void VideoProcessorSetStreamColorSpace1(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_COLOR_SPACE_TYPE a_colorSpace) = 0; - virtual void VideoProcessorSetStreamMirror(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL a_enable, BOOL a_flipHorizontal, BOOL a_flipVertical) = 0; - virtual void VideoProcessorGetStreamColorSpace1(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_COLOR_SPACE_TYPE* a_colorSpace) = 0; - virtual void VideoProcessorGetStreamMirror(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, BOOL* a_enable, BOOL* a_flipHorizontal, BOOL* a_flipVertical) = 0; - virtual HRESULT VideoProcessorGetBehaviorHints(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_outputWidth, std::uint32_t a_outputHeight, DXGI_FORMAT a_outputFormat, std::uint32_t a_streamCount, const D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT* a_streams, std::uint32_t* a_behaviorHints) = 0; - }; - - struct __declspec(novtable, uuid("29DA1D51-1321-4454-804B-F5FC9F861F0F")) - ID3D11VideoDevice1 : public ID3D11VideoDevice - { - virtual HRESULT GetCryptoSessionPrivateDataSize(const GUID* a_cryptoType, const GUID* a_decoderProfile, const GUID* a_keyExchangeType, std::uint32_t* a_privateInputSize, std::uint32_t* a_privateOutputSize) = 0; - virtual HRESULT GetVideoDecoderCaps(const GUID* a_decoderProfile, std::uint32_t a_sampleWidth, std::uint32_t a_sampleHeight, const DXGI_RATIONAL* a_frameRate, std::uint32_t a_bitRate, const GUID* a_cryptoType, std::uint32_t* a_decoderCaps) = 0; - virtual HRESULT CheckVideoDecoderDownsampling(const D3D11_VIDEO_DECODER_DESC* a_inputDesc, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, const D3D11_VIDEO_DECODER_CONFIG* a_inputConfig, const DXGI_RATIONAL* a_frameRate, const D3D11_VIDEO_SAMPLE_DESC* a_outputDesc, BOOL* a_supported, BOOL* a_realTimeHint) = 0; - virtual HRESULT RecommendVideoDecoderDownsampleParameters(const D3D11_VIDEO_DECODER_DESC* a_inputDesc, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, const D3D11_VIDEO_DECODER_CONFIG* a_inputConfig, const DXGI_RATIONAL* a_frameRate, D3D11_VIDEO_SAMPLE_DESC* a_recommendedOutputDesc) = 0; - }; - - struct __declspec(novtable, uuid("465217F2-5568-43CF-B5B9-F61D54531CA1")) - ID3D11VideoProcessorEnumerator1 : public ID3D11VideoProcessorEnumerator - { - virtual HRESULT CheckVideoProcessorFormatConversion(DXGI_FORMAT a_inputFormat, DXGI_COLOR_SPACE_TYPE a_inputColorSpace, DXGI_FORMAT a_outputFormat, DXGI_COLOR_SPACE_TYPE a_outputColorSpace, BOOL* a_supported) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3DDeviceContextState{ 0x5C1E0D8A, 0x7C23, 0x48F9, { 0x8C, 0x59, 0xA9, 0x29, 0x58, 0xCE, 0xFF, 0x11 } }; - inline constexpr IID IID_ID3DUserDefinedAnnotation{ 0xB2DAAD8B, 0x03D4, 0x4DBF, { 0x95, 0xEB, 0x32, 0xAB, 0x4B, 0x63, 0xD0, 0xAB } }; - inline constexpr IID IID_ID3D11BlendState1{ 0xCC86FABE, 0xDA55, 0x401D, { 0x85, 0xE7, 0xE3, 0xC9, 0xDE, 0x28, 0x77, 0xE9 } }; - inline constexpr IID IID_ID3D11Device1{ 0xA04BFB29, 0x08EF, 0x43D6, { 0xA4, 0x9C, 0xA9, 0xBD, 0xBD, 0xCB, 0xE6, 0x86 } }; - inline constexpr IID IID_ID3D11DeviceContext1{ 0xBB2C6FAA, 0xB5FB, 0x4082, { 0x8E, 0x6B, 0x38, 0x8B, 0x8C, 0xFA, 0x90, 0xE1 } }; - inline constexpr IID IID_ID3D11RasterizerState1{ 0x1217D7A6, 0x5039, 0x418C, { 0xB0, 0x42, 0x9C, 0xBE, 0x25, 0x6A, 0xFD, 0x6E } }; - inline constexpr IID IID_ID3D11VideoContext1{ 0xA7F026DA, 0xA5F8, 0x4487, { 0xA5, 0x64, 0x15, 0xE3, 0x43, 0x57, 0x65, 0x1E } }; - inline constexpr IID IID_ID3D11VideoDevice1{ 0x29DA1D51, 0x1321, 0x4454, { 0x80, 0x4B, 0xF5, 0xFC, 0x9F, 0x86, 0x1F, 0x0F } }; - inline constexpr IID IID_ID3D11VideoProcessorEnumerator1{ 0x465217F2, 0x5568, 0x43CF, { 0xB5, 0xB9, 0xF6, 0x1D, 0x54, 0x53, 0x1C, 0xA1 } }; -} diff --git a/include/REX/W32/D3D11_2.h b/include/REX/W32/D3D11_2.h deleted file mode 100644 index 084532a3b..000000000 --- a/include/REX/W32/D3D11_2.h +++ /dev/null @@ -1,112 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11_1.h" - -namespace REX::W32 -{ - struct ID3D11Device2; - struct ID3D11DeviceContext2; -} - -namespace REX::W32 -{ - enum D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_FLAG - { - D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_TILED_RESOURCE = 0x1, - }; - - enum D3D11_TILE_COPY_FLAG - { - D3D11_TILE_COPY_NO_OVERWRITE = 0x1, - D3D11_TILE_COPY_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, - D3D11_TILE_COPY_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4, - }; - - enum D3D11_TILE_MAPPING_FLAG - { - D3D11_TILE_MAPPING_NO_OVERWRITE = 0x1, - }; - - enum D3D11_TILE_RANGE_FLAG - { - D3D11_TILE_RANGE_NULL = 0x1, - D3D11_TILE_RANGE_SKIP = 0x2, - D3D11_TILE_RANGE_REUSE_SINGLE_TILE = 0x4, - }; -} - -namespace REX::W32 -{ - struct D3D11_PACKED_MIP_DESC - { - std::uint8_t numStandardMips; - std::uint8_t numPackedMips; - std::uint32_t numTilesForPackedMips; - std::uint32_t startTileIndexInOverallResource; - }; - - struct D3D11_SUBRESOURCE_TILING - { - std::uint32_t widthInTiles; - std::uint16_t heightInTiles; - std::uint16_t depthInTiles; - std::uint32_t startTileIndexInOverallResource; - }; - - struct D3D11_TILED_RESOURCE_COORDINATE - { - std::uint32_t x; - std::uint32_t y; - std::uint32_t z; - std::uint32_t subResource; - }; - - struct D3D11_TILE_REGION_SIZE - { - std::uint32_t numTiles; - BOOL bUseBox; - std::uint32_t width; - std::uint16_t height; - std::uint16_t depth; - }; - - struct D3D11_TILE_SHAPE - { - std::uint32_t widthInTexels; - std::uint32_t heightInTexels; - std::uint32_t depthInTexels; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("9d06dffa-d1e5-4d07-83a8-1bb123f2f841")) - ID3D11Device2 : public ID3D11Device1 - { - virtual void GetImmediateContext2(ID3D11DeviceContext2** a_immediateContext) = 0; - virtual HRESULT CreateDeferredContext2(std::uint32_t a_contextFlags, ID3D11DeviceContext2** a_deferredContext) = 0; - virtual void GetResourceTiling(ID3D11Resource* a_tiledResource, std::uint32_t* a_numTilesForEntireResource, D3D11_PACKED_MIP_DESC* a_packedMipDesc, D3D11_TILE_SHAPE* a_standardTileShapeForNonPackedMips, std::uint32_t* a_numSubresourceTilings, std::uint32_t a_firstSubResourceTilingToGet, D3D11_SUBRESOURCE_TILING* a_subResourceTilingsForNonPackedMips) = 0; - virtual HRESULT CheckMultisampleQualityLevels1(DXGI_FORMAT a_format, std::uint32_t a_sampleCount, std::uint32_t a_flags, std::uint32_t* a_numQualityLevels) = 0; - }; - - struct __declspec(novtable, uuid("420d5b32-b90c-4da4-bef0-359f6a24a83a")) - ID3D11DeviceContext2 : public ID3D11DeviceContext1 - { - virtual HRESULT UpdateTileMappings(ID3D11Resource* a_tiledResource, std::uint32_t numTiledResourceRegions, const D3D11_TILED_RESOURCE_COORDINATE* a_tiledResourceRegionStartCoordinates, const D3D11_TILE_REGION_SIZE* a_tiledResourceRegionSizes, ID3D11Buffer* a_tilePool, std::uint32_t a_numRanges, const std::uint32_t* a_rangeFlags, const std::uint32_t* a_tilePoolStartOffsets, const std::uint32_t* a_rangeTileCounts, std::uint32_t a_flags) = 0; - virtual HRESULT CopyTileMappings(ID3D11Resource* a_destTiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_destRegionStartCoordinate, ID3D11Resource* a_sourceTiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_sourceRegionStartCoordinate, const D3D11_TILE_REGION_SIZE* a_tileRegionSize, std::uint32_t a_flags) = 0; - virtual void CopyTiles(ID3D11Resource* a_tiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_tileRegionStartCoordinate, const D3D11_TILE_REGION_SIZE* a_tileRegionSize, ID3D11Buffer* a_buffer, std::uint64_t a_bufferStartOffsetInBytes, std::uint32_t a_flags) = 0; - virtual void UpdateTiles(ID3D11Resource* a_destTiledResource, const D3D11_TILED_RESOURCE_COORDINATE* a_destTileRegionStartCoordinate, const D3D11_TILE_REGION_SIZE* a_destTileRegionSize, const void* a_sourceTileData, std::uint32_t a_flags) = 0; - virtual HRESULT ResizeTilePool(ID3D11Buffer* a_tilePool, std::uint64_t a_newSizeInBytes) = 0; - virtual void TiledResourceBarrier(ID3D11DeviceChild* a_tiledResourceOrViewAccessBeforeBarrier, ID3D11DeviceChild* a_tiledResourceOrViewAccessAfterBarrier) = 0; - virtual BOOL IsAnnotationEnabled(void) = 0; - virtual void SetMarkerInt(const wchar_t* a_label, std::int32_t a_data) = 0; - virtual void BeginEventInt(const wchar_t* a_label, std::int32_t a_data) = 0; - virtual void EndEvent(void) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Device2{ 0x9D06DFFA, 0xD1E5, 0x4D07, { 0x83, 0xA8, 0x1B, 0xB1, 0x23, 0xF2, 0xF8, 0x41 } }; - inline constexpr IID IID_ID3D11DeviceContext2{ 0x420D5B32, 0xB90C, 0x4DA4, { 0xBE, 0xF0, 0x35, 0x9F, 0x6A, 0x24, 0xA8, 0x3A } }; -} diff --git a/include/REX/W32/D3D11_3.h b/include/REX/W32/D3D11_3.h deleted file mode 100644 index aa066d952..000000000 --- a/include/REX/W32/D3D11_3.h +++ /dev/null @@ -1,301 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11_2.h" - -namespace REX::W32 -{ - struct ID3D11Device3; - struct ID3D11DeviceContext3; - struct ID3D11DeviceContext4; - struct ID3D11Fence; - struct ID3D11Query1; - struct ID3D11RasterizerState2; - struct ID3D11RenderTargetView1; - struct ID3D11ShaderResourceView1; - struct ID3D11Texture2D1; - struct ID3D11Texture3D1; - struct ID3D11UnorderedAccessView1; -} - -namespace REX::W32 -{ - enum D3D11_CONSERVATIVE_RASTERIZATION_MODE - { - D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF = 0, - D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON = 1, - }; - - enum D3D11_CONTEXT_TYPE - { - D3D11_CONTEXT_TYPE_ALL = 0, - D3D11_CONTEXT_TYPE_3D = 1, - D3D11_CONTEXT_TYPE_COMPUTE = 2, - D3D11_CONTEXT_TYPE_COPY = 3, - D3D11_CONTEXT_TYPE_VIDEO = 4, - }; - - enum D3D11_FENCE_FLAG - { - D3D11_FENCE_FLAG_NONE = 0, - D3D11_FENCE_FLAG_SHARED = 0x2, - D3D11_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x4, - D3D11_FENCE_FLAG_NON_MONITORED = 0x8, - }; - - enum D3D11_TEXTURE_LAYOUT - { - D3D11_TEXTURE_LAYOUT_UNDEFINED = 0, - D3D11_TEXTURE_LAYOUT_ROW_MAJOR = 1, - D3D11_TEXTURE_LAYOUT_64K_STANDARD_SWIZZLE = 2, - }; -} - -namespace REX::W32 -{ - struct D3D11_TEX2D_ARRAY_RTV1 - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_ARRAY_SRV1 - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_ARRAY_UAV1 - { - std::uint32_t mipSlice; - std::uint32_t firstArraySlice; - std::uint32_t arraySize; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_RTV1 - { - std::uint32_t mipSlice; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_SRV1 - { - std::uint32_t mostDetailedMip; - std::uint32_t mipLevels; - std::uint32_t planeSlice; - }; - - struct D3D11_TEX2D_UAV1 - { - std::uint32_t mipSlice; - std::uint32_t planeSlice; - }; - - struct D3D11_QUERY_DESC1 - { - D3D11_QUERY query; - std::uint32_t miscFlags; - D3D11_CONTEXT_TYPE contextType; - }; - - struct D3D11_RASTERIZER_DESC2 - { - D3D11_FILL_MODE fillMode; - D3D11_CULL_MODE cullMode; - BOOL frontCounterClockwise; - std::int32_t depthBias; - float depthBiasClamp; - float slopeScaledDepthBias; - BOOL depthClipEnable; - BOOL scissorEnable; - BOOL multisampleEnable; - BOOL antialiasedLineEnable; - std::uint32_t forcedSampleCount; - D3D11_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster; - }; - - struct D3D11_RENDER_TARGET_VIEW_DESC1 - { - DXGI_FORMAT format; - D3D11_RTV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_RTV buffer; - D3D11_TEX1D_RTV texture1D; - D3D11_TEX1D_ARRAY_RTV texture1DArray; - D3D11_TEX2D_RTV1 texture2D; - D3D11_TEX2D_ARRAY_RTV1 texture2DArray; - D3D11_TEX2DMS_RTV texture2DMS; - D3D11_TEX2DMS_ARRAY_RTV texture2DMSArray; - D3D11_TEX3D_RTV texture3D; - }; - }; - - struct D3D11_TEXTURE2D_DESC1 - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t mipLevels; - std::uint32_t arraySize; - DXGI_FORMAT format; - DXGI_SAMPLE_DESC sampleDesc; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - D3D11_TEXTURE_LAYOUT textureLayout; - }; - - struct D3D11_TEXTURE3D_DESC1 - { - std::uint32_t width; - std::uint32_t height; - std::uint32_t depth; - std::uint32_t mipLevels; - DXGI_FORMAT format; - D3D11_USAGE usage; - std::uint32_t bindFlags; - std::uint32_t cpuAccessFlags; - std::uint32_t miscFlags; - D3D11_TEXTURE_LAYOUT textureLayout; - }; - - struct D3D11_SHADER_RESOURCE_VIEW_DESC1 - { - DXGI_FORMAT format; - D3D11_SRV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_SRV buffer; - D3D11_TEX1D_SRV texture1D; - D3D11_TEX1D_ARRAY_SRV texture1DArray; - D3D11_TEX2D_SRV1 texture2D; - D3D11_TEX2D_ARRAY_SRV1 texture2DArray; - D3D11_TEX2DMS_SRV texture2DMS; - D3D11_TEX2DMS_ARRAY_SRV texture2DMSArray; - D3D11_TEX3D_SRV texture3D; - D3D11_TEXCUBE_SRV textureCube; - D3D11_TEXCUBE_ARRAY_SRV textureCubeArray; - D3D11_BUFFEREX_SRV bufferEx; - }; - }; - - struct D3D11_UNORDERED_ACCESS_VIEW_DESC1 - { - DXGI_FORMAT format; - D3D11_UAV_DIMENSION viewDimension; - union - { - D3D11_BUFFER_UAV buffer; - D3D11_TEX1D_UAV texture1D; - D3D11_TEX1D_ARRAY_UAV texture1DArray; - D3D11_TEX2D_UAV1 texture2D; - D3D11_TEX2D_ARRAY_UAV1 texture2DArray; - D3D11_TEX3D_UAV texture3D; - }; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("A05C8C37-D2C6-4732-B3A0-9CE0B0DC9AE6")) - ID3D11Device3 : public ID3D11Device2 - { - virtual HRESULT CreateTexture2D1(const D3D11_TEXTURE2D_DESC1* a_desc1, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture2D1** a_texture2D) = 0; - virtual HRESULT CreateTexture3D1(const D3D11_TEXTURE3D_DESC1* a_desc1, const D3D11_SUBRESOURCE_DATA* a_initialData, ID3D11Texture3D1** a_texture3D) = 0; - virtual HRESULT CreateRasterizerState2(const D3D11_RASTERIZER_DESC2* a_rasterizerDesc, ID3D11RasterizerState2** a_rasterizerState) = 0; - virtual HRESULT CreateShaderResourceView1(ID3D11Resource* a_resource, const D3D11_SHADER_RESOURCE_VIEW_DESC1* a_desc1, ID3D11ShaderResourceView1** a_srView1) = 0; - virtual HRESULT CreateUnorderedAccessView1(ID3D11Resource* a_resource, const D3D11_UNORDERED_ACCESS_VIEW_DESC1* a_desc1, ID3D11UnorderedAccessView1** a_uaView1) = 0; - virtual HRESULT CreateRenderTargetView1(ID3D11Resource* a_resource, const D3D11_RENDER_TARGET_VIEW_DESC1* a_desc1, ID3D11RenderTargetView1** a_rtView1) = 0; - virtual HRESULT CreateQuery1(const D3D11_QUERY_DESC1* a_queryDesc1, ID3D11Query1** a_query1) = 0; - virtual void GetImmediateContext3(ID3D11DeviceContext3** a_immediateContext) = 0; - virtual HRESULT CreateDeferredContext3(std::uint32_t a_contextFlags, ID3D11DeviceContext3** a_deferredContext) = 0; - virtual void WriteToSubresource(ID3D11Resource* a_dstResource, std::uint32_t a_dstSubresource, const D3D11_BOX* a_dstBox, const void* a_srcData, std::uint32_t a_srcRowPitch, std::uint32_t a_srcDepthPitch) = 0; - virtual void ReadFromSubresource(void* a_dstData, std::uint32_t a_dstRowPitch, std::uint32_t a_dstDepthPitch, ID3D11Resource* a_srcResource, std::uint32_t a_srcSubresource, const D3D11_BOX* a_srcBox) = 0; - }; - - struct __declspec(novtable, uuid("b4e3c01d-e79e-4637-91b2-510e9f4c9b8f")) - ID3D11DeviceContext3 : public ID3D11DeviceContext2 - { - virtual void Flush1(D3D11_CONTEXT_TYPE a_contextType, HANDLE a_event) = 0; - virtual void SetHardwareProtectionState(BOOL a_hwProtectionEnable) = 0; - virtual void GetHardwareProtectionState(BOOL* a_hwProtectionEnable) = 0; - }; - - struct __declspec(novtable, uuid("917600da-f58c-4c33-98d8-3e15b390fa24")) - ID3D11DeviceContext4 : public ID3D11DeviceContext3 - { - virtual HRESULT Signal(ID3D11Fence* a_fence, std::uint64_t a_value) = 0; - virtual HRESULT Wait(ID3D11Fence* a_fence, std::uint64_t a_value) = 0; - }; - - struct __declspec(novtable, uuid("affde9d1-1df7-4bb7-8a34-0f46251dab80")) - ID3D11Fence : public ID3D11DeviceChild - { - virtual HRESULT CreateSharedHandle(const SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_access, const wchar_t* a_name, HANDLE* a_handle) = 0; - virtual std::uint64_t GetCompletedValue(void) = 0; - virtual HRESULT SetEventOnCompletion(std::uint64_t a_value, HANDLE a_event) = 0; - }; - - struct __declspec(novtable, uuid("631b4766-36dc-461d-8db6-c47e13e60916")) - ID3D11Query1 : public ID3D11Query - { - virtual void GetDesc1(D3D11_QUERY_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("6fbd02fb-209f-46c4-b059-2ed15586a6ac")) - ID3D11RasterizerState2 : public ID3D11RasterizerState1 - { - virtual void GetDesc2(D3D11_RASTERIZER_DESC2* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("ffbe2e23-f011-418a-ac56-5ceed7c5b94b")) - ID3D11RenderTargetView1 : public ID3D11RenderTargetView - { - virtual void GetDesc1(D3D11_RENDER_TARGET_VIEW_DESC1* a_desc1) = 0; - }; - - struct __declspec(novtable, uuid("91308b87-9040-411d-8c67-c39253ce3802")) - ID3D11ShaderResourceView1 : public ID3D11ShaderResourceView - { - virtual void GetDesc1(D3D11_SHADER_RESOURCE_VIEW_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("51218251-1E33-4617-9CCB-4D3A4367E7BB")) - ID3D11Texture2D1 : public ID3D11Texture2D - { - virtual void GetDesc1(D3D11_TEXTURE2D_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("0C711683-2853-4846-9BB0-F3E60639E46A")) - ID3D11Texture3D1 : public ID3D11Texture3D - { - virtual void GetDesc1(D3D11_TEXTURE3D_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("7b3b6153-a886-4544-ab37-6537c8500403")) - ID3D11UnorderedAccessView1 : public ID3D11UnorderedAccessView - { - virtual void GetDesc1(D3D11_UNORDERED_ACCESS_VIEW_DESC1* a_desc) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Device3{ 0xA05C8C37, 0xD2C6, 0x4732, { 0xB3, 0xA0, 0x9C, 0xE0, 0xB0, 0xDC, 0x9A, 0xE6 } }; - inline constexpr IID IID_ID3D11DeviceContext3{ 0xB4E3C01D, 0xE79E, 0x4637, { 0x91, 0xB2, 0x51, 0x0E, 0x9F, 0x4C, 0x9B, 0x8F } }; - inline constexpr IID IID_ID3D11DeviceContext4{ 0x917600DA, 0xF58C, 0x4C33, { 0x98, 0xD8, 0x3E, 0x15, 0xB3, 0x90, 0xFA, 0x24 } }; - inline constexpr IID IID_ID3D11Fence{ 0xAFFDE9D1, 0x1DF7, 0x4BB7, { 0x8A, 0x34, 0x0F, 0x46, 0x25, 0x1D, 0xAB, 0x80 } }; - inline constexpr IID IID_ID3D11Query1{ 0x631B4766, 0x36DC, 0x461D, { 0x8D, 0xB6, 0xC4, 0x7E, 0x13, 0xE6, 0x09, 0x16 } }; - inline constexpr IID IID_ID3D11RasterizerState2{ 0x6FBD02FB, 0x209F, 0x46C4, { 0xb0, 0x59, 0x2E, 0xD1, 0x55, 0x86, 0xA6, 0xAC } }; - inline constexpr IID IID_ID3D11RenderTargetView1{ 0xFFBE2E23, 0xF011, 0x418A, { 0xAC, 0x56, 0x5C, 0xEE, 0xD7, 0xC5, 0xB9, 0x4B } }; - inline constexpr IID IID_ID3D11ShaderResourceView1{ 0x91308B87, 0x9040, 0x411D, { 0x8C, 0x67, 0xC3, 0x92, 0x53, 0xCE, 0x38, 0x02 } }; - inline constexpr IID IID_ID3D11Texture2D1{ 0x51218251, 0x1E33, 0x4617, { 0x9C, 0xCB, 0x4D, 0x3A, 0x43, 0x67, 0xE7, 0xBB } }; - inline constexpr IID IID_ID3D11Texture3D1{ 0x0C711683, 0x2853, 0x4846, { 0x9B, 0xB0, 0xF3, 0xE6, 0x06, 0x39, 0xE4, 0x6A } }; - inline constexpr IID IID_ID3D11UnorderedAccessView1{ 0x7B3B6153, 0xA886, 0x4544, { 0xAB, 0x37, 0x65, 0x37, 0xC8, 0x50, 0x04, 0x03 } }; -} diff --git a/include/REX/W32/D3D11_4.h b/include/REX/W32/D3D11_4.h deleted file mode 100644 index f8034dd2c..000000000 --- a/include/REX/W32/D3D11_4.h +++ /dev/null @@ -1,138 +0,0 @@ -#pragma once - -#include "REX/W32/D3D11_3.h" -#include "REX/W32/DXGI_5.h" - -namespace REX::W32 -{ - struct ID3D11Device4; - struct ID3D11Device5; - struct ID3D11Multithread; - struct ID3D11VideoContext2; - struct ID3D11VideoContext3; - struct ID3D11VideoDevice2; -} - -namespace REX::W32 -{ - enum D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS - { - D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAG_NONE = 0, - }; - - enum D3D11_FEATURE_VIDEO - { - D3D11_FEATURE_VIDEO_DECODER_HISTOGRAM = 0, - }; - - enum D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT - { - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_Y = 0, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_U = 1, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_V = 2, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_R = 0, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_G = 1, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_B = 2, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_A = 3, - }; - - enum D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS - { - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_NONE = 0, - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_Y = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_Y), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_U = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_U), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_V = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_V), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_R = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_R), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_G = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_G), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_B = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_B), - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_A = (1 << D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_A), - }; -} - -namespace REX::W32 -{ - struct D3D11_FEATURE_DATA_D3D11_OPTIONS4 - { - BOOL extendedNV12SharedTextureSupported; - }; - - struct D3D11_FEATURE_DATA_VIDEO_DECODER_HISTOGRAM - { - D3D11_VIDEO_DECODER_DESC decoderDesc; - D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS components; - std::uint32_t binCount; - std::uint32_t counterBitDepth; - }; - - struct D3D11_VIDEO_DECODER_BUFFER_DESC2 - { - D3D11_VIDEO_DECODER_BUFFER_TYPE bufferType; - std::uint32_t dataOffset; - std::uint32_t dataSize; - void* iv; - std::uint32_t ivSize; - D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK* subSampleMappingBlock; - std::uint32_t subSampleMappingCount; - std::uint32_t cBlocksStripeEncrypted; - std::uint32_t cBlocksStripeClear; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("8992ab71-02e6-4b8d-ba48-b056dcda42c4")) - ID3D11Device4 : public ID3D11Device3 - { - virtual HRESULT RegisterDeviceRemovedEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterDeviceRemoved(std::uint32_t a_cookie) = 0; - }; - - struct __declspec(novtable, uuid("8ffde202-a0e7-45df-9e01-e837801b5ea0")) - ID3D11Device5 : public ID3D11Device4 - { - virtual HRESULT OpenSharedFence(HANDLE a_fenceHandle, const IID& a_returnedInterface, void** a_fence) = 0; - virtual HRESULT CreateFence(std::uint64_t a_initialValue, D3D11_FENCE_FLAG a_flags, const IID& a_returnedInterface, void** a_fence) = 0; - }; - - struct __declspec(novtable, uuid("9B7E4E00-342C-4106-A19F-4F2704F689F0")) - ID3D11Multithread : public IUnknown - { - virtual void Enter(void) = 0; - virtual void Leave(void) = 0; - virtual BOOL SetMultithreadProtected(BOOL a_mtProtect) = 0; - virtual BOOL GetMultithreadProtected(void) = 0; - }; - - struct __declspec(novtable, uuid("C4E7374C-6243-4D1B-AE87-52B4F740E261")) - ID3D11VideoContext2 : public ID3D11VideoContext1 - { - virtual void VideoProcessorSetOutputHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, DXGI_HDR_METADATA_TYPE a_type, std::uint32_t a_size, const void* a_hdrMetaData) = 0; - virtual void VideoProcessorGetOutputHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, DXGI_HDR_METADATA_TYPE* a_type, std::uint32_t a_size, void* a_hdrMetaData) = 0; - virtual void VideoProcessorSetStreamHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_HDR_METADATA_TYPE a_type, std::uint32_t a_size, const void* a_hdrMetaData) = 0; - virtual void VideoProcessorGetStreamHDRMetaData(ID3D11VideoProcessor* a_videoProcessor, std::uint32_t a_streamIndex, DXGI_HDR_METADATA_TYPE* a_type, std::uint32_t a_size, void* a_hdrMetaData) = 0; - }; - - struct __declspec(novtable, uuid("A9E2FAA0-CB39-418F-A0B7-D8AAD4DE672E")) - ID3D11VideoContext3 : public ID3D11VideoContext2 - { - virtual HRESULT DecoderBeginFrame1(ID3D11VideoDecoder* a_decoder, ID3D11VideoDecoderOutputView* a_view, std::uint32_t a_contentKeySize, const void* a_contentKey, std::uint32_t a_numComponentHistograms, const std::uint32_t* a_histogramOffsets, ID3D11Buffer* const* a_histogramBuffers) = 0; - virtual HRESULT SubmitDecoderBuffers2(ID3D11VideoDecoder* a_decoder, std::uint32_t a_numBuffers, const D3D11_VIDEO_DECODER_BUFFER_DESC2* a_bufferDesc) = 0; - }; - - struct __declspec(novtable, uuid("59C0CB01-35F0-4A70-8F67-87905C906A53")) - ID3D11VideoDevice2 : public ID3D11VideoDevice1 - { - virtual HRESULT CheckFeatureSupport(D3D11_FEATURE_VIDEO a_feature, void* a_featureSupportData, std::uint32_t a_featureSupportDataSize) = 0; - virtual HRESULT NegotiateCryptoSessionKeyExchangeMT(ID3D11CryptoSession* a_cryptoSession, D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS a_flags, std::uint32_t a_dataSize, void* a_data) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_ID3D11Device4{ 0x8992AB71, 0x02E6, 0x4B8D, { 0xBA, 0x48, 0xB0, 0x56, 0xDC, 0xDA, 0x42, 0xC4 } }; - inline constexpr IID IID_ID3D11Device5{ 0x8FFDE202, 0xA0E7, 0x45DF, { 0x9E, 0x01, 0xE8, 0x37, 0x80, 0x1B, 0x5E, 0xA0 } }; - inline constexpr IID IID_ID3D11Multithread{ 0x9B7E4E00, 0x342C, 0x4106, { 0xA1, 0x9F, 0x4F, 0x27, 0x04, 0xF6, 0x89, 0xF0 } }; - inline constexpr IID IID_ID3D11VideoContext2{ 0xC4E7374C, 0x6243, 0x4D1B, { 0xAE, 0x87, 0x52, 0xB4, 0xF7, 0x40, 0xE2, 0x61 } }; - inline constexpr IID IID_ID3D11VideoContext3{ 0xA9E2FAA0, 0xCB39, 0x418F, { 0xA0, 0xB7, 0xD8, 0xAA, 0xD4, 0xDE, 0x67, 0x2E } }; - inline constexpr IID IID_ID3D11VideoDevice2{ 0x59C0CB01, 0x35F0, 0x4A70, { 0x8F, 0x67, 0x87, 0x90, 0x5C, 0x90, 0x6A, 0x53 } }; -} diff --git a/include/REX/W32/D3DCOMPILER.h b/include/REX/W32/D3DCOMPILER.h deleted file mode 100644 index 0cca3be73..000000000 --- a/include/REX/W32/D3DCOMPILER.h +++ /dev/null @@ -1,154 +0,0 @@ -#pragma once - -#include "REX/W32/D3D.h" - -namespace REX::W32 -{ - struct ID3DBlob; - struct ID3DInclude; - struct ID3D10Effect; - struct ID3D11FunctionLinkingGraph; - struct ID3D11Linker; - struct ID3D11Module; -} - -namespace REX::W32 -{ - enum D3D_BLOB_PART - { - D3D_BLOB_INPUT_SIGNATURE_BLOB, - D3D_BLOB_OUTPUT_SIGNATURE_BLOB, - D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, - D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, - D3D_BLOB_ALL_SIGNATURE_BLOB, - D3D_BLOB_DEBUG_INFO, - D3D_BLOB_LEGACY_SHADER, - D3D_BLOB_XNA_PREPASS_SHADER, - D3D_BLOB_XNA_SHADER, - D3D_BLOB_PDB, - D3D_BLOB_PRIVATE_DATA, - D3D_BLOB_ROOT_SIGNATURE, - D3D_BLOB_DEBUG_NAME, - D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000, - D3D_BLOB_TEST_COMPILE_DETAILS, - D3D_BLOB_TEST_COMPILE_PERF, - D3D_BLOB_TEST_COMPILE_REPORT, - }; - - enum D3D_DISASM_FLAGS - { - D3D_DISASM_ENABLE_COLOR_CODE = 0x00000001, - D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS = 0x00000002, - D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING = 0x00000004, - D3D_DISASM_ENABLE_INSTRUCTION_CYCLE = 0x00000008, - D3D_DISASM_DISABLE_DEBUG_INFO = 0x00000010, - D3D_DISASM_ENABLE_INSTRUCTION_OFFSET = 0x00000020, - D3D_DISASM_INSTRUCTION_ONLY = 0x00000040, - D3D_DISASM_PRINT_HEX_LITERALS = 0x00000080, - }; - - enum D3DCOMPILE_EFFECT - { - D3DCOMPILE_EFFECT_CHILD_EFFECT = (1 << 0), - D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS = (1 << 1), - }; - - enum D3DCOMPILE_FLAGS - { - D3DCOMPILE_DEBUG = (1 << 0), - D3DCOMPILE_SKIP_VALIDATION = (1 << 1), - D3DCOMPILE_SKIP_OPTIMIZATION = (1 << 2), - D3DCOMPILE_PACK_MATRIX_ROW_MAJOR = (1 << 3), - D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR = (1 << 4), - D3DCOMPILE_PARTIAL_PRECISION = (1 << 5), - D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT = (1 << 6), - D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT = (1 << 7), - D3DCOMPILE_NO_PRESHADER = (1 << 8), - D3DCOMPILE_AVOID_FLOW_CONTROL = (1 << 9), - D3DCOMPILE_PREFER_FLOW_CONTROL = (1 << 10), - D3DCOMPILE_ENABLE_STRICTNESS = (1 << 11), - D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY = (1 << 12), - D3DCOMPILE_IEEE_STRICTNESS = (1 << 13), - D3DCOMPILE_OPTIMIZATION_LEVEL0 = (1 << 14), - D3DCOMPILE_OPTIMIZATION_LEVEL1 = 0, - D3DCOMPILE_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15)), - D3DCOMPILE_OPTIMIZATION_LEVEL3 = (1 << 15), - D3DCOMPILE_RESERVED16 = (1 << 16), - D3DCOMPILE_RESERVED17 = (1 << 17), - D3DCOMPILE_WARNINGS_ARE_ERRORS = (1 << 18), - D3DCOMPILE_RESOURCES_MAY_ALIAS = (1 << 19), - D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES = (1 << 20), - D3DCOMPILE_ALL_RESOURCES_BOUND = (1 << 21), - D3DCOMPILE_DEBUG_NAME_FOR_SOURCE = (1 << 22), - D3DCOMPILE_DEBUG_NAME_FOR_BINARY = (1 << 23), - }; - - enum D3DCOMPILE_FLAGS2 - { - D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST = 0, - D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 = (1 << 4), - D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 = (1 << 5), - }; - - enum D3DCOMPILE_SECDATA_FLAGS - { - D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS = 0x00000001, - D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS = 0x00000002, - D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH = 0x00000004, - }; - - enum D3DCOMPILER_STRIP_FLAGS - { - D3DCOMPILER_STRIP_REFLECTION_DATA = 0x00000001, - D3DCOMPILER_STRIP_DEBUG_INFO = 0x00000002, - D3DCOMPILER_STRIP_TEST_BLOBS = 0x00000004, - D3DCOMPILER_STRIP_PRIVATE_DATA = 0x00000008, - D3DCOMPILER_STRIP_ROOT_SIGNATURE = 0x00000010, - D3DCOMPILER_STRIP_FORCE_DWORD = 0x7FFFFFFF, - }; -} - -namespace REX::W32 -{ - struct D3D_SHADER_DATA - { - const void* bytecode; - std::size_t bytecodeLength; - }; -} - -namespace REX::W32 -{ - inline const auto D3D_COMPILE_STANDARD_FILE_INCLUDE{ reinterpret_cast(static_cast(1)) }; - inline constexpr auto D3D_COMPRESS_SHADER_KEEP_ALL_PARTS{ 0x00000001u }; - inline constexpr auto D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE{ 0x00000001u }; -} - -namespace REX::W32 -{ - HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs); - HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs); - HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs); - HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData); - HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob); - HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph); - HRESULT D3DCreateLinker(ID3D11Linker** a_linker); - HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders); - HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly); - HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly); - HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly); - HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part); - HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo); - HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob); - HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob); - HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob); - HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts); - HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module); - HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs); - HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents); - HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector); - HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector); - HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader); - HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob); - HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite); -} diff --git a/include/REX/W32/DBGHELP.h b/include/REX/W32/DBGHELP.h deleted file mode 100644 index 350b3ebb6..000000000 --- a/include/REX/W32/DBGHELP.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -namespace REX::W32 -{ - // symbol name undecoration flags - inline constexpr auto UNDNAME_NO_MS_KEYWORDS{ 0x00000002u }; - inline constexpr auto UNDNAME_NO_FUNCTION_RETURNS{ 0x00000004u }; - inline constexpr auto UNDNAME_NO_ALLOCATION_MODEL{ 0x00000008u }; - inline constexpr auto UNDNAME_NO_ALLOCATION_LANGUAGE{ 0x00000010u }; - inline constexpr auto UNDNAME_NO_THISTYPE{ 0x00000060u }; - inline constexpr auto UNDNAME_NO_ACCESS_SPECIFIERS{ 0x00000080u }; - inline constexpr auto UNDNAME_NO_THROW_SIGNATURES{ 0x00000100u }; - inline constexpr auto UNDNAME_NO_RETURN_UDT_MODEL{ 0x00000400u }; - inline constexpr auto UNDNAME_NAME_ONLY{ 0x00001000u }; - inline constexpr auto UNDNAME_NO_ARGUMENTS{ 0x00002000u }; -} - -namespace REX::W32 -{ - std::uint32_t UnDecorateSymbolName(const char* a_name, char* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept; - std::uint32_t UnDecorateSymbolNameW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept; -} diff --git a/include/REX/W32/DINPUT.h b/include/REX/W32/DINPUT.h deleted file mode 100644 index 85f4e5396..000000000 --- a/include/REX/W32/DINPUT.h +++ /dev/null @@ -1,499 +0,0 @@ -#pragma once - -#include "REX/W32/COM.h" -#include "REX/W32/D3D.h" - -namespace REX::W32 -{ - struct IDirectInput8A; - struct IDirectInputDevice8A; - struct IDirectInputEffect; -} - -namespace REX::W32 -{ - enum DIK : std::uint32_t - { - DIK_ESCAPE = 0x1, - DIK_1 = 0x2, - DIK_2 = 0x3, - DIK_3 = 0x4, - DIK_4 = 0x5, - DIK_5 = 0x6, - DIK_6 = 0x7, - DIK_7 = 0x8, - DIK_8 = 0x9, - DIK_9 = 0xA, - DIK_0 = 0xB, - DIK_MINUS = 0xC, - DIK_EQUALS = 0xD, - DIK_BACK = 0xE, - DIK_TAB = 0xF, - DIK_Q = 0x10, - DIK_W = 0x11, - DIK_E = 0x12, - DIK_R = 0x13, - DIK_T = 0x14, - DIK_Y = 0x15, - DIK_U = 0x16, - DIK_I = 0x17, - DIK_O = 0x18, - DIK_P = 0x19, - DIK_LBRACKET = 0x1A, - DIK_RBRACKET = 0x1B, - DIK_RETURN = 0x1C, - DIK_LCONTROL = 0x1D, - DIK_A = 0x1E, - DIK_S = 0x1F, - DIK_D = 0x20, - DIK_F = 0x21, - DIK_G = 0x22, - DIK_H = 0x23, - DIK_J = 0x24, - DIK_K = 0x25, - DIK_L = 0x26, - DIK_SEMICOLON = 0x27, - DIK_APOSTROPHE = 0x28, - DIK_GRAVE = 0x29, - DIK_LSHIFT = 0x2A, - DIK_BACKSLASH = 0x2B, - DIK_Z = 0x2C, - DIK_X = 0x2D, - DIK_C = 0x2E, - DIK_V = 0x2F, - DIK_B = 0x30, - DIK_N = 0x31, - DIK_M = 0x32, - DIK_COMMA = 0x33, - DIK_PERIOD = 0x34, - DIK_SLASH = 0x35, - DIK_RSHIFT = 0x36, - DIK_MULTIPLY = 0x37, - DIK_LMENU = 0x38, - DIK_SPACE = 0x39, - DIK_CAPITAL = 0x3A, - DIK_F1 = 0x3B, - DIK_F2 = 0x3C, - DIK_F3 = 0x3D, - DIK_F4 = 0x3E, - DIK_F5 = 0x3F, - DIK_F6 = 0x40, - DIK_F7 = 0x41, - DIK_F8 = 0x42, - DIK_F9 = 0x43, - DIK_F10 = 0x44, - DIK_NUMLOCK = 0x45, - DIK_SCROLL = 0x46, - DIK_NUMPAD7 = 0x47, - DIK_NUMPAD8 = 0x48, - DIK_NUMPAD9 = 0x49, - DIK_SUBTRACT = 0x4A, - DIK_NUMPAD4 = 0x4B, - DIK_NUMPAD5 = 0x4C, - DIK_NUMPAD6 = 0x4D, - DIK_ADD = 0x4E, - DIK_NUMPAD1 = 0x4F, - DIK_NUMPAD2 = 0x50, - DIK_NUMPAD3 = 0x51, - DIK_NUMPAD0 = 0x52, - DIK_DECIMAL = 0x53, - DIK_OEM_102 = 0x56, - DIK_F11 = 0x57, - DIK_F12 = 0x58, - DIK_F13 = 0x64, - DIK_F14 = 0x65, - DIK_F15 = 0x66, - DIK_KANA = 0x70, - DIK_ABNT_C1 = 0x73, - DIK_CONVERT = 0x79, - DIK_NOCONVERT = 0x7B, - DIK_YEN = 0x7D, - DIK_ABNT_C2 = 0x7E, - DIK_NUMPADEQUALS = 0x8D, - DIK_PREVTRACK = 0x90, - DIK_AT = 0x91, - DIK_COLON = 0x92, - DIK_UNDERLINE = 0x93, - DIK_KANJI = 0x94, - DIK_STOP = 0x95, - DIK_AX = 0x96, - DIK_UNLABELED = 0x97, - DIK_NEXTTRACK = 0x99, - DIK_NUMPADENTER = 0x9C, - DIK_RCONTROL = 0x9D, - DIK_MUTE = 0xA0, - DIK_CALCULATOR = 0xA1, - DIK_PLAYPAUSE = 0xA2, - DIK_MEDIASTOP = 0xA4, - DIK_VOLUMEDOWN = 0xAE, - DIK_VOLUMEUP = 0xB0, - DIK_WEBHOME = 0xB2, - DIK_NUMPADCOMMA = 0xB3, - DIK_DIVIDE = 0xB5, - DIK_SYSRQ = 0xB7, - DIK_RMENU = 0xB8, - DIK_PAUSE = 0xC5, - DIK_HOME = 0xC7, - DIK_UP = 0xC8, - DIK_PRIOR = 0xC9, - DIK_LEFT = 0xCB, - DIK_RIGHT = 0xCD, - DIK_END = 0xCF, - DIK_DOWN = 0xD0, - DIK_NEXT = 0xD1, - DIK_INSERT = 0xD2, - DIK_DELETE = 0xD3, - DIK_LWIN = 0xDB, - DIK_RWIN = 0xDC, - DIK_APPS = 0xDD, - DIK_POWER = 0xDE, - DIK_SLEEP = 0xDF, - DIK_WAKE = 0xE3, - DIK_WEBSEARCH = 0xE5, - DIK_WEBFAVORITES = 0xE6, - DIK_WEBREFRESH = 0xE7, - DIK_WEBSTOP = 0xE8, - DIK_WEBFORWARD = 0xE9, - DIK_WEBBACK = 0xEA, - DIK_MYCOMPUTER = 0xEB, - DIK_MAIL = 0xEC, - DIK_MEDIASELECT = 0xED, - DIK_BACKSPACE = DIK_BACK, - DIK_NUMPADSTAR = DIK_MULTIPLY, - DIK_LALT = DIK_LMENU, - DIK_CAPSLOCK = DIK_CAPITAL, - DIK_NUMPADMINUS = DIK_SUBTRACT, - DIK_NUMPADPLUS = DIK_ADD, - DIK_NUMPADPERIOD = DIK_DECIMAL, - DIK_NUMPADSLASH = DIK_DIVIDE, - DIK_RALT = DIK_RMENU, - DIK_UPARROW = DIK_UP, - DIK_PGUP = DIK_PRIOR, - DIK_LEFTARROW = DIK_LEFT, - DIK_RIGHTARROW = DIK_RIGHT, - DIK_DOWNARROW = DIK_DOWN, - DIK_PGDN = DIK_NEXT - }; -} - -namespace REX::W32 -{ - struct DIENVELOPE; - struct DIOBJECTDATAFORMAT; - - struct DIACTIONA - { - std::uintptr_t appData; - std::uint32_t semantic; - std::uint32_t flags; - union - { - const char* actionName; - std::uint32_t resIdString; - }; - GUID guidInstance; - std::uint32_t objID; - std::uint32_t how; - }; - - struct DIACTIONFORMATA - { - std::uint32_t size; - std::uint32_t actionSize; - std::uint32_t dataSize; - std::uint32_t numActions; - DIACTIONA* action; - GUID guidActionMap; - std::uint32_t genre; - std::uint32_t bufferSize; - std::int32_t axisMin; - std::int32_t axisMax; - HINSTANCE instString; - FILETIME timeStamp; - std::uint32_t crc; - char actionMap[MAX_PATH]; - }; - - struct DICOLORSET - { - std::uint32_t size; - D3DCOLOR textFore; - D3DCOLOR textHighlight; - D3DCOLOR calloutLine; - D3DCOLOR calloutHighlight; - D3DCOLOR border; - D3DCOLOR controlFill; - D3DCOLOR highlightFill; - D3DCOLOR areaFill; - }; - - struct DICONFIGUREDEVICESPARAMSA - { - std::uint32_t size; - std::uint32_t users; - char* userNames; - std::uint32_t formatsSize; - DIACTIONFORMATA* formats; - HWND hwnd; - DICOLORSET dics; - IUnknown* unkDDSTarget; - }; - - struct DIDATAFORMAT - { - std::uint32_t size; - std::uint32_t objSize; - std::uint32_t flags; - std::uint32_t dataSize; - std::uint32_t numObjs; - DIOBJECTDATAFORMAT* odf; - }; - - struct DIDEVCAPS - { - std::uint32_t size; - std::uint32_t flags; - std::uint32_t devType; - std::uint32_t axes; - std::uint32_t buttons; - std::uint32_t povs; - std::uint32_t ffSamplePeriod; - std::uint32_t ffMinTimeResolution; - std::uint32_t firmwareRevision; - std::uint32_t hardwareRevision; - std::uint32_t ffDriverVersion; - }; - - struct DIDEVICEIMAGEINFOA - { - char imagePath[MAX_PATH]; - std::uint32_t flags; - std::uint32_t viewID; - RECT overlay; - std::uint32_t objID; - std::uint32_t validPts; - POINT calloutLine[5]; - RECT calloutRect; - std::uint32_t textAlign; - }; - - struct DIDEVICEIMAGEINFOHEADERA - { - std::uint32_t size; - std::uint32_t sizeImageInfo; - std::uint32_t views; - std::uint32_t buttons; - std::uint32_t axes; - std::uint32_t povs; - std::uint32_t bufferSize; - std::uint32_t bufferUsed; - DIDEVICEIMAGEINFOA* imageInfoArray; - }; - - struct DIDEVICEINSTANCEA - { - std::uint32_t size; - GUID guidInstance; - GUID guidProduct; - std::uint32_t devType; - char instanceName[MAX_PATH]; - char productName[MAX_PATH]; - GUID guidFFDriver; - - // DIRECTINPUT_VERSION >= 0x0500 - std::uint16_t usagePage; - std::uint16_t usage; - }; - - struct DIDEVICEOBJECTDATA - { - std::uint32_t ofs; - std::uint32_t data; - std::uint32_t timeStamp; - std::uint32_t sequence; - std::uintptr_t appData; - }; - - struct DIDEVICEOBJECTINSTANCEA - { - std::uint32_t size; - GUID guidType; - std::uint32_t ofs; - std::uint32_t type; - std::uint32_t flags; - char name[MAX_PATH]; - - // DIRECTINPUT_VERSION >= 0x0500 - std::uint32_t ffMaxForce; - std::uint32_t ffForceResolution; - std::uint16_t collectionNumber; - std::uint16_t designatorIndex; - std::uint16_t usagePage; - std::uint16_t usage; - std::uint32_t dimension; - std::uint16_t exponent; - std::uint16_t reportId; - }; - - struct DIEFFECT - { - std::uint32_t size; - std::uint32_t flags; - std::uint32_t duration; - std::uint32_t samplePeriod; - std::uint32_t gain; - std::uint32_t triggerButton; - std::uint32_t triggerRepeatInterval; - std::uint32_t axesSize; - std::uint32_t* axes; - std::int32_t* direction; - DIENVELOPE* envelope; - std::uint32_t typeSpecificParamsSize; - void* typeSpecificParams; - std::uint32_t startDelay; - }; - - struct DIENVELOPE - { - std::uint32_t size; - std::uint32_t attackLevel; - std::uint32_t attackTime; - std::uint32_t fadeLevel; - std::uint32_t fadeTime; - }; - - struct DIEFFECTINFOA - { - std::uint32_t size; - GUID guid; - std::uint32_t effectType; - std::uint32_t staticParams; - std::uint32_t dynamicParams; - char name[MAX_PATH]; - }; - - struct DIEFFESCAPE - { - std::uint32_t size; - std::uint32_t command; - void* inBuffer; - std::uint32_t inBufferSize; - void* outBuffer; - std::uint32_t outBufferSize; - }; - - struct DIFILEEFFECT - { - std::uint32_t size; - GUID guidEffect; - const DIEFFECT* effect; - char friendlyName[MAX_PATH]; - }; - - struct DIMOUSESTATE2 - { - std::int32_t x; - std::int32_t y; - std::int32_t z; - std::uint8_t rgbButtons[8]; - }; - - struct DIOBJECTDATAFORMAT - { - const GUID* guid; - std::uint32_t ofs; - std::uint32_t type; - std::uint32_t flags; - }; - - struct DIPROPHEADER - { - std::uint32_t size; - std::uint32_t headerSize; - std::uint32_t obj; - std::uint32_t how; - }; -} - -namespace REX::W32 -{ - using LPDICONFIGUREDEVICESCALLBACK = BOOL(__stdcall*)(IUnknown*, void*); - using LPDIENUMCREATEDEFFECTOBJECTSCALLBACK = BOOL(__stdcall*)(IDirectInputEffect*, void*); - using LPDIENUMDEVICESBYSEMANTICSCBA = BOOL(__stdcall*)(const DIDEVICEINSTANCEA*, IDirectInputDevice8A*, std::uint32_t, std::uint32_t, void*); - using LPDIENUMDEVICESCALLBACKA = BOOL(__stdcall*)(const DIDEVICEINSTANCEA*, void*); - using LPDIENUMDEVICEOBJECTSCALLBACKA = BOOL(__stdcall*)(const DIDEVICEOBJECTINSTANCEA*, void*); - using LPDIENUMEFFECTSCALLBACKA = BOOL(__stdcall*)(const DIEFFECTINFOA*, void*); - using LPDIENUMEFFECTSINFILECALLBACK = BOOL(__stdcall*)(const DIFILEEFFECT*, void*); -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("BF798030-483A-4DA2-AA99-5D64ED369700")) - IDirectInput8A : public IUnknown - { - virtual HRESULT CreateDevice(const GUID&, IDirectInputDevice8A**, IUnknown*) noexcept = 0; - virtual HRESULT EnumDevices(std::uint32_t, LPDIENUMDEVICESCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetDeviceStatus(const GUID&) noexcept = 0; - virtual HRESULT RunControlPanel(HWND, std::uint32_t) noexcept = 0; - virtual HRESULT Initialize(HINSTANCE, std::uint32_t) noexcept = 0; - virtual HRESULT FindDevice(const GUID&, const char*, GUID*) noexcept = 0; - virtual HRESULT EnumDevicesBySemantics(const char*, DIACTIONFORMATA*, LPDIENUMDEVICESBYSEMANTICSCBA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK, DICONFIGUREDEVICESPARAMSA*, std::uint32_t, void*) noexcept = 0; - }; - - struct __declspec(novtable, uuid("54D41080-DC15-4833-A41B-748F73A38179")) - IDirectInputDevice8A : public IUnknown - { - virtual HRESULT GetCapabilities(DIDEVCAPS*) noexcept = 0; - virtual HRESULT EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetProperty(const GUID&, DIPROPHEADER*) noexcept = 0; - virtual HRESULT SetProperty(const GUID&, const DIPROPHEADER*) noexcept = 0; - virtual HRESULT Acquire() noexcept = 0; - virtual HRESULT Unacquire() noexcept = 0; - virtual HRESULT GetDeviceState(std::uint32_t, void*) noexcept = 0; - virtual HRESULT GetDeviceData(std::uint32_t, DIDEVICEOBJECTDATA*, std::uint32_t*, std::uint32_t) noexcept = 0; - virtual HRESULT SetDataFormat(const DIDATAFORMAT*) noexcept = 0; - virtual HRESULT SetEventNotification(HANDLE) noexcept = 0; - virtual HRESULT SetCooperativeLevel(HWND, std::uint32_t) noexcept = 0; - virtual HRESULT GetObjectInfo(DIDEVICEOBJECTINSTANCEA*, std::uint32_t, std::uint32_t) noexcept = 0; - virtual HRESULT GetDeviceInfo(DIDEVICEINSTANCEA*) noexcept = 0; - virtual HRESULT RunControlPanel(HWND, std::uint32_t) noexcept = 0; - virtual HRESULT Initialize(HINSTANCE, std::uint32_t, const GUID&) noexcept = 0; - virtual HRESULT CreateEffect(const GUID&, const DIEFFECT*, IDirectInputEffect*, IUnknown*) noexcept = 0; - virtual HRESULT EnumEffects(LPDIENUMEFFECTSCALLBACKA, void*, std::uint32_t) noexcept = 0; - virtual HRESULT GetEffectInfo(DIEFFECTINFOA*, const GUID&) noexcept = 0; - virtual HRESULT GetForceFeedbackState(std::uint32_t*) noexcept = 0; - virtual HRESULT SendForceFeedbackCommand(std::uint32_t) noexcept = 0; - virtual HRESULT EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, void*, std::uint32_t) noexcept = 0; - virtual HRESULT Escape(DIEFFESCAPE*) noexcept = 0; - virtual HRESULT Poll() noexcept = 0; - virtual HRESULT SendDeviceData(std::uint32_t, const DIDEVICEOBJECTDATA*, std::uint32_t*, std::uint32_t) noexcept = 0; - virtual HRESULT EnumEffectsInFile(const char*, LPDIENUMEFFECTSINFILECALLBACK, void*, std::uint32_t) noexcept = 0; - virtual HRESULT WriteEffectToFile(const char*, std::uint32_t, DIFILEEFFECT*, std::uint32_t) noexcept = 0; - virtual HRESULT BuildActionMap(DIACTIONFORMATA*, const char*, std::uint32_t) noexcept = 0; - virtual HRESULT SetActionMap(DIACTIONFORMATA*, const char*, std::uint32_t) noexcept = 0; - virtual HRESULT GetImageInfo(DIDEVICEIMAGEINFOHEADERA*) noexcept = 0; - }; - - struct __declspec(novtable, uuid("E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35")) - IDirectInputEffect : public IUnknown - { - virtual HRESULT Initialize(HINSTANCE, std::uint32_t, const GUID&) noexcept = 0; - virtual HRESULT GetEffectGuid(GUID*) noexcept = 0; - virtual HRESULT GetParameters(DIEFFECT*, std::uint32_t) noexcept = 0; - virtual HRESULT SetParameters(const DIEFFECT*, std::uint32_t) noexcept = 0; - virtual HRESULT Start(std::uint32_t, std::uint32_t) noexcept = 0; - virtual HRESULT Stop() noexcept = 0; - virtual HRESULT GetEffectStatus(std::uint32_t*) noexcept = 0; - virtual HRESULT Download() noexcept = 0; - virtual HRESULT Unload() noexcept = 0; - virtual HRESULT Escape(DIEFFESCAPE*) noexcept = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDirectInput8A{ 0xBF798030, 0x483A, 0x4DA2, { 0xAA, 0x99, 0x5D, 0x64, 0xED, 0x36, 0x97, 0x00 } }; - inline constexpr IID IID_IDirectInputDevice8A{ 0x54D41080, 0xDC15, 0x4833, { 0xA4, 0x1B, 0x74, 0x8F, 0x73, 0xA3, 0x81, 0x79 } }; - inline constexpr IID IID_IDirectInputEffect{ 0xE7E1F7C0, 0x88D2, 0x11D0, { 0x9A, 0xD0, 0x00, 0xA0, 0xC9, 0xA0, 0x6E, 0x35 } }; -} diff --git a/include/REX/W32/DXGI.h b/include/REX/W32/DXGI.h deleted file mode 100644 index 022ebcfc3..000000000 --- a/include/REX/W32/DXGI.h +++ /dev/null @@ -1,549 +0,0 @@ -#pragma once - -#include "REX/W32/COM.h" - -namespace REX::W32 -{ - struct IDXGIAdapter; - struct IDXGIAdapter1; - struct IDXGIDevice; - struct IDXGIDevice1; - struct IDXGIDeviceSubObject; - struct IDXGIFactory1; - struct IDXGIKeyedMutex; - struct IDXGIObject; - struct IDXGIOutput; - struct IDXGIResource; - struct IDXGISurface; - struct IDXGISurface1; - struct IDXGISwapChain; -} - -namespace REX::W32 -{ - enum DXGI_ADAPTER_FLAG - { - DXGI_ADAPTER_FLAG_NONE = 0, - DXGI_ADAPTER_FLAG_REMOTE = 1, - DXGI_ADAPTER_FLAG_SOFTWARE = 2, - DXGI_ADAPTER_FLAG_FORCE_DWORD = 0xFFFFFFFF, - }; - - enum DXGI_COLOR_SPACE_TYPE - { - DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0, - DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3, - DXGI_COLOR_SPACE_RESERVED = 4, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11, - DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13, - DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16, - DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17, - DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18, - DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19, - DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 = 20, - DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 = 21, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 = 22, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 = 23, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24, - DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF, - }; - - enum DXGI_FORMAT - { - DXGI_FORMAT_UNKNOWN = 0, - DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, - DXGI_FORMAT_R32G32B32A32_FLOAT = 2, - DXGI_FORMAT_R32G32B32A32_UINT = 3, - DXGI_FORMAT_R32G32B32A32_SINT = 4, - DXGI_FORMAT_R32G32B32_TYPELESS = 5, - DXGI_FORMAT_R32G32B32_FLOAT = 6, - DXGI_FORMAT_R32G32B32_UINT = 7, - DXGI_FORMAT_R32G32B32_SINT = 8, - DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, - DXGI_FORMAT_R16G16B16A16_FLOAT = 10, - DXGI_FORMAT_R16G16B16A16_UNORM = 11, - DXGI_FORMAT_R16G16B16A16_UINT = 12, - DXGI_FORMAT_R16G16B16A16_SNORM = 13, - DXGI_FORMAT_R16G16B16A16_SINT = 14, - DXGI_FORMAT_R32G32_TYPELESS = 15, - DXGI_FORMAT_R32G32_FLOAT = 16, - DXGI_FORMAT_R32G32_UINT = 17, - DXGI_FORMAT_R32G32_SINT = 18, - DXGI_FORMAT_R32G8X24_TYPELESS = 19, - DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, - DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, - DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, - DXGI_FORMAT_R10G10B10A2_UNORM = 24, - DXGI_FORMAT_R10G10B10A2_UINT = 25, - DXGI_FORMAT_R11G11B10_FLOAT = 26, - DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, - DXGI_FORMAT_R8G8B8A8_UNORM = 28, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, - DXGI_FORMAT_R8G8B8A8_UINT = 30, - DXGI_FORMAT_R8G8B8A8_SNORM = 31, - DXGI_FORMAT_R8G8B8A8_SINT = 32, - DXGI_FORMAT_R16G16_TYPELESS = 33, - DXGI_FORMAT_R16G16_FLOAT = 34, - DXGI_FORMAT_R16G16_UNORM = 35, - DXGI_FORMAT_R16G16_UINT = 36, - DXGI_FORMAT_R16G16_SNORM = 37, - DXGI_FORMAT_R16G16_SINT = 38, - DXGI_FORMAT_R32_TYPELESS = 39, - DXGI_FORMAT_D32_FLOAT = 40, - DXGI_FORMAT_R32_FLOAT = 41, - DXGI_FORMAT_R32_UINT = 42, - DXGI_FORMAT_R32_SINT = 43, - DXGI_FORMAT_R24G8_TYPELESS = 44, - DXGI_FORMAT_D24_UNORM_S8_UINT = 45, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, - DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, - DXGI_FORMAT_R8G8_TYPELESS = 48, - DXGI_FORMAT_R8G8_UNORM = 49, - DXGI_FORMAT_R8G8_UINT = 50, - DXGI_FORMAT_R8G8_SNORM = 51, - DXGI_FORMAT_R8G8_SINT = 52, - DXGI_FORMAT_R16_TYPELESS = 53, - DXGI_FORMAT_R16_FLOAT = 54, - DXGI_FORMAT_D16_UNORM = 55, - DXGI_FORMAT_R16_UNORM = 56, - DXGI_FORMAT_R16_UINT = 57, - DXGI_FORMAT_R16_SNORM = 58, - DXGI_FORMAT_R16_SINT = 59, - DXGI_FORMAT_R8_TYPELESS = 60, - DXGI_FORMAT_R8_UNORM = 61, - DXGI_FORMAT_R8_UINT = 62, - DXGI_FORMAT_R8_SNORM = 63, - DXGI_FORMAT_R8_SINT = 64, - DXGI_FORMAT_A8_UNORM = 65, - DXGI_FORMAT_R1_UNORM = 66, - DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, - DXGI_FORMAT_R8G8_B8G8_UNORM = 68, - DXGI_FORMAT_G8R8_G8B8_UNORM = 69, - DXGI_FORMAT_BC1_TYPELESS = 70, - DXGI_FORMAT_BC1_UNORM = 71, - DXGI_FORMAT_BC1_UNORM_SRGB = 72, - DXGI_FORMAT_BC2_TYPELESS = 73, - DXGI_FORMAT_BC2_UNORM = 74, - DXGI_FORMAT_BC2_UNORM_SRGB = 75, - DXGI_FORMAT_BC3_TYPELESS = 76, - DXGI_FORMAT_BC3_UNORM = 77, - DXGI_FORMAT_BC3_UNORM_SRGB = 78, - DXGI_FORMAT_BC4_TYPELESS = 79, - DXGI_FORMAT_BC4_UNORM = 80, - DXGI_FORMAT_BC4_SNORM = 81, - DXGI_FORMAT_BC5_TYPELESS = 82, - DXGI_FORMAT_BC5_UNORM = 83, - DXGI_FORMAT_BC5_SNORM = 84, - DXGI_FORMAT_B5G6R5_UNORM = 85, - DXGI_FORMAT_B5G5R5A1_UNORM = 86, - DXGI_FORMAT_B8G8R8A8_UNORM = 87, - DXGI_FORMAT_B8G8R8X8_UNORM = 88, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, - DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, - DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, - DXGI_FORMAT_BC6H_TYPELESS = 94, - DXGI_FORMAT_BC6H_UF16 = 95, - DXGI_FORMAT_BC6H_SF16 = 96, - DXGI_FORMAT_BC7_TYPELESS = 97, - DXGI_FORMAT_BC7_UNORM = 98, - DXGI_FORMAT_BC7_UNORM_SRGB = 99, - DXGI_FORMAT_AYUV = 100, - DXGI_FORMAT_Y410 = 101, - DXGI_FORMAT_Y416 = 102, - DXGI_FORMAT_NV12 = 103, - DXGI_FORMAT_P010 = 104, - DXGI_FORMAT_P016 = 105, - DXGI_FORMAT_420_OPAQUE = 106, - DXGI_FORMAT_YUY2 = 107, - DXGI_FORMAT_Y210 = 108, - DXGI_FORMAT_Y216 = 109, - DXGI_FORMAT_NV11 = 110, - DXGI_FORMAT_AI44 = 111, - DXGI_FORMAT_IA44 = 112, - DXGI_FORMAT_P8 = 113, - DXGI_FORMAT_A8P8 = 114, - DXGI_FORMAT_B4G4R4A4_UNORM = 115, - - DXGI_FORMAT_P208 = 130, - DXGI_FORMAT_V208 = 131, - DXGI_FORMAT_V408 = 132, - - DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189, - DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190, - - DXGI_FORMAT_FORCE_UINT = 0xFFFFFFFF, - }; - - enum DXGI_MODE_ROTATION - { - DXGI_MODE_ROTATION_UNSPECIFIED = 0, - DXGI_MODE_ROTATION_IDENTITY = 1, - DXGI_MODE_ROTATION_ROTATE90 = 2, - DXGI_MODE_ROTATION_ROTATE180 = 3, - DXGI_MODE_ROTATION_ROTATE270 = 4, - }; - - enum DXGI_MODE_SCALING - { - DXGI_MODE_SCALING_UNSPECIFIED = 0, - DXGI_MODE_SCALING_CENTERED = 1, - DXGI_MODE_SCALING_STRETCHED = 2, - }; - - enum DXGI_MODE_SCANLINE_ORDER - { - DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, - DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, - DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, - DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3, - }; - - enum DXGI_RESIDENCY - { - DXGI_RESIDENCY_FULLY_RESIDENT = 1, - DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, - DXGI_RESIDENCY_EVICTED_TO_DISK = 3, - }; - - enum DXGI_SWAP_EFFECT - { - DXGI_SWAP_EFFECT_DISCARD = 0, - DXGI_SWAP_EFFECT_SEQUENTIAL = 1, - DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, - DXGI_SWAP_EFFECT_FLIP_DISCARD = 4, - }; - - enum DXGI_SWAP_CHAIN_FLAG - { - DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, - DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, - DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, - DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, - DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, - DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, - DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, - DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, - DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, - DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, - DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024, - DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 2048, - DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 4096, - }; -} - -namespace REX::W32 -{ - struct D3DCOLORVALUE - { - float r; - float g; - float b; - float a; - }; - - using DXGI_RGBA = D3DCOLORVALUE; - using DXGI_USAGE = std::uint32_t; - - struct LUID - { - std::uint32_t lo; - std::int32_t hi; - }; -} - -namespace REX::W32 -{ - struct DXGI_ADAPTER_DESC - { - wchar_t description[128]; - std::uint32_t vendorId; - std::uint32_t deviceId; - std::uint32_t subSysId; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLuid; - }; - - struct DXGI_ADAPTER_DESC1 - { - wchar_t description[128]; - std::uint32_t vendorId; - std::uint32_t deviceId; - std::uint32_t subSysId; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLuid; - std::uint32_t flags; - }; - - struct DXGI_DISPLAY_COLOR_SPACE - { - float primaryCoordinates[8][2]; - float whitePoints[16][2]; - }; - - struct DXGI_FRAME_STATISTICS - { - std::uint32_t presentCount; - std::uint32_t presentRefreshCount; - std::uint32_t syncRefreshCount; - std::int64_t syncQPCTime; - std::int64_t syncGPUTime; - }; - - struct DXGI_RGB - { - float red; - float green; - float blue; - }; - - struct DXGI_GAMMA_CONTROL - { - DXGI_RGB scale; - DXGI_RGB offset; - DXGI_RGB gammaCurve[1025]; - }; - - struct DXGI_GAMMA_CONTROL_CAPABILITIES - { - BOOL scaleAndOffsetSupported; - float maxConvertedValue; - float minConvertedValue; - std::uint32_t numGammaControlPoints; - float controlPointPositions[1025]; - }; - - struct DXGI_MAPPED_RECT - { - std::int32_t pitch; - std::uint8_t* bits; - }; - - struct DXGI_RATIONAL - { - std::uint32_t numerator; - std::uint32_t denominator; - }; - - struct DXGI_MODE_DESC - { - std::uint32_t width; - std::uint32_t height; - DXGI_RATIONAL refreshRate; - DXGI_FORMAT format; - DXGI_MODE_SCANLINE_ORDER scanlineOrdering; - DXGI_MODE_SCALING scaling; - }; - - struct DXGI_OUTPUT_DESC - { - wchar_t deviceName[32]; - RECT desktopCoordinates; - BOOL attachedToDesktop; - DXGI_MODE_ROTATION rotation; - HMONITOR monitor; - }; - - struct DXGI_SAMPLE_DESC - { - std::uint32_t count; - std::uint32_t quality; - }; - - struct DXGI_SHARED_RESOURCE - { - HANDLE handle; - }; - - struct DXGI_SURFACE_DESC - { - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - DXGI_SAMPLE_DESC sampleDesc; - }; - - struct DXGI_SWAP_CHAIN_DESC - { - DXGI_MODE_DESC bufferDesc; - DXGI_SAMPLE_DESC sampleDesc; - DXGI_USAGE bufferUsage; - std::uint32_t bufferCount; - HWND outputWindow; - BOOL windowed; - DXGI_SWAP_EFFECT swapEffect; - std::uint32_t flags; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("aec22fb8-76f3-4639-9be0-28eb43a67a2e")) - IDXGIObject : public IUnknown - { - virtual HRESULT SetPrivateData(const GUID& a_iid, std::uint32_t a_dataSize, const void* a_data) = 0; - virtual HRESULT SetPrivateDataInterface(const GUID& a_iid, const IUnknown* a_unknown) = 0; - virtual HRESULT GetPrivateData(const GUID& a_iid, std::uint32_t* a_dataSize, void* a_data) = 0; - virtual HRESULT GetParent(const GUID& a_iid, void** a_parent) = 0; - }; - - struct __declspec(novtable, uuid("3d3e0379-f9de-4d58-bb6c-18d62992f1a6")) - IDXGIDeviceSubObject : public IDXGIObject - { - virtual HRESULT GetDevice(const GUID& a_iid, void** a_device) = 0; - }; - - struct __declspec(novtable, uuid("035f3ab4-482e-4e50-b41f-8a7f8bd8960b")) - IDXGIResource : public IDXGIDeviceSubObject - { - virtual HRESULT GetSharedHandle(HANDLE* a_sharedHandle) = 0; - virtual HRESULT GetUsage(DXGI_USAGE* a_usage) = 0; - virtual HRESULT SetEvictionPriority(std::uint32_t a_evictionPriority) = 0; - virtual HRESULT GetEvictionPriority(std::uint32_t* a_evictionPriority) = 0; - }; - - struct __declspec(novtable, uuid("9d8e1289-d7b3-465f-8126-250e349af85d")) - IDXGIKeyedMutex : public IDXGIDeviceSubObject - { - virtual HRESULT AcquireSync(std::uint64_t a_key, std::uint32_t a_milliseconds) = 0; - virtual HRESULT ReleaseSync(std::uint64_t a_key) = 0; - }; - - struct __declspec(novtable, uuid("cafcb56c-6ac3-4889-bf47-9e23bbd260ec")) - IDXGISurface : public IDXGIDeviceSubObject - { - virtual HRESULT GetDesc(DXGI_SURFACE_DESC* a_desc) = 0; - virtual HRESULT Map(DXGI_MAPPED_RECT* a_lockedRect, std::uint32_t a_mapFlags) = 0; - virtual HRESULT Unmap(void) = 0; - }; - - struct __declspec(novtable, uuid("4AE63092-6327-4c1b-80AE-BFE12EA32B86")) - IDXGISurface1 : public IDXGISurface - { - virtual HRESULT GetDC(BOOL a_discard, HDC* a_hdc) = 0; - virtual HRESULT ReleaseDC(RECT* a_dirtyRect) = 0; - }; - - struct __declspec(novtable, uuid("2411e7e1-12ac-4ccf-bd14-9798e8534dc0")) - IDXGIAdapter : public IDXGIObject - { - virtual HRESULT EnumOutputs(std::uint32_t a_outputSize, IDXGIOutput** a_output) = 0; - virtual HRESULT GetDesc(DXGI_ADAPTER_DESC* a_desc) = 0; - virtual HRESULT CheckInterfaceSupport(const GUID& a_iid, std::int64_t* a_umdVersion) = 0; - }; - - struct __declspec(novtable, uuid("29038f61-3839-4626-91fd-086879011a05")) - IDXGIAdapter1 : public IDXGIAdapter - { - virtual HRESULT GetDesc1(DXGI_ADAPTER_DESC1* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("ae02eedb-c735-4690-8d52-5a8dc20213aa")) - IDXGIOutput : public IDXGIObject - { - virtual HRESULT GetDesc(DXGI_OUTPUT_DESC* a_desc) = 0; - virtual HRESULT GetDisplayModeList(DXGI_FORMAT a_enumFormat, std::uint32_t a_flags, std::uint32_t* a_numModes, DXGI_MODE_DESC* a_desc) = 0; - virtual HRESULT FindClosestMatchingMode(const DXGI_MODE_DESC* a_modeToMatch, DXGI_MODE_DESC* a_closestMatch, IUnknown* a_concernedDevice) = 0; - virtual HRESULT WaitForVBlank(void) = 0; - virtual HRESULT TakeOwnership(IUnknown* a_device, BOOL a_exclusive) = 0; - virtual void ReleaseOwnership(void) = 0; - virtual HRESULT GetGammaControlCapabilities(DXGI_GAMMA_CONTROL_CAPABILITIES* a_gammaCaps) = 0; - virtual HRESULT SetGammaControl(const DXGI_GAMMA_CONTROL* a_array) = 0; - virtual HRESULT GetGammaControl(DXGI_GAMMA_CONTROL* a_array) = 0; - virtual HRESULT SetDisplaySurface(IDXGISurface* a_scanoutSurface) = 0; - virtual HRESULT GetDisplaySurfaceData(IDXGISurface* a_destination) = 0; - virtual HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* a_stats) = 0; - }; - - struct __declspec(novtable, uuid("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a")) - IDXGISwapChain : public IDXGIDeviceSubObject - { - virtual HRESULT Present(std::uint32_t a_syncInterval, std::uint32_t a_flags) = 0; - virtual HRESULT GetBuffer(std::uint32_t a_buffer, const GUID& a_iid, void** a_surface) = 0; - virtual HRESULT SetFullscreenState(BOOL a_fullscreen, IDXGIOutput* a_target) = 0; - virtual HRESULT GetFullscreenState(BOOL* a_fullscreen, IDXGIOutput** a_target) = 0; - virtual HRESULT GetDesc(DXGI_SWAP_CHAIN_DESC* a_desc) = 0; - virtual HRESULT ResizeBuffers(std::uint32_t a_bufferCount, std::uint32_t a_width, std::uint32_t a_height, DXGI_FORMAT a_newFormat, std::uint32_t a_swapChainFlags) = 0; - virtual HRESULT ResizeTarget(const DXGI_MODE_DESC* a_newTargetParameters) = 0; - virtual HRESULT GetContainingOutput(IDXGIOutput** a_output) = 0; - virtual HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* a_stats) = 0; - virtual HRESULT GetLastPresentCount(std::uint32_t* a_lastPresentCount) = 0; - }; - - struct __declspec(novtable, uuid("7b7166ec-21c7-44ae-b21a-c9ae321ae369")) - IDXGIFactory : public IDXGIObject - { - virtual HRESULT EnumAdapters(std::uint32_t a_adapterSize, IDXGIAdapter** a_adapter) = 0; - virtual HRESULT MakeWindowAssociation(HWND a_windowHandle, std::uint32_t a_flags) = 0; - virtual HRESULT GetWindowAssociation(HWND* a_windowHandle) = 0; - virtual HRESULT CreateSwapChain(IUnknown* a_device, DXGI_SWAP_CHAIN_DESC* a_desc, IDXGISwapChain** a_swapChain) = 0; - virtual HRESULT CreateSoftwareAdapter(HMODULE a_module, IDXGIAdapter** a_adapter) = 0; - }; - - struct __declspec(novtable, uuid("770aae78-f26f-4dba-a829-253c83d1b387")) - IDXGIFactory1 : public IDXGIFactory - { - virtual HRESULT EnumAdapters1(std::uint32_t a_adapterSize, IDXGIAdapter1** a_adapter) = 0; - virtual BOOL IsCurrent(void) = 0; - }; - - struct __declspec(novtable, uuid("54ec77fa-1377-44e6-8c32-88fd5f44c84c")) - IDXGIDevice : public IDXGIObject - { - virtual HRESULT GetAdapter(IDXGIAdapter** a_adapter) = 0; - virtual HRESULT CreateSurface(const DXGI_SURFACE_DESC* a_desc, std::uint32_t a_numSurfaces, DXGI_USAGE a_usage, const DXGI_SHARED_RESOURCE* a_sharedResource, IDXGISurface** a_surface) = 0; - virtual HRESULT QueryResourceResidency(IUnknown* const* a_resources, DXGI_RESIDENCY* a_residencyStatus, std::uint32_t a_numResources) = 0; - virtual HRESULT SetGPUThreadPriority(std::int32_t a_priority) = 0; - virtual HRESULT GetGPUThreadPriority(std::int32_t* a_priority) = 0; - }; - - struct __declspec(novtable, uuid("77db970f-6276-48ba-ba28-070143b4392c")) - IDXGIDevice1 : public IDXGIDevice - { - virtual HRESULT SetMaximumFrameLatency(std::uint32_t a_maxLatency) = 0; - virtual HRESULT GetMaximumFrameLatency(std::uint32_t* a_maxLatency) = 0; - }; -} - -namespace REX::W32 -{ - HRESULT CreateDXGIFactory(const IID& a_iid, void** a_factory) noexcept; - HRESULT CreateDXGIFactory1(const IID& a_iid, void** a_factory) noexcept; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter{ 0x2411E7E1, 0x12AC, 0x4CCF, { 0xBD, 0x14, 0x97, 0x98, 0xE8, 0x53, 0x4D, 0xC0 } }; - inline constexpr IID IID_IDXGIAdapter1{ 0x29038F61, 0x3839, 0x4626, { 0x91, 0xFD, 0x08, 0x68, 0x79, 0x01, 0x1A, 0x05 } }; - inline constexpr IID IID_IDXGIObject{ 0xAEC22Fb8, 0x76F3, 0x4639, { 0x9B, 0xE0, 0x28, 0xEB, 0x43, 0xA6, 0x7A, 0x2E } }; - inline constexpr IID IID_IDXGIDevice{ 0x54EC77FA, 0x1377, 0x44E6, { 0x8C, 0x32, 0x88, 0xFD, 0x5F, 0x44, 0xC8, 0x4C } }; - inline constexpr IID IID_IDXGIDevice1{ 0x77DB970F, 0x6276, 0x48BA, { 0xBA, 0x28, 0x07, 0x01, 0x43, 0xB4, 0x39, 0x2C } }; - inline constexpr IID IID_IDXGIDeviceSubObject{ 0x3D3E0379, 0xF9DE, 0x4D58, { 0xBB, 0x6C, 0x18, 0xD6, 0x29, 0x92, 0xF1, 0xA6 } }; - inline constexpr IID IID_IDXGIFactory{ 0x7B7166EC, 0x21C7, 0x44AE, { 0xB2, 0x1A, 0xC9, 0xAE, 0x32, 0x1A, 0xE3, 0x69 } }; - inline constexpr IID IID_IDXGIFactory1{ 0x770AAE78, 0xF26F, 0x4DBA, { 0xA8, 0x29, 0x25, 0x3C, 0x83, 0xD1, 0xB3, 0x87 } }; - inline constexpr IID IID_IDXGIKeyedMutex{ 0x9D8E1289, 0xD7B3, 0x465F, { 0x81, 0x26, 0x25, 0x0E, 0x34, 0x9A, 0xF8, 0x5D } }; - inline constexpr IID IID_IDXGIOutput{ 0xAE02EEDB, 0xC735, 0x4690, { 0x8D, 0x52, 0x5A, 0x8D, 0xC2, 0x02, 0x13, 0xAA } }; - inline constexpr IID IID_IDXGIResource{ 0x035F3AB4, 0x482E, 0x4E50, { 0xB4, 0x1F, 0x8A, 0x7F, 0x8B, 0xD8, 0x96, 0x0B } }; - inline constexpr IID IID_IDXGISurface{ 0xCAFCB56C, 0x6AC3, 0x4889, { 0xBF, 0x47, 0x9E, 0x23, 0xBB, 0xD2, 0x60, 0xEC } }; - inline constexpr IID IID_IDXGISurface1{ 0x4AE63092, 0x6327, 0x4C1B, { 0x80, 0xAE, 0xBF, 0xE1, 0x2E, 0xA3, 0x2B, 0x86 } }; - inline constexpr IID IID_IDXGISwapChain{ 0x310D36A0, 0xD2E7, 0x4C0A, { 0xAA, 0x04, 0x6A, 0x9D, 0x23, 0xB8, 0x88, 0x6A } }; -} diff --git a/include/REX/W32/DXGI_2.h b/include/REX/W32/DXGI_2.h deleted file mode 100644 index aca5932db..000000000 --- a/include/REX/W32/DXGI_2.h +++ /dev/null @@ -1,272 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI.h" - -namespace REX::W32 -{ - struct IDXGIAdapter2; - struct IDXGIDevice2; - struct IDXGIDisplayControl; - struct IDXGIFactory2; - struct IDXGIOutput1; - struct IDXGIOutputDuplication; - struct IDXGIResource1; - struct IDXGISurface2; - struct IDXGISwapChain1; -} - -namespace REX::W32 -{ - enum DXGI_ALPHA_MODE - { - DXGI_ALPHA_MODE_UNSPECIFIED = 0, - DXGI_ALPHA_MODE_PREMULTIPLIED = 1, - DXGI_ALPHA_MODE_STRAIGHT = 2, - DXGI_ALPHA_MODE_IGNORE = 3, - DXGI_ALPHA_MODE_FORCE_DWORD = 0xFFFFFFFF, - }; - - enum DXGI_COMPUTE_PREEMPTION_GRANULARITY - { - DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, - DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY = 1, - DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY = 2, - DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY = 3, - DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY = 4, - }; - - enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY - { - DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY = 0, - DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY = 1, - DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY = 2, - DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY = 3, - DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY = 4, - }; - - enum DXGI_OFFER_RESOURCE_PRIORITY - { - DXGI_OFFER_RESOURCE_PRIORITY_LOW = 1, - DXGI_OFFER_RESOURCE_PRIORITY_NORMAL = (DXGI_OFFER_RESOURCE_PRIORITY_LOW + 1), - DXGI_OFFER_RESOURCE_PRIORITY_HIGH = (DXGI_OFFER_RESOURCE_PRIORITY_NORMAL + 1) - }; - - enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE - { - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 0x1, - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR = 0x2, - DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR = 0x4, - }; - - enum DXGI_SCALING - { - DXGI_SCALING_STRETCH = 0, - DXGI_SCALING_NONE = 1, - DXGI_SCALING_ASPECT_RATIO_STRETCH = 2, - }; -} - -namespace REX::W32 -{ - struct DXGI_ADAPTER_DESC2 - { - wchar_t description[128]; - std::uint32_t vendorID; - std::uint32_t deviceID; - std::uint32_t subSysID; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLUID; - std::uint32_t flags; - DXGI_GRAPHICS_PREEMPTION_GRANULARITY graphicsPreemptionGranularity; - DXGI_COMPUTE_PREEMPTION_GRANULARITY computePreemptionGranularity; - }; - - struct DXGI_MODE_DESC1 - { - std::uint32_t width; - std::uint32_t height; - DXGI_RATIONAL refreshRate; - DXGI_FORMAT format; - DXGI_MODE_SCANLINE_ORDER scanlineOrdering; - DXGI_MODE_SCALING scaling; - BOOL stereo; - }; - - struct DXGI_OUTDUPL_DESC - { - DXGI_MODE_DESC modeDesc; - DXGI_MODE_ROTATION rotation; - BOOL desktopImageInSystemMemory; - }; - - struct DXGI_OUTDUPL_POINTER_POSITION - { - POINT position; - BOOL visible; - }; - - struct DXGI_OUTDUPL_FRAME_INFO - { - std::int64_t lastPresentTime; - std::int64_t lastMouseUpdateTime; - std::uint32_t accumulatedFrames; - BOOL rectsCoalesced; - BOOL protectedContentMaskedOut; - DXGI_OUTDUPL_POINTER_POSITION pointerPosition; - std::uint32_t totalMetadataBufferSize; - std::uint32_t pointerShapeBufferSize; - }; - - struct DXGI_OUTDUPL_MOVE_RECT - { - POINT sourcePoint; - RECT destinationRect; - }; - - struct DXGI_OUTDUPL_POINTER_SHAPE_INFO - { - std::uint32_t type; - std::uint32_t width; - std::uint32_t height; - std::uint32_t pitch; - POINT hotSpot; - }; - - struct DXGI_PRESENT_PARAMETERS - { - std::uint32_t dirtyRectsCount; - RECT* dirtyRects; - RECT* scrollRect; - POINT* scrollOffset; - }; - - struct DXGI_SWAP_CHAIN_DESC1 - { - std::uint32_t width; - std::uint32_t height; - DXGI_FORMAT format; - BOOL stereo; - DXGI_SAMPLE_DESC sampleDesc; - DXGI_USAGE bufferUsage; - std::uint32_t bufferCount; - DXGI_SCALING scaling; - DXGI_SWAP_EFFECT swapEffect; - DXGI_ALPHA_MODE alphaMode; - std::uint32_t flags; - }; - - struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC - { - DXGI_RATIONAL refreshRate; - DXGI_MODE_SCANLINE_ORDER scanlineOrdering; - DXGI_MODE_SCALING scaling; - BOOL windowed; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("0AA1AE0A-FA0E-4B84-8644-E05FF8E5ACB5")) - IDXGIAdapter2 : public IDXGIAdapter1 - { - virtual HRESULT GetDesc2(DXGI_ADAPTER_DESC2* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("05008617-FBFD-4051-A790-144884B4F6A9")) - IDXGIDevice2 : public IDXGIDevice1 - { - virtual HRESULT OfferResources(std::uint32_t a_numResources, IDXGIResource* const* a_resources, DXGI_OFFER_RESOURCE_PRIORITY a_priority) = 0; - virtual HRESULT ReclaimResources(std::uint32_t a_numResources, IDXGIResource* const* a_resources, BOOL* a_discarded) = 0; - virtual HRESULT EnqueueSetEvent(HANDLE a_event) = 0; - }; - - struct __declspec(novtable, uuid("EA9DBF1A-C88E-4486-854A-98AA0138F30C")) - IDXGIDisplayControl : public IUnknown - { - virtual BOOL IsStereoEnabled(void) = 0; - virtual void SetStereoEnabled(BOOL a_enabled) = 0; - }; - - struct __declspec(novtable, uuid("50C83A1C-E072-4C48-87B0-3630FA36A6D0")) - IDXGIFactory2 : public IDXGIFactory1 - { - virtual BOOL IsWindowedStereoEnabled(void) = 0; - virtual HRESULT CreateSwapChainForHwnd(IUnknown* a_device, HWND a_wnd, const DXGI_SWAP_CHAIN_DESC1* a_desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* a_fullscreenDesc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - virtual HRESULT CreateSwapChainForCoreWindow(IUnknown* a_device, IUnknown* a_window, const DXGI_SWAP_CHAIN_DESC1* a_desc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - virtual HRESULT GetSharedResourceAdapterLuid(HANDLE a_resource, LUID* a_luid) = 0; - virtual HRESULT RegisterStereoStatusWindow(HWND a_wnd, std::uint32_t a_msg, std::uint32_t* a_cookie) = 0; - virtual HRESULT RegisterStereoStatusEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterStereoStatus(std::uint32_t a_cookie) = 0; - virtual HRESULT RegisterOcclusionStatusWindow(HWND a_wnd, std::uint32_t a_msg, std::uint32_t* a_cookie) = 0; - virtual HRESULT RegisterOcclusionStatusEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterOcclusionStatus(std::uint32_t dwCookie) = 0; - virtual HRESULT CreateSwapChainForComposition(IUnknown* a_device, const DXGI_SWAP_CHAIN_DESC1* a_desc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - }; - - struct __declspec(novtable, uuid("00CDDEA8-939B-4B83-A340-A685226666CC")) - IDXGIOutput1 : public IDXGIOutput - { - virtual HRESULT GetDisplayModeList1(DXGI_FORMAT a_enumFormat, std::uint32_t a_flags, std::uint32_t* a_numModes, DXGI_MODE_DESC1* a_desc) = 0; - virtual HRESULT FindClosestMatchingMode1(const DXGI_MODE_DESC1* a_modeToMatch, DXGI_MODE_DESC1* a_closestMatch, IUnknown* a_concernedDevice) = 0; - virtual HRESULT GetDisplaySurfaceData1(IDXGIResource* a_destination) = 0; - virtual HRESULT DuplicateOutput(IUnknown* a_device, IDXGIOutputDuplication** a_outputDuplication) = 0; - }; - - struct __declspec(novtable, uuid("191CFAC3-A341-470D-B26E-A864F428319C")) - IDXGIOutputDuplication : public IDXGIObject - { - virtual void GetDesc(DXGI_OUTDUPL_DESC* a_desc) = 0; - virtual HRESULT AcquireNextFrame(std::uint32_t a_timeoutInMilliseconds, DXGI_OUTDUPL_FRAME_INFO* a_frameInfo, IDXGIResource** a_desktopResource) = 0; - virtual HRESULT GetFrameDirtyRects(std::uint32_t a_dirtyRectsBufferSize, RECT* a_dirtyRectsBuffer, std::uint32_t* a_dirtyRectsBufferSizeRequired) = 0; - virtual HRESULT GetFrameMoveRects(std::uint32_t a_moveRectsBufferSize, DXGI_OUTDUPL_MOVE_RECT* a_moveRectBuffer, std::uint32_t* a_moveRectsBufferSizeRequired) = 0; - virtual HRESULT GetFramePointerShape(std::uint32_t a_pointerShapeBufferSize, void* a_pointerShapeBuffer, std::uint32_t* a_pointerShapeBufferSizeRequired, DXGI_OUTDUPL_POINTER_SHAPE_INFO* a_pointerShapeInfo) = 0; - virtual HRESULT MapDesktopSurface(DXGI_MAPPED_RECT* a_lockedRect) = 0; - virtual HRESULT UnMapDesktopSurface(void) = 0; - virtual HRESULT ReleaseFrame(void) = 0; - }; - - struct __declspec(novtable, uuid("30961379-4609-4A41-998E-54FE567EE0C1")) - IDXGIResource1 : public IDXGIResource - { - virtual HRESULT CreateSubresourceSurface(std::uint32_t a_index, IDXGISurface2** a_surface) = 0; - virtual HRESULT CreateSharedHandle(const SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_access, const wchar_t* a_name, HANDLE* a_handle) = 0; - }; - - struct __declspec(novtable, uuid("ABA496DD-B617-4CB8-A866-BC44D7EB1FA2")) - IDXGISurface2 : public IDXGISurface1 - { - virtual HRESULT GetResource(const IID& a_iid, void** a_parentResource, std::uint32_t* a_subresourceIndex) = 0; - }; - - struct __declspec(novtable, uuid("790A45F7-0D42-4876-983A-0A55CFE6F4AA")) - IDXGISwapChain1 : public IDXGISwapChain - { - virtual HRESULT GetDesc1(DXGI_SWAP_CHAIN_DESC1* a_desc) = 0; - virtual HRESULT GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC* a_desc) = 0; - virtual HRESULT GetHwnd(HWND* a_wnd) = 0; - virtual HRESULT GetCoreWindow(const IID& a_iid, void** a_unk) = 0; - virtual HRESULT Present1(std::uint32_t a_syncInterval, std::uint32_t a_presentFlags, const DXGI_PRESENT_PARAMETERS* a_presentParameters) = 0; - virtual BOOL IsTemporaryMonoSupported(void) = 0; - virtual HRESULT GetRestrictToOutput(IDXGIOutput** a_restrictToOutput) = 0; - virtual HRESULT SetBackgroundColor(const DXGI_RGBA* a_color) = 0; - virtual HRESULT GetBackgroundColor(DXGI_RGBA* a_color) = 0; - virtual HRESULT SetRotation(DXGI_MODE_ROTATION a_rotation) = 0; - virtual HRESULT GetRotation(DXGI_MODE_ROTATION* a_rotation) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter2{ 0x0AA1AE0A, 0xFA0E, 0x4B84, { 0x86, 0x44, 0xE0, 0x5F, 0xF8, 0xE5, 0xAC, 0xB5 } }; - inline constexpr IID IID_IDXGIDevice2{ 0x05008617, 0xFBFD, 0x4051, { 0xA7, 0x90, 0x14, 0x48, 0x84, 0xB4, 0xF6, 0xA9 } }; - inline constexpr IID IID_IDXGIDisplayControl{ 0xEA9DBF1A, 0xC88E, 0x4486, { 0x85, 0x4A, 0x98, 0xAA, 0x01, 0x38, 0xF3, 0x0C } }; - inline constexpr IID IID_IDXGIFactory2{ 0x50C83A1C, 0xE072, 0x4C48, { 0x87, 0xB0, 0x36, 0x30, 0xFA, 0x36, 0xA6, 0xD0 } }; - inline constexpr IID IID_IDXGIOutput1{ 0x00CDDEA8, 0x939B, 0x4B83, { 0xA3, 0x40, 0xA6, 0x85, 0x22, 0x66, 0x66, 0xCC } }; - inline constexpr IID IID_IDXGIOutputDuplication{ 0x191CFAC3, 0xA341, 0x470D, { 0xB2, 0x6E, 0xA8, 0x64, 0xF4, 0x28, 0x31, 0x9C } }; - inline constexpr IID IID_IDXGIResource1{ 0x30961379, 0x4609, 0x4A41, { 0x99, 0x8E, 0x54, 0xFE, 0x56, 0x7E, 0xE0, 0xC1 } }; - inline constexpr IID IID_IDXGISurface2{ 0xABA496DD, 0xB617, 0x4CB8, { 0xA8, 0x66, 0xBC, 0x44, 0xD7, 0xEB, 0x1F, 0xA2 } }; - inline constexpr IID IID_IDXGISwapChain1{ 0x790A45F7, 0x0D42, 0x4876, { 0x98, 0x3A, 0x0A, 0x55, 0xCF, 0xE6, 0xF4, 0xAA } }; -} diff --git a/include/REX/W32/DXGI_3.h b/include/REX/W32/DXGI_3.h deleted file mode 100644 index 04333f6da..000000000 --- a/include/REX/W32/DXGI_3.h +++ /dev/null @@ -1,148 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_2.h" - -namespace REX::W32 -{ - struct IDXGIDecodeSwapChain; - struct IDXGIDevice3; - struct IDXGIFactory3; - struct IDXGIFactoryMedia; - struct IDXGIOutput2; - struct IDXGIOutput3; - struct IDXGISwapChain2; - struct IDXGISwapChainMedia; -} - -namespace REX::W32 -{ - enum DXGI_FRAME_PRESENTATION_MODE - { - DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0, - DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1, - DXGI_FRAME_PRESENTATION_MODE_NONE = 2, - DXGI_FRAME_PRESENTATION_MODE_COMPOSITION_FAILURE = 3, - }; - - enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS - { - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, - DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, - }; - - enum DXGI_OVERLAY_SUPPORT_FLAG - { - DXGI_OVERLAY_SUPPORT_FLAG_DIRECT = 0x1, - DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2, - }; -} - -namespace REX::W32 -{ - struct DXGI_DECODE_SWAP_CHAIN_DESC - { - std::uint32_t flags; - }; - - struct DXGI_FRAME_STATISTICS_MEDIA - { - std::uint32_t presentCount; - std::uint32_t presentRefreshCount; - std::uint32_t syncRefreshCount; - std::int64_t syncQPCTime; - std::int64_t syncGPUTime; - DXGI_FRAME_PRESENTATION_MODE compositionMode; - std::uint32_t approvedPresentDuration; - }; - - struct DXGI_MATRIX_3X2_F - { - float _11; - float _12; - float _21; - float _22; - float _31; - float _32; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("2633066B-4514-4C7A-8FD8-12EA98059D18")) - IDXGIDecodeSwapChain : public IUnknown - { - virtual HRESULT PresentBuffer(std::uint32_t a_bufferToPresent, std::uint32_t a_syncInterval, std::uint32_t a_flags) = 0; - virtual HRESULT SetSourceRect(const RECT* a_rect) = 0; - virtual HRESULT SetTargetRect(const RECT* a_rect) = 0; - virtual HRESULT SetDestSize(std::uint32_t a_width, std::uint32_t a_height) = 0; - virtual HRESULT GetSourceRect(RECT* a_rect) = 0; - virtual HRESULT GetTargetRect(RECT* a_rect) = 0; - virtual HRESULT GetDestSize(std::uint32_t* a_width, std::uint32_t* a_height) = 0; - virtual HRESULT SetColorSpace(DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS a_colorSpace) = 0; - virtual DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS GetColorSpace(void) = 0; - }; - - struct __declspec(novtable, uuid("6007896C-3244-4AFD-BF18-A6D3BEDA5023")) - IDXGIDevice3 : public IDXGIDevice2 - { - virtual void Trim(void) = 0; - }; - - struct __declspec(novtable, uuid("25483823-CD46-4C7D-86CA-47AA95B837BD")) - IDXGIFactory3 : public IDXGIFactory2 - { - virtual std::uint32_t GetCreationFlags(void) = 0; - }; - - struct __declspec(novtable, uuid("41E7D1F2-A591-4F7B-A2E5-FA9C843E1C12")) - IDXGIFactoryMedia : public IUnknown - { - virtual HRESULT CreateSwapChainForCompositionSurfaceHandle(IUnknown* a_device, HANDLE a_surface, const DXGI_SWAP_CHAIN_DESC1* a_desc, IDXGIOutput* a_restrictToOutput, IDXGISwapChain1** a_swapChain) = 0; - virtual HRESULT CreateDecodeSwapChainForCompositionSurfaceHandle(IUnknown* a_device, HANDLE a_surface, DXGI_DECODE_SWAP_CHAIN_DESC* a_desc, IDXGIResource* a_yuvDecodeBuffers, IDXGIOutput* a_restrictToOutput, IDXGIDecodeSwapChain** a_swapChain) = 0; - }; - - struct __declspec(novtable, uuid("595E39D1-2724-4663-99B1-DA969DE28364")) - IDXGIOutput2 : public IDXGIOutput1 - { - virtual BOOL SupportsOverlays(void) = 0; - }; - - struct __declspec(novtable, uuid("8A6BB301-7E7E-41F4-A8E0-5B32F7F99B18")) - IDXGIOutput3 : public IDXGIOutput2 - { - virtual HRESULT CheckOverlaySupport(DXGI_FORMAT a_enumFormat, IUnknown* a_concernedDevice, std::uint32_t* a_flags) = 0; - }; - - struct __declspec(novtable, uuid("A8BE2AC4-199F-4946-B331-79599FB98DE7")) - IDXGISwapChain2 : public IDXGISwapChain1 - { - virtual HRESULT SetSourceSize(std::uint32_t a_width, std::uint32_t a_height) = 0; - virtual HRESULT GetSourceSize(std::uint32_t* a_width, std::uint32_t* a_height) = 0; - virtual HRESULT SetMaximumFrameLatency(std::uint32_t a_maxLatency) = 0; - virtual HRESULT GetMaximumFrameLatency(std::uint32_t* a_maxLatency) = 0; - virtual HANDLE GetFrameLatencyWaitableObject(void) = 0; - virtual HRESULT SetMatrixTransform(const DXGI_MATRIX_3X2_F* a_matrix) = 0; - virtual HRESULT GetMatrixTransform(DXGI_MATRIX_3X2_F* a_matrix) = 0; - }; - - struct __declspec(novtable, uuid("DD95B90B-F05F-4F6A-BD65-25BFB264BD84")) - IDXGISwapChainMedia : public IUnknown - { - virtual HRESULT GetFrameStatisticsMedia(DXGI_FRAME_STATISTICS_MEDIA* a_stats) = 0; - virtual HRESULT SetPresentDuration(std::uint32_t a_duration) = 0; - virtual HRESULT CheckPresentDurationSupport(std::uint32_t a_desiredPresentDuration, std::uint32_t* a_closestSmallerPresentDuration, std::uint32_t* a_closestLargerPresentDuration) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIDecodeSwapChain{ 0x2633066B, 0x4514, 0x4C7A, { 0x8F, 0xD8, 0x12, 0xEA, 0x98, 0x05, 0x9D, 0x18 } }; - inline constexpr IID IID_IDXGIDevice3{ 0x6007896C, 0x3244, 0x4AFD, { 0xBF, 0x18, 0xA6, 0xD3, 0xBE, 0xDA, 0x50, 0x23 } }; - inline constexpr IID IID_IDXGIFactory3{ 0x25483823, 0xCD46, 0x4C7D, { 0x86, 0xCA, 0x47, 0xAA, 0x95, 0xB8, 0x37, 0xBD } }; - inline constexpr IID IID_IDXGIFactoryMedia{ 0x41E7D1F2, 0xA591, 0x4F7B, { 0xA2, 0xE5, 0xFA, 0x9C, 0x84, 0x3E, 0x1C, 0x12 } }; - inline constexpr IID IID_IDXGIOutput2{ 0x595E39D1, 0x2724, 0x4663, { 0x99, 0xB1, 0xDA, 0x96, 0x9D, 0xE2, 0x83, 0x64 } }; - inline constexpr IID IID_IDXGIOutput3{ 0x8A6BB301, 0x7E7E, 0x41F4, { 0xA8, 0xE0, 0x5B, 0x32, 0xF7, 0xF9, 0x9B, 0x18 } }; - inline constexpr IID IID_IDXGISwapChain2{ 0xA8BE2AC4, 0x199F, 0x4946, { 0xB3, 0x31, 0x79, 0x59, 0x9F, 0xB9, 0x8D, 0xE7 } }; - inline constexpr IID IID_IDXGISwapChainMedia{ 0xDD95B90B, 0xF05F, 0x4F6A, { 0xBD, 0x65, 0x25, 0xBF, 0xB2, 0x64, 0xBD, 0x84 } }; -} diff --git a/include/REX/W32/DXGI_4.h b/include/REX/W32/DXGI_4.h deleted file mode 100644 index 5e60b9731..000000000 --- a/include/REX/W32/DXGI_4.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_3.h" - -namespace REX::W32 -{ - struct IDXGIAdapter3; - struct IDXGIFactory4; - struct IDXGIOutput4; - struct IDXGISwapChain3; -} - -namespace REX::W32 -{ - enum DXGI_MEMORY_SEGMENT_GROUP - { - DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0, - DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1, - }; - - enum DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG - { - DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, - }; - - enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG - { - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x1, - DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x2, - }; -} - -namespace REX::W32 -{ - struct DXGI_QUERY_VIDEO_MEMORY_INFO - { - std::uint64_t budget; - std::uint64_t currentUsage; - std::uint64_t availableForReservation; - std::uint64_t currentReservation; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("645967A4-1392-4310-A798-8053CE3E93FD")) - IDXGIAdapter3 : public IDXGIAdapter2 - { - virtual HRESULT RegisterHardwareContentProtectionTeardownStatusEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterHardwareContentProtectionTeardownStatus(std::uint32_t a_cookie) = 0; - virtual HRESULT QueryVideoMemoryInfo(std::uint32_t a_nodeIndex, DXGI_MEMORY_SEGMENT_GROUP a_memorySegmentGroup, DXGI_QUERY_VIDEO_MEMORY_INFO* a_videoMemoryInfo) = 0; - virtual HRESULT SetVideoMemoryReservation(std::uint32_t a_nodeIndex, DXGI_MEMORY_SEGMENT_GROUP a_memorySegmentGroup, std::uint64_t a_reservation) = 0; - virtual HRESULT RegisterVideoMemoryBudgetChangeNotificationEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual void UnregisterVideoMemoryBudgetChangeNotification(std::uint32_t a_cookie) = 0; - }; - - struct __declspec(novtable, uuid("1BC6EA02-EF36-464F-BF0C-21CA39E5168A")) - IDXGIFactory4 : public IDXGIFactory3 - { - virtual HRESULT EnumAdapterByLuid(LUID a_luid, const IID& a_iid, void** a_adapter) = 0; - virtual HRESULT EnumWarpAdapter(const IID& a_iid, void** a_adapter) = 0; - }; - - struct __declspec(novtable, uuid("DC7DCA35-2196-414D-9F53-617884032A60")) - IDXGIOutput4 : public IDXGIOutput3 - { - virtual HRESULT CheckOverlayColorSpaceSupport(DXGI_FORMAT a_format, DXGI_COLOR_SPACE_TYPE a_colorSpace, IUnknown* a_concernedDevice, std::uint32_t* a_flags) = 0; - }; - - struct __declspec(novtable, uuid("94D99BDB-F1F8-4AB0-B236-7DA0170EDAB1")) - IDXGISwapChain3 : public IDXGISwapChain2 - { - virtual std::uint32_t GetCurrentBackBufferIndex(void) = 0; - virtual HRESULT CheckColorSpaceSupport(DXGI_COLOR_SPACE_TYPE a_colorSpace, std::uint32_t* a_colorSpaceSupport) = 0; - virtual HRESULT SetColorSpace1(DXGI_COLOR_SPACE_TYPE a_colorSpace) = 0; - virtual HRESULT ResizeBuffers1(std::uint32_t a_bufferCount, std::uint32_t a_width, std::uint32_t a_height, DXGI_FORMAT a_format, std::uint32_t a_swapChainFlags, const std::uint32_t* a_creationNodeMask, IUnknown* const* a_presentQueue) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter3{ 0x645967A4, 0x1392, 0x4310, { 0xA7, 0x98, 0x80, 0x53, 0xCE, 0x3E, 0x93, 0xFD } }; - inline constexpr IID IID_IDXGIFactory4{ 0x1BC6EA02, 0xEF36, 0x464F, { 0xBF, 0x0C, 0x21, 0xCA, 0x39, 0xE5, 0x16, 0x8A } }; - inline constexpr IID IID_IDXGIOutput4{ 0xDC7DCA35, 0x2196, 0x414D, { 0x9F, 0x53, 0x61, 0x78, 0x84, 0x03, 0x2A, 0x60 } }; - inline constexpr IID IID_IDXGISwapChain3{ 0x94D99BDB, 0xF1F8, 0x4AB0, { 0xB2, 0x36, 0x7D, 0xA0, 0x17, 0x0E, 0xDA, 0xB1 } }; -} diff --git a/include/REX/W32/DXGI_5.h b/include/REX/W32/DXGI_5.h deleted file mode 100644 index 7ebf3b702..000000000 --- a/include/REX/W32/DXGI_5.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_4.h" - -namespace REX::W32 -{ - struct IDXGIDevice4; - struct IDXGIFactory5; - struct IDXGIOutput5; - struct IDXGISwapChain4; -} - -namespace REX::W32 -{ - enum DXGI_FEATURE - { - DXGI_FEATURE_PRESENT_ALLOW_TEARING = 0, - }; - - enum DXGI_HDR_METADATA_TYPE - { - DXGI_HDR_METADATA_TYPE_NONE = 0, - DXGI_HDR_METADATA_TYPE_HDR10 = 1, - DXGI_HDR_METADATA_TYPE_HDR10PLUS = 2, - }; - - enum DXGI_OFFER_RESOURCE_FLAGS - { - DXGI_OFFER_RESOURCE_FLAG_ALLOW_DECOMMIT = 0x1, - }; - - enum DXGI_RECLAIM_RESOURCE_RESULTS - { - DXGI_RECLAIM_RESOURCE_RESULT_OK = 0, - DXGI_RECLAIM_RESOURCE_RESULT_DISCARDED = 1, - DXGI_RECLAIM_RESOURCE_RESULT_NOT_COMMITTED = 2, - }; -} - -namespace REX::W32 -{ - struct DXGI_HDR_METADATA_HDR10 - { - std::uint16_t redPrimary[2]; - std::uint16_t GreenPrimary[2]; - std::uint16_t bluePrimary[2]; - std::uint16_t whitePoint[2]; - std::uint32_t maxMasteringLuminance; - std::uint32_t minMasteringLuminance; - std::uint16_t maxContentLightLevel; - std::uint16_t maxFrameAverageLightLevel; - }; - - struct DXGI_HDR_METADATA_HDR10PLUS - { - std::uint8_t data[72]; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("95B4F95F-D8DA-4CA4-9EE6-3B76D5968A10")) - IDXGIDevice4 : public IDXGIDevice3 - { - virtual HRESULT OfferResources1(std::uint32_t a_numResources, IDXGIResource* const* a_resources, DXGI_OFFER_RESOURCE_PRIORITY a_priority, std::uint32_t a_flags) = 0; - virtual HRESULT ReclaimResources1(std::uint32_t a_numResources, IDXGIResource* const* a_resources, DXGI_RECLAIM_RESOURCE_RESULTS* a_results) = 0; - }; - - struct __declspec(novtable, uuid("7632E1F5-EE65-4DCA-87FD-84CD75F8838D")) - IDXGIFactory5 : public IDXGIFactory4 - { - virtual HRESULT CheckFeatureSupport(DXGI_FEATURE a_feature, void* a_featureSupportData, std::uint32_t a_featureSupportDataSize) = 0; - }; - - struct __declspec(novtable, uuid("80A07424-AB52-42EB-833C-0C42FD282D98")) - IDXGIOutput5 : public IDXGIOutput4 - { - virtual HRESULT DuplicateOutput1(IUnknown* a_device, std::uint32_t a_flags, std::uint32_t a_supportedFormatsCount, const DXGI_FORMAT* a_supportedFormats, IDXGIOutputDuplication** a_outputDuplication) = 0; - }; - - struct __declspec(novtable, uuid("3D585D5A-BD4A-489E-B1F4-3DBCB6452FFB")) - IDXGISwapChain4 : public IDXGISwapChain3 - { - virtual HRESULT SetHDRMetaData(DXGI_HDR_METADATA_TYPE a_type, std::uint32_t a_size, void* a_metaData) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIDevice4{ 0x95B4F95F, 0xD8DA, 0x4CA4, { 0x9E, 0xE6, 0x3B, 0x76, 0xD5, 0x96, 0x8A, 0x10 } }; - inline constexpr IID IID_IDXGIFactory5{ 0x7632E1F5, 0xEE65, 0x4DCA, { 0x87, 0xFD, 0x84, 0xCD, 0x75, 0xF8, 0x83, 0x8D } }; - inline constexpr IID IID_IDXGIOutput5{ 0x80A07424, 0xAB52, 0x42EB, { 0x83, 0x3C, 0x0C, 0x42, 0xFD, 0x28, 0x2D, 0x98 } }; - inline constexpr IID IID_IDXGISwapChain4{ 0x3D585D5A, 0xBD4A, 0x489E, { 0xB1, 0xF4, 0x3D, 0xBC, 0xB6, 0x45, 0x2F, 0xFB } }; -} diff --git a/include/REX/W32/DXGI_6.h b/include/REX/W32/DXGI_6.h deleted file mode 100644 index 1d2915997..000000000 --- a/include/REX/W32/DXGI_6.h +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -#include "REX/W32/DXGI_5.h" - -namespace REX::W32 -{ - struct IDXGIAdapter4; - struct IDXGIFactory6; - struct IDXGIFactory7; - struct IDXGIOutput6; -} - -namespace REX::W32 -{ - enum DXGI_ADAPTER_FLAG3 - { - DXGI_ADAPTER_FLAG3_NONE = 0, - DXGI_ADAPTER_FLAG3_REMOTE = 1, - DXGI_ADAPTER_FLAG3_SOFTWARE = 2, - DXGI_ADAPTER_FLAG3_ACG_COMPATIBLE = 4, - DXGI_ADAPTER_FLAG3_SUPPORT_MONITORED_FENCES = 8, - DXGI_ADAPTER_FLAG3_SUPPORT_NON_MONITORED_FENCES = 0x10, - DXGI_ADAPTER_FLAG3_KEYED_MUTEX_CONFORMANCE = 0x20, - DXGI_ADAPTER_FLAG3_FORCE_DWORD = 0xFFFFFFFF, - }; - - enum DXGI_GPU_PREFERENCE - { - DXGI_GPU_PREFERENCE_UNSPECIFIED = 0, - DXGI_GPU_PREFERENCE_MINIMUM_POWER = (DXGI_GPU_PREFERENCE_UNSPECIFIED + 1), - DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE = (DXGI_GPU_PREFERENCE_MINIMUM_POWER + 1), - }; - - enum DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAGS - { - DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_FULLSCREEN = 1, - DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_WINDOWED = 2, - DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_CURSOR_STRETCHED = 4, - }; -} - -namespace REX::W32 -{ - struct DXGI_ADAPTER_DESC3 - { - wchar_t description[128]; - std::uint32_t vendorID; - std::uint32_t deviceID; - std::uint32_t subSysID; - std::uint32_t revision; - std::size_t dedicatedVideoMemory; - std::size_t dedicatedSystemMemory; - std::size_t sharedSystemMemory; - LUID adapterLUID; - DXGI_ADAPTER_FLAG3 flags; - DXGI_GRAPHICS_PREEMPTION_GRANULARITY graphicsPreemptionGranularity; - DXGI_COMPUTE_PREEMPTION_GRANULARITY computePreemptionGranularity; - }; - - struct DXGI_OUTPUT_DESC1 - { - wchar_t deviceName[32]; - RECT desktopCoordinates; - BOOL attachedToDesktop; - DXGI_MODE_ROTATION rotation; - HMONITOR monitor; - std::uint32_t bitsPerColor; - DXGI_COLOR_SPACE_TYPE colorSpace; - float redPrimary[2]; - float greenPrimary[2]; - float bluePrimary[2]; - float whitePoint[2]; - float minLuminance; - float maxLuminance; - float maxFullFrameLuminance; - }; -} - -namespace REX::W32 -{ - struct __declspec(novtable, uuid("3C8D99D1-4FBF-4181-A82C-AF66BF7BD24E")) - IDXGIAdapter4 : public IDXGIAdapter3 - { - virtual HRESULT GetDesc3(DXGI_ADAPTER_DESC3* a_desc) = 0; - }; - - struct __declspec(novtable, uuid("C1B6694F-FF09-44A9-B03C-77900A0A1D17")) - IDXGIFactory6 : public IDXGIFactory5 - { - virtual HRESULT EnumAdapterByGpuPreference(std::uint32_t a_adapterFlags, DXGI_GPU_PREFERENCE a_gpuPreference, const IID& a_iid, void** a_adapter) = 0; - }; - - struct __declspec(novtable, uuid("A4966EED-76DB-44DA-84C1-EE9A7AFB20A8")) - IDXGIFactory7 : public IDXGIFactory6 - { - virtual HRESULT RegisterAdaptersChangedEvent(HANDLE a_event, std::uint32_t* a_cookie) = 0; - virtual HRESULT UnregisterAdaptersChangedEvent(std::uint32_t a_cookie) = 0; - }; - - struct __declspec(novtable, uuid("068346E8-AAEC-4B84-ADD7-137F513F77A1")) - IDXGIOutput6 : public IDXGIOutput5 - { - virtual HRESULT GetDesc1(DXGI_OUTPUT_DESC1* a_desc) = 0; - virtual HRESULT CheckHardwareCompositionSupport(std::uint32_t* a_flags) = 0; - }; -} - -namespace REX::W32 -{ - inline constexpr IID IID_IDXGIAdapter4{ 0x3C8D99D1, 0x4FBF, 0x4181, { 0xA8, 0x2C, 0xAF, 0x66, 0xBF, 0x7B, 0xD2, 0x4E } }; - inline constexpr IID IID_IDXGIFactory6{ 0xC1B6694F, 0xFF09, 0x44A9, { 0xB0, 0x3C, 0x77, 0x90, 0x0A, 0x0A, 0x1D, 0x17 } }; - inline constexpr IID IID_IDXGIFactory7{ 0xA4966EED, 0x76DB, 0x44DA, { 0x84, 0xC1, 0xEE, 0x9A, 0x7A, 0xFB, 0x20, 0xA8 } }; - inline constexpr IID IID_IDXGIOutput6{ 0x068346E8, 0xAAEC, 0x4B84, { 0xAD, 0xD7, 0x13, 0x7F, 0x51, 0x3F, 0x77, 0xA1 } }; -} diff --git a/include/REX/W32/KERNEL32.h b/include/REX/W32/KERNEL32.h deleted file mode 100644 index a82531a7c..000000000 --- a/include/REX/W32/KERNEL32.h +++ /dev/null @@ -1,506 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - // standard access - inline constexpr auto STANDARD_RIGHTS_REQUIRED{ 0x000F0000 }; - inline constexpr auto STANDARD_RIGHTS_ALL{ 0x001F0000 }; - - // code page identifiers - inline constexpr auto CP_UTF8{ 65001u }; - - // memory allocation types - inline constexpr auto MEM_COMMIT{ 0x00001000u }; - inline constexpr auto MEM_RESERVE{ 0x00002000u }; - inline constexpr auto MEM_DECOMMIT{ 0x00004000u }; - inline constexpr auto MEM_RELEASE{ 0x00008000u }; - inline constexpr auto MEM_FREE{ 0x00010000u }; - inline constexpr auto MEM_RESET{ 0x00080000u }; - inline constexpr auto MEM_RESET_UNDO{ 0x01000000u }; - - // memory page protection attributes - inline constexpr auto PAGE_NOACCESS{ 0x00000001u }; - inline constexpr auto PAGE_READONLY{ 0x00000002u }; - inline constexpr auto PAGE_READWRITE{ 0x00000004u }; - inline constexpr auto PAGE_WRITECOPY{ 0x00000008u }; - inline constexpr auto PAGE_EXECUTE{ 0x00000010u }; - inline constexpr auto PAGE_EXECUTE_READ{ 0x00000020u }; - inline constexpr auto PAGE_EXECUTE_READWRITE{ 0x00000040u }; - - // memory section - inline constexpr auto SECTION_QUERY{ 0x00000001 }; - inline constexpr auto SECTION_MAP_WRITE{ 0x00000002 }; - inline constexpr auto SECTION_MAP_READ{ 0x00000004 }; - inline constexpr auto SECTION_MAP_EXECUTE{ 0x00000008 }; - inline constexpr auto SECTION_EXTEND_SIZE{ 0x00000010 }; - inline constexpr auto SECTION_MAP_EXECUTE_EXPLICIT{ 0x00000020 }; - inline constexpr auto SECTION_ALL_ACCESS{ - STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE - }; - - // file attributes - inline constexpr auto FILE_ATTRIBUTE_READONLY{ 0x00000001u }; - inline constexpr auto FILE_ATTRIBUTE_HIDDEN{ 0x00000002u }; - inline constexpr auto FILE_ATTRIBUTE_SYSTEM{ 0x00000004u }; - inline constexpr auto FILE_ATTRIBUTE_DIRECTORY{ 0x00000010u }; - inline constexpr auto FILE_ATTRIBUTE_ARCHIVE{ 0x00000020u }; - - // 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 ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; - std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept; - bool FindClose(HANDLE a_file) noexcept; - HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept; - HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept; - bool FindNextFileA(HANDLE a_file, WIN32_FIND_DATAA* a_data) noexcept; - bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept; - bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept; - bool FreeLibrary(HMODULE a_module) noexcept; - 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/NT.h b/include/REX/W32/NT.h deleted file mode 100644 index 9a410f64b..000000000 --- a/include/REX/W32/NT.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - struct EXCEPTION_REGISTRATION_RECORD; - struct PEB_LDR_DATA; - struct RTL_USER_PROCESS_PARAMETERS; - struct UNICODE_STRING; - - using PS_POST_PROCESS_INIT_ROUTINE = void (*)(); - - struct LIST_ENTRY - { - struct LIST_ENTRY* fLink; - struct LIST_ENTRY* bLink; - }; - - struct NT_TIB - { - EXCEPTION_REGISTRATION_RECORD* exceptionList; - void* stackBase; - void* stackLimit; - void* subSystemTib; - union - { - void* fiberData; - std::uint32_t version; - }; - void* arbitraryUserPointer; - struct NT_TIB* self; - }; - - struct PEB - { - std::byte reserved1[2]; - std::byte beingDebugged; - std::byte reserved2[1]; - void* reserved3[2]; - PEB_LDR_DATA* ldr; - RTL_USER_PROCESS_PARAMETERS* processParameters; - void* reserved4[3]; - void* atlThunkSListPtr; - void* reserved5; - std::uint32_t reserved6; - void* reserved7; - std::uint32_t reserved8; - std::uint32_t atlThunkSListPtr32; - void* reserved9[45]; - std::byte reserved10[96]; - PS_POST_PROCESS_INIT_ROUTINE postProcessInitRoutine; - std::byte reserved11[128]; - void* reserved12[1]; - std::uint32_t sessionID; - }; - - struct PEB_LDR_DATA - { - std::byte reserved1[8]; - void* reserved2[3]; - LIST_ENTRY inMemoryOrderModuleList; - }; - - struct RTL_USER_PROCESS_PARAMETERS - { - std::byte reserved1[16]; - void* reserved2[10]; - UNICODE_STRING imagePathName; - UNICODE_STRING commandLine; - }; - - struct TEB - { - void* reserved1[11]; - void* threadLocalStoragePointer; - PEB* processEnvironmentBlock; - void* reserved2[399]; - std::byte reserved3[1952]; - void* tlsSlots[64]; - std::byte reserved4[8]; - void* reserved5[26]; - void* reservedForOle; - void* reserved6[4]; - void* tlsExpansionSlots; - }; -} - -namespace REX::W32 -{ - TEB* NtCurrentTeb() noexcept; -} diff --git a/include/REX/W32/OLE32.h b/include/REX/W32/OLE32.h deleted file mode 100644 index 517861ec4..000000000 --- a/include/REX/W32/OLE32.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - void CoTaskMemFree(void* a_block) noexcept; -} diff --git a/include/REX/W32/SHELL32.h b/include/REX/W32/SHELL32.h deleted file mode 100644 index e99e7d29f..000000000 --- a/include/REX/W32/SHELL32.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - // known folder ids - inline constexpr GUID FOLDERID_Documents{ 0xFDD39AD0u, 0x238Fu, 0x46AFu, { 0xADu, 0xB4u, 0x6Cu, 0x85u, 0x48u, 0x03u, 0x69u, 0xC7u } }; - inline constexpr GUID FOLDERID_Pictures{ 0x33E28130u, 0x4E1Eu, 0x4676u, { 0x83u, 0x5Au, 0x98u, 0x39u, 0x5Cu, 0x3Bu, 0xC3u, 0xBBu } }; - inline constexpr GUID FOLDERID_ProgramData{ 0x62AB5D82u, 0xFDC1u, 0x4DC3u, { 0xA9u, 0xDDu, 0x07u, 0x0Du, 0x1Du, 0x49u, 0x5Du, 0x97u } }; - - // known folder flags - inline constexpr auto KF_FLAG_DEFAULT{ 0x00000000u }; - inline constexpr auto KF_FLAG_FORCE_APP_DATA_REDIRECTION{ 0x00080000u }; - inline constexpr auto KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET{ 0x00040000u }; - inline constexpr auto KF_FLAG_FORCE_PACKAGE_REDIRECTION{ 0x00020000u }; - inline constexpr auto KF_FLAG_NO_PACKAGE_REDIRECTION{ 0x00010000u }; - inline constexpr auto KF_FLAG_FORCE_APPCONTAINER_REDIRECTION{ 0x00020000u }; - inline constexpr auto KF_FLAG_NO_APPCONTAINER_REDIRECTION{ 0x00010000u }; - inline constexpr auto KF_FLAG_CREATE{ 0x00008000u }; - inline constexpr auto KF_FLAG_DONT_VERIFY{ 0x00004000u }; - inline constexpr auto KF_FLAG_DONT_UNEXPAND{ 0x00002000u }; - inline constexpr auto KF_FLAG_NO_ALIAS{ 0x00001000u }; - inline constexpr auto KF_FLAG_INIT{ 0x00000800u }; - inline constexpr auto KF_FLAG_DEFAULT_PATH{ 0x00000400u }; - inline constexpr auto KF_FLAG_NOT_PARENT_RELATIVE{ 0x00000200u }; - inline constexpr auto KF_FLAG_SIMPLE_IDLIST{ 0x00000100u }; - inline constexpr auto KF_FLAG_ALIAS_ONLY{ 0x80000000u }; -} - -namespace REX::W32 -{ - std::int32_t SHGetKnownFolderPath(const GUID& a_id, std::uint32_t a_flags, void* a_token, wchar_t** a_path) noexcept; -} diff --git a/include/REX/W32/USER32.h b/include/REX/W32/USER32.h deleted file mode 100644 index f3325fa02..000000000 --- a/include/REX/W32/USER32.h +++ /dev/null @@ -1,293 +0,0 @@ -#pragma once - -#include "REX/W32/BASE.h" - -namespace REX::W32 -{ - enum GWLP : std::int32_t - { - GWLP_USERDATA = -21, - GWLP_ID = -12, - GWLP_HWNDPARENT = -8, - GWLP_HINSTANCE = -6, - GWLP_WNDPROC = -4, - }; - - enum WM : std::uint32_t - { - WM_NULL = 0x0000u, - WM_CREATE = 0x0001u, - WM_DESTROY = 0x0002u, - WM_MOVE = 0x0003u, - WM_SIZE = 0x0005u, - WM_ACTIVATE = 0x0006u, - WM_SETFOCUS = 0x0007u, - WM_KILLFOCUS = 0x0008u, - WM_ENABLE = 0x000Au, - WM_SETREDRAW = 0x000Bu, - WM_SETTEXT = 0x000Cu, - WM_GETTEXT = 0x000Du, - WM_GETTEXTLENGTH = 0x000Eu, - WM_PAINT = 0x000Fu, - WM_CLOSE = 0x0010u, - WM_QUIT = 0x0012u, - WM_ERASEBKGND = 0x0014u, - WM_SHOWWINDOW = 0x0018u, - WM_ACTIVATEAPP = 0x001Cu, - WM_FONTCHANGE = 0x001Du, - WM_TIMECHANGE = 0x001Eu, - WM_CANCELMODE = 0x001Fu, - WM_SETCURSOR = 0x0020u, - WM_MOUSEACTIVATE = 0x0021u, - WM_CHILDACTIVATE = 0x0022u, - }; - - enum VK : std::uint32_t - { - VK_LBUTTON = 0x1, - VK_RBUTTON = 0x2, - VK_CANCEL = 0x3, - VK_MBUTTON = 0x4, - VK_XBUTTON1 = 0x5, - VK_XBUTTON2 = 0x6, - VK_BACK = 0x8, - VK_TAB = 0x9, - VK_RESERVED_0A = 0xA, - VK_RESERVED_0B = 0xB, - VK_CLEAR = 0xC, - VK_RETURN = 0xD, - VK_SHIFT = 0x10, - VK_CONTROL = 0x11, - VK_MENU = 0x12, - VK_PAUSE = 0x13, - VK_CAPITAL = 0x14, - VK_KANA = 0x15, - VK_HANGUEL = 0x15, - VK_HANGUL = 0x15, - VK_IME_ON = 0x16, - VK_JUNJA = 0x17, - VK_FINAL = 0x18, - VK_HANJA = 0x19, - VK_KANJI = VK_HANJA, - VK_IME_OFF = 0x1A, - VK_ESCAPE = 0x1B, - VK_CONVERT = 0x1C, - VK_NONCONVERT = 0x1D, - VK_ACCEPT = 0x1E, - VK_MODECHANGE = 0x1F, - VK_SPACE = 0x20, - VK_PRIOR = 0x21, - VK_NEXT = 0x22, - VK_END = 0x23, - VK_HOME = 0x24, - VK_LEFT = 0x25, - VK_UP = 0x26, - VK_RIGHT = 0x27, - VK_DOWN = 0x28, - VK_SELECT = 0x29, - VK_PRINT = 0x2A, - VK_EXECUTE = 0x2B, - VK_SNAPSHOT = 0x2C, - VK_INSERT = 0x2D, - VK_DELETE = 0x2E, - VK_HELP = 0x2F, - VK_0 = 0x30, - VK_1 = 0x31, - VK_2 = 0x32, - VK_3 = 0x33, - VK_4 = 0x34, - VK_5 = 0x35, - VK_6 = 0x36, - VK_7 = 0x37, - VK_8 = 0x38, - VK_9 = 0x39, - VK_A = 0x41, - VK_B = 0x42, - VK_C = 0x43, - VK_D = 0x44, - VK_E = 0x45, - VK_F = 0x46, - VK_G = 0x47, - VK_H = 0x48, - VK_I = 0x49, - VK_J = 0x4A, - VK_K = 0x4B, - VK_L = 0x4C, - VK_M = 0x4D, - VK_N = 0x4E, - VK_O = 0x4F, - VK_P = 0x50, - VK_Q = 0x51, - VK_R = 0x52, - VK_S = 0x53, - VK_T = 0x54, - VK_U = 0x55, - VK_V = 0x56, - VK_W = 0x57, - VK_X = 0x58, - VK_Y = 0x59, - VK_Z = 0x5A, - VK_LWIN = 0x5B, - VK_RWIN = 0x5C, - VK_APPS = 0x5D, - VK_RESERVED_5E = 0x5E, - VK_SLEEP = 0x5F, - VK_NUMPAD0 = 0x60, - VK_NUMPAD1 = 0x61, - VK_NUMPAD2 = 0x62, - VK_NUMPAD3 = 0x63, - VK_NUMPAD4 = 0x64, - VK_NUMPAD5 = 0x65, - VK_NUMPAD6 = 0x66, - VK_NUMPAD7 = 0x67, - VK_NUMPAD8 = 0x68, - VK_NUMPAD9 = 0x69, - VK_MULTIPLY = 0x6A, - VK_ADD = 0x6B, - VK_SEPARATOR = 0x6C, - VK_SUBTRACT = 0x6D, - VK_DECIMAL = 0x6E, - VK_DIVIDE = 0x6F, - VK_F1 = 0x70, - VK_F2 = 0x71, - VK_F3 = 0x72, - VK_F4 = 0x73, - VK_F5 = 0x74, - VK_F6 = 0x75, - VK_F7 = 0x76, - VK_F8 = 0x77, - VK_F9 = 0x78, - VK_F10 = 0x79, - VK_F11 = 0x7A, - VK_F12 = 0x7B, - VK_F13 = 0x7C, - VK_F14 = 0x7D, - VK_F15 = 0x7E, - VK_F16 = 0x7F, - VK_F17 = 0x80, - VK_F18 = 0x81, - VK_F19 = 0x82, - VK_F20 = 0x83, - VK_F21 = 0x84, - VK_F22 = 0x85, - VK_F23 = 0x86, - VK_F24 = 0x87, - VK_NUMLOCK = 0x90, - VK_SCROLL = 0x91, - VK_OEMSPECIFIC_92 = 0x92, - VK_OEMSPECIFIC_93 = 0x93, - VK_OEMSPECIFIC_94 = 0x94, - VK_OEMSPECIFIC_95 = 0x95, - VK_OEMSPECIFIC_96 = 0x96, - VK_LSHIFT = 0xA0, - VK_RSHIFT = 0xA1, - VK_LCONTROL = 0xA2, - VK_RCONTROL = 0xA3, - VK_LMENU = 0xA4, - VK_RMENU = 0xA5, - VK_BROWSER_BACK = 0xA6, - VK_BROWSER_FORWARD = 0xA7, - VK_BROWSER_REFRESH = 0xA8, - VK_BROWSER_STOP = 0xA9, - VK_BROWSER_SEARCH = 0xAA, - VK_BROWSER_FAVORITES = 0xAB, - VK_BROWSER_HOME = 0xAC, - VK_VOLUME_MUTE = 0xAD, - VK_VOLUME_DOWN = 0xAE, - VK_VOLUME_UP = 0xAF, - VK_MEDIA_NEXT_TRACK = 0xB0, - VK_MEDIA_PREV_TRACK = 0xB1, - VK_MEDIA_STOP = 0xB2, - VK_MEDIA_PLAY_PAUSE = 0xB3, - VK_LAUNCH_MAIL = 0xB4, - VK_LAUNCH_MEDIA_SELECT = 0xB5, - VK_LAUNCH_APP1 = 0xB6, - VK_LAUNCH_APP2 = 0xB7, - VK_RESERVED_B8 = 0xB8, - VK_RESERVED_B9 = 0xB9, - VK_OEM_1 = 0xBA, - VK_OEM_PLUS = 0xBB, - VK_OEM_COMMA = 0xBC, - VK_OEM_MINUS = 0xBD, - VK_OEM_PERIOD = 0xBE, - VK_OEM_2 = 0xBF, - VK_OEM_3 = 0xC0, - VK_RESERVED_C1 = 0xC1, - VK_RESERVED_C2 = 0xC2, - VK_RESERVED_C3 = 0xC3, - VK_RESERVED_C4 = 0xC4, - VK_RESERVED_C5 = 0xC5, - VK_RESERVED_C6 = 0xC6, - VK_RESERVED_C7 = 0xC7, - VK_RESERVED_C8 = 0xC8, - VK_RESERVED_C9 = 0xC9, - VK_RESERVED_CA = 0xCA, - VK_RESERVED_CB = 0xCB, - VK_RESERVED_CC = 0xCC, - VK_RESERVED_CD = 0xCD, - VK_RESERVED_CE = 0xCE, - VK_RESERVED_CF = 0xCF, - VK_RESERVED_D0 = 0xD0, - VK_RESERVED_D1 = 0xD1, - VK_RESERVED_D2 = 0xD2, - VK_RESERVED_D3 = 0xD3, - VK_RESERVED_D4 = 0xD4, - VK_RESERVED_D5 = 0xD5, - VK_RESERVED_D6 = 0xD6, - VK_RESERVED_D7 = 0xD7, - VK_OEM_4 = 0xDB, - VK_OEM_5 = 0xDC, - VK_OEM_6 = 0xDD, - VK_OEM_7 = 0xDE, - VK_OEM_8 = 0xDF, - VK_RESERVED_E0 = 0xE0, - VK_OEMSPECIFIC_E1 = 0xE1, - VK_OEM_102 = 0xE2, - VK_OEMSPECIFIC_E3 = 0xE3, - VK_OEMSPECIFIC_E4 = 0xE4, - VK_PROCESSKEY = 0xE5, - VK_OEMSPECIFIC_E6 = 0xE6, - VK_PACKET = 0xE7, - VK_OEMSPECIFIC_E9 = 0xE9, - VK_OEMSPECIFIC_EA = 0xEA, - VK_OEMSPECIFIC_EB = 0xEB, - VK_OEMSPECIFIC_EC = 0xEC, - VK_OEMSPECIFIC_ED = 0xED, - VK_OEMSPECIFIC_EE = 0xEE, - VK_OEMSPECIFIC_EF = 0xEF, - VK_OEMSPECIFIC_F0 = 0xF0, - VK_OEMSPECIFIC_F1 = 0xF1, - VK_OEMSPECIFIC_F2 = 0xF2, - VK_OEMSPECIFIC_F3 = 0xF3, - VK_OEMSPECIFIC_F4 = 0xF4, - VK_OEMSPECIFIC_F5 = 0xF5, - VK_ATTN = 0xF6, - VK_CRSEL = 0xF7, - VK_EXSEL = 0xF8, - VK_EREOF = 0xF9, - VK_PLAY = 0xFA, - VK_ZOOM = 0xFB, - VK_NONAME = 0xFC, - VK_PA1 = 0xFD, - VK_OEM_CLEAR = 0xFE, - VK_RESERVED_FF = 0xFF, - }; -} - -namespace REX::W32 -{ - using WNDPROC = std::intptr_t (*)(HWND, std::uint32_t, std::uintptr_t, std::intptr_t); -} - -namespace REX::W32 -{ - bool GetClientRect(HWND a_wnd, RECT* a_rect) noexcept; - std::int32_t GetKeyNameTextA(std::int32_t a_param, char* a_buf, std::int32_t a_bufLen) noexcept; - std::int32_t GetKeyNameTextW(std::int32_t a_param, wchar_t* a_buf, std::int32_t a_bufLen) noexcept; - std::int16_t GetKeyState(std::int32_t a_key) noexcept; - bool GetWindowRect(HWND a_wnd, RECT* a_rect) noexcept; - std::int32_t MessageBoxA(HWND a_wnd, const char* a_text, const char* a_caption, std::uint32_t a_type) noexcept; - std::int32_t MessageBoxW(HWND a_wnd, const wchar_t* a_text, const wchar_t* a_caption, std::uint32_t a_type) noexcept; - std::intptr_t SetWindowLongPtrA(HWND a_wnd, std::int32_t a_index, std::intptr_t a_newPtr) noexcept; - std::int32_t ShowCursor(bool a_show) noexcept; -} diff --git a/include/REX/W32/VERSION.h b/include/REX/W32/VERSION.h deleted file mode 100644 index 25c72d901..000000000 --- a/include/REX/W32/VERSION.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -namespace REX::W32 -{ - bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept; - std::uint32_t GetFileVersionInfoSizeA(const char* a_name, std::uint32_t* a_handle) noexcept; - //std::uint32_t GetFileVersionInfoSizeExA(std::uint32_t a_flags, const char* a_name, std::uint32_t* a_handle) noexcept; - std::uint32_t GetFileVersionInfoSizeExW(std::uint32_t a_flags, const wchar_t* a_name, std::uint32_t* a_handle) noexcept; - std::uint32_t GetFileVersionInfoSizeW(const wchar_t* a_name, std::uint32_t* a_handle) noexcept; - bool GetFileVersionInfoW(const wchar_t* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept; - bool VerQueryValueA(const void* a_block, const char* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept; - bool VerQueryValueW(const void* a_block, const wchar_t* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept; -} diff --git a/include/REX/W32/XINPUT.h b/include/REX/W32/XINPUT.h deleted file mode 100644 index 071a97aa0..000000000 --- a/include/REX/W32/XINPUT.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -namespace REX::W32 -{ - inline constexpr std::uint16_t XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE{ 7849 }; - inline constexpr std::uint16_t XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE{ 8689 }; - inline constexpr std::uint8_t XINPUT_GAMEPAD_TRIGGER_THRESHOLD{ 30 }; -} - -namespace REX::W32 -{ - enum XINPUT_GAMEPAD_BUTTON : std::uint16_t - { - XINPUT_GAMEPAD_DPAD_UP = 0x0001, - XINPUT_GAMEPAD_DPAD_DOWN = 0x0002, - XINPUT_GAMEPAD_DPAD_LEFT = 0x0004, - XINPUT_GAMEPAD_DPAD_RIGHT = 0x0008, - XINPUT_GAMEPAD_START = 0x0010, - XINPUT_GAMEPAD_BACK = 0x0020, - XINPUT_GAMEPAD_LEFT_THUMB = 0x0040, - XINPUT_GAMEPAD_RIGHT_THUMB = 0x0080, - XINPUT_GAMEPAD_LEFT_SHOULDER = 0x0100, - XINPUT_GAMEPAD_RIGHT_SHOULDER = 0x0200, - XINPUT_GAMEPAD_A = 0x1000, - XINPUT_GAMEPAD_B = 0x2000, - XINPUT_GAMEPAD_X = 0x4000, - XINPUT_GAMEPAD_Y = 0x8000, - XINPUT_GAMEPAD_BUTTON_MASK = XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_DPAD_RIGHT | XINPUT_GAMEPAD_START | XINPUT_GAMEPAD_BACK | XINPUT_GAMEPAD_LEFT_THUMB | XINPUT_GAMEPAD_RIGHT_THUMB | XINPUT_GAMEPAD_LEFT_SHOULDER | XINPUT_GAMEPAD_RIGHT_SHOULDER | XINPUT_GAMEPAD_A | XINPUT_GAMEPAD_B | XINPUT_GAMEPAD_X | XINPUT_GAMEPAD_Y, - }; -} - -namespace REX::W32 -{ - struct XINPUT_BATTERY_INFORMATION - { - std::uint8_t batteryType; - std::uint8_t batteryLevel; - }; - - struct XINPUT_GAMEPAD - { - std::uint16_t buttons; - std::uint8_t leftTrigger; - std::uint8_t rightTrigger; - std::int16_t thumbLX; - std::int16_t thumbLY; - std::int16_t thumbRX; - std::int16_t thumbRY; - }; - - struct XINPUT_KEYSTROKE - { - std::uint16_t virtualKey; - std::uint16_t unicode; - std::uint16_t flags; - std::uint8_t userIndex; - std::uint8_t hidCode; - }; - - struct XINPUT_STATE - { - std::uint32_t packetNumber; - XINPUT_GAMEPAD gamepad; - }; - - struct XINPUT_VIBRATION - { - std::uint16_t leftMotorSpeed; - std::uint16_t rightMotorSpeed; - }; - - struct XINPUT_CAPABILITIES - { - std::uint8_t type; - std::uint8_t subType; - std::uint16_t flags; - XINPUT_GAMEPAD gamepad; - XINPUT_VIBRATION vibration; - }; -} diff --git a/include/SKSE/API.h b/include/SKSE/API.h index 95657cba9..ccbf68670 100644 --- a/include/SKSE/API.h +++ b/include/SKSE/API.h @@ -3,44 +3,56 @@ #include "RE/B/BSTEvent.h" #include "SKSE/Events.h" -#include "SKSE/Impl/Stubs.h" #include "SKSE/Interfaces.h" -#include "SKSE/Trampoline.h" #include "SKSE/Version.h" #define SKSEAPI __cdecl namespace SKSE { - void Init(const LoadInterface* a_intfc, const bool a_log = true) noexcept; + struct InitInfo + { + bool log{ true }; + const char* logName{ nullptr }; + const char* logPattern{ nullptr }; + bool trampoline{ false }; + std::size_t trampolineSize{ 0 }; + bool trampolineSKSE{ true }; + bool hook{ true }; + }; + + void Init(const LoadInterface* a_intfc, InitInfo a_info = {}) noexcept; void RegisterForAPIInitEvent(std::function a_fn); -#ifdef SKYRIM_SUPPORT_AE - std::string_view GetPluginName() noexcept; - std::string_view GetPluginAuthor() noexcept; - REL::Version GetPluginVersion() noexcept; -#endif - - PluginHandle GetPluginHandle() noexcept; - std::uint32_t GetReleaseIndex() noexcept; - - const ScaleformInterface* GetScaleformInterface() noexcept; - const PapyrusInterface* GetPapyrusInterface() noexcept; - const SerializationInterface* GetSerializationInterface() noexcept; - const TaskInterface* GetTaskInterface() noexcept; - const TrampolineInterface* GetTrampolineInterface() noexcept; - - const MessagingInterface* GetMessagingInterface() noexcept; - RE::BSTEventSource* GetModCallbackEventSource() noexcept; - RE::BSTEventSource* GetCameraEventSource() noexcept; - RE::BSTEventSource* GetCrosshairRefEventSource() noexcept; - RE::BSTEventSource* GetActionEventSource() noexcept; - RE::BSTEventSource* GetNiNodeUpdateEventSource() noexcept; - - const ObjectInterface* GetObjectInterface() noexcept; - const SKSEDelayFunctorManager* GetDelayFunctorManager() noexcept; - const SKSEObjectRegistry* GetObjectRegistry() noexcept; - const SKSEPersistentObjectStorage* GetPersistentObjectStorage() noexcept; - - void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve = true); + [[nodiscard]] std::string_view GetPluginName() noexcept; + [[nodiscard]] std::string_view GetPluginAuthor() noexcept; + [[nodiscard]] REL::Version GetPluginVersion() noexcept; + [[nodiscard]] PluginHandle GetPluginHandle() noexcept; + [[nodiscard]] const PluginInfo* GetPluginInfo(std::string_view a_plugin) noexcept; + [[nodiscard]] std::uint32_t GetReleaseIndex() noexcept; + [[nodiscard]] std::uint32_t GetSKSEVersion() noexcept; + + [[nodiscard]] const ScaleformInterface* GetScaleformInterface() noexcept; + [[nodiscard]] const PapyrusInterface* GetPapyrusInterface() noexcept; + [[nodiscard]] const SerializationInterface* GetSerializationInterface() noexcept; + [[nodiscard]] const TaskInterface* GetTaskInterface() noexcept; + [[nodiscard]] const MessagingInterface* GetMessagingInterface() noexcept; + [[nodiscard]] const ObjectInterface* GetObjectInterface() noexcept; + [[nodiscard]] const TrampolineInterface* GetTrampolineInterface() noexcept; + [[nodiscard]] const SKSEDelayFunctorManager* GetDelayFunctorManager() noexcept; + [[nodiscard]] const SKSEObjectRegistry* GetObjectRegistry() noexcept; + [[nodiscard]] const SKSEPersistentObjectStorage* GetPersistentObjectStorage() noexcept; + + [[nodiscard]] RE::BSTEventSource* GetModCallbackEventSource() noexcept; + [[nodiscard]] RE::BSTEventSource* GetCameraEventSource() noexcept; + [[nodiscard]] RE::BSTEventSource* GetCrosshairRefEventSource() noexcept; + [[nodiscard]] RE::BSTEventSource* GetActionEventSource() noexcept; + [[nodiscard]] RE::BSTEventSource* GetNiNodeUpdateEventSource() noexcept; +} + +namespace SKSE +{ + void Init(const LoadInterface* a_intfc, bool a_log) noexcept; + + void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve = true) noexcept; } diff --git a/include/SKSE/IAT.h b/include/SKSE/IAT.h deleted file mode 100644 index 57fa55a2d..000000000 --- a/include/SKSE/IAT.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -namespace SKSE -{ - [[nodiscard]] std::uintptr_t GetIATAddr(std::string_view a_dll, std::string_view a_function); - [[nodiscard]] std::uintptr_t GetIATAddr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function); - - [[nodiscard]] void* GetIATPtr(std::string_view a_dll, std::string_view a_function); - - template - [[nodiscard]] inline T* GetIATPtr(std::string_view a_dll, std::string_view a_function) - { - return static_cast(GetIATPtr(std::move(a_dll), std::move(a_function))); - } - - [[nodiscard]] void* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function); - - template - [[nodiscard]] 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))); - } - - std::uintptr_t PatchIAT(std::uintptr_t a_newFunc, std::string_view a_dll, std::string_view a_function); - - template - inline std::uintptr_t PatchIAT(F a_newFunc, std::string_view a_dll, std::string_view a_function) - { - return PatchIAT(stl::unrestricted_cast(a_newFunc), a_dll, a_function); - } -} diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index f9826171a..75d8d5107 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -1,513 +1,46 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static_assert( - std::is_integral_v && sizeof(std::time_t) == sizeof(std::size_t), - "wrap std::time_t instead"); - -#include "REX/REX/Enum.h" -#include "REX/REX/EnumSet.h" -#include "REX/W32/KERNEL32.h" -#include "REX/W32/USER32.h" - -#pragma warning(push) -#include -#include -#pragma warning(pop) +#include +#include namespace SKSE { using namespace std::literals; +} - namespace stl - { - template - using basic_zstring = std::basic_string_view; - - using zstring = basic_zstring; - using zwstring = basic_zstring; - - // owning pointer - template < - class T, - class = std::enable_if_t< - std::is_pointer_v>> - using owner = T; - - // non-owning pointer - template < - class T, - class = std::enable_if_t< - std::is_pointer_v>> - using observer = T; - - // non-null pointer - template < - class T, - class = std::enable_if_t< - std::is_pointer_v>> - using not_null = T; - - namespace nttp - { - template - struct string - { - using char_type = CharT; - using pointer = char_type*; - using const_pointer = const char_type*; - using reference = char_type&; - using const_reference = const char_type&; - using size_type = std::size_t; - - static constexpr auto npos = static_cast(-1); - - consteval string(const_pointer a_string) noexcept - { - for (size_type i = 0; i < N; ++i) { - c[i] = a_string[i]; - } - } - - [[nodiscard]] consteval const_reference operator[](size_type a_pos) const noexcept - { - assert(a_pos < N); - return c[a_pos]; - } - - [[nodiscard]] consteval const_reference back() const noexcept { return (*this)[size() - 1]; } - [[nodiscard]] consteval const_pointer data() const noexcept { return c; } - [[nodiscard]] consteval bool empty() const noexcept { return this->size() == 0; } - [[nodiscard]] consteval const_reference front() const noexcept { return (*this)[0]; } - [[nodiscard]] consteval size_type length() const noexcept { return N; } - [[nodiscard]] consteval size_type size() const noexcept { return length(); } - - template - [[nodiscard]] consteval auto substr() const noexcept - { - return string < CharT, COUNT != npos ? COUNT : N - POS > (this->data() + POS); - } - - char_type c[N] = {}; - }; - - template - string(const CharT (&)[N]) -> string; - } - - template - requires(std::invocable>) - class scope_exit - { - public: - // 1) - template - explicit scope_exit(Fn&& a_fn) noexcept(std::is_nothrow_constructible_v || - std::is_nothrow_constructible_v) // - requires(!std::is_same_v, scope_exit> && - std::is_constructible_v) - { - static_assert(std::invocable); - - if constexpr (!std::is_lvalue_reference_v && - std::is_nothrow_constructible_v) { - _fn.emplace(std::forward(a_fn)); - } else { - _fn.emplace(a_fn); - } - } - - // 2) - scope_exit(scope_exit&& a_rhs) noexcept(std::is_nothrow_move_constructible_v || - std::is_nothrow_copy_constructible_v) // - requires(std::is_nothrow_move_constructible_v || - std::is_copy_constructible_v) - { - static_assert(!(std::is_nothrow_move_constructible_v && !std::is_move_constructible_v)); - static_assert(!(!std::is_nothrow_move_constructible_v && !std::is_copy_constructible_v)); - - if (a_rhs.active()) { - if constexpr (std::is_nothrow_move_constructible_v) { - _fn.emplace(std::forward(*a_rhs._fn)); - } else { - _fn.emplace(a_rhs._fn); - } - a_rhs.release(); - } - } - - // 3) - scope_exit(const scope_exit&) = delete; - - ~scope_exit() noexcept - { - if (_fn.has_value()) { - (*_fn)(); - } - } - - void release() noexcept { _fn.reset(); } - - private: - [[nodiscard]] bool active() const noexcept { return _fn.has_value(); } - - std::optional> _fn; - }; - - template - scope_exit(EF) -> scope_exit; - - // backwards compat - template < - class E, - class U = std::underlying_type_t> - class enumeration : public REX::EnumSet - { - using super = REX::EnumSet; - - public: - using enum_type = E; - using underlying_type = U; - - using super::super; - using super::operator=; - using super::operator*; - }; - - template - enumeration(Args...) -> enumeration< - std::common_type_t, - std::underlying_type_t< - std::common_type_t>>; - } +namespace RE +{ + using namespace std::literals; } -namespace SKSE +namespace stl { - namespace stl + template + [[nodiscard]] inline auto pun_bits(Args... a_args) // + requires(std::same_as, bool> && ...) { - template - class atomic_ref : - public std::atomic_ref - { - private: - using super = std::atomic_ref; - - public: - using value_type = typename super::value_type; - - explicit atomic_ref(volatile T& a_obj) noexcept(std::is_nothrow_constructible_v) : - super(const_cast(a_obj)) - {} - - using super::super; - using super::operator=; - }; - - template - atomic_ref(volatile T&) -> atomic_ref; - - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - template class atomic_ref; - - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - static_assert(atomic_ref::is_always_lock_free); - - template - struct ssizeof - { - [[nodiscard]] constexpr operator std::ptrdiff_t() const noexcept { return value; } + constexpr auto ARGC = sizeof...(Args); - [[nodiscard]] constexpr std::ptrdiff_t operator()() const noexcept { return value; } + std::bitset bits; + std::size_t i = 0; + ((bits[i++] = a_args), ...); - static constexpr auto value = static_cast(sizeof(T)); - }; - - template - inline constexpr auto ssizeof_v = ssizeof::value; - - template - [[nodiscard]] auto adjust_pointer(U* a_ptr, std::ptrdiff_t a_adjust) noexcept - { - auto addr = a_ptr ? reinterpret_cast(a_ptr) + a_adjust : 0; - if constexpr (std::is_const_v && std::is_volatile_v) { - return reinterpret_cast*>(addr); - } else if constexpr (std::is_const_v) { - return reinterpret_cast*>(addr); - } else if constexpr (std::is_volatile_v) { - return reinterpret_cast*>(addr); - } else { - return reinterpret_cast(addr); - } - } - - template - void emplace_vtable(T* a_ptr) - { - reinterpret_cast(a_ptr)[0] = T::VTABLE[0].address(); - } - - template - void memzero(volatile T* a_ptr, std::size_t a_size = sizeof(T)) - { - const auto begin = reinterpret_cast(a_ptr); - constexpr char val{ 0 }; - std::fill_n(begin, a_size, val); - } - - template - [[nodiscard]] inline auto pun_bits(Args... a_args) // - requires(std::same_as, bool> && ...) - { - constexpr auto ARGC = sizeof...(Args); - - std::bitset bits; - std::size_t i = 0; - ((bits[i++] = a_args), ...); - - if constexpr (ARGC <= std::numeric_limits::digits) { - return bits.to_ulong(); - } else if constexpr (ARGC <= std::numeric_limits::digits) { - return bits.to_ullong(); - } else { - static_assert(false && sizeof...(Args)); - } - } - - [[nodiscard]] inline auto utf8_to_utf16(std::string_view a_in) noexcept - -> std::optional - { - const auto cvt = [&](wchar_t* a_dst, std::size_t a_length) { - return REX::W32::MultiByteToWideChar( - REX::W32::CP_UTF8, - 0, - a_in.data(), - static_cast(a_in.length()), - a_dst, - static_cast(a_length)); - }; - - const auto len = cvt(nullptr, 0); - if (len == 0) { - return std::nullopt; - } - - std::wstring out(len, '\0'); - if (cvt(out.data(), out.length()) == 0) { - return std::nullopt; - } - - return out; - } - - [[nodiscard]] inline auto utf16_to_utf8(std::wstring_view a_in) noexcept - -> std::optional - { - const auto cvt = [&](char* a_dst, std::size_t a_length) { - return REX::W32::WideCharToMultiByte( - REX::W32::CP_UTF8, - 0, - a_in.data(), - static_cast(a_in.length()), - a_dst, - static_cast(a_length), - nullptr, - nullptr); - }; - - const auto len = cvt(nullptr, 0); - if (len == 0) { - return std::nullopt; - } - - std::string out(len, '\0'); - if (cvt(out.data(), out.length()) == 0) { - return std::nullopt; - } - - return out; - } - - [[noreturn]] inline void report_and_fail(std::string_view a_msg, std::source_location a_loc = std::source_location::current()) - { - const auto body = [&]() { - const std::filesystem::path p = a_loc.file_name(); - auto filename = p.lexically_normal().generic_string(); - - const std::regex r{ R"((?:^|[\\\/])(?:include|src)[\\\/](.*)$)" }; - std::smatch matches; - if (std::regex_search(filename, matches, r)) { - filename = matches[1].str(); - } - - return utf8_to_utf16( - std::format( - "{}({}): {}"sv, - filename, - a_loc.line(), - a_msg)) - .value_or(L""s); - }(); - - const auto caption = []() { - std::vector buf; - buf.reserve(REX::W32::MAX_PATH); - buf.resize(REX::W32::MAX_PATH / 2); - std::uint32_t result = 0; - do { - buf.resize(buf.size() * 2); - result = REX::W32::GetModuleFileNameW( - REX::W32::GetCurrentModule(), - buf.data(), - static_cast(buf.size())); - } while (result && result == buf.size() && buf.size() <= std::numeric_limits::max()); - - if (result && result != buf.size()) { - std::filesystem::path p(buf.begin(), buf.begin() + result); - return p.filename().native(); - } else { - return L""s; - } - }(); - - spdlog::log( - spdlog::source_loc{ - a_loc.file_name(), - static_cast(a_loc.line()), - a_loc.function_name() }, - spdlog::level::critical, - a_msg); - REX::W32::MessageBoxW(nullptr, body.c_str(), (caption.empty() ? nullptr : caption.c_str()), 0); - REX::W32::TerminateProcess(REX::W32::GetCurrentProcess(), EXIT_FAILURE); - } - - template - [[nodiscard]] To unrestricted_cast(From a_from) noexcept - { - if constexpr (std::is_same_v< - std::remove_cv_t, - std::remove_cv_t>) { - return To{ a_from }; - - // From != To - } else if constexpr (std::is_reference_v) { - return stl::unrestricted_cast(std::addressof(a_from)); - - // From: NOT reference - } else if constexpr (std::is_reference_v) { - return *stl::unrestricted_cast< - std::add_pointer_t< - std::remove_reference_t>>(a_from); - - // To: NOT reference - } else if constexpr (std::is_pointer_v && - std::is_pointer_v) { - return static_cast( - const_cast( - static_cast(a_from))); - } else if constexpr ((std::is_pointer_v && std::is_integral_v) || - (std::is_integral_v && std::is_pointer_v)) { - return reinterpret_cast(a_from); - } else { - union - { - std::remove_cv_t> from; - std::remove_cv_t> to; - }; - - from = std::forward(a_from); - return to; - } + if constexpr (ARGC <= std::numeric_limits::digits) { + return bits.to_ulong(); + } else if constexpr (ARGC <= std::numeric_limits::digits) { + return bits.to_ullong(); + } else { + static_assert(false && sizeof...(Args)); } } } -namespace RE -{ - using namespace std::literals; - namespace stl = SKSE::stl; -} - -namespace REL -{ - using namespace std::literals; - namespace stl = SKSE::stl; -} - #ifdef SKYRIM_SUPPORT_AE # define RELOCATION_ID(SE, AE) REL::ID(AE) #else # define RELOCATION_ID(SE, AE) REL::ID(SE) #endif -#include "REL/REL.h" - #include "RE/Offsets.h" #include "RE/Offsets_NiRTTI.h" #include "RE/Offsets_RTTI.h" diff --git a/include/SKSE/Impl/Stubs.h b/include/SKSE/Impl/Stubs.h deleted file mode 100644 index de1bed3e1..000000000 --- a/include/SKSE/Impl/Stubs.h +++ /dev/null @@ -1,112 +0,0 @@ -#pragma once - -class SKSEDelayFunctorManager; -class SKSEObjectRegistry; -class SKSEPersistentObjectStorage; -class TaskDelegate; -class UIDelegate_v1; - -namespace SKSE -{ - using PluginHandle = std::uint32_t; - enum : PluginHandle - { - kInvalidPluginHandle = static_cast(-1) - }; - - namespace detail - { - struct PluginInfo - { - std::uint32_t infoVersion; - const char* name; - std::uint32_t version; - }; - - struct SKSEInterface - { - std::uint32_t skseVersion; - std::uint32_t runtimeVersion; - std::uint32_t editorVersion; - std::uint32_t isEditor; - void* (*QueryInterface)(std::uint32_t); - PluginHandle (*GetPluginHandle)(); - std::uint32_t (*GetReleaseIndex)(); - const void* (*GetPluginInfo)(const char*); - }; - - struct SKSEMessagingInterface - { - std::uint32_t interfaceVersion; - bool (*RegisterListener)(PluginHandle, const char*, void*); - bool (*Dispatch)(PluginHandle, std::uint32_t, void*, std::uint32_t, const char*); - void* (*GetEventDispatcher)(std::uint32_t); - }; - - struct SKSEObjectInterface - { - std::uint32_t interfaceVersion; - SKSEDelayFunctorManager& (*GetDelayFunctorManager)(); - SKSEObjectRegistry& (*GetObjectRegistry)(); - SKSEPersistentObjectStorage& (*GetPersistentObjectStorage)(); - }; - - struct SKSEPapyrusInterface - { - std::uint32_t interfaceVersion; - bool (*Register)(void*); - }; - - struct SKSEScaleformInterface - { - std::uint32_t interfaceVersion; - bool (*Register)(const char*, void*); - void (*RegisterForInventory)(void*); - }; - - struct SKSESerializationInterface - { - std::uint32_t version; - void (*SetUniqueID)(PluginHandle, std::uint32_t); - void (*SetRevertCallback)(PluginHandle, void*); - void (*SetSaveCallback)(PluginHandle, void*); - void (*SetLoadCallback)(PluginHandle, void*); - void (*SetFormDeleteCallback)(PluginHandle, void*); - bool (*WriteRecord)(std::uint32_t, std::uint32_t, const void*, std::uint32_t); - bool (*OpenRecord)(std::uint32_t, std::uint32_t); - bool (*WriteRecordData)(const void*, std::uint32_t); - bool (*GetNextRecordInfo)(std::uint32_t*, std::uint32_t*, std::uint32_t*); - std::uint32_t (*ReadRecordData)(void*, std::uint32_t); - bool (*ResolveHandle)(std::uint64_t, std::uint64_t*); - bool (*ResolveFormId)(std::uint32_t, std::uint32_t*); - }; - - struct SKSETaskInterface - { - std::uint32_t interfaceVersion; - void (*AddTask)(void*); - void (*AddUITask)(void*); - }; - - struct SKSETrampolineInterface - { - std::uint32_t interfaceVersion; - void* (*AllocateFromBranchPool)(PluginHandle, std::size_t); - void* (*AllocateFromLocalPool)(PluginHandle, std::size_t); - }; - - class TaskDelegate - { - public: - virtual void Run() = 0; - virtual void Dispose() = 0; - }; - - class UIDelegate_v1 - { - public: - virtual void Run() = 0; - virtual void Dispose() = 0; - }; - } -} diff --git a/include/SKSE/Interfaces.h b/include/SKSE/Interfaces.h index 696cbe1a9..857372610 100644 --- a/include/SKSE/Interfaces.h +++ b/include/SKSE/Interfaces.h @@ -1,6 +1,5 @@ #pragma once -#include "SKSE/Impl/Stubs.h" #include "SKSE/Version.h" namespace RE @@ -22,21 +21,146 @@ namespace RE namespace SKSE { - struct PluginInfo; + using PluginHandle = std::uint32_t; - class QueryInterface + struct PluginInfo { - public: - [[nodiscard]] std::uint32_t EditorVersion() const; - [[nodiscard]] bool IsEditor() const; - [[nodiscard]] REL::Version RuntimeVersion() const; - [[nodiscard]] std::uint32_t SKSEVersion() const; + enum + { + kVersion = 1 + }; + + std::uint32_t infoVersion; + const char* name; + std::uint32_t version; + }; + + class SKSEDelayFunctorManager; + class SKSEObjectRegistry; + class SKSEPersistentObjectStorage; + class TaskDelegate; + class UIDelegate_v1; + + namespace Impl + { + struct SKSEInterface + { + std::uint32_t skseVersion; + std::uint32_t runtimeVersion; + std::uint32_t editorVersion; + std::uint32_t isEditor; + void* (*QueryInterface)(std::uint32_t); + PluginHandle (*GetPluginHandle)(); + std::uint32_t (*GetReleaseIndex)(); + const void* (*GetPluginInfo)(const char*); + }; + + struct SKSEMessagingInterface + { + std::uint32_t interfaceVersion; + bool (*RegisterListener)(PluginHandle, const char*, void*); + bool (*Dispatch)(PluginHandle, std::uint32_t, void*, std::uint32_t, const char*); + void* (*GetEventDispatcher)(std::uint32_t); + }; + + struct SKSEObjectInterface + { + std::uint32_t interfaceVersion; + SKSEDelayFunctorManager& (*GetDelayFunctorManager)(); + SKSEObjectRegistry& (*GetObjectRegistry)(); + SKSEPersistentObjectStorage& (*GetPersistentObjectStorage)(); + }; + struct SKSEPapyrusInterface + { + std::uint32_t interfaceVersion; + bool (*Register)(void*); + }; + + struct SKSEScaleformInterface + { + std::uint32_t interfaceVersion; + bool (*Register)(const char*, void*); + void (*RegisterForInventory)(void*); + }; + + struct SKSESerializationInterface + { + std::uint32_t version; + void (*SetUniqueID)(PluginHandle, std::uint32_t); + void (*SetRevertCallback)(PluginHandle, void*); + void (*SetSaveCallback)(PluginHandle, void*); + void (*SetLoadCallback)(PluginHandle, void*); + void (*SetFormDeleteCallback)(PluginHandle, void*); + bool (*WriteRecord)(std::uint32_t, std::uint32_t, const void*, std::uint32_t); + bool (*OpenRecord)(std::uint32_t, std::uint32_t); + bool (*WriteRecordData)(const void*, std::uint32_t); + bool (*GetNextRecordInfo)(std::uint32_t*, std::uint32_t*, std::uint32_t*); + std::uint32_t (*ReadRecordData)(void*, std::uint32_t); + bool (*ResolveHandle)(std::uint64_t, std::uint64_t*); + bool (*ResolveFormID)(std::uint32_t, std::uint32_t*); + }; + + struct SKSETaskInterface + { + std::uint32_t interfaceVersion; + void (*AddTask)(void*); + void (*AddUITask)(void*); + }; + + struct SKSETrampolineInterface + { + std::uint32_t interfaceVersion; + void* (*AllocateFromBranchPool)(PluginHandle, std::size_t); + void* (*AllocateFromLocalPool)(PluginHandle, std::size_t); + }; + + class TaskDelegate + { + public: + virtual void Run() = 0; + virtual void Dispose() = 0; + }; + + class UIDelegate_v1 + { + public: + virtual void Run() = 0; + virtual void Dispose() = 0; + }; + } + + class QueryInterface + { protected: - [[nodiscard]] const detail::SKSEInterface* GetProxy() const; + [[nodiscard]] decltype(auto) GetProxy() const noexcept + { + return reinterpret_cast(*this); + } + + private: + [[nodiscard]] constexpr static REL::Version MakeVersion(std::uint32_t a_version) noexcept + { + return { + static_cast((a_version >> 8 * 3) & 0x0FF), + static_cast((a_version >> 8 * 2) & 0x0FF), + static_cast((a_version >> 8 / 2) & 0xFFF), + static_cast((a_version >> 8 * 0) & 0x00F) + }; + } + + public: + [[nodiscard]] std::uint32_t EditorVersion() const noexcept { return GetProxy().editorVersion; } + [[nodiscard]] std::uint32_t SKSEVersion() const noexcept { return GetProxy().skseVersion; } + [[nodiscard]] PluginHandle GetPluginHandle() const { return GetProxy().GetPluginHandle(); } + const PluginInfo* GetPluginInfo(const char* a_name) const { return static_cast(GetProxy().GetPluginInfo(a_name)); } + [[nodiscard]] std::uint32_t GetReleaseIndex() const { return GetProxy().GetReleaseIndex(); } + [[nodiscard]] bool IsEditor() const noexcept { return GetProxy().isEditor != 0; } + [[nodiscard]] REL::Version RuntimeVersion() const noexcept { return MakeVersion(GetProxy().runtimeVersion); } }; - class LoadInterface : public QueryInterface + class LoadInterface : + public QueryInterface { public: enum : std::uint32_t @@ -52,53 +176,71 @@ namespace SKSE kTotal }; - [[nodiscard]] PluginHandle GetPluginHandle() const; - const PluginInfo* GetPluginInfo(const char* a_name) const; - [[nodiscard]] std::uint32_t GetReleaseIndex() const; - [[nodiscard]] void* QueryInterface(std::uint32_t a_id) const; + [[nodiscard]] void* QueryInterface(std::uint32_t a_id) const { return GetProxy().QueryInterface(a_id); } + + template + T* QueryInterface(std::uint32_t a_id) const noexcept + { + auto result = static_cast(QueryInterface(a_id)); + if (result && result->Version() > T::kVersion) + REX::ERROR("interface definition is out of date"); + + return result; + } }; class ScaleformInterface { - public: - using RegCallback = bool(RE::GFxMovieView* a_view, RE::GFxValue* a_root); - using RegInvCallback = void(RE::GFxMovieView* a_view, RE::GFxValue* a_object, RE::InventoryEntryData* a_item); + private: + [[nodiscard]] decltype(auto) GetProxy() const noexcept + { + return reinterpret_cast(*this); + } + public: enum { kVersion = 2 }; - [[nodiscard]] std::uint32_t Version() const; + using RegCallback = bool(RE::GFxMovieView* a_view, RE::GFxValue* a_root); + using RegInvCallback = void(RE::GFxMovieView* a_view, RE::GFxValue* a_object, RE::InventoryEntryData* a_item); + + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } bool Register(RegCallback* a_callback, const char* a_name) const; void Register(RegInvCallback* a_callback) const; - - protected: - [[nodiscard]] const detail::SKSEScaleformInterface* GetProxy() const; }; class SerializationInterface { - public: - using EventCallback = void(SerializationInterface* a_intfc); - using FormDeleteCallback = void(RE::VMHandle a_handle); + private: + [[nodiscard]] decltype(auto) GetProxy() const noexcept + { + return reinterpret_cast(*this); + } + public: enum { kVersion = 4 }; - [[nodiscard]] std::uint32_t Version() const; + using EventCallback = void(SerializationInterface* a_intfc); + using FormDeleteCallback = void(RE::VMHandle a_handle); - void SetUniqueID(std::uint32_t a_uid) const; + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().version; } - void SetFormDeleteCallback(FormDeleteCallback* a_callback) const; - void SetLoadCallback(EventCallback* a_callback) const; + void SetUniqueID(std::uint32_t a_uid) const; void SetRevertCallback(EventCallback* a_callback) const; void SetSaveCallback(EventCallback* a_callback) const; + void SetLoadCallback(EventCallback* a_callback) const; + void SetFormDeleteCallback(FormDeleteCallback* a_callback) const; bool WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const void* a_buf, std::uint32_t a_length) const; + bool OpenRecord(std::uint32_t a_type, std::uint32_t a_version) const; + bool WriteRecordData(const void* a_buf, std::uint32_t a_length) const; + bool WriteRecordDataEx(std::uint32_t& a_diff, const void* a_buf, std::uint32_t a_length) const; template >, int> = 0> inline bool WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const T& a_buf) const @@ -112,11 +254,6 @@ namespace SKSE return WriteRecord(a_type, a_version, std::addressof(a_buf), sizeof(T) * N); } - [[nodiscard]] bool OpenRecord(std::uint32_t a_type, std::uint32_t a_version) const; - - bool WriteRecordData(const void* a_buf, std::uint32_t a_length) const; - bool WriteRecordDataEx(std::uint32_t& a_diff, const void* a_buf, std::uint32_t a_length) const; - template >, int> = 0> bool WriteRecordData(const T& a_buf) const { @@ -170,70 +307,87 @@ namespace SKSE return ReadRecordDataEx(a_diff, std::addressof(a_buf), sizeof(T) * N); } - bool ResolveFormID(RE::FormID a_oldFormID, RE::FormID& a_newFormID) const; - bool ResolveHandle(RE::VMHandle a_oldHandle, RE::VMHandle& a_newHandle) const; + bool ResolveHandle(RE::VMHandle a_oldHandle, RE::VMHandle& a_newHandle) const + { + return GetProxy().ResolveHandle(a_oldHandle, &a_newHandle); + } - protected: - [[nodiscard]] const detail::SKSESerializationInterface* GetProxy() const; + bool ResolveFormID(RE::FormID a_oldFormID, RE::FormID& a_newFormID) const + { + return GetProxy().ResolveFormID(a_oldFormID, &a_newFormID); + } }; class TaskInterface { - public: - using TaskFn = std::function; - - enum + private: + [[nodiscard]] decltype(auto) GetProxy() const noexcept { - kVersion = 2 - }; - - [[nodiscard]] std::uint32_t Version() const; - - void AddTask(TaskFn a_task) const; - void AddTask(TaskDelegate* a_task) const; - void AddUITask(TaskFn a_task) const; - void AddUITask(UIDelegate_v1* a_task) const; + return reinterpret_cast(*this); + } - protected: - class Task : public detail::TaskDelegate + class Task : + public Impl::TaskDelegate { public: - Task(TaskFn&& a_fn); + explicit Task(std::function a_task) noexcept : + _impl(std::move(a_task)) + {} - void Run() override; - void Dispose() override; + void Run() override { _impl(); } + void Dispose() override { delete this; } private: - TaskFn _fn; + std::function _impl; }; - class UITask : public detail::UIDelegate_v1 + class UITask : + public Impl::UIDelegate_v1 { public: - UITask(TaskFn&& a_fn); + explicit UITask(std::function a_task) noexcept : + _impl(std::move(a_task)) + {} - void Run() override; - void Dispose() override; + void Run() override { _impl(); } + void Dispose() override { delete this; } private: - TaskFn _fn; + std::function _impl; + }; + + public: + enum + { + kVersion = 2 }; - [[nodiscard]] const detail::SKSETaskInterface* GetProxy() const; + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } + + void AddTask(TaskDelegate* a_task) const { GetProxy().AddTask(a_task); } + void AddTask(std::function a_task) const { GetProxy().AddTask(new Task(std::move(a_task))); } + void AddUITask(UIDelegate_v1* a_task) const { GetProxy().AddUITask(a_task); } + void AddUITask(std::function a_task) const { GetProxy().AddUITask(new UITask(std::move(a_task))); } }; class PapyrusInterface { - public: - using RegFunction1 = bool(RE::BSScript::Internal::VirtualMachine* a_vm); - using RegFunction2 = bool(RE::BSScript::IVirtualMachine* a_vm); + private: + [[nodiscard]] decltype(auto) GetProxy() const noexcept + { + return reinterpret_cast(*this); + } + public: enum { kVersion = 1 }; - [[nodiscard]] std::uint32_t Version() const; + using RegFunction1 = bool(RE::BSScript::Internal::VirtualMachine* a_vm); + using RegFunction2 = bool(RE::BSScript::IVirtualMachine* a_vm); + + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } template bool Register(Last a_last) const @@ -247,9 +401,6 @@ namespace SKSE return Register_Impl(a_first) && Register(a_rest...); } - protected: - [[nodiscard]] const detail::SKSEPapyrusInterface* GetProxy() const; - private: bool Register_Impl(RegFunction1* a_fn) const; bool Register_Impl(RegFunction2* a_fn) const; @@ -257,17 +408,13 @@ namespace SKSE class MessagingInterface { - public: - struct Message + private: + [[nodiscard]] decltype(auto) GetProxy() const noexcept { - const char* sender; - std::uint32_t type; - std::uint32_t dataLen; - void* data; - }; - - using EventCallback = void(Message* a_msg); + return reinterpret_cast(*this); + } + public: enum { kVersion = 2 @@ -299,65 +446,67 @@ namespace SKSE kTotal }; - [[nodiscard]] std::uint32_t Version() const; + struct Message + { + const char* sender; + std::uint32_t type; + std::uint32_t dataLen; + void* data; + }; + + using EventCallback = void(Message* a_msg); - bool Dispatch(std::uint32_t a_messageType, void* a_data, std::uint32_t a_dataLen, const char* a_receiver) const; - [[nodiscard]] void* GetEventDispatcher(Dispatcher a_dispatcherID) const; - bool RegisterListener(EventCallback* a_callback) const; - bool RegisterListener(const char* a_sender, EventCallback* a_callback) const; + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } - protected: - [[nodiscard]] const detail::SKSEMessagingInterface* GetProxy() const; + bool Dispatch(std::uint32_t a_messageType, void* a_data, std::uint32_t a_dataLen, const char* a_receiver) const; + bool RegisterListener(EventCallback* a_handler) const { return RegisterListener("SKSE", a_handler); } + bool RegisterListener(const char* a_sender, EventCallback* a_callback) const; + + [[nodiscard]] void* GetEventDispatcher(Dispatcher a_dispatcherID) const + { + return GetProxy().GetEventDispatcher(std::to_underlying(a_dispatcherID)); + } }; class ObjectInterface { + private: + [[nodiscard]] decltype(auto) GetProxy() const noexcept + { + return reinterpret_cast(*this); + } + public: enum { kVersion = 1 }; - [[nodiscard]] std::uint32_t Version() const; - - [[nodiscard]] SKSEDelayFunctorManager& GetDelayFunctorManager() const; - [[nodiscard]] SKSEObjectRegistry& GetObjectRegistry() const; - [[nodiscard]] SKSEPersistentObjectStorage& GetPersistentObjectStorage() const; - - private: - [[nodiscard]] const detail::SKSEObjectInterface* GetProxy() const; + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } + [[nodiscard]] SKSEDelayFunctorManager& GetDelayFunctorManager() const { return GetProxy().GetDelayFunctorManager(); } + [[nodiscard]] SKSEObjectRegistry& GetObjectRegistry() const { return GetProxy().GetObjectRegistry(); } + [[nodiscard]] SKSEPersistentObjectStorage& GetPersistentObjectStorage() const { return GetProxy().GetPersistentObjectStorage(); } }; class TrampolineInterface { - public: - enum - { - kVersion = 1 - }; - - [[nodiscard]] std::uint32_t Version() const; - - [[nodiscard]] void* AllocateFromBranchPool(std::size_t a_size) const; - [[nodiscard]] void* AllocateFromLocalPool(std::size_t a_size) const; - private: - [[nodiscard]] const detail::SKSETrampolineInterface* GetProxy() const; - }; + [[nodiscard]] decltype(auto) GetProxy() const noexcept + { + return reinterpret_cast(*this); + } - struct PluginInfo - { + public: enum { kVersion = 1 }; - std::uint32_t infoVersion; - const char* name; - std::uint32_t version; + [[nodiscard]] std::uint32_t Version() const noexcept { return GetProxy().interfaceVersion; } + [[nodiscard]] void* AllocateFromBranchPool(std::size_t a_size) const; + [[nodiscard]] void* AllocateFromLocalPool(std::size_t a_size) const; }; -#ifdef SKYRIM_SUPPORT_AE struct PluginVersionData { public: @@ -444,7 +593,6 @@ namespace SKSE static_assert(offsetof(PluginVersionData, compatibleVersions) == 0x30C); static_assert(offsetof(PluginVersionData, xseMinimum) == 0x34C); static_assert(sizeof(PluginVersionData) == 0x350); -#endif } #define SKSEPluginLoad(...) extern "C" [[maybe_unused]] __declspec(dllexport) bool SKSEPlugin_Load(__VA_ARGS__) diff --git a/include/SKSE/Logger.h b/include/SKSE/Logger.h index 1e1d09a6e..4cb6f941b 100644 --- a/include/SKSE/Logger.h +++ b/include/SKSE/Logger.h @@ -1,46 +1,9 @@ #pragma once -#define SKSE_MAKE_SOURCE_LOGGER(a_func, a_type) \ - \ - template \ - struct [[maybe_unused]] a_func \ - { \ - a_func() = delete; \ - \ - explicit a_func( \ - spdlog::format_string_t a_fmt, \ - Args&&... a_args, \ - std::source_location a_loc = std::source_location::current()) \ - { \ - spdlog::log( \ - spdlog::source_loc{ \ - a_loc.file_name(), \ - static_cast(a_loc.line()), \ - a_loc.function_name() }, \ - spdlog::level::a_type, \ - a_fmt, \ - std::forward(a_args)...); \ - } \ - }; \ - \ - template \ - a_func(spdlog::format_string_t, Args&&...) -> a_func; - namespace SKSE::log { - SKSE_MAKE_SOURCE_LOGGER(trace, trace); - SKSE_MAKE_SOURCE_LOGGER(debug, debug); - SKSE_MAKE_SOURCE_LOGGER(info, info); - SKSE_MAKE_SOURCE_LOGGER(warn, warn); - SKSE_MAKE_SOURCE_LOGGER(error, err); - SKSE_MAKE_SOURCE_LOGGER(critical, critical); - [[nodiscard]] std::optional log_directory(); void add_papyrus_sink(std::regex a_filter); void remove_papyrus_sink(); - - void init(); } - -#undef SKSE_MAKE_SOURCE_LOGGER diff --git a/include/SKSE/RegistrationMap.h b/include/SKSE/RegistrationMap.h index bb6e570af..390a57eca 100644 --- a/include/SKSE/RegistrationMap.h +++ b/include/SKSE/RegistrationMap.h @@ -344,7 +344,7 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return; } @@ -377,7 +377,7 @@ namespace SKSE { assert(a_intfc); if (!a_intfc->OpenRecord(a_type, a_version)) { - log::error("Failed to open record!"); + REX::ERROR("Failed to open record!"); return false; } @@ -407,7 +407,7 @@ namespace SKSE // Reg count const std::size_t numRegs = _regs.size(); if (!a_intfc->WriteRecordData(numRegs)) { - log::error("Failed to save reg count ({})!", numRegs); + REX::ERROR("Failed to save reg count ({})!", numRegs); return false; } @@ -419,13 +419,13 @@ namespace SKSE // Handle count std::size_t numHandles = reg.second.size(); if (!a_intfc->WriteRecordData(numHandles)) { - log::error("Failed to save handle count ({})!", numHandles); + REX::ERROR("Failed to save handle count ({})!", numHandles); return false; } // Handle for (auto& handle : reg.second) { if (!a_intfc->WriteRecordData(handle)) { - log::error("Failed to save handle ({})", handle); + REX::ERROR("Failed to save handle ({})", handle); return false; } } @@ -499,14 +499,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } const auto invalidHandle = policy->EmptyHandle(); auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return false; } @@ -528,14 +528,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } const auto invalidHandle = policy->EmptyHandle(); const auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return false; } @@ -557,14 +557,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return; } const auto invalidHandle = policy->EmptyHandle(); const auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return; } diff --git a/include/SKSE/RegistrationMapUnique.h b/include/SKSE/RegistrationMapUnique.h index acfd3e6f9..6a918a2cc 100644 --- a/include/SKSE/RegistrationMapUnique.h +++ b/include/SKSE/RegistrationMapUnique.h @@ -431,7 +431,7 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return; } @@ -451,7 +451,7 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return; } @@ -490,7 +490,7 @@ namespace SKSE { assert(a_intfc); if (!a_intfc->OpenRecord(a_type, a_version)) { - log::error("Failed to open record!"); + REX::ERROR("Failed to open record!"); return false; } @@ -506,18 +506,18 @@ namespace SKSE // Reg count const std::size_t numRegs = _regs.size(); if (!a_intfc->WriteRecordData(numRegs)) { - log::error("Failed to save reg count ({})!", numRegs); + REX::ERROR("Failed to save reg count ({})!", numRegs); return false; } for (auto& reg : _regs) { //FormID if (!a_intfc->WriteRecordData(reg.first)) { - log::error("Failed to save handle formID ({:X})", reg.first); + REX::ERROR("Failed to save handle formID ({:X})", reg.first); return false; } std::size_t numUniqueHandle = reg.second.size(); if (!a_intfc->WriteRecordData(numUniqueHandle)) { - log::error("Failed to save handle count ({})!", numUniqueHandle); + REX::ERROR("Failed to save handle count ({})!", numUniqueHandle); return false; } // UniqueHandle @@ -525,22 +525,22 @@ namespace SKSE // EventFilter auto [eventFilter, match] = key; if (!eventFilter.Save(a_intfc)) { - log::error("Failed to save event filters!"); + REX::ERROR("Failed to save event filters!"); return false; } if (!a_intfc->WriteRecordData(match)) { - log::error("Failed to save reg key as bool ({})!", match); + REX::ERROR("Failed to save reg key as bool ({})!", match); return false; } //handle set std::size_t numHandles = handles.size(); if (!a_intfc->WriteRecordData(numHandles)) { - log::error("Failed to save handle count ({})!", numHandles); + REX::ERROR("Failed to save handle count ({})!", numHandles); return false; } for (auto& handle : handles) { if (!a_intfc->WriteRecordData(handle)) { - log::error("Failed to save handle ({})", handle); + REX::ERROR("Failed to save handle ({})", handle); return false; } } @@ -571,7 +571,7 @@ namespace SKSE for (std::size_t i = 0; i < numRegs; ++i) { a_intfc->ReadRecordData(formID); if (!a_intfc->ResolveFormID(formID, formID)) { - log::warn("Failed to resolve target formID ({:X})", formID); + REX::WARN("Failed to resolve target formID ({:X})", formID); continue; } a_intfc->ReadRecordData(numKeyHandle); @@ -579,7 +579,7 @@ namespace SKSE // filter Filter eventFilter{}; if (!eventFilter.Load(a_intfc)) { - log::error("Failed to save event filters!"); + REX::ERROR("Failed to save event filters!"); continue; } bool match; @@ -612,14 +612,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } const auto invalidHandle = policy->EmptyHandle(); auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return false; } @@ -641,14 +641,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } const auto invalidHandle = policy->EmptyHandle(); const auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return false; } @@ -672,14 +672,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return; } const auto invalidHandle = policy->EmptyHandle(); const auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return; } diff --git a/include/SKSE/SKSE.h b/include/SKSE/SKSE.h index d7a1cfbdc..be3a1fd55 100644 --- a/include/SKSE/SKSE.h +++ b/include/SKSE/SKSE.h @@ -4,7 +4,6 @@ #include "SKSE/API.h" #include "SKSE/Events.h" -#include "SKSE/IAT.h" #include "SKSE/InputMap.h" #include "SKSE/Interfaces.h" #include "SKSE/Logger.h" diff --git a/include/SKSE/Trampoline.h b/include/SKSE/Trampoline.h index 326533b4a..f946e49ba 100644 --- a/include/SKSE/Trampoline.h +++ b/include/SKSE/Trampoline.h @@ -1,208 +1,14 @@ #pragma once -#if defined(SKSE_SUPPORT_XBYAK) -namespace Xbyak -{ - class CodeGenerator; -} -#endif +#include "REL/Trampoline.h" namespace SKSE { - class Trampoline - { - public: - using deleter_type = std::function; - - Trampoline() = default; - Trampoline(const Trampoline&) = delete; - - Trampoline(Trampoline&& a_rhs) noexcept { move_from(std::move(a_rhs)); } - - explicit Trampoline(std::string_view a_name) : - _name(a_name) - {} - - ~Trampoline() { release(); } - - Trampoline& operator=(const Trampoline&) = delete; - - Trampoline& operator=(Trampoline&& a_rhs) noexcept - { - if (this != std::addressof(a_rhs)) { - move_from(std::move(a_rhs)); - } - return *this; - } - - void create(std::size_t a_size) { return create(a_size, nullptr); } - void create(std::size_t a_size, void* a_module); - - void set_trampoline(void* a_trampoline, std::size_t a_size, deleter_type a_deleter = {}) - { - auto trampoline = static_cast(a_trampoline); - if (trampoline) { - constexpr auto INT3 = static_cast(0xCC); - std::memset(trampoline, INT3, a_size); - } - - release(); - - _deleter = std::move(a_deleter); - _data = trampoline; - _capacity = a_size; - _size = 0; - - log_stats(); - } - - [[nodiscard]] void* allocate(std::size_t a_size) - { - auto result = do_allocate(a_size); - log_stats(); - return result; - } - -#ifdef SKSE_SUPPORT_XBYAK - [[nodiscard]] void* allocate(Xbyak::CodeGenerator& a_code); -#endif - - template - [[nodiscard]] T* allocate() - { - return static_cast(allocate(sizeof(T))); - } - - [[nodiscard]] constexpr std::size_t empty() const noexcept { return _capacity == 0; } - [[nodiscard]] constexpr std::size_t capacity() const noexcept { return _capacity; } - [[nodiscard]] constexpr std::size_t allocated_size() const noexcept { return _size; } - [[nodiscard]] constexpr std::size_t free_size() const noexcept { return _capacity - _size; } - - template - std::uintptr_t write_branch(std::uintptr_t a_src, std::uintptr_t a_dst) - { - std::uint8_t data = 0; - if constexpr (N == 5) { - // E9 cd - // JMP rel32 - data = 0xE9; - } else if constexpr (N == 6) { - // FF /4 - // JMP r/m64 - data = 0x25; - } else { - static_assert(false && N, "invalid branch size"); - } - - return write_branch(a_src, a_dst, data); - } - - template - std::uintptr_t write_branch(std::uintptr_t a_src, F a_dst) - { - return write_branch(a_src, stl::unrestricted_cast(a_dst)); - } + using Trampoline = REL::Trampoline; - template - std::uintptr_t write_call(std::uintptr_t a_src, std::uintptr_t a_dst) - { - std::uint8_t data = 0; - if constexpr (N == 5) { - // E8 cd - // CALL rel32 - data = 0xE8; - } else if constexpr (N == 6) { - // FF /2 - // CALL r/m64 - data = 0x15; - } else { - static_assert(false && N, "invalid call size"); - } - - return write_branch(a_src, a_dst, data); - } - - template - std::uintptr_t write_call(std::uintptr_t a_src, F a_dst) - { - return write_call(a_src, stl::unrestricted_cast(a_dst)); - } - - private: - [[nodiscard]] void* do_create(std::size_t a_size, std::uintptr_t a_address); - [[nodiscard]] void* do_allocate(std::size_t a_size); - - 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) - { - const auto isNop = *reinterpret_cast(a_src) == 0x90; - const auto disp = reinterpret_cast(a_src + N - 4); - const auto nextOp = a_src + N; - const auto func = isNop ? 0 : nextOp + *disp; - - if constexpr (N == 5) { - write_5branch(a_src, a_dst, a_data); - } else if constexpr (N == 6) { - write_6branch(a_src, a_dst, a_data); - } else { - static_assert(false && N, "invalid branch size"); - } - - return func; - } - - void move_from(Trampoline&& a_rhs) - { - _5branches = std::move(a_rhs._5branches); - _6branches = std::move(a_rhs._6branches); - _name = std::move(a_rhs._name); - - _deleter = std::move(a_rhs._deleter); - - _data = a_rhs._data; - a_rhs._data = nullptr; - - _capacity = a_rhs._capacity; - a_rhs._capacity = 0; - - _size = a_rhs._size; - a_rhs._size = 0; - } - - void log_stats() const; - - [[nodiscard]] bool in_range(std::ptrdiff_t a_disp) const - { - constexpr auto min = std::numeric_limits::min(); - constexpr auto max = std::numeric_limits::max(); - - return min <= a_disp && a_disp <= max; - } - - void release() - { - if (_data && _deleter) { - _deleter(_data, _capacity); - } - - _5branches.clear(); - _6branches.clear(); - _data = nullptr; - _capacity = 0; - _size = 0; - } - - std::map _5branches; - std::map _6branches; - std::string _name{ "Default Trampoline"sv }; - deleter_type _deleter; - std::byte* _data{ nullptr }; - std::size_t _capacity{ 0 }; - std::size_t _size{ 0 }; - }; - - Trampoline& GetTrampoline(); + // DEPRECATED + [[nodiscard]] REL::Trampoline& GetTrampoline() noexcept + { + return REL::GetTrampoline(); + } } diff --git a/Flash/AS2/CLIK/Amp.as b/res/Flash/AS2/CLIK/Amp.as similarity index 100% rename from Flash/AS2/CLIK/Amp.as rename to res/Flash/AS2/CLIK/Amp.as diff --git a/Flash/AS2/CLIK/Button.as b/res/Flash/AS2/CLIK/Button.as similarity index 100% rename from Flash/AS2/CLIK/Button.as rename to res/Flash/AS2/CLIK/Button.as diff --git a/Flash/AS2/CLIK/Mouse.as b/res/Flash/AS2/CLIK/Mouse.as similarity index 100% rename from Flash/AS2/CLIK/Mouse.as rename to res/Flash/AS2/CLIK/Mouse.as diff --git a/Flash/AS2/CLIK/MovieClip.as b/res/Flash/AS2/CLIK/MovieClip.as similarity index 100% rename from Flash/AS2/CLIK/MovieClip.as rename to res/Flash/AS2/CLIK/MovieClip.as diff --git a/Flash/AS2/CLIK/Selection.as b/res/Flash/AS2/CLIK/Selection.as similarity index 100% rename from Flash/AS2/CLIK/Selection.as rename to res/Flash/AS2/CLIK/Selection.as diff --git a/Flash/AS2/CLIK/Stage.as b/res/Flash/AS2/CLIK/Stage.as similarity index 100% rename from Flash/AS2/CLIK/Stage.as rename to res/Flash/AS2/CLIK/Stage.as diff --git a/Flash/AS2/CLIK/System/capabilities.as b/res/Flash/AS2/CLIK/System/capabilities.as similarity index 100% rename from Flash/AS2/CLIK/System/capabilities.as rename to res/Flash/AS2/CLIK/System/capabilities.as diff --git a/Flash/AS2/CLIK/TextField.as b/res/Flash/AS2/CLIK/TextField.as similarity index 100% rename from Flash/AS2/CLIK/TextField.as rename to res/Flash/AS2/CLIK/TextField.as diff --git a/Flash/AS2/CLIK/TextFormat.as b/res/Flash/AS2/CLIK/TextFormat.as similarity index 100% rename from Flash/AS2/CLIK/TextFormat.as rename to res/Flash/AS2/CLIK/TextFormat.as diff --git a/Flash/AS2/CLIK/gfx/controls/Button.as b/res/Flash/AS2/CLIK/gfx/controls/Button.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/Button.as rename to res/Flash/AS2/CLIK/gfx/controls/Button.as diff --git a/Flash/AS2/CLIK/gfx/controls/ButtonBar.as b/res/Flash/AS2/CLIK/gfx/controls/ButtonBar.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ButtonBar.as rename to res/Flash/AS2/CLIK/gfx/controls/ButtonBar.as diff --git a/Flash/AS2/CLIK/gfx/controls/ButtonGroup.as b/res/Flash/AS2/CLIK/gfx/controls/ButtonGroup.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ButtonGroup.as rename to res/Flash/AS2/CLIK/gfx/controls/ButtonGroup.as diff --git a/Flash/AS2/CLIK/gfx/controls/CheckBox.as b/res/Flash/AS2/CLIK/gfx/controls/CheckBox.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/CheckBox.as rename to res/Flash/AS2/CLIK/gfx/controls/CheckBox.as diff --git a/Flash/AS2/CLIK/gfx/controls/CoreList.as b/res/Flash/AS2/CLIK/gfx/controls/CoreList.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/CoreList.as rename to res/Flash/AS2/CLIK/gfx/controls/CoreList.as diff --git a/Flash/AS2/CLIK/gfx/controls/Dialog.as b/res/Flash/AS2/CLIK/gfx/controls/Dialog.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/Dialog.as rename to res/Flash/AS2/CLIK/gfx/controls/Dialog.as diff --git a/Flash/AS2/CLIK/gfx/controls/DragTarget.as b/res/Flash/AS2/CLIK/gfx/controls/DragTarget.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/DragTarget.as rename to res/Flash/AS2/CLIK/gfx/controls/DragTarget.as diff --git a/Flash/AS2/CLIK/gfx/controls/DropdownMenu.as b/res/Flash/AS2/CLIK/gfx/controls/DropdownMenu.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/DropdownMenu.as rename to res/Flash/AS2/CLIK/gfx/controls/DropdownMenu.as diff --git a/Flash/AS2/CLIK/gfx/controls/InventorySlot.as b/res/Flash/AS2/CLIK/gfx/controls/InventorySlot.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/InventorySlot.as rename to res/Flash/AS2/CLIK/gfx/controls/InventorySlot.as diff --git a/Flash/AS2/CLIK/gfx/controls/ItemSlot.as b/res/Flash/AS2/CLIK/gfx/controls/ItemSlot.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ItemSlot.as rename to res/Flash/AS2/CLIK/gfx/controls/ItemSlot.as diff --git a/Flash/AS2/CLIK/gfx/controls/Label.as b/res/Flash/AS2/CLIK/gfx/controls/Label.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/Label.as rename to res/Flash/AS2/CLIK/gfx/controls/Label.as diff --git a/Flash/AS2/CLIK/gfx/controls/ListItemRenderer.as b/res/Flash/AS2/CLIK/gfx/controls/ListItemRenderer.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ListItemRenderer.as rename to res/Flash/AS2/CLIK/gfx/controls/ListItemRenderer.as diff --git a/Flash/AS2/CLIK/gfx/controls/NumericStepper.as b/res/Flash/AS2/CLIK/gfx/controls/NumericStepper.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/NumericStepper.as rename to res/Flash/AS2/CLIK/gfx/controls/NumericStepper.as diff --git a/Flash/AS2/CLIK/gfx/controls/OptionStepper.as b/res/Flash/AS2/CLIK/gfx/controls/OptionStepper.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/OptionStepper.as rename to res/Flash/AS2/CLIK/gfx/controls/OptionStepper.as diff --git a/Flash/AS2/CLIK/gfx/controls/ProgressBar.as b/res/Flash/AS2/CLIK/gfx/controls/ProgressBar.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ProgressBar.as rename to res/Flash/AS2/CLIK/gfx/controls/ProgressBar.as diff --git a/Flash/AS2/CLIK/gfx/controls/RadioButton.as b/res/Flash/AS2/CLIK/gfx/controls/RadioButton.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/RadioButton.as rename to res/Flash/AS2/CLIK/gfx/controls/RadioButton.as diff --git a/Flash/AS2/CLIK/gfx/controls/ScrollBar.as b/res/Flash/AS2/CLIK/gfx/controls/ScrollBar.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ScrollBar.as rename to res/Flash/AS2/CLIK/gfx/controls/ScrollBar.as diff --git a/Flash/AS2/CLIK/gfx/controls/ScrollIndicator.as b/res/Flash/AS2/CLIK/gfx/controls/ScrollIndicator.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ScrollIndicator.as rename to res/Flash/AS2/CLIK/gfx/controls/ScrollIndicator.as diff --git a/Flash/AS2/CLIK/gfx/controls/ScrollingList.as b/res/Flash/AS2/CLIK/gfx/controls/ScrollingList.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ScrollingList.as rename to res/Flash/AS2/CLIK/gfx/controls/ScrollingList.as diff --git a/Flash/AS2/CLIK/gfx/controls/Slider.as b/res/Flash/AS2/CLIK/gfx/controls/Slider.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/Slider.as rename to res/Flash/AS2/CLIK/gfx/controls/Slider.as diff --git a/Flash/AS2/CLIK/gfx/controls/StatusIndicator.as b/res/Flash/AS2/CLIK/gfx/controls/StatusIndicator.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/StatusIndicator.as rename to res/Flash/AS2/CLIK/gfx/controls/StatusIndicator.as diff --git a/Flash/AS2/CLIK/gfx/controls/TextArea.as b/res/Flash/AS2/CLIK/gfx/controls/TextArea.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/TextArea.as rename to res/Flash/AS2/CLIK/gfx/controls/TextArea.as diff --git a/Flash/AS2/CLIK/gfx/controls/TextInput.as b/res/Flash/AS2/CLIK/gfx/controls/TextInput.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/TextInput.as rename to res/Flash/AS2/CLIK/gfx/controls/TextInput.as diff --git a/Flash/AS2/CLIK/gfx/controls/TileList.as b/res/Flash/AS2/CLIK/gfx/controls/TileList.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/TileList.as rename to res/Flash/AS2/CLIK/gfx/controls/TileList.as diff --git a/Flash/AS2/CLIK/gfx/controls/UILoader.as b/res/Flash/AS2/CLIK/gfx/controls/UILoader.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/UILoader.as rename to res/Flash/AS2/CLIK/gfx/controls/UILoader.as diff --git a/Flash/AS2/CLIK/gfx/controls/ViewStack.as b/res/Flash/AS2/CLIK/gfx/controls/ViewStack.as similarity index 100% rename from Flash/AS2/CLIK/gfx/controls/ViewStack.as rename to res/Flash/AS2/CLIK/gfx/controls/ViewStack.as diff --git a/Flash/AS2/CLIK/gfx/core/UIComponent.as b/res/Flash/AS2/CLIK/gfx/core/UIComponent.as similarity index 100% rename from Flash/AS2/CLIK/gfx/core/UIComponent.as rename to res/Flash/AS2/CLIK/gfx/core/UIComponent.as diff --git a/Flash/AS2/CLIK/gfx/data/DataProvider.as b/res/Flash/AS2/CLIK/gfx/data/DataProvider.as similarity index 100% rename from Flash/AS2/CLIK/gfx/data/DataProvider.as rename to res/Flash/AS2/CLIK/gfx/data/DataProvider.as diff --git a/Flash/AS2/CLIK/gfx/data/GameDataProvider.as b/res/Flash/AS2/CLIK/gfx/data/GameDataProvider.as similarity index 100% rename from Flash/AS2/CLIK/gfx/data/GameDataProvider.as rename to res/Flash/AS2/CLIK/gfx/data/GameDataProvider.as diff --git a/Flash/AS2/CLIK/gfx/events/EventDispatcher.as b/res/Flash/AS2/CLIK/gfx/events/EventDispatcher.as similarity index 100% rename from Flash/AS2/CLIK/gfx/events/EventDispatcher.as rename to res/Flash/AS2/CLIK/gfx/events/EventDispatcher.as diff --git a/Flash/AS2/CLIK/gfx/events/EventTypes.as b/res/Flash/AS2/CLIK/gfx/events/EventTypes.as similarity index 100% rename from Flash/AS2/CLIK/gfx/events/EventTypes.as rename to res/Flash/AS2/CLIK/gfx/events/EventTypes.as diff --git a/Flash/AS2/CLIK/gfx/interfaces/IDataProvider.as b/res/Flash/AS2/CLIK/gfx/interfaces/IDataProvider.as similarity index 100% rename from Flash/AS2/CLIK/gfx/interfaces/IDataProvider.as rename to res/Flash/AS2/CLIK/gfx/interfaces/IDataProvider.as diff --git a/Flash/AS2/CLIK/gfx/interfaces/IList.as b/res/Flash/AS2/CLIK/gfx/interfaces/IList.as similarity index 100% rename from Flash/AS2/CLIK/gfx/interfaces/IList.as rename to res/Flash/AS2/CLIK/gfx/interfaces/IList.as diff --git a/Flash/AS2/CLIK/gfx/interfaces/IListItemRenderer.as b/res/Flash/AS2/CLIK/gfx/interfaces/IListItemRenderer.as similarity index 100% rename from Flash/AS2/CLIK/gfx/interfaces/IListItemRenderer.as rename to res/Flash/AS2/CLIK/gfx/interfaces/IListItemRenderer.as diff --git a/Flash/AS2/CLIK/gfx/io/GameDelegate.as b/res/Flash/AS2/CLIK/gfx/io/GameDelegate.as similarity index 100% rename from Flash/AS2/CLIK/gfx/io/GameDelegate.as rename to res/Flash/AS2/CLIK/gfx/io/GameDelegate.as diff --git a/Flash/AS2/CLIK/gfx/layout/Panel.as b/res/Flash/AS2/CLIK/gfx/layout/Panel.as similarity index 100% rename from Flash/AS2/CLIK/gfx/layout/Panel.as rename to res/Flash/AS2/CLIK/gfx/layout/Panel.as diff --git a/Flash/AS2/CLIK/gfx/layout/StagePanel.as b/res/Flash/AS2/CLIK/gfx/layout/StagePanel.as similarity index 100% rename from Flash/AS2/CLIK/gfx/layout/StagePanel.as rename to res/Flash/AS2/CLIK/gfx/layout/StagePanel.as diff --git a/Flash/AS2/CLIK/gfx/managers/DragManager.as b/res/Flash/AS2/CLIK/gfx/managers/DragManager.as similarity index 100% rename from Flash/AS2/CLIK/gfx/managers/DragManager.as rename to res/Flash/AS2/CLIK/gfx/managers/DragManager.as diff --git a/Flash/AS2/CLIK/gfx/managers/FocusHandler.as b/res/Flash/AS2/CLIK/gfx/managers/FocusHandler.as similarity index 100% rename from Flash/AS2/CLIK/gfx/managers/FocusHandler.as rename to res/Flash/AS2/CLIK/gfx/managers/FocusHandler.as diff --git a/Flash/AS2/CLIK/gfx/managers/InputDelegate.as b/res/Flash/AS2/CLIK/gfx/managers/InputDelegate.as similarity index 100% rename from Flash/AS2/CLIK/gfx/managers/InputDelegate.as rename to res/Flash/AS2/CLIK/gfx/managers/InputDelegate.as diff --git a/Flash/AS2/CLIK/gfx/managers/PopUpManager.as b/res/Flash/AS2/CLIK/gfx/managers/PopUpManager.as similarity index 100% rename from Flash/AS2/CLIK/gfx/managers/PopUpManager.as rename to res/Flash/AS2/CLIK/gfx/managers/PopUpManager.as diff --git a/Flash/AS2/CLIK/gfx/motion/Tween.as b/res/Flash/AS2/CLIK/gfx/motion/Tween.as similarity index 100% rename from Flash/AS2/CLIK/gfx/motion/Tween.as rename to res/Flash/AS2/CLIK/gfx/motion/Tween.as diff --git a/Flash/AS2/CLIK/gfx/ui/InputDetails.as b/res/Flash/AS2/CLIK/gfx/ui/InputDetails.as similarity index 100% rename from Flash/AS2/CLIK/gfx/ui/InputDetails.as rename to res/Flash/AS2/CLIK/gfx/ui/InputDetails.as diff --git a/Flash/AS2/CLIK/gfx/ui/NavigationCode.as b/res/Flash/AS2/CLIK/gfx/ui/NavigationCode.as similarity index 100% rename from Flash/AS2/CLIK/gfx/ui/NavigationCode.as rename to res/Flash/AS2/CLIK/gfx/ui/NavigationCode.as diff --git a/Flash/AS2/CLIK/gfx/utils/Constraints.as b/res/Flash/AS2/CLIK/gfx/utils/Constraints.as similarity index 100% rename from Flash/AS2/CLIK/gfx/utils/Constraints.as rename to res/Flash/AS2/CLIK/gfx/utils/Constraints.as diff --git a/Flash/AS2/CLIK/gfx/utils/Delegate.as b/res/Flash/AS2/CLIK/gfx/utils/Delegate.as similarity index 100% rename from Flash/AS2/CLIK/gfx/utils/Delegate.as rename to res/Flash/AS2/CLIK/gfx/utils/Delegate.as diff --git a/Flash/AS2/CLIK/gfx/utils/Locale.as b/res/Flash/AS2/CLIK/gfx/utils/Locale.as similarity index 100% rename from Flash/AS2/CLIK/gfx/utils/Locale.as rename to res/Flash/AS2/CLIK/gfx/utils/Locale.as diff --git a/CommonLibSSE.natvis b/res/commonlibsse.natvis similarity index 99% rename from CommonLibSSE.natvis rename to res/commonlibsse.natvis index 5025977c3..ea3798fd9 100644 --- a/CommonLibSSE.natvis +++ b/res/commonlibsse.natvis @@ -1,6 +1,6 @@ - + {static_cast<$T1>(_impl),en} diff --git a/res/scripts/generate_headers.py b/res/scripts/generate_headers.py new file mode 100644 index 000000000..162d61a67 --- /dev/null +++ b/res/scripts/generate_headers.py @@ -0,0 +1,45 @@ +import os +import pathlib + +def make_header(a_directory, a_filename, a_exclude = set()): + a_exclude.add(a_filename) + + with open(a_directory + "/" + a_filename, "w", encoding="utf-8") as out: + out.write("#pragma once\n") + out.write("\n") + out.write('#include "SKSE/Impl/PCH.h"\n') + out.write("\n") + + tmp = [] + for dirpath, dirnames, filenames in os.walk(a_directory): + rem = [] + for dirname in dirnames: + if dirname in a_exclude: + rem.append(dirname) + for todo in rem: + dirnames.remove(todo) + + for filename in filenames: + if filename not in a_exclude and filename.endswith((".h", ".hpp", ".hxx")): + path = os.path.join(dirpath, filename) + tmp.append(os.path.normpath(path)) + + files = [] + for file in tmp: + files.append(file.replace("\\", "/")) + + files.sort() + for file in files: + out.write('#include "') + out.write(file) + out.write('"\n') + +def main(): + root = pathlib.Path(os.path.dirname(os.path.realpath(__file__))).parent.parent + os.chdir(os.path.join(root, "include")) + + make_header("SKSE", "SKSE.h", { "Impl" }) + make_header("RE", "Skyrim.h", { "BSCoreTypes.h", "Offsets.h", "Offsets_NiRTTI.h", "Offsets_RTTI.h", "SFTypes.h" }) + +if __name__ == "__main__": + main() diff --git a/scripts/cmake_generate.py b/scripts/cmake_generate.py deleted file mode 100644 index 527fb20de..000000000 --- a/scripts/cmake_generate.py +++ /dev/null @@ -1,74 +0,0 @@ -import os - -HEADER_TYPES = (".h", ".hpp", ".hxx") -SOURCE_TYPES = (".c", ".cpp", ".cxx") -ALL_TYPES = HEADER_TYPES + SOURCE_TYPES - -def make_header(a_directory, a_filename, a_exclude): - a_exclude.add(a_filename) - - with open(a_directory + "/" + a_filename, "w", encoding="utf-8") as out: - out.write("#pragma once\n") - out.write("\n") - out.write('#include "SKSE/Impl/PCH.h"\n') - out.write("\n") - - tmp = [] - for dirpath, dirnames, filenames in os.walk(a_directory): - rem = [] - for dirname in dirnames: - if dirname in a_exclude: - rem.append(dirname) - for todo in rem: - dirnames.remove(todo) - - for filename in filenames: - if filename not in a_exclude and filename.endswith(HEADER_TYPES): - path = os.path.join(dirpath, filename) - tmp.append(os.path.normpath(path)) - - files = [] - for file in tmp: - files.append(file.replace("\\", "/")) - - files.sort() - for file in files: - out.write('#include "') - out.write(file) - out.write('"\n') - -def make_cmake(): - tmp = [] - for directory in { "include", "src" }: - for dirpath, dirnames, filenames in os.walk(directory): - for filename in filenames: - if filename.endswith(ALL_TYPES): - path = os.path.join(dirpath, filename) - tmp.append(os.path.normpath(path)) - - sources = [] - for file in tmp: - name = file.replace("\\", "/") - sources.append(name) - sources.sort() - - def do_make(a_filename, a_varname, a_files): - with open("cmake/{}.cmake".format(a_filename), "w", encoding="utf-8") as out: - out.write("set({}\n".format(a_varname)) - for file in a_files: - out.write("\t{}\n".format(file)) - out.write(")\n") - - do_make("sourcelist", "SOURCES", sources) - -def main(): - root = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] - os.chdir(root) - make_cmake() - - os.chdir(os.path.join(root, "include")) - make_header("SKSE", "SKSE.h", { "Impl" }) - make_header("RE", "Skyrim.h", { "BSCoreTypes.h", "Offsets.h", "Offsets_NiRTTI.h", "Offsets_RTTI.h", "SFTypes.h" }) - -if __name__ == "__main__": - main() diff --git a/src/RE/B/BSAtomic.cpp b/src/RE/B/BSAtomic.cpp index 9b5428137..fbcb1cc67 100644 --- a/src/RE/B/BSAtomic.cpp +++ b/src/RE/B/BSAtomic.cpp @@ -7,14 +7,12 @@ namespace RE BSSemaphoreBase::BSSemaphoreBase() : semaphore() { - stl::memzero(&semaphore); semaphore = REX::W32::CreateSemaphoreA(nullptr, 0, 40, nullptr); } BSSemaphoreBase::~BSSemaphoreBase() { REX::W32::CloseHandle(semaphore); - stl::memzero(&semaphore); } BSSpinLock::BSSpinLock() : diff --git a/src/RE/B/BSHandleRefObject.cpp b/src/RE/B/BSHandleRefObject.cpp index c2af7ce71..1efc3b9ed 100644 --- a/src/RE/B/BSHandleRefObject.cpp +++ b/src/RE/B/BSHandleRefObject.cpp @@ -5,13 +5,13 @@ namespace RE BSHandleRefObject::~BSHandleRefObject() { _refCount = _refCount & kRefCountMask; - stl::atomic_ref totalObjects{ *GetTotalObjectCount() }; + REX::TAtomicRef totalObjects{ *GetTotalObjectCount() }; --totalObjects; } void BSHandleRefObject::DecRefCount() { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; if (((--myRefCount) & kRefCountMask) == 0) { DeleteThis(); } @@ -19,7 +19,7 @@ namespace RE void BSHandleRefObject::IncRefCount() { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; ++myRefCount; } diff --git a/src/RE/B/BSLightingShaderMaterialBase.cpp b/src/RE/B/BSLightingShaderMaterialBase.cpp index 70cb59587..5cdbcc3f4 100644 --- a/src/RE/B/BSLightingShaderMaterialBase.cpp +++ b/src/RE/B/BSLightingShaderMaterialBase.cpp @@ -50,7 +50,7 @@ namespace RE std::memset((void*)material, 0, sizeof(BSLightingShaderMaterial)); if (material) { material->Ctor(); - stl::emplace_vtable(material); + REX::EMPLACE_VTABLE(material); } return material; } diff --git a/src/RE/B/BSTArray.cpp b/src/RE/B/BSTArray.cpp index d76a99b30..b749bf9d3 100644 --- a/src/RE/B/BSTArray.cpp +++ b/src/RE/B/BSTArray.cpp @@ -9,7 +9,6 @@ namespace RE if (_data) { deallocate(_data); } - stl::memzero(this); } void* BSScrapArrayAllocator::allocate(std::size_t a_size) diff --git a/src/RE/B/BSWin32KeyboardDevice.cpp b/src/RE/B/BSWin32KeyboardDevice.cpp index e0f0abe73..ba0668588 100644 --- a/src/RE/B/BSWin32KeyboardDevice.cpp +++ b/src/RE/B/BSWin32KeyboardDevice.cpp @@ -1,5 +1,7 @@ #include "RE/B/BSWin32KeyboardDevice.h" +#include + namespace RE { bool BSWin32KeyboardDevice::IsPressed(std::uint32_t a_keyCode) const diff --git a/src/RE/B/BipedAnim.cpp b/src/RE/B/BipedAnim.cpp index 64f13a142..64f3155a9 100644 --- a/src/RE/B/BipedAnim.cpp +++ b/src/RE/B/BipedAnim.cpp @@ -7,7 +7,6 @@ namespace RE BipedAnim::~BipedAnim() { Dtor(); - stl::memzero(this); } void BipedAnim::RemoveAllParts() diff --git a/src/RE/E/ExtraAliasInstanceArray.cpp b/src/RE/E/ExtraAliasInstanceArray.cpp index 80629b01d..ba8c3a611 100644 --- a/src/RE/E/ExtraAliasInstanceArray.cpp +++ b/src/RE/E/ExtraAliasInstanceArray.cpp @@ -9,7 +9,7 @@ namespace RE aliases(), lock() { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraAliasInstanceArray::~ExtraAliasInstanceArray() diff --git a/src/RE/E/ExtraAshPileRef.cpp b/src/RE/E/ExtraAshPileRef.cpp index 14f1b43b1..ed512adf2 100644 --- a/src/RE/E/ExtraAshPileRef.cpp +++ b/src/RE/E/ExtraAshPileRef.cpp @@ -11,7 +11,7 @@ namespace RE ashPileRef(ashPileRef), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraAshPileRef::GetType() const diff --git a/src/RE/E/ExtraCanTalkToPlayer.cpp b/src/RE/E/ExtraCanTalkToPlayer.cpp index 09f567f05..8d761b828 100644 --- a/src/RE/E/ExtraCanTalkToPlayer.cpp +++ b/src/RE/E/ExtraCanTalkToPlayer.cpp @@ -13,7 +13,7 @@ namespace RE pad12(0), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraCanTalkToPlayer::GetType() const diff --git a/src/RE/E/ExtraCannotWear.cpp b/src/RE/E/ExtraCannotWear.cpp index b87593b36..42f962c1b 100644 --- a/src/RE/E/ExtraCannotWear.cpp +++ b/src/RE/E/ExtraCannotWear.cpp @@ -5,7 +5,7 @@ namespace RE ExtraCannotWear::ExtraCannotWear() : BSExtraData() { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraCannotWear::GetType() const diff --git a/src/RE/E/ExtraCharge.cpp b/src/RE/E/ExtraCharge.cpp index 857fdd61e..a1a143952 100644 --- a/src/RE/E/ExtraCharge.cpp +++ b/src/RE/E/ExtraCharge.cpp @@ -7,7 +7,7 @@ namespace RE charge(0.0F), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraCharge::GetType() const diff --git a/src/RE/E/ExtraContainerChanges.cpp b/src/RE/E/ExtraContainerChanges.cpp index 61f0ef810..6685b2d0d 100644 --- a/src/RE/E/ExtraContainerChanges.cpp +++ b/src/RE/E/ExtraContainerChanges.cpp @@ -12,7 +12,7 @@ namespace RE BSExtraData(), changes(a_changes) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraContainerChanges::~ExtraContainerChanges() diff --git a/src/RE/E/ExtraCount.cpp b/src/RE/E/ExtraCount.cpp index dc54e6e95..4258d864d 100644 --- a/src/RE/E/ExtraCount.cpp +++ b/src/RE/E/ExtraCount.cpp @@ -12,7 +12,7 @@ namespace RE pad12(0), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraCount::GetType() const diff --git a/src/RE/E/ExtraEnchantment.cpp b/src/RE/E/ExtraEnchantment.cpp index 42abe88a5..cc33c15e2 100644 --- a/src/RE/E/ExtraEnchantment.cpp +++ b/src/RE/E/ExtraEnchantment.cpp @@ -14,7 +14,7 @@ namespace RE pad1B(0), pad1C(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraEnchantment::GetType() const diff --git a/src/RE/E/ExtraEncounterZone.cpp b/src/RE/E/ExtraEncounterZone.cpp index d467af4c1..3c1beadc5 100644 --- a/src/RE/E/ExtraEncounterZone.cpp +++ b/src/RE/E/ExtraEncounterZone.cpp @@ -10,7 +10,7 @@ namespace RE BSExtraData(), zone(a_zone) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraEncounterZone::GetType() const diff --git a/src/RE/E/ExtraForcedTarget.cpp b/src/RE/E/ExtraForcedTarget.cpp index 59f7319b7..dd298fcfd 100644 --- a/src/RE/E/ExtraForcedTarget.cpp +++ b/src/RE/E/ExtraForcedTarget.cpp @@ -13,7 +13,7 @@ namespace RE target(a_target), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraForcedTarget::GetType() const diff --git a/src/RE/E/ExtraHealth.cpp b/src/RE/E/ExtraHealth.cpp index 9169e7072..e70ff1e21 100644 --- a/src/RE/E/ExtraHealth.cpp +++ b/src/RE/E/ExtraHealth.cpp @@ -11,7 +11,7 @@ namespace RE health(a_health), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraHealth::GetType() const diff --git a/src/RE/E/ExtraHotkey.cpp b/src/RE/E/ExtraHotkey.cpp index 8d8b8b127..2385f4f5f 100644 --- a/src/RE/E/ExtraHotkey.cpp +++ b/src/RE/E/ExtraHotkey.cpp @@ -13,7 +13,7 @@ namespace RE unk12(0), unk14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraHotkey::GetType() const diff --git a/src/RE/E/ExtraLevCreaModifier.cpp b/src/RE/E/ExtraLevCreaModifier.cpp index 874a14fa5..122e703a0 100644 --- a/src/RE/E/ExtraLevCreaModifier.cpp +++ b/src/RE/E/ExtraLevCreaModifier.cpp @@ -11,7 +11,7 @@ namespace RE modifier(a_modifier), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraLevCreaModifier::GetType() const diff --git a/src/RE/E/ExtraLightData.cpp b/src/RE/E/ExtraLightData.cpp index 22699332f..3d2c80c25 100644 --- a/src/RE/E/ExtraLightData.cpp +++ b/src/RE/E/ExtraLightData.cpp @@ -17,7 +17,7 @@ namespace RE data(), pad24(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraLightData::GetType() const diff --git a/src/RE/E/ExtraNorthRotation.cpp b/src/RE/E/ExtraNorthRotation.cpp index be11af643..241d313bd 100644 --- a/src/RE/E/ExtraNorthRotation.cpp +++ b/src/RE/E/ExtraNorthRotation.cpp @@ -7,7 +7,7 @@ namespace RE northRot(0.0F), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraNorthRotation::GetType() const diff --git a/src/RE/E/ExtraOwnership.cpp b/src/RE/E/ExtraOwnership.cpp index 138ef6993..005b47485 100644 --- a/src/RE/E/ExtraOwnership.cpp +++ b/src/RE/E/ExtraOwnership.cpp @@ -10,7 +10,7 @@ namespace RE BSExtraData(), owner(a_owner) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraOwnership::GetType() const diff --git a/src/RE/E/ExtraPoison.cpp b/src/RE/E/ExtraPoison.cpp index 4c76f1321..9ced57fd0 100644 --- a/src/RE/E/ExtraPoison.cpp +++ b/src/RE/E/ExtraPoison.cpp @@ -12,7 +12,7 @@ namespace RE count(a_count), pad1C(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraPoison::GetType() const diff --git a/src/RE/E/ExtraRank.cpp b/src/RE/E/ExtraRank.cpp index 090112b15..fc63d638a 100644 --- a/src/RE/E/ExtraRank.cpp +++ b/src/RE/E/ExtraRank.cpp @@ -11,7 +11,7 @@ namespace RE rank(a_rank), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraRank::GetType() const diff --git a/src/RE/E/ExtraReferenceHandle.cpp b/src/RE/E/ExtraReferenceHandle.cpp index 635facbee..999f65a66 100644 --- a/src/RE/E/ExtraReferenceHandle.cpp +++ b/src/RE/E/ExtraReferenceHandle.cpp @@ -13,7 +13,7 @@ namespace RE containerRef(a_containerRef), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraReferenceHandle::GetType() const diff --git a/src/RE/E/ExtraSoul.cpp b/src/RE/E/ExtraSoul.cpp index a08b985e3..eda32ff7c 100644 --- a/src/RE/E/ExtraSoul.cpp +++ b/src/RE/E/ExtraSoul.cpp @@ -13,7 +13,7 @@ namespace RE pad12(0), pad14(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraSoul::GetType() const diff --git a/src/RE/E/ExtraTextDisplayData.cpp b/src/RE/E/ExtraTextDisplayData.cpp index 0becd7627..d9e19eb7e 100644 --- a/src/RE/E/ExtraTextDisplayData.cpp +++ b/src/RE/E/ExtraTextDisplayData.cpp @@ -13,7 +13,7 @@ namespace RE pad32(0), pad34(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraTextDisplayData::ExtraTextDisplayData(const char* a_name) : @@ -27,7 +27,7 @@ namespace RE pad32(0), pad34(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); SetName(a_name); } @@ -42,7 +42,7 @@ namespace RE pad32(0), pad34(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); GetDisplayName(a_baseObject, a_temperFactor); } diff --git a/src/RE/E/ExtraUniqueID.cpp b/src/RE/E/ExtraUniqueID.cpp index 79746d92d..a568851b9 100644 --- a/src/RE/E/ExtraUniqueID.cpp +++ b/src/RE/E/ExtraUniqueID.cpp @@ -12,7 +12,7 @@ namespace RE uniqueID(a_uniqueID), pad16(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } ExtraDataType ExtraUniqueID::GetType() const diff --git a/src/RE/G/GFxResource.cpp b/src/RE/G/GFxResource.cpp index f7321bb5e..ed4920331 100644 --- a/src/RE/G/GFxResource.cpp +++ b/src/RE/G/GFxResource.cpp @@ -29,13 +29,13 @@ namespace RE void GFxResource::AddRef() { - stl::atomic_ref myRefCount{ _refCount.value }; + REX::TAtomicRef myRefCount{ _refCount.value }; ++myRefCount; } bool GFxResource::AddRef_NotZero() { - stl::atomic_ref myRefCount{ _refCount.value }; + REX::TAtomicRef myRefCount{ _refCount.value }; if (myRefCount != 0) { ++myRefCount; return true; @@ -46,7 +46,7 @@ namespace RE void GFxResource::Release() { - stl::atomic_ref myRefCount{ _refCount.value }; + REX::TAtomicRef myRefCount{ _refCount.value }; if (--myRefCount == 0) { if (_lib) { _lib->RemoveResourceOnRelease(this); diff --git a/src/RE/G/GRefCountImpl.cpp b/src/RE/G/GRefCountImpl.cpp index c76773eab..0fbfbb755 100644 --- a/src/RE/G/GRefCountImpl.cpp +++ b/src/RE/G/GRefCountImpl.cpp @@ -4,13 +4,13 @@ namespace RE { void GRefCountImpl::AddRef() { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; ++myRefCount; } void GRefCountImpl::Release() { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; if (--myRefCount == 0) { delete this; } diff --git a/src/RE/G/GString.cpp b/src/RE/G/GString.cpp index 3728e2946..09847140f 100644 --- a/src/RE/G/GString.cpp +++ b/src/RE/G/GString.cpp @@ -17,13 +17,13 @@ namespace RE void GString::DataDesc::AddRef() { - stl::atomic_ref myRefCount{ refCount }; + REX::TAtomicRef myRefCount{ refCount }; ++myRefCount; } void GString::DataDesc::Release() { - stl::atomic_ref myRefCount{ refCount }; + REX::TAtomicRef myRefCount{ refCount }; if (--myRefCount == 0) { GFREE(this); } diff --git a/src/RE/I/InventoryChanges.cpp b/src/RE/I/InventoryChanges.cpp index c12788564..b9c2c2588 100644 --- a/src/RE/I/InventoryChanges.cpp +++ b/src/RE/I/InventoryChanges.cpp @@ -14,7 +14,6 @@ namespace RE InventoryChanges::~InventoryChanges() { Dtor(); - stl::memzero(this); } void InventoryChanges::AddEntryData(InventoryEntryData* a_entry) diff --git a/src/RE/M/MagicItemDataCollector.cpp b/src/RE/M/MagicItemDataCollector.cpp index 0c162159a..f0e6a1d28 100644 --- a/src/RE/M/MagicItemDataCollector.cpp +++ b/src/RE/M/MagicItemDataCollector.cpp @@ -17,7 +17,7 @@ namespace RE pad4A(0), pad4C(0) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } BSContainer::ForEachResult MagicItemDataCollector::operator()(Effect* a_effect) diff --git a/src/RE/M/MemoryPage.cpp b/src/RE/M/MemoryPage.cpp index 8900c3836..97ab32371 100644 --- a/src/RE/M/MemoryPage.cpp +++ b/src/RE/M/MemoryPage.cpp @@ -11,7 +11,7 @@ namespace RE void* MemoryPage::GetTail() { - return stl::adjust_pointer(GetHead(), pageSize); + return REX::ADJUST_POINTER(GetHead(), pageSize); } bool MemoryPage::IsInRange(const void* a_ptr) diff --git a/src/RE/N/NiRefObject.cpp b/src/RE/N/NiRefObject.cpp index 165a900c9..21a7b87cd 100644 --- a/src/RE/N/NiRefObject.cpp +++ b/src/RE/N/NiRefObject.cpp @@ -4,13 +4,13 @@ namespace RE { NiRefObject::NiRefObject() { - stl::atomic_ref objectCount{ *GetTotalObjectCount() }; + REX::TAtomicRef objectCount{ *GetTotalObjectCount() }; ++objectCount; } NiRefObject::~NiRefObject() { - stl::atomic_ref objectCount{ *GetTotalObjectCount() }; + REX::TAtomicRef objectCount{ *GetTotalObjectCount() }; --objectCount; } @@ -21,13 +21,13 @@ namespace RE void NiRefObject::IncRefCount() { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; ++myRefCount; } void NiRefObject::DecRefCount() { - stl::atomic_ref myRefCount{ _refCount }; + REX::TAtomicRef myRefCount{ _refCount }; if (--myRefCount == 0) { DeleteThis(); } diff --git a/src/RE/O/Object.cpp b/src/RE/O/Object.cpp index 0e8ede7ee..16543768c 100644 --- a/src/RE/O/Object.cpp +++ b/src/RE/O/Object.cpp @@ -11,7 +11,6 @@ namespace RE Object::~Object() { Dtor(); - stl::memzero(this); } VMHandle Object::GetHandle() const diff --git a/src/RE/O/ObjectTypeInfo.cpp b/src/RE/O/ObjectTypeInfo.cpp index b44268905..9868813bd 100644 --- a/src/RE/O/ObjectTypeInfo.cpp +++ b/src/RE/O/ObjectTypeInfo.cpp @@ -44,7 +44,7 @@ namespace RE TypeInfo::RawType ObjectTypeInfo::GetRawType() const { - return stl::unrestricted_cast(this); + return REX::UNRESTRICTED_CAST(this); } auto ObjectTypeInfo::GetUnlinkedFunctionIter() diff --git a/src/RE/P/PackUnpack.cpp b/src/RE/P/PackUnpack.cpp index b66213b98..1d91e4ce4 100644 --- a/src/RE/P/PackUnpack.cpp +++ b/src/RE/P/PackUnpack.cpp @@ -19,7 +19,7 @@ namespace RE if (vm && vm->GetScriptObjectType(a_typeID, classPtr) && classPtr) { return classPtr->GetRawType(); } else { - SKSE::log::error("Failed to get vm type id for class {}!", a_typeID); + REX::ERROR("Failed to get vm type id for class {}!", a_typeID); return TypeInfo::RawType::kNone; } } diff --git a/src/RE/P/Projectile.cpp b/src/RE/P/Projectile.cpp index 9fbb24ed4..ff0926fb5 100644 --- a/src/RE/P/Projectile.cpp +++ b/src/RE/P/Projectile.cpp @@ -43,7 +43,7 @@ namespace RE deferInitialization(false), forceConeOfFire(false) { - stl::emplace_vtable(this); + REX::EMPLACE_VTABLE(this); } Projectile::LaunchData::LaunchData(Actor* a_shooter, const NiPoint3& a_origin, const ProjectileRot& a_angles, MagicItem* a_spell) : diff --git a/src/RE/S/Stack.cpp b/src/RE/S/Stack.cpp index 8eab477dc..8788727a9 100644 --- a/src/RE/S/Stack.cpp +++ b/src/RE/S/Stack.cpp @@ -10,7 +10,6 @@ namespace RE Stack::~Stack() { Dtor(); - stl::memzero(this); } std::uint32_t Stack::GetPageForFrame(const StackFrame* a_frame) const diff --git a/src/RE/S/StreamBase.cpp b/src/RE/S/StreamBase.cpp index 94c5901e3..e70e90088 100644 --- a/src/RE/S/StreamBase.cpp +++ b/src/RE/S/StreamBase.cpp @@ -36,7 +36,7 @@ namespace RE std::uint32_t StreamBase::DecRef() { - stl::atomic_ref myFlags{ flags }; + REX::TAtomicRef myFlags{ flags }; std::uint32_t expected; do { expected = myFlags; @@ -46,7 +46,7 @@ namespace RE std::uint32_t StreamBase::IncRef() { - stl::atomic_ref myFlags{ flags }; + REX::TAtomicRef myFlags{ flags }; std::uint32_t expected; do { expected = myFlags; diff --git a/src/RE/T/TESFaction.cpp b/src/RE/T/TESFaction.cpp index 29a7de391..98b70377c 100644 --- a/src/RE/T/TESFaction.cpp +++ b/src/RE/T/TESFaction.cpp @@ -227,7 +227,7 @@ namespace RE processLists->ClearCachedFactionFightReactions(); } } else { - SKSE::log::debug("Cannot be an ally of a NONE faction"); + REX::DEBUG("Cannot be an ally of a NONE faction"); } } @@ -257,7 +257,7 @@ namespace RE processLists->ClearCachedFactionFightReactions(); } } else { - SKSE::log::debug("Cannot be an ally of a NONE faction"); + REX::DEBUG("Cannot be an ally of a NONE faction"); } } diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index 997cd4754..3c5d3cdec 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -523,7 +523,7 @@ namespace RE return func(this); } - NiControllerSequence* TESObjectREFR::GetSequence(stl::zstring a_name) const + NiControllerSequence* TESObjectREFR::GetSequence(std::string_view a_name) const { auto node = Get3D(); if (!node) { @@ -811,13 +811,13 @@ namespace RE assert(a_target); auto node = a_target->Get3D(); if (!node) { - SKSE::log::debug("Cannot move the target because it does not have 3D"); + REX::DEBUG("Cannot move the target because it does not have 3D"); return false; } auto object = node->GetObjectByName(a_nodeName); if (!object) { - SKSE::log::debug("Target does not have a node named {}", a_nodeName.c_str()); + REX::DEBUG("Target does not have a node named {}", a_nodeName.c_str()); return false; } @@ -854,7 +854,7 @@ namespace RE return handle.get(); } - void TESObjectREFR::PlayAnimation(stl::zstring a_from, stl::zstring a_to) + void TESObjectREFR::PlayAnimation(std::string_view a_from, std::string_view a_to) { auto node = Get3D(); if (!node) { @@ -938,7 +938,7 @@ namespace RE { auto node = Get3D(); if (!node) { - SKSE::log::debug("Target does not have 3D"); + REX::DEBUG("Target does not have 3D"); return false; } diff --git a/src/RE/T/TESQuest.cpp b/src/RE/T/TESQuest.cpp index 24bc46967..9f955a186 100644 --- a/src/RE/T/TESQuest.cpp +++ b/src/RE/T/TESQuest.cpp @@ -101,7 +101,7 @@ namespace RE bool TESQuest::Start() { if (eventID != QuestEvent::kNone) { - SKSE::log::debug("Attempting to start event scoped quest outside of story manager"); + REX::DEBUG("Attempting to start event scoped quest outside of story manager"); return false; } diff --git a/src/RE/U/UnlinkedTypes.cpp b/src/RE/U/UnlinkedTypes.cpp index 36f72ce86..6080ba357 100644 --- a/src/RE/U/UnlinkedTypes.cpp +++ b/src/RE/U/UnlinkedTypes.cpp @@ -11,7 +11,6 @@ namespace RE Object::~Object() { Dtor(); - stl::memzero(this); } void Object::Dtor() diff --git a/src/RE/V/Variable.cpp b/src/RE/V/Variable.cpp index fb6922499..5a566a496 100644 --- a/src/RE/V/Variable.cpp +++ b/src/RE/V/Variable.cpp @@ -43,7 +43,6 @@ namespace RE Variable::~Variable() { Cleanup(); - stl::memzero(this); } Variable& Variable::operator=(const Variable& a_rhs) diff --git a/src/REL/ID.cpp b/src/REL/ID.cpp deleted file mode 100644 index e6c0f63bf..000000000 --- a/src/REL/ID.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "REL/ID.h" - -#include "REX/W32/KERNEL32.h" - -namespace REL -{ - namespace detail - { - bool memory_map::open(stl::zwstring a_name, std::size_t a_size) - { - close(); - - REX::W32::ULARGE_INTEGER bytes; - bytes.value = a_size; - - _mapping = REX::W32::OpenFileMappingW( - REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, - false, - a_name.data()); - if (!_mapping) { - close(); - return false; - } - - _view = REX::W32::MapViewOfFile( - _mapping, - REX::W32::FILE_MAP_READ | REX::W32::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(); - - REX::W32::ULARGE_INTEGER bytes; - bytes.value = a_size; - - _mapping = REX::W32::OpenFileMappingW( - REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, - false, - a_name.data()); - if (!_mapping) { - _mapping = REX::W32::CreateFileMappingW( - REX::W32::INVALID_HANDLE_VALUE, - nullptr, - REX::W32::PAGE_READWRITE, - bytes.hi, - bytes.lo, - a_name.data()); - if (!_mapping) { - return false; - } - } - - _view = REX::W32::MapViewOfFile( - _mapping, - REX::W32::FILE_MAP_READ | REX::W32::FILE_MAP_WRITE, - 0, - 0, - bytes.value); - if (!_view) { - return false; - } - - return true; - } - - void memory_map::close() - { - if (_view) { - REX::W32::UnmapViewOfFile(static_cast(_view)); - _view = nullptr; - } - - if (_mapping) { - REX::W32::CloseHandle(_mapping); - _mapping = nullptr; - } - } - } -} diff --git a/src/REL/Module.cpp b/src/REL/Module.cpp deleted file mode 100644 index 846df2bf3..000000000 --- a/src/REL/Module.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#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 = REX::W32::IMAGE_FIRST_SECTION(ntHeader); - const auto size = std::min(ntHeader->fileHeader.sectionCount, _segments.size()); - for (std::size_t i = 0; i < size; ++i) { - const auto& section = sections[i]; - const auto it = std::find_if(SEGMENTS.begin(), SEGMENTS.end(), [&](auto&& a_elem) { - constexpr auto size = std::extent_v; - const auto len = std::min(a_elem.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 7a0d491eb..000000000 --- a/src/REL/Relocation.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#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); - } -} diff --git a/src/REL/Version.cpp b/src/REL/Version.cpp deleted file mode 100644 index c204adc02..000000000 --- a/src/REL/Version.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#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; - } -} diff --git a/src/REX/REX.cpp b/src/REX/REX.cpp deleted file mode 100644 index f7103830a..000000000 --- a/src/REX/REX.cpp +++ /dev/null @@ -1,375 +0,0 @@ -#include "REX/REX/INI.h" -#include "REX/REX/JSON.h" -#include "REX/REX/TOML.h" - -#include "SKSE/Logger.h" - -#ifdef REX_OPTION_INI -# include - -namespace REX::INI -{ - namespace Impl - { - template - constexpr bool is_long_integral_v = std::_Is_any_of_v, std::uint8_t, std::uint16_t, std::uint32_t, std::int8_t, std::int16_t, std::int32_t>; - - template - void SettingLoad( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value, - T& a_valueDefault) - { - const auto file = static_cast(a_data); - if constexpr (std::is_same_v) { - a_value = file->GetBoolValue(a_section.data(), a_key.data(), a_valueDefault); - } else if constexpr (std::is_floating_point_v) { - a_value = static_cast(file->GetDoubleValue(a_section.data(), a_key.data(), a_valueDefault)); - } else if constexpr (is_long_integral_v) { - a_value = static_cast(file->GetLongValue(a_section.data(), a_key.data(), a_valueDefault)); - } else if constexpr (std::is_same_v) { - a_value = file->GetValue(a_section.data(), a_key.data(), a_valueDefault.c_str()); - } - } - - template void SettingLoad(void*, sec_t, key_t, bool&, bool&); - template void SettingLoad(void*, sec_t, key_t, float&, float&); - template void SettingLoad(void*, sec_t, key_t, double&, double&); - template void SettingLoad(void*, sec_t, key_t, std::uint8_t&, std::uint8_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint16_t&, std::uint16_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint32_t&, std::uint32_t&); - template void SettingLoad(void*, sec_t, key_t, std::int8_t&, std::int8_t&); - template void SettingLoad(void*, sec_t, key_t, std::int16_t&, std::int16_t&); - template void SettingLoad(void*, sec_t, key_t, std::int32_t&, std::int32_t&); - template void SettingLoad(void*, sec_t, key_t, std::string&, std::string&); - - template - void SettingSave( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value) - { - auto& file = *static_cast(a_data); - if constexpr (std::is_same_v) { - file.SetBoolValue(a_section.data(), a_key.data(), a_value); - } else if constexpr (std::is_floating_point_v) { - file.SetDoubleValue(a_section.data(), a_key.data(), a_value); - } else if constexpr (is_long_integral_v) { - file.SetLongValue(a_section.data(), a_key.data(), a_value); - } else if constexpr (std::is_same_v) { - file.SetValue(a_section.data(), a_key.data(), a_value.c_str()); - } - } - - template void SettingSave(void*, sec_t, key_t, bool&); - template void SettingSave(void*, sec_t, key_t, float&); - template void SettingSave(void*, sec_t, key_t, double&); - template void SettingSave(void*, sec_t, key_t, std::uint8_t&); - template void SettingSave(void*, sec_t, key_t, std::uint16_t&); - template void SettingSave(void*, sec_t, key_t, std::uint32_t&); - template void SettingSave(void*, sec_t, key_t, std::int8_t&); - template void SettingSave(void*, sec_t, key_t, std::int16_t&); - template void SettingSave(void*, sec_t, key_t, std::int32_t&); - template void SettingSave(void*, sec_t, key_t, std::string&); - } - - void SettingStore::Load() - { - CSimpleIniA file; - file.SetUnicode(true); - file.SetQuotes(true); - - if (std::filesystem::exists(m_fileBase)) { - file.LoadFile(m_fileBase.data()); - for (auto& setting : m_settings) { - setting->Load(&file, true); - } - } - - if (std::filesystem::exists(m_fileUser)) { - file.LoadFile(m_fileUser.data()); - for (auto& setting : m_settings) { - setting->Load(&file, false); - } - } - } - - void SettingStore::Save() - { - CSimpleIniA file; - file.SetUnicode(true); - file.SetQuotes(true); - - file.LoadFile(m_fileBase.data()); - for (auto& setting : m_settings) { - setting->Save(&file); - } - - file.SaveFile(m_fileBase.data()); - } -} -#endif - -#ifdef REX_OPTION_JSON -# include - -namespace REX::JSON -{ - namespace Impl - { - template - void SettingLoad( - void* a_data, - path_t a_path, - T& a_value, - T& a_valueDefault) - { - const auto& json = *static_cast(a_data); - if (a_path[0] == '/') { - a_value = json.value(nlohmann::json::json_pointer(a_path.data()), a_valueDefault); - } else { - a_value = json.value(a_path, a_valueDefault); - } - } - - template void SettingLoad(void*, path_t, bool&, bool&); - template void SettingLoad(void*, path_t, float&, float&); - template void SettingLoad(void*, path_t, double&, double&); - template void SettingLoad(void*, path_t, std::uint8_t&, std::uint8_t&); - template void SettingLoad(void*, path_t, std::uint16_t&, std::uint16_t&); - template void SettingLoad(void*, path_t, std::uint32_t&, std::uint32_t&); - template void SettingLoad(void*, path_t, std::int8_t&, std::int8_t&); - template void SettingLoad(void*, path_t, std::int16_t&, std::int16_t&); - template void SettingLoad(void*, path_t, std::int32_t&, std::int32_t&); - template void SettingLoad(void*, path_t, std::string&, std::string&); - - template - void SettingSave( - void* a_data, - path_t a_path, - T& a_value) - { - auto& json = *static_cast(a_data); - if (a_path[0] == '/') { - json[nlohmann::json::json_pointer(a_path.data())] = a_value; - } else { - json[a_path] = a_value; - } - } - - template void SettingSave(void*, path_t, bool&); - template void SettingSave(void*, path_t, float&); - template void SettingSave(void*, path_t, double&); - template void SettingSave(void*, path_t, std::uint8_t&); - template void SettingSave(void*, path_t, std::uint16_t&); - template void SettingSave(void*, path_t, std::uint32_t&); - template void SettingSave(void*, path_t, std::int8_t&); - template void SettingSave(void*, path_t, std::int16_t&); - template void SettingSave(void*, path_t, std::int32_t&); - template void SettingSave(void*, path_t, std::string&); - } - - void SettingStore::Load() - { - if (std::filesystem::exists(m_fileBase)) { - std::ifstream file{ m_fileBase.data() }; - try { - auto result = nlohmann::json::parse(file); - for (auto setting : m_settings) { - setting->Load(&result, true); - } - } catch (const std::exception& e) { - SKSE::log::error("{}", e.what()); - } - } - - if (std::filesystem::exists(m_fileUser)) { - std::ifstream file{ m_fileUser.data() }; - try { - auto result = nlohmann::json::parse(file); - for (auto setting : m_settings) { - setting->Load(&result, false); - } - } catch (const std::exception& e) { - SKSE::log::error("{}", e.what()); - } - } - } - - void SettingStore::Save() - { - nlohmann::json output{}; - if (std::filesystem::exists(m_fileBase)) { - std::ifstream file{ m_fileBase.data() }; - output = nlohmann::json::parse(file); - } - - for (auto& setting : m_settings) { - setting->Save(&output); - } - - std::ofstream file{ m_fileBase.data(), std::ios::trunc }; - file << std::setw(4) << output; - } -} -#endif - -#ifdef REX_OPTION_TOML -# include - -namespace REX::TOML -{ - namespace Impl - { - static toml::value* recurse_table(toml::value* a_result, toml::value& a_value, const std::string& a_section, bool a_create) - { - if (a_result && a_result->is_table()) { - for (auto& value : a_result->as_table()) { - if (value.first == a_section) { - return std::addressof(value.second); - } - } - if (a_create) { - (*a_result)[a_section] = toml::table{}; - return std::addressof((*a_result)[a_section]); - } - } else if (a_value.is_table()) { - for (auto& value : a_value.as_table()) { - if (value.first == a_section) { - return std::addressof(value.second); - } - } - if (a_create) { - a_value[a_section] = toml::table{}; - return std::addressof(a_value[a_section]); - } - } - return a_result; - } - - static bool recurse_mark_implicit(toml::value& a_value) - { - for (auto& kv : a_value.as_table()) { - if (kv.second.is_table()) { - if (!recurse_mark_implicit(kv.second)) { - continue; - } - kv.second.as_table_fmt().fmt = toml::table_format::implicit; - } else { - return false; - } - } - return true; - } - - template - void SettingLoad( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value, - T& a_valueDefault) - { - const auto& data = static_cast(a_data); - if (a_section.empty()) { - auto& path = (*data); - a_value = toml::find_or(path, a_key.data(), a_valueDefault); - return; - } else if (a_section.size() == 1) { - auto& path = (*data)[a_section.front()]; - a_value = toml::find_or(path, a_key.data(), a_valueDefault); - return; - } else { - toml::value* path{ nullptr }; - for (auto& section : a_section) { - path = recurse_table(path, *data, section, false); - } - if (path) { - a_value = toml::find_or(*path, a_key.data(), a_valueDefault); - return; - } - } - a_value = a_valueDefault; - } - - template void SettingLoad(void*, sec_t, key_t, bool&, bool&); - template void SettingLoad(void*, sec_t, key_t, float&, float&); - template void SettingLoad(void*, sec_t, key_t, double&, double&); - template void SettingLoad(void*, sec_t, key_t, std::uint8_t&, std::uint8_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint16_t&, std::uint16_t&); - template void SettingLoad(void*, sec_t, key_t, std::uint32_t&, std::uint32_t&); - template void SettingLoad(void*, sec_t, key_t, std::int8_t&, std::int8_t&); - template void SettingLoad(void*, sec_t, key_t, std::int16_t&, std::int16_t&); - template void SettingLoad(void*, sec_t, key_t, std::int32_t&, std::int32_t&); - template void SettingLoad(void*, sec_t, key_t, std::string&, std::string&); - - template - void SettingSave( - void* a_data, - sec_t a_section, - key_t a_key, - T& a_value) - { - auto& data = *static_cast(a_data); - if (a_section.empty()) { - data[a_key.data()] = a_value; - } else if (a_section.size() == 1) { - data[a_section.front()][a_key.data()] = a_value; - } else { - toml::value* path{ nullptr }; - for (auto& section : a_section) { - path = recurse_table(path, data, section, true); - } - if (path) { - (*path)[a_key.data()] = a_value; - } - } - } - - template void SettingSave(void*, sec_t, key_t, bool&); - template void SettingSave(void*, sec_t, key_t, float&); - template void SettingSave(void*, sec_t, key_t, double&); - template void SettingSave(void*, sec_t, key_t, std::uint8_t&); - template void SettingSave(void*, sec_t, key_t, std::uint16_t&); - template void SettingSave(void*, sec_t, key_t, std::uint32_t&); - template void SettingSave(void*, sec_t, key_t, std::int8_t&); - template void SettingSave(void*, sec_t, key_t, std::int16_t&); - template void SettingSave(void*, sec_t, key_t, std::int32_t&); - template void SettingSave(void*, sec_t, key_t, std::string&); - } - - void SettingStore::Load() - { - if (auto result = toml::try_parse(m_fileBase.data()); result.is_ok()) { - for (auto& setting : m_settings) { - setting->Load(&result.unwrap(), true); - } - } - - if (auto result = toml::try_parse(m_fileUser.data()); result.is_ok()) { - for (auto& setting : m_settings) { - setting->Load(&result.unwrap(), false); - } - } - } - - void SettingStore::Save() - { - toml::value output{}; - if (auto result = toml::try_parse(m_fileBase.data()); result.is_ok()) { - output = result.unwrap(); - } - - for (auto setting : m_settings) { - setting->Save(&output); - } - - Impl::recurse_mark_implicit(output); - std::ofstream file{ m_fileBase.data(), std::ios::trunc }; - file << toml::format(output); - } -} -#endif diff --git a/src/REX/W32.cpp b/src/REX/W32.cpp deleted file mode 100644 index 9a584bfff..000000000 --- a/src/REX/W32.cpp +++ /dev/null @@ -1,959 +0,0 @@ -#include "REX/W32/ADVAPI32.h" -#include "REX/W32/BCRYPT.h" -#include "REX/W32/D3D11.h" -#include "REX/W32/D3DCOMPILER.h" -#include "REX/W32/DBGHELP.h" -#include "REX/W32/DXGI.h" -#include "REX/W32/KERNEL32.h" -#include "REX/W32/NT.h" -#include "REX/W32/OLE32.h" -#include "REX/W32/SHELL32.h" -#include "REX/W32/USER32.h" -#include "REX/W32/VERSION.h" - -// ADVAPI32 - -REX_W32_IMPORT(std::int32_t, RegGetValueA, REX::W32::HKEY, const char*, const char*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); -REX_W32_IMPORT(std::int32_t, RegGetValueW, REX::W32::HKEY, const wchar_t*, const wchar_t*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); - -namespace REX::W32 -{ - std::int32_t RegGetValueA(HKEY a_key, const char* a_subKey, const char* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) - { - return ::W32_IMPL_RegGetValueA(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); - } - - std::int32_t RegGetValueW(HKEY a_key, const wchar_t* a_subKey, const wchar_t* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) - { - return ::W32_IMPL_RegGetValueW(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); - } -} - -// BCRYPT - -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptOpenAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE*, const wchar_t*, const wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCloseAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCreateHash, REX::W32::BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE*, std::uint8_t*, std::uint32_t, std::uint8_t*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptDestroyHash, REX::W32::BCRYPT_HASH_HANDLE); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptFinishHash, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptGetProperty, REX::W32::BCRYPT_HANDLE, const wchar_t*, std::uint8_t*, std::uint32_t, std::uint32_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptHashData, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); - -namespace REX::W32 -{ - NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptOpenAlgorithmProvider(a_algorithm, a_id, a_impl, a_flags); - } - - NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptCloseAlgorithmProvider(a_algorithm, a_flags); - } - - NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject, std::uint32_t a_hashObjectSize, std::uint8_t* a_secret, std::uint32_t a_secretSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptCreateHash(a_algorithm, a_hash, a_hashObject, a_hashObjectSize, a_secret, a_secretSize, a_flags); - } - - NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash) - { - return ::W32_IMPL_BCryptDestroyHash(a_hash); - } - - NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptFinishHash(a_hash, a_output, a_outputSize, a_flags); - } - - NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptGetProperty(a_object, a_property, a_output, a_outputSize, a_result, a_flags); - } - - NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptHashData(a_hash, a_input, a_inputSize, a_flags); - } -} - -// D3D11 - -REX_W32_IMPORT(std::int32_t, D3D11CreateDevice, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); -REX_W32_IMPORT(std::int32_t, D3D11CreateDeviceAndSwapChain, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, const REX::W32::DXGI_SWAP_CHAIN_DESC*, REX::W32::IDXGISwapChain**, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); - -namespace REX::W32 -{ - HRESULT D3D11CreateDevice(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept - { - return ::W32_IMPL_D3D11CreateDevice(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_device, a_pFeatureLevel, a_immediateContext); - } - - HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const DXGI_SWAP_CHAIN_DESC* a_swapChainDesc, IDXGISwapChain** a_swapChain, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept - { - return ::W32_IMPL_D3D11CreateDeviceAndSwapChain(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_swapChainDesc, a_swapChain, a_device, a_pFeatureLevel, a_immediateContext); - } -} - -// D3DCOMPILER - -REX_W32_IMPORT(std::int32_t, D3DCompile, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompile2, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompileFromFile, const wchar_t*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompressShaders, std::uint32_t, REX::W32::D3D_SHADER_DATA*, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCreateBlob, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCreateFunctionLinkingGraph, std::uint32_t, REX::W32::ID3D11FunctionLinkingGraph**); -REX_W32_IMPORT(std::int32_t, D3DCreateLinker, REX::W32::ID3D11Linker**); -REX_W32_IMPORT(std::int32_t, D3DDecompressShaders, const void*, std::size_t, std::uint32_t, std::uint32_t, std::uint32_t*, std::uint32_t, REX::W32::ID3DBlob**, std::uint32_t*); -REX_W32_IMPORT(std::int32_t, D3DDisassemble, const void*, std::size_t, std::uint32_t, const char*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DDisassemble10Effect, REX::W32::ID3D10Effect*, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DDisassembleRegion, const void*, std::size_t, std::uint32_t, const char*, std::size_t, std::size_t, std::size_t*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t a_flags, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetDebugInfo, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetInputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetInputAndOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetTraceInstructionOffsets, const void*, std::size_t, std::uint32_t, std::size_t, std::size_t, std::size_t*, std::size_t*); -REX_W32_IMPORT(std::int32_t, D3DLoadModule, const void*, std::size_t, REX::W32::ID3D11Module**); -REX_W32_IMPORT(std::int32_t, D3DPreprocess, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DReadFileToBlob, const wchar_t*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DReflect, const void*, std::size_t, const REX::W32::IID&, void**); -REX_W32_IMPORT(std::int32_t, D3DReflectLibrary, const void*, std::size_t, const REX::W32::IID&, void**); -REX_W32_IMPORT(std::int32_t, D3DSetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DStripShader, const void*, std::size_t, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DWriteBlobToFile, REX::W32::ID3DBlob*, const wchar_t*, REX::W32::BOOL); - -namespace REX::W32 -{ - HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompile(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); - } - - HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompile2(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_secondaryDataFlags, a_secondaryData, a_secondaryDataSize, a_code, a_errorMsgs); - } - - HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompileFromFile(a_fileName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); - } - - HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData) - { - return ::W32_IMPL_D3DCompressShaders(a_numShaders, a_shaderData, a_flags, a_compressedData); - } - - HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob) - { - return ::W32_IMPL_D3DCreateBlob(a_size, a_blob); - } - - HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph) - { - return ::W32_IMPL_D3DCreateFunctionLinkingGraph(a_flags, a_functionLinkingGraph); - } - - HRESULT D3DCreateLinker(ID3D11Linker** a_linker) - { - return ::W32_IMPL_D3DCreateLinker(a_linker); - } - - HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders) - { - return ::W32_IMPL_D3DDecompressShaders(a_srcData, a_srcDataSize, a_numShaders, a_startIndex, a_indices, a_flags, a_shaders, a_totalShaders); - } - - HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassemble(a_srcData, a_srcDataSize, a_flags, a_comments, a_disassembly); - } - - HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassemble10Effect(a_effect, a_flags, a_disassembly); - } - - HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassembleRegion(a_srcData, a_srcDataSize, a_flags, a_comments, a_startByteOffset, a_numInsts, a_finishByteOffset, a_disassembly); - } - - HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part) - { - return ::W32_IMPL_D3DGetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part); - } - - HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo) - { - return ::W32_IMPL_D3DGetDebugInfo(a_srcData, a_srcDataSize, a_debugInfo); - } - - HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetInputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetInputAndOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts) - { - return ::W32_IMPL_D3DGetTraceInstructionOffsets(a_srcData, a_srcDataSize, a_flags, a_startInstIndex, a_numInsts, a_offsets, a_totalInsts); - } - - HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module) - { - return ::W32_IMPL_D3DLoadModule(a_srcData, a_srcDataSize, a_module); - } - - HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DPreprocess(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_codeText, a_errorMsgs); - } - - HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents) - { - return ::W32_IMPL_D3DReadFileToBlob(a_fileName, a_contents); - } - - HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) - { - return ::W32_IMPL_D3DReflect(a_srcData, a_srcDataSize, a_iid, a_reflector); - } - - HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) - { - return ::W32_IMPL_D3DReflectLibrary(a_srcData, a_srcDataSize, a_iid, a_reflector); - } - - HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader) - { - return ::W32_IMPL_D3DSetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part, a_partSize, a_newShader); - } - - HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob) - { - return ::W32_IMPL_D3DStripShader(a_srcData, a_srcDataSize, a_stripFlags, a_strippedBlob); - } - - HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite) - { - return ::W32_IMPL_D3DWriteBlobToFile(a_blob, a_fileName, static_cast(a_overwrite)); - } -} - -// DBGHELP - -REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolName, const char*, char*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolNameW, const wchar_t*, wchar_t*, std::uint32_t, std::uint32_t); - -namespace REX::W32 -{ - std::uint32_t UnDecorateSymbolName(const char* a_name, char* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept - { - return ::W32_IMPL_UnDecorateSymbolName(a_name, a_buf, a_bufLen, a_flags); - } - - std::uint32_t UnDecorateSymbolNameW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept - { - return ::W32_IMPL_UnDecorateSymbolNameW(a_name, a_buf, a_bufLen, a_flags); - } -} - -// DXGI - -REX_W32_IMPORT(std::int32_t, CreateDXGIFactory, const IID&, void**); -REX_W32_IMPORT(std::int32_t, CreateDXGIFactory1, const IID&, void**); - -namespace REX::W32 -{ - HRESULT CreateDXGIFactory(const IID& a_iid, void** a_factory) noexcept - { - return ::W32_IMPL_CreateDXGIFactory(a_iid, a_factory); - } - - HRESULT CreateDXGIFactory1(const IID& a_iid, void** a_factory) noexcept - { - return ::W32_IMPL_CreateDXGIFactory1(a_iid, a_factory); - } -} - -// KERNEL32 - -REX_W32_IMPORT(REX::W32::BOOL, CloseHandle, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileA, const char*, std::uint32_t, std::uint32_t, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileW, const wchar_t*, std::uint32_t, std::uint32_t, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingA, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingW, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const wchar_t*); -REX_W32_IMPORT(REX::W32::BOOL, CreateProcessA, const char*, char*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const char*, REX::W32::STARTUPINFOA*, REX::W32::PROCESS_INFORMATION*); -REX_W32_IMPORT(REX::W32::BOOL, CreateProcessW, const wchar_t*, wchar_t*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const wchar_t*, REX::W32::STARTUPINFOW*, REX::W32::PROCESS_INFORMATION*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateRemoteThread, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateSemaphoreA, REX::W32::SECURITY_ATTRIBUTES*, std::int32_t, std::int32_t, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateThread, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(void, DeleteCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(void, EnterCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsA, const char*, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsW, const wchar_t*, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, FindClose, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileA, const char*, REX::W32::WIN32_FIND_DATAA*); -REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileW, const wchar_t*, REX::W32::WIN32_FIND_DATAW*); -REX_W32_IMPORT(REX::W32::BOOL, FindNextFileA, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAA*); -REX_W32_IMPORT(REX::W32::BOOL, FindNextFileW, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAW*); -REX_W32_IMPORT(REX::W32::BOOL, FlushInstructionCache, REX::W32::HANDLE, const void*, std::size_t); -REX_W32_IMPORT(REX::W32::BOOL, FreeLibrary, REX::W32::HMODULE); -REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameA, char*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameW, wchar_t*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetCurrentDirectoryA, std::uint32_t, char*); -REX_W32_IMPORT(std::uint32_t, GetCurrentDirectoryW, std::uint32_t, wchar_t*); -REX_W32_IMPORT(REX::W32::HANDLE, GetCurrentProcess); -REX_W32_IMPORT(std::uint32_t, GetCurrentThreadId); -REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableA, const char*, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableW, const wchar_t*, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, GetFileSizeEx, REX::W32::HANDLE, REX::W32::LARGE_INTEGER*); -REX_W32_IMPORT(std::uint32_t, GetLastError); -REX_W32_IMPORT(std::uint32_t, GetModuleFileNameA, REX::W32::HMODULE, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetModuleFileNameW, REX::W32::HMODULE, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleA, const char*); -REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleW, const wchar_t*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileIntA, const char*, const char*, std::int32_t, const char*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileIntW, const wchar_t*, const wchar_t*, std::int32_t, const wchar_t*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringA, const char*, const char*, const char*, char*, std::uint32_t, const char*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringW, const wchar_t*, const wchar_t*, const wchar_t*, wchar_t*, std::uint32_t, const wchar_t*); -REX_W32_IMPORT(void*, GetProcAddress, REX::W32::HMODULE, const char*); -REX_W32_IMPORT(void, GetSystemInfo, REX::W32::SYSTEM_INFO*); -REX_W32_IMPORT(REX::W32::BOOL, InitializeCriticalSectionAndSpinCount, REX::W32::CRITICAL_SECTION*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, IsDebuggerPresent); -REX_W32_IMPORT(std::int32_t, LCMapStringEx, const wchar_t*, std::uint32_t, const wchar_t*, std::int32_t, wchar_t*, std::int32_t, REX::W32::NLSVERSIONINFO*, void*, std::intptr_t); -REX_W32_IMPORT(void, LeaveCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryA, const char*); -REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryW, const wchar_t*); -REX_W32_IMPORT(void*, MapViewOfFile, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t); -REX_W32_IMPORT(void*, MapViewOfFileEx, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t, void*); -REX_W32_IMPORT(std::int32_t, MultiByteToWideChar, std::uint32_t, std::uint32_t, const char*, std::int32_t, wchar_t*, std::int32_t); -REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingA, std::uint32_t, REX::W32::BOOL, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingW, std::uint32_t, REX::W32::BOOL, const wchar_t*); -REX_W32_IMPORT(void, OutputDebugStringA, const char*); -REX_W32_IMPORT(void, OutputDebugStringW, const wchar_t*); -REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceCounter, std::int64_t*); -REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceFrequency, std::int64_t*); -REX_W32_IMPORT(std::uint32_t, ResumeThread, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableA, const char*, const char*); -REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableW, const wchar_t*, const wchar_t*); -REX_W32_IMPORT(void, Sleep, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, TerminateProcess, REX::W32::HANDLE, std::uint32_t); -REX_W32_IMPORT(void*, TlsGetValue, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, TlsSetValue, std::uint32_t, void*); -REX_W32_IMPORT(REX::W32::BOOL, UnmapViewOfFile, const void*); -REX_W32_IMPORT(void*, VirtualAlloc, void*, std::size_t, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(void*, VirtualAllocEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualFree, void*, std::size_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualFreeEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualProtect, void*, std::size_t, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VirtualProtectEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(std::size_t, VirtualQuery, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); -REX_W32_IMPORT(std::size_t, VirtualQueryEx, REX::W32::HANDLE, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); -REX_W32_IMPORT(std::uint32_t, WaitForSingleObject, REX::W32::HANDLE, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, WaitForSingleObjectEx, REX::W32::HANDLE, std::uint32_t, REX::W32::BOOL); -REX_W32_IMPORT(std::int32_t, WideCharToMultiByte, std::uint32_t, std::uint32_t, const wchar_t*, std::int32_t, char*, std::int32_t, const char*, std::int32_t*); -REX_W32_IMPORT(REX::W32::BOOL, WriteProcessMemory, REX::W32::HANDLE, void*, const void*, std::size_t, std::size_t*); - -extern "C" REX::W32::IMAGE_DOS_HEADER __ImageBase; - -namespace REX::W32 -{ - bool CloseHandle(HANDLE a_handle) noexcept - { - return ::W32_IMPL_CloseHandle(a_handle); - } - - HANDLE CreateFileA(const char* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile) - { - return ::W32_IMPL_CreateFileA(a_fileName, a_desiredAccess, a_shareMode, a_attributes, a_creationDisposition, a_flags, a_templateFile); - } - - HANDLE CreateFileW(const wchar_t* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile) - { - return ::W32_IMPL_CreateFileW(a_fileName, a_desiredAccess, a_shareMode, a_attributes, a_creationDisposition, a_flags, a_templateFile); - } - - HANDLE CreateFileMappingA(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const char* a_name) noexcept - { - return ::W32_IMPL_CreateFileMappingA(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); - } - - HANDLE CreateFileMappingW(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_CreateFileMappingW(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); - } - - bool CreateProcessA(const char* a_name, char* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const char* a_curDir, STARTUPINFOA* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept - { - return ::W32_IMPL_CreateProcessA(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); - } - - bool CreateProcessW(const wchar_t* a_name, wchar_t* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const wchar_t* a_curDir, STARTUPINFOW* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept - { - return ::W32_IMPL_CreateProcessW(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); - } - - HANDLE CreateRemoteThread(HANDLE a_process, SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept - { - return ::W32_IMPL_CreateRemoteThread(a_process, a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); - } - - HANDLE CreateSemaphoreA(SECURITY_ATTRIBUTES* a_semaphoreAttr, std::int32_t a_initCount, std::int32_t a_maxCount, const char* a_name) - { - return ::W32_IMPL_CreateSemaphoreA(a_semaphoreAttr, a_initCount, a_maxCount, a_name); - } - - HANDLE CreateThread(SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept - { - return ::W32_IMPL_CreateThread(a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); - } - - void DeleteCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_DeleteCriticalSection(a_criticalSection); - } - - void EnterCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_EnterCriticalSection(a_criticalSection); - } - - std::uint32_t ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept - { - return ::W32_IMPL_ExpandEnvironmentStringsA(a_src, a_dst, a_dstLen); - } - - std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept - { - return ::W32_IMPL_ExpandEnvironmentStringsW(a_src, a_dst, a_dstLen); - } - - bool FindClose(HANDLE a_file) noexcept - { - return ::W32_IMPL_FindClose(a_file); - } - - HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept - { - return ::W32_IMPL_FindFirstFileA(a_name, a_data); - } - - HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept - { - return ::W32_IMPL_FindFirstFileW(a_name, a_data); - } - - bool FindNextFileA(HANDLE a_file, WIN32_FIND_DATAA* a_data) noexcept - { - return ::W32_IMPL_FindNextFileA(a_file, a_data); - } - - bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept - { - return ::W32_IMPL_FindNextFileW(a_file, a_data); - } - - bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept - { - return ::W32_IMPL_FlushInstructionCache(a_process, a_baseAddr, a_size); - } - - bool FreeLibrary(HMODULE a_module) noexcept - { - return ::W32_IMPL_FreeLibrary(a_module); - } - - bool GetComputerNameA(char* a_buffer, std::uint32_t* a_size) noexcept - { - return ::W32_IMPL_GetComputerNameA(a_buffer, a_size); - } - - bool GetComputerNameW(wchar_t* a_buffer, std::uint32_t* a_size) noexcept - { - return ::W32_IMPL_GetComputerNameW(a_buffer, a_size); - } - - std::uint32_t GetCurrentDirectoryA(std::uint32_t a_size, char* a_buffer) noexcept - { - return ::W32_IMPL_GetCurrentDirectoryA(a_size, a_buffer); - } - - std::uint32_t GetCurrentDirectoryW(std::uint32_t a_size, wchar_t* a_buffer) noexcept - { - return ::W32_IMPL_GetCurrentDirectoryW(a_size, a_buffer); - } - - HMODULE GetCurrentModule() noexcept - { - return reinterpret_cast(std::addressof(__ImageBase)); - } - - HANDLE GetCurrentProcess() noexcept - { - return ::W32_IMPL_GetCurrentProcess(); - } - - std::uint32_t GetCurrentThreadId() noexcept - { - return ::W32_IMPL_GetCurrentThreadId(); - } - - std::uint32_t GetEnvironmentVariableA(const char* a_name, char* a_buf, std::uint32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetEnvironmentVariableA(a_name, a_buf, a_bufLen); - } - - std::uint32_t GetEnvironmentVariableW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetEnvironmentVariableW(a_name, a_buf, a_bufLen); - } - - bool GetFileSizeEx(HANDLE a_file, LARGE_INTEGER* a_fileSize) noexcept - { - return ::W32_IMPL_GetFileSizeEx(a_file, a_fileSize); - } - - std::uint32_t GetLastError() noexcept - { - return ::W32_IMPL_GetLastError(); - } - - std::uint32_t GetModuleFileNameA(HMODULE a_module, char* a_name, std::uint32_t a_nameLen) noexcept - { - return ::W32_IMPL_GetModuleFileNameA(a_module, a_name, a_nameLen); - } - - std::uint32_t GetModuleFileNameW(HMODULE a_module, wchar_t* a_name, std::uint32_t a_nameLen) noexcept - { - return ::W32_IMPL_GetModuleFileNameW(a_module, a_name, a_nameLen); - } - - HMODULE GetModuleHandleA(const char* a_name) noexcept - { - return ::W32_IMPL_GetModuleHandleA(a_name); - } - - HMODULE GetModuleHandleW(const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetModuleHandleW(a_name); - } - - std::uint32_t GetPrivateProfileIntA(const char* a_app, const char* a_key, std::int32_t a_default, const char* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileIntA(a_app, a_key, a_default, a_name); - } - - std::uint32_t GetPrivateProfileIntW(const wchar_t* a_app, const wchar_t* a_key, std::int32_t a_default, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileIntW(a_app, a_key, a_default, a_name); - } - - std::uint32_t GetPrivateProfileStringA(const char* a_app, const char* a_key, const char* a_default, char* a_buf, std::uint32_t a_bufLen, const char* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileStringA(a_app, a_key, a_default, a_buf, a_bufLen, a_name); - } - - std::uint32_t GetPrivateProfileStringW(const wchar_t* a_app, const wchar_t* a_key, const wchar_t* a_default, wchar_t* a_buf, std::uint32_t a_bufLen, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileStringW(a_app, a_key, a_default, a_buf, a_bufLen, a_name); - } - - void* GetProcAddress(HMODULE a_module, const char* a_name) noexcept - { - return ::W32_IMPL_GetProcAddress(a_module, a_name); - } - - void GetSystemInfo(SYSTEM_INFO* a_info) noexcept - { - return ::W32_IMPL_GetSystemInfo(a_info); - } - - bool IMAGE_SNAP_BY_ORDINAL64(std::uint64_t a_ordinal) noexcept - { - return (a_ordinal & IMAGE_ORDINAL_FLAG64) != 0; - } - - IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION(const IMAGE_NT_HEADERS64* a_header) noexcept - { - constexpr auto opt = __builtin_offsetof(IMAGE_NT_HEADERS64, optionalHeader); - const auto optSize = a_header->fileHeader.optionalHeaderSize; - const auto section = reinterpret_cast(a_header) + opt + optSize; - return reinterpret_cast(section); - } - - bool InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount) - { - return ::W32_IMPL_InitializeCriticalSectionAndSpinCount(a_criticalSection, a_spinCount); - } - - std::uint32_t InterlockedCompareExchange(volatile std::uint32_t* a_target, std::uint32_t a_value, std::uint32_t a_compare) noexcept - { - return _InterlockedCompareExchange((volatile long*)a_target, a_value, a_compare); - } - - std::uint64_t InterlockedCompareExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value, std::uint64_t a_compare) noexcept - { - return _InterlockedCompareExchange64((volatile long long*)a_target, a_value, a_compare); - } - - std::uint32_t InterlockedDecrement(volatile std::uint32_t* a_target) noexcept - { - return _InterlockedDecrement((volatile long*)a_target); - } - - std::uint64_t InterlockedDecrement64(volatile std::uint64_t* a_target) noexcept - { - return _InterlockedDecrement64((volatile long long*)a_target); - } - - std::uint32_t InterlockedExchange(volatile std::uint32_t* a_target, std::uint32_t a_value) noexcept - { - return _InterlockedExchange((volatile long*)a_target, a_value); - } - - std::uint64_t InterlockedExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value) noexcept - { - return _InterlockedExchange64((volatile long long*)a_target, a_value); - } - - std::uint32_t InterlockedIncrement(volatile std::uint32_t* a_target) noexcept - { - return _InterlockedIncrement((volatile long*)a_target); - } - - std::uint64_t InterlockedIncrement64(volatile std::uint64_t* a_target) noexcept - { - return _InterlockedIncrement64((volatile long long*)a_target); - } - - bool IsDebuggerPresent() noexcept - { - return ::W32_IMPL_IsDebuggerPresent(); - } - - std::int32_t LCMapStringEx(const wchar_t* a_locale, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen, NLSVERSIONINFO* a_info, void* a_reserved, std::intptr_t a_sortHandle) noexcept - { - return ::W32_IMPL_LCMapStringEx(a_locale, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_info, a_reserved, a_sortHandle); - } - - void LeaveCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_LeaveCriticalSection(a_criticalSection); - } - - HMODULE LoadLibraryA(const char* a_name) noexcept - { - return ::W32_IMPL_LoadLibraryA(a_name); - } - - HMODULE LoadLibraryW(const wchar_t* a_name) noexcept - { - return ::W32_IMPL_LoadLibraryW(a_name); - } - - void* MapViewOfFile(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes) noexcept - { - return ::W32_IMPL_MapViewOfFile(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes); - } - - void* MapViewOfFileEx(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes, void* a_baseAddr) noexcept - { - return ::W32_IMPL_MapViewOfFileEx(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes, a_baseAddr); - } - - std::int32_t MultiByteToWideChar(std::uint32_t a_codePage, std::uint32_t a_flags, const char* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen) noexcept - { - return ::W32_IMPL_MultiByteToWideChar(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen); - } - - HANDLE OpenFileMappingA(std::uint32_t a_desiredAccess, bool a_inheritHandle, const char* a_name) noexcept - { - return ::W32_IMPL_OpenFileMappingA(a_desiredAccess, a_inheritHandle, a_name); - } - - HANDLE OpenFileMappingW(std::uint32_t a_desiredAccess, bool a_inheritHandle, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_OpenFileMappingW(a_desiredAccess, a_inheritHandle, a_name); - } - - void OutputDebugStringA(const char* a_str) noexcept - { - ::W32_IMPL_OutputDebugStringA(a_str); - } - - void OutputDebugStringW(const wchar_t* a_str) noexcept - { - ::W32_IMPL_OutputDebugStringW(a_str); - } - - bool QueryPerformanceCounter(std::int64_t* a_counter) noexcept - { - return ::W32_IMPL_QueryPerformanceCounter(a_counter); - } - - bool QueryPerformanceFrequency(std::int64_t* a_frequency) noexcept - { - return ::W32_IMPL_QueryPerformanceFrequency(a_frequency); - } - - std::uint32_t ResumeThread(HANDLE a_handle) noexcept - { - return ::W32_IMPL_ResumeThread(a_handle); - } - - bool SetEnvironmentVariableA(const char* a_name, const char* a_value) noexcept - { - return ::W32_IMPL_SetEnvironmentVariableA(a_name, a_value); - } - - bool SetEnvironmentVariableW(const wchar_t* a_name, const wchar_t* a_value) noexcept - { - return ::W32_IMPL_SetEnvironmentVariableW(a_name, a_value); - } - - void Sleep(std::uint32_t a_milliseconds) noexcept - { - ::W32_IMPL_Sleep(a_milliseconds); - } - - bool TerminateProcess(HANDLE a_process, std::uint32_t a_exitCode) noexcept - { - return ::W32_IMPL_TerminateProcess(a_process, a_exitCode); - } - - void* TlsGetValue(std::uint32_t a_index) noexcept - { - return ::W32_IMPL_TlsGetValue(a_index); - } - - bool TlsSetValue(std::uint32_t a_index, void* a_value) noexcept - { - return ::W32_IMPL_TlsSetValue(a_index, a_value); - } - - bool UnmapViewOfFile(const void* a_baseAddress) noexcept - { - return ::W32_IMPL_UnmapViewOfFile(a_baseAddress); - } - - void* VirtualAlloc(void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept - { - return ::W32_IMPL_VirtualAlloc(a_address, a_size, a_type, a_protect); - } - - void* VirtualAllocEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept - { - return ::W32_IMPL_VirtualAllocEx(a_process, a_address, a_size, a_type, a_protect); - } - - bool VirtualFree(void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_VirtualFree(a_address, a_size, a_type); - } - - bool VirtualFreeEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_VirtualFreeEx(a_process, a_address, a_size, a_type); - } - - bool VirtualProtect(void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept - { - return ::W32_IMPL_VirtualProtect(a_address, a_size, a_newProtect, a_oldProtect); - } - - bool VirtualProtectEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept - { - return ::W32_IMPL_VirtualProtectEx(a_process, a_address, a_size, a_newProtect, a_oldProtect); - } - - std::size_t VirtualQuery(const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept - { - return ::W32_IMPL_VirtualQuery(a_address, a_buf, a_bufLen); - } - - std::size_t VirtualQueryEx(HANDLE a_process, const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept - { - return ::W32_IMPL_VirtualQueryEx(a_process, a_address, a_buf, a_bufLen); - } - - std::uint32_t WaitForSingleObject(HANDLE a_handle, std::uint32_t a_milliseconds) noexcept - { - return ::W32_IMPL_WaitForSingleObject(a_handle, a_milliseconds); - } - - std::uint32_t WaitForSingleObjectEx(HANDLE a_handle, std::uint32_t a_milliseconds, bool a_alertable) noexcept - { - return ::W32_IMPL_WaitForSingleObjectEx(a_handle, a_milliseconds, a_alertable); - } - - std::int32_t WideCharToMultiByte(std::uint32_t a_codePage, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, char* a_dst, std::int32_t a_dstLen, const char* a_default, std::int32_t* a_defaultLen) - { - return ::W32_IMPL_WideCharToMultiByte(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_default, a_defaultLen); - } - - bool WriteProcessMemory(HANDLE a_process, void* a_address, const void* a_buf, std::size_t a_bufLen, std::size_t* a_bufWritten) noexcept - { - return ::W32_IMPL_WriteProcessMemory(a_process, a_address, a_buf, a_bufLen, a_bufWritten); - } -} - -// NT -namespace REX::W32 -{ - TEB* NtCurrentTeb() noexcept - { - return reinterpret_cast(__readgsqword(offsetof(NT_TIB, self))); - } -} - -// OLE32 - -REX_W32_IMPORT(void, CoTaskMemFree, void*); - -namespace REX::W32 -{ - void CoTaskMemFree(void* a_block) noexcept - { - ::W32_IMPL_CoTaskMemFree(a_block); - } -} - -// SHELL32 - -REX_W32_IMPORT(std::int32_t, SHGetKnownFolderPath, const REX::W32::GUID&, std::uint32_t, void*, wchar_t**); - -namespace REX::W32 -{ - std::int32_t SHGetKnownFolderPath(const GUID& a_id, std::uint32_t a_flags, void* a_token, wchar_t** a_path) noexcept - { - return ::W32_IMPL_SHGetKnownFolderPath(a_id, a_flags, a_token, a_path); - } -} - -// USER32 - -REX_W32_IMPORT(REX::W32::BOOL, GetClientRect, REX::W32::HWND, REX::W32::RECT*); -REX_W32_IMPORT(std::int32_t, GetKeyNameTextA, std::int32_t, char*, std::int32_t); -REX_W32_IMPORT(std::int32_t, GetKeyNameTextW, std::int32_t, wchar_t*, std::int32_t); -REX_W32_IMPORT(std::int16_t, GetKeyState, std::int32_t); -REX_W32_IMPORT(REX::W32::BOOL, GetWindowRect, REX::W32::HWND, REX::W32::RECT*); -REX_W32_IMPORT(std::int32_t, MessageBoxA, REX::W32::HWND, const char*, const char*, std::uint32_t); -REX_W32_IMPORT(std::int32_t, MessageBoxW, REX::W32::HWND, const wchar_t*, const wchar_t*, std::uint32_t); -REX_W32_IMPORT(std::intptr_t, SetWindowLongPtrA, REX::W32::HWND, std::int32_t, std::intptr_t); -REX_W32_IMPORT(std::int32_t, ShowCursor, REX::W32::BOOL); - -namespace REX::W32 -{ - bool GetClientRect(HWND a_wnd, RECT* a_rect) noexcept - { - return ::W32_IMPL_GetClientRect(a_wnd, a_rect); - } - - std::int32_t GetKeyNameTextA(std::int32_t a_param, char* a_buf, std::int32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetKeyNameTextA(a_param, a_buf, a_bufLen); - } - - std::int32_t GetKeyNameTextW(std::int32_t a_param, wchar_t* a_buf, std::int32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetKeyNameTextW(a_param, a_buf, a_bufLen); - } - - std::int16_t GetKeyState(std::int32_t a_key) noexcept - { - return ::W32_IMPL_GetKeyState(a_key); - } - - bool GetWindowRect(HWND a_wnd, RECT* a_rect) noexcept - { - return ::W32_IMPL_GetWindowRect(a_wnd, a_rect); - } - - std::int32_t MessageBoxA(HWND a_wnd, const char* a_text, const char* a_caption, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_MessageBoxA(a_wnd, a_text, a_caption, a_type); - } - - std::int32_t MessageBoxW(HWND a_wnd, const wchar_t* a_text, const wchar_t* a_caption, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_MessageBoxW(a_wnd, a_text, a_caption, a_type); - } - - std::intptr_t SetWindowLongPtrA(HWND a_wnd, std::int32_t a_index, std::intptr_t a_newPtr) noexcept - { - return ::W32_IMPL_SetWindowLongPtrA(a_wnd, a_index, a_newPtr); - } - - std::int32_t ShowCursor(bool a_show) noexcept - { - return ::W32_IMPL_ShowCursor(a_show); - } -} - -// VERSION - -REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoA, const char*, std::uint32_t, std::uint32_t, void*); -REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoW, const wchar_t*, std::uint32_t, std::uint32_t, void*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeA, const char*, std::uint32_t*); -//REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExA, std::uint32_t, const char*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExW, std::uint32_t, const wchar_t*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeW, const wchar_t*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueA, const void*, const char*, void**, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueW, const void*, const wchar_t*, void**, std::uint32_t*); - -namespace REX::W32 -{ - bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept - { - return ::W32_IMPL_GetFileVersionInfoA(a_name, a_handle, a_dataLen, a_data); - } - - std::uint32_t GetFileVersionInfoSizeA(const char* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeA(a_name, a_handle); - } - - /* - std::uint32_t GetFileVersionInfoSizeExA(std::uint32_t a_flags, const char* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeExA(a_flags, a_name, a_handle); - } - */ - - std::uint32_t GetFileVersionInfoSizeExW(std::uint32_t a_flags, const wchar_t* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeExW(a_flags, a_name, a_handle); - } - - std::uint32_t GetFileVersionInfoSizeW(const wchar_t* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeW(a_name, a_handle); - } - - bool GetFileVersionInfoW(const wchar_t* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept - { - return ::W32_IMPL_GetFileVersionInfoW(a_name, a_handle, a_dataLen, a_data); - } - - bool VerQueryValueA(const void* a_block, const char* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept - { - return ::W32_IMPL_VerQueryValueA(a_block, a_subBlock, a_buf, a_bufLen); - } - - bool VerQueryValueW(const void* a_block, const wchar_t* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept - { - return ::W32_IMPL_VerQueryValueW(a_block, a_subBlock, a_buf, a_bufLen); - } -} diff --git a/src/SKSE/API.cpp b/src/SKSE/API.cpp index 4202ba800..efafee55f 100644 --- a/src/SKSE/API.cpp +++ b/src/SKSE/API.cpp @@ -3,48 +3,46 @@ #include "SKSE/Interfaces.h" #include "SKSE/Logger.h" +#include +#include +#include + namespace SKSE { - namespace detail + namespace Impl { - struct APIStorage + class API : + public REX::Singleton { public: - [[nodiscard]] static APIStorage& get() noexcept - { - static APIStorage singleton; - return singleton; - } + void Init(InitInfo, const SKSE::QueryInterface* a_intfc); + void InitLog(); + void InitTrampoline(); + void InitHook(REL::HOOK_STEP a_step); - std::string_view pluginName{}; - std::string_view pluginAuthor{}; - REL::Version pluginVersion{}; + InitInfo info; - PluginHandle pluginHandle{ static_cast(-1) }; - std::uint32_t releaseIndex{ 0 }; + std::string pluginName{}; + std::string pluginAuthor{}; + REL::Version pluginVersion{}; + + std::uint32_t skseVersion{}; + PluginHandle pluginHandle{ static_cast(-1) }; + std::uint32_t releaseIndex{ 0 }; + std::function pluginInfoAccessor; ScaleformInterface* scaleformInterface{ nullptr }; PapyrusInterface* papyrusInterface{ nullptr }; SerializationInterface* serializationInterface{ nullptr }; TaskInterface* taskInterface{ nullptr }; + MessagingInterface* messagingInterface{ nullptr }; + ObjectInterface* objectInterface{ nullptr }; TrampolineInterface* trampolineInterface{ nullptr }; - MessagingInterface* messagingInterface{ nullptr }; - RE::BSTEventSource* modCallbackEventSource{ nullptr }; - RE::BSTEventSource* cameraEventSource{ nullptr }; - RE::BSTEventSource* crosshairRefEventSource{ nullptr }; - RE::BSTEventSource* actionEventSource{ nullptr }; - RE::BSTEventSource* niNodeUpdateEventSource{ nullptr }; - - ObjectInterface* objectInterface{ nullptr }; SKSEDelayFunctorManager* delayFunctorManager{ nullptr }; SKSEObjectRegistry* objectRegistry{ nullptr }; SKSEPersistentObjectStorage* persistentObjectStorage{ nullptr }; - std::mutex apiLock; - std::vector> apiInitRegs; - bool apiInit{ false }; - template [[nodiscard]] RE::BSTEventSource* GetEventDispatcher(MessagingInterface::Dispatcher a_id) const { @@ -52,219 +50,296 @@ namespace SKSE return static_cast*>(messagingInterface->GetEventDispatcher(a_id)); } - private: - APIStorage() noexcept = default; - APIStorage(const APIStorage&) = delete; - APIStorage(APIStorage&&) = delete; - - ~APIStorage() noexcept = default; + RE::BSTEventSource* modCallbackEventSource{ nullptr }; + RE::BSTEventSource* cameraEventSource{ nullptr }; + RE::BSTEventSource* crosshairRefEventSource{ nullptr }; + RE::BSTEventSource* actionEventSource{ nullptr }; + RE::BSTEventSource* niNodeUpdateEventSource{ nullptr }; - APIStorage& operator=(const APIStorage&) = delete; - APIStorage& operator=(APIStorage&&) = delete; + std::mutex apiLock; + std::vector> apiInitRegs; + bool apiInit{ false }; }; - template - T* QueryInterface(const LoadInterface* a_intfc, std::uint32_t a_id) + void API::Init(InitInfo a_info, const SKSE::QueryInterface* a_intfc) { - auto result = static_cast(a_intfc->QueryInterface(a_id)); - if (result && result->Version() > T::kVersion) { - log::warn("interface definition is out of date"sv); - } - return result; + info = a_info; + + static std::once_flag once; + std::call_once(once, [&]() { + if (const auto data = PluginVersionData::GetSingleton()) { + pluginName = data->GetPluginName(); + pluginAuthor = data->GetAuthorName(); + pluginVersion = data->GetPluginVersion(); + } else { + std::vector buf(REX::W32::MAX_PATH, '\0'); + const auto size = REX::W32::GetModuleFileNameA(REX::W32::GetCurrentModule(), buf.data(), REX::W32::MAX_PATH); + if (size) { + std::filesystem::path p(buf.begin(), buf.begin() + size); + pluginName = p.stem().string(); + } + } + + skseVersion = a_intfc->SKSEVersion(); + pluginHandle = a_intfc->GetPluginHandle(); + releaseIndex = a_intfc->GetReleaseIndex(); + pluginInfoAccessor = reinterpret_cast(a_intfc)->GetPluginInfo; + }); } - } - void Init(const LoadInterface* a_intfc, [[maybe_unused]] const bool a_log) noexcept - { - if (!a_intfc) { - stl::report_and_fail("interface is null"sv); - } - - (void)REL::Module::get(); - (void)REL::IDDatabase::get(); + void API::InitLog() + { + if (info.log) { + static std::once_flag once; + std::call_once(once, [&]() { + auto path = log::log_directory(); + if (!path) + return; + + *path /= std::format("{}.log", info.logName ? info.logName : SKSE::GetPluginName()); + + std::vector sinks{ + std::make_shared(path->string(), true), + std::make_shared() + }; + + auto logger = std::make_shared("global", sinks.begin(), sinks.end()); +#ifndef NDEBUG + logger->set_level(spdlog::level::debug); + logger->flush_on(spdlog::level::debug); +#else + logger->set_level(spdlog::level::info); + logger->flush_on(spdlog::level::info); +#endif + spdlog::set_default_logger(std::move(logger)); + spdlog::set_pattern(info.logPattern ? info.logPattern : "[%T.%e] [%=5t] [%L] %v"); - auto& storage = detail::APIStorage::get(); - const auto& intfc = *a_intfc; + REX::INFO("{} v{}", GetPluginName(), GetPluginVersion()); + }); + } + } - const std::scoped_lock l(storage.apiLock); -#ifdef SKYRIM_SUPPORT_AE - if (const auto pluginVersionData = PluginVersionData::GetSingleton()) { - storage.pluginName = pluginVersionData->GetPluginName(); - storage.pluginAuthor = pluginVersionData->GetAuthorName(); - storage.pluginVersion = pluginVersionData->GetPluginVersion(); + void API::InitTrampoline() + { + if (info.trampoline) { + static std::once_flag once; + std::call_once(once, [&]() { + if (!info.trampolineSize) { + const auto hookStore = REL::HookStore::GetSingleton(); + info.trampolineSize += hookStore->GetSizeTrampoline(); + } + + auto& trampoline = REL::GetTrampoline(); + if (const auto intfc = GetTrampolineInterface(); + intfc && info.trampolineSKSE) { + if (const auto mem = intfc->AllocateFromBranchPool(info.trampolineSize)) + trampoline.set_trampoline(mem, info.trampolineSize); + else + trampoline.create(info.trampolineSize); + } + }); + } } - if (a_log) { - log::init(); - log::info("{} v{}", GetPluginName(), GetPluginVersion()); + void API::InitHook(REL::HOOK_STEP a_step) + { + if (info.hook) { + const auto hookStore = REL::HookStore::GetSingleton(); + hookStore->Init(); + hookStore->Enable(a_step); + } } -#endif + } - if (!storage.apiInit) { - storage.pluginHandle = intfc.GetPluginHandle(); - storage.releaseIndex = intfc.GetReleaseIndex(); - - storage.scaleformInterface = detail::QueryInterface(a_intfc, LoadInterface::kScaleform); - storage.papyrusInterface = detail::QueryInterface(a_intfc, LoadInterface::kPapyrus); - storage.serializationInterface = detail::QueryInterface(a_intfc, LoadInterface::kSerialization); - storage.taskInterface = detail::QueryInterface(a_intfc, LoadInterface::kTask); - storage.trampolineInterface = detail::QueryInterface(a_intfc, LoadInterface::kTrampoline); - - storage.messagingInterface = detail::QueryInterface(a_intfc, LoadInterface::kMessaging); - if (storage.messagingInterface) { - storage.modCallbackEventSource = storage.GetEventDispatcher(MessagingInterface::Dispatcher::kModEvent); - storage.cameraEventSource = storage.GetEventDispatcher(MessagingInterface::Dispatcher::kCameraEvent); - storage.crosshairRefEventSource = storage.GetEventDispatcher(MessagingInterface::Dispatcher::kCrosshairEvent); - storage.actionEventSource = storage.GetEventDispatcher(MessagingInterface::Dispatcher::kActionEvent); - storage.niNodeUpdateEventSource = storage.GetEventDispatcher(MessagingInterface::Dispatcher::kNiNodeUpdateEvent); + void Init(const LoadInterface* a_intfc, InitInfo a_info) noexcept + { + static std::once_flag once; + std::call_once(once, [&]() { + auto api = Impl::API::GetSingleton(); + api->Init(a_info, a_intfc); + api->InitLog(); + + api->scaleformInterface = a_intfc->QueryInterface(LoadInterface::kScaleform); + api->papyrusInterface = a_intfc->QueryInterface(LoadInterface::kPapyrus); + api->serializationInterface = a_intfc->QueryInterface(LoadInterface::kSerialization); + api->taskInterface = a_intfc->QueryInterface(LoadInterface::kTask); + api->trampolineInterface = a_intfc->QueryInterface(LoadInterface::kTrampoline); + + api->messagingInterface = a_intfc->QueryInterface(LoadInterface::kMessaging); + if (api->messagingInterface) { + api->modCallbackEventSource = api->GetEventDispatcher(MessagingInterface::Dispatcher::kModEvent); + api->cameraEventSource = api->GetEventDispatcher(MessagingInterface::Dispatcher::kCameraEvent); + api->crosshairRefEventSource = api->GetEventDispatcher(MessagingInterface::Dispatcher::kCrosshairEvent); + api->actionEventSource = api->GetEventDispatcher(MessagingInterface::Dispatcher::kActionEvent); + api->niNodeUpdateEventSource = api->GetEventDispatcher(MessagingInterface::Dispatcher::kNiNodeUpdateEvent); } - storage.objectInterface = detail::QueryInterface(a_intfc, LoadInterface::kObject); - if (storage.objectInterface) { - const auto& objectInterface = *storage.objectInterface; - storage.delayFunctorManager = std::addressof(objectInterface.GetDelayFunctorManager()); - storage.objectRegistry = std::addressof(objectInterface.GetObjectRegistry()); - storage.persistentObjectStorage = std::addressof(objectInterface.GetPersistentObjectStorage()); + api->objectInterface = a_intfc->QueryInterface(LoadInterface::kObject); + if (api->objectInterface) { + api->delayFunctorManager = std::addressof(api->objectInterface->GetDelayFunctorManager()); + api->objectRegistry = std::addressof(api->objectInterface->GetObjectRegistry()); + api->persistentObjectStorage = std::addressof(api->objectInterface->GetPersistentObjectStorage()); } - storage.apiInit = true; - auto& regs = storage.apiInitRegs; - for (const auto& reg : regs) { - reg(); + const std::scoped_lock lock{ api->apiLock }; + if (!api->apiInit) { + api->apiInit = true; + auto& regs = api->apiInitRegs; + for (const auto& reg : regs) { + reg(); + } + regs.clear(); + regs.shrink_to_fit(); } - regs.clear(); - regs.shrink_to_fit(); - } + + api->InitTrampoline(); + api->InitHook(REL::HOOK_STEP::LOAD); + }); } void RegisterForAPIInitEvent(std::function a_fn) { - { - auto& storage = detail::APIStorage::get(); - const std::scoped_lock l(storage.apiLock); - if (!storage.apiInit) { - storage.apiInitRegs.push_back(a_fn); - return; - } + auto api = Impl::API::GetSingleton(); + const std::scoped_lock lock{ api->apiLock }; + if (!api->apiInit) { + api->apiInitRegs.push_back(a_fn); + return; } a_fn(); } -#ifdef SKYRIM_SUPPORT_AE + std::uint32_t GetSKSEVersion() noexcept + { + return Impl::API::GetSingleton()->skseVersion; + } + std::string_view GetPluginName() noexcept { - return detail::APIStorage::get().pluginName; + return Impl::API::GetSingleton()->pluginName; } std::string_view GetPluginAuthor() noexcept { - return detail::APIStorage::get().pluginAuthor; + return Impl::API::GetSingleton()->pluginAuthor; } REL::Version GetPluginVersion() noexcept { - return detail::APIStorage::get().pluginVersion; + return Impl::API::GetSingleton()->pluginVersion; } -#endif PluginHandle GetPluginHandle() noexcept { - return detail::APIStorage::get().pluginHandle; + return Impl::API::GetSingleton()->pluginHandle; + } + + const PluginInfo* GetPluginInfo(std::string_view a_plugin) noexcept + { + if (const auto& accessor = Impl::API::GetSingleton()->pluginInfoAccessor) { + if (const auto result = accessor(a_plugin.data())) { + return static_cast(result); + } + } + + REX::ERROR("failed to get plugin info for {}", a_plugin); + return nullptr; } std::uint32_t GetReleaseIndex() noexcept { - return detail::APIStorage::get().releaseIndex; + return Impl::API::GetSingleton()->releaseIndex; + } + + const MessagingInterface* GetMessagingInterface() noexcept + { + return Impl::API::GetSingleton()->messagingInterface; } const ScaleformInterface* GetScaleformInterface() noexcept { - return detail::APIStorage::get().scaleformInterface; + return Impl::API::GetSingleton()->scaleformInterface; } const PapyrusInterface* GetPapyrusInterface() noexcept { - return detail::APIStorage::get().papyrusInterface; + return Impl::API::GetSingleton()->papyrusInterface; } const SerializationInterface* GetSerializationInterface() noexcept { - return detail::APIStorage::get().serializationInterface; + return Impl::API::GetSingleton()->serializationInterface; } const TaskInterface* GetTaskInterface() noexcept { - return detail::APIStorage::get().taskInterface; + return Impl::API::GetSingleton()->taskInterface; } - const TrampolineInterface* GetTrampolineInterface() noexcept + const ObjectInterface* GetObjectInterface() noexcept { - return detail::APIStorage::get().trampolineInterface; + return Impl::API::GetSingleton()->objectInterface; } - const MessagingInterface* GetMessagingInterface() noexcept + const TrampolineInterface* GetTrampolineInterface() noexcept { - return detail::APIStorage::get().messagingInterface; + return Impl::API::GetSingleton()->trampolineInterface; } - RE::BSTEventSource* GetModCallbackEventSource() noexcept + const SKSEDelayFunctorManager* GetDelayFunctorManager() noexcept { - return detail::APIStorage::get().modCallbackEventSource; + return Impl::API::GetSingleton()->delayFunctorManager; } - RE::BSTEventSource* GetCameraEventSource() noexcept + const SKSEObjectRegistry* GetObjectRegistry() noexcept { - return detail::APIStorage::get().cameraEventSource; + return Impl::API::GetSingleton()->objectRegistry; } - RE::BSTEventSource* GetCrosshairRefEventSource() noexcept + const SKSEPersistentObjectStorage* GetPersistentObjectStorage() noexcept { - return detail::APIStorage::get().crosshairRefEventSource; + return Impl::API::GetSingleton()->persistentObjectStorage; } - RE::BSTEventSource* GetActionEventSource() noexcept + RE::BSTEventSource* GetModCallbackEventSource() noexcept { - return detail::APIStorage::get().actionEventSource; + return Impl::API::GetSingleton()->modCallbackEventSource; } - RE::BSTEventSource* GetNiNodeUpdateEventSource() noexcept + RE::BSTEventSource* GetCameraEventSource() noexcept { - return detail::APIStorage::get().niNodeUpdateEventSource; + return Impl::API::GetSingleton()->cameraEventSource; } - const ObjectInterface* GetObjectInterface() noexcept + RE::BSTEventSource* GetCrosshairRefEventSource() noexcept { - return detail::APIStorage::get().objectInterface; + return Impl::API::GetSingleton()->crosshairRefEventSource; } - const SKSEDelayFunctorManager* GetDelayFunctorManager() noexcept + RE::BSTEventSource* GetActionEventSource() noexcept { - return detail::APIStorage::get().delayFunctorManager; + return Impl::API::GetSingleton()->actionEventSource; } - const SKSEObjectRegistry* GetObjectRegistry() noexcept + RE::BSTEventSource* GetNiNodeUpdateEventSource() noexcept { - return detail::APIStorage::get().objectRegistry; + return Impl::API::GetSingleton()->niNodeUpdateEventSource; } +} - const SKSEPersistentObjectStorage* GetPersistentObjectStorage() noexcept +namespace SKSE +{ + void Init(const LoadInterface* a_intfc, const bool a_log) noexcept { - return detail::APIStorage::get().persistentObjectStorage; + Init(a_intfc, { .log = a_log }); } - void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve) + void AllocTrampoline(std::size_t a_size, bool a_trySKSEReserve) noexcept { - auto& trampoline = GetTrampoline(); - if (auto intfc = GetTrampolineInterface(); - intfc && a_trySKSEReserve) { - auto memory = intfc->AllocateFromBranchPool(a_size); - if (memory) { - trampoline.set_trampoline(memory, a_size); - return; - } - } - - trampoline.create(a_size); + auto api = Impl::API::GetSingleton(); + api->info.trampoline = true; + api->info.trampolineSize = a_size; + api->info.trampolineSKSE = a_trySKSEReserve; + api->InitTrampoline(); } } diff --git a/src/SKSE/IAT.cpp b/src/SKSE/IAT.cpp deleted file mode 100644 index 9039bc5d6..000000000 --- a/src/SKSE/IAT.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "SKSE/IAT.h" - -#include "SKSE/Logger.h" - -#include "REX/W32/KERNEL32.h" - -namespace SKSE -{ - std::uintptr_t GetIATAddr(std::string_view a_dll, std::string_view a_function) - { - return reinterpret_cast(GetIATPtr(std::move(a_dll), std::move(a_function))); - } - - std::uintptr_t GetIATAddr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function) - { - return reinterpret_cast(GetIATPtr(a_module, std::move(a_dll), std::move(a_function))); - } - - void* GetIATPtr(std::string_view a_dll, std::string_view a_function) - { - return GetIATPtr(REL::Module::get().pointer(), std::move(a_dll), std::move(a_function)); - } - - // https://guidedhacking.com/attachments/pe_imptbl_headers-jpg.2241/ - void* GetIATPtr(REX::W32::HMODULE a_module, std::string_view a_dll, std::string_view a_function) - { - assert(a_module); - const auto dosHeader = reinterpret_cast(a_module); - if (dosHeader->magic != REX::W32::IMAGE_DOS_SIGNATURE) { - log::error("Invalid DOS header"); - return nullptr; - } - - const auto ntHeader = stl::adjust_pointer(dosHeader, dosHeader->lfanew); - const auto& dataDir = ntHeader->optionalHeader.dataDirectory[REX::W32::IMAGE_DIRECTORY_ENTRY_IMPORT]; - const auto importDesc = stl::adjust_pointer(dosHeader, dataDir.virtualAddress); - - for (auto import = importDesc; import->characteristics != 0; ++import) { - auto name = stl::adjust_pointer(dosHeader, import->name); - if (a_dll.size() == strlen(name) && _strnicmp(a_dll.data(), name, a_dll.size()) != 0) { - continue; - } - - const auto thunk = stl::adjust_pointer(dosHeader, import->firstThunkOriginal); - for (std::size_t i = 0; thunk[i].ordinal; ++i) { - if (REX::W32::IMAGE_SNAP_BY_ORDINAL64(thunk[i].ordinal)) { - continue; - } - - const auto importByName = stl::adjust_pointer(dosHeader, thunk[i].address); - if (a_function.size() == strlen(importByName->name) && - _strnicmp(a_function.data(), importByName->name, a_function.size()) == 0) { - return stl::adjust_pointer(dosHeader, import->firstThunk) + i; - } - } - } - - log::warn("Failed to find {} ({})", a_dll, a_function); - return nullptr; - } - - std::uintptr_t PatchIAT(std::uintptr_t a_newFunc, std::string_view a_dll, std::string_view a_function) - { - std::uintptr_t origAddr = 0; - - const auto oldFunc = GetIATAddr(a_dll, a_function); - if (oldFunc) { - origAddr = *reinterpret_cast(oldFunc); - REL::safe_write(oldFunc, a_newFunc); - } else { - log::warn("Failed to patch {} ({})", a_dll, a_function); - } - - return origAddr; - } -} diff --git a/src/SKSE/InputMap.cpp b/src/SKSE/InputMap.cpp index 0ce8af9f7..96e5c0fc3 100644 --- a/src/SKSE/InputMap.cpp +++ b/src/SKSE/InputMap.cpp @@ -260,7 +260,9 @@ namespace SKSE 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); + std::string result{}; + REX::UTF16_TO_UTF8(keyNameW, result); + return result; } std::string InputMap::GetMouseButtonName(std::uint32_t a_keyCode) diff --git a/src/SKSE/Interfaces.cpp b/src/SKSE/Interfaces.cpp index 4776e0a0f..b54431ce9 100644 --- a/src/SKSE/Interfaces.cpp +++ b/src/SKSE/Interfaces.cpp @@ -7,230 +7,83 @@ namespace SKSE { - std::uint32_t QueryInterface::EditorVersion() const - { - return GetProxy()->editorVersion; - } - - bool QueryInterface::IsEditor() const - { - return static_cast(GetProxy()->isEditor); - } - - REL::Version QueryInterface::RuntimeVersion() const - { - const auto packed = GetProxy()->runtimeVersion; - const auto major = static_cast((packed & 0xFF000000) >> 24); - const auto minor = static_cast((packed & 0x00FF0000) >> 16); - const auto revision = static_cast((packed & 0x0000FFF0) >> 4); - const auto build = static_cast((packed & 0x0000000F) >> 0); - return { major, minor, revision, build }; - } - - std::uint32_t QueryInterface::SKSEVersion() const - { - return GetProxy()->skseVersion; - } - - const detail::SKSEInterface* QueryInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - PluginHandle LoadInterface::GetPluginHandle() const - { - return GetProxy()->GetPluginHandle(); - } - - const PluginInfo* LoadInterface::GetPluginInfo(const char* a_name) const - { - return static_cast(GetProxy()->GetPluginInfo(a_name)); - } - - std::uint32_t LoadInterface::GetReleaseIndex() const - { - return GetProxy()->GetReleaseIndex(); - } - - void* LoadInterface::QueryInterface(std::uint32_t a_id) const - { - return GetProxy()->QueryInterface(a_id); - } - - std::uint32_t ScaleformInterface::Version() const - { - return GetProxy()->interfaceVersion; - } - bool ScaleformInterface::Register(RegCallback* a_callback, const char* a_name) const { - auto result = GetProxy()->Register(a_name, reinterpret_cast(a_callback)); + auto result = GetProxy().Register(a_name, reinterpret_cast(a_callback)); if (!result) { - log::error("Failed to register {} for scaleform interface callback", a_name); + REX::ERROR("Failed to register {} for scaleform interface callback", a_name); } return result; } void ScaleformInterface::Register(RegInvCallback* a_callback) const { - GetProxy()->RegisterForInventory(reinterpret_cast(a_callback)); - } - - const detail::SKSEScaleformInterface* ScaleformInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - std::uint32_t SerializationInterface::Version() const - { - return GetProxy()->version; + GetProxy().RegisterForInventory(reinterpret_cast(a_callback)); } void SerializationInterface::SetUniqueID(std::uint32_t a_uid) const { - GetProxy()->SetUniqueID(GetPluginHandle(), a_uid); + GetProxy().SetUniqueID(GetPluginHandle(), a_uid); } - void SerializationInterface::SetFormDeleteCallback(FormDeleteCallback* a_callback) const + void SerializationInterface::SetRevertCallback(EventCallback* a_callback) const { - GetProxy()->SetFormDeleteCallback(GetPluginHandle(), reinterpret_cast(a_callback)); + GetProxy().SetRevertCallback(GetPluginHandle(), reinterpret_cast(a_callback)); } - void SerializationInterface::SetLoadCallback(EventCallback* a_callback) const + void SerializationInterface::SetSaveCallback(EventCallback* a_callback) const { - GetProxy()->SetLoadCallback(GetPluginHandle(), reinterpret_cast(a_callback)); + GetProxy().SetSaveCallback(GetPluginHandle(), reinterpret_cast(a_callback)); } - void SerializationInterface::SetRevertCallback(EventCallback* a_callback) const + void SerializationInterface::SetLoadCallback(EventCallback* a_callback) const { - GetProxy()->SetRevertCallback(GetPluginHandle(), reinterpret_cast(a_callback)); + GetProxy().SetLoadCallback(GetPluginHandle(), reinterpret_cast(a_callback)); } - void SerializationInterface::SetSaveCallback(EventCallback* a_callback) const + void SerializationInterface::SetFormDeleteCallback(FormDeleteCallback* a_callback) const { - GetProxy()->SetSaveCallback(GetPluginHandle(), reinterpret_cast(a_callback)); + GetProxy().SetFormDeleteCallback(GetPluginHandle(), reinterpret_cast(a_callback)); } bool SerializationInterface::WriteRecord(std::uint32_t a_type, std::uint32_t a_version, const void* a_buf, std::uint32_t a_length) const { - return GetProxy()->WriteRecord(a_type, a_version, a_buf, a_length); + return GetProxy().WriteRecord(a_type, a_version, a_buf, a_length); } bool SerializationInterface::OpenRecord(std::uint32_t a_type, std::uint32_t a_version) const { - return GetProxy()->OpenRecord(a_type, a_version); + return GetProxy().OpenRecord(a_type, a_version); } bool SerializationInterface::WriteRecordData(const void* a_buf, std::uint32_t a_length) const { - return GetProxy()->WriteRecordData(a_buf, a_length); + return GetProxy().WriteRecordData(a_buf, a_length); } bool SerializationInterface::WriteRecordDataEx(std::uint32_t& a_diff, const void* a_buf, std::uint32_t a_length) const { a_diff += a_length; - return GetProxy()->WriteRecordData(a_buf, a_length); + return GetProxy().WriteRecordData(a_buf, a_length); } bool SerializationInterface::GetNextRecordInfo(std::uint32_t& a_type, std::uint32_t& a_version, std::uint32_t& a_length) const { - return GetProxy()->GetNextRecordInfo(&a_type, &a_version, &a_length); + return GetProxy().GetNextRecordInfo(&a_type, &a_version, &a_length); } std::uint32_t SerializationInterface::ReadRecordData(void* a_buf, std::uint32_t a_length) const { - return GetProxy()->ReadRecordData(a_buf, a_length); + return GetProxy().ReadRecordData(a_buf, a_length); } std::uint32_t SerializationInterface::ReadRecordDataEx(std::uint32_t& a_diff, void* a_buf, std::uint32_t a_length) const { - const auto result = GetProxy()->ReadRecordData(a_buf, a_length); + const auto result = GetProxy().ReadRecordData(a_buf, a_length); a_diff -= result; return result; } - bool SerializationInterface::ResolveFormID(RE::FormID a_oldFormID, RE::FormID& a_newFormID) const - { - return GetProxy()->ResolveFormId(a_oldFormID, &a_newFormID); - } - - bool SerializationInterface::ResolveHandle(RE::VMHandle a_oldHandle, RE::VMHandle& a_newHandle) const - { - return GetProxy()->ResolveHandle(a_oldHandle, &a_newHandle); - } - - const detail::SKSESerializationInterface* SerializationInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - std::uint32_t TaskInterface::Version() const - { - return GetProxy()->interfaceVersion; - } - - void TaskInterface::AddTask(TaskFn a_task) const - { - GetProxy()->AddTask(new Task(std::move(a_task))); - } - - void TaskInterface::AddTask(TaskDelegate* a_task) const - { - GetProxy()->AddTask(a_task); - } - - void TaskInterface::AddUITask(TaskFn a_task) const - { - GetProxy()->AddUITask(new UITask(std::move(a_task))); - } - - void TaskInterface::AddUITask(UIDelegate_v1* a_task) const - { - GetProxy()->AddUITask(a_task); - } - - TaskInterface::Task::Task(TaskFn&& a_fn) : - _fn(std::move(a_fn)) - {} - - void TaskInterface::Task::Run() - { - _fn(); - } - - void TaskInterface::Task::Dispose() - { - delete this; - } - - TaskInterface::UITask::UITask(TaskFn&& a_fn) : - _fn(std::move(a_fn)) - {} - - void TaskInterface::UITask::Run() - { - _fn(); - } - - void TaskInterface::UITask::Dispose() - { - delete this; - } - - const detail::SKSETaskInterface* TaskInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - std::uint32_t PapyrusInterface::Version() const - { - return GetProxy()->interfaceVersion; - } - bool PapyrusInterface::Register_Impl(RegFunction1* a_fn) const { assert(a_fn); @@ -239,9 +92,9 @@ namespace SKSE a_fn(vm); return true; } else { - auto result = GetProxy()->Register(reinterpret_cast(a_fn)); + auto result = GetProxy().Register(reinterpret_cast(a_fn)); if (!result) { - log::error("Failed to register for papyrus interface"); + REX::ERROR("Failed to register for papyrus interface"); } return result; } @@ -255,110 +108,44 @@ namespace SKSE a_fn(vm); return true; } else { - auto result = GetProxy()->Register(reinterpret_cast(a_fn)); + auto result = GetProxy().Register(reinterpret_cast(a_fn)); if (!result) { - log::error("Failed to register for papyrus interface"); + REX::ERROR("Failed to register for papyrus interface"); } return result; } } - const detail::SKSEPapyrusInterface* PapyrusInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - std::uint32_t MessagingInterface::Version() const - { - return GetProxy()->interfaceVersion; - } - bool MessagingInterface::Dispatch(std::uint32_t a_messageType, void* a_data, std::uint32_t a_dataLen, const char* a_receiver) const { - auto result = GetProxy()->Dispatch(GetPluginHandle(), a_messageType, a_data, a_dataLen, a_receiver); + auto result = GetProxy().Dispatch(GetPluginHandle(), a_messageType, a_data, a_dataLen, a_receiver); if (!result) { - log::warn("Failed to dispatch message to {}", (a_receiver ? a_receiver : "all listeners")); + REX::WARN("Failed to dispatch message to {}", (a_receiver ? a_receiver : "all listeners")); } return result; } - void* MessagingInterface::GetEventDispatcher(Dispatcher a_dispatcherID) const - { - return GetProxy()->GetEventDispatcher(static_cast(a_dispatcherID)); - } - - bool MessagingInterface::RegisterListener(EventCallback* a_callback) const - { - return RegisterListener("SKSE", a_callback); - } - bool MessagingInterface::RegisterListener(const char* a_sender, EventCallback* a_callback) const { - auto result = GetProxy()->RegisterListener(GetPluginHandle(), a_sender, reinterpret_cast(a_callback)); + auto result = GetProxy().RegisterListener(GetPluginHandle(), a_sender, reinterpret_cast(a_callback)); if (!result) { - log::error("Failed to register messaging listener for {}", a_sender); + REX::ERROR("Failed to register messaging listener for {}", a_sender); } return result; } - const detail::SKSEMessagingInterface* MessagingInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - std::uint32_t ObjectInterface::Version() const - { - return GetProxy()->interfaceVersion; - } - - SKSEDelayFunctorManager& ObjectInterface::GetDelayFunctorManager() const - { - return (SKSEDelayFunctorManager&)GetProxy()->GetDelayFunctorManager(); - } - - SKSEObjectRegistry& ObjectInterface::GetObjectRegistry() const - { - return (SKSEObjectRegistry&)GetProxy()->GetObjectRegistry(); - } - - SKSEPersistentObjectStorage& ObjectInterface::GetPersistentObjectStorage() const - { - return (SKSEPersistentObjectStorage&)GetProxy()->GetPersistentObjectStorage(); - } - - const detail::SKSEObjectInterface* ObjectInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); - } - - std::uint32_t TrampolineInterface::Version() const - { - return GetProxy()->interfaceVersion; - } - void* TrampolineInterface::AllocateFromBranchPool(std::size_t a_size) const { - return GetProxy()->AllocateFromBranchPool(GetPluginHandle(), a_size); + return GetProxy().AllocateFromBranchPool(GetPluginHandle(), a_size); } void* TrampolineInterface::AllocateFromLocalPool(std::size_t a_size) const { - return GetProxy()->AllocateFromLocalPool(GetPluginHandle(), a_size); - } - - const detail::SKSETrampolineInterface* TrampolineInterface::GetProxy() const - { - assert(this); - return reinterpret_cast(this); + return GetProxy().AllocateFromLocalPool(GetPluginHandle(), a_size); } -#ifdef SKYRIM_SUPPORT_AE const PluginVersionData* PluginVersionData::GetSingleton() noexcept { return reinterpret_cast(REX::W32::GetProcAddress(REX::W32::GetCurrentModule(), "SKSEPlugin_Version")); } -#endif } diff --git a/src/SKSE/Logger.cpp b/src/SKSE/Logger.cpp index 2fc72cd04..efd4aa477 100644 --- a/src/SKSE/Logger.cpp +++ b/src/SKSE/Logger.cpp @@ -9,9 +9,6 @@ #include "SKSE/API.h" -#include -#include - namespace SKSE { namespace Impl @@ -36,16 +33,16 @@ namespace SKSE if (a_event && a_event->errorMsg && std::regex_search(a_event->errorMsg, _filter)) { switch (a_event->severity) { case Severity::kInfo: - log::info("{}"sv, a_event->errorMsg); + REX::INFO("{}"sv, a_event->errorMsg); break; case Severity::kWarning: - log::warn("{}"sv, a_event->errorMsg); + REX::WARN("{}"sv, a_event->errorMsg); break; case Severity::kError: - log::error("{}"sv, a_event->errorMsg); + REX::ERROR("{}"sv, a_event->errorMsg); break; case Severity::kFatal: - log::critical("{}"sv, a_event->errorMsg); + REX::CRITICAL("{}"sv, a_event->errorMsg); break; } } @@ -74,7 +71,7 @@ namespace SKSE 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); + REX::ERROR("failed to get known folder path"sv); return std::nullopt; } @@ -116,34 +113,5 @@ namespace SKSE } }); } - - void init() - { - // remove ifdef if 1.5.x support is removed -#ifdef SKYRIM_SUPPORT_AE - auto path = log_directory(); - if (!path) { - return; - } - - *path /= std::format("{}.log", SKSE::GetPluginName()); - - std::vector sinks{ - std::make_shared(path->string(), true), - std::make_shared() - }; - - auto logger = std::make_shared("global", sinks.begin(), sinks.end()); -# ifndef NDEBUG - logger->set_level(spdlog::level::debug); - logger->flush_on(spdlog::level::debug); -# else - logger->set_level(spdlog::level::info); - logger->flush_on(spdlog::level::info); -# endif - spdlog::set_default_logger(std::move(logger)); - spdlog::set_pattern("[%T.%e] [%=5t] [%L] %v"); -#endif - } } } diff --git a/src/SKSE/RegistrationSet.cpp b/src/SKSE/RegistrationSet.cpp index 20d4ddbc5..cf31a789f 100644 --- a/src/SKSE/RegistrationSet.cpp +++ b/src/SKSE/RegistrationSet.cpp @@ -149,7 +149,7 @@ namespace SKSE { assert(a_intfc); if (!a_intfc->OpenRecord(a_type, a_version)) { - log::error("Failed to open record"); + REX::ERROR("Failed to open record"); return false; } @@ -162,13 +162,13 @@ namespace SKSE Locker locker(_lock); const std::size_t numRegs = _handles.size(); if (!a_intfc->WriteRecordData(numRegs)) { - log::error("Failed to save number of regs ({})", numRegs); + REX::ERROR("Failed to save number of regs ({})", numRegs); return false; } for (auto& handle : _handles) { if (!a_intfc->WriteRecordData(handle)) { - log::error("Failed to save reg ({})", handle); + REX::ERROR("Failed to save reg ({})", handle); return false; } } @@ -207,14 +207,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy"); + REX::ERROR("Failed to get handle policy"); return false; } const auto invalidHandle = policy->EmptyHandle(); const auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle"); + REX::ERROR("Failed to create handle"); return false; } @@ -235,14 +235,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } auto invalidHandle = policy->EmptyHandle(); auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return false; } @@ -262,7 +262,7 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } diff --git a/src/SKSE/RegistrationSetUnique.cpp b/src/SKSE/RegistrationSetUnique.cpp index 3fdf73140..b86bc6d7f 100644 --- a/src/SKSE/RegistrationSetUnique.cpp +++ b/src/SKSE/RegistrationSetUnique.cpp @@ -202,7 +202,7 @@ namespace SKSE { assert(a_intfc); if (!a_intfc->OpenRecord(a_type, a_version)) { - log::error("Failed to open record"); + REX::ERROR("Failed to open record"); return false; } @@ -216,23 +216,23 @@ namespace SKSE Locker locker(_lock); const std::size_t numUniqueHandles = _regs.size(); if (!a_intfc->WriteRecordData(numUniqueHandles)) { - log::error("Failed to save unique handle count ({})", numUniqueHandles); + REX::ERROR("Failed to save unique handle count ({})", numUniqueHandles); return false; } for (auto& [formID, handleSet] : _regs) { if (!a_intfc->WriteRecordData(formID)) { - log::error("Failed to save target formID ({:X})", formID); + REX::ERROR("Failed to save target formID ({:X})", formID); return false; } const std::size_t numHandles = handleSet.size(); if (!a_intfc->WriteRecordData(numHandles)) { - log::error("Failed to save handle count ({})", numHandles); + REX::ERROR("Failed to save handle count ({})", numHandles); return false; } for (auto& handle : handleSet) { if (!a_intfc->WriteRecordData(handle)) { - log::error("Failed to save reg handle ({})", handle); + REX::ERROR("Failed to save reg handle ({})", handle); return false; } } @@ -258,7 +258,7 @@ namespace SKSE for (std::size_t i = 0; i < numUniqueHandles; ++i) { a_intfc->ReadRecordData(formID); if (!a_intfc->ResolveFormID(formID, formID)) { - log::warn("Error reading formID ({:X})", formID); + REX::WARN("Error reading formID ({:X})", formID); continue; } a_intfc->ReadRecordData(numHandles); @@ -284,14 +284,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy"); + REX::ERROR("Failed to get handle policy"); return false; } const auto invalidHandle = policy->EmptyHandle(); const auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle"); + REX::ERROR("Failed to create handle"); return false; } @@ -312,14 +312,14 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } auto invalidHandle = policy->EmptyHandle(); auto handle = policy->GetHandleForObject(a_typeID, a_object); if (handle == invalidHandle) { - log::error("Failed to create handle!"); + REX::ERROR("Failed to create handle!"); return false; } @@ -338,7 +338,7 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } @@ -358,7 +358,7 @@ namespace SKSE auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton(); auto policy = vm ? vm->GetObjectHandlePolicy() : nullptr; if (!policy) { - log::error("Failed to get handle policy!"); + REX::ERROR("Failed to get handle policy!"); return false; } diff --git a/src/SKSE/Trampoline.cpp b/src/SKSE/Trampoline.cpp deleted file mode 100644 index 67ada4d5e..000000000 --- a/src/SKSE/Trampoline.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "SKSE/Trampoline.h" - -#include "SKSE/Logger.h" - -#include "REX/W32/KERNEL32.h" - -// xbyak brings in -#ifdef SKSE_SUPPORT_XBYAK -# include -# undef max -# undef MEM_COMMIT -# undef MEM_FREE -# undef MEM_RELEASE -# undef MEM_RESERVE -# undef PAGE_EXECUTE_READWRITE -#endif - -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) - { - auto result = do_allocate(a_code.getSize()); - log_stats(); - std::memcpy(result, a_code.getCode(), a_code.getSize()); - return result; - } -#endif - - // https://stackoverflow.com/a/54732489 - void* Trampoline::do_create(std::size_t a_size, std::uintptr_t a_address) - { - constexpr std::size_t gigabyte = static_cast(1) << 30; - constexpr std::size_t minRange = gigabyte * 2; - constexpr std::uintptr_t maxAddr = std::numeric_limits::max(); - - REX::W32::SYSTEM_INFO si; - REX::W32::GetSystemInfo(&si); - const std::uint32_t granularity = si.allocationGranularity; - - std::uintptr_t min = a_address >= minRange ? detail::roundup(a_address - minRange, granularity) : 0; - const std::uintptr_t max = a_address < (maxAddr - minRange) ? detail::rounddown(a_address + minRange, granularity) : maxAddr; - - REX::W32::MEMORY_BASIC_INFORMATION mbi; - do { - if (!REX::W32::VirtualQuery(reinterpret_cast(min), std::addressof(mbi), sizeof(mbi))) { - log::error("VirtualQuery failed with code: 0x{:08X}"sv, REX::W32::GetLastError()); - return nullptr; - } - - const auto baseAddr = reinterpret_cast(mbi.baseAddress); - min = baseAddr + mbi.regionSize; - - if (mbi.state == REX::W32::MEM_FREE) { - const std::uintptr_t addr = 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) { - 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; - } - log::warn("VirtualAlloc failed with code: 0x{:08X}"sv, REX::W32::GetLastError()); - } - } - } while (min < max); - - 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; - } -} diff --git a/src/SKSE/Translation.cpp b/src/SKSE/Translation.cpp index 2a3c2b668..d0a44d30b 100644 --- a/src/SKSE/Translation.cpp +++ b/src/SKSE/Translation.cpp @@ -48,7 +48,7 @@ namespace SKSE const auto scaleformTranslator = skyrim_cast(translator); if (!scaleformTranslator) { - log::warn("Failed to import translation for {}"sv, a_name); + REX::WARN("Failed to import translation for {}"sv, a_name); return; } @@ -64,7 +64,7 @@ namespace SKSE if (!fileStream.good()) { return; } else { - log::info("Reading translations from {}..."sv, path); + REX::INFO("Reading translations from {}..."sv, path); } // Check if file is empty, if not check if the BOM is UTF-16 @@ -72,11 +72,11 @@ namespace SKSE std::uint64_t read; fileStream.stream->DoRead(&bom, sizeof(std::uint16_t), read); if (read == 0) { - log::warn("Empty translation file."sv); + REX::WARN("Empty translation file."sv); return; } if (bom != 0xFEFF) { - log::error("BOM Error, file must be encoded in UCS-2 LE."sv); + REX::ERROR("BOM Error, file must be encoded in UCS-2 LE."sv); return; } @@ -129,7 +129,7 @@ namespace SKSE const auto translator = loader ? loader->GetStateAddRef(RE::GFxState::StateType::kTranslator) : nullptr; if (!translator) { - log::warn("Failed to get Scaleform translator"sv); + REX::WARN("Failed to get Scaleform translator"sv); return false; } @@ -163,9 +163,10 @@ namespace SKSE } // Lookup translation - std::wstring key_utf16 = stl::utf8_to_utf16(key).value_or(L""s); - RE::GFxWStringBuffer result; + std::wstring key_utf16{}; + REX::UTF8_TO_UTF16(key, key_utf16); + RE::GFxWStringBuffer result; RE::GFxTranslator::TranslateInfo translateInfo; translateInfo.key = key_utf16.c_str(); translateInfo.result = std::addressof(result); @@ -175,7 +176,8 @@ namespace SKSE return false; } - std::string result_utf8 = stl::utf16_to_utf8(result.c_str()).value_or(""s); + std::string result_utf8{}; + REX::UTF16_TO_UTF8(result.c_str(), result_utf8); // Replace tokens with nested translations from right to left auto pos = result_utf8.rfind("{}"s); diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 457ac1957..000000000 --- a/vcpkg.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "commonlibsse", - "version-string": "1", - "description": "A reverse engineered resource for developing F4SE plugins for Skyrim Special Edition", - "homepage": "https://github.com/Ryan-rsm-McKenzie/CommonLibSSE", - "license": "MIT", - "supports": "windows & x64", - "dependencies": [ - "rsm-binary-io", - "spdlog" - ] -} diff --git a/xmake.lua b/xmake.lua index b94d8cbb3..e78ba1bc7 100644 --- a/xmake.lua +++ b/xmake.lua @@ -8,6 +8,9 @@ set_languages("c++23") set_warnings("allextra") set_encodings("utf-8") +-- add repositories +add_repositories("libxse-xrepo https://github.com/libxse/libxse-xrepo") + -- add rules add_rules("mode.debug", "mode.releasedbg") @@ -15,55 +18,39 @@ add_rules("mode.debug", "mode.releasedbg") includes("xmake-rules.lua") -- define options -option("rex_ini", function() +option("commonlib_ini", function() set_default(false) - set_description("Enable ini config support for REX") - add_defines("REX_OPTION_INI=1") + set_description("enable REX::INI settings support") end) -option("rex_json", function() +option("commonlib_json", function() set_default(false) - set_description("Enable json config support for REX") - add_defines("REX_OPTION_JSON=1") + set_description("enable REX::JSON settings support") end) -option("rex_toml", function() +option("commonlib_toml", function() set_default(false) - set_description("Enable toml config support for REX") - add_defines("REX_OPTION_TOML=1") + set_description("enable REX::TOML settings support") end) -option("skyrim_ae", function() +option("commonlib_xbyak", function() set_default(false) - set_description("Enable support for Skyrim AE") - add_defines("SKYRIM_SUPPORT_AE=1") + set_description("enable xbyak support for trampoline") end) -option("skse_xbyak", function() +option("skyrim_ae", function() set_default(false) - set_description("Enable trampoline support for Xbyak") - add_defines("SKSE_SUPPORT_XBYAK=1") + set_description("enable support for Skyrim AE") + add_defines("SKYRIM_SUPPORT_AE=1") end) -- require packages -add_requires("rsm-binary-io") -add_requires("spdlog", { configs = { header_only = false, wchar = true, std_format = true } }) - -if has_config("rex_ini") then - add_requires("simpleini") -end - -if has_config("rex_json") then - add_requires("nlohmann_json") -end - -if has_config("rex_toml") then - add_requires("toml11") -end - -if has_config("skse_xbyak") then - add_requires("xbyak") -end +add_requires("commonlib-shared 9f05bd7de2c8cdbbc3f15128f17e5f7b1c72bce0", { configs = { + ini = has_config("commonlib_ini"), + json = has_config("commonlib_json"), + toml = has_config("commonlib_toml"), + xbyak = has_config("commonlib_xbyak") +} }) -- define targets target("commonlibsse", function() @@ -74,29 +61,10 @@ target("commonlibsse", function() set_default(os.scriptdir() == os.projectdir()) -- add packages - add_packages("rsm-binary-io", "spdlog", { public = true }) - - if has_config("rex_ini") then - add_packages("simpleini", { public = true }) - end - - if has_config("rex_json") then - add_packages("nlohmann_json", { public = true }) - end - - if has_config("rex_toml") then - add_packages("toml11", { public = true }) - end - - if has_config("skse_xbyak") then - add_packages("xbyak", { public = true }) - end + add_packages("commonlib-shared", { public = true }) -- add options - add_options("rex_ini", "rex_json", "rex_toml", "skyrim_ae", "skse_xbyak", { public = true }) - - -- add system links - add_syslinks("advapi32", "bcrypt", "d3d11", "d3dcompiler", "dbghelp", "dxgi", "ole32", "shell32", "user32", "version") + add_options("skyrim_ae", { public = true }) -- add source files add_files("src/**.cpp") @@ -105,11 +73,12 @@ target("commonlibsse", function() add_includedirs("include", { public = true }) add_headerfiles( "include/(RE/**.h)", - "include/(REL/**.h)", - "include/(REX/**.h)", "include/(SKSE/**.h)" ) + -- add extra files + add_extrafiles("res/commonlibsse.natvis") + -- set precompiled header set_pcxxheader("include/SKSE/Impl/PCH.h")