From 5296f3a10a4a8fad736af784366ae5195749dfb3 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 19 Apr 2013 19:11:03 +0300 Subject: [PATCH] 2600b17 --- cfgfile.cpp | 8 ++- custom.cpp | 33 ++++++++++- drawing.cpp | 87 +++++++++++++++++++--------- gayle.cpp | 80 ++++++++++++++++---------- genlinetoscr.cpp | 10 ++-- include/drawing.h | 2 - include/options.h | 2 + main.cpp | 8 +-- od-win32/sysconfig.h | 3 + od-win32/win32.cpp | 6 +- od-win32/win32.h | 4 +- od-win32/win32_scaler.cpp | 2 +- od-win32/win32gfx.cpp | 18 +++--- od-win32/win32gui.cpp | 107 ++++++++++++++++++----------------- od-win32/winuaechangelog.txt | 15 +++++ 15 files changed, 245 insertions(+), 140 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index a02b525e..f7e2acb4 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -956,8 +956,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_str (f, _T("gfx_filter_keep_aspect"), aspects[p->gfx_filter_keep_aspect]); cfgfile_dwrite_str (f, _T("gfx_filter_autoscale"), autoscale[p->gfx_filter_autoscale]); cfgfile_dwrite (f, _T("gfx_filter_aspect_ratio"), _T("%d:%d"), - p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect >> 8) : -1, - p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect & 0xff) : -1); + p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect / ASPECTMULT) : -1, + p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect & (ASPECTMULT - 1)) : -1); cfgfile_dwrite (f, _T("gfx_luminance"), _T("%d"), p->gfx_luminance); cfgfile_dwrite (f, _T("gfx_contrast"), _T("%d"), p->gfx_contrast); cfgfile_dwrite (f, _T("gfx_gamma"), _T("%d"), p->gfx_gamma); @@ -1101,6 +1101,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool (f, _T("denise_noehb"), p->cs_denisenoehb); cfgfile_dwrite_bool (f, _T("agnus_bltbusybug"), p->cs_agnusbltbusybug); cfgfile_dwrite_bool (f, _T("ics_agnus"), p->cs_dipagnus); + cfgfile_dwrite (f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks); cfgfile_dwrite_bool (f, _T("fastmem_autoconfig"), p->fastmem_autoconfig); cfgfile_write (f, _T("fastmem_size"), _T("%d"), p->fastmem_size / 0x100000); @@ -2012,7 +2013,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) else if (v1 == 0 || v2 == 0) p->gfx_filter_aspect = 0; else - p->gfx_filter_aspect = (v1 << 8) | v2; + p->gfx_filter_aspect = v1 * ASPECTMULT + v2; } return 1; } @@ -2962,6 +2963,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH return 1; if (cfgfile_intval (option, value, _T("cachesize"), &p->cachesize, 1) + || cfgfile_intval (option, value, _T("chipset_hacks"), &p->cs_hacks, 1) || cfgfile_intval (option, value, _T("serial_stopbits"), &p->serial_stopbits, 1) || cfgfile_intval (option, value, _T("cpu060_revision"), &p->cpu060_revision, 1) || cfgfile_intval (option, value, _T("fpu_revision"), &p->fpu_revision, 1) diff --git a/custom.cpp b/custom.cpp index 91521216..e93b8908 100644 --- a/custom.cpp +++ b/custom.cpp @@ -478,8 +478,8 @@ void alloc_cycle_blitter (int hpos, uaecptr *ptr, int chnum) write_log (_T("buggy copper cycle conflict with blitter ch %c %08x <- %08x PC=%08x\n"), 'A' + (chnum - 1), *ptr, srcptr, m68k_getpc ()); warned--; } -// if (currprefs.cpu_model == 68000) -// *ptr = srcptr; + if ((currprefs.cs_hacks & 1) && currprefs.cpu_model == 68000) + *ptr = srcptr; } alloc_cycle (hpos, CYCLE_BLITTER); } @@ -1095,6 +1095,24 @@ STATIC_INLINE void maybe_first_bpl1dat (int hpos) } } +// emulate weird shifting glitch on right border if +// bitplane is lores max overscan and bitplane delay >= 8 +// not fully understood yet. +static void do_right_ddf_hack (int nr, int hpos) +{ + int shift; + + if (GET_RES_AGNUS (bplcon0) != RES_LORES) + return; + if (hpos < 0xd8) + return; + shift = (nr & 1) ? toscr_delay2 : toscr_delay1; + if (shift < 8) + return; + fetched[nr] >>= 7; +} + + STATIC_INLINE void fetch (int nr, int fm, int hpos) { if (nr < bplcon0_planes_limit) { @@ -1137,6 +1155,9 @@ STATIC_INLINE void fetch (int nr, int fm, int hpos) mod = bpl1mod; bplpt[nr] += mod; bplptx[nr] += mod; + + if ((currprefs.cs_hacks & 2) || 0) + do_right_ddf_hack (nr, hpos); } } else { // use whatever left in BPLxDAT if no DMA @@ -1152,6 +1173,14 @@ STATIC_INLINE void toscr_3_ecs (int nbits) int i; uae_u32 mask = 0xFFFF >> (16 - nbits); +#if 0 + int pos = thisline_decision.plfleft + out_offs * 16; + int checkpos = 220; + + if (pos < checkpos && pos + nbits >= checkpos) { + } +#endif + for (i = 0; i < toscr_nr_planes2; i += 2) { outword[i] <<= nbits; outword[i] |= (todisplay[i][0] >> (16 - nbits + delay1)) & mask; diff --git a/drawing.cpp b/drawing.cpp index 2e402f04..f94c7508 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -166,7 +166,7 @@ static uae_u8 all_zeros[MAX_PIXELS_PER_LINE]; uae_u8 *xlinebuffer; static int *amiga2aspect_line_map, *native2amiga_line_map; -static uae_u8 *row_map[MAX_VIDHEIGHT + 1]; +static uae_u8 *row_map[MAX_UAE_HEIGHT + 1]; static uae_u8 row_tmp[MAX_PIXELS_PER_LINE * 32 / 8]; static int max_drawn_amiga_line; @@ -692,10 +692,11 @@ where do we start drawing the playfield, where do we start drawing the right bor All of these are forced into the visible window (VISIBLE_LEFT_BORDER .. VISIBLE_RIGHT_BORDER). PLAYFIELD_START and PLAYFIELD_END are in window coordinates. */ static int playfield_start, playfield_end; -static int real_playfield_start, real_playfield_end; static int linetoscr_diw_start, linetoscr_diw_end; static int native_ddf_left, native_ddf_right; +#if 0 static bool can_have_bordersprite; +#endif static int pixels_offset; static int src_pixel, ham_src_pixel; @@ -746,15 +747,11 @@ static void pfield_init_linetoscr (void) playfield_start = linetoscr_diw_start; playfield_end = linetoscr_diw_end; -#if 0 + if (playfield_start < native_ddf_left) playfield_start = native_ddf_left; if (playfield_end > native_ddf_right) playfield_end = native_ddf_right; -#endif - unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; - ham_src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left); - unpainted = res_shift_from_window (unpainted); if (playfield_start < visible_left_border) playfield_start = visible_left_border; @@ -765,25 +762,28 @@ static void pfield_init_linetoscr (void) if (playfield_end > visible_right_border) playfield_end = visible_right_border; +#if 0 real_playfield_end = playfield_end; real_playfield_start = playfield_start; +#endif // Sprite hpos don't include DIW_DDF_OFFSET and can appear 1 lores pixel // before first bitplane pixel appears. - // This means "bordersprite" conditions is possible under OCS/ECS too. Argh! + // This means "bordersprite" condition is possible under OCS/ECS too. Argh! if (dip_for_drawing->nr_sprites) { /* bordersprite off or not supported: sprites are visible until diw_end */ - if (playfield_end < linetoscr_diw_end) + if (playfield_end < linetoscr_diw_end && hblank_right_stop > playfield_end) { playfield_end = linetoscr_diw_end; + } int end = coord_hw_to_window_x (dp_for_drawing->plfleft * 2); if (end < playfield_start && end > linetoscr_diw_start) { playfield_start = end; - can_have_bordersprite = true; + ;//can_have_bordersprite = true; } else { - can_have_bordersprite = false; - } + ;//can_have_bordersprite = false; + } } else { - can_have_bordersprite = dp_for_drawing->bordersprite_seen; + ;//can_have_bordersprite = dp_for_drawing->bordersprite_seen; } #ifdef AGA @@ -812,6 +812,10 @@ static void pfield_init_linetoscr (void) } #endif + unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; + ham_src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left); + unpainted = res_shift_from_window (unpainted); + if (sprite_first_x < sprite_last_x) { if (sprite_first_x < 0) sprite_first_x = 0; @@ -835,7 +839,7 @@ static void pfield_init_linetoscr (void) if (dip_for_drawing->nr_sprites == 0) return; - /* Must clear parts of apixels. */ + /* We need to clear parts of apixels. */ if (linetoscr_diw_start < native_ddf_left) { int size = res_shift_from_window (native_ddf_left - linetoscr_diw_start); linetoscr_diw_start = native_ddf_left; @@ -849,6 +853,29 @@ static void pfield_init_linetoscr (void) } } +// erase sprite graphics in pixdata if they were outside of ddf +static void pfield_erase_hborder_sprites (void) +{ + if (sprite_first_x < native_ddf_left) { + int size = res_shift_from_window (native_ddf_left - sprite_first_x); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, 0, size); + } + if (sprite_last_x > native_ddf_right) { + int pos = res_shift_from_window (native_ddf_right - native_ddf_left); + int size = res_shift_from_window (sprite_last_x - native_ddf_right); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size); + } +} + +// erase whole viewable area if upper or lower border +static void pfield_erase_vborder_sprites (void) +{ + uae_u8 c = colors_for_drawing.borderblank ? 0 : colors_for_drawing.acolors[0]; + int size = res_shift_from_window (linetoscr_diw_end - linetoscr_diw_start); + memset (pixdata.apixels + MAX_PIXELS_PER_LINE - size, c, size); +} + + STATIC_INLINE uae_u16 merge_2pixel16 (uae_u16 p1, uae_u16 p2) { uae_u16 v = ((((p1 >> xredcolor_s) & xredcolor_m) + ((p2 >> xredcolor_s) & xredcolor_m)) / 2) << xredcolor_s; @@ -1714,6 +1741,7 @@ STATIC_INLINE void draw_sprites_ecs (struct sprite_entry *e) } } +#if 0 /* clear possible bitplane data outside DIW area */ static void clear_bitplane_border (void) { @@ -1733,6 +1761,7 @@ static void clear_bitplane_border (void) memset (pixdata.apixels + pixels_offset + (real_playfield_end >> shift), v, len); } } +#endif /* emulate OCS/ECS only undocumented "SWIV" hardware feature */ static void weird_bitplane_fix (void) @@ -1865,9 +1894,9 @@ void init_row_map (void) { static uae_u8 *oldbufmem; static int oldheight, oldpitch; - int i, j; - if (gfxvidinfo.drawbuffer.height_allocated > MAX_VIDHEIGHT) { + + if (gfxvidinfo.drawbuffer.height_allocated > MAX_UAE_HEIGHT) { write_log (_T("Resolution too high, aborting\n")); abort (); } @@ -1875,14 +1904,14 @@ void init_row_map (void) oldheight == gfxvidinfo.drawbuffer.height_allocated && oldpitch == gfxvidinfo.drawbuffer.rowbytes) return; + j = oldheight == 0 ? MAX_UAE_HEIGHT : oldheight; + for (i = gfxvidinfo.drawbuffer.height_allocated; i < MAX_UAE_HEIGHT + 1 && i < j + 1; i++) + row_map[i] = row_tmp; + for (i = 0, j = 0; i < gfxvidinfo.drawbuffer.height_allocated; i++, j += gfxvidinfo.drawbuffer.rowbytes) + row_map[i] = gfxvidinfo.drawbuffer.bufmem + j; oldbufmem = gfxvidinfo.drawbuffer.bufmem; oldheight = gfxvidinfo.drawbuffer.height_allocated; oldpitch = gfxvidinfo.drawbuffer.rowbytes; - j = 0; - for (i = gfxvidinfo.drawbuffer.height_allocated; i < MAX_VIDHEIGHT + 1; i++) - row_map[i] = row_tmp; - for (i = 0; i < gfxvidinfo.drawbuffer.height_allocated; i++, j += gfxvidinfo.drawbuffer.rowbytes) - row_map[i] = gfxvidinfo.drawbuffer.bufmem + j; } void init_aspect_maps (void) @@ -2073,22 +2102,22 @@ static void pfield_expand_dp_bplconx (int regno, int v) regno -= 0x1000; switch (regno) { - case 0x100: + case 0x100: // BPLCON1 dp_for_drawing->bplcon0 = v; dp_for_drawing->bplres = GET_RES_DENISE (v); dp_for_drawing->nr_planes = GET_PLANES (v); dp_for_drawing->ham_seen = isham (v); break; - case 0x104: + case 0x104: // BPLCON2 dp_for_drawing->bplcon2 = v; break; #ifdef ECS_DENISE - case 0x106: + case 0x106: // BPLCON3 dp_for_drawing->bplcon3 = v; break; #endif #ifdef AGA - case 0x10c: + case 0x10c: // BPLCON4 dp_for_drawing->bplcon4 = v; break; #endif @@ -2295,8 +2324,6 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in if (dip_for_drawing->nr_sprites) { int i; - if (can_have_bordersprite) - clear_bitplane_border (); for (i = 0; i < dip_for_drawing->nr_sprites; i++) { #ifdef AGA @@ -2322,6 +2349,9 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in do_flush_line (vb, follow_ypos); } + if (dip_for_drawing->nr_sprites) + pfield_erase_hborder_sprites (); + } else if (border > 0) { // border > 0: top or bottom border bool dosprites = false; @@ -2333,7 +2363,7 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in dosprites = true; pfield_expand_dp_bplcon (); pfield_init_linetoscr (); - memset (pixdata.apixels + MAX_PIXELS_PER_LINE, colors_for_drawing.borderblank ? 0 : colors_for_drawing.acolors[0], MAX_PIXELS_PER_LINE); + pfield_erase_vborder_sprites (); } #endif @@ -2768,6 +2798,7 @@ static void draw_frame2 (struct vidbuffer *vbin, struct vidbuffer *vbout) hposblank = 0; pfield_draw_line (vbout, line, where2, amiga2aspect_line_map[i1 + 1]); } + #if 0 /* clear possible old garbage at the bottom if emulated area become smaller */ for (i = last_max_ypos; i < vb->outheight; i++) { diff --git a/gayle.cpp b/gayle.cpp index ee5b7c17..70580f30 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -192,6 +192,7 @@ struct ide_hdf int data_size; int data_multi; int direction; // 0 = read, 1 = write + bool intdrq; int lba48; uae_u8 multiple_mode; int irq_delay; @@ -434,18 +435,27 @@ static uae_u8 read_gayle_cs (void) static void ide_interrupt (struct ide_hdf *ide) { + ide->regs.ide_status |= IDE_STATUS_BSY; + ide->regs.ide_status &= ~IDE_STATUS_DRQ; ide->irq_delay = 2; } static void ide_fast_interrupt (struct ide_hdf *ide) { + ide->regs.ide_status |= IDE_STATUS_BSY; + ide->regs.ide_status &= ~IDE_STATUS_DRQ; ide->irq_delay = 1; } static void ide_interrupt_do (struct ide_hdf *ide) { - ide->regs.ide_status &= ~IDE_STATUS_BSY; - if (ide->direction) + uae_u8 os = ide->regs.ide_status; + ide->regs.ide_status &= ~IDE_STATUS_DRQ; + if (ide->intdrq) ide->regs.ide_status |= IDE_STATUS_DRQ; + ide->regs.ide_status &= ~IDE_STATUS_BSY; + if (IDE_LOG > 1) + write_log (_T("IDE INT %02X -> %02X\n"), os, ide->regs.ide_status); + ide->intdrq = false; ide->irq_delay = 0; if (ide->regs.ide_devcon & 2) return; @@ -470,9 +480,9 @@ static void ide_data_ready (struct ide_hdf *ide) { memset (ide->secbuf, 0, ide->blocksize); ide->data_offset = 0; - ide->regs.ide_status |= IDE_STATUS_DRQ; ide->data_size = ide->blocksize; ide->data_multi = 1; + ide->intdrq = true; ide_interrupt (ide); } @@ -739,16 +749,25 @@ static void check_maxtransfer (struct ide_hdf *ide, int state) } } -static void process_rw_command (struct ide_hdf *ide) +static void setdrq (struct ide_hdf *ide) +{ + ide->regs.ide_status |= IDE_STATUS_DRQ; + ide->regs.ide_status &= ~IDE_STATUS_BSY; +} +static void setbsy (struct ide_hdf *ide) { ide->regs.ide_status |= IDE_STATUS_BSY; ide->regs.ide_status &= ~IDE_STATUS_DRQ; +} + +static void process_rw_command (struct ide_hdf *ide) +{ + setbsy (ide); write_comm_pipe_u32 (&requests, ide->num, 1); } static void process_packet_command (struct ide_hdf *ide) { - ide->regs.ide_status |= IDE_STATUS_BSY; - ide->regs.ide_status &= ~IDE_STATUS_DRQ; + setbsy (ide); write_comm_pipe_u32 (&requests, ide->num | 0x80, 1); } @@ -769,7 +788,7 @@ static bool atapi_set_size (struct ide_hdf *ide) if (!size) { ide->packet_state = 0; ide->packet_transfer_size = 0; - return true; + return false; } if (ide->packet_state == 2) { if (size > ide->packet_data_size) @@ -782,10 +801,9 @@ static bool atapi_set_size (struct ide_hdf *ide) } else { ide->packet_transfer_size = 12; } - ide->regs.ide_status = IDE_STATUS_DRQ; if (IDE_LOG > 1) write_log (_T("ATAPI data transfer %d/%d bytes\n"), ide->packet_transfer_size, ide->data_size); - return false; + return true; } static void atapi_packet (struct ide_hdf *ide) @@ -802,7 +820,8 @@ static void atapi_packet (struct ide_hdf *ide) ide->data_offset = 0; ide->regs.ide_nsector = ATAPI_CD; ide->regs.ide_error = 0; - atapi_set_size (ide); + if (atapi_set_size (ide)) + setdrq (ide); } static void do_packet_command (struct ide_hdf *ide) @@ -842,7 +861,8 @@ static void do_packet_command (struct ide_hdf *ide) ide->data_size = ide->scsi->data_len; } ide->packet_state = 2; // data phase - atapi_set_size (ide); + if (atapi_set_size (ide)) + ide->intdrq = true; } static void do_process_packet_command (struct ide_hdf *ide) @@ -853,9 +873,12 @@ static void do_process_packet_command (struct ide_hdf *ide) ide->packet_data_offset += ide->packet_transfer_size; if (!ide->direction) { // data still remaining, next transfer - atapi_set_size (ide); + if (atapi_set_size (ide)) + ide->intdrq = true; } else { if (atapi_set_size (ide)) { + ide->intdrq = true; + } else { memcpy (&ide->scsi->buffer, ide->secbuf, ide->data_size); ide->scsi->data_len = ide->data_size; scsi_emulate_cmd (ide->scsi); @@ -864,7 +887,7 @@ static void do_process_packet_command (struct ide_hdf *ide) } } } - ide->irq_delay = 1; + ide_fast_interrupt (ide); } static void do_process_rw_command (struct ide_hdf *ide) @@ -900,17 +923,15 @@ static void do_process_rw_command (struct ide_hdf *ide) if (IDE_LOG > 1) write_log (_T("IDE%d read, read %d bytes\n"), ide->num, nsec * ide->blocksize); } - ide->regs.ide_status |= IDE_STATUS_DRQ; + ide->intdrq = true; last = dec_nsec (ide, nsec) == 0; put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec); - if (last) { - if (ide->direction) { - if (IDE_LOG > 1) - write_log (_T("IDE%d write finished\n"), ide->num); - ide->regs.ide_status &= ~IDE_STATUS_DRQ; - } + if (last && ide->direction) { + ide->intdrq = false; + if (IDE_LOG > 1) + write_log (_T("IDE%d write finished\n"), ide->num); } - ide->irq_delay = 1; + ide_fast_interrupt (ide); } static void ide_read_sectors (struct ide_hdf *ide, int flags) @@ -936,7 +957,7 @@ static void ide_read_sectors (struct ide_hdf *ide, int flags) ide->data_offset = 0; ide->data_size = nsec * ide->blocksize; ide->direction = 0; - + // read start: preload sector(s), then trigger interrupt. process_rw_command (ide); } @@ -972,11 +993,9 @@ static void ide_write_sectors (struct ide_hdf *ide, int flags) ide->data_offset = 0; ide->data_size = nsec * ide->blocksize; ide->direction = 1; - - ide->regs.ide_status |= IDE_STATUS_BSY; - ide->regs.ide_status &= ~IDE_STATUS_DRQ; - - ide_fast_interrupt (ide); + // write start: set DRQ and clear BSY. No interrupt. + ide->regs.ide_status |= IDE_STATUS_DRQ; + ide->regs.ide_status &= ~IDE_STATUS_BSY; } static void ide_do_command (struct ide_hdf *ide, uae_u8 cmd) @@ -1065,7 +1084,7 @@ static uae_u16 ide_get_data (struct ide_hdf *ide) write_log (_T("IDE%d DATA read\n"), ide->num); if (ide->data_size == 0) { if (IDE_LOG > 0) - write_log (_T("IDE%d DATA read without DRQ!? PC=%08X\n"), ide->num, m68k_getpc ()); + write_log (_T("IDE%d DATA but no data left!? %02X PC=%08X\n"), ide->num, ide->regs.ide_status, m68k_getpc ()); if (!isdrive (ide)) return 0xffff; return 0; @@ -1103,6 +1122,9 @@ static uae_u16 ide_get_data (struct ide_hdf *ide) } } if (ide->data_size == 0) { + if (!(ide->regs.ide_status & IDE_STATUS_DRQ)) { + write_log (_T("IDE%d read finished but DRQ was not active?\n"), ide->num); + } ide->regs.ide_status &= ~IDE_STATUS_DRQ; if (IDE_LOG > 1) write_log (_T("IDE%d read finished\n"), ide->num); @@ -1119,7 +1141,7 @@ static void ide_put_data (struct ide_hdf *ide, uae_u16 v) write_log (_T("IDE%d DATA write %04x %d/%d\n"), ide->num, v, ide->data_offset, ide->data_size); if (ide->data_size == 0) { if (IDE_LOG > 0) - write_log (_T("IDE%d DATA write without DRQ!? PC=%08X\n"), ide->num, m68k_getpc ()); + write_log (_T("IDE%d DATA write without request!? %02X PC=%08X\n"), ide->num, ide->regs.ide_status, m68k_getpc ()); return; } ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] = v & 0xff; diff --git a/genlinetoscr.cpp b/genlinetoscr.cpp index c33e8be0..63ce40b3 100644 --- a/genlinetoscr.cpp +++ b/genlinetoscr.cpp @@ -137,13 +137,13 @@ static void out_linetoscr_do_srcpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_ static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode, int spr) { if (aga && cmode == CMODE_HAM) { - outln ( " dpix_val = CONVERT_RGB (ham_linebuf[spix]);"); - if (spr) - outln ( " sprpix_val = dpix_val;"); + outln ( " spix_val = ham_linebuf[spix];"); + outln ( " dpix_val = CONVERT_RGB (spix_val);"); } else if (cmode == CMODE_HAM) { - outln ( " dpix_val = xcolors[ham_linebuf[spix]];"); + outln ( " spix_val = ham_linebuf[spix];"); + outln ( " dpix_val = xcolors[spix_val];"); if (spr) - outln ( " sprpix_val = dpix_val;"); + outln ( " sprpix_val = pixdata.apixels[spix];"); } else if (aga && cmode == CMODE_DUALPF) { outln ( " {"); outln ( " uae_u8 val = lookup[spix_val];"); diff --git a/include/drawing.h b/include/drawing.h index f71b7556..39af628c 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -177,10 +177,8 @@ struct color_change { /* 440 rather than 880, since sprites are always lores. */ #ifdef UAE_MINI #define MAX_PIXELS_PER_LINE 880 -#define MAX_VIDHEIGHT 800 #else #define MAX_PIXELS_PER_LINE 1760 -#define MAX_VIDHEIGHT 2048 #endif /* No divisors for MAX_PIXELS_PER_LINE; we support AGA and SHRES sprites */ diff --git a/include/options.h b/include/options.h index fb3b4e40..da7df1c7 100644 --- a/include/options.h +++ b/include/options.h @@ -101,6 +101,7 @@ struct floppyslot bool forcedwriteprotect; }; +#define ASPECTMULT 1024 #define WH_NATIVE 1 struct wh { int x, y; @@ -409,6 +410,7 @@ struct uae_prefs { bool cs_denisenoehb; bool cs_dipagnus; bool cs_agnusbltbusybug; + int cs_hacks; TCHAR romfile[MAX_DPATH]; TCHAR romident[256]; diff --git a/main.cpp b/main.cpp index 3519c7df..e20007df 100644 --- a/main.cpp +++ b/main.cpp @@ -150,10 +150,10 @@ static void fixup_prefs_dim2 (struct wh *wh) wh->width = 160; if (wh->height < 128) wh->height = 128; - if (wh->width > 3072) - wh->width = 3072; - if (wh->height > 2048) - wh->height = 2048; + if (wh->width > MAX_UAE_WIDTH) + wh->width = MAX_UAE_WIDTH; + if (wh->height > MAX_UAE_HEIGHT) + wh->height = MAX_UAE_HEIGHT; } void fixup_prefs_dimensions (struct uae_prefs *prefs) diff --git a/od-win32/sysconfig.h b/od-win32/sysconfig.h index a2efff68..bb4054a1 100644 --- a/od-win32/sysconfig.h +++ b/od-win32/sysconfig.h @@ -17,6 +17,9 @@ #define WINDOWS #define ZLIB_WINAPI +#define MAX_UAE_WIDTH 8192 +#define MAX_UAE_HEIGHT 8192 + #ifndef UAE_MINI #define DEBUGGER diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 92d793d0..079a3e29 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -3121,8 +3121,8 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) cfgfile_target_dwrite_bool (f, _T("rtg_scale_center"), p->win32_rtgscalemode == 2); cfgfile_target_dwrite_bool (f, _T("rtg_scale_allow"), p->win32_rtgallowscaling); cfgfile_target_dwrite (f, _T("rtg_scale_aspect_ratio"), _T("%d:%d"), - p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio >> 8) : -1, - p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio & 0xff) : -1); + p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio / ASPECTMULT) : -1, + p->win32_rtgscaleaspectratio >= 0 ? (p->win32_rtgscaleaspectratio & (ASPECTMULT - 1)) : -1); if (p->win32_rtgvblankrate <= 0) cfgfile_target_dwrite_str (f, _T("rtg_vblank"), p->win32_rtgvblankrate == -1 ? _T("real") : (p->win32_rtgvblankrate == -2 ? _T("disabled") : _T("chipset"))); else @@ -3339,7 +3339,7 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR * else if (v1 == 0 || v2 == 0) p->win32_rtgscaleaspectratio = 0; else - p->win32_rtgscaleaspectratio = (v1 << 8) | v2; + p->win32_rtgscaleaspectratio = v1 * ASPECTMULT + v2; } return 1; } diff --git a/od-win32/win32.h b/od-win32/win32.h index e6110f37..558b66ed 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,11 +19,11 @@ #define LANG_DLL 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("16") +#define WINUAEBETA _T("17") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2013, 4, 13) +#define WINUAEDATE MAKEBD(2013, 4, 19) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 4cf35cd5..0ace59df 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -200,7 +200,7 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height srcratio = 4.0f / 3.0f; if (currprefs.gfx_filter_aspect > 0) { - dstratio = (currprefs.gfx_filter_aspect >> 8) * 1.0f / (currprefs.gfx_filter_aspect & 0xff); + dstratio = (currprefs.gfx_filter_aspect / ASPECTMULT) * 1.0f / (currprefs.gfx_filter_aspect & (ASPECTMULT - 1)); } else if (currprefs.gfx_filter_aspect < 0) { if (isfullscreen () && deskw > 0 && deskh > 0) dstratio = 1.0f * deskw / deskh; diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 3b328197..a9ce287d 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -260,7 +260,7 @@ int default_freq = 60; HWND hStatusWnd = NULL; -static uae_u8 scrlinebuf[4096 * 4]; /* this is too large, but let's rather play on the safe side here */ +static uae_u8 scrlinebuf[MAX_UAE_WIDTH * 4]; /* this is too large, but let's rather play on the safe side here */ static struct MultiDisplay *getdisplay2 (struct uae_prefs *p, int index) { @@ -1196,15 +1196,15 @@ static void DX_Blit96 (int x, int y, int w, int h) SetRect (&sr, 0, 0, picasso96_state.Width, picasso96_state.Height); if (currprefs.win32_rtgscaleaspectratio < 0) { // automatic - srcratio = picasso96_state.Width * 256 / picasso96_state.Height; - dstratio = srcwidth * 256 / srcheight; + srcratio = picasso96_state.Width * ASPECTMULT / picasso96_state.Height; + dstratio = srcwidth * ASPECTMULT / srcheight; } else if (currprefs.win32_rtgscaleaspectratio == 0) { // none srcratio = dstratio = 0; } else { // manual - srcratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff); - dstratio = srcwidth * 256 / srcheight; + srcratio = currprefs.win32_rtgscaleaspectratio; + dstratio = srcwidth * ASPECTMULT / srcheight; } if (srcratio == dstratio) { SetRect (&dr, 0, 0, srcwidth, srcheight); @@ -1266,15 +1266,15 @@ void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_hei } else { if (currprefs.win32_rtgscaleaspectratio < 0) { // automatic - srcratio = srcwidth * 256 / srcheight; - dstratio = currentmode->native_width * 256 / currentmode->native_height; + srcratio = srcwidth * ASPECTMULT / srcheight; + dstratio = currentmode->native_width * ASPECTMULT / currentmode->native_height; } else if (currprefs.win32_rtgscaleaspectratio == 0) { // none srcratio = dstratio = 0; } else { // manual - dstratio = (currprefs.win32_rtgscaleaspectratio >> 8) * 256 / (currprefs.win32_rtgscaleaspectratio & 0xff); - srcratio = srcwidth * 256 / srcheight; + dstratio = currprefs.win32_rtgscaleaspectratio; + srcratio = srcwidth * ASPECTMULT / srcheight; } if (srcratio == dstratio) { diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 0c1dd18b..4961b562 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -139,6 +139,36 @@ static TCHAR stored_path[MAX_DPATH]; static int gui_size_changed; static int filterstackpos = 0; +static const int defaultaspectratios[] = { + 4, 3, 16, 10, 15, 9, 27, 16, 128, 75, 16, 9, 256, 135, 21, 9, 16, 3, + -1 +}; +static int getaspectratioindex (int ar) +{ + for (int i = 0; defaultaspectratios[i] >= 0; i += 2) { + if (ar == defaultaspectratios[i + 0] * 1024 + defaultaspectratios[i + 1]) + return i / 2; + } + return 0; +} +static int getaspectratio (int index) +{ + for (int i = 0; defaultaspectratios[i] >= 0; i += 2) { + if (i == index * 2) { + return defaultaspectratios[i + 0] * 1024 + defaultaspectratios[i + 1]; + } + } + return 0; +} +static void addaspectratios (HWND hDlg, int id) +{ + for (int i = 0; defaultaspectratios[i] >= 0; i += 2) { + TCHAR tmp[100]; + _stprintf (tmp, _T("%d:%d (%.2f)"), defaultaspectratios[i + 0], defaultaspectratios[i + 1], (double)defaultaspectratios[i + 0] / defaultaspectratios[i + 1]); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)tmp); + } +} + #define Error(x) MessageBox (NULL, (x), _T("WinUAE Error"), MB_OK) wstring WIN32GUI_LoadUIString (DWORD id) @@ -5958,15 +5988,17 @@ static void init_display_mode (HWND hDlg) SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_RESETCONTENT, 0, 0); cnt = 0; gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1; - for (i = 0; md->DisplayModes[i].depth >= 0; i++) { - if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx == md->DisplayModes[index].residx) { - TCHAR tmp[64]; - _stprintf (tmp, _T("%d"), md->DisplayModes[i].depth * 8); - SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp); - if (md->DisplayModes[i].depth == d) - SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_SETCURSEL, cnt, 0); - gui_display_depths[cnt] = md->DisplayModes[i].depth; - cnt++; + if (index >= 0) { + for (i = 0; md->DisplayModes[i].depth >= 0; i++) { + if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx == md->DisplayModes[index].residx) { + TCHAR tmp[64]; + _stprintf (tmp, _T("%d"), md->DisplayModes[i].depth * 8); + SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp); + if (md->DisplayModes[i].depth == d) + SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_SETCURSEL, cnt, 0); + gui_display_depths[cnt] = md->DisplayModes[i].depth; + cnt++; + } } } init_frequency_combo (hDlg, index); @@ -6374,7 +6406,9 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l struct MultiDisplay *md = getdisplay (&workprefs); LRESULT posn1 = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0); LRESULT posn2 = SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_GETCURSEL, 0, 0); - if (posn1 != CB_ERR && posn2 != CB_ERR) { + if (posn1 != CB_ERR) { + if (posn2 == CB_ERR) + posn2 = 0; workprefs.gfx_size_fs.special = 0; for (dmode = 0; md->DisplayModes[dmode].depth >= 0; dmode++) { if (md->DisplayModes[dmode].residx == posn1) @@ -7183,11 +7217,8 @@ static void values_to_memorydlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_SETCURSEL, (workprefs.win32_rtgscaleaspectratio == 0) ? 0 : - (workprefs.win32_rtgscaleaspectratio == 4 * 256 + 3) ? 2 : - (workprefs.win32_rtgscaleaspectratio == 5 * 256 + 4) ? 3 : - (workprefs.win32_rtgscaleaspectratio == 15 * 256 + 9) ? 4 : - (workprefs.win32_rtgscaleaspectratio == 16 * 256 + 9) ? 5 : - (workprefs.win32_rtgscaleaspectratio == 16 * 256 + 10) ? 6 : 1, 0); + (workprefs.win32_rtgscaleaspectratio == 1) ? 1 : + getaspectratioindex (workprefs.win32_rtgscaleaspectratio) + 2, 0); mem_size = 0; switch (workprefs.mbresmem_low_size) { @@ -7384,11 +7415,7 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)tmp); WIN32GUI_LoadUIString (IDS_AUTOMATIC, tmp, sizeof tmp / sizeof (TCHAR)); SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)tmp); - SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)_T("4:3")); - SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)_T("5:4")); - SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)_T("15:9")); - SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)_T("16:9")); - SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_ADDSTRING, 0, (LPARAM)_T("16:10")); + addaspectratios (hDlg, IDC_RTG_SCALE_ASPECTRATIO); SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)_T("Chipset")); SendDlgItemMessage (hDlg, IDC_RTG_VBLANKRATE, CB_ADDSTRING, 0, (LPARAM)_T("Default")); @@ -7488,18 +7515,10 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP if (v != CB_ERR) { if (v == 0) workprefs.win32_rtgscaleaspectratio = 0; - if (v == 1) + else if (v == 1) workprefs.win32_rtgscaleaspectratio = -1; - if (v == 2) - workprefs.win32_rtgscaleaspectratio = 4 * 256 + 3; - if (v == 3) - workprefs.win32_rtgscaleaspectratio = 5 * 256 + 4; - if (v == 4) - workprefs.win32_rtgscaleaspectratio = 15 * 256 + 9; - if (v == 5) - workprefs.win32_rtgscaleaspectratio = 16 * 256 + 9; - if (v == 6) - workprefs.win32_rtgscaleaspectratio = 16 * 256 + 10; + else if (v >= 2) + workprefs.win32_rtgscaleaspectratio = getaspectratio (v - 2); } break; case IDC_RTG_Z2Z3: @@ -13811,11 +13830,7 @@ static void values_to_hw3ddlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_SETCURSEL, (workprefs.gfx_filter_aspect == 0) ? 0 : (workprefs.gfx_filter_aspect < 0) ? 1 : - (workprefs.gfx_filter_aspect == 4 * 256 + 3) ? 2 : - (workprefs.gfx_filter_aspect == 5 * 256 + 4) ? 3 : - (workprefs.gfx_filter_aspect == 15 * 256 + 9) ? 4 : - (workprefs.gfx_filter_aspect == 16 * 256 + 9) ? 5 : - (workprefs.gfx_filter_aspect == 16 * 256 + 10) ? 6 : 0, 0); + getaspectratioindex (workprefs.gfx_filter_aspect) + 2, 0); CheckDlgButton (hDlg, IDC_FILTERKEEPASPECT, workprefs.gfx_filter_keep_aspect); CheckDlgButton (hDlg, IDC_FILTERKEEPAUTOSCALEASPECT, workprefs.gfx_filter_keep_autoscale_aspect != 0); @@ -14259,11 +14274,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)tmp); WIN32GUI_LoadUIString (IDS_AUTOMATIC, tmp, sizeof tmp / sizeof (TCHAR)); SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)tmp); - SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)_T("4:3")); - SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)_T("5:4")); - SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)_T("15:9")); - SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)_T("16:9")); - SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)_T("16:10")); + addaspectratios (hDlg, IDC_FILTERASPECT); SendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_RESETCONTENT, 0, 0); WIN32GUI_LoadUIString (IDS_DISABLED, tmp, sizeof tmp / sizeof (TCHAR)); @@ -14405,18 +14416,10 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (v != CB_ERR) { if (v == 0) v2 = 0; - if (v == 1) + else if (v == 1) v2 = -1; - if (v == 2) - v2 = 4 * 256 + 3; - if (v == 3) - v2 = 5 * 256 + 4; - if (v == 4) - v2 = 15 * 256 + 9; - if (v == 5) - v2 = 16 * 256 + 9; - if (v == 6) - v2 = 16 * 256 + 10; + else if (v >= 2) + v2 = getaspectratio (v - 2); } currprefs.gfx_filter_aspect = workprefs.gfx_filter_aspect = v2; updatedisplayarea (); diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 4a29aa35..78416206 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,21 @@ - restore only single input target to default. +Beta 17: + +- One more IDE emulation fix, bogus extra write interrupt removed (I think this was accidentally introduced in some recent + update). For some reason all tested drivers seemed to ignore it but it also could have caused data corruption in worst case. +- Added support for very large resolutions (NV Surround/AMD Eyefinity), max is now 8192x8192 (from 3072x2048) + (I now have 3xVG248QE in portrait surround, 2d lightboost mode, GTX680 SLI. Debezeling still to do..) +- Display panel GUI didn't accept new selected resolution if previously loaded config had non-existing resolution. +- B16 didn't fix all glitches, yet another fix attempt. (Mindriot/Andromeda and more) +- Fixed sprite priorities in HAM mode (Thanks to Paradroid for this and right edge overscan test case) +- Added some uncommon aspect ratios to GUI aspect ratio select menus. +- Added new config entry "chipset_hacks" that is used to enable emulation of not fully known chipset features or bugs. + Bit 0 = emulate COPJMP/Blitter cycle conflict (Blitter DMA channel gets loaded with Copper address) + Bit 1 = emulate strange right edge overscan display shift if lores bitplane and scroll value is greater than 7. + DO NOT enable in your default configuration, these are not fully emulated and can and will break other programs! + Beta 16: This beta should fix all strange display glitches introduced in previous 2.6 betas. -- 2.47.3