From 2de36f3f48ea3f68f1a0ab3b6f08c48a456643a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=20=E6=9D=B0?= Date: Thu, 5 Jun 2025 10:55:16 +0800 Subject: [PATCH] 1 --- .gitattributes | 63 + .gitignore | 363 + ScreenRecoder.sln | 31 + ScreenRecoder/CursorData.h | 614 + ScreenRecoder/D3DX11.h | 74 + ScreenRecoder/D3DX11async.h | 164 + ScreenRecoder/D3DX11core.h | 128 + ScreenRecoder/D3DX11tex.h | 772 + ScreenRecoder/DXGIDuplicator.cpp | 190 + ScreenRecoder/DXGIDuplicator.h | 32 + ScreenRecoder/Delogo.ico | Bin 0 -> 16958 bytes ScreenRecoder/ImGui/imconfig.h | 136 + ScreenRecoder/ImGui/imgui.cpp | 16263 ++++++++++++++++++ ScreenRecoder/ImGui/imgui.h | 3643 ++++ ScreenRecoder/ImGui/imgui_demo.cpp | 10316 +++++++++++ ScreenRecoder/ImGui/imgui_draw.cpp | 4634 +++++ ScreenRecoder/ImGui/imgui_impl_dx10.cpp | 590 + ScreenRecoder/ImGui/imgui_impl_dx10.h | 32 + ScreenRecoder/ImGui/imgui_impl_dx11.cpp | 606 + ScreenRecoder/ImGui/imgui_impl_dx11.h | 33 + ScreenRecoder/ImGui/imgui_impl_dx12.cpp | 762 + ScreenRecoder/ImGui/imgui_impl_dx12.h | 46 + ScreenRecoder/ImGui/imgui_impl_dx9.cpp | 411 + ScreenRecoder/ImGui/imgui_impl_dx9.h | 32 + ScreenRecoder/ImGui/imgui_impl_win32.cpp | 925 + ScreenRecoder/ImGui/imgui_impl_win32.h | 53 + ScreenRecoder/ImGui/imgui_internal.h | 3712 ++++ ScreenRecoder/ImGui/imgui_tables.cpp | 4451 +++++ ScreenRecoder/ImGui/imgui_widgets.cpp | 10169 +++++++++++ ScreenRecoder/ImGui/imstb_rectpack.h | 627 + ScreenRecoder/ImGui/imstb_textedit.h | 1441 ++ ScreenRecoder/ImGui/imstb_truetype.h | 5085 ++++++ ScreenRecoder/ImHelper.cpp | 191 + ScreenRecoder/ImHelper.h | 28 + ScreenRecoder/List.natvis | 18 + ScreenRecoder/ScreenRecoder.cpp | 588 + ScreenRecoder/ScreenRecoder.rc | Bin 0 -> 3228 bytes ScreenRecoder/ScreenRecoder.vcxproj | 304 + ScreenRecoder/ScreenRecoder.vcxproj.filters | 436 + ScreenRecoder/d3dx11.lib | Bin 0 -> 13786 bytes ScreenRecoder/resource.h | 16 + 41 files changed, 67979 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 ScreenRecoder.sln create mode 100644 ScreenRecoder/CursorData.h create mode 100644 ScreenRecoder/D3DX11.h create mode 100644 ScreenRecoder/D3DX11async.h create mode 100644 ScreenRecoder/D3DX11core.h create mode 100644 ScreenRecoder/D3DX11tex.h create mode 100644 ScreenRecoder/DXGIDuplicator.cpp create mode 100644 ScreenRecoder/DXGIDuplicator.h create mode 100644 ScreenRecoder/Delogo.ico create mode 100644 ScreenRecoder/ImGui/imconfig.h create mode 100644 ScreenRecoder/ImGui/imgui.cpp create mode 100644 ScreenRecoder/ImGui/imgui.h create mode 100644 ScreenRecoder/ImGui/imgui_demo.cpp create mode 100644 ScreenRecoder/ImGui/imgui_draw.cpp create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx10.cpp create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx10.h create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx11.cpp create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx11.h create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx12.cpp create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx12.h create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx9.cpp create mode 100644 ScreenRecoder/ImGui/imgui_impl_dx9.h create mode 100644 ScreenRecoder/ImGui/imgui_impl_win32.cpp create mode 100644 ScreenRecoder/ImGui/imgui_impl_win32.h create mode 100644 ScreenRecoder/ImGui/imgui_internal.h create mode 100644 ScreenRecoder/ImGui/imgui_tables.cpp create mode 100644 ScreenRecoder/ImGui/imgui_widgets.cpp create mode 100644 ScreenRecoder/ImGui/imstb_rectpack.h create mode 100644 ScreenRecoder/ImGui/imstb_textedit.h create mode 100644 ScreenRecoder/ImGui/imstb_truetype.h create mode 100644 ScreenRecoder/ImHelper.cpp create mode 100644 ScreenRecoder/ImHelper.h create mode 100644 ScreenRecoder/List.natvis create mode 100644 ScreenRecoder/ScreenRecoder.cpp create mode 100644 ScreenRecoder/ScreenRecoder.rc create mode 100644 ScreenRecoder/ScreenRecoder.vcxproj create mode 100644 ScreenRecoder/ScreenRecoder.vcxproj.filters create mode 100644 ScreenRecoder/d3dx11.lib create mode 100644 ScreenRecoder/resource.h diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9491a2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,363 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd \ No newline at end of file diff --git a/ScreenRecoder.sln b/ScreenRecoder.sln new file mode 100644 index 0000000..21eddaf --- /dev/null +++ b/ScreenRecoder.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35312.102 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScreenRecoder", "ScreenRecoder\ScreenRecoder.vcxproj", "{F70F08D0-3A56-4E00-9941-A7B95D07EF2F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Debug|x64.ActiveCfg = Debug|x64 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Debug|x64.Build.0 = Debug|x64 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Debug|x86.ActiveCfg = Debug|Win32 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Debug|x86.Build.0 = Debug|Win32 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Release|x64.ActiveCfg = Release|x64 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Release|x64.Build.0 = Release|x64 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Release|x86.ActiveCfg = Release|Win32 + {F70F08D0-3A56-4E00-9941-A7B95D07EF2F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FAD60BC3-1307-4DAB-8F22-F5B51948EBC7} + EndGlobalSection +EndGlobal diff --git a/ScreenRecoder/CursorData.h b/ScreenRecoder/CursorData.h new file mode 100644 index 0000000..1156fed --- /dev/null +++ b/ScreenRecoder/CursorData.h @@ -0,0 +1,614 @@ +#pragma once +typedef struct CursorDefine +{ + bool Center; + const unsigned int Data[32]; +}; +const CursorDefine _CURSOR_32512 = +{ +false, +{ +0b00000000000000000000000000000000, +0b10000000000000000000000000000000, +0b11000000000000000000000000000000, +0b11100000000000000000000000000000, +0b11110000000000000000000000000000, +0b11111000000000000000000000000000, +0b11111100000000000000000000000000, +0b11111110000000000000000000000000, +0b11111111000000000000000000000000, +0b11111111100000000000000000000000, +0b11111111110000000000000000000000, +0b11111111111000000000000000000000, +0b11111111111100000000000000000000, +0b11111110000000000000000000000000, +0b11111110000000000000000000000000, +0b11001111000000000000000000000000, +0b10000111000000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000011110000000000000000000000, +0b00000001100000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32513 = +{ +false, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000001110111000000000000, +0b00000000000001111111000000000000, +0b00000000000001111111000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000000011100000000000000, +0b00000000000001111111000000000000, +0b00000000000001110111000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32514 = +{ +false, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000011111111111111000000000, +0b00000000011111111111111000000000, +0b00000000011111111111111000000000, +0b00000000011111111111110000000000, +0b00000000011111111111110000000000, +0b00000000011111111111110000000000, +0b00000000011111111111110000000000, +0b00000000000111111111100000000000, +0b00000000000111111111000000000000, +0b00000000000001111110000000000000, +0b00000000000001111100000000000000, +0b00000000000001111100000000000000, +0b00000000000001111110000000000000, +0b00000000000011111111000000000000, +0b00000000000111111111100000000000, +0b00000000001111111111110000000000, +0b00000000011111111111110000000000, +0b00000000011111111111110000000000, +0b00000000011111111111110000000000, +0b00000000011111111111110000000000, +0b00000000011111111111111000000000, +0b00000000011111111111111000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32515 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000001111111111111111100000000, +0b00000001111111111111111100000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32516 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000010000000000000000, +0b00000000000000011000000000000000, +0b00000000000001111100000000000000, +0b00000000000001111110000000000000, +0b00000000000111111111000000000000, +0b00000000000111111111100000000000, +0b00000000000111111111100000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32642 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000011111000000000000000000, +0b00000000011111000000000000000000, +0b00000000011111000000000000000000, +0b00000000011111000000000000000000, +0b00000000011111100000000000000000, +0b00000000000001110000000000000000, +0b00000000000000111000000000000000, +0b00000000000000011100000000000000, +0b00000000000000001110010000000000, +0b00000000000000000111110000000000, +0b00000000000000000011110000000000, +0b00000000000000000011110000000000, +0b00000000000000000111110000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32643 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000111110000000000, +0b00000000000000000111110000000000, +0b00000000000000000011110000000000, +0b00000000000000000011110000000000, +0b00000000000000000111110000000000, +0b00000000000000001100000000000000, +0b00000000000000011100000000000000, +0b00000000000000110000000000000000, +0b00000000011001110000000000000000, +0b00000000011111000000000000000000, +0b00000000011111000000000000000000, +0b00000000011111000000000000000000, +0b00000000011111000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32644 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000011000000000011000000000, +0b00000000111000000000011100000000, +0b00000001111111111111111110000000, +0b00000001111111111111111100000000, +0b00000000111000000000011100000000, +0b00000000011000000000010000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32645 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000010000000000000000, +0b00000000000000011000000000000000, +0b00000000000001111100000000000000, +0b00000000000001111110000000000000, +0b00000000000001111110000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000001111110000000000000, +0b00000000000001111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000010000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32646 = +{ +true, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000011000000000000000, +0b00000000000000111100000000000000, +0b00000000000001111110000000000000, +0b00000000000001111110000000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000011000011000011000000000, +0b00000000111000011000011100000000, +0b00000001111111111111111110000000, +0b00000001111111111111111100000000, +0b00000000111000011000011100000000, +0b00000000011000011000010000000000, +0b00000000000000011000000000000000, +0b00000000000000011000000000000000, +0b00000000000001111110000000000000, +0b00000000000001111100000000000000, +0b00000000000000111100000000000000, +0b00000000000000010000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32648 = +{ +false, +{ +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000001111110000000000000, +0b00000000000111111111110000000000, +0b00000000001111111111110000000000, +0b00000000011111111111111100000000, +0b00000000111110000001111100000000, +0b00000001111111000000011110000000, +0b00000001111111000000001111000000, +0b00000011111111110000001111000000, +0b00000011110111110000000111000000, +0b00000011110011111100000111000000, +0b00000011110001111100000111000000, +0b00000011110000111111000111000000, +0b00000011110000011111001111000000, +0b00000001111000001111111111000000, +0b00000001111000000111111110000000, +0b00000001111110000011111110000000, +0b00000000011111000011111100000000, +0b00000000011111111111111000000000, +0b00000000000111111111110000000000, +0b00000000000011111111000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32649 = +{ +false, +{ +0b00000011000000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000111110000000000000000000000, +0b00000111111110000000000000000000, +0b00000111111111110000000000000000, +0b00000111111111111000000000000000, +0b00000111111111111000000000000000, +0b00000111111111111000000000000000, +0b11110111111111111000000000000000, +0b11111111111111111000000000000000, +0b11111111111111111000000000000000, +0b01111111111111111000000000000000, +0b00111111111111111000000000000000, +0b00011111111111111000000000000000, +0b00001111111111110000000000000000, +0b00000111111111110000000000000000, +0b00000111111111110000000000000000, +0b00000001111111000000000000000000, +0b00000000011110000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32650 = +{ +false, +{ +0b00000000000000000000000000000000, +0b11000000000000000000000000000000, +0b11000000000000000000000000000000, +0b11110000000011111111100000000000, +0b11110000000011111111100000000000, +0b11111100000011111111100000000000, +0b11111100000001111111000000000000, +0b11111111000001111111000000000000, +0b11111111000001111111000000000000, +0b11111111110001111111000000000000, +0b11111111110000011100000000000000, +0b11111111111100111110000000000000, +0b11111111111101111111000000000000, +0b11111111000001111111000000000000, +0b11101111000001111111000000000000, +0b11000111000001111111000000000000, +0b10000111100011111111100000000000, +0b00000111110011111111100000000000, +0b00000011110000000000000000000000, +0b00000001110000000000000000000000, +0b00000001110000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32651 = +{ +false, +{ +0b00000000000000000000000000000000, +0b11000000000000000000000000000000, +0b11000000000000000000000000000000, +0b11110000000000000000000000000000, +0b11110000000000000000000000000000, +0b11111100000011111111000000000000, +0b11111100000111111111000000000000, +0b11111111000111101111100000000000, +0b11111111000111101111100000000000, +0b11111111110111101111100000000000, +0b11111111110111111111000000000000, +0b11111111111100111110000000000000, +0b11111111111100111100000000000000, +0b11111111000000111100000000000000, +0b11101111000000011100000000000000, +0b11000111000001111110000000000000, +0b10000111100000111100000000000000, +0b00000111110000011100000000000000, +0b00000011110000000000000000000000, +0b00000001110000000000000000000000, +0b00000001110000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +0b00000000000000000000000000000000, +} +}; +const CursorDefine _CURSOR_32671 = +{ +false, +{ +0b00000001100000000000000000000000, +0b00000011110000000000000000000000, +0b00000011110000000000000000000000, +0b00000011110000000000000000000000, +0b00000011110000000000000000000000, +0b00000011111100000000000000000000, +0b00000011111111100000000000000000, +0b00000011111111111100000000000000, +0b00000011111111111100000000000000, +0b00000011111111111100000000000000, +0b00000011111111111100000000000000, +0b01111011111111111100000000000000, +0b01111111111111111100000000000000, +0b01111111111111111100000000000000, +0b01111111111111111100000000000000, +0b00111111111111111100000000000000, +0b00011111111111111100000000000000, +0b00001111111111111101111110000000, +0b00001111111111111001111111000000, +0b00000111111111111111111111100000, +0b00000011111111111111111111100000, +0b00000000111111100111111111100000, +0b00000000000100000111111111100000, +0b00000000000000000111111111100000, +0b00000000000000000111111111100000, +0b00000000000000000011111111000000, +0b00000000000000000001111111000000, +0b00000000000000000001111110000000, +0b00000000000000000001111110000000, +0b00000000000000000000011100000000, +0b00000000000000000000011100000000, +0b00000000000000000000011000000000, +} +}; +const CursorDefine _CURSOR_32672 = +{ +false, +{ +0b00000011000000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000111100000000000000000000000, +0b00000111111010000000000000000000, +0b00000111111111000000000000000000, +0b00000111111111111000000000000000, +0b00000111111111111000000000000000, +0b00000111111111111000000000000000, +0b01100111111111111000000000000000, +0b11111111111111111000000000000000, +0b11111111111111111000000000000000, +0b01111111111111111000000000000000, +0b01111111111111111000000000000000, +0b00111111111111111000000000000000, +0b00011111111111111000000000000000, +0b00001111111111110001111110000000, +0b00000111111111110001111110000000, +0b00000011111111100011111111000000, +0b00000001111111000011111111000000, +0b00000000000000000011111111000000, +0b00000000000000000011111111000000, +0b00000000000000000001111110000000, +0b00000000000000000001111110000000, +0b00000000000000000011111111100000, +0b00000000000000000111111111100000, +0b00000000000000000111111111100000, +0b00000000000000000111111111110000, +0b00000000000000001111111111110000, +0b00000000000000000111111111100000, +0b00000000000000000001111111000000, +} +}; \ No newline at end of file diff --git a/ScreenRecoder/D3DX11.h b/ScreenRecoder/D3DX11.h new file mode 100644 index 0000000..103c782 --- /dev/null +++ b/ScreenRecoder/D3DX11.h @@ -0,0 +1,74 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx11.h +// Content: D3DX11 utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX11_INTERNAL__ +#error Incorrect D3DX11 header used +#endif + +#ifndef __D3DX11_H__ +#define __D3DX11_H__ + + +// Defines +#include +#include + +#ifdef ALLOW_THROWING_NEW +#include +#endif + +#define D3DX11_DEFAULT ((UINT) -1) +#define D3DX11_FROM_FILE ((UINT) -3) +#define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3) + +#ifndef D3DX11INLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DX11INLINE __forceinline + #else + #define D3DX11INLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DX11INLINE inline + #else + #define D3DX11INLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d11.h" +#include "d3dx11.h" +#include "d3dx11core.h" +#include "d3dx11tex.h" +#include "d3dx11async.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DX11_ERR { + D3DX11_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900), + D3DX11_ERR_INVALID_MESH = MAKE_DDHRESULT(2901), + D3DX11_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902), + D3DX11_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903), + D3DX11_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904), + D3DX11_ERR_INVALID_DATA = MAKE_DDHRESULT(2905), + D3DX11_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906), + D3DX11_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907), + D3DX11_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX11_H__ + diff --git a/ScreenRecoder/D3DX11async.h b/ScreenRecoder/D3DX11async.h new file mode 100644 index 0000000..4586c55 --- /dev/null +++ b/ScreenRecoder/D3DX11async.h @@ -0,0 +1,164 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3DX11Async.h +// Content: D3DX11 Asynchronous Shader loaders / compilers +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX11ASYNC_H__ +#define __D3DX11ASYNC_H__ + +#include "d3dx11.h" + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DX11Compile: +// ------------------ +// Compiles an effect or shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0", +// "vs_3_sw", "vs_4_0", "vs_4_1", +// "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", +// "ps_3_sw", "ps_4_0", "ps_4_1", +// "gs_4_0", "gs_4_1", +// "tx_1_0", +// "fx_4_0", "fx_4_1" +// Note that this entrypoint does not compile fx_2_0 targets, for that +// you need to use the D3DX9 function. +// Flags1 +// See D3D10_SHADER_xxx flags. +// Flags2 +// See D3D10_EFFECT_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3D10GetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX11CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CompileFromFile D3DX11CompileFromFileW +#else +#define D3DX11CompileFromFile D3DX11CompileFromFileA +#endif + +HRESULT WINAPI D3DX11CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CompileFromResource D3DX11CompileFromResourceW +#else +#define D3DX11CompileFromResource D3DX11CompileFromResourceA +#endif + +HRESULT WINAPI D3DX11CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11PreprocessShaderFromFile D3DX11PreprocessShaderFromFileW +#define D3DX11PreprocessShaderFromResource D3DX11PreprocessShaderFromResourceW +#else +#define D3DX11PreprocessShaderFromFile D3DX11PreprocessShaderFromFileA +#define D3DX11PreprocessShaderFromResource D3DX11PreprocessShaderFromResourceA +#endif + +//---------------------------------------------------------------------------- +// Async processors +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX11CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, + ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX11DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX11CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX11DataProcessor **ppProcessor); + +//---------------------------------------------------------------------------- +// D3DX11 Asynchronous texture I/O (advanced mode) +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX11CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX11DataLoader **ppDataLoader); + +#ifdef UNICODE +#define D3DX11CreateAsyncFileLoader D3DX11CreateAsyncFileLoaderW +#define D3DX11CreateAsyncResourceLoader D3DX11CreateAsyncResourceLoaderW +#else +#define D3DX11CreateAsyncFileLoader D3DX11CreateAsyncFileLoaderA +#define D3DX11CreateAsyncResourceLoader D3DX11CreateAsyncResourceLoaderA +#endif + +HRESULT WINAPI D3DX11CreateAsyncTextureProcessor(ID3D11Device *pDevice, D3DX11_IMAGE_LOAD_INFO *pLoadInfo, ID3DX11DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX11CreateAsyncTextureInfoProcessor(D3DX11_IMAGE_INFO *pImageInfo, ID3DX11DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX11CreateAsyncShaderResourceViewProcessor(ID3D11Device *pDevice, D3DX11_IMAGE_LOAD_INFO *pLoadInfo, ID3DX11DataProcessor **ppDataProcessor); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX11ASYNC_H__ + + diff --git a/ScreenRecoder/D3DX11core.h b/ScreenRecoder/D3DX11core.h new file mode 100644 index 0000000..18e9935 --- /dev/null +++ b/ScreenRecoder/D3DX11core.h @@ -0,0 +1,128 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx11core.h +// Content: D3DX11 core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx11.h" + +#ifndef __D3DX11CORE_H__ +#define __D3DX11CORE_H__ + +// Current name of the DLL shipped in the same SDK as this header. + + +#define D3DX11_DLL_W L"d3dx11_43.dll" +#define D3DX11_DLL_A "d3dx11_43.dll" + +#ifdef UNICODE + #define D3DX11_DLL D3DX11_DLL_W +#else + #define D3DX11_DLL D3DX11_DLL_A +#endif + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// +// D3DX11_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DX11CheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DX11CreateVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + + +#define D3DX11_SDK_VERSION 43 + + +#ifdef D3D_DIAG_DLL +BOOL WINAPI D3DX11DebugMute(BOOL Mute); +#endif +HRESULT WINAPI D3DX11CheckVersion(UINT D3DSdkVersion, UINT D3DX11SdkVersion); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX11ThreadPump: +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DX11DataLoader + +DECLARE_INTERFACE(ID3DX11DataLoader) +{ + STDMETHOD(Load)(THIS) PURE; + STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE ID3DX11DataProcessor + +DECLARE_INTERFACE(ID3DX11DataProcessor) +{ + STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE; + STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +// {C93FECFA-6967-478a-ABBC-402D90621FCB} +DEFINE_GUID(IID_ID3DX11ThreadPump, +0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb); + +#undef INTERFACE +#define INTERFACE ID3DX11ThreadPump + +DECLARE_INTERFACE_(ID3DX11ThreadPump, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX11ThreadPump + STDMETHOD(AddWorkItem)(THIS_ ID3DX11DataLoader *pDataLoader, ID3DX11DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE; + STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE; + + STDMETHOD(WaitForAllItems)(THIS) PURE; + STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount); + + STDMETHOD(PurgeAllItems)(THIS) PURE; + STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE; + +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI D3DX11CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX11ThreadPump **ppThreadPump); + +HRESULT WINAPI D3DX11UnsetAllDeviceObjects(ID3D11DeviceContext *pContext); + +#ifdef __cplusplus +} +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// + +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) + +#endif //__D3DX11CORE_H__ + diff --git a/ScreenRecoder/D3DX11tex.h b/ScreenRecoder/D3DX11tex.h new file mode 100644 index 0000000..16c0409 --- /dev/null +++ b/ScreenRecoder/D3DX11tex.h @@ -0,0 +1,772 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx11tex.h +// Content: D3DX11 texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx11.h" + +#ifndef __D3DX11TEX_H__ +#define __D3DX11TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX11_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX11_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX11_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX11_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX11_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX11_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX11_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX11_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX11_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX11_FILTER_MIRROR +// Same as specifying D3DX11_FILTER_MIRROR_U | D3DX11_FILTER_MIRROR_V | +// D3DX11_FILTER_MIRROR_V +// D3DX11_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX11_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX11_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX11_FILTER_SRGB +// Same as specifying D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_FILTER_FLAG +{ + D3DX11_FILTER_NONE = (1 << 0), + D3DX11_FILTER_POINT = (2 << 0), + D3DX11_FILTER_LINEAR = (3 << 0), + D3DX11_FILTER_TRIANGLE = (4 << 0), + D3DX11_FILTER_BOX = (5 << 0), + + D3DX11_FILTER_MIRROR_U = (1 << 16), + D3DX11_FILTER_MIRROR_V = (2 << 16), + D3DX11_FILTER_MIRROR_W = (4 << 16), + D3DX11_FILTER_MIRROR = (7 << 16), + + D3DX11_FILTER_DITHER = (1 << 19), + D3DX11_FILTER_DITHER_DIFFUSION= (2 << 19), + + D3DX11_FILTER_SRGB_IN = (1 << 21), + D3DX11_FILTER_SRGB_OUT = (2 << 21), + D3DX11_FILTER_SRGB = (3 << 21), +} D3DX11_FILTER_FLAG; + +//---------------------------------------------------------------------------- +// D3DX11_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DX11ComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX11_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX11_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX11_NORMALMAP_MIRROR +// Same as specifying D3DX11_NORMALMAP_MIRROR_U | D3DX11_NORMALMAP_MIRROR_V +// D3DX11_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX11_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_NORMALMAP_FLAG +{ + D3DX11_NORMALMAP_MIRROR_U = (1 << 16), + D3DX11_NORMALMAP_MIRROR_V = (2 << 16), + D3DX11_NORMALMAP_MIRROR = (3 << 16), + D3DX11_NORMALMAP_INVERTSIGN = (8 << 16), + D3DX11_NORMALMAP_COMPUTE_OCCLUSION = (16 << 16), +} D3DX11_NORMALMAP_FLAG; + +//---------------------------------------------------------------------------- +// D3DX11_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX11_CHANNEL_RED +// Indicates the red channel should be used +// D3DX11_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX11_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX11_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX11_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_CHANNEL_FLAG +{ + D3DX11_CHANNEL_RED = (1 << 0), + D3DX11_CHANNEL_BLUE = (1 << 1), + D3DX11_CHANNEL_GREEN = (1 << 2), + D3DX11_CHANNEL_ALPHA = (1 << 3), + D3DX11_CHANNEL_LUMINANCE = (1 << 4), +} D3DX11_CHANNEL_FLAG; + + + +//---------------------------------------------------------------------------- +// D3DX11_IMAGE_FILE_FORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_IMAGE_FILE_FORMAT +{ + D3DX11_IFF_BMP = 0, + D3DX11_IFF_JPG = 1, + D3DX11_IFF_PNG = 3, + D3DX11_IFF_DDS = 4, + D3DX11_IFF_TIFF = 10, + D3DX11_IFF_GIF = 11, + D3DX11_IFF_WMP = 12, + D3DX11_IFF_FORCE_DWORD = 0x7fffffff + +} D3DX11_IMAGE_FILE_FORMAT; + + +//---------------------------------------------------------------------------- +// D3DX11_SAVE_TEXTURE_FLAG: +// --------------------- +// This enum is used to support texture saving options. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_SAVE_TEXTURE_FLAG +{ + D3DX11_STF_USEINPUTBLOB = 0x0001, +} D3DX11_SAVE_TEXTURE_FLAG; + + +//---------------------------------------------------------------------------- +// D3DX11_IMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// ArraySize +// Array size in textures +// MipLevels +// Number of mip levels in original image +// MiscFlags +// Miscellaneous flags +// Format +// D3D format which most closely describes the data in original image +// ResourceDimension +// D3D11_RESOURCE_DIMENSION representing the dimension of texture stored in the file. +// D3D11_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D +// ImageFileFormat +// D3DX11_IMAGE_FILE_FORMAT representing the format of the image file. +//---------------------------------------------------------------------------- + +typedef struct D3DX11_IMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT ArraySize; + UINT MipLevels; + UINT MiscFlags; + DXGI_FORMAT Format; + D3D11_RESOURCE_DIMENSION ResourceDimension; + D3DX11_IMAGE_FILE_FORMAT ImageFileFormat; +} D3DX11_IMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX11_IMAGE_LOAD_INFO: +// --------------- +// This structure can be optionally passed in to texture loader APIs to +// control how textures get loaded. Pass in D3DX11_DEFAULT for any of these +// to have D3DX automatically pick defaults based on the source file. +// +// Width +// Rescale texture to Width texels wide +// Height +// Rescale texture to Height texels high +// Depth +// Rescale texture to Depth texels deep +// FirstMipLevel +// First mip level to load +// MipLevels +// Number of mip levels to load after the first level +// Usage +// D3D11_USAGE flag for the new texture +// BindFlags +// D3D11 Bind flags for the new texture +// CpuAccessFlags +// D3D11 CPU Access flags for the new texture +// MiscFlags +// Reserved. Must be 0 +// Format +// Resample texture to the specified format +// Filter +// Filter the texture using the specified filter (only when resampling) +// MipFilter +// Filter the texture mip levels using the specified filter (only if +// generating mips) +// pSrcInfo +// (optional) pointer to a D3DX11_IMAGE_INFO structure that will get +// populated with source image information +//---------------------------------------------------------------------------- + + +typedef struct D3DX11_IMAGE_LOAD_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT FirstMipLevel; + UINT MipLevels; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CpuAccessFlags; + UINT MiscFlags; + DXGI_FORMAT Format; + UINT Filter; + UINT MipFilter; + D3DX11_IMAGE_INFO* pSrcInfo; + +#ifdef __cplusplus + D3DX11_IMAGE_LOAD_INFO() + { + Width = D3DX11_DEFAULT; + Height = D3DX11_DEFAULT; + Depth = D3DX11_DEFAULT; + FirstMipLevel = D3DX11_DEFAULT; + MipLevels = D3DX11_DEFAULT; + Usage = (D3D11_USAGE) D3DX11_DEFAULT; + BindFlags = D3DX11_DEFAULT; + CpuAccessFlags = D3DX11_DEFAULT; + MiscFlags = D3DX11_DEFAULT; + Format = DXGI_FORMAT_FROM_FILE; + Filter = D3DX11_DEFAULT; + MipFilter = D3DX11_DEFAULT; + pSrcInfo = NULL; + } +#endif + +} D3DX11_IMAGE_LOAD_INFO; + +//------------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource/Memory: +// ------------------------------ +// Fills in a D3DX11_IMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name. +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pPump +// Optional pointer to a thread pump object to use. +// pSrcInfo +// Pointer to a D3DX11_IMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//------------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11GetImageInfoFromFileA( + LPCSTR pSrcFile, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11GetImageInfoFromFileW( + LPCWSTR pSrcFile, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11GetImageInfoFromFile D3DX11GetImageInfoFromFileW +#else +#define D3DX11GetImageInfoFromFile D3DX11GetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DX11GetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11GetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11GetImageInfoFromResource D3DX11GetImageInfoFromResourceW +#else +#define D3DX11GetImageInfoFromResource D3DX11GetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DX11GetImageInfoFromMemory( + LPCVOID pSrcData, + SIZE_T SrcDataSize, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX11CreateTextureFromFile/Resource/Memory: +// D3DX11CreateShaderResourceViewFromFile/Resource/Memory: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pLoadInfo +// Optional pointer to a D3DX11_IMAGE_LOAD_INFO structure that +// contains additional loader parameters. +// pPump +// Optional pointer to a thread pump object to use. +// ppTexture +// [out] Created texture object. +// ppShaderResourceView +// [out] Shader resource view object created. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +// +//---------------------------------------------------------------------------- + + +// FromFile + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromFileA( + ID3D11Device* pDevice, + LPCSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromFileW( + ID3D11Device* pDevice, + LPCWSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateShaderResourceViewFromFile D3DX11CreateShaderResourceViewFromFileW +#else +#define D3DX11CreateShaderResourceViewFromFile D3DX11CreateShaderResourceViewFromFileA +#endif + +HRESULT WINAPI + D3DX11CreateTextureFromFileA( + ID3D11Device* pDevice, + LPCSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateTextureFromFileW( + ID3D11Device* pDevice, + LPCWSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateTextureFromFile D3DX11CreateTextureFromFileW +#else +#define D3DX11CreateTextureFromFile D3DX11CreateTextureFromFileA +#endif + + +// FromResource (resources in dll/exes) + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromResourceA( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromResourceW( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateShaderResourceViewFromResource D3DX11CreateShaderResourceViewFromResourceW +#else +#define D3DX11CreateShaderResourceViewFromResource D3DX11CreateShaderResourceViewFromResourceA +#endif + +HRESULT WINAPI + D3DX11CreateTextureFromResourceA( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateTextureFromResourceW( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateTextureFromResource D3DX11CreateTextureFromResourceW +#else +#define D3DX11CreateTextureFromResource D3DX11CreateTextureFromResourceA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromMemory( + ID3D11Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateTextureFromMemory( + ID3D11Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX11_TEXTURE_LOAD_INFO: +// ------------------------ +// +//---------------------------------------------------------------------------- + +typedef struct _D3DX11_TEXTURE_LOAD_INFO +{ + D3D11_BOX *pSrcBox; + D3D11_BOX *pDstBox; + UINT SrcFirstMip; + UINT DstFirstMip; + UINT NumMips; + UINT SrcFirstElement; + UINT DstFirstElement; + UINT NumElements; + UINT Filter; + UINT MipFilter; + +#ifdef __cplusplus + _D3DX11_TEXTURE_LOAD_INFO() + { + pSrcBox = NULL; + pDstBox = NULL; + SrcFirstMip = 0; + DstFirstMip = 0; + NumMips = D3DX11_DEFAULT; + SrcFirstElement = 0; + DstFirstElement = 0; + NumElements = D3DX11_DEFAULT; + Filter = D3DX11_DEFAULT; + MipFilter = D3DX11_DEFAULT; + } +#endif + +} D3DX11_TEXTURE_LOAD_INFO; + + +//---------------------------------------------------------------------------- +// D3DX11LoadTextureFromTexture: +// ---------------------------- +// Load a texture from a texture. +// +// Parameters: +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DX11LoadTextureFromTexture( + ID3D11DeviceContext *pContext, + ID3D11Resource *pSrcTexture, + D3DX11_TEXTURE_LOAD_INFO *pLoadInfo, + ID3D11Resource *pDstTexture); + + +//---------------------------------------------------------------------------- +// D3DX11FilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// MipFilter +// D3DX11_FILTER flags controlling how each miplevel is filtered. +// Or D3DX11_DEFAULT for D3DX11_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11FilterTexture( + ID3D11DeviceContext *pContext, + ID3D11Resource *pTexture, + UINT SrcLevel, + UINT MipFilter); + + +//---------------------------------------------------------------------------- +// D3DX11SaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11SaveTextureToFileA( + ID3D11DeviceContext *pContext, + ID3D11Resource *pSrcTexture, + D3DX11_IMAGE_FILE_FORMAT DestFormat, + LPCSTR pDestFile); + +HRESULT WINAPI + D3DX11SaveTextureToFileW( + ID3D11DeviceContext *pContext, + ID3D11Resource *pSrcTexture, + D3DX11_IMAGE_FILE_FORMAT DestFormat, + LPCWSTR pDestFile); + +#ifdef UNICODE +#define D3DX11SaveTextureToFile D3DX11SaveTextureToFileW +#else +#define D3DX11SaveTextureToFile D3DX11SaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DX11SaveTextureToMemory: +// ---------------------- +// Save a texture to a blob. +// +// Parameters: +// pSrcTexture +// Source texture, containing the image to be saved +// DestFormat +// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving. +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// Flags +// optional flags +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11SaveTextureToMemory( + ID3D11DeviceContext *pContext, + ID3D11Resource* pSrcTexture, + D3DX11_IMAGE_FILE_FORMAT DestFormat, + ID3D10Blob** ppDestBuf, + UINT Flags); + + +//---------------------------------------------------------------------------- +// D3DX11ComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pSrcTexture +// Pointer to the source heightmap texture +// Flags +// D3DX11_NORMALMAP flags +// Channel +// D3DX11_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +// pDestTexture +// Pointer to the destination texture +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11ComputeNormalMap( + ID3D11DeviceContext *pContext, + ID3D11Texture2D *pSrcTexture, + UINT Flags, + UINT Channel, + FLOAT Amplitude, + ID3D11Texture2D *pDestTexture); + + +//---------------------------------------------------------------------------- +// D3DX11SHProjectCubeMap: +// ---------------------- +// Projects a function represented in a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11SHProjectCubeMap( + ID3D11DeviceContext *pContext, + __in_range(2,6) UINT Order, + ID3D11Texture2D *pCubeMap, + __out_ecount(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX11TEX_H__ + diff --git a/ScreenRecoder/DXGIDuplicator.cpp b/ScreenRecoder/DXGIDuplicator.cpp new file mode 100644 index 0000000..c744d28 --- /dev/null +++ b/ScreenRecoder/DXGIDuplicator.cpp @@ -0,0 +1,190 @@ +#include "DXGIDuplicator.h" +#include "Utils/Utils.h" +DXGIDuplicator::DXGIDuplicator() +{ +} + +DXGIDuplicator::~DXGIDuplicator() +{ + if (duplication_) + { + duplication_->Release(); + } + if (device_) + { + device_->Release(); + } + if (deviceContext_) + { + deviceContext_->Release(); + } +} +bool DXGIDuplicator::InitD3D11Device(ID3D11Device* g_pd3dDevice, ID3D11DeviceContext* g_pImmediateContext) +{ + device_ = g_pd3dDevice; + deviceContext_ = g_pImmediateContext; + return true; +} +bool DXGIDuplicator::InitDuplication() +{ + HRESULT hr = S_OK; + + IDXGIDevice* dxgiDevice = nullptr; + hr = device_->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast(&dxgiDevice)); + if (FAILED(hr)) + { + return false; + } + + IDXGIAdapter* dxgiAdapter = nullptr; + hr = dxgiDevice->GetAdapter(&dxgiAdapter); + dxgiDevice->Release(); + if (FAILED(hr)) + { + return false; + } + + UINT output = 0; + IDXGIOutput* dxgiOutput = nullptr; + while (true) + { + hr = dxgiAdapter->EnumOutputs(output++, &dxgiOutput); + if (hr == DXGI_ERROR_NOT_FOUND) + { + return false; + } + else + { + DXGI_OUTPUT_DESC desc; + dxgiOutput->GetDesc(&desc); + Width = desc.DesktopCoordinates.right - desc.DesktopCoordinates.left; + Height = desc.DesktopCoordinates.bottom - desc.DesktopCoordinates.top; + break; + } + } + dxgiAdapter->Release(); + + IDXGIOutput1* dxgiOutput1 = nullptr; + hr = dxgiOutput->QueryInterface(__uuidof(IDXGIOutput1), reinterpret_cast(&dxgiOutput1)); + dxgiOutput->Release(); + if (FAILED(hr)) + { + return false; + } + + hr = dxgiOutput1->DuplicateOutput(device_, &duplication_); + dxgiOutput1->Release(); + if (FAILED(hr)) + { + return false; + } + + return true; +} +HRESULT DXGIDuplicator::GetDesktopFrame(ID3D11Texture2D*& texture, UINT TimeoutInMilliseconds) +{ + HRESULT hr = S_OK; + DXGI_OUTDUPL_FRAME_INFO frameInfo; + IDXGIResource* resource = NULL; + FreeFrame(); + hr = duplication_->AcquireNextFrame(TimeoutInMilliseconds, &frameInfo, &resource); + if (FAILED(hr)) + return hr; + frameRef += 1; + hr = resource->QueryInterface(IID_PPV_ARGS(&texture)); + resource->Release(); + if (FAILED(hr)) + return hr; + if (frameInfo.LastPresentTime.QuadPart == 0) + return DXGI_ERROR_WAIT_TIMEOUT; + return hr; +} +ID3D11Texture2D* DXGIDuplicator::ConvertFormat(ID3D11Texture2D* pSrcTexture, DXGI_FORMAT fmt) +{ + static ID3D11Texture2D* pDestTexture = NULL; + if (pDestTexture == NULL) + { + HRESULT hr = S_OK; + D3D11_TEXTURE2D_DESC desc; + pSrcTexture->GetDesc(&desc); + desc.Format = fmt; + desc.Usage = D3D11_USAGE_STAGING; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + desc.BindFlags = 0; + desc.MiscFlags = 0; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + hr = device_->CreateTexture2D(&desc, NULL, &pDestTexture); + if (FAILED(hr)) + { + pDestTexture = NULL; + return NULL; + } + } + deviceContext_->CopyResource(pDestTexture, pSrcTexture); + return pDestTexture; +} +void* DXGIDuplicator::MapBuffer(ID3D11Texture2D* texture2D) +{ + HRESULT hr = S_OK; + D3D11_MAPPED_SUBRESOURCE mappedResource{}; + hr = this->deviceContext_->Map(texture2D, 0, D3D11_MAP_READ, 0, &mappedResource); + if (FAILED(hr)) + return NULL; + return mappedResource.pData; +} +void DXGIDuplicator::UnMapBuffer(ID3D11Texture2D* texture2D) +{ + this->deviceContext_->Unmap(texture2D, 0); +} +std::vector DXGIDuplicator::GenerateBitmapFile(ID3D11Texture2D* texture2D) +{ + D3D11_TEXTURE2D_DESC desc{}; + texture2D->GetDesc(&desc); + D3D11_MAPPED_SUBRESOURCE mappedResource; + HRESULT hr = this->deviceContext_->Map(texture2D, 0, D3D11_MAP_READ, 0, &mappedResource); + if (FAILED(hr)) + return std::vector(); + + size_t bmpSize = desc.Width * desc.Height * 4; + std::vector result(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmpSize, 0); + + BITMAPFILEHEADER* bmpHeader = (BITMAPFILEHEADER*)(&result[0]); + BITMAPINFOHEADER* bmiHeader = (BITMAPINFOHEADER*)(&result[0] + sizeof(BITMAPFILEHEADER)); + + uint8_t* rgba = (uint8_t*)(&result[0] + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)); + + bmpHeader->bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmpSize; + bmpHeader->bfType = 0x4D42; + bmpHeader->bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); + bmpHeader->bfReserved1 = 0; + bmpHeader->bfReserved2 = 0; + + bmiHeader->biSize = sizeof(BITMAPINFOHEADER); + bmiHeader->biWidth = desc.Width; + bmiHeader->biHeight = 0 - desc.Height; + bmiHeader->biPlanes = 1; + bmiHeader->biBitCount = 32; + bmiHeader->biCompression = 0; + bmiHeader->biSizeImage = bmpSize; + bmiHeader->biXPelsPerMeter = 0; + bmiHeader->biYPelsPerMeter = 0; + bmiHeader->biClrUsed = 0; + bmiHeader->biClrImportant = 0; + + memcpy(rgba, mappedResource.pData, bmpSize); + this->deviceContext_->Unmap(texture2D, 0); + return result; +} + +HRESULT DXGIDuplicator::FreeFrame() +{ + if (frameRef > 0) + { + frameRef -= 1; + return duplication_->ReleaseFrame(); + } + return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; +} \ No newline at end of file diff --git a/ScreenRecoder/DXGIDuplicator.h b/ScreenRecoder/DXGIDuplicator.h new file mode 100644 index 0000000..f3309db --- /dev/null +++ b/ScreenRecoder/DXGIDuplicator.h @@ -0,0 +1,32 @@ +#pragma once +#include +#include +#include +#include +#pragma comment(lib, "d3d11.lib") +#pragma comment(lib, "dxgi.lib") + + +class DXGIDuplicator +{ +public: + int Width; + int Height; + DXGIDuplicator(); + ~DXGIDuplicator(); + bool InitD3D11Device(ID3D11Device* g_pd3dDevice,ID3D11DeviceContext* g_pImmediateContext); + bool InitDuplication(); + HRESULT GetDesktopFrame(ID3D11Texture2D*& texture, UINT TimeoutInMilliseconds = 0); + ID3D11Texture2D* ConvertFormat(ID3D11Texture2D* pSrcTexture, DXGI_FORMAT fmt = DXGI_FORMAT_R8G8B8A8_UNORM); + std::vector GenerateBitmapFile(ID3D11Texture2D* texture2D); + + void* MapBuffer(ID3D11Texture2D* texture2D); + void UnMapBuffer(ID3D11Texture2D* texture2D); + HRESULT FreeFrame(); +private: + int frameRef = 0; + ID3D11Device* device_ = nullptr; + ID3D11DeviceContext* deviceContext_ = nullptr; + IDXGIOutputDuplication* duplication_ = nullptr; +}; + diff --git a/ScreenRecoder/Delogo.ico b/ScreenRecoder/Delogo.ico new file mode 100644 index 0000000000000000000000000000000000000000..fb7cb6117d2ac44e7e65263c71043f0407dd09c8 GIT binary patch literal 16958 zcmeI1dx#ZP9LLYx$DG-Fcki9YZ80$|d$}gG6-8#57@3b=qLzqMl7+i>=gi&Jq{zog zn^;ksQD9_cMK1_?{bSHS{Soxi)Ii8c`lB+a!2U`|x_!>wYnI-*%`DtYXt&Iu-LPL6>#S%k5nr>sTQI05+@VnJ49gEA{f;Jtml6b z9N)Esip7u(Ci6@HDVMmX6(fajXQQdb5~z>BbB4DbRPHQQk$`mgXrIUPTLCG3o9 zqYq7|KfMY2VD}hc*IzX5$Ackqm<$F)ef+{P`-GkC&AQU>;(l*{9tZv@|6{Q~r){g* zQ;*S1(_Zp_)Hc<{j;T@*FMnAPj#Q>CgX_4@O6Y-A;i%=bzaG!7X*G`Y=P@=dqklKk z)T7^D#|*kVvVN*02grYAWDn|Nphek(*B`(S@LdSss?Adm_hMeyG*Rsc|h*W&%OsYqh|=VhUn7uTO8BB5l(~19yo$E09>$OxgOJR zW-Q=afNu<`zG?)yAB1-b*>%l_KNk4CWIBYhg_Tm}>&XnsGk35H&>Xb~=BjxL!Y(cF(FT zCT>6I_>FYwx(eTP7q^Q6vq1iusE5vjce;)B?M&v~o$wia9Kwfa;=7sonSRsCL*F0r zP(jPP@M(yqnpW)%9!zF`Kxm>K1>)pPm9Z^#4)?zYHp03Ftf%gN^z^|5h#F#4?ezUY z!nMQ=U_%2<$8}0Im%KY!r?9q-p1&5S*A9>d_Qg~eus@`_n{YPg3NWhNqF%%^Wv`~j z1j=T5x;cLd>yk-)2N**15JD5}sOMjxTux4J1K$IRy_S>MP2DFj43|Q*0HbO($W_Cz z)gZU~ppl;Ab?jx4|NZ1G4N*2Aa#WA?Y$@%VlwHiHcMwaDfvZDcJXT8`%RdJq$B5r> zkV~p!-z`F~Q?Ejc{vHU^r0dt}wNhSG+S^6NfXE?Bc-1L-jFM4qBmc{|&rPtf2{#r^ zHC2j=nPVST(~6^%^+ladH>)mhqDO08WShZk*0X0p8e&Oe{MUOTdN1V~O6D51dE`4> ze~X_4Yc92{kX9258D&7MSWz3>>}}S`v&Y5WOH)mo>HizxR*(=iOs!pg+)Pm}AkHJa z+pogQA-sl1Ygl(o10(L*JF2iY`miP~2FQo~CriB&qDSl0=k)%lUJtNGGphXc+`+ZV z<6e6G84hje13BiWY^$-efl2;)z6sZ(&q+0oyj|Aw8U5ajX0L{CO7%;<6-n}@Um(lxDfSK z`?H-b`2PbU$Q9H6gn}$jfv$R~|31~}Dw=)gIfg&p73^=4OWdP_xv*XIN;}gxnSI`Q zp!dBQ6UPKMxTZhbF@i~sV9XfByj*16m=h~AZr1PST^fRifc?Q!ANu|y%zOQXlsY3X z{7eV)XWT>Q-zHWVk;fe|JYp