Merge pull request #1571 from 86Box/master

Bring the branch up to par with master.
This commit is contained in:
Miran Grča
2021-08-02 06:58:22 +02:00
committed by GitHub
83 changed files with 3364 additions and 788 deletions

View File

@@ -69,6 +69,7 @@ HANDLE ghMutex;
LCID lang_id; /* current language ID used */
DWORD dwSubLangID;
int acp_utf8; /* Windows supports UTF-8 codepage */
volatile int cpu_thread_run = 1;
/* Local data. */
@@ -487,7 +488,7 @@ main_thread(void *param)
title_update = 1;
old_time = GetTickCount();
drawits = frames = 0;
while (!is_quit) {
while (!is_quit && cpu_thread_run) {
/* See if it is time to run a frame of code. */
new_time = GetTickCount();
drawits += (new_time - old_time);
@@ -512,7 +513,7 @@ main_thread(void *param)
// Sleep(1);
/* If needed, handle a screen resize. */
if (doresize && !video_fullscreen) {
if (doresize && !video_fullscreen && !is_quit) {
if (vid_resize & 2)
plat_resize(fixed_size_x, fixed_size_y);
else
@@ -520,6 +521,8 @@ main_thread(void *param)
doresize = 0;
}
}
is_quit = 1;
}
@@ -543,7 +546,7 @@ do_start(void)
win_log("Main timer precision: %llu\n", timer_freq);
/* Start the emulator, really. */
thMain = thread_create(main_thread, &is_quit);
thMain = thread_create(main_thread, NULL);
SetThreadPriority(thMain, THREAD_PRIORITY_HIGHEST);
}
@@ -552,16 +555,17 @@ do_start(void)
void
do_stop(void)
{
is_quit = 1;
/* Claim the video blitter. */
startblit();
plat_delay_ms(100);
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_HAS_SHUTDOWN, (WPARAM) 0, (LPARAM) hwndMain);
vid_apis[vid_api].close();
pc_close(thMain);
thMain = NULL;
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_HAS_SHUTDOWN, (WPARAM) 0, (LPARAM) hwndMain);
}
@@ -1072,7 +1076,10 @@ plat_setfullscreen(int on)
GetClientRect(hwndMain, &rect);
temp_x = rect.right - rect.left + 1;
temp_y = rect.bottom - rect.top + 1 - sbar_height;
if (hide_status_bar)
temp_y = rect.bottom - rect.top + 1;
else
temp_y = rect.bottom - rect.top + 1 - sbar_height;
} else {
if (dpi_scale) {
temp_x = MulDiv((vid_resize & 2) ? fixed_size_x : unscaled_size_x, dpi, 96);
@@ -1083,7 +1090,10 @@ plat_setfullscreen(int on)
}
/* Main Window. */
ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height);
if (hide_status_bar)
ResizeWindowByClientArea(hwndMain, temp_x, temp_y);
else
ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height);
}
/* Render window. */