Force horizontal pixel doubling for 320x400/320x480 modes when possible

This commit is contained in:
Cacodemon345
2025-06-28 01:12:49 +06:00
parent 6a8eaf507c
commit b21c5f1294
4 changed files with 21 additions and 5 deletions

View File

@@ -281,6 +281,10 @@ typedef struct svga_t {
you should set this flag when entering that mode*/ you should set this flag when entering that mode*/
int disable_blink; int disable_blink;
/*Force special shifter bypass logic for 8-bpp lowres modes.
Needed if the screen is squished on certain S3 cards.*/
int force_shifter_bypass;
/*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/ /*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/
int force_dword_mode; int force_dword_mode;

View File

@@ -58,10 +58,6 @@ extern void svga_render_8bpp_highres(svga_t *svga);
extern void svga_render_8bpp_clone_highres(svga_t *svga); extern void svga_render_8bpp_clone_highres(svga_t *svga);
extern void svga_render_8bpp_tseng_lowres(svga_t *svga); extern void svga_render_8bpp_tseng_lowres(svga_t *svga);
extern void svga_render_8bpp_tseng_highres(svga_t *svga); extern void svga_render_8bpp_tseng_highres(svga_t *svga);
extern void svga_render_8bpp_gs_lowres(svga_t *svga);
extern void svga_render_8bpp_gs_highres(svga_t *svga);
extern void svga_render_8bpp_rgb_lowres(svga_t *svga);
extern void svga_render_8bpp_rgb_highres(svga_t *svga);
extern void svga_render_15bpp_lowres(svga_t *svga); extern void svga_render_15bpp_lowres(svga_t *svga);
extern void svga_render_15bpp_highres(svga_t *svga); extern void svga_render_15bpp_highres(svga_t *svga);
extern void svga_render_15bpp_mix_lowres(svga_t *svga); extern void svga_render_15bpp_mix_lowres(svga_t *svga);

View File

@@ -1193,6 +1193,21 @@ svga_recalctimings(svga_t *svga)
if (enable_overscan && (svga->monitor->mon_overscan_x != old_monitor_overscan_x || svga->monitor->mon_overscan_y != old_monitor_overscan_y)) if (enable_overscan && (svga->monitor->mon_overscan_x != old_monitor_overscan_x || svga->monitor->mon_overscan_y != old_monitor_overscan_y))
video_force_resize_set_monitor(1, svga->monitor_index); video_force_resize_set_monitor(1, svga->monitor_index);
svga->force_shifter_bypass = 0;
if (svga->hdisp == 320 && svga->dispend >= 400 && !svga->override && svga->render != svga_render_8bpp_clone_highres) {
svga->hdisp *= 2;
if (svga->render == svga_render_16bpp_highres) svga->render = svga_render_16bpp_lowres;
else if (svga->render == svga_render_15bpp_highres) svga->render = svga_render_15bpp_lowres;
else if (svga->render == svga_render_15bpp_mix_highres) svga->render = svga_render_15bpp_mix_lowres;
else if (svga->render == svga_render_24bpp_highres) svga->render = svga_render_24bpp_lowres;
else if (svga->render == svga_render_32bpp_highres) svga->render = svga_render_32bpp_lowres;
else if (svga->render == svga_render_8bpp_highres) {
svga->render = svga_render_8bpp_lowres;
svga->force_shifter_bypass = 1;
}
else svga->hdisp /= 2;
}
} }
static void static void
@@ -1550,6 +1565,7 @@ svga_init(const device_t *info, svga_t *svga, void *priv, int memsize,
svga->monitor->mon_overscan_y = 32; svga->monitor->mon_overscan_y = 32;
svga->x_add = 8; svga->x_add = 8;
svga->y_add = 16; svga->y_add = 16;
svga->force_shifter_bypass = 1;
svga->crtc[0] = 63; svga->crtc[0] = 63;
svga->crtc[6] = 255; svga->crtc[6] = 255;

View File

@@ -694,7 +694,7 @@ svga_render_indexed_gfx(svga_t *svga, bool highres, bool combine8bits)
- HT-216 (+ other Video7 chipsets?) has 0x3C4.0xC8 bit 4 which, when set to 1, loads - HT-216 (+ other Video7 chipsets?) has 0x3C4.0xC8 bit 4 which, when set to 1, loads
bytes directly, bypassing the shifters. bytes directly, bypassing the shifters.
*/ */
const bool highres8bpp = combine8bits && highres; const bool highres8bpp = (combine8bits && highres) || svga->force_shifter_bypass;
const bool dwordload = ((svga->seqregs[0x01] & 0x10) != 0); const bool dwordload = ((svga->seqregs[0x01] & 0x10) != 0);
const bool wordload = ((svga->seqregs[0x01] & 0x04) != 0) && !dwordload; const bool wordload = ((svga->seqregs[0x01] & 0x04) != 0) && !dwordload;