From 37c6a0aa3f2c3c21d29fcdedfea38e9ea5d5f369 Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Tue, 24 Mar 2026 23:19:49 +0100 Subject: [PATCH] Add DirectX manipulating lib --- includes/DirectX.h | 12 ++++++++++++ libs/DirectX.cpp | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 includes/DirectX.h create mode 100644 libs/DirectX.cpp diff --git a/includes/DirectX.h b/includes/DirectX.h new file mode 100644 index 0000000..56edeb9 --- /dev/null +++ b/includes/DirectX.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +/** + * @brief Retrieves Display mode. + * + * This function should be calld on event `on_present` + * + * @param swapchain retrieved from on_present event + */ +bool IsExclusiveFullscreen(reshade::api::swapchain* swapchain); diff --git a/libs/DirectX.cpp b/libs/DirectX.cpp new file mode 100644 index 0000000..78eaec6 --- /dev/null +++ b/libs/DirectX.cpp @@ -0,0 +1,18 @@ +#include "DirectX.h" +#include + +bool IsExclusiveFullscreen(reshade::api::swapchain* swapchain) { + if (!swapchain) return false; + + auto native = swapchain->get_native(); // Retrieving native swapchain + IDXGISwapChain* dxgiSwap = reinterpret_cast(native); + if (!dxgiSwap) return false; + + DXGI_SWAP_CHAIN_DESC desc = {}; + bool exclusive = false; + + if (SUCCEEDED(dxgiSwap->GetDesc(&desc))) + exclusive = (desc.Windowed == FALSE); // FALSE = exclusive fullscreen + + return exclusive; +} \ No newline at end of file