diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 11fb8ba..37e8849 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:614dc453abbfbc0659502a136e3cd3b2dbb7e794dc3c964ffd2f53a784c6f429 +oid sha256:8448e58dc97c4a242f28a3c94cd1e3837f13fd9cb48d6c3342f84df91fccbbf3 size 779264 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 81894e6..07ebb26 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f5c8f132cd8013ecb60b7bd0b0a17727fc0e4ffbc2c17756dcb835897d511427 -size 671232 +oid sha256:41137464c3c599b09e720882a36a3e1c939081fa477027447459c269fdb15971 +size 673280 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 32bbeaa..f8a7cad 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -1453,4 +1453,12 @@ fix?: bypass for WM_FONTCHANGE: avoids "Warhammer: Shadow of the Horned Rat" cra add: WinG32 debug highlighting of blitted rects on screen add: GDI32 debug highlighting of blitted rects on screen add: hooks for GDI32 GetTextExtentPointA and GetTextExtentPoint32A: needed for proper string rendering on "Warhammer: Shadow of the Horned Rat" -add: hook for GDI32 GdiAlphaBlend, very rare call that appeared in "RHEM" during savegame load. \ No newline at end of file +add: hook for GDI32 GdiAlphaBlend, very rare call that appeared in "RHEM" during savegame load. + +v2.04.06 +GUI: +add: Expert mode +DLL: +fix: corrected condition to print two virtual registry log messages +fix: improved logic to recover surfaces with DDSCAPS_TEXTURE capability - ref. "Dominant Species" +fix: fixed cursor clipping state and toggle key to make it work in all conditions \ No newline at end of file diff --git a/dll/advapi.cpp b/dll/advapi.cpp index 45a75cc..35c0788 100644 --- a/dll/advapi.cpp +++ b/dll/advapi.cpp @@ -101,7 +101,7 @@ static int ReplaceVar(char *pData, LPBYTE *lplpData, LPDWORD lpcbData) } // set output vars if not NULL iTokenLength = strlen(sTokenValue); - OutTrace("REPLACED token=%d val=\"%s\" len=%d\n", iTokenIndex, sTokenValue, iTokenLength); + OutTraceR("REPLACED token=%d val=\"%s\" len=%d\n", iTokenIndex, sTokenValue, iTokenLength); if(lplpData) { strcpy((char *)*lplpData, sTokenValue); *lplpData += iTokenLength; @@ -456,7 +456,7 @@ static LONG myRegOpenKeyEx( if(RegBuf[0]=='['){ // beware: registry keys are case insensitive. Must use _strnicmp instead of strncmp if((!_strnicmp(&RegBuf[1],sKey,strlen(sKey))) && (RegBuf[strlen(sKey)+1]==']')){ - OutTrace("%s: found fake Key=\"%s\" hkResult=%x\n", label, sKey, phkResult ? *phkResult : 0); + OutTraceR("%s: found fake Key=\"%s\" hkResult=%x\n", label, sKey, phkResult ? *phkResult : 0); fclose(regf); return ERROR_SUCCESS; } diff --git a/dll/ddcreates.cpp b/dll/ddcreates.cpp index 7a450a8..04a36b4 100644 --- a/dll/ddcreates.cpp +++ b/dll/ddcreates.cpp @@ -715,11 +715,13 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu); // v2.04.05: error condition found & fixed on certain platforms for "Dominant Species" only (so far). - if ((res == DDERR_UNSUPPORTED) && (ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY|DDSCAPS_TEXTURE))){ + if (((res == DDERR_UNSUPPORTED) || (res == DDERR_UNSUPPORTEDMODE)) && + (ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE)){ OutTraceDW("BuildGenericEmu: CreateSurface ERROR res=%x(%s) at %d, TEXTURE->OFFSCREENPLAIN retry\n", res, ExplainDDError(res), __LINE__); - ddsd.ddsCaps.dwCaps = (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); + ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_TEXTURE|DDSCAPS_ALLOCONLOAD); + ddsd.ddsCaps.dwCaps |= (DDSCAPS_OFFSCREENPLAIN); res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu); - } + } if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res!=DD_OK)){ OutTraceDW("BuildGenericEmu: CreateSurface ERROR res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__); ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index 2f8925a..f3355a4 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.04.05" +#define VERSION "2.04.06" #define DDTHREADLOCK 1 diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index ddc1930..233884c 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index 6485132..fd30ed1 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -1822,48 +1822,48 @@ HRESULT WINAPI extTexInitialize(void *t, LPDIRECT3DDEVICE lpd3dd, LPDIRECTDRAWSU return (*pTInitialize)(t, lpd3dd, lpdds); } -HRESULT WINAPI extTexGetHandle(TexGetHandle_Type pTGetHandle, void *t, LPDIRECT3DDEVICE lpd3dd, LPD3DTEXTUREHANDLE lpth) +static HRESULT WINAPI extTexGetHandle(int version, TexGetHandle_Type pTGetHandle, void *t, LPDIRECT3DDEVICE lpd3dd, LPD3DTEXTUREHANDLE lpth) { HRESULT ret; - OutTrace("Texture::GetHandle lpt=%x lpd3dd=%x lpth=%x\n", t, lpd3dd, lpth); + OutTrace("Texture(%d)::GetHandle lpt=%x lpd3dd=%x lpth=%x\n", version, t, lpd3dd, lpth); ret = (*pTGetHandle)(t, lpd3dd, lpth); if(ret) OutTraceE("Texture::Load ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); return ret; } HRESULT WINAPI extTexGetHandle1(void *t, LPDIRECT3DDEVICE lpd3dd, LPD3DTEXTUREHANDLE lpth) -{ return extTexGetHandle(pTGetHandle1, t, lpd3dd, lpth); } +{ return extTexGetHandle(1, pTGetHandle1, t, lpd3dd, lpth); } HRESULT WINAPI extTexGetHandle2(void *t, LPDIRECT3DDEVICE2 lpd3dd, LPD3DTEXTUREHANDLE lpth) -{ return extTexGetHandle(pTGetHandle2, t, (LPDIRECT3DDEVICE)lpd3dd, lpth); } +{ return extTexGetHandle(2, pTGetHandle2, t, (LPDIRECT3DDEVICE)lpd3dd, lpth); } -HRESULT WINAPI extTexPaletteChanged(TexPaletteChanged_Type pTPaletteChanged, void *t, DWORD dw1, DWORD dw2) +static HRESULT WINAPI extTexPaletteChanged(int version, TexPaletteChanged_Type pTPaletteChanged, void *t, DWORD dw1, DWORD dw2) { HRESULT ret; - OutTrace("Texture::PaletteChanged lpt=%x dw1=%x dw2=%x\n", t, dw1, dw2); + OutTrace("Texture(%d)::PaletteChanged lpt=%x dw1=%x dw2=%x\n", version, t, dw1, dw2); ret = (*pTPaletteChanged)(t, dw1, dw2); if(ret) OutTraceE("Texture::PaletteChanged ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); return ret; } HRESULT WINAPI extTexPaletteChanged1(void *t, DWORD dw1, DWORD dw2) -{ return extTexPaletteChanged(pTPaletteChanged1, t, dw1, dw2); } +{ return extTexPaletteChanged(1, pTPaletteChanged1, t, dw1, dw2); } HRESULT WINAPI extTexPaletteChanged2(void *t, DWORD dw1, DWORD dw2) -{ return extTexPaletteChanged(pTPaletteChanged2, t, dw1, dw2); } +{ return extTexPaletteChanged(2, pTPaletteChanged2, t, dw1, dw2); } -HRESULT WINAPI extTexLoad(TexLoad_Type pTLoad, void *t, LPDIRECT3DTEXTURE lpt) +HRESULT WINAPI extTexLoad(int version, TexLoad_Type pTLoad, void *t, LPDIRECT3DTEXTURE lpt) { HRESULT ret; - OutTrace("Texture::Load lpt=%x lpd3dt=%x\n", t, lpt); + OutTrace("Texture(%d)::Load lpt=%x lpd3dt=%x\n", version, t, lpt); ret = (*pTLoad)(t, lpt); if(ret) OutTraceE("Texture::Load ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); return ret; } HRESULT WINAPI extTexLoad1(void *t, LPDIRECT3DTEXTURE lpt) -{ return extTexLoad(pTLoad1, t, lpt); } +{ return extTexLoad(1, pTLoad1, t, lpt); } HRESULT WINAPI extTexLoad2(void *t, LPDIRECT3DTEXTURE lpt) -{ return extTexLoad(pTLoad2, t, lpt); } +{ return extTexLoad(2, pTLoad2, t, lpt); } HRESULT WINAPI extTexUnload(void *t) { diff --git a/dll/iatpatch.cpp b/dll/iatpatch.cpp index 7720284..9949182 100644 --- a/dll/iatpatch.cpp +++ b/dll/iatpatch.cpp @@ -467,7 +467,7 @@ BOOL IsIATSequential(HMODULE module) // skip first string for(; *fname; fname++); for(; !*fname; fname++); // if second string is another DLL it is sequential, otherwise not. - OutTraceB("IsIATSequential: second entry=%s\n", fname); + //OutTraceB("IsIATSequential: second entry=%s\n", fname); return (BOOL)stristr(fname, ".DLL"); } __except(EXCEPTION_EXECUTE_HANDLER) diff --git a/dll/winproc.cpp b/dll/winproc.cpp index 5d8b08f..4988a3c 100644 --- a/dll/winproc.cpp +++ b/dll/winproc.cpp @@ -224,7 +224,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp POINT prev, curr; RECT rect; static int i=0; - static int ClipCursorToggleState = 1; + static int ClipCursorToggleState = 0; WNDPROC pWindowProc; extern void dxwFixWindowPos(char *, HWND, LPARAM); extern LPRECT lpClipRegion; @@ -236,9 +236,20 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp extern void DDrawScreenShot(int); if(DoOnce){ + RECT cliprect; + BOOL clipret; DoOnce=FALSE; IsToBeLocked=(dxw.dwFlags1 & LOCKWINPOS); LastTimeShift=SaveTimeShift=dxw.TimeShift; + clipret = (*pGetClipCursor)(&cliprect); + // v2.04.06: you always get a clipper area. To tell that the clipper is NOT active for your window + // you can compare the clipper area with the whole desktop. If they are equivalent, you have no + // clipper (or you are in fullscreen mode, but that is equivalent). + ClipCursorToggleState = TRUE; + if (((cliprect.right - cliprect.left) == (*pGetSystemMetrics)(SM_CXVIRTUALSCREEN)) && + ((cliprect.bottom - cliprect.top) == (*pGetSystemMetrics)(SM_CYVIRTUALSCREEN))) + ClipCursorToggleState = FALSE; + OutTraceDW("Initial clipper status=%x\n", ClipCursorToggleState); } // v2.1.93: adjust clipping region @@ -467,7 +478,10 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: if(dxw.Windowize){ - if((dxw.dwFlags1 & CLIPCURSOR) && ClipCursorToggleState) dxw.SetClipCursor(); + if((dxw.dwFlags1 & CLIPCURSOR) && !ClipCursorToggleState) { + ClipCursorToggleState = TRUE; + dxw.SetClipCursor(); + } if((dxw.dwFlags1 & MODIFYMOUSE) && !(dxw.dwFlags1 & MESSAGEPROC)){ // mouse processing // scale mouse coordinates prev.x = LOWORD(lparam); @@ -488,7 +502,10 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case WM_SETFOCUS: OutTraceDW("WindowProc: hwnd=%x GOT FOCUS\n", hwnd); - if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor(); + if(dxw.dwFlags1 & CLIPCURSOR) { + ClipCursorToggleState = TRUE; + dxw.SetClipCursor(); + } if (dxw.dwFlags1 & DISABLECLIPPING) extClipCursor(lpClipRegion); break; case WM_KILLFOCUS: @@ -551,11 +568,9 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp DxWndKey=dxw.MapKeysConfig(message, lparam, wparam); switch (DxWndKey){ case DXVK_CLIPTOGGLE: - if(dxw.dwFlags1 & CLIPCURSOR){ - OutTraceDW("WindowProc: WM_SYSKEYDOWN key=%x ToggleState=%x\n",wparam,ClipCursorToggleState); - ClipCursorToggleState = !ClipCursorToggleState; - ClipCursorToggleState ? dxw.SetClipCursor() : dxw.EraseClipCursor(); - } + OutTraceDW("WindowProc: WM_SYSKEYDOWN key=%x ToggleState=%x\n", wparam, ClipCursorToggleState); + ClipCursorToggleState = !ClipCursorToggleState; + ClipCursorToggleState ? dxw.SetClipCursor() : dxw.EraseClipCursor(); break; case DXVK_REFRESH: dxw.ScreenRefresh(); diff --git a/host/CGlobalSettings.cpp b/host/CGlobalSettings.cpp index 23d9d68..7c7ce65 100644 --- a/host/CGlobalSettings.cpp +++ b/host/CGlobalSettings.cpp @@ -80,7 +80,7 @@ IMPLEMENT_DYNAMIC(CGlobalSettings, CDialog) CGlobalSettings::CGlobalSettings(CWnd* pParent /*=NULL*/) : CDialog(CGlobalSettings::IDD, pParent) { - m_DebugMode = GetPrivateProfileInt("window", "debug", 0, gInitPath); + //m_DebugMode = GetPrivateProfileInt("window", "debug", 0, gInitPath); m_AutoHideMode = GetPrivateProfileInt("window", "autohide", 0, gInitPath); m_CheckAdminRights = GetPrivateProfileInt("window", "checkadmin", 0, gInitPath); m_NameFromFolder = GetPrivateProfileInt("window", "namefromfolder", 0, gInitPath); @@ -112,7 +112,7 @@ void CGlobalSettings::DoDataExchange(CDataExchange* pDX) CString sDefaultPosX, sDefaultPosY; sDefaultPosX.Format("%d", m_DefaultPosX); sDefaultPosY.Format("%d", m_DefaultPosY); - DDX_Check(pDX, IDC_CONFIG_DEBUGMODE, m_DebugMode); + //DDX_Check(pDX, IDC_CONFIG_DEBUGMODE, m_DebugMode); DDX_Check(pDX, IDC_CONFIG_AUTOHIDE, m_AutoHideMode); DDX_Check(pDX, IDC_CONFIG_CHECKADMIN, m_CheckAdminRights); DDX_Check(pDX, IDC_CONFIG_NAMEFROMFOLDER, m_NameFromFolder); @@ -180,8 +180,8 @@ void CGlobalSettings::OnOK() char val[32]; CDialog::OnOK(); // boolean flags - sprintf_s(val, sizeof(val), "%i", m_DebugMode); - WritePrivateProfileString("window", "debug", val, gInitPath); + //sprintf_s(val, sizeof(val), "%i", m_DebugMode); + //WritePrivateProfileString("window", "debug", val, gInitPath); sprintf_s(val, sizeof(val), "%i", m_AutoHideMode); WritePrivateProfileString("window", "autohide", val, gInitPath); sprintf_s(val, sizeof(val), "%i", m_CheckAdminRights); @@ -244,7 +244,7 @@ void CGlobalSettings::OnOK() WritePrivateProfileString("keymapping", HKeys[i].sIniLabel, "", gInitPath); } //(CDxwndhostView *)(this->GetParent())->UpdateHotKeys(); - gbDebug = m_DebugMode; + //gbDebug = m_DebugMode; gAutoHideMode = m_AutoHideMode; gWarnOnExit = m_WarnOnExit; } diff --git a/host/CGlobalSettings.h b/host/CGlobalSettings.h index 771cc45..1dfa5ff 100644 --- a/host/CGlobalSettings.h +++ b/host/CGlobalSettings.h @@ -31,7 +31,7 @@ public: protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - BOOL m_DebugMode; + //BOOL m_DebugMode; BOOL m_UpdatePaths; BOOL m_AutoHideMode; BOOL m_CheckAdminRights; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index ae61289..57ee12d 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.cpp b/host/dxwndhost.cpp index a30a06d..530dead 100644 --- a/host/dxwndhost.cpp +++ b/host/dxwndhost.cpp @@ -148,17 +148,6 @@ BOOL CDxwndhostApp::InitInstance() // standard initialization - // Register the document template. - - CSingleDocTemplate* pDocTemplate; - pDocTemplate = new CSingleDocTemplate( - IDR_MAINFRAME, - RUNTIME_CLASS(CDxwndhostDoc), - RUNTIME_CLASS(CMainFrame), // SDI main frame window - RUNTIME_CLASS(CDxwndhostView)); - AddDocTemplate(pDocTemplate); - - // DDE file open: Parse command line for standard shell commands and so on. // Parse command line for standard shell commands, DDE, file open // and user-defined flags. The CCommandLine class has been replaced @@ -174,6 +163,16 @@ BOOL CDxwndhostApp::InitInstance() if(!gAutoHideMode) gAutoHideMode = GetPrivateProfileInt("window", "autohide", 0, InitPath); // debug flag set from config file gWarnOnExit = GetPrivateProfileInt("window", "warnonexit", 0, InitPath); // WarnOnExit flag set from config file + // Register the document template. + + CSingleDocTemplate* pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + gbDebug ? IDR_MAINFRAME_EX : IDR_MAINFRAME, + RUNTIME_CLASS(CDxwndhostDoc), + RUNTIME_CLASS(CMainFrame), // SDI main frame window + RUNTIME_CLASS(CDxwndhostView)); + AddDocTemplate(pDocTemplate); + if(!LangSelected){ LANGID LangId; char LangString[20+1]; diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index ddf9b64..384e7d9 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 c6995a8..d566e26 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 01d1d09..abf2f4d 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -129,6 +129,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView) ON_COMMAND(ID_DELETE, OnDelete) ON_COMMAND(ID_FILE_SORTPROGRAMSLIST, OnSort) ON_COMMAND(ID_EDIT_GLOBALSETTINGS, OnGlobalSettings) + ON_COMMAND(ID_OPTIONS_EXPERTMODE, OnExpertModeToggle) ON_COMMAND(ID_FILE_CLEARALLLOGS, OnClearAllLogs) ON_COMMAND(ID_FILE_GOTOTRAYICON, OnGoToTrayIcon) ON_COMMAND(ID_FILE_SAVE, OnSaveFile) @@ -2539,6 +2540,19 @@ void CDxwndhostView::OnGlobalSettings() pDlg->ShowWindow(SW_SHOW); } +void CDxwndhostView::OnExpertModeToggle() +{ + CMenu *menu; + gbDebug = !gbDebug; + menu = this->GetParent()->GetMenu(); + ::DestroyMenu(menu->GetSafeHmenu()); + menu->LoadMenu(gbDebug ? IDR_MAINFRAME_EX : IDR_MAINFRAME); + this->GetParent()->SetMenu(menu); + menu->CheckMenuItem(ID_OPTIONS_EXPERTMODE, gbDebug ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileString("window", "debug", (gbDebug ? "1" : "0"), gInitPath); + +} + void CDxwndhostView::OnViewTimeSlider() { CTimeSliderDialog *pDlg = new CTimeSliderDialog(); diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h index be50a48..7fd0698 100644 --- a/host/dxwndhostView.h +++ b/host/dxwndhostView.h @@ -83,6 +83,7 @@ protected: afx_msg void OnTaskbarShow(); afx_msg void OnSort(); afx_msg void OnGlobalSettings(); + afx_msg void OnExpertModeToggle(); afx_msg void OnViewLog(); afx_msg void OnDeleteLog(); afx_msg void OnDebugView(); diff --git a/host/resource b/host/resource index 4950f98..4c865d7 100644 Binary files a/host/resource and b/host/resource differ