diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 5880555..f2f5a61 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -128,6 +128,7 @@ #define LIMITSCREENRES 0x00001000 // Limit available screen resolution up to defined maximum #define NOFILLRECT 0x00002000 // Suppress FillRect calls #define HOOKGLIDE 0x00004000 // Hook glide calls +#define HIDEDESKTOP 0x00004000 // Hide desktop background // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 60a2783..aa1c284 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f5ca6f4d3ce49c5e35b6ced416a8e48d7948813d8994ff1fefcb656817359bb8 -size 448512 +oid sha256:204b88153c343d4bd1b32eadbb4f2c0267ad6f3147cf813cf591084e27893061 +size 450048 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index c754c5b..304b212 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b5fbb1db51dc2da5ddf88d048bb24471391cc9f1ff80e96a27c916198cc6f4b +oid sha256:a63a5100db9d65c9b66846c79b6cb41578fccabd9de5bb4ba788b371bb72b25f size 535040 diff --git a/build/exports/Blade Runner.dxw b/build/exports/Blade Runner.dxw new file mode 100644 index 0000000..3d7b5b0 --- /dev/null +++ b/build/exports/Blade Runner.dxw @@ -0,0 +1,26 @@ +[target] +title0=Blade Runner +path0=D:\Games\blade runner\BLADE.EXE +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134234210 +flagg0=1480589320 +flagh0=2580 +flagi0=16388 +tflag0=6211 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index a44714c..b50554f 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -376,4 +376,5 @@ eliminated "Disable HAL support", no longer necessary some incomplete work on gdi game handling added preliminary, incomplete (not working) glide handling - +v2.02.54 +added "Hide desktop background" video option diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 5d91f1c..51bc0fa 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -93,6 +93,7 @@ HRESULT WINAPI extUnlockDir4(LPDIRECTDRAWSURFACE, LPRECT); HRESULT WINAPI extUnlockDir1(LPDIRECTDRAWSURFACE, LPVOID); HRESULT WINAPI extCreateSurface(int, CreateSurface_Type, LPDIRECTDRAW, DDSURFACEDESC2 *, LPDIRECTDRAWSURFACE *, void *); +HRESULT WINAPI extSetSurfaceDesc(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, DWORD); // DirectDrawClipper HRESULT WINAPI extReleaseC(LPDIRECTDRAWCLIPPER); @@ -202,6 +203,7 @@ Unlock4_Type pUnlock4; UpdateOverlay_Type pUpdateOverlay; UpdateOverlayDisplay_Type pUpdateOverlayDisplay; UpdateOverlayZOrder_Type pUpdateOverlayZOrder; +SetSurfaceDesc_Type pSetSurfaceDesc; /* DirectDrawClipper hook pointers */ QueryInterface_Type pQueryInterfaceC; @@ -1219,6 +1221,9 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) SetHook((void *)(**(DWORD **)lplpdds + 128), extUnlockDir4, (void **)&pUnlock4, "Unlock(S4)"); } + if (dxversion == 7) + SetHook((void *)(**(DWORD **)lplpdds + 156), extSetSurfaceDesc, (void **)&pSetSurfaceDesc, "SetSurfaceDesc(S3)"); + if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; // just proxed .... @@ -4487,7 +4492,7 @@ HRESULT WINAPI extDDGetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDG OutTraceDDRAW("GetAvailableVidMem(D): lpdd=%x\n", lpdd); res=(*pGetAvailableVidMem)(lpdd, lpDDSCaps, lpdwTotal, lpdwFree); if(res){ - OutTraceDW("GetAvailableVidMem(D): ERROR res=%x(%s)\n", res, ExplainDDError(res)); + OutTraceE("GetAvailableVidMem(D): ERROR res=%x(%s)\n", res, ExplainDDError(res)); } else { OutTraceDW("GetAvailableVidMem(D): DDSCaps=%x(%s) Total=%x Free=%x\n", @@ -4526,3 +4531,12 @@ HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LP { return extGetAvailableVidMem(lpdd, lpDDSCaps, lpdwTotal, lpdwFree, pGetAvailableVidMem4); } + +HRESULT WINAPI extSetSurfaceDesc(LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpDDsd2, DWORD dwFlags) +{ + HRESULT res; + OutTrace("SetSurfaceDesc: REACHED\n"); + res = (*pSetSurfaceDesc)(lpdds, lpDDsd2, dwFlags); + OutTraceE("SetSurfaceDesc: ERROR res=%x(%s)\n", res, ExplainDDError(res)); + return res; +} diff --git a/dll/dwhide.cpp b/dll/dwhide.cpp new file mode 100644 index 0000000..ab1c522 --- /dev/null +++ b/dll/dwhide.cpp @@ -0,0 +1,123 @@ +#define _CRT_SECURE_NO_WARNINGS + +#include +#include "dxwnd.h" +#include "dxwcore.hpp" + +static bool quit = false; + +static LRESULT CALLBACK Hider_Message_Handler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam) +{ + switch(umsg) + { + case WM_DESTROY: + PostQuitMessage(0); + break; + case WM_CLOSE: + quit = true; + break; + } + + return DefWindowProc(hwnd, umsg, wparam, lparam); +} + +void dxwCore::HideDesktop(HWND hwnd) +{ + static BOOL DoOnce=TRUE; + static ATOM aClass; + static HWND wleft=0, wright=0, wtop=0, wbottom=0; + RECT wRect, wDesktop; + static HINSTANCE hinst=NULL; + if(DoOnce){ + WNDCLASSEX WndClsEx; + DoOnce=FALSE; + +#ifdef DISABLEAERODESKTOP + typedef HRESULT (WINAPI *DwmEnableComposition_Type)(UINT); + DwmEnableComposition_Type pDwmEnableComposition; + HMODULE hlib; + + // try to disable AERO desktop interface, if possible ... + pDwmEnableComposition = NULL; + hlib=(*pLoadLibraryA)("dwmapi.dll"); + if(hlib){ + pDwmEnableComposition = (DwmEnableComposition_Type)(*pGetProcAddress)(hlib, "DwmEnableComposition"); + } + if(pDwmEnableComposition) { + (*pDwmEnableComposition)(FALSE); + } +#endif + + hinst=GetModuleHandle(NULL); + if(!hinst) + OutTrace("GetModuleHandle ERROR err=%d\n", GetLastError()); + else + OutTrace("GetModuleHandle hinst=%x\n", hinst); + + WndClsEx.cbSize = sizeof(WNDCLASSEX); + WndClsEx.style = 0; + WndClsEx.lpfnWndProc = Hider_Message_Handler; //DefWindowProc; + WndClsEx.cbClsExtra = 0; + WndClsEx.cbWndExtra = 0; + WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION); + //WndClsEx.hCursor = LoadCursor(NULL, IDC_CROSS); + WndClsEx.hCursor = NULL; + WndClsEx.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + //WndClsEx.hbrBackground = CreateSolidBrush(RGB(200,0,0)); + WndClsEx.lpszMenuName = NULL; + WndClsEx.lpszClassName = "dxwnd:hider"; + WndClsEx.hInstance = hinst; + WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + + // Register the application + aClass=RegisterClassEx(&WndClsEx); + if(!aClass) OutTraceE("RegisterClassEx: ERROR err=%d\n", GetLastError()); + } + + if(!(*pGetWindowRect)(hwnd, &wRect)) { + OutTrace("GetWindowRect ERROR hwnd=%x err=%d\n", hWnd, GetLastError()); + return; + } + if(!(*pGetWindowRect)((*pGetDesktopWindow)(), &wDesktop)) { + OutTrace("GetWindowRect ERROR hwnd=%x err=%d\n", NULL, GetLastError()); + return; + } + + // this is tricky: if you create a window with zero style, the manager seems to apply a default + // overlapped window style. The only way I got to be sure that the style is exactly nothing + // at all is to repeat the command by a SetWindowLong(hwnd, GWL_STYLE, 0) that sets again zero + // as the correct window style. + + HWND hParent = (*pGetDesktopWindow)(); + if(!wleft) { + wleft=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL); + (*pSetWindowLong)(wleft, GWL_STYLE, 0); + } + if(!wright) { + wright=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL); + (*pSetWindowLong)(wright, GWL_STYLE, 0); + } + if(!wtop) { + wtop=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL); + (*pSetWindowLong)(wtop, GWL_STYLE, 0); + } + if(!wbottom) { + wbottom=(*pCreateWindowExA)(0, "dxwnd:hider", "hider", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL); + (*pSetWindowLong)(wbottom, GWL_STYLE, 0); + } + + (*pMoveWindow)(wleft, wDesktop.left, wDesktop.top, wRect.left, wDesktop.bottom, TRUE); + (*pMoveWindow)(wright, wRect.right, wDesktop.top, wDesktop.right-wRect.right, wDesktop.bottom, TRUE); + (*pMoveWindow)(wtop, wDesktop.left, wDesktop.top, wDesktop.right, wRect.top-wDesktop.top, TRUE); + (*pMoveWindow)(wbottom, wDesktop.left, wRect.bottom, wDesktop.right, wDesktop.bottom-wRect.bottom, TRUE); + + (*pSetWindowLong)(wleft, GWL_EXSTYLE, WS_EX_TOPMOST); + (*pSetWindowLong)(wright, GWL_EXSTYLE, WS_EX_TOPMOST); + (*pSetWindowLong)(wtop, GWL_EXSTYLE, WS_EX_TOPMOST); + (*pSetWindowLong)(wbottom, GWL_EXSTYLE, WS_EX_TOPMOST); + + (*pShowWindow)(wleft, SW_SHOW); + (*pShowWindow)(wright, SW_SHOW); + (*pShowWindow)(wtop, SW_SHOW); + (*pShowWindow)(wbottom, SW_SHOW); +} diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 42b83eb..ed7df5f 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -545,6 +545,7 @@ void AdjustWindowPos(HWND hwnd, DWORD width, DWORD height) if(dxw.dwFlags2 & SUPPRESSIME) SuppressIMEWindow(); dxw.ShowBanner(hwnd); + if(dxw.dwFlags4 & HIDEDESKTOP) dxw.HideDesktop(dxw.GethWnd()); return; } @@ -917,10 +918,11 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp dxw.dwFlags1 |= LOCKWINPOS; dx_UpdatePositionLock(hwnd); } - if (dxw.dwFlags1 & HIDEHWCURSOR) while((*pShowCursor)(0) >= 0); - if (dxw.dwFlags2 & SHOWHWCURSOR) while((*pShowCursor)(1) < 0); + if(dxw.dwFlags1 & HIDEHWCURSOR) while((*pShowCursor)(0) >= 0); + if(dxw.dwFlags2 & SHOWHWCURSOR) while((*pShowCursor)(1) < 0); if(dxw.dwFlags1 & ENABLECLIPPING) extClipCursor(lpClipRegion); if(dxw.dwFlags2 & REFRESHONRESIZE) dxw.ScreenRefresh(); + if(dxw.dwFlags4 & HIDEDESKTOP) dxw.HideDesktop(dxw.GethWnd()); break; case WM_ACTIVATE: dxw.bActive = (LOWORD(wparam) == WA_ACTIVE || LOWORD(wparam) == WA_CLICKACTIVE) ? 1 : 0; diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index c0cde6e..b995bda 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -94,6 +94,7 @@ public: // methods char *GetTSCaption(int); void DoSlow(int); void ShowBanner(HWND); + void HideDesktop(HWND); POINT ScreenToClient(POINT); int GetDLLIndex(char *); void FixStyle(char *, HWND, WPARAM, LPARAM); diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index f7236da..9516796 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . #include "dxwnd.h" #include "dxwcore.hpp" -#define VERSION "2.02.54" +#define VERSION "2.02.55" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.suo b/dll/dxwnd.suo new file mode 100644 index 0000000..a6ba136 Binary files /dev/null and b/dll/dxwnd.suo differ diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 20e9ab0..cece195 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/dxwnd.vs2008.vcproj b/dll/dxwnd.vs2008.vcproj index 9275997..9a558d4 100644 --- a/dll/dxwnd.vs2008.vcproj +++ b/dll/dxwnd.vs2008.vcproj @@ -264,6 +264,10 @@ /> + + diff --git a/dll/hddraw.h b/dll/hddraw.h index cbc2789..177adf2 100644 --- a/dll/hddraw.h +++ b/dll/hddraw.h @@ -95,6 +95,8 @@ typedef HRESULT (WINAPI *Unlock4_Type)(LPDIRECTDRAWSURFACE, LPRECT); typedef HRESULT (WINAPI *UpdateOverlay_Type)(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDOVERLAYFX); typedef HRESULT (WINAPI *UpdateOverlayDisplay_Type) (LPDIRECTDRAWSURFACE, DWORD); typedef HRESULT (WINAPI *UpdateOverlayZOrder_Type)(LPDIRECTDRAWSURFACE, DWORD, LPDIRECTDRAWSURFACE); +typedef HRESULT (WINAPI *SetSurfaceDesc_Type)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, DWORD); + // DirectDrawClipper typedef HRESULT (WINAPI *AddRefC_Type)(LPDIRECTDRAWCLIPPER); typedef HRESULT (WINAPI *ReleaseC_Type)(LPDIRECTDRAWCLIPPER); diff --git a/dll/user32.cpp b/dll/user32.cpp index 74368b6..a824a69 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -504,7 +504,7 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) nCmdShow=SW_SHOWNORMAL; } } -} + } res=(*pShowWindow)(hwnd, nCmdShow); diff --git a/host/Resource.h b/host/Resource.h index ff9b4e0..34d2ea9 100644 --- a/host/Resource.h +++ b/host/Resource.h @@ -202,6 +202,7 @@ #define IDC_ADDPROXYLIBS 1160 #define IDC_INTERCEPTRDTSC 1161 #define IDC_NOFILLRECT 1162 +#define IDC_HIDEDESKTOP 1163 #define ID_MODIFY 32771 #define ID_DELETE 32772 #define ID_ADD 32773 diff --git a/host/TabWindow.cpp b/host/TabWindow.cpp index be75b33..82c80bd 100644 --- a/host/TabWindow.cpp +++ b/host/TabWindow.cpp @@ -44,6 +44,7 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame); DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove); DDX_Check(pDX, IDC_SUPPRESSCHILD, cTarget->m_SuppressChild); + DDX_Check(pDX, IDC_HIDEDESKTOP, cTarget->m_HideDesktop); // color management DDX_Check(pDX, IDC_INIT8BPP, cTarget->m_Init8BPP); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index fa756e7..c8e68ff 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -46,6 +46,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_NoAlphaChannel = FALSE; m_FixRefCounter = TRUE; m_SuppressChild = FALSE; + m_HideDesktop = FALSE; m_LockSysColors = FALSE; m_ForceYUVtoRGB = FALSE; m_ForceRGBtoYUV = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 143a3c3..842dc7a 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -137,6 +137,7 @@ public: BOOL m_NoAlphaChannel; BOOL m_FixRefCounter; BOOL m_SuppressChild; + BOOL m_HideDesktop; BOOL m_LockSysColors; BOOL m_SaveCaps; BOOL m_SingleProcAffinity; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index afe5f30..09fb942 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index e96686a..7412695 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -437,6 +437,7 @@ BEGIN GROUPBOX "Screen resolution",IDC_STATIC,149,123,144,64 CONTROL "Limit resolution:",IDC_LIMITSCREENRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,136,63,10 LISTBOX IDC_LISTRES,226,133,57,26,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + CONTROL "Hide desktop background",IDC_HIDEDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,184,125,10 END IDD_TAB_EMPTY DIALOGEX 0, 0, 300, 240 diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index d9d99e6..a5e1d6a 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index cef2529..753877e 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -177,6 +177,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_NoAlphaChannel) t->flags4 |= NOALPHACHANNEL; if(dlg->m_FixRefCounter) t->flags4 |= FIXREFCOUNTER; if(dlg->m_SuppressChild) t->flags4 |= SUPPRESSCHILD; + if(dlg->m_HideDesktop) t->flags4 |= HIDEDESKTOP; if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS; if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB; if(dlg->m_ForceRGBtoYUV) t->flags3 |= RGB2YUV; @@ -319,6 +320,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_NoAlphaChannel = t->flags4 & NOALPHACHANNEL ? 1 : 0; dlg->m_FixRefCounter = t->flags4 & FIXREFCOUNTER ? 1 : 0; dlg->m_SuppressChild = t->flags4 & SUPPRESSCHILD ? 1 : 0; + dlg->m_HideDesktop = t->flags4 & HIDEDESKTOP ? 1 : 0; dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0; dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0; dlg->m_ForceYUVtoRGB = t->flags3 & YUV2RGB ? 1 : 0;