diff --git a/Disasm201/disasm.vs2008.suo b/Disasm201/disasm.vs2008.suo index 9d8f6ce..0a849f6 100644 Binary files a/Disasm201/disasm.vs2008.suo and b/Disasm201/disasm.vs2008.suo differ diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 9e00921..ddeacf0 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -163,6 +163,9 @@ #define TEXTUREDUMP 0x00004000 // dump textures to file system as bmp files #define TEXTUREHACK 0x00008000 // load (replace) hacked textures from file system (bmp files) #define TEXTURETRANSP 0x00010000 // transparent textures (unimplemented) +#define NORMALIZEPERFCOUNT 0x00020000 // Normalize Performance Counter to a Performance Frequency of 1MHz +#define HYBRIDMODE 0x00040000 // ????? +#define GDICOLORCONV 0x00080000 // do color conversion using GDI // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/Resources_CN.dll b/build/Resources_CN.dll deleted file mode 100644 index aec1a83..0000000 --- a/build/Resources_CN.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7bebe395edfd439cfe09e4875e481f37506e0a980a3c589958dd9781c7dc4e65 -size 105472 diff --git a/build/Resources_EN.dll b/build/Resources_EN.dll deleted file mode 100644 index e87acca..0000000 --- a/build/Resources_EN.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0612ced9b9f9b7805a31213cba47f847cc10eb0d6a95e2d47adff97484edf5f5 -size 89600 diff --git a/build/Resources_IT.dll b/build/Resources_IT.dll deleted file mode 100644 index a8a9f92..0000000 --- a/build/Resources_IT.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ceacbf8f568d53efcb0982da28698e26923abb941312acaa6d6d0a743a91870b -size 112128 diff --git a/build/Resources_RU.dll b/build/Resources_RU.dll deleted file mode 100644 index 9382396..0000000 --- a/build/Resources_RU.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f2673e4533d1eeb79eb96ba29f360d844b64b06cdf3000271441a9f6b026d7e5 -size 114176 diff --git a/build/dxwnd.dll b/build/dxwnd.dll index dbf1421..28e192b 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dbfe732ec7cba24e2a540fa0a0275293d8f65b1922afeb0a190e5c7c5678e53f -size 535552 +oid sha256:dbb593dd74acbc13c129c32d28ba3808deabc13a62e2163696e371d06a5cdee5 +size 537600 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 6b38334..08c7dac 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef09812ea8000eca947a595d2c89257576af411f35834a2aecec9256e1c3a385 +oid sha256:8fb3df5a4f77d45fa4e102e1b37ab739fdee0eefc74edd8f3574f58c43166ee2 size 532992 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index 6ab9251..4d43d17 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -1,9 +1,9 @@ [window] -posx=1486 -posy=523 +posx=50 +posy=50 sizx=320 sizy=200 -lang=automatic +lang=default [texture] MinTexX=16 MaxTexX=0 diff --git a/build/exports/Age of Wonders.dxw b/build/exports/Age of Wonders.dxw index 8caa0f2..9468df5 100644 --- a/build/exports/Age of Wonders.dxw +++ b/build/exports/Age of Wonders.dxw @@ -9,7 +9,7 @@ coord0=0 flag0=679477792 flagg0=1207959552 flagh0=20 -flagi0=201326596 +flagi0=205520900 tflag0=0 initx0=0 inity0=0 @@ -25,3 +25,4 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +flagj0=128 diff --git a/build/exports/Beavis & Butthead Do U..dxw b/build/exports/Beavis & Butthead Do U..dxw index ea24f57..8189d23 100644 --- a/build/exports/Beavis & Butthead Do U..dxw +++ b/build/exports/Beavis & Butthead Do U..dxw @@ -5,10 +5,10 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=671090722 +flag0=673187874 flagg0=1207959552 flagh0=32788 -flagi0=0 +flagi0=4194304 tflag0=3 initx0=0 inity0=0 @@ -22,3 +22,7 @@ sizx0=800 sizy0=600 maxfps0=0 initts0=0 +launchpath0= +flagj0=128 +winver0=0 +maxres0=0 diff --git a/build/exports/Breath of Fire IV.dxw b/build/exports/Breath of Fire IV.dxw index ef8dcb8..1789bab 100644 --- a/build/exports/Breath of Fire IV.dxw +++ b/build/exports/Breath of Fire IV.dxw @@ -7,11 +7,11 @@ opengllib0= ver0=0 coord0=0 flag0=134217762 -flagg0=1476395024 -flagh0=4116 -flagi0=-2011168764 +flagg0=1476395008 +flagh0=20 +flagi0=138412036 flagj0=4224 -tflag0=6402 +tflag0=0 initx0=0 inity0=0 minx0=0 diff --git a/build/exports/Cyber Gladiators (3dfx).dxw b/build/exports/Cyber Gladiators (3dfx).dxw new file mode 100644 index 0000000..d8aeaf7 --- /dev/null +++ b/build/exports/Cyber Gladiators (3dfx).dxw @@ -0,0 +1,28 @@ +[target] +title0=Cyber Gladiators (3dfx) +path0=D:\Games\Cyber Gladiators\cyber.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=671088802 +flagg0=1744896000 +flagh0=20 +flagi0=-2009071612 +flagj0=4224 +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/exports/Hexplore.dxw b/build/exports/Hexplore.dxw new file mode 100644 index 0000000..eb0303f --- /dev/null +++ b/build/exports/Hexplore.dxw @@ -0,0 +1,28 @@ +[target] +title0=Hexplore +path0=D:\Games\Hexplore\hexplore.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134234146 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +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/exports/Hoyle Casino Empire (fullscreen).dxw b/build/exports/Hoyle Casino Empire (fullscreen).dxw new file mode 100644 index 0000000..26b2195 --- /dev/null +++ b/build/exports/Hoyle Casino Empire (fullscreen).dxw @@ -0,0 +1,28 @@ +[target] +title0=Hoyle Casino Empire (fullscreen) +path0=D:\Games\Hoyle Casino Empire\CasinoEmpire.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1073741824 +flagh0=20 +flagi0=138412036 +flagj0=4224 +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/exports/Hoyle Casino Empire.dxw b/build/exports/Hoyle Casino Empire.dxw new file mode 100644 index 0000000..d8254c1 --- /dev/null +++ b/build/exports/Hoyle Casino Empire.dxw @@ -0,0 +1,28 @@ +[target] +title0=Hoyle Casino Empire +path0=D:\Games\Hoyle Casino Empire\CasinoEmpire.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1242562560 +flagh0=20 +flagi0=138413060 +flagj0=4224 +tflag0=6151 +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/M1 Tank Platoon 2.dxw b/build/exports/M1 Tank Platoon 2.dxw new file mode 100644 index 0000000..9421797 --- /dev/null +++ b/build/exports/M1 Tank Platoon 2.dxw @@ -0,0 +1,28 @@ +[target] +title0=M1 Tank Platoon 2 +path0=D:\Games\M1 Tank Platoon 2\M1TP2.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134238242 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +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=8 +winver0=0 +maxres0=-1 diff --git a/build/exports/Streets of Sim City (2000 re-release, 3DFX).dxw b/build/exports/Streets of Sim City (2000 re-release, 3DFX).dxw new file mode 100644 index 0000000..c469c45 --- /dev/null +++ b/build/exports/Streets of Sim City (2000 re-release, 3DFX).dxw @@ -0,0 +1,28 @@ +[target] +title0=Streets of Sim City +path0=D:\Games\Streets of Sim City\STREETS.EXE +launchpath0= +module0= +opengllib0= +ver0=1 +coord0=0 +flag0=671088674 +flagg0=1224736768 +flagh0=20 +flagi0=138412036 +flagj0=4224 +tflag0=6403 +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/Taito Legends 2.dxw b/build/exports/Taito Legends 2.dxw new file mode 100644 index 0000000..8941389 --- /dev/null +++ b/build/exports/Taito Legends 2.dxw @@ -0,0 +1,28 @@ +[target] +title0=Taito Legends 2 +path0=D:\Games\Taito Legends 2\Taito.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1207959552 +flagh0=20 +flagi0=205520900 +flagj0=4224 +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/exports/Wind Fantasy SP.dxw b/build/exports/Wind Fantasy SP.dxw index 41bd5f3..b423bd3 100644 --- a/build/exports/Wind Fantasy SP.dxw +++ b/build/exports/Wind Fantasy SP.dxw @@ -25,4 +25,4 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 -flagj0=128 +flagj0=4224 diff --git a/build/exports/Wizardry 8 (3DfX).dxw b/build/exports/Wizardry 8 (3DfX).dxw new file mode 100644 index 0000000..2195b3a --- /dev/null +++ b/build/exports/Wizardry 8 (3DfX).dxw @@ -0,0 +1,28 @@ +[target] +title0=Wizardry 8 (3DfX) +path0=D:\Games\Wizardry 8\Wiz8.exe +launchpath0= +module0= +opengllib0= +ver0=9 +coord0=0 +flag0=134217730 +flagg0=1207959552 +flagh0=20 +flagi0=205520900 +flagj0=4224 +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/exports/dxwnd.ini b/build/exports/dxwnd.ini index 4e7b98e..06104c1 100644 --- a/build/exports/dxwnd.ini +++ b/build/exports/dxwnd.ini @@ -1,5 +1,5 @@ [window] -posx=1392 -posy=53 -sizx=320 -sizy=841 +posx=1189 +posy=594 +sizx=497 +sizy=464 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 34a3b4c..1faa15b 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -673,4 +673,11 @@ fix: changed surface capability policy so that "Risk II" works with identical su v2.03.05 add: texture dump for d3d8 & d3d9. Note: highlight & hack yet to be implemented. d3d10 & d3d11 yet to be implemented. Texture types not complete. -fix: handling of d3d10 (Assassin's Creed) \ No newline at end of file +fix: handling of d3d10 (Assassin's Creed) + +v2.03.06 +fix: do not try to set vsync delays on ddraw surface when not created yet +fix: catched several sporadic errors before they could crash the application +fix: GetAttachedSurface() now retrieves a backbuffer from the list, instead of referencing the last one - this fixes "Tomb Raider III" GOG release in non emulated mode. +add: "Normalize performance counter" flag to fix an improper use of QueryPerformanceCounter() made by "Cyber Gladiators" +add: "GDI Color conversion" debug flag diff --git a/dll/d3dtexture.cpp b/dll/d3dtexture.cpp index 9e3006c..c41c305 100644 --- a/dll/d3dtexture.cpp +++ b/dll/d3dtexture.cpp @@ -233,8 +233,6 @@ void D3DTextureDump(D3DSURFACE_DESC Desc, D3DLOCKED_RECT LockedRect) break; // almost certainly, an empty black surface! } - dxw.dwTFlags = (hash == 0xEC2EE7CE) ? 0xFFFFFFFF : 0x00000000; - // Create the .BMP file. extern char *GetDxWndPath(); sprintf_s(pszFile, MAX_PATH, "%s\\texture.out\\texture.%03d.%03d.%s.%08X.bmp", diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index e06536d..8e12d72 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -21,6 +21,7 @@ extern BOOL IsChangeDisplaySettingsHotPatched; BOOL bDontReleaseBackBuffer = FALSE; DWORD dwBackBufferCaps; extern void TextureHandling(LPDIRECTDRAWSURFACE); +ColorConversion_Type pColorConversion = NULL; // DirectDraw API HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *); @@ -1516,10 +1517,7 @@ HRESULT WINAPI extGetCapsD(LPDIRECTDRAW lpdd, LPDDCAPS c1, LPDDCAPS c2) c2=&swcaps; res=(*pGetCapsD)(lpdd, NULL, c2); } - //DWORD AlphaCaps; - //AlphaCaps=c1->dwFXAlphaCaps; memcpy((void *)c1, (void *)c2, size); - //c1->dwFXAlphaCaps=AlphaCaps; } if(dxw.dwFlags3 & CAPMASK) MaskCapsD(c1, c2); @@ -2743,8 +2741,11 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet // AddAttachedSurface, or a primary complex surface creation otherwise.... if(IsPrim && (lpddsc->dwCaps & (DDSCAPS_BACKBUFFER|DDSCAPS_FLIP))) { // v2.02.42 added DDSCAPS_FLIP for Empire Earth - if (lpDDSBack) { - *lplpddas = lpDDSBack; + // in "Tomb Raider III" GOG release, the primary surface is queryed and has no attached + // backbuffer, but a backbuffer does exist and has to be retrieved by GetBackBufferSurface. + LPDIRECTDRAWSURFACE lpddsback = dxw.GetBackBufferSurface(); + if (lpddsback) { + *lplpddas = lpddsback; OutTraceDW("GetAttachedSurface(%d): BACKBUFFER attached=%x\n", dxversion, *lplpddas); return DD_OK; } @@ -2829,7 +2830,12 @@ HRESULT WINAPI PrimaryBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECT HRESULT WINAPI PrimaryFastBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect) { - return (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddssrc, lpsrcrect, DDBLTFAST_WAIT); + RECT client; + int iXOffset, iYOffset; // offsets to center surface area to window + (*pGetClientRect)(dxw.GethWnd(), &client); + iXOffset = (client.right - dxw.GetScreenWidth()) >> 1; + iYOffset = (client.bottom - dxw.GetScreenHeight()) >> 1; + return (*pBltFast)(lpdds, iXOffset + lpdestrect->left, iYOffset + lpdestrect->top, lpddssrc, lpsrcrect, DDBLTFAST_WAIT); } HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect) @@ -2857,6 +2863,10 @@ HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, L if(lpddssrc==NULL){ // blit from backbuffer lpdds->GetAttachedSurface(&caps, &(LPDIRECTDRAWSURFACE)lpddsBak); + if(lpddsBak == NULL) { + OutTraceE("PrimaryStretchBlt: skip - lpddsBak=%x at %d\n", lpddsBak, __LINE__); + return DD_OK; // fake a success ... + } lpddsBak->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd); } else{ @@ -2878,11 +2888,14 @@ HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, L } // 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__); - // 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) BlitError(res, lpsrcrect, lpdestrect, __LINE__); + if(res) { + OutTraceE("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__); + } (*pReleaseS)(lpddsTmp); return res; } @@ -2976,14 +2989,20 @@ HRESULT WINAPI PrimaryBilinearBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, ddsd.dwSize = dwSize; 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__); + if(res) { + OutTraceE("Lock: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + return DD_OK; + } bSourceBuf = (BYTE *)ddsd.lpSurface; SrcPitch = ddsd.lPitch; memset(&ddsd,0,dwSize); ddsd.dwSize = dwSize; 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__); + if(res) { + OutTraceE("Lock: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + return DD_OK; + } bDestBuf = (BYTE *)ddsd.lpSurface; DestPitch = ddsd.lPitch; @@ -3039,6 +3058,66 @@ HRESULT WINAPI PrimaryNoBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRE return DD_OK; } +typedef HRESULT (WINAPI *ColorConversion_Type)(LPDIRECTDRAWSURFACE, RECT, LPDIRECTDRAWSURFACE *); + +HRESULT WINAPI ColorConversionEmulated(LPDIRECTDRAWSURFACE lpdds, RECT emurect, LPDIRECTDRAWSURFACE *lpddssource) +{ + HRESULT res; + res=(*pEmuBlt)(lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0); + if(res==DDERR_SURFACEBUSY){ + (*pUnlockMethod(lpdds))(lpdds, NULL); + (*pUnlockMethod(lpDDSEmu_Back))(lpDDSEmu_Back, NULL); + res=(*pEmuBlt)(lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0); + } + if(res) { + BlitError(res, &emurect, &emurect, __LINE__); + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; + } + *lpddssource = lpDDSEmu_Back; + return res; +} + +HRESULT WINAPI ColorConversionGDI(LPDIRECTDRAWSURFACE lpdds, RECT emurect, LPDIRECTDRAWSURFACE *lpddssource) +{ + // GDICOLORCONV: use GDI capabilities to convert color depth by BitBlt-ting between different hdc + HRESULT res; + OutTrace("STEP: GDI Color Conversion\n"); + do { + HDC hdc_source, hdc_dest; + res=(*pGetDC)(lpdds, &hdc_source); + if(res) { + OutTraceE("GetDC ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + break; + } + res=(*pGetDC)(lpDDSEmu_Back, &hdc_dest); + if(res) { + OutTraceE("GetDC ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + break; + } + if(!BitBlt(hdc_dest, 0, 0, dxw.GetScreenWidth(), dxw.GetScreenHeight(), hdc_source, 0, 0, SRCCOPY)){ + OutTraceE("BitBlt ERROR: err=%d at %d\n", GetLastError(), __LINE__); + } + res=(*pReleaseDC)(lpdds, hdc_source); + if(res) { + OutTraceE("ReleaseDC ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + break; + } + res=(*pReleaseDC)(lpDDSEmu_Back, hdc_dest); + if(res) { + OutTraceE("ReleaseDC ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + break; + } + } while(FALSE); + *lpddssource = lpDDSEmu_Back; + return res; +} + +HRESULT WINAPI ColorConversionDDRAW(LPDIRECTDRAWSURFACE lpdds, RECT emurect, LPDIRECTDRAWSURFACE *lpddssource) +{ + *lpddssource = lpdds; + return DD_OK; +} + HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx, BOOL isFlipping) { @@ -3332,23 +3411,10 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, } LPDIRECTDRAWSURFACE lpDDSSource; - - if(dxw.dwFlags1 & EMULATESURFACE){ - res=(*pEmuBlt)(lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0); - if(res==DDERR_SURFACEBUSY){ - (*pUnlockMethod(lpdds))(lpdds, NULL); - (*pUnlockMethod(lpDDSEmu_Back))(lpDDSEmu_Back, NULL); - res=(*pEmuBlt)(lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0); - } - if(res) { - BlitError(res, &emurect, &emurect, __LINE__); - if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; - return res; - } - lpDDSSource = lpDDSEmu_Back; - } - else{ - lpDDSSource = lpdds; + if (res=(*pColorConversion)(lpdds, emurect, &lpDDSSource)) { + OutTraceE("sBlt ERROR: Color conversion failed res=%d(%s)\n", res, ExplainDDError(res)); + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK; + return res; } dxw.ShowOverlay(lpDDSSource); @@ -4332,8 +4398,13 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds) OutTraceDDRAW("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res); if (res==0) { // common precondition + // erase surface from primary or backbuffer list + if(IsPrim || IsBack) dxw.MarkRegularSurface(lpdds); + // when releasing primary surface, erase clipping region if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor(); + + // clear service surface pointers if (dxw.dwFlags1 & EMULATESURFACE) { if(lpdds==lpDDSEmu_Prim) { OutTraceDW("Release(S): Clearing lpDDSEmu_Prim pointer\n"); @@ -4875,7 +4946,7 @@ HRESULT WINAPI extDDGetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDG return ret; } - HRESULT WINAPI extDDSetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDGAMMARAMP lpgr) +HRESULT WINAPI extDDSetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDGAMMARAMP lpgr) { HRESULT ret; OutTraceDDRAW("SetGammaRamp: dds=%x dwFlags=%x\n", lpdds, dwFlags); @@ -4891,7 +4962,7 @@ HRESULT WINAPI extDDGetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDG return ret; } - HRESULT WINAPI extGetAvailableVidMem(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree, GetAvailableVidMem_Type pGetAvailableVidMem) +HRESULT WINAPI extGetAvailableVidMem(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree, GetAvailableVidMem_Type pGetAvailableVidMem) { HRESULT res; //const DWORD dwMaxMem = 0x7FFFF000; diff --git a/dll/dxemublt.cpp b/dll/dxemublt.cpp index c84393b..a5ad9d2 100644 --- a/dll/dxemublt.cpp +++ b/dll/dxemublt.cpp @@ -1268,8 +1268,29 @@ static HRESULT WINAPI EmuBlt_Null(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrec void SetBltTransformations() { - OutTraceDW("SetBltTransformations: color transformation %d->%d\n", - dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount); + pPrimaryBlt = PrimaryBlt; + if(dxw.dwFlags5 & AEROBOOST) pPrimaryBlt = PrimaryStretchBlt; + if(dxw.dwFlags5 & BILINEARFILTER) pPrimaryBlt = PrimaryBilinearBlt; + if(dxw.dwFlags5 & DOFASTBLT) pPrimaryBlt = PrimaryFastBlt; // debug opt + if(dxw.dwFlags5 & NOBLT) pPrimaryBlt = PrimaryNoBlt; // debug opt + + extern HRESULT WINAPI ColorConversionDDRAW(LPDIRECTDRAWSURFACE, RECT, LPDIRECTDRAWSURFACE *); + extern HRESULT WINAPI ColorConversionGDI(LPDIRECTDRAWSURFACE, RECT, LPDIRECTDRAWSURFACE *); + extern HRESULT WINAPI ColorConversionEmulated(LPDIRECTDRAWSURFACE, RECT, LPDIRECTDRAWSURFACE *); + pColorConversion = ColorConversionDDRAW; // default for no emulation mode + if(dxw.dwFlags1 & EMULATESURFACE) { + pColorConversion = ColorConversionEmulated; // default for emulation mode + if(dxw.dwFlags5 & HYBRIDMODE) pColorConversion = ColorConversionDDRAW; + if(dxw.dwFlags5 & GDICOLORCONV) pColorConversion = ColorConversionGDI; + } + char *s = "???"; + if(pColorConversion == ColorConversionDDRAW) s="DDRAW"; + if(pColorConversion == ColorConversionGDI) s="GDI"; + if(pColorConversion == ColorConversionEmulated) s="EMULATED"; + OutTraceDW("SetBltTransformations: color conversion %s BPP %d->%d\n", + s, dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount); + + if(pColorConversion != ColorConversionEmulated) return; /* default (bad) setting */ pEmuBlt=EmuBlt_Null; @@ -1331,11 +1352,4 @@ void SetBltTransformations() dxw.ActualPixelFormat.dwRGBBitCount); break; } - - pPrimaryBlt = PrimaryBlt; - if(dxw.dwFlags5 & AEROBOOST) pPrimaryBlt = PrimaryStretchBlt; - if(dxw.dwFlags5 & BILINEARFILTER) pPrimaryBlt = PrimaryBilinearBlt; - if(dxw.dwFlags5 & DOFASTBLT) pPrimaryBlt = PrimaryFastBlt; // debug opt - if(dxw.dwFlags5 & NOBLT) pPrimaryBlt = PrimaryNoBlt; // debug opt - return; } diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 742dfaf..c2e45de 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -794,7 +794,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp extern void SetVSyncDelays(LPDIRECTDRAW); extern LPDIRECTDRAW lpPrimaryDD; if(dxw.dwFlags4 & STRETCHTIMERS) dxw.RenewTimers(); - SetVSyncDelays(lpPrimaryDD); + if(lpPrimaryDD) SetVSyncDelays(lpPrimaryDD); LastTimeShift=dxw.TimeShift; } @@ -1302,6 +1302,7 @@ void HookModule(HMODULE base, int dxversion) (dxw.dwFlags4 & OVERRIDEREGISTRY) || (dxw.dwTFlags & OUTREGISTRY)) HookAdvApi32(base); HookMSV4WLibs(base); // -- used by Aliens & Amazons demo: what for? + //HookSmackW32(base); } #define USEWINNLSENABLE @@ -1576,6 +1577,18 @@ static void ReplacePrivilegedOps() HWND hDesktopWindow = NULL; #endif +// Message poller: its only purpose is to keep sending messages to the main window +// so that the message loop is kept running. It is a trick necessary to play +// smack videos with smackw32.dll and AUTOREFRESH mode set +DWORD WINAPI MessagePoller(LPVOID lpParameter) +{ + #define DXWREFRESHINTERVAL 20 + while(TRUE){ + Sleep(DXWREFRESHINTERVAL); + SendMessage(dxw.GethWnd(), WM_NCHITTEST, 0, 0); + } +} + void HookInit(TARGETMAP *target, HWND hwnd) { HMODULE base; @@ -1604,6 +1617,13 @@ void HookInit(TARGETMAP *target, HWND hwnd) SetDllDirectory(sSourcePath); if(dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE; // if AUTOMATIC, try this first! + if(dxw.dwFlags5 & HYBRIDMODE) { + // special mode settings .... + dxw.dwFlags1 |= EMULATESURFACE; + dxw.dwFlags5 |= NOSYSTEMEMULATED; + dxw.dwFlags2 |= SETCOMPATIBILITY; + dxw.dwFlags5 &= ~(BILINEARFILTER | AEROBOOST); + } if(hwnd){ // v2.02.32: skip this when in code injection mode. // v2.1.75: is it correct to set hWnd here? @@ -1662,6 +1682,14 @@ void HookInit(TARGETMAP *target, HWND hwnd) if (dxw.dwFlags4 & LIMITSCREENRES) OutTrace("HookInit: max resolution=%s\n", (dxw.MaxScreenRes<6)?Resolutions[dxw.MaxScreenRes]:"unknown"); } + { + // Beware: for some strange & mysterious reason, this call makes Warcraft II and other games + // work better, avoiding something that resembles a black palette (no blit errors, but the + // whole screen black!!) and an AERO rupture. + PIXELFORMATDESCRIPTOR pfd; + DescribePixelFormat(GetDC(GetDesktopWindow()), 1, sizeof(PIXELFORMATDESCRIPTOR), &pfd); + } + if (hwnd && IsDebug){ DWORD dwStyle, dwExStyle; char ClassName[81]; @@ -1786,6 +1814,9 @@ void HookInit(TARGETMAP *target, HWND hwnd) AdjustWindowPos(dxw.hParentWnd, target->sizx, target->sizy); } } + + if (dxw.dwFlags1 & AUTOREFRESH) + CreateThread(NULL, 0, MessagePoller, NULL, 0, NULL); } LPCSTR ProcToString(LPCSTR proc) diff --git a/dll/dxhook.h b/dll/dxhook.h index 4b2726e..a2c77d9 100644 --- a/dll/dxhook.h +++ b/dll/dxhook.h @@ -11,6 +11,7 @@ extern void HookUser32(HMODULE); extern void HookWinMM(HMODULE); extern void HookAdvApi32(HMODULE); extern void HookImagehlp(HMODULE); +extern void HookSmackW32(HMODULE); extern void InitPosition(int, int, int, int, int, int); //void InitWindowPos(int, int, int, int); diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index e79b926..a0f9c93 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -240,4 +240,7 @@ typedef enum { DXVK_TIMETOGGLE, DXVK_ALTF4, DXVK_SIZE -}; \ No newline at end of file +}; + +typedef HRESULT (WINAPI *ColorConversion_Type)(LPDIRECTDRAWSURFACE, RECT, LPDIRECTDRAWSURFACE *); +extern ColorConversion_Type pColorConversion; diff --git a/dll/dxwnd.aps b/dll/dxwnd.aps index fbcc6dc..be1bf61 100644 Binary files a/dll/dxwnd.aps and b/dll/dxwnd.aps differ diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index d9e42b1..0b0fcc9 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.03.05" +#define VERSION "2.03.06" #define DXWACTIVATESINGLETASK 1 // comment to allow multiple task activations #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index d6281e0..b65a310 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 9340914..e1b9ed7 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -357,6 +357,13 @@ BOOL WINAPI extQueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) else{ LARGE_INTEGER CurrentInCount; ret=(*pQueryPerformanceCounter)(&CurrentInCount); + if(dxw.dwFlags5 & NORMALIZEPERFCOUNT) { + LARGE_INTEGER PerfFrequency; + static LARGE_INTEGER StartCounter = {0LL}; + if (StartCounter.QuadPart == 0LL) StartCounter.QuadPart = CurrentInCount.QuadPart; + (*pQueryPerformanceFrequency)(&PerfFrequency); + CurrentInCount.QuadPart = ((CurrentInCount.QuadPart - StartCounter.QuadPart) * 1000000LL) / PerfFrequency.QuadPart; + } *lpPerformanceCount = dxw.StretchLargeCounter(CurrentInCount); } @@ -374,8 +381,15 @@ BOOL WINAPI extQueryPerformanceFrequency(LARGE_INTEGER *lpPerformanceFrequency) *lpPerformanceFrequency=myPerfFrequency; ret = 0; } - else - ret=(*pQueryPerformanceFrequency)(lpPerformanceFrequency); + else{ + if(dxw.dwFlags5 & NORMALIZEPERFCOUNT){ + lpPerformanceFrequency->QuadPart = 1000000LL; + ret = TRUE; + } + else{ + ret = (*pQueryPerformanceFrequency)(lpPerformanceFrequency); + } + } OutTraceDW("QueryPerformanceFrequency: ret=%x Frequency=%x-%x\n", ret, lpPerformanceFrequency->HighPart, lpPerformanceFrequency->LowPart); return ret; } @@ -726,6 +740,21 @@ BOOL WINAPI extCreateProcessA( OutTraceDW("CreateProcess: SUPPRESS\n"); return TRUE; } + +#if 0 + // useless: DxWnd should hook to two processes contemporarily .... + // problem: binkplay seems to detect the screen actual size + if(TRUE){ + // get rid of /R option from binkplay argument line + if(!strncmp(lpCommandLine, "binkplay.exe ", strlen("binkplay.exe "))){ + char *rCommand; + rCommand = strstr(lpCommandLine, "/R "); + if(rCommand) memset(rCommand, ' ', strlen("/R ")); + OutTraceDW("CreateProcess: ApplicationName=\"%s\" CommandLine=\"%s\"\n", lpApplicationName, lpCommandLine); + } + } +#endif + //#define RELEASEHOOKTOSONPROCESS TRUE // extern void UnhookProc(); // if(RELEASEHOOKTOSONPROCESS) UnhookProc(); diff --git a/dll/smack.cpp b/dll/smack.cpp index 7215425..414bb1f 100644 --- a/dll/smack.cpp +++ b/dll/smack.cpp @@ -22,17 +22,37 @@ SmackOpen_Type pSmackOpen = NULL; SmackStruct * WINAPI extSmackOpen(HANDLE, UINT32, INT32); +static HookEntry_Type Hooks[]={ + {HOOK_IAT_CANDIDATE, "_SmackOpen@12", (FARPROC)NULL, (FARPROC *)&pSmackOpen, (FARPROC)extSmackOpen}, + {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator +}; + FARPROC Remap_smack_ProcAddress(LPCSTR proc, HMODULE hModule) { - if (!strcmp(proc,"_SmackOpen@12") && !pSmackOpen){ - pSmackOpen=(SmackOpen_Type)(*pGetProcAddress)(hModule, proc); - OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pSmackOpen); - return (FARPROC)extSmackOpen; - } + FARPROC addr; + if (addr=RemapLibrary(proc, hModule, Hooks)) return addr; // NULL -> keep the original call address return NULL; } +static char *libname = "smackw32.dll"; + +void HookSmackW32(HMODULE hModule) +{ + HookLibrary(hModule, Hooks, libname); + return; +} + +DWORD ThreadId = 0; + +DWORD WINAPI DoScreenRefresh(LPVOID lpParameter) +{ + while(TRUE){ + Sleep(20); + dxw.ScreenRefresh(); + } +} + SmackStruct * WINAPI extSmackOpen(HANDLE SmackFile, UINT32 flags, INT32 unknown) { SmackStruct *ret; @@ -43,8 +63,6 @@ SmackStruct * WINAPI extSmackOpen(HANDLE SmackFile, UINT32 flags, INT32 unknown) if (ret) { OutTraceDW("SmackOpen: version=%x screen=(%dx%d) frame_count=%d frame_number=%d\n", ret->version, ret->width, ret->height, ret->frame_count, ret->frame_number); - //ret->width=800; - //ret->height=600; } return ret; } diff --git a/host/DesktopDialog.cpp b/host/DesktopDialog.cpp index 88aa340..643af85 100644 --- a/host/DesktopDialog.cpp +++ b/host/DesktopDialog.cpp @@ -52,7 +52,20 @@ void CDesktopDialog::OnTimer(UINT_PTR nIDEvent) PIXELFORMATDESCRIPTOR pfd; int iPixelFormat; - // get the current pixel format index + // get the current pixel format index +#if 0 + ::DescribePixelFormat(hDC, 1, sizeof(PIXELFORMATDESCRIPTOR), &pfd); + HMODULE ogl; + //ogl=LoadLibrary("opengl32"); + ogl=LoadLibrary("gdi32"); + typedef BOOL (WINAPI *wglGetPixelFormat_Type)(HDC); + wglGetPixelFormat_Type pwglGetPixelFormat; + //pwglGetPixelFormat = (wglGetPixelFormat_Type)GetProcAddress(ogl, "wglGetPixelFormat"); + pwglGetPixelFormat = (wglGetPixelFormat_Type)GetProcAddress(ogl, "GetPixelFormat"); + iPixelFormat = (*pwglGetPixelFormat)(hDC); + iPixelFormat = (*pwglGetPixelFormat)(NULL); + //iPixelFormat = ::GetPixelFormat(NULL); +#endif iPixelFormat = ::GetPixelFormat(hDC); if(!iPixelFormat) iPixelFormat=1; // why returns 0??? if(iPixelFormat){ @@ -76,7 +89,6 @@ void CDesktopDialog::OnTimer(UINT_PTR nIDEvent) sprintf_s(sMsg, 1024, "error %d", GetLastError()); } - this->SetDlgItemTextA(IDC_DESKTOPINFO, sMsg); } diff --git a/host/Resource.h b/host/Resource.h index 42d887f..7945a0e 100644 Binary files a/host/Resource.h and b/host/Resource.h differ diff --git a/host/TabDebug.cpp b/host/TabDebug.cpp index 38579d7..88c778c 100644 --- a/host/TabDebug.cpp +++ b/host/TabDebug.cpp @@ -34,6 +34,7 @@ void CTabDebug::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_MARKBLIT, cTarget->m_MarkBlit); DDX_Check(pDX, IDC_NOBLT, cTarget->m_NoBlt); DDX_Check(pDX, IDC_FASTBLT, cTarget->m_FastBlt); + DDX_Check(pDX, IDC_GDICOLORCONV, cTarget->m_GDIColorConv); DDX_Check(pDX, IDC_ANALYTICMODE, cTarget->m_AnalyticMode); DDX_Check(pDX, IDC_SURFACEWARN, cTarget->m_SurfaceWarn); DDX_Check(pDX, IDC_CAPMASK, cTarget->m_CapMask); diff --git a/host/TabTiming.cpp b/host/TabTiming.cpp index d5905d6..72112d6 100644 --- a/host/TabTiming.cpp +++ b/host/TabTiming.cpp @@ -36,6 +36,7 @@ void CTabTiming::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_TIMESTRETCH, cTarget->m_TimeStretch); DDX_Check(pDX, IDC_INTERCEPTRDTSC, cTarget->m_InterceptRDTSC); DDX_Check(pDX, IDC_STRETCHTIMERS, cTarget->m_StretchTimers); + DDX_Check(pDX, IDC_NORMALIZEPERFCOUNT, cTarget->m_NormalizePerfCount); DDX_Check(pDX, IDC_QUARTERBLT, cTarget->m_QuarterBlt); DDX_Check(pDX, IDC_FINETIMING, cTarget->m_FineTiming); DDX_Text(pDX, IDC_MAXFPS, cTarget->m_MaxFPS); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 19cd0e4..1b2a563 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -110,6 +110,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_NoBlt = FALSE; m_BilinearBlt = FALSE; m_FastBlt = FALSE; + m_GDIColorConv = FALSE; m_PreventMaximize = FALSE; m_ClientRemapping = TRUE; // default true !! m_LockWinPos = FALSE; @@ -139,6 +140,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_ShowTimeStretch = FALSE; m_TimeStretch = FALSE; m_StretchTimers = FALSE; + m_NormalizePerfCount = FALSE; m_QuarterBlt = FALSE; m_FineTiming = FALSE; m_ReleaseMouse = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 11322b9..58bd0ae 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -90,6 +90,7 @@ public: BOOL m_NoBlt; BOOL m_BilinearBlt; BOOL m_FastBlt; + BOOL m_GDIColorConv; BOOL m_PreventMaximize; BOOL m_ClientRemapping; BOOL m_LockWinPos; @@ -119,6 +120,7 @@ public: BOOL m_ShowTimeStretch; BOOL m_TimeStretch; BOOL m_StretchTimers; + BOOL m_NormalizePerfCount; BOOL m_QuarterBlt; BOOL m_FineTiming; BOOL m_ReleaseMouse; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 3628ef4..a7c5aef 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 52ac7d8..8a84921 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 47b3c94..34016bb 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 8ca11e7..e8dc9ce 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -131,6 +131,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) case 2: t->flags |= EMULATEBUFFER; break; case 3: t->flags |= LOCKEDSURFACE; break; case 4: t->flags |= EMULATESURFACE; break; + case 5: t->flags5 |= HYBRIDMODE; break; break; } @@ -238,6 +239,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_NoSystemEmulated) t->flags5 |= NOSYSTEMEMULATED; if(dlg->m_NoBlt) t->flags5 |= NOBLT; if(dlg->m_FastBlt) t->flags5 |= DOFASTBLT; + if(dlg->m_GDIColorConv) t->flags5 |= GDICOLORCONV; if(dlg->m_PreventMaximize) t->flags |= PREVENTMAXIMIZE; if(dlg->m_ClientRemapping) t->flags |= CLIENTREMAPPING; if(dlg->m_LockWinPos) t->flags |= LOCKWINPOS; @@ -267,6 +269,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_ShowTimeStretch) t->flags4 |= SHOWTIMESTRETCH; if(dlg->m_TimeStretch) t->flags2 |= TIMESTRETCH; if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS; + if(dlg->m_NormalizePerfCount) t->flags5 |= NORMALIZEPERFCOUNT; if(dlg->m_QuarterBlt) t->flags5 |= QUARTERBLT; if(dlg->m_FineTiming) t->flags4 |= FINETIMING; if(dlg->m_ReleaseMouse) t->flags4 |= RELEASEMOUSE; @@ -334,6 +337,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) if(t->flags & EMULATEBUFFER) dlg->m_DxEmulationMode = 2; if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 3; if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 4; + if(t->flags5 & HYBRIDMODE) dlg->m_DxEmulationMode = 5; dlg->m_DxFilterMode = 0; if(t->flags4 & BILINEAR2XFILTER) dlg->m_DxFilterMode = 1; @@ -431,6 +435,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_NoSystemEmulated = t->flags5 & NOSYSTEMEMULATED ? 1 : 0; dlg->m_NoBlt = t->flags5 & NOBLT ? 1 : 0; dlg->m_FastBlt = t->flags5 & DOFASTBLT ? 1 : 0; + dlg->m_GDIColorConv = t->flags5 & GDICOLORCONV ? 1 : 0; dlg->m_PreventMaximize = t->flags & PREVENTMAXIMIZE ? 1 : 0; dlg->m_ClientRemapping = t->flags & CLIENTREMAPPING ? 1 : 0; dlg->m_LockWinPos = t->flags & LOCKWINPOS ? 1 : 0; @@ -460,6 +465,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_ShowTimeStretch = t->flags4 & SHOWTIMESTRETCH ? 1 : 0; dlg->m_TimeStretch = t->flags2 & TIMESTRETCH ? 1 : 0; dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0; + dlg->m_NormalizePerfCount = t->flags5 & NORMALIZEPERFCOUNT ? 1 : 0; dlg->m_QuarterBlt = t->flags5 & QUARTERBLT ? 1 : 0; dlg->m_FineTiming = t->flags4 & FINETIMING ? 1 : 0; dlg->m_ReleaseMouse = t->flags4 & RELEASEMOUSE ? 1 : 0; @@ -655,16 +661,16 @@ static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, c sprintf_s(key, sizeof(key), "coord%i", i); TargetMap->coordinates = GetPrivateProfileInt("target", key, 0, InitPath); - // be sure just one of the emulation flags is set sprintf_s(key, sizeof(key), "flag%i", i); TargetMap->flags = GetPrivateProfileInt("target", key, 0, InitPath); - flags = TargetMap->flags; - TargetMap->flags &= ~EMULATEFLAGS; - do{ - if(flags & EMULATESURFACE) {TargetMap->flags |= EMULATESURFACE; break;} - if(flags & EMULATEBUFFER) {TargetMap->flags |= EMULATEBUFFER; break;} - if(flags & LOCKEDSURFACE) {TargetMap->flags |= LOCKEDSURFACE; break;} - } while (0); + //// be sure just one of the emulation flags is set + //flags = TargetMap->flags; + //TargetMap->flags &= ~EMULATEFLAGS; + //do{ + // if(flags & EMULATESURFACE) {TargetMap->flags |= EMULATESURFACE; break;} + // if(flags & EMULATEBUFFER) {TargetMap->flags |= EMULATEBUFFER; break;} + // if(flags & LOCKEDSURFACE) {TargetMap->flags |= LOCKEDSURFACE; break;} + //} while (0); sprintf_s(key, sizeof(key), "flagg%i", i); TargetMap->flags2 = GetPrivateProfileInt("target", key, 0, InitPath); diff --git a/host/resource b/host/resource index ac83293..ae55ba3 100644 Binary files a/host/resource and b/host/resource differ