diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 9881200..143c59f 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -175,7 +175,7 @@ #define STRESSRESOURCES 0x02000000 // simulates a lack of resources condition, for testing (debug opt.) #define MESSAGEPUMP 0x04000000 // inserts a "message pump" loop between repeated operation that may stop the task on Win7 and greater #define TEXTUREFORMAT 0x08000000 // Apply virtual pixel format to texture surfaces without DDSD_PIXELFORMAT attribute -#define GSKYHACK 0x10000000 // use VIDEOMEMORY+LOCALVIDMEM capability to turn hw acceleration on ... +//#define GSKYHACK 0x10000000 // use VIDEOMEMORY+LOCALVIDMEM capability to turn hw acceleration on ... #define LOCKRESERVEDPALETTE 0x20000000 // lock the reserved palette entries (usually 20: 0-9 and 246-255) #define UNLOCKZORDER 0x40000000 // Inhibit attempts to keep the main win on top of ZORDER by stripping BringWindowToTop and SetForegroundWindow calls #define EASPORTSHACK 0X80000000 // Hack to intercept and neutralize some of the hooks set internally by EA Sports games diff --git a/build/dxwnd.dll b/build/dxwnd.dll index b0fced2..9dafcdc 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5211d477a57e94924d26e7fdb6bafab7271fb26dbace81ea1d77114cad7fa1c3 +oid sha256:56ab101cb2b224e431663b2780b0f9909105b05d8224c9aaf04fce73f4478f2c size 576000 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 4cbee38..d4cbbf5 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec8dfbc77b459282a1bde4e41baf74b3c9a05edfd78fd1f8660c051ce47cc97f +oid sha256:4689f5e3e9616fb6a9cffaa580a02ca3aceb4364593deeb30b373e1e6f0d0696 size 539648 diff --git a/build/exports/Crimson Skies.dxw b/build/exports/Crimson Skies.dxw index 84b3e28..f70aaa4 100644 --- a/build/exports/Crimson Skies.dxw +++ b/build/exports/Crimson Skies.dxw @@ -9,7 +9,7 @@ flag0=140525606 flagg0=1207959568 flagh0=20 flagi0=4194596 -tflag0=258 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -26,3 +26,6 @@ launchpath0= flagj0=128 winver0=0 maxres0=0 +notes0= +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Darius Gaiden.dxw b/build/exports/Darius Gaiden.dxw index e971208..4ffe178 100644 --- a/build/exports/Darius Gaiden.dxw +++ b/build/exports/Darius Gaiden.dxw @@ -5,10 +5,10 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=671089184 +flag0=671088674 flagg0=1207959552 flagh0=20 -flagi0=4 +flagi0=4194308 tflag0=0 initx0=0 inity0=0 @@ -24,3 +24,8 @@ maxfps0=0 initts0=2 winver0=0 maxres0=-1 +launchpath0= +notes0= +flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Dark Planet Battle for Natrolis.dxw b/build/exports/Dark Planet Battle for Natrolis.dxw index 9324fda..8094d4a 100644 --- a/build/exports/Dark Planet Battle for Natrolis.dxw +++ b/build/exports/Dark Planet Battle for Natrolis.dxw @@ -5,10 +5,10 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=671088673 +flag0=671088675 flagg0=1208025088 flagh0=20 -flagi0=12 +flagi0=4194316 tflag0=0 initx0=0 inity0=0 @@ -24,3 +24,8 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +launchpath0= +notes0= +flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Darkened Skye.dxw b/build/exports/Darkened Skye.dxw index ac9f547..a7c1926 100644 --- a/build/exports/Darkened Skye.dxw +++ b/build/exports/Darkened Skye.dxw @@ -5,7 +5,7 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=679493664 +flag0=679493666 flagg0=1207959552 flagh0=65556 flagi0=69206020 @@ -25,3 +25,7 @@ initts0=0 winver0=0 maxres0=-1 launchpath0= +notes0= +flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Devastation.dxw b/build/exports/Devastation.dxw index c550573..e1d416f 100644 --- a/build/exports/Devastation.dxw +++ b/build/exports/Devastation.dxw @@ -8,8 +8,8 @@ coord0=0 flag0=134217766 flagg0=1207959552 flagh0=65556 -flagi0=0 -tflag0=67 +flagi0=4194304 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -22,3 +22,10 @@ sizx0=800 sizy0=600 maxfps0=0 initts0=0 +launchpath0= +notes0= +flagj0=128 +flagk0=0 +winver0=0 +maxres0=0 +swapeffect0=0 diff --git a/build/exports/Devil Inside, the.dxw b/build/exports/Devil Inside, the.dxw index 0f74487..4c1269e 100644 --- a/build/exports/Devil Inside, the.dxw +++ b/build/exports/Devil Inside, the.dxw @@ -6,7 +6,7 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=671105072 +flag0=671105074 flagg0=1207959552 flagh0=16 flagi0=-2009071612 @@ -25,3 +25,7 @@ maxfps0=0 initts0=-4 winver0=0 maxres0=-1 +notes0= +flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Die Hard Nakatomi Plaza.dxw b/build/exports/Die Hard Nakatomi Plaza.dxw index 99a83be..47ee8ac 100644 --- a/build/exports/Die Hard Nakatomi Plaza.dxw +++ b/build/exports/Die Hard Nakatomi Plaza.dxw @@ -6,12 +6,12 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=671096866 +flag0=673194018 flagg0=1207959552 flagh0=20 flagi0=138412036 -flagj0=8328 -tflag0=6403 +flagj0=128 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -26,3 +26,6 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +notes0= +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Dune 2000 (not emulated).dxw b/build/exports/Dune 2000 (not emulated).dxw deleted file mode 100644 index 0435be3..0000000 --- a/build/exports/Dune 2000 (not emulated).dxw +++ /dev/null @@ -1,26 +0,0 @@ -[target] -title0=Dune 2000 -path0=D:\Games\Dune 2000\DUNE2000.DAT -module0= -opengllib0= -ver0=0 -coord0=0 -flag0=671105312 -flagg0=1207959568 -flagh0=20 -flagi0=4 -tflag0=64 -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/exports/Dune 2000.dxw b/build/exports/Dune 2000.dxw index a90698b..328d89a 100644 --- a/build/exports/Dune 2000.dxw +++ b/build/exports/Dune 2000.dxw @@ -4,12 +4,15 @@ path0=D:\Games\Dune 2000\DUNE2000.DAT launchpath0=D:\Games\Dune 2000\DUNE2000.EXE module0= opengllib0= +notes0= ver0=0 coord0=0 flag0=671105058 flagg0=1207959568 flagh0=20 flagi0=4194308 +flagj0=128 +flagk0=0 tflag0=0 initx0=0 inity0=0 @@ -25,5 +28,4 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 -notes0= -flagj0=128 +swapeffect0=0 diff --git a/build/exports/Empire of the Ants.dxw b/build/exports/Empire of the Ants.dxw index 3971d7b..9c5eaee 100644 --- a/build/exports/Empire of the Ants.dxw +++ b/build/exports/Empire of the Ants.dxw @@ -9,7 +9,7 @@ flag0=402669606 flagg0=1207959552 flagh0=20 flagi0=4194308 -tflag0=64 +tflag0=0 initx0=0 inity0=0 minx0=0 diff --git a/build/exports/Forsaken (HW).dxw b/build/exports/Forsaken (HW).dxw index ad3c252..636132a 100644 --- a/build/exports/Forsaken (HW).dxw +++ b/build/exports/Forsaken (HW).dxw @@ -5,10 +5,10 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=411058208 -flagg0=1207959808 +flag0=950026274 +flagg0=1207959812 flagh0=20 -flagi0=2097156 +flagi0=4194308 tflag0=0 initx0=0 inity0=0 @@ -26,6 +26,6 @@ winver0=0 maxres0=-1 launchpath0= notes0= -flagj0=262272 +flagj0=162 flagk0=0 swapeffect0=0 diff --git a/build/exports/Killing Time.dxw b/build/exports/Killing Time.dxw new file mode 100644 index 0000000..d0796df --- /dev/null +++ b/build/exports/Killing Time.dxw @@ -0,0 +1,31 @@ +[target] +title0=Killing Time +path0=D:\Games\killingtime\KILLTIME.EXE +launchpath0= +module0= +opengllib0= +notes0=Movies not rendered correctly +ver0=0 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +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 +swapeffect0=0 diff --git a/build/exports/STCC Swedish TouringCar Championship.dxw b/build/exports/STCC Swedish TouringCar Championship.dxw new file mode 100644 index 0000000..d772e9c --- /dev/null +++ b/build/exports/STCC Swedish TouringCar Championship.dxw @@ -0,0 +1,31 @@ +[target] +title0=STCC Swedish TouringCar Championship +path0=D:\Games\STCC\STCC.exe +launchpath0= +module0= +opengllib0= +notes0=Still slow and choppy in emulation mode +ver0=0 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4256 +flagk0=0 +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 +swapeffect0=0 diff --git a/build/exports/Total Soccer 2000 (DirectX).dxw b/build/exports/Total Soccer 2000 (DirectX).dxw index eba889f..af6c5db 100644 --- a/build/exports/Total Soccer 2000 (DirectX).dxw +++ b/build/exports/Total Soccer 2000 (DirectX).dxw @@ -5,10 +5,10 @@ module0= opengllib0= ver0=1 coord0=0 -flag0=134234784 -flagg0=1208025344 +flag0=134234274 +flagg0=1207959808 flagh0=20 -flagi0=12 +flagi0=4194308 tflag0=0 initx0=0 inity0=0 @@ -24,3 +24,8 @@ maxfps0=0 initts0=2 winver0=0 maxres0=-1 +launchpath0= +notes0= +flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/eXpendable.dxw b/build/exports/eXpendable.dxw index 38c084d..d6101cf 100644 --- a/build/exports/eXpendable.dxw +++ b/build/exports/eXpendable.dxw @@ -9,9 +9,9 @@ coord0=0 flag0=134217762 flagg0=1207959552 flagh0=20 -flagi0=134217732 -flagj0=8320 -tflag0=129 +flagi0=138412036 +flagj0=128 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -26,3 +26,6 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +notes0= +flagk0=0 +swapeffect0=0 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 6cd16e0..c53a606 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -825,4 +825,9 @@ fix: handling of DDERR_SURFACEBUSY error in blit operations, recovers "Virtua Co fix: several changes in palette handling, improve (but don't fix!) "Man in Black" palette rendering fix: EnumDisplayMode hooker, passing wrong vodeo modes to the callback routine. Fixes "Total Annihilation Kingdoms" crash fix: DxWnd GUI build with very large width, causing slow interface responsiveness. -add: added the "Suppress Release on backbuffer" that makes "Tetris Worlds" working, avoiding to release the backbuffer surface too many times. \ No newline at end of file +add: added the "Suppress Release on backbuffer" that makes "Tetris Worlds" working, avoiding to release the backbuffer surface too many times. + +v2.03.25: +fix: CoCreateInstance hooking for IDirectDraw interface: fixes "Darius Gaiden" +fix: BackBufferCaps value for NOSYSTEMEMULATED option. Fixes "Forsaken" crashes in AERO mode. +fix: GDI GetDC and GetWindowDC must not redirect the zero hWnd to the current main window if not in fullscreen mode. \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index fc6cf8e..01085a1 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -2238,8 +2238,8 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf // DDSCAPS_SYSTEMMEMORY makes operations faster, but it is not always good... dwBackBufferCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY); // on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it.... - // if(dxw.dwFlags5 & NOSYSTEMEMULATED) dwBackBufferCaps &= ~DDSCAPS_SYSTEMMEMORY; - if(dxw.dwFlags5 & GSKYHACK) dwBackBufferCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); + // this is important to avoid that certain D3D operations will abort - see "Forsaken" problem + if(dxw.dwFlags5 & NOSYSTEMEMULATED) dwBackBufferCaps = DDSCAPS_OFFSCREENPLAIN; if(dxw.dwFlags5 & GDIMODE) return DD_OK; @@ -2905,19 +2905,19 @@ HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, L ddsd.ddsCaps.dwCaps = dwBackBufferCaps; res=(*pCreateSurface)(lpPrimaryDD, (LPDDSURFACEDESC)&ddsd, &lpddsTmp, NULL); if(res) { - OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - OutTraceB("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Gateway]", __LINE__)); + OutTraceE("PrimaryStretchBlt: CreateSurface ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + OutTraceB("PrimaryStretchBlt: CreateSurface %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Gateway]", __LINE__)); return res; } // stretch-blit to target size on OFFSCREENPLAIN temp surface res= (*pBlt)(lpddsTmp, &TmpRect, lpddssrc, lpsrcrect, DDBLT_WAIT, 0); if(res) { - OutTraceE("Blt: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + OutTraceE("PrimaryStretchBlt: Blt ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); } else { // fast-blit to primary res= (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddsTmp, &TmpRect, DDBLTFAST_WAIT); - if(res) OutTraceE("Blt: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + if(res) OutTraceE("PrimaryStretchBlt: Blt ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); } (*pReleaseS)(lpddsTmp); return res; @@ -3005,7 +3005,7 @@ HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, // capabilities must cope with primary / backbuffer surface capabilities to get speedy operations ddsd.ddsCaps.dwCaps = dwBackBufferCaps; res=(*pCreateSurface)(lpPrimaryDD, (LPDDSURFACEDESC)&ddsd, &lpddsTmp, NULL); - if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + if(res) OutTraceE("PrimaryBilinearBlt: CreateSurface ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); // get informations memset(&ddsd,0,dwSize); @@ -3013,7 +3013,7 @@ HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; res=(*pLock)(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0); if(res) { - OutTraceE("Lock: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + OutTraceE("PrimaryBilinearBlt: Lock ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return DD_OK; } bSourceBuf = (BYTE *)ddsd.lpSurface; @@ -3023,7 +3023,7 @@ HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; res=(*pLock)(lpddsTmp, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0); if(res) { - OutTraceE("Lock: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + OutTraceE("PrimaryBilinearBlt: Lock ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return DD_OK; } bDestBuf = (BYTE *)ddsd.lpSurface; @@ -3070,7 +3070,7 @@ HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, (*pUnlockMethod(lpddssrc))(lpddssrc, NULL); (*pUnlockMethod(lpddsTmp))(lpddsTmp, NULL); res= (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddsTmp, &TmpRect, DDBLTFAST_WAIT); - if(res) OutTraceE("BltFast: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + if(res) OutTraceE("PrimaryBilinearBlt: BltFast ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); (*pReleaseS)(lpddsTmp); if(lpddsCopy) (*pReleaseS)(lpddsCopy); return res; diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 2943cae..0811309 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -101,7 +101,7 @@ static char *Flag5Names[32]={ "TEXTURETRANSP", "NORMALIZEPERFCOUNT", "HYBRIDMODE", "GDICOLORCONV", "INJECTSON", "ENABLESONHOOK", "FREEZEINJECTEDSON", "GDIMODE", "CENTERTOWIN", "STRESSRESOURCES", "MESSAGEPUMP", "TEXTUREFORMAT", - "GSKYHACK", "LOCKRESERVEDPALETTE", "UNLOCKZORDER", "EASPORTSHACK", + "--GSKYHACK", "LOCKRESERVEDPALETTE", "UNLOCKZORDER", "EASPORTSHACK", }; static char *Flag6Names[32]={ diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 46d6a6e..7b07040 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.24" +#define VERSION "2.03.25" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 53ceb35..1155ddf 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index b25d27f..49582d5 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -125,6 +125,7 @@ typedef HRESULT (WINAPI *DeleteViewport1_Type)(void *, LPDIRECT3DVIEWPORT); typedef HRESULT (WINAPI *NextViewport1_Type)(void *, LPDIRECT3DVIEWPORT, LPDIRECT3DVIEWPORT *, DWORD); typedef HRESULT (WINAPI *DeleteViewport2_Type)(void *, LPDIRECT3DVIEWPORT2); typedef HRESULT (WINAPI *NextViewport2_Type)(void *, LPDIRECT3DVIEWPORT2, LPDIRECT3DVIEWPORT2 *, DWORD); +typedef HRESULT (WINAPI *ViewportClear_Type)(void *, DWORD, LPD3DRECT, DWORD); InitializeVP_Type pInitializeVP = NULL; SetViewport_Type pSetViewport = NULL; @@ -141,6 +142,7 @@ DeleteViewport1_Type pDeleteViewport1 = NULL; NextViewport1_Type pNextViewport1 = NULL; DeleteViewport2_Type pDeleteViewport2 = NULL; NextViewport2_Type pNextViewport2 = NULL; +ViewportClear_Type pViewportClear = NULL; HRESULT WINAPI extInitialize(void *); HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); @@ -158,6 +160,7 @@ HRESULT WINAPI extDeleteViewport1(void *, LPDIRECT3DVIEWPORT); HRESULT WINAPI extNextViewport1(void *, LPDIRECT3DVIEWPORT, LPDIRECT3DVIEWPORT *, DWORD); HRESULT WINAPI extDeleteViewport2(void *, LPDIRECT3DVIEWPORT2); HRESULT WINAPI extNextViewport2(void *, LPDIRECT3DVIEWPORT2, LPDIRECT3DVIEWPORT2 *, DWORD); +HRESULT WINAPI extViewportClear(void *, DWORD, LPD3DRECT, DWORD); HRESULT WINAPI extInitializeVP(void *, LPDIRECT3D); HRESULT WINAPI extSetViewport(void *, LPD3DVIEWPORT); @@ -535,6 +538,9 @@ void HookViewport(LPDIRECT3DVIEWPORT *lpViewport, int d3dversion) SetHook((void *)(**(DWORD **)lpViewport + 12), extInitializeVP, (void **)&pInitializeVP, "Initialize(VP1)"); SetHook((void *)(**(DWORD **)lpViewport + 16), extGetViewport, (void **)&pGetViewport, "GetViewport(1)"); SetHook((void *)(**(DWORD **)lpViewport + 20), extSetViewport, (void **)&pSetViewport, "SetViewport(1)"); + + // to do: why Clear method crashes in "Forsaken" in emulation and GDI mode??? + // SetHook((void *)(**(DWORD **)lpViewport + 48), extViewportClear, (void **)&pViewportClear, "Clear(1)"); break; case 2: SetHook((void *)(**(DWORD **)lpViewport + 12), extInitializeVP, (void **)&pInitializeVP, "Initialize(VP2)"); @@ -1573,7 +1579,7 @@ HRESULT WINAPI extEnumZBufferFormats(void *lpd3d, REFCLSID riidDevice, LPD3DENUM { HRESULT ret; CallbackZBufArg Arg; - OutTrace("Direct3D::EnumZBufferFormats d3d=%x clsid=%x context=%x\n", lpd3d, riidDevice.Data1, lpContext); + OutTraceD3D("Direct3D::EnumZBufferFormats d3d=%x clsid=%x context=%x\n", lpd3d, riidDevice.Data1, lpContext); Arg.cb= &lpEnumCallback; Arg.arg=lpContext; ret = (*pEnumZBufferFormats)(lpd3d, riidDevice, (LPD3DENUMPIXELFORMATSCALLBACK)extZBufferProxy, (LPVOID)&Arg); @@ -1581,3 +1587,24 @@ HRESULT WINAPI extEnumZBufferFormats(void *lpd3d, REFCLSID riidDevice, LPD3DENUM return ret; } +// Beware: using service surfaces with DDSCAPS_SYSTEMMEMORY capability may lead to crashes in D3D operations +// like Vievport::Clear() in "Forsaken" set in emulation AERO-friendly mode. To avoid the problem, you can +// suppress the offending cap by use of the NOSYSTEMEMULATED flag + +HRESULT WINAPI extViewportClear(void *lpd3dvp, DWORD p1, LPD3DRECT lpRect, DWORD p2) +{ + HRESULT ret; + + if(IsTraceD3D){ + char sRect[81]; + if (lpRect) sprintf(sRect, "(%d,%d)-(%d,%d)", lpRect->x1, lpRect->y1, lpRect->x2, lpRect->y2); + else strcpy(sRect, "(NULL)"); + OutTrace("Viewport::Clear lpd3dvp=%x p1=%x p2=%x rect=%s\n", lpd3dvp, p1, p2, sRect); + } + + // proxying the call .... + ret = (*pViewportClear)(lpd3dvp, p1, lpRect, p2); + + OutTraceD3D("Viewport::Clear ret=%x\n", ret); + return ret; +} diff --git a/dll/ole32.cpp b/dll/ole32.cpp index fd0d8fd..c620650 100644 --- a/dll/ole32.cpp +++ b/dll/ole32.cpp @@ -117,8 +117,13 @@ HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, #else LPDIRECTDRAW lpOldDDraw; case 0x6C14DB80: + // must go through DirectDrawCreate: needed for "Darius Gaiden" OutTraceDW("CoCreateInstance: IID_DirectDraw RIID\n"); - HookDDSession((LPDIRECTDRAW *)ppv, 1); + res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + res=lpOldDDraw->QueryInterface(IID_IDirectDraw, (LPVOID *)ppv); + if(res)OutTraceDW("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); + lpOldDDraw->Release(); break; case 0xB3A6F3E0: OutTraceDW("CoCreateInstance: IID_DirectDraw2 RIID\n"); diff --git a/dll/user32.cpp b/dll/user32.cpp index 73066de..caf2d76 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -1919,6 +1919,8 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName) HDC ret; HWND lochwnd; + if(!dxw.IsFullScreen()) return(*pGDIGetDC)(hwnd); + lochwnd=hwnd; if (dxw.IsRealDesktop(hwnd)) { diff --git a/host/TabDebug.cpp b/host/TabDebug.cpp index 4f99573..91b4348 100644 --- a/host/TabDebug.cpp +++ b/host/TabDebug.cpp @@ -47,8 +47,6 @@ void CTabDebug::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_FREEZEINJECTEDSON, cTarget->m_FreezeInjectedSon); DDX_Check(pDX, IDC_STRESSRESOURCES, cTarget->m_StressResources); DDX_Check(pDX, IDC_NOSYSTEMMEMORY, cTarget->m_NoSystemMemory); - DDX_Check(pDX, IDC_NOSYSTEMEMULATED, cTarget->m_NoSystemEmulated); - DDX_Check(pDX, IDC_GSKYHACK, cTarget->m_GSkyHack); } BEGIN_MESSAGE_MAP(CTabDebug, CDialog) diff --git a/host/TabDirect3D.cpp b/host/TabDirect3D.cpp index 5b9999c..b28dcca 100644 --- a/host/TabDirect3D.cpp +++ b/host/TabDirect3D.cpp @@ -34,6 +34,7 @@ void CTabDirect3D::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_NOD3DRESET, cTarget->m_NoD3DReset); DDX_Check(pDX, IDC_SUPPRESSD3DEXT, cTarget->m_SuppressD3DExt); DDX_Check(pDX, IDC_FORCESHEL, cTarget->m_ForcesHEL); + DDX_Check(pDX, IDC_NOSYSTEMEMULATED, cTarget->m_NoSystemEmulated); // Texture management DDX_Radio(pDX, IDC_TEXTURENONE, cTarget->m_TextureHandling); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index a51df9a..b43bfe7 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -104,7 +104,6 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_DisableGammaRamp = FALSE; m_AutoRefresh = FALSE; m_TextureFormat = FALSE; - m_GSkyHack = FALSE; m_FixWinFrame = FALSE; m_EnableClipping = FALSE; m_CursorClipping = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 59c9e03..85be721 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -80,7 +80,6 @@ public: BOOL m_DisableGammaRamp; BOOL m_AutoRefresh; BOOL m_TextureFormat; - BOOL m_GSkyHack; BOOL m_FixWinFrame; BOOL m_EnableClipping; BOOL m_CursorClipping; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index d6cafea..731ced8 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 79b4250..ab69f90 100644 Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 4197b9b..fd8ba34 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 ea5c2d8..7179486 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -300,7 +300,6 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_DisableGammaRamp) t->flags2 |= DISABLEGAMMARAMP; if(dlg->m_AutoRefresh) t->flags |= AUTOREFRESH; if(dlg->m_TextureFormat) t->flags5 |= TEXTUREFORMAT; - if(dlg->m_GSkyHack) t->flags5 |= GSKYHACK; if(dlg->m_FixWinFrame) t->flags |= FIXWINFRAME; if(dlg->m_EnableClipping) t->flags |= ENABLECLIPPING; if(dlg->m_CursorClipping) t->flags |= CLIPCURSOR; @@ -519,7 +518,6 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_DisableGammaRamp = t->flags2 & DISABLEGAMMARAMP ? 1 : 0; dlg->m_AutoRefresh = t->flags & AUTOREFRESH ? 1 : 0; dlg->m_TextureFormat = t->flags5 & TEXTUREFORMAT ? 1 : 0; - dlg->m_GSkyHack = t->flags5 & GSKYHACK ? 1 : 0; dlg->m_FixWinFrame = t->flags & FIXWINFRAME ? 1 : 0; dlg->m_EnableClipping = t->flags & ENABLECLIPPING ? 1 : 0; dlg->m_CursorClipping = t->flags & CLIPCURSOR ? 1 : 0; diff --git a/host/resource b/host/resource index c4c6b86..7f61693 100644 Binary files a/host/resource and b/host/resource differ