diff --git a/build/dxwnd.dll b/build/dxwnd.dll index b101732..29e3792 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:367c504db6f66d3f5c9e40e1a3e3aeb94f3c5a3df7b7bd9134a649379a40c8fa -size 612864 +oid sha256:4fa45747fcb74b2f182ae1d40d3d2219eef7a9410a72a7db49157aba403d9fe4 +size 613888 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 8f4f1a8..fb487c0 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b44208fd7eef222ff0861d95418c3aabb46481b83198c1b40d769bc52f6a8b4 +oid sha256:48137e513053f009fb46ef066a902428491fa3fbc00119db3d5a16cd287ce4fa size 545792 diff --git a/build/dxwnd.ini b/build/dxwnd.ini deleted file mode 100644 index ce0540b..0000000 --- a/build/dxwnd.ini +++ /dev/null @@ -1,70 +0,0 @@ -[window] -exportpath=D:\DxWnd\v2_03_43_src\build\exports\ -exepath=D:\Games\Arx Fatalis demo\ -posx=1946 -posy=567 -sizx=320 -sizy=200 -[target] -title0=Arx Fatalis demo -path0=D:\Games\Arx Fatalis demo\ARX.exe -launchpath0= -module0=Athena -opengllib0= -notes0= -registry0= -ver0=0 -coord0=0 -flag0=136314918 -flagg0=1207959552 -flagh0=65552 -flagi0=138412036 -flagj0=4224 -flagk0=65536 -tflag0=0 -initx0=0 -inity0=0 -minx0=0 -miny0=0 -maxx0=0 -maxy0=0 -posx0=150 -posy0=50 -sizx0=800 -sizy0=600 -maxfps0=0 -initts0=0 -winver0=0 -maxres0=-1 -swapeffect0=0 -title1=TieFighter 95 -path1=D:\Games\TIE95\TIE95.EXE -launchpath1= -module1= -opengllib1= -notes1=The game can be played also with no joystick using the DxWnd virtual one.\nIf you have a real joystick, the "Use DLL injection" flag is not necessary.\nUse "Unlock Z order" to avoid losing control of the window. -registry1= -ver1=1 -coord1=0 -flag1=681574514 -flagg1=1744830464 -flagh1=20 -flagi1=138412036 -flagj1=1073746048 -flagk1=136642560 -tflag1=0 -initx1=0 -inity1=0 -minx1=0 -miny1=0 -maxx1=800 -maxy1=600 -posx1=50 -posy1=50 -sizx1=800 -sizy1=600 -maxfps1=0 -initts1=0 -winver1=0 -maxres1=-1 -swapeffect1=0 diff --git a/build/exports/Imperialism II.dxw b/build/exports/Imperialism II.dxw index 877dcee..d9d16fd 100644 --- a/build/exports/Imperialism II.dxw +++ b/build/exports/Imperialism II.dxw @@ -28,5 +28,5 @@ launchpath0= notes0= registry0= flagj0=0 -flagk0=262144 +flagk0=0 swapeffect0=0 diff --git a/build/exports/Reah.dxw b/build/exports/Reah.dxw new file mode 100644 index 0000000..6df2cf9 --- /dev/null +++ b/build/exports/Reah.dxw @@ -0,0 +1,32 @@ +[target] +title0=Reah +path0=D:\Games\Reah\Reah.exe +launchpath0=F:\Autorun.exe +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=-1465778141 +flagg0=1209010176 +flagh0=20 +flagi0=138412036 +flagj0=1073746048 +flagk0=98304 +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 +swapeffect0=0 diff --git a/build/exports/Super Real Mahjong P7.dxw b/build/exports/Super Real Mahjong P7.dxw new file mode 100644 index 0000000..befc22d --- /dev/null +++ b/build/exports/Super Real Mahjong P7.dxw @@ -0,0 +1,32 @@ +[target] +title0=Super Real Mahjong P7 +path0=D:\Games\Super Real Mahjong P7\P7\p7.exe +launchpath0=D:\Games\Super Real Mahjong P7\P7\p7.exe -f +module0= +opengllib0= +notes0= +registry0= +ver0=0 +coord0=0 +flag0=681574434 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=5248 +flagk0=67436544 +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 +swapeffect0=0 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 1bdfc3e..7b294b1 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -951,4 +951,13 @@ fix: deleted emulation of ZBUFFER attach. Needed for "Arx Fatalis" fix: added emulation of PixelFormat in getPixelFormat hooker. Needed for "Arx Fatalis" add: added virtual joystick feature. Required to play "Tie Fighter 95" with no real joystick v2.03.43.fix1 -fix: recovered virtual joystick buttons \ No newline at end of file +fix: recovered virtual joystick buttons + +v2.03.44 +fix: GetSystemPaletteUse error message +fix: transparent virtual joystick icons +fix: RealizePalette hooker crash in "Super Real Mahjong P7" +fix: complete recoding of GDI BitBlt, StretchBlt and PatBlt hookers: it fixes "Reah" problems +fix: changes in USER32 BeginPaint hooker to support DC sharing with ddraw +fix: increased configuration panels heigth do avoid clipping when desktop font size is set to 125% + diff --git a/dll/dxhelper.cpp b/dll/dxhelper.cpp index 2ee318d..c85aeed 100644 --- a/dll/dxhelper.cpp +++ b/dll/dxhelper.cpp @@ -1421,7 +1421,7 @@ char *ExplainGetDCExFlags(DWORD c) char *ExplainPaletteUse(UINT uUsage) { - char *eb = SYSPAL_ERROR; + char *eb = "SYSPAL_ERROR"; switch(uUsage){ case SYSPAL_STATIC: eb="SYSPAL_STATIC"; break; case SYSPAL_NOSTATIC: eb="SYSPAL_NOSTATIC"; break; diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index dc793d8..d0a71ce 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.43.fix1" +#define VERSION "2.03.44" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 99cde0e..9b0adcf 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/fire1.bmp b/dll/fire1.bmp index be8f6f3..3b33839 100644 Binary files a/dll/fire1.bmp and b/dll/fire1.bmp differ diff --git a/dll/fire2.bmp b/dll/fire2.bmp index 6549d79..5a810e8 100644 Binary files a/dll/fire2.bmp and b/dll/fire2.bmp differ diff --git a/dll/fire3.bmp b/dll/fire3.bmp index 6230854..c740377 100644 Binary files a/dll/fire3.bmp and b/dll/fire3.bmp differ diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp index 2e8e04a..4b9085c 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -9,6 +9,10 @@ #include "stdio.h" +#define GDIMODE_STRETCHED 0 +#define GDIMODE_EMULATED 1 +extern int GDIEmulationMode; + static void Stopper(char *s, int line) { char sMsg[81]; @@ -616,7 +620,7 @@ UINT WINAPI extRealizePalette(HDC hdc) HRESULT res; extern LPDIRECTDRAWPALETTE lpDDP; extern SetEntries_Type pSetEntries; - res=(*pSetEntries)(lpDDP, 0, 0, 256, PalEntries); + if(lpDDP && pSetEntries) res=(*pSetEntries)(lpDDP, 0, 0, 256, PalEntries); } else ret=(*pGDIRealizePalette)(hdc); @@ -758,6 +762,7 @@ HDC WINAPI extGDICreateCompatibleDC(HDC hdc) BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop) { BOOL res; + BOOL IsToScreen; OutTraceDW("GDI.BitBlt: HDC=%x nXDest=%d nYDest=%d nWidth=%d nHeight=%d hdcSrc=%x nXSrc=%d nYSrc=%d dwRop=%x(%s)\n", hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop, ExplainROP(dwRop)); @@ -771,44 +776,40 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH if(dxw.dwFlags3 & GDIEMULATEDC){ if (hdcDest==dxw.RealHDC) hdcDest=dxw.VirtualHDC; - //return (*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); + OutTraceB("GDI.BitBlt: DEBUG emulated hdc dest=%x->%x\n", dxw.RealHDC, hdcDest); } - SetStretchBltMode(hdcDest, HALFTONE); - if (OBJ_DC == GetObjectType(hdcDest)){ - //if(dxw.IsRealDesktop(WindowFromDC(hdcDest))) hdcDest=GetDC(dxw.GethWnd()); // ?????? - if (dxw.HandleFPS()) return TRUE; - if (dxw.dwFlags3 & NOGDIBLT) return TRUE; - if(dxw.IsFullScreen()){ - int nWDest, nHDest; - nWDest= nWidth; - nHDest= nHeight; - dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); - res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); - dxw.ShowOverlay(hdcDest); - OutTrace("Debug: DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); - } - else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: See StretchBlt. + if(hdcDest == NULL){ + // happens in Reah, hdc is NULL despite the fact that BeginPaint returns a valid DC. Too bad, we recover here ... + hdcDest = (*pGDIGetDC)(dxw.GethWnd()); + OutTraceB("GDI.BitBlt: DEBUG hdc dest=NULL->%x\n", hdcDest); + } + + IsToScreen=(OBJ_DC == GetObjectType(hdcDest)); + if (IsToScreen && (dxw.dwFlags3 & NOGDIBLT)) return TRUE; + if(dxw.IsFullScreen()) { + switch(GDIEmulationMode){ + case GDIMODE_STRETCHED: { int nWDest, nHDest; nWDest= nWidth; nHDest= nHeight; - dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest); + dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); - dxw.ShowOverlay(hdcDest); - OutTrace("Debug: NULL dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); - } - else{ + OutTraceB("GDI.BitBlt: DEBUG DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + } + break; + case GDIMODE_EMULATED: + default: res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); - OutTrace("Debug: PROXY dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWidth, nHeight); - } + break; } + } else { res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); } + if(res && IsToScreen) dxw.ShowOverlay(hdcDest); if(!res) OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); - return res; } @@ -823,29 +824,42 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH OutTraceB("GDI.PatBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n", dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest)); - IsToScreen=FALSE; - res=0; - if (OBJ_DC == GetObjectType(hdcDest)){ - IsToScreen=TRUE; - if (dxw.HandleFPS()) return TRUE; - if (dxw.dwFlags3 & NOGDIBLT) return TRUE; - if (dxw.IsFullScreen()){ - dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight); - dxw.ShowOverlay(hdcDest); - res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); - } - else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: See StretchBlt. - dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight); - res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); + if(dxw.dwFlags3 & GDIEMULATEDC){ + if (hdcDest==dxw.RealHDC) hdcDest=dxw.VirtualHDC; + OutTraceB("GDI.PatBlt: DEBUG emulated hdc dest=%x->%x\n", dxw.RealHDC, hdcDest); + } + + if(hdcDest == NULL){ + // happens in Reah, hdc is NULL despite the fact that BeginPaint returns a valid DC. Too bad, we recover here ... + hdcDest = (*pGDIGetDC)(dxw.GethWnd()); + OutTraceB("GDI.PatBlt: DEBUG hdc dest=NULL->%x\n", hdcDest); + } + + IsToScreen=(OBJ_DC == GetObjectType(hdcDest)); + if (IsToScreen && (dxw.dwFlags3 & NOGDIBLT)) return TRUE; + if(dxw.IsFullScreen()) { + switch(GDIEmulationMode){ + case GDIMODE_STRETCHED: { + int nWDest, nHDest; + nWDest= nWidth; + nHDest= nHeight; + dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, dwRop); + OutTraceB("GDI.PatBlt: DEBUG DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + } + break; + case GDIMODE_EMULATED: + default: + res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); + break; } } else { - res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); + res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); } - if (IsToScreen) dxw.ShowOverlay(hdcDest); - if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); + if(res && IsToScreen) dxw.ShowOverlay(hdcDest); + if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; } @@ -861,24 +875,41 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n", dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest)); - IsToScreen=FALSE; - if (OBJ_DC == GetObjectType(hdcDest)){ - if (dxw.HandleFPS()) return TRUE; - if (dxw.dwFlags3 & NOGDIBLT) return TRUE; - IsToScreen=TRUE; - if(dxw.IsFullScreen()){ - dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight); - } - else if(WindowFromDC(hdcDest)==NULL){ - // V2.02.31: In "Silent Hunter II" intro movie, QuickTime 5 renders the video on the PrimarySurface->GetDC device context, - // that is a memory device type associated to NULL (desktop) window, through GDI StretchBlt api. So, you shoud compensate - // by scaling and offsetting to main window. - dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight); - } + if(dxw.dwFlags3 & GDIEMULATEDC){ + if (hdcDest==dxw.RealHDC) hdcDest=dxw.VirtualHDC; + OutTraceB("GDI.StretchBlt: DEBUG emulated hdc dest=%x->%x\n", dxw.RealHDC, hdcDest); } - res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop); - if (IsToScreen) dxw.ShowOverlay(hdcDest); + if(hdcDest == NULL){ + // happens in Reah, hdc is NULL despite the fact that BeginPaint returns a valid DC. Too bad, we recover here ... + hdcDest = (*pGDIGetDC)(dxw.GethWnd()); + OutTraceB("GDI.StretchBlt: DEBUG hdc dest=NULL->%x\n", hdcDest); + } + + IsToScreen=(OBJ_DC == GetObjectType(hdcDest)); + if (IsToScreen && (dxw.dwFlags3 & NOGDIBLT)) return TRUE; + if(dxw.IsFullScreen()) { + switch(GDIEmulationMode){ + case GDIMODE_STRETCHED: { + int nWDest, nHDest; + nWDest= nWidth; + nHDest= nHeight; + dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest); + res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); + OutTraceB("GDI.StretchBlt: DEBUG DC dest=(%d,%d) size=(%d,%d)\n", nXDest, nYDest, nWDest, nHDest); + } + break; + case GDIMODE_EMULATED: + default: + res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); + break; + } + } + else { + res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); + } + + if(res && IsToScreen) dxw.ShowOverlay(hdcDest); if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; } diff --git a/dll/msvfw.cpp b/dll/msvfw.cpp index cda90b5..90c88fb 100644 --- a/dll/msvfw.cpp +++ b/dll/msvfw.cpp @@ -16,6 +16,18 @@ DWORD WINAPI extICDrawBegin(HIC, DWORD, HPALETTE, HWND, HDC, int, int, int, int typedef BOOL (WINAPI *DrawDibDraw_Type)(HDRAWDIB, HDC, int, int, int, int, LPBITMAPINFOHEADER, LPVOID, int, int, int, int, UINT); DrawDibDraw_Type pDrawDibDraw = NULL; BOOL WINAPI extDrawDibDraw(HDRAWDIB, HDC, int, int, int, int, LPBITMAPINFOHEADER, LPVOID, int, int, int, int, UINT); +typedef BOOL (WINAPI *DrawDibBegin_Type)(HDRAWDIB, HDC, int, int, LPBITMAPINFOHEADER, int, int, UINT); +DrawDibBegin_Type pDrawDibBegin = NULL; +BOOL WINAPI extDrawDibBegin(HDRAWDIB, HDC, int, int, LPBITMAPINFOHEADER, int, int, UINT); +typedef BOOL (WINAPI *DrawDibStart_Type)(HDRAWDIB, LONG); +DrawDibStart_Type pDrawDibStart = NULL; +BOOL WINAPI extDrawDibStart(HDRAWDIB, LONG); +typedef BOOL (WINAPI *DrawDibStop_Type)(HDRAWDIB); +DrawDibStop_Type pDrawDibStop = NULL; +BOOL WINAPI extDrawDibStop(HDRAWDIB); +typedef BOOL (WINAPI *DrawDibEnd_Type)(HDRAWDIB); +DrawDibEnd_Type pDrawDibEnd = NULL; +BOOL WINAPI extDrawDibEnd(HDRAWDIB); static HookEntry_Type Hooks[]={ //{HOOK_HOT_CANDIDATE, "ICSendMessage", (FARPROC)NULL, (FARPROC *)&pICSendMessage, (FARPROC)extICSendMessage}, @@ -24,6 +36,10 @@ static HookEntry_Type Hooks[]={ {HOOK_HOT_CANDIDATE, "ICGetDisplayFormat", (FARPROC)NULL, (FARPROC *)&pICGetDisplayFormat, (FARPROC)extICGetDisplayFormat}, // "Man in Black" - beware: this is NOT STDCALL!!! {HOOK_HOT_CANDIDATE, "ICDrawBegin", (FARPROC)NULL, (FARPROC *)&pICDrawBegin, (FARPROC)extICDrawBegin}, {HOOK_HOT_CANDIDATE, "DrawDibDraw", (FARPROC)NULL, (FARPROC *)&pDrawDibDraw, (FARPROC)extDrawDibDraw}, + {HOOK_HOT_CANDIDATE, "DrawDibBegin", (FARPROC)NULL, (FARPROC *)&pDrawDibBegin, (FARPROC)extDrawDibBegin}, + {HOOK_HOT_CANDIDATE, "DrawDibStart", (FARPROC)NULL, (FARPROC *)&pDrawDibStart, (FARPROC)extDrawDibStart}, + {HOOK_HOT_CANDIDATE, "DrawDibStop", (FARPROC)NULL, (FARPROC *)&pDrawDibStop, (FARPROC)extDrawDibStop}, + {HOOK_HOT_CANDIDATE, "DrawDibEnd", (FARPROC)NULL, (FARPROC *)&pDrawDibEnd, (FARPROC)extDrawDibEnd}, {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator }; @@ -236,4 +252,43 @@ BOOL WINAPI extDrawDibDraw(HDRAWDIB hdd, HDC hdc, int xDst, int yDst, int dxDst, hdd, hdc, xDst, yDst, dxDst, dyDst, xSrc, ySrc, dxSrc, dySrc, wFlags); ret = (*pDrawDibDraw)(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags); return ret; -} \ No newline at end of file +} +BOOL WINAPI extDrawDibBegin(HDRAWDIB hdd, HDC hdc, int dxDest, int dyDest, LPBITMAPINFOHEADER lpbi, int dxSrc, int dySrc, UINT wFlags) +{ + // Reah game transitions + BOOL ret; + OutTrace("DrawDibBegin: hdd=%x hdc=%x DEST size=(%d,%d) SRC size=(%d,%d) flags=%x\n", + hdd, hdc, dxDest, dyDest, dxSrc, dySrc, wFlags); + ret = (*pDrawDibBegin)(hdd, hdc, dxDest, dyDest, lpbi, dxSrc, dySrc, wFlags); + return ret; +} + +BOOL WINAPI extDrawDibStart(HDRAWDIB hdd, LONG rate) +{ + // Reah game transitions + BOOL ret; + OutTrace("DrawDibStart: hdd=%x rate=%x\n", hdd, rate); + ret = (*pDrawDibStart)(hdd, rate); + return ret; +} + +BOOL WINAPI extDrawDibStop(HDRAWDIB hdd) +{ + // Reah game transitions + BOOL ret; + OutTrace("DrawDibStop: hdd=%x\n", hdd); + ret = (*pDrawDibStop)(hdd); + return ret; +} + +BOOL WINAPI extDrawDibEnd(HDRAWDIB hdd) +{ + // Reah game transitions + BOOL ret; + OutTrace("DrawDibEnd: hdd=%x\n", hdd); + ret = (*pDrawDibEnd)(hdd); + return ret; +} + + + diff --git a/dll/user32.cpp b/dll/user32.cpp index 6653001..4a68e35 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -620,7 +620,6 @@ BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase) OutTraceDW("InvalidateRect: hwnd=%x rect=NULL erase=%x\n", hwnd, bErase); - if(dxw.IsFullScreen()) { switch(GDIEmulationMode){ case GDIMODE_STRETCHED: @@ -2086,20 +2085,26 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint) // if not in fullscreen mode, that's all! if(!dxw.IsFullScreen()) return hdc; - // on CLIENTREMAPPING, resize the paint area to virtual screen size - //if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect(); - if(dxw.dwFlags1 & CLIENTREMAPPING) dxw.UnmapClient(&(lpPaint->rcPaint)); - switch(GDIEmulationMode){ - case GDIMODE_STRETCHED: - break; - case GDIMODE_EMULATED: - HDC EmuHDC; - EmuHDC = dxw.AcquireEmulatedDC(hwnd); - lpPaint->hdc=EmuHDC; - hdc = EmuHDC; - break; + if(bFlippedDC) { + hdc = dxw.AcquireSharedDC(hwnd); } + else { + switch(GDIEmulationMode){ + case GDIMODE_STRETCHED: + // on CLIENTREMAPPING, resize the paint area to virtual screen size + //if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect(); + if(dxw.dwFlags1 & CLIENTREMAPPING) dxw.UnmapClient(&(lpPaint->rcPaint)); + break; + case GDIMODE_EMULATED: + HDC EmuHDC; + EmuHDC = dxw.AcquireEmulatedDC(hwnd); + lpPaint->hdc=EmuHDC; + hdc = EmuHDC; + break; + } + } + OutTraceDW("GDI.BeginPaint: hdc=%x rcPaint=(%d,%d)-(%d,%d)\n", hdc, lpPaint->rcPaint.left, lpPaint->rcPaint.top, lpPaint->rcPaint.right, lpPaint->rcPaint.bottom); diff --git a/dll/winmm.cpp b/dll/winmm.cpp index 111cbc2..2182c02 100644 --- a/dll/winmm.cpp +++ b/dll/winmm.cpp @@ -339,12 +339,18 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji) dwButtons = 0; if (GetKeyState(VK_LBUTTON) < 0) dwButtons |= JOY_BUTTON1; if (GetKeyState(VK_RBUTTON) < 0) dwButtons |= JOY_BUTTON2; + if (GetKeyState(VK_MBUTTON) < 0) dwButtons |= JOY_BUTTON3; POINT pt; if(hwnd=dxw.GethWnd()){ RECT client; POINT upleft = {0,0}; (*pGetClientRect)(hwnd, &client); (*pClientToScreen)(hwnd, &upleft); + if(dwButtons & JOY_BUTTON3){ + // center joystick ... + dwButtons &= ~JOY_BUTTON3; + (*pSetCursorPos)(upleft.x + (client.right >> 1), upleft.y + (client.bottom >> 1)); + } (*pGetCursorPos)(&pt); pt.x -= upleft.x; pt.y -= upleft.y; @@ -391,7 +397,6 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons) RECT client; RECT win; POINT PrevViewPort; - int StretchMode; // don't show when system cursor is visible CURSORINFO ci; @@ -422,16 +427,12 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons) (*pGetWindowRect)(dxw.GethWnd(), &win); - //if(!pSetViewportOrgEx) pSetViewportOrgEx=SetViewportOrgEx; (*pSetViewportOrgEx)(hClientDC, 0, 0, &PrevViewPort); - StretchMode=GetStretchBltMode(hClientDC); - SetStretchBltMode(hClientDC, HALFTONE); int w, h; - w=36; - h=36; - (*pGDIStretchBlt)(hClientDC, x-(w>>1), y-(h>>1), w, h, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); + w=bm.bmWidth; + h=bm.bmHeight; + (*pGDIBitBlt)(hClientDC, x-(w>>1), y-(h>>1), w, h, hdcMem, 0, 0, SRCPAINT); - SetStretchBltMode(hClientDC, StretchMode); (*pSetViewportOrgEx)(hClientDC, PrevViewPort.x, PrevViewPort.y, NULL); SelectObject(hdcMem, hbmOld); DeleteDC(hdcMem); diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 45864e2..4c24b1d 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 9b0926d..9805e85 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ