From: Toni Wilen Date: Wed, 15 Feb 2012 18:29:13 +0000 (+0200) Subject: 2400b17 X-Git-Tag: 2400~12 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c001faaff68507f8996985f2d3d125ffcc9afbc6;p=francis%2Fwinuae.git 2400b17 --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 5fcf2d06..7f9b4124 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -1010,6 +1010,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool (f, L"agnus_bltbusybug", p->cs_agnusbltbusybug); cfgfile_dwrite_bool (f, L"ics_agnus", p->cs_dipagnus); + cfgfile_dwrite_bool (f, L"autoconfig", p->autoconfig); cfgfile_write (f, L"fastmem_size", L"%d", p->fastmem_size / 0x100000); cfgfile_dwrite (f, L"fastmem2_size", L"%d", p->fastmem2_size / 0x100000); cfgfile_write (f, L"a3000mem_size", L"%d", p->mbresmem_low_size / 0x100000); @@ -2261,6 +2262,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_yesno (option, value, L"denise_noehb", &p->cs_denisenoehb) || cfgfile_yesno (option, value, L"ics_agnus", &p->cs_dipagnus) || cfgfile_yesno (option, value, L"agnus_bltbusybug", &p->cs_agnusbltbusybug) + || cfgfile_yesno (option, value, L"autoconfig", &p->autoconfig) || cfgfile_yesno (option, value, L"kickshifter", &p->kickshifter) || cfgfile_yesno (option, value, L"ntsc", &p->ntscmode) @@ -2664,6 +2666,10 @@ invalid_fs: int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int type) { + if (!_tcscmp (option, L"debug")) { + write_log (L"CONFIG DEBUG: '%s'\n", value); + return 1; + } if (!_tcscmp (option, L"config_hardware")) return 1; if (!_tcscmp (option, L"config_host")) @@ -3981,8 +3987,8 @@ void default_prefs (struct uae_prefs *p, int type) p->gfx_autoresolution_minh = 0; p->color_mode = 2; p->gfx_blackerthanblack = 0; - p->gfx_apmode[0].gfx_backbuffers = 1; - p->gfx_apmode[1].gfx_backbuffers = 1; + p->gfx_apmode[0].gfx_backbuffers = 2; + p->gfx_apmode[1].gfx_backbuffers = 2; p->immediate_blits = 0; p->waiting_blits = 0; @@ -4091,6 +4097,7 @@ void default_prefs (struct uae_prefs *p, int type) p->custom_memory_sizes[0] = 0; p->custom_memory_addrs[1] = 0; p->custom_memory_sizes[1] = 0; + p->autoconfig = true; p->nr_floppies = 2; p->floppy_read_only = false; @@ -4414,11 +4421,10 @@ static int bip_a4000t (struct uae_prefs *p, int config, int compa, int romcheck) static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck) { - int roms[4]; + int roms[2]; roms[0] = 24; - roms[1] = 23; - roms[2] = -1; + roms[1] = -1; p->chipset_mask = 0; p->bogomem_size = 0; p->sound_filter = FILTER_SOUND_ON; @@ -4754,20 +4760,27 @@ int built_in_chipset_prefs (struct uae_prefs *p) p->cs_a1000ram = 0; p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 0; - p->cs_cdtvcd = p->cs_cdtvram = 0; + p->cs_cdtvcd = p->cs_cdtvram = p->cs_cdtvscsi = 0; + p->cs_a2091 = p->cs_a4091 = 0; p->cs_fatgaryrev = -1; p->cs_ide = 0; p->cs_ramseyrev = -1; p->cs_deniserev = -1; p->cs_agnusrev = -1; + p->cs_denisenoehb = 0; + p->cs_dipagnus = 0; + p->cs_agnusbltbusybug = 0; p->cs_mbdmac = 0; - p->cs_a2091 = 0; p->cs_pcmcia = 0; p->cs_ksmirror_e0 = 1; + p->cs_ksmirror_a8 = 0; p->cs_ciaoverlay = 1; p->cs_ciaatod = 0; + p->cs_rtc = 1; + p->cs_rtc_adjust_mode = p->cs_rtc_adjust = 0; p->cs_df0idhw = 1; p->cs_resetwarning = 1; + p->cs_slowmemisfast = 0; switch (p->cs_compatible) { diff --git a/custom.cpp b/custom.cpp index 6f7e1308..c860d5b1 100644 --- a/custom.cpp +++ b/custom.cpp @@ -54,6 +54,10 @@ #include "ncr_scsi.h" #include "blkdev.h" #include "sampler.h" +#include "clipboard.h" +#ifdef RETROPLATFORM +#include "rp.h" +#endif #define CUSTOM_DEBUG 0 #define SPRITE_DEBUG 0 @@ -140,11 +144,15 @@ static int lof_current; // what display device thinks static int lol; static int next_lineno, prev_lineno; static enum nln_how nextline_how; -static int lof_changed = 0, interlace_changed = 0; +static int lof_changed = 0, lof_changing = 0, interlace_changed = 0; static int scandoubled_line; static bool vsync_rendered, frame_shown; static int jitcount = 0; +#define LOF_TOGGLES_NEEDED 4 +#define NLACE_CNT_NEEDED 50 +static int lof_togglecnt_lace, lof_togglecnt_nlace, lof_previous, nlace_cnt; + /* Stupid genlock-detection prevention hack. * We should stop calling vsync_handler() and * hstop_handler() completely but it is not @@ -1831,7 +1839,7 @@ static void start_bpl_dma (int hpos, int hstart) if (first_bpl_vpos < 0) first_bpl_vpos = vpos; - if (doflickerfix () && interlace_seen && !scandoubled_line) { + if (doflickerfix () && interlace_seen > 0 && !scandoubled_line) { int i; for (i = 0; i < 8; i++) { prevbpl[lof_current][vpos][i] = bplptx[i]; @@ -2777,9 +2785,39 @@ int current_maxvpos (void) return maxvpos + (lof_store ? 1 : 0); } +static void checklacecount (bool lace) +{ + if (!interlace_changed) { + if (nlace_cnt >= NLACE_CNT_NEEDED && lace) { + lof_togglecnt_lace = LOF_TOGGLES_NEEDED; + lof_togglecnt_nlace = 0; + write_log (L"immediate lace\n"); + nlace_cnt = 0; + } else if (nlace_cnt <= -NLACE_CNT_NEEDED && !lace) { + lof_togglecnt_nlace = LOF_TOGGLES_NEEDED; + lof_togglecnt_lace = 0; + write_log (L"immediate nlace\n"); + nlace_cnt = 0; + } + } + if (lace) { + if (nlace_cnt > 0) + nlace_cnt = 0; + nlace_cnt--; + if (nlace_cnt < -NLACE_CNT_NEEDED * 2) + nlace_cnt = -NLACE_CNT_NEEDED * 2; + } else if (!lace) { + if (nlace_cnt < 0) + nlace_cnt = 0; + nlace_cnt++; + if (nlace_cnt > NLACE_CNT_NEEDED * 2) + nlace_cnt = NLACE_CNT_NEEDED * 2; + } +} + struct chipset_refresh *get_chipset_refresh (void) { - int islace = (bplcon0 & 4) ? 1 : 0; + int islace = interlace_seen ? 1 : 0; int isntsc = (beamcon0 & 0x20) ? 0 : 1; if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) @@ -2806,7 +2844,7 @@ static bool changed_chipset_refresh (void) static void compute_framesync (void) { - int islace = (bplcon0 & 4) ? 1 : 0; + int islace = interlace_seen ? 1 : 0; int isntsc = (beamcon0 & 0x20) ? 0 : 1; bool found = false; @@ -2856,7 +2894,7 @@ static void compute_framesync (void) changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz; } stored_chipset_refresh = cr; - interlace_changed = islace; + interlace_changed = 0; if (beamcon0 & 0x80) { int res = GET_RES_AGNUS (bplcon0); @@ -2908,14 +2946,15 @@ static void compute_framesync (void) compute_vsynctime (); - write_log (L"%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d) IDX=%d\n", + write_log (L"%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d) IDX=%d (%s)\n", isntsc ? L"NTSC" : L"PAL", islace ? L" laced" : L"", doublescan > 0 ? L" dblscan" : L"", vblank_hz, vblank_hz * maxvpos_nom, maxhpos, maxvpos, lof_store ? 1 : 0, - cr ? cr->index : -1 - ); + cr ? cr->index : -1, + cr != NULL && cr->label != NULL ? cr->label : L"" + ); config_changed = 1; } @@ -2940,7 +2979,7 @@ void init_hz (bool fullinit) } beamcon0 = new_beamcon0; isntsc = (beamcon0 & 0x20) ? 0 : 1; - islace = (bplcon0 & 4) ? 1 : 0; + islace = (interlace_seen) ? 1 : 0; if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) isntsc = currprefs.ntscmode ? 1 : 0; if (!isntsc) { @@ -3249,15 +3288,15 @@ static void VPOSW (uae_u16 v) write_log (L"VPOSW %04X PC=%08x\n", v, M68K_GETPC); #endif if (lof_store != ((v & 0x8000) ? 1 : 0)) { - lof_changed = 1; lof_store = (v & 0x8000) ? 1 : 0; + lof_changing = lof_store ? 1 : -1; } if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { lol = (v & 0x0080) ? 1 : 0; if (!islinetoggle ()) lol = 0; } - if (lof_changed) + if (lof_changing) return; vpos &= 0x00ff; v &= 7; @@ -3805,6 +3844,9 @@ static void BPLCON0 (int hpos, uae_u16 v) hpos_previous = hpos; } + if ((bplcon0 & 4) != (v & 4)) + checklacecount ((v & 4) != 0); + bplcon0 = v; bpldmainitdelay (hpos); @@ -5291,10 +5333,12 @@ static void vsync_handler_pre (void) timehack_alive--; inputdevice_vsync (); - filesys_vsync (); - sampler_vsync (); + clipboard_vsync (); +#ifdef RETROPLATFORM + rp_vsync (); +#endif if (!vsync_rendered) { vsync_handle_redraw (lof_store, lof_changed); @@ -5303,7 +5347,7 @@ static void vsync_handler_pre (void) render_screen (); if (!frame_shown) { frame_shown = true; - show_screen_maybe (true); + show_screen_maybe (isvsync_chipset () >= 0); } } } @@ -5314,6 +5358,7 @@ static void vsync_handler_pre (void) vblank_hz_state = 1; vsync_handle_check (); + checklacecount ((bplcon0 & 4) != 0); } // emulated hardware vsync @@ -5372,9 +5417,26 @@ static void vsync_handler_post (void) write_log (L"vblank interrupt not cleared\n"); #endif DISK_vsync (); + if (bplcon0 & 4) lof_store = lof_store ? 0 : 1; lof_current = lof_store; + if (lof_togglecnt_lace >= LOF_TOGGLES_NEEDED) { + interlace_changed = notice_interlace_seen (true); + } else if (lof_togglecnt_nlace >= LOF_TOGGLES_NEEDED) { + interlace_changed = notice_interlace_seen (false); + if (interlace_changed) { + if (currprefs.gfx_scandoubler && currprefs.gfx_vresolution) + notice_screen_contents_lost (); + } + } + if (lof_changing) { + // still same? Trigger change now. + if ((!lof_store && lof_changing < 0) || (lof_store && lof_changing > 0)) { + lof_changed = 1; + } + lof_changing = 0; + } if (debug_copper) record_copper_reset (); @@ -5385,14 +5447,11 @@ static void vsync_handler_post (void) vpos_count = p96refresh_active; vtotal = vpos_count; } - if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (abs (vpos_count - vpos_count_prev) > 1)) + if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (abs (vpos_count - vpos_count_prev) > 1) || lof_changed) init_hz (); - else if (lof_changed || interlace_changed != ((bplcon0 & 4) ? 1 : 0) || changed_chipset_refresh ()) + else if (interlace_changed || changed_chipset_refresh ()) compute_framesync (); -#if 0 - if (lof_changed) - compute_vsynctime (); -#endif + vpos_count_prev = vpos_count; lof_changed = 0; @@ -5682,7 +5741,7 @@ static void hsync_handler_pre (bool onvsync) lightpen_triggered = 1; } hardware_line_completed (next_lineno); - if (doflickerfix () && interlace_seen) + if (doflickerfix () && interlace_seen > 0) hsync_scandoubler (); } @@ -5759,11 +5818,25 @@ static void hsync_handler_post (bool onvsync) CIA_vsync_posthandler (ciasyncs); } - if (vpos == equ_vblank_endline + 1 && lof_current != lof_store) { - // argh, line=0 field decision was wrong, someone did - // something stupid and changed LOF - // lof_current = lof_store; - // don't really know what to do here exactly without corrupt display + if (vpos == equ_vblank_endline + 1) { + if (lof_current != lof_store) { + // argh, line=0 field decision was wrong, someone did + // something stupid and changed LOF + // lof_current = lof_store; + // don't really know what to do here exactly without corrupt display + } + if (lof_store != lof_previous) { + if (lof_togglecnt_lace < LOF_TOGGLES_NEEDED) + lof_togglecnt_lace++; + if (lof_togglecnt_lace >= LOF_TOGGLES_NEEDED) + lof_togglecnt_nlace = 0; + } else { + if (lof_togglecnt_nlace < LOF_TOGGLES_NEEDED) + lof_togglecnt_nlace++; + if (lof_togglecnt_nlace >= LOF_TOGGLES_NEEDED) + lof_togglecnt_lace = 0; + } + lof_previous = lof_store; } inputdevice_hsync (); @@ -5849,10 +5922,8 @@ static void hsync_handler_post (bool onvsync) int lineno = vpos; if (lineno >= MAXVPOS) lineno %= MAXVPOS; - if ((bplcon0 & 4) && currprefs.gfx_vresolution) - notice_interlace_seen (); nextline_how = nln_normal; - if (doflickerfix () && interlace_seen) { + if (doflickerfix () && interlace_seen > 0) { lineno *= 2; } else if (currprefs.gfx_vresolution && (doublescan <= 0 || interlace_seen > 0)) { lineno *= 2; @@ -5950,7 +6021,7 @@ static void hsync_handler_post (bool onvsync) vsync_handle_redraw (lof_store, lof_changed); if (vblank_hz_state) { render_screen (); - show_screen_maybe (true); + show_screen_maybe (false); } frame_shown = true; } @@ -6121,6 +6192,10 @@ void custom_reset (int hardreset) dmal = 0; init_hz_full (); vpos_lpen = -1; + lof_changing = 0; + lof_togglecnt_nlace = lof_togglecnt_lace = 0; + lof_previous = lof_store; + nlace_cnt = NLACE_CNT_NEEDED; audio_reset (); if (!isrestore ()) { @@ -6726,7 +6801,7 @@ static void REGPARAM2 custom_bput (uaecptr addr, uae_u32 value) } } -static void REGPARAM2 custom_lput(uaecptr addr, uae_u32 value) +static void REGPARAM2 custom_lput (uaecptr addr, uae_u32 value) { #ifdef JIT special_mem |= S_WRITE; diff --git a/drawing.cpp b/drawing.cpp index 006c6ebc..19b750eb 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2746,6 +2746,7 @@ void vsync_handle_redraw (int long_frame, int lof_changed) if (framecnt == 0) finish_drawing_frame (); +#if 0 if (interlace_seen > 0) { interlace_seen = -1; } else if (interlace_seen == -1) { @@ -2753,6 +2754,7 @@ void vsync_handle_redraw (int long_frame, int lof_changed) if (currprefs.gfx_scandoubler && currprefs.gfx_vresolution) notice_screen_contents_lost (); } +#endif if (quit_program < 0) { #ifdef SAVESTATE @@ -2859,12 +2861,25 @@ static void gfxbuffer_reset (void) gfxvidinfo.drawbuffer.unlockscr = dummy_unlock; } -void notice_interlace_seen (void) +bool notice_interlace_seen (bool lace) { + bool changed = false; // non-lace to lace switch (non-lace active at least one frame)? - if (interlace_seen == 0) - frame_redraw_necessary = 2; - interlace_seen = 1; + if (lace) { + if (interlace_seen == 0) { + frame_redraw_necessary = 2; + changed = true; + write_log (L"->lace\n"); + } + interlace_seen = currprefs.gfx_vresolution ? 1 : -1; + } else { + if (interlace_seen) { + changed = true; + write_log (L"->non-lace\n"); + } + interlace_seen = 0; + } + return changed; } static void clearbuffer (struct vidbuffer *dst) diff --git a/expansion.cpp b/expansion.cpp index 91bc79f8..b5940f4a 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -1437,8 +1437,10 @@ void expamem_reset (void) allocate_expamem (); expamem_bank.name = L"Autoconfig [reset]"; + if (!currprefs.autoconfig) + do_mount = 0; /* check if Kickstart version is below 1.3 */ - if (kickstart_version + if (kickstart_version && do_mount && (/* Kickstart 1.0 & 1.1! */ kickstart_version == 0xFFFF /* Kickstart < 1.3 */ @@ -1451,9 +1453,11 @@ void expamem_reset (void) if (need_uae_boot_rom () == 0) do_mount = 0; if (fastmemory != NULL && currprefs.chipmem_size <= 2 * 1024 * 1024) { - card_name[cardno] = L"Z2Fast"; - card_init[cardno] = expamem_init_fastcard; - card_map[cardno++] = expamem_map_fastcard; + card_name[cardno] = L"Z2Fast"; + card_init[cardno] = expamem_init_fastcard; + card_map[cardno++] = expamem_map_fastcard; + if (!currprefs.autoconfig || !do_mount) + map_banks (&fastmem_bank, 0x00200000 >> 16, allocated_fastmem >> 16, 0); } #ifdef CDTV diff --git a/filesys.cpp b/filesys.cpp index 4b40c285..cb16ee8b 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -5787,13 +5787,13 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke rdbmnt flags = rl (buf + 20); - if (flags & 2) { /* do not mount */ + if ((flags & 2) || uip->bootpri <= -129) { /* do not mount */ err = -1; write_log (L"RDB: Automount disabled, not mounting\n"); goto error; } - if (!(flags & 1)) /* not bootable */ + if (!(flags & 1) || uip->bootpri <= -128) /* not bootable */ m68k_dreg (regs, 7) = m68k_dreg (regs, 7) & ~1; buf[37 + buf[36]] = 0; /* zero terminate BSTR */ diff --git a/gayle.cpp b/gayle.cpp index f3007f41..edd9c225 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -523,13 +523,16 @@ static void ide_identify_drive (void) } } -static void ide_execute_drive_diagnostics (void) +static void ide_execute_drive_diagnostics (bool irq) { ide->regs->ide_error = 1; ide->regs->ide_sector = ide->regs->ide_nsector = 1; ide->regs->ide_select = 0; ide->regs->ide_lcyl = ide->regs->ide_hcyl = 0; - ide->status &= ~IDE_STATUS_BSY; + if (irq) + ide_interrupt (); + else + ide->status = ~IDE_STATUS_BSY; } static void ide_initialize_drive_parameters (void) @@ -745,7 +748,7 @@ static void ide_do_command (uae_u8 cmd) } else if (cmd == 0xec) { /* identify drive */ ide_identify_drive (); } else if (cmd == 0x90) { /* execute drive diagnostics */ - ide_execute_drive_diagnostics (); + ide_execute_drive_diagnostics (true); } else if (cmd == 0x91) { /* initialize drive parameters */ ide_initialize_drive_parameters (); } else if (cmd == 0xc6) { /* set multiple mode */ @@ -985,7 +988,7 @@ static void ide_write_reg (int ide_reg, uae_u32 val) break; case IDE_DEVCON: if ((ide->regs->ide_devcon & 4) == 0 && (val & 4) != 0) - ide_execute_drive_diagnostics (); + ide_execute_drive_diagnostics (false); ide->regs->ide_devcon = val; break; case IDE_DATA: diff --git a/include/drawing.h b/include/drawing.h index 2bec79b1..aa0e3f79 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -277,7 +277,7 @@ extern void vsync_handle_check (void); extern void init_hardware_for_drawing_frame (void); extern void reset_drawing (void); extern void drawing_init (void); -extern void notice_interlace_seen (void); +extern bool notice_interlace_seen (bool); extern void frame_drawn (void); extern void redraw_frame (void); extern int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy); diff --git a/include/options.h b/include/options.h index 12b218cc..9b2597c5 100644 --- a/include/options.h +++ b/include/options.h @@ -401,6 +401,7 @@ struct uae_prefs { int rtgmem_type; uae_u32 custom_memory_addrs[MAX_CUSTOM_MEMORY_ADDRS]; uae_u32 custom_memory_sizes[MAX_CUSTOM_MEMORY_ADDRS]; + bool autoconfig; bool kickshifter; bool filesys_no_uaefsdb; diff --git a/inputdevice.cpp b/inputdevice.cpp index e1dea782..ed93b8c7 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -60,7 +60,7 @@ extern int bootrom_header, bootrom_items; // 16 = potgo // 32 = vsync -int inputdevice_logging = 1; +int inputdevice_logging = 0; #define IE_INVERT 0x80 #define IE_CDTV 0x100 diff --git a/main.cpp b/main.cpp index 580c2901..9de64529 100644 --- a/main.cpp +++ b/main.cpp @@ -131,8 +131,6 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) { fixup_prefs_dim2 (&prefs->gfx_size_fs); fixup_prefs_dim2 (&prefs->gfx_size_win); - if (prefs->gfx_filter == 0 && prefs->gfx_filter_autoscale && !prefs->gfx_api) - prefs->gfx_filter = 1; if (prefs->gfx_apmode[1].gfx_vsync) prefs->gfx_apmode[1].gfx_vsyncmode = 1; if (prefs->gfx_apmode[0].gfx_vsync && !prefs->gfx_apmode[0].gfx_vsyncmode && prefs->gfx_apmode[0].gfx_backbuffers < 1) @@ -141,10 +139,24 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) for (int i = 0; i < 2; i++) { struct apmode *ap = &prefs->gfx_apmode[i]; ap->gfx_vflip = false; - if (ap->gfx_backbuffers >= 1) - ap->gfx_vflip = true; // true = wait for vblank flip, false = immediate flip + if (ap->gfx_vsync) { + if (ap->gfx_vsyncmode) { + // low latency vsync: no flip only if no-buffer + if (ap->gfx_backbuffers >= 1) + ap->gfx_vflip = true; // true = wait for vblank flip, false = immediate flip + } else { + // legacy vsync: always wait for flip + ap->gfx_vflip = true; + } + } else { + // no vsync: wait if tripple bufferirng + if (ap->gfx_backbuffers >= 2) + ap->gfx_vflip = true; + } } + if (prefs->gfx_filter == 0 && ((prefs->gfx_filter_autoscale && !prefs->gfx_api) || (prefs->gfx_apmode[0].gfx_vsyncmode))) + prefs->gfx_filter = 1; } void fixup_cpu (struct uae_prefs *p) diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index faa89577..4df9c86d 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -1194,7 +1194,7 @@ static uae_u32 hidmask (int bits) static int extractbits (uae_u32 val, int bits, bool issigned) { if (issigned) - return val & (hidmask (bits)) ? val | (bits >= 32 ? 0x80000000 : (-1 << bits)) : val; + return (val & (bits >= 32 ? 0x80000000 : (1 << (bits - 1)))) ? val | (bits >= 32 ? 0x80000000 : (-1 << bits)) : val; else return val & hidmask (bits); } @@ -1872,8 +1872,8 @@ static void handle_rawinput_2 (RAWINPUT *raw) v -= logicalrange + vcaps->LogicalMin; - //if (axisnum == 0) - // write_log (L"%d\n", v); + if (axisnum == 0) + write_log (L"%d\n", v); data = v; diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 71b5e01d..d5a1d0bb 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -738,7 +738,7 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) LPD3DXBUFFER Errors = NULL; LPD3DXBUFFER BufferEffect = NULL; HRESULT hr; - TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH]; + TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH], tmp3[MAX_DPATH]; LPD3DXEFFECT effect = NULL; static int first; DWORD compileflags = psEnabled ? 0 : D3DXSHADER_USE_LEGACY_D3DX9_31_DLL; @@ -747,8 +747,7 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) compileflags |= EFFECTCOMPILERFLAGS; plugin_path = get_plugin_path (tmp, sizeof tmp / sizeof (TCHAR), L"filtershaders\\direct3d"); - if (filenotificationhandle == NULL) - filenotificationhandle = FindFirstChangeNotification (tmp, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE); + _tcscpy (tmp3, tmp); _tcscat (tmp, shaderfile); if (!full) { struct zfile *z = zfile_fopen (tmp, L"r", 0); @@ -773,15 +772,13 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) if (FAILED (hr)) { const char *str = psEnabled ? fx20 : fx10; int len = strlen (str); -#if 0 - if ((!existsfile || canusefile == 0) && plugin_path) { + if (!existsfile && plugin_path) { struct zfile *z = zfile_fopen (tmp, L"w", 0); if (z) { zfile_fwrite ((void*)str, len, 1, z); zfile_fclose (z); } } -#endif hr = D3DXCreateEffectCompiler (str, len, NULL, NULL, compileflags, &EffectCompiler, &Errors); if (FAILED (hr)) { write_log (L"%s: D3DXCreateEffectCompilerFromResource failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors)); @@ -832,6 +829,8 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) goto end; } ret = 1; + if (plugin_path && filenotificationhandle == NULL) + filenotificationhandle = FindFirstChangeNotification (tmp3, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE); end: if (Errors) Errors->Release (); @@ -1685,6 +1684,9 @@ static void settransform (void) static void invalidatedeviceobjects (void) { + if (filenotificationhandle != NULL) + FindCloseChangeNotification (filenotificationhandle); + filenotificationhandle = NULL; if (query) { query->Release(); query = NULL; @@ -1838,9 +1840,6 @@ static int restoredeviceobjects (void) static void D3D_free2 (void) { - if (filenotificationhandle != NULL) - FindCloseChangeNotification (filenotificationhandle); - filenotificationhandle = NULL; invalidatedeviceobjects (); if (d3dswapchain) { d3dswapchain->Release (); @@ -2120,16 +2119,15 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth write_log (L"DYNAMIC "); write_log (L"\n"); - write_log (L"%s: PS=%d.%d VS=%d.%d %d*%d*%d%s VS=%d B=%d%s%s %d-bit %d\n", + write_log (L"%s: PS=%d.%d VS=%d.%d %d*%d*%d%s VS=%d B=%d%s %d-bit %d\n", D3DHEAD, (d3dCaps.PixelShaderVersion >> 8) & 0xff, d3dCaps.PixelShaderVersion & 0xff, (d3dCaps.VertexShaderVersion >> 8) & 0xff, d3dCaps.VertexShaderVersion & 0xff, max_texture_w, max_texture_h, dpp.FullScreen_RefreshRateInHz, dpp.Windowed ? L"" : L" FS", - vsync, dpp.BackBufferCount, - dpp.PresentationInterval & D3DPRESENT_INTERVAL_IMMEDIATE ? L"I" : L"F", - ap->gfx_backbuffers == 0 ? L"E" : L"", + vsync, ap->gfx_backbuffers, + ap->gfx_vflip ? L"W" : L"I", t_depth, adapter ); @@ -2203,7 +2201,7 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth write_log (L"%s: CreateQuery(D3DQUERYTYPE_EVENT) failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); } if (d3ddevex) { - hr = d3ddevex->SetMaximumFrameLatency (vsync < 0 && ap->gfx_backbuffers == 0 ? 1 : 0); + hr = d3ddevex->SetMaximumFrameLatency (vsync < 0 ? 1 : 0); if (FAILED (hr)) write_log (L"%s: SetMaximumFrameLatency() failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); } @@ -2680,6 +2678,25 @@ uae_u8 *D3D_locktexture (int *pitch, bool fullupdate) return (uae_u8*)lock.pBits; } +static void flushgpu (bool wait) +{ + if (query) { + HRESULT hr = query->Issue (D3DISSUE_END); + if (SUCCEEDED (hr)) { + while (query->GetData (NULL, 0, D3DGETDATA_FLUSH) == S_FALSE) { + if (!wait) + return; + } + } else { + static int reported; + if (reported < 10) { + reported++; + write_log (L"%s: query->Issue (D3DISSUE_END) failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); + } + } + } +} + bool D3D_renderframe (void) { static int vsync2_cnt; @@ -2691,6 +2708,7 @@ bool D3D_renderframe (void) while (WaitForSingleObject (filenotificationhandle, 0) == WAIT_OBJECT_0) { FindNextChangeNotification (filenotificationhandle); devicelost = 2; + write_log (L"%s: Shader file modification notification\n", D3DHEAD); } } @@ -2701,19 +2719,8 @@ bool D3D_renderframe (void) } D3D_render2 (); + flushgpu (false); - if (query) { - HRESULT hr = query->Issue (D3DISSUE_END); - if (SUCCEEDED (hr)) { - while (query->GetData (NULL, 0, D3DGETDATA_FLUSH) == S_FALSE); - } else { - static int reported; - if (reported < 10) { - reported++; - write_log (L"query->Issue (D3DISSUE_END) failed: %s\n", D3DHEAD, D3D_ErrorString (hr)); - } - } - } return true; } @@ -2733,6 +2740,7 @@ void D3D_showframe (void) D3D_showframe2 (true); } } + flushgpu (true); } void D3D_refresh (void) diff --git a/od-win32/dxwrap.cpp b/od-win32/dxwrap.cpp index 323145d1..570fe683 100644 --- a/od-win32/dxwrap.cpp +++ b/od-win32/dxwrap.cpp @@ -406,8 +406,11 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height) } else { ddrval = DD_FALSE; } - write_log (L"DDRAW: primary surface %p, secondary %p (%dx%dx%d) bb=%d\n", - dxdata.primary, surf, width, height, dxdata.native.ddpfPixelFormat.dwRGBBitCount, dxdata.backbuffers); + write_log (L"DDRAW: %dx%d B=%d%s %d-bit\n", + width, height, + ap->gfx_backbuffers, ap->gfx_vflip ? L"W" : L"I", + dxdata.native.ddpfPixelFormat.dwRGBBitCount + ); return ddrval; } diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index b3f3105e..47d4f5ec 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -690,17 +690,15 @@ static void picasso_handle_vsync2 (void) int thisisvsync = 1; int vsync = isvsync_rtg (); int mult; + bool rendered = false; -#ifdef RETROPLATFORM - rp_vsync (); -#endif - - clipboard_vsync (); - if (!picasso_on) - createwindowscursor (0, 0, 0, 0, 0, 1); + if (vsync < 0) { + vsync_busywait_end (); + vsync_busywait_do (NULL, false, false); + } getvsyncrate (currprefs.chipset_refreshrate, &mult); - if (vsync >= 0 && mult < 0) { + if (vsync && mult < 0) { vsynccnt++; if (vsynccnt < 2) thisisvsync = 0; @@ -708,55 +706,53 @@ static void picasso_handle_vsync2 (void) vsynccnt = 0; } - if (thisisvsync && currprefs.win32_rtgvblankrate == 0 && !vsync) - picasso_trigger_vblank (); - - if (!picasso_on) - return; - framecnt++; mouseupdate (); if (thisisvsync) { - if (!rtg_render ()) - rtg_show (); + rendered = rtg_render (); } if (setupcursor_needed) setupcursor (); + if (thisisvsync) + picasso_trigger_vblank (); + + if (vsync < 0) { + vsync_busywait_start (); + } + + if (thisisvsync && !rendered) + rtg_show (); } static int p96hsync; void picasso_handle_vsync (void) { - int vsync = isvsync_rtg (); - + if (currprefs.rtgmem_size == 0) + return; + if (!picasso_on) { + createwindowscursor (0, 0, 0, 0, 0, 1); picasso_trigger_vblank (); return; } + int vsync = isvsync_rtg (); if (vsync < 0) { p96hsync = 0; - vsync_busywait_end (); - vsync_busywait_do (NULL, false, false); - framecnt++; - mouseupdate (); - bool rendered = rtg_render (); - picasso_trigger_vblank (); - clipboard_vsync (); - vsync_busywait_start (); - if (!rendered) - rtg_show (); - } else { + picasso_handle_vsync2 (); + } else if (currprefs.win32_rtgvblankrate == 0) { picasso_handle_vsync2 (); } } void picasso_handle_hsync (void) { - int vsync = isvsync_rtg (); + if (currprefs.rtgmem_size == 0) + return; + int vsync = isvsync_rtg (); if (vsync < 0) { p96hsync++; if (p96hsync >= p96syncrate * 3) { @@ -767,14 +763,17 @@ void picasso_handle_hsync (void) return; } - if (currprefs.rtgmem_size == 0) - return; - if (currprefs.win32_rtgvblankrate == 0 && !vsync) + if (currprefs.win32_rtgvblankrate == 0) return; p96hsync++; if (p96hsync >= p96syncrate) { - picasso_trigger_vblank (); + if (!picasso_on) { + createwindowscursor (0, 0, 0, 0, 0, 1); + picasso_trigger_vblank (); + } else { + picasso_handle_vsync2 (); + } p96hsync = 0; } } @@ -982,7 +981,6 @@ void picasso_refresh (void) width = picasso96_state.Width; height = picasso96_state.Height; } - flushpixels (); } else { write_log (L"ERROR - picasso_refresh() can't refresh!\n"); } diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index d8e7794f..ff3f29cc 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -562,7 +562,7 @@ static void releasecapture (void) showcursor = 0; } -void setmouseactive (int active) +static void setmouseactive2 (int active, bool allowpause) { //write_log (L"setmouseactive %d->%d\n", mouseactive, active); if (active == 0) @@ -642,7 +642,7 @@ void setmouseactive (int active) } else { inputdevice_acquire (FALSE); } - if (!active) + if (!active && allowpause) checkpause (); setmaintitle (hMainWnd); #ifdef RETROPLATFORM @@ -650,8 +650,12 @@ void setmouseactive (int active) rp_mouse_magic (magicmouse_alive ()); #endif } +void setmouseactive (int active) +{ + setmouseactive2 (active, true); +} -static const int hotkeys[] = { VK_VOLUME_UP, VK_VOLUME_DOWN, VK_VOLUME_MUTE, -1 }; +static int hotkeys[] = { VK_VOLUME_UP, VK_VOLUME_DOWN, VK_VOLUME_MUTE, -1 }; static void winuae_active (HWND hWnd, int minimized) { @@ -677,9 +681,9 @@ static void winuae_active (HWND hWnd, int minimized) if (sound_closed < 0) { resumesoundpaused (); } else { - if (currprefs.win32_iconified_pause) + if (currprefs.win32_iconified_pause && !currprefs.win32_inactive_pause) resumepaused (1); - if (currprefs.win32_inactive_pause) + else if (currprefs.win32_inactive_pause) resumepaused (2); } sound_closed = 0; @@ -694,7 +698,7 @@ static void winuae_active (HWND hWnd, int minimized) getcapslock (); wait_keyrelease (); inputdevice_acquire (TRUE); - if (isfullscreen() != 0 && !gui_active) + if (isfullscreen () != 0 && !gui_active) setmouseactive (1); #ifdef LOGITECHLCD if (!minimized) @@ -760,7 +764,6 @@ static void winuae_inactive (HWND hWnd, int minimized) } } } - wait_keyrelease (); setpriority (pri); #ifdef FILESYS filesys_flush_cache (); @@ -775,10 +778,29 @@ void minimizewindow (void) ShowWindow (hMainWnd, SW_MINIMIZE); } +void enablecapture (void) +{ + setmouseactive (1); + if (sound_closed < 0) { + resumesoundpaused (); + sound_closed = 0; + } + if (currprefs.win32_inactive_pause) { + resumepaused (2); + } +} + void disablecapture (void) { setmouseactive (0); focus = 0; + if (currprefs.win32_inactive_pause && sound_closed == 0) { + setpaused (2); + sound_closed = 1; + } else if (currprefs.win32_inactive_nosound && sound_closed == 0) { + setsoundpaused (); + sound_closed = -1; + } } void gui_gameport_button_change (int port, int button, int onoff) @@ -1136,7 +1158,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, //write_log (L"%d %d %d %d %d %d %dx%d %dx%d\n", wm, mouseactive, focus, showcursor, recapture, isfullscreen (), mx, my, mouseposx, mouseposy); if (recapture && isfullscreen () <= 0) { - setmouseactive (1); + enablecapture (); return 0; } if (wm < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) { diff --git a/od-win32/win32.h b/od-win32/win32.h index 9dda2781..539a6663 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,8 +19,8 @@ #define LANG_DLL 1 //#define WINUAEBETA L"" -#define WINUAEBETA L"Beta 16" -#define WINUAEDATE MAKEBD(2012, 2, 10) +#define WINUAEBETA L"Beta 17" +#define WINUAEDATE MAKEBD(2012, 2, 15) #define WINUAEEXTRA L"" //#define WINUAEEXTRA L"AmiKit Preview" #define WINUAEREV L"" diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index e493220c..ccbfc497 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -871,6 +871,8 @@ static void waitflipevent (void) } static void doflipevent (void) { + if (flipevent == NULL) + return; waitflipevent (); flipevent_mode = 1; SetEvent (flipevent); @@ -879,7 +881,7 @@ static void doflipevent (void) bool show_screen_maybe (bool show) { struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0]; - if (ap->gfx_vsync >= 0 || !ap->gfx_vflip) { + if (!ap->gfx_vflip || ap->gfx_vsyncmode == 0 || !ap->gfx_vsync) { if (show) show_screen (); return false; @@ -1117,6 +1119,7 @@ uae_u8 *gfx_lock_picasso (bool fullupdate, bool doclear) if (!p) { LeaveCriticalSection (&screen_cs); } else { + rtg_locked = true; if (doclear) { uae_u8 *p2 = p; for (int h = 0; h < picasso_vidinfo.height; h++) { @@ -1409,6 +1412,10 @@ int check_prefs_changed_gfx (void) c |= currprefs.gfx_filter_gamma != changed_prefs.gfx_filter_gamma ? (1|8) : 0; //c |= currprefs.gfx_filter_ != changed_prefs.gfx_filter_ ? (1|8) : 0; + c |= currprefs.gfx_luminance != changed_prefs.gfx_luminance ? (1|8) : 0; + c |= currprefs.gfx_contrast != changed_prefs.gfx_contrast ? (1|8) : 0; + c |= currprefs.gfx_gamma != changed_prefs.gfx_gamma ? (1|8) : 0; + c |= currprefs.gfx_resolution != changed_prefs.gfx_resolution ? (128) : 0; c |= currprefs.gfx_vresolution != changed_prefs.gfx_vresolution ? (128) : 0; c |= currprefs.gfx_autoresolution_minh != changed_prefs.gfx_autoresolution_minh ? (128) : 0; @@ -1478,6 +1485,10 @@ int check_prefs_changed_gfx (void) currprefs.gfx_filter_autoscale = changed_prefs.gfx_filter_autoscale; //currprefs.gfx_filter_ = changed_prefs.gfx_filter_; + currprefs.gfx_luminance = changed_prefs.gfx_luminance; + currprefs.gfx_contrast = changed_prefs.gfx_contrast; + currprefs.gfx_gamma = changed_prefs.gfx_gamma; + currprefs.gfx_resolution = changed_prefs.gfx_resolution; currprefs.gfx_vresolution = changed_prefs.gfx_vresolution; currprefs.gfx_autoresolution_minh = changed_prefs.gfx_autoresolution_minh; @@ -1793,6 +1804,7 @@ static int reopen (int full) { int quick = 0; int idx = screen_is_picasso ? 1 : 0; + struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0]; updatewinfsmode (&changed_prefs); @@ -1832,6 +1844,9 @@ static int reopen (int full) open_windows (0); + if (isvsync () < 0) + vblank_calibrate (0, false); + if (isfullscreen () <= 0) DirectDraw_FillPrimary (); @@ -2500,7 +2515,7 @@ frame_time_t vsync_busywait_end (void) { vsync_notvblank (); while (!vblank_found && vblankthread_mode == VBLANKTH_ACTIVE) { - vsync_sleep (true); + vsync_sleep (false); } changevblankthreadmode (VBLANKTH_ACTIVE_WAIT); return thread_vblank_time; @@ -2508,6 +2523,7 @@ frame_time_t vsync_busywait_end (void) void vsync_busywait_start (void) { + vsync_notvblank (); changevblankthreadmode (VBLANKTH_ACTIVE_START); vblank_prev_time = thread_vblank_time; } diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 1792e6dd..7f3592df 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -8770,8 +8770,8 @@ static void sethardfile (HWND hDlg) CheckDlgButton (hDlg, IDC_HDF_AUTOBOOT, current_hfdlg.autoboot); CheckDlgButton (hDlg, IDC_HDF_DONOTMOUNT, current_hfdlg.donotmount); ew (hDlg, IDC_HDF_RDB, !rdb); - ew (hDlg, IDC_HDF_AUTOBOOT, !rdb); - ew (hDlg, IDC_HDF_DONOTMOUNT, !rdb); + ew (hDlg, IDC_HDF_AUTOBOOT, TRUE); + ew (hDlg, IDC_HDF_DONOTMOUNT, TRUE); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_hfdlg.controller, 0); } diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 3b0f2fbe..cc266305 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,32 @@ +Beta 17: + +- Fixed b16 low latency vsync issues. +- Possible fix for no buffer vsync tearing in D3D mode on some systems. +- Tweaked b4 too fast cpu audio hack, it broke routines that start playing empty sample (with length=1) + and then near immediately reset audio pointer to correct sample. Hack detected this as a bad + behavior and "fixed" it causing corrupt sound. (Game Solid 2 AGA) +- Release keys before pausing, stuck Alt if Alt-Tab pressed and emulation was set to pause when inactive. +- Magic mouse triggered window activation/deactivation didn't handle inactive pause or sound correctly. +- UAE controller mounted RDB hardfiles support bootable and do not mount checkboxes. "Do not mount" ticked + = ignore all RDB hardfile partitions, "Bootable" unticked = do not boot from any RDB hardfile + partition. Other boot priority values are ignored. +- Execute drive diagnostics IDE command should also set interrupt state (if enabled) +- Enable null filter if none and low latency vsync selected. It can't work with "none" filter. +- gfx_contrast/gfx_luminance/gfx_gamma didn't work on the fly using uae-configuration. +- Interlace mode detection rewritten. This should improve interlace emulation of weird programs + doing weird things with interlace... Do not simply mirror BPLCON0 LACE bit but also check + that LOF bit toggles correctly. +- Only enable vblank waits in non-vsync modes if triple buffering is enabled. I always forget that + it is bad idea because on some systems it works fine, on some others it causes huge slowdowns. +- Some Advanced Chipset panel settings were not overridden if compatible settings was enabled. + This could have caused strange compatibility problems even in Quickstart modes if default.uae + had modified advanced chipset config entries. +- On the fly RTG vsync mode switch does not freeze the emulation anymore. +- Fixed A1000 Quickstart ROM missing message. +- KS 1.2 or older: map Z2 FastRAM as a non-autoconfig memory board. +- HID joystick negative axis values broke in b15. + Beta 16: - AROS CDFS update, disabled annoying and pointless "Write protected" requester.