More fixes, the hard freeze is truly gone now.

This commit is contained in:
OBattler
2023-12-11 20:32:51 +01:00
parent 686644d2a1
commit 2a2432207a
2 changed files with 20 additions and 12 deletions

View File

@@ -111,7 +111,7 @@
/* Stuff that used to be globally declared in plat.h but is now extern there /* Stuff that used to be globally declared in plat.h but is now extern there
and declared here instead. */ and declared here instead. */
int dopause; /* system is paused */ int dopause = 1; /* system is paused */
atomic_flag doresize; /* screen resize requested */ atomic_flag doresize; /* screen resize requested */
volatile int is_quit; /* system exit requested */ volatile int is_quit; /* system exit requested */
uint64_t timer_freq; uint64_t timer_freq;
@@ -236,8 +236,8 @@ int efscrnsz_y = SCREEN_RES_Y;
static wchar_t mouse_msg[3][200]; static wchar_t mouse_msg[3][200];
static volatile int do_pause_ack = 0; static volatile atomic_int do_pause_ack = 0;
static volatile int pause_ack = 0; static volatile atomic_int pause_ack = 0;
#ifndef RELEASE_BUILD #ifndef RELEASE_BUILD
static char buff[1024]; static char buff[1024];
@@ -1359,9 +1359,9 @@ _ui_window_title(void *s)
void void
ack_pause(void) ack_pause(void)
{ {
if (do_pause_ack) { if (atomic_load(&do_pause_ack)) {
do_pause_ack = 0; atomic_store(&do_pause_ack, 0);
pause_ack = 1; atomic_store(&pause_ack, 1);
} }
} }
@@ -1579,12 +1579,14 @@ get_actual_size_y(void)
void void
do_pause(int p) do_pause(int p)
{ {
if (p) int old_p = dopause;
if (p && !old_p)
do_pause_ack = p; do_pause_ack = p;
dopause = p; dopause = p;
if (p) { if (p && !old_p) {
while (!pause_ack) while (!atomic_load(&pause_ack))
; ;
} }
pause_ack = 0; atomic_store(&pause_ack, 0);
} }

View File

@@ -293,8 +293,6 @@ main(int argc, char *argv[])
// pc_reset_hard_init(); // pc_reset_hard_init();
/* Set the PAUSE mode depending on the renderer. */
// plat_pause(0);
QTimer onesec; QTimer onesec;
QObject::connect(&onesec, &QTimer::timeout, &app, [] { QObject::connect(&onesec, &QTimer::timeout, &app, [] {
pc_onesec(); pc_onesec();
@@ -323,6 +321,14 @@ main(int argc, char *argv[])
QTimer::singleShot(0, &app, [] { QTimer::singleShot(0, &app, [] {
pc_reset_hard_init(); pc_reset_hard_init();
main_thread = new std::thread(main_thread_fn); main_thread = new std::thread(main_thread_fn);
/* Set the PAUSE mode depending on the renderer. */
#ifdef USE_VNC
if (vnc_enabled && vid_api != 6)
plat_pause(1);
else
#endif
plat_pause(0);
}); });
auto ret = app.exec(); auto ret = app.exec();