add new .ini setting for hiding child windows

This commit is contained in:
FunkyFr3sh 2021-08-10 16:45:40 +02:00
parent 1fde0ef382
commit b83005118d
3 changed files with 37 additions and 11 deletions

View file

@ -25,6 +25,7 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
#define FIX_CHILDS_DISABLED 0 #define FIX_CHILDS_DISABLED 0
#define FIX_CHILDS_DETECT 1 #define FIX_CHILDS_DETECT 1
#define FIX_CHILDS_DETECT_PAINT 2 #define FIX_CHILDS_DETECT_PAINT 2
#define FIX_CHILDS_DETECT_HIDE 3
#define RESLIST_NORMAL 0 #define RESLIST_NORMAL 0
#define RESLIST_MINI 1 #define RESLIST_MINI 1

View file

@ -329,7 +329,7 @@ static void cfg_create_ini()
"; Note: Set this to 2 if your chosen resolution is not working, set to 1 if the game is crashing\n" "; Note: Set this to 2 if your chosen resolution is not working, set to 1 if the game is crashing\n"
"resolutions=0\n" "resolutions=0\n"
"\n" "\n"
"; Child window handling, possible values: 0 = Disabled, 1 = Display top left, 2 = Display top left + repaint\n" "; Child window handling, possible values: 0 = Disabled, 1 = Display top left, 2 = Display top left + repaint, 3 = Hide\n"
"; Note: Disables upscaling if a child window was detected\n" "; Note: Disables upscaling if a child window was detected\n"
"fixchilds=2\n" "fixchilds=2\n"
"\n" "\n"
@ -417,8 +417,8 @@ static void cfg_create_ini()
"\n" "\n"
"; Blade & Sword\n" "; Blade & Sword\n"
"[comeon]\n" "[comeon]\n"
"renderer=opengl\n" "fixchilds=3\n"
"nonexclusive=true\n" "hook=3\n"
"fixpitch=true\n" "fixpitch=true\n"
"\n" "\n"
"; Blood II - The Chosen / Shogo - Mobile Armor Division\n" "; Blood II - The Chosen / Shogo - Mobile Armor Division\n"

View file

@ -1,5 +1,6 @@
#include <windows.h> #include <windows.h>
#include "ddraw.h" #include "ddraw.h"
#include "debug.h"
#include "dd.h" #include "dd.h"
#include "ddsurface.h" #include "ddsurface.h"
#include "hook.h" #include "hook.h"
@ -372,20 +373,44 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
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)
{ {
g_ddraw->got_child_windows = g_ddraw->child_window_exists = TRUE; //TRACE(" util_enum_child_proc right=%u, bottom=%u\n", size.right, size.bottom);
if (g_ddraw->fixchilds == FIX_CHILDS_DETECT_PAINT) if (g_ddraw->fixchilds == FIX_CHILDS_DETECT_HIDE)
{ {
HDC dst_dc = GetDC(hwnd); LONG style = GetWindowLong(hwnd, GWL_EXSTYLE);
HDC src_dc;
dds_GetDC(this, &src_dc); if (!(style & WS_EX_TRANSPARENT))
{
real_SetWindowLongA(hwnd, GWL_EXSTYLE, style | WS_EX_TRANSPARENT);
real_MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)&pos, 2); real_SetWindowPos(
hwnd,
0,
0,
0,
0,
0,
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER
);
}
}
else
{
g_ddraw->got_child_windows = g_ddraw->child_window_exists = TRUE;
BitBlt(dst_dc, 0, 0, size.right, size.bottom, src_dc, pos.left, pos.top, SRCCOPY); if (g_ddraw->fixchilds == FIX_CHILDS_DETECT_PAINT)
{
HDC dst_dc = GetDC(hwnd);
HDC src_dc;
ReleaseDC(hwnd, dst_dc); dds_GetDC(this, &src_dc);
real_MapWindowPoints(HWND_DESKTOP, g_ddraw->hwnd, (LPPOINT)&pos, 2);
BitBlt(dst_dc, 0, 0, size.right, size.bottom, src_dc, pos.left, pos.top, SRCCOPY);
ReleaseDC(hwnd, dst_dc);
}
} }
} }