Qt: Skip emulator-specific things on startup if starting in manager mode:
- Don't try to read 86box.cfg; - Don't initialize subsystems that aren't used in manager mode; - Ignore `-I` or `-X` command-line options; - Don't block keyboard navigation and mnemonics in menus; - Don't perform UUID/WinBox/cpu_override checks.
This commit is contained in:
75
src/86box.c
75
src/86box.c
@@ -1056,47 +1056,50 @@ usage:
|
|||||||
vmm_enabled = 1;
|
vmm_enabled = 1;
|
||||||
pclog("# VM Manager enabled. Path: %s\n", vmm_path);
|
pclog("# VM Manager enabled. Path: %s\n", vmm_path);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* We are about to read the configuration file, which MAY
|
|
||||||
* put data into global variables (the hard- and floppy
|
|
||||||
* disks are an example) so we have to initialize those
|
|
||||||
* modules before we load the config..
|
|
||||||
*/
|
|
||||||
hdd_init();
|
|
||||||
network_init();
|
|
||||||
mouse_init();
|
|
||||||
cdrom_global_init();
|
|
||||||
rdisk_global_init();
|
|
||||||
mo_global_init();
|
|
||||||
|
|
||||||
/* Initialize the keyboard accelerator list with default values */
|
if (!vmm_enabled) {
|
||||||
for (int x = 0; x < NUM_ACCELS; x++) {
|
/*
|
||||||
strcpy(acc_keys[x].name, def_acc_keys[x].name);
|
* We are about to read the configuration file, which MAY
|
||||||
strcpy(acc_keys[x].desc, def_acc_keys[x].desc);
|
* put data into global variables (the hard- and floppy
|
||||||
strcpy(acc_keys[x].seq, def_acc_keys[x].seq);
|
* disks are an example) so we have to initialize those
|
||||||
}
|
* modules before we load the config..
|
||||||
|
*/
|
||||||
|
hdd_init();
|
||||||
|
network_init();
|
||||||
|
mouse_init();
|
||||||
|
cdrom_global_init();
|
||||||
|
rdisk_global_init();
|
||||||
|
mo_global_init();
|
||||||
|
|
||||||
/* Load the configuration file. */
|
/* Initialize the keyboard accelerator list with default values */
|
||||||
config_load();
|
for (int x = 0; x < NUM_ACCELS; x++) {
|
||||||
|
strcpy(acc_keys[x].name, def_acc_keys[x].name);
|
||||||
|
strcpy(acc_keys[x].desc, def_acc_keys[x].desc);
|
||||||
|
strcpy(acc_keys[x].seq, def_acc_keys[x].seq);
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear the CMOS and/or BIOS flash file, if we were started with
|
/* Load the configuration file. */
|
||||||
the relevant parameter(s). */
|
config_load();
|
||||||
if (clear_cmos) {
|
|
||||||
delete_nvr_file(0);
|
|
||||||
clear_cmos = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clear_flash) {
|
/* Clear the CMOS and/or BIOS flash file, if we were started with
|
||||||
delete_nvr_file(1);
|
the relevant parameter(s). */
|
||||||
clear_flash = 0;
|
if (clear_cmos) {
|
||||||
}
|
delete_nvr_file(0);
|
||||||
|
clear_cmos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < FDD_NUM; i++) {
|
if (clear_flash) {
|
||||||
if (fn[i] != NULL) {
|
delete_nvr_file(1);
|
||||||
if (strlen(fn[i]) <= 511)
|
clear_flash = 0;
|
||||||
strncpy(floppyfns[i], fn[i], 511);
|
}
|
||||||
free(fn[i]);
|
|
||||||
fn[i] = NULL;
|
for (uint8_t i = 0; i < FDD_NUM; i++) {
|
||||||
|
if (fn[i] != NULL) {
|
||||||
|
if (strlen(fn[i]) <= 511)
|
||||||
|
strncpy(floppyfns[i], fn[i], 511);
|
||||||
|
free(fn[i]);
|
||||||
|
fn[i] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -561,13 +561,11 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qt_set_sequence_auto_mnemonic(false);
|
|
||||||
Q_INIT_RESOURCE(qt_resources);
|
Q_INIT_RESOURCE(qt_resources);
|
||||||
Q_INIT_RESOURCE(qt_translations);
|
Q_INIT_RESOURCE(qt_translations);
|
||||||
QSurfaceFormat fmt = QSurfaceFormat::defaultFormat();
|
QSurfaceFormat fmt = QSurfaceFormat::defaultFormat();
|
||||||
fmt.setSwapInterval(0);
|
fmt.setSwapInterval(0);
|
||||||
QSurfaceFormat::setDefaultFormat(fmt);
|
QSurfaceFormat::setDefaultFormat(fmt);
|
||||||
app.setStyle(new StyleOverride());
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
CocoaEventFilter cocoafilter;
|
CocoaEventFilter cocoafilter;
|
||||||
@@ -586,6 +584,10 @@ main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!vmm_enabled)
|
||||||
|
qt_set_sequence_auto_mnemonic(false);
|
||||||
|
app.setStyle(new StyleOverride());
|
||||||
|
|
||||||
bool startMaximized = window_remember && monitor_settings[0].mon_window_maximized;
|
bool startMaximized = window_remember && monitor_settings[0].mon_window_maximized;
|
||||||
fprintf(stderr, "Qt: version %s, platform \"%s\"\n", qVersion(), QApplication::platformName().toUtf8().data());
|
fprintf(stderr, "Qt: version %s, platform \"%s\"\n", qVersion(), QApplication::platformName().toUtf8().data());
|
||||||
ProgSettings::loadTranslators(&app);
|
ProgSettings::loadTranslators(&app);
|
||||||
@@ -619,6 +621,19 @@ main(int argc, char *argv[])
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vmm_enabled) {
|
||||||
|
// VMManagerMain vmm;
|
||||||
|
// // Hackish until there is a proper solution
|
||||||
|
// QApplication::setApplicationName("86Box VM Manager");
|
||||||
|
// QApplication::setApplicationDisplayName("86Box VM Manager");
|
||||||
|
// vmm.show();
|
||||||
|
// vmm.exec();
|
||||||
|
const auto vmm_main_window = new VMManagerMainWindow();
|
||||||
|
vmm_main_window->show();
|
||||||
|
QApplication::exec();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// UUID / copy / move detection
|
// UUID / copy / move detection
|
||||||
if(!util::compareUuid()) {
|
if(!util::compareUuid()) {
|
||||||
QMessageBox movewarnbox;
|
QMessageBox movewarnbox;
|
||||||
@@ -681,19 +696,6 @@ main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vmm_enabled) {
|
|
||||||
// VMManagerMain vmm;
|
|
||||||
// // Hackish until there is a proper solution
|
|
||||||
// QApplication::setApplicationName("86Box VM Manager");
|
|
||||||
// QApplication::setApplicationDisplayName("86Box VM Manager");
|
|
||||||
// vmm.show();
|
|
||||||
// vmm.exec();
|
|
||||||
const auto vmm_main_window = new VMManagerMainWindow();
|
|
||||||
vmm_main_window->show();
|
|
||||||
QApplication::exec();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DISCORD
|
#ifdef DISCORD
|
||||||
discord_load();
|
discord_load();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <86box/86box.h>
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
|
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
|
||||||
@@ -37,7 +41,7 @@ StyleOverride::styleHint(
|
|||||||
QStyleHintReturn *returnData) const
|
QStyleHintReturn *returnData) const
|
||||||
{
|
{
|
||||||
/* Disable using menu with alt key */
|
/* Disable using menu with alt key */
|
||||||
if (hint == QStyle::SH_MenuBar_AltKeyNavigation)
|
if (!vmm_enabled && (hint == QStyle::SH_MenuBar_AltKeyNavigation))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||||
|
|||||||
Reference in New Issue
Block a user