diff --git a/menu.cpp b/menu.cpp index 4000dd4..8c039ab 100644 --- a/menu.cpp +++ b/menu.cpp @@ -1888,6 +1888,7 @@ void HandleUI(void) if (mask == 1 && is_x86()) { x86_init(); + ResetUART(); menustate = MENU_NONE1; } else @@ -2551,14 +2552,9 @@ void HandleUI(void) case 5: if (select) { - int mode = GetUARTMode(); - if(mode != 0) - { - SetUARTMode(0); - SetUARTMode(mode); - menustate = MENU_8BIT_SYSTEM1; - menusub = 4; - } + ResetUART(); + menustate = MENU_8BIT_SYSTEM1; + menusub = 4; } break; case 6: diff --git a/user_io.cpp b/user_io.cpp index 9fb7ab6..88481a3 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -612,6 +612,19 @@ void SetMidiLinkMode(int mode) set_uart_alt(); } +void ResetUART() +{ + if (uart_mode) + { + int mode = GetUARTMode(); + if (mode != 0) + { + SetUARTMode(0); + SetUARTMode(mode); + } + } +} + uint16_t sdram_sz(int sz) { int res = 0; @@ -2019,13 +2032,14 @@ void user_io_send_buttons(char force) if (is_minimig()) minimig_reset(); if (is_megacd()) mcd_reset(); if (is_pce()) pcecd_reset(); + if (is_x86()) x86_init(); + ResetUART(); } key_map = map; if (user_io_osd_is_visible()) map &= ~BUTTON2; spi_uio_cmd16(UIO_BUT_SW, map); printf("sending keymap: %X\n", map); - if ((key_map & BUTTON2) && is_x86()) x86_init(); } } diff --git a/user_io.h b/user_io.h index 8b9d871..f852025 100644 --- a/user_io.h +++ b/user_io.h @@ -243,6 +243,7 @@ int GetUARTMode(); void SetUARTMode(int mode); int GetMidiLinkMode(); void SetMidiLinkMode(int mode); +void ResetUART(); void user_io_store_filename(char *filename); int user_io_use_cheats();