diff --git a/src/86box.c b/src/86box.c index b42a15656..f675f4940 100644 --- a/src/86box.c +++ b/src/86box.c @@ -236,6 +236,9 @@ int efscrnsz_y = SCREEN_RES_Y; static wchar_t mouse_msg[3][200]; +static int do_pause_ack = 0; +static int pause_ack = 0; + #ifndef RELEASE_BUILD static char buff[1024]; static int seen = 0; @@ -1353,6 +1356,15 @@ _ui_window_title(void *s) } #endif +void +ack_pause(void) +{ + if (do_pause_ack) { + do_pause_ack = 0; + pause_ack = 1; + } +} + void pc_run(void) { @@ -1369,6 +1381,7 @@ pc_run(void) /* Run a block of code. */ startblit(); cpu_exec((int32_t) cpu_s->rspeed / 100); + ack_pause(); #ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */ if (gdbstub_step == GDBSTUB_EXEC) { #endif @@ -1562,3 +1575,16 @@ get_actual_size_y(void) { return (efscrnsz_y); } + +void +do_pause(int p) +{ + if (p) + do_pause_ack = p; + dopause = p; + if (p) { + while (!pause_ack) + ; + } + pause_ack = 0; +} diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index a8f4ac7f2..ae2ea260c 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -213,6 +213,9 @@ extern uint16_t get_last_addr(void); extern void sub_cycles(int c); extern void resub_cycles(int old_cycles); +extern void ack_pause(void); +extern void do_pause(int p); + extern double isa_timing; extern int io_delay; extern int framecountx; diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index e3eeb3fc4..598025795 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -137,6 +137,8 @@ main_thread_fn() } } else { /* Just so we dont overload the host OS. */ + if (dopause) + ack_pause(); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 2aebc39ef..1d0b2451a 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -921,16 +921,10 @@ MainWindow::on_actionSettings_triggered() switch (settings.result()) { case QDialog::Accepted: - /* pc_reset_hard_close(); settings.save(); config_changed = 2; pc_reset_hard_init(); - */ - settings.save(); - config_changed = 2; - pc_reset_hard(); - break; case QDialog::Rejected: break; diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 3a9db0310..d76aad977 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -382,7 +382,7 @@ plat_pause(int p) if ((p == 0) && (time_sync & TIME_SYNC_ENABLED)) nvr_time_sync(); - dopause = p; + do_pause(p); if (p) { if (mouse_capture) plat_mouse_capture(0);