From 895995c073680a044a0e2aa0f9fdbe935259e856 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sat, 8 Nov 2003 10:11:25 +0000 Subject: [PATCH] Added some kind of aspect correction calcuation, still not perfect Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1414 --- src/hardware/vga_draw.cpp | 60 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index 1365795e..a8de2f15 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -30,11 +30,8 @@ static void VGA_HERC_Draw(Bit8u * bitdata,Bitu pitch) { Bit8u * reader=&vga.mem.linear[(vga.herc.mode_control & 0x80) ? 8*1024 : 0]; for (Bitu y=0;y>3;x>0;x--) { Bit8u val=*(tempread++); *(Bit32u *)(draw+0)=CGA_2_Table[val >> 4]; @@ -259,8 +256,7 @@ void VGA_DrawHandler(RENDER_Part_Handler part_handler) { /* Draw the current frame */ if (!vga.draw.resizing) { if (vga.config.line_compare=vga.draw.height){ LOG(LOG_VGAGFX,LOG_NORMAL)("Split at %d",stop); goto drawnormal; @@ -348,9 +344,13 @@ norender:; void VGA_SetupDrawing(void) { /* Calculate the FPS for this screen */ double fps; - Bitu vtotal=2 + (vga.crtc.vertical_total | ((vga.crtc.overflow & 1) << 8) | ((vga.crtc.overflow & 0x20) << 4) ); + Bitu vtotal=2 + vga.crtc.vertical_total | + ((vga.crtc.overflow & 1) << 8) | ((vga.crtc.overflow & 0x20) << 4) + ; Bitu htotal=5 + vga.crtc.horizontal_total; - Bitu vdispend = 1 + (vga.crtc.vertical_display_end | ((vga.crtc.overflow & 2)<<7) | ((vga.crtc.overflow & 0x40) << 3) ); + Bitu vdispend = 1 + (vga.crtc.vertical_display_end | + ((vga.crtc.overflow & 2)<<7) | ((vga.crtc.overflow & 0x40) << 3) | + ((vga.s3.ex_ver_overflow & 0x2) << 9)); Bitu hdispend = 1 + (vga.crtc.horizontal_display_end); Bitu hbstart = vga.crtc.start_horizontal_blanking; @@ -365,19 +365,25 @@ void VGA_SetupDrawing(void) { /* Check for 8 for 9 character clock mode */ if (vga.seq.clocking_mode & 1 ) clock/=8; else clock/=9; /* Check for pixel doubling, master clock/2 */ - if (vga.seq.clocking_mode & 0x8) clock/=2; + if (vga.seq.clocking_mode & 0x8) { + clock/=2; + htotal*=2; + } /* Check for dual transfer whatever thing,master clock/2 */ if (vga.s3.pll.cmd & 0x10) clock/=2; - + LOG(LOG_VGA,LOG_NORMAL)("H total %d, V Total %d",htotal,vtotal); LOG(LOG_VGA,LOG_NORMAL)("H D End %d, V D End %d",hdispend,vdispend); fps=clock/(vtotal*htotal); - + double correct_ratio=(100.0/525.0); + double aspect_ratio=((double)htotal/((double)vtotal)/correct_ratio); + vga.draw.resizing=false; - Bitu width,height,pitch,flags; + Bitu width,height,pitch; + Bitu scalew=1; + Bitu scaleh=1; - flags=0; vga.draw.lines=height=vdispend; width=hdispend; vga.draw.double_height=vga.config.vline_double; @@ -387,29 +393,19 @@ void VGA_SetupDrawing(void) { case M_VGA: vga.draw.double_width=true; //Hack since 256 color modes use 2 clocks for a pixel /* Don't know might do this different sometime, will have to do for now */ - if (!vga.draw.double_height) { - if (vga.config.vline_height&1) { - vga.draw.double_height=true; - vga.draw.font_height/=2; - } - } + scaleh*=vga.draw.font_height; width<<=2; pitch=vga.config.scan_len*8; break; case M_LIN8: width<<=3; - if (vga.draw.double_width) width>>=1; - if (!vga.draw.double_height) { - if (vga.config.vline_height&1) { - vga.draw.double_height=true; - vga.draw.font_height/=2; - } - } + scaleh*=vga.draw.font_height; pitch=vga.config.scan_len*8; break; case M_EGA16: width<<=3; pitch=vga.config.scan_len*16; + scaleh*=vga.draw.font_height; break; case M_CGA4: case M_CGA16: //Let is use 320x200 res and double pixels myself @@ -435,6 +431,7 @@ void VGA_SetupDrawing(void) { break; case M_TEXT2: case M_TEXT16: + aspect_ratio=1.0; vga.draw.font_height=vga.config.vline_height+1; if (vga.draw.font_height<4 && (machine