diff --git a/Include/dxwnd.h b/Include/dxwnd.h index aaa14c2..15c7704 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -20,7 +20,8 @@ #define HANDLEEXCEPTIONS 0x00000040 // Handles exceptions: Div by 0 .... #define SAVELOAD 0x00000080 #define EMULATEBUFFER 0x00000100 -#define HANDLEDC 0x00000200 +//#define HANDLEDC 0x00000200 +#define AUTOMATIC 0x00000200 #define BLITFROMBACKBUFFER 0x00000400 #define SUPPRESSCLIPPING 0x00000800 #define AUTOREFRESH 0x00001000 diff --git a/build/dxwnd.dll b/build/dxwnd.dll index f81ec13..d1a1101 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4afdf78c8226b629ed5e70a1fe3d1e79ac6e8293bc1e2ac74b2257d59d10f6d7 -size 457728 +oid sha256:6470041921d673a2f604bd9a646a2462aba707cab537c42a5770a9cc981dbb0a +size 458240 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 7aea3db..8f9b3f1 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f349082b6ce4e630b509e9dc5903c05b296b7fa6b071c1885241ea5c4cf2ed7 +oid sha256:d9760719d7520e5a1b652d530fc2f32b8018842d333594f06241a692b3904652 size 535040 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index c84dc60..76b75c2 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -3124,12 +3124,81 @@ maxfps124=0 initts124=0 winver124=0 maxres124=-1 -title125=Red Storm: Rogue Spear +title125=Populous 3 (GOG - D3D) module125= opengllib125= -title126=Black Thorn +title126=Populous 3 (GOG) module126= opengllib126= +path125=D:\Games\Populous 3 (GOG)\D3DPopTB.exe +ver125=0 +coord125=0 +flag125=671105572 +flagg125=134217744 +flagh125=65556 +flagi125=4 +tflag125=6146 +initx125=0 +inity125=0 +minx125=0 +miny125=0 +maxx125=0 +maxy125=0 +posx125=50 +posy125=50 +sizx125=800 +sizy125=600 +maxfps125=0 +initts125=0 +winver125=0 +maxres125=-1 +path126=D:\Games\Populous 3 (GOG)\popTB.exe +ver126=0 +coord126=0 +flag126=671105572 +flagg126=1207959568 +flagh126=20 +flagi126=4 +tflag126=0 +initx126=0 +inity126=0 +minx126=0 +miny126=0 +maxx126=0 +maxy126=0 +posx126=50 +posy126=50 +sizx126=800 +sizy126=600 +maxfps126=0 +initts126=0 +winver126=0 +maxres126=-1 +title127=Thief 2 (GOG) +path127=D:\Games\Thief 2 (GOG)\thief2_no_ddfix.exe +module127= +opengllib127= +ver127=0 +coord127=0 +flag127=687865888 +flagg127=1207959552 +flagh127=65556 +flagi127=4 +tflag127=0 +initx127=0 +inity127=0 +minx127=0 +miny127=0 +maxx127=0 +maxy127=0 +posx127=50 +posy127=50 +sizx127=800 +sizy127=600 +maxfps127=0 +initts127=0 +winver127=0 +maxres127=-1 [window] posx=1129 posy=466 diff --git a/build/exports/Populous 3 (GOG - D3D).dxw b/build/exports/Populous 3 (GOG - D3D).dxw new file mode 100644 index 0000000..3bfd24c --- /dev/null +++ b/build/exports/Populous 3 (GOG - D3D).dxw @@ -0,0 +1,26 @@ +[target] +title0=Populous 3 (GOG - D3D) +path0=D:\Games\Populous 3 (GOG)\D3DPopTB.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=671105572 +flagg0=134217744 +flagh0=65556 +flagi0=4 +tflag0=6146 +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/Populous 3 (GOG).dxw b/build/exports/Populous 3 (GOG).dxw new file mode 100644 index 0000000..762b140 --- /dev/null +++ b/build/exports/Populous 3 (GOG).dxw @@ -0,0 +1,26 @@ +[target] +title0=Populous 3 (GOG) +path0=D:\Games\Populous 3 (GOG)\popTB.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=671105572 +flagg0=1207959568 +flagh0=20 +flagi0=4 +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 2ee4534..6aaf2f4 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -390,5 +390,11 @@ v2.02.57 fixed WS_NCCALCSIZE & WM_NCPAINT messages to ensure a proper window's border and size - fixed Black Thorn window problems fixed "Hide desktop background" flag +v2.02.58 +Added Automatic DirectX mode: not workink always, but should make it much easier to guess a proper surface setting. +Automatic mode allows dynamic mode change depending on the situation: it is necessary for Populous 3 D3D version. +fixed BltFast operation with SRC color key (often used to draw cursor from texures) directly to primary surface: this makes the cursor visible in Populous 3. +minor fixes on logging + diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 6221b0f..f8d8ea2 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -16,7 +16,6 @@ #include "dxhelper.h" #include "syslibs.h" - // DirectDraw API HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *); HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *); @@ -1393,6 +1392,8 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I OutTraceDDRAW("DirectDrawCreate: guid=%x(%s)\n", lpguid, ExplainGUID(lpguid)); + if (dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE; + if(!pDirectDrawCreate){ // not hooked yet.... HINSTANCE hinst; hinst = LoadLibrary("ddraw.dll"); @@ -1463,6 +1464,8 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, OutTraceDDRAW("DirectDrawCreateEx: guid=%x(%s) refiid=%x\n", lpguid, ExplainGUID(lpguid), iid); + if (dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE; + // v2.1.70: auto-hooking (just in case...) if(!pDirectDrawCreateEx){ // not hooked yet.... HINSTANCE hinst; @@ -3031,6 +3034,10 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, } if(res){ BlitError(res, lpsrcrect, &destrect, __LINE__); + if(IsDebug) { + DescribeSurface(lpdds, 0, "[DST]" , __LINE__); + if (lpddssrc) DescribeSurface(lpddssrc, 0, "[SRC]" , __LINE__); // lpddssrc could be NULL!!! + } // Try to handle HDC lock concurrency.... if(res==DDERR_SURFACEBUSY){ (*pUnlockMethod(lpdds))(lpdds, NULL); @@ -3038,8 +3045,30 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, res= (*pBlt)(lpdds, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx); if (res) BlitError(res, lpsrcrect, &destrect, __LINE__); } - - if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; + // Try to handle DDBLT_KEYSRC on primary surface + if((res==DDERR_INVALIDPARAMS) && (dwflags & DDBLT_KEYSRC)){ + // to do: handle possible situations with surface 2 / 4 / 7 types + DDSURFACEDESC ddsd; + LPDIRECTDRAWSURFACE lpddsTmp; + if (IsDebug) BlitTrace("KEYSRC", lpsrcrect, &destrect, __LINE__); + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + lpddssrc->GetSurfaceDesc(&ddsd); + res=(*pCreateSurface1)(lpPrimaryDD, &ddsd, &lpddsTmp, NULL); + if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); + // copy background + res= (*pBlt)(lpddsTmp, lpsrcrect, lpdds, &destrect, DDBLT_WAIT, NULL); + if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); + // overlay texture + res= (*pBlt)(lpddsTmp, lpsrcrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx); + if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); + // copy back to destination + res= (*pBlt)(lpdds, &destrect, lpddsTmp, lpsrcrect, DDBLT_WAIT, lpddbltfx); + if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__); + if (res) BlitError(res, lpsrcrect, &destrect, __LINE__); + (*pReleaseS)(lpddsTmp); + } + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK; } return res; @@ -3252,12 +3281,13 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, return 0; } + flags = 0; if(dwtrans & DDBLTFAST_WAIT) flags = DDBLT_WAIT; if(dwtrans & DDBLTFAST_DESTCOLORKEY) flags |= DDBLT_KEYDEST; if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_KEYSRC; if ((dxw.dwFlags2 & FULLRECTBLT) && ToPrim){ - return sBlt("BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, 0, FALSE); + return sBlt("BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, NULL, FALSE); } destrect.left = dwx; @@ -3267,8 +3297,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, destrect.bottom = destrect.top + lpsrcrect->bottom - lpsrcrect->top; // avoid altering pointed values.... srcrect=*lpsrcrect; - //ret=lpdds->Blt(&destrect, lpddssrc, &srcrect, flags, 0); - ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, &srcrect, flags, 0, FALSE); + ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, &srcrect, flags, NULL, FALSE); } else{ // does it EVER goes through here? NULL is not a valid rect value for BltFast call.... @@ -3282,7 +3311,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, } destrect.right = destrect.left + ddsd.dwWidth; destrect.bottom = destrect.top + ddsd.dwHeight; - ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, NULL, flags, 0, FALSE); + ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, NULL, flags, NULL, FALSE); } return ret; @@ -4032,7 +4061,7 @@ HRESULT WINAPI extGetColorKey(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORK OutTraceE("GetColorKey: ERROR lpdds=%x flags=%x res=%x(%s)\n", lpdds, flags, res, ExplainDDError(res)); else OutTraceDDRAW("GetColorKey: colors=(L:%x,H:%x)\n", - lpdds, lpDDColorKey->dwColorSpaceLowValue, lpDDColorKey->dwColorSpaceHighValue); + lpDDColorKey->dwColorSpaceLowValue, lpDDColorKey->dwColorSpaceHighValue); return res; } diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 737a64b..c3a0e36 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -37,7 +37,7 @@ CRITICAL_SECTION TraceCS; static char *FlagNames[32]={ "UNNOTIFY", "EMULATESURFACE", "CLIPCURSOR", "RESETPRIMARY", "HOOKDI", "MODIFYMOUSE", "HANDLEEXCEPTIONS", "SAVELOAD", - "EMULATEBUFFER", "HANDLEDC", "BLITFROMBACKBUFFER", "SUPPRESSCLIPPING", + "EMULATEBUFFER", "AUTOMATIC", "BLITFROMBACKBUFFER", "SUPPRESSCLIPPING", "AUTOREFRESH", "FIXWINFRAME", "HIDEHWCURSOR", "SLOWDOWN", "ENABLECLIPPING", "LOCKWINSTYLE", "MAPGDITOPRIMARY", "FIXTEXTOUT", "KEEPCURSORWITHIN", "USERGB565", "SUPPRESSDXERRORS", "PREVENTMAXIMIZE", @@ -713,18 +713,6 @@ static void dx_TogglePositionLock(HWND hwnd) } } -static void dx_ToggleDC() -{ - if(dxw.dwFlags1 & HANDLEDC){ - dxw.dwFlags1 &= ~HANDLEDC; - OutTrace("ToggleDC: HANDLEDC mode OFF\n"); - } - else { - dxw.dwFlags1 |= HANDLEDC; - OutTrace("ToggleDC: HANDLEDC mode ON\n"); - } -} - static void dx_ToggleFPS() { if(dxw.dwFlags2 & SHOWFPS){ @@ -997,9 +985,9 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case VK_F9: dx_TogglePositionLock(hwnd); break; - case VK_F8: - dx_ToggleDC(); - break; + //case VK_F8: + // dx_ToggleDC(); + // break; case VK_F7: dx_ToggleFPS(); break; @@ -1482,6 +1470,8 @@ void HookInit(TARGETMAP *target, HWND hwnd) dxw.InitTarget(target); + if(dxw.dwFlags1 & AUTOMATIC) dxw.dwFlags1 |= EMULATESURFACE; // if AUTOMATIC, try this first! + if(hwnd){ // v2/02.32: skip this when in code injection mode. // v2.1.75: is it correct to set hWnd here? //dxw.SethWnd(hwnd); diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 8039986..de28892 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.57" +#define VERSION "2.02.58" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index ad61a09..b8f058b 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 24d19b6..fb17f83 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -1042,30 +1042,6 @@ BOOL WINAPI extGDIDeleteDC(HDC hdc) return res; } -COLORREF WINAPI extSetTextColor(HDC hdc, COLORREF crColor) -{ - COLORREF res; - - if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC) && (dxw.VirtualPixelFormat.dwRGBBitCount==8)) - crColor=GetMatchingColor(crColor); - - res=(*pGDISetTextColor)(hdc, crColor); - OutTraceDW("SetTextColor: color=%x res=%x%s\n", crColor, res, (res==CLR_INVALID)?"(CLR_INVALID)":""); - return res; -} - -COLORREF WINAPI extSetBkColor(HDC hdc, COLORREF crColor) -{ - COLORREF res; - - if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC) && (dxw.VirtualPixelFormat.dwRGBBitCount==8)) - crColor=GetMatchingColor(crColor); - - res=(*pGDISetBkColor)(hdc, crColor); - OutTraceDW("SetBkColor: color=%x res=%x%s\n", crColor, res, (res==CLR_INVALID)?"(CLR_INVALID)":""); - return res; -} - HFONT WINAPI extCreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index f8e9bf9..47be8e2 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -693,7 +693,12 @@ HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd); if(res) { OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - return res; + if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) { + dxw.dwFlags1 &= ~EMULATESURFACE; + dxw.dwFlags1 |= LOCKEDSURFACE; + res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd); + } + if (res) return res; } else OutTraceD3D("CreateDevice(D3D2): lpd3dd=%x\n", lpd3d, *lplpd3dd); @@ -702,33 +707,20 @@ HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE return res; } -const GUID IID_IDirect3DRampDevice; -const GUID IID_IDirect3DRGBDevice; - HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 lpdds, LPDIRECT3DDEVICE3 *lplpd3dd, LPUNKNOWN unk) { HRESULT res; - GUID IID_IDirect3DRGBDevice = {0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; - GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; - GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29}; OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk); - //res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk); if(res) { OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - //if(1) { - // GUID IID_IDirect3DRGBDevice = {0xA4665C60,0x2673,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; - // GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; - // GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29}; - // res=(*pCreateDevice3)(lpd3d, IID_IDirect3DRGBDevice, lpdds, lplpd3dd, unk); - // if(res) OutTraceE("CreateDevice(IID_IDirect3DRGBDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - // res=(*pCreateDevice3)(lpd3d, IID_IDirect3DRampDevice, lpdds, lplpd3dd, unk); - // if(res) OutTraceE("CreateDevice(IID_IDirect3DRampDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - // res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk); - // if(res) OutTraceE("CreateDevice(IID_IDirect3DMMXDevice) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - //} - return res; + if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) { + dxw.dwFlags1 &= ~EMULATESURFACE; + dxw.dwFlags1 |= LOCKEDSURFACE; + res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk); + } + if (res) return res; } HookDirect3DDevice((void **)lplpd3dd, 3); @@ -744,6 +736,12 @@ HRESULT WINAPI extCreateDevice7(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE7 res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd); if(res) { OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) { + dxw.dwFlags1 &= ~EMULATESURFACE; + dxw.dwFlags1 |= LOCKEDSURFACE; + res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd); + } + if (res) return res; return res; } @@ -773,26 +771,6 @@ HRESULT WINAPI extD3DGetCaps(void *d3dd, LPD3DDEVICEDESC lpd3dd ,LPD3DDEVICEDESC return res; } -#if 0 -//HRESULT WINAPI extSwapTextureHandles(void *d3dd, LPDIRECT3DTEXTURE,LPDIRECT3DTEXTURE) -//HRESULT WINAPI extCreateExecuteBuffer(void *d3dd, LPD3DEXECUTEBUFFERDESC,LPDIRECT3DEXECUTEBUFFER*,IUnknown*) -//HRESULT WINAPI extGetStats(void *d3dd, LPD3DSTATS) -HRESULT WINAPI extExecute(void *d3dd, LPDIRECT3DEXECUTEBUFFER lpd3dEB, LPDIRECT3DVIEWPORT lpd3dVP, DWORD dwFlags) -HRESULT WINAPI extAddViewport(void *d3dd, LPDIRECT3DVIEWPORT) -HRESULT WINAPI extDeleteViewport(void *d3dd,HIS_ LPDIRECT3DVIEWPORT) -HRESULT WINAPI extNextViewport(void *d3dd, LPDIRECT3DVIEWPORT,LPDIRECT3DVIEWPORT*,DWORD) -HRESULT WINAPI extPick(void *d3dd, LPDIRECT3DEXECUTEBUFFER,LPDIRECT3DVIEWPORT,DWORD,LPD3DRECT) -HRESULT WINAPI extGetPickRecords(void *d3dd, LPDWORD,LPD3DPICKRECORD) -HRESULT WINAPI extEnumTextureFormats(void *d3dd, LPD3DENUMTEXTUREFORMATSCALLBACK,LPVOID) -HRESULT WINAPI extCreateMatrix(void *d3dd, LPD3DMATRIXHANDLE) -HRESULT WINAPI extSetMatrix(void *d3dd, D3DMATRIXHANDLE,const LPD3DMATRIX) -HRESULT WINAPI extGetMatrix(void *d3dd, D3DMATRIXHANDLE,LPD3DMATRIX) -HRESULT WINAPI extDeleteMatrix(void *d3dd, D3DMATRIXHANDLE) -HRESULT WINAPI extBeginScene(void *d3dd) -HRESULT WINAPI extEndScene(void *d3dd) -HRESULT WINAPI extGetDirect3D(void *d3dd, LPDIRECT3D*) -#endif - char *ExplainRenderstateValue(DWORD Value) { char *p; diff --git a/dll/syslibs.h b/dll/syslibs.h index 086fb8a..57bbafe 100644 --- a/dll/syslibs.h +++ b/dll/syslibs.h @@ -450,9 +450,7 @@ extern BOOL WINAPI extGDIRestoreDC(HDC, int); extern int WINAPI extGDISaveDC(HDC); extern BOOL WINAPI extScaleWindowExtEx(HDC, int, int, int, int, LPSIZE); extern HPALETTE WINAPI extSelectPalette(HDC, HPALETTE, BOOL); -extern COLORREF WINAPI extSetBkColor(HDC, COLORREF); extern BOOL WINAPI extSetDeviceGammaRamp(HDC, LPVOID); -extern COLORREF WINAPI extSetTextColor(HDC, COLORREF); extern BOOL WINAPI extGDIStretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD); extern int WINAPI extStretchDIBits(HDC, int, int, int, int, int, int, int, int, const VOID *, const BITMAPINFO *, UINT, DWORD); extern BOOL WINAPI extDDStretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD); diff --git a/host/Resource.h b/host/Resource.h index 34d2ea9..73a9d8a 100644 --- a/host/Resource.h +++ b/host/Resource.h @@ -54,8 +54,9 @@ #define IDC_EMULATEBUFFER 1009 #define IDC_LOCKEDSURFACE 1010 #define IDC_EMULATESURFACE 1011 -#define IDC_MODIFYMOUSE 1012 -#define IDC_HANDLEDC 1014 +#define IDC_AUTOMATIC 1012 +#define IDC_MODIFYMOUSE 1013 +//#define IDC_HANDLEDC 1014 #define IDC_SAVELOAD 1015 #define IDC_INITX 1016 #define IDC_INITY 1017 diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index c8e68ff..c9532aa 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -22,7 +22,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) //{{AFX_DATA_INIT(CTargetDlg) m_DXVersion = 0; m_Coordinates = 0; - m_DxEmulationMode = 3; // default: EMULATESURFACE + m_DxEmulationMode = 4; // default: AUTOMATIC m_DCEmulationMode = 0; // default: no emulation m_HookDI = FALSE; m_ModifyMouse = TRUE; // default true !! @@ -34,7 +34,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_OutD3DTrace = FALSE; m_OutDDRAWTrace = FALSE; m_DXProxed = FALSE; - m_HandleDC = FALSE; + //m_HandleDC = FALSE; m_HandleExceptions = FALSE; m_SuppressIME = FALSE; m_SuppressD3DExt = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 842dc7a..ee22b11 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -42,7 +42,7 @@ public: BOOL m_ImportTable; BOOL m_RegistryOp; BOOL m_TraceHooks; - BOOL m_HandleDC; + //BOOL m_HandleDC; BOOL m_UnNotify; BOOL m_Windowize; BOOL m_HookDLLs; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 09fb942..0e149a6 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 7412695..5060d65 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -327,6 +327,7 @@ BEGIN CONTROL "Primary Buffer",IDC_EMULATEBUFFER,"Button",BS_AUTORADIOBUTTON,14,132,67,12 CONTROL "Locked Surface",IDC_LOCKEDSURFACE,"Button",BS_AUTORADIOBUTTON,14,144,67,12 CONTROL "Primary Surface",IDC_EMULATESURFACE,"Button",BS_AUTORADIOBUTTON,14,156,77,12 + CONTROL "Automatic mode",IDC_AUTOMATIC,"Button",BS_AUTORADIOBUTTON,14,168,77,12 GROUPBOX "DirectX Version Hook",IDC_STATIC,6,3,98,103,WS_GROUP GROUPBOX "Emulation",IDC_STATIC,7,109,98,80,WS_GROUP CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,16,126,9 diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index a74b152..2352abc 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 753877e..ddcdda3 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -129,6 +129,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) case 1: t->flags |= EMULATEBUFFER; break; case 2: t->flags |= LOCKEDSURFACE; break; case 3: t->flags |= EMULATESURFACE; break; + case 4: t->flags |= AUTOMATIC; break; } t->flags2 &= ~GDISTRETCHED; t->flags &= ~MAPGDITOPRIMARY; @@ -154,7 +155,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_ImportTable) t->tflags |= OUTIMPORTTABLE; if(dlg->m_RegistryOp) t->tflags |= OUTREGISTRY; if(dlg->m_TraceHooks) t->tflags |= TRACEHOOKS; - if(dlg->m_HandleDC) t->flags |= HANDLEDC; + //if(dlg->m_HandleDC) t->flags |= HANDLEDC; if(dlg->m_HandleExceptions) t->flags |= HANDLEEXCEPTIONS; if(dlg->m_LimitResources) t->flags2 |= LIMITRESOURCES; if(dlg->m_CDROMDriveType) t->flags3 |= CDROMDRIVETYPE; @@ -287,6 +288,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) if(t->flags & EMULATEBUFFER) dlg->m_DxEmulationMode = 1; if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 2; if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 3; + if(t->flags & AUTOMATIC) dlg->m_DxEmulationMode = 4; dlg->m_DCEmulationMode = 0; if(t->flags2 & GDISTRETCHED) dlg->m_DCEmulationMode = 1; @@ -308,7 +310,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_ImportTable = t->tflags & OUTIMPORTTABLE ? 1 : 0; dlg->m_RegistryOp = t->tflags & OUTREGISTRY ? 1 : 0; dlg->m_TraceHooks = t->tflags & TRACEHOOKS ? 1 : 0; - dlg->m_HandleDC = t->flags & HANDLEDC ? 1 : 0; + //dlg->m_HandleDC = t->flags & HANDLEDC ? 1 : 0; dlg->m_HandleExceptions = t->flags & HANDLEEXCEPTIONS ? 1 : 0; dlg->m_SuppressIME = t->flags2 & SUPPRESSIME ? 1 : 0; dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0; @@ -1150,7 +1152,7 @@ void CDxwndhostView::OnAdd() //dlg.m_Coordinates = 0; //dlg.m_MaxX = 0; //639; //dlg.m_MaxY = 0; //479; - //dlg.m_DxEmulationMode = 3; // defaulting to EMULATIONMODE + //dlg.m_DxEmulationMode = 4; // defaulting to AUTOMATIC for(i = 0; i < MAXTARGETS; i ++) if(!TargetMaps[i].path[0]) break; if(i>=MAXTARGETS){ MessageBoxEx(0, "Maximum entries number reached.\nDelete some entry to add a new one.", "Warning", MB_OK | MB_ICONEXCLAMATION, NULL);