From: Toni Wilen Date: Tue, 7 Apr 2020 17:18:32 +0000 (+0300) Subject: OSD scale multiplier. X-Git-Tag: 4400~87 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=5ff30b79ef766bd14d9cb0f3e328d36b2b0d25cb;p=francis%2Fwinuae.git OSD scale multiplier. --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 2aafe646..5e76abb8 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -160,6 +160,7 @@ static const TCHAR *compmode[] = { _T("direct"), _T("indirect"), _T("indirectKS" static const TCHAR *flushmode[] = { _T("soft"), _T("hard"), 0 }; static const TCHAR *kbleds[] = { _T("none"), _T("POWER"), _T("DF0"), _T("DF1"), _T("DF2"), _T("DF3"), _T("HD"), _T("CD"), _T("DFx"), 0 }; static const TCHAR *onscreenleds[] = { _T("false"), _T("true"), _T("rtg"), _T("both"), 0 }; +static const TCHAR *ledscale[] = { _T("automatic"), _T("1x"), _T("2x"), _T("3x"), _T("4x"), 0 }; static const TCHAR *soundfiltermode1[] = { _T("off"), _T("emulated"), _T("on"), 0 }; static const TCHAR *soundfiltermode2[] = { _T("standard"), _T("enhanced"), 0 }; static const TCHAR *lorestype1[] = { _T("lores"), _T("hires"), _T("superhires"), 0 }; @@ -2302,6 +2303,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool (f, _T("show_leds_rtg"), !!(p->leds_on_screen & STATUSLINE_RTG)); write_leds(f, _T("show_leds_enabled"), p->leds_on_screen_mask[0]); write_leds(f, _T("show_leds_enabled_rtg"), p->leds_on_screen_mask[1]); + cfgfile_dwrite_str(f, _T("show_leds_size"), ledscale[p->leds_on_screen_multiplier[0]]); + cfgfile_dwrite_str(f, _T("show_leds_size_rtg"), ledscale[p->leds_on_screen_multiplier[1]]); cfgfile_dwrite_bool(f, _T("show_refresh_indicator"), p->refresh_indicator); cfgfile_dwrite(f, _T("power_led_dim"), _T("%d"), p->power_led_dim); @@ -3565,6 +3568,12 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) p->leds_on_screen &= ~STATUSLINE_RTG; return 1; } + if (_tcscmp(option, _T("show_leds_size")) == 0 || _tcscmp(option, _T("show_leds_size_rtg")) == 0) { + TCHAR tmp[MAX_DPATH]; + int idx = _tcscmp(option, _T("show_leds_size")) == 0 ? 0 : 1; + cfgfile_strval(option, value, option, &p->leds_on_screen_multiplier[idx], ledscale, 0); + return 1; + } if (_tcscmp (option, _T("show_leds_enabled")) == 0 || _tcscmp (option, _T("show_leds_enabled_rtg")) == 0) { TCHAR tmp[MAX_DPATH]; int idx = _tcscmp (option, _T("show_leds_enabled")) == 0 ? 0 : 1; diff --git a/drawing.cpp b/drawing.cpp index 32651aba..53284883 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -3927,11 +3927,12 @@ static void draw_frame_extras(struct vidbuffer *vb, int y_start, int y_end) { if ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && softstatusline()) { int slx, sly; - statusline_getpos(vb->monitor_id, &slx, &sly, vb->outwidth, vb->outheight, 1, 1); + int mult = statusline_get_multiplier(vb->monitor_id); + statusline_getpos(vb->monitor_id, &slx, &sly, vb->outwidth, vb->outheight); statusbar_y1 = sly + min_ypos_for_screen - 1; - statusbar_y2 = statusbar_y1 + TD_TOTAL_HEIGHT + 1; + statusbar_y2 = statusbar_y1 + TD_TOTAL_HEIGHT * mult + 1; draw_status_line(vb->monitor_id, sly, -1); - for (int i = 0; i < TD_TOTAL_HEIGHT; i++) { + for (int i = 0; i < TD_TOTAL_HEIGHT * mult; i++) { int line = sly + i; draw_status_line(vb->monitor_id, line, i); } diff --git a/include/statusline.h b/include/statusline.h index e290cd2f..02589fc1 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -27,10 +27,10 @@ static int td_pos = (TD_RIGHT | TD_BOTTOM); #define STATUSLINE_RTG 2 #define STATUSLINE_TARGET 0x80 -extern void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); -extern void statusline_single_erase(int monid, uae_u8 *buf, int bpp, int y, int totalwidth); -extern void statusline_getpos(int monid, int *x, int *y, int width, int height, int hx, int vx); -extern bool softstatusline(void); +void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); +void statusline_single_erase(int monid, uae_u8 *buf, int bpp, int y, int totalwidth); +void statusline_getpos(int monid, int *x, int *y, int width, int height); +bool softstatusline(void); #define STATUSTYPE_FLOPPY 1 #define STATUSTYPE_DISPLAY 2 @@ -38,14 +38,16 @@ extern bool softstatusline(void); #define STATUSTYPE_CD 4 #define STATUSTYPE_OTHER 5 -extern bool createstatusline(int); -extern void deletestatusline(int); -extern void statusline_render(int, uae_u8 *buf, int bpp, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); -extern void statusline_add_message(int statustype, const TCHAR *format, ...); -extern void statusline_clear(void); -extern void statusline_vsync(void); -extern void statusline_updated(int); -extern bool has_statusline_updated(void); -extern const TCHAR *statusline_fetch(void); +bool createstatusline(int); +void deletestatusline(int); +void statusline_render(int, uae_u8 *buf, int bpp, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); +void statusline_add_message(int statustype, const TCHAR *format, ...); +void statusline_clear(void); +void statusline_vsync(void); +void statusline_updated(int); +bool has_statusline_updated(void); +const TCHAR *statusline_fetch(void); +int statusline_set_multiplier(int, int, int); +int statusline_get_multiplier(int monid); #endif /* UAE_STATUSLINE_H */ diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index ec91a4e5..cd9da64c 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -1410,16 +1410,13 @@ static void updateleds (struct d3dstruct *d3d) for (int y = 0; y < TD_TOTAL_HEIGHT * d3d->statusbar_vx; y++) { uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; - statusline_single_erase(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth * d3d->statusbar_hx); + statusline_single_erase(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth); } statusline_render(d3d - d3ddata, (uae_u8*)locked.pBits, 32 / 8, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a); - int y = 0; - for (int yy = 0; yy < d3d->statusbar_vx * TD_TOTAL_HEIGHT; yy++) { - uae_u8 *buf = (uae_u8*)locked.pBits + yy * locked.Pitch; + for (int y = 0; y < TD_TOTAL_HEIGHT * d3d->statusbar_vx; y++) { + uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; draw_status_line_single(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a); - if ((yy % d3d->statusbar_vx) == 0) - y++; } d3d->ledtexture->UnlockRect (0); @@ -1427,13 +1424,12 @@ static void updateleds (struct d3dstruct *d3d) static int createledtexture (struct d3dstruct *d3d) { + struct AmigaMonitor *mon = &AMonitors[d3d - d3ddata]; + + d3d->statusbar_hx = d3d->statusbar_vx = statusline_set_multiplier(mon->monitor_id, d3d->tout_w, d3d->tout_h); d3d->ledwidth = d3d->window_w; - d3d->ledheight = TD_TOTAL_HEIGHT; - if (d3d->statusbar_hx < 1) - d3d->statusbar_hx = 1; - if (d3d->statusbar_vx < 1) - d3d->statusbar_vx = 1; - d3d->ledtexture = createtext (d3d, d3d->ledwidth * d3d->statusbar_hx, d3d->ledheight * d3d->statusbar_vx, D3DFMT_A8R8G8B8); + d3d->ledheight = TD_TOTAL_HEIGHT * d3d->statusbar_vx; + d3d->ledtexture = createtext(d3d, d3d->ledwidth, d3d->ledheight * d3d->statusbar_vx, D3DFMT_A8R8G8B8); if (!d3d->ledtexture) return 0; return 1; @@ -3727,7 +3723,7 @@ static void D3D_render2(struct d3dstruct *d3d, int mode) } if (d3d->ledtexture && (((currprefs.leds_on_screen & STATUSLINE_RTG) && WIN32GFX_IsPicassoScreen(mon)) || ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !WIN32GFX_IsPicassoScreen(mon)))) { int slx, sly; - statusline_getpos(d3d - d3ddata, &slx, &sly, d3d->window_w, d3d->window_h, d3d->statusbar_hx, d3d->statusbar_vx); + statusline_getpos(d3d - d3ddata, &slx, &sly, d3d->window_w, d3d->window_h); v.x = slx; v.y = sly; v.z = 0; diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index d3237b45..3a16dd76 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -1574,7 +1574,7 @@ static void updateleds(struct d3d11struct *d3d) if (!d3d->osd.texture || d3d != d3d11data) return; - statusline_getpos(d3d - d3d11data, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight, d3d->statusbar_hx, d3d->statusbar_vx); + statusline_getpos(d3d - d3d11data, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight); d3d->osd.x = osdx; d3d->osd.y = osdy; @@ -1585,16 +1585,13 @@ static void updateleds(struct d3d11struct *d3d) } for (int y = 0; y < TD_TOTAL_HEIGHT * d3d->statusbar_vx; y++) { uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch; - statusline_single_erase(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth * d3d->statusbar_hx); + statusline_single_erase(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth); } statusline_render(d3d - d3d11data, (uae_u8*)map.pData, 32 / 8, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a); - int y = 0; - for (int yy = 0; yy < d3d->statusbar_vx * TD_TOTAL_HEIGHT; yy++) { - uae_u8 *buf = (uae_u8*)map.pData + yy * map.RowPitch; + for (int y = 0; y < TD_TOTAL_HEIGHT * d3d->statusbar_vx; y++) { + uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch; draw_status_line_single(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a); - if ((yy % d3d->statusbar_vx) == 0) - y++; } d3d->m_deviceContext->Unmap(d3d->osd.texture, 0); @@ -1922,6 +1919,7 @@ static void erasetexture(struct d3d11struct *d3d) static bool CreateTexture(struct d3d11struct *d3d) { + struct AmigaMonitor *mon = &AMonitors[d3d - d3d11data]; D3D11_TEXTURE2D_DESC desc; D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc; HRESULT hr; @@ -2005,12 +2003,9 @@ static bool CreateTexture(struct d3d11struct *d3d) UpdateVertexArray(d3d, d3d->m_vertexBuffer, 0, 0, 0, 0, 0, 0, 0, 0); + d3d->statusbar_hx = d3d->statusbar_vx = statusline_set_multiplier(mon->monitor_id, d3d->m_screenWidth, d3d->m_screenHeight); d3d->ledwidth = d3d->m_screenWidth; - d3d->ledheight = TD_TOTAL_HEIGHT; - if (d3d->statusbar_hx < 1) - d3d->statusbar_hx = 1; - if (d3d->statusbar_vx < 1) - d3d->statusbar_vx = 1; + d3d->ledheight = TD_TOTAL_HEIGHT * d3d->statusbar_vx; allocsprite(d3d, &d3d->osd, d3d->ledwidth, d3d->ledheight, true); d3d->osd.enabled = true; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index e2da354e..acac9adb 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -4191,14 +4191,14 @@ void picasso_statusline(int monid, uae_u8 *dst) if (dst_width > vidinfo->width) dst_width = vidinfo->width; pitch = vidinfo->rowbytes; - statusline_getpos(monid, &slx, &sly, state->Width, dst_height, 1, 1); - if (currprefs.gfx_api) + statusline_getpos(monid, &slx, &sly, state->Width, dst_height); + if (currprefs.gfx_api) { statusline_render(monid, dst + sly * pitch, vidinfo->pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); - yy = 0; - for (y = 0; y < TD_TOTAL_HEIGHT; y++) { + } + int m = statusline_get_multiplier(monid); + for (y = 0; y < TD_TOTAL_HEIGHT * m; y++) { uae_u8 *buf = dst + (y + sly) * pitch; draw_status_line_single(monid, buf, vidinfo->pixbytes, y, dst_width, p96rc, p96gc, p96bc, NULL); - yy++; } } diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 22c16260..f91c5803 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -797,15 +797,16 @@ static void statusline(int monid) if (!(currprefs.leds_on_screen & STATUSLINE_CHIPSET) || !tempsurf) return; - statusline_getpos(monid, &slx, &sly, dst_width, dst_height, 1, 1); + statusline_getpos(monid, &slx, &sly, dst_width, dst_height); + int m = statusline_get_multiplier(monid); lx = dst_width; ly = dst_height; - SetRect(&sr, slx, 0, slx + lx, TD_TOTAL_HEIGHT); - SetRect(&dr, slx, sly, slx + lx, sly + TD_TOTAL_HEIGHT); + SetRect(&sr, slx, 0, slx + lx, TD_TOTAL_HEIGHT * m); + SetRect(&dr, slx, sly, slx + lx, sly + TD_TOTAL_HEIGHT * m); DirectDraw_BlitRect(tempsurf, &sr, NULL, &dr); if (DirectDraw_LockSurface(tempsurf, &desc)) { statusline_render(0, (uae_u8*)desc.lpSurface, dst_depth / 8, desc.lPitch, lx, ly, rc, gc, bc, NULL); - for (y = 0; y < TD_TOTAL_HEIGHT; y++) { + for (y = 0; y < TD_TOTAL_HEIGHT * m; y++) { uae_u8 *buf = (uae_u8*)desc.lpSurface + y * desc.lPitch; draw_status_line_single(monid, buf, dst_depth / 8, y, lx, rc, gc, bc, NULL); } @@ -878,6 +879,7 @@ bool S2X_init(int monid, int dw, int dh, int dd) d3d = currprefs.gfx_api; changed_prefs.leds_on_screen |= STATUSLINE_TARGET; currprefs.leds_on_screen |= STATUSLINE_TARGET; + statusline_set_multiplier(monid, dw, dh); if (d3d) dd = amiga_depth2; diff --git a/statusline.cpp b/statusline.cpp index ee279a65..50363b63 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -19,9 +19,10 @@ * Some code to put status information on the screen. */ -void statusline_getpos(int monid, int *x, int *y, int width, int height, int hx, int vx) +void statusline_getpos(int monid, int *x, int *y, int width, int height) { - int total_height = TD_TOTAL_HEIGHT * vx; + int mx = statusline_get_multiplier(monid); + int total_height = TD_TOTAL_HEIGHT * mx; if (currprefs.osd_pos.x >= 20000) { if (currprefs.osd_pos.x >= 30000) *y = width * (currprefs.osd_pos.x - 30000) / 1000; @@ -64,17 +65,19 @@ STATIC_INLINE uae_u32 ledcolor(uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, return v; } -static void write_tdnumber(uae_u8 *buf, int bpp, int x, int y, int num, uae_u32 c1, uae_u32 c2) +static void write_tdnumber(uae_u8 *buf, int bpp, int x, int y, int num, uae_u32 c1, uae_u32 c2, int mult) { int j; const char *numptr; numptr = numbers + num * TD_NUM_WIDTH + NUMBERS_NUM * TD_NUM_WIDTH * y; for (j = 0; j < TD_NUM_WIDTH; j++) { - if (*numptr == 'x') - putpixel (buf, NULL, bpp, x + j, c1, 1); - else if (*numptr == '+') - putpixel (buf, NULL, bpp, x + j, c2, 0); + for (int k = 0; k < mult; k++) { + if (*numptr == 'x') + putpixel(buf, NULL, bpp, x + j * mult + k, c1, 1); + else if (*numptr == '+') + putpixel(buf, NULL, bpp, x + j * mult + k, c2, 0); + } numptr++; } } @@ -92,19 +95,51 @@ static uae_u32 rgbmuldiv(uae_u32 rgb, int mul, int div) return out; } +static int statusline_mult[2]; + +int statusline_set_multiplier(int monid, int width, int height) +{ + struct amigadisplay *ad = &adisplays[monid]; + int idx = ad->picasso_on ? 1 : 0; + int mult = currprefs.leds_on_screen_multiplier[idx]; + if (!mult) { + mult = 1; + } + if (mult > 4) { + mult = 4; + } + statusline_mult[idx] = mult; + return mult; +} + +int statusline_get_multiplier(int monid) +{ + struct amigadisplay *ad = &adisplays[monid]; + int idx = ad->picasso_on ? 1 : 0; + if (statusline_mult[idx] <= 0) + return 1; + return statusline_mult[idx]; +} + void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha) { struct amigadisplay *ad = &adisplays[monid]; int x_start, j, led, border; uae_u32 c1, c2, cb; + int mult = statusline_mult[ad->picasso_on ? 1 : 0]; + + if (!mult) + return; + + y /= mult; c1 = ledcolor (0x00ffffff, rc, gc, bc, alpha); c2 = ledcolor (0x00000000, rc, gc, bc, alpha); if (td_pos & TD_RIGHT) - x_start = totalwidth - TD_PADX - VISIBLE_LEDS * TD_WIDTH; + x_start = totalwidth - (TD_PADX + VISIBLE_LEDS * TD_WIDTH) * mult; else - x_start = TD_PADX; + x_start = TD_PADX * mult; for (led = 0; led < LED_MAX; led++) { int side, pos, num1 = -1, num2 = -1, num3 = -1, num4 = -1; @@ -303,32 +338,34 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi border = 1; } - x = x_start + pos * TD_WIDTH; - if (!border) { - putpixel(buf, NULL, bpp, x - 1, cb, 0); - } - for (j = 0; j < TD_LED_WIDTH; j++) { - putpixel(buf, NULL, bpp, x + j, c, 0); - } - if (!border) { - putpixel(buf, NULL, bpp, x + j, cb, 0); + x = x_start + pos * TD_WIDTH * mult; + for (int xx = 0; xx < mult; xx++) { + if (!border) { + putpixel(buf, NULL, bpp, x - mult + xx, cb, 0); + } + for (j = 0; j < TD_LED_WIDTH * mult; j += mult) { + putpixel(buf, NULL, bpp, x + j + xx, c, 0); + } + if (!border) { + putpixel(buf, NULL, bpp, x + j + xx, cb, 0); + } } if (y >= TD_PADY && y - TD_PADY < TD_NUM_HEIGHT) { if (num3 >= 0) { - x += (TD_LED_WIDTH - am * TD_NUM_WIDTH) / 2; + x += (TD_LED_WIDTH - am * TD_NUM_WIDTH) * mult / 2; if (num1 > 0) { - write_tdnumber (buf, bpp, x, y - TD_PADY, num1, pen_rgb, c2); - x += TD_NUM_WIDTH; + write_tdnumber(buf, bpp, x, y - TD_PADY, num1, pen_rgb, c2, mult); + x += TD_NUM_WIDTH * mult; } if (num2 >= 0) { - write_tdnumber (buf, bpp, x, y - TD_PADY, num2, pen_rgb, c2); - x += TD_NUM_WIDTH; + write_tdnumber(buf, bpp, x, y - TD_PADY, num2, pen_rgb, c2, mult); + x += TD_NUM_WIDTH * mult; } - write_tdnumber (buf, bpp, x, y - TD_PADY, num3, pen_rgb, c2); - x += TD_NUM_WIDTH; + write_tdnumber(buf, bpp, x, y - TD_PADY, num3, pen_rgb, c2, mult); + x += TD_NUM_WIDTH * mult; if (num4 > 0) - write_tdnumber (buf, bpp, x, y - TD_PADY, num4, pen_rgb, c2); + write_tdnumber(buf, bpp, x, y - TD_PADY, num4, pen_rgb, c2, mult); } } }