1
0
Fork 0

Add zooming stuff from hal. Add some fixes by wd and hal to prevent crashing related not enough lines calculated with screenresizes (vgaonly).

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3134
This commit is contained in:
Peter Veenstra 2008-03-30 18:02:23 +00:00
parent cd2e2fd306
commit 5491001923
4 changed files with 45 additions and 28 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: vga.h,v 1.39 2008-02-06 18:22:27 c2woody Exp $ */
/* $Id: vga.h,v 1.40 2008-03-30 18:02:23 qbix79 Exp $ */
#ifndef DOSBOX_VGA_H
#define DOSBOX_VGA_H
@ -128,7 +128,6 @@ typedef struct {
double vdend, vtotal;
double hdend, htotal;
double parts;
double virtline;
} delay;
double aspect_ratio;
bool double_scan;

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: vga_crtc.cpp,v 1.31 2008-02-06 18:23:34 c2woody Exp $ */
/* $Id: vga_crtc.cpp,v 1.32 2008-03-30 18:02:23 qbix79 Exp $ */
#include <stdlib.h>
#include "dosbox.h"
@ -141,11 +141,21 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
if (IS_VGA_ARCH)
vga.config.line_compare=(vga.config.line_compare & 0x5ff)|(val&0x40)<<3;
// don't call resize on doublescan change (magic.exe by European Technology)
if ((vga.crtc.maximum_scan_line ^ val) & ((svgaCard==SVGA_None)?0x3f:0xbf)) {
if(IS_VGA_ARCH && (svgaCard==SVGA_None) && (vga.mode==M_EGA || vga.mode==M_VGA)) {
// in vgaonly mode we take special care of line repeats (excluding CGA modes)
if ((vga.crtc.maximum_scan_line ^ val) & 0x20) {
crtc(maximum_scan_line)=val;
VGA_StartResize();
}
crtc(maximum_scan_line)=val;
VGA_StartResize();
} else crtc(maximum_scan_line)=val;
vga.draw.address_line_total = (val &0x1F) + 1;
if(val&0x80) vga.draw.address_line_total*=2;
} else {
if ((vga.crtc.maximum_scan_line ^ val) & 0xbf) {
crtc(maximum_scan_line)=val;
VGA_StartResize();
}
}
/*
0-4 Number of scan lines in a character row -1. In graphics modes this is
the number of times (-1) the line is displayed before passing on to

View file

@ -179,9 +179,12 @@ void VGA_DAC_CombineColor(Bit8u attr,Bit8u pal) {
/* Check if this is a new color */
vga.dac.combine[attr]=pal;
switch (vga.mode) {
case M_VGA:
case M_LIN8:
break;
case M_VGA:
// used by copper demo; almost no video card seems to suport it
if(!IS_VGA_ARCH || (svgaCard!=SVGA_None)) break;
default:
vga.dac.xlat16[attr] = ((vga.dac.rgb[pal].blue>>1)&0x1f) |
(((vga.dac.rgb[pal].green)&0x3f)<<5)|

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: vga_draw.cpp,v 1.93 2008-03-08 12:29:59 c2woody Exp $ */
/* $Id: vga_draw.cpp,v 1.94 2008-03-30 18:02:23 qbix79 Exp $ */
#include <string.h>
#include <math.h>
@ -634,17 +634,12 @@ static INLINE void VGA_ChangesEnd(void ) {
static void VGA_DrawSingleLine(Bitu blah) {
if(vga.attr.enabled || (!(vga.mode==M_VGA || vga.mode==M_EGA))) {
Bit8u * data=VGA_DrawLine( vga.draw.address, vga.draw.address_line );
// Magic Circle last part
if((vga.crtc.maximum_scan_line & 0x80)&& !vga.draw.doubleheight)
RENDER_DrawLine(data);
RENDER_DrawLine(data);
} else {
// else draw overscan color line
// TODO: black line should be good enough for now
// (DoWhackaDo)
memset(TempLine, 0, sizeof(TempLine));
if((vga.crtc.maximum_scan_line & 0x80)&& !vga.draw.doubleheight)
RENDER_DrawLine(TempLine);
RENDER_DrawLine(TempLine);
}
@ -662,8 +657,8 @@ static void VGA_DrawSingleLine(Bitu blah) {
}
vga.draw.address_line=0;
}
if ((vga.draw.lines_done < vga.draw.lines_total) && (!vga.draw.resizing)) {
PIC_AddEvent(VGA_DrawSingleLine,(float)vga.draw.delay.virtline);
if (vga.draw.lines_done < vga.draw.lines_total) {
PIC_AddEvent(VGA_DrawSingleLine,(float)vga.draw.delay.htotal);
} else RENDER_EndUpdate();
}
@ -855,7 +850,7 @@ static void VGA_VerticalTimer(Bitu val) {
vga.draw.vret_triggered=true;
}
}
if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) PIC_AddEvent(VGA_DrawSingleLine,(float)vga.draw.delay.htotal);
if ((IS_VGA_ARCH) && (svgaCard==SVGA_None)) PIC_AddEvent(VGA_DrawSingleLine,(float)(vga.draw.delay.htotal/4.0));
else PIC_AddEvent(VGA_DrawPart,(float)vga.draw.delay.parts,vga.draw.parts_lines);
//VGA_DrawPart( vga.draw.parts_lines );
//PIC_AddEvent(VGA_DrawPart,(float)vga.draw.delay.parts,vga.draw.parts_lines);
@ -1010,9 +1005,17 @@ void VGA_SetupDrawing(Bitu val) {
if (vga.seq.clocking_mode & 0x8) {
htotal*=2;
}
vga.draw.address_line_total=(vga.crtc.maximum_scan_line&0xf)+1;
if (IS_VGA_ARCH) vga.draw.double_scan=(vga.crtc.maximum_scan_line&0x80)>0;
vga.draw.address_line_total=(vga.crtc.maximum_scan_line&0x1f)+1;
if(IS_VGA_ARCH && (svgaCard==SVGA_None) && (vga.mode==M_EGA || vga.mode==M_VGA)) {
// vgaonly; can't use with CGA because these use address_line for their
// own purposes.
// Set the low resolution modes to have as many lines as are scanned -
// Quite a few demos change the max_scanline register at display time
// to get SFX: Majic12 show, Magic circle, Copper, GBU, Party91
if( vga.crtc.maximum_scan_line&0x80) vga.draw.address_line_total*=2;
vga.draw.double_scan=false;
}
else if (IS_VGA_ARCH) vga.draw.double_scan=(vga.crtc.maximum_scan_line&0x80)>0;
else vga.draw.double_scan=(vtotal==262);
} else {
htotal = vga.other.htotal + 1;
@ -1313,11 +1316,15 @@ void VGA_SetupDrawing(Bitu val) {
if (IS_VGA_ARCH) height/=2;
doubleheight=true;
}
//Only check for extra double height in vga modes
if (!doubleheight && (vga.mode<M_TEXT) && !(vga.draw.address_line_total & 1)) {
vga.draw.address_line_total/=2;
doubleheight=true;
height/=2;
if(!(IS_VGA_ARCH && (svgaCard==SVGA_None) && (vga.mode==M_EGA || vga.mode==M_VGA))) {
// what is this hack needed for?
//Only check for extra double height in vga modes
if (!doubleheight && (vga.mode<M_TEXT) && !(vga.draw.address_line_total & 1)) {
vga.draw.address_line_total/=2;
doubleheight=true;
height/=2;
}
}
vga.draw.lines_total=height;
vga.draw.parts_lines=vga.draw.lines_total/vga.draw.parts_total;
@ -1356,11 +1363,9 @@ void VGA_SetupDrawing(Bitu val) {
doublewidth ? "double":"normal",doubleheight ? "double":"normal",aspect_ratio);
#endif
RENDER_SetSize(width,height,bpp,fps,aspect_ratio,doublewidth,doubleheight);
if(doubleheight) vga.draw.delay.virtline = vga.draw.delay.htotal * 2.0;
// On doubleheight modes we need twice the time to pass to the next scanline
else vga.draw.delay.virtline = vga.draw.delay.htotal;
vga.draw.delay.framestart = PIC_FullIndex();
PIC_AddEvent( VGA_VerticalTimer , (float)vga.draw.delay.vtotal );
vga.draw.lines_done = 0;
}
};