From 8405c7a67e6a47c70f28fb56548c0d82d937db93 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 6 Jan 2024 17:43:22 +0200 Subject: [PATCH] Make sure power led state is restored. --- cia.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cia.cpp b/cia.cpp index 23d0a6d5..e48b024c 100644 --- 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); -- 2.47.3