From 8861741945404350589613bbe2ab4157c0f30c8c Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 28 Mar 2025 00:10:16 +0600 Subject: [PATCH] Some needed changes for hard resets --- src/86box.c | 3 +++ src/device/keyboard.c | 2 +- src/device/keyboard_at.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/86box.c b/src/86box.c index 2b6e1ba9f..57faa89c1 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1301,6 +1301,9 @@ pc_reset_hard_init(void) /* Mark ACPI as unavailable */ acpi_enabled = 0; + /* Reset all keyboard indicators */ + keyboard_update_states(0, 0, 0); + /* Reset the general machine support modules. */ io_init(); diff --git a/src/device/keyboard.c b/src/device/keyboard.c index aa9aba3c6..7666b0e70 100644 --- a/src/device/keyboard.c +++ b/src/device/keyboard.c @@ -75,7 +75,7 @@ static scancode *scan_table; /* scancode table for keyboard */ static volatile uint8_t caps_lock = 0; static volatile uint8_t num_lock = 0; static volatile uint8_t scroll_lock = 0; -static uint8_t shift = 0; +static uint8_t shift = 0; static int key5576mode = 0; diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index c5f73459b..605f51e90 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -3764,12 +3764,12 @@ keyboard_at_init(const device_t *info) if (dev->port != NULL) { kbc_at_dev_reset(dev, 0); - keyboard_update_states(0, 0, 0); bat_counter = 0x0000; } keyboard_send = add_data_kbd; SavedKbd = dev; + keyboard_update_states(0, 0, 0); inv_cmd_response = (dev->type & FLAG_PS2) ? 0xfe : 0xfa; @@ -3788,6 +3788,8 @@ keyboard_at_close(void *priv) /* Disable the scancode maps. */ keyboard_set_table(NULL); + keyboard_update_states(0, 0, 0); + SavedKbd = NULL; free(dev);