From 5112aa76e4ea750a196cec68c2a12efb86ccba66 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 4 Jun 2024 03:40:29 +0200 Subject: [PATCH] fix movies in atrox --- src/config.c | 1 - src/utils.c | 16 ++++++++++++---- src/winapi_hooks.c | 24 +++++++++++++++++++++--- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/config.c b/src/config.c index c695cd2..41c23e4 100644 --- a/src/config.c +++ b/src/config.c @@ -366,7 +366,6 @@ static void cfg_create_ini() "; Atrox\n" "[Atrox]\n" "nonexclusive=true\n" - "fixchilds=0\n" "allow_wmactivate=true\n" "\n" "; Atomic Bomberman\n" diff --git a/src/utils.c b/src/utils.c index de9fc99..8c8072c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -590,17 +590,25 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam) RECT size; RECT pos; - if (real_GetClientRect(hwnd, &size) && real_GetWindowRect(hwnd, &pos) && size.right > 1 && size.bottom > 1) + if (real_GetClientRect(hwnd, &size) && + real_GetWindowRect(hwnd, &pos) && + size.right > 1 && + size.bottom > 1) { char class_name[MAX_PATH] = { 0 }; GetClassNameA(hwnd, class_name, sizeof(class_name) - 1); + LONG style = real_GetWindowLongA(hwnd, GWL_STYLE); LONG exstyle = real_GetWindowLongA(hwnd, GWL_EXSTYLE); - //TRACE("util_enum_child_proc class=%s, hwnd=%p, width=%u, height=%u, left=%d, top=%d\n", - // class_name, hwnd, size.right, size.bottom, pos.left, pos.top); + //TRACE("util_enum_child_proc class=%s, hwnd=%p, width=%u, height=%u, left=%d, top=%d, parent=%p\n", + // class_name, hwnd, size.right, size.bottom, pos.left, pos.top, GetParent(hwnd)); - //dbg_dump_wnd_styles(real_GetWindowLongA(hwnd, GWL_STYLE), exstyle); + //dbg_dump_wnd_styles(style, exstyle); + + /* Atrox */ + if (style == 0x500100C4 && strcmp(class_name, "Edit") == 0) + return TRUE; if (g_config.fixchilds == FIX_CHILDS_DETECT_HIDE || strcmp(class_name, "VideoRenderer") == 0 || diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index 560a8b8..664d16e 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -834,6 +834,7 @@ BOOL WINAPI fake_StretchBlt( (hwnd == g_ddraw.hwnd || (g_config.fixchilds && IsChild(g_ddraw.hwnd, hwnd) && (g_config.fixchilds == FIX_CHILDS_DETECT_HIDE || + strcmp(class_name, "VideoRenderer") == 0 || strcmp(class_name, "AVI Window") == 0 || strcmp(class_name, "MCIAVI") == 0 || strcmp(class_name, "AVIWnd32") == 0 || @@ -846,8 +847,22 @@ BOOL WINAPI fake_StretchBlt( if (primary_dc) { + POINT pt = { 0 }; + real_MapWindowPoints(hwnd, g_ddraw.hwnd, &pt, 1); + BOOL result = - real_StretchBlt(primary_dc, xDest, yDest, wDest, hDest, hdcSrc, xSrc, ySrc, wSrc, hSrc, rop); + real_StretchBlt( + primary_dc, + xDest + pt.x, + yDest + pt.y, + wDest, + hDest, + hdcSrc, + xSrc, + ySrc, + wSrc, + hSrc, + rop); dds_ReleaseDC(g_ddraw.primary, primary_dc); @@ -1053,11 +1068,14 @@ int WINAPI fake_StretchDIBits( if (primary_dc) { + POINT pt = {0}; + real_MapWindowPoints(hwnd, g_ddraw.hwnd, &pt, 1); + int result = real_StretchDIBits( primary_dc, - xDest, - yDest, + xDest + pt.x, + yDest + pt.y, DestWidth, DestHeight, xSrc,