float hmult, vmult;
bool half;
bool rtg;
+ int scalemode = p->gf[0].gfx_filter_autoscale;
hres = p->gfx_resolution;
vres = p->gfx_vresolution;
if (p->gf[0].gfx_filter_scanlines || p->gfx_pscanlines)
m |= RP_SCREENMODE_SCANLINES;
- if (p->gfx_xcenter_pos == 0 && p->gfx_ycenter_pos == 0)
- cf |= RP_CLIPFLAGS_NOCLIP;
- else if (p->gf[0].gfx_filter_autoscale == AUTOSCALE_RESIZE || p->gf[0].gfx_filter_autoscale == AUTOSCALE_NORMAL)
+ if (scalemode == AUTOSCALE_RESIZE || scalemode == AUTOSCALE_NORMAL || scalemode == AUTOSCALE_INTEGER_AUTOSCALE)
cf |= RP_CLIPFLAGS_AUTOCLIP;
+ else if (p->gfx_xcenter_pos == 0 && p->gfx_ycenter_pos == 0)
+ cf |= RP_CLIPFLAGS_NOCLIP;
}
if (full) {
if (p->gf[rtg].gfx_filter_bilinear) {
m |= RP_SCREENMODE_INTERPOLATION;
}
+ if (!rtg && p->gfx_ntscpixels) {
+ m |= RP_SCREENMODE_PIXEL_ORIGINAL_RATIO;
+ }
sm->dwScreenMode = m | (storeflags & (RP_SCREENMODE_SCALING_STRETCH | RP_SCREENMODE_SCALING_SUBPIXEL));
sm->lTargetHeight = 0;
p->gf[0].gfx_filter_right_border = 0;
p->gf[0].gfx_filter_bottom_border = 0;
p->gf[0].gfx_filter_autoscale = AUTOSCALE_CENTER;
+ p->gfx_ntscpixels = false;
+
disp = getdisplay(p, 0);
if (log_rp & 2) {
if (keepaspect) {
p->gf[0].gfx_filter_aspect = -1;
- p->gf[0].gfx_filter_keep_autoscale_aspect = 1;
+ p->gf[0].gfx_filter_keep_autoscale_aspect = integerscale ? 0 : 1;
p->gf[0].gfx_filter_keep_aspect = 1;
} else {
p->gf[0].gfx_filter_aspect = 0;
} else {
p->gf[0].gfx_filter_bilinear = interpolation_old(sm->dwScreenMode);
}
+
+ if (sm->dwScreenMode & RP_SCREENMODE_PIXEL_ORIGINAL_RATIO) {
+ p->gfx_ntscpixels = true;
+ }
}
if (log_rp & 2) {
}
{
- float palntscratio = dstratio;
- int l = 0;
- bool isp = ispal(&l);
- if (abs(l - 262) <= 25) {
- l = 262;
- }
- if (abs(l - 312) <= 25) {
- l = 312;
- }
- float ll = l * 2.0f + 1.0f;
- if (currprefs.ntscmode) {
- if (palntscadjust && isp) {
- palntscratio = palntscratio * (525.0f / ll);
+ int lh = 0;
+ bool isp = ispal(&lh);
+ if (lh > 1) {
+ float palntscratio = dstratio;
+ float palh = (312 - 25) * 2 + 1.0f;
+ float ntsch = (262 - 20) * 2 + 1.0f;
+ float ll = (lh - 23) * 2 + 1.0f;
+ if (abs(lh - (262 - 20)) <= 22) {
+ ll = ntsch;
}
- if (keep_aspect == 2 && isp) {
- palntscratio = palntscratio * 0.93f;
- } else if (keep_aspect == 1 && !isp) {
- palntscratio = palntscratio * 0.98f;
+ if (abs(lh - (312 - 25)) <= 22) {
+ ll = palh;
}
- } else {
- if (palntscadjust && !isp) {
- palntscratio = palntscratio * (625.0f / ll);
+ if (currprefs.gfx_ntscpixels) {
+ if (!isp) {
+ palntscratio = palntscratio * palh / ll;
+ }
+ if (currprefs.ntscmode) {
+ if (keep_aspect == 2 && isp) {
+ palntscratio = palntscratio * 0.93f;
+ }
+ else if (keep_aspect == 1 && !isp) {
+ palntscratio = palntscratio * 0.98f;
+ }
+ } else {
+ if (keep_aspect == 2 && isp) {
+ palntscratio = palntscratio * 0.95f;
+ }
+ else if (keep_aspect == 1 && !isp) {
+ palntscratio = palntscratio * 0.95f;
+ }
+ }
+ } else {
+ if (currprefs.ntscmode) {
+ if (palntscadjust && isp) {
+ palntscratio = palntscratio * ntsch / ll;
+ }
+ if (keep_aspect == 2 && isp) {
+ palntscratio = palntscratio * 0.93f;
+ } else if (keep_aspect == 1 && !isp) {
+ palntscratio = palntscratio * 0.98f;
+ }
+ } else {
+ if (palntscadjust && !isp) {
+ palntscratio = palntscratio * palh / ll;
+ }
+ if (keep_aspect == 2 && isp) {
+ palntscratio = palntscratio * 0.95f;
+ } else if (keep_aspect == 1 && !isp) {
+ palntscratio = palntscratio * 0.95f;
+ }
+ }
}
- if (keep_aspect == 2 && isp) {
- palntscratio = palntscratio * 0.95f;
- } else if (keep_aspect == 1 && !isp) {
- palntscratio = palntscratio * 0.95f;
+ if (palntscratio != dstratio) {
+ ymult = ymult * palntscratio / dstratio;
}
}
- if (palntscratio != dstratio) {
- ymult = ymult * palntscratio / dstratio;
- }
}
if (srcratio > dstratio) {