From 3516db59d48fc6ca30aa4e23df116aeb005f77ea Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 11 Jun 2016 19:21:06 +0300 Subject: [PATCH] Network led, >999 FPS counter. --- ethernet.cpp | 3 +++ include/gui.h | 4 ++- include/statusline.h | 2 +- statusline.cpp | 58 ++++++++++++++++++++++++++++++-------------- 4 files changed, 47 insertions(+), 20 deletions(-) diff --git a/ethernet.cpp b/ethernet.cpp index 18b182b4..40689f35 100644 --- a/ethernet.cpp +++ b/ethernet.cpp @@ -10,6 +10,7 @@ #include "traps.h" #include "sana2.h" #include "uae/slirp.h" +#include "gui.h" #ifndef HAVE_INET_ATON static int inet_aton(const char *cp, struct in_addr *ia) @@ -59,6 +60,7 @@ void slirp_output (const uint8_t *pkt, int pkt_len) { if (!slirp_data) return; + gui_flicker_led(LED_NET, 0, gui_data.net | 1); uae_sem_wait (&slirp_sem1); slirp_data->gotfunc (slirp_data->userdata, pkt, pkt_len); uae_sem_post (&slirp_sem1); @@ -68,6 +70,7 @@ void ethernet_trigger (struct netdriverdata *ndd, void *vsd) { if (!ndd) return; + gui_flicker_led(LED_NET, 0, gui_data.net | 2); switch (ndd->type) { case UAENET_SLIRP: diff --git a/include/gui.h b/include/gui.h index 55aa30a1..1a087a6b 100644 --- a/include/gui.h +++ b/include/gui.h @@ -46,7 +46,8 @@ extern bool no_gui, quit_to_gui; #define LED_CPU 8 #define LED_SND 9 #define LED_MD 10 -#define LED_MAX 11 +#define LED_NET 11 +#define LED_MAX 12 struct gui_info { @@ -60,6 +61,7 @@ struct gui_info uae_s8 hd; /* harddrive */ uae_s8 cd; /* CD */ uae_s8 md; /* CD32 or CDTV internal storage */ + uae_s8 net; /* network */ int cpu_halted; int fps, idle; int fps_color; diff --git a/include/statusline.h b/include/statusline.h index 31f5a2d5..950e5c2a 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -19,7 +19,7 @@ static int td_pos = (TD_RIGHT | TD_BOTTOM); #define TD_TOTAL_HEIGHT (TD_PADY * 2 + TD_NUM_HEIGHT) -#define NUMBERS_NUM 17 +#define NUMBERS_NUM 19 #define TD_BORDER 0x333333 diff --git a/statusline.cpp b/statusline.cpp index e5108676..ec953d87 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -45,14 +45,14 @@ void statusline_getpos (int *x, int *y, int width, int height) } } -static const char *numbers = { /* ugly 0123456789CHD%+-P */ - "+++++++--++++-+++++++++++++++++-++++++++++++++++++++++++++++++++++++++++++++-++++++-++++----++---+--------------+++++++" - "+xxxxx+--+xx+-+xxxxx++xxxxx++x+-+x++xxxxx++xxxxx++xxxxx++xxxxx++xxxxx++xxxx+-+x++x+-+xxx++-+xx+-+x---+----------+xxxxx+" - "+x+++x+--++x+-+++++x++++++x++x+++x++x++++++x++++++++++x++x+++x++x+++x++x++++-+x++x+-+x++x+--+x++x+--+x+----+++--+x---x+" - "+x+-+x+---+x+-+xxxxx++xxxxx++xxxxx++xxxxx++xxxxx+--++x+-+xxxxx++xxxxx++x+----+xxxx+-+x++x+----+x+--+xxx+--+xxx+-+xxxxx+" - "+x+++x+---+x+-+x++++++++++x++++++x++++++x++x+++x+--+x+--+x+++x++++++x++x++++-+x++x+-+x++x+---+x+x+--+x+----+++--+x+++++" - "+xxxxx+---+x+-+xxxxx++xxxxx+----+x++xxxxx++xxxxx+--+x+--+xxxxx++xxxxx++xxxx+-+x++x+-+xxx+---+x++xx--------------+x+----" - "+++++++---+++-++++++++++++++----+++++++++++++++++--+++--++++++++++++++++++++-++++++-++++------------------------+++----" +static const char *numbers = { /* ugly 0123456789CHD%+-PNK */ + "+++++++--++++-+++++++++++++++++-++++++++++++++++++++++++++++++++++++++++++++-++++++-++++----++---+--------------+++++++++++++++++++++" + "+xxxxx+--+xx+-+xxxxx++xxxxx++x+-+x++xxxxx++xxxxx++xxxxx++xxxxx++xxxxx++xxxx+-+x++x+-+xxx++-+xx+-+x---+----------+xxxxx++x+++x++x++x++" + "+x+++x+--++x+-+++++x++++++x++x+++x++x++++++x++++++++++x++x+++x++x+++x++x++++-+x++x+-+x++x+--+x++x+--+x+----+++--+x---x++xx++x++x+x+++" + "+x+-+x+---+x+-+xxxxx++xxxxx++xxxxx++xxxxx++xxxxx+--++x+-+xxxxx++xxxxx++x+----+xxxx+-+x++x+----+x+--+xxx+--+xxx+-+xxxxx++x+x+x++xx++++" + "+x+++x+---+x+-+x++++++++++x++++++x++++++x++x+++x+--+x+--+x+++x++++++x++x++++-+x++x+-+x++x+---+x+x+--+x+----+++--+x++++++x+x+x++x+x+++" + "+xxxxx+---+x+-+xxxxx++xxxxx+----+x++xxxxx++xxxxx+--+x+--+xxxxx++xxxxx++xxxx+-+x++x+-+xxx+---+x++xx--------------+x+----+x++xx++x++x++" + "+++++++---+++-++++++++++++++----+++++++++++++++++--+++--++++++++++++++++++++-++++++-++++------------------------+++----++++++++++++++" }; STATIC_INLINE uae_u32 ledcolor (uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *a) @@ -105,7 +105,7 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u if (led >= LED_DF0 && led <= LED_DF3) { int pled = led - LED_DF0; int track = gui_data.drive_track[pled]; - pos = 6 + pled; + pos = 7 + pled; on_rgb = 0x00cc00; on_rgb2 = 0x006600; off_rgb = 0x003300; @@ -165,14 +165,22 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u int fps = (gui_data.fps + 5) / 10; on_rgb = 0x000000; off_rgb = gui_data.fps_color ? 0xcccc00 : 0x000000; - if (fps > 999) - fps = 999; - num1 = fps / 100; - num2 = (fps - num1 * 100) / 10; - num3 = fps % 10; am = 3; - if (num1 == 0) - am = 2; + if (fps > 999) { + fps += 50; + fps /= 10; + if (fps > 999) + fps = 999; + num1 = fps / 100; + num2 = 18; + num3 = (fps - num1 * 100) / 10; + } else { + num1 = fps / 100; + num2 = (fps - num1 * 100) / 10; + num3 = fps % 10; + if (num1 == 0) + am = 2; + } } } else if (led == LED_CPU) { int idle = (gui_data.idle + 5) / 10; @@ -224,7 +232,7 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u am = 3; } else if (led == LED_MD && gui_data.drive_disabled[3]) { // DF3 reused as internal non-volatile ram led (cd32/cdtv) - pos = 6 + 3; + pos = 7 + 3; if (gui_data.md >= 0) { on = gui_data.md; on_rgb = on == 2 ? 0xcc0000 : 0x00cc00; @@ -233,8 +241,22 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u num1 = -1; num2 = -1; num3 = -1; - } else + } else if (led == LED_NET) { + pos = 6; + on = gui_data.net; + on_rgb = 0; + if (on & 1) + on_rgb |= 0x00cc00; + if (on & 2) + on_rgb |= 0xcc0000; + off_rgb = 0x000000; + num1 = -1; + num2 = -1; + num3 = 17; + am = 1; + } else { return; + } on_rgb |= 0x33000000; off_rgb |= 0x33000000; if (half > 0) { -- 2.47.3