1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-25 01:57:47 +01:00

add test patches for Clue Finders 4th

This commit is contained in:
FunkyFr3sh 2024-05-26 09:08:38 +02:00
parent 10ec35d458
commit 5bbe1299d2
5 changed files with 44 additions and 8 deletions

View File

@ -9,6 +9,7 @@
#define WM_DISPLAYCHANGE_DDRAW WM_APP+116 #define WM_DISPLAYCHANGE_DDRAW WM_APP+116
#define WM_TOGGLE_FULLSCREEN WM_APP+117 #define WM_TOGGLE_FULLSCREEN WM_APP+117
#define WM_TOGGLE_MAXIMIZE WM_APP+118 #define WM_TOGGLE_MAXIMIZE WM_APP+118
#define WM_ACTIVATEAPP_DDRAW WM_APP+119
#define IDT_TIMER_LEAVE_BNET 541287654 #define IDT_TIMER_LEAVE_BNET 541287654

View File

@ -921,7 +921,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
real_SetWindowLongA( real_SetWindowLongA(
g_ddraw.hwnd, g_ddraw.hwnd,
GWL_STYLE, GWL_STYLE,
(real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW) & ~WS_MAXIMIZE); (real_GetWindowLongA(g_ddraw.hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW) & ~(WS_MAXIMIZE | WS_SYSMENU));
} }
LONG exstyle = real_GetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE); LONG exstyle = real_GetWindowLongA(g_ddraw.hwnd, GWL_EXSTYLE);
@ -1003,6 +1003,8 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
if (lock_mouse || (g_config.fullscreen && real_GetForegroundWindow() == g_ddraw.hwnd)) if (lock_mouse || (g_config.fullscreen && real_GetForegroundWindow() == g_ddraw.hwnd))
mouse_lock(); mouse_lock();
real_SendMessageA(g_ddraw.hwnd, WM_ACTIVATEAPP_DDRAW, 1, 0);
} }
else else
{ {

View File

@ -66,25 +66,45 @@ HRESULT ddc_IsClipListChanged(IDirectDrawClipperImpl* This, BOOL FAR* lpbChanged
HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags) HRESULT ddc_SetClipList(IDirectDrawClipperImpl* This, LPRGNDATA lpClipList, DWORD dwFlags)
{ {
/* Keep this commented out until we found a game that actually needs it
if (This->hwnd) if (This->hwnd)
return DDERR_CLIPPERISUSINGHWND; return DDERR_CLIPPERISUSINGHWND;
if (This->region) if (This->region)
DeleteObject(This->region); DeleteObject(This->region);
if (lpClipList) if (lpClipList && lpClipList->rdh.nCount >= 1)
{ {
This->region = ExtCreateRegion(NULL, 0, lpClipList); RECT* rc = (RECT*)lpClipList->Buffer;
This->region = CreateRectRgnIndirect(&rc[0]);
if (!This->region) if (!This->region)
return DDERR_INVALIDCLIPLIST; return DDERR_INVALIDCLIPLIST;
for (int i = 1; i < lpClipList->rdh.nCount; ++i)
{
HRGN region = CreateRectRgnIndirect(&rc[i]);
if (!region)
return DDERR_INVALIDCLIPLIST;
if (CombineRgn(This->region, region, This->region, RGN_OR) == ERROR)
{
DeleteObject(region);
DeleteObject(This->region);
This->region = NULL;
return DDERR_INVALIDCLIPLIST;
}
DeleteObject(region);
}
} }
else else
{ {
This->region = NULL; This->region = NULL;
} }
*/
return DD_OK; return DD_OK;
} }

View File

@ -86,12 +86,13 @@ HRESULT dds_Blt(
BOOL is_stretch_blt = src_w != dst_w || src_h != dst_h; BOOL is_stretch_blt = src_w != dst_w || src_h != dst_h;
/* Disable this for now (needs more testing)
if (This->clipper && !(dwFlags & DDBLT_NO_CLIP) && dst_w > 0 && dst_h > 0) if (This->clipper && !(dwFlags & DDBLT_NO_CLIP) && dst_w > 0 && dst_h > 0)
{ {
DWORD size = 0; DWORD size = 0;
if (SUCCEEDED(IDirectDrawClipper_GetClipList(This->clipper, &dst_rect, NULL, &size))) HRESULT result = IDirectDrawClipper_GetClipList(This->clipper, &dst_rect, NULL, &size);
if (SUCCEEDED(result))
{ {
RGNDATA* list = (RGNDATA*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); RGNDATA* list = (RGNDATA*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
@ -122,8 +123,15 @@ HRESULT dds_Blt(
return DD_OK; return DD_OK;
} }
} }
else if (result == DDERR_NOCLIPLIST)
{
return DDERR_NOCLIPLIST;
}
else
{
return DDERR_INVALIDCLIPLIST;
}
} }
*/
if (dst_rect.right < 0) if (dst_rect.right < 0)
dst_rect.right = 0; dst_rect.right = 0;

View File

@ -175,6 +175,11 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
uMsg = WM_DISPLAYCHANGE; uMsg = WM_DISPLAYCHANGE;
break; break;
} }
case WM_ACTIVATEAPP_DDRAW:
{
uMsg = WM_ACTIVATEAPP;
break;
}
case WM_D3D9DEVICELOST: case WM_D3D9DEVICELOST:
{ {
if (((!g_config.windowed && !g_config.nonexclusive) || !util_is_minimized(g_ddraw.hwnd)) && if (((!g_config.windowed && !g_config.nonexclusive) || !util_is_minimized(g_ddraw.hwnd)) &&