diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index a740ef84d..e74892c0e 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -166,6 +166,10 @@ static INT32 windowedModes[MAXWINMODES][2] = { 320, 200}, // 1.60,1.00 }; +#define CUSTOMMODENUM 9999 +static INT32 custom_width = 0; +static INT32 custom_height = 0; + static void Impl_VideoSetupSDLBuffer(void); static void Impl_VideoSetupBuffer(void); static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); @@ -1512,6 +1516,16 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h) return i; } } + // did not find mode from list, make custom resolution if the values somewhat make sense + // opengl mode does not mind about max resolution defined in screen.h + // if not using opengl, check against the maximum as well + if ((w >= BASEVIDWIDTH && h >= BASEVIDHEIGHT) && + (rendermode == render_opengl || (w <= MAXVIDWIDTH && h <= MAXVIDHEIGHT))) + { + custom_width = w; + custom_height = h; + return CUSTOMMODENUM; + } return -1; #if 0 INT32 matchMode = -1, i; @@ -1625,6 +1639,13 @@ INT32 VID_SetMode(INT32 modeNum) vid.height = windowedModes[modeNum][1]; vid.modenum = modeNum; } + else if (modeNum == CUSTOMMODENUM && custom_width && custom_height) + { + // at this point these values are assumed to be okay + vid.width = custom_width; + vid.height = custom_height; + vid.modenum = modeNum; + } else { // just set the desktop resolution as a fallback