Fix -E argument; add ifdefs for SDL

This commit is contained in:
David Hrdlička
2025-08-21 17:17:52 +02:00
committed by GitHub
parent b111b66949
commit 341b1a52a6
3 changed files with 27 additions and 14 deletions

View File

@@ -219,7 +219,8 @@ int sound_muted = 0; /* (C) Is soun
int jumpered_internal_ecp_dma = 0; /* (C) Jumpered internal EPC DMA */ int jumpered_internal_ecp_dma = 0; /* (C) Jumpered internal EPC DMA */
int inhibit_multimedia_keys; /* (G) Inhibit multimedia keys on Windows. */ int inhibit_multimedia_keys; /* (G) Inhibit multimedia keys on Windows. */
int force_10ms; /* (C) Force 10ms CPU frame intervals. */ 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 int other_ide_present = 0; /* IDE controllers from non-IDE cards are
present */ present */
@@ -632,7 +633,7 @@ pc_show_usage(char *s)
#ifdef _WIN32 #ifdef _WIN32
"-D or --debug\t\t\t- force debug output logging\n" "-D or --debug\t\t\t- force debug output logging\n"
#endif #endif
#if 1 #ifndef USE_SDL_UI
"-E or --vmmpath\t\t- vm manager path\n" "-E or --vmmpath\t\t- vm manager path\n"
#endif #endif
"-F or --fullscreen\t\t- start in fullscreen mode\n" "-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")) { } else if (!strcasecmp(argv[c], "--debug") || !strcasecmp(argv[c], "-D")) {
force_debug = 1; force_debug = 1;
#endif #endif
//#ifdef ENABLE_NG #ifndef USE_SDL_UI
} else if (!strcasecmp(argv[c], "--vmmpath") || } else if (!strcasecmp(argv[c], "--vmmpath") ||
!strcasecmp(argv[c], "-E")) { !strcasecmp(argv[c], "-E")) {
/* Using this variable for vm manager path /* Using this variable for vm manager path
@@ -784,7 +785,7 @@ usage:
memcpy(vmm_path, vp, sizeof(vmm_path)); memcpy(vmm_path, vp, sizeof(vmm_path));
else else
memcpy(vmm_path, vp, strlen(vp) + 1); memcpy(vmm_path, vp, strlen(vp) + 1);
//#endif #endif
} else if (!strcasecmp(argv[c], "--fullscreen") || !strcasecmp(argv[c], "-F")) { } else if (!strcasecmp(argv[c], "--fullscreen") || !strcasecmp(argv[c], "-F")) {
start_in_fullscreen = 1; start_in_fullscreen = 1;
} else if (!strcasecmp(argv[c], "--logfile") || !strcasecmp(argv[c], "-L")) { } 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("# Global configuration file: %s\n", global_cfg_path);
pclog("# Configuration file: %s\n#\n\n", 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. */ /* Load the global configuration file. */
config_load_global(); config_load_global();
if (vmm_disabled && start_vmm) { #ifndef USE_SDL_UI
if (vmm_disabled)
#endif
{
start_vmm = 0; 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 * We are about to read the configuration file, which MAY
* put data into global variables (the hard- and floppy * put data into global variables (the hard- and floppy

View File

@@ -141,9 +141,9 @@ load_global(void)
p = ini_section_get_string(cat, "vmm_path", NULL); p = ini_section_get_string(cat, "vmm_path", NULL);
if (p != NULL) if (p != NULL)
strncpy(vmm_path, p, sizeof(vmm_path) - 1); strncpy(vmm_path_cfg, p, sizeof(vmm_path_cfg) - 1);
else else
plat_get_vmm_dir(vmm_path, sizeof(vmm_path)); plat_get_vmm_dir(vmm_path_cfg, sizeof(vmm_path_cfg));
} }
/* Load "General" section. */ /* Load "General" section. */
@@ -2214,8 +2214,8 @@ save_global(void)
else else
ini_section_delete_var(cat, "vmm_disabled"); ini_section_delete_var(cat, "vmm_disabled");
if (vmm_path[0] != 0) if (vmm_path_cfg[0] != 0)
ini_section_set_string(cat, "vmm_path", vmm_path); ini_section_set_string(cat, "vmm_path", vmm_path_cfg);
else else
ini_section_delete_var(cat, "vmm_path"); ini_section_delete_var(cat, "vmm_path");
} }

View File

@@ -186,6 +186,7 @@ extern int pit_mode; /* (C) force setting PIT mode */
extern int fm_driver; /* (C) select FM sound driver */ extern int fm_driver; /* (C) select FM sound driver */
extern int hook_enabled; /* (C) Keyboard hook is enabled */ extern int hook_enabled; /* (C) Keyboard hook is enabled */
extern int vmm_disabled; /* (G) disable built-in manager */ 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 exe_path[2048]; /* path (dir) of executable */
extern char usr_path[1024]; /* path (dir) of user data */ extern char usr_path[1024]; /* path (dir) of user data */