├── NoShadowPlayBS ├── icon1.ico ├── NoShadowPlayBS.rc ├── lib │ └── DirectXTK.lib ├── src │ ├── utils.h │ ├── config.h │ ├── utils.cpp │ ├── memory.h │ ├── config.cpp │ └── memory.cpp ├── NoShadowPlayBS.vcxproj.user ├── resource.h ├── include │ ├── DirectXTK │ │ ├── ScreenGrab.h │ │ ├── GraphicsMemory.h │ │ ├── CommonStates.h │ │ ├── XboxDDSTextureLoader.h │ │ ├── Mouse.h │ │ ├── SpriteBatch.h │ │ ├── PrimitiveBatch.h │ │ ├── BufferHelpers.h │ │ ├── DirectXHelpers.h │ │ ├── PostProcess.h │ │ ├── GeometricPrimitive.h │ │ ├── SpriteFont.h │ │ ├── WICTextureLoader.h │ │ ├── DDSTextureLoader.h │ │ ├── GamePad.h │ │ └── Model.h │ ├── ImGui │ │ ├── imgui_impl_dx11.h │ │ ├── imgui_impl_win32.h │ │ └── imconfig.h │ └── INIReader │ │ ├── cpp │ │ ├── INIReader.h │ │ └── INIReader.cpp │ │ ├── ini.h │ │ └── ini.c ├── NoShadowPlayBS.vcxproj.filters └── NoShadowPlayBS.vcxproj ├── NoShadowPlayBS.sln ├── README.md └── .gitignore /NoShadowPlayBS/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/womblee/instant_replay_patcher/HEAD/NoShadowPlayBS/icon1.ico -------------------------------------------------------------------------------- /NoShadowPlayBS/NoShadowPlayBS.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/womblee/instant_replay_patcher/HEAD/NoShadowPlayBS/NoShadowPlayBS.rc -------------------------------------------------------------------------------- /NoShadowPlayBS/lib/DirectXTK.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/womblee/instant_replay_patcher/HEAD/NoShadowPlayBS/lib/DirectXTK.lib -------------------------------------------------------------------------------- /NoShadowPlayBS/src/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | std::wstring to_lower(const std::wstring& str); 7 | std::string bytes_to_hex_string(const uint8_t* bytes, size_t size); 8 | std::string int_to_hex(uintptr_t value); -------------------------------------------------------------------------------- /NoShadowPlayBS/NoShadowPlayBS.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /NoShadowPlayBS/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by NoShadowPlayBS.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 103 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /NoShadowPlayBS/src/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define DEFAULT_CONFIG_FILENAME "config.ini" 5 | 6 | struct Config { 7 | bool no_gui = false; 8 | bool startup_enabled = false; 9 | bool start_menu_enabled = false; 10 | bool hide_log_window = false; 11 | bool dark_mode = true; 12 | bool auto_close = false; 13 | bool auto_patch = false; 14 | 15 | bool Load(const std::string& filename = ""); 16 | bool Save(const std::string& filename = "") const; 17 | void SetDefaults(); 18 | }; -------------------------------------------------------------------------------- /NoShadowPlayBS/src/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | std::wstring to_lower(const std::wstring& str) 9 | { 10 | std::wstring result = str; 11 | std::transform(result.begin(), result.end(), result.begin(), ::towlower); 12 | return result; 13 | } 14 | 15 | std::string bytes_to_hex_string(const uint8_t* bytes, size_t size) 16 | { 17 | std::ostringstream oss; 18 | for (size_t i = 0; i < size; ++i) { 19 | oss << std::hex << std::setw(2) << std::setfill('0') << (int)bytes[i] << " "; 20 | } 21 | return oss.str(); 22 | } 23 | 24 | std::string int_to_hex(uintptr_t value) 25 | { 26 | std::stringstream stream; 27 | stream << std::hex << value; 28 | return stream.str(); 29 | } -------------------------------------------------------------------------------- /NoShadowPlayBS/src/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | std::vector get_processes_by_name(const std::wstring& process_name); 9 | bool is_module_loaded(DWORD process_id, const std::wstring& module_name); 10 | uintptr_t get_remote_module_base_address(HANDLE h_process, const wchar_t* module_name); 11 | uintptr_t get_exported_function_address(HANDLE h_process, uintptr_t module_base, const wchar_t* module_name, const char* function_name); 12 | uintptr_t allocate_memory_near_address(HANDLE process, uintptr_t desired_address, SIZE_T size, 13 | DWORD protection = PAGE_EXECUTE_READWRITE, SIZE_T range = 0x20000000 - 0x2000); 14 | bool assemble_jump_near_instruction(uint8_t* buffer, uintptr_t source_address, uintptr_t target_address); 15 | bool write_memory(HANDLE h_process, uintptr_t address, const void* buffer, SIZE_T size); 16 | bool write_memory_with_protection(HANDLE h_process, uintptr_t address, const void* buffer, SIZE_T size); 17 | bool write_memory_with_protection_dynamic(HANDLE h_process, uintptr_t address, const std::vector& buffer); -------------------------------------------------------------------------------- /NoShadowPlayBS.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.13.35828.75 d17.13 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NoShadowPlayBS", "NoShadowPlayBS\NoShadowPlayBS.vcxproj", "{73705999-89AB-48A5-BE5A-5126ACD3ED84}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Debug|x64.ActiveCfg = Debug|x64 17 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Debug|x64.Build.0 = Debug|x64 18 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Debug|x86.ActiveCfg = Debug|Win32 19 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Debug|x86.Build.0 = Debug|Win32 20 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Release|x64.ActiveCfg = Release|x64 21 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Release|x64.Build.0 = Release|x64 22 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Release|x86.ActiveCfg = Release|Win32 23 | {73705999-89AB-48A5-BE5A-5126ACD3ED84}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {FF242DA8-EB96-4167-8085-58D7F51A117F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // Copyright (c) Microsoft Corporation. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkId=248929 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #if defined(_XBOX_ONE) && defined(_TITLE) 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | #if defined(NTDDI_WIN10_FE) || defined(__MINGW32__) 29 | #include 30 | #else 31 | #include 32 | #endif 33 | 34 | #ifdef _MSC_VER 35 | #pragma comment(lib,"uuid.lib") 36 | #endif 37 | 38 | #ifndef DIRECTX_TOOLKIT_API 39 | #ifdef DIRECTX_TOOLKIT_EXPORT 40 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 41 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 42 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 43 | #else 44 | #define DIRECTX_TOOLKIT_API 45 | #endif 46 | #endif 47 | 48 | 49 | namespace DirectX 50 | { 51 | DIRECTX_TOOLKIT_API 52 | HRESULT __cdecl SaveDDSTextureToFile( 53 | _In_ ID3D11DeviceContext* pContext, 54 | _In_ ID3D11Resource* pSource, 55 | _In_z_ const wchar_t* fileName) noexcept; 56 | 57 | DIRECTX_TOOLKIT_API 58 | HRESULT __cdecl SaveWICTextureToFile( 59 | _In_ ID3D11DeviceContext* pContext, 60 | _In_ ID3D11Resource* pSource, 61 | _In_ REFGUID guidContainerFormat, 62 | _In_z_ const wchar_t* fileName, 63 | _In_opt_ const GUID* targetFormat = nullptr, 64 | _In_ std::function setCustomProps = nullptr, 65 | _In_ bool forceSRGB = false); 66 | } 67 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/GraphicsMemory.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: GraphicsMemory.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | 21 | #ifndef DIRECTX_TOOLKIT_API 22 | #ifdef DIRECTX_TOOLKIT_EXPORT 23 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 24 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 25 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 26 | #else 27 | #define DIRECTX_TOOLKIT_API 28 | #endif 29 | #endif 30 | 31 | 32 | namespace DirectX 33 | { 34 | inline namespace DX11 35 | { 36 | class GraphicsMemory 37 | { 38 | public: 39 | DIRECTX_TOOLKIT_API 40 | #if defined(_XBOX_ONE) && defined(_TITLE) 41 | GraphicsMemory( 42 | _In_ ID3D11DeviceX* device, 43 | unsigned int backBufferCount = 2); 44 | #else 45 | GraphicsMemory( 46 | _In_ ID3D11Device* device, 47 | unsigned int backBufferCount = 2); 48 | #endif 49 | 50 | DIRECTX_TOOLKIT_API GraphicsMemory(GraphicsMemory&&) noexcept; 51 | DIRECTX_TOOLKIT_API GraphicsMemory& operator= (GraphicsMemory&&) noexcept; 52 | 53 | GraphicsMemory(GraphicsMemory const&) = delete; 54 | GraphicsMemory& operator=(GraphicsMemory const&) = delete; 55 | 56 | DIRECTX_TOOLKIT_API virtual ~GraphicsMemory(); 57 | 58 | DIRECTX_TOOLKIT_API void* __cdecl Allocate( 59 | _In_opt_ ID3D11DeviceContext* context, 60 | size_t size, 61 | int alignment); 62 | 63 | DIRECTX_TOOLKIT_API void __cdecl Commit(); 64 | 65 | // Singleton 66 | DIRECTX_TOOLKIT_API static GraphicsMemory& __cdecl Get(); 67 | 68 | private: 69 | // Private implementation. 70 | class Impl; 71 | 72 | std::unique_ptr pImpl; 73 | }; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/ImGui/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset). 7 | // [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'. 8 | 9 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 11 | // Learn about Dear ImGui: 12 | // - FAQ https://dearimgui.com/faq 13 | // - Getting Started https://dearimgui.com/getting-started 14 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 15 | // - Introduction, links and more at the top of imgui.cpp 16 | 17 | #pragma once 18 | #include "imgui.h" // IMGUI_IMPL_API 19 | #ifndef IMGUI_DISABLE 20 | 21 | struct ID3D11Device; 22 | struct ID3D11DeviceContext; 23 | struct ID3D11SamplerState; 24 | struct ID3D11Buffer; 25 | 26 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 27 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 28 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 29 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 30 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 31 | 32 | // Use if you want to reset your rendering device without losing Dear ImGui state. 33 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 34 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 35 | 36 | // [BETA] Selected render state data shared with callbacks. 37 | // This is temporarily stored in GetPlatformIO().Renderer_RenderState during the ImGui_ImplDX11_RenderDrawData() call. 38 | // (Please open an issue if you feel you need access to more data) 39 | struct ImGui_ImplDX11_RenderState 40 | { 41 | ID3D11Device* Device; 42 | ID3D11DeviceContext* DeviceContext; 43 | ID3D11SamplerState* SamplerDefault; 44 | ID3D11Buffer* VertexConstantBuffer; 45 | }; 46 | 47 | #endif // #ifndef IMGUI_DISABLE 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NVIDIA Patcher - Instant Replay Recording Restriction Bypass 2 | 3 | A lightweight tool that enables NVIDIA Shadowplay to record content normally flagged as "restricted" by bypassing NVIDIA's content detection mechanisms. 4 | 5 | ![image](https://github.com/user-attachments/assets/1ab41da7-0ef1-4158-b122-857159cca709) 6 | 7 | ![image](https://github.com/user-attachments/assets/a75dae0b-321e-41c7-bc0f-f47d9f805711) 8 | 9 | ## Simpler Solution 10 | Instead of using this tool, **you can simply switch browsers**! 11 | 12 | NVIDIA **doesn't detect** Brave and some other browsers **AT ALL**, and you can even use websites with Google Widevine DRM! 13 | 14 | ## Key Features 15 | - **Automatic Detection**: Monitors and automatically patches the NVIDIA Container process (nvcontainer.exe) 16 | - **List of patched functions**: 17 | - `OpenProcess` 18 | - `Process32FirstW` 19 | - `Process32NextW` 20 | - `Module32FirstW` 21 | - `Module32NextW` 22 | - `K32EnumProcessModules` 23 | - `EnumWindows` 24 | - `GetWindowInfo` 25 | - `GetWindowDisplayAffinity` 26 | - `GetFileVersionInfoA` 27 | - `GetFileVersionInfoSizeA` 28 | - `GetModuleHandleA` 29 | - `GetModuleHandleW` 30 | - `GetModuleHandleExA` 31 | - `GetModuleHandleExW` 32 | - `GetModuleFileNameA` 33 | - `GetModuleFileNameW` 34 | - `K32GetModuleFileNameExA` 35 | - `K32GetModuleBaseNameA` 36 | - `NvD3DUmx_BrowserDetect` 37 | - **Patch Now**: 38 | - You can patch out the NVIDIA restrictions just with a press of a button! 39 | - **Undo Patches**: 40 | - Revert the patches back to normal (only works for one session). 41 | - **Options**: 42 | - Auto-patch on launch 43 | - Auto-close after successful patching option. 44 | - Run at Windows startup. 45 | - **Minimalist Interface**: Clean, Dark-themed UI with easy-to-use controls. 46 | 47 | ## Usage 48 | 1. Download and run the `.exe` from Releases tab. 49 | 2. The tool will automatically detect and patch NVIDIA processes. 50 | 3. Configure settings as desired. 51 | 4. Click 'Patch Now' for patch to be applied. 52 | 5. Check the log window for patching status and details. 53 | 54 | ## Technical Details 55 | This tool works by injecting memory patches into NVIDIA's container process, specifically targeting the functions that detect protected content. By bypassing these detection mechanisms, Shadowplay can record content from applications that would normally trigger the "Recording is not available due to restricted content" error. 56 | 57 | ## Credits 58 | This project builds upon the foundation of [ShadowPlay_Patcher by furyzenblade](https://github.com/furyzenblade/ShadowPlay_Patcher), introducing a cleaner architecture, enhanced stability, an intuitive UI, and multiple additional patches to fully bypass NVIDIA Instant Replay protection mechanisms. 59 | 60 | Make sure to check it out, I wouldn't have made this program without their research! 61 | -------------------------------------------------------------------------------- /NoShadowPlayBS/src/config.cpp: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace { 8 | constexpr std::string_view CONFIG_SECTION = "Settings"; 9 | 10 | // Helper function to show error messages 11 | void ShowConfigError(const char* message) { 12 | MessageBoxA(nullptr, message, "Configuration Error", MB_ICONERROR | MB_OK); 13 | } 14 | } // namespace 15 | 16 | bool Config::Load(const std::string& filename) { 17 | INIReader reader(filename.empty() ? DEFAULT_CONFIG_FILENAME : filename); 18 | 19 | if (reader.ParseError() < 0) { 20 | // Only set defaults if file doesn't exist 21 | if (GetFileAttributesA(filename.c_str()) == INVALID_FILE_ATTRIBUTES) { 22 | SetDefaults(); 23 | return false; // File doesn't exist is not an error case 24 | } 25 | 26 | ShowConfigError("Failed to parse configuration file. Using defaults."); 27 | SetDefaults(); 28 | return false; 29 | } 30 | 31 | try { 32 | no_gui = reader.GetBoolean(CONFIG_SECTION.data(), "no_gui", no_gui); 33 | startup_enabled = reader.GetBoolean(CONFIG_SECTION.data(), "startup_enabled", startup_enabled); 34 | start_menu_enabled = reader.GetBoolean(CONFIG_SECTION.data(), "start_menu_enabled", start_menu_enabled); 35 | hide_log_window = reader.GetBoolean(CONFIG_SECTION.data(), "hide_log_window", hide_log_window); 36 | dark_mode = reader.GetBoolean(CONFIG_SECTION.data(), "dark_mode", dark_mode); 37 | auto_close = reader.GetBoolean(CONFIG_SECTION.data(), "auto_close", auto_close); 38 | auto_patch = reader.GetBoolean(CONFIG_SECTION.data(), "auto_patch", auto_patch); 39 | 40 | return true; 41 | } 42 | catch (const std::exception& e) { 43 | ShowConfigError(e.what()); 44 | SetDefaults(); 45 | return false; 46 | } 47 | } 48 | 49 | bool Config::Save(const std::string& filename) const { 50 | try { 51 | std::ofstream file(filename.empty() ? DEFAULT_CONFIG_FILENAME : filename); 52 | if (!file.is_open()) { 53 | throw std::runtime_error("Could not open file for writing"); 54 | } 55 | 56 | file << "[" << CONFIG_SECTION << "]\n" 57 | << "no_gui=" << (no_gui ? "true" : "false") << "\n" 58 | << "startup_enabled=" << (startup_enabled ? "true" : "false") << "\n" 59 | << "start_menu_enabled=" << (start_menu_enabled ? "true" : "false") << "\n" 60 | << "hide_log_window=" << (hide_log_window ? "true" : "false") << "\n" 61 | << "dark_mode=" << (dark_mode ? "true" : "false") << "\n" 62 | << "auto_close=" << (auto_close ? "true" : "false") << "\n" 63 | << "auto_patch=" << (auto_patch ? "true" : "false") << "\n"; 64 | 65 | return file.good(); 66 | } 67 | catch (const std::exception& e) { 68 | ShowConfigError(e.what()); 69 | return false; 70 | } 71 | } 72 | 73 | void Config::SetDefaults() { 74 | no_gui = false; 75 | startup_enabled = false; 76 | start_menu_enabled = false; 77 | hide_log_window = false; 78 | dark_mode = true; // Default to dark mode as it's more common 79 | auto_close = false; 80 | auto_patch = false; 81 | } -------------------------------------------------------------------------------- /NoShadowPlayBS/NoShadowPlayBS.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | 76 | 77 | Resource Files 78 | 79 | 80 | 81 | 82 | Resource Files 83 | 84 | 85 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/CommonStates.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: CommonStates.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | 20 | #ifndef DIRECTX_TOOLKIT_API 21 | #ifdef DIRECTX_TOOLKIT_EXPORT 22 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 23 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 24 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 25 | #else 26 | #define DIRECTX_TOOLKIT_API 27 | #endif 28 | #endif 29 | 30 | 31 | namespace DirectX 32 | { 33 | inline namespace DX11 34 | { 35 | class CommonStates 36 | { 37 | public: 38 | DIRECTX_TOOLKIT_API explicit CommonStates(_In_ ID3D11Device* device); 39 | 40 | DIRECTX_TOOLKIT_API CommonStates(CommonStates&&) noexcept; 41 | DIRECTX_TOOLKIT_API CommonStates& operator= (CommonStates&&) noexcept; 42 | 43 | CommonStates(CommonStates const&) = delete; 44 | CommonStates& operator= (CommonStates const&) = delete; 45 | 46 | DIRECTX_TOOLKIT_API virtual ~CommonStates(); 47 | 48 | // Blend states. 49 | DIRECTX_TOOLKIT_API ID3D11BlendState* __cdecl Opaque() const; 50 | DIRECTX_TOOLKIT_API ID3D11BlendState* __cdecl AlphaBlend() const; 51 | DIRECTX_TOOLKIT_API ID3D11BlendState* __cdecl Additive() const; 52 | DIRECTX_TOOLKIT_API ID3D11BlendState* __cdecl NonPremultiplied() const; 53 | 54 | // Depth stencil states. 55 | DIRECTX_TOOLKIT_API ID3D11DepthStencilState* __cdecl DepthNone() const; 56 | DIRECTX_TOOLKIT_API ID3D11DepthStencilState* __cdecl DepthDefault() const; 57 | DIRECTX_TOOLKIT_API ID3D11DepthStencilState* __cdecl DepthRead() const; 58 | DIRECTX_TOOLKIT_API ID3D11DepthStencilState* __cdecl DepthReverseZ() const; 59 | DIRECTX_TOOLKIT_API ID3D11DepthStencilState* __cdecl DepthReadReverseZ() const; 60 | 61 | // Rasterizer states. 62 | DIRECTX_TOOLKIT_API ID3D11RasterizerState* __cdecl CullNone() const; 63 | DIRECTX_TOOLKIT_API ID3D11RasterizerState* __cdecl CullClockwise() const; 64 | DIRECTX_TOOLKIT_API ID3D11RasterizerState* __cdecl CullCounterClockwise() const; 65 | DIRECTX_TOOLKIT_API ID3D11RasterizerState* __cdecl Wireframe() const; 66 | 67 | // Sampler states. 68 | DIRECTX_TOOLKIT_API ID3D11SamplerState* __cdecl PointWrap() const; 69 | DIRECTX_TOOLKIT_API ID3D11SamplerState* __cdecl PointClamp() const; 70 | DIRECTX_TOOLKIT_API ID3D11SamplerState* __cdecl LinearWrap() const; 71 | DIRECTX_TOOLKIT_API ID3D11SamplerState* __cdecl LinearClamp() const; 72 | DIRECTX_TOOLKIT_API ID3D11SamplerState* __cdecl AnisotropicWrap() const; 73 | DIRECTX_TOOLKIT_API ID3D11SamplerState* __cdecl AnisotropicClamp() const; 74 | 75 | private: 76 | // Private implementation. 77 | class Impl; 78 | 79 | std::shared_ptr pImpl; 80 | }; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/XboxDDSTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: XboxDDSTextureLoader.h 3 | // 4 | // Functions for loading a DDS texture using the XBOX extended header and creating a 5 | // Direct3D11.X runtime resource for it via the CreatePlacement APIs 6 | // 7 | // Note these functions will not load standard DDS files. Use the DDSTextureLoader 8 | // module in the DirectXTex package or as part of the DirectXTK library to load 9 | // these files which use standard Direct3D resource creation APIs. 10 | // 11 | // Copyright (c) Microsoft Corporation. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkId=248929 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #if !defined(_XBOX_ONE) || !defined(_TITLE) 21 | #error This module only supports Xbox One exclusive apps 22 | #endif 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #ifndef DIRECTX_TOOLKIT_API 30 | #ifdef DIRECTX_TOOLKIT_EXPORT 31 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 32 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 33 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 34 | #else 35 | #define DIRECTX_TOOLKIT_API 36 | #endif 37 | #endif 38 | 39 | #ifndef DDS_ALPHA_MODE_DEFINED 40 | #define DDS_ALPHA_MODE_DEFINED 41 | namespace DirectX 42 | { 43 | enum DDS_ALPHA_MODE : uint32_t 44 | { 45 | DDS_ALPHA_MODE_UNKNOWN = 0, 46 | DDS_ALPHA_MODE_STRAIGHT = 1, 47 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 48 | DDS_ALPHA_MODE_OPAQUE = 3, 49 | DDS_ALPHA_MODE_CUSTOM = 4, 50 | }; 51 | } 52 | #endif 53 | 54 | 55 | namespace Xbox 56 | { 57 | using DirectX::DDS_ALPHA_MODE; 58 | 59 | DIRECTX_TOOLKIT_API 60 | HRESULT __cdecl CreateDDSTextureFromMemory( 61 | _In_ ID3D11DeviceX* d3dDevice, 62 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 63 | _In_ size_t ddsDataSize, 64 | _Outptr_opt_ ID3D11Resource** texture, 65 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 66 | _Outptr_ void** grfxMemory, 67 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 68 | _In_ bool forceSRGB = false) noexcept; 69 | 70 | DIRECTX_TOOLKIT_API 71 | HRESULT __cdecl CreateDDSTextureFromFile( 72 | _In_ ID3D11DeviceX* d3dDevice, 73 | _In_z_ const wchar_t* szFileName, 74 | _Outptr_opt_ ID3D11Resource** texture, 75 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 76 | _Outptr_ void** grfxMemory, 77 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 78 | _In_ bool forceSRGB = false) noexcept; 79 | 80 | DIRECTX_TOOLKIT_API 81 | void FreeDDSTextureMemory( _In_opt_ void* grfxMemory ) noexcept; 82 | 83 | #ifdef __cpp_lib_byte 84 | DIRECTX_TOOLKIT_API 85 | inline HRESULT __cdecl CreateDDSTextureFromMemory( 86 | _In_ ID3D11DeviceX* d3dDevice, 87 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 88 | _In_ size_t ddsDataSize, 89 | _Outptr_opt_ ID3D11Resource** texture, 90 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 91 | _Outptr_ void** grfxMemory, 92 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 93 | _In_ bool forceSRGB = false) noexcept 94 | { 95 | return CreateDDSTextureFromMemory(d3dDevice, reinterpret_cast(ddsData), ddsDataSize, texture, textureView, grfxMemory, alphaMode, forceSRGB); 96 | } 97 | #endif // __cpp_lib_byte 98 | } 99 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/ImGui/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32-bits AND 64-bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen. 7 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values are obsolete since 1.87 and not supported since 1.91.5] 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | // [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 10 | 11 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 13 | // Learn about Dear ImGui: 14 | // - FAQ https://dearimgui.com/faq 15 | // - Getting Started https://dearimgui.com/getting-started 16 | // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). 17 | // - Introduction, links and more at the top of imgui.cpp 18 | 19 | #pragma once 20 | #include "imgui.h" // IMGUI_IMPL_API 21 | #ifndef IMGUI_DISABLE 22 | 23 | // Follow "Getting Started" link and check examples/ folder to learn about using backends! 24 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 25 | IMGUI_IMPL_API bool ImGui_ImplWin32_InitForOpenGL(void* hwnd); 26 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 27 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 28 | 29 | // Win32 message handler your application need to call. 30 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 31 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 32 | // - Call from your application's message handler. Keep calling your message handler unless this function returns TRUE. 33 | 34 | #if 0 35 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 36 | #endif 37 | 38 | // DPI-related helpers (optional) 39 | // - Use to enable DPI awareness without having to create an application manifest. 40 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 41 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 42 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 43 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 44 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 45 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 46 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 47 | 48 | // Transparency related helpers (optional) [experimental] 49 | // - Use to enable alpha compositing transparency with the desktop. 50 | // - Use together with e.g. clearing your framebuffer with zero-alpha. 51 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd 52 | 53 | #endif // #ifndef IMGUI_DISABLE 54 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/INIReader/cpp/INIReader.h: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | 5 | // Copyright (C) 2009-2020, Ben Hoyt 6 | 7 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 8 | // Go to the project home page for more info: 9 | // 10 | // https://github.com/benhoyt/inih 11 | 12 | #ifndef INIREADER_H 13 | #define INIREADER_H 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | // Visibility symbols, required for Windows DLLs 22 | #ifndef INI_API 23 | #if defined _WIN32 || defined __CYGWIN__ 24 | # ifdef INI_SHARED_LIB 25 | # ifdef INI_SHARED_LIB_BUILDING 26 | # define INI_API __declspec(dllexport) 27 | # else 28 | # define INI_API __declspec(dllimport) 29 | # endif 30 | # else 31 | # define INI_API 32 | # endif 33 | #else 34 | # if defined(__GNUC__) && __GNUC__ >= 4 35 | # define INI_API __attribute__ ((visibility ("default"))) 36 | # else 37 | # define INI_API 38 | # endif 39 | #endif 40 | #endif 41 | 42 | // Read an INI file into easy-to-access name/value pairs. (Note that I've gone 43 | // for simplicity here rather than speed, but it should be pretty decent.) 44 | class INIReader 45 | { 46 | public: 47 | // Construct INIReader and parse given filename. See ini.h for more info 48 | // about the parsing. 49 | INI_API explicit INIReader(const std::string& filename); 50 | 51 | // Construct INIReader and parse given buffer. See ini.h for more info 52 | // about the parsing. 53 | INI_API explicit INIReader(const char *buffer, size_t buffer_size); 54 | 55 | // Return the result of ini_parse(), i.e., 0 on success, line number of 56 | // first error on parse error, or -1 on file open error. 57 | INI_API int ParseError() const; 58 | 59 | // Get a string value from INI file, returning default_value if not found. 60 | INI_API std::string Get(const std::string& section, const std::string& name, 61 | const std::string& default_value) const; 62 | 63 | // Get a string value from INI file, returning default_value if not found, 64 | // empty, or contains only whitespace. 65 | INI_API std::string GetString(const std::string& section, const std::string& name, 66 | const std::string& default_value) const; 67 | 68 | // Get an integer (long) value from INI file, returning default_value if 69 | // not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). 70 | INI_API long GetInteger(const std::string& section, const std::string& name, long default_value) const; 71 | 72 | // Get a 64-bit integer (int64_t) value from INI file, returning default_value if 73 | // not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). 74 | INI_API int64_t GetInteger64(const std::string& section, const std::string& name, int64_t default_value) const; 75 | 76 | // Get an unsigned integer (unsigned long) value from INI file, returning default_value if 77 | // not found or not a valid unsigned integer (decimal "1234", or hex "0x4d2"). 78 | INI_API unsigned long GetUnsigned(const std::string& section, const std::string& name, unsigned long default_value) const; 79 | 80 | // Get an unsigned 64-bit integer (uint64_t) value from INI file, returning default_value if 81 | // not found or not a valid unsigned integer (decimal "1234", or hex "0x4d2"). 82 | INI_API uint64_t GetUnsigned64(const std::string& section, const std::string& name, uint64_t default_value) const; 83 | 84 | // Get a real (floating point double) value from INI file, returning 85 | // default_value if not found or not a valid floating point value 86 | // according to strtod(). 87 | INI_API double GetReal(const std::string& section, const std::string& name, double default_value) const; 88 | 89 | // Get a boolean value from INI file, returning default_value if not found or if 90 | // not a valid true/false value. Valid true values are "true", "yes", "on", "1", 91 | // and valid false values are "false", "no", "off", "0" (not case sensitive). 92 | INI_API bool GetBoolean(const std::string& section, const std::string& name, bool default_value) const; 93 | 94 | // Return a newly-allocated vector of all section names, in alphabetical order. 95 | INI_API std::vector Sections() const; 96 | 97 | // Return a newly-allocated vector of keys in the given section, in alphabetical order. 98 | INI_API std::vector Keys(const std::string& section) const; 99 | 100 | // Return true if the given section exists (section must contain at least 101 | // one name=value pair). 102 | INI_API bool HasSection(const std::string& section) const; 103 | 104 | // Return true if a value exists with the given section and field names. 105 | INI_API bool HasValue(const std::string& section, const std::string& name) const; 106 | 107 | protected: 108 | int _error; 109 | std::map _values; 110 | static std::string MakeKey(const std::string& section, const std::string& name); 111 | static int ValueHandler(void* user, const char* section, const char* name, 112 | const char* value); 113 | }; 114 | 115 | #endif // INIREADER_H 116 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/INIReader/cpp/INIReader.cpp: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | 5 | // Copyright (C) 2009-2020, Ben Hoyt 6 | 7 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 8 | // Go to the project home page for more info: 9 | // 10 | // https://github.com/benhoyt/inih 11 | 12 | #include 13 | #include 14 | #include 15 | #include "../ini.h" 16 | #include "INIReader.h" 17 | 18 | using std::string; 19 | 20 | INIReader::INIReader(const string& filename) 21 | { 22 | _error = ini_parse(filename.c_str(), ValueHandler, this); 23 | } 24 | 25 | INIReader::INIReader(const char *buffer, size_t buffer_size) 26 | { 27 | string content(buffer, buffer_size); 28 | _error = ini_parse_string(content.c_str(), ValueHandler, this); 29 | } 30 | 31 | int INIReader::ParseError() const 32 | { 33 | return _error; 34 | } 35 | 36 | string INIReader::Get(const string& section, const string& name, const string& default_value) const 37 | { 38 | string key = MakeKey(section, name); 39 | // Use _values.find() here instead of _values.at() to support pre C++11 compilers 40 | return _values.count(key) ? _values.find(key)->second : default_value; 41 | } 42 | 43 | string INIReader::GetString(const string& section, const string& name, const string& default_value) const 44 | { 45 | const string str = Get(section, name, ""); 46 | return str.empty() ? default_value : str; 47 | } 48 | 49 | long INIReader::GetInteger(const string& section, const string& name, long default_value) const 50 | { 51 | string valstr = Get(section, name, ""); 52 | const char* value = valstr.c_str(); 53 | char* end; 54 | // This parses "1234" (decimal) and also "0x4D2" (hex) 55 | long n = strtol(value, &end, 0); 56 | return end > value ? n : default_value; 57 | } 58 | 59 | INI_API int64_t INIReader::GetInteger64(const string& section, const string& name, int64_t default_value) const 60 | { 61 | string valstr = Get(section, name, ""); 62 | const char* value = valstr.c_str(); 63 | char* end; 64 | // This parses "1234" (decimal) and also "0x4D2" (hex) 65 | int64_t n = strtoll(value, &end, 0); 66 | return end > value ? n : default_value; 67 | } 68 | 69 | unsigned long INIReader::GetUnsigned(const string& section, const string& name, unsigned long default_value) const 70 | { 71 | string valstr = Get(section, name, ""); 72 | const char* value = valstr.c_str(); 73 | char* end; 74 | // This parses "1234" (decimal) and also "0x4D2" (hex) 75 | unsigned long n = strtoul(value, &end, 0); 76 | return end > value ? n : default_value; 77 | } 78 | 79 | INI_API uint64_t INIReader::GetUnsigned64(const string& section, const string& name, uint64_t default_value) const 80 | { 81 | string valstr = Get(section, name, ""); 82 | const char* value = valstr.c_str(); 83 | char* end; 84 | // This parses "1234" (decimal) and also "0x4D2" (hex) 85 | uint64_t n = strtoull(value, &end, 0); 86 | return end > value ? n : default_value; 87 | } 88 | 89 | double INIReader::GetReal(const string& section, const string& name, double default_value) const 90 | { 91 | string valstr = Get(section, name, ""); 92 | const char* value = valstr.c_str(); 93 | char* end; 94 | double n = strtod(value, &end); 95 | return end > value ? n : default_value; 96 | } 97 | 98 | bool INIReader::GetBoolean(const string& section, const string& name, bool default_value) const 99 | { 100 | string valstr = Get(section, name, ""); 101 | // Convert to lower case to make string comparisons case-insensitive 102 | std::transform(valstr.begin(), valstr.end(), valstr.begin(), 103 | [](const unsigned char& ch) { return static_cast(::tolower(ch)); }); 104 | if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1") 105 | return true; 106 | else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0") 107 | return false; 108 | else 109 | return default_value; 110 | } 111 | 112 | std::vector INIReader::Sections() const 113 | { 114 | std::set sectionSet; 115 | for (std::map::const_iterator it = _values.begin(); it != _values.end(); ++it) { 116 | size_t pos = it->first.find('='); 117 | if (pos != string::npos) { 118 | sectionSet.insert(it->first.substr(0, pos)); 119 | } 120 | } 121 | return std::vector(sectionSet.begin(), sectionSet.end()); 122 | } 123 | 124 | std::vector INIReader::Keys(const string& section) const 125 | { 126 | std::vector keys; 127 | string keyPrefix = MakeKey(section, ""); 128 | for (std::map::const_iterator it = _values.begin(); it != _values.end(); ++it) { 129 | if (it->first.compare(0, keyPrefix.length(), keyPrefix) == 0) { 130 | keys.push_back(it->first.substr(keyPrefix.length())); 131 | } 132 | } 133 | return keys; 134 | } 135 | 136 | bool INIReader::HasSection(const string& section) const 137 | { 138 | const string key = MakeKey(section, ""); 139 | std::map::const_iterator pos = _values.lower_bound(key); 140 | if (pos == _values.end()) 141 | return false; 142 | // Does the key at the lower_bound pos start with "section"? 143 | return pos->first.compare(0, key.length(), key) == 0; 144 | } 145 | 146 | bool INIReader::HasValue(const string& section, const string& name) const 147 | { 148 | string key = MakeKey(section, name); 149 | return _values.count(key); 150 | } 151 | 152 | string INIReader::MakeKey(const string& section, const string& name) 153 | { 154 | string key = section + "=" + name; 155 | // Convert to lower case to make section/name lookups case-insensitive 156 | std::transform(key.begin(), key.end(), key.begin(), 157 | [](const unsigned char& ch) { return static_cast(::tolower(ch)); }); 158 | return key; 159 | } 160 | 161 | int INIReader::ValueHandler(void* user, const char* section, const char* name, 162 | const char* value) 163 | { 164 | if (!name) // Happens when INI_CALL_HANDLER_ON_NEW_SECTION enabled 165 | return 1; 166 | INIReader* reader = static_cast(user); 167 | string key = MakeKey(section, name); 168 | if (reader->_values[key].size() > 0) 169 | reader->_values[key] += "\n"; 170 | reader->_values[key] += value ? value : ""; 171 | return 1; 172 | } 173 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/Mouse.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: Mouse.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | // http://go.microsoft.com/fwlink/?LinkID=615561 9 | //-------------------------------------------------------------------------------------- 10 | 11 | #pragma once 12 | 13 | #if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_COREWINDOW) 14 | 15 | #ifdef _GAMING_DESKTOP 16 | #include 17 | #endif 18 | 19 | #if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600)) 20 | #define USING_GAMEINPUT 21 | #elif (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE)) 22 | #define USING_COREWINDOW 23 | #endif 24 | 25 | #endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT 26 | 27 | #if defined(USING_GAMEINPUT) && !defined(_GAMING_XBOX) && defined(_MSC_VER) 28 | #pragma comment(lib,"gameinput.lib") 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #ifdef USING_COREWINDOW 35 | namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } } 36 | #endif 37 | 38 | #ifndef DIRECTX_TOOLKIT_API 39 | #ifdef DIRECTX_TOOLKIT_EXPORT 40 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 41 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 42 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 43 | #else 44 | #define DIRECTX_TOOLKIT_API 45 | #endif 46 | #endif 47 | 48 | #ifdef __clang__ 49 | #pragma clang diagnostic push 50 | #pragma clang diagnostic ignored "-Wunknown-pragmas" 51 | #endif 52 | 53 | 54 | namespace DirectX 55 | { 56 | class Mouse 57 | { 58 | public: 59 | DIRECTX_TOOLKIT_API Mouse() noexcept(false); 60 | 61 | DIRECTX_TOOLKIT_API Mouse(Mouse&&) noexcept; 62 | DIRECTX_TOOLKIT_API Mouse& operator= (Mouse&&) noexcept; 63 | 64 | Mouse(Mouse const&) = delete; 65 | Mouse& operator=(Mouse const&) = delete; 66 | 67 | DIRECTX_TOOLKIT_API virtual ~Mouse(); 68 | 69 | enum Mode : uint32_t 70 | { 71 | MODE_ABSOLUTE = 0, 72 | MODE_RELATIVE, 73 | }; 74 | 75 | struct State 76 | { 77 | bool leftButton; 78 | bool middleButton; 79 | bool rightButton; 80 | bool xButton1; 81 | bool xButton2; 82 | int x; 83 | int y; 84 | int scrollWheelValue; 85 | Mode positionMode; 86 | }; 87 | 88 | class DIRECTX_TOOLKIT_API ButtonStateTracker 89 | { 90 | public: 91 | enum ButtonState : uint32_t 92 | { 93 | UP = 0, // Button is up 94 | HELD = 1, // Button is held down 95 | RELEASED = 2, // Button was just released 96 | PRESSED = 3, // Buton was just pressed 97 | }; 98 | 99 | ButtonState leftButton; 100 | ButtonState middleButton; 101 | ButtonState rightButton; 102 | ButtonState xButton1; 103 | ButtonState xButton2; 104 | 105 | #ifdef _PREFAST_ 106 | #pragma prefast(push) 107 | #pragma prefast(disable : 26495, "Reset() performs the initialization") 108 | #endif 109 | ButtonStateTracker() noexcept { Reset(); } 110 | #ifdef _PREFAST_ 111 | #pragma prefast(pop) 112 | #endif 113 | 114 | void __cdecl Update(const State& state) noexcept; 115 | 116 | void __cdecl Reset() noexcept; 117 | 118 | State __cdecl GetLastState() const noexcept { return lastState; } 119 | 120 | private: 121 | State lastState; 122 | }; 123 | 124 | // Retrieve the current state of the mouse 125 | DIRECTX_TOOLKIT_API State __cdecl GetState() const; 126 | 127 | // Resets the accumulated scroll wheel value 128 | DIRECTX_TOOLKIT_API void __cdecl ResetScrollWheelValue() noexcept; 129 | 130 | // Sets mouse mode (defaults to absolute) 131 | DIRECTX_TOOLKIT_API void __cdecl SetMode(Mode mode); 132 | 133 | // Signals the end of frame (recommended, but optional) 134 | DIRECTX_TOOLKIT_API void __cdecl EndOfInputFrame() noexcept; 135 | 136 | // Feature detection 137 | DIRECTX_TOOLKIT_API bool __cdecl IsConnected() const; 138 | 139 | // Cursor visibility 140 | DIRECTX_TOOLKIT_API bool __cdecl IsVisible() const noexcept; 141 | DIRECTX_TOOLKIT_API void __cdecl SetVisible(bool visible); 142 | 143 | #ifdef USING_COREWINDOW 144 | DIRECTX_TOOLKIT_API void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window); 145 | #ifdef __cplusplus_winrt 146 | DIRECTX_TOOLKIT_API void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window) 147 | { 148 | // See https://msdn.microsoft.com/en-us/library/hh755802.aspx 149 | SetWindow(reinterpret_cast(window)); 150 | } 151 | #endif 152 | #ifdef CPPWINRT_VERSION 153 | DIRECTX_TOOLKIT_API void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window) 154 | { 155 | // See https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/interop-winrt-abi 156 | SetWindow(reinterpret_cast(winrt::get_abi(window))); 157 | } 158 | #endif 159 | 160 | static void __cdecl SetDpi(float dpi); 161 | #elif defined(WM_USER) 162 | DIRECTX_TOOLKIT_API void __cdecl SetWindow(HWND window); 163 | DIRECTX_TOOLKIT_API static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam); 164 | 165 | #ifdef _GAMING_XBOX 166 | DIRECTX_TOOLKIT_API static void __cdecl SetResolution(float scale); 167 | #endif 168 | #endif 169 | 170 | // Singleton 171 | DIRECTX_TOOLKIT_API static Mouse& __cdecl Get(); 172 | 173 | private: 174 | // Private implementation. 175 | class Impl; 176 | 177 | std::unique_ptr pImpl; 178 | }; 179 | } 180 | 181 | #ifdef __clang__ 182 | #pragma clang diagnostic pop 183 | #endif 184 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/SpriteBatch.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: SpriteBatch.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #include 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | 26 | #ifndef DIRECTX_TOOLKIT_API 27 | #ifdef DIRECTX_TOOLKIT_EXPORT 28 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 29 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 30 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 31 | #else 32 | #define DIRECTX_TOOLKIT_API 33 | #endif 34 | #endif 35 | 36 | 37 | namespace DirectX 38 | { 39 | inline namespace DX11 40 | { 41 | enum SpriteSortMode : uint32_t 42 | { 43 | SpriteSortMode_Deferred, 44 | SpriteSortMode_Immediate, 45 | SpriteSortMode_Texture, 46 | SpriteSortMode_BackToFront, 47 | SpriteSortMode_FrontToBack, 48 | }; 49 | 50 | enum SpriteEffects : uint32_t 51 | { 52 | SpriteEffects_None = 0, 53 | SpriteEffects_FlipHorizontally = 1, 54 | SpriteEffects_FlipVertically = 2, 55 | SpriteEffects_FlipBoth = SpriteEffects_FlipHorizontally | SpriteEffects_FlipVertically, 56 | }; 57 | 58 | class SpriteBatch 59 | { 60 | public: 61 | DIRECTX_TOOLKIT_API explicit SpriteBatch(_In_ ID3D11DeviceContext* deviceContext); 62 | 63 | DIRECTX_TOOLKIT_API SpriteBatch(SpriteBatch&&) noexcept; 64 | DIRECTX_TOOLKIT_API SpriteBatch& operator= (SpriteBatch&&) noexcept; 65 | 66 | SpriteBatch(SpriteBatch const&) = delete; 67 | SpriteBatch& operator= (SpriteBatch const&) = delete; 68 | 69 | DIRECTX_TOOLKIT_API virtual ~SpriteBatch(); 70 | 71 | // Begin/End a batch of sprite drawing operations. 72 | DIRECTX_TOOLKIT_API void XM_CALLCONV Begin( 73 | SpriteSortMode sortMode = SpriteSortMode_Deferred, 74 | _In_opt_ ID3D11BlendState* blendState = nullptr, 75 | _In_opt_ ID3D11SamplerState* samplerState = nullptr, 76 | _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, 77 | _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr, 78 | _In_ std::function setCustomShaders = nullptr, 79 | FXMMATRIX transformMatrix = MatrixIdentity); 80 | DIRECTX_TOOLKIT_API void __cdecl End(); 81 | 82 | // Draw overloads specifying position, origin and scale as XMFLOAT2. 83 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 84 | _In_ ID3D11ShaderResourceView* texture, 85 | XMFLOAT2 const& position, FXMVECTOR color = Colors::White); 86 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 87 | _In_ ID3D11ShaderResourceView* texture, 88 | XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, 89 | FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, 90 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 91 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 92 | _In_ ID3D11ShaderResourceView* texture, 93 | XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, 94 | FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, 95 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 96 | 97 | // Draw overloads specifying position, origin and scale via the first two components of an XMVECTOR. 98 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 99 | _In_ ID3D11ShaderResourceView* texture, 100 | FXMVECTOR position, FXMVECTOR color = Colors::White); 101 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 102 | _In_ ID3D11ShaderResourceView* texture, 103 | FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, 104 | FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, 105 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 106 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 107 | _In_ ID3D11ShaderResourceView* texture, 108 | FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, 109 | FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, 110 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 111 | 112 | // Draw overloads specifying position as a RECT. 113 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 114 | _In_ ID3D11ShaderResourceView* texture, 115 | RECT const& destinationRectangle, 116 | FXMVECTOR color = Colors::White); 117 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 118 | _In_ ID3D11ShaderResourceView* texture, 119 | RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, 120 | FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, 121 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 122 | 123 | // Rotation mode to be applied to the sprite transformation 124 | DIRECTX_TOOLKIT_API void __cdecl SetRotation(DXGI_MODE_ROTATION mode); 125 | DIRECTX_TOOLKIT_API DXGI_MODE_ROTATION __cdecl GetRotation() const noexcept; 126 | 127 | // Set viewport for sprite transformation 128 | DIRECTX_TOOLKIT_API void __cdecl SetViewport(const D3D11_VIEWPORT& viewPort); 129 | 130 | private: 131 | // Private implementation. 132 | struct Impl; 133 | 134 | std::unique_ptr pImpl; 135 | 136 | DIRECTX_TOOLKIT_API static const XMMATRIX MatrixIdentity; 137 | DIRECTX_TOOLKIT_API static const XMFLOAT2 Float2Zero; 138 | }; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/PrimitiveBatch.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: PrimitiveBatch.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #ifndef DIRECTX_TOOLKIT_API 25 | #ifdef DIRECTX_TOOLKIT_EXPORT 26 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 27 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 28 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 29 | #else 30 | #define DIRECTX_TOOLKIT_API 31 | #endif 32 | #endif 33 | 34 | 35 | namespace DirectX 36 | { 37 | inline namespace DX11 38 | { 39 | namespace Private 40 | { 41 | // Base class, not to be used directly: clients should access this via the derived PrimitiveBatch. 42 | class PrimitiveBatchBase 43 | { 44 | protected: 45 | DIRECTX_TOOLKIT_API PrimitiveBatchBase( 46 | _In_ ID3D11DeviceContext* deviceContext, 47 | size_t maxIndices, size_t maxVertices, size_t vertexSize); 48 | DIRECTX_TOOLKIT_API PrimitiveBatchBase(PrimitiveBatchBase&&) noexcept; 49 | DIRECTX_TOOLKIT_API PrimitiveBatchBase& operator= (PrimitiveBatchBase&&) noexcept; 50 | 51 | PrimitiveBatchBase(PrimitiveBatchBase const&) = delete; 52 | PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) = delete; 53 | 54 | DIRECTX_TOOLKIT_API virtual ~PrimitiveBatchBase(); 55 | 56 | public: 57 | // Begin/End a batch of primitive drawing operations. 58 | DIRECTX_TOOLKIT_API void __cdecl Begin(); 59 | DIRECTX_TOOLKIT_API void __cdecl End(); 60 | 61 | protected: 62 | // Internal, untyped drawing method. 63 | DIRECTX_TOOLKIT_API void __cdecl Draw( 64 | D3D11_PRIMITIVE_TOPOLOGY topology, 65 | bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, 66 | size_t indexCount, size_t vertexCount, 67 | _Out_ void** pMappedVertices); 68 | 69 | private: 70 | // Private implementation. 71 | class Impl; 72 | 73 | std::unique_ptr pImpl; 74 | }; 75 | } 76 | 77 | // Template makes the API typesafe, eg. PrimitiveBatch. 78 | template 79 | class PrimitiveBatch : public Private::PrimitiveBatchBase 80 | { 81 | static constexpr size_t DefaultBatchSize = 2048; 82 | 83 | public: 84 | explicit PrimitiveBatch( 85 | _In_ ID3D11DeviceContext* deviceContext, 86 | size_t maxIndices = DefaultBatchSize * 3, size_t maxVertices = DefaultBatchSize) 87 | : PrimitiveBatchBase(deviceContext, maxIndices, maxVertices, sizeof(TVertex)) 88 | { 89 | } 90 | 91 | PrimitiveBatch(PrimitiveBatch&&) = default; 92 | PrimitiveBatch& operator= (PrimitiveBatch&&) = default; 93 | 94 | PrimitiveBatch(PrimitiveBatch const&) = delete; 95 | PrimitiveBatch& operator= (PrimitiveBatch const&) = delete; 96 | 97 | // Similar to the D3D9 API DrawPrimitiveUP. 98 | void Draw( 99 | D3D11_PRIMITIVE_TOPOLOGY topology, 100 | _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) 101 | { 102 | void* mappedVertices; 103 | 104 | PrimitiveBatchBase::Draw(topology, false, nullptr, 0, vertexCount, &mappedVertices); 105 | 106 | memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex)); 107 | } 108 | 109 | 110 | // Similar to the D3D9 API DrawIndexedPrimitiveUP. 111 | void DrawIndexed( 112 | D3D11_PRIMITIVE_TOPOLOGY topology, 113 | _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, 114 | _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) 115 | { 116 | void* mappedVertices; 117 | 118 | PrimitiveBatchBase::Draw(topology, true, indices, indexCount, vertexCount, &mappedVertices); 119 | 120 | memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex)); 121 | } 122 | 123 | 124 | void DrawLine( 125 | TVertex const& v1, 126 | TVertex const& v2) 127 | { 128 | TVertex* mappedVertices; 129 | 130 | PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_LINELIST, false, nullptr, 0, 2, reinterpret_cast(&mappedVertices)); 131 | 132 | mappedVertices[0] = v1; 133 | mappedVertices[1] = v2; 134 | } 135 | 136 | 137 | void DrawTriangle( 138 | TVertex const& v1, 139 | TVertex const& v2, 140 | TVertex const& v3) 141 | { 142 | TVertex* mappedVertices; 143 | 144 | PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, false, nullptr, 0, 3, reinterpret_cast(&mappedVertices)); 145 | 146 | mappedVertices[0] = v1; 147 | mappedVertices[1] = v2; 148 | mappedVertices[2] = v3; 149 | } 150 | 151 | 152 | void DrawQuad( 153 | TVertex const& v1, 154 | TVertex const& v2, 155 | TVertex const& v3, 156 | TVertex const& v4) 157 | { 158 | static const uint16_t quadIndices[] = { 0, 1, 2, 0, 2, 3 }; 159 | 160 | TVertex* mappedVertices; 161 | 162 | PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, true, quadIndices, 6, 4, reinterpret_cast(&mappedVertices)); 163 | 164 | mappedVertices[0] = v1; 165 | mappedVertices[1] = v2; 166 | mappedVertices[2] = v3; 167 | mappedVertices[3] = v4; 168 | } 169 | }; 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/INIReader/ini.h: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | SPDX-License-Identifier: BSD-3-Clause 4 | 5 | Copyright (C) 2009-2020, Ben Hoyt 6 | 7 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 8 | home page for more info: 9 | 10 | https://github.com/benhoyt/inih 11 | 12 | */ 13 | 14 | #ifndef INI_H 15 | #define INI_H 16 | 17 | /* Make this header file easier to include in C++ code */ 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #include 23 | 24 | /* Nonzero if ini_handler callback should accept lineno parameter. */ 25 | #ifndef INI_HANDLER_LINENO 26 | #define INI_HANDLER_LINENO 0 27 | #endif 28 | 29 | /* Visibility symbols, required for Windows DLLs */ 30 | #ifndef INI_API 31 | #if defined _WIN32 || defined __CYGWIN__ 32 | # ifdef INI_SHARED_LIB 33 | # ifdef INI_SHARED_LIB_BUILDING 34 | # define INI_API __declspec(dllexport) 35 | # else 36 | # define INI_API __declspec(dllimport) 37 | # endif 38 | # else 39 | # define INI_API 40 | # endif 41 | #else 42 | # if defined(__GNUC__) && __GNUC__ >= 4 43 | # define INI_API __attribute__ ((visibility ("default"))) 44 | # else 45 | # define INI_API 46 | # endif 47 | #endif 48 | #endif 49 | 50 | /* Typedef for prototype of handler function. 51 | 52 | Note that even though the value parameter has type "const char*", the user 53 | may cast to "char*" and modify its content, as the value is not used again 54 | after the call to ini_handler. This is not true of section and name -- 55 | those must not be modified. 56 | */ 57 | #if INI_HANDLER_LINENO 58 | typedef int (*ini_handler)(void* user, const char* section, 59 | const char* name, const char* value, 60 | int lineno); 61 | #else 62 | typedef int (*ini_handler)(void* user, const char* section, 63 | const char* name, const char* value); 64 | #endif 65 | 66 | /* Typedef for prototype of fgets-style reader function. */ 67 | typedef char* (*ini_reader)(char* str, int num, void* stream); 68 | 69 | /* Parse given INI-style file. May have [section]s, name=value pairs 70 | (whitespace stripped), and comments starting with ';' (semicolon). Section 71 | is "" if name=value pair parsed before any section heading. name:value 72 | pairs are also supported as a concession to Python's configparser. 73 | 74 | For each name=value pair parsed, call handler function with given user 75 | pointer as well as section, name, and value (data only valid for duration 76 | of handler call). Handler should return nonzero on success, zero on error. 77 | 78 | Returns 0 on success, line number of first error on parse error (doesn't 79 | stop on first error), -1 on file open error, or -2 on memory allocation 80 | error (only when INI_USE_STACK is zero). 81 | */ 82 | INI_API int ini_parse(const char* filename, ini_handler handler, void* user); 83 | 84 | /* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't 85 | close the file when it's finished -- the caller must do that. */ 86 | INI_API int ini_parse_file(FILE* file, ini_handler handler, void* user); 87 | 88 | /* Same as ini_parse(), but takes an ini_reader function pointer instead of 89 | filename. Used for implementing custom or string-based I/O (see also 90 | ini_parse_string). */ 91 | INI_API int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, 92 | void* user); 93 | 94 | /* Same as ini_parse(), but takes a zero-terminated string with the INI data 95 | instead of a file. Useful for parsing INI data from a network socket or 96 | already in memory. */ 97 | INI_API int ini_parse_string(const char* string, ini_handler handler, void* user); 98 | 99 | /* Nonzero to allow multi-line value parsing, in the style of Python's 100 | configparser. If allowed, ini_parse() will call the handler with the same 101 | name for each subsequent line parsed. */ 102 | #ifndef INI_ALLOW_MULTILINE 103 | #define INI_ALLOW_MULTILINE 1 104 | #endif 105 | 106 | /* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of 107 | the file. See https://github.com/benhoyt/inih/issues/21 */ 108 | #ifndef INI_ALLOW_BOM 109 | #define INI_ALLOW_BOM 1 110 | #endif 111 | 112 | /* Chars that begin a start-of-line comment. Per Python configparser, allow 113 | both ; and # comments at the start of a line by default. */ 114 | #ifndef INI_START_COMMENT_PREFIXES 115 | #define INI_START_COMMENT_PREFIXES ";#" 116 | #endif 117 | 118 | /* Nonzero to allow inline comments (with valid inline comment characters 119 | specified by INI_INLINE_COMMENT_PREFIXES). Set to 0 to turn off and match 120 | Python 3.2+ configparser behaviour. */ 121 | #ifndef INI_ALLOW_INLINE_COMMENTS 122 | #define INI_ALLOW_INLINE_COMMENTS 1 123 | #endif 124 | #ifndef INI_INLINE_COMMENT_PREFIXES 125 | #define INI_INLINE_COMMENT_PREFIXES ";" 126 | #endif 127 | 128 | /* Nonzero to use stack for line buffer, zero to use heap (malloc/free). */ 129 | #ifndef INI_USE_STACK 130 | #define INI_USE_STACK 1 131 | #endif 132 | 133 | /* Maximum line length for any line in INI file (stack or heap). Note that 134 | this must be 3 more than the longest line (due to '\r', '\n', and '\0'). */ 135 | #ifndef INI_MAX_LINE 136 | #define INI_MAX_LINE 200 137 | #endif 138 | 139 | /* Nonzero to allow heap line buffer to grow via realloc(), zero for a 140 | fixed-size buffer of INI_MAX_LINE bytes. Only applies if INI_USE_STACK is 141 | zero. */ 142 | #ifndef INI_ALLOW_REALLOC 143 | #define INI_ALLOW_REALLOC 0 144 | #endif 145 | 146 | /* Initial size in bytes for heap line buffer. Only applies if INI_USE_STACK 147 | is zero. */ 148 | #ifndef INI_INITIAL_ALLOC 149 | #define INI_INITIAL_ALLOC 200 150 | #endif 151 | 152 | /* Stop parsing on first error (default is to keep parsing). */ 153 | #ifndef INI_STOP_ON_FIRST_ERROR 154 | #define INI_STOP_ON_FIRST_ERROR 0 155 | #endif 156 | 157 | /* Nonzero to call the handler at the start of each new section (with 158 | name and value NULL). Default is to only call the handler on 159 | each name=value pair. */ 160 | #ifndef INI_CALL_HANDLER_ON_NEW_SECTION 161 | #define INI_CALL_HANDLER_ON_NEW_SECTION 0 162 | #endif 163 | 164 | /* Nonzero to allow a name without a value (no '=' or ':' on the line) and 165 | call the handler with value NULL in this case. Default is to treat 166 | no-value lines as an error. */ 167 | #ifndef INI_ALLOW_NO_VALUE 168 | #define INI_ALLOW_NO_VALUE 0 169 | #endif 170 | 171 | /* Nonzero to use custom ini_malloc, ini_free, and ini_realloc memory 172 | allocation functions (INI_USE_STACK must also be 0). These functions must 173 | have the same signatures as malloc/free/realloc and behave in a similar 174 | way. ini_realloc is only needed if INI_ALLOW_REALLOC is set. */ 175 | #ifndef INI_CUSTOM_ALLOCATOR 176 | #define INI_CUSTOM_ALLOCATOR 0 177 | #endif 178 | 179 | 180 | #ifdef __cplusplus 181 | } 182 | #endif 183 | 184 | #endif /* INI_H */ 185 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/BufferHelpers.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: BufferHelpers.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #if defined(_XBOX_ONE) && defined(_TITLE) 16 | #include 17 | #include "GraphicsMemory.h" 18 | #else 19 | #include 20 | #endif 21 | 22 | #include 23 | 24 | #ifndef DIRECTX_TOOLKIT_API 25 | #ifdef DIRECTX_TOOLKIT_EXPORT 26 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 27 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 28 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 29 | #else 30 | #define DIRECTX_TOOLKIT_API 31 | #endif 32 | #endif 33 | 34 | 35 | namespace DirectX 36 | { 37 | // Helpers for creating initialized Direct3D buffer resources. 38 | DIRECTX_TOOLKIT_API 39 | HRESULT __cdecl CreateStaticBuffer( 40 | _In_ ID3D11Device* device, 41 | _In_reads_bytes_(count* stride) const void* ptr, 42 | size_t count, 43 | size_t stride, 44 | unsigned int bindFlags, 45 | _COM_Outptr_ ID3D11Buffer** pBuffer) noexcept; 46 | 47 | template 48 | HRESULT CreateStaticBuffer( 49 | _In_ ID3D11Device* device, 50 | _In_reads_(count) T const* data, 51 | size_t count, 52 | unsigned int bindFlags, 53 | _COM_Outptr_ ID3D11Buffer** pBuffer) noexcept 54 | { 55 | return CreateStaticBuffer(device, data, count, sizeof(T), bindFlags, pBuffer); 56 | } 57 | 58 | template 59 | HRESULT CreateStaticBuffer( 60 | _In_ ID3D11Device* device, 61 | T const& data, 62 | unsigned int bindFlags, 63 | _COM_Outptr_ ID3D11Buffer** pBuffer) noexcept 64 | { 65 | return CreateStaticBuffer(device, data.data(), data.size(), sizeof(typename T::value_type), bindFlags, pBuffer); 66 | } 67 | 68 | // Helpers for creating texture from memory arrays. 69 | DIRECTX_TOOLKIT_API 70 | HRESULT __cdecl CreateTextureFromMemory( 71 | _In_ ID3D11Device* device, 72 | size_t width, 73 | DXGI_FORMAT format, 74 | const D3D11_SUBRESOURCE_DATA& initData, 75 | _COM_Outptr_opt_ ID3D11Texture1D** texture, 76 | _COM_Outptr_opt_ ID3D11ShaderResourceView** textureView, 77 | unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept; 78 | 79 | DIRECTX_TOOLKIT_API 80 | HRESULT __cdecl CreateTextureFromMemory( 81 | _In_ ID3D11Device* device, 82 | size_t width, size_t height, 83 | DXGI_FORMAT format, 84 | const D3D11_SUBRESOURCE_DATA& initData, 85 | _COM_Outptr_opt_ ID3D11Texture2D** texture, 86 | _COM_Outptr_opt_ ID3D11ShaderResourceView** textureView, 87 | unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept; 88 | 89 | DIRECTX_TOOLKIT_API 90 | HRESULT __cdecl CreateTextureFromMemory( 91 | #if defined(_XBOX_ONE) && defined(_TITLE) 92 | _In_ ID3D11DeviceX* d3dDeviceX, 93 | _In_ ID3D11DeviceContextX* d3dContextX, 94 | #else 95 | _In_ ID3D11Device* device, 96 | _In_ ID3D11DeviceContext* d3dContext, 97 | #endif 98 | size_t width, size_t height, 99 | DXGI_FORMAT format, 100 | const D3D11_SUBRESOURCE_DATA& initData, 101 | _COM_Outptr_opt_ ID3D11Texture2D** texture, 102 | _COM_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; 103 | 104 | DIRECTX_TOOLKIT_API 105 | HRESULT __cdecl CreateTextureFromMemory( 106 | _In_ ID3D11Device* device, 107 | size_t width, size_t height, size_t depth, 108 | DXGI_FORMAT format, 109 | const D3D11_SUBRESOURCE_DATA& initData, 110 | _COM_Outptr_opt_ ID3D11Texture3D** texture, 111 | _COM_Outptr_opt_ ID3D11ShaderResourceView** textureView, 112 | unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept; 113 | 114 | // Strongly typed wrapper around a Direct3D constant buffer. 115 | inline namespace DX11 116 | { 117 | namespace Private 118 | { 119 | // Base class, not to be used directly: clients should access this via the derived PrimitiveBatch. 120 | class DIRECTX_TOOLKIT_API ConstantBufferBase 121 | { 122 | protected: 123 | void __cdecl CreateBuffer(_In_ ID3D11Device* device, size_t bytes, _Outptr_ ID3D11Buffer** pBuffer); 124 | }; 125 | } 126 | } 127 | 128 | template 129 | class ConstantBuffer : public DX11::Private::ConstantBufferBase 130 | { 131 | public: 132 | // Constructor. 133 | ConstantBuffer() = default; 134 | explicit ConstantBuffer(_In_ ID3D11Device* device) noexcept(false) 135 | { 136 | CreateBuffer(device, sizeof(T), mConstantBuffer.GetAddressOf()); 137 | } 138 | 139 | ConstantBuffer(ConstantBuffer&&) = default; 140 | ConstantBuffer& operator= (ConstantBuffer&&) = default; 141 | 142 | ConstantBuffer(ConstantBuffer const&) = delete; 143 | ConstantBuffer& operator= (ConstantBuffer const&) = delete; 144 | 145 | void Create(_In_ ID3D11Device* device) 146 | { 147 | CreateBuffer(device, sizeof(T), mConstantBuffer.ReleaseAndGetAddressOf()); 148 | } 149 | 150 | // Writes new data into the constant buffer. 151 | #if defined(_XBOX_ONE) && defined(_TITLE) 152 | void __cdecl SetData(_In_ ID3D11DeviceContext* deviceContext, T const& value, void** grfxMemory) 153 | { 154 | assert(grfxMemory != nullptr); 155 | 156 | void* ptr = GraphicsMemory::Get().Allocate(deviceContext, sizeof(T), 64); 157 | assert(ptr != nullptr); 158 | 159 | *(T*)ptr = value; 160 | 161 | *grfxMemory = ptr; 162 | } 163 | #else 164 | 165 | void __cdecl SetData(_In_ ID3D11DeviceContext* deviceContext, T const& value) noexcept 166 | { 167 | assert(mConstantBuffer); 168 | 169 | D3D11_MAPPED_SUBRESOURCE mappedResource; 170 | if (SUCCEEDED(deviceContext->Map(mConstantBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) 171 | { 172 | *static_cast(mappedResource.pData) = value; 173 | 174 | deviceContext->Unmap(mConstantBuffer.Get(), 0); 175 | } 176 | } 177 | #endif // _XBOX_ONE && _TITLE 178 | 179 | // Looks up the underlying D3D constant buffer. 180 | ID3D11Buffer* GetBuffer() const noexcept { return mConstantBuffer.Get(); } 181 | 182 | private: 183 | Microsoft::WRL::ComPtr mConstantBuffer; 184 | }; 185 | } 186 | -------------------------------------------------------------------------------- /NoShadowPlayBS/src/memory.cpp: -------------------------------------------------------------------------------- 1 | #include "memory.h" 2 | #include "utils.h" 3 | #include 4 | 5 | std::vector get_processes_by_name(const std::wstring& process_name) 6 | { 7 | std::vector process_ids; 8 | HANDLE h_process_snap; 9 | PROCESSENTRY32 pe32; 10 | pe32.dwSize = sizeof(PROCESSENTRY32); 11 | 12 | h_process_snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 13 | if (h_process_snap == INVALID_HANDLE_VALUE) 14 | return process_ids; 15 | 16 | if (!Process32First(h_process_snap, &pe32)) 17 | { 18 | CloseHandle(h_process_snap); 19 | return process_ids; 20 | } 21 | 22 | std::wstring target_name = to_lower(process_name); 23 | do 24 | { 25 | if (to_lower(pe32.szExeFile) == target_name) 26 | process_ids.push_back(pe32.th32ProcessID); 27 | } while (Process32Next(h_process_snap, &pe32)); 28 | 29 | CloseHandle(h_process_snap); 30 | return process_ids; 31 | } 32 | 33 | bool is_module_loaded(DWORD process_id, const std::wstring& module_name) 34 | { 35 | HANDLE h_module_snap = INVALID_HANDLE_VALUE; 36 | MODULEENTRY32 me32; 37 | me32.dwSize = sizeof(MODULEENTRY32); 38 | 39 | h_module_snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, process_id); 40 | if (h_module_snap == INVALID_HANDLE_VALUE) 41 | return false; 42 | 43 | if (!Module32First(h_module_snap, &me32)) 44 | { 45 | CloseHandle(h_module_snap); 46 | return false; 47 | } 48 | 49 | std::wstring target_module_name = to_lower(module_name); 50 | 51 | do 52 | { 53 | if (to_lower(me32.szModule) == target_module_name || to_lower(me32.szExePath) == target_module_name) 54 | { 55 | CloseHandle(h_module_snap); 56 | return true; 57 | } 58 | } while (Module32Next(h_module_snap, &me32)); 59 | 60 | CloseHandle(h_module_snap); 61 | return false; 62 | } 63 | 64 | uintptr_t get_remote_module_base_address(HANDLE h_process, const wchar_t* module_name) 65 | { 66 | HANDLE h_snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, GetProcessId(h_process)); 67 | if (h_snapshot == INVALID_HANDLE_VALUE) return 0; 68 | 69 | MODULEENTRY32 me; 70 | me.dwSize = sizeof(MODULEENTRY32); 71 | uintptr_t module_base = 0; 72 | if (Module32First(h_snapshot, &me)) 73 | { 74 | do 75 | { 76 | if (_wcsicmp(me.szModule, module_name) == 0) { 77 | module_base = (uintptr_t)me.modBaseAddr; 78 | break; 79 | } 80 | } while (Module32Next(h_snapshot, &me)); 81 | } 82 | CloseHandle(h_snapshot); 83 | return module_base; 84 | } 85 | 86 | uintptr_t get_exported_function_address(HANDLE h_process, uintptr_t module_base, const wchar_t* module_name, const char* function_name) { 87 | // Load the specified module locally (will just increase reference count if already loaded) 88 | // Only used to get a handle to the module 89 | HMODULE h_local_module = LoadLibrary(module_name); 90 | if (!h_local_module) return 0; 91 | 92 | // Get the address of the function in the local module 93 | FARPROC local_proc_address = GetProcAddress(h_local_module, function_name); 94 | if (!local_proc_address) 95 | { 96 | FreeLibrary(h_local_module); 97 | return 0; 98 | } 99 | 100 | // Calculate the offset of the function within the local module 101 | uintptr_t offset = (uintptr_t)local_proc_address - (uintptr_t)h_local_module; 102 | 103 | // Free the local module (decrease reference count) 104 | FreeLibrary(h_local_module); 105 | 106 | // TODO: Maybe refactor to only return the offset 107 | // Address of the function in the remote module 108 | return module_base + offset; 109 | } 110 | 111 | uintptr_t allocate_memory_near_address(HANDLE process, uintptr_t desired_address, SIZE_T size, DWORD protection, SIZE_T range) { 112 | /* Default/optional args: 113 | // DWORD protection = PAGE_EXECUTE_READWRITE 114 | // SIZE_T range = 0x20000000 - 0x2000 115 | */ 116 | 117 | const SIZE_T step = 0x1000; // One page (4KB) 118 | uintptr_t base_address = desired_address - range; 119 | uintptr_t end_address = desired_address + range; 120 | 121 | for (uintptr_t address = base_address; address < end_address; address += step) 122 | { 123 | void* allocated_memory = VirtualAllocEx( 124 | process, 125 | reinterpret_cast(address), 126 | size, 127 | MEM_RESERVE | MEM_COMMIT, 128 | protection 129 | ); 130 | 131 | if (allocated_memory != NULL) 132 | return reinterpret_cast(allocated_memory); 133 | } 134 | 135 | return NULL; 136 | } 137 | 138 | bool assemble_jump_near_instruction(uint8_t* buffer, uintptr_t source_address, uintptr_t target_address) { 139 | // TODO: Use dynamic byte array or force length of 5 bytes 140 | 141 | // Calculate the relative offset for the jump 142 | intptr_t jump_offset = target_address - (source_address + 5); // 5 is the size of the JMP instruction 143 | 144 | if (std::abs(jump_offset) > 0x7FFFFFFF) // Check if the offset is within 32-bit range 145 | return false; 146 | 147 | // Assemble the JMP instruction (E9 offset) 148 | buffer[0] = 0xE9; // JMP opcode 149 | *reinterpret_cast(buffer + 1) = static_cast(jump_offset); 150 | 151 | return true; 152 | } 153 | 154 | bool write_memory(HANDLE h_process, uintptr_t address, const void* buffer, SIZE_T size) { 155 | SIZE_T written; 156 | return WriteProcessMemory(h_process, reinterpret_cast(address), buffer, size, &written) && written == size; 157 | } 158 | 159 | bool write_memory_with_protection(HANDLE h_process, uintptr_t address, const void* buffer, SIZE_T size) { 160 | DWORD old_protect; 161 | 162 | // Change memory protection to allow writing 163 | if (!VirtualProtectEx(h_process, reinterpret_cast(address), size, PAGE_EXECUTE_READWRITE, &old_protect)) 164 | return false; 165 | 166 | bool success = write_memory(h_process, address, buffer, size); 167 | 168 | // Restore the original memory protection 169 | if (!VirtualProtectEx(h_process, reinterpret_cast(address), size, old_protect, &old_protect)) 170 | return false; 171 | 172 | return success; 173 | } 174 | 175 | bool write_memory_with_protection_dynamic(HANDLE h_process, uintptr_t address, const std::vector& buffer) { 176 | // TODO: Make overload for write_memory_with_protection 177 | DWORD old_protect; 178 | 179 | // Change memory protection to allow writing 180 | if (!VirtualProtectEx(h_process, reinterpret_cast(address), buffer.size(), PAGE_EXECUTE_READWRITE, &old_protect)) 181 | return false; 182 | 183 | // Write the memory 184 | bool success = write_memory(h_process, address, buffer.data(), buffer.size()); 185 | 186 | // Restore the original memory protection 187 | if (!VirtualProtectEx(h_process, reinterpret_cast(address), buffer.size(), old_protect, &old_protect)) 188 | return false; 189 | 190 | return success; 191 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio generated files 2 | *.suo 3 | *.user 4 | *.userosscache 5 | *.sln.docstates 6 | *.vcxproj.filters 7 | *.vcxproj.user 8 | 9 | # Visual Studio directories 10 | .vs/ 11 | bin/ 12 | obj/ 13 | Debug/ 14 | Release/ 15 | x64/ 16 | x86/ 17 | ARM/ 18 | ARM64/ 19 | 20 | # Build results 21 | [Dd]ebug/ 22 | [Dd]ebugPublic/ 23 | [Rr]elease/ 24 | [Rr]eleases/ 25 | x64/ 26 | x86/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio cache/options directory 36 | .vs/ 37 | *.vscode/ 38 | 39 | # MSTest test Results 40 | [Tt]est[Rr]esult*/ 41 | [Bb]uild[Ll]og.* 42 | 43 | # NUNIT 44 | *.VisualState.xml 45 | TestResult.xml 46 | 47 | # Build Results of an ATL Project 48 | [Dd]ebugPS/ 49 | [Rr]eleasePS/ 50 | dlldata.c 51 | 52 | # Benchmark Results 53 | BenchmarkDotNet.Artifacts/ 54 | 55 | # .NET Core 56 | project.lock.json 57 | project.fragment.lock.json 58 | artifacts/ 59 | 60 | # StyleCop 61 | StyleCopReport.xml 62 | 63 | # Files built by Visual Studio 64 | *_i.c 65 | *_p.c 66 | *_h.h 67 | *.ilk 68 | *.meta 69 | *.obj 70 | *.iobj 71 | *.pch 72 | *.pdb 73 | *.ipdb 74 | *.pgc 75 | *.pgd 76 | *.rsp 77 | *.sbr 78 | *.tlb 79 | *.tli 80 | *.tlh 81 | *.tmp 82 | *.tmp_proj 83 | *_wpftmp.csproj 84 | *.log 85 | *.vspscc 86 | *.vssscc 87 | .builds 88 | *.pidb 89 | *.svclog 90 | *.scc 91 | 92 | # Chutzpah Test files 93 | _Chutzpah* 94 | 95 | # Visual C++ cache files 96 | ipch/ 97 | *.aps 98 | *.ncb 99 | *.opendb 100 | *.opensdf 101 | *.sdf 102 | *.cachefile 103 | *.VC.db 104 | *.VC.VC.opendb 105 | 106 | # Visual Studio profiler 107 | *.psess 108 | *.vsp 109 | *.vspx 110 | *.sap 111 | 112 | # Visual Studio Trace Files 113 | *.e2e 114 | 115 | # TFS 2012 Local Workspace 116 | $tf/ 117 | 118 | # Guidance Automation Toolkit 119 | *.gpState 120 | 121 | # ReSharper is a .NET coding add-in 122 | _ReSharper*/ 123 | *.[Rr]e[Ss]harper 124 | *.DotSettings.user 125 | 126 | # JustCode is a .NET coding add-in 127 | .JustCode 128 | 129 | # TeamCity is a build add-in 130 | _TeamCity* 131 | 132 | # DotCover is a Code Coverage Tool 133 | *.dotCover 134 | 135 | # AxoCover is a Code Coverage Tool 136 | .axoCover/* 137 | !.axoCover/settings.json 138 | 139 | # Visual Studio code coverage results 140 | *.coverage 141 | *.coveragexml 142 | 143 | # NCrunch 144 | _NCrunch_* 145 | .*crunch*.local.xml 146 | nCrunchTemp_* 147 | 148 | # MightyMoose 149 | *.mm.* 150 | AutoTest.Net/ 151 | 152 | # Web workbench (sass) 153 | .sass-cache/ 154 | 155 | # Installshield output folder 156 | [Ee]xpress/ 157 | 158 | # DocProject is a documentation generator add-in 159 | DocProject/buildhelp/ 160 | DocProject/Help/*.HxT 161 | DocProject/Help/*.HxC 162 | DocProject/Help/Html2 163 | DocProject/Help/html 164 | 165 | # Click-Once directory 166 | publish/ 167 | 168 | # Publish Web Output 169 | *.[Pp]ublish.xml 170 | *.azurePubxml 171 | # Note: Comment the next line if you want to checkin your web deploy settings, 172 | # but database connection strings (with potential passwords) will be unencrypted 173 | *.pubxml 174 | *.publishproj 175 | 176 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 177 | # checkin your Azure Web App publish settings, but sensitive information contained 178 | # in these files may be visible to others. 179 | *.azurePubxml 180 | 181 | # NuGet Packages 182 | *.nupkg 183 | # The packages folder can be ignored because of Package Restore 184 | **/[Pp]ackages/* 185 | # except build/, which is used as an MSBuild target. 186 | !**/[Pp]ackages/build/ 187 | # Uncomment if necessary however generally it will be regenerated when needed 188 | #!**/[Pp]ackages/repositories.config 189 | # NuGet v3's project.json files produces more ignorable files 190 | *.nuget.props 191 | *.nuget.targets 192 | 193 | # Microsoft Azure Build Output 194 | csx/ 195 | *.build.csdef 196 | 197 | # Microsoft Azure Emulator 198 | ecf/ 199 | rcf/ 200 | 201 | # Windows Store app package directories and files 202 | AppPackages/ 203 | BundleArtifacts/ 204 | Package.StoreAssociation.xml 205 | _pkginfo.txt 206 | *.appx 207 | 208 | # Visual Studio cache files 209 | # files ending in .cache can be ignored 210 | *.[Cc]ache 211 | # but keep track of directories ending in .cache 212 | !?*.[Cc]ache/ 213 | 214 | # Others 215 | ClientBin/ 216 | ~$* 217 | *~ 218 | *.dbmdl 219 | *.dbproj.schemaview 220 | *.jfm 221 | *.pfx 222 | *.publishsettings 223 | orleans.codegen.cs 224 | 225 | # Including strong name files can present a security risk 226 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 227 | #*.snk 228 | 229 | # Since there are multiple workflows, uncomment next line to ignore bower_components 230 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 231 | #bower_components/ 232 | 233 | # RIA/Silverlight projects 234 | Generated_Code/ 235 | 236 | # Backup & report files from converting an old project file 237 | # to a newer Visual Studio version. Backup files are not needed, 238 | # because we have git ;-) 239 | _UpgradeReport_Files/ 240 | Backup*/ 241 | UpgradeLog*.XML 242 | UpgradeLog*.htm 243 | ServiceFabricBackup/ 244 | *.rptproj.bak 245 | 246 | # SQL Server files 247 | *.mdf 248 | *.ldf 249 | *.ndf 250 | 251 | # Business Intelligence projects 252 | *.rdl.data 253 | *.bim.layout 254 | *.bim_*.settings 255 | *.rptproj.rsuser 256 | *- Backup*.rdl 257 | 258 | # Microsoft Fakes 259 | FakesAssemblies/ 260 | 261 | # GhostDoc plugin setting file 262 | *.GhostDoc.xml 263 | 264 | # Node.js Tools for Visual Studio 265 | .ntvs_analysis.dat 266 | node_modules/ 267 | 268 | # Visual Studio 6 build log 269 | *.plg 270 | 271 | # Visual Studio 6 workspace options file 272 | *.opt 273 | 274 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 275 | *.vbw 276 | 277 | # Visual Studio LightSwitch build output 278 | **/*.HTMLClient/GeneratedArtifacts 279 | **/*.DesktopClient/GeneratedArtifacts 280 | **/*.DesktopClient/ModelManifest.xml 281 | **/*.Server/GeneratedArtifacts 282 | **/*.Server/ModelManifest.xml 283 | _Pvt_Extensions 284 | 285 | # Paket dependency manager 286 | .paket/paket.exe 287 | paket-files/ 288 | 289 | # FAKE - F# Make 290 | .fake/ 291 | 292 | # JetBrains Rider 293 | .idea/ 294 | *.sln.iml 295 | 296 | # CodeRush personal settings 297 | .cr/personal 298 | 299 | # Python Tools for Visual Studio (PTVS) 300 | __pycache__/ 301 | *.pyc 302 | 303 | # Cake - Uncomment if you are using it 304 | # tools/** 305 | # !tools/packages.config 306 | 307 | # Tabs Studio 308 | *.tss 309 | 310 | # Telerik's JustMock configuration file 311 | *.jmconfig 312 | 313 | # BizTalk build output 314 | *.btp.cs 315 | *.btm.cs 316 | *.odx.cs 317 | *.xsd.cs 318 | 319 | # OpenCover UI analysis results 320 | OpenCover/ 321 | 322 | # Azure Stream Analytics local run output 323 | ASALocalRun/ 324 | 325 | # MSBuild Binary and Structured Log 326 | *.binlog 327 | 328 | # NVidia Nsight GPU debugger configuration file 329 | *.nvuser 330 | 331 | # MFractors (Xamarin productivity tool) working folder 332 | .mfractor/ 333 | 334 | # Local History for Visual Studio 335 | .localhistory/ 336 | 337 | # BeatPulse healthcheck temp database 338 | healthchecksdb 339 | 340 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 341 | MigrationBackup/ 342 | 343 | # Ionide (cross platform F# VS Code tools) working folder 344 | .ionide/ 345 | 346 | # CMake 347 | CMakeLists.txt.user 348 | CMakeCache.txt 349 | CMakeFiles/ 350 | CMakeScripts/ 351 | Testing/ 352 | Makefile 353 | cmake_install.cmake 354 | install_manifest.txt 355 | compile_commands.json 356 | CTestTestfile.cmake 357 | _deps 358 | 359 | # Common C++ artifacts 360 | *.exe 361 | *.out 362 | *.app 363 | *.i*86 364 | *.x86_64 365 | *.hex 366 | *.dSYM/ 367 | *.su 368 | *.idb 369 | *.pdb 370 | *.map 371 | 372 | # Qt-es 373 | object_script.*.Release 374 | object_script.*.Debug 375 | *_plugin_import.cpp 376 | /.qmake.cache 377 | /.qmake.stash 378 | *.pro.user 379 | *.pro.user.* 380 | *.qbs.user 381 | *.qbs.user.* 382 | *.moc 383 | moc_*.cpp 384 | moc_*.h 385 | qrc_*.cpp 386 | ui_*.h 387 | *.qmlc 388 | *.jsc 389 | Makefile* 390 | *build-* 391 | *.qm 392 | *.prl 393 | 394 | # Qt unit tests 395 | target_wrapper.* 396 | 397 | # QtCreator 398 | *.autosave 399 | 400 | # QtCreator Qml 401 | *.qmlproject.user 402 | *.qmlproject.user.* 403 | 404 | # QtCreator CMake 405 | CMakeLists.txt.user* 406 | 407 | # QtCreator 4.8< compilation database 408 | compile_commands.json 409 | 410 | # QtCreator local machine specific files for imported projects 411 | *creator.user* 412 | 413 | # IntelliSense Database 414 | *.VC.db-* 415 | 416 | # Custom additions - add your project specific ignores here 417 | # *.config 418 | # *.ini -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/DirectXHelpers.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DirectXHelpers.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #ifdef _MSC_VER 19 | #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) 20 | #if !defined(_XBOX_ONE) || !defined(_TITLE) 21 | #pragma comment(lib,"dxguid.lib") 22 | #endif 23 | #endif 24 | #endif 25 | 26 | #ifndef IID_GRAPHICS_PPV_ARGS 27 | #define IID_GRAPHICS_PPV_ARGS(x) IID_PPV_ARGS(x) 28 | #endif 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #ifndef DIRECTX_TOOLKIT_API 37 | #ifdef DIRECTX_TOOLKIT_EXPORT 38 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 39 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 40 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 41 | #else 42 | #define DIRECTX_TOOLKIT_API 43 | #endif 44 | #endif 45 | 46 | 47 | // 48 | // The core Direct3D headers provide the following helper C++ classes 49 | // CD3D11_RECT 50 | // CD3D11_BOX 51 | // CD3D11_DEPTH_STENCIL_DESC 52 | // CD3D11_BLEND_DESC, CD3D11_BLEND_DESC1 53 | // CD3D11_RASTERIZER_DESC, CD3D11_RASTERIZER_DESC1 54 | // CD3D11_BUFFER_DESC 55 | // CD3D11_TEXTURE1D_DESC 56 | // CD3D11_TEXTURE2D_DESC 57 | // CD3D11_TEXTURE3D_DESC 58 | // CD3D11_SHADER_RESOURCE_VIEW_DESC 59 | // CD3D11_RENDER_TARGET_VIEW_DESC 60 | // CD3D11_VIEWPORT 61 | // CD3D11_DEPTH_STENCIL_VIEW_DESC 62 | // CD3D11_UNORDERED_ACCESS_VIEW_DESC 63 | // CD3D11_SAMPLER_DESC 64 | // CD3D11_QUERY_DESC 65 | // CD3D11_COUNTER_DESC 66 | // 67 | 68 | 69 | namespace DirectX 70 | { 71 | inline namespace DX11 72 | { 73 | class IEffect; 74 | } 75 | 76 | // simliar to std::lock_guard for exception-safe Direct3D resource locking 77 | class DIRECTX_TOOLKIT_API MapGuard : public D3D11_MAPPED_SUBRESOURCE 78 | { 79 | public: 80 | MapGuard(_In_ ID3D11DeviceContext* context, 81 | _In_ ID3D11Resource *resource, 82 | _In_ unsigned int subresource, 83 | _In_ D3D11_MAP mapType, 84 | _In_ unsigned int mapFlags) noexcept(false) 85 | : mContext(context), mResource(resource), mSubresource(subresource) 86 | { 87 | HRESULT hr = mContext->Map(resource, subresource, mapType, mapFlags, this); 88 | if (FAILED(hr)) 89 | { 90 | throw std::exception(); 91 | } 92 | } 93 | 94 | MapGuard(MapGuard&&) = delete; 95 | MapGuard& operator= (MapGuard&&) = delete; 96 | 97 | MapGuard(MapGuard const&) = delete; 98 | MapGuard& operator= (MapGuard const&) = delete; 99 | 100 | ~MapGuard() 101 | { 102 | mContext->Unmap(mResource, mSubresource); 103 | } 104 | 105 | #ifdef __clang__ 106 | #pragma clang diagnostic push 107 | #pragma clang diagnostic ignored "-Wunknown-warning-option" 108 | #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" 109 | #endif 110 | 111 | uint8_t* get() const noexcept 112 | { 113 | return static_cast(pData); 114 | } 115 | uint8_t* get(size_t slice) const noexcept 116 | { 117 | return static_cast(pData) + (slice * DepthPitch); 118 | } 119 | 120 | uint8_t* scanline(size_t row) const noexcept 121 | { 122 | return static_cast(pData) + (row * RowPitch); 123 | } 124 | uint8_t* scanline(size_t slice, size_t row) const noexcept 125 | { 126 | return static_cast(pData) + (slice * DepthPitch) + (row * RowPitch); 127 | } 128 | 129 | #ifdef __clang__ 130 | #pragma clang diagnostic pop 131 | #endif 132 | 133 | template 134 | void copy(_In_reads_(count) T const* data, size_t count) noexcept 135 | { 136 | memcpy(pData, data, count * sizeof(T)); 137 | } 138 | 139 | template 140 | void copy(T const& data) noexcept 141 | { 142 | memcpy(pData, data.data(), data.size() * sizeof(typename T::value_type)); 143 | } 144 | 145 | private: 146 | ID3D11DeviceContext* mContext; 147 | ID3D11Resource* mResource; 148 | unsigned int mSubresource; 149 | }; 150 | 151 | 152 | // Helper sets a D3D resource name string (used by PIX and debug layer leak reporting). 153 | #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) 154 | template 155 | inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const char(&name)[TNameLength]) noexcept 156 | { 157 | #if defined(_XBOX_ONE) && defined(_TITLE) 158 | wchar_t wname[MAX_PATH]; 159 | int result = MultiByteToWideChar(CP_UTF8, 0, name, TNameLength, wname, MAX_PATH); 160 | if (result > 0) 161 | { 162 | resource->SetName(wname); 163 | } 164 | #else 165 | resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name); 166 | #endif 167 | } 168 | #else 169 | template 170 | inline void SetDebugObjectName(_In_ ID3D11DeviceChild*, _In_z_ const char(&)[TNameLength]) noexcept 171 | { 172 | } 173 | #endif 174 | 175 | #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) 176 | template 177 | inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength]) 178 | { 179 | #if defined(_XBOX_ONE) && defined(_TITLE) 180 | resource->SetName(name); 181 | #else 182 | char aname[MAX_PATH]; 183 | int result = WideCharToMultiByte(CP_UTF8, 0, name, TNameLength, aname, MAX_PATH, nullptr, nullptr); 184 | if (result > 0) 185 | { 186 | resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, aname); 187 | } 188 | #endif 189 | } 190 | #else 191 | template 192 | inline void SetDebugObjectName(_In_ ID3D11DeviceChild*, _In_z_ const wchar_t(&)[TNameLength]) 193 | { 194 | } 195 | #endif 196 | 197 | inline namespace DX11 198 | { 199 | // Helper to check for power-of-2 200 | template 201 | constexpr bool IsPowerOf2(T x) noexcept { return ((x != 0) && !(x & (x - 1))); } 202 | 203 | // Helpers for aligning values by a power of 2 204 | template 205 | inline T AlignDown(T size, size_t alignment) noexcept 206 | { 207 | if (alignment > 0) 208 | { 209 | assert(((alignment - 1) & alignment) == 0); 210 | auto mask = static_cast(alignment - 1); 211 | return size & ~mask; 212 | } 213 | return size; 214 | } 215 | 216 | template 217 | inline T AlignUp(T size, size_t alignment) noexcept 218 | { 219 | if (alignment > 0) 220 | { 221 | assert(((alignment - 1) & alignment) == 0); 222 | auto mask = static_cast(alignment - 1); 223 | return (size + mask) & ~mask; 224 | } 225 | return size; 226 | } 227 | } 228 | 229 | // Helper for creating a Direct3D input layout to match a shader from an IEffect 230 | DIRECTX_TOOLKIT_API 231 | HRESULT __cdecl CreateInputLayoutFromEffect( 232 | _In_ ID3D11Device* device, 233 | _In_ IEffect* effect, 234 | _In_reads_(count) const D3D11_INPUT_ELEMENT_DESC* desc, 235 | size_t count, 236 | _COM_Outptr_ ID3D11InputLayout** pInputLayout) noexcept; 237 | 238 | template 239 | HRESULT CreateInputLayoutFromEffect(_In_ ID3D11Device* device, 240 | _In_ IEffect* effect, 241 | _COM_Outptr_ ID3D11InputLayout** pInputLayout) noexcept 242 | { 243 | return CreateInputLayoutFromEffect(device, effect, T::InputElements, T::InputElementCount, pInputLayout); 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /NoShadowPlayBS/NoShadowPlayBS.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | Win32Proj 24 | {73705999-89ab-48a5-be5a-5126acd3ed84} 25 | NoShadowPlayBS 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | 84 | 85 | 86 | 87 | Level3 88 | true 89 | true 90 | true 91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Console 96 | true 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | true 118 | true 119 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | stdcpp20 122 | $(ProjectDir)include;$(ProjectDir)src;%(AdditionalIncludeDirectories) 123 | 124 | 125 | Windows 126 | true 127 | true 128 | true 129 | $(ProjectDir)lib;%(AdditionalLibraryDirectories) 130 | DirectXTK.lib;%(AdditionalDependencies) 131 | RequireAdministrator 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/INIReader/ini.c: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | SPDX-License-Identifier: BSD-3-Clause 4 | 5 | Copyright (C) 2009-2020, Ben Hoyt 6 | 7 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 8 | home page for more info: 9 | 10 | https://github.com/benhoyt/inih 11 | 12 | */ 13 | 14 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 15 | #define _CRT_SECURE_NO_WARNINGS 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "ini.h" 23 | 24 | #if !INI_USE_STACK 25 | #if INI_CUSTOM_ALLOCATOR 26 | #include 27 | void* ini_malloc(size_t size); 28 | void ini_free(void* ptr); 29 | void* ini_realloc(void* ptr, size_t size); 30 | #else 31 | #include 32 | #define ini_malloc malloc 33 | #define ini_free free 34 | #define ini_realloc realloc 35 | #endif 36 | #endif 37 | 38 | #define MAX_SECTION 50 39 | #define MAX_NAME 50 40 | 41 | /* Used by ini_parse_string() to keep track of string parsing state. */ 42 | typedef struct { 43 | const char* ptr; 44 | size_t num_left; 45 | } ini_parse_string_ctx; 46 | 47 | /* Strip whitespace chars off end of given string, in place. Return s. */ 48 | static char* ini_rstrip(char* s) 49 | { 50 | char* p = s + strlen(s); 51 | while (p > s && isspace((unsigned char)(*--p))) 52 | *p = '\0'; 53 | return s; 54 | } 55 | 56 | /* Return pointer to first non-whitespace char in given string. */ 57 | static char* ini_lskip(const char* s) 58 | { 59 | while (*s && isspace((unsigned char)(*s))) 60 | s++; 61 | return (char*)s; 62 | } 63 | 64 | /* Return pointer to first char (of chars) or inline comment in given string, 65 | or pointer to NUL at end of string if neither found. Inline comment must 66 | be prefixed by a whitespace character to register as a comment. */ 67 | static char* ini_find_chars_or_comment(const char* s, const char* chars) 68 | { 69 | #if INI_ALLOW_INLINE_COMMENTS 70 | int was_space = 0; 71 | while (*s && (!chars || !strchr(chars, *s)) && 72 | !(was_space && strchr(INI_INLINE_COMMENT_PREFIXES, *s))) { 73 | was_space = isspace((unsigned char)(*s)); 74 | s++; 75 | } 76 | #else 77 | while (*s && (!chars || !strchr(chars, *s))) { 78 | s++; 79 | } 80 | #endif 81 | return (char*)s; 82 | } 83 | 84 | /* Similar to strncpy, but ensures dest (size bytes) is 85 | NUL-terminated, and doesn't pad with NULs. */ 86 | static char* ini_strncpy0(char* dest, const char* src, size_t size) 87 | { 88 | /* Could use strncpy internally, but it causes gcc warnings (see issue #91) */ 89 | size_t i; 90 | for (i = 0; i < size - 1 && src[i]; i++) 91 | dest[i] = src[i]; 92 | dest[i] = '\0'; 93 | return dest; 94 | } 95 | 96 | /* See documentation in header file. */ 97 | int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, 98 | void* user) 99 | { 100 | /* Uses a fair bit of stack (use heap instead if you need to) */ 101 | #if INI_USE_STACK 102 | char line[INI_MAX_LINE]; 103 | size_t max_line = INI_MAX_LINE; 104 | #else 105 | char* line; 106 | size_t max_line = INI_INITIAL_ALLOC; 107 | #endif 108 | #if INI_ALLOW_REALLOC && !INI_USE_STACK 109 | char* new_line; 110 | size_t offset; 111 | #endif 112 | char section[MAX_SECTION] = ""; 113 | #if INI_ALLOW_MULTILINE 114 | char prev_name[MAX_NAME] = ""; 115 | #endif 116 | 117 | char* start; 118 | char* end; 119 | char* name; 120 | char* value; 121 | int lineno = 0; 122 | int error = 0; 123 | 124 | #if !INI_USE_STACK 125 | line = (char*)ini_malloc(INI_INITIAL_ALLOC); 126 | if (!line) { 127 | return -2; 128 | } 129 | #endif 130 | 131 | #if INI_HANDLER_LINENO 132 | #define HANDLER(u, s, n, v) handler(u, s, n, v, lineno) 133 | #else 134 | #define HANDLER(u, s, n, v) handler(u, s, n, v) 135 | #endif 136 | 137 | /* Scan through stream line by line */ 138 | while (reader(line, (int)max_line, stream) != NULL) { 139 | #if INI_ALLOW_REALLOC && !INI_USE_STACK 140 | offset = strlen(line); 141 | while (offset == max_line - 1 && line[offset - 1] != '\n') { 142 | max_line *= 2; 143 | if (max_line > INI_MAX_LINE) 144 | max_line = INI_MAX_LINE; 145 | new_line = ini_realloc(line, max_line); 146 | if (!new_line) { 147 | ini_free(line); 148 | return -2; 149 | } 150 | line = new_line; 151 | if (reader(line + offset, (int)(max_line - offset), stream) == NULL) 152 | break; 153 | if (max_line >= INI_MAX_LINE) 154 | break; 155 | offset += strlen(line + offset); 156 | } 157 | #endif 158 | 159 | lineno++; 160 | 161 | start = line; 162 | #if INI_ALLOW_BOM 163 | if (lineno == 1 && (unsigned char)start[0] == 0xEF && 164 | (unsigned char)start[1] == 0xBB && 165 | (unsigned char)start[2] == 0xBF) { 166 | start += 3; 167 | } 168 | #endif 169 | start = ini_rstrip(ini_lskip(start)); 170 | 171 | if (strchr(INI_START_COMMENT_PREFIXES, *start)) { 172 | /* Start-of-line comment */ 173 | } 174 | #if INI_ALLOW_MULTILINE 175 | else if (*prev_name && *start && start > line) { 176 | #if INI_ALLOW_INLINE_COMMENTS 177 | end = ini_find_chars_or_comment(start, NULL); 178 | if (*end) 179 | *end = '\0'; 180 | ini_rstrip(start); 181 | #endif 182 | /* Non-blank line with leading whitespace, treat as continuation 183 | of previous name's value (as per Python configparser). */ 184 | if (!HANDLER(user, section, prev_name, start) && !error) 185 | error = lineno; 186 | } 187 | #endif 188 | else if (*start == '[') { 189 | /* A "[section]" line */ 190 | end = ini_find_chars_or_comment(start + 1, "]"); 191 | if (*end == ']') { 192 | *end = '\0'; 193 | ini_strncpy0(section, start + 1, sizeof(section)); 194 | #if INI_ALLOW_MULTILINE 195 | *prev_name = '\0'; 196 | #endif 197 | #if INI_CALL_HANDLER_ON_NEW_SECTION 198 | if (!HANDLER(user, section, NULL, NULL) && !error) 199 | error = lineno; 200 | #endif 201 | } 202 | else if (!error) { 203 | /* No ']' found on section line */ 204 | error = lineno; 205 | } 206 | } 207 | else if (*start) { 208 | /* Not a comment, must be a name[=:]value pair */ 209 | end = ini_find_chars_or_comment(start, "=:"); 210 | if (*end == '=' || *end == ':') { 211 | *end = '\0'; 212 | name = ini_rstrip(start); 213 | value = end + 1; 214 | #if INI_ALLOW_INLINE_COMMENTS 215 | end = ini_find_chars_or_comment(value, NULL); 216 | if (*end) 217 | *end = '\0'; 218 | #endif 219 | value = ini_lskip(value); 220 | ini_rstrip(value); 221 | 222 | #if INI_ALLOW_MULTILINE 223 | ini_strncpy0(prev_name, name, sizeof(prev_name)); 224 | #endif 225 | /* Valid name[=:]value pair found, call handler */ 226 | if (!HANDLER(user, section, name, value) && !error) 227 | error = lineno; 228 | } 229 | else if (!error) { 230 | /* No '=' or ':' found on name[=:]value line */ 231 | #if INI_ALLOW_NO_VALUE 232 | *end = '\0'; 233 | name = ini_rstrip(start); 234 | if (!HANDLER(user, section, name, NULL) && !error) 235 | error = lineno; 236 | #else 237 | error = lineno; 238 | #endif 239 | } 240 | } 241 | 242 | #if INI_STOP_ON_FIRST_ERROR 243 | if (error) 244 | break; 245 | #endif 246 | } 247 | 248 | #if !INI_USE_STACK 249 | ini_free(line); 250 | #endif 251 | 252 | return error; 253 | } 254 | 255 | /* See documentation in header file. */ 256 | int ini_parse_file(FILE* file, ini_handler handler, void* user) 257 | { 258 | return ini_parse_stream((ini_reader)fgets, file, handler, user); 259 | } 260 | 261 | /* See documentation in header file. */ 262 | int ini_parse(const char* filename, ini_handler handler, void* user) 263 | { 264 | FILE* file; 265 | int error; 266 | 267 | file = fopen(filename, "r"); 268 | if (!file) 269 | return -1; 270 | error = ini_parse_file(file, handler, user); 271 | fclose(file); 272 | return error; 273 | } 274 | 275 | /* An ini_reader function to read the next line from a string buffer. This 276 | is the fgets() equivalent used by ini_parse_string(). */ 277 | static char* ini_reader_string(char* str, int num, void* stream) { 278 | ini_parse_string_ctx* ctx = (ini_parse_string_ctx*)stream; 279 | const char* ctx_ptr = ctx->ptr; 280 | size_t ctx_num_left = ctx->num_left; 281 | char* strp = str; 282 | char c; 283 | 284 | if (ctx_num_left == 0 || num < 2) 285 | return NULL; 286 | 287 | while (num > 1 && ctx_num_left != 0) { 288 | c = *ctx_ptr++; 289 | ctx_num_left--; 290 | *strp++ = c; 291 | if (c == '\n') 292 | break; 293 | num--; 294 | } 295 | 296 | *strp = '\0'; 297 | ctx->ptr = ctx_ptr; 298 | ctx->num_left = ctx_num_left; 299 | return str; 300 | } 301 | 302 | /* See documentation in header file. */ 303 | int ini_parse_string(const char* string, ini_handler handler, void* user) { 304 | ini_parse_string_ctx ctx; 305 | 306 | ctx.ptr = string; 307 | ctx.num_left = strlen(string); 308 | return ini_parse_stream((ini_reader)ini_reader_string, &ctx, handler, 309 | user); 310 | } 311 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/PostProcess.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: PostProcess.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | #ifndef DIRECTX_TOOLKIT_API 25 | #ifdef DIRECTX_TOOLKIT_EXPORT 26 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 27 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 28 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 29 | #else 30 | #define DIRECTX_TOOLKIT_API 31 | #endif 32 | #endif 33 | 34 | 35 | namespace DirectX 36 | { 37 | inline namespace DX11 38 | { 39 | //------------------------------------------------------------------------------ 40 | // Abstract interface representing a post-process pass 41 | class DIRECTX_TOOLKIT_API IPostProcess 42 | { 43 | public: 44 | virtual ~IPostProcess() = default; 45 | 46 | IPostProcess(const IPostProcess&) = delete; 47 | IPostProcess& operator=(const IPostProcess&) = delete; 48 | 49 | virtual void __cdecl Process( 50 | _In_ ID3D11DeviceContext* deviceContext, 51 | _In_ std::function setCustomState = nullptr) = 0; 52 | 53 | protected: 54 | IPostProcess() = default; 55 | IPostProcess(IPostProcess&&) = default; 56 | IPostProcess& operator=(IPostProcess&&) = default; 57 | }; 58 | 59 | 60 | //------------------------------------------------------------------------------ 61 | // Basic post-process 62 | class BasicPostProcess : public IPostProcess 63 | { 64 | public: 65 | enum Effect : uint32_t 66 | { 67 | Copy, 68 | Monochrome, 69 | Sepia, 70 | DownScale_2x2, 71 | DownScale_4x4, 72 | GaussianBlur_5x5, 73 | BloomExtract, 74 | BloomBlur, 75 | Effect_Max 76 | }; 77 | 78 | DIRECTX_TOOLKIT_API explicit BasicPostProcess(_In_ ID3D11Device* device); 79 | 80 | DIRECTX_TOOLKIT_API BasicPostProcess(BasicPostProcess&&) noexcept; 81 | DIRECTX_TOOLKIT_API BasicPostProcess& operator= (BasicPostProcess&&) noexcept; 82 | 83 | BasicPostProcess(BasicPostProcess const&) = delete; 84 | BasicPostProcess& operator= (BasicPostProcess const&) = delete; 85 | 86 | DIRECTX_TOOLKIT_API ~BasicPostProcess() override; 87 | 88 | // IPostProcess methods. 89 | DIRECTX_TOOLKIT_API void __cdecl Process( 90 | _In_ ID3D11DeviceContext* deviceContext, 91 | _In_ std::function setCustomState = nullptr) override; 92 | 93 | // Shader control 94 | DIRECTX_TOOLKIT_API void __cdecl SetEffect(Effect fx); 95 | 96 | // Properties 97 | DIRECTX_TOOLKIT_API void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); 98 | 99 | // Sets multiplier for GaussianBlur_5x5 100 | DIRECTX_TOOLKIT_API void __cdecl SetGaussianParameter(float multiplier); 101 | 102 | // Sets parameters for BloomExtract 103 | DIRECTX_TOOLKIT_API void __cdecl SetBloomExtractParameter(float threshold); 104 | 105 | // Sets parameters for BloomBlur 106 | DIRECTX_TOOLKIT_API void __cdecl SetBloomBlurParameters(bool horizontal, float size, float brightness); 107 | 108 | private: 109 | // Private implementation. 110 | class Impl; 111 | 112 | std::unique_ptr pImpl; 113 | }; 114 | 115 | 116 | //------------------------------------------------------------------------------ 117 | // Dual-texure post-process 118 | class DualPostProcess : public IPostProcess 119 | { 120 | public: 121 | enum Effect : uint32_t 122 | { 123 | Merge, 124 | BloomCombine, 125 | Effect_Max 126 | }; 127 | 128 | DIRECTX_TOOLKIT_API explicit DualPostProcess(_In_ ID3D11Device* device); 129 | 130 | DIRECTX_TOOLKIT_API DualPostProcess(DualPostProcess&&) noexcept; 131 | DIRECTX_TOOLKIT_API DualPostProcess& operator= (DualPostProcess&&) noexcept; 132 | 133 | DualPostProcess(DualPostProcess const&) = delete; 134 | DualPostProcess& operator= (DualPostProcess const&) = delete; 135 | 136 | DIRECTX_TOOLKIT_API ~DualPostProcess() override; 137 | 138 | // IPostProcess methods. 139 | DIRECTX_TOOLKIT_API void __cdecl Process( 140 | _In_ ID3D11DeviceContext* deviceContext, 141 | _In_ std::function setCustomState = nullptr) override; 142 | 143 | // Shader control 144 | DIRECTX_TOOLKIT_API void __cdecl SetEffect(Effect fx); 145 | 146 | // Properties 147 | DIRECTX_TOOLKIT_API void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); 148 | DIRECTX_TOOLKIT_API void __cdecl SetSourceTexture2(_In_opt_ ID3D11ShaderResourceView* value); 149 | 150 | // Sets parameters for Merge 151 | DIRECTX_TOOLKIT_API void __cdecl SetMergeParameters(float weight1, float weight2); 152 | 153 | // Sets parameters for BloomCombine 154 | DIRECTX_TOOLKIT_API void __cdecl SetBloomCombineParameters(float bloom, float base, float bloomSaturation, float baseSaturation); 155 | 156 | private: 157 | // Private implementation. 158 | class Impl; 159 | 160 | std::unique_ptr pImpl; 161 | }; 162 | 163 | 164 | //------------------------------------------------------------------------------ 165 | // Tone-map post-process 166 | class ToneMapPostProcess : public IPostProcess 167 | { 168 | public: 169 | // Tone-mapping operator 170 | enum Operator : uint32_t 171 | { 172 | None, // Pass-through 173 | Saturate, // Clamp [0,1] 174 | Reinhard, // x/(1+x) 175 | ACESFilmic, 176 | Operator_Max 177 | }; 178 | 179 | // Electro-Optical Transfer Function (EOTF) 180 | enum TransferFunction : uint32_t 181 | { 182 | Linear, // Pass-through 183 | SRGB, // sRGB (Rec.709 and approximate sRGB display curve) 184 | ST2084, // HDR10 (Rec.2020 color primaries and ST.2084 display curve) 185 | TransferFunction_Max 186 | }; 187 | 188 | // Color Rotation Transform for HDR10 189 | enum ColorPrimaryRotation : uint32_t 190 | { 191 | HDTV_to_UHDTV, // Rec.709 to Rec.2020 192 | DCI_P3_D65_to_UHDTV, // DCI-P3-D65 (a.k.a Display P3 or P3D65) to Rec.2020 193 | HDTV_to_DCI_P3_D65, // Rec.709 to DCI-P3-D65 (a.k.a Display P3 or P3D65) 194 | }; 195 | 196 | DIRECTX_TOOLKIT_API explicit ToneMapPostProcess(_In_ ID3D11Device* device); 197 | 198 | DIRECTX_TOOLKIT_API ToneMapPostProcess(ToneMapPostProcess&&) noexcept; 199 | DIRECTX_TOOLKIT_API ToneMapPostProcess& operator= (ToneMapPostProcess&&) noexcept; 200 | 201 | ToneMapPostProcess(ToneMapPostProcess const&) = delete; 202 | ToneMapPostProcess& operator= (ToneMapPostProcess const&) = delete; 203 | 204 | DIRECTX_TOOLKIT_API ~ToneMapPostProcess() override; 205 | 206 | // IPostProcess methods. 207 | DIRECTX_TOOLKIT_API void __cdecl Process( 208 | _In_ ID3D11DeviceContext* deviceContext, 209 | _In_ std::function setCustomState = nullptr) override; 210 | 211 | // Shader control 212 | DIRECTX_TOOLKIT_API void __cdecl SetOperator(Operator op); 213 | 214 | DIRECTX_TOOLKIT_API void __cdecl SetTransferFunction(TransferFunction func); 215 | 216 | #if defined(_XBOX_ONE) && defined(_TITLE) 217 | // Uses Multiple Render Targets to generate both HDR10 and GameDVR SDR signals 218 | DIRECTX_TOOLKIT_API void __cdecl SetMRTOutput(bool value = true); 219 | #endif 220 | 221 | // Properties 222 | DIRECTX_TOOLKIT_API void __cdecl SetHDRSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); 223 | 224 | // Sets the Color Rotation Transform for HDR10 signal output 225 | DIRECTX_TOOLKIT_API void __cdecl SetColorRotation(ColorPrimaryRotation value); 226 | DIRECTX_TOOLKIT_API void __cdecl SetColorRotation(CXMMATRIX value); 227 | 228 | // Sets exposure value for LDR tonemap operators 229 | DIRECTX_TOOLKIT_API void __cdecl SetExposure(float exposureValue); 230 | 231 | // Sets ST.2084 parameter for how bright white should be in nits 232 | DIRECTX_TOOLKIT_API void __cdecl SetST2084Parameter(float paperWhiteNits); 233 | 234 | private: 235 | // Private implementation. 236 | class Impl; 237 | 238 | std::unique_ptr pImpl; 239 | }; 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/GeometricPrimitive.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: GeometricPrimitive.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #include "VertexTypes.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | #ifndef DIRECTX_TOOLKIT_API 23 | #ifdef DIRECTX_TOOLKIT_EXPORT 24 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 25 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 26 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 27 | #else 28 | #define DIRECTX_TOOLKIT_API 29 | #endif 30 | #endif 31 | 32 | 33 | namespace DirectX 34 | { 35 | inline namespace DX11 36 | { 37 | class IEffect; 38 | 39 | class GeometricPrimitive 40 | { 41 | public: 42 | GeometricPrimitive(GeometricPrimitive&&) = default; 43 | GeometricPrimitive& operator= (GeometricPrimitive&&) = default; 44 | 45 | GeometricPrimitive(GeometricPrimitive const&) = delete; 46 | GeometricPrimitive& operator= (GeometricPrimitive const&) = delete; 47 | 48 | using VertexType = VertexPositionNormalTexture; 49 | using VertexCollection = std::vector; 50 | using IndexCollection = std::vector; 51 | 52 | DIRECTX_TOOLKIT_API virtual ~GeometricPrimitive(); 53 | 54 | // Factory methods. 55 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateCube( 56 | _In_ ID3D11DeviceContext* deviceContext, 57 | float size = 1, bool rhcoords = true); 58 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateBox( 59 | _In_ ID3D11DeviceContext* deviceContext, 60 | const XMFLOAT3& size, 61 | bool rhcoords = true, bool invertn = false); 62 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateSphere( 63 | _In_ ID3D11DeviceContext* deviceContext, 64 | float diameter = 1, size_t tessellation = 16, 65 | bool rhcoords = true, bool invertn = false); 66 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateGeoSphere( 67 | _In_ ID3D11DeviceContext* deviceContext, 68 | float diameter = 1, size_t tessellation = 3, 69 | bool rhcoords = true); 70 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateCylinder( 71 | _In_ ID3D11DeviceContext* deviceContext, 72 | float height = 1, float diameter = 1, size_t tessellation = 32, 73 | bool rhcoords = true); 74 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateCone( 75 | _In_ ID3D11DeviceContext* deviceContext, 76 | float diameter = 1, float height = 1, size_t tessellation = 32, 77 | bool rhcoords = true); 78 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateTorus( 79 | _In_ ID3D11DeviceContext* deviceContext, 80 | float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, 81 | bool rhcoords = true); 82 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateTetrahedron( 83 | _In_ ID3D11DeviceContext* deviceContext, 84 | float size = 1, 85 | bool rhcoords = true); 86 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateOctahedron( 87 | _In_ ID3D11DeviceContext* deviceContext, 88 | float size = 1, 89 | bool rhcoords = true); 90 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateDodecahedron( 91 | _In_ ID3D11DeviceContext* deviceContext, 92 | float size = 1, 93 | bool rhcoords = true); 94 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateIcosahedron( 95 | _In_ ID3D11DeviceContext* deviceContext, 96 | float size = 1, 97 | bool rhcoords = true); 98 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateTeapot( 99 | _In_ ID3D11DeviceContext* deviceContext, 100 | float size = 1, size_t tessellation = 8, 101 | bool rhcoords = true); 102 | DIRECTX_TOOLKIT_API static std::unique_ptr __cdecl CreateCustom( 103 | _In_ ID3D11DeviceContext* deviceContext, 104 | const VertexCollection& vertices, 105 | const IndexCollection& indices); 106 | 107 | // Vertex/Index methods. 108 | DIRECTX_TOOLKIT_API static void __cdecl CreateCube( 109 | VertexCollection& vertices, 110 | IndexCollection& indices, 111 | float size = 1, 112 | bool rhcoords = true); 113 | DIRECTX_TOOLKIT_API static void __cdecl CreateBox( 114 | VertexCollection& vertices, 115 | IndexCollection& indices, 116 | const XMFLOAT3& size, bool rhcoords = true, 117 | bool invertn = false); 118 | DIRECTX_TOOLKIT_API static void __cdecl CreateSphere( 119 | VertexCollection& vertices, 120 | IndexCollection& indices, 121 | float diameter = 1, size_t tessellation = 16, 122 | bool rhcoords = true, bool invertn = false); 123 | DIRECTX_TOOLKIT_API static void __cdecl CreateGeoSphere( 124 | VertexCollection& vertices, 125 | IndexCollection& indices, 126 | float diameter = 1, size_t tessellation = 3, 127 | bool rhcoords = true); 128 | DIRECTX_TOOLKIT_API static void __cdecl CreateCylinder( 129 | VertexCollection& vertices, 130 | IndexCollection& indices, 131 | float height = 1, float diameter = 1, size_t tessellation = 32, 132 | bool rhcoords = true); 133 | DIRECTX_TOOLKIT_API static void __cdecl CreateCone( 134 | VertexCollection& vertices, 135 | IndexCollection& indices, 136 | float diameter = 1, float height = 1, size_t tessellation = 32, 137 | bool rhcoords = true); 138 | DIRECTX_TOOLKIT_API static void __cdecl CreateTorus( 139 | VertexCollection& vertices, 140 | IndexCollection& indices, 141 | float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, 142 | bool rhcoords = true); 143 | DIRECTX_TOOLKIT_API static void __cdecl CreateTetrahedron( 144 | VertexCollection& vertices, 145 | IndexCollection& indices, 146 | float size = 1, 147 | bool rhcoords = true); 148 | DIRECTX_TOOLKIT_API static void __cdecl CreateOctahedron( 149 | VertexCollection& vertices, 150 | IndexCollection& indices, 151 | float size = 1, 152 | bool rhcoords = true); 153 | DIRECTX_TOOLKIT_API static void __cdecl CreateDodecahedron( 154 | VertexCollection& vertices, 155 | IndexCollection& indices, 156 | float size = 1, 157 | bool rhcoords = true); 158 | DIRECTX_TOOLKIT_API static void __cdecl CreateIcosahedron(VertexCollection 159 | & vertices, IndexCollection& indices, 160 | float size = 1, 161 | bool rhcoords = true); 162 | DIRECTX_TOOLKIT_API static void __cdecl CreateTeapot( 163 | VertexCollection& vertices, 164 | IndexCollection& indices, 165 | float size = 1, size_t tessellation = 8, 166 | bool rhcoords = true); 167 | 168 | // Draw the primitive. 169 | DIRECTX_TOOLKIT_API void XM_CALLCONV Draw( 170 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 171 | FXMVECTOR color = Colors::White, 172 | _In_opt_ ID3D11ShaderResourceView* texture = nullptr, 173 | bool wireframe = false, 174 | _In_ std::function setCustomState = nullptr) const; 175 | 176 | // Draw the primitive using a custom effect. 177 | DIRECTX_TOOLKIT_API void __cdecl Draw( 178 | _In_ IEffect* effect, 179 | _In_ ID3D11InputLayout* inputLayout, 180 | bool alpha = false, bool wireframe = false, 181 | _In_ std::function setCustomState = nullptr) const; 182 | 183 | DIRECTX_TOOLKIT_API void __cdecl DrawInstanced( 184 | _In_ IEffect* effect, 185 | _In_ ID3D11InputLayout* inputLayout, 186 | uint32_t instanceCount, 187 | bool alpha = false, bool wireframe = false, 188 | uint32_t startInstanceLocation = 0, 189 | _In_ std::function setCustomState = nullptr) const; 190 | 191 | // Create input layout for drawing with a custom effect. 192 | DIRECTX_TOOLKIT_API void __cdecl CreateInputLayout( 193 | _In_ IEffect* effect, 194 | _Outptr_ ID3D11InputLayout** inputLayout) const; 195 | 196 | DIRECTX_TOOLKIT_API static inline void SetDepthBufferMode(bool reverseZ) 197 | { 198 | s_reversez = reverseZ; 199 | } 200 | 201 | private: 202 | DIRECTX_TOOLKIT_API static bool s_reversez; 203 | 204 | DIRECTX_TOOLKIT_API GeometricPrimitive() noexcept(false); 205 | 206 | // Private implementation. 207 | class Impl; 208 | 209 | std::unique_ptr pImpl; 210 | }; 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/SpriteFont.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: SpriteFont.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #include "SpriteBatch.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #ifndef DIRECTX_TOOLKIT_API 19 | #ifdef DIRECTX_TOOLKIT_EXPORT 20 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 21 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 22 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 23 | #else 24 | #define DIRECTX_TOOLKIT_API 25 | #endif 26 | #endif 27 | 28 | 29 | namespace DirectX 30 | { 31 | inline namespace DX11 32 | { 33 | class SpriteFont 34 | { 35 | public: 36 | struct Glyph; 37 | 38 | DIRECTX_TOOLKIT_API SpriteFont( 39 | _In_ ID3D11Device* device, 40 | _In_z_ wchar_t const* fileName, 41 | bool forceSRGB = false); 42 | DIRECTX_TOOLKIT_API SpriteFont( 43 | _In_ ID3D11Device* device, 44 | _In_reads_bytes_(dataSize) uint8_t const* dataBlob, _In_ size_t dataSize, 45 | bool forceSRGB = false); 46 | DIRECTX_TOOLKIT_API SpriteFont( 47 | _In_ ID3D11ShaderResourceView* texture, 48 | _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, 49 | _In_ float lineSpacing); 50 | 51 | DIRECTX_TOOLKIT_API SpriteFont(SpriteFont&&) noexcept; 52 | DIRECTX_TOOLKIT_API SpriteFont& operator= (SpriteFont&&) noexcept; 53 | 54 | SpriteFont(SpriteFont const&) = delete; 55 | SpriteFont& operator= (SpriteFont const&) = delete; 56 | 57 | DIRECTX_TOOLKIT_API virtual ~SpriteFont(); 58 | 59 | // Wide-character / UTF-16LE 60 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 61 | _In_ SpriteBatch* spriteBatch, 62 | _In_z_ wchar_t const* text, 63 | XMFLOAT2 const& position, 64 | FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, 65 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 66 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 67 | _In_ SpriteBatch* spriteBatch, 68 | _In_z_ wchar_t const* text, 69 | XMFLOAT2 const& position, 70 | FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, 71 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 72 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 73 | _In_ SpriteBatch* spriteBatch, 74 | _In_z_ wchar_t const* text, 75 | FXMVECTOR position, 76 | FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, 77 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 78 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 79 | _In_ SpriteBatch* spriteBatch, 80 | _In_z_ wchar_t const* text, 81 | FXMVECTOR position, 82 | FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, 83 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 84 | 85 | DIRECTX_TOOLKIT_API XMVECTOR XM_CALLCONV MeasureString( 86 | _In_z_ wchar_t const* text, 87 | bool ignoreWhitespace = true) const; 88 | 89 | DIRECTX_TOOLKIT_API RECT __cdecl MeasureDrawBounds( 90 | _In_z_ wchar_t const* text, 91 | XMFLOAT2 const& position, 92 | bool ignoreWhitespace = true) const; 93 | DIRECTX_TOOLKIT_API RECT XM_CALLCONV MeasureDrawBounds( 94 | _In_z_ wchar_t const* text, 95 | FXMVECTOR position, 96 | bool ignoreWhitespace = true) const; 97 | 98 | // UTF-8 99 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 100 | _In_ SpriteBatch* spriteBatch, 101 | _In_z_ char const* text, 102 | XMFLOAT2 const& position, 103 | FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, 104 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 105 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 106 | _In_ SpriteBatch* spriteBatch, 107 | _In_z_ char const* text, 108 | XMFLOAT2 const& position, 109 | FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, 110 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 111 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 112 | _In_ SpriteBatch* spriteBatch, 113 | _In_z_ char const* text, 114 | FXMVECTOR position, 115 | FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, 116 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 117 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 118 | _In_ SpriteBatch* spriteBatch, 119 | _In_z_ char const* text, 120 | FXMVECTOR position, 121 | FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, 122 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 123 | 124 | DIRECTX_TOOLKIT_API XMVECTOR XM_CALLCONV MeasureString( 125 | _In_z_ char const* text, 126 | bool ignoreWhitespace = true) const; 127 | 128 | DIRECTX_TOOLKIT_API RECT __cdecl MeasureDrawBounds( 129 | _In_z_ char const* text, 130 | XMFLOAT2 const& position, 131 | bool ignoreWhitespace = true) const; 132 | DIRECTX_TOOLKIT_API RECT XM_CALLCONV MeasureDrawBounds( 133 | _In_z_ char const* text, 134 | FXMVECTOR position, 135 | bool ignoreWhitespace = true) const; 136 | 137 | // Spacing properties 138 | DIRECTX_TOOLKIT_API float __cdecl GetLineSpacing() const noexcept; 139 | DIRECTX_TOOLKIT_API void __cdecl SetLineSpacing(float spacing); 140 | 141 | // Font properties 142 | DIRECTX_TOOLKIT_API wchar_t __cdecl GetDefaultCharacter() const noexcept; 143 | DIRECTX_TOOLKIT_API void __cdecl SetDefaultCharacter(wchar_t character); 144 | 145 | DIRECTX_TOOLKIT_API bool __cdecl ContainsCharacter(wchar_t character) const; 146 | 147 | // Custom layout/rendering 148 | DIRECTX_TOOLKIT_API Glyph const* __cdecl FindGlyph(wchar_t character) const; 149 | DIRECTX_TOOLKIT_API void __cdecl GetSpriteSheet(ID3D11ShaderResourceView** texture) const; 150 | 151 | // Describes a single character glyph. 152 | struct Glyph 153 | { 154 | uint32_t Character; 155 | RECT Subrect; 156 | float XOffset; 157 | float YOffset; 158 | float XAdvance; 159 | }; 160 | 161 | #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED) 162 | DIRECTX_TOOLKIT_API SpriteFont( 163 | _In_ ID3D11Device* device, 164 | _In_z_ __wchar_t const* fileName, 165 | bool forceSRGB = false); 166 | 167 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 168 | _In_ SpriteBatch* spriteBatch, 169 | _In_z_ __wchar_t const* text, 170 | XMFLOAT2 const& position, 171 | FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, 172 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 173 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 174 | _In_ SpriteBatch* spriteBatch, 175 | _In_z_ __wchar_t const* text, 176 | XMFLOAT2 const& position, 177 | FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, 178 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 179 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 180 | _In_ SpriteBatch* spriteBatch, 181 | _In_z_ __wchar_t const* text, 182 | FXMVECTOR position, 183 | FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, 184 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 185 | DIRECTX_TOOLKIT_API void XM_CALLCONV DrawString( 186 | _In_ SpriteBatch* spriteBatch, 187 | _In_z_ __wchar_t const* text, 188 | FXMVECTOR position, 189 | FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, 190 | SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 191 | 192 | DIRECTX_TOOLKIT_API XMVECTOR XM_CALLCONV MeasureString( 193 | _In_z_ __wchar_t const* text, 194 | bool ignoreWhitespace = true) const; 195 | 196 | DIRECTX_TOOLKIT_API RECT __cdecl MeasureDrawBounds( 197 | _In_z_ __wchar_t const* text, 198 | XMFLOAT2 const& position, 199 | bool ignoreWhitespace = true) const; 200 | DIRECTX_TOOLKIT_API RECT XM_CALLCONV MeasureDrawBounds( 201 | _In_z_ __wchar_t const* text, 202 | FXMVECTOR position, 203 | bool ignoreWhitespace = true) const; 204 | 205 | DIRECTX_TOOLKIT_API void __cdecl SetDefaultCharacter(__wchar_t character); 206 | 207 | DIRECTX_TOOLKIT_API bool __cdecl ContainsCharacter(__wchar_t character) const; 208 | 209 | DIRECTX_TOOLKIT_API Glyph const* __cdecl FindGlyph(__wchar_t character) const; 210 | #endif // !_NATIVE_WCHAR_T_DEFINED 211 | 212 | private: 213 | // Private implementation. 214 | class Impl; 215 | 216 | std::unique_ptr pImpl; 217 | 218 | DIRECTX_TOOLKIT_API static const XMFLOAT2 Float2Zero; 219 | }; 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/WICTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: WICTextureLoader.h 3 | // 4 | // Function for loading a WIC image and creating a Direct3D runtime texture for it 5 | // (auto-generating mipmaps if possible) 6 | // 7 | // Note: Assumes application has already called CoInitializeEx 8 | // 9 | // Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for 10 | // auto-gen mipmap support. 11 | // 12 | // Note these functions are useful for images created as simple 2D textures. For 13 | // more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. 14 | // For a full-featured DDS file reader, writer, and texture processing pipeline see 15 | // the 'Texconv' sample and the 'DirectXTex' library. 16 | // 17 | // Copyright (c) Microsoft Corporation. 18 | // Licensed under the MIT License. 19 | // 20 | // http://go.microsoft.com/fwlink/?LinkId=248926 21 | // http://go.microsoft.com/fwlink/?LinkId=248929 22 | //-------------------------------------------------------------------------------------- 23 | 24 | #pragma once 25 | 26 | #if defined(_XBOX_ONE) && defined(_TITLE) 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | #include 33 | #include 34 | 35 | #ifdef _MSC_VER 36 | #pragma comment(lib,"uuid.lib") 37 | #endif 38 | 39 | #ifndef DIRECTX_TOOLKIT_API 40 | #ifdef DIRECTX_TOOLKIT_EXPORT 41 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 42 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 43 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 44 | #else 45 | #define DIRECTX_TOOLKIT_API 46 | #endif 47 | #endif 48 | 49 | 50 | namespace DirectX 51 | { 52 | inline namespace DX11 53 | { 54 | enum WIC_LOADER_FLAGS : uint32_t 55 | { 56 | WIC_LOADER_DEFAULT = 0, 57 | WIC_LOADER_FORCE_SRGB = 0x1, 58 | WIC_LOADER_IGNORE_SRGB = 0x2, 59 | WIC_LOADER_SRGB_DEFAULT = 0x4, 60 | WIC_LOADER_FIT_POW2 = 0x20, 61 | WIC_LOADER_MAKE_SQUARE = 0x40, 62 | WIC_LOADER_FORCE_RGBA32 = 0x80, 63 | }; 64 | } 65 | 66 | // Standard version 67 | DIRECTX_TOOLKIT_API 68 | HRESULT __cdecl CreateWICTextureFromMemory( 69 | _In_ ID3D11Device* d3dDevice, 70 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 71 | _In_ size_t wicDataSize, 72 | _Outptr_opt_ ID3D11Resource** texture, 73 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 74 | _In_ size_t maxsize = 0) noexcept; 75 | 76 | DIRECTX_TOOLKIT_API 77 | HRESULT __cdecl CreateWICTextureFromFile( 78 | _In_ ID3D11Device* d3dDevice, 79 | _In_z_ const wchar_t* szFileName, 80 | _Outptr_opt_ ID3D11Resource** texture, 81 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 82 | _In_ size_t maxsize = 0) noexcept; 83 | 84 | // Standard version with optional auto-gen mipmap support 85 | DIRECTX_TOOLKIT_API 86 | HRESULT __cdecl CreateWICTextureFromMemory( 87 | #if defined(_XBOX_ONE) && defined(_TITLE) 88 | _In_ ID3D11DeviceX* d3dDevice, 89 | _In_opt_ ID3D11DeviceContextX* d3dContext, 90 | #else 91 | _In_ ID3D11Device* d3dDevice, 92 | _In_opt_ ID3D11DeviceContext* d3dContext, 93 | #endif 94 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 95 | _In_ size_t wicDataSize, 96 | _Outptr_opt_ ID3D11Resource** texture, 97 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 98 | _In_ size_t maxsize = 0) noexcept; 99 | 100 | DIRECTX_TOOLKIT_API 101 | HRESULT __cdecl CreateWICTextureFromFile( 102 | #if defined(_XBOX_ONE) && defined(_TITLE) 103 | _In_ ID3D11DeviceX* d3dDevice, 104 | _In_opt_ ID3D11DeviceContextX* d3dContext, 105 | #else 106 | _In_ ID3D11Device* d3dDevice, 107 | _In_opt_ ID3D11DeviceContext* d3dContext, 108 | #endif 109 | _In_z_ const wchar_t* szFileName, 110 | _Outptr_opt_ ID3D11Resource** texture, 111 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 112 | _In_ size_t maxsize = 0) noexcept; 113 | 114 | // Extended version 115 | DIRECTX_TOOLKIT_API 116 | HRESULT __cdecl CreateWICTextureFromMemoryEx( 117 | _In_ ID3D11Device* d3dDevice, 118 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 119 | _In_ size_t wicDataSize, 120 | _In_ size_t maxsize, 121 | _In_ D3D11_USAGE usage, 122 | _In_ unsigned int bindFlags, 123 | _In_ unsigned int cpuAccessFlags, 124 | _In_ unsigned int miscFlags, 125 | _In_ WIC_LOADER_FLAGS loadFlags, 126 | _Outptr_opt_ ID3D11Resource** texture, 127 | _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; 128 | 129 | DIRECTX_TOOLKIT_API 130 | HRESULT __cdecl CreateWICTextureFromFileEx( 131 | _In_ ID3D11Device* d3dDevice, 132 | _In_z_ const wchar_t* szFileName, 133 | _In_ size_t maxsize, 134 | _In_ D3D11_USAGE usage, 135 | _In_ unsigned int bindFlags, 136 | _In_ unsigned int cpuAccessFlags, 137 | _In_ unsigned int miscFlags, 138 | _In_ WIC_LOADER_FLAGS loadFlags, 139 | _Outptr_opt_ ID3D11Resource** texture, 140 | _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; 141 | 142 | // Extended version with optional auto-gen mipmap support 143 | DIRECTX_TOOLKIT_API 144 | HRESULT __cdecl CreateWICTextureFromMemoryEx( 145 | #if defined(_XBOX_ONE) && defined(_TITLE) 146 | _In_ ID3D11DeviceX* d3dDevice, 147 | _In_opt_ ID3D11DeviceContextX* d3dContext, 148 | #else 149 | _In_ ID3D11Device* d3dDevice, 150 | _In_opt_ ID3D11DeviceContext* d3dContext, 151 | #endif 152 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 153 | _In_ size_t wicDataSize, 154 | _In_ size_t maxsize, 155 | _In_ D3D11_USAGE usage, 156 | _In_ unsigned int bindFlags, 157 | _In_ unsigned int cpuAccessFlags, 158 | _In_ unsigned int miscFlags, 159 | _In_ WIC_LOADER_FLAGS loadFlags, 160 | _Outptr_opt_ ID3D11Resource** texture, 161 | _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; 162 | 163 | DIRECTX_TOOLKIT_API 164 | HRESULT __cdecl CreateWICTextureFromFileEx( 165 | #if defined(_XBOX_ONE) && defined(_TITLE) 166 | _In_ ID3D11DeviceX* d3dDevice, 167 | _In_opt_ ID3D11DeviceContextX* d3dContext, 168 | #else 169 | _In_ ID3D11Device* d3dDevice, 170 | _In_opt_ ID3D11DeviceContext* d3dContext, 171 | #endif 172 | _In_z_ const wchar_t* szFileName, 173 | _In_ size_t maxsize, 174 | _In_ D3D11_USAGE usage, 175 | _In_ unsigned int bindFlags, 176 | _In_ unsigned int cpuAccessFlags, 177 | _In_ unsigned int miscFlags, 178 | _In_ WIC_LOADER_FLAGS loadFlags, 179 | _Outptr_opt_ ID3D11Resource** texture, 180 | _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; 181 | 182 | #ifdef __cpp_lib_byte 183 | DIRECTX_TOOLKIT_API 184 | inline HRESULT __cdecl CreateWICTextureFromMemory( 185 | _In_ ID3D11Device* d3dDevice, 186 | _In_reads_bytes_(wicDataSize) const std::byte* wicData, 187 | _In_ size_t wicDataSize, 188 | _Outptr_opt_ ID3D11Resource** texture, 189 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 190 | _In_ size_t maxsize = 0) noexcept 191 | { 192 | return CreateWICTextureFromMemory(d3dDevice, reinterpret_cast(wicData), wicDataSize, texture, textureView, maxsize); 193 | } 194 | 195 | DIRECTX_TOOLKIT_API 196 | inline HRESULT __cdecl CreateWICTextureFromMemory( 197 | #if defined(_XBOX_ONE) && defined(_TITLE) 198 | _In_ ID3D11DeviceX* d3dDevice, 199 | _In_opt_ ID3D11DeviceContextX* d3dContext, 200 | #else 201 | _In_ ID3D11Device* d3dDevice, 202 | _In_opt_ ID3D11DeviceContext* d3dContext, 203 | #endif 204 | _In_reads_bytes_(wicDataSize) const std::byte* wicData, 205 | _In_ size_t wicDataSize, 206 | _Outptr_opt_ ID3D11Resource** texture, 207 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 208 | _In_ size_t maxsize = 0) noexcept 209 | { 210 | return CreateWICTextureFromMemory(d3dDevice, d3dContext, reinterpret_cast(wicData), wicDataSize, texture, textureView, maxsize); 211 | } 212 | 213 | DIRECTX_TOOLKIT_API 214 | inline HRESULT __cdecl CreateWICTextureFromMemoryEx( 215 | _In_ ID3D11Device* d3dDevice, 216 | _In_reads_bytes_(wicDataSize) const std::byte* wicData, 217 | _In_ size_t wicDataSize, 218 | _In_ size_t maxsize, 219 | _In_ D3D11_USAGE usage, 220 | _In_ unsigned int bindFlags, 221 | _In_ unsigned int cpuAccessFlags, 222 | _In_ unsigned int miscFlags, 223 | _In_ WIC_LOADER_FLAGS loadFlags, 224 | _Outptr_opt_ ID3D11Resource** texture, 225 | _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept 226 | { 227 | return CreateWICTextureFromMemoryEx(d3dDevice, reinterpret_cast(wicData), wicDataSize, maxsize, usage, bindFlags, cpuAccessFlags, miscFlags, loadFlags, texture, textureView); 228 | } 229 | 230 | DIRECTX_TOOLKIT_API 231 | inline HRESULT __cdecl CreateWICTextureFromMemoryEx( 232 | #if defined(_XBOX_ONE) && defined(_TITLE) 233 | _In_ ID3D11DeviceX* d3dDevice, 234 | _In_opt_ ID3D11DeviceContextX* d3dContext, 235 | #else 236 | _In_ ID3D11Device* d3dDevice, 237 | _In_opt_ ID3D11DeviceContext* d3dContext, 238 | #endif 239 | _In_reads_bytes_(wicDataSize) const std::byte* wicData, 240 | _In_ size_t wicDataSize, 241 | _In_ size_t maxsize, 242 | _In_ D3D11_USAGE usage, 243 | _In_ unsigned int bindFlags, 244 | _In_ unsigned int cpuAccessFlags, 245 | _In_ unsigned int miscFlags, 246 | _In_ WIC_LOADER_FLAGS loadFlags, 247 | _Outptr_opt_ ID3D11Resource** texture, 248 | _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept 249 | { 250 | return CreateWICTextureFromMemoryEx(d3dDevice, d3dContext, reinterpret_cast(wicData), wicDataSize, maxsize, usage, bindFlags, cpuAccessFlags, miscFlags, loadFlags, texture, textureView); 251 | } 252 | #endif // __cpp_lib_byte 253 | 254 | #ifdef __clang__ 255 | #pragma clang diagnostic push 256 | #pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec" 257 | #endif 258 | 259 | inline namespace DX11 260 | { 261 | DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS) 262 | } 263 | 264 | #ifdef __clang__ 265 | #pragma clang diagnostic pop 266 | #endif 267 | } 268 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/DDSTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DDSTextureLoader.h 3 | // 4 | // Functions for loading a DDS texture and creating a Direct3D runtime resource for it 5 | // 6 | // Note these functions are useful as a light-weight runtime loader for DDS files. For 7 | // a full-featured DDS file reader, writer, and texture processing pipeline see 8 | // the 'Texconv' sample and the 'DirectXTex' library. 9 | // 10 | // Copyright (c) Microsoft Corporation. 11 | // Licensed under the MIT License. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=248926 14 | // http://go.microsoft.com/fwlink/?LinkId=248929 15 | //-------------------------------------------------------------------------------------- 16 | 17 | #pragma once 18 | 19 | #if defined(_XBOX_ONE) && defined(_TITLE) 20 | #include 21 | #else 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | #ifndef DIRECTX_TOOLKIT_API 29 | #ifdef DIRECTX_TOOLKIT_EXPORT 30 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 31 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 32 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 33 | #else 34 | #define DIRECTX_TOOLKIT_API 35 | #endif 36 | #endif 37 | 38 | 39 | namespace DirectX 40 | { 41 | #ifndef DDS_ALPHA_MODE_DEFINED 42 | #define DDS_ALPHA_MODE_DEFINED 43 | enum DDS_ALPHA_MODE : uint32_t 44 | { 45 | DDS_ALPHA_MODE_UNKNOWN = 0, 46 | DDS_ALPHA_MODE_STRAIGHT = 1, 47 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 48 | DDS_ALPHA_MODE_OPAQUE = 3, 49 | DDS_ALPHA_MODE_CUSTOM = 4, 50 | }; 51 | #endif 52 | 53 | inline namespace DX11 54 | { 55 | enum DDS_LOADER_FLAGS : uint32_t 56 | { 57 | DDS_LOADER_DEFAULT = 0, 58 | DDS_LOADER_FORCE_SRGB = 0x1, 59 | DDS_LOADER_IGNORE_SRGB = 0x2, 60 | DDS_LOADER_IGNORE_MIPS = 0x20, 61 | }; 62 | } 63 | 64 | // Standard version 65 | DIRECTX_TOOLKIT_API 66 | HRESULT __cdecl CreateDDSTextureFromMemory( 67 | _In_ ID3D11Device* d3dDevice, 68 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 69 | _In_ size_t ddsDataSize, 70 | _Outptr_opt_ ID3D11Resource** texture, 71 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 72 | _In_ size_t maxsize = 0, 73 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 74 | 75 | DIRECTX_TOOLKIT_API 76 | HRESULT __cdecl CreateDDSTextureFromFile( 77 | _In_ ID3D11Device* d3dDevice, 78 | _In_z_ const wchar_t* szFileName, 79 | _Outptr_opt_ ID3D11Resource** texture, 80 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 81 | _In_ size_t maxsize = 0, 82 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 83 | 84 | // Standard version with optional auto-gen mipmap support 85 | DIRECTX_TOOLKIT_API 86 | HRESULT __cdecl CreateDDSTextureFromMemory( 87 | #if defined(_XBOX_ONE) && defined(_TITLE) 88 | _In_ ID3D11DeviceX* d3dDevice, 89 | _In_opt_ ID3D11DeviceContextX* d3dContext, 90 | #else 91 | _In_ ID3D11Device* d3dDevice, 92 | _In_opt_ ID3D11DeviceContext* d3dContext, 93 | #endif 94 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 95 | _In_ size_t ddsDataSize, 96 | _Outptr_opt_ ID3D11Resource** texture, 97 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 98 | _In_ size_t maxsize = 0, 99 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 100 | 101 | DIRECTX_TOOLKIT_API 102 | HRESULT __cdecl CreateDDSTextureFromFile( 103 | #if defined(_XBOX_ONE) && defined(_TITLE) 104 | _In_ ID3D11DeviceX* d3dDevice, 105 | _In_opt_ ID3D11DeviceContextX* d3dContext, 106 | #else 107 | _In_ ID3D11Device* d3dDevice, 108 | _In_opt_ ID3D11DeviceContext* d3dContext, 109 | #endif 110 | _In_z_ const wchar_t* szFileName, 111 | _Outptr_opt_ ID3D11Resource** texture, 112 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 113 | _In_ size_t maxsize = 0, 114 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 115 | 116 | // Extended version 117 | DIRECTX_TOOLKIT_API 118 | HRESULT __cdecl CreateDDSTextureFromMemoryEx( 119 | _In_ ID3D11Device* d3dDevice, 120 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 121 | _In_ size_t ddsDataSize, 122 | _In_ size_t maxsize, 123 | _In_ D3D11_USAGE usage, 124 | _In_ unsigned int bindFlags, 125 | _In_ unsigned int cpuAccessFlags, 126 | _In_ unsigned int miscFlags, 127 | _In_ DDS_LOADER_FLAGS loadFlags, 128 | _Outptr_opt_ ID3D11Resource** texture, 129 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 130 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 131 | 132 | DIRECTX_TOOLKIT_API 133 | HRESULT __cdecl CreateDDSTextureFromFileEx( 134 | _In_ ID3D11Device* d3dDevice, 135 | _In_z_ const wchar_t* szFileName, 136 | _In_ size_t maxsize, 137 | _In_ D3D11_USAGE usage, 138 | _In_ unsigned int bindFlags, 139 | _In_ unsigned int cpuAccessFlags, 140 | _In_ unsigned int miscFlags, 141 | _In_ DDS_LOADER_FLAGS loadFlags, 142 | _Outptr_opt_ ID3D11Resource** texture, 143 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 144 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 145 | 146 | // Extended version with optional auto-gen mipmap support 147 | DIRECTX_TOOLKIT_API 148 | HRESULT __cdecl CreateDDSTextureFromMemoryEx( 149 | #if defined(_XBOX_ONE) && defined(_TITLE) 150 | _In_ ID3D11DeviceX* d3dDevice, 151 | _In_opt_ ID3D11DeviceContextX* d3dContext, 152 | #else 153 | _In_ ID3D11Device* d3dDevice, 154 | _In_opt_ ID3D11DeviceContext* d3dContext, 155 | #endif 156 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 157 | _In_ size_t ddsDataSize, 158 | _In_ size_t maxsize, 159 | _In_ D3D11_USAGE usage, 160 | _In_ unsigned int bindFlags, 161 | _In_ unsigned int cpuAccessFlags, 162 | _In_ unsigned int miscFlags, 163 | _In_ DDS_LOADER_FLAGS loadFlags, 164 | _Outptr_opt_ ID3D11Resource** texture, 165 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 166 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 167 | 168 | DIRECTX_TOOLKIT_API 169 | HRESULT __cdecl CreateDDSTextureFromFileEx( 170 | #if defined(_XBOX_ONE) && defined(_TITLE) 171 | _In_ ID3D11DeviceX* d3dDevice, 172 | _In_opt_ ID3D11DeviceContextX* d3dContext, 173 | #else 174 | _In_ ID3D11Device* d3dDevice, 175 | _In_opt_ ID3D11DeviceContext* d3dContext, 176 | #endif 177 | _In_z_ const wchar_t* szFileName, 178 | _In_ size_t maxsize, 179 | _In_ D3D11_USAGE usage, 180 | _In_ unsigned int bindFlags, 181 | _In_ unsigned int cpuAccessFlags, 182 | _In_ unsigned int miscFlags, 183 | _In_ DDS_LOADER_FLAGS loadFlags, 184 | _Outptr_opt_ ID3D11Resource** texture, 185 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 186 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; 187 | 188 | #ifdef __cpp_lib_byte 189 | DIRECTX_TOOLKIT_API 190 | inline HRESULT __cdecl CreateDDSTextureFromMemory( 191 | _In_ ID3D11Device* d3dDevice, 192 | _In_reads_bytes_(ddsDataSize) const std::byte* ddsData, 193 | _In_ size_t ddsDataSize, 194 | _Outptr_opt_ ID3D11Resource** texture, 195 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 196 | _In_ size_t maxsize = 0, 197 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept 198 | { 199 | return CreateDDSTextureFromMemory(d3dDevice, reinterpret_cast(ddsData), ddsDataSize, texture, textureView, maxsize, alphaMode); 200 | } 201 | 202 | DIRECTX_TOOLKIT_API 203 | inline HRESULT __cdecl CreateDDSTextureFromMemory( 204 | #if defined(_XBOX_ONE) && defined(_TITLE) 205 | _In_ ID3D11DeviceX* d3dDevice, 206 | _In_opt_ ID3D11DeviceContextX* d3dContext, 207 | #else 208 | _In_ ID3D11Device* d3dDevice, 209 | _In_opt_ ID3D11DeviceContext* d3dContext, 210 | #endif 211 | _In_reads_bytes_(ddsDataSize) const std::byte* ddsData, 212 | _In_ size_t ddsDataSize, 213 | _Outptr_opt_ ID3D11Resource** texture, 214 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 215 | _In_ size_t maxsize = 0, 216 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept 217 | { 218 | return CreateDDSTextureFromMemory(d3dDevice, d3dContext, reinterpret_cast(ddsData), ddsDataSize, texture, textureView, maxsize, alphaMode); 219 | } 220 | 221 | DIRECTX_TOOLKIT_API 222 | inline HRESULT __cdecl CreateDDSTextureFromMemoryEx( 223 | _In_ ID3D11Device* d3dDevice, 224 | _In_reads_bytes_(ddsDataSize) const std::byte* ddsData, 225 | _In_ size_t ddsDataSize, 226 | _In_ size_t maxsize, 227 | _In_ D3D11_USAGE usage, 228 | _In_ unsigned int bindFlags, 229 | _In_ unsigned int cpuAccessFlags, 230 | _In_ unsigned int miscFlags, 231 | _In_ DDS_LOADER_FLAGS loadFlags, 232 | _Outptr_opt_ ID3D11Resource** texture, 233 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 234 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept 235 | { 236 | return CreateDDSTextureFromMemoryEx(d3dDevice, reinterpret_cast(ddsData), ddsDataSize, maxsize, usage, bindFlags, cpuAccessFlags, miscFlags, loadFlags, texture, textureView, alphaMode); 237 | } 238 | 239 | DIRECTX_TOOLKIT_API 240 | inline HRESULT __cdecl CreateDDSTextureFromMemoryEx( 241 | #if defined(_XBOX_ONE) && defined(_TITLE) 242 | _In_ ID3D11DeviceX* d3dDevice, 243 | _In_opt_ ID3D11DeviceContextX* d3dContext, 244 | #else 245 | _In_ ID3D11Device* d3dDevice, 246 | _In_opt_ ID3D11DeviceContext* d3dContext, 247 | #endif 248 | _In_reads_bytes_(ddsDataSize) const std::byte* ddsData, 249 | _In_ size_t ddsDataSize, 250 | _In_ size_t maxsize, 251 | _In_ D3D11_USAGE usage, 252 | _In_ unsigned int bindFlags, 253 | _In_ unsigned int cpuAccessFlags, 254 | _In_ unsigned int miscFlags, 255 | _In_ DDS_LOADER_FLAGS loadFlags, 256 | _Outptr_opt_ ID3D11Resource** texture, 257 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 258 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept 259 | { 260 | return CreateDDSTextureFromMemoryEx(d3dDevice, d3dContext, reinterpret_cast(ddsData), ddsDataSize, maxsize, usage, bindFlags, cpuAccessFlags, miscFlags, loadFlags, texture, textureView, alphaMode); 261 | } 262 | #endif // __cpp_lib_byte 263 | 264 | #ifdef __clang__ 265 | #pragma clang diagnostic push 266 | #pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec" 267 | #endif 268 | 269 | inline namespace DX11 270 | { 271 | DEFINE_ENUM_FLAG_OPERATORS(DDS_LOADER_FLAGS) 272 | } 273 | 274 | #ifdef __clang__ 275 | #pragma clang diagnostic pop 276 | #endif 277 | } 278 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/ImGui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // DEAR IMGUI COMPILE-TIME OPTIONS 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp file to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | #define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | // - Windows DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 25 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 26 | //#define IMGUI_API __declspec(dllexport) // MSVC Windows: DLL export 27 | //#define IMGUI_API __declspec(dllimport) // MSVC Windows: DLL import 28 | //#define IMGUI_API __attribute__((visibility("default"))) // GCC/Clang: override visibility when set is hidden 29 | 30 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names. 31 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 32 | 33 | //---- Disable all of Dear ImGui or don't implement standard windows/tools. 34 | // It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. 35 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 36 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. 37 | //#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty. 38 | 39 | //---- Don't implement some functions to reduce linkage requirements. 40 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 41 | //#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW) 42 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a) 43 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME). 44 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 45 | //#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS // Don't implement default platform_io.Platform_OpenInShellFn() handler (Win32: ShellExecute(), require shell32.lib/.a, Mac/Linux: use system("")). 46 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 47 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 48 | //#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies) 49 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 50 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 51 | //#define IMGUI_DISABLE_DEFAULT_FONT // Disable default embedded font (ProggyClean.ttf), remove ~9.5 KB from output binary. AddFontDefault() will assert. 52 | //#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available 53 | 54 | //---- Enable Test Engine / Automation features. 55 | //#define IMGUI_ENABLE_TEST_ENGINE // Enable imgui_test_engine hooks. Generally set automatically by include "imgui_te_config.h", see Test Engine for details. 56 | 57 | //---- Include imgui_user.h at the end of imgui.h as a convenience 58 | // May be convenient for some users to only explicitly include vanilla imgui.h and have extra stuff included. 59 | //#define IMGUI_INCLUDE_IMGUI_USER_H 60 | //#define IMGUI_USER_H_FILENAME "my_folder/my_imgui_user.h" 61 | 62 | //---- Pack vertex colors as BGRA8 instead of RGBA8 (to avoid converting from one to another). Need dedicated backend support. 63 | //#define IMGUI_USE_BGRA_PACKED_COLOR 64 | 65 | //---- Use legacy CRC32-adler tables (used before 1.91.6), in order to preserve old .ini data that you cannot afford to invalidate. 66 | //#define IMGUI_USE_LEGACY_CRC32_ADLER 67 | 68 | //---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 69 | //#define IMGUI_USE_WCHAR32 70 | 71 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 72 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 73 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 74 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 75 | //#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined. 76 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 77 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 78 | //#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined. 79 | 80 | //---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 81 | // Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. 82 | //#define IMGUI_USE_STB_SPRINTF 83 | 84 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 85 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 86 | // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. 87 | //#define IMGUI_ENABLE_FREETYPE 88 | 89 | //---- Use FreeType + plutosvg or lunasvg to render OpenType SVG fonts (SVGinOT) 90 | // Only works in combination with IMGUI_ENABLE_FREETYPE. 91 | // - plutosvg is currently easier to install, as e.g. it is part of vcpkg. It will support more fonts and may load them faster. See misc/freetype/README for instructions. 92 | // - Both require headers to be available in the include path + program to be linked with the library code (not provided). 93 | // - (note: lunasvg implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement) 94 | //#define IMGUI_ENABLE_FREETYPE_PLUTOSVG 95 | //#define IMGUI_ENABLE_FREETYPE_LUNASVG 96 | 97 | //---- Use stb_truetype to build and rasterize the font atlas (default) 98 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 99 | //#define IMGUI_ENABLE_STB_TRUETYPE 100 | 101 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 102 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 103 | /* 104 | #define IM_VEC2_CLASS_EXTRA \ 105 | constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ 106 | operator MyVec2() const { return MyVec2(x,y); } 107 | 108 | #define IM_VEC4_CLASS_EXTRA \ 109 | constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ 110 | operator MyVec4() const { return MyVec4(x,y,z,w); } 111 | */ 112 | //---- ...Or use Dear ImGui's own very basic math operators. 113 | //#define IMGUI_DEFINE_MATH_OPERATORS 114 | 115 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 116 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 117 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 118 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 119 | //#define ImDrawIdx unsigned int 120 | 121 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 122 | //struct ImDrawList; 123 | //struct ImDrawCmd; 124 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 125 | //#define ImDrawCallback MyImDrawCallback 126 | 127 | //---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase) 128 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 129 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 130 | //#define IM_DEBUG_BREAK __debugbreak() 131 | 132 | //---- Debug Tools: Enable slower asserts 133 | //#define IMGUI_DEBUG_PARANOID 134 | 135 | //---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files) 136 | /* 137 | namespace ImGui 138 | { 139 | void MyFunction(const char* name, MyMatrix44* mtx); 140 | } 141 | */ 142 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/GamePad.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: GamePad.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | // http://go.microsoft.com/fwlink/?LinkID=615561 9 | //-------------------------------------------------------------------------------------- 10 | 11 | #pragma once 12 | 13 | #if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_WINDOWS_GAMING_INPUT) 14 | 15 | #ifdef _GAMING_DESKTOP 16 | #include 17 | #endif 18 | 19 | #if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600)) 20 | #define USING_GAMEINPUT 21 | #elif (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) && !defined(_GAMING_DESKTOP) && !defined(__MINGW32__) 22 | #define USING_WINDOWS_GAMING_INPUT 23 | #elif !defined(_XBOX_ONE) 24 | #define USING_XINPUT 25 | #endif 26 | 27 | #endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT 28 | 29 | #ifdef USING_GAMEINPUT 30 | #include 31 | #if !defined(_GAMING_XBOX) && defined(_MSC_VER) 32 | #pragma comment(lib,"gameinput.lib") 33 | #endif 34 | 35 | #elif defined(USING_WINDOWS_GAMING_INPUT) 36 | #ifdef _MSC_VER 37 | #pragma comment(lib,"runtimeobject.lib") 38 | #endif 39 | #include 40 | 41 | #elif defined(_XBOX_ONE) 42 | // Legacy Xbox One XDK uses Windows::Xbox::Input 43 | 44 | #elif defined(USING_XINPUT) 45 | #ifdef _MSC_VER 46 | #pragma comment(lib,"xinput.lib") 47 | #endif 48 | #endif 49 | 50 | #include 51 | #include 52 | 53 | #ifndef DIRECTX_TOOLKIT_API 54 | #ifdef DIRECTX_TOOLKIT_EXPORT 55 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 56 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 57 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 58 | #else 59 | #define DIRECTX_TOOLKIT_API 60 | #endif 61 | #endif 62 | 63 | #ifdef __clang__ 64 | #pragma clang diagnostic push 65 | #pragma clang diagnostic ignored "-Wunknown-pragmas" 66 | #endif 67 | 68 | #if defined(DIRECTX_TOOLKIT_IMPORT) && defined(_MSC_VER) 69 | #pragma warning(push) 70 | #pragma warning(disable : 4251) 71 | #endif 72 | 73 | 74 | namespace DirectX 75 | { 76 | class GamePad 77 | { 78 | public: 79 | DIRECTX_TOOLKIT_API GamePad() noexcept(false); 80 | 81 | DIRECTX_TOOLKIT_API GamePad(GamePad&&) noexcept; 82 | DIRECTX_TOOLKIT_API GamePad& operator= (GamePad&&) noexcept; 83 | 84 | GamePad(GamePad const&) = delete; 85 | GamePad& operator=(GamePad const&) = delete; 86 | 87 | DIRECTX_TOOLKIT_API virtual ~GamePad(); 88 | 89 | #if defined(USING_GAMEINPUT) || defined(USING_WINDOWS_GAMING_INPUT) || defined(_XBOX_ONE) 90 | static constexpr int MAX_PLAYER_COUNT = 8; 91 | #else 92 | static constexpr int MAX_PLAYER_COUNT = 4; 93 | #endif 94 | 95 | static constexpr int c_MostRecent = -1; 96 | 97 | #ifdef USING_GAMEINPUT 98 | static constexpr int c_MergedInput = -2; 99 | #endif 100 | 101 | enum DeadZone : uint32_t 102 | { 103 | DEAD_ZONE_INDEPENDENT_AXES = 0, 104 | DEAD_ZONE_CIRCULAR, 105 | DEAD_ZONE_NONE, 106 | }; 107 | 108 | struct Buttons 109 | { 110 | bool a; 111 | bool b; 112 | bool x; 113 | bool y; 114 | bool leftStick; 115 | bool rightStick; 116 | bool leftShoulder; 117 | bool rightShoulder; 118 | union 119 | { 120 | bool back; 121 | bool view; 122 | }; 123 | union 124 | { 125 | bool start; 126 | bool menu; 127 | }; 128 | }; 129 | 130 | struct DPad 131 | { 132 | bool up; 133 | bool down; 134 | bool right; 135 | bool left; 136 | }; 137 | 138 | struct ThumbSticks 139 | { 140 | float leftX; 141 | float leftY; 142 | float rightX; 143 | float rightY; 144 | }; 145 | 146 | struct Triggers 147 | { 148 | float left; 149 | float right; 150 | }; 151 | 152 | struct DIRECTX_TOOLKIT_API State 153 | { 154 | bool connected; 155 | uint64_t packet; 156 | Buttons buttons; 157 | DPad dpad; 158 | ThumbSticks thumbSticks; 159 | Triggers triggers; 160 | 161 | bool __cdecl IsConnected() const noexcept { return connected; } 162 | 163 | // Is the button pressed currently? 164 | bool __cdecl IsAPressed() const noexcept { return buttons.a; } 165 | bool __cdecl IsBPressed() const noexcept { return buttons.b; } 166 | bool __cdecl IsXPressed() const noexcept { return buttons.x; } 167 | bool __cdecl IsYPressed() const noexcept { return buttons.y; } 168 | 169 | bool __cdecl IsLeftStickPressed() const noexcept { return buttons.leftStick; } 170 | bool __cdecl IsRightStickPressed() const noexcept { return buttons.rightStick; } 171 | 172 | bool __cdecl IsLeftShoulderPressed() const noexcept { return buttons.leftShoulder; } 173 | bool __cdecl IsRightShoulderPressed() const noexcept { return buttons.rightShoulder; } 174 | 175 | bool __cdecl IsBackPressed() const noexcept { return buttons.back; } 176 | bool __cdecl IsViewPressed() const noexcept { return buttons.view; } 177 | bool __cdecl IsStartPressed() const noexcept { return buttons.start; } 178 | bool __cdecl IsMenuPressed() const noexcept { return buttons.menu; } 179 | 180 | bool __cdecl IsDPadDownPressed() const noexcept { return dpad.down; } 181 | bool __cdecl IsDPadUpPressed() const noexcept { return dpad.up; } 182 | bool __cdecl IsDPadLeftPressed() const noexcept { return dpad.left; } 183 | bool __cdecl IsDPadRightPressed() const noexcept { return dpad.right; } 184 | 185 | bool __cdecl IsLeftThumbStickUp() const noexcept { return (thumbSticks.leftY > 0.5f) != 0; } 186 | bool __cdecl IsLeftThumbStickDown() const noexcept { return (thumbSticks.leftY < -0.5f) != 0; } 187 | bool __cdecl IsLeftThumbStickLeft() const noexcept { return (thumbSticks.leftX < -0.5f) != 0; } 188 | bool __cdecl IsLeftThumbStickRight() const noexcept { return (thumbSticks.leftX > 0.5f) != 0; } 189 | 190 | bool __cdecl IsRightThumbStickUp() const noexcept { return (thumbSticks.rightY > 0.5f) != 0; } 191 | bool __cdecl IsRightThumbStickDown() const noexcept { return (thumbSticks.rightY < -0.5f) != 0; } 192 | bool __cdecl IsRightThumbStickLeft() const noexcept { return (thumbSticks.rightX < -0.5f) != 0; } 193 | bool __cdecl IsRightThumbStickRight() const noexcept { return (thumbSticks.rightX > 0.5f) != 0; } 194 | 195 | bool __cdecl IsLeftTriggerPressed() const noexcept { return (triggers.left > 0.5f) != 0; } 196 | bool __cdecl IsRightTriggerPressed() const noexcept { return (triggers.right > 0.5f) != 0; } 197 | }; 198 | 199 | struct DIRECTX_TOOLKIT_API Capabilities 200 | { 201 | enum Type : uint32_t 202 | { 203 | UNKNOWN = 0, 204 | GAMEPAD, 205 | WHEEL, 206 | ARCADE_STICK, 207 | FLIGHT_STICK, 208 | DANCE_PAD, 209 | GUITAR, 210 | GUITAR_ALTERNATE, 211 | DRUM_KIT, 212 | GUITAR_BASS = 11, 213 | ARCADE_PAD = 19, 214 | }; 215 | 216 | bool connected; 217 | Type gamepadType; 218 | #ifdef USING_GAMEINPUT 219 | APP_LOCAL_DEVICE_ID id; 220 | #elif defined(USING_WINDOWS_GAMING_INPUT) 221 | std::wstring id; 222 | #else 223 | uint64_t id; 224 | #endif 225 | uint16_t vid; 226 | uint16_t pid; 227 | 228 | Capabilities() noexcept : connected(false), gamepadType(UNKNOWN), id{}, vid(0), pid(0) {} 229 | 230 | bool __cdecl IsConnected() const noexcept { return connected; } 231 | }; 232 | 233 | class DIRECTX_TOOLKIT_API ButtonStateTracker 234 | { 235 | public: 236 | enum ButtonState : uint32_t 237 | { 238 | UP = 0, // Button is up 239 | HELD = 1, // Button is held down 240 | RELEASED = 2, // Button was just released 241 | PRESSED = 3, // Buton was just pressed 242 | }; 243 | 244 | ButtonState a; 245 | ButtonState b; 246 | ButtonState x; 247 | ButtonState y; 248 | 249 | ButtonState leftStick; 250 | ButtonState rightStick; 251 | 252 | ButtonState leftShoulder; 253 | ButtonState rightShoulder; 254 | 255 | union 256 | { 257 | ButtonState back; 258 | ButtonState view; 259 | }; 260 | 261 | union 262 | { 263 | ButtonState start; 264 | ButtonState menu; 265 | }; 266 | 267 | ButtonState dpadUp; 268 | ButtonState dpadDown; 269 | ButtonState dpadLeft; 270 | ButtonState dpadRight; 271 | 272 | ButtonState leftStickUp; 273 | ButtonState leftStickDown; 274 | ButtonState leftStickLeft; 275 | ButtonState leftStickRight; 276 | 277 | ButtonState rightStickUp; 278 | ButtonState rightStickDown; 279 | ButtonState rightStickLeft; 280 | ButtonState rightStickRight; 281 | 282 | ButtonState leftTrigger; 283 | ButtonState rightTrigger; 284 | 285 | #ifdef _PREFAST_ 286 | #pragma prefast(push) 287 | #pragma prefast(disable : 26495, "Reset() performs the initialization") 288 | #endif 289 | ButtonStateTracker() noexcept { Reset(); } 290 | #ifdef _PREFAST_ 291 | #pragma prefast(pop) 292 | #endif 293 | 294 | void __cdecl Update(const State& state) noexcept; 295 | 296 | void __cdecl Reset() noexcept; 297 | 298 | State __cdecl GetLastState() const noexcept { return lastState; } 299 | 300 | private: 301 | State lastState; 302 | }; 303 | 304 | // Retrieve the current state of the gamepad of the associated player index 305 | DIRECTX_TOOLKIT_API State __cdecl GetState( 306 | int player, 307 | DeadZone deadZoneMode = DEAD_ZONE_INDEPENDENT_AXES); 308 | 309 | // Retrieve the current capabilities of the gamepad of the associated player index 310 | DIRECTX_TOOLKIT_API Capabilities __cdecl GetCapabilities(int player); 311 | 312 | // Set the vibration motor speeds of the gamepad 313 | DIRECTX_TOOLKIT_API bool __cdecl SetVibration( 314 | int player, 315 | float leftMotor, float rightMotor, 316 | float leftTrigger = 0.f, float rightTrigger = 0.f) noexcept; 317 | 318 | // Handle suspending/resuming 319 | DIRECTX_TOOLKIT_API void __cdecl Suspend() noexcept; 320 | DIRECTX_TOOLKIT_API void __cdecl Resume() noexcept; 321 | 322 | #ifdef USING_GAMEINPUT 323 | DIRECTX_TOOLKIT_API void __cdecl RegisterEvents(void* ctrlChanged) noexcept; 324 | 325 | // Underlying device access 326 | _Success_(return) 327 | DIRECTX_TOOLKIT_API 328 | bool __cdecl GetDevice(int player, _Outptr_ IGameInputDevice * *device) noexcept; 329 | #elif defined(USING_WINDOWS_GAMING_INPUT) || defined(_XBOX_ONE) 330 | DIRECTX_TOOLKIT_API void __cdecl RegisterEvents(void* ctrlChanged, void* userChanged) noexcept; 331 | #endif 332 | 333 | // Singleton 334 | DIRECTX_TOOLKIT_API static GamePad& __cdecl Get(); 335 | 336 | private: 337 | // Private implementation. 338 | class Impl; 339 | 340 | std::unique_ptr pImpl; 341 | }; 342 | } 343 | 344 | #ifdef __clang__ 345 | #pragma clang diagnostic pop 346 | #endif 347 | 348 | #if defined(DIRECTX_TOOLKIT_IMPORT) && defined(_MSC_VER) 349 | #pragma warning(pop) 350 | #endif 351 | -------------------------------------------------------------------------------- /NoShadowPlayBS/include/DirectXTK/Model.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: Model.h 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #include 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | 35 | #ifndef DIRECTX_TOOLKIT_API 36 | #ifdef DIRECTX_TOOLKIT_EXPORT 37 | #define DIRECTX_TOOLKIT_API __declspec(dllexport) 38 | #elif defined(DIRECTX_TOOLKIT_IMPORT) 39 | #define DIRECTX_TOOLKIT_API __declspec(dllimport) 40 | #else 41 | #define DIRECTX_TOOLKIT_API 42 | #endif 43 | #endif 44 | 45 | #if defined(DIRECTX_TOOLKIT_IMPORT) && defined(_MSC_VER) 46 | #pragma warning(push) 47 | #pragma warning(disable : 4251) 48 | #endif 49 | 50 | 51 | namespace DirectX 52 | { 53 | inline namespace DX11 54 | { 55 | class IEffect; 56 | class IEffectFactory; 57 | class CommonStates; 58 | class ModelMesh; 59 | 60 | //------------------------------------------------------------------------------ 61 | // Model loading options 62 | enum ModelLoaderFlags : uint32_t 63 | { 64 | ModelLoader_Clockwise = 0x0, 65 | ModelLoader_CounterClockwise = 0x1, 66 | ModelLoader_PremultipledAlpha = 0x2, 67 | ModelLoader_MaterialColorsSRGB = 0x4, 68 | ModelLoader_AllowLargeModels = 0x8, 69 | ModelLoader_IncludeBones = 0x10, 70 | ModelLoader_DisableSkinning = 0x20, 71 | }; 72 | 73 | //------------------------------------------------------------------------------ 74 | // Frame hierarchy for rigid body and skeletal animation 75 | struct DIRECTX_TOOLKIT_API ModelBone 76 | { 77 | ModelBone() noexcept : 78 | parentIndex(c_Invalid), 79 | childIndex(c_Invalid), 80 | siblingIndex(c_Invalid) 81 | { 82 | } 83 | 84 | ModelBone(uint32_t parent, uint32_t child, uint32_t sibling) noexcept : 85 | parentIndex(parent), 86 | childIndex(child), 87 | siblingIndex(sibling) 88 | { 89 | } 90 | 91 | uint32_t parentIndex; 92 | uint32_t childIndex; 93 | uint32_t siblingIndex; 94 | std::wstring name; 95 | 96 | using Collection = std::vector; 97 | 98 | static constexpr uint32_t c_Invalid = uint32_t(-1); 99 | 100 | struct aligned_deleter { void operator()(void* p) noexcept { _aligned_free(p); } }; 101 | 102 | using TransformArray = std::unique_ptr; 103 | 104 | static TransformArray MakeArray(size_t count) 105 | { 106 | void* temp = _aligned_malloc(sizeof(XMMATRIX) * count, 16); 107 | if (!temp) 108 | throw std::bad_alloc(); 109 | return TransformArray(static_cast(temp)); 110 | } 111 | }; 112 | 113 | 114 | //------------------------------------------------------------------------------ 115 | // Each mesh part is a submesh with a single effect 116 | class DIRECTX_TOOLKIT_API ModelMeshPart 117 | { 118 | public: 119 | ModelMeshPart() noexcept; 120 | 121 | ModelMeshPart(ModelMeshPart&&) = default; 122 | ModelMeshPart& operator= (ModelMeshPart&&) = default; 123 | 124 | ModelMeshPart(ModelMeshPart const&) = default; 125 | ModelMeshPart& operator= (ModelMeshPart const&) = default; 126 | 127 | virtual ~ModelMeshPart(); 128 | 129 | using Collection = std::vector>; 130 | using InputLayoutCollection = std::vector; 131 | 132 | uint32_t indexCount; 133 | uint32_t startIndex; 134 | int32_t vertexOffset; 135 | uint32_t vertexStride; 136 | D3D_PRIMITIVE_TOPOLOGY primitiveType; 137 | DXGI_FORMAT indexFormat; 138 | Microsoft::WRL::ComPtr inputLayout; 139 | Microsoft::WRL::ComPtr indexBuffer; 140 | Microsoft::WRL::ComPtr vertexBuffer; 141 | std::shared_ptr effect; 142 | std::shared_ptr vbDecl; 143 | bool isAlpha; 144 | 145 | // Draw mesh part with custom effect 146 | void __cdecl Draw( 147 | _In_ ID3D11DeviceContext* deviceContext, 148 | _In_ IEffect* ieffect, 149 | _In_ ID3D11InputLayout* iinputLayout, 150 | _In_ std::function setCustomState = nullptr) const; 151 | 152 | void __cdecl DrawInstanced( 153 | _In_ ID3D11DeviceContext* deviceContext, 154 | _In_ IEffect* ieffect, 155 | _In_ ID3D11InputLayout* iinputLayout, 156 | uint32_t instanceCount, 157 | uint32_t startInstanceLocation = 0, 158 | _In_ std::function setCustomState = nullptr) const; 159 | 160 | // Create input layout for drawing with a custom effect. 161 | void __cdecl CreateInputLayout(_In_ ID3D11Device* device, _In_ IEffect* ieffect, _Outptr_ ID3D11InputLayout** iinputLayout) const; 162 | 163 | // Change effect used by part and regenerate input layout (be sure to call Model::Modified as well) 164 | void __cdecl ModifyEffect(_In_ ID3D11Device* device, _In_ const std::shared_ptr& ieffect, bool isalpha = false); 165 | }; 166 | 167 | 168 | //------------------------------------------------------------------------------ 169 | // A mesh consists of one or more model mesh parts 170 | class DIRECTX_TOOLKIT_API ModelMesh 171 | { 172 | public: 173 | ModelMesh() noexcept; 174 | 175 | ModelMesh(ModelMesh&&) = default; 176 | ModelMesh& operator= (ModelMesh&&) = default; 177 | 178 | ModelMesh(ModelMesh const&) = delete; 179 | ModelMesh& operator= (ModelMesh const&) = delete; 180 | 181 | virtual ~ModelMesh(); 182 | 183 | BoundingSphere boundingSphere; 184 | BoundingBox boundingBox; 185 | ModelMeshPart::Collection meshParts; 186 | uint32_t boneIndex; 187 | std::vector boneInfluences; 188 | std::wstring name; 189 | bool ccw; 190 | bool pmalpha; 191 | 192 | using Collection = std::vector>; 193 | 194 | // Setup states for drawing mesh 195 | void __cdecl PrepareForRendering( 196 | _In_ ID3D11DeviceContext* deviceContext, 197 | const CommonStates& states, 198 | bool alpha = false, 199 | bool wireframe = false) const; 200 | 201 | // Draw the mesh 202 | void XM_CALLCONV Draw( 203 | _In_ ID3D11DeviceContext* deviceContext, 204 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 205 | bool alpha = false, 206 | _In_ std::function setCustomState = nullptr) const; 207 | 208 | // Draw the mesh using model bones 209 | void XM_CALLCONV Draw( 210 | _In_ ID3D11DeviceContext* deviceContext, 211 | size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms, 212 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 213 | bool alpha = false, 214 | _In_ std::function setCustomState = nullptr) const; 215 | 216 | // Draw the mesh using skinning 217 | void XM_CALLCONV DrawSkinned( 218 | _In_ ID3D11DeviceContext* deviceContext, 219 | size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms, 220 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 221 | bool alpha = false, 222 | _In_ std::function setCustomState = nullptr) const; 223 | 224 | static void SetDepthBufferMode(bool reverseZ) 225 | { 226 | s_reversez = reverseZ; 227 | } 228 | 229 | private: 230 | static bool s_reversez; 231 | }; 232 | 233 | 234 | //------------------------------------------------------------------------------ 235 | // A model consists of one or more meshes 236 | class DIRECTX_TOOLKIT_API Model 237 | { 238 | public: 239 | Model() = default; 240 | 241 | Model(Model&&) = default; 242 | Model& operator= (Model&&) = default; 243 | 244 | Model(Model const& other); 245 | Model& operator= (Model const& rhs); 246 | 247 | virtual ~Model(); 248 | 249 | ModelMesh::Collection meshes; 250 | ModelBone::Collection bones; 251 | ModelBone::TransformArray boneMatrices; 252 | ModelBone::TransformArray invBindPoseMatrices; 253 | std::wstring name; 254 | 255 | // Draw all the meshes in the model 256 | void XM_CALLCONV Draw( 257 | _In_ ID3D11DeviceContext* deviceContext, 258 | const CommonStates& states, 259 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 260 | bool wireframe = false, 261 | _In_ std::function setCustomState = nullptr) const; 262 | 263 | // Draw all the meshes using model bones 264 | void XM_CALLCONV Draw( 265 | _In_ ID3D11DeviceContext* deviceContext, 266 | const CommonStates& states, 267 | size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms, 268 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 269 | bool wireframe = false, 270 | _In_ std::function setCustomState = nullptr) const; 271 | 272 | // Draw all the meshes using skinning 273 | void XM_CALLCONV DrawSkinned( 274 | _In_ ID3D11DeviceContext* deviceContext, 275 | const CommonStates& states, 276 | size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms, 277 | FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 278 | bool wireframe = false, 279 | _In_ std::function setCustomState = nullptr) const; 280 | 281 | // Compute bone positions based on heirarchy and transform matrices 282 | void __cdecl CopyAbsoluteBoneTransformsTo( 283 | size_t nbones, 284 | _Out_writes_(nbones) XMMATRIX* boneTransforms) const; 285 | 286 | void __cdecl CopyAbsoluteBoneTransforms( 287 | size_t nbones, 288 | _In_reads_(nbones) const XMMATRIX* inBoneTransforms, 289 | _Out_writes_(nbones) XMMATRIX* outBoneTransforms) const; 290 | 291 | // Set bone matrices to a set of relative tansforms 292 | void __cdecl CopyBoneTransformsFrom( 293 | size_t nbones, 294 | _In_reads_(nbones) const XMMATRIX* boneTransforms); 295 | 296 | // Copies the relative bone matrices to a transform array 297 | void __cdecl CopyBoneTransformsTo( 298 | size_t nbones, 299 | _Out_writes_(nbones) XMMATRIX* boneTransforms) const; 300 | 301 | // Notify model that effects, parts list, or mesh list has changed 302 | void __cdecl Modified() noexcept { mEffectCache.clear(); } 303 | 304 | // Update all effects used by the model 305 | void __cdecl UpdateEffects(_In_ std::function setEffect); 306 | 307 | // Loads a model from a Visual Studio Starter Kit .CMO file 308 | static std::unique_ptr __cdecl CreateFromCMO( 309 | _In_ ID3D11Device* device, 310 | _In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize, 311 | _In_ IEffectFactory& fxFactory, 312 | ModelLoaderFlags flags = ModelLoader_CounterClockwise, 313 | _Out_opt_ size_t* animsOffset = nullptr); 314 | static std::unique_ptr __cdecl CreateFromCMO( 315 | _In_ ID3D11Device* device, 316 | _In_z_ const wchar_t* szFileName, 317 | _In_ IEffectFactory& fxFactory, 318 | ModelLoaderFlags flags = ModelLoader_CounterClockwise, 319 | _Out_opt_ size_t* animsOffset = nullptr); 320 | 321 | // Loads a model from a DirectX SDK .SDKMESH file 322 | static std::unique_ptr __cdecl CreateFromSDKMESH( 323 | _In_ ID3D11Device* device, 324 | _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize, 325 | _In_ IEffectFactory& fxFactory, 326 | ModelLoaderFlags flags = ModelLoader_Clockwise); 327 | static std::unique_ptr __cdecl CreateFromSDKMESH( 328 | _In_ ID3D11Device* device, 329 | _In_z_ const wchar_t* szFileName, 330 | _In_ IEffectFactory& fxFactory, 331 | ModelLoaderFlags flags = ModelLoader_Clockwise); 332 | 333 | // Loads a model from a .VBO file 334 | static std::unique_ptr __cdecl CreateFromVBO( 335 | _In_ ID3D11Device* device, 336 | _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize, 337 | _In_ std::shared_ptr ieffect = nullptr, 338 | ModelLoaderFlags flags = ModelLoader_Clockwise); 339 | static std::unique_ptr __cdecl CreateFromVBO( 340 | _In_ ID3D11Device* device, 341 | _In_z_ const wchar_t* szFileName, 342 | _In_ std::shared_ptr ieffect = nullptr, 343 | ModelLoaderFlags flags = ModelLoader_Clockwise); 344 | 345 | #ifdef __cpp_lib_byte 346 | static std::unique_ptr __cdecl CreateFromCMO( 347 | _In_ ID3D11Device* device, 348 | _In_reads_bytes_(dataSize) const std::byte* meshData, size_t dataSize, 349 | _In_ IEffectFactory& fxFactory, 350 | ModelLoaderFlags flags = ModelLoader_CounterClockwise, 351 | _Out_opt_ size_t* animsOffset = nullptr) 352 | { 353 | return CreateFromCMO(device, reinterpret_cast(meshData), dataSize, fxFactory, flags, animsOffset); 354 | } 355 | 356 | static std::unique_ptr __cdecl CreateFromSDKMESH( 357 | _In_ ID3D11Device* device, 358 | _In_reads_bytes_(dataSize) const std::byte* meshData, _In_ size_t dataSize, 359 | _In_ IEffectFactory& fxFactory, 360 | ModelLoaderFlags flags = ModelLoader_Clockwise) 361 | { 362 | return CreateFromSDKMESH(device, reinterpret_cast(meshData), dataSize, fxFactory, flags); 363 | } 364 | 365 | static std::unique_ptr __cdecl CreateFromVBO( 366 | _In_ ID3D11Device* device, 367 | _In_reads_bytes_(dataSize) const std::byte* meshData, _In_ size_t dataSize, 368 | _In_ std::shared_ptr ieffect = nullptr, 369 | ModelLoaderFlags flags = ModelLoader_Clockwise) 370 | { 371 | return CreateFromVBO(device, reinterpret_cast(meshData), dataSize, ieffect, flags); 372 | } 373 | #endif // __cpp_lib_byte 374 | 375 | #if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED) 376 | static std::unique_ptr __cdecl CreateFromCMO( 377 | _In_ ID3D11Device* device, 378 | _In_z_ const __wchar_t* szFileName, 379 | _In_ IEffectFactory& fxFactory, 380 | ModelLoaderFlags flags = ModelLoader_CounterClockwise, 381 | _Out_opt_ size_t* animsOffset = nullptr); 382 | 383 | static std::unique_ptr __cdecl CreateFromSDKMESH( 384 | _In_ ID3D11Device* device, 385 | _In_z_ const __wchar_t* szFileName, 386 | _In_ IEffectFactory& fxFactory, 387 | ModelLoaderFlags flags = ModelLoader_Clockwise); 388 | 389 | static std::unique_ptr __cdecl CreateFromVBO( 390 | _In_ ID3D11Device* device, 391 | _In_z_ const __wchar_t* szFileName, 392 | _In_ std::shared_ptr ieffect = nullptr, 393 | ModelLoaderFlags flags = ModelLoader_Clockwise); 394 | #endif // !_NATIVE_WCHAR_T_DEFINED 395 | 396 | private: 397 | std::set mEffectCache; 398 | 399 | void __cdecl ComputeAbsolute(uint32_t index, 400 | CXMMATRIX local, size_t nbones, 401 | _In_reads_(nbones) const XMMATRIX* inBoneTransforms, 402 | _Inout_updates_(nbones) XMMATRIX* outBoneTransforms, 403 | size_t& visited) const; 404 | }; 405 | 406 | #ifdef __clang__ 407 | #pragma clang diagnostic push 408 | #pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec" 409 | #endif 410 | 411 | DEFINE_ENUM_FLAG_OPERATORS(ModelLoaderFlags) 412 | 413 | #ifdef __clang__ 414 | #pragma clang diagnostic pop 415 | #endif 416 | } 417 | } 418 | 419 | #if defined(DIRECTX_TOOLKIT_IMPORT) && defined(_MSC_VER) 420 | #pragma warning(pop) 421 | #endif 422 | --------------------------------------------------------------------------------