DXGL r871 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r870‎ | r871 | r872 >
Date:20:24, 28 September 2018
Author:admin
Status:new
Tags:
Comment:
Dynamically load UpdateLayeredWindow.
This might make ddraw.dll work on Windows 98 but I have not successfully tested it (OpenGL 2.0 not working on my test system).
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -3890,6 +3890,33 @@
38913891 else return FALSE;
38923892 }
38933893
 3894+static BOOL(WINAPI *__UpdateLayeredWindow)(HWND hWnd, HDC hdcDst, POINT *pptDst, SIZE *psize,
 3895+ HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags) = NULL;
 3896+static BOOL UpdateLayeredWindowFail = FALSE;
 3897+static BOOL WINAPI _UpdateLayeredWindow(HWND hWnd, HDC hdcDst, POINT *pptDst, SIZE *psize,
 3898+ HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags)
 3899+{
 3900+ HANDLE hUser32;
 3901+ if (!__UpdateLayeredWindow)
 3902+ {
 3903+ if (UpdateLayeredWindowFail) return FALSE;
 3904+ hUser32 = GetModuleHandle(_T("user32.dll"));
 3905+ if (!hUser32)
 3906+ {
 3907+ UpdateLayeredWindowFail = TRUE;
 3908+ return FALSE;
 3909+ }
 3910+ __UpdateLayeredWindow = (BOOL(WINAPI*)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD))
 3911+ GetProcAddress((HMODULE)hUser32, "UpdateLayeredWindow");
 3912+ if (!__UpdateLayeredWindow)
 3913+ {
 3914+ UpdateLayeredWindowFail = TRUE;
 3915+ return NULL;
 3916+ }
 3917+ }
 3918+ return __UpdateLayeredWindow(hWnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crKey, pblend, dwFlags);
 3919+}
 3920+
38943921 void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync, BOOL settime)
38953922 {
38963923 int progtype;
@@ -4067,7 +4094,7 @@
40684095 BLENDFUNCTION func = {AC_SRC_OVER,0,255,AC_SRC_ALPHA};
40694096 hPrevObj = SelectObject(This->dib.hdc,This->dib.hbitmap);
40704097 ClientToScreen(This->RenderWnd->GetHWnd(),&dest);
4071 - UpdateLayeredWindow(This->RenderWnd->GetHWnd(),hRenderDC,&dest,&wnd,
 4098+ _UpdateLayeredWindow(This->RenderWnd->GetHWnd(),hRenderDC,&dest,&wnd,
40724099 This->dib.hdc,&srcpoint,0,&func,ULW_ALPHA);
40734100 SelectObject(This->dib.hdc,hPrevObj);
40744101 ReleaseDC(This->RenderWnd->GetHWnd(),hRenderDC);