From e2f5f4c545d114370700b9ba68a3f2a8e33587a6 Mon Sep 17 00:00:00 2001 From: str1k3r <115313679+S1l3ntStr1ke87@users.noreply.github.com> Date: Tue, 25 Aug 2026 19:07:51 -0400 Subject: [PATCH] feat: working widescreen and HighDef checks --- 4J_Render/Windows64/RendererCore.cpp | 33 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/4J_Render/Windows64/RendererCore.cpp b/4J_Render/Windows64/RendererCore.cpp index 003393e..f29f5c0 100644 --- a/4J_Render/Windows64/RendererCore.cpp +++ b/4J_Render/Windows64/RendererCore.cpp @@ -55,6 +55,8 @@ D3D11_PRIMITIVE_TOPOLOGY Renderer::g_topologies[C4JRender::PRIMITIVE_TYPE_COUNT] }; static const unsigned int kVertexBufferSize = 0x100000; +static unsigned int kScreenWidth = 1920; +static unsigned int kScreenHeight = 1080; static const unsigned int kThumbnailSize = 64; static const unsigned int g_vertexStrides[C4JRender::VERTEX_TYPE_COUNT] = { 32, 16, 32, 32 }; @@ -854,12 +856,22 @@ ID3D11DeviceContext *Renderer::InitialiseContext(bool fromPresent) bool Renderer::IsHiDef() { - return true; + if(kScreenHeight >= 720 && kScreenWidth >= 1280) + { + return true; + } + else + { + return false; + } } bool Renderer::IsWidescreen() { - return true; + if (kScreenHeight == 0) return false; + + float aspectRatio = static_cast(kScreenWidth) / kScreenHeight; + return (aspectRatio >= 1.6f); } void Renderer::Present(int ScreenWidth, int ScreenHeight) @@ -870,7 +882,10 @@ void Renderer::Present(int ScreenWidth, int ScreenHeight) { PROFILER_SCOPE("Renderer::Present", "ScreenGrab", MP_MAGENTA); - unsigned char *linearData = new unsigned char[ScreenWidth * ScreenHeight * 4]; + kScreenHeight = ScreenHeight; + kScreenWidth = ScreenWidth; + + unsigned char *linearData = new unsigned char[kScreenWidth * kScreenHeight * 4]; ID3D11Resource *backBufferResource = NULL; ID3D11Texture2D *backBuffer = NULL; @@ -896,13 +911,13 @@ void Renderer::Present(int ScreenWidth, int ScreenHeight) m_pDeviceContext->Map(stagingTexture, 0, D3D11_MAP_READ_WRITE, 0, &mapped); const unsigned char* src = reinterpret_cast(mapped.pData); - for (UINT y = 0; y < ScreenHeight; ++y) + for (UINT y = 0; y < kScreenHeight; ++y) { - unsigned char *dstRow = linearData + y * ScreenWidth * 4; + unsigned char *dstRow = linearData + y * kScreenWidth * 4; const unsigned char *srcRow = src + y * mapped.RowPitch; - std::memcpy(dstRow, srcRow, ScreenWidth * 4); + std::memcpy(dstRow, srcRow, kScreenWidth * 4); - for (UINT x = 0; x < ScreenWidth; ++x) + for (UINT x = 0; x < kScreenWidth; ++x) dstRow[x * 4 + 3] = 0xFF; } @@ -924,8 +939,8 @@ void Renderer::Present(int ScreenWidth, int ScreenHeight) UTCSysTime.wSecond); D3DXIMAGE_INFO info; - info.Width = ScreenWidth; - info.Height = ScreenHeight; + info.Width = kScreenWidth; + info.Height = kScreenHeight; SaveTextureData(fileName, &info, reinterpret_cast(linearData)); delete[] linearData;