]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Make sure power led state is restored.
authorToni Wilen <twilen@winuae.net>
Sat, 6 Jan 2024 15:43:22 +0000 (17:43 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 6 Jan 2024 15:43:22 +0000 (17:43 +0200)
cia.cpp

diff --git a/cia.cpp b/cia.cpp
index 23d0a6d593f313aa11d66acdcb388d2bc389a28f..e48b024c4bc661fa8842a07d798002822911669b 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -155,7 +155,7 @@ struct CIA
 static struct CIA cia[2];
 
 static bool oldovl;
-static bool led;
+static int led;
 static int led_old_brightness;
 static evt_t led_cycle;
 static evt_t cia_now_evt;
@@ -1242,7 +1242,7 @@ static void calc_led(int old_led)
 {
        evt_t c = get_cycles();
        int t = (int)((c - led_cycle) / CYCLE_UNIT);
-       if (old_led)
+       if (old_led > 0)
                led_cycles_on += t;
        else
                led_cycles_off += t;
@@ -1323,7 +1323,7 @@ void CIA_vsync_prehandler(void)
 static void check_led(void)
 {
        uae_u8 v = cia[0].pra;
-       bool led2;
+       int led2;
 
        v |= ~cia[0].dra; /* output is high when pin's direction is input */
        led2 = (v & 2) ? 0 : 1;
@@ -2170,6 +2170,7 @@ void CIA_reset(void)
        led_cycles_off = 0;
        led_cycles_on = 0;
        led_cycle = get_cycles();
+       led = 0;
 
        if (!savestate_state) {
                oldovl = true;
@@ -2199,6 +2200,7 @@ void CIA_reset(void)
                if (currprefs.cs_ciaoverlay) {
                        oldovl = true;
                }
+               led = -1;
                bfe001_change();
                if (!currprefs.cs_ciaoverlay) {
                        map_overlay(oldovl ? 0 : 1);