diff --git a/Include/dxwnd.h b/Include/dxwnd.h index cee3fd1..a479495 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -138,6 +138,7 @@ #define SUPPORTSVGA 0x00400000 // Supports SVGA standard resolutions #define SUPPORTHDTV 0x00800000 // Supports HDTV standard resolutions #define RELEASEMOUSE 0x01000000 // GetCursorPos returns centered coordinates when the mouse cursor is moved outside the window +#define FRAMECOMPENSATION 0x02000000 // Compensate for frame border adding x,y displacement of (x) left border and (y) window title bar // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 1da87e5..3065a8c 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c611f6cdccad0df1ba3b649511c7d2b439dae191fa2b7789306494873761540 -size 474112 +oid sha256:2402376ce446d1f0d06c36f3d7cfdda81e9052c03dde6bdcb0532bf9b5fc67ef +size 475648 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 1f9b9e7..3a9a89f 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c883d8d4dfc5696176aa802dd69c0c32d1e682d0672bfb24609b39e2a581950 +oid sha256:e351b8cb36d1cfc02f5a113555e75bc72da15b5054595777b85b4fac2d993b6d size 539136 diff --git a/build/dxwnd.ini b/build/dxwnd.ini new file mode 100644 index 0000000..56f6475 --- /dev/null +++ b/build/dxwnd.ini @@ -0,0 +1,5 @@ +[window] +posx=930 +posy=192 +sizx=320 +sizy=200 diff --git a/build/exports/Call To Power 2.dxw b/build/exports/Call To Power 2.dxw new file mode 100644 index 0000000..3ef24a5 --- /dev/null +++ b/build/exports/Call To Power 2.dxw @@ -0,0 +1,26 @@ +[target] +title0=Call To Power 2 +path0=D:\Games\Call To Power 2\ctp2_program\ctp\ctp2.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134234657 +flagg0=1207959552 +flagh0=32788 +flagi0=4 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Crimson Skies (DEMO).dxw b/build/exports/Crimson Skies (DEMO).dxw new file mode 100644 index 0000000..ff2c160 --- /dev/null +++ b/build/exports/Crimson Skies (DEMO).dxw @@ -0,0 +1,24 @@ +[target] +title0=Crimson Skies (DEMO) +path0=D:\Games\Crimson Skies\crimson.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=155205636 +flagg0=1210056720 +flagh0=20 +flagi0=260 +tflag0=3 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Disney Groove It.dxw b/build/exports/Disney Groove It.dxw new file mode 100644 index 0000000..df39fea --- /dev/null +++ b/build/exports/Disney Groove It.dxw @@ -0,0 +1,26 @@ +[target] +title0=Disney Groove It +path0=D:\Games\groove it\groove.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217728 +flagg0=1207959808 +flagh0=20 +flagi0=4 +tflag0=6211 +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/Empire of the Ants (ITA).dxw b/build/exports/Empire of the Ants (ITA).dxw new file mode 100644 index 0000000..8b0ba00 --- /dev/null +++ b/build/exports/Empire of the Ants (ITA).dxw @@ -0,0 +1,26 @@ +[target] +title0=Empire of the Ants (ITA) +path0=D:\Games\Empire of the Ants\Formiche.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=151011364 +flagg0=134217728 +flagh0=20 +flagi0=4 +tflag0=6467 +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/Hundred Swords.dxw b/build/exports/Hundred Swords.dxw new file mode 100644 index 0000000..7814396 --- /dev/null +++ b/build/exports/Hundred Swords.dxw @@ -0,0 +1,26 @@ +[target] +title0=Hundred Swords +path0=D:\Games\Hundred Swords\H_SWORDS.exe +module0= +opengllib0= +ver0=1 +coord0=0 +flag0=402653472 +flagg0=1212153856 +flagh0=20 +flagi0=4 +tflag0=6210 +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=4 +maxres0=-1 diff --git a/build/exports/Insane.dxw b/build/exports/Insane.dxw new file mode 100644 index 0000000..ec5c4e0 --- /dev/null +++ b/build/exports/Insane.dxw @@ -0,0 +1,27 @@ +[target] +title0=Insane +path0=D:\Games\Insane\Game.exe +launchpath0= +module0= +opengllib0= +ver0=7 +coord0=0 +flag0=134217760 +flagg0=1207959553 +flagh0=20 +flagi0=4194308 +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/Jolly Rover.dxw b/build/exports/Jolly Rover.dxw new file mode 100644 index 0000000..a00c24b --- /dev/null +++ b/build/exports/Jolly Rover.dxw @@ -0,0 +1,26 @@ +[target] +title0=Jolly Rover +path0=D:\Games\Jolly Rover\rover.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134218240 +flagg0=1207959552 +flagh0=20 +flagi0=4 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/LEGO Stunt Rally.dxw b/build/exports/LEGO Stunt Rally.dxw new file mode 100644 index 0000000..c44445b --- /dev/null +++ b/build/exports/LEGO Stunt Rally.dxw @@ -0,0 +1,27 @@ +[target] +title0=LEGO Stunt Rally +path0=D:\Games\LEGO Stunt Rally\_msr.exe +launchpath0=D:\Games\LEGO Stunt Rally\StuntRally.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217760 +flagg0=1207959552 +flagh0=20 +flagi0=4325380 +tflag0=6210 +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/MDK2.dxw b/build/exports/MDK2.dxw new file mode 100644 index 0000000..8a3a852 --- /dev/null +++ b/build/exports/MDK2.dxw @@ -0,0 +1,26 @@ +[target] +title0=MDK2 +path0=D:\Games\MDK2\mdk2Main.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217760 +flagg0=1744961536 +flagh0=20 +flagi0=4 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Mall Tycoon 3.dxw b/build/exports/Mall Tycoon 3.dxw new file mode 100644 index 0000000..0311ea5 --- /dev/null +++ b/build/exports/Mall Tycoon 3.dxw @@ -0,0 +1,26 @@ +[target] +title0=Mall Tycoon 3 +path0=D:\Games\Mall Tycoon 3\Mall3Game.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=671089184 +flagg0=1207959552 +flagh0=20 +flagi0=4194308 +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/Motocross Madness Trial.dxw b/build/exports/Motocross Madness Trial.dxw new file mode 100644 index 0000000..5ee2e35 --- /dev/null +++ b/build/exports/Motocross Madness Trial.dxw @@ -0,0 +1,26 @@ +[target] +title0=Motocross Madness Trial +path0=D:\Games\Motocross Madness Trial\mcm.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=169885728 +flagg0=134219776 +flagh0=20 +flagi0=2097156 +tflag0=6415 +initx0=0 +inity0=0 +minx0=50 +miny0=50 +maxx0=800 +maxy0=600 +posx0=0 +posy0=0 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/PC Ciclismo 2001 (HAL).dxw b/build/exports/PC Ciclismo 2001 (HAL).dxw new file mode 100644 index 0000000..bf853d0 --- /dev/null +++ b/build/exports/PC Ciclismo 2001 (HAL).dxw @@ -0,0 +1,26 @@ +[target] +title0=PC Ciclismo 2001 +path0=D:\Games\PC Ciclismo 2001\PcCiclismo.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=1207959840 +flagg0=1207959552 +flagh0=98324 +flagi0=4 +tflag0=6211 +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/PC Ciclismo 2001 (through RGB sw emulation).dxw b/build/exports/PC Ciclismo 2001 (through RGB sw emulation).dxw new file mode 100644 index 0000000..b7eae2f --- /dev/null +++ b/build/exports/PC Ciclismo 2001 (through RGB sw emulation).dxw @@ -0,0 +1,26 @@ +[target] +title0=PC Ciclismo 2001 +path0=D:\Games\PC Ciclismo 2001\PcCiclismo.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=1207959586 +flagg0=1207959552 +flagh0=98324 +flagi0=4 +tflag0=6211 +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/Prey.dxw b/build/exports/Prey.dxw new file mode 100644 index 0000000..89454d6 --- /dev/null +++ b/build/exports/Prey.dxw @@ -0,0 +1,26 @@ +[target] +title0=Prey +path0=D:\Games\Prey\prey.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1208090624 +flagh0=20 +flagi0=4 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Rites of War Demo.dxw b/build/exports/Rites of War Demo.dxw new file mode 100644 index 0000000..af513ea --- /dev/null +++ b/build/exports/Rites of War Demo.dxw @@ -0,0 +1,26 @@ +[target] +title0=Rites of War Demo +path0=D:\Games\Rites of War Demo\RoWDemo.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134234656 +flagg0=1207959680 +flagh0=20 +flagi0=4 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/SpellForce GOLD Edition.dxw b/build/exports/SpellForce GOLD Edition.dxw new file mode 100644 index 0000000..0a5c2a7 --- /dev/null +++ b/build/exports/SpellForce GOLD Edition.dxw @@ -0,0 +1,27 @@ +[target] +title0=SpellForce GOLD Edition +path0=D:\Games\SpellForce\SpellForce.exe +launchpath0= +module0= +opengllib0= +ver0=9 +coord0=0 +flag0=134218272 +flagg0=1207959552 +flagh0=20 +flagi0=4194308 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Sub Command.dxw b/build/exports/Sub Command.dxw new file mode 100644 index 0000000..ac2c053 --- /dev/null +++ b/build/exports/Sub Command.dxw @@ -0,0 +1,27 @@ +[target] +title0=Sub Command +path0=D:\Games\Sub Command\subcommand.exe +launchpath0= +module0= +opengllib0= +ver0=8 +coord0=0 +flag0=1610613345 +flagg0=1207959552 +flagh0=20 +flagi0=37748740 +tflag0=64 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=1200 +sizy0=900 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Tropico Paradise Island.dxw b/build/exports/Tropico Paradise Island.dxw new file mode 100644 index 0000000..f75cabc --- /dev/null +++ b/build/exports/Tropico Paradise Island.dxw @@ -0,0 +1,26 @@ +[target] +title0=Tropico Paradise Island +path0=D:\Games\Tropico Paradise Island\Tropico.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134218272 +flagg0=1207959552 +flagh0=20 +flagi0=4 +tflag0=1024 +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 9bcac3e..2b8f111 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -472,3 +472,6 @@ added "Launch" field (optional) to start the program with arguments or a separat v2.02.72 fix: fixed Launch field used with "Use DLL injection" flag fix: somehow improved "Use DLL injection" to avoid blocked tasks and allow exception handling + +v2.02.73 +to be written .... \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index 3d2758f..8db12d4 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -1843,7 +1843,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, dxw.SetScreenSize(dwwidth, dwheight); GetHookInfo()->Height=(short)dxw.GetScreenHeight(); GetHookInfo()->Width=(short)dxw.GetScreenWidth(); - AdjustWindowFrame(dxw.GethWnd(), dwwidth, dwheight); + if(dxw.Windowize) AdjustWindowFrame(dxw.GethWnd(), dwwidth, dwheight); if(dxw.dwFlags1 & EMULATESURFACE){ // in EMULATESURFACE mode, let SetPixFmt decide upon the PixelFormat @@ -1852,27 +1852,38 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, ddsd.dwSize=sizeof(ddsd); SetPixFmt(&ddsd); SetBltTransformations(); - OutTraceDW("SetDisplayMode: mode=EMULATE %s ret=OK\n", DumpPixelFormat(&ddsd)); - return DD_OK; + if(dxw.Windowize) { + OutTraceDW("SetDisplayMode: mode=EMULATE %s ret=OK\n", DumpPixelFormat(&ddsd)); + SetVSyncDelays(lpdd); + return DD_OK; + } + } + else{ + OutTraceDW("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp); + dxw.ActualPixelFormat.dwRGBBitCount = dwbpp; } - - OutTraceDW("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp); - dxw.ActualPixelFormat.dwRGBBitCount = dwbpp; ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = Set_dwSize_From_DDraw(lpdd); ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_REFRESHRATE; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - (*pGetDisplayMode)(lpdd, (LPDDSURFACEDESC)&ddsd); - if (version==1) - res = (*pSetDisplayMode1)(lpdd, ddsd.dwWidth, ddsd.dwHeight, dwbpp); - else - res = (*pSetDisplayMode2)(lpdd, ddsd.dwWidth, ddsd.dwHeight, dwbpp, ddsd.dwRefreshRate, 0); + + if(dxw.Windowize){ + dwwidth = ddsd.dwWidth; + dwheight = ddsd.dwHeight; + OutTraceDW("SetDisplayMode: fixing colordepth current=%d required=%d size=(%dx%d)\n", + ddsd.ddpfPixelFormat.dwRGBBitCount, dwbpp, dwwidth, dwheight); + } + if(dxw.dwFlags1 & EMULATESURFACE){ + dwbpp = ddsd.ddpfPixelFormat.dwRGBBitCount; + } - OutTraceDW("SetDisplayMode: fixing colordepth current=%d required=%d size=(%dx%d)\n", - ddsd.ddpfPixelFormat.dwRGBBitCount, dwbpp, ddsd.dwWidth, ddsd.dwHeight); + if (version==1) + res = (*pSetDisplayMode1)(lpdd, dwwidth, dwheight, dwbpp); + else + res = (*pSetDisplayMode2)(lpdd, dwwidth, dwheight, dwbpp, ddsd.dwRefreshRate, 0); SetVSyncDelays(lpdd); return 0; @@ -1899,14 +1910,17 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) GetPixFmt((LPDDSURFACEDESC2)lpddsd); if(!lpddsd->ddpfPixelFormat.dwFlags) SetPixFmt((LPDDSURFACEDESC2)lpddsd); } - lpddsd->dwWidth = dxw.GetScreenWidth(); - lpddsd->dwHeight = dxw.GetScreenHeight(); - // v2.1.96: fake screen color depth - if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix - if(dxw.dwFlags2 & INIT8BPP) FixPixelFormat(8, &lpddsd->ddpfPixelFormat); - if(dxw.dwFlags2 & INIT16BPP) FixPixelFormat(16, &lpddsd->ddpfPixelFormat); - OutTraceDW("GetDisplayMode: fix RGBBitCount=%d\n", lpddsd->ddpfPixelFormat.dwRGBBitCount); + if(dxw.Windowize){ + lpddsd->dwWidth = dxw.GetScreenWidth(); + lpddsd->dwHeight = dxw.GetScreenHeight(); + + // v2.1.96: fake screen color depth + if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix + if(dxw.dwFlags2 & INIT8BPP) FixPixelFormat(8, &lpddsd->ddpfPixelFormat); + if(dxw.dwFlags2 & INIT16BPP) FixPixelFormat(16, &lpddsd->ddpfPixelFormat); + OutTraceDW("GetDisplayMode: fix RGBBitCount=%d\n", lpddsd->ddpfPixelFormat.dwRGBBitCount); + } } //OutTraceDW("GetDisplayMode: returning WxH=(%dx%d) PixelFormat Flags=%x(%s) RGBBitCount=%d RGBAmask=(%x,%x,%x,%x) Caps=%x(%s)\n", @@ -1932,37 +1946,44 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) InitDDScreenParameters((LPDIRECTDRAW)lpdd); - if (dwflags & DDSCL_FULLSCREEN){ - // v2.01.82 fix: - // WARN: Tomb Raider 4 demo is setting cooperative level against hwnd 0 (desktop) - // so in this case better use the registered hWnd value. Same as GP500, who uses - // the desktop window handle. - // v2.02.31 fix: - // Hooligans - Storm over Europe wants to set cooperative level NORMAL to hwnd 0 - // that is legitimate, but setting against desktop window gives an error code - so - // the zero hwnd redirection had to be moved within the FULLSCREEN if case. - if(dxw.IsRealDesktop(hwnd)){ - OutTraceDW("SetCooperativeLevel: desktop hwnd=%x -> %x\n", hwnd, dxw.GethWnd()); - hwnd=dxw.GethWnd(); + if(dxw.Windowize){ + if (dwflags & DDSCL_FULLSCREEN){ + // v2.01.82 fix: + // WARN: Tomb Raider 4 demo is setting cooperative level against hwnd 0 (desktop) + // so in this case better use the registered hWnd value. Same as GP500, who uses + // the desktop window handle. + // v2.02.31 fix: + // Hooligans - Storm over Europe wants to set cooperative level NORMAL to hwnd 0 + // that is legitimate, but setting against desktop window gives an error code - so + // the zero hwnd redirection had to be moved within the FULLSCREEN if case. + if(dxw.IsRealDesktop(hwnd)){ + OutTraceDW("SetCooperativeLevel: desktop hwnd=%x -> %x\n", hwnd, dxw.GethWnd()); + hwnd=dxw.GethWnd(); + } + dxw.SetFullScreen(TRUE); + dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX); + dwflags |= DDSCL_NORMAL; + res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); + AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight()); + if (dxw.dwFlags1 & FIXWINFRAME) dxw.FixWindowFrame(hwnd); + } + else{ + RECT client; + (*pGetClientRect)(hwnd, &client); + // v2.02.11: + // Non fullscreen cooperative mode means windowed, unless the window occupies the whole desktop area + dxw.SetFullScreen(client.right==dxw.iSizX && client.bottom==dxw.iSizY); + //dxw.SetFullScreen(FALSE); + res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); } - dxw.SetFullScreen(TRUE); - dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX); - dwflags |= DDSCL_NORMAL; - res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); - AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight()); - if (dxw.dwFlags1 & FIXWINFRAME) dxw.FixWindowFrame(hwnd); } - else{ - RECT client; - (*pGetClientRect)(hwnd, &client); - // v2.02.11: - // Non fullscreen cooperative mode means windowed, unless the window occupies the whole desktop area - dxw.SetFullScreen(client.right==dxw.iSizX && client.bottom==dxw.iSizY); - //dxw.SetFullScreen(FALSE); + else { res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); } + if(res) - OutTraceE("SetCooperativeLevel: ERROR err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); + OutTraceE("SetCooperativeLevel: ERROR lpdd=%x hwnd=%x Flags=%x err=%x(%s) at %d\n", + lpdd, hwnd, dwflags, res, ExplainDDError(res), __LINE__); GetHookInfo()->IsFullScreen=dxw.IsFullScreen(); @@ -2396,8 +2417,17 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0); if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){ OutTraceDW("CreateSurface: ASSERT DDSEmu_Prim already exists\n"); - res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim); // ok only if the previous surface has the good properties!!! - (*pReleaseS)(lpDDSEmu_Prim); + if(dxw.Windowize){ + // in Winowize mode, the desktop properties are untouched, then the current primary surface can be recycled + res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim); + (*pReleaseS)(lpDDSEmu_Prim); + } + else { + // in non-Windowized mode, the primary surface must be released and rebuilt with the proper properties + res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim); + if (lpDDSEmu_Prim) while((*pReleaseS)(lpDDSEmu_Prim)); + res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0); + } } if(res){ OutTraceE("CreateSurface: ERROR on DDSEmu_Prim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); @@ -2663,6 +2693,9 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate BuildSurface_Type BuildBackBuffer; BuildSurface_Type BuildGeneric; + if(!dxw.Windowize){ + } + if (dxw.dwFlags1 & EMULATESURFACE){ BuildPrimary = BuildPrimaryEmu; BuildBackBuffer = BuildBackBufferEmu; diff --git a/dll/dxhelper.cpp b/dll/dxhelper.cpp index a2bbba1..abfe26e 100644 --- a/dll/dxhelper.cpp +++ b/dll/dxhelper.cpp @@ -955,6 +955,7 @@ char *ExplainWinMessage(DWORD c) case WM_IME_COMPOSITIONFULL: eb="WM_IME_COMPOSITIONFULL"; break; case WM_IME_SELECT: eb="WM_IME_SELECT"; break; case WM_IME_CHAR: eb="WM_IME_CHAR"; break; + case WM_IME_REQUEST: eb="WM_IME_REQUEST"; break; case WM_IME_KEYDOWN: eb="WM_IME_KEYDOWN"; break; case WM_IME_KEYUP: eb="WM_IME_KEYUP"; break; #endif /* WINVER >= 0x0400 */ diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 03fd6e8..4d7619d 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -800,8 +800,8 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp } if(dxw.dwFlags4 & STRETCHTIMERS){ - if(LastTimeShift != dxw.TimeShift) dxw.RenewTimers(); - LastTimeShift=dxw.TimeShift; + if(LastTimeShift != dxw.TimeShift) dxw.RenewTimers(); + LastTimeShift=dxw.TimeShift; } switch(message){ @@ -819,7 +819,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_NCPAINT: if((dxw.dwFlags1 & LOCKWINPOS) && (hwnd == dxw.GethWnd()) && dxw.IsFullScreen()){ // v2.02.30: don't alter child and other windows.... OutTraceDW("WindowProc: %s wparam=%x\n", ExplainWinMessage(message), wparam); - return (*pDefWindowProc)(hwnd, message, wparam, lparam); + return (*pDefWindowProcA)(hwnd, message, wparam, lparam); } break; case WM_NCCREATE: @@ -843,7 +843,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if((dxw.dwFlags2 & FIXNCHITTEST) && (dxw.dwFlags1 & MODIFYMOUSE)){ // mouse processing POINT cursor; LRESULT ret; - ret=(*pDefWindowProc)(hwnd, message, wparam, lparam); + ret=(*pDefWindowProcA)(hwnd, message, wparam, lparam); if (ret==HTCLIENT) { cursor.x=LOWORD(lparam); cursor.y=HIWORD(lparam); @@ -855,13 +855,13 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp } break; case WM_ERASEBKGND: - if(dxw.IsDesktop(hwnd)){ + if(dxw.Windowize && dxw.IsDesktop(hwnd)){ OutTraceDW("WindowProc: WM_ERASEBKGND(%x,%x) - suppressed\n", wparam, lparam); return 1; // 1 == OK, erased } break; case WM_DISPLAYCHANGE: - if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){ + if (dxw.Windowize && (dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){ OutTraceDW("WindowProc: prevent WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n", wparam, LOWORD(lparam), HIWORD(lparam)); // v2.02.43: unless EMULATESURFACE is set, lock the screen resolution only, but not the color depth! @@ -873,7 +873,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: - if(dxw.IsFullScreen()){ + if(dxw.Windowize && dxw.IsFullScreen()){ LPWINDOWPOS wp; wp = (LPWINDOWPOS)lparam; dxwFixWindowPos("WindowProc", hwnd, lparam); @@ -917,26 +917,28 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp while((*pShowCursor)(1) < 0); break; case WM_MOUSEMOVE: - prev.x = LOWORD(lparam); - prev.y = HIWORD(lparam); - if (dxw.dwFlags1 & HIDEHWCURSOR) { - (*pGetClientRect)(hwnd, &rect); - if(prev.x >= 0 && prev.x < rect.right && prev.y >= 0 && prev.y < rect.bottom) - while((*pShowCursor)(0) >= 0); - else + if(dxw.Windowize){ + prev.x = LOWORD(lparam); + prev.y = HIWORD(lparam); + if (dxw.dwFlags1 & HIDEHWCURSOR) { + (*pGetClientRect)(hwnd, &rect); + if(prev.x >= 0 && prev.x < rect.right && prev.y >= 0 && prev.y < rect.bottom) + while((*pShowCursor)(0) >= 0); + else + while((*pShowCursor)(1) < 0); + } + else { while((*pShowCursor)(1) < 0); + } + if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing + // scale mouse coordinates + curr=dxw.FixCursorPos(prev); //v2.02.30 + lparam = MAKELPARAM(curr.x, curr.y); + OutTraceC("WindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); + } + GetHookInfo()->CursorX=LOWORD(lparam); + GetHookInfo()->CursorY=HIWORD(lparam); } - else { - while((*pShowCursor)(1) < 0); - } - if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing - // scale mouse coordinates - curr=dxw.FixCursorPos(prev); //v2.02.30 - lparam = MAKELPARAM(curr.x, curr.y); - OutTraceC("WindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); - } - GetHookInfo()->CursorX=LOWORD(lparam); - GetHookInfo()->CursorY=HIWORD(lparam); break; // fall through cases: case WM_MOUSEWHEEL: @@ -949,23 +951,25 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: - if((dxw.dwFlags1 & CLIPCURSOR) && ClipCursorToggleState) dxw.SetClipCursor(); - if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing - // scale mouse coordinates - prev.x = LOWORD(lparam); - prev.y = HIWORD(lparam); - curr = prev; - if(message == WM_MOUSEWHEEL){ // v2.02.33 mousewheel fix - POINT upleft={0,0}; - (*pClientToScreen)(dxw.GethWnd(), &upleft); - curr = dxw.SubCoordinates(curr, upleft); + if(dxw.Windowize){ + if((dxw.dwFlags1 & CLIPCURSOR) && ClipCursorToggleState) dxw.SetClipCursor(); + if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing + // scale mouse coordinates + prev.x = LOWORD(lparam); + prev.y = HIWORD(lparam); + curr = prev; + if(message == WM_MOUSEWHEEL){ // v2.02.33 mousewheel fix + POINT upleft={0,0}; + (*pClientToScreen)(dxw.GethWnd(), &upleft); + curr = dxw.SubCoordinates(curr, upleft); + } + curr=dxw.FixCursorPos(curr); //v2.02.30 + lparam = MAKELPARAM(curr.x, curr.y); + OutTraceC("WindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); } - curr=dxw.FixCursorPos(curr); //v2.02.30 - lparam = MAKELPARAM(curr.x, curr.y); - OutTraceC("WindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); + GetHookInfo()->CursorX=LOWORD(lparam); + GetHookInfo()->CursorY=HIWORD(lparam); } - GetHookInfo()->CursorX=LOWORD(lparam); - GetHookInfo()->CursorY=HIWORD(lparam); break; case WM_SETFOCUS: OutTraceDW("WindowProc: hwnd=%x GOT FOCUS\n", hwnd); @@ -1051,7 +1055,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_SETCURSOR: // shows a different cursor when moving on borders case WM_NCLBUTTONDOWN: // intercepts mouse down on borders case WM_NCLBUTTONUP: // intercepts mouse up on borders - ret=(*pDefWindowProc)(hwnd, message, wparam, lparam); + ret=(*pDefWindowProcA)(hwnd, message, wparam, lparam); break; } } @@ -1066,7 +1070,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp sprintf(sMsg,"ASSERT: WindowProc mismatch hwnd=%x\n", hwnd); OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "WindowProc", MB_OK | MB_ICONEXCLAMATION); - return (*pDefWindowProc)(hwnd, message, wparam, lparam); + return (*pDefWindowProcA)(hwnd, message, wparam, lparam); } void HookSysLibsInit() @@ -1528,9 +1532,11 @@ void HookInit(TARGETMAP *target, HWND hwnd) } // make InitPosition used for both DInput and DDraw - InitPosition(target->initx, target->inity, - target->minx, target->miny, target->maxx, target->maxy); - dxw.InitWindowPos(target->posx, target->posy, target->sizx, target->sizy); + if(dxw.Windowize){ + InitPosition(target->initx, target->inity, + target->minx, target->miny, target->maxx, target->maxy); + dxw.InitWindowPos(target->posx, target->posy, target->sizx, target->sizy); + } OutTraceB("HookInit: base hmodule=%x\n", base); HookModule(base, dxw.dwTargetDDVersion); @@ -1563,14 +1569,17 @@ void HookInit(TARGETMAP *target, HWND hwnd) InitScreenParameters(); if(hwnd) HookWindowProc(hwnd); + // in fullscreen mode, messages seem to reach and get processed by the parent window + if(!dxw.Windowize && hwnd) HookWindowProc(GetParent(hwnd)); // initialize window: if // 1) not in injection mode (hwnd != 0) and - // 2) supposedly in fullscreen mode (dxw.IsFullScreen()) and - // 3) configuration ask for a overlapped bordered window (dxw.dwFlags1 & FIXWINFRAME) then + // 2) in Windowed mode and + // 3) supposedly in fullscreen mode (dxw.IsFullScreen()) and + // 4) configuration ask for a overlapped bordered window (dxw.dwFlags1 & FIXWINFRAME) then // update window styles: just this window or, when FIXPARENTWIN is set, the father one as well. - if (hwnd && dxw.IsFullScreen() && (dxw.dwFlags1 & FIXWINFRAME)) { + if (hwnd && dxw.Windowize && dxw.IsFullScreen() && (dxw.dwFlags1 & FIXWINFRAME)) { dxw.FixWindowFrame(dxw.hChildWnd); AdjustWindowPos(dxw.hChildWnd, target->sizx, target->sizy); if(dxw.dwFlags1 & FIXPARENTWIN) { diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index 9acf59d..827c689 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -64,6 +64,7 @@ void dxwCore::SetFullScreen(BOOL fs) BOOL dxwCore::IsFullScreen() { + //if(!Windowize) return FALSE; return FullScreen; } @@ -74,7 +75,8 @@ void dxwCore::InitTarget(TARGETMAP *target) dwFlags3 = target->flags3; dwFlags4 = target->flags4; dwTFlags = target->tflags; - if(dxw.dwFlags3 & FULLSCREENONLY) FullScreen=TRUE; + Windowize = (dwFlags2 & WINDOWIZE) ? TRUE : FALSE; + if(dwFlags3 & FULLSCREENONLY) FullScreen=TRUE; gsModules = target->module; MaxFPS = target->MaxFPS; CustomOpenGLLib = target->OpenGLLib; diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index 4c06acf..9961801 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -118,6 +118,7 @@ public: // methods LARGE_INTEGER StretchLargeCounter(LARGE_INTEGER); public: // simple data variables + BOOL Windowize; DDPIXELFORMAT ActualPixelFormat; DDPIXELFORMAT VirtualPixelFormat; DWORD dwDDVersion; diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 1860046..d8f7494 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.72" +#define VERSION "2.02.73" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 0a0527a..ce9e133 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp index df0c5f5..7ddbaf8 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -661,52 +661,54 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresParam) OutTrace(" PresentationInterval = 0x%x\n", *(tmp ++)); } - if(Windowed) { - // do not attempt to reset when returning to windowed mode: it is useless (you are windowed already) - // and the code below (GetDirect3D, ...) doesn't work. - OutTraceDW("SKIPPED!\n"); - return DD_OK; - } + if(dxw.Windowize){ + if(Windowed) { + // do not attempt to reset when returning to windowed mode: it is useless (you are windowed already) + // and the code below (GetDirect3D, ...) doesn't work. + OutTraceDW("SKIPPED!\n"); + return DD_OK; + } - if (dwD3DVersion == 9){ - res=(*pGetDirect3D9)(pd3dd, &pD3D); - if(res) { - OutTraceDW("GetDirect3D FAILED! %x\n", res); - return(DD_OK); + if (dwD3DVersion == 9){ + res=(*pGetDirect3D9)(pd3dd, &pD3D); + if(res) { + OutTraceDW("GetDirect3D FAILED! %x\n", res); + return(DD_OK); + } + OutTraceDW("GetDirect3D pd3d=%x\n", pD3D); + res=(*pGetAdapterDisplayMode9)(pD3D, 0, &mode); + if(res) { + OutTraceDW("GetAdapterDisplayMode FAILED! %x\n", res); + return(DD_OK); + } + param[2] = mode.Format; + param[7] = 0; //hDeviceWindow + dxw.SetFullScreen(~param[8]?TRUE:FALSE); + param[8] = 1; //Windowed + //param[11] = D3DPRESENTFLAG_DEVICECLIP; //Flags; + param[12] = 0; //FullScreen_RefreshRateInHz; + param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval } - OutTraceDW("GetDirect3D pd3d=%x\n", pD3D); - res=(*pGetAdapterDisplayMode9)(pD3D, 0, &mode); - if(res) { - OutTraceDW("GetAdapterDisplayMode FAILED! %x\n", res); - return(DD_OK); + else{ + res=(*pGetDirect3D8)(pd3dd, &pD3D); + if(res) { + OutTraceDW("GetDirect3D FAILED! %x\n", res); + return(DD_OK); + } + OutTraceDW("GetDirect3D pd3d=%x\n", pD3D); + res=(*pGetAdapterDisplayMode8)(pD3D, 0, &mode); + if(res) { + OutTraceDW("GetAdapterDisplayMode FAILED! %x\n", res); + return(DD_OK); + } + param[2] = mode.Format; + param[6] = 0; //hDeviceWindow + dxw.SetFullScreen(~param[7]?TRUE:FALSE); + param[7] = 1; //Windowed + //param[10] = D3DPRESENTFLAG_DEVICECLIP; //Flags; + param[11] = 0; //FullScreen_RefreshRateInHz; + param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval } - param[2] = mode.Format; - param[7] = 0; //hDeviceWindow - dxw.SetFullScreen(~param[8]?TRUE:FALSE); - param[8] = 1; //Windowed - //param[11] = D3DPRESENTFLAG_DEVICECLIP; //Flags; - param[12] = 0; //FullScreen_RefreshRateInHz; - param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval - } - else{ - res=(*pGetDirect3D8)(pd3dd, &pD3D); - if(res) { - OutTraceDW("GetDirect3D FAILED! %x\n", res); - return(DD_OK); - } - OutTraceDW("GetDirect3D pd3d=%x\n", pD3D); - res=(*pGetAdapterDisplayMode8)(pD3D, 0, &mode); - if(res) { - OutTraceDW("GetAdapterDisplayMode FAILED! %x\n", res); - return(DD_OK); - } - param[2] = mode.Format; - param[6] = 0; //hDeviceWindow - dxw.SetFullScreen(~param[7]?TRUE:FALSE); - param[7] = 1; //Windowed - //param[10] = D3DPRESENTFLAG_DEVICECLIP; //Flags; - param[11] = 0; //FullScreen_RefreshRateInHz; - param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval } res = (*pReset)(pd3dd, (D3DPRESENT_PARAMETERS *)param); @@ -836,43 +838,10 @@ HRESULT WINAPI extGetAdapterDisplayMode9(void *lpd3d, UINT Adapter, D3DDISPLAYMO return res; } -//HRESULT extValidateDevice(void *, DWORD *pNumPasses); -//HRESULT extGetDeviceCaps(void *, D3DCAPS9 *pCaps); -//typedef HRESULT (WINAPI *ValidateDevice_Type)(void *, DWORD *); -//typedef HRESULT (WINAPI *GetDeviceCapsD3D_Type)(void *, D3DCAPS9 *); -//ValidateDevice_Type pValidateDevice; -//GetDeviceCapsD3D_Type pGetDeviceCapsD3D; -//HRESULT extValidateDevice(void *lpd3dd, DWORD *pNumPasses) -//{ -// OutTrace("ValidateDevice hooked\n"); -// return (*pValidateDevice)(lpd3dd, pNumPasses); -//} -//HRESULT extGetDeviceCapsD3D(void *lpd3dd, D3DCAPS9 *pCaps) -//{ -// OutTrace("GetDeviceCaps hooked\n"); -// return (*pGetDeviceCapsD3D)(lpd3dd, pCaps); -//} -HRESULT WINAPI extProbe(void *lpd3dd) +void FixD3DWindowFrame(HWND hfocuswindow) { - OutTraceD3D("Probe: d3dd=%x\n", lpd3dd); - return 0; -} - -HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, - HWND hfocuswindow, DWORD behaviorflags, D3DPRESENT_PARAMETERS *ppresentparam, void **ppd3dd) -{ - HRESULT res; - DWORD param[64], *tmp; - D3DDISPLAYMODE mode; - int Windowed; - - OutTraceD3D("CreateDevice: D3DVersion=%d lpd3d=%x adapter=%x hFocusWnd=%x behavior=%x, size=(%d,%d)\n", - dwD3DVersion, lpd3d, adapter, hfocuswindow, behaviorflags, ppresentparam->BackBufferWidth, ppresentparam->BackBufferHeight); - - memcpy(param, ppresentparam, (dwD3DVersion == 9)?56:52); - dxw.SethWnd(hfocuswindow); - dxw.SetScreenSize(param[0], param[1]); - if(!(dxw.dwFlags3 & NOWINDOWMOVE)) AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); + if(!(dxw.dwFlags3 & NOWINDOWMOVE)) + AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); if(dxw.dwFlags3 & FIXD3DFRAME){ char ClassName[81]; @@ -893,6 +862,24 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, OutTraceE("CreateDevice: CreateWindowEx ERROR err=%d\n", GetLastError()); dxw.SethWnd(hfocuswindow, dxw.GethWnd()); } +} + +HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, + HWND hfocuswindow, DWORD behaviorflags, D3DPRESENT_PARAMETERS *ppresentparam, void **ppd3dd) +{ + HRESULT res; + DWORD param[64], *tmp; + D3DDISPLAYMODE mode; + int Windowed; + + OutTraceD3D("CreateDevice: D3DVersion=%d lpd3d=%x adapter=%x hFocusWnd=%x behavior=%x, size=(%d,%d)\n", + dwD3DVersion, lpd3d, adapter, hfocuswindow, behaviorflags, ppresentparam->BackBufferWidth, ppresentparam->BackBufferHeight); + + memcpy(param, ppresentparam, (dwD3DVersion == 9)?56:52); + dxw.SethWnd(hfocuswindow); + dxw.SetScreenSize(param[0], param[1]); + + if(dxw.Windowize) FixD3DWindowFrame(hfocuswindow); if(IsTraceDW){ tmp = param; @@ -917,7 +904,6 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, OutTrace(" PresentationInterval = 0x%x\n", *(tmp ++)); } - //((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode); if(dwD3DVersion == 9) (*pGetAdapterDisplayMode9)(lpd3d, 0, &mode); else @@ -927,24 +913,26 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, OutTraceDW(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height); OutTraceDW(" Current Refresh Rate = %d\n", mode.RefreshRate); - //param[0]=param[1]=0; - if(dwD3DVersion == 9){ - param[7] = 0; //hDeviceWindow - dxw.SetFullScreen(~param[8]?TRUE:FALSE); - param[8] = 1; //Windowed - //param[11] = D3DPRESENTFLAG_DEVICECLIP; //Flags; - param[12] = 0; //FullScreen_RefreshRateInHz; - param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + if(dxw.Windowize){ + param[7] = 0; //hDeviceWindow + dxw.SetFullScreen(~param[8]?TRUE:FALSE); + param[8] = 1; //Windowed + //param[11] = D3DPRESENTFLAG_DEVICECLIP; //Flags; + param[12] = 0; //FullScreen_RefreshRateInHz; + param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + } res = (*pCreateDevice9)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd); } else{ - param[6] = 0; //hDeviceWindow - dxw.SetFullScreen(~param[7]?TRUE:FALSE); - param[7] = 1; //Windowed - //param[10] = D3DPRESENTFLAG_DEVICECLIP; //Flags; - param[11] = 0; //FullScreen_RefreshRateInHz; - param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + if(dxw.Windowize){ + param[6] = 0; //hDeviceWindow + dxw.SetFullScreen(~param[7]?TRUE:FALSE); + param[7] = 1; //Windowed + //param[10] = D3DPRESENTFLAG_DEVICECLIP; //Flags; + param[11] = 0; //FullScreen_RefreshRateInHz; + param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + } res = (*pCreateDevice8)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd); } @@ -984,7 +972,8 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp memcpy(param, ppresentparam, 56); dxw.SethWnd(hfocuswindow); dxw.SetScreenSize(param[0], param[1]); - AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); + + if(dxw.Windowize) FixD3DWindowFrame(hfocuswindow); tmp = param; if(IsTraceDW){ @@ -1016,12 +1005,14 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp OutTraceDW(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height); OutTraceDW(" Current Refresh Rate = %d\n", mode.RefreshRate); - //param[7] = 0; //hDeviceWindow - param[7] = (DWORD)dxw.GethWnd(); //hDeviceWindow - dxw.SetFullScreen(~param[8]?TRUE:FALSE); - param[8] = 1; //Windowed - param[12] = 0; //FullScreen_RefreshRateInHz; - param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + if(dxw.Windowize){ + //param[7] = 0; //hDeviceWindow + param[7] = (DWORD)dxw.GethWnd(); //hDeviceWindow + dxw.SetFullScreen(~param[8]?TRUE:FALSE); + param[8] = 1; //Windowed + param[12] = 0; //FullScreen_RefreshRateInHz; + param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + } res = (*pCreateDeviceEx)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, pFullscreenDisplayMode, ppd3dd); if(res){ @@ -1105,7 +1096,7 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3d, D3DPRESENT_PARAMETERS * memcpy(param, pPresentationParameters, (dwD3DVersion == 9)?56:52); dxw.SetScreenSize(param[0], param[1]); - AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); + if(dxw.Windowize) FixD3DWindowFrame(dxw.GethWnd()); tmp = param; if(IsTraceDW){ @@ -1135,19 +1126,21 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3d, D3DPRESENT_PARAMETERS * OutTraceDW(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height); OutTraceDW(" Current Refresh Rate = %d\n", mode.RefreshRate); - if(dwD3DVersion == 9){ - param[7] = 0; //hDeviceWindow - dxw.SetFullScreen(~param[8]?TRUE:FALSE); - param[8] = 1; //Windowed - param[12] = 0; //FullScreen_RefreshRateInHz; - param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval - } - else{ - param[6] = 0; //hDeviceWindow - dxw.SetFullScreen(~param[7]?TRUE:FALSE); - param[7] = 1; //Windowed - param[11] = 0; //FullScreen_RefreshRateInHz; - param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + if(dxw.Windowize){ + if(dwD3DVersion == 9){ + param[7] = 0; //hDeviceWindow + dxw.SetFullScreen(~param[8]?TRUE:FALSE); + param[8] = 1; //Windowed + param[12] = 0; //FullScreen_RefreshRateInHz; + param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + } + else{ + param[6] = 0; //hDeviceWindow + dxw.SetFullScreen(~param[7]?TRUE:FALSE); + param[7] = 1; //Windowed + param[11] = 0; //FullScreen_RefreshRateInHz; + param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval + } } res=(*pCreateAdditionalSwapChain)(lpd3d, (D3DPRESENT_PARAMETERS *)param, ppSwapChain); if(res) OutTraceE("CreateAdditionalSwapChain ERROR: res=%x\n", res); @@ -1175,13 +1168,16 @@ HRESULT WINAPI extD3D10CreateDevice( return res; } SetHook((void *)(*(DWORD *)*ppDevice + 100), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D10)"); - ViewPort.TopLeftX=dxw.iPosX; - ViewPort.TopLeftY=dxw.iPosY; - ViewPort.Width=dxw.iSizX; - ViewPort.Height=dxw.iSizY; - ViewPort.MinDepth=1.0; - ViewPort.MaxDepth=1.0; - (*pRSSetViewports)((void *)*ppDevice, 1, (D3D11_VIEWPORT *)&ViewPort); + + if(dxw.Windowize){ + ViewPort.TopLeftX=dxw.iPosX; + ViewPort.TopLeftY=dxw.iPosY; + ViewPort.Width=dxw.iSizX; + ViewPort.Height=dxw.iSizY; + ViewPort.MinDepth=1.0; + ViewPort.MaxDepth=1.0; + (*pRSSetViewports)((void *)*ppDevice, 1, (D3D11_VIEWPORT *)&ViewPort); + } OutTraceD3D("D3D10CreateDevice: ret=%x\n", res); return res; } @@ -1216,8 +1212,10 @@ HRESULT WINAPI extD3D10CreateDeviceAndSwapChain( HRESULT res; OutTraceD3D("D3D10CreateDeviceAndSwapChain: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); //return 0x887a0004; - pSwapChainDesc->OutputWindow = dxw.GethWnd(); - pSwapChainDesc->Windowed = true; + if(dxw.Windowize){ + pSwapChainDesc->OutputWindow = dxw.GethWnd(); + pSwapChainDesc->Windowed = true; + } res=(*pD3D10CreateDeviceAndSwapChain)(pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice); OutTraceD3D("D3D10CreateDeviceAndSwapChain ret=%x\n", res); return res; @@ -1236,8 +1234,10 @@ HRESULT WINAPI extD3D10CreateDeviceAndSwapChain1( HRESULT res; OutTraceD3D("D3D10CreateDeviceAndSwapChain1: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); //return 0x887a0004; - pSwapChainDesc->OutputWindow = dxw.GethWnd(); - pSwapChainDesc->Windowed = true; + if(dxw.Windowize){ + pSwapChainDesc->OutputWindow = dxw.GethWnd(); + pSwapChainDesc->Windowed = true; + } res=(*pD3D10CreateDeviceAndSwapChain1)(pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice); OutTraceD3D("D3D10CreateDeviceAndSwapChain1 ret=%x\n", res); return res; @@ -1294,7 +1294,7 @@ void WINAPI extRSSetViewports(ID3D11DeviceContext *This, UINT NumViewports, D3D1 { OutTraceD3D("RSSetViewports: NumViewports=%d\n", NumViewports); - if(NumViewports==1){ + if(dxw.Windowize && (NumViewports==1)){ pViewports->TopLeftX=dxw.iPosX; pViewports->TopLeftY=dxw.iPosY; pViewports->Width=dxw.iSizX; @@ -1405,8 +1405,16 @@ HRESULT WINAPI extGetDirect3D9(void *lpdd3dd, void **ppD3D9) HRESULT WINAPI extCheckFullScreen(void) { - OutTraceDW("CheckFullScreen: return OK\n"); - return 0; + HRESULT res; + if(dxw.Windowize){ + OutTraceDW("CheckFullScreen: return OK\n"); + res=0; + } + else{ + res=(*pCheckFullScreen)(); + OutTraceDW("CheckFullScreen: return %x\n", res); + } + return res; } void WINAPI extSetGammaRamp(void *lpdd3dd, UINT iSwapChain, DWORD Flags, D3DGAMMARAMP *pRamp) diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index ed30e24..358b53b 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -517,7 +517,7 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc) if (remap=Remap_d3d11_ProcAddress(proc, hModule)) return remap; break; case SYSLIBIDX_OPENGL: - if (remap=Remap_gl_ProcAddress(proc, hModule)) return remap; + if(dxw.Windowize) if (remap=Remap_gl_ProcAddress(proc, hModule)) return remap; break; // case SYSLIBIDX_GLIDE: // case SYSLIBIDX_GLIDE2X: diff --git a/dll/syslibs.h b/dll/syslibs.h index bf6a021..a524f5d 100644 --- a/dll/syslibs.h +++ b/dll/syslibs.h @@ -345,7 +345,8 @@ DXWEXTERN CreateDialogIndirectParam_Type pCreateDialogIndirectParam DXWINITIALIZ DXWEXTERN CreateDialogParam_Type pCreateDialogParam DXWINITIALIZED; DXWEXTERN CreateWindowExA_Type pCreateWindowExA DXWINITIALIZED; DXWEXTERN CreateWindowExW_Type pCreateWindowExW DXWINITIALIZED; -DXWEXTERN DefWindowProc_Type pDefWindowProc DXWINITIALIZED; +DXWEXTERN DefWindowProc_Type pDefWindowProcA DXWINITIALIZED; +DXWEXTERN DefWindowProc_Type pDefWindowProcW DXWINITIALIZED; DXWEXTERN DrawText_Type pDrawText DXWINITIALIZED; DXWEXTERN DrawTextEx_Type pDrawTextEx DXWINITIALIZED; DXWEXTERN EndPaint_Type pEndPaint DXWINITIALIZED; @@ -394,6 +395,7 @@ DXWEXTERN GetForegroundWindow_Type pGetForegroundWindow DXWINITIALIZED; DXWEXTERN GetActiveWindow_Type pGetActiveWindow DXWINITIALIZED; DXWEXTERN IsWindowVisible_Type pIsWindowVisible DXWINITIALIZED; DXWEXTERN SystemParametersInfo_Type pSystemParametersInfoA DXWINITIALIZED; +DXWEXTERN SystemParametersInfo_Type pSystemParametersInfoW DXWINITIALIZED; DXWEXTERN KillTimer_Type pKillTimer DXWINITIALIZED; DXWEXTERN GetUpdateRect_Type pGetUpdateRect DXWINITIALIZED; @@ -543,7 +545,8 @@ extern HWND WINAPI extCreateDialogIndirectParam(HINSTANCE, LPCDLGTEMPLATE, HWND, extern HWND WINAPI extCreateDialogParam(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM); extern HWND WINAPI extCreateWindowExA(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); extern HWND WINAPI extCreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); -extern LRESULT WINAPI extDefWindowProc(HWND, UINT, WPARAM, LPARAM); +extern LRESULT WINAPI extDefWindowProcA(HWND, UINT, WPARAM, LPARAM); +extern LRESULT WINAPI extDefWindowProcW(HWND, UINT, WPARAM, LPARAM); extern int WINAPI extDrawTextA(HDC, LPCTSTR, int, LPRECT, UINT); extern int WINAPI extDrawTextExA(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); extern BOOL WINAPI extEndPaint(HWND, const PAINTSTRUCT *); @@ -603,6 +606,7 @@ extern HWND WINAPI extGetForegroundWindow(void); extern HWND WINAPI extGetActiveWindow(void); extern BOOL WINAPI extIsWindowVisible(HWND); extern BOOL WINAPI extSystemParametersInfoA(UINT, UINT, PVOID, UINT); +extern BOOL WINAPI extSystemParametersInfoW(UINT, UINT, PVOID, UINT); extern BOOL WINAPI extKillTimer(HWND, UINT_PTR); extern BOOL WINAPI extGetUpdateRect(HWND, LPRECT, BOOL); diff --git a/dll/user32.cpp b/dll/user32.cpp index f691a42..848dc56 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -26,7 +26,8 @@ static HookEntry_Type Hooks[]={ {"EnumDisplaySettingsA", (FARPROC)EnumDisplaySettingsA, (FARPROC *)&pEnumDisplaySettings, (FARPROC)extEnumDisplaySettings}, {"GetClipCursor", (FARPROC)GetClipCursor, (FARPROC*)&pGetClipCursor, (FARPROC)extGetClipCursor}, {"ClipCursor", (FARPROC)ClipCursor, (FARPROC *)&pClipCursor, (FARPROC)extClipCursor}, - {"DefWindowProcA", (FARPROC)DefWindowProcA, (FARPROC *)&pDefWindowProc, (FARPROC)extDefWindowProc}, + {"DefWindowProcA", (FARPROC)DefWindowProcA, (FARPROC *)&pDefWindowProcA, (FARPROC)extDefWindowProcA}, + {"DefWindowProcW", (FARPROC)DefWindowProcW, (FARPROC *)&pDefWindowProcW, (FARPROC)extDefWindowProcW}, {"CreateWindowExA", (FARPROC)CreateWindowExA, (FARPROC *)&pCreateWindowExA, (FARPROC)extCreateWindowExA}, {"CreateWindowExW", (FARPROC)CreateWindowExW, (FARPROC *)&pCreateWindowExW, (FARPROC)extCreateWindowExW}, {"RegisterClassExA", (FARPROC)RegisterClassExA, (FARPROC *)&pRegisterClassExA, (FARPROC)extRegisterClassExA}, @@ -46,6 +47,7 @@ static HookEntry_Type Hooks[]={ //{"GetForegroundWindow", (FARPROC)NULL, (FARPROC *)&pGetForegroundWindow, (FARPROC)extGetForegroundWindow}, {"IsWindowVisible", (FARPROC)NULL, (FARPROC *)&pIsWindowVisible, (FARPROC)extIsWindowVisible}, {"SystemParametersInfoA", (FARPROC)SystemParametersInfoA, (FARPROC *)&pSystemParametersInfoA, (FARPROC)extSystemParametersInfoA}, + {"SystemParametersInfoW", (FARPROC)SystemParametersInfoW, (FARPROC *)&pSystemParametersInfoW, (FARPROC)extSystemParametersInfoW}, {0, NULL, 0, 0} // terminator }; @@ -559,47 +561,48 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong, SetWindowLon OutTraceDW("SetWindowLong: hwnd=%x, Index=%x(%s) Val=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), dwNewLong); - //if(!hwnd) hwnd=dxw.GethWnd(); - - if (dxw.dwFlags1 & LOCKWINSTYLE){ - if(nIndex==GWL_STYLE){ - OutTraceDW("SetWindowLong: Lock GWL_STYLE=%x\n", dwNewLong); - //return 1; - return (*pGetWindowLongA)(hwnd, nIndex); - } - if(nIndex==GWL_EXSTYLE){ - OutTraceDW("SetWindowLong: Lock GWL_EXSTYLE=%x\n", dwNewLong); - //return 1; - return (*pGetWindowLongA)(hwnd, nIndex); - } - } - - if (dxw.dwFlags1 & PREVENTMAXIMIZE){ - if(nIndex==GWL_STYLE){ - dwNewLong &= ~WS_MAXIMIZE; - if(dxw.IsDesktop(hwnd)){ - OutTraceDW("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong); - dwNewLong |= WS_OVERLAPPEDWINDOW; - dwNewLong &= ~(WS_DLGFRAME|WS_MAXIMIZE|WS_VSCROLL|WS_HSCROLL|WS_CLIPSIBLINGS); + if (dxw.Windowize){ + if(dxw.dwFlags1 & LOCKWINSTYLE){ + if(nIndex==GWL_STYLE){ + OutTraceDW("SetWindowLong: Lock GWL_STYLE=%x\n", dwNewLong); + //return 1; + return (*pGetWindowLongA)(hwnd, nIndex); + } + if(nIndex==GWL_EXSTYLE){ + OutTraceDW("SetWindowLong: Lock GWL_EXSTYLE=%x\n", dwNewLong); + //return 1; + return (*pGetWindowLongA)(hwnd, nIndex); } } - // v2.02.32: disable topmost for main window only - if(dxw.IsDesktop(hwnd) && (nIndex==GWL_EXSTYLE)){ - OutTraceDW("SetWindowLong: GWL_EXSTYLE %x suppress TOPMOST\n", dwNewLong); - dwNewLong = dwNewLong & ~(WS_EX_TOPMOST); - } - } - if (dxw.dwFlags1 & FIXWINFRAME){ - //if((nIndex==GWL_STYLE) && !(dwNewLong & WS_CHILD)){ - if((nIndex==GWL_STYLE) && !(dwNewLong & WS_CHILD) && dxw.IsDesktop(hwnd)){ - OutTraceDW("SetWindowLong: GWL_STYLE %x force OVERLAPPEDWINDOW\n", dwNewLong); - dwNewLong |= WS_OVERLAPPEDWINDOW; - dwNewLong &= ~WS_CLIPSIBLINGS; + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ + if(nIndex==GWL_STYLE){ + dwNewLong &= ~WS_MAXIMIZE; + if(dxw.IsDesktop(hwnd)){ + OutTraceDW("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong); + dwNewLong |= WS_OVERLAPPEDWINDOW; + dwNewLong &= ~(WS_DLGFRAME|WS_MAXIMIZE|WS_VSCROLL|WS_HSCROLL|WS_CLIPSIBLINGS); + } + } + // v2.02.32: disable topmost for main window only + if(dxw.IsDesktop(hwnd) && (nIndex==GWL_EXSTYLE)){ + OutTraceDW("SetWindowLong: GWL_EXSTYLE %x suppress TOPMOST\n", dwNewLong); + dwNewLong = dwNewLong & ~(WS_EX_TOPMOST); + } + } + + if (dxw.dwFlags1 & FIXWINFRAME){ + //if((nIndex==GWL_STYLE) && !(dwNewLong & WS_CHILD)){ + if((nIndex==GWL_STYLE) && !(dwNewLong & WS_CHILD) && dxw.IsDesktop(hwnd)){ + OutTraceDW("SetWindowLong: GWL_STYLE %x force OVERLAPPEDWINDOW\n", dwNewLong); + dwNewLong |= WS_OVERLAPPEDWINDOW; + dwNewLong &= ~WS_CLIPSIBLINGS; + } } } if ((nIndex==GWL_WNDPROC) && dxw.IsFullScreen()){ // v2.02.51 - see A10 Cuba.... + //if (nIndex==GWL_WNDPROC){ WNDPROC lres; WNDPROC OldProc; // GPL fix @@ -800,6 +803,22 @@ BOOL WINAPI extGetCursorPos(LPPOINT lppoint) *lppoint=dxw.ScreenToClient(*lppoint); *lppoint=dxw.FixCursorPos(*lppoint); + if(dxw.dwFlags4 & FRAMECOMPENSATION){ + static int dx, dy, todo=TRUE; + if (todo){ + RECT wrect; + POINT upleft={0, 0}; + todo=FALSE; + (*pGetWindowRect)(dxw.GethWnd(), &wrect); + (*pClientToScreen)(dxw.GethWnd(), &upleft); + dx=upleft.x - wrect.left; + dy=upleft.y - wrect.top; + OutTraceC("GetCursorPos: frame compensation=(%d,%d)\n", dx, dy); + } + lppoint->x += dx; + lppoint->y += dy; + } + GetHookInfo()->CursorX=(short)lppoint->x; GetHookInfo()->CursorY=(short)lppoint->y; OutTraceC("GetCursorPos: FIXED pos=(%d,%d)->(%d,%d)\n", prev.x, prev.y, lppoint->x, lppoint->y); @@ -1118,6 +1137,33 @@ static HWND WINAPI extCreateWindowCommon( WNDPROC pWindowProc; BOOL isValidHandle=TRUE; + if(!dxw.Windowize){ + if(WideChar) + hwnd= (*pCreateWindowExW)(dwExStyle, (LPCWSTR)lpClassName, (LPCWSTR)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); + else + hwnd= (*pCreateWindowExA)(dwExStyle, (LPCSTR)lpClassName, (LPCSTR)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); + if ((dwStyle & WS_CHILD) && (dxw.dwFlags1 & HOOKCHILDWIN)){ + // child window inherit the father's windproc, so if it's redirected to + // a hooker (either extWindowProc or extChildWindowProc) you have to retrieve + // the correct value (WhndGetWindowProc) before saving it (WhndStackPush). + long res; + pWindowProc = (WNDPROC)(*pGetWindowLongA)(hwnd, GWL_WNDPROC); + if((pWindowProc == extWindowProc) || + (pWindowProc == extChildWindowProc) || + (pWindowProc == extDialogWindowProc)){ // avoid recursions + HWND Father; + Father=GetParent(hwnd); + pWindowProc=WhndGetWindowProc(Father); + } + OutTraceDW("Hooking CHILD hwnd=%x father WindowProc %x->%x\n", hwnd, pWindowProc, extChildWindowProc); + res=(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extChildWindowProc); + if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError()); + WhndStackPush(hwnd, pWindowProc); + } + OutTraceDW("%s: ret=%x\n", ApiName, hwnd); + return hwnd; + } + // no maximized windows in any case if (dxw.dwFlags1 & PREVENTMAXIMIZE){ OutTraceDW("%s: handling PREVENTMAXIMIZE mode\n", ApiName); @@ -1380,7 +1426,7 @@ LRESULT WINAPI extCallWindowProc(WNDPROC lpPrevWndFunc, HWND hwnd, UINT Msg, WPA return res; } -LRESULT WINAPI extDefWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) +LRESULT WINAPI extDefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) { // v2.02.30: fix (Imperialism II): apply to main window only !!! HRESULT res; @@ -1389,7 +1435,21 @@ LRESULT WINAPI extDefWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lPara if(hwnd == dxw.GethWnd()) res=FixWindowProc("DefWindowProc", hwnd, Msg, wParam, &lParam); if (res==(HRESULT)-1) - return (*pDefWindowProc)(hwnd, Msg, wParam, lParam); + return (*pDefWindowProcA)(hwnd, Msg, wParam, lParam); + else + return res; +} + +LRESULT WINAPI extDefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + // v2.02.30: fix (Imperialism II): apply to main window only !!! + HRESULT res; + + res = -1; + if(hwnd == dxw.GethWnd()) res=FixWindowProc("DefWindowProc", hwnd, Msg, wParam, &lParam); + + if (res==(HRESULT)-1) + return (*pDefWindowProcW)(hwnd, Msg, wParam, lParam); else return res; } @@ -1582,7 +1642,10 @@ LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags) OutTrace("\n"); } - return MyChangeDisplaySettings("ChangeDisplaySettingsA", FALSE, lpDevMode, dwflags); + if(dxw.Windowize) + return MyChangeDisplaySettings("ChangeDisplaySettingsA", FALSE, lpDevMode, dwflags); + else + return (*pChangeDisplaySettingsA)(lpDevMode, dwflags); } LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags) @@ -1595,7 +1658,10 @@ LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags) OutTrace("\n"); } - return MyChangeDisplaySettings("ChangeDisplaySettingsW", TRUE, lpDevMode, dwflags); + if(dxw.Windowize) + return MyChangeDisplaySettings("ChangeDisplaySettingsW", TRUE, lpDevMode, dwflags); + else + return (*pChangeDisplaySettingsW)(lpDevMode, dwflags); } LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) @@ -1608,7 +1674,10 @@ LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevM OutTrace("\n"); } - return MyChangeDisplaySettings("ChangeDisplaySettingsExA", FALSE, lpDevMode, dwflags); + if(dxw.Windowize) + return MyChangeDisplaySettings("ChangeDisplaySettingsExA", FALSE, lpDevMode, dwflags); + else + return (*pChangeDisplaySettingsExA)(lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); } LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR lpszDeviceName, DEVMODEW *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) @@ -1621,7 +1690,10 @@ LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR lpszDeviceName, DEVMODEW *lpDevM OutTrace("\n"); } - return MyChangeDisplaySettings("ChangeDisplaySettingsExW", TRUE, lpDevMode, dwflags); + if(dxw.Windowize) + return MyChangeDisplaySettings("ChangeDisplaySettingsExW", TRUE, lpDevMode, dwflags); + else + return (*pChangeDisplaySettingsExW)(lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); } HDC WINAPI extGDIGetDC(HWND hwnd) @@ -1663,6 +1735,7 @@ HDC WINAPI extEMUGetDC(HWND hwnd) HWND lochwnd; OutTraceDW("GDI.GetDC: hwnd=%x\n", hwnd); + lochwnd=hwnd; if (dxw.IsRealDesktop(hwnd)) { OutTraceDW("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); @@ -1927,8 +2000,9 @@ HDC WINAPI extDDBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint) LPDIRECTDRAWSURFACE lpDDS; DDSURFACEDESC ddsd; res=extDirectDrawCreate(0, &lpDD, NULL); - //lpDD->SetCooperativeLevel(dxw.GethWnd(), DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); - lpDD->SetCooperativeLevel(dxw.GethWnd(), DDSCL_NORMAL); + //res=extDirectDrawCreate((GUID *)&IID_IDirectDraw, &lpDD, NULL); + lpDD->SetCooperativeLevel(dxw.GethWnd(), DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); + //lpDD->SetCooperativeLevel(dxw.GethWnd(), DDSCL_NORMAL); memset((void *)&ddsd, 0, sizeof(DDSURFACEDESC)); ddsd.dwSize = sizeof(DDSURFACEDESC); ddsd.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH; @@ -2031,9 +2105,12 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT if(dxw.IsFullScreen() && hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit); - WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc); - if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc)) - OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__); + // v2.02.73: redirect lpDialogFunc only when it is nor NULL + if(lpDialogFunc) { + WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc); + if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc)) + OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__); + } OutTraceDW("CreateDialogIndirectParam: hwnd=%x\n", RetHWND); isWithinDialog=FALSE; @@ -2050,9 +2127,12 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW if(hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogParam)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, lParamInit); - WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc); - if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc)) - OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__); + // v2.02.73: redirect lpDialogFunc only when it is nor NULL: fix for "LEGO Stunt Rally" + if(lpDialogFunc) { + WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc); + if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc)) + OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__); + } OutTraceDW("CreateDialogParam: hwnd=%x\n", RetHWND); isWithinDialog=FALSE; @@ -2066,57 +2146,59 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL OutTraceDW("MoveWindow: hwnd=%x xy=(%d,%d) size=(%d,%d) repaint=%x indialog=%x fullscreen=%x\n", hwnd, X, Y, nWidth, nHeight, bRepaint, isWithinDialog, dxw.IsFullScreen()); - if(dxw.IsDesktop(hwnd)){ - // v2.1.93: happens in "Emergency Fighters for Life" ... - // what is the meaning of this? is it related to video stretching? - OutTraceDW("MoveWindow: prevent moving desktop win\n"); - return TRUE; - } + if(dxw.Windowize){ + if(dxw.IsDesktop(hwnd)){ + // v2.1.93: happens in "Emergency Fighters for Life" ... + // what is the meaning of this? is it related to video stretching? + OutTraceDW("MoveWindow: prevent moving desktop win\n"); + return TRUE; + } - if((hwnd==dxw.GethWnd()) || (hwnd==dxw.hParentWnd)){ - OutTraceDW("MoveWindow: prevent moving main win\n"); - return TRUE; - } + if((hwnd==dxw.GethWnd()) || (hwnd==dxw.hParentWnd)){ + OutTraceDW("MoveWindow: prevent moving main win\n"); + return TRUE; + } - if (dxw.IsFullScreen()){ - POINT upleft={0,0}; - RECT client; - BOOL isChild; - (*pClientToScreen)(dxw.GethWnd(),&upleft); - (*pGetClientRect)(dxw.GethWnd(),&client); - if ((*pGetWindowLongA)(hwnd, GWL_STYLE) & WS_CHILD){ - isChild=TRUE; - // child coordinate adjustement - X = (X * client.right) / dxw.GetScreenWidth(); - Y = (Y * client.bottom) / dxw.GetScreenHeight(); - nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); - nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); - } - else { - isChild=FALSE; - // regular win coordinate adjustement - X = upleft.x + (X * client.right) / dxw.GetScreenWidth(); - Y = upleft.y + (Y * client.bottom) / dxw.GetScreenHeight(); - nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); - nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); - } - OutTraceDW("MoveWindow: DEBUG client=(%d,%d) screen=(%d,%d)\n", - client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight()); - OutTraceDW("MoveWindow: hwnd=%x child=%x relocated to xy=(%d,%d) size=(%d,%d)\n", - hwnd, isChild, X, Y, nWidth, nHeight); - } - else{ - if((X==0)&&(Y==0)&&(nWidth==dxw.GetScreenWidth())&&(nHeight==dxw.GetScreenHeight())){ - // evidently, this was supposed to be a fullscreen window.... - RECT screen; - POINT upleft = {0,0}; - (*pGetClientRect)(dxw.GethWnd(),&screen); + if (dxw.IsFullScreen()){ + POINT upleft={0,0}; + RECT client; + BOOL isChild; (*pClientToScreen)(dxw.GethWnd(),&upleft); - X=upleft.x; - Y=upleft.y; - nWidth=screen.right; - nHeight=screen.bottom; - OutTraceDW("MoveWindow: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", X, Y, nWidth, nHeight); + (*pGetClientRect)(dxw.GethWnd(),&client); + if ((*pGetWindowLongA)(hwnd, GWL_STYLE) & WS_CHILD){ + isChild=TRUE; + // child coordinate adjustement + X = (X * client.right) / dxw.GetScreenWidth(); + Y = (Y * client.bottom) / dxw.GetScreenHeight(); + nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); + nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); + } + else { + isChild=FALSE; + // regular win coordinate adjustement + X = upleft.x + (X * client.right) / dxw.GetScreenWidth(); + Y = upleft.y + (Y * client.bottom) / dxw.GetScreenHeight(); + nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); + nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); + } + OutTraceDW("MoveWindow: DEBUG client=(%d,%d) screen=(%d,%d)\n", + client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight()); + OutTraceDW("MoveWindow: hwnd=%x child=%x relocated to xy=(%d,%d) size=(%d,%d)\n", + hwnd, isChild, X, Y, nWidth, nHeight); + } + else{ + if((X==0)&&(Y==0)&&(nWidth==dxw.GetScreenWidth())&&(nHeight==dxw.GetScreenHeight())){ + // evidently, this was supposed to be a fullscreen window.... + RECT screen; + POINT upleft = {0,0}; + (*pGetClientRect)(dxw.GethWnd(),&screen); + (*pClientToScreen)(dxw.GethWnd(),&upleft); + X=upleft.x; + Y=upleft.y; + nWidth=screen.right; + nHeight=screen.bottom; + OutTraceDW("MoveWindow: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", X, Y, nWidth, nHeight); + } } } @@ -2268,7 +2350,7 @@ BOOL WINAPI extUpdateWindow(HWND hwnd) BOOL ret; OutTraceDW("UpdateWindow: hwnd=%x\n", hwnd); - if(dxw.IsRealDesktop(hwnd)){ + if(dxw.Windowize && dxw.IsRealDesktop(hwnd)){ OutTraceDW("UpdateWindow: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); hwnd=dxw.GethWnd(); } @@ -2391,6 +2473,22 @@ BOOL WINAPI extSystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, return ret; } +BOOL WINAPI extSystemParametersInfoW(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni) +{ + BOOL ret; + OutTraceDW("SystemParametersInfo: Action=%x Param=%x WinIni=%x\n", uiAction, uiParam, fWinIni); + ret=(*pSystemParametersInfoW)(uiAction, uiParam, pvParam, fWinIni); + if(uiAction==SPI_GETWORKAREA){ + LPRECT cli = (LPRECT)pvParam; + cli->top = 0; + cli->left = 0; + cli->bottom = dxw.GetScreenHeight(); + cli->right = dxw.GetScreenWidth(); + OutTraceDW("SystemParametersInfo: resized client workarea rect=(%d,%d)-(%d,%d)\n", cli->left, cli->top, cli->right, cli->bottom); + } + return ret; +} + #undef OutTraceDW #define OutTraceDW OutTrace diff --git a/host/Resource.h b/host/Resource.h index 4d5e70f..ae52826 100644 --- a/host/Resource.h +++ b/host/Resource.h @@ -213,6 +213,8 @@ #define IDC_DISABLEFOGGING 1175 #define IDC_RELEASEMOUSE 1176 #define IDC_HOOKGLIDE 1177 +#define IDC_RELEASEMOUSE2 1177 +#define IDC_FRAMECOMPENSATION 1177 #define ID_MODIFY 32771 #define ID_DELETE 32772 #define ID_ADD 32773 diff --git a/host/TabInput.cpp b/host/TabInput.cpp index b832fc9..473d65c 100644 --- a/host/TabInput.cpp +++ b/host/TabInput.cpp @@ -38,6 +38,7 @@ void CTabInput::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_FIXNCHITTEST, cTarget->m_FixNCHITTEST); DDX_Check(pDX, IDC_SLOW, cTarget->m_SlowDown); DDX_Check(pDX, IDC_RELEASEMOUSE, cTarget->m_ReleaseMouse); + DDX_Check(pDX, IDC_FRAMECOMPENSATION, cTarget->m_FrameCompensation); // DirectInput DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI); DDX_Text(pDX, IDC_INITX, cTarget->m_InitX); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 2576586..63b4ca7 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -127,6 +127,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_StretchTimers = FALSE; m_FineTiming = FALSE; m_ReleaseMouse = FALSE; + m_FrameCompensation = FALSE; m_InterceptRDTSC = FALSE; m_HookOpenGL = FALSE; m_ForceHookOpenGL = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 7d806d7..23a6cae 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -110,6 +110,7 @@ public: BOOL m_StretchTimers; BOOL m_FineTiming; BOOL m_ReleaseMouse; + BOOL m_FrameCompensation; BOOL m_InterceptRDTSC; BOOL m_HookOpenGL; BOOL m_ForceHookOpenGL; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index b1cd8cc..1030255 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 4bf3ea7..a22a4ad 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -359,15 +359,15 @@ BEGIN CONTROL "Correct mouse position",IDC_MODIFYMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,38,107,12 CONTROL "Hide Cursor",IDC_HIDEHWCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,15,100,10 CONTROL "Intercept GDI Cursor Clipping",IDC_ENABLECLIPPING, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,109,10 - GROUPBOX "Cursor handling",IDC_STATIC,7,3,129,148 - CONTROL "Keep cursor within window",IDC_KEEPCURSORWITHIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,61,108,10 - CONTROL "Force cursor clipping",IDC_CLIPCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,50,108,10 - CONTROL "Message processing",IDC_MESSAGEPROC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,96,103,10 - CONTROL "Keep cursor fixed",IDC_KEEPCURSORFIXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,73,107,10 - CONTROL "fix WM_NCHITTEST",IDC_FIXNCHITTEST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,107,103,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,97,109,10 + GROUPBOX "Cursor handling",IDC_STATIC,7,3,129,162 + CONTROL "Keep cursor within window",IDC_KEEPCURSORWITHIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,73,108,10 + CONTROL "Force cursor clipping",IDC_CLIPCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,62,108,10 + CONTROL "Message processing",IDC_MESSAGEPROC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,108,103,10 + CONTROL "Keep cursor fixed",IDC_KEEPCURSORFIXED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,107,10 + CONTROL "fix WM_NCHITTEST",IDC_FIXNCHITTEST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,119,103,10 CONTROL "Show Cursor",IDC_SHOWHWCURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,27,104,10 - CONTROL "Slow down mouse polling",IDC_SLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,118,103,12 + CONTROL "Slow down mouse polling",IDC_SLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,103,12 LTEXT "Initial coord.",IDC_STATIC,148,33,46,9 LTEXT "X",IDC_STATIC,234,34,9,9 LTEXT "Y",IDC_STATIC,261,34,9,9 @@ -388,7 +388,8 @@ BEGIN CONTROL "Filter offending messages",IDC_FILTERMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,96,114,10 CONTROL "Peek all messages in queue",IDC_PEEKALLMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,108,114,10 GROUPBOX "Message handling",IDC_STATIC,142,79,151,72 - CONTROL "Release mouse outside window",IDC_RELEASEMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,114,12 + CONTROL "Release mouse outside window",IDC_RELEASEMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,142,114,12 + CONTROL "Window frame compensation",IDC_FRAMECOMPENSATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,50,114,12 END IDD_TAB_TIMING DIALOGEX 0, 0, 300, 240 diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 2c43e37..f8013af 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 09eda0d..b7a58c6 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -241,6 +241,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_StretchTimers) t->flags4 |= STRETCHTIMERS; if(dlg->m_FineTiming) t->flags4 |= FINETIMING; if(dlg->m_ReleaseMouse) t->flags4 |= RELEASEMOUSE; + if(dlg->m_FrameCompensation) t->flags4 |= FRAMECOMPENSATION; if(dlg->m_InterceptRDTSC) t->flags4 |= INTERCEPTRDTSC; if(dlg->m_HookOpenGL) t->flags2 |= HOOKOPENGL; if(dlg->m_ForceHookOpenGL) t->flags3 |= FORCEHOOKOPENGL; @@ -406,6 +407,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_StretchTimers = t->flags4 & STRETCHTIMERS ? 1 : 0; dlg->m_FineTiming = t->flags4 & FINETIMING ? 1 : 0; dlg->m_ReleaseMouse = t->flags4 & RELEASEMOUSE ? 1 : 0; + dlg->m_FrameCompensation = t->flags4 & FRAMECOMPENSATION ? 1 : 0; dlg->m_InterceptRDTSC = t->flags4 & INTERCEPTRDTSC ? 1 : 0; dlg->m_HookOpenGL = t->flags2 & HOOKOPENGL ? 1 : 0; dlg->m_ForceHookOpenGL = t->flags3 & FORCEHOOKOPENGL ? 1 : 0;