vidinfo->gfx_vresolution_reserved = VRES_DOUBLE;
graphics_reset(false);
}
- int newres = largest_res;
- if (htotal < 190)
- newres = largest_res + 1;
- if (newres < RES_HIRES)
+ int newres = RES_HIRES;
+ int hres = (2 * htotal) << largest_res;
+ if (hres > 1000) {
+ newres = RES_SUPERHIRES;
+ } else {
+ newres = RES_HIRES;
+ }
+ if (newres < RES_HIRES) {
newres = RES_HIRES;
- if (newres > RES_MAX)
+ }
+ if (newres > RES_MAX) {
newres = RES_MAX;
+ }
if (changed_prefs.gfx_resolution != newres) {
autoswitch_old_resolution = RES_HIRES;
write_log(_T("Programmed mode autores = %d -> %d (%d)\n"), changed_prefs.gfx_resolution, newres, largest_res);
float multadd = 1.0f / (1 << currprefs.gf[idx].gfx_filter_integerscalelimit);
if (cw2 > maxw || ch2 > maxh) {
- while (cw2 / mult - adjw > maxw || ch2 / mult - adjh > maxh)
+ while (cw2 / mult - adjw > maxw || ch2 / mult - adjh > maxh) {
mult += multadd;
- maxw = (int)(maxw * mult);
- maxh = (int)(maxh * mult);
+ }
+ float multx = mult, multy = mult;
+ maxw = (int)(maxw * multx);
+ maxh = (int)(maxh * multy);
} else {
- while (cw2 * (mult + multadd) - adjw <= maxw && ch2 * (mult + multadd) - adjh <= maxh)
+ while (cw2 * (mult + multadd) - adjw <= maxw && ch2 * (mult + multadd) - adjh <= maxh) {
mult += multadd;
- maxw = (int)((maxw + mult - multadd) / mult);
- maxh = (int)((maxh + mult - multadd) / mult);
+ }
+ float multx = mult, multy = mult;
+ // if width is smaller than height, double width (programmed modes)
+ if (cw2 * (mult + multadd) - adjw <= maxw && cw2 < ch2) {
+ multx += multadd;
+ }
+ maxw = (int)((maxw + multx - multadd) / multx);
+ maxh = (int)((maxh + multy - multadd) / multy);
}
*mode = 1;