diff --git a/build/dxwnd.0.ini b/build/dxwnd.0.ini new file mode 100644 index 0000000..be2c649 --- /dev/null +++ b/build/dxwnd.0.ini @@ -0,0 +1,31 @@ +[window] +posx=50 +posy=50 +sizx=320 +sizy=200 +lang=default +;lang=automatic +;updatepaths=1 +;debug=1 +;multiprocesshook=0 +;checkadmin=0 +[texture] +MinTexX=16 +MaxTexX=0 +MinTexY=16 +MaxTexY=0 +[keymapping] +timetoggle=0x72 +altf4=0x73 +timeslow=0x74 +timefast=0x75 +cliptoggle= +refresh= +logtoggle= +plocktoggle= +fpstoggle= +printscreen=0x7B +corner=0x7A +freezetime=0x79 + + diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 3b22216..8100502 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ca8e1fa67ffd8ece8ce4dd729b0eec753da49cad2b29f93f9560f96a1105d18 -size 620544 +oid sha256:61651edf36eea1710fe669de4024922eca627ff0992815cd2b51cce9cadbd82c +size 620032 diff --git a/build/dxwnd.ini b/build/dxwnd.ini deleted file mode 100644 index ce40365..0000000 --- a/build/dxwnd.ini +++ /dev/null @@ -1,176 +0,0 @@ -[window] -exepath=D:\Games\Dark Earth\ -exportpath=D:\DxWnd\exports\ -posx=1087 -posy=286 -sizx=320 -sizy=200 -[target] -title0=Warlords Battlecry 3 (GOG) -path0=D:\Games\Warlords Battlecry 3 (GOG)\Battlecry III.exe -launchpath0= -module0= -opengllib0= -notes0= -registry0= -ver0=0 -coord0=2 -flag0=136314914 -flagg0=1207959568 -flagh0=20 -flagi0=138543108 -flagj0=4224 -flagk0=65536 -flagl0=0 -flagm0=0 -tflag0=0 -posx0=50 -posy0=50 -sizx0=800 -sizy0=600 -maxfps0=0 -initts0=0 -winver0=0 -maxres0=-1 -swapeffect0=0 -maxddinterface0=7 -title1=Galapagos -path1=D:\Games\Galapagos\GALA.EXE -launchpath1= -module1= -opengllib1= -notes1= -registry1= -ver1=7 -coord1=0 -flag1=681623718 -flagg1=1207959556 -flagh1=20 -flagi1=203423748 -flagj1=128 -flagk1=65536 -flagl1=0 -flagm1=0 -tflag1=-2147477245 -posx1=50 -posy1=50 -sizx1=800 -sizy1=600 -maxfps1=0 -initts1=0 -winver1=0 -maxres1=-1 -swapeffect1=0 -maxddinterface1=7 -title2=Warlords Battlecry III -path2=D:\Games\Warlords Battlecry III\Battlecry III.exe -launchpath2= -module2= -opengllib2= -notes2= -registry2= -ver2=0 -coord2=0 -flag2=136314914 -flagg2=1207959568 -flagh2=20 -flagi2=-2009071612 -flagj2=4224 -flagk2=65536 -flagl2=0 -flagm2=0 -tflag2=-2147477245 -posx2=50 -posy2=50 -sizx2=880 -sizy2=660 -maxfps2=0 -initts2=0 -winver2=0 -maxres2=-1 -swapeffect2=0 -maxddinterface2=7 -title3=Close Combat 2: a bridge too far -path3=D:\Games\Close Combat 2\CC2.EXE -launchpath3= -module3= -opengllib3= -notes3= -registry3=[HKEY_LOCAL_MACHINE\SOFTWARE]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat\2.00]\n"PID"="00000-000-0000000-00000"\n"InstalledTo"="C:\\GAMES\\CC2"\n"ScreenX"="800"\n"ScreenY"="600"\n"Version"="2.0"\n"IType"=hex:01,00,00,00\n"GameSpeed"=hex:01,00,00,00\n"ShowDSAlert"=hex:01,00,00,00\n"ShowQuickHelp"=hex:01,00,00,00\n"PlaySounds"=hex:01,00,00,00\n"PlayMusic"=hex:01,00,00,00\n"PlayVideos"=hex:00,00,00,00\n"FCopy"=hex:00,00,00,00\n"SMethod"=hex:00,00,00,00\n"Save"=hex:00,00,00,00\n"ShowTrees"=hex:01,00,00,00\n"StaticFPS"=hex:0a,00,00,00\n"InstalledFrom"=".\\"\n"Launched"="1"\n"VersionType"="RetailVersion"\n\n[HKEY_LOCAL_MACHINE\SOFTWARE]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat\2.00]\n"PID"="00000-000-0000000-00000"\n"InstalledTo"="C:\\GAMES\\CC2"\n"ScreenX"="800"\n"ScreenY"="600"\n"Version"="2.0"\n"IType"=hex:01,00,00,00\n"GameSpeed"=hex:01,00,00,00\n"ShowDSAlert"=hex:01,00,00,00\n"ShowQuickHelp"=hex:01,00,00,00\n"PlaySounds"=hex:01,00,00,00\n"PlayMusic"=hex:01,00,00,00\n"PlayVideos"=hex:00,00,00,00\n"FCopy"=hex:00,00,00,00\n"SMethod"=hex:00,00,00,00\n"Save"=hex:00,00,00,00\n"ShowTrees"=hex:01,00,00,00\n"StaticFPS"=hex:0a,00,00,00\n"InstalledFrom"=".\\"\n"Launched"="1"\n"VersionType"="RetailVersion"\n\n -ver3=0 -coord3=0 -flag3=134225952 -flagg3=1744830464 -flagh3=1044 -flagi3=1279262724 -flagj3=8392832 -flagk3=0 -flagl3=0 -flagm3=0 -tflag3=0 -posx3=50 -posy3=50 -sizx3=0 -sizy3=0 -maxfps3=0 -initts3=0 -winver3=0 -maxres3=-1 -swapeffect3=0 -maxddinterface3=7 -title4=CyberStrike 2 -path4=D:\Games\CyberStrike 2\CS2OG.FUN -launchpath4= -module4= -opengllib4= -notes4= -registry4= -ver4=0 -coord4=0 -flag4=136314978 -flagg4=1476395008 -flagh4=20 -flagi4=136314884 -flagj4=1054848 -flagk4=65536 -flagl4=0 -flagm4=0 -tflag4=-2147477245 -posx4=50 -posy4=50 -sizx4=800 -sizy4=600 -maxfps4=0 -initts4=0 -winver4=0 -maxres4=-1 -swapeffect4=0 -maxddinterface4=7 -title5=Dark Earth -path5=D:\Games\Dark Earth\dkev.exe -launchpath5= -module5= -opengllib5= -notes5= -registry5= -ver5=0 -coord5=0 -flag5=136331362 -flagg5=1476395008 -flagh5=20 -flagi5=138936324 -flagj5=4224 -flagk5=65536 -flagl5=0 -flagm5=0 -tflag5=-2147477245 -posx5=50 -posy5=50 -sizx5=800 -sizy5=600 -maxfps5=0 -initts5=0 -winver5=0 -maxres5=-1 -swapeffect5=0 -maxddinterface5=7 diff --git a/build/dxwnd.reg b/build/dxwnd.reg deleted file mode 100644 index 3b510dd..0000000 --- a/build/dxwnd.reg +++ /dev/null @@ -1,52 +0,0 @@ -[HKEY_LOCAL_MACHINE\SOFTWARE] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat] -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat\2.00] -"PID"="00000-000-0000000-00000" -"InstalledTo"="C:\\GAMES\\CC2" -"ScreenX"="800" -"ScreenY"="600" -"Version"="2.0" -"IType"=hex:01,00,00,00 -"GameSpeed"=hex:01,00,00,00 -"ShowDSAlert"=hex:01,00,00,00 -"ShowQuickHelp"=hex:01,00,00,00 -"PlaySounds"=hex:01,00,00,00 -"PlayMusic"=hex:01,00,00,00 -"PlayVideos"=hex:00,00,00,00 -"FCopy"=hex:00,00,00,00 -"SMethod"=hex:00,00,00,00 -"Save"=hex:00,00,00,00 -"ShowTrees"=hex:01,00,00,00 -"StaticFPS"=hex:0a,00,00,00 -"InstalledFrom"=".\\" -"Launched"="1" -"VersionType"="RetailVersion" - -[HKEY_LOCAL_MACHINE\SOFTWARE] -[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft] -[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games] -[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat] -[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat\2.00] -"PID"="00000-000-0000000-00000" -"InstalledTo"="C:\\GAMES\\CC2" -"ScreenX"="800" -"ScreenY"="600" -"Version"="2.0" -"IType"=hex:01,00,00,00 -"GameSpeed"=hex:01,00,00,00 -"ShowDSAlert"=hex:01,00,00,00 -"ShowQuickHelp"=hex:01,00,00,00 -"PlaySounds"=hex:01,00,00,00 -"PlayMusic"=hex:01,00,00,00 -"PlayVideos"=hex:00,00,00,00 -"FCopy"=hex:00,00,00,00 -"SMethod"=hex:00,00,00,00 -"Save"=hex:00,00,00,00 -"ShowTrees"=hex:01,00,00,00 -"StaticFPS"=hex:0a,00,00,00 -"InstalledFrom"=".\\" -"Launched"="1" -"VersionType"="RetailVersion" - diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index fdad1e6..a65a363 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1030,4 +1030,8 @@ add: syslib shared dc mode preliminary implementation, thank to Narzoul's ideas. fix: handling of cursor hide/show for programs that don't go through the message window ("Deadlock II rel. 1.2") add: /R:n command line option to automatically start DxWnd in icon tray, run the n-th program in configuration and terminate. add: option to disable the disabling of Alt-Tab key through SetWindowHooks through WH_KEYBOARD_LL event. Make it posssible to use Alt-Tab key on "Dungeon Kepper II". -fix: palette object reference count decremented from extra references and zeroed by the "Return 0 refcount" flag: make it possible to run "Dark Earth" that makes a check on the palette reerence counter before starting the game. \ No newline at end of file +fix: palette object reference count decremented from extra references and zeroed by the "Return 0 refcount" flag: make it possible to run "Dark Earth" that makes a check on the palette reerence counter before starting the game. + +v2.03.55 +fix: differentiated handling of blitting from memory to DC vs. from DC vs. memory. The second case is less frequent, but altered the correct rendering of "Battlezone 1998 edition", now working both in scaled, emulated DC shared DC and shared ddraw and GDI DC. The fix impacts both BitBlt and ScaledBlt GDI calls. +fix: prevented InvalidateRect to return giving a scaled rect. Fixes "Deadlock 2"partial screen updates. \ No newline at end of file diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index bfd77f2..4347e8c 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -711,6 +711,19 @@ void dxwCore::UnmapClient(int *nXDest, int *nYDest) if(h) *nYDest = ((*nYDest * (int)dwScreenHeight) + (h >> 1)) / h; } +void dxwCore::UnmapClient(int *nXDest, int *nYDest, int *nWidth, int *nHeight) +{ + RECT client; + int w, h; + if(!(*pGetClientRect)(hWnd, &client)) return; + w = client.right ? client.right : iSizX; + h = client.bottom ? client.bottom : iSizY; + if(w) *nXDest = ((*nXDest * (int)dwScreenWidth) + (w >> 1)) / w; + if(h) *nYDest = ((*nYDest * (int)dwScreenHeight) + (h >> 1)) / h; + if(w) *nWidth = ((*nWidth * (int)dwScreenWidth) + (w >> 1)) / w; + if(h) *nHeight = ((*nHeight * (int)dwScreenHeight) + (h >> 1)) / h; +} + void dxwCore::UnmapClient(LPRECT lpRect) { RECT client; diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index 611be01..6ad431c 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -73,6 +73,7 @@ public: // methods //void MapClient(float *, float *); void UnmapClient(LPPOINT); void UnmapClient(int *, int *); + void UnmapClient(int *, int *, int *, int *); void UnmapClient(LPRECT); void MapWindow(LPPOINT); void MapWindow(LPRECT); diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index ffd5170..6813106 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . #include "TlHelp32.h" -#define VERSION "2.03.54.fix2" +#define VERSION "2.03.55" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index bcb2651..e4af9b6 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp index 22e6134..5873240 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -221,7 +221,8 @@ static HookEntry_Type SyscallHooks[]={ {HOOK_IAT_CANDIDATE, "DeleteDC", (FARPROC)DeleteDC, (FARPROC *)&pGDIDeleteDC, (FARPROC)extGDIDeleteDC}, // for tracing only! {HOOK_IAT_CANDIDATE, "CreateDCA", (FARPROC)CreateDCA, (FARPROC *)&pGDICreateDCA, (FARPROC)extGDICreateDCA}, {HOOK_IAT_CANDIDATE, "CreateDCW", (FARPROC)CreateDCW, (FARPROC *)&pGDICreateDCW, (FARPROC)extGDICreateDCW}, - // CreateDCW ..... {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator + // CreateDCW ..... + {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator }; static HookEntry_Type ScaledHooks[]={ @@ -994,7 +995,16 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH case GDIMODE_STRETCHED: nWDest= nWidth; nHDest= nHeight; - if (IsToScreen && !IsFromScreen) dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + switch(Flux){ + case 1: // memory to screen + dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + break; + case 2: // screen to memory + dxw.MapClient(&nXSrc, &nYSrc, &nWidth, &nHeight); + break; + default: + break; + } res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); OutTraceB("GDI.BitBlt: DEBUG DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); break; @@ -1081,7 +1091,16 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in int nWDest, nHDest; nWDest= nWidth; nHDest= nHeight; - dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + switch(Flux){ + case 1: // memory to screen + dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + break; + case 2: // screen to memory + dxw.MapClient(&nXSrc, &nYSrc, &nWidth, &nHeight); + break; + default: + break; + } res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop); OutTraceB("GDI.StretchBlt: DEBUG DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); } diff --git a/dll/shareddc.cpp b/dll/shareddc.cpp index eb40911..29a9b33 100644 --- a/dll/shareddc.cpp +++ b/dll/shareddc.cpp @@ -61,85 +61,40 @@ HDC dxwSDC::GetPrimaryDC(HDC hdc) extern void *lpD3DActiveDevice; OutTraceB("dxwSDC::GetPrimaryDC: hdc=%x\n", hdc); -#ifdef D3D9TRY - if(lpD3DActiveDevice){ - // search for D3D first - //RECT client; - //(*pGetClientRect)(dxw.GethWnd(), &client); - //if(pDestSurface == NULL){ - // //res=((IDirect3DDevice9 *)lpD3DActiveDevice)->CreateOffscreenPlainSurface(ScreenWidth, ScreenHeight, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, &pDestSurface, NULL); - // //res=((IDirect3DDevice9 *)lpD3DActiveDevice)->CreateOffscreenPlainSurface(dxw.GetScreenWidth(), dxw.GetScreenHeight(), D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, &pDestSurface, NULL); - // res=((IDirect3DDevice9 *)lpD3DActiveDevice)->CreateOffscreenPlainSurface(client.right, client.bottom, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, &pDestSurface, NULL); - // if(res){ - // OutTraceE("dxwSDC::CreateOffscreenPlainSurface: ERROR err=%x(%s) at=%d\n", res, ExplainDDError(res), __LINE__); - // return NULL; - // _Warn("CreateOffscreenPlainSurface ERROR"); - // } - //} - //res=((IDirect3DDevice9 *)lpD3DActiveDevice)->GetFrontBufferData(1, pDestSurface); - //if(res){ - // OutTraceE("GetFrontBufferData: ERROR err=%x(%s) at=%d\n", res, ExplainDDError(res), __LINE__); - // _Warn("GetFrontBufferData ERROR"); - //} - IDirect3DSurface9 *pRenderSurface; - res=((IDirect3DDevice9 *)lpD3DActiveDevice)->GetRenderTarget(0, &pRenderSurface); - if(res){ - OutTraceE("d3d9::GetRenderTarget: ERROR err=%x(%s) at=%d\n", res, ExplainDDError(res), __LINE__); - _Warn("d3d9::GetRenderTarget ERROR"); + + // look for ddraw first + //if(pReleaseDDThreadLock)(*pReleaseDDThreadLock)(); + lpDDSPrimary = dxwss.GetPrimarySurface(); + if (lpDDSPrimary) { + if(pReleaseDDThreadLock)(*pReleaseDDThreadLock)(); + res=((*pGetDC)(lpDDSPrimary, &PrimaryDC)); + while((PrimaryDC == NULL) && lpDDSPrimary) { + OutTraceB("dxwSDC::GetPrimaryDC: found primary surface with no DC, unref lpdds=%x\n", lpDDSPrimary); + dxwss.UnrefSurface(lpDDSPrimary); + lpDDSPrimary = dxwss.GetPrimarySurface(); + if (lpDDSPrimary) (*pGetDC)(lpDDSPrimary, &PrimaryDC); } - //res=((IDirect3DDevice9 *)lpD3DActiveDevice)->GetRenderTargetData(pRenderSurface, pDestSurface); - //if(res){ - // OutTraceE("d3d9::GetRenderTargetData: ERROR err=%x(%s) at=%d\n", res, ExplainDDError(res), __LINE__); - // _Warn("d3d9::GetRenderTargetData ERROR"); - //} - //res=pDestSurface->GetDC(&PrimaryDC); - res=pRenderSurface->GetDC(&PrimaryDC); - if(res){ - OutTraceE("d3d9::GetDC: ERROR err=%x(%s) at=%d\n", res, ExplainDDError(res), __LINE__); - //_Warn("d3d9::GetDC ERROR"); - VirtualSurfaceType = VIRTUAL_ON_D3D; + if (!PrimaryDC) { + _Warn("No primary DC"); + OutTraceB("dxwSDC::GetPrimaryDC: no ddraw primary DC\n"); return NULL; } - VirtualSurfaceType = VIRTUAL_ON_D3D; + // avoid double Getdc on same hdc and lock + // if(PrimaryDC == hdc) (*pReleaseDC)(lpDDSPrimary, PrimaryDC); + OutTraceB("dxwSDC::GetPrimaryDC: ddraw PrimaryDC=%x\n", PrimaryDC); + VirtualSurfaceType = VIRTUAL_ON_DDRAW; } else { -#else - { -#endif - // else look for ddraw - //if(pReleaseDDThreadLock)(*pReleaseDDThreadLock)(); - lpDDSPrimary = dxwss.GetPrimarySurface(); - if (lpDDSPrimary) { - if(pReleaseDDThreadLock)(*pReleaseDDThreadLock)(); - res=((*pGetDC)(lpDDSPrimary, &PrimaryDC)); - while((PrimaryDC == NULL) && lpDDSPrimary) { - OutTraceB("dxwSDC::GetPrimaryDC: found primary surface with no DC, unref lpdds=%x\n", lpDDSPrimary); - dxwss.UnrefSurface(lpDDSPrimary); - lpDDSPrimary = dxwss.GetPrimarySurface(); - if (lpDDSPrimary) (*pGetDC)(lpDDSPrimary, &PrimaryDC); - } - if (!PrimaryDC) { - _Warn("No primary DC"); - OutTraceB("dxwSDC::GetPrimaryDC: no ddraw primary DC\n"); - return NULL; - } - // avoid double Getdc on same hdc and lock - // if(PrimaryDC == hdc) (*pReleaseDC)(lpDDSPrimary, PrimaryDC); - OutTraceB("dxwSDC::GetPrimaryDC: ddraw PrimaryDC=%x\n", PrimaryDC); - VirtualSurfaceType = VIRTUAL_ON_DDRAW; + // finally, search GDI DC + PrimaryDC = (*pGDIGetDC)(dxw.GethWnd()); + if (!PrimaryDC) { + _Warn("No window DC"); + OutTraceB("dxwSDC::GetPrimaryDC: no windows DC\n"); + return NULL; } - else { - // finally, search GDI DC - PrimaryDC = (*pGDIGetDC)(dxw.GethWnd()); - if (!PrimaryDC) { - _Warn("No window DC"); - OutTraceB("dxwSDC::GetPrimaryDC: no windows DC\n"); - return NULL; - } - OutTraceB("dxwSDC::GetPrimaryDC: gdi PrimaryDC=%x\n", PrimaryDC); - VirtualSurfaceType = VIRTUAL_ON_WINDOW; - } - } + OutTraceB("dxwSDC::GetPrimaryDC: gdi PrimaryDC=%x\n", PrimaryDC); + VirtualSurfaceType = VIRTUAL_ON_WINDOW; + } // whenever the hdc changes, rebuild the virtual DC if(hdc != LastHDC) do { @@ -208,11 +163,27 @@ HDC dxwSDC::GetPrimaryDC(HDC hdc) } if(PrimaryDC){ - if(!(*pGDIBitBlt)(VirtualHDC, 0, 0, ScreenWidth, ScreenHeight, PrimaryDC, VirtualOffset.x, VirtualOffset.y, SRCCOPY)){ - OutTraceE("dxwSDC::GetPrimaryDC: StretchBlt ERROR err=%d at=%d\n", GetLastError(), __LINE__); - _Warn("StretchBlt ERROR"); + switch(VirtualSurfaceType){ + case VIRTUAL_ON_DDRAW: + if(!(*pGDIBitBlt)(VirtualHDC, 0, 0, ScreenWidth, ScreenHeight, PrimaryDC, VirtualOffset.x, VirtualOffset.y, SRCCOPY)){ + OutTraceE("dxwSDC::GetPrimaryDC: StretchBlt ERROR err=%d at=%d\n", GetLastError(), __LINE__); + _Warn("StretchBlt ERROR"); + } + OutTraceB("dxwSDC::GetPrimaryDC: fill=(0,0)-(%dx%d) from=(%d,%d)\n", ScreenWidth, ScreenHeight, VirtualOffset.x, VirtualOffset.y); + break; + case VIRTUAL_ON_WINDOW: + int w, h; + dxw.MapClient(&VirtualOffset); + w = ScreenWidth; + h = ScreenHeight; + dxw.MapClient(&w, &h); + if(!(*pGDIStretchBlt)(VirtualHDC, 0, 0, ScreenWidth, ScreenHeight, PrimaryDC, VirtualOffset.x, VirtualOffset.y, w, h, SRCCOPY)){ + OutTraceE("dxwSDC::GetPrimaryDC: StretchBlt ERROR err=%d at=%d\n", GetLastError(), __LINE__); + _Warn("StretchBlt ERROR"); + } + OutTraceB("dxwSDC::GetPrimaryDC: fill=(0,0)-(%dx%d) from=(%d,%d)-(%dx%d)\n", ScreenWidth, ScreenHeight, VirtualOffset.x, VirtualOffset.y, w, h); + break; } - OutTraceB("dxwSDC::GetPrimaryDC: fill=(0,0)-(%d,%d) from=(%d,%d)\n", ScreenWidth, ScreenHeight, VirtualOffset.x, VirtualOffset.y); } POINT origin = {}; @@ -274,18 +245,6 @@ BOOL dxwSDC::PutPrimaryDC(HDC hdc, BOOL UpdateScreen, int XDest, int YDest, int if(UpdateScreen){ switch(VirtualSurfaceType){ -#ifdef D3D9TRY - case VIRTUAL_ON_D3D: - RECT client; - SetStretchBltMode(PrimaryDC, HALFTONE); - (*pGetClientRect)(dxw.GethWnd(), &client); - if(PrimaryDC) ret=(*pGDIStretchBlt)(PrimaryDC, 0, 0, client.right, client.bottom, VirtualHDC, 0, 0, dxw.GetScreenWidth(), dxw.GetScreenHeight(), SRCCOPY); - ret=(*pGDIReleaseDC)(dxw.GethWnd(), PrimaryDC); - //ret=(*pGDIReleaseDC)(dxw.GethWnd(), PrimaryDC); - if(!ret) OutTrace("dxwSDC::PutPrimaryDC: ReleaseDC ERROR err=%d\n", GetLastError()); - //pDestSurface->Release(); - break; -#endif case VIRTUAL_ON_DDRAW: ret=(*pGDIBitBlt)(PrimaryDC, XDest+VirtualOffset.x, YDest+VirtualOffset.y, nDestWidth, nDestHeight, VirtualHDC, XDest, YDest, SRCCOPY); if(!ret || (ret==GDI_ERROR)) { @@ -409,6 +368,7 @@ static BOOL CALLBACK excludeClipRectsForOverlappingWindows(HWND hwnd, LPARAM lPa void dxwSDC::setClippingRegion(HDC compatDc, HDC origDc, POINT& origin) { +#if 0 OutTrace("dxwSDC::setClippingRegion: compdc=%x origdc=%x origin=(%d,%d)\n", compatDc, origDc, origin.x, origin.y); HRGN clipRgn = CreateRectRgn(0, 0, 0, 0); const bool isEmptyClipRgn = (1 != GetRandomRgn(origDc, clipRgn, SYSRGN)); @@ -444,13 +404,14 @@ void dxwSDC::setClippingRegion(HDC compatDc, HDC origDc, POINT& origin) } } DeleteObject(origClipRgn); +#endif - return; +#if 0 // to finish ..... // on Win10 this part seems unnecessary and giving troubles ..... //dxw.MapClient(&origin); - if (!isEmptyClipRgn) - { + //if (!isEmptyClipRgn) + if(1){ HWND hwnd = WindowFromDC(origDc); if (hwnd) { @@ -458,4 +419,5 @@ void dxwSDC::setClippingRegion(HDC compatDc, HDC origDc, POINT& origin) EnumWindows(&excludeClipRectsForOverlappingWindows,(LPARAM)(&excludeClipRectsData)); } } +#endif } diff --git a/dll/user32.cpp b/dll/user32.cpp index 425ce1b..528c29b 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -639,12 +639,19 @@ BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase) OutTrace("InvalidateRect: hwnd=%x rect=%s erase=%x\n", hwnd, sRect, bErase); } + RECT ScaledRect; if(dxw.IsFullScreen()) { switch(dxw.GDIEmulationMode){ case GDIMODE_STRETCHED: case GDIMODE_SHAREDDC: case GDIMODE_EMULATED: - if(lpRect) dxw.MapClient(lpRect); + if(lpRect) { + // v2.03.55: the lpRect area must NOT be altered by the call + // effect visible in partial updates of Deadlock 2 main menu buttons + ScaledRect = *lpRect; + dxw.MapClient(&ScaledRect); + lpRect = &ScaledRect; + } break; default: break;