From d64c481952e82d72c21ebc894de29472525f69cc Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 18 Nov 2017 16:39:01 +0100 Subject: [PATCH] Fixed taking screenshots with DirectDraw; Reenabled minimizing the window - it no longer crashes the emulator. --- src/pc.c | 15 +++++++++++++-- src/video/video.h | 3 +++ src/win/win.c | 4 ++-- src/win/win_ddraw.cc | 10 ++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/pc.c b/src/pc.c index ed4d88939..5a385e491 100644 --- a/src/pc.c +++ b/src/pc.c @@ -152,7 +152,19 @@ int64_t main_time; static int unscaled_size_x = SCREEN_RES_X, /* current unscaled size X */ - unscaled_size_y = SCREEN_RES_Y; /* current unscaled size Y */ + unscaled_size_y = SCREEN_RES_Y, /* current unscaled size Y */ + efscrnsz_y = SCREEN_RES_Y; + + +int get_actual_size_x(void) +{ + return unscaled_size_x; +} + +int get_actual_size_y(void) +{ + return efscrnsz_y; +} /* Log something to the logfile or stdout. */ @@ -210,7 +222,6 @@ set_screen_size(int x, int y) int temp_overscan_x = overscan_x; int temp_overscan_y = overscan_y; double dx, dy, dtx, dty; - int efscrnsz_y; /* Make sure we keep usable values. */ #if 0 diff --git a/src/video/video.h b/src/video/video.h index 165bc48ca..539194d5e 100644 --- a/src/video/video.h +++ b/src/video/video.h @@ -218,6 +218,9 @@ extern void video_update_timing(void); extern void loadfont(wchar_t *s, int format); +extern int get_actual_size_x(void); +extern int get_actual_size_y(void); + #ifdef ENABLE_VRAM_DUMP extern void svga_dump_vram(void); #endif diff --git a/src/win/win.c b/src/win/win.c index b501eeb77..a67cb0760 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -963,10 +963,10 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) /* Set up main window for resizing if configured. */ if (vid_resize) SetWindowLongPtr(hwnd, GWL_STYLE, - (WS_OVERLAPPEDWINDOW&~WS_MINIMIZEBOX)); + (WS_OVERLAPPEDWINDOW)); else SetWindowLongPtr(hwnd, GWL_STYLE, - (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX&~WS_MINIMIZEBOX)); + (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX)); /* Move to the last-saved position if needed. */ if (window_remember) diff --git a/src/win/win_ddraw.cc b/src/win/win_ddraw.cc index cef4de882..61f2d88e0 100644 --- a/src/win/win_ddraw.cc +++ b/src/win/win_ddraw.cc @@ -353,6 +353,7 @@ ddraw_blit(int x, int y, int y1, int y2, int w, int h) void ddraw_take_screenshot(wchar_t *fn) { +#if 0 xs = xsize; ys = ys2 = ysize; @@ -369,6 +370,15 @@ ddraw_take_screenshot(wchar_t *fn) else ys += overscan_y; } +#endif + + xs = get_actual_size_x(); + ys = ys2 = get_actual_size_y(); + + if (ysize <= 250) { + ys >>= 1; + ys2 >>= 1; + } CopySurface(lpdds_back2);