From c1800bb42dc2e0fb450c4dfdc66d89faee043da0 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 16 Jan 2010 17:27:15 +0000 Subject: [PATCH] Sanity checks in the pixel ratio loading. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1258 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- readini.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/readini.c b/readini.c index 350053ad..b086c9b5 100644 --- a/readini.c +++ b/readini.c @@ -846,6 +846,36 @@ int Load_INI(T_Config * conf) if (!Load_INI_get_values (file, buffer,"Pixel_ratio",1,values)) { Pixel_ratio = values[0]; + switch(Pixel_ratio) { + case PIXEL_WIDE: + if(Video_mode[0].Width < 640) + Pixel_ratio = PIXEL_SIMPLE; + break; + case PIXEL_TALL: + if(Video_mode[0].Height < 400) + Pixel_ratio = PIXEL_SIMPLE; + break; + case PIXEL_DOUBLE: + if(Video_mode[0].Width < 640 || Video_mode[0].Height < 400) + Pixel_ratio = PIXEL_SIMPLE; + break; + case PIXEL_TRIPLE: + if(Video_mode[0].Width < 3*320 || Video_mode[0].Height < 3*200) + Pixel_ratio = PIXEL_SIMPLE; + break; + case PIXEL_WIDE2: + if(Video_mode[0].Width < 4*320 || Video_mode[0].Height < 2*200) + Pixel_ratio = PIXEL_SIMPLE; + break; + case PIXEL_TALL2: + if(Video_mode[0].Width < 2*320 || Video_mode[0].Height < 4*200) + Pixel_ratio = PIXEL_SIMPLE; + break; + case PIXEL_QUAD: + if(Video_mode[0].Width < 4*320 || Video_mode[0].Height < 4*200) + Pixel_ratio = PIXEL_SIMPLE; + break; + } } fclose(file);