From 2b82661cf4065fb95c19b2dcdaf025bcd4ded547 Mon Sep 17 00:00:00 2001 From: waltje Date: Sat, 14 Oct 2017 00:49:08 -0400 Subject: [PATCH] More cleanups, and integgrated support for VNC (and RDP) remote renderers. --- src/Makefile.mingw | 28 ++++- src/config.c | 8 +- src/plat.h | 3 + src/win/86Box.rc | 6 + src/win/resource.h | 4 +- src/win/win.c | 246 +++++++++++++++++++++++++--------------- src/win/win.h | 4 +- src/win/win_about.c | 7 +- src/win/win_d3d.cc | 7 +- src/win/win_d3d.h | 4 +- src/win/win_d3d_fs.cc | 7 +- src/win/win_ddraw.cc | 12 +- src/win/win_ddraw.h | 2 + src/win/win_ddraw_fs.cc | 9 ++ src/win/win_settings.c | 8 +- 15 files changed, 245 insertions(+), 110 deletions(-) diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 4a3a5dd6f..2ca7cf2cb 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -8,7 +8,7 @@ # # Modified Makefile for Win32 (MinGW32) environment. # -# Version: @(#)Makefile.mingw 1.0.57 2017/10/11 +# Version: @(#)Makefile.mingw 1.0.58 2017/10/13 # # Authors: Miran Grca, # Fred N. van Kempen, @@ -59,6 +59,12 @@ endif ifndef USB USB := n endif +ifndef VNC +VNC := n +endif +ifndef RDP +RDP := n +endif ifndef DEV_BUILD DEV_BUILD := n endif @@ -194,6 +200,22 @@ MUNTOBJ := midi_mt32.o \ Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o endif +ifeq ($(VNC), y) +CFLAGS += -DUSE_VNC +RFLAGS += -DUSE_VNC +CFLAGS += -I$(VNC_PATH)\INCLUDE +VNCLIB := $(VNC_PATH)\LIB\libvncserver.a +VNCOBJ := win_vnc.o +endif + +ifeq ($(RDP), y) +CFLAGS += -DUSE_RDP +RFLAGS += -DUSE_RDP +CFLAGS += -I$(RDP_PATH)\INCLUDE +RDPLIB := $(RDP_PATH)\LIB\librdp.a +RDPOBJ := win_rdp.o +endif + # Options for the DEV branch. ifeq ($(DEV_BRANCH), y) CFLAGS += -DDEV_BRANCH @@ -356,6 +378,7 @@ VIDOBJ := video.o \ PLATOBJ := win.o \ win_ddraw.o win_ddraw_fs.o win_d3d.o win_d3d_fs.o \ + $(VNCOBJ) $(RDPOBJ) \ win_dynld.o win_thread.o $(WSERIAL) win_cdrom.o win_cdrom_ioctl.o \ win_keyboard.o win_mouse.o win_joystick.o win_midi.o \ win_dialog.o win_about.o win_status.o win_stbar.o \ @@ -376,6 +399,9 @@ LIBS := -mwindows \ -lopenal.dll \ -lddraw -ldinput8 -ldxguid -ld3d9 -ld3dx9 \ -lcomctl32 -lwinmm +ifeq ($(VNC), y) +LIBS += $(VNCLIB) -lws2_32 -lz -lpthread +endif LIBS += -lkernel32 -lwsock32 -liphlpapi -lpsapi LIBS += -static -lstdc++ -lgcc LIBS += -Wl,--large-address-aware diff --git a/src/config.c b/src/config.c index 8564f7832..2be964650 100644 --- a/src/config.c +++ b/src/config.c @@ -422,9 +422,11 @@ load_general(void) vid_api = 0; else if (! strcmp(temp, "d3d9")) vid_api = 1; +#ifdef USE_VNC else if (! strcmp(temp, "vnc")) vid_api = 2; -#if 0 +#endif +#ifdef USE_RDP else if (! strcmp(temp, "rdp")) vid_api = 3; #endif @@ -1181,11 +1183,13 @@ save_general(void) config_set_string(cat, "vid_renderer", "d3d9"); break; +#ifdef USE_VNC case 2: config_set_string(cat, "vid_renderer", "vnc"); break; +#endif -#if 0 +#ifdef USE_RDP case 3: config_set_string(cat, "vid_renderer", "rdp"); break; diff --git a/src/plat.h b/src/plat.h index 4b066ad6c..83b865a8e 100644 --- a/src/plat.h +++ b/src/plat.h @@ -36,7 +36,10 @@ extern void get_executable_name(wchar_t *s, int size); extern void set_window_title(wchar_t *s); extern int dir_check_exist(wchar_t *path); extern int dir_create(wchar_t *path); + extern void leave_fullscreen(void); +extern void plat_pause(int p); + /* Return the size (in wchar's) of a wchar_t array. */ #define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t)) diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 245c9d2e0..ba60ae9ff 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -64,6 +64,12 @@ BEGIN BEGIN MENUITEM "&DirectDraw", IDM_VID_DDRAW MENUITEM "Direct&3D 9", IDM_VID_D3D +#ifdef USE_VNC + MENUITEM "&VNC", IDM_VID_VNC +#endif +#ifdef USE_RDP + MENUITEM "&RDP", IDM_VID_RDP +#endif END MENUITEM SEPARATOR POPUP "&Window scale factor" diff --git a/src/win/resource.h b/src/win/resource.h index 9c616594d..e71fa3532 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -10,7 +10,7 @@ * * NOTE: FIXME: Strings 2176 and 2193 are same. * - * Version: @(#)resource.h 1.0.11 2017/10/07 + * Version: @(#)resource.h 1.0.12 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -424,6 +424,8 @@ #define IDM_VID_REMEMBER 40051 #define IDM_VID_DDRAW 40060 #define IDM_VID_D3D 40061 +#define IDM_VID_VNC 40062 +#define IDM_VID_RDP 40063 #define IDM_VID_SCALE_1X 40064 #define IDM_VID_SCALE_2X 40065 #define IDM_VID_SCALE_3X 40066 diff --git a/src/win/win.c b/src/win/win.c index fae60d2a9..8f3f4217a 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -8,7 +8,7 @@ * * The Emulator's Windows core. * - * Version: @(#)win.c 1.0.22 2017/10/12 + * Version: @(#)win.c 1.0.23 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -61,10 +61,8 @@ #include "win.h" #include "win_ddraw.h" #include "win_d3d.h" - - -#ifndef MAPVK_VK_TO_VSC -# define MAPVK_VK_TO_VSC 0 +#ifdef USE_VNC +# include "win_vnc.h" #endif @@ -79,29 +77,7 @@ typedef struct { extern int updatestatus; -int recv_key[272]; -HWND hwndMain; -HMENU menuMain; -HANDLE ghMutex; -HANDLE slirpMutex; -HINSTANCE hinstance; -HICON hIcon[512]; -RECT oldclip; -LCID dwLanguage; -uint32_t dwLangID, - dwSubLangID; -rc_str_t *lpRCstr2048; -rc_str_t *lpRCstr3072; -rc_str_t *lpRCstr4096; -rc_str_t *lpRCstr4352; -rc_str_t *lpRCstr4608; -rc_str_t *lpRCstr5120; -rc_str_t *lpRCstr5376; -rc_str_t *lpRCstr5632; -rc_str_t *lpRCstr6144; - - -int pause = 0; +/* Public data, more or less non-specific to platform. */ int scale = 0; uint64_t timer_freq; int winsizex = 640, @@ -113,39 +89,85 @@ int drawits = 0; int quited = 0; int mousecapture = 0; uint64_t main_time; + +/* Public data, specific to platform. */ +HWND hwndMain; +HMENU menuMain; +HANDLE ghMutex; +HANDLE slirpMutex; +HINSTANCE hinstance; +HICON hIcon[512]; +RECT oldclip; +LCID dwLanguage; +int recv_key[272]; +uint32_t dwLangID, + dwSubLangID; + char openfilestring[260]; WCHAR wopenfilestring[260]; -static RAWINPUTDEVICE device; -static HHOOK hKeyboardHook; -static int hook_enabled = 0; - +/* Local data. */ static HANDLE thMain; static HWND hwndRender; /* machine render window */ static wchar_t wTitle[512]; +static RAWINPUTDEVICE device; +static HHOOK hKeyboardHook; +static int hook_enabled = 0; static int save_window_pos = 0; static int win_doresize = 0; static int leave_fullscreen_flag = 0; static int unscaled_size_x = 0; static int unscaled_size_y = 0; +static int pause; static uint64_t start_time; static uint64_t end_time; static wchar_t **argv; static int argc; static wchar_t *argbuf; +static rc_str_t *lpRCstr2048, + *lpRCstr3072, + *lpRCstr4096, + *lpRCstr4352, + *lpRCstr4608, + *lpRCstr5120, + *lpRCstr5376, + *lpRCstr5632, + *lpRCstr6144; static struct { + int local; int (*init)(HWND h); void (*close)(void); void (*resize)(int x, int y); -} vid_apis[2][2] = { + int (*pause)(void); +} vid_apis[2][4] = { { - { ddraw_init, ddraw_close, NULL }, - { d3d_init, d3d_close, d3d_resize } + { 1, ddraw_init, ddraw_close, NULL, ddraw_pause }, + { 1, d3d_init, d3d_close, d3d_resize, d3d_pause }, +#ifdef USE_VNC + { 0, vnc_init, vnc_close, vnc_resize, vnc_pause }, +#else + { 0, NULL, NULL, NULL, NULL }, +#endif +#ifdef USE_RDP + { 0, rdp_init, rdp_close, rdp_resize, rdp_pause } +#else + { 0, NULL, NULL, NULL, NULL } +#endif }, { - { ddraw_fs_init, ddraw_fs_close, NULL }, - { d3d_fs_init, d3d_fs_close, NULL } + { 1, ddraw_fs_init, ddraw_fs_close, NULL, ddraw_fs_pause }, + { 1, d3d_fs_init, d3d_fs_close, NULL, d3d_fs_pause }, +#ifdef USE_VNC + { 0, vnc_init, vnc_close, vnc_resize, vnc_pause }, +#else + { 0, NULL, NULL, NULL, NULL }, +#endif +#ifdef USE_RDP + { 0, rdp_init, rdp_close, rdp_resize, rdp_pause } +#else + { 0, NULL, NULL, NULL, NULL } +#endif } }; @@ -189,7 +211,7 @@ releasemouse(void) static void win_pc_reset(int hard) { - pause = 1; + plat_pause(1); Sleep(100); @@ -202,7 +224,7 @@ win_pc_reset(int hard) else pc_send_cad(); - pause = 0; + plat_pause(vid_apis[video_fullscreen][vid_api].pause()); } @@ -257,7 +279,8 @@ MainThread(LPVOID param) } else Sleep(1); - if (!video_fullscreen && win_doresize && (winsizex>0) && (winsizey>0)) { + if (!video_fullscreen && vid_apis[0][vid_api].local && + win_doresize && (winsizex>0) && (winsizey>0)) { SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders); GetWindowRect(hwndMain, &r); MoveWindow(hwndRender, 0, 0, winsizex, winsizey, TRUE); @@ -327,6 +350,12 @@ ResetAllMenus(void) CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_DDRAW+0, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_DDRAW+1, MF_UNCHECKED); +#ifdef USE_VNC + CheckMenuItem(menuMain, IDM_VID_DDRAW+2, MF_UNCHECKED); +#endif +#ifdef USE_VNC + CheckMenuItem(menuMain, IDM_VID_DDRAW+3, MF_UNCHECKED); +#endif CheckMenuItem(menuMain, IDM_VID_FS_FULL+0, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FS_FULL+1, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FS_FULL+2, MF_UNCHECKED); @@ -377,14 +406,14 @@ ResetAllMenus(void) if (vid_resize) CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_CHECKED); - CheckMenuItem(menuMain, IDM_VID_DDRAW + vid_api, MF_CHECKED); - CheckMenuItem(menuMain, IDM_VID_FS_FULL + video_fullscreen_scale, MF_CHECKED); + CheckMenuItem(menuMain, IDM_VID_DDRAW+vid_api, MF_CHECKED); + CheckMenuItem(menuMain, IDM_VID_FS_FULL+video_fullscreen_scale, MF_CHECKED); CheckMenuItem(menuMain, IDM_VID_REMEMBER, window_remember?MF_CHECKED:MF_UNCHECKED); - CheckMenuItem(menuMain, IDM_VID_SCALE_1X + scale, MF_CHECKED); + CheckMenuItem(menuMain, IDM_VID_SCALE_1X+scale, MF_CHECKED); CheckMenuItem(menuMain, IDM_VID_CGACON, vid_cga_contrast?MF_CHECKED:MF_UNCHECKED); - CheckMenuItem(menuMain, IDM_VID_GRAYCT_601 + video_graytype, MF_CHECKED); - CheckMenuItem(menuMain, IDM_VID_GRAY_RGB + video_grayscale, MF_CHECKED); + CheckMenuItem(menuMain, IDM_VID_GRAYCT_601+video_graytype, MF_CHECKED); + CheckMenuItem(menuMain, IDM_VID_GRAY_RGB+video_grayscale, MF_CHECKED); } @@ -424,7 +453,6 @@ LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static wchar_t wOldTitle[512]; HMENU hmenu; RECT rect; int i = 0; @@ -462,14 +490,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_ACTION_PAUSE: - pause ^= 1; - if (pause) { - wcscpy(wOldTitle, wTitle); - wcscat(wTitle, L" - PAUSED -"); - - set_window_title(NULL); - } else - set_window_title(wOldTitle); + plat_pause(pause ^ 1); break; case IDM_CONFIG: @@ -523,11 +544,21 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_VID_DDRAW: case IDM_VID_D3D: +#ifdef USE_VNC + case IDM_VID_VNC: +#endif +#ifdef USE_RDP + case IDM_VID_RDP: +#endif startblit(); video_wait_for_blit(); CheckMenuItem(hmenu, IDM_VID_DDRAW+vid_api, MF_UNCHECKED); vid_apis[0][vid_api].close(); vid_api = LOWORD(wParam) - IDM_VID_DDRAW; + if (vid_apis[0][vid_api].local) + ShowWindow(hwndRender, SW_SHOW); + else + ShowWindow(hwndRender, SW_HIDE); CheckMenuItem(hmenu, IDM_VID_DDRAW+vid_api, MF_CHECKED); vid_apis[0][vid_api].init(hwndRender); endblit(); @@ -687,7 +718,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) #endif case IDM_CONFIG_LOAD: - pause = 1; + plat_pause(1); if (! file_dlg_st(hwnd, IDS_2160, "", 0)) { if (ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES) { config_write(config_file_default); @@ -747,15 +778,15 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) pc_reset_hard_init(); } } - pause = 0; + plat_pause(0); break; case IDM_CONFIG_SAVE: - pause = 1; + plat_pause(1); if (! file_dlg_st(hwnd, IDS_2160, "", 1)) { config_write(wopenfilestring); } - pause = 0; + plat_pause(0); break; } return(0); @@ -817,7 +848,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) MoveWindow(hwndSBAR, 0, winsizey + 6, winsizex, 17, TRUE); - if (hwndRender != NULL) { + if (vid_apis[0][vid_api].local && (hwndRender != NULL)) { MoveWindow(hwndRender, 0, 0, winsizex, winsizey, TRUE); if (vid_apis[video_fullscreen][vid_api].resize) { @@ -1138,17 +1169,14 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) /* Set the initial title for the program's main window. */ _swprintf(title, L"%s v%s", EMU_NAME_W, EMU_VERSION_W); + set_window_title(title); /* Now create our main window. */ hwnd = CreateWindowEx ( 0, /* no extended possibilites */ CLASS_NAME, /* class name */ title, /* Title Text */ -#if 0 - (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX), /* default window */ -#else (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX) | DS_3DLOOK, -#endif CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where window ends up on the screen */ 640+(GetSystemMetrics(SM_CXFIXEDFRAME)*2), /* width */ @@ -1211,10 +1239,14 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) ghMutex = CreateMutex(NULL, FALSE, L"86Box.BlitMutex"); /* Create the Machine Rendering window. */ - hwndRender = CreateWindow(L"STATIC", NULL, WS_VISIBLE|WS_CHILD|SS_BITMAP, + hwndRender = CreateWindow(L"STATIC", NULL, WS_CHILD|SS_BITMAP, 0, 0, 1, 1, hwnd, NULL, hInst, NULL); MoveWindow(hwndRender, 0, 0, winsizex, winsizey, TRUE); + /* If this is a local renderer, enable it. */ + if (vid_apis[0][vid_api].local) + ShowWindow(hwndRender, SW_SHOW); + /* Select the best system renderer available. */ if (! vid_apis[0][vid_api].init(hwndRender)) { vid_api ^= 1; @@ -1259,6 +1291,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nFunsterStil) /* Fire up the machine. */ pc_reset_hard(); + /* Set the PAUSE mode depending on the renderer. */ + plat_pause(0); + /* * Everything has been configured, and all seems to work, * so now it is time to start the main thread to do some @@ -1461,6 +1496,33 @@ win_language_check(void) } +void +plat_pause(int p) +{ + static wchar_t oldtitle[512]; + + /* If un-pausing, as the renderer if that's OK. */ + if (p == 0) + p = vid_apis[video_fullscreen][vid_api].pause(); + + /* If already so, done. */ + if (pause == p) return; + + if (p) { + wcscpy(oldtitle, wTitle); + wcscat(wTitle, L" - PAUSED -"); + set_window_title(NULL); + } else { + set_window_title(oldtitle); + } + + pause = p; + + /* Update the actual menu. */ + CheckMenuItem(menuMain, IDM_ACTION_PAUSE, (pause)?MF_CHECKED:MF_UNCHECKED); +} + + wchar_t * plat_get_string(int i) { @@ -1497,13 +1559,6 @@ plat_get_string_from_string(char *str) } - -/* If these are in the headers, doesn't work...? --FvK */ -//extern void ddraw_take_screenshot(wchar_t *); -//extern void ddraw_fs_take_screenshot(wchar_t *); -//extern void d3d_take_screenshot(wchar_t *); -//extern void d3d_fs_take_screenshot(wchar_t *); - void take_screenshot(void) { @@ -1531,23 +1586,36 @@ take_screenshot(void) wcscat(path, L"/"); #endif - if (vid_api == 1) { - wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info); - append_filename_w(path, cfg_path, fn, 1024); - if (video_fullscreen) - d3d_fs_take_screenshot(path); - else - d3d_take_screenshot(path); - } else if (vid_api == 0) { - wcsftime(path, 128, L"%Y%m%d_%H%M%S.bmp", info); - append_filename_w(path, cfg_path, fn, 1024); - if (video_fullscreen) - ddraw_fs_take_screenshot(path); - else - ddraw_take_screenshot(path); - } + switch(vid_api) { + case 0: /* ddraw */ + wcsftime(path, 128, L"%Y%m%d_%H%M%S.bmp", info); + append_filename_w(path, cfg_path, fn, 1024); + if (video_fullscreen) + ddraw_fs_take_screenshot(path); + else + ddraw_take_screenshot(path); + pclog("Screenshot: fn='%S'\n", path); + break; - pclog("Screenshot: fn='%S'\n", path); + case 1: /* d3d9 */ + wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info); + append_filename_w(path, cfg_path, fn, 1024); + if (video_fullscreen) + d3d_fs_take_screenshot(path); + else + d3d_take_screenshot(path); + pclog("Screenshot: fn='%S'\n", path); + break; + +#ifdef USE_VNC + case 2: /* vnc */ + wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info); + append_filename_w(path, cfg_path, fn, 1024); + vnc_take_screenshot(path); + pclog("Screenshot: fn='%S'\n", path); + break; +#endif + } } @@ -1592,8 +1660,8 @@ updatewindowsize(int x, int y) if (x < 160) x = 160; if (y < 100) y = 100; - if (x > 2048) x = 2048; - if (y > 2048) y = 2048; + if (x > 2048) x = 2048; + if (y > 2048) y = 2048; if (suppress_overscan) temp_overscan_x = temp_overscan_y = 0; diff --git a/src/win/win.h b/src/win/win.h index 0c337ba31..916087de9 100644 --- a/src/win/win.h +++ b/src/win/win.h @@ -10,7 +10,7 @@ * support modules for Windows. Generic definitions for UI and * platform go into ../plat*.h. * - * Version: @(#)win.h 1.0.4 2017/10/09 + * Version: @(#)win.h 1.0.5 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -45,7 +45,6 @@ #define SUB_CLASS_NAME L"86BoxSubWnd" #define SB_CLASS_NAME L"86BoxStatusBar" #define SB_MENU_NAME L"StatusBarMenu" -#define RENDER_NAME L"RenderWindow" /* Application-specific window messages. */ #define WM_RESETD3D WM_USER @@ -53,7 +52,6 @@ #define WM_SAVESETTINGS 0x8888 -extern int pause; extern int status_is_open; extern int mousecapture; extern LCID dwLanguage; diff --git a/src/win/win_about.c b/src/win/win_about.c index 18bcf6efa..c8b46d86a 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -8,7 +8,7 @@ * * Handle the About dialog. * - * Version: @(#)win_about.c 1.0.2 2017/10/09 + * Version: @(#)win_about.c 1.0.3 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -29,6 +29,7 @@ #include #include #include "../86box.h" +#include "../plat.h" #include "win.h" @@ -39,7 +40,7 @@ AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_INITDIALOG: - pause = 1; + plat_pause(1); h = GetDlgItem(hdlg, IDC_ABOUT_ICON); SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)LoadImage(hinstance,(PCTSTR)100,IMAGE_ICON,64,64,0)); @@ -49,7 +50,7 @@ AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) { case IDOK: EndDialog(hdlg, 0); - pause = 0; + plat_pause(0); return TRUE; default: diff --git a/src/win/win_d3d.cc b/src/win/win_d3d.cc index 93252c691..78ffb6fc9 100644 --- a/src/win/win_d3d.cc +++ b/src/win/win_d3d.cc @@ -8,7 +8,7 @@ * * Direct3D 9 rendererer and screenshots taking. * - * Version: @(#)win_d3d.cc 1.0.2 2017/10/10 + * Version: @(#)win_d3d.cc 1.0.3 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -233,6 +233,11 @@ void d3d_close() } } +int d3d_pause(void) +{ + return(0); +} + void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h) { HRESULT hr = D3D_OK; diff --git a/src/win/win_d3d.h b/src/win/win_d3d.h index a57c2bb80..2757d6902 100644 --- a/src/win/win_d3d.h +++ b/src/win/win_d3d.h @@ -8,7 +8,7 @@ * * Direct3D 9 rendererer and screenshots taking. * - * Version: @(#)win_d3d.h 1.0.1 2017/10/10 + * Version: @(#)win_d3d.h 1.0.2 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -32,12 +32,14 @@ extern "C" { extern int d3d_init(HWND h); extern void d3d_close(void); extern void d3d_reset(void); +extern int d3d_pause(void); extern void d3d_resize(int x, int y); extern void d3d_take_screenshot(wchar_t *fn); extern int d3d_fs_init(HWND h); extern void d3d_fs_close(void); extern void d3d_fs_reset(void); +extern int d3d_fs_pause(void); extern void d3d_fs_resize(int x, int y); extern void d3d_fs_take_screenshot(wchar_t *fn); diff --git a/src/win/win_d3d_fs.cc b/src/win/win_d3d_fs.cc index 71d7b3cc8..11612d75d 100644 --- a/src/win/win_d3d_fs.cc +++ b/src/win/win_d3d_fs.cc @@ -8,7 +8,7 @@ * * Direct3D 9 full-screen rendererer. * - * Version: @(#)win_d3d_fs.cc 1.0.4 2017/10/10 + * Version: @(#)win_d3d_fs.cc 1.0.5 2017/10/13 * * Authors: Sarah Walker, * Miran Grca, @@ -254,6 +254,11 @@ void d3d_fs_close() DestroyWindow(d3d_device_window); } +int d3d_fs_pause(void) +{ + return(0); +} + static void d3d_fs_size(RECT window_rect, double *l, double *t, double *r, double *b, int w, int h) { int ratio_w, ratio_h; diff --git a/src/win/win_ddraw.cc b/src/win/win_ddraw.cc index f1bada1e8..9c1cffb9d 100644 --- a/src/win/win_ddraw.cc +++ b/src/win/win_ddraw.cc @@ -20,6 +20,7 @@ extern "C" void pclog(const char *format, ...); extern "C" void device_force_redraw(void); extern "C" int ddraw_init(HWND h); +extern "C" int ddraw_pause(void); extern "C" void ddraw_close(void); extern "C" void ddraw_take_screenshot(wchar_t *fn); @@ -304,10 +305,6 @@ ddraw_blit_memtoscreen_8(int x, int y, int w, int h) int ddraw_init(HWND h) { -#if NO_THIS_CRASHES_NOW - cgapal_rebuild(); -#endif - if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL))) return(0); if (FAILED(lpdd->QueryInterface(IID_IDirectDraw7, (LPVOID *)&lpdd7))) @@ -403,6 +400,13 @@ ddraw_close(void) } +int +ddraw_pause(void) +{ + return(0); +} + + void ddraw_take_screenshot(wchar_t *fn) { diff --git a/src/win/win_ddraw.h b/src/win/win_ddraw.h index 921300739..fa47da60f 100644 --- a/src/win/win_ddraw.h +++ b/src/win/win_ddraw.h @@ -15,10 +15,12 @@ extern "C" { extern int ddraw_init(HWND h); extern void ddraw_close(void); +extern int ddraw_pause(void); extern void ddraw_take_screenshot(wchar_t *fn); extern int ddraw_fs_init(HWND h); extern void ddraw_fs_close(void); +extern int ddraw_fs_pause(void); extern void ddraw_fs_take_screenshot(wchar_t *fn); #ifdef __cplusplus diff --git a/src/win/win_ddraw_fs.cc b/src/win/win_ddraw_fs.cc index 777fa4f3a..31c7ca584 100644 --- a/src/win/win_ddraw_fs.cc +++ b/src/win/win_ddraw_fs.cc @@ -24,6 +24,7 @@ extern "C" void device_force_redraw(void); extern "C" int ddraw_fs_init(HWND h); extern "C" void ddraw_fs_close(void); +extern "C" int ddraw_fs_pause(void); extern "C" void ddraw_fs_take_screenshot(wchar_t *fn); extern void ddraw_common_take_screenshot(wchar_t *fn, IDirectDrawSurface7 *pDDSurface); @@ -320,6 +321,14 @@ static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h) lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC); } + +int +ddraw_fs_pause(void) +{ + return(0); +} + + void ddraw_fs_take_screenshot(wchar_t *fn) { ddraw_common_take_screenshot(fn, lpdds_back2); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 11dcaf072..3f73b2137 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Windows 86Box Settings dialog handler. * - * Version: @(#)win_settings.c 1.0.20 2017/10/10 + * Version: @(#)win_settings.c 1.0.21 2017/10/13 * * Author: Miran Grca, * @@ -4307,7 +4307,7 @@ static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wPar switch (message) { case WM_INITDIALOG: - pause = 1; + plat_pause(1); win_settings_init(); displayed_category = -1; h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); @@ -4362,7 +4362,7 @@ static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wPar /* pclog("Destroying window...\n"); */ DestroyWindow(hwndChildDialog); EndDialog(hdlg, 0); - pause = 0; + plat_pause(0); return TRUE; } else @@ -4372,7 +4372,7 @@ static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wPar case IDCANCEL: DestroyWindow(hwndChildDialog); EndDialog(hdlg, 0); - pause=0; + plat_pause(0); return TRUE; } break;