diff --git a/EGameTools/source/ImGui/impl/d3d11_impl.cpp b/EGameTools/source/ImGui/impl/d3d11_impl.cpp index 12df38b..463609c 100644 --- a/EGameTools/source/ImGui/impl/d3d11_impl.cpp +++ b/EGameTools/source/ImGui/impl/d3d11_impl.cpp @@ -6,6 +6,7 @@ namespace impl { namespace d3d11 { ID3D11Device* d3d11Device = nullptr; static ID3D11DeviceContext* d3d11DeviceContext = nullptr; + static ID3D11RenderTargetView* d3d11RenderTargetView = nullptr; HRESULT(__stdcall* oPresent)(IDXGISwapChain*, UINT, UINT); HRESULT __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags) { @@ -18,6 +19,19 @@ namespace impl { pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&d3d11Device); d3d11Device->GetImmediateContext(&d3d11DeviceContext); + ID3D11Texture2D* renderTargetTexture = nullptr; + + // Create custom render target view because DX11 color space issue with ImGui bruh + if (SUCCEEDED(pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast(&renderTargetTexture)))) { + D3D11_RENDER_TARGET_VIEW_DESC desc{}; + memset(&desc, 0, sizeof(desc)); + desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + + d3d11Device->CreateRenderTargetView(renderTargetTexture, &desc, &d3d11RenderTargetView); + renderTargetTexture->Release(); + } + #ifndef LLMH_IMPL_DISABLE_DEBUG std::thread([&desc]() { impl::win32::init(desc.OutputWindow); }).detach(); #else @@ -35,6 +49,8 @@ namespace impl { init = true; } + d3d11DeviceContext->OMSetRenderTargets(1, &d3d11RenderTargetView, nullptr); + ImGui_ImplDX11_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); diff --git a/EGameTools/source/menu/init.cpp b/EGameTools/source/menu/init.cpp index 31fc93a..e94dfb0 100644 --- a/EGameTools/source/menu/init.cpp +++ b/EGameTools/source/menu/init.cpp @@ -269,6 +269,8 @@ namespace Menu { io.FontDefault = io.Fonts->AddFontFromMemoryTTF((void*)g_FontRudaBold, sizeof(g_FontRudaBold), 12.0f + 6.0f, &fontConfig); io.Fonts->Build(); + spdlog::warn("Loading EGameTools logo texture"); EGTLogoTexture = Utils::Texture::LoadImGuiTexture(g_EGTWhiteLogo, sizeof(g_EGTWhiteLogo)); + spdlog::info("Loaded EGameTools logo"); } } \ No newline at end of file diff --git a/EGameTools/source/utils/texture.cpp b/EGameTools/source/utils/texture.cpp index 7e1effe..0247d38 100644 --- a/EGameTools/source/utils/texture.cpp +++ b/EGameTools/source/utils/texture.cpp @@ -19,7 +19,7 @@ namespace Utils { namespace Texture { static int descriptor_index = 1; - ImTextureID LoadImGuiTextureD3D11(const unsigned char* rawData, const int rawSize) { + static ImTextureID LoadImGuiTextureD3D11(const unsigned char* rawData, const int rawSize) { int image_width = 0; int image_height = 0; unsigned char* image_data = stbi_load_from_memory(rawData, rawSize, &image_width, &image_height, nullptr, 4); @@ -62,7 +62,7 @@ namespace Utils { return static_cast(my_texture); } - ImTextureID LoadImGuiTextureD3D12(const unsigned char* rawData, const int rawSize) { + static ImTextureID LoadImGuiTextureD3D12(const unsigned char* rawData, const int rawSize) { int image_width = 0; int image_height = 0; unsigned char* image_data = stbi_load_from_memory(rawData, rawSize, &image_width, &image_height, nullptr, 4);