1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

RealizePalette should not change the hardware palette in fullscreen mode

Fixes black briefing screens in Starcraft (issue #206).
This commit is contained in:
narzoul 2023-02-25 15:39:32 +01:00
parent 280d2b52e5
commit 21c52092b8
2 changed files with 10 additions and 3 deletions

View File

@ -1526,10 +1526,10 @@ namespace D3dDdi
return;
}
DDraw::PrimarySurface::updatePalette();
if (isFullscreen)
{
DDraw::PrimarySurface::updatePalette();
const Int2 ar = m_device.getAdapter().getAspectRatio();
g_presentationRect = calculateScaledRect({ 0, 0, ar.x, ar.y }, DDraw::RealPrimarySurface::getMonitorRect());
auto& si = m_origData.pSurfList[0];
@ -1544,6 +1544,8 @@ namespace D3dDdi
}
else
{
Gdi::Palette::setHardwarePalette(Gdi::Palette::getSystemPalette().data());
g_presentationRect = {};
Gdi::VirtualScreen::setFullscreenMode(false);
Gdi::Cursor::setEmulated(false);

View File

@ -3,6 +3,8 @@
#include <Common/Hook.h>
#include <Common/Log.h>
#include <Common/ScopedSrwLock.h>
#include <DDraw/RealPrimarySurface.h>
#include <DDraw/Surfaces/PrimarySurface.h>
#include <Gdi/Gdi.h>
#include <Gdi/Palette.h>
#include <Gdi/VirtualScreen.h>
@ -170,7 +172,10 @@ namespace
}
paletteInfo.isRealized = true;
std::memcpy(g_hardwarePalette, g_systemPalette, sizeof(g_hardwarePalette));
if (!DDraw::RealPrimarySurface::isFullscreen() || !DDraw::PrimarySurface::s_palette)
{
std::memcpy(g_hardwarePalette, g_systemPalette, sizeof(g_hardwarePalette));
}
Gdi::VirtualScreen::updatePalette(g_systemPalette);
return LOG_RESULT(count);
}