From 99673b6b7e2fdedfcd89e43098d88c88837f5b00 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 26 Dec 2008 20:22:54 +0200 Subject: [PATCH] imported winuaesrc1540b6.zip --- cfgfile.c | 4 ++- custom.c | 33 +++++++++++++++-- drawing.c | 68 ++++++++++++++++++++---------------- main.c | 9 ++--- od-win32/win32.h | 2 +- od-win32/win32_scale2x.c | 8 ++--- od-win32/win32gui.c | 29 ++++++++------- od-win32/winuaechangelog.txt | 11 ++++++ 8 files changed, 103 insertions(+), 61 deletions(-) diff --git a/cfgfile.c b/cfgfile.c index 5d631a2d..585f1e32 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -581,6 +581,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite (f, "gfx_filter_blur=%d\n", p->gfx_filter_blur); cfgfile_dwrite (f, "gfx_filter_noise=%d\n", p->gfx_filter_noise); cfgfile_dwrite (f, "gfx_filter_keep_aspect=%s\n", p->gfx_filter_keep_aspect ? "true" : "false"); + cfgfile_dwrite (f, "gfx_autoscale=%s\n", p->gfx_filter_autoscale ? "true" : "false"); cfgfile_dwrite (f, "gfx_filter_aspect_ratio=%d:%d\n", p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect >> 8) : -1, p->gfx_filter_aspect >= 0 ? (p->gfx_filter_aspect & 0xff) : -1); @@ -904,6 +905,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) || cfgfile_intval (option, value, "gfx_filter_blur", &p->gfx_filter_blur, 1) || cfgfile_intval (option, value, "gfx_filter_noise", &p->gfx_filter_noise, 1) || cfgfile_yesno (option, value, "gfx_filter_keep_aspect", &p->gfx_filter_keep_aspect) + || cfgfile_yesno (option, value, "gfx_filter_autoscale", &p->gfx_filter_autoscale) || cfgfile_intval (option, value, "gfx_luminance", &p->gfx_luminance, 1) || cfgfile_intval (option, value, "gfx_contrast", &p->gfx_contrast, 1) || cfgfile_intval (option, value, "gfx_gamma", &p->gfx_gamma, 1) @@ -3009,7 +3011,7 @@ void default_prefs (struct uae_prefs *p, int type) p->gfx_filter_vert_zoom_mult = 0; p->gfx_filter_filtermode = 0; p->gfx_filter_scanlineratio = (1 << 4) | 1; - p->gfx_filter_keep_aspect = 0; + p->gfx_filter_keep_aspect = 1; p->gfx_filter_autoscale = 1; strcpy (p->df[0], "df0.adf"); diff --git a/custom.c b/custom.c index 9cc86f29..dd2e7aaf 100755 --- a/custom.c +++ b/custom.c @@ -242,16 +242,18 @@ enum diw_states DIW_waiting_start, DIW_waiting_stop }; -int plffirstline, plflastline; +static int plffirstline, plflastline; +int plffirstline_total, plflastline_total; static int plfstrt_start, plfstrt, plfstop; static int sprite_minx, sprite_maxx; static int first_bpl_vpos; static int last_diw_pix_hpos, last_ddf_pix_hpos; static int last_decide_line_hpos, last_sprite_decide_line_hpos; static int last_fetch_hpos, last_sprite_hpos; -int diwfirstword, diwlastword; +static int diwfirstword, diwlastword; static enum diw_states diwstate, hdiwstate, ddfstate; int first_planes_vpos, last_planes_vpos; +int diwfirstword_total, diwlastword_total; /* Sprite collisions */ static unsigned int clxdat, clxcon, clxcon2, clxcon_bpl_enable, clxcon_bpl_match; @@ -2254,6 +2256,17 @@ static void decide_sprites (int hpos) record_sprite (next_lineno, nr, posns[i], sprdata[nr], sprdatb[nr], sprctl[nr]); } last_sprite_point = point; + + if (bplcon3 & 2) { + if (vpos < first_planes_vpos || first_planes_vpos == 0) + first_planes_vpos = vpos; + if (vpos < plffirstline_total) + plffirstline_total = vpos; + if (vpos > last_planes_vpos) + last_planes_vpos = vpos; + if (vpos > plflastline_total) + plflastline_total = vpos; + } } STATIC_INLINE int sprites_differ (struct draw_info *dip, struct draw_info *dip_old) @@ -4414,6 +4427,10 @@ static void init_hardware_frame (void) ddfstate = DIW_waiting_start; first_planes_vpos = 0; last_planes_vpos = 0; + diwfirstword_total = max_diwlastword; + diwlastword_total = 0; + plflastline_total = 0; + plffirstline_total = maxvpos; } void init_hardware_for_drawing_frame (void) @@ -4925,6 +4942,7 @@ static void hsync_handler (void) hsync_counter++; //copper_check (2); + if (vpos == minfirstline) { if (GET_PLANES (bplcon0) > 0) first_planes_vpos = minfirstline; @@ -4932,6 +4950,17 @@ static void hsync_handler (void) if (GET_PLANES (bplcon0) > 0) last_planes_vpos = vpos - 1; } + if (vpos >= first_planes_vpos && vpos <= last_planes_vpos) { + if (diwlastword > diwlastword_total) + diwlastword_total = diwlastword; + if (diwfirstword < diwfirstword_total) + diwfirstword_total = diwfirstword; + } + if (plffirstline < plffirstline_total) + plffirstline_total = plffirstline; + if (plflastline > plflastline_total) + plflastline_total = plflastline; + #if 0 { diff --git a/drawing.c b/drawing.c index 2580ead0..7a81580e 100755 --- a/drawing.c +++ b/drawing.c @@ -308,36 +308,38 @@ void notice_screen_contents_lost (void) } -extern int plffirstline, plflastline; +extern int plffirstline_total, plflastline_total; extern int first_planes_vpos, last_planes_vpos; +extern int diwfirstword_total, diwlastword_total; #define MIN_DISPLAY_W 256 #define MIN_DISPLAY_H 192 #define MAX_DISPLAY_W 344 #define MAX_DISPLAY_H 272 +static int gclow, gcloh, gclox, gcloy; + int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy) { int w, h, dx, dy, y1, y2, dbl1, dbl2; - static int ow, oh, ox, oy; int ret = 0; - *pw = ow; - *ph = oh; - *pdx = ox; - *pdy = oy; + *pw = gclow; + *ph = gcloh; + *pdx = gclox; + *pdy = gcloy; - if (ow > 0 && oh > 0) + if (gclow > 0 && gcloh > 0) ret = -1; - w = diwlastword - diwfirstword; - dx = diwfirstword - visible_left_border; - y2 = plflastline > last_planes_vpos ? last_planes_vpos : plflastline; - y1 = plffirstline > first_planes_vpos ? plffirstline : first_planes_vpos; + w = diwlastword_total - diwfirstword_total; + dx = diwfirstword_total - visible_left_border; + y2 = plflastline_total > last_planes_vpos ? last_planes_vpos : plflastline_total; + y1 = plffirstline_total > first_planes_vpos ? plffirstline_total: first_planes_vpos; if (y1 < minfirstline) y1 = first_planes_vpos; h = y2 - y1; - dy = plffirstline - minfirstline; + dy = plffirstline_total - minfirstline; if (dy < 0) dy = first_planes_vpos - minfirstline; @@ -348,16 +350,6 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy) if (w == 0 || h == 0) return 0; - if (ow == w && oh == h && ox == dx && oy == dy) - return ret; - - if (w <= 0 || h <= 0 || dx <= 0 || dy <= 0) - return ret; - if (dx > gfxvidinfo.width / 4) - return ret; - if (dy > gfxvidinfo.height / 4) - return ret; - if ((w >> currprefs.gfx_resolution) < MIN_DISPLAY_W) w = MIN_DISPLAY_W << currprefs.gfx_resolution; if ((h >> dbl1) < MIN_DISPLAY_H) @@ -368,14 +360,26 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy) if ((h >> dbl1) > MAX_DISPLAY_H) h = MAX_DISPLAY_H << dbl1; - ow = w; - oh = h; - ox = dx; - oy = dy; + if (gclow == w && gcloh == h && gclox == dx && gcloy == dy) + return ret; + + if (w <= 0 || h <= 0 || dx <= 0 || dy <= 0) + return ret; + if (dx > gfxvidinfo.width / 4) + return ret; + if (dy > gfxvidinfo.height / 4) + return ret; + + gclow = w; + gcloh = h; + gclox = dx; + gcloy = dy; *pw = w; *ph = h; *pdx = dx; *pdy = dy; + + write_log ("%dx%d %dx%d\n", w, h, dx, dy); return 1; } @@ -383,12 +387,12 @@ void get_custom_mouse_limits (int *pw, int *ph, int *pdx, int *pdy, int dbl) { int w, h, dx, dy, dbl1, dbl2, y1, y2; - w = diwlastword - diwfirstword; - dx = diwfirstword - visible_left_border; - y2 = plflastline > last_planes_vpos ? last_planes_vpos : plflastline; - y1 = plffirstline > first_planes_vpos ? plffirstline : first_planes_vpos; + w = diwlastword_total - diwfirstword_total; + dx = diwfirstword_total - visible_left_border; + y2 = plflastline_total > last_planes_vpos ? last_planes_vpos : plflastline_total; + y1 = plffirstline_total > first_planes_vpos ? plffirstline_total : first_planes_vpos; h = y2 - y1; - dy = plffirstline - minfirstline; + dy = plffirstline_total - minfirstline; if (*pw > 0) w = *pw; @@ -2841,6 +2845,8 @@ void reset_drawing (void) sprite_buffer_res = currprefs.gfx_resolution; if (doublescan > 0 && sprite_buffer_res < RES_SUPERHIRES) sprite_buffer_res++; + + gclow = gcloh = gclox = gcloy = 0; } void drawing_init (void) diff --git a/main.c b/main.c index eb1888ca..25f63641 100755 --- a/main.c +++ b/main.c @@ -126,16 +126,11 @@ 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) { + if (prefs->gfx_filter == 0 && prefs->gfx_filter_autoscale) prefs->gfx_filter = 1; - prefs->gfx_filter_horiz_zoom = 0; - prefs->gfx_filter_vert_zoom = 0; - prefs->gfx_filtershader[0] = 0; + if (prefs->gfx_filter_autoscale) { prefs->gfx_filter_horiz_zoom_mult = 0; prefs->gfx_filter_vert_zoom_mult = 0; - prefs->gfx_filter_filtermode = 0; - prefs->gfx_filter_autoscale = 1; - prefs->gfx_filter_keep_aspect = 0; } } diff --git a/od-win32/win32.h b/od-win32/win32.h index ba380c95..07aeca93 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -17,7 +17,7 @@ #define WINUAEPUBLICBETA 1 -#define WINUAEBETA "5" +#define WINUAEBETA "6" #define WINUAEDATE MAKEBD(2008, 12, 26) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32_scale2x.c b/od-win32/win32_scale2x.c index 4e4dc5ea..bff1ed41 100755 --- a/od-win32/win32_scale2x.c +++ b/od-win32/win32_scale2x.c @@ -146,12 +146,12 @@ void getfilterrect2 (RECT *sr, RECT *dr, int dst_width, int dst_height, int aw, if (xratio > yratio) { diff = diffx - diffx * yratio / xratio; - dr->right += diff; - dr->left -= diff; + dr->right += diff / 2; + dr->left -= diff / 2; } else { diff = diffx - diffx * xratio / yratio; - dr->bottom += diff; - dr->top -= diff; + dr->bottom += diff / 2; + dr->top -= diff / 2; } } diff = dr->right - dr->left; diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 6f27dbbc..c0735f3d 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -9771,9 +9771,6 @@ static void enable_for_hw3ddlg (HWND hDlg) vv3 = TRUE; if (v && uf->x[0]) vv4 = TRUE; -// ew (hDlg, IDC_FILTERENABLE, TRUE); - ew (hDlg, IDC_FILTERMODE, v); -// CheckDlgButton (hDlg, IDC_FILTERENABLE, v); ew (hDlg, IDC_FILTERHZ, v); ew (hDlg, IDC_FILTERVZ, v); ew (hDlg, IDC_FILTERHZMULT, v && !as); @@ -9788,7 +9785,6 @@ static void enable_for_hw3ddlg (HWND hDlg) ew (hDlg, IDC_FILTERFILTER, vv); ew (hDlg, IDC_FILTERKEEPASPECT, v); ew (hDlg, IDC_FILTERASPECT, v); - ew (hDlg, IDC_FILTERAUTORES, v); ew (hDlg, IDC_FILTERPRESETSAVE, filterpreset_builtin < 0); ew (hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0); @@ -9900,9 +9896,11 @@ static void values_to_hw3ddlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_FILTERVO, TBM_SETPAGESIZE, 0, 1); SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_RESETCONTENT, 0, 0L); + WIN32GUI_LoadUIString (IDS_NONE, tmp, MAX_DPATH); + SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)tmp); uf = &uaefilters[0]; nofilter = 0; fltnum = 0; - i = 0; j = 0; + i = 0; j = 1; while (uaefilters[i].name) { switch (uaefilters[i].type) { @@ -10192,12 +10190,13 @@ static void filter_handle (HWND hDlg) tmp[0] = 0; SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp); workprefs.gfx_filtershader[0] = 0; - if (item > UAE_FILTER_PAL) { - item = UAE_FILTER_DIRECT3D - 1; - sprintf (workprefs.gfx_filtershader, "%s.fx", tmp + 5); - } - workprefs.gfx_filter = 1; - if (1) { //IsDlgButtonChecked (hDlg, IDC_FILTERENABLE)) { + workprefs.gfx_filter = 0; + if (item > 0) { + item--; + if (item > UAE_FILTER_PAL) { + item = UAE_FILTER_DIRECT3D - 1; + sprintf (workprefs.gfx_filtershader, "%s.fx", tmp + 5); + } workprefs.gfx_filter = uaefilters[item].type; item = SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_GETCURSEL, 0, 0L); if (item != CB_ERR) @@ -10229,7 +10228,6 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_INITDIALOG: - //ShowWindow (GetDlgItem(hDlg, IDC_FILTERAUTORES), SW_HIDE); pages[HW3D_ID] = hDlg; currentpage = HW3D_ID; SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_RESETCONTENT, 0, 0); @@ -10271,11 +10269,12 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM filter_preset (hDlg, wParam); recursive++; break; -// case IDC_FILTERENABLE: -// filter_handle (hDlg); -// break; case IDC_FILTERAUTORES: workprefs.gfx_filter_autoscale = IsDlgButtonChecked (hDlg, IDC_FILTERAUTORES); + if (workprefs.gfx_filter_autoscale && workprefs.gfx_filter == 0) + workprefs.gfx_filter = 1; + values_to_hw3ddlg (hDlg); + enable_for_hw3ddlg (hDlg); break; case IDC_FILTERKEEPASPECT: currprefs.gfx_filter_keep_aspect = workprefs.gfx_filter_keep_aspect = IsDlgButtonChecked (hDlg, IDC_FILTERKEEPASPECT); diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 0945b0cd..fea3d1d4 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,15 @@ + +Beta 6: + +- Spheris Legacy top/bottom border autoscaling fixed +- screen width checking only stored final display size before vblank + (game with wide gamescreen and narrow scoreboard at the bottom would + have used scoreboard's width) +- autoscale saved to config file +- non-filtered mode is back but enabling autoscale will automatically + enable null filter if current selection was no filter + Beta 5: WARNING: big changes. 1.6 version change expected. - KS loader 16-bit odd/even rom image to 32-bit merging fixed -- 2.47.3