diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 8bf3e55..e825a0e 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -130,6 +130,7 @@ #define HOOKGLIDE 0x00004000 // Hook glide calls #define HIDEDESKTOP 0x00008000 // Hide desktop background #define STRETCHTIMERS 0x00010000 // Enables timers stretching when TIMESTRETCH is on +#define NOFLIPEMULATION 0x00020000 // Compensate the effect of Flip-ping through Blt operations // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/dxwnd.dll b/build/dxwnd.dll index e037b01..1356ba6 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f6f6dffdd6c64dfb4fca9318b394132c66ec7a1070122c384b78e0a8a52c45e2 -size 461824 +oid sha256:c6bba6804bdeb0de0f1ff7e02150e77f737c1f1bcbab40e6b192d48a7ab00451 +size 462848 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 9b2e702..455ed96 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84004748b9ed3c04e7d2d8101220a505a229bc299211e587a74ffd89cc85e154 +oid sha256:9eab6b03785ebc8bf84e56c3a16897517ad0b7b5f77bdba87630c6157b63dba6 size 535552 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index 0ee1d17..6b38169 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -3680,19 +3680,19 @@ module147= opengllib147= ver147=0 coord147=0 -flag147=134235680 -flagg147=1207959560 +flag147=134234656 +flagg147=1207959552 flagh147=67108884 -flagi147=4 -tflag147=6419 +flagi147=131076 +tflag147=0 initx147=0 inity147=0 minx147=0 miny147=0 maxx147=0 maxy147=0 -posx147=0 -posy147=0 +posx147=50 +posy147=50 sizx147=800 sizy147=600 maxfps147=0 diff --git a/build/exports/Gruntz.dxw b/build/exports/Gruntz.dxw new file mode 100644 index 0000000..2148a0f --- /dev/null +++ b/build/exports/Gruntz.dxw @@ -0,0 +1,26 @@ +[target] +title0=Gruntz +path0=D:\Games\gruntz\GRUNTZ.EXE +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134234656 +flagg0=1207959552 +flagh0=67108884 +flagi0=131076 +tflag0=0 +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 4c8e459..3511506 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -405,3 +405,5 @@ fixed time stretching to handle Total Soccer 2000 fixed ZBUFFER surface creation to handle GOG Incoming troubles on some cards fixed handling of special effects (wireframe, no fogging, zbuffer always) to be valid on all d3d versions +v2.02.61 +added directx "Compensate Flip emulation" flag: used primarily to get rid of mouse artifacts due to emulated Flip rpocedure in windowed mode. Fixes Gruntz issues and some other games... \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 18fdd56..6109910 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -741,6 +741,22 @@ CreateSurface2_Type pCreateSurfaceMethod(LPDIRECTDRAWSURFACE lpdds) return (CreateSurface2_Type)pCreateSurface1; } +GetSurfaceDesc2_Type pGetSurfaceDescMethod(LPDIRECTDRAWSURFACE lpdds) +{ + char sMsg[81]; + void * extUnlock; + extUnlock=(void *)*(DWORD *)(*(DWORD *)lpdds + 128); + if(extUnlock==(void *)extUnlock1) return (GetSurfaceDesc2_Type)pGetSurfaceDesc1; + if(extUnlock==(void *)extUnlock4) return pGetSurfaceDesc7 ? pGetSurfaceDesc7 : pGetSurfaceDesc4; + if(extUnlock==(void *)extUnlockDir1) return (GetSurfaceDesc2_Type)pGetSurfaceDesc1; + if(extUnlock==(void *)extUnlockDir4) return pGetSurfaceDesc7 ? pGetSurfaceDesc7 : pGetSurfaceDesc4; + sprintf_s(sMsg, 80, "pGetSurfaceDescMethod: pUnlock(%x) can't match %x\n", lpdds, extUnlock); + OutTraceDW(sMsg); + if (IsAssertEnabled) MessageBox(0, sMsg, "pGetSurfaceDescMethod", MB_OK | MB_ICONEXCLAMATION); + if (pGetSurfaceDesc4) return pGetSurfaceDesc4; + return (GetSurfaceDesc2_Type)pGetSurfaceDesc1; +} + int SurfaceDescrSize(LPDIRECTDRAWSURFACE lpdds) { char sMsg[81]; @@ -3191,6 +3207,8 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, { BOOL IsPrim; HRESULT res; + DDSURFACEDESC2 ddsd; + LPDIRECTDRAWSURFACE lpddsTmp; IsPrim=dxw.IsAPrimarySurface(lpdds); OutTraceDDRAW("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n", @@ -3198,7 +3216,6 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, if (!IsPrim){ if(lpddssrc){ - //return 0; res=(*pFlip)(lpdds, lpddssrc, dwflags); } else{ @@ -3234,6 +3251,20 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpPrimaryDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0); + if(dxw.dwFlags4 & NOFLIPEMULATION){ + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = SurfaceDescrSize(lpdds); + //if(pGetSurfaceDesc1) (*pGetSurfaceDesc1)(lpDDSBack, (LPDDSURFACEDESC)&ddsd); + (*pGetSurfaceDescMethod(lpdds))((LPDIRECTDRAWSURFACE2)lpDDSBack, &ddsd); + ddsd.dwFlags &= ~DDSD_PITCH; + //DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[temp]" , __LINE__); + res=(*pCreateSurfaceMethod(lpdds))(lpPrimaryDD, &ddsd, &lpddsTmp, NULL); + if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + // copy front buffer + res= (*pBlt)(lpddsTmp, NULL, lpdds, NULL, DDBLT_WAIT, NULL); + if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); + } + if(lpddssrc){ //res=lpdds->Blt(0, lpddssrc, 0, DDBLT_WAIT, 0); res=sBlt("Flip", lpdds, NULL, lpddssrc, NULL, DDBLT_WAIT, 0, TRUE); @@ -3254,6 +3285,15 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, } else res=sBlt("Flip", lpdds, NULL, lpDDSBack, NULL, DDBLT_WAIT, 0, TRUE); + + lpddssrc = lpDDSBack; + } + + if(dxw.dwFlags4 & NOFLIPEMULATION){ + // restore flipped backbuffer + res= (*pBlt)(lpddssrc, NULL, lpddsTmp, NULL, DDBLT_WAIT, NULL); + if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); + (*pReleaseS)(lpddsTmp); } if(res) OutTraceE("Flip: Blt ERROR %x(%s)\n", res, ExplainDDError(res)); diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 6d670e0..ff1788d 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -72,7 +72,7 @@ static char *Flag4Names[32]={ "ZBUFFERCLEAN", "ZBUFFER0CLEAN", "ZBUFFERALWAYS", "DISABLEFOGGING", "NOPOWER2FIX", "NOPERFCOUNTER", "ADDPROXYLIBS", "INTERCEPTRDTSC", "LIMITSCREENRES", "NOFILLRECT", "HOOKGLIDE", "HIDEDESKTOP", - "STRETCHTIMERS", "", "", "", + "STRETCHTIMERS", "NOFLIPEMULATION", "", "", "", "", "", "", "", "", "", "", "", "", "", "", diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 8f2c2ca..880edbd 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.60" +#define VERSION "2.02.61" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 7cf4258..78dec33 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/host/Resource.h b/host/Resource.h index c0b4241..c28ba0a 100644 --- a/host/Resource.h +++ b/host/Resource.h @@ -56,7 +56,6 @@ #define IDC_EMULATESURFACE 1011 #define IDC_AUTOMATIC 1012 #define IDC_MODIFYMOUSE 1013 -//#define IDC_HANDLEDC 1014 #define IDC_SAVELOAD 1015 #define IDC_INITX 1016 #define IDC_INITY 1017 @@ -205,6 +204,7 @@ #define IDC_NOFILLRECT 1162 #define IDC_HIDEDESKTOP 1163 #define IDC_STRETCHTIMERS 1164 +#define IDC_NOFLIPEMULATION 1165 #define ID_MODIFY 32771 #define ID_DELETE 32772 #define ID_ADD 32773 diff --git a/host/TabDirectX.cpp b/host/TabDirectX.cpp index 0efd812..66b9ad4 100644 --- a/host/TabDirectX.cpp +++ b/host/TabDirectX.cpp @@ -44,6 +44,7 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_NOALPHACHANNEL, cTarget->m_NoAlphaChannel); DDX_Check(pDX, IDC_FIXREFCOUNTER, cTarget->m_FixRefCounter); DDX_Check(pDX, IDC_ADDPROXYLIBS, cTarget->m_AddProxyLibs); + DDX_Check(pDX, IDC_NOFLIPEMULATION, cTarget->m_NoFlipEmulation); //DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps); } diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 50043fc..03e2bb6 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -79,6 +79,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_SaveLoad = FALSE; m_SlowDown = FALSE; m_BlitFromBackBuffer = FALSE; + m_NoFlipEmulation = FALSE; m_SuppressClipping = FALSE; m_DisableGammaRamp = FALSE; m_AutoRefresh = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 18ba2c4..72a320a 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -60,6 +60,7 @@ public: BOOL m_SaveLoad; BOOL m_SlowDown; BOOL m_BlitFromBackBuffer; + BOOL m_NoFlipEmulation; BOOL m_SuppressClipping; BOOL m_DisableGammaRamp; BOOL m_AutoRefresh; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 0e149a6..1079619 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 9884c9d..bf1887c 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -337,17 +337,18 @@ BEGIN CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,40,127,10 CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,52,119,10 CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,64,119,10 - CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,76,119,10 - CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,88,119,10 - CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,100,109,12 + CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,88,119,10 + CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,100,119,10 + CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,112,109,12 CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,118,216,109,12 - CONTROL "Forces HEL ",IDC_FORCESHEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,112,109,12 - CONTROL "Win7 color fix",IDC_COLORFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,124,109,12 - CONTROL "Don't fix the Pixel Format",IDC_NOPIXELFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,136,109,12 + CONTROL "Forces HEL ",IDC_FORCESHEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,124,109,12 + CONTROL "Win7 color fix",IDC_COLORFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,136,109,12 + CONTROL "Don't fix the Pixel Format",IDC_NOPIXELFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,148,109,12 CONTROL "by default set no ALPHACHANNEL",IDC_NOALPHACHANNEL, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,148,123,12 - CONTROL "Fix ddraw ref counter",IDC_FIXREFCOUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,160,123,12 - CONTROL "Add proxy libs",IDC_ADDPROXYLIBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,172,123,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,160,123,12 + CONTROL "Fix ddraw ref counter",IDC_FIXREFCOUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,172,123,12 + CONTROL "Add proxy libs",IDC_ADDPROXYLIBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,184,123,12 + CONTROL "Compensate Flip emulation",IDC_NOFLIPEMULATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,76,119,10 END IDD_TAB_INPUT DIALOGEX 0, 0, 300, 240 diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index f21bee9..90f8554 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 351a9b0..c0d3d68 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -188,6 +188,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_SaveLoad) t->flags |= SAVELOAD; if(dlg->m_SlowDown) t->flags |= SLOWDOWN; if(dlg->m_BlitFromBackBuffer) t->flags |= BLITFROMBACKBUFFER; + if(dlg->m_NoFlipEmulation) t->flags4 |= NOFLIPEMULATION; if(dlg->m_SuppressClipping) t->flags |= SUPPRESSCLIPPING; if(dlg->m_DisableGammaRamp) t->flags2 |= DISABLEGAMMARAMP; if(dlg->m_AutoRefresh) t->flags |= AUTOREFRESH; @@ -344,6 +345,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_SaveLoad = t->flags & SAVELOAD ? 1 : 0; dlg->m_SlowDown = t->flags & SLOWDOWN ? 1 : 0; dlg->m_BlitFromBackBuffer = t->flags & BLITFROMBACKBUFFER ? 1 : 0; + dlg->m_NoFlipEmulation = t->flags4 & NOFLIPEMULATION ? 1 : 0; dlg->m_SuppressClipping = t->flags & SUPPRESSCLIPPING ? 1 : 0; dlg->m_DisableGammaRamp = t->flags2 & DISABLEGAMMARAMP ? 1 : 0; dlg->m_AutoRefresh = t->flags & AUTOREFRESH ? 1 : 0;