diff --git a/src/win/86Box.rc b/src/win/86Box.rc index d28c34767..a9dedccdd 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -8,7 +8,7 @@ * * Application resource script for Windows. * - * Version: @(#)86Box.rc 1.0.54 2019/11/19 + * Version: @(#)86Box.rc 1.0.55 2019/12/05 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -66,12 +66,11 @@ BEGIN MENUITEM SEPARATOR POPUP "Re&nderer" BEGIN - MENUITEM "&DirectDraw", IDM_VID_DDRAW + MENUITEM "&SDL (Software)", IDM_VID_SDL_SW + MENUITEM "&SDL (Hardware)", IDM_VID_SDL_HW #ifdef USE_D2D MENUITEM "Direct&2D 1.0", IDM_VID_D2D #endif - MENUITEM "Direct&3D 9", IDM_VID_D3D - MENUITEM "&SDL", IDM_VID_SDL #ifdef USE_VNC MENUITEM "&VNC", IDM_VID_VNC #endif diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index e37ba29a6..a44791823 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -8,7 +8,7 @@ # # Makefile for Win32 (MinGW32) environment. # -# Version: @(#)Makefile.mingw 1.0.138 2019/10/23 +# Version: @(#)Makefile.mingw 1.0.139 2019/12/05 # # Authors: Miran Grca, # Fred N. van Kempen, @@ -369,7 +369,7 @@ ifneq ($(WX), n) UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o else UIOBJ := win_ui.o win_stbar.o \ - win_ddraw.o win_d3d.o win_sdl.o \ + win_sdl.o \ win_dialog.o win_about.o \ win_settings.o win_devconf.o win_snd_gain.o \ win_new_floppy.o win_jsconf.o @@ -688,15 +688,8 @@ ifdef EXOBJ OBJ += $(EXOBJ) endif -LIBS := -mwindows \ - -lddraw -ldxguid -ld3d9 \ - -lcomctl32 - -ifeq ($(STATIC), y) -LIBS += -lopenal -lole32 -lwinmm -else -LIBS += -lwinmm -lopenal.dll -endif +LIBS := -mwindows -lcomctl32 \ + -lopenal -lole32 ifeq ($(D2D), y) LIBS += $(D2DLIB) @@ -710,8 +703,7 @@ endif ifneq ($(WX), n) LIBS += $(WX_LIBS) -lm endif -LIBS += -lpng -lz -lwsock32 -liphlpapi -ldinput8 -LIBS += -static -lstdc++ +LIBS += -lpng -lz -lwsock32 -liphlpapi -ldinput8 -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -lversion -lwinmm -static -lstdc++ ifneq ($(X64), y) LIBS += -Wl,--large-address-aware endif @@ -719,9 +711,7 @@ ifneq ($(DINPUT), y) LIBS += -lxinput endif -ifeq ($(STATIC), y) LIBS += -static -endif # Build module rules. ifeq ($(AUTODEP), y) diff --git a/src/win/Makefile_ndr.mingw b/src/win/Makefile_ndr.mingw index 466bf472f..71c19c605 100644 --- a/src/win/Makefile_ndr.mingw +++ b/src/win/Makefile_ndr.mingw @@ -8,7 +8,7 @@ # # Makefile for Win32 (MinGW32) environment. # -# Version: @(#)Makefile.mingw 1.0.138 2019/10/23 +# Version: @(#)Makefile.mingw 1.0.139 2019/12/05 # # Authors: Miran Grca, # Fred N. van Kempen, @@ -375,7 +375,7 @@ ifneq ($(WX), n) UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o else UIOBJ := win_ui.o win_stbar.o \ - win_ddraw.o win_d3d.o win_sdl.o \ + win_sdl.o \ win_dialog.o win_about.o \ win_settings.o win_devconf.o win_snd_gain.o \ win_new_floppy.o win_jsconf.o @@ -694,15 +694,8 @@ ifdef EXOBJ OBJ += $(EXOBJ) endif -LIBS := -mwindows \ - -lddraw -ldxguid -ld3d9 \ - -lcomctl32 - -ifeq ($(STATIC), y) -LIBS += -lopenal -lole32 -lwinmm -else -LIBS += -lwinmm -lopenal.dll -endif +LIBS := -mwindows -lcomctl32 \ + -lopenal -lole32 ifeq ($(D2D), y) LIBS += $(D2DLIB) @@ -716,8 +709,7 @@ endif ifneq ($(WX), n) LIBS += $(WX_LIBS) -lm endif -LIBS += -lpng -lz -lwsock32 -liphlpapi -ldinput8 -LIBS += -static -lstdc++ +LIBS += -lpng -lz -lwsock32 -liphlpapi -ldinput8 -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -lversion -lwinmm -static -lstdc++ ifneq ($(X64), y) LIBS += -Wl,--large-address-aware endif @@ -725,9 +717,7 @@ ifneq ($(DINPUT), y) LIBS += -lxinput endif -ifeq ($(STATIC), y) LIBS += -static -endif # Build module rules. ifeq ($(AUTODEP), y) diff --git a/src/win/resource.h b/src/win/resource.h index c2b58ed69..422771a19 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -8,16 +8,16 @@ * * Windows resource defines. * - * Version: @(#)resource.h 1.0.30 2019/01/19 + * Version: @(#)resource.h 1.0.31 2019/12/05 * * Authors: Sarah Walker, * Miran Grca, * Fred N. van Kempen, * David Hrdlička, * - * Copyright 2008-2018 Sarah Walker. - * Copyright 2016-2018 Miran Grca. - * Copyright 2018 David Hrdlička. + * Copyright 2008-2019 Sarah Walker. + * Copyright 2016-2019 Miran Grca. + * Copyright 2018,2019 David Hrdlička. */ #ifndef WIN_RESOURCE_H # define WIN_RESOURCE_H @@ -266,18 +266,17 @@ #define IDM_UPDATE_ICONS 40030 #define IDM_VID_RESIZE 40040 #define IDM_VID_REMEMBER 40041 -#define IDM_VID_DDRAW 40050 +#define IDM_VID_SDL_SW 40050 +#define IDM_VID_SDL_HW 40051 #ifdef USE_D2D -#define IDM_VID_D2D 40051 -#define IDM_VID_D3D 40052 -#define IDM_VID_SDL 40053 -#define IDM_VID_VNC 40054 -#else -#define IDM_VID_D3D 40051 -#define IDM_VID_SDL 40052 +#define IDM_VID_D2D 40052 #ifdef USE_VNC #define IDM_VID_VNC 40053 #endif +#else +#ifdef USE_VNC +#define IDM_VID_VNC 40052 +#endif #endif #define IDM_VID_SCALE_1X 40055 #define IDM_VID_SCALE_2X 40056 diff --git a/src/win/win.c b/src/win/win.c index f4481feed..2f421412b 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -8,7 +8,7 @@ * * Platform main support module for Windows. * - * Version: @(#)win.c 1.0.59 2019/11/02 + * Version: @(#)win.c 1.0.60 2019/12/05 * * Authors: Sarah Walker, * Miran Grca, @@ -43,9 +43,7 @@ #ifdef USE_VNC # include "../vnc.h" #endif -# include "win_ddraw.h" # include "win_d2d.h" -# include "win_d3d.h" # include "win_sdl.h" #include "win.h" @@ -87,25 +85,23 @@ static const struct { void (*enable)(int enable); } vid_apis[2][RENDERERS_NUM] = { { - { "DDraw", 1, (int(*)(void*))ddraw_init, ddraw_close, NULL, ddraw_pause, ddraw_enable }, + { "SDL_Software", 1, (int(*)(void*))sdl_inits, sdl_close, NULL, sdl_pause, sdl_enable }, + { "SDL_Hardware", 1, (int(*)(void*))sdl_inith, sdl_close, NULL, sdl_pause, sdl_enable } #ifdef USE_D2D - { "D2D", 1, (int(*)(void*))d2d_init, d2d_close, NULL, d2d_pause, d2d_enable }, + ,{ "D2D", 1, (int(*)(void*))d2d_init, d2d_close, NULL, d2d_pause, d2d_enable } #endif - { "D3D", 1, (int(*)(void*))d3d_init, d3d_close, d3d_resize, d3d_pause, d3d_enable }, - { "SDL", 1, (int(*)(void*))sdl_init, sdl_close, NULL, sdl_pause, sdl_enable } #ifdef USE_VNC - ,{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } + ,{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } #endif }, { - { "DDraw", 1, (int(*)(void*))ddraw_init_fs, ddraw_close, NULL, ddraw_pause, ddraw_enable }, + { "SDL_Software", 1, (int(*)(void*))sdl_inits_fs, sdl_close, sdl_resize, sdl_pause, sdl_enable }, + { "SDL_Hardware", 1, (int(*)(void*))sdl_inith_fs, sdl_close, sdl_resize, sdl_pause, sdl_enable } #ifdef USE_D2D - { "D2D", 1, (int(*)(void*))d2d_init_fs, d2d_close, NULL, d2d_pause, d2d_enable }, + ,{ "D2D", 1, (int(*)(void*))d2d_init_fs, d2d_close, NULL, d2d_pause, d2d_enable } #endif - { "D3D", 1, (int(*)(void*))d3d_init_fs, d3d_close, NULL, d3d_pause, d3d_enable }, - { "SDL", 1, (int(*)(void*))sdl_init_fs, sdl_close, sdl_resize, sdl_pause, sdl_enable } #ifdef USE_VNC - ,{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } + ,{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } #endif }, }; @@ -664,11 +660,11 @@ plat_vidapi(char *name) { int i; -#ifdef USE_D2D - if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(2); -#else + /* Default/System is SDL Hardware. */ if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(1); -#endif + + /* If DirectDraw or plain SDL was specified, return SDL Software. */ + if (!strcasecmp(name, "ddraw") || !strcasecmp(name, "sdl")) return(1); for (i = 0; i < RENDERERS_NUM; i++) { if (vid_apis[0][i].name && @@ -676,7 +672,7 @@ plat_vidapi(char *name) } /* Default value. */ - return(0); + return(1); } @@ -688,38 +684,29 @@ plat_vidapi_name(int api) switch(api) { case 0: - name = "ddraw"; + name = "sdl_software"; + break; + case 1: break; #ifdef USE_D2D - case 1: + case 2: name = "d2d"; break; - - case 2: - break; - - case 3: - name = "sdl"; - break; -#else - case 1: - break; - - case 2: - name = "sdl"; - break; #endif #ifdef USE_VNC #ifdef USE_D2D - case 4: -#else case 3: +#else + case 2: #endif name = "vnc"; break; #endif + default: + fatal("Unknown renderer: %i\n", api); + break; } return(name); diff --git a/src/win/win.h b/src/win/win.h index 05ce73978..c3717e72b 100644 --- a/src/win/win.h +++ b/src/win/win.h @@ -8,7 +8,7 @@ * * Platform support defintions for Win32. * - * Version: @(#)win.h 1.0.28 2019/11/02 + * Version: @(#)win.h 1.0.29 2019/12/05 * * Authors: Sarah Walker, * Miran Grca, @@ -49,8 +49,7 @@ and 0x8895 with WPARAM = followed by 0x8896 with WPARAM = 0. All shutdowns will send an 0x8897. */ -#define WM_RESETD3D WM_USER -#define WM_LEAVEFULLSCREEN WM_USER+1 +#define WM_LEAVEFULLSCREEN WM_USER #define WM_SAVESETTINGS 0x8888 #define WM_SHOWSETTINGS 0x8889 #define WM_PAUSE 0x8890 @@ -67,16 +66,16 @@ #ifdef USE_VNC #ifdef USE_D2D -#define RENDERERS_NUM 5 -#else -#define RENDERERS_NUM 4 -#endif -#else -#ifdef USE_D2D #define RENDERERS_NUM 4 #else #define RENDERERS_NUM 3 #endif +#else +#ifdef USE_D2D +#define RENDERERS_NUM 3 +#else +#define RENDERERS_NUM 2 +#endif #endif diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index 7a58fa2e6..c8147cdc7 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -12,7 +12,7 @@ * we will not use that, but, instead, use a new window which * coverrs the entire desktop. * - * Version: @(#)win_sdl.c 1.0.8 2019/10/22 + * Version: @(#)win_sdl.c 1.0.9 2019/12/05 * * Authors: Fred N. van Kempen, * Michael Dring, @@ -72,10 +72,10 @@ #include "win_sdl.h" -#define PATH_SDL_DLL "SDL2.dll" +#define RENDERER_FULL_SCREEN 1 +#define RENDERER_HARDWARE 2 -static void *sdl_handle = NULL; /* handle to libSDL2 DLL */ static SDL_Window *sdl_win = NULL; static SDL_Renderer *sdl_render = NULL; static SDL_Texture *sdl_tex = NULL; @@ -88,71 +88,6 @@ static volatile int sdl_enabled = 0; static SDL_mutex* sdl_mutex = NULL; -/* Pointers to the real functions. */ -static void (*sdl_GetVersion)(SDL_version *ver); -static char *const (*sdl_GetError)(void); -static int (*sdl_Init)(Uint32 flags); -static void (*sdl_Quit)(void); -static SDL_Window *(*sdl_CreateWindowFrom)(const void *data); -static void (*sdl_DestroyWindow)(SDL_Window *window); -static SDL_Renderer *(*sdl_CreateRenderer)(SDL_Window *window, - int index, Uint32 flags); -static void (*sdl_DestroyRenderer)(SDL_Renderer *renderer); -static SDL_Texture *(*sdl_CreateTexture)(SDL_Renderer *renderer, - Uint32 format, int access, - int w, int h); -static void (*sdl_DestroyTexture)(SDL_Texture *texture); -static int (*sdl_LockTexture)(SDL_Texture *texture, - const SDL_Rect *rect, - void **pixels, int *pitch); -static void (*sdl_UnlockTexture)(SDL_Texture *texture); -static int (*sdl_RenderCopy)(SDL_Renderer *renderer, - SDL_Texture *texture, - const SDL_Rect *srcrect, - const SDL_Rect *dstrect); -static void (*sdl_RenderPresent)(SDL_Renderer *renderer); -static void (*sdl_GetWindowSize)(SDL_Window* window, - int* w, - int* h); -static int (*sdl_RenderReadPixels)(SDL_Renderer* renderer, - const SDL_Rect* rect, - Uint32 format, - void* pixels, - int pitch); -static SDL_bool (*sdl_SetHint)(const char* name, - const char* value); -static SDL_mutex* (*sdl_CreateMutex)(void); -static void (*sdl_DestroyMutex)(SDL_mutex* mutex); -static int (*sdl_LockMutex)(SDL_mutex* mutex); -static int (*sdl_UnlockMutex)(SDL_mutex* mutex); - - -static dllimp_t sdl_imports[] = { - { "SDL_GetVersion", &sdl_GetVersion }, - { "SDL_GetError", &sdl_GetError }, - { "SDL_Init", &sdl_Init }, - { "SDL_Quit", &sdl_Quit }, - { "SDL_CreateWindowFrom", &sdl_CreateWindowFrom }, - { "SDL_DestroyWindow", &sdl_DestroyWindow }, - { "SDL_CreateRenderer", &sdl_CreateRenderer }, - { "SDL_DestroyRenderer", &sdl_DestroyRenderer }, - { "SDL_CreateTexture", &sdl_CreateTexture }, - { "SDL_DestroyTexture", &sdl_DestroyTexture }, - { "SDL_LockTexture", &sdl_LockTexture }, - { "SDL_UnlockTexture", &sdl_UnlockTexture }, - { "SDL_RenderCopy", &sdl_RenderCopy }, - { "SDL_RenderPresent", &sdl_RenderPresent }, - { "SDL_GetWindowSize", &sdl_GetWindowSize }, - { "SDL_RenderReadPixels", &sdl_RenderReadPixels }, - { "SDL_SetHint", &sdl_SetHint }, - { "SDL_CreateMutex", &sdl_CreateMutex }, - { "SDL_DestroyMutex", &sdl_DestroyMutex }, - { "SDL_LockMutex", &sdl_LockMutex }, - { "SDL_UnlockMutex", &sdl_UnlockMutex }, - { NULL, NULL } -}; - - #ifdef ENABLE_SDL_LOG int sdl_do_log = ENABLE_SDL_LOG; @@ -257,14 +192,14 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h) return; } - sdl_LockMutex(sdl_mutex); + SDL_LockMutex(sdl_mutex); /* * TODO: * SDL_UpdateTexture() might be better here, as it is * (reportedly) slightly faster. */ - sdl_LockTexture(sdl_tex, 0, &pixeldata, &pitch); + SDL_LockTexture(sdl_tex, 0, &pixeldata, &pitch); for (yy = y1; yy < y2; yy++) { if ((y + yy) >= 0 && (y + yy) < buffer32->h) { @@ -277,7 +212,7 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h) video_blit_complete(); - sdl_UnlockTexture(sdl_tex); + SDL_UnlockTexture(sdl_tex); if (sdl_fs) { sdl_log("sdl_blit(%i, %i, %i, %i, %i, %i) (%i, %i)\n", x, y, y1, y2, w, h, unscaled_size_x, efscrnsz_y); @@ -291,13 +226,13 @@ sdl_blit(int x, int y, int y1, int y2, int w, int h) r_src.w = w; r_src.h = h; - ret = sdl_RenderCopy(sdl_render, sdl_tex, &r_src, 0); + ret = SDL_RenderCopy(sdl_render, sdl_tex, &r_src, 0); if (ret) sdl_log("SDL: unable to copy texture to renderer (%s)\n", sdl_GetError()); - sdl_RenderPresent(sdl_render); + SDL_RenderPresent(sdl_render); - sdl_UnlockMutex(sdl_mutex); + SDL_UnlockMutex(sdl_mutex); } @@ -311,22 +246,22 @@ sdl_close(void) sdl_enabled = 0; if (sdl_mutex != NULL) { - sdl_DestroyMutex(sdl_mutex); + SDL_DestroyMutex(sdl_mutex); sdl_mutex = NULL; } if (sdl_tex != NULL) { - sdl_DestroyTexture(sdl_tex); + SDL_DestroyTexture(sdl_tex); sdl_tex = NULL; } if (sdl_render != NULL) { - sdl_DestroyRenderer(sdl_render); + SDL_DestroyRenderer(sdl_render); sdl_render = NULL; } if (sdl_win != NULL) { - sdl_DestroyWindow(sdl_win); + SDL_DestroyWindow(sdl_win); sdl_win = NULL; } @@ -347,13 +282,8 @@ sdl_close(void) sdl_parent_hwnd = NULL; } - /* Quit and unload the DLL if possible. */ - if (sdl_handle != NULL) { - sdl_Quit(); - - dynld_close(sdl_handle); - sdl_handle = NULL; - } + /* Quit. */ + SDL_Quit(); } @@ -361,7 +291,7 @@ static int old_capture = 0; static int -sdl_init_common(int fs) +sdl_init_common(int flags) { wchar_t temp[128]; SDL_version ver; @@ -370,24 +300,21 @@ sdl_init_common(int fs) sdl_log("SDL: init (fs=%d)\n", fs); - /* Try loading the DLL. */ - sdl_handle = dynld_module(PATH_SDL_DLL, sdl_imports); - if (sdl_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2120); - return(0); - } - /* Get and log the version of the DLL we are using. */ - sdl_GetVersion(&ver); + SDL_GetVersion(&ver); sdl_log("SDL: version %d.%d.%d\n", ver.major, ver.minor, ver.patch); /* Initialize the SDL system. */ - if (sdl_Init(SDL_INIT_VIDEO) < 0) { + if (SDL_Init(SDL_INIT_VIDEO) < 0) { sdl_log("SDL: initialization failed (%s)\n", sdl_GetError()); return(0); } - if (fs) { + if (flags & RENDERER_HARDWARE) + SDL_SetHint(SDL_HINT_RENDER_DRIVER, "direct3d"); + /* TODO: why is this necessary to avoid black screen on Win7/8/10? */ + + if (flags & RENDERER_FULL_SCREEN) { /* Get the size of the (current) desktop. */ sdl_w = GetSystemMetrics(SM_CXSCREEN); sdl_h = GetSystemMetrics(SM_CYSCREEN); @@ -431,7 +358,7 @@ sdl_init_common(int fs) x, y, w, h, SWP_SHOWWINDOW); /* Now create the SDL window from that. */ - sdl_win = sdl_CreateWindowFrom((void *)sdl_hwnd); + sdl_win = SDL_CreateWindowFrom((void *)sdl_hwnd); old_capture = mouse_capture; @@ -442,7 +369,7 @@ sdl_init_common(int fs) mouse_capture = 1; } else { /* Create the SDL window from the render window. */ - sdl_win = sdl_CreateWindowFrom((void *)hwndRender); + sdl_win = SDL_CreateWindowFrom((void *)hwndRender); mouse_capture = old_capture; @@ -453,7 +380,7 @@ sdl_init_common(int fs) } } if (sdl_win == NULL) { - sdl_log("SDL: unable to CreateWindowFrom (%s)\n", sdl_GetError()); + sdl_log("SDL: unable to CreateWindowFrom (%s)\n", SDL_GetError()); sdl_close(); return(0); } @@ -465,9 +392,14 @@ sdl_init_common(int fs) * trying to switch to fullscreen even though the window is * not a fullscreen window?) */ - sdl_render = sdl_CreateRenderer(sdl_win, -1, SDL_RENDERER_SOFTWARE); + if (flags & RENDERER_HARDWARE) { + sdl_render = SDL_CreateRenderer(sdl_win, -1, SDL_RENDERER_ACCELERATED); + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); + } else + sdl_render = SDL_CreateRenderer(sdl_win, -1, SDL_RENDERER_SOFTWARE); + if (sdl_render == NULL) { - sdl_log("SDL: unable to create renderer (%s)\n", sdl_GetError()); + sdl_log("SDL: unable to create renderer (%s)\n", SDL_GetError()); sdl_close(); return(0); } @@ -478,10 +410,10 @@ sdl_init_common(int fs) * channel seems to be set to 255 everywhere, so ARGB8888 works * just as well. */ - sdl_tex = sdl_CreateTexture(sdl_render, SDL_PIXELFORMAT_ARGB8888, + sdl_tex = SDL_CreateTexture(sdl_render, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 2048, 2048); if (sdl_tex == NULL) { - sdl_log("SDL: unable to create texture (%s)\n", sdl_GetError()); + sdl_log("SDL: unable to create texture (%s)\n", SDL_GetError()); sdl_close(); return(0); } @@ -492,27 +424,41 @@ sdl_init_common(int fs) /* Register our renderer! */ video_setblit(sdl_blit); - sdl_fs = fs; + sdl_fs = !!(flags & RENDERER_FULL_SCREEN); sdl_enabled = 1; - sdl_mutex = sdl_CreateMutex(); + sdl_mutex = SDL_CreateMutex(); return(1); } int -sdl_init(HWND h) +sdl_inits(HWND h) { return sdl_init_common(0); } int -sdl_init_fs(HWND h) +sdl_inith(HWND h) { - return sdl_init_common(1); + return sdl_init_common(RENDERER_HARDWARE); +} + + +int +sdl_inits_fs(HWND h) +{ + return sdl_init_common(RENDERER_FULL_SCREEN); +} + + +int +sdl_inith_fs(HWND h) +{ + return sdl_init_common(RENDERER_FULL_SCREEN | RENDERER_HARDWARE); } @@ -533,10 +479,11 @@ sdl_resize(int x, int y) ww = x; wh = y; - sdl_stretch(&ww, &wh, &wx, &wy); - if (sdl_fs) + if (sdl_fs) { + sdl_stretch(&ww, &wh, &wx, &wy); MoveWindow(sdl_hwnd, wx, wy, ww, wh, TRUE); + } cur_w = x; cur_h = y; diff --git a/src/win/win_sdl.h b/src/win/win_sdl.h index 9a0645455..896b3b8ef 100644 --- a/src/win/win_sdl.h +++ b/src/win/win_sdl.h @@ -8,7 +8,7 @@ * * Definitions for the libSDL2 rendering module. * - * Version: @(#)win_sdl.h 1.0.1 2019/10/12 + * Version: @(#)win_sdl.h 1.0.2 2019/12/05 * * Authors: Fred N. van Kempen, * Michael Dring, @@ -51,8 +51,10 @@ extern void sdl_close(void); -extern int sdl_init(HWND h); -extern int sdl_init_fs(HWND h); +extern int sdl_inits(HWND h); +extern int sdl_inith(HWND h); +extern int sdl_inits_fs(HWND h); +extern int sdl_inith_fs(HWND h); extern int sdl_pause(void); extern void sdl_resize(int x, int y); extern void sdl_enable(int enable); diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 312a76826..1f9eedcb8 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -8,7 +8,7 @@ * * user Interface module for WinAPI on Windows. * - * Version: @(#)win_ui.c 1.0.44 2019/11/02 + * Version: @(#)win_ui.c 1.0.45 2019/12/05 * * Authors: Sarah Walker, * Miran Grca, @@ -39,7 +39,6 @@ #include "../plat_midi.h" #include "../ui.h" #include "win.h" -#include "win_d3d.h" #define TIMER_1SEC 1 /* ID of the one-second timer */ @@ -156,20 +155,13 @@ ResetAllMenus(void) CheckMenuItem(menuMain, IDM_VID_INVERT, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_UNCHECKED); - CheckMenuItem(menuMain, IDM_VID_DDRAW+0, MF_UNCHECKED); + CheckMenuItem(menuMain, IDM_VID_SDL_SW, MF_UNCHECKED); + CheckMenuItem(menuMain, IDM_VID_SDL_HW, MF_UNCHECKED); #ifdef USE_D2D - CheckMenuItem(menuMain, IDM_VID_DDRAW+1, MF_UNCHECKED); - CheckMenuItem(menuMain, IDM_VID_DDRAW+2, MF_UNCHECKED); - CheckMenuItem(menuMain, IDM_VID_DDRAW+3, MF_UNCHECKED); -#ifdef USE_VNC - CheckMenuItem(menuMain, IDM_VID_DDRAW+4, MF_UNCHECKED); + CheckMenuItem(menuMain, IDM_VID_D2D, MF_UNCHECKED); #endif -#else - CheckMenuItem(menuMain, IDM_VID_DDRAW+1, MF_UNCHECKED); - CheckMenuItem(menuMain, IDM_VID_DDRAW+2, MF_UNCHECKED); #ifdef USE_VNC - CheckMenuItem(menuMain, IDM_VID_DDRAW+3, MF_UNCHECKED); -#endif + CheckMenuItem(menuMain, IDM_VID_VNC, MF_UNCHECKED); #endif CheckMenuItem(menuMain, IDM_VID_FS_FULL+0, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FS_FULL+1, MF_UNCHECKED); @@ -226,7 +218,7 @@ 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_SDL_SW+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); @@ -440,18 +432,17 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) config_save(); break; - case IDM_VID_DDRAW: + case IDM_VID_SDL_SW: + case IDM_VID_SDL_HW: #ifdef USE_D2D case IDM_VID_D2D: #endif - case IDM_VID_D3D: - case IDM_VID_SDL: #ifdef USE_VNC case IDM_VID_VNC: #endif - CheckMenuItem(hmenu, IDM_VID_DDRAW+vid_api, MF_UNCHECKED); - plat_setvid(LOWORD(wParam) - IDM_VID_DDRAW); - CheckMenuItem(hmenu, IDM_VID_DDRAW+vid_api, MF_CHECKED); + CheckMenuItem(hmenu, IDM_VID_SDL_SW + vid_api, MF_UNCHECKED); + plat_setvid(LOWORD(wParam) - IDM_VID_SDL_SW); + CheckMenuItem(hmenu, IDM_VID_SDL_SW + vid_api, MF_CHECKED); config_save(); break; @@ -673,15 +664,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) ui_sb_timer_callback(wParam & 0xff); break; - case WM_RESETD3D: - startblit(); - if (video_fullscreen) - d3d_reset_fs(); - else - d3d_reset(); - endblit(); - break; - case WM_LEAVEFULLSCREEN: plat_setfullscreen(0); config_save();