diff --git a/CHANGELOG b/CHANGELOG index c6887ea63..774b11847 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,16 @@ 0.83.10 - - dynamic_x86 now handles pagefaults non-recursively, - which allows to use dynamic core with Windows 9x/ME - without crashes. (koolkdev) + - The dynamic_x86 CPU core can now handle page faults + non-recursively, so you can now run the dynamic_x86 + core with Windows 9x/ME without crashes, although + this may slightly decrease the performance, and it + may be disabled by setting the config option "use + dynamic core with paging on" in [cpu] section to + "false". Also fixed incorrect behavior for handling + trap flags in the dynamic core and updated the MMX + code for improved performance. (koolkdev) + - Added support for Direct3D output on Windows SDL2 + builds just like Windows SDL1 builds to become the + default output in all Windows builds. (Wengier) - DOSBox-X now natively supports the pixel-perfect scaling! Set the option "output=openglpp" in [sdl] section of the config file to enable this output. @@ -11,10 +20,9 @@ with some code cleanups by Wengier. - Updated the Windows installer to add a page for new users to select a video system output - the - default output (Direct3D on SDL1 builds / standard - OpenGL on x86/x64 SDL2 builds), OpenGL output with - pixel-perfect scaling for improved image quality, - and the TrueType font (TTF) output. (Wengier) + default Direct3D output, OpenGL with pixel-perfect + scaling (openglpp) for improved image quality, and + the TrueType font (TTF) output. (Wengier) - You can now supply a ZIP/7Z file as a parameter to DOSBox-X directly so that it will be mounted as C: drive when DOSBox-X starts. (Wengier) @@ -103,8 +111,6 @@ - Fixed an issue that the DOSBox-X window size may be incorrect when restoring from a maximized window in the SDL2 builds. (Wengier) - - Fixed incorrect behavior for handling trap flags - in the dynamic core. (koolkdev) - Fixed that the menu option "Select OpenGL (GLSL) shader.." not working properly sometimes. (Wengier) - Fixed Ctrl+C not working in GNU ed. (Wengier) diff --git a/contrib/windows/installer/DOSBox-X-setup.iss b/contrib/windows/installer/DOSBox-X-setup.iss index 144e0d0cf..20ee2dfca 100644 --- a/contrib/windows/installer/DOSBox-X-setup.iss +++ b/contrib/windows/installer/DOSBox-X-setup.iss @@ -241,10 +241,10 @@ begin else PageBuild.Values[4] := True; CreateHelpButton(ScaleX(20), WizardForm.CancelButton.Top, WizardForm.CancelButton.Width, WizardForm.CancelButton.Height); - msg:='DOSBox-X supports different video output systems for different purposes.' #13#13 'By default it uses the Direct3D output on the SDL1 version and the standard OpenGL output on the SDL2 version. But you may want to select the OpenGL output with pixel-perfect scaling for improved image quality (not available if you had selected an ARM build). Also, if you use text-mode DOS applications you probably want to select the TrueType font (TTF) output to make the text screen look much better.' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf), or from DOSBox-X''s Video menu.'; + msg:='DOSBox-X supports different video output systems for different purposes.' #13#13 'By default it uses the Direct3D output, but you may want to select the OpenGL pixel-perfect scaling output for improved image quality (not available if you had selected an ARM build). Also, if you use text-mode DOS applications you probably want to select the TrueType font (TTF) output to make the text screen look much better.' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf), or from DOSBox-X''s Video menu.'; PageOutput:=CreateInputOptionPage(100, 'Video output for DOSBox-X', 'Specify the DOSBox-X video output system', msg, True, False); - PageOutput.Add('Default output (SDL1: Direct3D / SDL2: OpenGL)'); - PageOutput.Add('OpenGL perfect: pixel-perfect scaling mode'); + PageOutput.Add('Default output (Direct3D)'); + PageOutput.Add('OpenGL with pixel-perfect scaling'); PageOutput.Add('TrueType font output for text-mode applications'); PageOutput.Values[0] := True; msg:='You can specify a default DOS version for DOSBox-X to report to itself and DOS programs. This can sometimes change the feature sets of DOSBox-X. For example, selecting 7.10 as the reported DOS version will enable support for Windows-style long filenames (LFN) and FAT32 disk images (>2GB disk images) by default.' #13#13 'If you are not sure about which DOS version to report, you can also leave this unselected, then a preset DOS version will be reported (usually 5.00).' #13#13 'This setting can be later modified in the DOSBox-X''s configuration file (dosbox-x.conf).'; @@ -252,7 +252,7 @@ begin PageVer.Add('DOS version 3.30'); PageVer.Add('DOS version 5.00'); PageVer.Add('DOS version 6.22'); - PageVer.Add('DOS version 7.10'); + PageVer.Add('DOS version 7.10 (for LFN and FAT32 support)'); end; function NextButtonClick(CurPageID: Integer): Boolean; begin @@ -321,9 +321,9 @@ begin begin Wizardform.ReadyMemo.Lines.Add(''); Wizardform.ReadyMemo.Lines.Add('Video output for DOSBox-X:'); - msg:='Default output (SDL1: Direct3D / SDL2: OpenGL)'; + msg:='Default output (Direct3D)'; if (PageOutput.Values[1]) then - msg:='OpenGL perfect: pixel-perfect scaling mode'; + msg:='OpenGL with pixel-perfect scaling'; if (PageOutput.Values[2]) then msg:='TrueType font output for text-mode applications'; Wizardform.ReadyMemo.Lines.Add(' '+msg); diff --git a/contrib/windows/installer/readme.txt b/contrib/windows/installer/readme.txt index c4cf0e738..0719dcedf 100644 --- a/contrib/windows/installer/readme.txt +++ b/contrib/windows/installer/readme.txt @@ -16,7 +16,7 @@ At the beginning you have got a Z:\> instead of a C:\> at the DOSBox-X prompt. S To change to the drive mounted like above, type "C:". If everything went fine, DOSBox-X will display the prompt "C:\>". You do not have to manually mount drives after DOSBox-X starts. Click the "Main" menu, and select "Configuration tool". Then select the "AUTOEXEC.BAT" setting group, where you can change its contents. The commands present here are run when DOSBox-X starts, so you can use this section for the mounting and other purposes, such as launching a specific program you want to use, or a game you want to play. You can also quickly launch a DOS program or game in DOSBox-X by clicking "Quick launch program..." under "DOS" menu. -Hint: DOSBox-X supports different video output systems for different purposes. By default it uses the Direct3D output on the SDL1 version and the standard OpenGL output on the SDL2 version. But if you desire the pixel-perfect scaling feature for improved image quality you may want to select the openglpp output. Also, if you use text-mode DOS applications you probably want to select the TrueType font (TTF) output to make the text screen look much better. +Hint: DOSBox-X supports different video output systems for different purposes. By default it uses the Direct3D output, but if you desire the pixel-perfect scaling feature for improved image quality you may want to select the openglpp output ("OpenGL perfect"). Also, if you use text-mode DOS applications and/or the DOS shell a lot you probably want to select the TrueType font (TTF) output to make the text screen look much better. Further Information =================== diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 6b2c5dba6..c3f9588d6 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -317,10 +317,8 @@ static const char *def_menu_video_scaler[] = static const char *def_menu_video_output[] = { "output_surface", -#if !defined(C_SDL2) && !defined(HX_DOS) -# if (HAVE_D3D9_H) && defined(WIN32) +#if (HAVE_D3D9_H) && defined(WIN32) && !defined(HX_DOS) "output_direct3d", -# endif #endif #if defined(C_OPENGL) && !defined(HX_DOS) "output_opengl", diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 75d59ca6e..a0611707c 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -250,6 +250,9 @@ bool osx_detect_nstouchbar(void); void osx_init_touchbar(void); #endif +#if C_DIRECT3D +void d3d_init(void); +#endif bool TTF_using(void); void ShutDownMemHandles(Section * sec); void resetFontSize(), decreaseFontSize(); @@ -3710,9 +3713,10 @@ void change_output(int output) { OUTPUT_OPENGL_Select(GLPerfect); #endif break; - #if C_DIRECT3D +#if C_DIRECT3D case 6: OUTPUT_DIRECT3D_Select(); + d3d_init(); break; #endif case 7: @@ -3722,8 +3726,10 @@ void change_output(int output) { break; case 9: #if C_DIRECT3D - if (sdl.desktop.want_type == SCREEN_DIRECT3D) + if (sdl.desktop.want_type == SCREEN_DIRECT3D) { OUTPUT_DIRECT3D_Select(); + d3d_init(); + } #endif break; #if defined(USE_TTF) @@ -4081,7 +4087,6 @@ void GFX_RestoreMode(void) { GFX_ResetScreen(); } -#if !defined(C_SDL2) static bool GFX_GetSurfacePtrLock = false; unsigned char *GFX_GetSurfacePtr(size_t *pitch, unsigned int x, unsigned int y) { @@ -4113,7 +4118,6 @@ void GFX_ReleaseSurfacePtr(void) { GFX_GetSurfacePtrLock = false; } } -#endif bool GFX_StartUpdate(uint8_t* &pixels,Bitu &pitch) { @@ -5355,6 +5359,10 @@ static void GUI_StartUp() { GFX_LogSDLState(); GFX_Stop(); +#if C_DIRECT3D + if (sdl.desktop.want_type == SCREEN_DIRECT3D) + d3d_init(); +#endif #if defined(C_SDL2) SDL_SetWindowTitle(sdl.window,"DOSBox-X"); @@ -10136,31 +10144,68 @@ bool output_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menui if (!strcmp(what,"surface")) { if (sdl.desktop.want_type == SCREEN_SURFACE) return true; - change_output(0); + if (window_was_maximized&&!GFX_IsFullscreen()) { + change_output(5); +#if defined(WIN32) + ShowWindow(GetHWND(), SW_MAXIMIZE); +#endif + } else + change_output(0); RENDER_Reset(); } else if (!strcmp(what,"opengl")) { #if C_OPENGL if (sdl.desktop.want_type == SCREEN_OPENGL && sdl_opengl.kind == GLBilinear) return true; - change_output(3); + if (window_was_maximized&&!GFX_IsFullscreen()) { + change_output(3); +#if defined(WIN32) + ShowWindow(GetHWND(), SW_MAXIMIZE); +#endif + } else + change_output(3); #endif } else if (!strcmp(what,"openglnb")) { #if C_OPENGL if (sdl.desktop.want_type == SCREEN_OPENGL && sdl_opengl.kind == GLNearest) return true; - change_output(4); + if (window_was_maximized&&!GFX_IsFullscreen()) { + change_output(4); +#if defined(WIN32) + ShowWindow(GetHWND(), SW_MAXIMIZE); +#endif + } else + change_output(4); #endif } else if (!strcmp(what,"openglpp")) { #if C_OPENGL if (sdl.desktop.want_type == SCREEN_OPENGL && sdl_opengl.kind == GLPerfect) return true; - change_output(5); + if (window_was_maximized&&!GFX_IsFullscreen()) { + change_output(5); +#if defined(WIN32) + ShowWindow(GetHWND(), SW_MAXIMIZE); +#endif + } else + change_output(5); #endif } else if (!strcmp(what,"direct3d")) { #if C_DIRECT3D if (sdl.desktop.want_type == SCREEN_DIRECT3D) return true; - change_output(6); +#if C_OPENGL && defined(C_SDL2) + if (sdl.desktop.want_type == SCREEN_OPENGL) { + sdl.desktop.isperfect = false; + OUTPUT_SURFACE_Select(); + RENDER_Reset(); + } +#endif + if (window_was_maximized&&!GFX_IsFullscreen()) { + change_output(6); +#if defined(WIN32) + ShowWindow(GetHWND(), SW_MAXIMIZE); +#endif + } else + change_output(6); #endif } else if (!strcmp(what,"ttf")) { diff --git a/src/output/direct3d/direct3d.cpp b/src/output/direct3d/direct3d.cpp index 411828b5d..7988f4d76 100644 --- a/src/output/direct3d/direct3d.cpp +++ b/src/output/direct3d/direct3d.cpp @@ -123,7 +123,11 @@ HRESULT CDirect3D::InitializeDX(HWND wnd, bool triplebuf) thread_run = true; thread_command = D3D_IDLE; +#if defined(C_SDL2) + thread = SDL_CreateThread(EntryPoint, "Direct3D", this); +#else thread = SDL_CreateThread(EntryPoint, this); +#endif SDL_SemWait(thread_ack); #endif diff --git a/src/output/output_direct3d.cpp b/src/output/output_direct3d.cpp index 72c4fe37d..abaec2c64 100644 --- a/src/output/output_direct3d.cpp +++ b/src/output/output_direct3d.cpp @@ -13,7 +13,7 @@ using namespace std; CDirect3D* d3d = NULL; void ResolvePath(std::string& in); -static void d3d_init(void) +void d3d_init(void) { sdl.desktop.want_type = SCREEN_DIRECT3D; if (!sdl.using_windib) @@ -30,7 +30,11 @@ static void d3d_init(void) SDL_SysWMinfo wmi; SDL_VERSION(&wmi.version); - if (!SDL_GetWMInfo(&wmi)) +#if defined(C_SDL2) + if (!SDL_GetWindowWMInfo(sdl.window, &wmi)) +#else + if (!SDL_GetWMInfo(&wmi)) +#endif { LOG_MSG("SDL:Error retrieving window information"); LOG_MSG("Failed to get window info"); @@ -50,7 +54,11 @@ static void d3d_init(void) OUTPUT_SURFACE_Select(); return; } - else if (d3d->InitializeDX(wmi.child_window, sdl.desktop.doublebuf) != S_OK) +#if defined(C_SDL2) + else if (d3d->InitializeDX(wmi.info.win.window, sdl.desktop.doublebuf) != S_OK) +#else + else if (d3d->InitializeDX(wmi.child_window, sdl.desktop.doublebuf) != S_OK) +#endif { LOG_MSG("Unable to initialize DirectX"); OUTPUT_SURFACE_Select(); @@ -83,7 +91,6 @@ void OUTPUT_DIRECT3D_Select() { sdl.desktop.want_type = SCREEN_DIRECT3D; render.aspectOffload = true; - d3d_init(); #if defined(WIN32) && !defined(C_SDL2) SDL1_hax_inhibit_WM_PAINT = 1; @@ -232,18 +239,35 @@ Bitu OUTPUT_DIRECT3D_SetSize() // Create a dummy sdl surface // D3D will hang or crash when using fullscreen with ddraw surface, therefore we hack SDL to provide // a GDI window with an additional 0x40 flag. If this fails or stock SDL is used, use WINDIB output + void GFX_SetResizeable(bool enable); if (GCC_UNLIKELY(d3d->bpp16)) { +#if defined(C_SDL2) + GFX_SetResizeable(true); + sdl.window = GFX_SetSDLWindowMode(windowWidth, windowHeight, SCREEN_SURFACE); + if (sdl.window != NULL) sdl.surface = SDL_GetWindowSurface(sdl.window); + else sdl.surface = NULL; + sdl.desktop.pixelFormat = SDL_GetWindowPixelFormat(sdl.window); +#else sdl.surface = SDL_SetVideoMode(windowWidth, windowHeight, 16, sdl.desktop.fullscreen ? SDL_FULLSCREEN | 0x40 : SDL_RESIZABLE | 0x40); sdl.deferred_resize = false; sdl.must_redraw_all = true; +#endif retFlags = GFX_CAN_16 | GFX_SCALING; } else { +#if defined(C_SDL2) + GFX_SetResizeable(true); + sdl.window = GFX_SetSDLWindowMode(windowWidth, windowHeight, SCREEN_SURFACE); + if (sdl.window != NULL) sdl.surface = SDL_GetWindowSurface(sdl.window); + else sdl.surface = NULL; + sdl.desktop.pixelFormat = SDL_GetWindowPixelFormat(sdl.window); +#else sdl.surface = SDL_SetVideoMode(windowWidth, windowHeight, 0, sdl.desktop.fullscreen ? SDL_FULLSCREEN | 0x40 : SDL_RESIZABLE | 0x40); sdl.deferred_resize = false; sdl.must_redraw_all = true; +#endif retFlags = GFX_CAN_32 | GFX_SCALING; } diff --git a/vs2015/config.h b/vs2015/config.h index 1ff316e21..b40e06dde 100644 --- a/vs2015/config.h +++ b/vs2015/config.h @@ -49,16 +49,13 @@ #define C_SDL_NET 1 /* Define to 1 if you have the header file. */ -#if !defined(C_SDL2) #define HAVE_D3D9_H 1 -#endif -#if HAVE_D3D9_H /* Define to 1 if you want to add Direct3D output to the list of available outputs */ #define C_DIRECT3D 1 + /* Define to 1 to use Direct3D shaders, requires d3d9.h and libd3dx9 */ #define C_D3DSHADERS 1 -#endif /* MT32 (munt) emulation */ #define C_MT32 1