diff --git a/Release/-dxwnd.dll b/Release/-dxwnd.dll new file mode 100644 index 0000000..bba0326 --- /dev/null +++ b/Release/-dxwnd.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f65c1e7993261840d66b4fed49ccf914a83f3a90b8e269f0cb9bff6464713c25 +size 648704 diff --git a/Release/.gitattributes b/Release/.gitattributes new file mode 100644 index 0000000..b110a24 --- /dev/null +++ b/Release/.gitattributes @@ -0,0 +1 @@ +*.{dll,exe} filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/Release/dxwnd.ini b/Release/dxwnd.ini new file mode 100644 index 0000000..9217f22 --- /dev/null +++ b/Release/dxwnd.ini @@ -0,0 +1,66 @@ +[window] +posx=1089 +posy=686 +sizx=554 +sizy=320 +exepath=D:\Games\Moto Racer 2 (GOG)\ +exportpath=D:\DxWnd\exports\ +[target] +title0=Battlezone (1998) +path0=D:\Games\Battlezone\bzone.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=-1608515533 +flagg0=1241513984 +flagh0=98320 +flagi0=138412036 +flagj0=4224 +flagk0=0 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=150 +posy0=150 +sizx0=880 +sizy0=660 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 +title1=Moto Racer 2 (GOG) +path1=D:\Games\Moto Racer 2 (GOG)\moto.exe +launchpath1=D:\Games\Moto Racer 2 (GOG)\moto.exe -noD3D +module1= +opengllib1= +notes1= +registry1= +ver1=0 +coord1=0 +flag1=681574450 +flagg1=1207959680 +flagh1=20 +flagi1=138412036 +flagj1=4224 +flagk1=327680 +flagl1=0 +flagm1=0 +tflag1=0 +dflag1=0 +posx1=50 +posy1=50 +sizx1=800 +sizy1=600 +maxfps1=0 +initts1=0 +winver1=0 +maxres1=-1 +swapeffect1=0 +maxddinterface1=7 diff --git a/Release/dxwnd.rar b/Release/dxwnd.rar new file mode 100644 index 0000000..7ceb8cf Binary files /dev/null and b/Release/dxwnd.rar differ diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 1cf05d4..8d6ef32 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3bd601d4523889f0cf019a183f5bc5476c5c03662c5f5a93a98686354056a73c -size 648704 +oid sha256:5851f8d55e160f90a240f655882cde9566c5edc132a20dff793d05746806f377 +size 649216 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 8af816f..d382450 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:740b5c2156b6965fee001072a8910fe5a3ae4523be53ac3e041723fa50361df1 +oid sha256:0c4c24c7a4b18dbcbc807d2c4d9bdf0a8dab01a0462815c337b62a2ee56aec86 size 567296 diff --git a/build/exports/A10 Cuba.dxw b/build/exports/A10 Cuba.dxw index 9052c32..4974043 100644 --- a/build/exports/A10 Cuba.dxw +++ b/build/exports/A10 Cuba.dxw @@ -27,3 +27,10 @@ notes0= flagj0=128 winver0=0 maxres0=0 +registry0= +flagk0=65536 +flagl0=0 +flagm0=0 +dflag0=0 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/Adrenix 3D.dxw b/build/exports/Adrenix 3D.dxw index 8c6b0c0..c5e338b 100644 --- a/build/exports/Adrenix 3D.dxw +++ b/build/exports/Adrenix 3D.dxw @@ -27,5 +27,10 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 -flagk0=0 +flagk0=65536 swapeffect0=0 +registry0= +flagl0=0 +flagm0=0 +dflag0=0 +maxddinterface0=7 diff --git a/build/exports/Black & White.dxw b/build/exports/Black & White.dxw index 8cc344b..80dc709 100644 --- a/build/exports/Black & White.dxw +++ b/build/exports/Black & White.dxw @@ -27,3 +27,10 @@ maxres0=0 launchpath0= notes0= flagj0=128 +registry0= +flagk0=65536 +flagl0=0 +flagm0=0 +dflag0=0 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/Mageslayer.dxw b/build/exports/Mageslayer.dxw index 390d092..5b8e209 100644 --- a/build/exports/Mageslayer.dxw +++ b/build/exports/Mageslayer.dxw @@ -9,7 +9,7 @@ flag0=134234146 flagg0=1476395040 flagh0=20 flagi0=4194305 -tflag0=64 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -27,3 +27,10 @@ notes0=May require "by default set no ALPHACHENNAL" if monitor doesn't support m flagj0=128 winver0=0 maxres0=0 +registry0= +flagk0=65536 +flagl0=0 +flagm0=0 +dflag0=0 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/Magic & Mayhem.dxw b/build/exports/Magic & Mayhem.dxw index acf7575..0d91920 100644 --- a/build/exports/Magic & Mayhem.dxw +++ b/build/exports/Magic & Mayhem.dxw @@ -3,13 +3,13 @@ title0=Magic & Mayhem path0=D:\Games\Magic_&_Mayhem\Chaos.exe module0= opengllib0= -ver0=0 +ver0=1 coord0=0 -flag0=138428450 +flag0=683687978 flagg0=1275068416 flagh0=20 flagi0=4194304 -tflag0=259 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -29,3 +29,8 @@ notes0= flagj0=128 flagk0=0 swapeffect0=0 +registry0= +flagl0=0 +flagm0=0 +dflag0=0 +maxddinterface0=4 diff --git a/build/exports/Martian Gothic Unification.dxw b/build/exports/Martian Gothic Unification.dxw index f31d8d2..651a152 100644 --- a/build/exports/Martian Gothic Unification.dxw +++ b/build/exports/Martian Gothic Unification.dxw @@ -5,10 +5,10 @@ module0= opengllib0= ver0=0 coord0=0 -flag0=134217760 +flag0=134217762 flagg0=1207959552 flagh0=20 -flagi0=4 +flagi0=4194308 tflag0=0 initx0=0 inity0=0 @@ -22,3 +22,15 @@ sizx0=800 sizy0=600 maxfps0=0 initts0=0 +launchpath0= +notes0= +registry0= +flagj0=0 +flagk0=65536 +flagl0=0 +flagm0=0 +dflag0=0 +winver0=0 +maxres0=0 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/Moto Racer 2 (GOG sw mode).dxw b/build/exports/Moto Racer 2 (GOG sw mode).dxw new file mode 100644 index 0000000..dfbf61f --- /dev/null +++ b/build/exports/Moto Racer 2 (GOG sw mode).dxw @@ -0,0 +1,30 @@ +[target] +title0=Moto Racer 2 (GOG) +path0=D:\Games\Moto Racer 2 (GOG)\moto.exe +launchpath0=D:\Games\Moto Racer 2 (GOG)\moto.exe -noD3D +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574434 +flagg0=1207959680 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=327680 +flagl0=0 +flagm0=0 +tflag0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/Restricted Area.dxw b/build/exports/Restricted Area.dxw new file mode 100644 index 0000000..15a175f --- /dev/null +++ b/build/exports/Restricted Area.dxw @@ -0,0 +1,29 @@ +[target] +title0=Restricted Area +path0=D:\Games\Restricted Area\Ra.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574440 +flagg0=1744830464 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=65536 +flagl0=0 +flagm0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/Road Rash.dxw b/build/exports/Road Rash.dxw index 1f00af9..0268230 100644 --- a/build/exports/Road Rash.dxw +++ b/build/exports/Road Rash.dxw @@ -7,7 +7,7 @@ opengllib0= notes0= ver0=0 coord0=0 -flag0=134217762 +flag0=134217770 flagg0=1744830464 flagh0=1040 flagi0=1212153860 @@ -30,3 +30,7 @@ maxres0=-1 flagk0=0 swapeffect0=0 registry0=[HKEY_LOCAL_MACHINE\SOFTWARE]\n\n; Road Rash\n\n[HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Arts]\n[HKEY_LOCAL_MACHINE\SOFTWARE\Electronic Arts\RoadRash 95]\n""=""\n"Path"="."\n"CheckDialup"=hex:00\n"ChatState"=hex:02\n"MiniDash"=hex:00\n"OpponentList"=hex:01\n +flagl0=0 +flagm0=0 +dflag0=0 +maxddinterface0=7 diff --git a/build/exports/Sports Car GT Demo.dxw b/build/exports/Sports Car GT Demo.dxw new file mode 100644 index 0000000..899051f --- /dev/null +++ b/build/exports/Sports Car GT Demo.dxw @@ -0,0 +1,29 @@ +[target] +title0=Sports Car GT Demo +path0=D:\Games\Sports Car GT Demo\Spcar.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136331298 +flagg0=1207959552 +flagh0=20 +flagi0=136445956 +flagj0=2101376 +flagk0=65536 +flagl0=0 +flagm0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/The Westerner.dxw b/build/exports/The Westerner.dxw new file mode 100644 index 0000000..42dd7fc --- /dev/null +++ b/build/exports/The Westerner.dxw @@ -0,0 +1,29 @@ +[target] +title0=The Westerner +path0=D:\Games\The Westerner\PICTuRE.exe +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=136315426 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=268500992 +flagl0=0 +flagm0=0 +dflag0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 +maxddinterface0=7 diff --git a/build/exports/dxwnd.ini b/build/exports/dxwnd.ini deleted file mode 100644 index 213d79a..0000000 --- a/build/exports/dxwnd.ini +++ /dev/null @@ -1,35 +0,0 @@ -[window] -posx=981 -posy=578 -sizx=320 -sizy=200 -exportpath=D:\DxWnd\exports\ -[target] -title0=Imperialism -path0=D:\Games\Imperialism\Imperialism.exe -launchpath0= -module0= -opengllib0= -notes0=Note:\nMap zooming is currently not workind. Do not click on the magnifying glass, \nor the game will crash. -registry0= -ver0=0 -coord0=0 -flag0=1746935851 -flagg0=1207959553 -flagh0=20 -flagi0=4194308 -flagj0=128 -flagk0=262144 -flagl0=4 -flagm0=0 -tflag0=-2147477245 -posx0=50 -posy0=50 -sizx0=800 -sizy0=600 -maxfps0=0 -initts0=0 -winver0=0 -maxres0=-1 -swapeffect0=0 -maxddinterface0=7 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 77d514e..ab36c6a 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1101,4 +1101,9 @@ fix: X,Y starting win position can now be negative integer (in multimonitor syst v2.03.66 fix: terminated the separation between ddraw method interfaces -fix: force clipper now builds a clipper for the real primary surface (useful when desktop composition is disabled) \ No newline at end of file +fix: force clipper now builds a clipper for the real primary surface (useful when desktop composition is disabled and on XP) + +v2.03.67 +fix: D3D7 hooks to make NBA2002 working +fix: better virtual color depth settings to allow "Moto Racer 2" believe it is running on a fake 16bpp desktop +fix: GUI placement coordinates are not saved when terminating in minimized or maximized state \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 8b4dfd6..940c02a 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -89,8 +89,8 @@ HRESULT WINAPI extWaitForVerticalBlank4(LPDIRECTDRAW, DWORD, HANDLE); HRESULT WINAPI extWaitForVerticalBlank7(LPDIRECTDRAW, DWORD, HANDLE); /*** Added in the V2 Interface ***/ HRESULT WINAPI extGetAvailableVidMem2(LPDIRECTDRAW, LPDDSCAPS, LPDWORD, LPDWORD); -HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW, LPDDSCAPS, LPDWORD, LPDWORD); -HRESULT WINAPI extGetAvailableVidMem7(LPDIRECTDRAW, LPDDSCAPS, LPDWORD, LPDWORD); +HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW, LPDDSCAPS2, LPDWORD, LPDWORD); +HRESULT WINAPI extGetAvailableVidMem7(LPDIRECTDRAW, LPDDSCAPS2, LPDWORD, LPDWORD); /*** Added in the V4 Interface ***/ HRESULT WINAPI extTestCooperativeLevel4(LPDIRECTDRAW); HRESULT WINAPI extTestCooperativeLevel7(LPDIRECTDRAW); @@ -283,7 +283,8 @@ SetDisplayMode1_Type pSetDisplayMode1; SetDisplayMode2_Type pSetDisplayMode2, pSetDisplayMode4, pSetDisplayMode7; WaitForVerticalBlank_Type pWaitForVerticalBlank1, pWaitForVerticalBlank2, pWaitForVerticalBlank4, pWaitForVerticalBlank7; GetSurfaceFromDC_Type pGetSurfaceFromDC; -GetAvailableVidMem_Type pGetAvailableVidMem2, pGetAvailableVidMem4, pGetAvailableVidMem7; +GetAvailableVidMem_Type pGetAvailableVidMem2; +GetAvailableVidMem4_Type pGetAvailableVidMem4, pGetAvailableVidMem7; RestoreAllSurfaces_Type pRestoreAllSurfaces; TestCooperativeLevel_Type pTestCooperativeLevel4, pTestCooperativeLevel7; GetDeviceIdentifier_Type pGetDeviceIdentifier; @@ -619,6 +620,7 @@ void InitDSScreenParameters(int dxversion, LPDIRECTDRAWSURFACE lpdds) void InitScreenParameters(int dxversion) { + extern void FixPixelFormat(int , DDPIXELFORMAT *); DEVMODE CurrDevMode; static int DoOnce = FALSE; @@ -642,6 +644,8 @@ void InitScreenParameters(int dxversion) // initialize to default null values, but dwRGBBitCount dxw.ActualPixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; dxw.VirtualPixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; // until set differently + if(dxw.dwFlags2 & INIT8BPP) FixPixelFormat(8, &dxw.VirtualPixelFormat); + if(dxw.dwFlags2 & INIT16BPP) FixPixelFormat(16, &dxw.VirtualPixelFormat); OutTraceDW("InitScreenParameters: dxversion=%d RGBBitCount=%d\n", dxversion, CurrDevMode.dmBitsPerPel); SetBltTransformations(dxversion); @@ -1616,6 +1620,16 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I if(lpPrimaryDD==NULL) lpPrimaryDD=*lplpdd; // do not override the value set when creating the primary surface! bFlippedDC = FALSE; // v02.03.30 +#ifdef AUTOSETCOOPERATIVELEVEL + OutTrace("Setting cooperative level version=%d hwnd=%x\n", dxw.dwDDVersion, dxw.GethWnd()); + switch(dxw.dwDDVersion){ + case 1: res=(*pSetCooperativeLevel1)(*lplpdd, dxw.GethWnd(), DDSCL_NORMAL); break; + case 2: res=(*pSetCooperativeLevel2)(*lplpdd, dxw.GethWnd(), DDSCL_NORMAL); break; + case 4: res=(*pSetCooperativeLevel4)(*lplpdd, dxw.GethWnd(), DDSCL_NORMAL); break; + case 7: res=(*pSetCooperativeLevel7)(*lplpdd, dxw.GethWnd(), DDSCL_NORMAL); break; + } + if(res) OutTraceE("SetCooperativeLevel ERROR: err=%x(%s)\n", res, ExplainDDError(res)); +#endif return DD_OK; } @@ -2087,24 +2101,13 @@ HRESULT WINAPI extGetDisplayMode(GetDisplayMode_Type pGetDisplayMode, LPDIRECTDR } HRESULT WINAPI extGetDisplayMode1(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) -{ - return extGetDisplayMode(pGetDisplayMode1, lpdd, lpddsd); -} - +{ return extGetDisplayMode(pGetDisplayMode1, lpdd, lpddsd); } HRESULT WINAPI extGetDisplayMode2(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) -{ - return extGetDisplayMode(pGetDisplayMode2, lpdd, lpddsd); -} - +{ return extGetDisplayMode(pGetDisplayMode2, lpdd, lpddsd); } HRESULT WINAPI extGetDisplayMode4(LPDIRECTDRAW lpdd, LPDDSURFACEDESC2 lpddsd) -{ - return extGetDisplayMode((GetDisplayMode_Type)pGetDisplayMode4, lpdd, (LPDDSURFACEDESC)lpddsd); -} - +{ return extGetDisplayMode((GetDisplayMode_Type)pGetDisplayMode4, lpdd, (LPDDSURFACEDESC)lpddsd); } HRESULT WINAPI extGetDisplayMode7(LPDIRECTDRAW lpdd, LPDDSURFACEDESC2 lpddsd) -{ - return extGetDisplayMode((GetDisplayMode_Type)pGetDisplayMode7, lpdd, (LPDDSURFACEDESC)lpddsd); -} +{ return extGetDisplayMode((GetDisplayMode_Type)pGetDisplayMode7, lpdd, (LPDDSURFACEDESC)lpddsd); } HRESULT WINAPI extSetCooperativeLevel(int dxversion, SetCooperativeLevel_Type pSetCooperativeLevel, LPDIRECTDRAW lpdd, HWND hwnd, DWORD dwflags) { @@ -2329,8 +2332,7 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa dxwss.PopSurface(lpDDSEmu_Prim); if (dxw.dwFlags3 & FORCECLIPPER){ - OutTraceDW("CreateSurface: FORCE SetClipper on primary hwnd=%x lpdds=%x\n", - dxw.GethWnd(), lpDDSEmu_Prim); + OutTraceDW("CreateSurface: FORCE SetClipper on primary hwnd=%x lpdds=%x\n", dxw.GethWnd(), lpDDSEmu_Prim); res=lpdd->CreateClipper(0, &lpddC, NULL); if (res) OutTraceE("CreateSurface: CreateClipper ERROR res=%x(%s)\n", res, ExplainDDError(res)); res=lpddC->SetHWnd(0, dxw.GethWnd()); @@ -5657,14 +5659,14 @@ HRESULT WINAPI extDDSetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDG return ret; } -static HRESULT WINAPI extGetAvailableVidMem(GetAvailableVidMem_Type pGetAvailableVidMem, LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) +static HRESULT WINAPI extGetAvailableVidMem(int dxversion, GetAvailableVidMem4_Type pGetAvailableVidMem, LPDIRECTDRAW lpdd, LPDDSCAPS2 lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) { HRESULT res; //const DWORD dwMaxMem = 0x7FFFF000; // v03.01.01: limit to smaller value to allow "Breath of Fire IV" card detection const DWORD dwMaxMem = 0x70000000; const DWORD dwHugeMem = 0xF0000000; - OutTraceDDRAW("GetAvailableVidMem(D): lpdd=%x\n", lpdd); + OutTraceDDRAW("GetAvailableVidMem(D%d): lpdd=%x\n", dxversion, lpdd); res=(*pGetAvailableVidMem)(lpdd, lpDDSCaps, lpdwTotal, lpdwFree); if(res){ if((dxw.dwFlags3 & FORCESHEL) && (res==DDERR_NODIRECTDRAWHW)){ @@ -5678,8 +5680,17 @@ static HRESULT WINAPI extGetAvailableVidMem(GetAvailableVidMem_Type pGetAvailabl return res; } - OutTraceDW("GetAvailableVidMem(D): DDSCaps=%x(%s) Total=%x Free=%x\n", - *lpDDSCaps, ExplainDDSCaps(lpDDSCaps->dwCaps), lpdwTotal?*lpdwTotal:0, lpdwFree?*lpdwFree:0); + if(dxversion == 2){ + OutTraceDW("GetAvailableVidMem(D2): DDSCaps=%x(%s) Total=%x Free=%x\n", + lpDDSCaps->dwCaps, ExplainDDSCaps(lpDDSCaps->dwCaps), lpdwTotal?*lpdwTotal:0, lpdwFree?*lpdwFree:0); + } + else{ + OutTraceDW("GetAvailableVidMem(D%d): DDSCaps=%x(%s).%x.%x.%x volumedepth=%d Total=%x Free=%x\n", + dxversion, + lpDDSCaps->dwCaps, ExplainDDSCaps(lpDDSCaps->dwCaps), + lpDDSCaps->dwCaps2, lpDDSCaps->dwCaps3, lpDDSCaps->dwCaps4, lpDDSCaps->dwVolumeDepth, + lpdwTotal?*lpdwTotal:0, lpdwFree?*lpdwFree:0); + } if(!(dxw.dwFlags2 & LIMITRESOURCES)) return res; @@ -5714,12 +5725,11 @@ static HRESULT WINAPI extGetAvailableVidMem(GetAvailableVidMem_Type pGetAvailabl } HRESULT WINAPI extGetAvailableVidMem2(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) -{ return extGetAvailableVidMem(pGetAvailableVidMem2, lpdd, lpDDSCaps, lpdwTotal, lpdwFree); } -HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) -{ return extGetAvailableVidMem(pGetAvailableVidMem4, lpdd, lpDDSCaps, lpdwTotal, lpdwFree); } -HRESULT WINAPI extGetAvailableVidMem7(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) -{ return extGetAvailableVidMem(pGetAvailableVidMem7, lpdd, lpDDSCaps, lpdwTotal, lpdwFree); } - +{ return extGetAvailableVidMem(2, (GetAvailableVidMem4_Type)pGetAvailableVidMem2, lpdd, (LPDDSCAPS2)lpDDSCaps, lpdwTotal, lpdwFree); } +HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW lpdd, LPDDSCAPS2 lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) +{ return extGetAvailableVidMem(4, pGetAvailableVidMem4, lpdd, lpDDSCaps, lpdwTotal, lpdwFree); } +HRESULT WINAPI extGetAvailableVidMem7(LPDIRECTDRAW lpdd, LPDDSCAPS2 lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) +{ return extGetAvailableVidMem(7, pGetAvailableVidMem7, lpdd, lpDDSCaps, lpdwTotal, lpdwFree); } HRESULT WINAPI extSetSurfaceDesc(SetSurfaceDesc_Type pSetSurfaceDesc, LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpDDsd2, DWORD dwFlags) { diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index eb689be..b03d957 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.66" +#define VERSION "2.03.67" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 798b88b..11bb5cd 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 3172bbe..bba3bc0 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -2652,6 +2652,7 @@ int WINAPI extDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes, LPPIXE { int res; OutTraceDW("DescribePixelFormat: hdc=%x PixelFormat=%d Bytes=%d\n", hdc, iPixelFormat, nBytes); + res=(*pDescribePixelFormat)(hdc, iPixelFormat, nBytes, ppfd); if(!res){ OutTraceE("DescribePixelFormat: ERROR err=%d at=%d\n", GetLastError(), __LINE__); @@ -2663,6 +2664,48 @@ int WINAPI extDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes, LPPIXE ppfd->dwFlags, ppfd->iPixelType, ppfd->iPixelType?"PFD_TYPE_COLORINDEX":"PFD_TYPE_RGBA", ppfd->cColorBits, ppfd->cRedBits, ppfd->cGreenBits, ppfd->cBlueBits, ppfd->cRedShift, ppfd->cGreenShift, ppfd->cBlueShift); + if((hdc==0) && dxw.IsFullScreen() && (ppfd->iPixelType==PFD_TYPE_RGBA)){ + OutTraceDW("DescribePixelFormat: emulating virtual desktop pixelformat bpp=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount); + switch(dxw.VirtualPixelFormat.dwRGBBitCount){ + case 8: + ppfd->cColorBits = 8; + OutTrace("colorbits=%d to be fixed!\n", ppfd->cColorBits); + break; + case 16: + ppfd->cColorBits = 16; + switch(dxw.VirtualPixelFormat.dwGBitMask){ + case 0x0007E0: // RGB565 + ppfd->cColorBits=16; + ppfd->cRedBits=5; + ppfd->cRedShift=0; + ppfd->cGreenBits=6; + ppfd->cGreenShift=5; + ppfd->cBlueBits=5; + ppfd->cBlueShift=11; + ppfd->cAlphaBits=0; + ppfd->cAlphaShift=0; + break; + case 0x0003E0: // RGB555 + ppfd->cColorBits=15; + ppfd->cRedBits=5; + ppfd->cRedShift=0; + ppfd->cGreenBits=5; + ppfd->cGreenShift=5; + ppfd->cBlueBits=5; + ppfd->cBlueShift=10; + ppfd->cAlphaBits=1; + ppfd->cAlphaShift=15; + break; + } + break; + case 24: + if (ppfd->cColorBits != 24) OutTrace("colorbits=%d to be fixed!\n", ppfd->cColorBits); + break; + case 32: + if (ppfd->cColorBits != 24) OutTrace("colorbits=%d to be fixed!\n", ppfd->cColorBits); + break; + } + } } else { OutTraceDW("DescribePixelFormat: res=%d\n", res); diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index 6f6187e..f32a60d 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -68,7 +68,8 @@ FindDevice_Type pFindDevice = NULL; CreateDevice2_Type pCreateDevice2 = NULL; CreateDevice3_Type pCreateDevice3 = NULL; CreateDevice7_Type pCreateDevice7 = NULL; -EnumZBufferFormats_Type pEnumZBufferFormats = NULL; +EnumZBufferFormats_Type pEnumZBufferFormats3 = NULL; +EnumZBufferFormats_Type pEnumZBufferFormats7 = NULL; HRESULT WINAPI extQueryInterfaceD31(void *, REFIID, LPVOID *); HRESULT WINAPI extQueryInterfaceD32(void *, REFIID, LPVOID *); @@ -82,7 +83,8 @@ HRESULT WINAPI extCreateLight1(void *, LPDIRECT3DLIGHT *, IUnknown *); HRESULT WINAPI extCreateLight2(void *, LPDIRECT3DLIGHT *, IUnknown *); HRESULT WINAPI extCreateLight3(void *, LPDIRECT3DLIGHT *, IUnknown *); -HRESULT WINAPI extEnumZBufferFormats(void *, REFCLSID, LPD3DENUMPIXELFORMATSCALLBACK, LPVOID); +HRESULT WINAPI extEnumZBufferFormats3(void *, REFCLSID, LPD3DENUMPIXELFORMATSCALLBACK, LPVOID); +HRESULT WINAPI extEnumZBufferFormats7(void *, REFCLSID, LPD3DENUMPIXELFORMATSCALLBACK, LPVOID); // Direct3DDevice-n interfaces @@ -447,13 +449,13 @@ void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int d3dversion) 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)"); - SetHook((void *)(**(DWORD **)lplpdd + 40), extEnumZBufferFormats, (void **)&pEnumZBufferFormats, "EnumZBufferFormats(D3D)"); + SetHook((void *)(**(DWORD **)lplpdd + 40), extEnumZBufferFormats3, (void **)&pEnumZBufferFormats3, "EnumZBufferFormats(D3D3)"); break; case 7: SetHook((void *)(**(DWORD **)lplpdd + 0), extQueryInterfaceD37, (void **)&pQueryInterfaceD37, "QueryInterface(D3S7)"); SetHook((void *)(**(DWORD **)lplpdd + 12), extEnumDevices7, (void **)&pEnumDevices7, "EnumDevices(7)"); SetHook((void *)(**(DWORD **)lplpdd + 16), extCreateDevice7, (void **)&pCreateDevice7, "CreateDevice(D3D7)"); - SetHook((void *)(**(DWORD **)lplpdd + 24), extEnumZBufferFormats, (void **)&pEnumZBufferFormats, "EnumZBufferFormats(D3D3)"); + SetHook((void *)(**(DWORD **)lplpdd + 24), extEnumZBufferFormats7, (void **)&pEnumZBufferFormats7, "EnumZBufferFormats(D3D7)"); break; } } @@ -1638,7 +1640,7 @@ HRESULT WINAPI extZBufferProxy(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext) return res; } -HRESULT WINAPI extEnumZBufferFormats(void *lpd3d, REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext) +static HRESULT WINAPI extEnumZBufferFormats(EnumZBufferFormats_Type pEnumZBufferFormats, void *lpd3d, REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext) { HRESULT ret; CallbackZBufArg Arg; @@ -1650,6 +1652,11 @@ HRESULT WINAPI extEnumZBufferFormats(void *lpd3d, REFCLSID riidDevice, LPD3DENUM return ret; } +HRESULT WINAPI extEnumZBufferFormats3(void *lpd3d, REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext) +{ return extEnumZBufferFormats(pEnumZBufferFormats3, lpd3d, riidDevice, lpEnumCallback, lpContext); } +HRESULT WINAPI extEnumZBufferFormats7(void *lpd3d, REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext) +{ return extEnumZBufferFormats(pEnumZBufferFormats7, lpd3d, riidDevice, lpEnumCallback, lpContext); } + // 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 NOSYSMEMPRIMARY or NOSYSMEMBACKBUF flags diff --git a/dll/hddraw.h b/dll/hddraw.h index 54e5a48..6a2ccb2 100644 --- a/dll/hddraw.h +++ b/dll/hddraw.h @@ -46,6 +46,7 @@ typedef HRESULT (WINAPI *SetDisplayMode2_Type)(LPDIRECTDRAW, DWORD, DWORD, DWORD typedef HRESULT (WINAPI *SetDisplayMode1_Type)(LPDIRECTDRAW, DWORD, DWORD, DWORD); typedef HRESULT (WINAPI *WaitForVerticalBlank_Type)(LPDIRECTDRAW, DWORD, HANDLE); typedef HRESULT (WINAPI *GetAvailableVidMem_Type)(LPDIRECTDRAW, LPDDSCAPS, LPDWORD, LPDWORD); +typedef HRESULT (WINAPI *GetAvailableVidMem4_Type)(LPDIRECTDRAW, LPDDSCAPS2, LPDWORD, LPDWORD); typedef HRESULT (WINAPI *GetSurfaceFromDC_Type)(LPDIRECTDRAW, HDC, LPDIRECTDRAWSURFACE*); typedef HRESULT (WINAPI *RestoreAllSurfaces_Type)(LPDIRECTDRAW); typedef HRESULT (WINAPI *TestCooperativeLevel_Type)(LPDIRECTDRAW); diff --git a/host/MainFrm.cpp b/host/MainFrm.cpp index 61c60e0..13f8dcb 100644 --- a/host/MainFrm.cpp +++ b/host/MainFrm.cpp @@ -83,6 +83,7 @@ CMainFrame::~CMainFrame() rect.left = x; rect.right = x + cx; AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, 1); + x = rect.left; y = rect.top; cx = rect.right - rect.left; @@ -143,6 +144,11 @@ BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) void CMainFrame::OnMove(int x, int y) { CFrameWnd::OnMove(x, y); + WINDOWPLACEMENT wndpl; + wndpl.length = sizeof(wndpl); + this->GetWindowPlacement(&wndpl); + if(wndpl.showCmd != SW_SHOWNORMAL) return; + this->x=x; this->y=y; } @@ -150,6 +156,10 @@ void CMainFrame::OnMove(int x, int y) void CMainFrame::OnSize(UINT nType, int cx, int cy) { CFrameWnd::OnSize(nType, cx, cy); + WINDOWPLACEMENT wndpl; + wndpl.length = sizeof(wndpl); + this->GetWindowPlacement(&wndpl); + if(wndpl.showCmd != SW_SHOWNORMAL) return; this->cx=cx; this->cy=cy; } diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 8fe7e2c..9b234c3 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 85a699b..3298d7b 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 a99880b..85bafc1 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ