Fixed the window resizes function in win_video.c, fixes window resizes with non-resizable window (ie. the main window is no longer stuck in 640x480);

Fixed the Force 4:3, Enable EGA/(S)VGA overscan, and Scale options;
Fixed a bug regarding register 0 of the SMC FDC37C665 Super I/O chip;
Commented out some excess logging.
This commit is contained in:
OBattler
2017-10-20 07:00:48 +02:00
parent 2f490728ca
commit 2be1c21c8a
22 changed files with 139 additions and 148 deletions

View File

@@ -1881,7 +1881,9 @@ nic_init(device_t *info)
uint32_t mac; uint32_t mac;
wchar_t *rom; wchar_t *rom;
nic_t *dev; nic_t *dev;
#ifdef ENABLE_NIC_LOG
int i; int i;
#endif
/* Get the desired debug level. */ /* Get the desired debug level. */
#ifdef ENABLE_NIC_LOG #ifdef ENABLE_NIC_LOG

View File

@@ -195,7 +195,9 @@ set_screen_size(int x, int y)
int efscrnsz_y; int efscrnsz_y;
/* Make sure we keep usable values. */ /* Make sure we keep usable values. */
#if 0
pclog("SetScreenSize(%d, %d) resize=%d\n", x, y, vid_resize); pclog("SetScreenSize(%d, %d) resize=%d\n", x, y, vid_resize);
#endif
if (x < 320) x = 320; if (x < 320) x = 320;
if (y < 200) y = 200; if (y < 200) y = 200;
if (x > 2048) x = 2048; if (x > 2048) x = 2048;
@@ -216,10 +218,10 @@ set_screen_size(int x, int y)
dty = (double)temp_overscan_y; dty = (double)temp_overscan_y;
/* Account for possible overscan. */ /* Account for possible overscan. */
if (temp_overscan_y == 16) { if (!(VGA) && (temp_overscan_y == 16)) {
/* CGA */ /* CGA */
dy = (((dx - dtx) / 4.0) * 3.0) + dty; dy = (((dx - dtx) / 4.0) * 3.0) + dty;
} else if (temp_overscan_y < 16) { } else if (!(VGA) && (temp_overscan_y < 16)) {
/* MDA/Hercules */ /* MDA/Hercules */
dy = (x / 4.0) * 3.0; dy = (x / 4.0) * 3.0;
} else { } else {
@@ -816,7 +818,7 @@ pc_thread(void *param)
while (! *quitp) { while (! *quitp) {
/* Update the Stat(u)s window with the current info. */ /* Update the Stat(u)s window with the current info. */
if (status_update_needed) { if (status_update_needed) {
#if 1 #if 0
pclog("Updating STATS window..\n"); pclog("Updating STATS window..\n");
// ui_status_update(); // ui_status_update();
#endif #endif

View File

@@ -177,6 +177,8 @@ void fdc37c665_write(uint16_t port, uint8_t val, void *priv)
if (val == 0xaa) if (val == 0xaa)
write_lock(val); write_lock(val);
else else
fdc37c665_curreg = val;
#if 0
if (fdc37c665_curreg != 0) if (fdc37c665_curreg != 0)
{ {
fdc37c665_curreg = val & 0xf; fdc37c665_curreg = val & 0xf;
@@ -186,9 +188,13 @@ void fdc37c665_write(uint16_t port, uint8_t val, void *priv)
/* Hardcode the IDE to AT type. */ /* Hardcode the IDE to AT type. */
fdc37c665_curreg = (val & 0xf) | 2; fdc37c665_curreg = (val & 0xf) | 2;
} }
#endif
} }
else else
{ {
if (fdc37c665_curreg > 15)
return;
valxor = val ^ fdc37c665_regs[fdc37c665_curreg]; valxor = val ^ fdc37c665_regs[fdc37c665_curreg];
fdc37c665_regs[fdc37c665_curreg] = val; fdc37c665_regs[fdc37c665_curreg] = val;

View File

@@ -396,13 +396,16 @@ void cga_poll(void *p)
if (cga->cgamode & 1) x = (cga->crtc[1] << 3) + 16; if (cga->cgamode & 1) x = (cga->crtc[1] << 3) + 16;
else x = (cga->crtc[1] << 4) + 16; else x = (cga->crtc[1] << 4) + 16;
cga->lastline++; cga->lastline++;
if (x != xsize || (cga->lastline - cga->firstline) != ysize) if ((x != xsize) || ((cga->lastline - cga->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = cga->lastline - cga->firstline; ysize = cga->lastline - cga->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, (ysize << 1) + 16); set_screen_size(xsize, (ysize << 1) + 16);
if (video_force_resize_get())
video_force_resize_set(0);
} }
if (cga->composite) if (cga->composite)

View File

@@ -664,7 +664,7 @@ void ega_poll(void *p)
if (ega->interlace && !ega->oddeven) ega->lastline++; if (ega->interlace && !ega->oddeven) ega->lastline++;
if (ega->interlace && ega->oddeven) ega->firstline--; if (ega->interlace && ega->oddeven) ega->firstline--;
if ((x != xsize || (ega->lastline - ega->firstline + 1) != ysize) || update_overscan) if ((x != xsize || (ega->lastline - ega->firstline + 1) != ysize) || update_overscan || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = ega->lastline - ega->firstline + 1; ysize = ega->lastline - ega->firstline + 1;
@@ -690,6 +690,9 @@ void ega_poll(void *p)
set_screen_size(xsize + x_add_ex, (ysize << 1) + y_add_ex); set_screen_size(xsize + x_add_ex, (ysize << 1) + y_add_ex);
else else
set_screen_size(xsize + x_add_ex, ysize + y_add_ex); set_screen_size(xsize + x_add_ex, ysize + y_add_ex);
if (video_force_resize_get())
video_force_resize_set(0);
} }
if (enable_overscan) if (enable_overscan)

View File

@@ -551,13 +551,16 @@ void genius_poll(void *p)
if (genius->displine == 1008) if (genius->displine == 1008)
{ {
/* Hardcode GENIUS_XSIZE * GENIUS_YSIZE window size */ /* Hardcode GENIUS_XSIZE * GENIUS_YSIZE window size */
if (GENIUS_XSIZE != xsize || GENIUS_YSIZE != ysize) if ((GENIUS_XSIZE != xsize) || (GENIUS_YSIZE != ysize) || video_force_resize_get())
{ {
xsize = GENIUS_XSIZE; xsize = GENIUS_XSIZE;
ysize = GENIUS_YSIZE; ysize = GENIUS_YSIZE;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize); set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, 0, xsize, ysize); video_blit_memtoscreen_8(0, 0, xsize, ysize);

View File

@@ -283,7 +283,7 @@ void hercules_poll(void *p)
if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1)) x = hercules->crtc[1] << 4; if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1)) x = hercules->crtc[1] << 4;
else x = hercules->crtc[1] * 9; else x = hercules->crtc[1] * 9;
hercules->lastline++; hercules->lastline++;
if (x != xsize || (hercules->lastline - hercules->firstline) != ysize) if ((x != xsize) || ((hercules->lastline - hercules->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = hercules->lastline - hercules->firstline; ysize = hercules->lastline - hercules->firstline;
@@ -291,6 +291,9 @@ void hercules_poll(void *p)
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize); set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, hercules->firstline, xsize, ysize); video_blit_memtoscreen_8(0, hercules->firstline, xsize, ysize);
frames++; frames++;

View File

@@ -633,13 +633,16 @@ void herculesplus_poll(void *p)
x = herculesplus->crtc[1] * 9; x = herculesplus->crtc[1] * 9;
} }
herculesplus->lastline++; herculesplus->lastline++;
if (x != xsize || (herculesplus->lastline - herculesplus->firstline) != ysize) if ((x != xsize) || ((herculesplus->lastline - herculesplus->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = herculesplus->lastline - herculesplus->firstline; ysize = herculesplus->lastline - herculesplus->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize); set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen(0, herculesplus->firstline, 0, herculesplus->lastline - herculesplus->firstline, xsize, herculesplus->lastline - herculesplus->firstline); video_blit_memtoscreen(0, herculesplus->firstline, 0, herculesplus->lastline - herculesplus->firstline, xsize, herculesplus->lastline - herculesplus->firstline);
frames++; frames++;

View File

@@ -980,13 +980,16 @@ void incolor_poll(void *p)
x = incolor->crtc[1] * 9; x = incolor->crtc[1] * 9;
} }
incolor->lastline++; incolor->lastline++;
if (x != xsize || (incolor->lastline - incolor->firstline) != ysize) if ((x != xsize) || ((incolor->lastline - incolor->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = incolor->lastline - incolor->firstline; ysize = incolor->lastline - incolor->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize); set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen(0, incolor->firstline, 0, incolor->lastline - incolor->firstline, xsize, incolor->lastline - incolor->firstline); video_blit_memtoscreen(0, incolor->firstline, 0, incolor->lastline - incolor->firstline, xsize, incolor->lastline - incolor->firstline);
frames++; frames++;

View File

@@ -243,13 +243,16 @@ void mda_poll(void *p)
{ {
x = mda->crtc[1] * 9; x = mda->crtc[1] * 9;
mda->lastline++; mda->lastline++;
if (x != xsize || (mda->lastline - mda->firstline) != ysize) if ((x != xsize) || ((mda->lastline - mda->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = mda->lastline - mda->firstline; ysize = mda->lastline - mda->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize); set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, mda->firstline, xsize, mda->lastline - mda->firstline); video_blit_memtoscreen_8(0, mda->firstline, xsize, mda->lastline - mda->firstline);
frames++; frames++;

View File

@@ -404,13 +404,16 @@ void m24_poll(void *p)
if (m24->cgamode & 1) x = (m24->crtc[1] << 3) + 16; if (m24->cgamode & 1) x = (m24->crtc[1] << 3) + 16;
else x = (m24->crtc[1] << 4) + 16; else x = (m24->crtc[1] << 4) + 16;
m24->lastline++; m24->lastline++;
if (x != xsize || (m24->lastline - m24->firstline) != ysize) if ((x != xsize) || ((m24->lastline - m24->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = m24->lastline - m24->firstline; ysize = m24->lastline - m24->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize + 16); set_screen_size(xsize, ysize + 16);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, m24->firstline - 8, xsize, (m24->lastline - m24->firstline) + 16); video_blit_memtoscreen_8(0, m24->firstline - 8, xsize, (m24->lastline - m24->firstline) + 16);

View File

@@ -413,13 +413,16 @@ static void pc1512_poll(void *p)
x = 640 + 16; x = 640 + 16;
pc1512->lastline++; pc1512->lastline++;
if (x != xsize || (pc1512->lastline - pc1512->firstline) != ysize) if ((x != xsize) || ((pc1512->lastline - pc1512->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = pc1512->lastline - pc1512->firstline; ysize = pc1512->lastline - pc1512->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, (ysize << 1) + 16); set_screen_size(xsize, (ysize << 1) + 16);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, pc1512->firstline - 4, xsize, (pc1512->lastline - pc1512->firstline) + 8); video_blit_memtoscreen_8(0, pc1512->firstline - 4, xsize, (pc1512->lastline - pc1512->firstline) + 8);

View File

@@ -503,13 +503,16 @@ void pcjr_poll(void *p)
if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16; if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16;
else x = (pcjr->crtc[1] << 4) + 16; else x = (pcjr->crtc[1] << 4) + 16;
pcjr->lastline++; pcjr->lastline++;
if (x != xsize || (pcjr->lastline - pcjr->firstline) != ysize) if ((x != xsize) || ((pcjr->lastline - pcjr->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = pcjr->lastline - pcjr->firstline; ysize = pcjr->lastline - pcjr->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, (ysize << 1) + 16); set_screen_size(xsize, (ysize << 1) + 16);
if (video_force_resize_get())
video_force_resize_set(0);
} }
if (pcjr->composite) if (pcjr->composite)

View File

@@ -1617,7 +1617,7 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
return; return;
} }
if (((wx!=xsize) || ((wy+1)!=ysize))) if ((wx != xsize) || ((wy + 1) != ysize) || video_force_resize_get())
{ {
/* Screen res has changed.. fix up, and let them know. */ /* Screen res has changed.. fix up, and let them know. */
xsize = wx; xsize = wx;
@@ -1625,18 +1625,13 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
if (xsize<64) xsize = 640; if (xsize<64) xsize = 640;
if (ysize<32) ysize = 200; if (ysize<32) ysize = 200;
if ((xsize > 2032) || (ysize > 2032))
{
x_add = 0;
y_add = 0;
suppress_overscan = 1;
}
else
{
suppress_overscan = 0;
}
set_screen_size(xsize+x_add,ysize+y_add); set_screen_size(xsize+x_add,ysize+y_add);
if (video_force_resize_get())
{
pclog("Scroll: %02X (%i, %i, %i, %i, %i, %i)\n", (svga->crtc[8] & 0x1f), enable_overscan, suppress_overscan, wx, wy + 1, x_add, y_add);
video_force_resize_set(0);
}
} }
if (enable_overscan && !suppress_overscan) if (enable_overscan && !suppress_overscan)

View File

@@ -134,7 +134,7 @@ uint32_t svga_color_transform(uint32_t color)
int svga_display_line(svga_t *svga) int svga_display_line(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int y_add = enable_overscan ? (overscan_y >> 1) : 0;
unsigned int dl = svga->displine; unsigned int dl = svga->displine;
if (svga->crtc[9] & 0x1f) if (svga->crtc[9] & 0x1f)
{ {
@@ -147,75 +147,9 @@ int svga_display_line(svga_t *svga)
void svga_render_blank(svga_t *svga) void svga_render_blank(svga_t *svga)
{ {
#if 0
int x, xx; int x, xx;
int y_add = (enable_overscan) ? 16 : 0; int y_add = enable_overscan ? (overscan_y >> 1) : 0;
int x_add = y_add >> 1; int x_add = enable_overscan ? 8 : 0;
int dl = svga_display_line(svga);
uint32_t *p;
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
svga->lastline_draw = svga->displine;
if (dl >= 2046)
{
return;
}
for (x = 0; x < svga->hdisp; x++)
{
switch (svga->seqregs[1] & 9)
{
case 0:
for (xx = 0; xx < 9; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 9) + xx + 32 + x_add]) != NULL)
{
p[(x * 9) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
case 1:
for (xx = 0; xx < 8; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 8) + xx + 32 + x_add]) != NULL)
{
p[(x * 8) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
case 8:
for (xx = 0; xx < 18; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 18) + xx + 32 + x_add]) != NULL)
{
p[(x * 18) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
case 9:
for (xx = 0; xx < 16; xx++)
{
p = ((uint32_t *)buffer32->line[dl]);
if (&(p[(x * 16) + xx + 32 + x_add]) != NULL)
{
p[(x * 16) + xx + 32 + x_add] = svga_color_transform(0);
}
}
break;
}
}
#endif
int x, xx;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
if (svga->firstline_draw == 2000) if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine; svga->firstline_draw = svga->displine;
@@ -243,8 +177,7 @@ void svga_render_blank(svga_t *svga)
void svga_render_text_40(svga_t *svga) void svga_render_text_40(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000) if (svga->firstline_draw == 2000)
@@ -311,8 +244,7 @@ void svga_render_text_40(svga_t *svga)
#if 0 #if 0
void svga_render_text_40_12(svga_t *svga) void svga_render_text_40_12(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 12 : 0;
int x_add = (enable_overscan) ? 12 : 0;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000) if (svga->firstline_draw == 2000)
@@ -368,8 +300,7 @@ void svga_render_text_40_12(svga_t *svga)
void svga_render_text_80(svga_t *svga) void svga_render_text_80(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000) if (svga->firstline_draw == 2000)
@@ -436,8 +367,7 @@ void svga_render_text_80(svga_t *svga)
#if 0 #if 0
void svga_render_text_80_12(svga_t *svga) void svga_render_text_80_12(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 12 : 0;
int x_add = (enable_overscan) ? 12 : 0;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000) if (svga->firstline_draw == 2000)
@@ -495,8 +425,7 @@ void svga_render_text_80_12(svga_t *svga)
void svga_render_2bpp_lowres(svga_t *svga) void svga_render_2bpp_lowres(svga_t *svga)
{ {
int changed_offset; int changed_offset;
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->sc & 1 && !(svga->crtc[0x17] & 1)) if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
@@ -548,8 +477,7 @@ void svga_render_2bpp_lowres(svga_t *svga)
void svga_render_2bpp_highres(svga_t *svga) void svga_render_2bpp_highres(svga_t *svga)
{ {
int changed_offset; int changed_offset;
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->sc & 1 && !(svga->crtc[0x17] & 1)) if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
@@ -601,8 +529,7 @@ void svga_render_2bpp_highres(svga_t *svga)
void svga_render_4bpp_lowres(svga_t *svga) void svga_render_4bpp_lowres(svga_t *svga)
{ {
int x; int x;
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
int offset; int offset;
uint32_t *p; uint32_t *p;
@@ -649,8 +576,7 @@ void svga_render_4bpp_highres(svga_t *svga)
{ {
int changed_offset; int changed_offset;
int changed_offset2; int changed_offset2;
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
int x; int x;
int offset; int offset;
@@ -709,8 +635,7 @@ void svga_render_4bpp_highres(svga_t *svga)
void svga_render_8bpp_lowres(svga_t *svga) void svga_render_8bpp_lowres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -741,8 +666,7 @@ void svga_render_8bpp_lowres(svga_t *svga)
void svga_render_8bpp_highres(svga_t *svga) void svga_render_8bpp_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -779,8 +703,7 @@ void svga_render_8bpp_highres(svga_t *svga)
void svga_render_15bpp_lowres(svga_t *svga) void svga_render_15bpp_lowres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -826,8 +749,7 @@ void svga_render_15bpp_lowres(svga_t *svga)
void svga_render_15bpp_highres(svga_t *svga) void svga_render_15bpp_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -865,8 +787,7 @@ void svga_render_15bpp_highres(svga_t *svga)
void svga_render_16bpp_lowres(svga_t *svga) void svga_render_16bpp_lowres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -912,8 +833,7 @@ void svga_render_16bpp_lowres(svga_t *svga)
void svga_render_16bpp_highres(svga_t *svga) void svga_render_16bpp_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -953,8 +873,7 @@ void svga_render_24bpp_lowres(svga_t *svga)
{ {
int x, offset; int x, offset;
uint32_t fg; uint32_t fg;
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -977,8 +896,7 @@ void svga_render_24bpp_lowres(svga_t *svga)
void svga_render_24bpp_highres(svga_t *svga) void svga_render_24bpp_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -1015,8 +933,7 @@ void svga_render_32bpp_lowres(svga_t *svga)
{ {
int x, offset; int x, offset;
uint32_t fg; uint32_t fg;
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
@@ -1041,8 +958,7 @@ void svga_render_32bpp_lowres(svga_t *svga)
91%*/ 91%*/
void svga_render_32bpp_highres(svga_t *svga) void svga_render_32bpp_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
@@ -1067,8 +983,7 @@ void svga_render_32bpp_highres(svga_t *svga)
void svga_render_ABGR8888_lowres(svga_t *svga) void svga_render_ABGR8888_lowres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
@@ -1093,8 +1008,7 @@ void svga_render_ABGR8888_lowres(svga_t *svga)
void svga_render_ABGR8888_highres(svga_t *svga) void svga_render_ABGR8888_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
@@ -1119,8 +1033,7 @@ void svga_render_ABGR8888_highres(svga_t *svga)
void svga_render_RGBA8888_lowres(svga_t *svga) void svga_render_RGBA8888_lowres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
@@ -1145,8 +1058,7 @@ void svga_render_RGBA8888_lowres(svga_t *svga)
void svga_render_RGBA8888_highres(svga_t *svga) void svga_render_RGBA8888_highres(svga_t *svga)
{ {
int y_add = (enable_overscan) ? 16 : 0; int x_add = enable_overscan ? 8 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga); int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange) if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)

View File

@@ -540,13 +540,16 @@ void tandy_poll(void *p)
if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16; if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16;
else x = (tandy->crtc[1] << 4) + 16; else x = (tandy->crtc[1] << 4) + 16;
tandy->lastline++; tandy->lastline++;
if (x != xsize || (tandy->lastline - tandy->firstline) != ysize) if ((x != xsize) || ((tandy->lastline - tandy->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = tandy->lastline - tandy->firstline; ysize = tandy->lastline - tandy->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, (ysize << 1) + 16); set_screen_size(xsize, (ysize << 1) + 16);
if (video_force_resize_get())
video_force_resize_set(0);
} }
if (tandy->composite) if (tandy->composite)

View File

@@ -609,13 +609,16 @@ static void tandysl_poll(void *p)
if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16; if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16;
else x = (tandy->crtc[1] << 4) + 16; else x = (tandy->crtc[1] << 4) + 16;
tandy->lastline++; tandy->lastline++;
if (x != xsize || (tandy->lastline - tandy->firstline) != ysize) if ((x != xsize) || ((tandy->lastline - tandy->firstline) != ysize) || video_force_resize_get())
{ {
xsize = x; xsize = x;
ysize = tandy->lastline - tandy->firstline; ysize = tandy->lastline - tandy->firstline;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, (ysize << 1) + 16); set_screen_size(xsize, (ysize << 1) + 16);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8); video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);

View File

@@ -860,13 +860,16 @@ void wy700_poll(void *p)
if (wy700->displine == 800) if (wy700->displine == 800)
{ {
/* Hardcode 1280x800 window size */ /* Hardcode 1280x800 window size */
if (WY700_XSIZE != xsize || WY700_YSIZE != ysize) if ((WY700_XSIZE != xsize) || (WY700_YSIZE != ysize) || video_force_resize_get())
{ {
xsize = WY700_XSIZE; xsize = WY700_XSIZE;
ysize = WY700_YSIZE; ysize = WY700_YSIZE;
if (xsize < 64) xsize = 656; if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200; if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize); set_screen_size(xsize, ysize);
if (video_force_resize_get())
video_force_resize_set(0);
} }
video_blit_memtoscreen_8(0, 0, xsize, ysize); video_blit_memtoscreen_8(0, 0, xsize, ysize);

View File

@@ -110,6 +110,7 @@ int video_timing[6][4] = {
{ VIDEO_BUS, 4, 5, 10 }, { VIDEO_BUS, 4, 5, 10 },
{ VIDEO_BUS, 3, 3, 4 } { VIDEO_BUS, 3, 3, 4 }
}; };
static int video_force_resize;
PALETTE cgapal = { PALETTE cgapal = {
{0,0,0}, {0,42,0}, {42,0,0}, {42,21,0}, {0,0,0}, {0,42,0}, {42,0,0}, {42,21,0},
{0,0,0}, {0,42,42}, {42,0,42}, {42,42,42}, {0,0,0}, {0,42,42}, {42,0,42}, {42,42,42},
@@ -574,6 +575,20 @@ video_reset(void)
} }
uint8_t
video_force_resize_get(void)
{
return video_force_resize;
}
void
video_force_resize_set(uint8_t res)
{
video_force_resize = res;
}
void void
loadfont(wchar_t *s, int format) loadfont(wchar_t *s, int format)
{ {

View File

@@ -107,6 +107,8 @@ extern void updatewindowsize(int x, int y);
extern void video_init(void); extern void video_init(void);
extern void video_close(void); extern void video_close(void);
extern void video_reset(void); extern void video_reset(void);
extern uint8_t video_force_resize_get(void);
extern void video_force_resize_set(uint8_t res);
extern void video_reset_device(int, int); extern void video_reset_device(int, int);
extern void video_update_timing(void); extern void video_update_timing(void);

View File

@@ -420,11 +420,13 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
scale = LOWORD(wParam) - IDM_VID_SCALE_1X; scale = LOWORD(wParam) - IDM_VID_SCALE_1X;
CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_CHECKED); CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_CHECKED);
device_force_redraw(); device_force_redraw();
video_force_resize_set(1);
config_save(); config_save();
break; break;
case IDM_VID_FORCE43: case IDM_VID_FORCE43:
video_toggle_option(hmenu, &force_43, IDM_VID_FORCE43); video_toggle_option(hmenu, &force_43, IDM_VID_FORCE43);
video_force_resize_set(1);
break; break;
case IDM_VID_INVERT: case IDM_VID_INVERT:
@@ -434,6 +436,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_VID_OVERSCAN: case IDM_VID_OVERSCAN:
update_overscan = 1; update_overscan = 1;
video_toggle_option(hmenu, &enable_overscan, IDM_VID_OVERSCAN); video_toggle_option(hmenu, &enable_overscan, IDM_VID_OVERSCAN);
video_force_resize_set(1);
break; break;
case IDM_VID_CGACON: case IDM_VID_CGACON:

View File

@@ -18,6 +18,7 @@
#define BITMAP WINDOWS_BITMAP #define BITMAP WINDOWS_BITMAP
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <commctrl.h>
#undef BITMAP #undef BITMAP
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@@ -277,17 +278,31 @@ endblit(void)
void void
plat_resize(int x, int y) plat_resize(int x, int y)
{ {
int sb_borders[3];
RECT r;
#if 0
pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", video_fullscreen, vid_api, x, y); pclog("PLAT: VID[%d,%d] resizing to %dx%d\n", video_fullscreen, vid_api, x, y);
#endif
/* First, see if we should resize the UI window. */ /* First, see if we should resize the UI window. */
if (vid_resize) { if (!vid_resize) {
/* Move the main window. */ SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM) sb_borders);
GetWindowRect(hwndMain, &r);
MoveWindow(hwndRender, 0, 0, x, y, TRUE);
GetWindowRect(hwndRender, &r);
MoveWindow(hwndSBAR,
0, r.bottom + GetSystemMetrics(SM_CYEDGE),
x, 17, TRUE);
GetWindowRect(hwndMain, &r);
/* Move the status bar with it. */ MoveWindow(hwndMain, r.left, r.top,
MoveWindow(hwndSBAR, 0, y+6, x, 17, TRUE); x + (GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
y + (GetSystemMetrics(SM_CYEDGE) * 2) + (GetSystemMetrics(vid_resize ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 17 + sb_borders[1] + 1,
TRUE);
/* Move the render window if we have one. */ if (mousecapture) {
if (vid_apis[0][vid_api].local && (hwndRender != NULL)) { GetWindowRect(hwndRender, &r);
MoveWindow(hwndRender, 0, 0, x, y, TRUE); ClipCursor(&r);
} }
} }