From 11a55708fb66e8fa1a65117741cbbab2eb4abfe8 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 21 Apr 2025 13:41:58 +0200 Subject: [PATCH] Made it compile as GUI again on Windows and made the help message a message box. --- CMakeLists.txt | 2 +- src/86box.c | 52 ++++++++++++++++++++++++++---------------------- src/qt/qt_ui.cpp | 9 ++++++++- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6ffa89e5..007c1ffd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ if(WIN32) # Default value for the `WIN32` target property, which specifies whether # to build the application for the Windows GUI or console subsystem - option(CMAKE_WIN32_EXECUTABLE "Build a Windows GUI executable" OFF) + option(CMAKE_WIN32_EXECUTABLE "Build a Windows GUI executable" ON) else() # Prefer dynamic builds everywhere else set(PREFER_STATIC OFF) diff --git a/src/86box.c b/src/86box.c index dae2d4ba5..cde98f5d8 100644 --- a/src/86box.c +++ b/src/86box.c @@ -666,40 +666,44 @@ usage: } } - printf("\nUsage: 86box [options] [cfg-file]\n\n"); - printf("Valid options are:\n\n"); - printf("-? or --help - show this information\n"); - printf("-C or --config path - set 'path' to be config file\n"); + ui_msgbox(MBX_INFO, L"\nUsage: 86box [options] [cfg-file]\n\n" + "Valid options are:\n\n" + "-? or --help\t\t\t- show this information\n" + "-C or --config path\t\t- set 'path' to be config file\n" #ifdef _WIN32 - printf("-D or --debug - force debug output logging\n"); + "-D or --debug\t\t\t- force debug output logging\n" #endif #if 0 - printf("-E or --nographic - forces the old behavior\n"); + "-E or --nographic\t\t- forces the old behavior\n" #endif - printf("-F or --fullscreen - start in fullscreen mode\n"); - printf("-G or --lang langid - start with specified language (e.g. en-US, or system)\n"); + "-F or --fullscreen\t\t- start in fullscreen mode\n" + "-G or --lang langid\t\t- start with specified language\n" + "\t\t\t\t (e.g. en-US, or system)\n" #ifdef _WIN32 - printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n"); + "-H or --hwnd id,hwnd\t\t- sends back the main dialog's hwnd\n" #endif - printf("-I or --image d:path - load 'path' as floppy image on drive d\n"); + "-I or --image d:path\t\t- load 'path' as floppy image on drive d\n" #ifdef USE_INSTRUMENT - printf("-J or --instrument name - set 'name' to be the profiling instrument\n"); + "-J or --instrument name\t- set 'name' to be the profiling instrument\n" #endif - printf("-L or --logfile path - set 'path' to be the logfile\n"); - printf("-M or --missing - dump missing machines and video cards\n"); - printf("-N or --noconfirm - do not ask for confirmation on quit\n"); - printf("-P or --vmpath path - set 'path' to be root for vm\n"); - printf("-R or --rompath path - set 'path' to be ROM path\n"); + "-L or --logfile pat\t\t- set 'path' to be the logfile\n" + "-M or --missing\t\t- dump missing machines and video cards\n" + "-N or --noconfirm\t\t- do not ask for confirmation on quit\n" + "-P or --vmpath path\t\t- set 'path' to be root for vm\n" + "-R or --rompath path\t\t- set 'path' to be ROM path\n" #ifndef USE_SDL_UI - printf("-S or --settings - show only the settings dialog\n"); + "-S or --settings\t\t\t- show only the settings dialog\n" #endif - printf("-T or --testmode - test mode: execute the test mode entry point on init/hard reset\n"); - printf("-V or --vmname name - overrides the name of the running VM\n"); - printf("-W or --nohook - disables keyboard hook (compatibility-only outside Windows)\n"); - printf("-X or --clear what - clears the 'what' (cmos/flash/both)\n"); - printf("-Y or --donothing - do not show any UI or run the emulation\n"); - printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n"); - printf("\nA config file can be specified. If none is, the default file will be used.\n"); + "-T or --testmode\t\t- test mode: execute the test mode entry\n" + "\t\t\t\t point on init/hard reset\n" + "-V or --vmname name\t\t- overrides the name of the running VM\n" + "-W or --nohook\t\t- disables keyboard hook\n" + "\t\t\t\t (compatibility-only outside Windows)\n" + "-X or --clear what\t\t- clears the 'what' (cmos/flash/both)\n" + "-Y or --donothing\t\t- do not show any UI or run the emulation\n" + "-Z or --lastvmpath\t\t- the last parameter is VM path rather\n" + "\t\t\t\t than config\n" + "\nA config file can be specified. If none is, the default file will be used.\n"); return 0; } else if (!strcasecmp(argv[c], "--lastvmpath") || !strcasecmp(argv[c], "-Z")) { lvmp = 1; diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index 57f8001dc..b4e8a5486 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -141,7 +141,14 @@ ui_msgbox_header(int flags, void *header, void *message) // any error in early init if (main_window == nullptr) { - QMessageBox msgBox(QMessageBox::Icon::Critical, hdr, msg); + auto msgicon = QMessageBox::Icon::Critical; + if (flags & MBX_INFO) + msgicon = QMessageBox::Icon::Information; + else if (flags & MBX_QUESTION) + msgicon = QMessageBox::Icon::Question; + else if (flags & MBX_WARNING) + msgicon = QMessageBox::Icon::Warning; + QMessageBox msgBox(msgicon, hdr, msg); msgBox.exec(); } else { // else scope it to main_window