The Settings dialog now the save and reset procedure in the correct order and pausing the emulator now actually waits for the pause to actually come into effect.

This commit is contained in:
OBattler
2023-10-31 00:44:04 +01:00
parent 3d3e7f5cf3
commit c173f5d415
5 changed files with 32 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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));
}
}

View File

@@ -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;

View File

@@ -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);