From 65310e01419d1ce79edc8dea14558c98344d5d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sat, 8 Jan 2022 21:43:04 +0100 Subject: [PATCH 1/2] Delay load `SetCurrentProcessExplicitAppUserModelID` Appears to be the only thing preventing 86Box from running on Vista. Note that this doesn't mean a change in the official system requirements. --- src/win/win.c | 3 --- src/win/win_ui.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/win/win.c b/src/win/win.c index 27386b5b7..a4854f65f 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -450,9 +450,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow) { char **argv = NULL; int argc, i; - wchar_t * AppID = L"86Box.86Box\0"; - - SetCurrentProcessExplicitAppUserModelID(AppID); /* Initialize the COM library for the main thread. */ CoInitializeEx(NULL, COINIT_MULTITHREADED); diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 40f9068b0..912eef8cf 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -92,6 +92,13 @@ static dllimp_t user32_imports[] = { { NULL, NULL } }; +/* Taskbar application ID API, Windows 7+ */ +void* shell32_handle = NULL; +static HRESULT (WINAPI *pSetCurrentProcessExplicitAppUserModelID)(PCWSTR AppID); +static dllimp_t shell32_imports[]= { +{ "SetCurrentProcessExplicitAppUserModelID", &pSetCurrentProcessExplicitAppUserModelID } +}; + int win_get_dpi(HWND hwnd) { if (user32_handle != NULL) { @@ -1244,6 +1251,11 @@ ui_init(int nCmdShow) /* Load DPI related Windows 10 APIs */ user32_handle = dynld_module("user32.dll", user32_imports); + /* Set the application ID for the taskbar. */ + shell32_handle = dynld_module("shell32.dll", shell32_imports); + if (shell32_handle) + pSetCurrentProcessExplicitAppUserModelID(L"86Box.86Box"); + /* Set up TaskDialog configuration. */ tdconfig.cbSize = sizeof(tdconfig); tdconfig.dwFlags = TDF_ENABLE_HYPERLINKS; From 9a566a501c5c42c032b4bada254052f696840cd4 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Sun, 9 Jan 2022 16:46:44 +0200 Subject: [PATCH 2/2] Add hide_tool_bar config file setting In preparation for toolbar implementation --- src/config.c | 7 +++++++ src/include/86box/plat.h | 2 +- src/unix/unix.c | 1 + src/win/win_ui.c | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index bda66d417..eebc4462e 100644 --- a/src/config.c +++ b/src/config.c @@ -561,6 +561,7 @@ load_general(void) kbd_req_capture = config_get_int(cat, "kbd_req_capture", 0); hide_status_bar = config_get_int(cat, "hide_status_bar", 0); + hide_tool_bar = config_get_int(cat, "hide_tool_bar", 0); confirm_reset = config_get_int(cat, "confirm_reset", 1); confirm_exit = config_get_int(cat, "confirm_exit", 1); @@ -2036,6 +2037,7 @@ config_load(void) kbd_req_capture = 0; hide_status_bar = 0; + hide_tool_bar = 0; scale = 1; machine = machine_get_machine_from_internal_name("ibmpc"); dpi_scale = 1; @@ -2222,6 +2224,11 @@ save_general(void) else config_delete_var(cat, "hide_status_bar"); + if (hide_tool_bar != 0) + config_set_int(cat, "hide_tool_bar", hide_tool_bar); + else + config_delete_var(cat, "hide_tool_bar"); + if (confirm_reset != 1) config_set_int(cat, "confirm_reset", confirm_reset); else diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 3a605fe6b..ff8b31b02 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -90,7 +90,7 @@ extern int update_icons; extern int unscaled_size_x, /* current unscaled size X */ unscaled_size_y; /* current unscaled size Y */ -extern int kbd_req_capture, hide_status_bar; +extern int kbd_req_capture, hide_status_bar, hide_tool_bar; /* System-related functions. */ extern char *fix_exe_path(char *str); diff --git a/src/unix/unix.c b/src/unix/unix.c index f707757fb..3727e1f63 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -40,6 +40,7 @@ int rctrl_is_lalt; int update_icons; int kbd_req_capture; int hide_status_bar; +int hide_tool_bar; int fixed_size_x = 640; int fixed_size_y = 480; extern int title_set; diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 912eef8cf..f866ed5bf 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -65,6 +65,7 @@ int user_resize = 0; int fixed_size_x = 0, fixed_size_y = 0; int kbd_req_capture = 0; int hide_status_bar = 0; +int hide_tool_bar = 0; int dpi = 96; extern char openfilestring[512];