From 0bbd0a09ec625e9b373b9c52339e6f333d7010c9 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 14 Oct 2014 14:54:41 +0000 Subject: [PATCH] Workaround 2 issues, when starting the keymapper with output=opengl,aspect=true on windows. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3871 --- src/gui/sdlmain.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 92ef1993..2fab4928 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -243,6 +243,23 @@ SDL_Surface* SDL_SetVideoMode_Wrap(int width,int height,int bpp,Bit32u flags){ return sdl.surface; } +#endif +#ifdef WIN32 + //SDL seems to crash if we are in OpenGL mode currently and change to exactly the same size without OpenGL. + //This happens when DOSBox is in textmode with aspect=true and output=opengl and the mapper is started. + //The easiest solution is to change the size. The mapper doesn't care. (PART PXX) + + //Also we have to switch back to windowed mode first, as else it may crash as well. + //Bug: we end up with a locked mouse cursor, but at least that beats crashing. (output=opengl,aspect=true,fullscreen=true) + if((i_flags&SDL_OPENGL) && !(flags&SDL_OPENGL) && (i_flags&SDL_FULLSCREEN) && !(flags&SDL_FULLSCREEN)){ + GFX_SwitchFullScreen(); + return SDL_SetVideoMode_Wrap(width,height,bpp,flags); + } + + //PXX + if ((i_flags&SDL_OPENGL) && !(flags&SDL_OPENGL) && height==i_height && width==i_width && height==480) { + height++; + } #endif SDL_Surface* s = SDL_SetVideoMode(width,height,bpp,flags); #if SETMODE_SAVES @@ -1944,7 +1961,7 @@ int main(int argc, char* argv[]) { sdl.inited = true; #ifndef DISABLE_JOYSTICK - //Initialise Joystick seperately. This way we can warn when it fails instead + //Initialise Joystick separately. This way we can warn when it fails instead //of exiting the application if( SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0 ) LOG_MSG("Failed to init joystick support"); #endif