feat: working widescreen and HighDef checks
This commit is contained in:
@@ -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<float>(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<const unsigned char*>(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<int*>(linearData));
|
||||
|
||||
delete[] linearData;
|
||||
|
||||
Reference in New Issue
Block a user