mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Limit maximum video memory
Fixes blurry textures in Rayman 2 and crash in Settlers 4
This commit is contained in:
parent
e83371afed
commit
b6f6f2acf0
@ -219,10 +219,36 @@ namespace
|
|||||||
{
|
{
|
||||||
LOG_FUNC("D3DKMTQueryAdapterInfo", pData);
|
LOG_FUNC("D3DKMTQueryAdapterInfo", pData);
|
||||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTQueryAdapterInfo)(pData);
|
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTQueryAdapterInfo)(pData);
|
||||||
if (SUCCEEDED(result) && KMTQAITYPE_UMDRIVERNAME == pData->Type)
|
if (SUCCEEDED(result))
|
||||||
{
|
{
|
||||||
auto info = static_cast<D3DKMT_UMDFILENAMEINFO*>(pData->pPrivateDriverData);
|
switch (pData->Type)
|
||||||
D3dDdi::onUmdFileNameQueried(info->UmdFileName);
|
{
|
||||||
|
case KMTQAITYPE_UMDRIVERNAME:
|
||||||
|
{
|
||||||
|
auto info = static_cast<D3DKMT_UMDFILENAMEINFO*>(pData->pPrivateDriverData);
|
||||||
|
D3dDdi::onUmdFileNameQueried(info->UmdFileName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KMTQAITYPE_GETSEGMENTSIZE:
|
||||||
|
{
|
||||||
|
auto info = static_cast<D3DKMT_SEGMENTSIZEINFO*>(pData->pPrivateDriverData);
|
||||||
|
const ULONGLONG maxMem = 0x3FFF0000;
|
||||||
|
if (info->DedicatedVideoMemorySize > maxMem)
|
||||||
|
{
|
||||||
|
info->DedicatedVideoMemorySize = maxMem;
|
||||||
|
}
|
||||||
|
if (info->DedicatedVideoMemorySize + info->DedicatedSystemMemorySize > maxMem)
|
||||||
|
{
|
||||||
|
info->DedicatedSystemMemorySize = maxMem - info->DedicatedVideoMemorySize;
|
||||||
|
}
|
||||||
|
if (info->SharedSystemMemorySize > maxMem)
|
||||||
|
{
|
||||||
|
info->SharedSystemMemorySize = maxMem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return LOG_RESULT(result);
|
return LOG_RESULT(result);
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,15 @@ std::ostream& operator<<(std::ostream& os, const D3DKMT_PRESENT& data)
|
|||||||
<< static_cast<UINT>(data.bOptimizeForComposition);
|
<< static_cast<UINT>(data.bOptimizeForComposition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_QUERYADAPTERINFO& data)
|
||||||
|
{
|
||||||
|
return Compat::LogStruct(os)
|
||||||
|
<< Compat::hex(data.hAdapter)
|
||||||
|
<< data.Type
|
||||||
|
<< data.pPrivateDriverData
|
||||||
|
<< data.PrivateDriverDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETQUEUEDLIMIT& data)
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETQUEUEDLIMIT& data)
|
||||||
{
|
{
|
||||||
return Compat::LogStruct(os)
|
return Compat::LogStruct(os)
|
||||||
|
@ -15,6 +15,7 @@ std::ostream& operator<<(std::ostream& os, const D3DKMT_DESTROYCONTEXT& data);
|
|||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_DESTROYDEVICE& data);
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_DESTROYDEVICE& data);
|
||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_OPENADAPTERFROMHDC& data);
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_OPENADAPTERFROMHDC& data);
|
||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_PRESENT& data);
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_PRESENT& data);
|
||||||
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_QUERYADAPTERINFO& data);
|
||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETQUEUEDLIMIT& data);
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETQUEUEDLIMIT& data);
|
||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETVIDPNSOURCEOWNER& data);
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETVIDPNSOURCEOWNER& data);
|
||||||
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETVIDPNSOURCEOWNER1& data);
|
std::ostream& operator<<(std::ostream& os, const D3DKMT_SETVIDPNSOURCEOWNER1& data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user