diff --git a/build/dxwnd.dll b/build/dxwnd.dll index db4fbd5..3b22216 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9f75f7b545dbfc03a38bf99d8260cbbe4dee01c82b7955c61769a126c643b82 -size 622080 +oid sha256:6ca8e1fa67ffd8ece8ce4dd729b0eec753da49cad2b29f93f9560f96a1105d18 +size 620544 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index a1deeb2..85753ec 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91dd24684d705c58f1e0bb5870715a997c93b285d02075571f0f8ef87068adec +oid sha256:4ee938187a007d36fb26816ecd7ce09990a0990c9c071881fa1a95dc2c4da831 size 548352 diff --git a/build/dxwnd.ini b/build/dxwnd.ini new file mode 100644 index 0000000..ce40365 --- /dev/null +++ b/build/dxwnd.ini @@ -0,0 +1,176 @@ +[window] +exepath=D:\Games\Dark Earth\ +exportpath=D:\DxWnd\exports\ +posx=1087 +posy=286 +sizx=320 +sizy=200 +[target] +title0=Warlords Battlecry 3 (GOG) +path0=D:\Games\Warlords Battlecry 3 (GOG)\Battlecry III.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=2 +flag0=136314914 +flagg0=1207959568 +flagh0=20 +flagi0=138543108 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +tflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 +title1=Galapagos +path1=D:\Games\Galapagos\GALA.EXE +launchpath1= +module1= +opengllib1= +notes1= +registry1= +ver1=7 +coord1=0 +flag1=681623718 +flagg1=1207959556 +flagh1=20 +flagi1=203423748 +flagj1=128 +flagk1=65536 +flagl1=0 +flagm1=0 +tflag1=-2147477245 +posx1=50 +posy1=50 +sizx1=800 +sizy1=600 +maxfps1=0 +initts1=0 +winver1=0 +maxres1=-1 +swapeffect1=0 +maxddinterface1=7 +title2=Warlords Battlecry III +path2=D:\Games\Warlords Battlecry III\Battlecry III.exe +launchpath2= +module2= +opengllib2= +notes2= +registry2= +ver2=0 +coord2=0 +flag2=136314914 +flagg2=1207959568 +flagh2=20 +flagi2=-2009071612 +flagj2=4224 +flagk2=65536 +flagl2=0 +flagm2=0 +tflag2=-2147477245 +posx2=50 +posy2=50 +sizx2=880 +sizy2=660 +maxfps2=0 +initts2=0 +winver2=0 +maxres2=-1 +swapeffect2=0 +maxddinterface2=7 +title3=Close Combat 2: a bridge too far +path3=D:\Games\Close Combat 2\CC2.EXE +launchpath3= +module3= +opengllib3= +notes3= +registry3=[HKEY_LOCAL_MACHINE\SOFTWARE]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat\2.00]\n"PID"="00000-000-0000000-00000"\n"InstalledTo"="C:\\GAMES\\CC2"\n"ScreenX"="800"\n"ScreenY"="600"\n"Version"="2.0"\n"IType"=hex:01,00,00,00\n"GameSpeed"=hex:01,00,00,00\n"ShowDSAlert"=hex:01,00,00,00\n"ShowQuickHelp"=hex:01,00,00,00\n"PlaySounds"=hex:01,00,00,00\n"PlayMusic"=hex:01,00,00,00\n"PlayVideos"=hex:00,00,00,00\n"FCopy"=hex:00,00,00,00\n"SMethod"=hex:00,00,00,00\n"Save"=hex:00,00,00,00\n"ShowTrees"=hex:01,00,00,00\n"StaticFPS"=hex:0a,00,00,00\n"InstalledFrom"=".\\"\n"Launched"="1"\n"VersionType"="RetailVersion"\n\n[HKEY_LOCAL_MACHINE\SOFTWARE]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat]\n[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat\2.00]\n"PID"="00000-000-0000000-00000"\n"InstalledTo"="C:\\GAMES\\CC2"\n"ScreenX"="800"\n"ScreenY"="600"\n"Version"="2.0"\n"IType"=hex:01,00,00,00\n"GameSpeed"=hex:01,00,00,00\n"ShowDSAlert"=hex:01,00,00,00\n"ShowQuickHelp"=hex:01,00,00,00\n"PlaySounds"=hex:01,00,00,00\n"PlayMusic"=hex:01,00,00,00\n"PlayVideos"=hex:00,00,00,00\n"FCopy"=hex:00,00,00,00\n"SMethod"=hex:00,00,00,00\n"Save"=hex:00,00,00,00\n"ShowTrees"=hex:01,00,00,00\n"StaticFPS"=hex:0a,00,00,00\n"InstalledFrom"=".\\"\n"Launched"="1"\n"VersionType"="RetailVersion"\n\n +ver3=0 +coord3=0 +flag3=134225952 +flagg3=1744830464 +flagh3=1044 +flagi3=1279262724 +flagj3=8392832 +flagk3=0 +flagl3=0 +flagm3=0 +tflag3=0 +posx3=50 +posy3=50 +sizx3=0 +sizy3=0 +maxfps3=0 +initts3=0 +winver3=0 +maxres3=-1 +swapeffect3=0 +maxddinterface3=7 +title4=CyberStrike 2 +path4=D:\Games\CyberStrike 2\CS2OG.FUN +launchpath4= +module4= +opengllib4= +notes4= +registry4= +ver4=0 +coord4=0 +flag4=136314978 +flagg4=1476395008 +flagh4=20 +flagi4=136314884 +flagj4=1054848 +flagk4=65536 +flagl4=0 +flagm4=0 +tflag4=-2147477245 +posx4=50 +posy4=50 +sizx4=800 +sizy4=600 +maxfps4=0 +initts4=0 +winver4=0 +maxres4=-1 +swapeffect4=0 +maxddinterface4=7 +title5=Dark Earth +path5=D:\Games\Dark Earth\dkev.exe +launchpath5= +module5= +opengllib5= +notes5= +registry5= +ver5=0 +coord5=0 +flag5=136331362 +flagg5=1476395008 +flagh5=20 +flagi5=138936324 +flagj5=4224 +flagk5=65536 +flagl5=0 +flagm5=0 +tflag5=-2147477245 +posx5=50 +posy5=50 +sizx5=800 +sizy5=600 +maxfps5=0 +initts5=0 +winver5=0 +maxres5=-1 +swapeffect5=0 +maxddinterface5=7 diff --git a/build/dxwnd.reg b/build/dxwnd.reg new file mode 100644 index 0000000..3b510dd --- /dev/null +++ b/build/dxwnd.reg @@ -0,0 +1,52 @@ +[HKEY_LOCAL_MACHINE\SOFTWARE] +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft] +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games] +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat] +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Close Combat\2.00] +"PID"="00000-000-0000000-00000" +"InstalledTo"="C:\\GAMES\\CC2" +"ScreenX"="800" +"ScreenY"="600" +"Version"="2.0" +"IType"=hex:01,00,00,00 +"GameSpeed"=hex:01,00,00,00 +"ShowDSAlert"=hex:01,00,00,00 +"ShowQuickHelp"=hex:01,00,00,00 +"PlaySounds"=hex:01,00,00,00 +"PlayMusic"=hex:01,00,00,00 +"PlayVideos"=hex:00,00,00,00 +"FCopy"=hex:00,00,00,00 +"SMethod"=hex:00,00,00,00 +"Save"=hex:00,00,00,00 +"ShowTrees"=hex:01,00,00,00 +"StaticFPS"=hex:0a,00,00,00 +"InstalledFrom"=".\\" +"Launched"="1" +"VersionType"="RetailVersion" + +[HKEY_LOCAL_MACHINE\SOFTWARE] +[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft] +[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games] +[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat] +[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft Games\Close Combat\2.00] +"PID"="00000-000-0000000-00000" +"InstalledTo"="C:\\GAMES\\CC2" +"ScreenX"="800" +"ScreenY"="600" +"Version"="2.0" +"IType"=hex:01,00,00,00 +"GameSpeed"=hex:01,00,00,00 +"ShowDSAlert"=hex:01,00,00,00 +"ShowQuickHelp"=hex:01,00,00,00 +"PlaySounds"=hex:01,00,00,00 +"PlayMusic"=hex:01,00,00,00 +"PlayVideos"=hex:00,00,00,00 +"FCopy"=hex:00,00,00,00 +"SMethod"=hex:00,00,00,00 +"Save"=hex:00,00,00,00 +"ShowTrees"=hex:01,00,00,00 +"StaticFPS"=hex:0a,00,00,00 +"InstalledFrom"=".\\" +"Launched"="1" +"VersionType"="RetailVersion" + diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 4614622..fdad1e6 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1025,8 +1025,9 @@ fix: changed SetHook so that it can get function pointers without necessarily re add: option "Limit ddraw interface" to exclude support for IDirectDrawInterface greater than limit (range 1-7) v2.03.53(skipped) -v2.03.54 +v2.03.54 (fix1+2) add: syslib shared dc mode preliminary implementation, thank to Narzoul's ideas. Works for "MS Golf 98" and "Deadlock II rel. 1.2" fix: handling of cursor hide/show for programs that don't go through the message window ("Deadlock II rel. 1.2") add: /R:n command line option to automatically start DxWnd in icon tray, run the n-th program in configuration and terminate. -add: option to disable the disabling of Alt-Tab key through SetWindowHooks through WH_KEYBOARD_LL event. Mae it posssible to use Alt-Tab key on "Dungeon Kepper II". \ No newline at end of file +add: option to disable the disabling of Alt-Tab key through SetWindowHooks through WH_KEYBOARD_LL event. Make it posssible to use Alt-Tab key on "Dungeon Kepper II". +fix: palette object reference count decremented from extra references and zeroed by the "Return 0 refcount" flag: make it possible to run "Dark Earth" that makes a check on the palette reerence counter before starting the game. \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 81d3510..5197bd2 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -295,6 +295,7 @@ LPDIRECTDRAWSURFACE lpDDZBuffer=NULL; LPDIRECTDRAW lpPrimaryDD=NULL; int iBakBufferVersion; LPDIRECTDRAWPALETTE lpDDP=NULL; +int iDDPExtraRefCounter=0; // v2.02.37: globals to store requested main surface capabilities DDSURFACEDESC2 DDSD_Prim; DWORD DDZBufferCaps; @@ -2392,7 +2393,10 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf } // this must be done after hooking - who knows why? res=(*pSetPalette)(*lplpdds, lpDDP); - if(res) OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + if(res) { + OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + } + else iDDPExtraRefCounter++; } // set a global capability value for surfaces that have to blit to primary @@ -2469,7 +2473,10 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea } // this must be done after hooking - who knows why? res=(*pSetPalette)(*lplpdds, lpDDP); - if(res) OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + if(res) { + OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + } + else iDDPExtraRefCounter++; } // set a global capability value for surfaces that have to blit to primary @@ -2590,7 +2597,10 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS } // this must be done after hooking - who knows why? res=(*pSetPalette)(*lplpdds, lpDDP); - if(res) OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + if(res) { + OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + } + else iDDPExtraRefCounter++; } // V2.1.85/V2.2.34: tricky !!!! @@ -2646,7 +2656,10 @@ static HRESULT BuildBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pC } // this must be done after hooking - who knows why? res=(*pSetPalette)(*lplpdds, lpDDP); - if(res) OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + if(res) { + OutTraceE("CreateSurface: SetPalette ERROR err=%x at %d\n", res, __LINE__); + } + else iDDPExtraRefCounter++; } return DD_OK; @@ -2798,8 +2811,10 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf res=(*pSetPalette)(*lplpdds, lpDDP); if(res) OutTraceE("SetPalette: ERROR on lpdds=%x(Emu_Generic) res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__); - else + else { OutTraceDW("CreateSurface: applied lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds); + iDDPExtraRefCounter++; + } } // diagnostic hooks .... @@ -2849,8 +2864,10 @@ static HRESULT BuildGenericFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea res=(*pSetPalette)(*lplpdds, lpDDP); if(res) OutTraceE("SetPalette: ERROR on lpdds=%x(Emu_Generic) res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__); - else + else { OutTraceDW("CreateSurface: applied lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds); + iDDPExtraRefCounter++; + } } // diagnostic hooks .... @@ -3815,6 +3832,7 @@ HRESULT WINAPI extGetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE *lpl OutTraceDW("GetPalette: retrieve PRIMARY palette for emulated surface lpDDP=%x\n", lpDDP); *lplpddp = lpDDP; lpDDP->AddRef(); + iDDPExtraRefCounter++; res=DD_OK; } @@ -4267,6 +4285,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) OutTraceE("GetDC: SetPalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return res; } + iDDPExtraRefCounter++; // retry .... res=(*pGetDC)(lpdds, pHDC); } @@ -4878,6 +4897,7 @@ ULONG WINAPI extReleaseD(int dxversion, ReleaseD_Type pReleaseD, LPDIRECTDRAW lp lpDDSEmu_Prim=NULL; lpDDSEmu_Back=NULL; lpDDP=NULL; + iDDPExtraRefCounter = 0; lpPrimaryDD=NULL; // v2.02.31 } } @@ -5136,12 +5156,19 @@ HRESULT WINAPI extReleaseP(LPDIRECTDRAWPALETTE lpddPalette) ULONG ref; ref = (*pReleaseP)(lpddPalette); - OutTraceDDRAW("Release(P): lpddPalette=%x ref=%x\n", lpddPalette, ref); - if(lpddPalette==lpDDP && ref==0){ - OutTraceDW("Release(P): clearing lpDDP=%x->NULL\n", lpDDP); - lpDDP=NULL; + + if (lpddPalette == lpDDP) { + OutTraceDW("Release(P): lpDDP extrarefcount=%d\n", iDDPExtraRefCounter); + ref -= iDDPExtraRefCounter; + if (ref <= 0) { + ref = 0; + OutTraceDW("Release(P): clearing lpDDP=%x->NULL\n", lpDDP); + lpDDP=NULL; + } + if(dxw.dwFlags4 & RETURNNULLREF) ref = 0; } + return ref; } diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 56f8f1e..ffd5170 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . #include "TlHelp32.h" -#define VERSION "2.03.54" +#define VERSION "2.03.54.fix2" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 997cf29..bcb2651 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 4c9c8d3..22e6134 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -783,6 +783,9 @@ UINT WINAPI extGetSystemPaletteUse(HDC hdc) UINT res; OutTraceDW("GDI.GetSystemPaletteUse: hdc=%x\n", hdc); res=(*pGetSystemPaletteUse)(hdc); + + if((res == SYSPAL_ERROR) && (dxw.dwFlags6 & SYNCPALETTE)) res = SYSPAL_NOSTATIC; + OutTraceDW("GetSystemPaletteUse: res=%x(%s)\n", res, ExplainPaletteUse(res)); return res; } diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index 476052a..9634d16 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -30,7 +30,11 @@ typedef HRESULT (WINAPI *Initialize_Type)(void *); typedef HRESULT (WINAPI *EnumDevices_Type)(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); typedef HRESULT (WINAPI *EnumDevices7_Type)(void *, LPD3DENUMDEVICESCALLBACK7, LPVOID); typedef HRESULT (WINAPI *CreateLight_Type)(void *, LPDIRECT3DLIGHT *, IUnknown *); -typedef HRESULT (WINAPI *CreateMaterial_Type)(void *, LPDIRECT3DMATERIAL *, IUnknown *); +#ifdef TRACEMATERIAL +typedef HRESULT (WINAPI *CreateMaterial1_Type)(void *, LPDIRECT3DMATERIAL *, IUnknown *); +typedef HRESULT (WINAPI *CreateMaterial2_Type)(void *, LPDIRECT3DMATERIAL2 *, IUnknown *); +typedef HRESULT (WINAPI *CreateMaterial3_Type)(void *, LPDIRECT3DMATERIAL3 *, IUnknown *); +#endif typedef HRESULT (WINAPI *CreateViewport1_Type)(void *, LPDIRECT3DVIEWPORT *, IUnknown *); typedef HRESULT (WINAPI *CreateViewport2_Type)(void *, LPDIRECT3DVIEWPORT2 *, IUnknown *); typedef HRESULT (WINAPI *CreateViewport3_Type)(void *, LPDIRECT3DVIEWPORT3 *, IUnknown *); @@ -45,7 +49,11 @@ Initialize_Type pInitialize = NULL; EnumDevices_Type pEnumDevices = NULL; EnumDevices7_Type pEnumDevices7 = NULL; CreateLight_Type pCreateLight = NULL; -CreateMaterial_Type pCreateMaterial = NULL; +#ifdef TRACEMATERIAL +CreateMaterial1_Type pCreateMaterial1 = NULL; +CreateMaterial2_Type pCreateMaterial2 = NULL; +CreateMaterial3_Type pCreateMaterial3 = NULL; +#endif CreateViewport1_Type pCreateViewport1 = NULL; CreateViewport2_Type pCreateViewport2 = NULL; CreateViewport3_Type pCreateViewport3 = NULL; @@ -114,8 +122,6 @@ SwapTextureHandles2_Type pSwapTextureHandles2 = NULL; typedef HRESULT (WINAPI *InitializeVP_Type)(void *, LPDIRECT3D); typedef HRESULT (WINAPI *SetViewport_Type)(void *, LPD3DVIEWPORT); -typedef HRESULT (WINAPI *SetMaterial_Type)(void *, LPD3DMATERIAL); -typedef HRESULT (WINAPI *GetMaterial_Type)(void *, LPD3DMATERIAL); typedef HRESULT (WINAPI *GetViewport_Type)(void *, LPD3DVIEWPORT); typedef HRESULT (WINAPI *GetViewport2_Type)(void *, LPD3DVIEWPORT); typedef HRESULT (WINAPI *SetViewport2_Type)(void *, LPD3DVIEWPORT); @@ -129,10 +135,15 @@ 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); +#ifdef TRACEMATERIAL +// IDirect3DMaterial interfaces + +typedef HRESULT (WINAPI *SetMaterial_Type)(void *, LPD3DMATERIAL); +typedef HRESULT (WINAPI *GetMaterial_Type)(void *, LPD3DMATERIAL); +#endif + InitializeVP_Type pInitializeVP = NULL; SetViewport_Type pSetViewport = NULL; -SetMaterial_Type pSetMaterial = NULL; -GetMaterial_Type pGetMaterial = NULL; GetViewport_Type pGetViewport = NULL; GetViewport2_Type pGetViewport2 = NULL; SetViewport2_Type pSetViewport2 = NULL; @@ -146,11 +157,20 @@ DeleteViewport2_Type pDeleteViewport2 = NULL; NextViewport2_Type pNextViewport2 = NULL; ViewportClear_Type pViewportClear = NULL; +#ifdef TRACEMATERIAL +SetMaterial_Type pSetMaterial = NULL; +GetMaterial_Type pGetMaterial = NULL; +#endif + HRESULT WINAPI extInitialize(void *); HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); HRESULT WINAPI extEnumDevices7(void *, LPD3DENUMDEVICESCALLBACK7, LPVOID); HRESULT WINAPI extCreateLight(void *, LPDIRECT3DLIGHT *, IUnknown *); -HRESULT WINAPI extCreateMaterial(void *, LPDIRECT3DMATERIAL *, IUnknown *); +#ifdef TRACEMATERIAL +HRESULT WINAPI extCreateMaterial1(void *, LPDIRECT3DMATERIAL *, IUnknown *); +HRESULT WINAPI extCreateMaterial2(void *, LPDIRECT3DMATERIAL2 *, IUnknown *); +HRESULT WINAPI extCreateMaterial3(void *, LPDIRECT3DMATERIAL3 *, IUnknown *); +#endif HRESULT WINAPI extCreateViewport1(void *, LPDIRECT3DVIEWPORT *, IUnknown *); HRESULT WINAPI extCreateViewport2(void *, LPDIRECT3DVIEWPORT2 *, IUnknown *); HRESULT WINAPI extCreateViewport3(void *, LPDIRECT3DVIEWPORT3 *, IUnknown *); @@ -167,8 +187,10 @@ HRESULT WINAPI extViewportClear(void *, DWORD, LPD3DRECT, DWORD); HRESULT WINAPI extInitializeVP(void *, LPDIRECT3D); HRESULT WINAPI extSetViewport(void *, LPD3DVIEWPORT); HRESULT WINAPI extGetViewport(void *, LPD3DVIEWPORT); +#ifdef TRACEMATERIAL HRESULT WINAPI extSetMaterial(void *, LPD3DMATERIAL); HRESULT WINAPI extGetMaterial(void *, LPD3DMATERIAL); +#endif HRESULT WINAPI extQueryInterfaceD3(void *, REFIID, LPVOID *); HRESULT WINAPI extQueryInterfaceD3D(void *, REFIID, LPVOID *); @@ -382,7 +404,9 @@ void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int d3dversion) SetHook((void *)(**(DWORD **)lplpdd + 12), extInitialize, (void **)&pInitialize, "Initialize(1)"); SetHook((void *)(**(DWORD **)lplpdd + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateLight, (void **)&pCreateLight, "CreateLight"); - SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); +#ifdef TRACEMATERIAL + SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateMaterial1, (void **)&pCreateMaterial1, "CreateMaterial(1)"); +#endif SetHook((void *)(**(DWORD **)lplpdd + 28), extCreateViewport1, (void **)&pCreateViewport1, "CreateViewport(1)"); SetHook((void *)(**(DWORD **)lplpdd + 32), extFindDevice, (void **)&pFindDevice, "FindDevice"); break; @@ -390,7 +414,9 @@ void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int d3dversion) SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)"); SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices(2)"); SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); - SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); +#ifdef TRACEMATERIAL + SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial2, (void **)&pCreateMaterial2, "CreateMaterial(2)"); +#endif SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateViewport2, (void **)&pCreateViewport2, "CreateViewport(2)"); SetHook((void *)(**(DWORD **)lplpdd + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); SetHook((void *)(**(DWORD **)lplpdd + 32), extCreateDevice2, (void **)&pCreateDevice2, "CreateDevice(D3D2)"); @@ -399,7 +425,9 @@ void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int d3dversion) SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD3, (void **)&pQueryInterfaceD3, "QueryInterface(D3S)"); SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices(3)"); SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); - SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); +#ifdef TRACEMATERIAL + SetHook((void *)(**(DWORD **)lplpdd + 20), extCreateMaterial3, (void **)&pCreateMaterial3, "CreateMaterial(3)"); +#endif SetHook((void *)(**(DWORD **)lplpdd + 24), extCreateViewport3, (void **)&pCreateViewport3, "CreateViewport(3)"); SetHook((void *)(**(DWORD **)lplpdd + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); SetHook((void *)(**(DWORD **)lplpdd + 32), extCreateDevice3, (void **)&pCreateDevice3, "CreateDevice(D3D3)"); @@ -563,6 +591,7 @@ void HookViewport(LPDIRECT3DVIEWPORT *lpViewport, int d3dversion) } } +#ifdef TRACEMATERIAL void HookMaterial(LPDIRECT3DMATERIAL *lpMaterial, int d3dversion) { OutTraceD3D("HookMaterial: Material=%x d3dversion=%d\n", *lpMaterial, d3dversion); @@ -578,6 +607,7 @@ void HookMaterial(LPDIRECT3DMATERIAL *lpMaterial, int d3dversion) break; } } +#endif void HookTexture(LPVOID *lpTexture, int version) { @@ -618,21 +648,27 @@ HRESULT WINAPI extQueryInterfaceD3(void *lpd3d, REFIID riid, LPVOID *ppvObj) SetHook((void *)(**(DWORD **)ppvObj + 12), extInitialize, (void **)&pInitialize, "Initialize"); SetHook((void *)(**(DWORD **)ppvObj + 16), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateLight, (void **)&pCreateLight, "CreateLight"); - SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); +#ifdef TRACEMATERIAL + SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateMaterial1, (void **)&pCreateMaterial1, "CreateMaterial(1)"); +#endif SetHook((void *)(**(DWORD **)ppvObj + 28), extCreateViewport1, (void **)&pCreateViewport1, "CreateViewport(1)"); SetHook((void *)(**(DWORD **)ppvObj + 32), extFindDevice, (void **)&pFindDevice, "FindDevice"); break; case 2: SetHook((void *)(**(DWORD **)ppvObj + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); SetHook((void *)(**(DWORD **)ppvObj + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); - SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); +#ifdef TRACEMATERIAL + SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateMaterial2, (void **)&pCreateMaterial2, "CreateMaterial(2)"); +#endif SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateViewport2, (void **)&pCreateViewport2, "CreateViewport(2)"); SetHook((void *)(**(DWORD **)ppvObj + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); break; case 3: SetHook((void *)(**(DWORD **)ppvObj + 12), extEnumDevices, (void **)&pEnumDevices, "EnumDevices"); SetHook((void *)(**(DWORD **)ppvObj + 16), extCreateLight, (void **)&pCreateLight, "CreateLight"); - SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateMaterial, (void **)&pCreateMaterial, "CreateMaterial"); +#ifdef TRACEMATERIAL + SetHook((void *)(**(DWORD **)ppvObj + 20), extCreateMaterial3, (void **)&pCreateMaterial3, "CreateMaterial(3)"); +#endif SetHook((void *)(**(DWORD **)ppvObj + 24), extCreateViewport3, (void **)&pCreateViewport3, "CreateViewport(3)"); SetHook((void *)(**(DWORD **)ppvObj + 28), extFindDevice, (void **)&pFindDevice, "FindDevice"); break; @@ -778,18 +814,44 @@ HRESULT WINAPI extCreateLight(void *lpd3d, LPDIRECT3DLIGHT *lpLight, IUnknown *p return res; } -HRESULT WINAPI extCreateMaterial(void *lpd3d, LPDIRECT3DMATERIAL *lpMaterial, IUnknown *p0) +#ifdef TRACEMATERIAL +HRESULT WINAPI extCreateMaterial1(void *lpd3d, LPDIRECT3DMATERIAL *lpMaterial, IUnknown *p0) { HRESULT res; - OutTraceD3D("CreateMaterial: d3d=%x\n", lpd3d); - res=(*pCreateMaterial)(lpd3d, lpMaterial, p0); + OutTraceD3D("CreateMaterial(1): d3d=%x\n", lpd3d); + res=(*pCreateMaterial1)(lpd3d, lpMaterial, p0); if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); else OutTraceD3D("CreateMaterial: OK\n"); HookMaterial(lpMaterial, GD3DDeviceVersion); return res; } +HRESULT WINAPI extCreateMaterial2(void *lpd3d, LPDIRECT3DMATERIAL2 *lpMaterial, IUnknown *p0) +{ + HRESULT res; + + OutTraceD3D("CreateMaterial(2): d3d=%x\n", lpd3d); + res=(*pCreateMaterial2)(lpd3d, lpMaterial, p0); + if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD3D("CreateMaterial: OK\n"); + //HookMaterial(lpMaterial, GD3DDeviceVersion); + return res; +} + +HRESULT WINAPI extCreateMaterial3(void *lpd3d, LPDIRECT3DMATERIAL3 *lpMaterial, IUnknown *p0) +{ + HRESULT res; + + OutTraceD3D("CreateMaterial(1): d3d=%x\n", lpd3d); + res=(*pCreateMaterial3)(lpd3d, lpMaterial, p0); + if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + else OutTraceD3D("CreateMaterial: OK\n"); + //HookMaterial(lpMaterial, GD3DDeviceVersion); + return res; +} +#endif + HRESULT WINAPI extCreateViewport1(void *lpd3d, LPDIRECT3DVIEWPORT *lpViewport, IUnknown *p0) { HRESULT res; @@ -1412,6 +1474,7 @@ HRESULT WINAPI extSetTexture7(void *d3dd, DWORD flags, LPDIRECTDRAWSURFACE7 lpte return res; } +#ifdef TRACEMATERIAL HRESULT WINAPI extSetMaterial(void *d3dd, LPD3DMATERIAL lpMaterial) { HRESULT res; @@ -1450,6 +1513,7 @@ HRESULT WINAPI extGetMaterial(void *d3dd, LPD3DMATERIAL lpMaterial) } return res; } +#endif HRESULT WINAPI extSwapTextureHandles(void *d3dd, LPDIRECT3DTEXTURE t1, LPDIRECT3DTEXTURE t2) { diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 125f4fd..a9db6cc 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 0fa70e1..18b8d47 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -2166,7 +2166,10 @@ void CDxwndhostView::OnRun() if(i<0) i=0; } else { - if(!listctrl.GetSelectedCount()) return; + if(!listctrl.GetSelectedCount()) { + IsLocked = FALSE; + return; + } pos = listctrl.GetFirstSelectedItemPosition(); i = listctrl.GetNextSelectedItem(pos); }