Skip to content

Commit

Permalink
Set video memory size
Browse files Browse the repository at this point in the history
Limit the video memory size as some games like The Settlers IV GOLD
won't work with large video memory sizes.
  • Loading branch information
elishacloud committed Mar 12, 2018
1 parent 0c3fb70 commit ea5ccd4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
45 changes: 45 additions & 0 deletions DDrawCompat/DDrawLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,51 @@ std::ostream& operator<<(std::ostream& os, HWND__& hwnd)
return os << "WND(" << static_cast<void*>(&hwnd) << ',' << name << ',' << rect << ')';
}

std::ostream& operator<<(std::ostream& os, const DDCAPS& caps)
{
return Compat::LogStruct(os)
<< caps.dwSize
<< Compat::hex(caps.dwCaps)
<< Compat::hex(caps.dwCaps2)
<< Compat::hex(caps.dwCKeyCaps)
<< Compat::hex(caps.dwFXCaps)
<< Compat::hex(caps.dwFXAlphaCaps)
<< Compat::hex(caps.dwPalCaps)
<< Compat::hex(caps.dwSVCaps)
<< Compat::hex(caps.dwAlphaBltConstBitDepths)
<< Compat::hex(caps.dwAlphaBltPixelBitDepths)
<< Compat::hex(caps.dwAlphaBltSurfaceBitDepths)
<< Compat::hex(caps.dwAlphaOverlayConstBitDepths)
<< Compat::hex(caps.dwAlphaOverlayPixelBitDepths)
<< Compat::hex(caps.dwAlphaOverlaySurfaceBitDepths)
<< Compat::hex(caps.dwZBufferBitDepths)
<< Compat::hex(caps.dwVidMemTotal)
<< Compat::hex(caps.dwVidMemFree)
<< Compat::hex(caps.dwMaxVisibleOverlays)
<< Compat::hex(caps.dwCurrVisibleOverlays)
<< Compat::hex(caps.dwNumFourCCCodes)
<< Compat::hex(caps.dwAlignBoundarySrc)
<< Compat::hex(caps.dwAlignSizeSrc)
<< Compat::hex(caps.dwAlignBoundaryDest)
<< Compat::hex(caps.dwAlignSizeDest)
<< Compat::hex(caps.dwAlignStrideAlign)
<< "{" << caps.dwRops[0]
<< caps.dwRops[1]
<< caps.dwRops[2]
<< caps.dwRops[3]
<< caps.dwRops[4]
<< caps.dwRops[5]
<< caps.dwRops[6]
<< caps.dwRops[7] << "}"
<< caps.ddsOldCaps
<< Compat::hex(caps.dwMinOverlayStretch)
<< Compat::hex(caps.dwMaxOverlayStretch)
<< Compat::hex(caps.dwMinLiveVideoStretch)
<< Compat::hex(caps.dwMaxLiveVideoStretch)
<< Compat::hex(caps.dwMinHwCodecStretch)
<< Compat::hex(caps.dwMaxHwCodecStretch);
}

std::ostream& operator<<(std::ostream& os, const DDSCAPS& caps)
{
return Compat::LogStruct(os)
Expand Down
1 change: 1 addition & 0 deletions DDrawCompat/DDrawLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ std::ostream& operator<<(std::ostream& os, const DEVMODEW& dm);
std::ostream& operator<<(std::ostream& os, const RECT& rect);
std::ostream& operator<<(std::ostream& os, HDC__& dc);
std::ostream& operator<<(std::ostream& os, HWND__& hwnd);
std::ostream& operator<<(std::ostream& os, const DDCAPS& caps);
std::ostream& operator<<(std::ostream& os, const DDSCAPS& caps);
std::ostream& operator<<(std::ostream& os, const DDSCAPS2& caps);
std::ostream& operator<<(std::ostream& os, const DDPIXELFORMAT& pf);
Expand Down
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 3523
#define BUILD_NUMBER 3549
8 changes: 8 additions & 0 deletions ddraw/IDirectDrawTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ void ConvertCaps(DDSCAPS2 &Caps2, DDSCAPS &Caps)

bool ConvertCaps(DDCAPS_DX7 &Caps, DDCAPS_DX7 &Caps7)
{
// Set available memory, some games have issues if this is set to high
if (Config.ConvertToDirectDraw7 && Caps7.dwVidMemTotal > 0x8000000)
{
Caps7.dwVidMemFree = 0x8000000 - (Caps7.dwVidMemTotal - Caps7.dwVidMemFree);
Caps7.dwVidMemTotal = 0x8000000;
}

// Convert caps
switch (Caps.dwSize)
{
case sizeof(DDCAPS_DX1) :
Expand Down

0 comments on commit ea5ccd4

Please # to comment.