1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

fix videos in wine

This commit is contained in:
FunkyFr3sh 2024-02-17 23:18:42 +01:00
parent caa06c77c0
commit eca7dde89e
3 changed files with 22 additions and 3 deletions

View File

@ -517,6 +517,7 @@ void hook_create(HOOKLIST* hooks, BOOL initial_hook)
BOOL is_local = _strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0; BOOL is_local = _strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0;
if (is_local || if (is_local ||
_strcmpi(mod_filename, "mciavi32") == 0 ||
_strcmpi(mod_filename, "MSVFW32") == 0 || _strcmpi(mod_filename, "MSVFW32") == 0 ||
_strcmpi(mod_filename, "quartz") == 0 || _strcmpi(mod_filename, "quartz") == 0 ||
_strcmpi(mod_filename, "winmm") == 0) _strcmpi(mod_filename, "winmm") == 0)
@ -581,6 +582,7 @@ void hook_revert(HOOKLIST* hooks)
BOOL is_local = _strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0; BOOL is_local = _strnicmp(game_dir, mod_dir, strlen(game_dir)) == 0;
if (is_local || if (is_local ||
_strcmpi(mod_filename, "mciavi32") == 0 ||
_strcmpi(mod_filename, "MSVFW32") == 0 || _strcmpi(mod_filename, "MSVFW32") == 0 ||
_strcmpi(mod_filename, "quartz") == 0 || _strcmpi(mod_filename, "quartz") == 0 ||
_strcmpi(mod_filename, "winmm") == 0) _strcmpi(mod_filename, "winmm") == 0)

View File

@ -568,6 +568,7 @@ BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
if (g_config.fixchilds == FIX_CHILDS_DETECT_HIDE || if (g_config.fixchilds == FIX_CHILDS_DETECT_HIDE ||
strcmp(class_name, "VideoRenderer") == 0 || strcmp(class_name, "VideoRenderer") == 0 ||
strcmp(class_name, "MCIAVI") == 0 ||
strcmp(class_name, "AVIWnd32") == 0 || strcmp(class_name, "AVIWnd32") == 0 ||
strcmp(class_name, "MCIWndClass") == 0) strcmp(class_name, "MCIWndClass") == 0)
{ {

View File

@ -763,6 +763,7 @@ BOOL WINAPI fake_StretchBlt(
(hwnd == g_ddraw->hwnd || (hwnd == g_ddraw->hwnd ||
(g_config.fixchilds && IsChild(g_ddraw->hwnd, hwnd) && (g_config.fixchilds && IsChild(g_ddraw->hwnd, hwnd) &&
(g_config.fixchilds == FIX_CHILDS_DETECT_HIDE || (g_config.fixchilds == FIX_CHILDS_DETECT_HIDE ||
strcmp(class_name, "MCIAVI") == 0 ||
strcmp(class_name, "AVIWnd32") == 0 || strcmp(class_name, "AVIWnd32") == 0 ||
strcmp(class_name, "MCIWndClass") == 0)))) strcmp(class_name, "MCIWndClass") == 0))))
{ {
@ -864,7 +865,22 @@ int WINAPI fake_StretchDIBits(
UINT iUsage, UINT iUsage,
DWORD rop) DWORD rop)
{ {
if (g_ddraw && g_ddraw->hwnd && WindowFromDC(hdc) == g_ddraw->hwnd) HWND hwnd = WindowFromDC(hdc);
char class_name[MAX_PATH] = { 0 };
if (g_ddraw && g_ddraw->hwnd && hwnd && hwnd != g_ddraw->hwnd)
{
GetClassNameA(hwnd, class_name, sizeof(class_name) - 1);
}
if (g_ddraw && g_ddraw->hwnd &&
(hwnd == g_ddraw->hwnd ||
(g_config.fixchilds && IsChild(g_ddraw->hwnd, hwnd) &&
(g_config.fixchilds == FIX_CHILDS_DETECT_HIDE ||
strcmp(class_name, "MCIAVI") == 0 ||
strcmp(class_name, "AVIWnd32") == 0 ||
strcmp(class_name, "MCIWndClass") == 0))))
{ {
if (g_ddraw->primary && (g_ddraw->primary->bpp == 16 || g_ddraw->primary->bpp == 32 || g_ddraw->primary->palette)) if (g_ddraw->primary && (g_ddraw->primary->bpp == 16 || g_ddraw->primary->bpp == 32 || g_ddraw->primary->palette))
{ {
@ -894,11 +910,11 @@ int WINAPI fake_StretchDIBits(
return result; return result;
} }
} }
else if (g_ddraw->width > 0) else if (g_ddraw->width > 0 && g_ddraw->render.hdc)
{ {
return return
real_StretchDIBits( real_StretchDIBits(
hdc, g_ddraw->render.hdc,
xDest + g_ddraw->render.viewport.x, xDest + g_ddraw->render.viewport.x,
yDest + g_ddraw->render.viewport.y, yDest + g_ddraw->render.viewport.y,
(int)(DestWidth * g_ddraw->render.scale_w), (int)(DestWidth * g_ddraw->render.scale_w),