From c090450765e4d6424943dcc9bad0571a354e9e6c Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 13 Apr 2013 15:35:33 +0300 Subject: [PATCH] 2600b16 --- blitter.cpp | 8 ++-- cfgfile.cpp | 23 ++++++++++- custom.cpp | 30 ++++++-------- drawing.cpp | 31 +++++++++------ gayle.cpp | 16 ++++++++ include/options.h | 1 + inputdevice.cpp | 16 +++++--- main.cpp | 4 +- od-win32/dinput.cpp | 37 ++++++++++++----- od-win32/direct3d.cpp | 5 ++- od-win32/rp.cpp | 18 ++++----- od-win32/win32.cpp | 12 ++++++ od-win32/win32.h | 4 +- od-win32/win32gfx.cpp | 57 ++++++++++++++++++-------- od-win32/win32gui.cpp | 77 +++++++++++++++++++++++++----------- od-win32/winuaechangelog.txt | 19 +++++++++ 16 files changed, 252 insertions(+), 106 deletions(-) diff --git a/blitter.cpp b/blitter.cpp index 896064c7..e280ddc1 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -326,7 +326,7 @@ extern int is_bitplane_dma (int hpos); STATIC_INLINE int canblit (int hpos) { if (!dmaen (DMA_BLITTER)) - return 0; + return -1; if (is_bitplane_dma (hpos)) return 0; if (cycle_line[hpos] & CYCLE_MASK) @@ -703,7 +703,7 @@ static void decide_blitter_line (int hsync, int hpos) break; } - if (!v) { + if (v <= 0) { blit_misscyclecounter++; blitter_nasty++; break; @@ -993,7 +993,7 @@ static void do_startcycles (int hpos) while (vhpos < hpos) { int v = canblit (vhpos); vhpos++; - if (v) { + if (v >= 0) { blit_startcycles--; if (blit_startcycles == 0) { if (blit_faulty) @@ -1062,7 +1062,7 @@ void decide_blitter (int hpos) } // idle cycles require free bus.. // (CPU can still use this cycle) - if (c == 0 && v == 0) { + if ((c == 0 && v == 0) || v < 0) { blitter_nasty++; blit_misscyclecounter++; break; diff --git a/cfgfile.cpp b/cfgfile.cpp index 1d445e30..a02b525e 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -879,6 +879,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate); cfgfile_dwrite (f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate); cfgfile_write_bool (f, _T("gfx_autoresolution"), p->gfx_autoresolution); + cfgfile_dwrite (f, _T("gfx_autoresolution_delay"), _T("%d"), p->gfx_autoresolution_delay); cfgfile_dwrite (f, _T("gfx_autoresolution_min_vertical"), vertmode[p->gfx_autoresolution_minv + 1]); cfgfile_dwrite (f, _T("gfx_autoresolution_min_horizontal"), horizmode[p->gfx_autoresolution_minh + 1]); @@ -918,6 +919,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) if (p->gfx_filtermask[i + MAX_FILTERSHADERS][0]) cfgfile_write_str (f, _T("gfx_filtermask_post"), p->gfx_filtermask[i + MAX_FILTERSHADERS]); } + cfgfile_dwrite_str (f, _T("gfx_filter_mask"), p->gfx_filtermask[2 * MAX_FILTERSHADERS - 1]); if (p->gfx_filtershader[0][0] && p->gfx_api) { cfgfile_dwrite (f, _T("gfx_filter"), _T("D3D:%s"), p->gfx_filtershader[0]); } else if (p->gfx_filter > 0) { @@ -959,7 +961,6 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) 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); - cfgfile_dwrite_str (f, _T("gfx_filter_mask"), p->gfx_filtermask[2 * MAX_FILTERSHADERS - 1]); if (p->gfx_filteroverlay[0]) { cfgfile_dwrite (f, _T("gfx_filter_overlay"), _T("%s%s"), p->gfx_filteroverlay, _tcschr (p->gfx_filteroverlay, ',') ? _T(",") : _T("")); @@ -1591,6 +1592,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, _T("gfx_refreshrate"), &p->gfx_apmode[APMODE_NATIVE].gfx_refreshrate, 1) || cfgfile_intval (option, value, _T("gfx_refreshrate_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_refreshrate, 1) || cfgfile_yesno (option, value, _T("gfx_autoresolution"), &p->gfx_autoresolution) + || cfgfile_intval (option, value, _T("gfx_autoresolution_delay"), &p->gfx_autoresolution_delay, 1) || cfgfile_intval (option, value, _T("gfx_backbuffers"), &p->gfx_apmode[APMODE_NATIVE].gfx_backbuffers, 1) || cfgfile_intval (option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1) || cfgfile_yesno (option, value, _T("gfx_interlace"), &p->gfx_apmode[APMODE_NATIVE].gfx_interlaced) @@ -1921,6 +1923,25 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) return 1; } + if (_tcscmp (option, _T("gfx_filtermask_pre")) == 0 || _tcscmp (option, _T("gfx_filtermask_post")) == 0) { + if (_tcscmp (option, _T("gfx_filtermask_pre")) == 0) { + for (int i = 0; i < MAX_FILTERSHADERS; i++) { + if (p->gfx_filtermask[i][0] == 0) { + _tcscpy (p->gfx_filtermask[i], value); + break; + } + } + } else { + for (int i = 0; i < MAX_FILTERSHADERS; i++) { + if (p->gfx_filtermask[i + MAX_FILTERSHADERS][0] == 0) { + _tcscpy (p->gfx_filtermask[i + MAX_FILTERSHADERS], value); + break; + } + } + } + return 1; + } + if (_tcscmp (option, _T("gfx_filter_pre")) == 0 || _tcscmp (option, _T("gfx_filter_post")) == 0) { TCHAR *s = _tcschr (value, ':'); if (s) { diff --git a/custom.cpp b/custom.cpp index 082bde27..91521216 100644 --- a/custom.cpp +++ b/custom.cpp @@ -1988,8 +1988,9 @@ STATIC_INLINE void decide_line (int hpos) return; if (fetch_state == fetch_not_started && (diwstate == DIW_waiting_stop || (currprefs.chipset_mask & CSMASK_ECS_AGNUS))) { + int start = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? plfstrt - 4 : HARD_DDF_START_REAL - 2; int ok = 0; - if (last_decide_line_hpos < plfstrt_start && hpos >= plfstrt_start) { + if (last_decide_line_hpos < start && hpos >= start) { if (plf_state == plf_idle || plf_state == plf_end) plf_state = plf_start; } @@ -3289,27 +3290,18 @@ static void calcdiw (void) plfstrt = ddfstrt; plfstop = ddfstop; + /* probably not the correct place.. should use plf_state instead */ if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) { - if (!bpldmawasactive) { - /* ECS/AGA and ddfstop > maxhpos == always-on display */ - if (plfstop > maxhpos) - plfstrt = 0; - if (plfstrt < HARD_DDF_START) - plfstrt = HARD_DDF_START; - plfstrt_start = plfstrt - 4; - } else { - plfstrt_start = plfstrt; - } + /* ECS/AGA and ddfstop > maxhpos == always-on display */ + if (plfstop > maxhpos) + plfstrt = 0; + if (plfstrt < HARD_DDF_START) + plfstrt = HARD_DDF_START; } else { - if (!bpldmawasactive) { - /* OCS and ddfstrt >= ddfstop == ddfstop = max */ - if (plfstrt >= plfstop && plfstrt >= HARD_DDF_START) - plfstop = 0xff; - plfstrt_start = HARD_DDF_START_REAL - 2; - } else { - plfstrt_start = plfstrt; - } + /* OCS and ddfstrt >= ddfstop == ddfstop = max */ + if (plfstrt >= plfstop && plfstrt >= HARD_DDF_START) + plfstop = 0xff; } diw_change = 2; } diff --git a/drawing.cpp b/drawing.cpp index c0cca803..2e402f04 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -713,7 +713,7 @@ STATIC_INLINE xcolnr getbgc (bool blank) return xcolors[0x0f0]; else if (hposblank == 3) return xcolors[0x00f]; - else if ( colors_for_drawing.borderblank) + else if (colors_for_drawing.borderblank) return xcolors[0x880]; //return colors_for_drawing.acolors[0]; return xcolors[0xf0f]; @@ -729,6 +729,7 @@ static void pfield_init_linetoscr (void) /* First, get data fetch start/stop in DIW coordinates. */ int ddf_left = dp_for_drawing->plfleft * 2 + DIW_DDF_OFFSET; int ddf_right = dp_for_drawing->plfright * 2 + DIW_DDF_OFFSET; + int leftborderhidden; /* Compute datafetch start/stop in pixels; native display coordinates. */ native_ddf_left = coord_hw_to_window_x (ddf_left); @@ -745,11 +746,12 @@ 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); @@ -777,7 +779,9 @@ static void pfield_init_linetoscr (void) if (end < playfield_start && end > linetoscr_diw_start) { playfield_start = end; can_have_bordersprite = true; - } + } else { + can_have_bordersprite = false; + } } else { can_have_bordersprite = dp_for_drawing->bordersprite_seen; } @@ -823,7 +827,11 @@ static void pfield_init_linetoscr (void) ddf_left -= DISPLAY_LEFT_SHIFT; pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << bplres); ddf_left <<= bplres; - src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left); + + leftborderhidden = playfield_start - native_ddf_left; + if (hblank_left_start > playfield_start) + leftborderhidden += hblank_left_start - playfield_start; + src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (leftborderhidden); if (dip_for_drawing->nr_sprites == 0) return; @@ -1175,8 +1183,6 @@ static int NOINLINE linetoscr_16_shrink1f_sh (int spix, int dpix, int stoppos, i return spix; } - - static int NOINLINE linetoscr_32_shrink2_sh (int spix, int dpix, int stoppos, int spr) { uae_u32 *buf = (uae_u32 *) xlinebuffer; @@ -2276,7 +2282,9 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in * full line. */ decode_ham (visible_left_border, visible_right_border, false); } else /* Argh. */ { + int ohposblank = hposblank; do_color_changes (dummy_worker, decode_ham, lineno); + hposblank = ohposblank; adjust_drawing_colors (dp_for_drawing->ctable, dp_for_drawing->ham_seen || bplehb); } bplham = dp_for_drawing->ham_at_start; @@ -2479,7 +2487,6 @@ static void center_image (void) center_reset = false; } -#define FRAMES_UNTIL_RES_SWITCH 1 static int frame_res_cnt; static void init_drawing_frame (void) { @@ -2488,7 +2495,7 @@ static void init_drawing_frame (void) static int frame_res_old; if (currprefs.gfx_autoresolution && frame_res >= 0 && frame_res_lace >= 0) { - if (FRAMES_UNTIL_RES_SWITCH > 0 && frame_res_old == frame_res * 2 + frame_res_lace) { + if (frame_res_cnt > 0 && frame_res_old == frame_res * 2 + frame_res_lace) { frame_res_cnt--; if (frame_res_cnt == 0) { int m = frame_res * 2 + frame_res_lace; @@ -2538,11 +2545,13 @@ static void init_drawing_frame (void) } m++; } - frame_res_cnt = FRAMES_UNTIL_RES_SWITCH; + frame_res_cnt = currprefs.gfx_autoresolution_delay; } } else { frame_res_old = frame_res * 2 + frame_res_lace; - frame_res_cnt = FRAMES_UNTIL_RES_SWITCH; + frame_res_cnt = currprefs.gfx_autoresolution_delay; + if (frame_res_cnt <= 0) + frame_res_cnt = 1; } } frame_res = -1; @@ -3175,7 +3184,7 @@ void reset_drawing (void) init_drawing_frame (); notice_screen_contents_lost (); - frame_res_cnt = FRAMES_UNTIL_RES_SWITCH; + frame_res_cnt = currprefs.gfx_autoresolution_delay; lightpen_y1 = lightpen_y2 = -1; reset_custom_limits (); diff --git a/gayle.cpp b/gayle.cpp index 15a6dbc2..ee5b7c17 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -1499,10 +1499,18 @@ static int isa4000t (uaecptr addr) static uae_u32 REGPARAM2 gayle_lget (uaecptr addr) { + struct ide_hdf *ide = NULL; + int ide_reg; uae_u32 v; #ifdef JIT special_mem |= S_READ; #endif + ide_reg = get_gayle_ide_reg (addr, &ide); + if (ide_reg == IDE_DATA) { + v = ide_get_data (ide) << 16; + v |= ide_get_data (ide); + return v; + } v = gayle_wget (addr) << 16; v |= gayle_wget (addr + 2); return v; @@ -1540,9 +1548,17 @@ static uae_u32 REGPARAM2 gayle_bget (uaecptr addr) static void REGPARAM2 gayle_lput (uaecptr addr, uae_u32 value) { + struct ide_hdf *ide = NULL; + int ide_reg; #ifdef JIT special_mem |= S_WRITE; #endif + ide_reg = get_gayle_ide_reg (addr, &ide); + if (ide_reg == IDE_DATA) { + ide_put_data (ide, value >> 16); + ide_put_data (ide, value & 0xffff); + return; + } gayle_wput (addr, value >> 16); gayle_wput (addr + 2, value & 0xffff); } diff --git a/include/options.h b/include/options.h index 89955fcb..fb3b4e40 100644 --- a/include/options.h +++ b/include/options.h @@ -301,6 +301,7 @@ struct uae_prefs { struct wh gfx_size_win_xtra[6]; struct wh gfx_size_fs_xtra[6]; bool gfx_autoresolution; + int gfx_autoresolution_delay; int gfx_autoresolution_minv, gfx_autoresolution_minh; bool gfx_scandoubler; struct apmode gfx_apmode[2]; diff --git a/inputdevice.cpp b/inputdevice.cpp index 932b7a20..e1c55757 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -4359,16 +4359,22 @@ int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int while (inputdevice_get_device_status (devnum) >= 0) { for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) { for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { - int port, k; + int port, k, l; uae_u64 flags; + bool ignore = false; int evtnum2 = inputdevice_get_mapping (devnum, j, &flags, &port, NULL, NULL, sub); if (port - 1 != index) continue; - for (k = 0; axistable[k] >= 0; k++) { - if (evtnum2 == axistable[k]) - break; + for (k = 0; axistable[k] >= 0; k += 3) { + if (evtnum2 == axistable[k] || evtnum2 == axistable[k + 1] || evtnum2 == axistable[k + 2]) { + for (l = 0; inputlist[l] >= 0; l++) { + if (inputlist[l] == axistable[k] || inputlist[l] == axistable[k + 1] || inputlist[l] == axistable[k + 1]) { + ignore = true; + } + } + } } - if (axistable[k] < 0) { + if (!ignore) { for (k = 0; inputlist[k] >= 0; k++) { if (evtnum2 == inputlist[k]) break; diff --git a/main.cpp b/main.cpp index 646ca62d..3519c7df 100644 --- a/main.cpp +++ b/main.cpp @@ -174,9 +174,7 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) ap->gfx_vflip = 1; if (!i && ap->gfx_backbuffers == 2) ap->gfx_vflip = 1; - if (ap->gfx_vflip) { - ap->gfx_strobo = prefs->lightboost_strobo; - } + ap->gfx_strobo = prefs->lightboost_strobo; } else { // legacy vsync: always wait for flip ap->gfx_vflip = -1; diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 58e76459..45b0920b 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -1921,14 +1921,21 @@ static void handle_rawinput_2 (RAWINPUT *raw) } if (!rm->ulButtons) { if (istest) { - if (abs (rm->lLastX - lastx[num]) > 7) { - setmousestate (num, 0, rm->lLastX, (rm->usFlags & (MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP)) ? 1 : 0); - lastx[num] = rm->lLastX; - lasty[num] = rm->lLastY; - } else if (abs (rm->lLastY - lasty[num]) > 7) { - setmousestate (num, 1, rm->lLastY, (rm->usFlags & (MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP)) ? 1 : 0); - lastx[num] = rm->lLastX; - lasty[num] = rm->lLastY; + static time_t ot; + time_t t = time (NULL); + if (t != ot && t != ot + 1) { + if (abs (rm->lLastX - lastx[num]) > 7) { + setmousestate (num, 0, rm->lLastX, (rm->usFlags & (MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP)) ? 1 : 0); + lastx[num] = rm->lLastX; + lasty[num] = rm->lLastY; + ot = t; + } + if (abs (rm->lLastY - lasty[num]) > 7) { + setmousestate (num, 1, rm->lLastY, (rm->usFlags & (MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP)) ? 1 : 0); + lastx[num] = rm->lLastX; + lasty[num] = rm->lLastY; + ot = t; + } } } else { setmousestate (num, 0, rm->lLastX, (rm->usFlags & (MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP)) ? 1 : 0); @@ -2901,8 +2908,18 @@ static void read_mouse (void) if (istest || isfocus () > 0) { for (k = 0; k < did->axles; k++) { - if (did->axismappings[k] == dimofs) - setmousestate (i, k, data, 0); + if (did->axismappings[k] == dimofs) { + if (istest) { + static time_t ot; + time_t t = time (NULL); + if (t != ot && t != ot + 1) { + if (data > 7 || data < -7) + setmousestate (i, k, data, 0); + } + } else { + setmousestate (i, k, data, 0); + } + } } for (k = 0; k < did->buttons; k++) { if (did->buttonmappings[k] == dimofs) { diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index fe8b7922..c293c6cd 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -2284,7 +2284,9 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int depth, int mmult) if (hzmult > 0) { vsync2 = 1; } else if (hzmult < 0) { - if (ap->gfx_vflip && !ap->gfx_strobo) { + if (ap->gfx_strobo) { + vsync2 = -2; + } else if (ap->gfx_vflip) { if (d3dCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO) dpp.PresentationInterval = D3DPRESENT_INTERVAL_TWO; else @@ -3150,6 +3152,7 @@ void D3D_showframe_special (int mode) return; hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, d3ddebug ? 0x80 : 0, 0), 0, 0); D3D_showframe2 (true); + flushgpu (true); } void D3D_refresh (void) diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index bf75cbc0..ad86ddae 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -1030,7 +1030,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM DWORD ret = 0; int ok = 0; screenshotmode = 0; - write_log (_T("'%s' '%s'\n"), rpsc->szScreenFiltered, rpsc->szScreenRaw); + //write_log (_T("'%s' '%s'\n"), rpsc->szScreenFiltered, rpsc->szScreenRaw); if (rpsc->szScreenFiltered[0]) ok = screenshotf (rpsc->szScreenFiltered, 1, 1, 0, NULL); if (rpsc->szScreenRaw[0]) { @@ -1051,7 +1051,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM freevidbuffer (&vb); } screenshotmode = ossm; - write_log (_T("->%d\n"), ok); + //write_log (_T("->%d\n"), ok); if (!ok) return RP_SCREENCAPTURE_ERROR; if (WIN32GFX_IsPicassoScreen ()) { @@ -1112,7 +1112,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM case RP_IPC_TO_GUEST_QUERYSCREENMODE: { screenmode_request = 1; - write_log (_T("RP_IPC_TO_GUEST_QUERYSCREENMODE -> RP_IPC_TO_HOST_SCREENMODE screenmode_request started\n")); + //write_log (_T("RP_IPC_TO_GUEST_QUERYSCREENMODE -> RP_IPC_TO_HOST_SCREENMODE screenmode_request started\n")); return 1; } case RP_IPC_TO_GUEST_GUESTAPIVERSION: @@ -1667,7 +1667,7 @@ void rp_turbo_floppy (int active) void rp_set_hwnd_delayed (void) { hwndset_delay = 4; - write_log (_T("RP_IPC_TO_HOST_SCREENMODE delay started\n")); + //write_log (_T("RP_IPC_TO_HOST_SCREENMODE delay started\n")); } void rp_set_hwnd (HWND hWnd) @@ -1677,10 +1677,10 @@ void rp_set_hwnd (HWND hWnd) if (!initialized) return; if (hwndset_delay) { - write_log (_T("RP_IPC_TO_HOST_SCREENMODE, delay=%d\n"), hwndset_delay); + //write_log (_T("RP_IPC_TO_HOST_SCREENMODE, delay=%d\n"), hwndset_delay); return; } - write_log (_T("RP_IPC_TO_HOST_SCREENMODE\n")); + //write_log (_T("RP_IPC_TO_HOST_SCREENMODE\n")); guestwindow = hWnd; get_screenmode (&sm, &currprefs); if (hWnd != NULL) @@ -1690,10 +1690,10 @@ void rp_set_hwnd (HWND hWnd) void rp_screenmode_changed (void) { - write_log (_T("rp_screenmode_changed\n")); + //write_log (_T("rp_screenmode_changed\n")); if (!screenmode_request) { screenmode_request = 6; - write_log (_T("rp_screenmode_changed -> screenmode_request started\n")); + //write_log (_T("rp_screenmode_changed -> screenmode_request started\n")); } } @@ -1744,7 +1744,7 @@ void rp_vsync (void) if (screenmode_request) { screenmode_request--; if (screenmode_request == 0) { - write_log (_T("RP_IPC_TO_HOST_SCREENMODE screenmode_request timeout\n")); + //write_log (_T("RP_IPC_TO_HOST_SCREENMODE screenmode_request timeout\n")); struct RPScreenMode sm = { 0 }; get_screenmode (&sm, &currprefs); RPSendMessagex (RP_IPC_TO_HOST_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index bed9792f..92d793d0 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -1216,6 +1216,18 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, uae_quit (); return 0; + case WM_WINDOWPOSCHANGED: + { + WINDOWPOS *wp = (WINDOWPOS*)lParam; + if (isfullscreen () <= 0) { + if (!IsIconic (hWnd) && hWnd == hAmigaWnd) { + updatewinrect (false); + updatemouseclip (); + } + } + } + break; + case WM_SETCURSOR: { if ((HWND)wParam == hAmigaWnd && currprefs.input_tablet > 0 && currprefs.input_magic_mouse && isfullscreen () <= 0) { diff --git a/od-win32/win32.h b/od-win32/win32.h index 7e997658..e6110f37 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,11 +19,11 @@ #define LANG_DLL 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("15") +#define WINUAEBETA _T("16") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2013, 4, 6) +#define WINUAEDATE MAKEBD(2013, 4, 13) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index c18e8978..3b328197 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1000,7 +1000,7 @@ bool render_screen (bool immediate) return render_ok; cnt = 0; while (wait_render) { - sleep_millis(1); + sleep_millis (1); cnt++; if (cnt > 500) return render_ok; @@ -2962,7 +2962,7 @@ static int frame_missed, frame_counted, frame_errors; static int frame_usage, frame_usage_avg, frame_usage_total; extern int log_vsync; static int dooddevenskip; -static volatile bool vblank_skipeveryother; +static volatile int vblank_skipeveryother; static int vblank_flip_delay; static int lacemismatch_post_frames = 5; @@ -3055,13 +3055,13 @@ static unsigned int __stdcall vblankthread (void *dummy) if (vp > maxscanline / 2) vp = maxscanline / 2; frame_time_t rpt = read_processor_time (); - vblank_prev_time2 = rpt - (vblankbaseadjust + (vblankbasefull * vp / maxscanline) / (vblank_skipeveryother ? 2 : 1)); + vblank_prev_time2 = rpt - (vblankbaseadjust + (vblankbasefull * vp / maxscanline) / (vblank_skipeveryother > 0 ? 2 : 1)); vblank_prev_time = vblank_prev_time2; firstvblankbasewait2 = false; prevvblankpos = -1; vblank_found_flipdelay = 0; doflipped = false; - if (vblank_skipeveryother) // wait for first vblank in skip frame mode (100Hz+) + if (vblank_skipeveryother > 0) // wait for first vblank in skip frame mode (100Hz+) vblankthread_mode = VBLANKTH_ACTIVE_SKIPFRAME; else vblankthread_mode = VBLANKTH_ACTIVE; @@ -3104,7 +3104,7 @@ static unsigned int __stdcall vblankthread (void *dummy) } if (!doflipped && ap->gfx_vflip > 0) { int flag = 1; - if (ap->gfx_strobo && vblank_skipeveryother) + if (ap->gfx_strobo && vblank_skipeveryother > 0) flag |= 2; doflipevent (flag); doflipped = true; @@ -3114,12 +3114,27 @@ static unsigned int __stdcall vblankthread (void *dummy) thread_vblank_time2 = t; vblank_found_chipset = true; if (!ap->gfx_vflip) { - while (!render_ok) { - if (read_processor_time () - t > vblankbasefull) - break; + if (vblank_skipeveryother >= 0) { + while (!render_ok) { + if (read_processor_time () - t > vblankbasefull) + break; + } + show_screen (0); + render_ok = false; + } else if (vblank_skipeveryother == -1) { + while (!render_ok) { + if (read_processor_time () - t > vblankbasefull) + break; + } + show_screen (0); + render_ok = false; + wait_render = true; + vblank_skipeveryother = -2; + } else { // == -2 + show_screen (2); + wait_render = false; + vblank_skipeveryother = -1; } - show_screen (0); - render_ok = false; int delay = read_processor_time () - t; if (delay < 0) delay = 0; @@ -3153,7 +3168,10 @@ static unsigned int __stdcall vblankthread (void *dummy) thread_vblank_time = thread_vblank_time2; vblank_found_rtg = vblank_found_rtg2; vblank_found = vblank_found2; - vblankthread_mode = VBLANKTH_ACTIVE_WAIT; + if (vblank_skipeveryother == -2) + vblankthread_mode = VBLANKTH_ACTIVE_START; + else + vblankthread_mode = VBLANKTH_ACTIVE_WAIT; SetEvent (vblankwaitevent); } else if (!donotwait || ap->gfx_vflip || picasso_on) { sleep_millis (1); @@ -3169,7 +3187,8 @@ static unsigned int __stdcall vblankthread (void *dummy) static bool isthreadedvsync (void) { - return isvsync_chipset () <= -2 || isvsync_rtg () < 0; + struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0]; + return isvsync_chipset () <= -2 || isvsync_rtg () < 0 || ap->gfx_strobo; } frame_time_t vsync_busywait_end (int *flipdelay) @@ -3581,11 +3600,15 @@ double vblank_calibrate (double approx_vblank, bool waitonly) tsum = approx_vblank; skip: - vblank_skipeveryother = false; + vblank_skipeveryother = 0; getvsyncrate (tsum, &mult); if (mult < 0) { div = 2.0; - vblank_skipeveryother = true; + vblank_skipeveryother = 1; + if (ap->gfx_strobo && ap->gfx_vflip == 0) { + vblank_skipeveryother = -1; + div = 1.0; + } } else if (mult > 0) { div = 0.5; } else { @@ -3596,7 +3619,7 @@ skip: vblankbasefull = (syncbase / tsum2); vblankbasewait1 = (syncbase / tsum2) * 70 / 100; vblankbasewait2 = (syncbase / tsum2) * 55 / 100; - vblankbasewait3 = (syncbase / tsum2) * 99 / 100 - syncbase / (250 * (vblank_skipeveryother ? 1 : 2)); // at least 2ms before vblank + vblankbasewait3 = (syncbase / tsum2) * 99 / 100 - syncbase / (250 * (vblank_skipeveryother > 0 ? 1 : 2)); // at least 2ms before vblank vblankbaselace = lace; write_log (_T("VSync %s: %.6fHz/%.1f=%.6fHz. MinV=%d MaxV=%d%s Adj=%d Units=%d %.1f%%\n"), @@ -3978,6 +4001,8 @@ static BOOL doInit (void) if (wasfullwindow_p == 0) wasfullwindow_p = currprefs.gfx_apmode[1].gfx_fullscreen == GFX_FULLWINDOW ? 1 : -1; gfxmode_reset (); + freevidbuffer (&gfxvidinfo.drawbuffer); + freevidbuffer (&gfxvidinfo.tempbuffer); for (;;) { updatemodes (); @@ -4095,8 +4120,6 @@ static BOOL doInit (void) #endif gfxvidinfo.drawbuffer.emergmem = scrlinebuf; // memcpy from system-memory to video-memory - freevidbuffer (&gfxvidinfo.drawbuffer); - freevidbuffer (&gfxvidinfo.tempbuffer); gfxvidinfo.drawbuffer.realbufmem = NULL; gfxvidinfo.drawbuffer.bufmem = NULL; gfxvidinfo.drawbuffer.bufmem_allocated = NULL; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 93a8a733..0c1dd18b 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -12687,13 +12687,27 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw break; } } + if (!found) { + for (int i = 0; i < wcnt; i++) { + input_selected_widget = widgets[i]; + type = inputdevice_get_widget_type (input_selected_device, input_selected_widget, NULL); + if (type == IDEV_WIDGET_AXIS) { + found = 2; + break; + } + } + } + for (int i = 0; i < wcnt; i++) { int typex = inputdevice_get_widget_type (input_selected_device, widgets[i], NULL); if (typex == IDEV_WIDGET_AXIS) { if (!found) { found = 1; input_selected_widget = widgets[i]; - } else if (found && type == IDEV_WIDGET_BUTTONAXIS) { + } else if (found == 1 && type == IDEV_WIDGET_BUTTONAXIS) { + axisevent = widgets[i]; + axisstate = widgetstate[i]; + } else if (found == 2 && type == IDEV_WIDGET_AXIS) { axisevent = widgets[i]; axisstate = widgetstate[i]; } @@ -12719,10 +12733,12 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw //write_log (_T("%d %d %d %d %d\n"), input_selected_device, input_selected_widget, type, evtnum, type2); // if this and previous are same axis and they match (up/down or left/right) - if ((inputmap_remap_counter & 1) == 1) { + // and not oneshot mode + if (!inputmap_oneshot && (inputmap_remap_counter & 1) == 1) { if (type2 == IDEV_WIDGET_BUTTONAXIS && prevtype2 == IDEV_WIDGET_BUTTONAXIS) { - if (type == IDEV_WIDGET_BUTTONAXIS && prevtype == IDEV_WIDGET_BUTTONAXIS) { - if (axisevent == prevaxisevent && (axisstate > 0 && prevaxisstate < 0)) { + if (axisevent == prevaxisevent && (axisstate > 0 && prevaxisstate < 0)) { + if ((type == IDEV_WIDGET_BUTTONAXIS && prevtype == IDEV_WIDGET_BUTTONAXIS) || + (type == IDEV_WIDGET_AXIS && prevtype == IDEV_WIDGET_AXIS)) { for (int i = 0; i < wcnt; i++) { wtype = widgets[i]; if (inputdevice_get_widget_type (input_selected_device, wtype, NULL) == IDEV_WIDGET_AXIS) { @@ -13004,6 +13020,37 @@ static int getremapcounter(int item) return 0; } +static void fillinputmapadd (HWND hDlg) +{ + const int *axistable; + int inputlist[MAX_COMPA_INPUTLIST]; + inputdevice_get_compatibility_input (&workprefs, inputmap_port, NULL, inputlist, &axistable); + SendDlgItemMessage (hDlg, IDC_INPUTMAPADD, CB_RESETCONTENT, 0, 0L); + int evt = 1; + for (;;) { + bool ignore = false; + struct inputevent *ie = inputdevice_get_eventinfo (evt); + if (!ie) + break; + if (_tcslen (ie->name) == 0) { + evt++; + continue; + } + for (int k = 0; axistable[k] >= 0; k += 3) { + if (evt == axistable[k] || evt == axistable[k + 1] || evt == axistable[k + 2]) { + for (int l = 0; inputlist[l] >= 0; l++) { + if (inputlist[l] == axistable[k] || inputlist[l] == axistable[k + 1] || inputlist[l] == axistable[k + 1]) { + ignore = true; + } + } + } + } + if (!ignore) + SendDlgItemMessage (hDlg, IDC_INPUTMAPADD, CB_ADDSTRING, 0, (LPARAM)ie->name); + evt++; + } +} + static INT_PTR CALLBACK InputMapDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive; @@ -13019,30 +13066,11 @@ static INT_PTR CALLBACK InputMapDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA return TRUE; case WM_INITDIALOG: { - const int *axislist; inputmap_port_remap = -1; inputmap_remap_counter = -1; inputmap_view_offset = 0; pages[INPUTMAP_ID] = hDlg; - - inputdevice_get_compatibility_input (&workprefs, inputmap_port, NULL, NULL, &axislist); - SendDlgItemMessage (hDlg, IDC_INPUTMAPADD, CB_RESETCONTENT, 0, 0L); - SendDlgItemMessage (hDlg, IDC_INPUTMAPADD, CB_ADDSTRING, 0, (LPARAM)szNone.c_str()); - i = 1; - for (;;) { - int j; - struct inputevent *ie = inputdevice_get_eventinfo (i); - if (!ie) - break; - for (j = 0; axislist[j] >= 0; j++) { - if (axislist[j] == i) - break; - } - if (axislist[j] < 0 && _tcslen (ie->name) > 0) - SendDlgItemMessage (hDlg, IDC_INPUTMAPADD, CB_ADDSTRING, 0, (LPARAM)ie->name); - i++; - } - + fillinputmapadd (hDlg); inputdevice_updateconfig (NULL, &workprefs); InitializeListView (hDlg); if (workprefs.jports[inputmap_port].id != JPORT_CUSTOM) { @@ -13149,6 +13177,7 @@ static INT_PTR CALLBACK InputMapDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA inputmap_port_remap = inputmap_port; inputdevice_compa_prepare_custom (&workprefs, inputmap_port, -1, true); inputdevice_updateconfig (NULL, &workprefs); + fillinputmapadd (hDlg); InitializeListView (hDlg); ListView_EnsureVisible (h, inputmap_remap_counter, FALSE); ListView_SetItemState (h, -1, 0, LVIS_SELECTED | LVIS_FOCUSED); diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index d6a3af9d..4a29aa35 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,25 @@ - restore only single input target to default. +Beta 16: + +This beta should fix all strange display glitches introduced in previous 2.6 betas. + +- New style filter mask config entry didn't load. (b6 or later) +- Improved mouse movement mapping in GamePorts panel remap window (It creates mouse movement mappings that makes sense..), + also implements 1s delay before next mouse movement is accepted in test/remap modes to reduce accidental events. +- Don't attempt to combine left/right->horizontal and up/down->vertical if remapping single event. +- Add select menu didn't include any "standard" device-specific events. (Incorrect filtering) +- DirectDraw + none filter was slow. (b7) +- Blitter changes in b12 still had some problems. +- "Subtle Shades" update was still broken, caused strange glitches in some situations. +- Left and right border was always fully blanked if scanline was in HAM mode. +- Low latency vsync + black frame insertion now always uses threaded vsync mode, normally was only used if fastest possible + CPU mode is in use (If you have 100Hz+ monitor, especially lightboost, your PC shouldn't be low end..), improves + stability. No buffer also supported but it can be unstable. +- Added "gfx_autoresolution_delay" config entry. Number of frames to wait before autoresolution mode changes, timeout will + always reset if mode change is detected during timeout countdown. + Beta 15: - IDE emulation drive status bit fix (DRQ and BSY active at the same time), fixes data corruption if IDEFix was active. (b5). -- 2.47.3