From 3de50d98adb490b63f306c149fa7b59f5a77181f Mon Sep 17 00:00:00 2001 From: narzoul Date: Wed, 2 Jan 2019 15:45:56 +0100 Subject: [PATCH] Fixed wrong palette returned by GetSystemPaletteEntries --- DDrawCompat/Gdi/Palette.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DDrawCompat/Gdi/Palette.cpp b/DDrawCompat/Gdi/Palette.cpp index 80180ea..bfb5433 100644 --- a/DDrawCompat/Gdi/Palette.cpp +++ b/DDrawCompat/Gdi/Palette.cpp @@ -7,7 +7,6 @@ #include "Common/Hook.h" #include "Common/Log.h" #include "DDraw/ScopedThreadLock.h" -#include "DDraw/Surfaces/PrimarySurface.h" #include "Gdi/Gdi.h" #include "Gdi/Palette.h" #include "VirtualScreen.h" @@ -104,7 +103,7 @@ namespace } DDraw::ScopedThreadLock lock; - std::memcpy(lppe, &DDraw::PrimarySurface::s_paletteEntries[iStartIndex], nEntries * sizeof(PALETTEENTRY)); + std::memcpy(lppe, &g_systemPalette[iStartIndex], nEntries * sizeof(PALETTEENTRY)); return LOG_RESULT(nEntries); } @@ -210,7 +209,7 @@ namespace Gdi { HPALETTE defaultPalette = reinterpret_cast(GetStockObject(DEFAULT_PALETTE)); GetPaletteEntries(defaultPalette, 0, 10, g_systemPalette); - GetPaletteEntries(defaultPalette, 246, 10, &g_systemPalette[246]); + GetPaletteEntries(defaultPalette, 10, 10, &g_systemPalette[246]); Gdi::VirtualScreen::updatePalette(); HOOK_FUNCTION(gdi32, GetSystemPaletteEntries, getSystemPaletteEntries);