From 979d772ffe2d1f00c74e038ecfbd64753d0ed15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 15:28:32 +0200 Subject: [PATCH 01/17] Add global config toggle for built-in manager --- src/86box.c | 40 +++++++++++++++++-------------------- src/config.c | 16 +++++++++++++++ src/include/86box/86box.h | 15 +++++++------- src/qt/qt_main.cpp | 6 +++--- src/qt/qt_styleoverride.cpp | 2 +- 5 files changed, 46 insertions(+), 33 deletions(-) diff --git a/src/86box.c b/src/86box.c index ff7e1ad08..bd5051968 100644 --- a/src/86box.c +++ b/src/86box.c @@ -219,6 +219,7 @@ int sound_muted = 0; /* (C) Is soun int jumpered_internal_ecp_dma = 0; /* (C) Jumpered internal EPC DMA */ int inhibit_multimedia_keys; /* (G) Inhibit multimedia keys on Windows. */ int force_10ms; /* (C) Force 10ms CPU frame intervals. */ +int vmm_disabled = -1; /* (G) disable built-in manager */ int other_ide_present = 0; /* IDE controllers from non-IDE cards are present */ @@ -258,7 +259,7 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { }; char vmm_path[1024] = { '\0'}; /* TEMPORARY - VM manager path to scan for VMs */ -int vmm_enabled = 0; +int start_vmm = 1; /* Statistics. */ extern int mmuflush; @@ -707,9 +708,6 @@ pc_init(int argc, char *argv[]) time_t now; int c; int lvmp = 0; -#ifdef DEPRECATE_USAGE - int deprecated = 1; -#endif #ifdef ENABLE_NG int ng = 0; #endif @@ -799,9 +797,7 @@ usage: goto usage; ppath = argv[++c]; -#ifdef DEPRECATE_USAGE - deprecated = 0; -#endif + start_vmm = 0; } else if (!strcasecmp(argv[c], "--rompath") || !strcasecmp(argv[c], "-R")) { if ((c + 1) == argc) goto usage; @@ -813,9 +809,7 @@ usage: goto usage; cfg = argv[++c]; -#ifdef DEPRECATE_USAGE - deprecated = 0; -#endif + start_vmm = 0; } else if (!strcasecmp(argv[c], "--global") || !strcasecmp(argv[c], "-O")) { if ((c + 1) == argc || plat_dir_check(argv[c + 1])) goto usage; @@ -924,21 +918,12 @@ usage: else cfg = argv[c++]; -#ifdef DEPRECATE_USAGE - deprecated = 0; -#endif + start_vmm = 0; } if (c != argc) goto usage; -#ifdef DEPRECATE_USAGE - if (deprecated) - pc_show_usage("Running 86Box without a specified VM path and/or configuration\n" - "file has been deprected. Please specify one or use a manager\n" - "(Avalonia 86 is recommended).\n\n"); -#endif - path_slash(usr_path); path_slash(rom_path); @@ -1104,14 +1089,25 @@ usage: pclog("# Global configuration file: %s\n", global_cfg_path); pclog("# Configuration file: %s\n#\n\n", cfg_path); if (strlen(vmm_path) != 0) { - vmm_enabled = 1; + start_vmm = 1; pclog("# VM Manager enabled. Path: %s\n", vmm_path); } /* Load the global configuration file. */ config_load_global(); - if (!vmm_enabled) { + if (vmm_disabled && start_vmm) { +#ifdef DEPRECATE_USAGE + if (vmm_disabled < 0) { + pc_show_usage("Running 86Box without a specified VM path and/or configuration\n" + "file has been deprecated. Please specify one or use a manager\n" + "(Avalonia 86 is recommended).\n\n"); + } +#endif + start_vmm = 0; + } + + if (!start_vmm) { /* * We are about to read the configuration file, which MAY * put data into global variables (the hard- and floppy diff --git a/src/config.c b/src/config.c index 25f287eef..9856afc3b 100644 --- a/src/config.c +++ b/src/config.c @@ -136,6 +136,15 @@ load_global(void) mouse_sensitivity = 0.1; else if (mouse_sensitivity > 2.0) mouse_sensitivity = 2.0; + + vmm_disabled = ini_section_get_int(cat, "vmm_disabled", -1); + + p = ini_section_get_string(cat, "vmm_path", NULL); + if (p != NULL) + strncpy(vmm_path, p, sizeof(vmm_path) - 1); + else + // [todo] plat_vmm_path() + vmm_path[0] = 0; } /* Load "General" section. */ @@ -2200,6 +2209,13 @@ save_global(void) ini_section_set_double(cat, "mouse_sensitivity", mouse_sensitivity); else ini_section_delete_var(cat, "mouse_sensitivity"); + + if (vmm_disabled != -1) + ini_section_set_int(cat, "vmm_disabled", vmm_disabled); + else + ini_section_delete_var(cat, "vmm_disabled"); + + ini_section_set_string(cat, "vmm_path", vmm_path); } /* Save "General" section. */ diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index de66f8a0f..9d902c85d 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -116,12 +116,12 @@ extern uint64_t instru_run_ms; #define window_y monitor_settings[0].mon_window_y #define window_w monitor_settings[0].mon_window_w #define window_h monitor_settings[0].mon_window_h -extern int inhibit_multimedia_keys; /* (C) Inhibit multimedia keys on Windows. */ +extern int inhibit_multimedia_keys; /* (G) Inhibit multimedia keys on Windows. */ extern int window_remember; extern int vid_resize; /* (C) allow resizing */ extern int invert_display; /* (C) invert the display */ extern int suppress_overscan; /* (C) suppress overscans */ -extern int lang_id; /* (C) language id */ +extern int lang_id; /* (G) language id */ extern int scale; /* (C) screen scale factor */ extern int dpi_scale; /* (C) DPI scaling of the emulated screen */ extern int vid_api; /* (C) video renderer */ @@ -160,9 +160,9 @@ extern int fpu_type; /* (C) fpu type */ extern int fpu_softfloat; /* (C) fpu uses softfloat */ extern int time_sync; /* (C) enable time sync */ extern int hdd_format_type; /* (C) hard disk file format */ -extern int confirm_reset; /* (C) enable reset confirmation */ -extern int confirm_exit; /* (C) enable exit confirmation */ -extern int confirm_save; /* (C) enable save confirmation */ +extern int confirm_reset; /* (G) enable reset confirmation */ +extern int confirm_exit; /* (G) enable exit confirmation */ +extern int confirm_save; /* (G) enable save confirmation */ extern int enable_discord; /* (C) enable Discord integration */ extern int force_10ms; /* (C) force 10ms CPU frame interval */ extern int jumpered_internal_ecp_dma; /* (C) Jumpered internal EPC DMA */ @@ -177,7 +177,7 @@ extern int sound_muted; /* (C) Is sound muted? */ extern int do_auto_pause; /* (C) Auto-pause the emulator on focus loss */ extern int auto_paused; extern int force_constant_mouse; /* (C) Force constant updating of the mouse */ -extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */ +extern double mouse_sensitivity; /* (G) Mouse sensitivity scale */ #ifdef _Atomic extern _Atomic double mouse_x_error; /* Mouse error accumulator - Y */ extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */ @@ -185,6 +185,7 @@ extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */ extern int pit_mode; /* (C) force setting PIT mode */ extern int fm_driver; /* (C) select FM sound driver */ extern int hook_enabled; /* (C) Keyboard hook is enabled */ +extern int vmm_disabled; /* (G) disable built-in manager */ extern char exe_path[2048]; /* path (dir) of executable */ extern char usr_path[1024]; /* path (dir) of user data */ @@ -193,7 +194,7 @@ extern char global_cfg_path[1024]; /* full path of global config file */ extern int open_dir_usr_path; /* default file open dialog directory of usr_path */ extern char uuid[MAX_UUID_LEN]; /* UUID or machine identifier */ extern char vmm_path[1024]; /* VM Manager path to scan (temporary) */ -extern int vmm_enabled; +extern int start_vmm; #ifndef USE_NEW_DYNAREC extern FILE *stdlog; /* file to log output to */ #endif diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 374b0f4fb..200ef3b20 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -584,7 +584,7 @@ main(int argc, char *argv[]) return 0; } - if (!vmm_enabled) + if (!start_vmm) #ifdef Q_OS_MACOS qt_set_sequence_auto_mnemonic(false); #else @@ -625,10 +625,10 @@ main(int argc, char *argv[]) return 6; } - if (!vmm_enabled) + if (!start_vmm) pc_init_modules(); - if (vmm_enabled) { + if (start_vmm) { // VMManagerMain vmm; // // Hackish until there is a proper solution // QApplication::setApplicationName("86Box VM Manager"); diff --git a/src/qt/qt_styleoverride.cpp b/src/qt/qt_styleoverride.cpp index adfae0734..1319f0dae 100644 --- a/src/qt/qt_styleoverride.cpp +++ b/src/qt/qt_styleoverride.cpp @@ -42,7 +42,7 @@ StyleOverride::styleHint( QStyleHintReturn *returnData) const { /* Disable using menu with alt key */ - if (!vmm_enabled && (!kbd_req_capture || mouse_capture) && (hint == QStyle::SH_MenuBar_AltKeyNavigation)) + if (!start_vmm && (!kbd_req_capture || mouse_capture) && (hint == QStyle::SH_MenuBar_AltKeyNavigation)) return 0; return QProxyStyle::styleHint(hint, option, widget, returnData); From 821134d31efd161d06dd21c0e2aa142632e5f7d6 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 21 Aug 2025 20:38:36 +0600 Subject: [PATCH 02/17] Start manager inside a timer callback --- src/qt/qt_main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 374b0f4fb..14eba06bf 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -635,8 +635,10 @@ main(int argc, char *argv[]) // QApplication::setApplicationDisplayName("86Box VM Manager"); // vmm.show(); // vmm.exec(); - const auto vmm_main_window = new VMManagerMainWindow(); - vmm_main_window->show(); + QTimer::singleShot(0, [] { + const auto vmm_main_window = new VMManagerMainWindow(); + vmm_main_window->show(); + }); QApplication::exec(); return 0; } From eb8ba6a4d8e593010410d020bdee8a5a40b6f7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:51:10 +0200 Subject: [PATCH 03/17] Little cleanup --- src/qt/qt_main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 200ef3b20..d35a09b45 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -625,9 +625,6 @@ main(int argc, char *argv[]) return 6; } - if (!start_vmm) - pc_init_modules(); - if (start_vmm) { // VMManagerMain vmm; // // Hackish until there is a proper solution @@ -641,6 +638,8 @@ main(int argc, char *argv[]) return 0; } + pc_init_modules(); + // UUID / copy / move detection if(!util::compareUuid()) { QMessageBox movewarnbox; From b37cb502ba223856d59ef63c983a5c2c80c44cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:51:36 +0200 Subject: [PATCH 04/17] Implement default VMM directory --- src/config.c | 8 +++++--- src/include/86box/plat.h | 1 + src/qt/qt_platform.cpp | 14 ++++++++++++++ src/unix/unix.c | 8 ++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 9856afc3b..a76a08126 100644 --- a/src/config.c +++ b/src/config.c @@ -143,8 +143,7 @@ load_global(void) if (p != NULL) strncpy(vmm_path, p, sizeof(vmm_path) - 1); else - // [todo] plat_vmm_path() - vmm_path[0] = 0; + plat_get_vmm_dir(vmm_path, sizeof(vmm_path)); } /* Load "General" section. */ @@ -2215,7 +2214,10 @@ save_global(void) else ini_section_delete_var(cat, "vmm_disabled"); - ini_section_set_string(cat, "vmm_path", vmm_path); + if (vmm_path[0] != 0) + ini_section_set_string(cat, "vmm_path", vmm_path); + else + ini_section_delete_var(cat, "vmm_path"); } /* Save "General" section. */ diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index ef06b3429..db3c4c14b 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -146,6 +146,7 @@ extern void plat_get_exe_name(char *s, int size); extern void plat_get_global_config_dir(char *outbuf, size_t len); extern void plat_get_global_data_dir(char *outbuf, size_t len); extern void plat_get_temp_dir(char *outbuf, uint8_t len); +extern void plat_get_vmm_dir(char *outbuf, uint8_t len); extern void plat_init_rom_paths(void); extern int plat_dir_check(char *path); extern int plat_dir_create(char *path); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index ee2e40d1d..74fe8249a 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -694,6 +694,20 @@ plat_get_temp_dir(char *outbuf, const uint8_t len) strncpy(outbuf, dir.canonicalPath().toUtf8().constData(), len); } +void +plat_get_vmm_dir(char *outbuf, const size_t len) +{ + const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0]).filePath("86Box VMs"); + + if (!dir.exists()) { + if (!dir.mkpath(".")) { + qWarning("Failed to create VMs directory %s", dir.absolutePath().toUtf8().constData()); + } + } + + strncpy(outbuf, dir.canonicalPath().toUtf8().constData(), len); +} + void plat_init_rom_paths(void) { diff --git a/src/unix/unix.c b/src/unix/unix.c index a28c4fc47..d35543548 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -901,6 +901,14 @@ plat_get_temp_dir(char *outbuf, uint8_t len) path_slash(outbuf); } +void +plat_get_vmm_dir(char *outbuf, const size_t len) +{ + // Return empty string. SDL 86Box does not have a VM manager + if (len > 0) + outbuf[0] = 0; +} + bool process_media_commands_3(uint8_t *id, char *fn, uint8_t *wp, int cmdargc) { From b111b6694996a2e4da70ff7fbd9d2d7c6ce61d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:57:02 +0200 Subject: [PATCH 05/17] Enable manager by default --- src/86box.c | 9 +-------- src/config.c | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/86box.c b/src/86box.c index bd5051968..a582e114e 100644 --- a/src/86box.c +++ b/src/86box.c @@ -219,7 +219,7 @@ int sound_muted = 0; /* (C) Is soun int jumpered_internal_ecp_dma = 0; /* (C) Jumpered internal EPC DMA */ int inhibit_multimedia_keys; /* (G) Inhibit multimedia keys on Windows. */ int force_10ms; /* (C) Force 10ms CPU frame intervals. */ -int vmm_disabled = -1; /* (G) disable built-in manager */ +int vmm_disabled = 0; /* (G) disable built-in manager */ int other_ide_present = 0; /* IDE controllers from non-IDE cards are present */ @@ -1097,13 +1097,6 @@ usage: config_load_global(); if (vmm_disabled && start_vmm) { -#ifdef DEPRECATE_USAGE - if (vmm_disabled < 0) { - pc_show_usage("Running 86Box without a specified VM path and/or configuration\n" - "file has been deprecated. Please specify one or use a manager\n" - "(Avalonia 86 is recommended).\n\n"); - } -#endif start_vmm = 0; } diff --git a/src/config.c b/src/config.c index a76a08126..b00579435 100644 --- a/src/config.c +++ b/src/config.c @@ -137,7 +137,7 @@ load_global(void) else if (mouse_sensitivity > 2.0) mouse_sensitivity = 2.0; - vmm_disabled = ini_section_get_int(cat, "vmm_disabled", -1); + vmm_disabled = ini_section_get_int(cat, "vmm_disabled", 0); p = ini_section_get_string(cat, "vmm_path", NULL); if (p != NULL) @@ -2209,7 +2209,7 @@ save_global(void) else ini_section_delete_var(cat, "mouse_sensitivity"); - if (vmm_disabled != -1) + if (vmm_disabled != 0) ini_section_set_int(cat, "vmm_disabled", vmm_disabled); else ini_section_delete_var(cat, "vmm_disabled"); From 341b1a52a6697aa177f59dcc6a68c26d3b8b1920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:17:52 +0200 Subject: [PATCH 06/17] Fix -E argument; add ifdefs for SDL --- src/86box.c | 32 ++++++++++++++++++++++---------- src/config.c | 8 ++++---- src/include/86box/86box.h | 1 + 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/86box.c b/src/86box.c index a582e114e..bac26ceb7 100644 --- a/src/86box.c +++ b/src/86box.c @@ -219,7 +219,8 @@ int sound_muted = 0; /* (C) Is soun int jumpered_internal_ecp_dma = 0; /* (C) Jumpered internal EPC DMA */ int inhibit_multimedia_keys; /* (G) Inhibit multimedia keys on Windows. */ int force_10ms; /* (C) Force 10ms CPU frame intervals. */ -int vmm_disabled = 0; /* (G) disable built-in manager */ +int vmm_disabled = 0; /* (G) disable built-in manager */ +char vmm_path_cfg[1024] = { '\0' }; /* (G) VMs path (unless -E is used)*/ int other_ide_present = 0; /* IDE controllers from non-IDE cards are present */ @@ -632,7 +633,7 @@ pc_show_usage(char *s) #ifdef _WIN32 "-D or --debug\t\t\t- force debug output logging\n" #endif -#if 1 +#ifndef USE_SDL_UI "-E or --vmmpath\t\t- vm manager path\n" #endif "-F or --fullscreen\t\t- start in fullscreen mode\n" @@ -773,7 +774,7 @@ usage: } else if (!strcasecmp(argv[c], "--debug") || !strcasecmp(argv[c], "-D")) { force_debug = 1; #endif -//#ifdef ENABLE_NG +#ifndef USE_SDL_UI } else if (!strcasecmp(argv[c], "--vmmpath") || !strcasecmp(argv[c], "-E")) { /* Using this variable for vm manager path @@ -784,7 +785,7 @@ usage: memcpy(vmm_path, vp, sizeof(vmm_path)); else memcpy(vmm_path, vp, strlen(vp) + 1); - //#endif +#endif } else if (!strcasecmp(argv[c], "--fullscreen") || !strcasecmp(argv[c], "-F")) { start_in_fullscreen = 1; } else if (!strcasecmp(argv[c], "--logfile") || !strcasecmp(argv[c], "-L")) { @@ -1088,19 +1089,30 @@ usage: pclog("# Global configuration file: %s\n", global_cfg_path); pclog("# Configuration file: %s\n#\n\n", cfg_path); - if (strlen(vmm_path) != 0) { - start_vmm = 1; - pclog("# VM Manager enabled. Path: %s\n", vmm_path); - } /* Load the global configuration file. */ config_load_global(); - if (vmm_disabled && start_vmm) { +#ifndef USE_SDL_UI + if (vmm_disabled) +#endif + { start_vmm = 0; } - if (!start_vmm) { +#ifndef USE_SDL_UI + if (strlen(vmm_path) != 0) { + /* -E specified on the command line. */ + start_vmm = 1; + } else { + strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path) - 1) + } + + if (start_vmm) { + pclog("# VM Manager enabled. Path: %s\n", vmm_path); + } else +#endif + { /* * We are about to read the configuration file, which MAY * put data into global variables (the hard- and floppy diff --git a/src/config.c b/src/config.c index b00579435..78e441b4d 100644 --- a/src/config.c +++ b/src/config.c @@ -141,9 +141,9 @@ load_global(void) p = ini_section_get_string(cat, "vmm_path", NULL); if (p != NULL) - strncpy(vmm_path, p, sizeof(vmm_path) - 1); + strncpy(vmm_path_cfg, p, sizeof(vmm_path_cfg) - 1); else - plat_get_vmm_dir(vmm_path, sizeof(vmm_path)); + plat_get_vmm_dir(vmm_path_cfg, sizeof(vmm_path_cfg)); } /* Load "General" section. */ @@ -2214,8 +2214,8 @@ save_global(void) else ini_section_delete_var(cat, "vmm_disabled"); - if (vmm_path[0] != 0) - ini_section_set_string(cat, "vmm_path", vmm_path); + if (vmm_path_cfg[0] != 0) + ini_section_set_string(cat, "vmm_path", vmm_path_cfg); else ini_section_delete_var(cat, "vmm_path"); } diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 9d902c85d..bde3dc2b5 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -186,6 +186,7 @@ extern int pit_mode; /* (C) force setting PIT mode */ extern int fm_driver; /* (C) select FM sound driver */ extern int hook_enabled; /* (C) Keyboard hook is enabled */ extern int vmm_disabled; /* (G) disable built-in manager */ +extern char vmm_path_cfg[1024]; /* (G) VMs path (unless -E is used) */ extern char exe_path[2048]; /* path (dir) of executable */ extern char usr_path[1024]; /* path (dir) of user data */ From bdaf1cbe55609ed96cd3131468cfd7df9656b231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:22:43 +0200 Subject: [PATCH 07/17] Fix build --- src/qt/qt_platform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 74fe8249a..8d0732dee 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -697,7 +697,7 @@ plat_get_temp_dir(char *outbuf, const uint8_t len) void plat_get_vmm_dir(char *outbuf, const size_t len) { - const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0]).filePath("86Box VMs"); + const auto dir = QDir(QDir::home().filePath("86Box VMs")); if (!dir.exists()) { if (!dir.mkpath(".")) { From 12a8229b906bde2a398ccd82330cec48cf85f063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:41:23 +0200 Subject: [PATCH 08/17] Fix build again --- src/86box.c | 2 +- src/qt/qt_platform.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/86box.c b/src/86box.c index bac26ceb7..9d0d95a70 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1105,7 +1105,7 @@ usage: /* -E specified on the command line. */ start_vmm = 1; } else { - strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path) - 1) + strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path) - 1); } if (start_vmm) { diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 8d0732dee..fb37e7507 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -697,7 +697,8 @@ plat_get_temp_dir(char *outbuf, const uint8_t len) void plat_get_vmm_dir(char *outbuf, const size_t len) { - const auto dir = QDir(QDir::home().filePath("86Box VMs")); + auto dir = QDir::home(); + dir.setPath("86Box VMs"); if (!dir.exists()) { if (!dir.mkpath(".")) { From 76fada4f06ff605d4bfa8c6d3c444d9f83937173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:43:42 +0200 Subject: [PATCH 09/17] And again --- src/include/86box/plat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index db3c4c14b..7b8a34857 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -146,7 +146,7 @@ extern void plat_get_exe_name(char *s, int size); extern void plat_get_global_config_dir(char *outbuf, size_t len); extern void plat_get_global_data_dir(char *outbuf, size_t len); extern void plat_get_temp_dir(char *outbuf, uint8_t len); -extern void plat_get_vmm_dir(char *outbuf, uint8_t len); +extern void plat_get_vmm_dir(char *outbuf, size_t len); extern void plat_init_rom_paths(void); extern int plat_dir_check(char *path); extern int plat_dir_create(char *path); From 1d97fd1274cf0494a68193beb61709d5d3f1d849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:14:33 +0200 Subject: [PATCH 10/17] Call load_global even with an empty config to populate default values --- src/config.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index 78e441b4d..7f4279a02 100644 --- a/src/config.c +++ b/src/config.c @@ -2023,12 +2023,10 @@ config_load_global(void) if (global == NULL) { global = ini_new(); - lang_id = plat_language_code(DEFAULT_LANGUAGE); - config_log("Global config file not present or invalid!\n"); - } else { - load_global(); } + + load_global(); } /* Load the specified or a default configuration file. */ From 37dfcf7b053450380c874a4e2fd911f1b776de65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:45:53 +0200 Subject: [PATCH 11/17] Fix VMs path --- src/qt/qt_platform.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index fb37e7507..d8aca89d4 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -697,16 +697,8 @@ plat_get_temp_dir(char *outbuf, const uint8_t len) void plat_get_vmm_dir(char *outbuf, const size_t len) { - auto dir = QDir::home(); - dir.setPath("86Box VMs"); - - if (!dir.exists()) { - if (!dir.mkpath(".")) { - qWarning("Failed to create VMs directory %s", dir.absolutePath().toUtf8().constData()); - } - } - - strncpy(outbuf, dir.canonicalPath().toUtf8().constData(), len); + const auto path = QDir::home().filePath("86Box VMs"); + strncpy(outbuf, path.toUtf8().constData(), len); } void From 1a84f452ee127cdee60f8ee78d090cbeef751ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:48:36 +0200 Subject: [PATCH 12/17] Fix logs --- src/86box.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/86box.c b/src/86box.c index 9d0d95a70..5f59dab7f 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1080,15 +1080,9 @@ usage: pclog("#\n# %ls v%ls logfile, created %s\n#\n", EMU_NAME_W, EMU_VERSION_FULL_W, temp); - pclog("# VM: %s\n#\n", vm_name); - pclog("# Emulator path: %s\n", exe_path); - pclog("# Userfiles path: %s\n", usr_path); - for (rom_path_t *rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { - pclog("# ROM path: %s\n", rom_path->path); - } + pclog("# Emulator path: %s\n", exe_path); pclog("# Global configuration file: %s\n", global_cfg_path); - pclog("# Configuration file: %s\n#\n\n", cfg_path); /* Load the global configuration file. */ config_load_global(); @@ -1108,11 +1102,19 @@ usage: strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path) - 1); } - if (start_vmm) { + if (start_vmm) { pclog("# VM Manager enabled. Path: %s\n", vmm_path); } else #endif { + pclog("# VM: %s\n#\n", vm_name); + pclog("# Configuration file: %s\n#\n\n", cfg_path); + pclog("# Userfiles path: %s\n", usr_path); + + for (rom_path_t *rom_path = &rom_paths; rom_path != NULL; rom_path = rom_path->next) { + pclog("# ROM path: %s\n", rom_path->path); + } + /* * We are about to read the configuration file, which MAY * put data into global variables (the hard- and floppy From 0ec66d5f8872bd95a3bb68c348452d007b4a4d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:49:09 +0200 Subject: [PATCH 13/17] Copy vmm_path to usr_path when manager is enabled --- src/86box.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/86box.c b/src/86box.c index 5f59dab7f..0b4dd4349 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1087,6 +1087,7 @@ usage: /* Load the global configuration file. */ config_load_global(); + /* Determine whether to start the VM manager. */ #ifndef USE_SDL_UI if (vmm_disabled) #endif @@ -1104,6 +1105,7 @@ usage: if (start_vmm) { pclog("# VM Manager enabled. Path: %s\n", vmm_path); + strncpy(usr_path, vmm_path, sizeof(usr_path) - 1); } else #endif { From 5e808ea7402a09a4ab417e8c687d69c9054b757b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:01:18 +0200 Subject: [PATCH 14/17] Save global config on load --- src/86box.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/86box.c b/src/86box.c index 0b4dd4349..fbccb4b79 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1086,6 +1086,7 @@ usage: /* Load the global configuration file. */ config_load_global(); + config_save_global(); // hack /* Determine whether to start the VM manager. */ #ifndef USE_SDL_UI From c9f907455bc02e9fc32c379672d8ecd4c792f761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:20:34 +0200 Subject: [PATCH 15/17] Hook up the system directory preference to `vmm_path_cfg` --- src/qt/qt_vmmanager_preferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_vmmanager_preferences.cpp b/src/qt/qt_vmmanager_preferences.cpp index b03c66aa4..cfc646df1 100644 --- a/src/qt/qt_vmmanager_preferences.cpp +++ b/src/qt/qt_vmmanager_preferences.cpp @@ -37,7 +37,7 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences) connect(ui->dirSelectButton, &QPushButton::clicked, this, &VMManagerPreferences::chooseDirectoryLocation); const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); - const auto configSystemDir = config->getStringValue("system_directory"); + const auto configSystemDir = vmm_path_cfg; if(!configSystemDir.isEmpty()) { // Prefer this one ui->systemDirectory->setText(configSystemDir); @@ -91,8 +91,8 @@ void VMManagerPreferences::accept() { const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); - config->setStringValue("system_directory", ui->systemDirectory->text()); + vmm_path_cfg = ui->systemDirectory->text(); lang_id = ui->comboBoxLanguage->currentData().toInt(); config_save_global(); From c63af8935112aa32fd177e6579f1fa2290e45944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:26:51 +0200 Subject: [PATCH 16/17] Fix build --- src/qt/qt_vmmanager_preferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_vmmanager_preferences.cpp b/src/qt/qt_vmmanager_preferences.cpp index cfc646df1..e5af6f714 100644 --- a/src/qt/qt_vmmanager_preferences.cpp +++ b/src/qt/qt_vmmanager_preferences.cpp @@ -37,7 +37,7 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences) connect(ui->dirSelectButton, &QPushButton::clicked, this, &VMManagerPreferences::chooseDirectoryLocation); const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); - const auto configSystemDir = vmm_path_cfg; + const auto configSystemDir = QString(vmm_path_cfg); if(!configSystemDir.isEmpty()) { // Prefer this one ui->systemDirectory->setText(configSystemDir); @@ -92,7 +92,7 @@ VMManagerPreferences::accept() { const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); - vmm_path_cfg = ui->systemDirectory->text(); + vmm_path_cfg = ui->systemDirectory->text().toUtf8().constData(); lang_id = ui->comboBoxLanguage->currentData().toInt(); config_save_global(); From ae2b4d7bb829a0b72bb26bc15b1ff53a973629ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:34:04 +0200 Subject: [PATCH 17/17] One more time --- src/qt/qt_vmmanager_preferences.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_preferences.cpp b/src/qt/qt_vmmanager_preferences.cpp index e5af6f714..91cbcb7fd 100644 --- a/src/qt/qt_vmmanager_preferences.cpp +++ b/src/qt/qt_vmmanager_preferences.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "qt_progsettings.hpp" #include "qt_vmmanager_preferences.hpp" @@ -92,7 +93,7 @@ VMManagerPreferences::accept() { const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); - vmm_path_cfg = ui->systemDirectory->text().toUtf8().constData(); + strncpy(vmm_path_cfg, ui->systemDirectory->text().toUtf8().constData(), sizeof(vmm_path_cfg) - 1); lang_id = ui->comboBoxLanguage->currentData().toInt(); config_save_global();