Added the --noconfirm/-N option to suppress the confirmation dialog box on quitting the emulator, closes #464.

This commit is contained in:
OBattler
2020-01-19 06:19:07 +01:00
parent f15e0268cf
commit cc9b3165b5
3 changed files with 30 additions and 15 deletions

View File

@@ -8,13 +8,13 @@
* *
* Main include file for the application. * Main include file for the application.
* *
* Version: @(#)86box.h 1.0.36 2019/12/05 * Version: @(#)86box.h 1.0.37 2020/01/19
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
*f Fred N. van Kempen, <decwiz@yahoo.com> *f Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2016-2019 Miran Grca. * Copyright 2016-2020 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen. * Copyright 2017-2020 Fred N. van Kempen.
*/ */
#ifndef EMU_86BOX_H #ifndef EMU_86BOX_H
# define EMU_86BOX_H # define EMU_86BOX_H
@@ -74,6 +74,7 @@ extern int force_debug; /* (O) force debug output */
extern int video_fps; /* (O) render speed in fps */ extern int video_fps; /* (O) render speed in fps */
#endif #endif
extern int settings_only; /* (O) show only the settings dialog */ extern int settings_only; /* (O) show only the settings dialog */
extern int no_quit_confirm; /* (O) do not ask for confirmation on quit */
#ifdef _WIN32 #ifdef _WIN32
extern uint64_t unique_id; extern uint64_t unique_id;
extern uint64_t source_hwnd; extern uint64_t source_hwnd;

View File

@@ -8,15 +8,15 @@
* *
* Main emulator module where most things are controlled. * Main emulator module where most things are controlled.
* *
* Version: @(#)pc.c 1.0.93 2019/12/05 * Version: @(#)pc.c 1.0.94 2020/01/19
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2008-2019 Sarah Walker. * Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2019 Miran Grca. * Copyright 2016-2020 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen. * Copyright 2017-2020 Fred N. van Kempen.
*/ */
#include <inttypes.h> #include <inttypes.h>
#include <stdarg.h> #include <stdarg.h>
@@ -95,6 +95,7 @@ int force_debug = 0; /* (O) force debug output */
int video_fps = RENDER_FPS; /* (O) render speed in fps */ int video_fps = RENDER_FPS; /* (O) render speed in fps */
#endif #endif
int settings_only = 0; /* (O) show only the settings dialog */ int settings_only = 0; /* (O) show only the settings dialog */
int no_quit_confirm = 0; /* (O) do not ask for confirmation on quit */
#ifdef _WIN32 #ifdef _WIN32
uint64_t unique_id = 0; uint64_t unique_id = 0;
uint64_t source_hwnd = 0; uint64_t source_hwnd = 0;
@@ -354,6 +355,7 @@ usage:
printf("-L or --logfile path - set 'path' to be the logfile\n"); printf("-L or --logfile path - set 'path' to be the logfile\n");
printf("-P or --vmpath path - set 'path' to be root for vm\n"); printf("-P or --vmpath path - set 'path' to be root for vm\n");
printf("-S or --settings - show only the settings dialog\n"); printf("-S or --settings - show only the settings dialog\n");
printf("-N or --noconfirm - do not ask for confirmation on quit\n");
#ifdef _WIN32 #ifdef _WIN32
printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n"); printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n");
#endif #endif
@@ -383,6 +385,9 @@ usage:
} else if (!wcscasecmp(argv[c], L"--settings") || } else if (!wcscasecmp(argv[c], L"--settings") ||
!wcscasecmp(argv[c], L"-S")) { !wcscasecmp(argv[c], L"-S")) {
settings_only = 1; settings_only = 1;
} else if (!wcscasecmp(argv[c], L"--noconfirm") ||
!wcscasecmp(argv[c], L"-N")) {
no_quit_confirm = 1;
#ifdef _WIN32 #ifdef _WIN32
} else if (!wcscasecmp(argv[c], L"--hwnd") || } else if (!wcscasecmp(argv[c], L"--hwnd") ||
!wcscasecmp(argv[c], L"-H")) { !wcscasecmp(argv[c], L"-H")) {

View File

@@ -8,16 +8,16 @@
* *
* user Interface module for WinAPI on Windows. * user Interface module for WinAPI on Windows.
* *
* Version: @(#)win_ui.c 1.0.45 2019/12/05 * Version: @(#)win_ui.c 1.0.46 2020/01/19
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2008-2019 Sarah Walker. * Copyright 2008-2020 Sarah Walker.
* Copyright 2016-2019 Miran Grca. * Copyright 2016-2020 Miran Grca.
* Copyright 2017-2019 Fred N. van Kempen. * Copyright 2017-2020 Fred N. van Kempen.
* Copyright 2019 GH Cao. * Copyright 2019,2020 GH Cao.
*/ */
#define UNICODE #define UNICODE
#include <windows.h> #include <windows.h>
@@ -333,7 +333,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_ACTION_EXIT: case IDM_ACTION_EXIT:
win_notify_dlg_open(); win_notify_dlg_open();
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); if (no_quit_confirm)
i = 0;
else
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) { if (i == 0) {
UnhookWindowsHookEx(hKeyboardHook); UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC); KillTimer(hwnd, TIMER_1SEC);
@@ -698,7 +701,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CLOSE: case WM_CLOSE:
win_notify_dlg_open(); win_notify_dlg_open();
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); if (no_quit_confirm)
i = 0;
else
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) { if (i == 0) {
UnhookWindowsHookEx(hKeyboardHook); UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC); KillTimer(hwnd, TIMER_1SEC);
@@ -744,7 +750,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (manager_wm) if (manager_wm)
break; break;
win_notify_dlg_open(); win_notify_dlg_open();
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); if (no_quit_confirm)
i = 0;
else
i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122);
if (i == 0) { if (i == 0) {
UnhookWindowsHookEx(hKeyboardHook); UnhookWindowsHookEx(hKeyboardHook);
KillTimer(hwnd, TIMER_1SEC); KillTimer(hwnd, TIMER_1SEC);