From 5cde84e58a07c490ae38e412539193cc6907d6a1 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 27 Aug 2017 10:20:41 +0000 Subject: [PATCH] Ignore video modes with resolutions less than 640x480 or with aspect ratios taller than around 4:3 when populating the mode lists used in the startup window and menus. Sorry to the two guys still using nasty 5:4 1280x1024 monitors in 2017; you'll have to set your resolution using the console now. git-svn-id: https://svn.eduke32.com/eduke32@6435 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/build.h | 15 ++++++++++++--- source/build/include/sdlayer.h | 2 +- source/build/src/sdlayer.cpp | 3 ++- source/build/src/sdlayer12.cpp | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 88981c05c..c46b1c145 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -40,13 +40,15 @@ enum rendmode_t { #define MAXWALLSV7 8192 #define MAXSPRITESV7 4096 -#ifndef GEKKO +#if !defined GEKKO && !defined __OPENDINGUX__ # define MAXSECTORS MAXSECTORSV8 # define MAXWALLS MAXWALLSV8 # define MAXSPRITES MAXSPRITESV8 # define MAXXDIM 7680 # define MAXYDIM 3200 +# define MINXDIM 640 +# define MINYDIM 480 // additional space beyond wall, in walltypes: # define M32_FIXME_WALLS 512 @@ -56,9 +58,16 @@ enum rendmode_t { # define MAXWALLS MAXWALLSV7 # define MAXSPRITES MAXSPRITESV7 -# define MAXXDIM 860 -# define MAXYDIM 490 +#ifdef GEKKO +# define MAXXDIM 860 +# define MAXYDIM 490 +# else +# define MAXXDIM 320 +# define MAXYDIM 200 +# endif +# define MINXDIM MAXXDIM +# define MINYDIM MAXYDIM # define M32_FIXME_WALLS 0 # define M32_FIXME_SECTORS 0 #endif diff --git a/source/build/include/sdlayer.h b/source/build/include/sdlayer.h index 6954dc8ae..c6545428c 100644 --- a/source/build/include/sdlayer.h +++ b/source/build/include/sdlayer.h @@ -58,7 +58,7 @@ int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout); } \ } while (0) -#define SDL_CHECKMODE(w, h) ((w < maxx) && (h < maxy)) +#define SDL_CHECKMODE(w, h) ((w < MAXXDIM) && (h < MAXYDIM) && (w >= MINXDIM) && (h >= MINYDIM) && (((float)w/(float)h) >= 1.3f)) #define SDL_CHECKFSMODES(w, h) \ if (w == 0 && h == 0) \ diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 398b5e921..bbe10a2b4 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -1160,7 +1160,8 @@ void getvalidmodes(void) for (i = 0; i < SDL_GetNumDisplayModes(0); i++) { SDL_GetDisplayMode(0, i, &dispmode); - if ((dispmode.w > MAXXDIM) || (dispmode.h > MAXYDIM) || + + if (!SDL_CHECKMODE(dispmode.w, dispmode.h) || (maxrefreshfreq && (dispmode.refresh_rate > maxrefreshfreq))) continue; diff --git a/source/build/src/sdlayer12.cpp b/source/build/src/sdlayer12.cpp index 3c501436b..311eb9922 100644 --- a/source/build/src/sdlayer12.cpp +++ b/source/build/src/sdlayer12.cpp @@ -267,7 +267,7 @@ void getvalidmodes(void) { for (i = 0; modes[i]; i++) { - if ((modes[i]->w > MAXXDIM) || (modes[i]->h > MAXYDIM)) + if (!SDL_CHECKMODE(modes[i]->w, modes[i]->h > MAXYDIM)) continue; SDL_ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1);