diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 9369f4d..266d200 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -63,7 +63,7 @@ #define HIDEMULTIMONITOR 0x00008000 // hide multimonitor configurations: GetAdapterCount returns 1. #define TIMESTRETCH 0x00010000 // make system time stretchable #define HOOKOPENGL 0x00020000 // Hook OpenGL calls -//#define WALLPAPERMODE 0x00040000 // mouse events are discarded (good for screensaver-like) +#define LOCKEDSIZE 0x00040000 // window resizzing is not allowed #define SHOWHWCURSOR 0x00080000 // enable hardware cursor #define GDISTRETCHED 0x00100000 // Stretch GDI/user32 coordinates to adapt to window size #define SHOWFPSOVERLAY 0x00200000 // shows FPS value to status win / log / screen overlay @@ -243,6 +243,7 @@ #define LOCKCOLORDEPTH 0x02000000 // lock ddraw color depth to current desktop value (used in SetDisplayMode) #define FIXSMACKLOOP 0x04000000 // fix Smack loop by insert processmessage and blit between frames #define FIXFREELIBRARY 0x08000000 // fix FreeLibrary simulating retcode 0(error) when attempting free of unallocated module +#define ANCHORED 0x10000000 // Anchored position & size, mo stretching or sliding is allowed // eighth flags DWORD dxw.dwFlags8: diff --git a/build/dxwnd.dll b/build/dxwnd.dll index f6ce91f..eb6f0b0 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:287b4afcae41e705bf3b4f67be71fce5403a26b7494cad40d5f1e4dbf5bf2925 -size 698368 +oid sha256:e98419de58b94f79d91d5044fe603e7754db6ea3d79e641b4fc16d9df5ea17e5 +size 700416 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 3dd268f..a2e5bb3 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46c4384a402e3f5d23af6b3f6f9649833e7aefedf0c46bfd7eee282d8029f6ff +oid sha256:a75eed6fc7414d986f53c430fc32131c3052a40abfabdac6c13e0ba6a8900b08 size 664576 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index 792bbe7..aed0584 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -3,8 +3,19 @@ exepath=D:\Games\Year Dead\ posx=1164 posy=243 sizx=320 -sizy=200 +sizy=494 exportpath=G:\DxWnd.develop\v2_03_94fx3_src\build\exports\ +debug=1 +autohide=0 +checkadmin=0 +namefromfolder=0 +multiprocesshook=0 +updatepaths=1 +defaultcoord=0 +defaultposx=50 +defaultposy=50 +defaultsizx=800 +defaultsizy=600 [target] title0=NITRO.EXE path0=D:\Games\WCW Nitro\NITRO.EXE @@ -109,7 +120,7 @@ slowratio2=2 initresw2=640 initresh2=480 title3=yeardead.exe -path3=D:\Games\Year Dead\yeardead.exe +path3=f:\Games\Year Dead\yeardead.exe startfolder3= launchpath3= module3= @@ -176,3 +187,95 @@ maxddinterface4=7 slowratio4=1 initresw4=0 initresh4=0 +title5=Adrenix 3D +path5=F:\Games\Adrenix\AdrenixD.exe +startfolder5= +launchpath5= +module5= +opengllib5= +notes5= +registry5= +ver5=0 +monitorid5=0 +coord5=0 +flag5=134235174 +flagg5=1216413696 +flagh5=20 +flagi5=138412036 +flagj5=5248 +flagk5=65536 +flagl5=0 +flagm5=0 +tflag5=6402 +dflag5=0 +posx5=50 +posy5=50 +sizx5=800 +sizy5=600 +maxfps5=0 +initts5=0 +winver5=0 +maxres5=-1 +swapeffect5=0 +maxddinterface5=7 +slowratio5=1 +initresw5=0 +initresh5=0 +title6=Adrenix +path6=F:\Games\Adrenix\Adrenix.exe +startfolder6= +launchpath6= +module6= +opengllib6= +notes6= +registry6= +ver6=0 +monitorid6=0 +coord6=0 +flag6=136314918 +flagg6=1207959552 +flagh6=20 +flagi6=138412036 +flagj6=4224 +flagk6=0 +flagl6=0 +flagm6=0 +tflag6=0 +dflag6=0 +posx6=50 +posy6=50 +sizx6=800 +sizy6=600 +maxfps6=0 +initts6=0 +winver6=0 +maxres6=-1 +swapeffect6=0 +maxddinterface6=7 +slowratio6=1 +initresw6=0 +initresh6=0 +[texture] +MinTexX=0 +MinTexY=0 +MaxTexX=0 +MaxTexY=0 +[keymapping] +timetoggle= +timefast= +timeslow= +altf4= +cliptoggle= +refresh= +logtoggle= +plogtoggle= +fpstoggle= +printscreen= +corner= +freezetime= +fullscreen= +workarea= +desktop= +minimize= +restore= +kill= diff --git a/build/exports/Medford Asylum.dxw b/build/exports/Medford Asylum.dxw new file mode 100644 index 0000000..9002bcc --- /dev/null +++ b/build/exports/Medford Asylum.dxw @@ -0,0 +1,35 @@ +[target] +title0=Medford Asylum +path0=F:\Games\Medford Asylum\MedfordAsylum.exe +startfolder0= +launchpath0= +module0= +opengllib0= +notes0= +registry0= +ver0=0 +monitorid0=-1 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=675282948 +flagj0=4224 +flagk0=65536 +flagl0=25165824 +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 +slowratio0=2 +initresw0=800 +initresh0=600 diff --git a/build/exports/dxwnd.log b/build/exports/dxwnd.log index a286f15..ef57fae 100644 --- a/build/exports/dxwnd.log +++ b/build/exports/dxwnd.log @@ -1,31 +1,6 @@ -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" +OnRun idx=7 prog="F:\Games\Warhammer 40K Rites Of War\RoW.exe" setwindowshook mode -OnRun idx=17 prog="F:\Games\Adrenix\AdrenixD.exe" +OnRun idx=7 prog="F:\Games\Warhammer 40K Rites Of War\RoW.exe" setwindowshook mode -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" -checksafediscversion -setwindowshook mode -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" -setwindowshook mode -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" -setwindowshook mode -OnRun idx=18 prog="V:\ADRENIX.EXE" -setwindowshook mode -OnRun idx=19 prog="V:\ADRENIXD.EXE" -setwindowshook mode -OnRun idx=20 prog="V:\ADRHEAT.EXE" -setwindowshook mode -OnRun idx=21 prog="V:\ADRHEATD.EXE" -setwindowshook mode -OnRun idx=22 prog="V:\ADX_VID.EXE" -setwindowshook mode -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" -setwindowshook mode -OnRun idx=17 prog="F:\Games\Adrenix\AdrenixD.exe" -setwindowshook mode -OnRun idx=17 prog="F:\Games\Adrenix\AdrenixD.exe" -setwindowshook mode -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" -setwindowshook mode -OnRun idx=16 prog="F:\Games\Adrenix\Adrenix.exe" +OnRun idx=7 prog="F:\Games\Warhammer 40K Rites Of War\RoW.exe" setwindowshook mode diff --git a/build/exports/dxwnd.reg b/build/exports/dxwnd.reg deleted file mode 100644 index 396bec7..0000000 --- a/build/exports/dxwnd.reg +++ /dev/null @@ -1,20 +0,0 @@ - -[HKEY_LOCAL_MACHINE\SOFTWARE\Interplay] - -[HKEY_LOCAL_MACHINE\SOFTWARE\Interplay\Dragon Dice] -"ApplicationPath"="d:\\games\\ddice\\" -"StarfleetDemo"=dword:00000001 -"GameInstalled"=dword:00000001 -"ZoomLevel"=dword:00000000 -"DieSortType"=dword:00000001 -"DisplayDieFaceType"=dword:00000000 -"DisplayRoll"=dword:00000001 -"DisplayBattle"=dword:00000001 -"DisplayDragonVsDragon"=dword:00000001 -"PlaySounds"=dword:00000001 -"PlayMusic"=dword:00000001 -"DemoMode"=dword:00000001 -"DisplayGameMessages"=dword:00000001 - -[HKEY_LOCAL_MACHINE\SOFTWARE\Interplay\Dragon Dice\1.0] - diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 8b9fb48..50dd839 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1330,4 +1330,12 @@ add: more logging in mciSendCommand - possibly some regression problem... fix: corrected clipping bug introduced in v2.03.93. fix: SetWindowLog hooker preventing to set DxWnd windowproc when not in fullscreen mode. Fixes "Nascar Racing 3" recursion and crash. fix: eliminated useless filter to suppress high resolutions detection in PREVENTMAXIMAZE mode -fix: fixed mciSendCommand wrapper log messages that could crash the program \ No newline at end of file +fix: fixed mciSendCommand wrapper log messages that could crash the program + +v2.03.95: +fix: fixed prototype for ICDrawBegin wrapper +add: extended logging for mci multimedia API +add: window position selector & "locked size" + "anchored" modes +fix: transient mode when system tray is not available +fix: recursion problem in kernel32 LoadLibrary* wrappers. Allows "Hot patch" on WinXP. +fix: initial position problem. diff --git a/dll/dwhide.cpp b/dll/dwhide.cpp index e888303..09f8b77 100644 --- a/dll/dwhide.cpp +++ b/dll/dwhide.cpp @@ -41,15 +41,15 @@ void gShowHideTaskBar(BOOL bHide /*=FALSE*/) // Code to Hide the System Task Bar rectWorkArea.bottom += (rectTaskBar.bottom - rectTaskBar.top); (*pSystemParametersInfoA)(SPI_SETWORKAREA, 0, (LPVOID)&rectWorkArea, 0); - ShowWindow(pWnd, SW_HIDE); - ShowWindow(pStart, SW_HIDE); + (*pShowWindow)(pWnd, SW_HIDE); + (*pShowWindow)(pStart, SW_HIDE); } else{ // Code to Show the System Task Bar rectWorkArea.bottom -= (rectTaskBar.bottom - rectTaskBar.top); (*pSystemParametersInfoA)(SPI_SETWORKAREA, 0, (LPVOID)&rectWorkArea, 0); - ShowWindow(pWnd, SW_SHOW); - ShowWindow(pStart, SW_SHOW); + (*pShowWindow)(pWnd, SW_SHOW); + (*pShowWindow)(pStart, SW_SHOW); } } diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 1b82994..168596c 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -78,7 +78,7 @@ static char *Flag2Names[32]={ "KEEPASPECTRATIO", "INIT8BPP", "FORCEWINRESIZE", "INIT16BPP", "KEEPCURSORFIXED", "DISABLEGAMMARAMP", "INDEPENDENTREFRESH", "FIXNCHITTEST", "LIMITFPS", "SKIPFPS", "SHOWFPS", "HIDEMULTIMONITOR", - "TIMESTRETCH", "HOOKOPENGL", "-------", "SHOWHWCURSOR", + "TIMESTRETCH", "HOOKOPENGL", "LOCKEDSIZE", "SHOWHWCURSOR", "GDISTRETCHED", "SHOWFPSOVERLAY", "FAKEVERSION", "FULLRECTBLT", "NOPALETTEUPDATE", "SUPPRESSIME", "NOBANNER", "WINDOWIZE", "LIMITRESOURCES", "STARTDEBUG", "SETCOMPATIBILITY", "WIREFRAME", @@ -136,7 +136,7 @@ static char *Flag7Names[32]={ "SSUPPRESSDIERRORS", "HOOKNORUN", "FIXBINDTEXTURE", "ENUM16BITMODES", "SHAREDKEYBOARD", "HOOKNOUPDATE", "HOOKGLUT32", "INITIALRES", "MAXIMUMRES", "LOCKCOLORDEPTH", "FIXSMACKLOOP", "FIXFREELIBRARY", - "", "", "", "", + "ANCHORED", "", "", "", }; static char *Flag8Names[32]={ @@ -1616,7 +1616,7 @@ void HookLibraryEx(HMODULE hModule, HookEntryEx_Type *Hooks, char *DLLName) ((dxw.dwFlags4 & HOTPATCHALWAYS) && (Hooks->HookStatus != HOOK_HOT_LINKED))) // force hot patch and not already hooked && Hooks->StoreAddress){ // and save ptr available - // Hot Patch - beware! This way yo're likely to hook unneeded libraries. + // Hot Patch - beware! This way you're likely to hook unneeded libraries. if(!Hooks->OriginalAddress) { if(!hDLL) { hDLL = (*pLoadLibraryA)(DLLName); diff --git a/dll/dxmapping.cpp b/dll/dxmapping.cpp index 2b29b3f..6abf839 100644 --- a/dll/dxmapping.cpp +++ b/dll/dxmapping.cpp @@ -410,6 +410,10 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP if(dxw.dwFlags4 & BILINEAR2XFILTER) MaxY <<= 1; // double } else{ + if((dxw.dwFlags2 & LOCKEDSIZE) || (dxw.dwFlags7 & ANCHORED)){ + iSizX = iSiz0X; + iSizY = iSiz0Y; + } MaxX = iSizX; MaxY = iSizY; } diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index dbec457..d13cd06 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -126,8 +126,8 @@ void dxwCore::InitTarget(TARGETMAP *target) pTimeShifter = TimeShifterCoarse; pTimeShifter64 = TimeShifter64Coarse; } - iSizX = target->sizx; - iSizY = target->sizy; + iSiz0X = iSizX = target->sizx; + iSiz0Y = iSizY = target->sizy; iPosX = target->posx; iPosY = target->posy; iMaxW = target->resw; @@ -1013,6 +1013,8 @@ void dxwCore::ShowBanner(HWND hwnd) hClientDC=(*pGDIGetDC)(hwnd); (*pGetClientRect)(hwnd, &client); + //(*pInvalidateRect)((*pGetDesktopWindow)(), NULL, FALSE); // invalidate full desktop, no erase. + (*pInvalidateRect)(0, NULL, FALSE); // invalidate full desktop, no erase. (*pGDIBitBlt)(hClientDC, 0, 0, client.right, client.bottom, NULL, 0, 0, BLACKNESS); if(JustOnce || (dwFlags2 & NOBANNER)) return; diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index 7f79766..9d43712 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -176,6 +176,8 @@ public: // simple data variables long iPosY; long iSizX; long iSizY; + long iSiz0X; + long iSiz0Y; long iMaxW; long iMaxH; int iRatioX; diff --git a/dll/dxwnd.aps b/dll/dxwnd.aps index 73667a3..1a29971 100644 Binary files a/dll/dxwnd.aps and b/dll/dxwnd.aps differ diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 323cee6..caf94af 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.94.fx3" +#define VERSION "2.03.95" #define DDTHREADLOCK 1 //#define LOCKTHREADS @@ -59,6 +59,8 @@ BOOL APIENTRY DllMain( HANDLE hmodule, HANDLE hCurrentThread; if(dwreason == DLL_PROCESS_DETACH){ + //if(pInvalidateRect && pGetDesktopWindow) (*pInvalidateRect)((*pGetDesktopWindow)(), NULL, FALSE); // invalidate full desktop, no erase. + if(pInvalidateRect) (*pInvalidateRect)(0, NULL, FALSE); // invalidate full desktop, no erase. UnmapViewOfFile(pMapping); CloseHandle(hMapping); } diff --git a/dll/dxwnd.vs2008.sln b/dll/dxwnd.vs2008.sln new file mode 100644 index 0000000..0d2e531 --- /dev/null +++ b/dll/dxwnd.vs2008.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.vs2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.ActiveCfg = Debug|Win32 + {579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.Build.0 = Debug|Win32 + {579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.ActiveCfg = Release|Win32 + {579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 5c8cd33..40035cd 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/hotpatch.cpp b/dll/hotpatch.cpp index 496b6e2..5202c61 100644 --- a/dll/hotpatch.cpp +++ b/dll/hotpatch.cpp @@ -98,4 +98,4 @@ void *HotPatch(void *apiproc, const char *apiname, void *hookproc) OutTrace("HotPatch: api=%s addr=%x->%x hook=%x\n", apiname, apiproc, orig_address, hookproc); return orig_address; #endif -} \ No newline at end of file +} \ No newline at end of file diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 4cd2989..3065f0d 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -521,12 +521,25 @@ LoadLibrary (hooking) related APIs HMODULE SysLibs[SYSLIBIDX_MAX]; -HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags, char *api) +HMODULE WINAPI LoadLibraryExWrapper(LPVOID lpFileName, BOOL IsWidechar, HANDLE hFile, DWORD dwFlags, char *api) { HMODULE libhandle; int idx; + // recursion control: this is necessary so far only on WinXP while other OS like Win7,8,10 don't get into + // recursion problems, but in any case better to leave it here, you never know .... + static BOOL Recursed = FALSE; - libhandle=(*pLoadLibraryExA)(lpFileName, hFile, dwFlags); + if(IsWidechar){ + OutTraceB("%s: file=%ls flags=%x\n", api, lpFileName, dwFlags); + libhandle=(*pLoadLibraryExW)((LPCWSTR)lpFileName, hFile, dwFlags); + } + else{ + OutTraceB("%s: file=%s flags=%x\n", api, lpFileName, dwFlags); + libhandle=(*pLoadLibraryExA)((LPCTSTR)lpFileName, hFile, dwFlags); + } + + if(Recursed) return libhandle; + Recursed = TRUE; // found in "The Rage" (1996): loading a module with relative path after a SetCurrentDirectory may fail, though // the module is present in the current directory folder. To fix this problem in case of failure it is possible @@ -534,14 +547,23 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl if(!libhandle){ char lpBuffer[MAX_PATH+1]; GetCurrentDirectory(MAX_PATH, lpBuffer); + if(IsWidechar) + sprintf_s(lpBuffer, MAX_PATH, "%s/%ls", lpBuffer, lpFileName); + else sprintf_s(lpBuffer, MAX_PATH, "%s/%s", lpBuffer, lpFileName); - OutTrace("GHODEBUG: fullpath=\"%s\"\n", lpBuffer); + + OutTrace("LoadLibrary: RETRY fullpath=\"%s\"\n", lpBuffer); libhandle=(*pLoadLibraryExA)(lpBuffer, hFile, dwFlags); } + if(IsWidechar) + OutTraceDW("%s: FileName=%ls hFile=%x Flags=%x(%s) hmodule=%x\n", api, lpFileName, hFile, dwFlags, ExplainLoadLibFlags(dwFlags), libhandle); + else OutTraceDW("%s: FileName=%s hFile=%x Flags=%x(%s) hmodule=%x\n", api, lpFileName, hFile, dwFlags, ExplainLoadLibFlags(dwFlags), libhandle); + if(!libhandle){ OutTraceE("%s: ERROR FileName=%s err=%d\n", api, lpFileName, GetLastError()); + Recursed = FALSE; return libhandle; } @@ -549,46 +571,45 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl // there's no symbol map, then itìs no possible to hook function calls. if(dwFlags & (LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE|LOAD_LIBRARY_AS_DATAFILE)) return libhandle; + char *AnsiFileName; + if(IsWidechar){ + static char sFileName[256+1]; + wcstombs_s(NULL, sFileName, (LPCWSTR)lpFileName, 80); + AnsiFileName = sFileName; + } + else + AnsiFileName = (char *)lpFileName; + idx=dxw.GetDLLIndex((char *)lpFileName); if(idx != -1) { - OutTraceDW("%s: push idx=%x library=%s hdl=%x\n", api, idx, lpFileName, libhandle); + OutTraceDW("%s: push idx=%x library=%s hdl=%x\n", api, idx, AnsiFileName, libhandle); SysLibs[idx]=libhandle; } // handle custom OpenGL library - if(!lstrcmpi(lpFileName,dxw.CustomOpenGLLib)){ + if(!lstrcmpi(AnsiFileName,dxw.CustomOpenGLLib)){ idx=SYSLIBIDX_OPENGL; SysLibs[idx]=libhandle; } if (idx == -1) { - OutTraceDW("%s: hooking lib=\"%s\" handle=%x\n", api, lpFileName, libhandle); + OutTraceDW("%s: hooking lib=\"%s\" handle=%x\n", api, AnsiFileName, libhandle); HookModule(libhandle, 0); } + + Recursed = FALSE; return libhandle; } HMODULE WINAPI extLoadLibraryA(LPCTSTR lpFileName) -{ - return LoadLibraryExWrapper(lpFileName, NULL, 0, "LoadLibraryA"); -} +{ return LoadLibraryExWrapper((LPVOID)lpFileName, FALSE, NULL, 0, "LoadLibraryA"); } HMODULE WINAPI extLoadLibraryW(LPCWSTR lpFileName) -{ - char sFileName[256+1]; - wcstombs_s(NULL, sFileName, lpFileName, 80); - return LoadLibraryExWrapper(sFileName, NULL, 0, "LoadLibraryW");; -} +{ return LoadLibraryExWrapper((LPVOID)lpFileName, TRUE, NULL, 0, "LoadLibraryW"); } HMODULE WINAPI extLoadLibraryExA(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags) -{ - return LoadLibraryExWrapper(lpFileName, hFile, dwFlags, "LoadLibraryExA"); -} +{ return LoadLibraryExWrapper((LPVOID)lpFileName, FALSE, hFile, dwFlags, "LoadLibraryExA"); } HMODULE WINAPI extLoadLibraryExW(LPCWSTR lpFileName, HANDLE hFile, DWORD dwFlags) -{ - char sFileName[256+1]; - wcstombs_s(NULL, sFileName, lpFileName, 80); - return LoadLibraryExWrapper(sFileName, hFile, dwFlags, "LoadLibraryExW");; -} +{ return LoadLibraryExWrapper((LPVOID)lpFileName, TRUE, hFile, dwFlags, "LoadLibraryExW"); } extern DirectDrawCreate_Type pDirectDrawCreate; extern DirectDrawCreateEx_Type pDirectDrawCreateEx; diff --git a/dll/msvfw.cpp b/dll/msvfw.cpp index 5768d26..cc43fd6 100644 --- a/dll/msvfw.cpp +++ b/dll/msvfw.cpp @@ -10,9 +10,9 @@ #include "msvfwhook.h" #undef DXWDECLARATIONS -typedef DWORD (WINAPI *ICDrawBegin_Type)(HIC, DWORD, HPALETTE, HWND, HDC, int, int, int, int, LPBITMAPINFOHEADER, int, int, int, int, DWORD, DWORD); +typedef DWORD (WINAPIV *ICDrawBegin_Type)(HIC, DWORD, HPALETTE, HWND, HDC, int, int, int, int, LPBITMAPINFOHEADER, int, int, int, int, DWORD, DWORD); ICDrawBegin_Type pICDrawBegin = NULL; -DWORD WINAPI extICDrawBegin(HIC, DWORD, HPALETTE, HWND, HDC, int, int, int, int, LPBITMAPINFOHEADER, int, int, int, int, DWORD, DWORD); +DWORD WINAPIV extICDrawBegin(HIC, DWORD, HPALETTE, HWND, HDC, int, int, int, int, LPBITMAPINFOHEADER, int, int, int, int, DWORD, DWORD); 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); @@ -34,7 +34,7 @@ static HookEntryEx_Type Hooks[]={ //{HOOK_HOT_CANDIDATE, 0, "ICOpen", (FARPROC)NULL, (FARPROC *)&pICOpen, (FARPROC)extICOpen}, {HOOK_HOT_CANDIDATE, 0, "MCIWndCreateA", (FARPROC)NULL, (FARPROC *)&pMCIWndCreateA, (FARPROC)extMCIWndCreateA}, // "Man in Black" - beware: this is NOT STDCALL!!! {HOOK_HOT_CANDIDATE, 0, "ICGetDisplayFormat", (FARPROC)NULL, (FARPROC *)&pICGetDisplayFormat, (FARPROC)extICGetDisplayFormat}, // "Man in Black" - beware: this is NOT STDCALL!!! - {HOOK_HOT_CANDIDATE, 0, "ICDrawBegin", (FARPROC)NULL, (FARPROC *)&pICDrawBegin, (FARPROC)extICDrawBegin}, + {HOOK_HOT_CANDIDATE, 0, "ICDrawBegin", (FARPROC)NULL, (FARPROC *)&pICDrawBegin, (FARPROC)extICDrawBegin}, // AoE demo: not a STDCALL !! {HOOK_HOT_CANDIDATE, 0, "DrawDibDraw", (FARPROC)NULL, (FARPROC *)&pDrawDibDraw, (FARPROC)extDrawDibDraw}, {HOOK_HOT_CANDIDATE, 0, "DrawDibBegin", (FARPROC)NULL, (FARPROC *)&pDrawDibBegin, (FARPROC)extDrawDibBegin}, {HOOK_HOT_CANDIDATE, 0, "DrawDibStart", (FARPROC)NULL, (FARPROC *)&pDrawDibStart, (FARPROC)extDrawDibStart}, @@ -237,7 +237,7 @@ HIC WINAPI extICGetDisplayFormat(HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINF return ret; } -DWORD WINAPI extICDrawBegin(HIC hic, DWORD dwFlags, HPALETTE hpal, HWND hwnd, HDC hdc, int xDst, int yDst, int dxDst, int dyDst, LPBITMAPINFOHEADER lpbi, int xSrc, int ySrc, int dxSrc, int dySrc, DWORD dwRate, DWORD dwScale) +DWORD WINAPIV extICDrawBegin(HIC hic, DWORD dwFlags, HPALETTE hpal, HWND hwnd, HDC hdc, int xDst, int yDst, int dxDst, int dyDst, LPBITMAPINFOHEADER lpbi, int xSrc, int ySrc, int dxSrc, int dySrc, DWORD dwRate, DWORD dwScale) { OutTrace("ICDrawBegin\n"); @@ -253,6 +253,7 @@ BOOL WINAPI extDrawDibDraw(HDRAWDIB hdd, HDC hdc, int xDst, int yDst, int dxDst, ret = (*pDrawDibDraw)(hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags); return ret; } + BOOL WINAPI extDrawDibBegin(HDRAWDIB hdd, HDC hdc, int dxDest, int dyDest, LPBITMAPINFOHEADER lpbi, int dxSrc, int dySrc, UINT wFlags) { // Reah game transitions diff --git a/dll/user32.cpp b/dll/user32.cpp index 76d0974..4ef1743 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -342,12 +342,11 @@ void HookUser32(HMODULE hModule) { HookLibraryEx(hModule, Hooks, libname); + HookLibraryEx(hModule, WinHooks, libname); + if (dxw.GDIEmulationMode != GDIMODE_NONE) HookLibraryEx(hModule, SyscallHooks, libname); if (dxw.dwFlags2 & GDISTRETCHED) HookLibraryEx(hModule, ScaledHooks, libname); - if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibraryEx(hModule, RemapHooks, libname); - //if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)) HookLibraryEx(hModule, WinHooks, libname); - HookLibraryEx(hModule, WinHooks, libname); if ((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) HookLibraryEx(hModule, MouseHooks, libname); if (dxw.dwFlags3 & PEEKALLMESSAGES) HookLibraryEx(hModule, PeekAllHooks, libname); if (dxw.dwFlags2 & TIMESTRETCH) HookLibraryEx(hModule, TimeHooks, libname); @@ -370,14 +369,15 @@ FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule) { FARPROC addr; if (addr=RemapLibraryEx(proc, hModule, Hooks)) return addr; - if (dxw.dwFlags1 & CLIENTREMAPPING) if (addr=RemapLibraryEx(proc, hModule, RemapHooks)) return addr; - if (dxw.GDIEmulationMode != GDIMODE_NONE) if(addr=RemapLibraryEx(proc, hModule, SyscallHooks)) return addr; + if (addr=RemapLibraryEx(proc, hModule, WinHooks)) return addr; - if (dxw.dwFlags2 & GDISTRETCHED) + if (dxw.dwFlags1 & CLIENTREMAPPING) + if (addr=RemapLibraryEx(proc, hModule, RemapHooks)) return addr; + if (dxw.GDIEmulationMode != GDIMODE_NONE) + if(addr=RemapLibraryEx(proc, hModule, SyscallHooks)) return addr; + if (dxw.dwFlags2 & GDISTRETCHED) if (addr=RemapLibraryEx(proc, hModule, ScaledHooks)) return addr; - if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)) - if (addr=RemapLibraryEx(proc, hModule, WinHooks)) return addr; - if ((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) + if ((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) if (addr=RemapLibraryEx(proc, hModule, MouseHooks)) return addr; if (dxw.dwFlags3 & PEEKALLMESSAGES) if (addr=RemapLibraryEx(proc, hModule, PeekAllHooks)) return addr; @@ -536,13 +536,31 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) if(wp->cx>MaxPos.cx) { wp->cx=MaxPos.cx; UpdFlag=1; } if(wp->cy>MaxPos.cy) { wp->cy=MaxPos.cy; UpdFlag=1; } if (UpdFlag) - OutTraceDW("%s: SET max dim=(%d,%d)\n", ApiName, wp->cx, wp->cy); + OutTraceDW("%s: SET max size=(%dx%d)\n", ApiName, wp->cx, wp->cy); } - if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ - dxw.CalculateWindowPos(hwnd, MaxX, MaxY, wp); - OutTraceDW("%s: LOCK pos=(%d,%d) dim=(%d,%d)\n", ApiName, wp->x, wp->y, wp->cx, wp->cy); - } + if (dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ + if (dxw.dwFlags1 & LOCKWINPOS){ + dxw.CalculateWindowPos(hwnd, MaxX, MaxY, wp); + OutTraceDW("%s: LOCK pos=(%d,%d) size=(%dx%d)\n", ApiName, wp->x, wp->y, wp->cx, wp->cy); + } + // v2.03.95: locked size + if (dxw.dwFlags2 & LOCKEDSIZE){ + WINDOWPOS MaxPos; + dxw.CalculateWindowPos(hwnd, MaxX, MaxY, &MaxPos); + wp->cx = MaxPos.cx; + wp->cy = MaxPos.cy; + OutTraceDW("%s: SET locked size=(%dx%d)\n", ApiName, wp->cx, wp->cy); + } + if (dxw.dwFlags7 & ANCHORED){ + WINDOWPOS MaxPos; + dxw.CalculateWindowPos(hwnd, MaxX, MaxY, &MaxPos); + wp->cx = MaxPos.cx; + wp->cy = MaxPos.cy; + wp->x = MaxPos.x; + wp->y = MaxPos.y; + OutTraceDW("%s: SET anchored pos=(%d,%d) size=(%dx%d)\n", ApiName, wp->x, wp->y, wp->cx, wp->cy); + } } if ((dxw.dwFlags2 & KEEPASPECTRATIO) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ // note: while keeping aspect ration, resizing from one corner doesn't tell @@ -739,6 +757,8 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) { BOOL res; extern HWND hTrayWnd; + static long iLastSizX, iLastSizY; + //static long iLastPosX, iLastPosY; OutTraceDW("ShowWindow: hwnd=%x, CmdShow=%x(%s)\n", hwnd, nCmdShow, ExplainShowCmd(nCmdShow)); @@ -765,6 +785,25 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) } res=(*pShowWindow)(hwnd, nCmdShow); + // v2.03.95: force zero size when minimize and drefresh window coordinates + if(hwnd == dxw.GethWnd()){ + if(nCmdShow==SW_MINIMIZE) { + iLastSizX = dxw.iSizX; + iLastSizY = dxw.iSizY; + //iLastPosX = dxw.iPosX; + //iLastPosY = dxw.iPosY; + dxw.iSizX = dxw.iSizY = 0; + } + else { + if((dxw.iSizX == 0) && (dxw.iSizY == 0)){ + dxw.iSizX = iLastSizX; + dxw.iSizY = iLastSizY; + //dxw.iPosX = iLastPosX; + //dxw.iPosY = iLastPosY; + } + } + } + //dxw.UpdateDesktopCoordinates(); OutTraceDW("ShowWindow: res=%x\n", res); return res; @@ -3012,12 +3051,33 @@ BOOL WINAPI extUpdateWindow(HWND hwnd) return ret; } +static char *sRedrawFlags(UINT flags) +{ + static char s[256]; + strcpy(s, "RDW_"); + if(flags & RDW_ERASE) strcat(s, "ERASE+"); + if(flags & RDW_FRAME) strcat(s, "FRAME+"); + if(flags & RDW_INTERNALPAINT) strcat(s, "INTERNALPAINT+"); + if(flags & RDW_INVALIDATE) strcat(s, "INVALIDATE+"); + if(flags & RDW_NOERASE) strcat(s, "NOERASE+"); + if(flags & RDW_NOFRAME) strcat(s, "NOFRAME+"); + if(flags & RDW_NOINTERNALPAINT) strcat(s, "NOINTERNALPAINT+"); + if(flags & RDW_VALIDATE) strcat(s, "VALIDATE+"); + if(flags & RDW_ERASENOW) strcat(s, "ERASENOW+"); + if(flags & RDW_UPDATENOW) strcat(s, "UPDATENOW+"); + if(flags & RDW_ALLCHILDREN) strcat(s, "ALLCHILDREN+"); + if(flags & RDW_NOCHILDREN) strcat(s, "NOCHILDREN+"); + if(strlen(s)>strlen("RDW_")) s[strlen(s)-1]=0; + else s[0]=0; + return s; +} + BOOL WINAPI extRedrawWindow(HWND hWnd, const RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags) { RECT rcUpdate; BOOL ret; - OutTraceDW("RedrawWindow: hwnd=%x hrgn=%x flags=%x\n", hWnd, hrgnUpdate, flags); + OutTraceDW("RedrawWindow: hwnd=%x hrgn=%x flags=%x(%s)\n", hWnd, hrgnUpdate, flags, sRedrawFlags(flags)); // v2.03.64 fix: if hrgnUpdate is set, lprcUpdate is ignored, so it can't be scaled // beware: they both could be null, and that means the whole window diff --git a/dll/winmm.cpp b/dll/winmm.cpp index de489fb..ec9499c 100644 --- a/dll/winmm.cpp +++ b/dll/winmm.cpp @@ -40,6 +40,18 @@ MMRESULT WINAPI extjoyGetPos(DWORD, LPJOYINFO); typedef MMRESULT (WINAPI *auxGetNumDevs_Type)(void); auxGetNumDevs_Type pauxGetNumDevs = NULL; MMRESULT WINAPI extauxGetNumDevs(void); +typedef BOOL (WINAPI *mciGetErrorStringA_Type)(DWORD, LPCSTR, UINT); +mciGetErrorStringA_Type pmciGetErrorStringA; +BOOL WINAPI extmciGetErrorStringA(DWORD, LPCSTR, UINT); +typedef MMRESULT (WINAPI *mixerGetLineControlsA_Type)(HMIXEROBJ, LPMIXERLINECONTROLS, DWORD); +mixerGetLineControlsA_Type pmixerGetLineControlsA; +MMRESULT WINAPI extmixerGetLineControlsA(HMIXEROBJ, LPMIXERLINECONTROLS, DWORD); +typedef UINT (WINAPI *waveOutGetNumDevs_Type)(void); +waveOutGetNumDevs_Type pwaveOutGetNumDevs; +UINT WINAPI extwaveOutGetNumDevs(void); +typedef UINT (WINAPI *mixerGetNumDevs_Type)(void); +mixerGetNumDevs_Type pmixerGetNumDevs; +UINT WINAPI extmixerGetNumDevs(void); static HookEntryEx_Type Hooks[]={ {HOOK_IAT_CANDIDATE, 0, "mciSendCommandA", NULL, (FARPROC *)&pmciSendCommandA, (FARPROC)extmciSendCommandA}, @@ -71,12 +83,22 @@ static HookEntryEx_Type JoyHooks[]={ {HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator }; +static HookEntryEx_Type DebugHooks[]={ + {HOOK_IAT_CANDIDATE, 0, "mciGetErrorStringA", NULL, (FARPROC *)&pmciGetErrorStringA, (FARPROC)extmciGetErrorStringA}, + {HOOK_IAT_CANDIDATE, 0, "mixerGetLineControlsA", NULL, (FARPROC *)&pmixerGetLineControlsA, (FARPROC)extmixerGetLineControlsA}, + {HOOK_IAT_CANDIDATE, 0, "waveOutGetNumDevs", NULL, (FARPROC *)&pwaveOutGetNumDevs, (FARPROC)extwaveOutGetNumDevs}, + {HOOK_IAT_CANDIDATE, 0, "auxGetNumDevs", NULL, (FARPROC *)&pauxGetNumDevs, (FARPROC)extauxGetNumDevs}, + {HOOK_IAT_CANDIDATE, 0, "mixerGetNumDevs", NULL, (FARPROC *)&pmixerGetNumDevs, (FARPROC)extmixerGetNumDevs}, + {HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator +}; + void HookWinMM(HMODULE module, char *libname) { HookLibraryEx(module, Hooks, libname); if(dxw.dwFlags2 & TIMESTRETCH) HookLibraryEx(module, TimeHooks, libname); if(dxw.dwFlags5 & REMAPMCI) HookLibraryEx(module, RemapHooks, libname); if(dxw.dwFlags6 & VIRTUALJOYSTICK) HookLibraryEx(module, JoyHooks, libname); + if(IsDebug) HookLibraryEx(module, DebugHooks, libname); } FARPROC Remap_WinMM_ProcAddress(LPCSTR proc, HMODULE hModule) @@ -90,6 +112,8 @@ FARPROC Remap_WinMM_ProcAddress(LPCSTR proc, HMODULE hModule) if (addr=RemapLibraryEx(proc, hModule, RemapHooks)) return addr; if(dxw.dwFlags6 & VIRTUALJOYSTICK) if (addr=RemapLibraryEx(proc, hModule, JoyHooks)) return addr; + if(IsDebug) + if (addr=RemapLibraryEx(proc, hModule, DebugHooks)) return addr; return NULL; } @@ -651,9 +675,42 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons) DeleteDC(hdcMem); } -// dangerous thing to do: it interferes with "Imperialism II" !!! MMRESULT WINAPI extauxGetNumDevs(void) { - OutTraceDW("auxGetNumDevs: returning fake 1\n"); - return 1; + UINT ret; + ret = (*pauxGetNumDevs)(); + OutTrace("auxGetNumDevs: ret=%d\n", ret); + return ret; +} + +BOOL WINAPI extmciGetErrorStringA(DWORD fdwError, LPCSTR lpszErrorText, UINT cchErrorText) +{ + BOOL ret; + ret = (*pmciGetErrorStringA)(fdwError, lpszErrorText, cchErrorText); + OutTrace("mciGetErrorStringA: ret=%x err=%d text=(%d)\"%s\"\n", ret, fdwError, cchErrorText, lpszErrorText); + return ret; +} + +MMRESULT WINAPI extmixerGetLineControlsA(HMIXEROBJ hmxobj, LPMIXERLINECONTROLS pmxlc, DWORD fdwControls) +{ + MMRESULT ret; + ret = (*pmixerGetLineControlsA)(hmxobj, pmxlc, fdwControls); + OutTrace("mixerGetLineControlsA: ret=%x hmxobj=%x Controls=%x\n", ret, hmxobj, fdwControls); + return ret; +} + +UINT WINAPI extwaveOutGetNumDevs(void) +{ + UINT ret; + ret = (*pwaveOutGetNumDevs)(); + OutTrace("waveOutGetNumDevs: ret=%d\n", ret); + return ret; +} + +UINT WINAPI extmixerGetNumDevs(void) +{ + UINT ret; + ret = (*pmixerGetNumDevs)(); + OutTrace("mixerGetNumDevs: ret=%d\n", ret); + return ret; } diff --git a/host/TabDirect3D.cpp b/host/TabDirect3D.cpp index d1956d1..3bbf77a 100644 --- a/host/TabDirect3D.cpp +++ b/host/TabDirect3D.cpp @@ -35,6 +35,10 @@ void CTabDirect3D::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_SUPPRESSD3DEXT, cTarget->m_SuppressD3DExt); DDX_Check(pDX, IDC_ENUM16BITMODES, cTarget->m_Enum16bitModes); + // Direct3D window tweaks + DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame); + DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove); + // Texture management DDX_Radio(pDX, IDC_TEXTURENONE, cTarget->m_TextureHandling); diff --git a/host/TabWindow.cpp b/host/TabWindow.cpp index 997d962..71ff946 100644 --- a/host/TabWindow.cpp +++ b/host/TabWindow.cpp @@ -32,26 +32,24 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX) // window management DDX_Check(pDX, IDC_FIXWINFRAME, cTarget->m_FixWinFrame); DDX_Check(pDX, IDC_PREVENTMAXIMIZE, cTarget->m_PreventMaximize); - DDX_Check(pDX, IDC_LOCKWINPOS, cTarget->m_LockWinPos); DDX_Check(pDX, IDC_LOCKWINSTYLE, cTarget->m_LockWinStyle); DDX_Check(pDX, IDC_FIXPARENTWIN, cTarget->m_FixParentWin); DDX_Check(pDX, IDC_MODALSTYLE, cTarget->m_ModalStyle); DDX_Check(pDX, IDC_FORCEWINRESIZE, cTarget->m_ForceWinResize); DDX_Check(pDX, IDC_HIDEMULTIMONITOR, cTarget->m_HideMultiMonitor); - //DDX_Check(pDX, IDC_WALLPAPERMODE, cTarget->m_WallpaperMode); DDX_Check(pDX, IDC_RECOVERSCREENMODE, cTarget->m_RecoverScreenMode); DDX_Check(pDX, IDC_REFRESHONRESIZE, cTarget->m_RefreshOnResize); - DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame); - DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove); DDX_Check(pDX, IDC_HIDETASKBAR, cTarget->m_HideTaskbar); DDX_Check(pDX, IDC_UNLOCKZORDER, cTarget->m_UnlockZOrder); DDX_Check(pDX, IDC_NODESTROYWINDOW, cTarget->m_NoDestroyWindow); DDX_Check(pDX, IDC_ACTIVATEAPP, cTarget->m_ActivateApp); + DDX_Radio(pDX, IDC_FREEMOVE, cTarget->m_WinMovementType); + // color management DDX_Radio(pDX, IDC_COLORCURRENT, cTarget->m_InitColorDepth); DDX_Check(pDX, IDC_DISABLEGAMMARAMP, cTarget->m_DisableGammaRamp); - DDX_Check(pDX, IDC_FORCE16BPP, cTarget->m_Force16BPP); + //DDX_Check(pDX, IDC_FORCE16BPP, cTarget->m_Force16BPP); DDX_Check(pDX, IDC_LOCKSYSCOLORS, cTarget->m_LockSysColors); DDX_Check(pDX, IDC_LOCKRESERVEDPALETTE, cTarget->m_LockReservedPalette); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 6f994d4..1d10baa 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -174,17 +174,15 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_GDIColorConv = FALSE; m_PreventMaximize = FALSE; m_ClientRemapping = TRUE; // default true !! - m_LockWinPos = FALSE; m_LockWinStyle = FALSE; m_FixParentWin = FALSE; m_ModalStyle = FALSE; m_KeepAspectRatio = FALSE; m_ForceWinResize = FALSE; m_HideMultiMonitor = FALSE; - //m_WallpaperMode = FALSE; m_FixD3DFrame = FALSE; m_NoWindowMove = FALSE; - m_Force16BPP = FALSE; + //m_Force16BPP = FALSE; m_HookChildWin = FALSE; m_MessageProc = FALSE; //m_NoMouseProc = FALSE; @@ -250,6 +248,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_InitTS = 8; m_SwapEffect = 0; m_InjectionMode = 0; + m_WinMovementType = 0; //}}AFX_DATA_INIT } diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 164f87d..6fa1328 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -40,6 +40,7 @@ public: int m_SlowRatio; int m_LogMode; int m_MonitorId; + int m_WinMovementType; BOOL m_HookDI; BOOL m_HookDI8; BOOL m_EmulateRelMouse; @@ -135,14 +136,12 @@ public: BOOL m_GDIColorConv; BOOL m_PreventMaximize; BOOL m_ClientRemapping; - BOOL m_LockWinPos; BOOL m_LockWinStyle; BOOL m_FixParentWin; BOOL m_ModalStyle; BOOL m_KeepAspectRatio; BOOL m_ForceWinResize; BOOL m_HideMultiMonitor; - //BOOL m_WallpaperMode; BOOL m_FixD3DFrame; BOOL m_NoWindowMove; BOOL m_HookChildWin; @@ -253,7 +252,7 @@ public: BOOL m_BlackWhite; BOOL m_SuppressD3DExt; BOOL m_Enum16bitModes; - BOOL m_Force16BPP; + //BOOL m_Force16BPP; BOOL m_LimitScreenRes; BOOL m_InitialRes; BOOL m_MaximumRes; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 53f6757..674fbb2 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.cpp b/host/dxwndhost.cpp index c4dd3be..acbb58c 100644 --- a/host/dxwndhost.cpp +++ b/host/dxwndhost.cpp @@ -64,6 +64,8 @@ void CNewCommandLineInfo::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast) // /e -- terminates (Ends) the active dxwnd session // /r: -- run the n-th game in configuration and terminate together with it // /a -- auto-hide mode while a game is running + // /q -- quiet mode, no error/message dialog boxes + if(bFlag) { CString sParam(lpszParam); if (sParam.MakeLower() == "t"){ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index 6ec6f9e..56ce0ec 100644 Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ diff --git a/host/dxwndhost.vs2008.sln b/host/dxwndhost.vs2008.sln new file mode 100644 index 0000000..5bf4fb1 --- /dev/null +++ b/host/dxwndhost.vs2008.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwndhost", "dxwndhost.vs2008.vcproj", "{FD0B0234-8EC5-43C0-A384-1B881DD3D925}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.ActiveCfg = Debug|Win32 + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.Build.0 = Debug|Win32 + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.ActiveCfg = Release|Win32 + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 59b8477..e638695 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 8d3a3c6..fe73bd6 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -302,6 +302,13 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) case 3: t->tflags |= (OUTTRACE|OUTSEPARATED); break; } + switch(dlg->m_WinMovementType){ + case 0: break; + case 1: t->flags |= LOCKWINPOS; break; + case 2: t->flags |= LOCKWINPOS; t->flags2 |= LOCKEDSIZE; break; + case 3: t->flags |= LOCKWINPOS; t->flags7 |= ANCHORED; break; + } + if(dlg->m_HookDI) t->flags |= HOOKDI; if(dlg->m_HookDI8) t->flags |= HOOKDI8; if(dlg->m_EmulateRelMouse) t->flags6 |= EMULATERELMOUSE; @@ -419,17 +426,15 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_GDIColorConv) t->flags5 |= GDICOLORCONV; if(dlg->m_PreventMaximize) t->flags |= PREVENTMAXIMIZE; if(dlg->m_ClientRemapping) t->flags |= CLIENTREMAPPING; - if(dlg->m_LockWinPos) t->flags |= LOCKWINPOS; if(dlg->m_LockWinStyle) t->flags |= LOCKWINSTYLE; if(dlg->m_FixParentWin) t->flags |= FIXPARENTWIN; if(dlg->m_ModalStyle) t->flags2 |= MODALSTYLE; if(dlg->m_KeepAspectRatio) t->flags2 |= KEEPASPECTRATIO; if(dlg->m_ForceWinResize) t->flags2 |= FORCEWINRESIZE; if(dlg->m_HideMultiMonitor) t->flags2 |= HIDEMULTIMONITOR; -// if(dlg->m_WallpaperMode) t->flags2 |= WALLPAPERMODE; if(dlg->m_FixD3DFrame) t->flags3 |= FIXD3DFRAME; if(dlg->m_NoWindowMove) t->flags3 |= NOWINDOWMOVE; - if(dlg->m_Force16BPP) t->flags3 |= FORCE16BPP; + //if(dlg->m_Force16BPP) t->flags3 |= FORCE16BPP; if(dlg->m_HookChildWin) t->flags |= HOOKCHILDWIN; if(dlg->m_MessageProc) t->flags |= MESSAGEPROC; //if(dlg->m_NoMouseProc) t->flags6 |= NOMOUSEPROC; @@ -589,6 +594,11 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) if(t->tflags & ERASELOGFILE) dlg->m_LogMode = 1; if(t->tflags & OUTSEPARATED) dlg->m_LogMode = 3; + dlg->m_WinMovementType = 0; + if(t->flags & LOCKWINPOS) dlg->m_WinMovementType = 1; + if(t->flags2 & LOCKEDSIZE) dlg->m_WinMovementType = 2; + if(t->flags7 & ANCHORED) dlg->m_WinMovementType = 3; + dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0; dlg->m_HookDI8 = t->flags & HOOKDI8 ? 1 : 0; dlg->m_EmulateRelMouse = t->flags6 & EMULATERELMOUSE ? 1 : 0; @@ -706,17 +716,15 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_GDIColorConv = t->flags5 & GDICOLORCONV ? 1 : 0; dlg->m_PreventMaximize = t->flags & PREVENTMAXIMIZE ? 1 : 0; dlg->m_ClientRemapping = t->flags & CLIENTREMAPPING ? 1 : 0; - dlg->m_LockWinPos = t->flags & LOCKWINPOS ? 1 : 0; dlg->m_LockWinStyle = t->flags & LOCKWINSTYLE ? 1 : 0; dlg->m_FixParentWin = t->flags & FIXPARENTWIN ? 1 : 0; dlg->m_ModalStyle = t->flags2 & MODALSTYLE ? 1 : 0; dlg->m_KeepAspectRatio = t->flags2 & KEEPASPECTRATIO ? 1 : 0; dlg->m_ForceWinResize = t->flags2 & FORCEWINRESIZE ? 1 : 0; dlg->m_HideMultiMonitor = t->flags2 & HIDEMULTIMONITOR ? 1 : 0; - //dlg->m_WallpaperMode = t->flags2 & WALLPAPERMODE ? 1 : 0; dlg->m_FixD3DFrame = t->flags3 & FIXD3DFRAME ? 1 : 0; dlg->m_NoWindowMove = t->flags3 & NOWINDOWMOVE ? 1 : 0; - dlg->m_Force16BPP = t->flags3 & FORCE16BPP ? 1 : 0; + //dlg->m_Force16BPP = t->flags3 & FORCE16BPP ? 1 : 0; dlg->m_HookChildWin = t->flags & HOOKCHILDWIN ? 1 : 0; dlg->m_MessageProc = t->flags & MESSAGEPROC ? 1 : 0; dlg->m_FixNCHITTEST = t->flags2 & FIXNCHITTEST ? 1 : 0; @@ -2271,6 +2279,24 @@ void CDxwndhostView::OnClearAllLogs() _unlink(FilePath); } +DWORD WINAPI SilentUpdate(CSystemTray *Tray) +{ + int DxStatus; + int IdleCount; + IdleCount=0; + while (TRUE) { + // once a second ... + Sleep(1000); + DxStatus=GetHookStatus(NULL); + if (DxStatus != DXW_RUNNING){ + IdleCount++; + if(IdleCount >= 2) exit(0); + } + else { + IdleCount=0; + } + } +} DWORD WINAPI TrayIconUpdate(CSystemTray *Tray) { @@ -2359,6 +2385,8 @@ void CDxwndhostView::OnGoToTrayIcon() "DxWnd", NIIF_INFO, 10)){ MessageBoxLang(DXW_STRING_TRAYFAIL, DXW_STRING_ERROR, MB_OK); + // error path: if can't create a system tray icon, transient logic must be silently placed here + if (gTransientMode) StatusThread= CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)SilentUpdate, (LPVOID)NULL, 0, &dwThrdId); return; } IconId=(menu->GetMenuState(ID_HOOK_START, MF_BYCOMMAND)==MF_CHECKED)?IDI_DXWAIT:IDI_DXIDLE; diff --git a/host/resource b/host/resource index c2ab1e7..dde3f7f 100644 Binary files a/host/resource and b/host/resource differ