]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Network led, >999 FPS counter.
authorToni Wilen <twilen@winuae.net>
Sat, 11 Jun 2016 16:21:06 +0000 (19:21 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 11 Jun 2016 16:21:06 +0000 (19:21 +0300)
ethernet.cpp
include/gui.h
include/statusline.h
statusline.cpp

index 18b182b444b0866856fe75a469f490017d49abf1..40689f3551536bf69271401bee793d50d530cfad 100644 (file)
@@ -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:
index 55aa30a1e2aa9eeeaf77398441f17e7687ebb027..1a087a6b9f0c8175f3c71ab063c8dc87fcce9ead 100644 (file)
@@ -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;
index 31f5a2d59e41fe46fc27baf0e0be138c6c4f275a..950e5c2a4ece40ec5ea456135b18e9addc33efd3 100644 (file)
@@ -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
 
index e510867638c25ba3c604b6f1f22b32a8e52a4571..ec953d87a747a602a29d60711a3e4e8d8a7fd9a0 100644 (file)
@@ -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) {