Add global config toggle for built-in manager
This commit is contained in:
40
src/86box.c
40
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
|
||||
|
||||
16
src/config.c
16
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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user