hook GetSystemPaletteEntries

This commit is contained in:
FunkyFr3sh 2024-12-15 00:46:44 +01:00
parent 806924f86e
commit 1c263ca573
5 changed files with 30 additions and 2 deletions

View file

@ -20,6 +20,7 @@
#include "dllmain.h"
#include "hook.h"
#include "directinput.h"
#include "ddpalette.h"
BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
@ -1348,6 +1349,20 @@ HFONT WINAPI fake_CreateFontA(
lpszFace);
}
UINT WINAPI fake_GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries)
{
if (g_ddraw.ref && g_ddraw.bpp == 8 && WindowFromDC(hdc) == g_ddraw.hwnd)
{
if (g_ddraw.primary && g_ddraw.primary->palette)
{
ddp_GetEntries(g_ddraw.primary->palette, 0, iStart, cEntries, pPalEntries);
return cEntries - iStart;
}
}
return real_GetSystemPaletteEntries(hdc, iStart, cEntries, pPalEntries);
}
HMODULE WINAPI fake_LoadLibraryA(LPCSTR lpLibFileName)
{
HMODULE hmod_old = GetModuleHandleA(lpLibFileName);