Skip to content

Commit

Permalink
use GetSystemPaletteEntries hook for any display DC
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Dec 22, 2024
1 parent 02a97cf commit d6a8027
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/winapi_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,10 +1426,7 @@ UINT WINAPI fake_GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LP
pPalEntries,
_ReturnAddress());

if (g_ddraw.ref &&
g_ddraw.bpp == 8 &&
pPalEntries &&
((g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) || WindowFromDC(hdc) == GetDesktopWindow()))
if (g_ddraw.ref && g_ddraw.bpp == 8 && pPalEntries && GetObjectType(hdc) == OBJ_DC)
{
TRACE(" Display DC\n");

Expand All @@ -1441,10 +1438,7 @@ UINT WINAPI fake_GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LP
{
for (int i = iStart, x = 0; i < iStart + cEntries && i < 256; i++, x++)
{
pPalEntries[x].peRed = g_ddp_default_palette[i].peRed;
pPalEntries[x].peGreen = g_ddp_default_palette[i].peGreen;
pPalEntries[x].peBlue = g_ddp_default_palette[i].peBlue;
pPalEntries[x].peFlags = g_ddp_default_palette[i].peFlags;
pPalEntries[x] = g_ddp_default_palette[i];
}
}

Expand Down

0 comments on commit d6a8027

Please sign in to comment.