Skip to content

Commit

Permalink
#313 Add partial support for American Girls Dress Designer (Fullscree…
Browse files Browse the repository at this point in the history
…n only, no upscaling)
  • Loading branch information
FunkyFr3sh committed May 22, 2024
1 parent 504c2eb commit 0cf0533
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions inc/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void util_toggle_maximize();
void util_toggle_fullscreen();
BOOL util_unadjust_window_rect(LPRECT prc, DWORD dwStyle, BOOL fMenu, DWORD dwExStyle);
void util_set_window_rect(int x, int y, int width, int height, UINT flags);
BOOL CALLBACK util_enum_thread_wnd_proc(HWND hwnd, LPARAM lParam);
BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lParam);
BOOL util_detect_low_res_screen();

Expand Down
4 changes: 4 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ static void cfg_create_ini()
"guard_lines=300\n"
"minfps=-2\n"
"\n"
"; American Girls Dress Designer\n"
"[Dress Designer]\n"
"fake_mode=640x480x32\n"
"\n"
"; Age of Wonders 2\n"
"[AoW2]\n"
"resolutions=2\n"
Expand Down
17 changes: 14 additions & 3 deletions src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,12 +1166,23 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags)
{
dbg_dump_scl_flags(dwFlags);

if (hwnd == NULL)
if (!hwnd)
{
return DD_OK;
if (!g_ddraw.hwnd && g_config.fake_mode[0])
{
EnumThreadWindows(GetCurrentThreadId(), (WNDENUMPROC)util_enum_thread_wnd_proc, 0);
hwnd = g_ddraw.hwnd;

if (!hwnd)
return DD_OK;
}
else
{
return DD_OK;
}
}

if (g_ddraw.hwnd == NULL)
if (!g_ddraw.hwnd)
{
g_ddraw.hwnd = hwnd;
}
Expand Down
8 changes: 8 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,14 @@ void util_set_window_rect(int x, int y, int width, int height, UINT flags)
}
}

BOOL CALLBACK util_enum_thread_wnd_proc(HWND hwnd, LPARAM lParam)
{
if (!g_ddraw.hwnd)
g_ddraw.hwnd = hwnd;

return FALSE;
}

BOOL CALLBACK util_enum_child_proc(HWND hwnd, LPARAM lparam)
{
IDirectDrawSurfaceImpl* this = (IDirectDrawSurfaceImpl*)lparam;
Expand Down

0 comments on commit 0cf0533

Please sign in to comment.