diff --git a/Include/dxwnd.h b/Include/dxwnd.h index f04c52c..6266ef9 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -148,6 +148,7 @@ // fifth flags DWORD dxw.dwFlags5: #define DIABLOTWEAK 0x00000001 // ... ??? ... +#define CLEARTARGET 0x00000002 // forces a D3D clean on target surface upon each BeginScene invocation // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general @@ -204,7 +205,7 @@ typedef struct short IsFullScreen; short Width, Height; short ColorDepth; - //DDPIXELFORMAT VirtualPixel; + DDPIXELFORMAT pfd; short DXVersion; HWND hWnd; DWORD dwPid; diff --git a/build/Resources_CN.dll b/build/Resources_CN.dll index 91c3a99..6defe55 100644 --- a/build/Resources_CN.dll +++ b/build/Resources_CN.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:782d53dad4046b681b15ecfbc8dd370c7a8097b7903daf63e4089c9b96916158 -size 125952 +oid sha256:4de37cdb906c386f2ba4b7f6793d36614ad77fcc432b1a21de322f93df87522a +size 132096 diff --git a/build/Resources_EN.dll b/build/Resources_EN.dll index 0030f75..63655f3 100644 --- a/build/Resources_EN.dll +++ b/build/Resources_EN.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ad4422aea023277c8d4310eb68782709f10d7567c8b12af62a30a32b3016c57 -size 131072 +oid sha256:3997d0254b83f70e4dd1ae372d7c5aefb6d6aeb5b6345651fca1dd1fa166b015 +size 137216 diff --git a/build/Resources_IT.dll b/build/Resources_IT.dll index a527ff2..670c9b7 100644 --- a/build/Resources_IT.dll +++ b/build/Resources_IT.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ab41e49d035c39a3a88ce07e5900ea8b8e8768ad56749e8f06969b9df343374f -size 132096 +oid sha256:2b27f7aa0eaa1fe4770e14f916970df79b1885df82aef47f260b00527074d10a +size 138240 diff --git a/build/dxwnd.dll b/build/dxwnd.dll index f63f5a6..729ad7e 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f143e88ec5785fc2144af1a779b09b9e0791bf0e1e7d7050c1921d36284787e -size 501248 +oid sha256:b6a90eedd9d99a4deac23538e6b96663ef88f4d640ddf13bc9e58289bbd6ba82 +size 503296 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 78aace7..98f6cce 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad3ceed714b0d4f97f1187893964ff234e6c48de19bac84b66a1f25c9105088c -size 549376 +oid sha256:79e9b0ed736620751f6a8788cba0d30c929abf45772b782f8fa6ccfdb6fa173c +size 557568 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index 56c15db..1db23f9 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -2,120 +2,5 @@ sizx=320 sizy=200 lang=automatic -posx=1429 -posy=317 -[target] -title0=Age of Empires -path0=D:\Games\Age of Empires\Empires.exe -launchpath0= -module0= -opengllib0= -ver0=0 -coord0=2 -flag0=134217762 -flagg0=1207959568 -flagh0=20 -flagi0=4195332 -tflag0=6147 -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 -title1=Diablo -path1=D:\Games\Diablo\Diablo.exe -launchpath1= -module1= -opengllib1= -ver1=1 -coord1=3 -flag1=138428450 -flagg1=1242562576 -flagh1=20 -flagi1=4195328 -tflag1=0 -initx1=0 -inity1=0 -minx1=0 -miny1=0 -maxx1=0 -maxy1=0 -posx1=50 -posy1=50 -sizx1=640 -sizy1=480 -maxfps1=0 -initts1=0 -winver1=0 -maxres1=0 -title2=Dune 2000 -path2=D:\Games\Dune 2000\DUNE2000.DAT -launchpath2=D:\Games\Dune 2000\DUNE2000.EXE -module2= -opengllib2= -ver2=0 -coord2=2 -flag2=671105058 -flagg2=1207959568 -flagh2=20 -flagi2=4195332 -tflag2=64 -initx2=0 -inity2=0 -minx2=0 -miny2=0 -maxx2=0 -maxy2=0 -posx2=50 -posy2=50 -sizx2=800 -sizy2=600 -maxfps2=0 -initts2=0 -winver2=0 -maxres2=-1 -title3=Genocide (REMIXED VERSION) -path3=D:\Games\genocide\remixed version (1999)\genocide\genocide.exe -launchpath3= -module3= -opengllib3= -ver3=0 -coord3=3 -flag3=134217762 -flagg3=1207959568 -flagh3=20 -flagi3=4195332 -tflag3=6402 -initx3=0 -inity3=0 -minx3=0 -miny3=0 -maxx3=0 -maxy3=0 -posx3=50 -posy3=50 -sizx3=800 -sizy3=600 -maxfps3=0 -initts3=0 -winver3=0 -maxres3=-1 -title4=Dune 2000 -module4= -opengllib4= -title5=Genocide (REMIXED VERSION) -module5= -opengllib5= -flagj0=0 -flagj1=1 -flagj2=0 -flagj3=0 +posx=50 +posy=50 diff --git a/build/exports/dxwnd.ini b/build/exports/dxwnd.ini index 87a33a6..58551d6 100644 --- a/build/exports/dxwnd.ini +++ b/build/exports/dxwnd.ini @@ -1,5 +1,5 @@ [window] -posx=1392 -posy=385 +posx=1803 +posy=246 sizx=320 sizy=200 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 48f1da9..5f3cfaa 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -569,3 +569,14 @@ added debug messages about hooked window class and name fix: ignore IME window when hooking main win, destroy it when requested fix: ignore HWND_MESSAGE type windows added "Diablo tweak" compatibility flag for Diablo proper screen update handling. It is a temporary tweak waiting to understand better how to properly manage it. + +v2.02.88 +fix: DIABLOTWEAK flag defaulted to FALSE +add: CLEARTARGET flag - forces a Clear CLEAR_TARGET operation on D3D BeginPaint: useful in combination with wireframe mode. +updated "Optimize CPU" behavior: now it emulates a VSync wait also on D3D8/D3D9. Fixes some "swimming" problem in "Soul Reaver 2", and saves CPU time by limiting the FPS to the refresh rate. +fixed positioning of FPS and time stretching indication on screen overlay +cleaned up GUI project: no more japanese and localized resources, no more unreferenced resources. +GUI: added Desktop status window +GUI: added pixel format descriptor to DxWnd status + + diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index abed4e1..5b8f721 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -294,7 +294,6 @@ int iRefreshDelayCount=2; void SetVSyncDelays(LPDIRECTDRAW lpdd) { DDSURFACEDESC2 ddsdRefreshRate; - int Reminder; HRESULT res; memset(&ddsdRefreshRate, 0, sizeof(ddsdRefreshRate)); @@ -305,18 +304,7 @@ void SetVSyncDelays(LPDIRECTDRAW lpdd) res=(*pGetDisplayMode)(lpdd, (LPDDSURFACEDESC)&ddsdRefreshRate); } if(res) return; - gdwRefreshRate = ddsdRefreshRate.dwRefreshRate; - if(!gdwRefreshRate) return; - iRefreshDelayCount=0; - Reminder=0; - do{ - iRefreshDelays[iRefreshDelayCount]=(1000+Reminder)/gdwRefreshRate; - Reminder=(1000+Reminder)-(iRefreshDelays[iRefreshDelayCount]*gdwRefreshRate); - iRefreshDelayCount++; - } while(Reminder && (iRefreshDelayCountHeight=(short)dxw.GetScreenHeight(); GetHookInfo()->Width=(short)dxw.GetScreenWidth(); + GetHookInfo()->ColorDepth=(short)dwbpp; if(dxw.Windowize) AdjustWindowFrame(dxw.GethWnd(), dwwidth, dwheight); if(dxw.dwFlags1 & EMULATESURFACE){ @@ -1909,6 +1898,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, } else{ OutTraceDW("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp); + dxw.VirtualPixelFormat.dwRGBBitCount = dwbpp; dxw.ActualPixelFormat.dwRGBBitCount = dwbpp; } @@ -2501,7 +2491,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf if(lpDDSEmu_Back==NULL){ ClearSurfaceDesc((void *)&ddsd, dxversion); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; ddsd.dwWidth = dxw.GetScreenWidth(); ddsd.dwHeight = dxw.GetScreenHeight(); if(dxw.dwFlags4 & BILINEARFILTER){ @@ -2842,6 +2832,13 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate lpDDSPrim = *lplpdds; dxw.MarkPrimarySurface(lpDDSPrim); + DDSURFACEDESC2 ddsdpix; + memset((void *)&ddsdpix, 0, sizeof(DDSURFACEDESC)); + ddsdpix.dwSize = sizeof(DDSURFACEDESC); + ddsdpix.dwFlags = DDSD_PIXELFORMAT; + (*pGetSurfaceDescMethod(lpDDSPrim))((LPDIRECTDRAWSURFACE2)lpDDSPrim, &ddsdpix); + GetHookInfo()->pfd=ddsdpix.ddpfPixelFormat; // v2.02.88 + if (BBCount){ // build emulated backbuffer surface res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, &lpDDSBack, NULL); @@ -3525,6 +3522,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, if(dwtrans & DDBLTFAST_WAIT) flags = DDBLT_WAIT; if(dwtrans & DDBLTFAST_DESTCOLORKEY) flags |= DDBLT_KEYDEST; if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_KEYSRC; + //if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_COLORFILL; if ((dxw.dwFlags2 & FULLRECTBLT) && ToPrim){ return sBlt("BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, NULL, FALSE); @@ -3542,16 +3540,23 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, else{ // does it EVER goes through here? NULL is not a valid rect value for BltFast call.... // yes, forced in FULLRECTBLT mode! - ddsd.dwSize=Set_dwSize_From_Surface(lpddssrc); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; - ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd); - if (ret){ - OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__); - return 0; + // yes, when BltFast on DDBLTFAST_SRCCOLORKEY!! (Pax Corpus) + if(lpddssrc){ + ddsd.dwSize=Set_dwSize_From_Surface(lpddssrc); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd); + if (ret){ + OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__); + return 0; + } + destrect.right = destrect.left + ddsd.dwWidth; + destrect.bottom = destrect.top + ddsd.dwHeight; + ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, NULL, flags, NULL, FALSE); + } + else{ + //ret=sBlt("BltFast", lpdds, NULL, lpddssrc, NULL, flags, NULL, FALSE); + ret=DD_OK; } - destrect.right = destrect.left + ddsd.dwWidth; - destrect.bottom = destrect.top + ddsd.dwHeight; - ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, NULL, flags, NULL, FALSE); } return ret; @@ -3559,16 +3564,11 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE hevent) { - static DWORD time = 0; - static BOOL step = 0; - DWORD tmp; - if(!(dxw.dwFlags1 & SAVELOAD)) return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent); - tmp = (*pGetTickCount)(); - if((time - tmp) > 32) time = tmp; - (*pSleep)(time - tmp); - time += iRefreshDelays[step++]; - if(step >= iRefreshDelayCount) step=0; - return 0; + if(dxw.dwFlags1 & SAVELOAD){ + dxw.VSyncWait(); + return 0; + } + return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent); } #define DDPCAPS_INITIALIZE_LEGACY 0x00000008l diff --git a/dll/dxemublt.cpp b/dll/dxemublt.cpp index a985cc0..75d83d3 100644 --- a/dll/dxemublt.cpp +++ b/dll/dxemublt.cpp @@ -261,7 +261,7 @@ static HRESULT WINAPI BilinearBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT l srcpitch = ddsd_src.lPitch - w; // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); - for(y = 0; y < h-1; y ++){ // first h-1 lines .... + for(y = 0; y < h-1; y ++){ // first h-1 lines .... register DWORD Q1, Q2, Q3, Q4, Q5; Q5 = Melt32(PaletteEntries[*(src8)], PaletteEntries[*(src8+ddsd_src.lPitch)]); for(x = 0; x < w; x ++){ diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 4615070..6ebab4e 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -93,7 +93,7 @@ static char *Flag4Names[32]={ }; static char *Flag5Names[32]={ - "DIABLOCHEAT", "", "", "", + "DIABLOTWEAK", "CLEARTARGET", "", "", "", "", "", "", "", "", "", "", "", "", "", "", @@ -106,8 +106,8 @@ static char *Flag5Names[32]={ static char *TFlagNames[32]={ "OUTTRACE", "OUTDDRAWTRACE", "OUTWINMESSAGES", "OUTCURSORTRACE", "OUTPROXYTRACE", "DXPROXED", "ASSERTDIALOG", "OUTIMPORTTABLE", - "OUTDEBUG", "OUTREGISTRY", "TRACEHOOKS", "", - "", "", "", "", + "OUTDEBUG", "OUTREGISTRY", "TRACEHOOKS", "OUTD3DTRACE", + "OUTDXWINTRACE", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", @@ -1515,10 +1515,31 @@ void HookInit(TARGETMAP *target, HWND hwnd) #ifdef CREATEDESKTOP if(CREATEDESKTOP){ if (!hDesktopWindow){ - //hDesktopWindow=CreateWindowEx(0, "STATIC", "DxWnd Desktop", 0, - hDesktopWindow=CreateWindowEx(WS_EX_CONTROLPARENT, "STATIC", "DxWnd Desktop", 0, - target->posx, target->posy, target->sizx, target->sizy, NULL, NULL, NULL, NULL); + static ATOM aClass; + WNDCLASSEX WndClsEx; + HINSTANCE hinst=NULL; + hinst=GetModuleHandle(NULL); + WndClsEx.cbSize = sizeof(WNDCLASSEX); + WndClsEx.style = 0; + WndClsEx.lpfnWndProc = DefWindowProc; + WndClsEx.cbClsExtra = 0; + WndClsEx.cbWndExtra = 0; + WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION); + WndClsEx.hCursor = NULL; + WndClsEx.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + //WndClsEx.hbrBackground = CreateSolidBrush(RGB(200,0,0)); + WndClsEx.lpszMenuName = NULL; + WndClsEx.lpszClassName = "dxwnd:desktop"; + WndClsEx.hInstance = hinst; + WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + + aClass=RegisterClassEx(&WndClsEx); + + //HWND hParent = (*pGetDesktopWindow)(); + HWND hParent = GetDesktopWindow(); // not hooked yet ! + hDesktopWindow=CreateWindowEx(0, "dxwnd:desktop", "DxWnd Desktop", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL); if(hDesktopWindow){ + MoveWindow(hDesktopWindow, target->posx, target->posy, target->sizx, target->sizy, TRUE); OutTraceDW("created desktop emulation: hwnd=%x\n", hDesktopWindow); } else{ @@ -1555,6 +1576,7 @@ void HookInit(TARGETMAP *target, HWND hwnd) OutTrace("HookInit: dxw.hParentWnd=%x class=\"%s\" text=\"%s\" style=%x(%s) exstyle=%x(%s)\n", dxw.hParentWnd, ClassName, WinText, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); OutTrace("HookInit: target window pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosY, dxw.iSizX, dxw.iSizY); + dxw.DumpDesktopStatus(); } if (SKIPIMEWINDOW) { @@ -1575,7 +1597,7 @@ void HookInit(TARGETMAP *target, HWND hwnd) #ifdef CREATEDESKTOP if(CREATEDESKTOP){ if (hDesktopWindow){ - OutTraceDW("HookInit: set new parent=%x\n", hDesktopWindow); + OutTraceDW("HookInit: set new parent=%x to main win=%x\n", hDesktopWindow, dxw.hChildWnd); SetParent(dxw.hChildWnd, hDesktopWindow); dxw.hParentWnd = hDesktopWindow; } diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index 1688fe5..2bbc3dd 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -45,6 +45,10 @@ dxwCore::dxwCore() MustShowOverlay=FALSE; TimerEvent.dwTimerType = TIMER_TYPE_NONE; WinDBInit(); + // initialization of default vsync emulation array + iRefreshDelays[0]=16; + iRefreshDelays[1]=17; + iRefreshDelayCount=2; } dxwCore::~dxwCore() @@ -140,6 +144,53 @@ void dxwCore::SetScreenSize(int x, int y) } } +void dxwCore::DumpDesktopStatus() +{ + HDC hDC; + HWND hDesktop; + RECT desktop; + PIXELFORMATDESCRIPTOR pfd; + int iPixelFormat, iBPP; + char ColorMask[65]; // are there 64BPP cards? I bet no.... + + // get the current pixel format index + hDesktop = GetDesktopWindow(); + hDC = GetDC(hDesktop); + ::GetWindowRect(hDesktop, &desktop); + iBPP = GetDeviceCaps(hDC, BITSPIXEL); + iPixelFormat = GetPixelFormat(hDC); + if(!iPixelFormat) iPixelFormat=1; // why returns 0??? + // obtain a detailed description of that pixel format + if(!DescribePixelFormat(hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd)){ + OutTrace("DescribePixelFormat ERROR: err=%d\n", GetLastError()); + return; + } + memset(ColorMask, ' ', 64); // blank fill + ColorMask[64] = 0; // terminate + for (int i=pfd.cRedShift; i 100)) return; + + gdwRefreshRate = RefreshRate; + if(!gdwRefreshRate) return; + iRefreshDelayCount=0; + Reminder=0; + do{ + iRefreshDelays[iRefreshDelayCount]=(1000+Reminder)/gdwRefreshRate; + Reminder=(1000+Reminder)-(iRefreshDelays[iRefreshDelayCount]*gdwRefreshRate); + iRefreshDelayCount++; + } while(Reminder && (iRefreshDelayCount 32) time = tmp; + (*pSleep)(time - tmp); + time += iRefreshDelays[step++]; + if(step >= iRefreshDelayCount) step=0; +} + + static float fMul[17]={2.14F, 1.95F, 1.77F, 1.61F, 1.46F, 1.33F, 1.21F, 1.10F, 1.00F, 0.91F, 0.83F, 0.75F, 0.68F, 0.62F, 0.56F, 0.51F, 0.46F}; //static float fMul[17]={0.46F, 0.51F, 0.56F, 0.62F, 0.68F, 0.75F, 0.83F, 0.91F, 1.00F, 1.10F, 1.21F, 1.33F, 1.46F, 1.61F, 1.77F, 1.95F, 2.14F}; @@ -1045,7 +1131,7 @@ void dxwCore::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) static DWORD dwStartTick=0; static DWORD dwUpdateTick=0; static FILETIME StartFileTime; - extern DXWNDSTATUS *pStatus; +// extern DXWNDSTATUS *pStatus; if(dwStartTick==0) { SYSTEMTIME StartingTime; @@ -1080,7 +1166,7 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime) static DWORD dwStartTick=0; static DWORD dwUpdateTick=0; static FILETIME StartFileTime; - extern DXWNDSTATUS *pStatus; +// extern DXWNDSTATUS *pStatus; if(dwStartTick==0) { SYSTEMTIME StartingTime; @@ -1109,16 +1195,27 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime) void dxwCore::ShowOverlay() { - if (MustShowOverlay) this->ShowOverlay(GetDC(hWnd)); + if (MustShowOverlay) { + RECT rect; + (*pGetClientRect)(hWnd, &rect); + this->ShowOverlay(GetDC(hWnd), rect.right, rect.bottom); + } } void dxwCore::ShowOverlay(LPDIRECTDRAWSURFACE lpdds) { - HDC hdc; // the working dc if (MustShowOverlay) { + HDC hdc; // the working dc + int h, w; if(!lpdds) return; if (FAILED(lpdds->GetDC(&hdc))) return; - this->ShowOverlay(hdc); + w = this->GetScreenWidth(); + h = this->GetScreenHeight(); + if(this->dwFlags4 & BILINEARFILTER) { + w <<=1; + h <<=1; + } + this->ShowOverlay(hdc, w, h); lpdds->ReleaseDC(hdc); } } @@ -1126,28 +1223,23 @@ void dxwCore::ShowOverlay(LPDIRECTDRAWSURFACE lpdds) void dxwCore::ShowOverlay(HDC hdc) { if(!hdc) return; - if (dwFlags2 & SHOWFPSOVERLAY) ShowFPS(hdc); - if (dwFlags4 & SHOWTIMESTRETCH) ShowTimeStretching(hdc); + RECT rect; + (*pGetClientRect)(hWnd, &rect); + this->ShowOverlay(GetDC(hWnd), rect.right, rect.bottom); } -//void dxwCore::ShowFPS() -//{ -// this->ShowFPS(GetDC(hWnd)); -//} -// -//void dxwCore::ShowFPS(LPDIRECTDRAWSURFACE lpdds) -//{ -// HDC hdc; // the working dc -// if (FAILED(lpdds->GetDC(&hdc))) return; -// this->ShowFPS(hdc); -// lpdds->ReleaseDC(hdc); -//} +void dxwCore::ShowOverlay(HDC hdc, int w, int h) +{ + if(!hdc) return; + if (dwFlags2 & SHOWFPSOVERLAY) ShowFPS(hdc, w, h); + if (dwFlags4 & SHOWTIMESTRETCH) ShowTimeStretching(hdc, w, h); +} // nasty global to ensure that the corner is picked semi-random, but never overlapped // between FPS and TimeStretch (and, as a side effect, never twice the same!) static int LastCorner; -void dxwCore::ShowFPS(HDC xdc) +void dxwCore::ShowFPS(HDC xdc, int w, int h) { char sBuf[81]; static DWORD dwTimer = 0; @@ -1156,18 +1248,23 @@ void dxwCore::ShowFPS(HDC xdc) static DWORD color; if((*pGetTickCount)()-dwTimer > 6000){ - RECT rect; dwTimer = (*pGetTickCount)(); corner = dwTimer % 4; if(corner==LastCorner) corner = (corner+1) % 4; LastCorner = corner; color=0xFF0000; // blue - (*pGetClientRect)(hWnd, &rect); + //(*pGetClientRect)(hWnd, &rect); + //switch (corner) { + //case 0: x=10; y=10; break; + //case 1: x=rect.right-60; y=10; break; + //case 2: x=rect.right-60; y=rect.bottom-20; break; + //case 3: x=10; y=rect.bottom-20; break; + //} switch (corner) { case 0: x=10; y=10; break; - case 1: x=rect.right-60; y=10; break; - case 2: x=rect.right-60; y=rect.bottom-20; break; - case 3: x=10; y=rect.bottom-20; break; + case 1: x=w-60; y=10; break; + case 2: x=w-60; y=h-20; break; + case 3: x=10; y=h-20; break; } } @@ -1178,27 +1275,7 @@ void dxwCore::ShowFPS(HDC xdc) TextOut(xdc, x, y, sBuf, strlen(sBuf)); } -//void dxwCore::ShowTimeStretching() -//{ -// HDC hdc; -// hdc=GetDC(hWnd); -// if(hdc)this->ShowTimeStretching(hdc); -//} -// -//void dxwCore::ShowTimeStretching(LPDIRECTDRAWSURFACE lpdds) -//{ -// HDC hdc; // the working dc -// __try { -// if (FAILED(lpdds->GetDC(&hdc))) return; -// } -// __except(EXCEPTION_EXECUTE_HANDLER){ -// return; -// } -// if(hdc)this->ShowTimeStretching(hdc); -// lpdds->ReleaseDC(hdc); -//} - -void dxwCore::ShowTimeStretching(HDC xdc) +void dxwCore::ShowTimeStretching(HDC xdc, int w, int h) { char sBuf[81]; static DWORD dwTimer = 0; @@ -1208,7 +1285,6 @@ void dxwCore::ShowTimeStretching(HDC xdc) static int LastTimeShift = 1000; // any initial number different from -8 .. +8 if((*pGetTickCount)()-dwTimer > 4000){ - RECT rect; if(LastTimeShift==TimeShift) return; // after a while, stop the show dwTimer = (*pGetTickCount)(); LastTimeShift=TimeShift; @@ -1216,12 +1292,17 @@ void dxwCore::ShowTimeStretching(HDC xdc) if(corner==LastCorner) corner = (corner+1) % 4; LastCorner = corner; color=0x0000FF; // red - (*pGetClientRect)(hWnd, &rect); + //(*pGetClientRect)(hWnd, &rect); + //switch (corner) { + //case 0: x=10; y=10; break; + //case 1: x=rect.right-60; y=10; break; + //case 2: x=rect.right-60; y=rect.bottom-20; break; + //case 3: x=10; y=rect.bottom-20; break; switch (corner) { case 0: x=10; y=10; break; - case 1: x=rect.right-60; y=10; break; - case 2: x=rect.right-60; y=rect.bottom-20; break; - case 3: x=10; y=rect.bottom-20; break; + case 1: x=w-60; y=10; break; + case 2: x=w-60; y=h-20; break; + case 3: x=10; y=h-20; break; } } diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index fef7be7..95bc51d 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -92,6 +92,7 @@ public: // methods LARGE_INTEGER dxwCore::StretchCounter(LARGE_INTEGER); void ShowOverlay(); void ShowOverlay(HDC); + void ShowOverlay(HDC, int, int); void ShowOverlay(LPDIRECTDRAWSURFACE); char *GetTSCaption(void); char *GetTSCaption(int); @@ -119,6 +120,9 @@ public: // methods LARGE_INTEGER StretchLargeCounter(LARGE_INTEGER); UINT MapKeysConfig(UINT, LPARAM, WPARAM); void MapKeysInit(); + void SetVSyncDelays(UINT); + void VSyncWait(); + void DumpDesktopStatus(); public: // simple data variables BOOL Windowize; @@ -170,9 +174,13 @@ private: void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE); void UnmarkBackBufferSurface(LPDIRECTDRAWSURFACE); BOOL MustShowOverlay; - void ShowFPS(HDC); - void ShowTimeStretching(HDC); + void ShowFPS(HDC, int, int); + void ShowTimeStretching(HDC, int, int); TimerEvent_Type TimerEvent; + DWORD gdwRefreshRate; + #define MAXREFRESHDELAYCOUNT 20 + int iRefreshDelays[MAXREFRESHDELAYCOUNT]; + int iRefreshDelayCount; }; extern dxwCore dxw; diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index c00f7ca..fb3db93 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.87" +#define VERSION "2.02.88" #define DDTHREADLOCK 1 @@ -93,6 +93,7 @@ int SetTarget(TARGETMAP *targets){ pStatus->TaskIdx=0; pStatus->hWnd=NULL; pStatus->ColorDepth=0; + memset((void *)&(pStatus->pfd), 0, sizeof(DDPIXELFORMAT)); pStatus->Height = pStatus->Width = 0; pStatus->DXVersion = 0; for(i = 0; targets[i].path[0]; i ++){ @@ -207,6 +208,7 @@ LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam) pStatus->dwPid=GetProcessId(GetCurrentProcess()); pStatus->TimeShift=pMapping[i].InitTS; pStatus->CursorX = pStatus->CursorY = 0; + memset((void *)&(pStatus->pfd), 0, sizeof(DDPIXELFORMAT)); DxWndStatus = *pStatus; HookInit(&pMapping[i], hwnd); } diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 79d498c..641653d 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 d28f4fe..e471120 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -726,6 +726,7 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresParam) } dxw.SetScreenSize(pPresParam->BackBufferWidth, pPresParam->BackBufferHeight); + dxw.SetVSyncDelays(mode.RefreshRate); GetHookInfo()->IsFullScreen = dxw.IsFullScreen(); GetHookInfo()->DXVersion=(short)dwD3DVersion; @@ -742,6 +743,7 @@ HRESULT WINAPI extPresent(void *pd3dd, CONST RECT *pSourceRect, CONST RECT *pDes OutTraceB("Present\n"); // frame counter handling.... if (dxw.HandleFPS()) return D3D_OK; + if (dxw.dwFlags1 & SAVELOAD) dxw.VSyncWait(); // proxy .... res=(*pPresent)(pd3dd, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); dxw.ShowOverlay(); @@ -763,6 +765,7 @@ HRESULT WINAPI extGetDisplayMode8(void *lpd3d, D3DDISPLAYMODE *pMode) pMode->Height = dxw.GetScreenHeight(); } OutTraceD3D("GetDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + dxw.SetVSyncDelays(pMode->RefreshRate); return res; } @@ -781,6 +784,7 @@ HRESULT WINAPI extGetDisplayMode9(void *lpd3d, UINT iSwapChain, D3DDISPLAYMODE * pMode->Height = dxw.GetScreenHeight(); } OutTraceD3D("GetDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + dxw.SetVSyncDelays(pMode->RefreshRate); return res; } @@ -817,6 +821,7 @@ HRESULT WINAPI extGetAdapterDisplayMode8(void *lpd3d, UINT Adapter, D3DDISPLAYMO pMode->Height = dxw.GetScreenHeight(); } OutTraceD3D("GetAdapterDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + dxw.SetVSyncDelays(pMode->RefreshRate); return res; } @@ -835,6 +840,7 @@ HRESULT WINAPI extGetAdapterDisplayMode9(void *lpd3d, UINT Adapter, D3DDISPLAYMO pMode->Height = dxw.GetScreenHeight(); } OutTraceD3D("GetAdapterDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + dxw.SetVSyncDelays(pMode->RefreshRate); return res; } @@ -967,6 +973,8 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, HookD3DDevice9(ppd3dd); } + dxw.SetVSyncDelays(mode.RefreshRate); + GetHookInfo()->IsFullScreen = dxw.IsFullScreen(); GetHookInfo()->DXVersion=(short)dwD3DVersion; GetHookInfo()->Height=(short)dxw.GetScreenHeight(); @@ -1049,6 +1057,8 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp HookD3DDevice9(ppd3dd); + dxw.SetVSyncDelays(mode.RefreshRate); + GetHookInfo()->IsFullScreen = dxw.IsFullScreen(); GetHookInfo()->DXVersion=(short)dwD3DVersion; GetHookInfo()->Height=(short)dxw.GetScreenHeight(); @@ -1182,6 +1192,7 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3dd, D3DPRESENT_PARAMETERS } (dwD3DVersion == 9) ? HookD3DDevice9(&lpd3dd) : HookD3DDevice8(&lpd3dd); + dxw.SetVSyncDelays(mode.RefreshRate); return res; } diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index f50e670..5a95757 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -863,7 +863,7 @@ HRESULT WINAPI extBeginScene2(void *d3dd) { HRESULT res; OutTraceD3D("BeginScene(2): d3dd=%x\n", d3dd); - if(dxw.dwFlags4 & ZBUFFERCLEAN){ + if((dxw.dwFlags4 & ZBUFFERCLEAN) || (dxw.dwFlags5 & CLEARTARGET)){ HRESULT res2; LPDIRECT3DVIEWPORT2 vp; D3DVIEWPORT vpd; @@ -877,7 +877,8 @@ HRESULT WINAPI extBeginScene2(void *d3dd) d3dRect.x2 = vpd.dwX + vpd.dwWidth; d3dRect.y2 = vpd.dwY + vpd.dwHeight; OutTraceD3D("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2); - vp->Clear(1, &d3dRect, D3DCLEAR_ZBUFFER); + if(dxw.dwFlags4 & ZBUFFERCLEAN) vp->Clear(1, &d3dRect, D3DCLEAR_ZBUFFER); + if(dxw.dwFlags5 & CLEARTARGET) vp->Clear(1, &d3dRect, D3DCLEAR_TARGET); } } res=(*pBeginScene2)(d3dd); @@ -889,7 +890,7 @@ HRESULT WINAPI extBeginScene3(void *d3dd) { HRESULT res; OutTraceD3D("BeginScene(3): d3dd=%x\n", d3dd); - if(dxw.dwFlags4 & (ZBUFFERCLEAN|ZBUFFER0CLEAN)){ + if((dxw.dwFlags4 & (ZBUFFERCLEAN|ZBUFFER0CLEAN)) || (dxw.dwFlags5 & CLEARTARGET)){ HRESULT res2; LPDIRECT3DVIEWPORT3 vp; D3DVIEWPORT vpd; @@ -905,6 +906,7 @@ HRESULT WINAPI extBeginScene3(void *d3dd) OutTraceD3D("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2); if(dxw.dwFlags4 & ZBUFFERCLEAN )vp->Clear2(1, &d3dRect, D3DCLEAR_ZBUFFER, 0, 1.0, 0); if(dxw.dwFlags4 & ZBUFFER0CLEAN)vp->Clear2(1, &d3dRect, D3DCLEAR_ZBUFFER, 0, 0.0, 0); + if(dxw.dwFlags5 & CLEARTARGET) vp->Clear(1, &d3dRect, D3DCLEAR_TARGET); } } res=(*pBeginScene3)(d3dd); diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index a3c7041..b46e976 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -10,8 +10,11 @@ //#undef IsTraceDW //#define IsTraceDW TRUE +BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL); + static HookEntry_Type Hooks[]={ {HOOK_IAT_CANDIDATE, "IsDebuggerPresent", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)extIsDebuggerPresent}, + {HOOK_IAT_CANDIDATE, "CheckRemoteDebuggerPresent", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)extCheckRemoteDebuggerPresent}, {HOOK_IAT_CANDIDATE, "GetProcAddress", (FARPROC)GetProcAddress, (FARPROC *)&pGetProcAddress, (FARPROC)extGetProcAddress}, {HOOK_IAT_CANDIDATE, "LoadLibraryA", (FARPROC)LoadLibraryA, (FARPROC *)&pLoadLibraryA, (FARPROC)extLoadLibraryA}, {HOOK_IAT_CANDIDATE, "LoadLibraryExA", (FARPROC)LoadLibraryExA, (FARPROC *)&pLoadLibraryExA, (FARPROC)extLoadLibraryExA}, @@ -628,7 +631,7 @@ DWORD WINAPI extGetLogicalDrives(void) DevBit = 0x1 << i; if(DevMask & DevBit){ char RootPathName[10]; - sprintf(RootPathName, "%c:\\", 'A'+i); + sprintf_s(RootPathName, 4, "%c:\\", 'A'+i); Vol = GetVolumeInformation(RootPathName, NULL, NULL, NULL, 0, 0, 0, 0); OutTrace("Vol=%s status=%x\n", RootPathName, Vol); if(!Vol) DevMask &= ~DevBit; @@ -722,3 +725,12 @@ BOOL WINAPI extCreateProcessA( OutTraceDW("CreateProcess: SUPPRESS ApplicationName=%s CommandLine=\"%s\"\n", lpApplicationName, lpCommandLine); return TRUE; } + +BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE hProcess, PBOOL pbDebuggerPresent) +{ + BOOL ret; + if(pbDebuggerPresent) *pbDebuggerPresent = FALSE; + ret= (hProcess==(HANDLE)0xFFFFFFFF) ? FALSE : TRUE; + OutTraceDW("CheckRemoteDebuggerPresent: hProcess=%x ret=%x\n", hProcess, ret); + return ret; +} diff --git a/host/DesktopDialog.cpp b/host/DesktopDialog.cpp new file mode 100644 index 0000000..88aa340 --- /dev/null +++ b/host/DesktopDialog.cpp @@ -0,0 +1,103 @@ +// DesktopDialog.cpp : implementation file +// + +#include "stdafx.h" +#include "dxwndhost.h" +#include "DesktopDialog.h" + +// CDesktopDialog dialog + +IMPLEMENT_DYNAMIC(CDesktopDialog, CDialog) + +CDesktopDialog::CDesktopDialog(CWnd* pParent /*=NULL*/) + : CDialog(CDesktopDialog::IDD, pParent) +{ +} + +CDesktopDialog::~CDesktopDialog() +{ +} + +void CDesktopDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CDesktopDialog, CDialog) + ON_WM_TIMER() +END_MESSAGE_MAP() + +#define IDDesktopTIMER 2 + +// CDesktopDialog message handlers + +void CDesktopDialog::OnTimer(UINT_PTR nIDEvent) +{ + char sMsg[1024]; + + CDialog::OnTimer(nIDEvent); + + RECT desktop; + HDC hDC; + // Get a handle to the desktop window + const CWnd *hDesktop = GetDesktopWindow(); + // Get the size of screen to the variable desktop + hDesktop->GetWindowRect(&desktop); + // The top left corner will have coordinates (0,0) + // and the bottom right corner will have coordinates + // (horizontal, vertical) + hDC = ::GetDC(::GetDesktopWindow()); + int iBPP = GetDeviceCaps(hDC, BITSPIXEL); + + PIXELFORMATDESCRIPTOR pfd; + int iPixelFormat; + // get the current pixel format index + iPixelFormat = ::GetPixelFormat(hDC); + if(!iPixelFormat) iPixelFormat=1; // why returns 0??? + if(iPixelFormat){ + // obtain a detailed description of that pixel format + ::DescribePixelFormat(hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); + sprintf_s(sMsg, 1024, + "Desktop size (W x H)=(%d x %d)\n" + "Color depth = %d (color bits = %d)\n" + "Pixel format = %d\n" + "Color bits (RGBA)=(%d,%d,%d,%d)\n" + "Color shift (RGBA)=(%d,%d,%d,%d)\n" + , + desktop.right, desktop.bottom, + iBPP, pfd.cColorBits, + iPixelFormat, + pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits, + pfd.cRedShift, pfd.cGreenShift, pfd.cBlueShift, pfd.cAlphaShift + ); + } + else{ + sprintf_s(sMsg, 1024, "error %d", GetLastError()); + } + + + this->SetDlgItemTextA(IDC_DESKTOPINFO, sMsg); +} + +BOOL CDesktopDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + SetTimer(IDDesktopTIMER, 1000, NULL); + + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CDesktopDialog::OnOK() +{ + // TODO: Add your specialized code here and/or call the base class + + KillTimer(IDDesktopTIMER); + // stop timer + + CDialog::OnOK(); +} diff --git a/host/DesktopDialog.h b/host/DesktopDialog.h new file mode 100644 index 0000000..ca15fd3 --- /dev/null +++ b/host/DesktopDialog.h @@ -0,0 +1,27 @@ +#pragma once + + +// CDesktopDialog dialog + +class CDesktopDialog : public CDialog +{ + DECLARE_DYNAMIC(CDesktopDialog) + +public: + CDesktopDialog(CWnd* pParent = NULL); // standard constructor + virtual ~CDesktopDialog(); + + // Dialog Data + enum { IDD = IDD_DESKTOP }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnTimer(UINT_PTR nIDEvent); +public: + virtual BOOL OnInitDialog(); +protected: + virtual void OnOK(); +}; diff --git a/host/Resource.h b/host/Resource.h index e67e189..3c5d6d1 100644 Binary files a/host/Resource.h and b/host/Resource.h differ diff --git a/host/StatusDialog.cpp b/host/StatusDialog.cpp index d194c11..dea3aac 100644 --- a/host/StatusDialog.cpp +++ b/host/StatusDialog.cpp @@ -39,7 +39,6 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent) LPCSTR Status; char sMsg[1024]; char sMsg2[1024]; - char sMsgBuf[80+1]; char DllVersion[21]; DXWNDSTATUS DxWndStatus; extern PRIVATEMAP *pTitles; @@ -78,14 +77,43 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent) DxWndStatus.isLogging?"ON":"OFF", DxWndStatus.CursorX, DxWndStatus.CursorY); strcat(sMsg, sMsg2); + if(DxWndStatus.pfd.dwFlags & DDPF_FOURCC){ + char *fcc; + fcc = (char *)&(DxWndStatus.pfd.dwFourCC); + sprintf_s(sMsg2, 1024, + "\nFourCC = %x (%c%c%c%c)", + DxWndStatus.pfd.dwFourCC, + isprint(fcc[0])?fcc[0]:'.', isprint(fcc[1])?fcc[1]:'.', isprint(fcc[2])?fcc[2]:'.', isprint(fcc[3])?fcc[3]:'.' + ); + strcat(sMsg, sMsg2); + } + if(DxWndStatus.pfd.dwSize){ + sprintf_s(sMsg2, 1024, + "\nPixel format=%s%s%s%s%s%s", + (DxWndStatus.pfd.dwFlags & DDPF_ALPHAPIXELS) ? "ALPHAPIXELS ":"", + (DxWndStatus.pfd.dwFlags & DDPF_ALPHA) ? "ALPHA ":"", + (DxWndStatus.pfd.dwFlags & DDPF_FOURCC) ? "FOURCC ":"", + (DxWndStatus.pfd.dwFlags & (DDPF_PALETTEINDEXED4|DDPF_PALETTEINDEXEDTO8|DDPF_PALETTEINDEXED8)) ? "PALETTEINDEXED ":"", + (DxWndStatus.pfd.dwFlags & DDPF_RGB) ? "RGB ":"", + (DxWndStatus.pfd.dwFlags & DDPF_YUV) ? "YUV ":"" + ); + strcat(sMsg, sMsg2); + } + if(DxWndStatus.pfd.dwFlags & DDPF_RGB){ + sprintf_s(sMsg2, 1024, + "\nColor mask (RGBA)=(%x,%x,%x,%x)", + DxWndStatus.pfd.dwRBitMask, DxWndStatus.pfd.dwGBitMask, DxWndStatus.pfd.dwBBitMask, DxWndStatus.pfd.dwRGBAlphaBitMask + ); + strcat(sMsg, sMsg2); + } if(Target->flags2 & (SHOWFPS|SHOWFPSOVERLAY)){ - sprintf(sMsgBuf, "\nFPS = %d", DxWndStatus.FPSCount); - strcat(sMsg, sMsgBuf); + sprintf(sMsg2, "\nFPS = %d", DxWndStatus.FPSCount); + strcat(sMsg, sMsg2); } if(Target->flags2 & TIMESTRETCH){ if(DxWndStatus.TimeShift>=-8 && DxWndStatus.TimeShift<=8){ - sprintf(sMsgBuf, "\nTime speed %s", GetTSCaption(DxWndStatus.TimeShift)); - strcat(sMsg, sMsgBuf); + sprintf(sMsg2, "\nTime speed %s", GetTSCaption(DxWndStatus.TimeShift)); + strcat(sMsg, sMsg2); } } } diff --git a/host/TabCompat.cpp b/host/TabCompat.cpp index 9a3eb33..465a948 100644 --- a/host/TabCompat.cpp +++ b/host/TabCompat.cpp @@ -48,6 +48,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_NOTEXTURES, cTarget->m_NoTextures); DDX_Check(pDX, IDC_WIREFRAME, cTarget->m_WireFrame); DDX_Check(pDX, IDC_DISABLEFOGGING, cTarget->m_DisableFogging); + DDX_Check(pDX, IDC_CLEARTARGET, cTarget->m_ClearTarget); // Registry management DDX_Check(pDX, IDC_EMULATEREGISTRY, cTarget->m_EmulateRegistry); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 82be5c4..60538bf 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -40,7 +40,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_SuppressIME = FALSE; m_SuppressD3DExt = FALSE; m_SetCompatibility = TRUE; - m_DiabloTweak = TRUE; + m_DiabloTweak = FALSE; m_DisableHAL = FALSE; m_ForcesHEL = FALSE; m_ColorFix = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index d1a92a8..9a3111c 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -140,6 +140,7 @@ public: BOOL m_NoPower2Fix; BOOL m_NoPerfCounter; BOOL m_DisableFogging; + BOOL m_ClearTarget; BOOL m_SuppressIME; BOOL m_SetCompatibility; BOOL m_DiabloTweak; diff --git a/host/dxwnd.ini b/host/dxwnd.ini deleted file mode 100644 index 3608fe7..0000000 --- a/host/dxwnd.ini +++ /dev/null @@ -1,5 +0,0 @@ -[window] -posx=1213 -posy=261 -sizx=320 -sizy=200 diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 0934b42..564eb0c 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.cpp b/host/dxwndhost.cpp index d93c908..bd07881 100644 --- a/host/dxwndhost.cpp +++ b/host/dxwndhost.cpp @@ -105,7 +105,6 @@ CDxwndhostApp theApp; BOOL CDxwndhostApp::InitInstance() { char InitPath[MAX_PATH]; - int CompatibilityMinLevel; AfxEnableControlContainer(); // standard initialization diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index e90125b..71c03cf 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 0ec922a..29f3b5b 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhost.vs2008.vcproj b/host/dxwndhost.vs2008.vcproj index 286ea2c..ec7733a 100644 --- a/host/dxwndhost.vs2008.vcproj +++ b/host/dxwndhost.vs2008.vcproj @@ -223,6 +223,10 @@ RelativePath=".\CppUACSelfElevation.cpp" > + + @@ -454,6 +458,10 @@ RelativePath=".\cdib.h" > + + @@ -547,6 +555,10 @@ RelativePath=".\res\bigicons.bmp" > + + diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index 74b5d41..8fcf403 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -12,6 +12,7 @@ #include "TargetDlg.h" #include "SystemTray.h" #include "StatusDialog.h" +#include "DesktopDialog.h" #include "PaletteDialog.h" #include "TimeSliderDialog.h" @@ -63,6 +64,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView) ON_COMMAND(ID_RUN, OnRun) ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore) ON_COMMAND(ID_VIEW_STATUS, OnViewStatus) + ON_COMMAND(ID_VIEW_DESKTOP, OnViewDesktop) ON_COMMAND(ID_VIEW_PALETTE, OnViewPalette) ON_COMMAND(ID_VIEW_TIMESLIDER, OnViewTimeSlider) ON_COMMAND(ID_DESKTOPCOLORDEPTH_8BPP, OnDesktopcolordepth8bpp) @@ -177,6 +179,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_NoPower2Fix) t->flags4 |= NOPOWER2FIX; if(dlg->m_NoPerfCounter) t->flags4 |= NOPERFCOUNTER; if(dlg->m_DisableFogging) t->flags4 |= DISABLEFOGGING; + if(dlg->m_ClearTarget) t->flags5 |= CLEARTARGET; if(dlg->m_SuppressIME) t->flags2 |= SUPPRESSIME; if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT; if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY; @@ -375,6 +378,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_NoPower2Fix = t->flags4 & NOPOWER2FIX ? 1 : 0; dlg->m_NoPerfCounter = t->flags4 & NOPERFCOUNTER ? 1 : 0; dlg->m_DisableFogging = t->flags4 & DISABLEFOGGING ? 1 : 0; + dlg->m_ClearTarget = t->flags5 & CLEARTARGET ? 1 : 0; dlg->m_SaveLoad = t->flags & SAVELOAD ? 1 : 0; dlg->m_SlowDown = t->flags & SLOWDOWN ? 1 : 0; dlg->m_BlitFromBackBuffer = t->flags & BLITFROMBACKBUFFER ? 1 : 0; @@ -1462,6 +1466,13 @@ void CDxwndhostView::OnViewStatus() pDlg->ShowWindow(SW_SHOW); } +void CDxwndhostView::OnViewDesktop() +{ + CDesktopDialog *pDlg = new CDesktopDialog(); + BOOL ret = pDlg->Create(CDesktopDialog::IDD, this); + pDlg->ShowWindow(SW_SHOW); +} + void CDxwndhostView::OnViewPalette() { CPaletteDialog *pDlg = new CPaletteDialog(); diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h index c7ee42c..136a3b6 100644 --- a/host/dxwndhostView.h +++ b/host/dxwndhostView.h @@ -83,6 +83,7 @@ protected: afx_msg void OnHookStop(); afx_msg void OnTrayRestore(); afx_msg void OnViewStatus(); + afx_msg void OnViewDesktop(); afx_msg void OnViewPalette(); afx_msg void OnViewTimeSlider(); afx_msg void OnExit(); diff --git a/host/res/bigicons.bmp b/host/res/bigicons.bmp index 66dd6f4..eb32d61 100644 Binary files a/host/res/bigicons.bmp and b/host/res/bigicons.bmp differ diff --git a/host/res/palette0.bmp b/host/res/palette0.bmp deleted file mode 100644 index 93f0908..0000000 Binary files a/host/res/palette0.bmp and /dev/null differ diff --git a/locale/cn/Resources_Cn.ncb b/locale/cn/Resources_Cn.ncb index 293e240..1172f15 100644 Binary files a/locale/cn/Resources_Cn.ncb and b/locale/cn/Resources_Cn.ncb differ diff --git a/locale/cn/Resources_Cn.rc b/locale/cn/Resources_Cn.rc index c95d853..b36a6a7 100644 Binary files a/locale/cn/Resources_Cn.rc and b/locale/cn/Resources_Cn.rc differ diff --git a/locale/cn/Resources_Cn.suo b/locale/cn/Resources_Cn.suo index 6bed9de..cd88731 100644 Binary files a/locale/cn/Resources_Cn.suo and b/locale/cn/Resources_Cn.suo differ diff --git a/locale/en/Resources_EN.rc b/locale/en/Resources_EN.rc index e90125b..71c03cf 100644 Binary files a/locale/en/Resources_EN.rc and b/locale/en/Resources_EN.rc differ diff --git a/locale/en/Resources_En.ncb b/locale/en/Resources_En.ncb index 33ba46b..ebcee50 100644 Binary files a/locale/en/Resources_En.ncb and b/locale/en/Resources_En.ncb differ diff --git a/locale/en/Resources_En.suo b/locale/en/Resources_En.suo index 955098f..a60147f 100644 Binary files a/locale/en/Resources_En.suo and b/locale/en/Resources_En.suo differ diff --git a/locale/it/Resources_IT.rc b/locale/it/Resources_IT.rc index 23f4d59..732076f 100644 Binary files a/locale/it/Resources_IT.rc and b/locale/it/Resources_IT.rc differ diff --git a/locale/it/Resources_It.ncb b/locale/it/Resources_It.ncb index dd9ef45..b5225cd 100644 Binary files a/locale/it/Resources_It.ncb and b/locale/it/Resources_It.ncb differ diff --git a/locale/it/Resources_It.suo b/locale/it/Resources_It.suo index 39d388b..794fde1 100644 Binary files a/locale/it/Resources_It.suo and b/locale/it/Resources_It.suo differ