From 7b92fa85ab54ca58b07034a29694feb99497e3a0 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 13 Dec 2025 12:27:24 +0200 Subject: [PATCH] lightpen_offset_gfx --- cfgfile.cpp | 6 ++++-- drawing.cpp | 29 ++++++++++++----------------- include/options.h | 2 +- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index 5dac884a..6f426b7c 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -2629,7 +2629,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_strarr(f, _T("monitoremu"), specialmonitorconfignames, p->monitoremu); #endif cfgfile_dwrite(f, _T("monitoremu_monitor"), _T("%d"), p->monitoremu_mon); - cfgfile_dwrite_coords(f, _T("lightpen_offset"), p->lightpen_offset[0], p->lightpen_offset[1]); + cfgfile_dwrite_coords(f, _T("lightpen_offset"), p->lightpen_offset[0][0], p->lightpen_offset[0][1]); + cfgfile_dwrite_coords(f, _T("lightpen_offset_gfx"), p->lightpen_offset[1][0], p->lightpen_offset[1][1]); cfgfile_dwrite_bool(f, _T("lightpen_crosshair"), p->lightpen_crosshair); cfgfile_dwrite_bool (f, _T("show_leds"), !!(p->leds_on_screen & STATUSLINE_CHIPSET)); @@ -5993,7 +5994,8 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_yesno(option, value, _T("gfxcard_dacswitch"), &p->rtg_dacswitch) || cfgfile_yesno(option, value, _T("gfxcard_multithread"), &p->rtg_multithread) || cfgfile_yesno(option, value, _T("synchronize_clock"), &p->tod_hack) - || cfgfile_coords(option, value, _T("lightpen_offset"), &p->lightpen_offset[0], &p->lightpen_offset[1]) + || cfgfile_coords(option, value, _T("lightpen_offset"), &p->lightpen_offset[0][0], &p->lightpen_offset[0][1]) + || cfgfile_coords(option, value, _T("lightpen_offset_gfx"), &p->lightpen_offset[1][0], &p->lightpen_offset[1][1]) || cfgfile_yesno(option, value, _T("lightpen_crosshair"), &p->lightpen_crosshair) || cfgfile_yesno(option, value, _T("kickshifter"), &p->kickshifter) diff --git a/drawing.cpp b/drawing.cpp index c42041ce..b7ca249d 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -1691,8 +1691,6 @@ static void init_drawing_frame(void) thisframe_last_drawn_line = -1; } -static int lightpen_y1[2], lightpen_y2[2]; - void putpixel(uae_u8 *buf, uae_u8 *genlockbuf, int x, xcolnr c8) { if (x <= 0) @@ -1808,12 +1806,12 @@ static const char *lightpen_cursor = { "------.....------" "------.xxx.------" "------.xxx.------" - "------.xxx.------" - ".......xxx......." - ".xxxxxxxxxxxxxxx." - ".xxxxxxxxxxxxxxx." - ".......xxx......." - "------.xxx.------" + "-------.x.-------" + "......-----......" + ".xxxx-------xxxx." + ".xxxx-------xxxx." + "......-----......" + "-------.x.-------" "------.xxx.------" "------.xxx.------" "------.....------" @@ -1874,8 +1872,8 @@ static void lightpen_update(struct vidbuffer *vb, int lpnum) cy >>= linedbl; cy += minfirstline; - cx += currprefs.lightpen_offset[0]; - cy += currprefs.lightpen_offset[1]; + cx += currprefs.lightpen_offset[0][0]; + cy += currprefs.lightpen_offset[0][1]; if (cx <= 0x18 - 1) { cx = 0x18 - 1; @@ -1893,21 +1891,20 @@ static void lightpen_update(struct vidbuffer *vb, int lpnum) if (currprefs.lightpen_crosshair && lightpen_active) { if (denise_lock()) { for (int i = 0; i < LIGHTPEN_HEIGHT; i++) { - int line = lightpen_y[lpnum] + i - LIGHTPEN_HEIGHT / 2; + int line = lightpen_y[lpnum] + i - LIGHTPEN_HEIGHT / 2 + currprefs.lightpen_offset[1][1]; if (line >= 0 && line < max_ypos_thisframe1) { if (lightpen_active & (1 << lpnum)) { - draw_lightpen_cursor(vb->monitor_id, lightpen_x[lpnum], i, line, cx > 0, lpnum); + draw_lightpen_cursor(vb->monitor_id, lightpen_x[lpnum] + currprefs.lightpen_offset[1][0], i, line, cx > 0, lpnum); } } } } } - lightpen_y1[lpnum] = lightpen_y[lpnum] - LIGHTPEN_HEIGHT / 2 - 1 + (thisframe_y_adjust_real >> linedbl); - lightpen_y2[lpnum] = lightpen_y1[lpnum] + LIGHTPEN_HEIGHT + 1 + (thisframe_y_adjust_real >> linedbl); - lightpen_cx[lpnum] = out ? -1 : cx; lightpen_cy[lpnum] = out ? -1 : cy; + + //write_log("%03d*%03d\n", cx, cy); } static void refresh_indicator_init(void) @@ -2371,8 +2368,6 @@ void reset_drawing(void) init_drawing_frame(); frame_res_cnt = currprefs.gfx_autoresolution_delay; - lightpen_y1[0] = lightpen_y2[0] = -1; - lightpen_y1[1] = lightpen_y2[1] = -1; reset_custom_limits(); diff --git a/include/options.h b/include/options.h index 5452f854..07318fc0 100644 --- a/include/options.h +++ b/include/options.h @@ -623,7 +623,7 @@ struct uae_prefs { int lightboost_strobo_ratio; bool gfx_grayscale; bool lightpen_crosshair; - int lightpen_offset[2]; + int lightpen_offset[2][2]; int gfx_display_sections; int gfx_variable_sync; bool gfx_windowed_resize; -- 2.47.3