Compare commits
3
Commits
2c2c7b8075
...
4c50659091
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c50659091 | ||
|
|
fdc89a23ea | ||
|
|
e2f5f4c545 |
No files matched your search
@@ -131,9 +131,9 @@ void C4JRender::DoScreenGrabOnNextPresent()
|
||||
InternalRenderManager.DoScreenGrabOnNextPresent();
|
||||
}
|
||||
|
||||
void C4JRender::Present(int ScreenWidth, int ScreenHeight)
|
||||
void C4JRender::Present()
|
||||
{
|
||||
InternalRenderManager.Present(ScreenWidth, ScreenHeight);
|
||||
InternalRenderManager.Present();
|
||||
}
|
||||
|
||||
void C4JRender::Clear(int flags, D3D11_RECT* pRect)
|
||||
@@ -146,6 +146,11 @@ void C4JRender::SetClearColour(const float colourRGBA[4])
|
||||
InternalRenderManager.SetClearColour(colourRGBA);
|
||||
}
|
||||
|
||||
void C4JRender::setResolution(int ScreenWidth, int ScreenHeight)
|
||||
{
|
||||
InternalRenderManager.setResolution(ScreenWidth, ScreenHeight);
|
||||
}
|
||||
|
||||
bool C4JRender::IsWidescreen()
|
||||
{
|
||||
return InternalRenderManager.IsWidescreen();
|
||||
|
||||
@@ -72,9 +72,10 @@ public:
|
||||
ID3D11DeviceContext *InitialiseContext(bool fromPresent);
|
||||
void StartFrame();
|
||||
void DoScreenGrabOnNextPresent();
|
||||
void Present(int ScreenWidth, int ScreenHeight);
|
||||
void Present();
|
||||
void Clear(int flags, D3D11_RECT *pRect);
|
||||
void SetClearColour(const float colourRGBA[4]);
|
||||
void setResolution(int ScreenWidth, int ScreenHeight);
|
||||
bool IsWidescreen();
|
||||
bool IsHiDef();
|
||||
void CaptureThumbnail(ImageFileBuffer *pngOut);
|
||||
|
||||
@@ -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 };
|
||||
@@ -852,17 +854,30 @@ ID3D11DeviceContext *Renderer::InitialiseContext(bool fromPresent)
|
||||
return deviceContext;
|
||||
}
|
||||
|
||||
//str1k3r - yo fuck you 4J and your hardcoded ass game
|
||||
void Renderer::setResolution(int ScreenWidth, int ScreenHeight)
|
||||
{
|
||||
if(kScreenHeight != ScreenHeight || kScreenWidth != ScreenWidth)
|
||||
{
|
||||
kScreenHeight = ScreenHeight;
|
||||
kScreenWidth = ScreenWidth;
|
||||
}
|
||||
}
|
||||
|
||||
bool Renderer::IsHiDef()
|
||||
{
|
||||
return true;
|
||||
return (kScreenHeight >= 720 && kScreenWidth >= 1280);
|
||||
}
|
||||
|
||||
bool Renderer::IsWidescreen()
|
||||
{
|
||||
return true;
|
||||
if (kScreenHeight == 0) return false;
|
||||
|
||||
float aspectRatio = static_cast<float>(kScreenWidth) / kScreenHeight;
|
||||
return (aspectRatio >= 1.56f);
|
||||
}
|
||||
|
||||
void Renderer::Present(int ScreenWidth, int ScreenHeight)
|
||||
void Renderer::Present()
|
||||
{
|
||||
PROFILER_SCOPE("Renderer::Present", "Present", MP_MAGENTA);
|
||||
|
||||
@@ -870,7 +885,7 @@ void Renderer::Present(int ScreenWidth, int ScreenHeight)
|
||||
{
|
||||
PROFILER_SCOPE("Renderer::Present", "ScreenGrab", MP_MAGENTA);
|
||||
|
||||
unsigned char *linearData = new unsigned char[ScreenWidth * ScreenHeight * 4];
|
||||
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;
|
||||
|
||||
@@ -81,9 +81,10 @@ public:
|
||||
void InitialiseContext();
|
||||
void StartFrame();
|
||||
void DoScreenGrabOnNextPresent();
|
||||
void Present(int ScreenWidth, int ScreenHeight);
|
||||
void Present();
|
||||
void Clear(int flags, D3D11_RECT *pRect = NULL);
|
||||
void SetClearColour(const float colourRGBA[4]);
|
||||
void setResolution(int ScreenWidth, int ScreenHeight);
|
||||
bool IsWidescreen();
|
||||
bool IsHiDef();
|
||||
void CaptureThumbnail(ImageFileBuffer *pngOut);
|
||||
|
||||
Reference in new issue
Block a user